print dialogs remember their position and size.

This commit is contained in:
charras 2010-01-18 17:05:31 +00:00
parent 82a7e0b0e5
commit e38949625b
3 changed files with 101 additions and 0 deletions

View File

@ -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 )
{

View File

@ -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()

View File

@ -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()
/**************************************************************/