Add MRU to image placement tools
(cherry picked from commit faa3829ad4
)
This commit is contained in:
parent
69bd4218f7
commit
23351b2046
|
@ -62,6 +62,7 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
|
||||||
m_lastTextOrientation( LABEL_SPIN_STYLE::RIGHT ),
|
m_lastTextOrientation( LABEL_SPIN_STYLE::RIGHT ),
|
||||||
m_lastTextBold( false ),
|
m_lastTextBold( false ),
|
||||||
m_lastTextItalic( false ),
|
m_lastTextItalic( false ),
|
||||||
|
m_mruPath( wxEmptyString ),
|
||||||
m_inPlaceSymbol( false ),
|
m_inPlaceSymbol( false ),
|
||||||
m_inPlaceImage( false ),
|
m_inPlaceImage( false ),
|
||||||
m_inSingleClickPlace( false ),
|
m_inSingleClickPlace( false ),
|
||||||
|
@ -489,7 +490,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 );
|
||||||
|
|
||||||
|
@ -510,6 +511,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( (wxPoint)cursorPos );
|
image = new SCH_BITMAP( (wxPoint)cursorPos );
|
||||||
|
|
|
@ -88,6 +88,7 @@ private:
|
||||||
LABEL_SPIN_STYLE m_lastTextOrientation;
|
LABEL_SPIN_STYLE m_lastTextOrientation;
|
||||||
bool m_lastTextBold;
|
bool m_lastTextBold;
|
||||||
bool m_lastTextItalic;
|
bool m_lastTextItalic;
|
||||||
|
wxString m_mruPath;
|
||||||
|
|
||||||
///< Re-entrancy guards
|
///< Re-entrancy guards
|
||||||
bool m_inPlaceSymbol;
|
bool m_inPlaceSymbol;
|
||||||
|
|
|
@ -89,7 +89,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;
|
||||||
|
@ -849,7 +850,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 );
|
||||||
|
|
||||||
|
@ -857,6 +858,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 ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -285,6 +285,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
|
||||||
wxPoint m_grid_origin;
|
wxPoint m_grid_origin;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue