Fix case-sensitive import using KiCad std
Fixes: lp:1832853 * https://bugs.launchpad.net/kicad/+bug/1832853
This commit is contained in:
parent
96935e0a7e
commit
79e2000af4
|
@ -29,25 +29,8 @@
|
|||
*/
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
/**
|
||||
* Format wildcard extension to support case sensitive file dialogs.
|
||||
*
|
||||
* The file extension wildcards of the GTK+ file dialog are case sensitive so using all lower
|
||||
* case characters means that only file extensions that are all lower case will show up in the
|
||||
* file dialog. The GTK+ file dialog does support regular expressions so the file extension
|
||||
* is converted to a regular expression ( sch -> [sS][cC][hH] ) when wxWidgets is built against
|
||||
* GTK+. Please make sure you call this function when adding new file wildcards.
|
||||
*
|
||||
* @note When calling wxFileDialog with a default file defined, make sure you include the
|
||||
* file extension along with the file name. Otherwise, on GTK+ builds, the file
|
||||
* dialog will append the wildcard regular expression as the file extension which is
|
||||
* surely not what you want.
|
||||
*
|
||||
* @param aWildcard is the extension part of the wild card.
|
||||
*
|
||||
* @return the build appropriate file dialog wildcard filter.
|
||||
*/
|
||||
static wxString formatWildcardExt( const wxString& aWildcard )
|
||||
|
||||
wxString formatWildcardExt( const wxString& aWildcard )
|
||||
{
|
||||
wxString wc;
|
||||
#if defined( __WXGTK__ )
|
||||
|
@ -68,6 +51,7 @@ static wxString formatWildcardExt( const wxString& aWildcard )
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
wxString AddFileExtListToFilter( const std::vector<std::string>& aExts )
|
||||
{
|
||||
if( aExts.size() == 0 )
|
||||
|
|
|
@ -69,6 +69,25 @@
|
|||
|
||||
wxString AddFileExtListToFilter( const std::vector<std::string>& aExts );
|
||||
|
||||
/**
|
||||
* Format wildcard extension to support case sensitive file dialogs.
|
||||
*
|
||||
* The file extension wildcards of the GTK+ file dialog are case sensitive so using all lower
|
||||
* case characters means that only file extensions that are all lower case will show up in the
|
||||
* file dialog. The GTK+ file dialog does support regular expressions so the file extension
|
||||
* is converted to a regular expression ( sch -> [sS][cC][hH] ) when wxWidgets is built against
|
||||
* GTK+. Please make sure you call this function when adding new file wildcards.
|
||||
*
|
||||
* @note When calling wxFileDialog with a default file defined, make sure you include the
|
||||
* file extension along with the file name. Otherwise, on GTK+ builds, the file
|
||||
* dialog will append the wildcard regular expression as the file extension which is
|
||||
* surely not what you want.
|
||||
*
|
||||
* @param aWildcard is the extension part of the wild card.
|
||||
*
|
||||
* @return the build appropriate file dialog wildcard filter.
|
||||
*/
|
||||
wxString formatWildcardExt( const wxString& aWildcard );
|
||||
|
||||
// Do NOT use wxString for these. wxStrings are not thread-safe, even when const. (For the
|
||||
// curious the UTF8 cacheing strategy puts iterators in a linked list. Insertion and removal
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
#include "graphics_import_plugin.h"
|
||||
#include "graphics_importer_buffer.h"
|
||||
|
||||
#include "dl_dxf.h"
|
||||
#include "dl_creationadapter.h"
|
||||
#include "wx/wx.h"
|
||||
#include <dl_creationadapter.h>
|
||||
#include <dl_dxf.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
class BOARD;
|
||||
|
@ -146,10 +148,7 @@ public:
|
|||
|
||||
const wxArrayString GetFileExtensions() const override
|
||||
{
|
||||
wxArrayString list;
|
||||
list.Add( "dxf" );
|
||||
list.Add( "DXF" );
|
||||
return list;
|
||||
return wxArrayString( 1, formatWildcardExt( "dxf" ) );
|
||||
}
|
||||
|
||||
bool Load( const wxString& aFileName ) override;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* @author Janito V. Ferreira Filho <janito.vff@gmail.com>
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -26,12 +26,13 @@
|
|||
#ifndef SVG_IMPORT_PLUGIN_H
|
||||
#define SVG_IMPORT_PLUGIN_H
|
||||
|
||||
#include "vector"
|
||||
|
||||
#include "nanosvg.h"
|
||||
|
||||
#include "graphics_import_plugin.h"
|
||||
#include <math/vector2d.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
class SVG_IMPORT_PLUGIN : public GRAPHICS_IMPORT_PLUGIN
|
||||
|
@ -44,10 +45,8 @@ public:
|
|||
|
||||
const wxArrayString GetFileExtensions() const override
|
||||
{
|
||||
wxArrayString list;
|
||||
list.Add( "svg" );
|
||||
list.Add( "SVG" );
|
||||
return list;
|
||||
|
||||
return wxArrayString( 1, formatWildcardExt( "svg" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue