Add MRU to image placement tools

This commit is contained in:
Seth Hillbrand 2022-02-25 13:18:43 -08:00
parent f6e303b72e
commit faa3829ad4
4 changed files with 9 additions and 3 deletions

View File

@ -66,6 +66,7 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
m_lastTextItalic( false ),
m_lastNetClassDirectiveItalic( true ),
m_lastFillStyle( FILL_T::NO_FILL ),
m_mruPath( wxEmptyString ),
m_inPlaceSymbol( false ),
m_inDrawShape( false ),
m_inPlaceImage( false ),
@ -494,7 +495,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 );
@ -515,6 +516,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( cursorPos );

View File

@ -91,6 +91,7 @@ private:
bool m_lastTextItalic;
bool m_lastNetClassDirectiveItalic;
FILL_T m_lastFillStyle;
wxString m_mruPath;
///< Re-entrancy guards
bool m_inPlaceSymbol;

View File

@ -83,7 +83,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;
@ -828,7 +829,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 );
@ -836,6 +837,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType )
return nullptr;
wxString fullFilename = fileDlg.GetPath();
m_mruImagePath = wxPathOnly( fullFilename );
if( !wxFileExists( fullFilename ) )
{

View File

@ -283,6 +283,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
VECTOR2I m_grid_origin;
};