diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index d6a3fe7fa3..741918de1f 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -62,6 +62,7 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() : m_lastTextOrientation( LABEL_SPIN_STYLE::RIGHT ), m_lastTextBold( false ), m_lastTextItalic( false ), + m_mruPath( wxEmptyString ), m_inPlaceSymbol( false ), m_inPlaceImage( false ), m_inSingleClickPlace( false ), @@ -489,7 +490,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) // having an auto-pan EDA_RECT canvas_area = GetCanvasFreeAreaPixels(); - wxFileDialog dlg( m_frame, _( "Choose Image" ), wxEmptyString, wxEmptyString, + wxFileDialog dlg( m_frame, _( "Choose Image" ), m_mruPath, wxEmptyString, _( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(), wxFD_OPEN ); @@ -510,6 +511,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent ) cursorPos = controls->GetMousePosition( true ); wxString fullFilename = dlg.GetPath(); + m_mruPath = wxPathOnly( fullFilename ); if( wxFileExists( fullFilename ) ) image = new SCH_BITMAP( (wxPoint)cursorPos ); diff --git a/eeschema/tools/sch_drawing_tools.h b/eeschema/tools/sch_drawing_tools.h index 92a105ef3d..0c971bbe26 100644 --- a/eeschema/tools/sch_drawing_tools.h +++ b/eeschema/tools/sch_drawing_tools.h @@ -88,6 +88,7 @@ private: LABEL_SPIN_STYLE m_lastTextOrientation; bool m_lastTextBold; bool m_lastTextItalic; + wxString m_mruPath; ///< Re-entrancy guards bool m_inPlaceSymbol; diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 127201fd91..cdc05bfbd5 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -89,7 +89,8 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_propertiesFrameWidth( 200 ), m_originSelectBox( nullptr ), m_originSelectChoice( 0 ), - m_pageSelectBox( nullptr ) + m_pageSelectBox( nullptr ), + m_mruImagePath( wxEmptyString ) { m_maximizeByDefault = true; m_userUnits = EDA_UNITS::MILLIMETRES; @@ -849,7 +850,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType ) case DS_DATA_ITEM::DS_BITMAP: { - wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString, + wxFileDialog fileDlg( this, _( "Choose Image" ), m_mruImagePath, wxEmptyString, _( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(), wxFD_OPEN ); @@ -857,6 +858,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType ) return nullptr; wxString fullFilename = fileDlg.GetPath(); + m_mruImagePath = wxPathOnly( fullFilename ); if( !wxFileExists( fullFilename ) ) { diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h index 634d30af08..cf91ac092f 100644 --- a/pagelayout_editor/pl_editor_frame.h +++ b/pagelayout_editor/pl_editor_frame.h @@ -285,6 +285,7 @@ private: int m_originSelectChoice; // the last choice for m_originSelectBox wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages // useful when there are some items which are + wxString m_mruImagePath; // Most recently used path for placing a new image // only on page 1, not on page 1 wxPoint m_grid_origin; };