From e38949625b8b066286f7aeba0f9005ee31633b83 Mon Sep 17 00:00:00 2001 From: charras Date: Mon, 18 Jan 2010 17:05:31 +0000 Subject: [PATCH] print dialogs remember their position and size. --- eeschema/dialog_print_using_printer.cpp | 33 +++++++++++++++++++++++ gerbview/dialog_print_using_printer.cpp | 32 ++++++++++++++++++++++ pcbnew/dialog_print_using_printer.cpp | 36 +++++++++++++++++++++++++ 3 files changed, 101 insertions(+) diff --git a/eeschema/dialog_print_using_printer.cpp b/eeschema/dialog_print_using_printer.cpp index b219bd44c2..41fa2fa82a 100644 --- a/eeschema/dialog_print_using_printer.cpp +++ b/eeschema/dialog_print_using_printer.cpp @@ -43,6 +43,8 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base private: WinEDA_SchematicFrame* m_Parent; wxConfig* m_Config; + static wxPoint s_LastPos; + static wxSize s_LastSize; public: DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* parent ); @@ -56,6 +58,8 @@ private: void OnPrintButtonClick( wxCommandEvent& event ); void OnButtonCancelClick( wxCommandEvent& event ){ Close(); } void SetPenWidth(); + + bool Show( bool show ); // overload stock function }; @@ -89,6 +93,10 @@ public: 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 * Calls the print dialog for Eeschema @@ -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 ) { diff --git a/gerbview/dialog_print_using_printer.cpp b/gerbview/dialog_print_using_printer.cpp index ec0ea45376..e7aaee66c4 100644 --- a/gerbview/dialog_print_using_printer.cpp +++ b/gerbview/dialog_print_using_printer.cpp @@ -48,6 +48,8 @@ private: WinEDA_GerberFrame* m_Parent; wxConfig* m_Config; wxCheckBox* m_BoxSelectLayer[32]; + static wxPoint s_LastPos; + static wxSize s_LastSize; public: DIALOG_PRINT_USING_PRINTER( WinEDA_GerberFrame* parent ); @@ -64,12 +66,17 @@ private: void SetPrintParameters( ); void InitValues( ); + bool Show( bool show ); // overload stock function + public: bool IsMirrored() { return m_Print_Mirror->IsChecked(); } bool PrintUsingSinglePage() { return m_PagesOption->GetSelection(); } 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( ) 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() diff --git a/pcbnew/dialog_print_using_printer.cpp b/pcbnew/dialog_print_using_printer.cpp index 90d43d01d2..fbdb8b10da 100644 --- a/pcbnew/dialog_print_using_printer.cpp +++ b/pcbnew/dialog_print_using_printer.cpp @@ -47,6 +47,8 @@ private: wxConfig* m_Config; wxCheckBox* m_BoxSelectLayer[32]; static bool m_ExcludeEdgeLayer; + static wxPoint s_LastPos; + static wxSize s_LastSize; public: DIALOG_PRINT_USING_PRINTER( WinEDA_PcbFrame* parent ); @@ -63,6 +65,8 @@ private: void SetPenWidth(); void InitValues( ); + bool Show( bool show ); // overload stock function + public: bool IsMirrored() { return m_Print_Mirror->IsChecked(); } bool ExcludeEdges() { return m_Exclude_Edges_Pcb->IsChecked(); } @@ -71,6 +75,10 @@ public: }; 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 { GetSizer()->SetSizeHints( this ); } + + Center(); } @@ -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() /**************************************************************/