Make image file extension filtering case-insensitive

Replace wxImage::GetImageExtWildcard() with a new FILEEXT::ImageFileWildcard()
function that uses KiCad's formatWildcardExt() to generate case-insensitive
file patterns on GTK (e.g., [pP][nN][gG] instead of just png).

This allows selecting image files with uppercase extensions like .JPG or .PNG
in the Place Image dialogs across eeschema, pcbnew, pl_editor, and
bitmap2component.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21254
This commit is contained in:
Seth Hillbrand
2026-01-29 09:22:46 -08:00
parent 44e5ef0aa0
commit e480764577
6 changed files with 13 additions and 8 deletions
+1 -2
View File
@@ -399,8 +399,7 @@ void BITMAP2CMP_FRAME::OnLoadFile()
path = m_mruPath;
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
_( "Image Files" ) + wxS( " " )+ wxImage::GetImageExtWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
FILEEXT::ImageFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( fileDlg.ShowModal() != wxID_OK )
return;
+6
View File
@@ -570,6 +570,12 @@ wxString FILEEXT::JpegFileWildcard()
}
wxString FILEEXT::ImageFileWildcard()
{
return _( "Image files" ) + AddFileExtListToFilter( { "png", "jpg", "jpeg", "bmp", "gif" } );
}
wxString FILEEXT::HotkeyFileWildcard()
{
return _( "Hotkey file" ) + AddFileExtListToFilter( { HotkeyFileExtension } );
+2 -2
View File
@@ -70,7 +70,7 @@
#include <import_gfx/dialog_import_gfx_sch.h>
#include <sync_sheet_pin/sheet_synchronization_agent.h>
#include <string_utils.h>
//#include <wildcards_and_files_ext.h>
#include <wildcards_and_files_ext.h>
#include <wx/filedlg.h>
#include <wx/msgdlg.h>
@@ -1184,7 +1184,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( ACTIONS::selectionClear );
wxFileDialog dlg( m_frame, _( "Choose Image" ), m_mruPath, wxEmptyString,
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(), wxFD_OPEN );
FILEEXT::ImageFileWildcard(), wxFD_OPEN );
bool cancelled = false;
+1
View File
@@ -286,6 +286,7 @@ public:
static wxString WorkbookFileWildcard();
static wxString PngFileWildcard();
static wxString JpegFileWildcard();
static wxString ImageFileWildcard();
static wxString HotkeyFileWildcard();
static wxString JobsetFileWildcard();
+1 -2
View File
@@ -843,8 +843,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType )
case DS_DATA_ITEM::DS_BITMAP:
{
wxFileDialog fileDlg( this, _( "Choose Image" ), m_mruImagePath, wxEmptyString,
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
wxFD_OPEN );
FILEEXT::ImageFileWildcard(), wxFD_OPEN );
if( fileDlg.ShowModal() != wxID_OK )
return nullptr;
+2 -2
View File
@@ -56,6 +56,7 @@
#include <view/view.h>
#include <widgets/appearance_controls.h>
#include <widgets/wx_infobar.h>
#include <wildcards_and_files_ext.h>
#include <wx/filedlg.h>
#include <wx/msgdlg.h>
@@ -749,8 +750,7 @@ int DRAWING_TOOL::PlaceReferenceImage( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( ACTIONS::selectionClear );
wxFileDialog dlg( m_frame, _( "Choose Image" ), wxEmptyString, wxEmptyString,
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
wxFD_OPEN );
FILEEXT::ImageFileWildcard(), wxFD_OPEN );
bool cancelled = false;
RunMainStack(