Commit e3894962 authored by charras's avatar charras

print dialogs remember their position and size.

parent 82a7e0b0
...@@ -43,6 +43,8 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base ...@@ -43,6 +43,8 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base
private: private:
WinEDA_SchematicFrame* m_Parent; WinEDA_SchematicFrame* m_Parent;
wxConfig* m_Config; wxConfig* m_Config;
static wxPoint s_LastPos;
static wxSize s_LastSize;
public: public:
DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* parent ); DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* parent );
...@@ -56,6 +58,8 @@ private: ...@@ -56,6 +58,8 @@ private:
void OnPrintButtonClick( wxCommandEvent& event ); void OnPrintButtonClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); } void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
void SetPenWidth(); void SetPenWidth();
bool Show( bool show ); // overload stock function
}; };
...@@ -89,6 +93,10 @@ public: ...@@ -89,6 +93,10 @@ public:
void DrawPage(); void DrawPage();
}; };
// We want our dialog to remember its previous screen position
wxPoint DIALOG_PRINT_USING_PRINTER::s_LastPos( -1, -1 );
wxSize DIALOG_PRINT_USING_PRINTER::s_LastSize;
/* Virtual function /* Virtual function
* Calls the print dialog for Eeschema * Calls the print dialog for Eeschema
...@@ -147,6 +155,31 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) ...@@ -147,6 +155,31 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
} }
} }
/*************************************************/
bool DIALOG_PRINT_USING_PRINTER::Show( bool show )
/*************************************************/
{
bool ret;
if( show )
{
if( s_LastPos.x != -1 )
{
SetSize( s_LastPos.x, s_LastPos.y, s_LastSize.x, s_LastSize.y, 0 );
}
ret = DIALOG_PRINT_USING_PRINTER_base::Show( show );
}
else
{
// Save the dialog's position before hiding
s_LastPos = GetPosition();
s_LastSize = GetSize();
ret = DIALOG_PRINT_USING_PRINTER_base::Show( show );
}
return ret;
}
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
{ {
......
...@@ -48,6 +48,8 @@ private: ...@@ -48,6 +48,8 @@ private:
WinEDA_GerberFrame* m_Parent; WinEDA_GerberFrame* m_Parent;
wxConfig* m_Config; wxConfig* m_Config;
wxCheckBox* m_BoxSelectLayer[32]; wxCheckBox* m_BoxSelectLayer[32];
static wxPoint s_LastPos;
static wxSize s_LastSize;
public: public:
DIALOG_PRINT_USING_PRINTER( WinEDA_GerberFrame* parent ); DIALOG_PRINT_USING_PRINTER( WinEDA_GerberFrame* parent );
...@@ -64,12 +66,17 @@ private: ...@@ -64,12 +66,17 @@ private:
void SetPrintParameters( ); void SetPrintParameters( );
void InitValues( ); void InitValues( );
bool Show( bool show ); // overload stock function
public: public:
bool IsMirrored() { return m_Print_Mirror->IsChecked(); } bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
bool PrintUsingSinglePage() { return m_PagesOption->GetSelection(); } bool PrintUsingSinglePage() { return m_PagesOption->GetSelection(); }
int SetLayerMaskFromListSelection(); int SetLayerMaskFromListSelection();
}; };
// We want our dialog to remember its previous screen position
wxPoint DIALOG_PRINT_USING_PRINTER::s_LastPos( -1, -1 );
wxSize DIALOG_PRINT_USING_PRINTER::s_LastSize;
/*******************************************************/ /*******************************************************/
...@@ -209,6 +216,31 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -209,6 +216,31 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_FineAdjustYscaleOpt->SetValue( msg ); m_FineAdjustYscaleOpt->SetValue( msg );
} }
/*************************************************/
bool DIALOG_PRINT_USING_PRINTER::Show( bool show )
/*************************************************/
{
bool ret;
if( show )
{
if( s_LastPos.x != -1 )
{
SetSize( s_LastPos.x, s_LastPos.y, s_LastSize.x, s_LastSize.y, 0 );
}
ret = DIALOG_PRINT_USING_PRINTER_base::Show( show );
}
else
{
// Save the dialog's position before hiding
s_LastPos = GetPosition();
s_LastSize = GetSize();
ret = DIALOG_PRINT_USING_PRINTER_base::Show( show );
}
return ret;
}
/**************************************************************/ /**************************************************************/
int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
......
...@@ -47,6 +47,8 @@ private: ...@@ -47,6 +47,8 @@ private:
wxConfig* m_Config; wxConfig* m_Config;
wxCheckBox* m_BoxSelectLayer[32]; wxCheckBox* m_BoxSelectLayer[32];
static bool m_ExcludeEdgeLayer; static bool m_ExcludeEdgeLayer;
static wxPoint s_LastPos;
static wxSize s_LastSize;
public: public:
DIALOG_PRINT_USING_PRINTER( WinEDA_PcbFrame* parent ); DIALOG_PRINT_USING_PRINTER( WinEDA_PcbFrame* parent );
...@@ -63,6 +65,8 @@ private: ...@@ -63,6 +65,8 @@ private:
void SetPenWidth(); void SetPenWidth();
void InitValues( ); void InitValues( );
bool Show( bool show ); // overload stock function
public: public:
bool IsMirrored() { return m_Print_Mirror->IsChecked(); } bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
bool ExcludeEdges() { return m_Exclude_Edges_Pcb->IsChecked(); } bool ExcludeEdges() { return m_Exclude_Edges_Pcb->IsChecked(); }
...@@ -71,6 +75,10 @@ public: ...@@ -71,6 +75,10 @@ public:
}; };
bool DIALOG_PRINT_USING_PRINTER::m_ExcludeEdgeLayer; bool DIALOG_PRINT_USING_PRINTER::m_ExcludeEdgeLayer;
// We want our dialog to remember its previous screen position
wxPoint DIALOG_PRINT_USING_PRINTER::s_LastPos( -1, -1 );
wxSize DIALOG_PRINT_USING_PRINTER::s_LastSize;
...@@ -114,6 +122,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_PcbFrame* parent ...@@ -114,6 +122,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_PcbFrame* parent
{ {
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
} }
Center();
} }
...@@ -244,6 +254,32 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -244,6 +254,32 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
} }
/*************************************************/
bool DIALOG_PRINT_USING_PRINTER::Show( bool show )
/*************************************************/
{
bool ret;
if( show )
{
if( s_LastPos.x != -1 )
{
SetSize( s_LastPos.x, s_LastPos.y, s_LastSize.x, s_LastSize.y, 0 );
}
ret = DIALOG_PRINT_USING_PRINTER_base::Show( show );
}
else
{
// Save the dialog's position before hiding
s_LastPos = GetPosition();
s_LastSize = GetSize();
ret = DIALOG_PRINT_USING_PRINTER_base::Show( show );
}
return ret;
}
/**************************************************************/ /**************************************************************/
int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
/**************************************************************/ /**************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment