Add MRU to image placement tools
This commit is contained in:
parent
f6e303b72e
commit
faa3829ad4
|
@ -66,6 +66,7 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
|
||||||
m_lastTextItalic( false ),
|
m_lastTextItalic( false ),
|
||||||
m_lastNetClassDirectiveItalic( true ),
|
m_lastNetClassDirectiveItalic( true ),
|
||||||
m_lastFillStyle( FILL_T::NO_FILL ),
|
m_lastFillStyle( FILL_T::NO_FILL ),
|
||||||
|
m_mruPath( wxEmptyString ),
|
||||||
m_inPlaceSymbol( false ),
|
m_inPlaceSymbol( false ),
|
||||||
m_inDrawShape( false ),
|
m_inDrawShape( false ),
|
||||||
m_inPlaceImage( false ),
|
m_inPlaceImage( false ),
|
||||||
|
@ -494,7 +495,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||||
// having an auto-pan
|
// having an auto-pan
|
||||||
EDA_RECT canvas_area = GetCanvasFreeAreaPixels();
|
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(),
|
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
|
||||||
wxFD_OPEN );
|
wxFD_OPEN );
|
||||||
|
|
||||||
|
@ -515,6 +516,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||||
cursorPos = controls->GetMousePosition( true );
|
cursorPos = controls->GetMousePosition( true );
|
||||||
|
|
||||||
wxString fullFilename = dlg.GetPath();
|
wxString fullFilename = dlg.GetPath();
|
||||||
|
m_mruPath = wxPathOnly( fullFilename );
|
||||||
|
|
||||||
if( wxFileExists( fullFilename ) )
|
if( wxFileExists( fullFilename ) )
|
||||||
image = new SCH_BITMAP( cursorPos );
|
image = new SCH_BITMAP( cursorPos );
|
||||||
|
|
|
@ -91,6 +91,7 @@ private:
|
||||||
bool m_lastTextItalic;
|
bool m_lastTextItalic;
|
||||||
bool m_lastNetClassDirectiveItalic;
|
bool m_lastNetClassDirectiveItalic;
|
||||||
FILL_T m_lastFillStyle;
|
FILL_T m_lastFillStyle;
|
||||||
|
wxString m_mruPath;
|
||||||
|
|
||||||
///< Re-entrancy guards
|
///< Re-entrancy guards
|
||||||
bool m_inPlaceSymbol;
|
bool m_inPlaceSymbol;
|
||||||
|
|
|
@ -83,7 +83,8 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_propertiesFrameWidth( 200 ),
|
m_propertiesFrameWidth( 200 ),
|
||||||
m_originSelectBox( nullptr ),
|
m_originSelectBox( nullptr ),
|
||||||
m_originSelectChoice( 0 ),
|
m_originSelectChoice( 0 ),
|
||||||
m_pageSelectBox( nullptr )
|
m_pageSelectBox( nullptr ),
|
||||||
|
m_mruImagePath( wxEmptyString )
|
||||||
{
|
{
|
||||||
m_maximizeByDefault = true;
|
m_maximizeByDefault = true;
|
||||||
m_userUnits = EDA_UNITS::MILLIMETRES;
|
m_userUnits = EDA_UNITS::MILLIMETRES;
|
||||||
|
@ -828,7 +829,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType )
|
||||||
|
|
||||||
case DS_DATA_ITEM::DS_BITMAP:
|
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(),
|
_( "Image Files" ) + wxS( " " ) + wxImage::GetImageExtWildcard(),
|
||||||
wxFD_OPEN );
|
wxFD_OPEN );
|
||||||
|
|
||||||
|
@ -836,6 +837,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
wxString fullFilename = fileDlg.GetPath();
|
wxString fullFilename = fileDlg.GetPath();
|
||||||
|
m_mruImagePath = wxPathOnly( fullFilename );
|
||||||
|
|
||||||
if( !wxFileExists( fullFilename ) )
|
if( !wxFileExists( fullFilename ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -283,6 +283,7 @@ private:
|
||||||
int m_originSelectChoice; // the last choice for m_originSelectBox
|
int m_originSelectChoice; // the last choice for m_originSelectBox
|
||||||
wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
|
wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
|
||||||
// useful when there are some items which are
|
// 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
|
// only on page 1, not on page 1
|
||||||
VECTOR2I m_grid_origin;
|
VECTOR2I m_grid_origin;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue