Commit 9a6f753c authored by stambaughw's avatar stambaughw

EESchema printing fixes and print dialog improvements.

* Remove unnecessary options from EESchema print dialog.
* Expose page setup dialog to fix page orientation problems on wxGTK.
* Added custom schematic print preview frame.
* Print dialog and preview frame remember size and position settings
  between sessions.
* Added monochrome and print sheet reference settings to project file.
parent 3e838053
This diff is collapsed.
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
...@@ -19,80 +19,56 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare ...@@ -19,80 +19,56 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
wxBoxSizer* bleftSizer; wxBoxSizer* bleftSizer;
bleftSizer = new wxBoxSizer( wxVERTICAL ); bleftSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbOptionsSizer; m_checkReference = new wxCheckBox( this, wxID_ANY, _("Print sheet &reference and title block"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); m_checkReference->SetValue(true);
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default Pen Size"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkReference->SetToolTip( _("Print (or not) the Frame references.") );
m_TextPenWidth->Wrap( -1 );
sbOptionsSizer->Add( m_TextPenWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DialogPenWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); bleftSizer->Add( m_checkReference, 0, wxALL, 5 );
m_DialogPenWidth->SetToolTip( _("Selection of the default pen thickness used to draw items, when their thickness is set to 0.") );
m_DialogPenWidth->SetMinSize( wxSize( 200,-1 ) );
sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_checkMonochrome = new wxCheckBox( this, wxID_ANY, _("Print in &black and white only"), wxDefaultPosition, wxDefaultSize, 0 );
m_Print_Sheet_Ref = new wxCheckBox( this, wxID_FRAME_SEL, _("Print frame ref"), wxDefaultPosition, wxDefaultSize, 0 ); bleftSizer->Add( m_checkMonochrome, 0, wxALL, 5 );
m_Print_Sheet_Ref->SetValue(true);
m_Print_Sheet_Ref->SetToolTip( _("Print (or not) the Frame references.") ); bMainSizer->Add( bleftSizer, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 12 );
sbOptionsSizer->Add( m_Print_Sheet_Ref, 0, wxALL, 5 );
bleftSizer->Add( sbOptionsSizer, 1, wxEXPAND|wxALL, 5 );
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString );
m_ModeColorOption = new wxRadioBox( this, wxID_PRINT_MODE, _("Print Mode"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ModeColorOption->SetSelection( 1 );
m_ModeColorOption->SetToolTip( _("Choose if you wand to draw the sheet like it appears on screen,\nor in black and white mode, better to print it when using black and white printers") );
bleftSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 );
wxString m_PagesOptionChoices[] = { _("Current"), _("All") };
int m_PagesOptionNChoices = sizeof( m_PagesOptionChoices ) / sizeof( wxString );
m_PagesOption = new wxRadioBox( this, wxID_PAGE_MODE, _("Page Print"), wxDefaultPosition, wxDefaultSize, m_PagesOptionNChoices, m_PagesOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PagesOption->SetSelection( 0 );
bleftSizer->Add( m_PagesOption, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bleftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer; wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL ); bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOption = new wxButton( this, wxID_PRINT_OPTIONS, _("Page Options"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonPageSetup = new wxButton( this, wxID_ANY, _("Page Setup"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonOption, 0, wxALL, 5 ); bbuttonsSizer->Add( m_buttonPageSetup, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
m_buttonPreview = new wxButton( this, wxID_PREVIEW, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonPreview = new wxButton( this, wxID_ANY, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPreview, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); bbuttonsSizer->Add( m_buttonPreview, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonPrint = new wxButton( this, wxID_PRINT_ALL, _("Print"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonPrint = new wxButton( this, wxID_ANY, _("Print"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPrint, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); bbuttonsSizer->Add( m_buttonPrint, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); bbuttonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bMainSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); bMainSizer->Add( bbuttonsSizer, 0, wxALL, 12 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnInitDialog ) ); this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnInitDialog ) );
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintSetup ), NULL, this ); m_buttonPageSetup->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this ); m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this ); m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnButtonCancelClick ), NULL, this ); m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnButtonCancelClick ), NULL, this );
} }
DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base() DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnInitDialog ) ); this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnInitDialog ) );
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintSetup ), NULL, this ); m_buttonPageSetup->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintPreview ), NULL, this ); m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnPrintButtonClick ), NULL, this ); m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnButtonCancelClick ), NULL, this ); m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnButtonCancelClick ), NULL, this );
} }
...@@ -11,44 +11,28 @@ ...@@ -11,44 +11,28 @@
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/checkbox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PRINT_USING_PRINTER_base /// Class DIALOG_PRINT_USING_PRINTER_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_PRINT_USING_PRINTER_base : public wxDialog class DIALOG_PRINT_USING_PRINTER_BASE : public wxDialog
{ {
private: private:
protected: protected:
enum wxCheckBox* m_checkReference;
{ wxCheckBox* m_checkMonochrome;
wxID_FRAME_SEL = 1000, wxButton* m_buttonPageSetup;
wxID_PRINT_MODE,
wxID_PAGE_MODE,
wxID_PRINT_OPTIONS,
wxID_PRINT_ALL,
};
wxStaticText* m_TextPenWidth;
wxTextCtrl* m_DialogPenWidth;
wxCheckBox* m_Print_Sheet_Ref;
wxRadioBox* m_ModeColorOption;
wxRadioBox* m_PagesOption;
wxButton* m_buttonOption;
wxButton* m_buttonPreview; wxButton* m_buttonPreview;
wxButton* m_buttonPrint; wxButton* m_buttonPrint;
wxButton* m_buttonQuit; wxButton* m_buttonQuit;
...@@ -56,15 +40,15 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog ...@@ -56,15 +40,15 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); } virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnPrintSetup( wxCommandEvent& event ){ event.Skip(); } virtual void OnPageSetup( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPrintPreview( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintPreview( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPrintButtonClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnPrintButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); }
public: public:
DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 336,268 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_USING_PRINTER_base(); ~DIALOG_PRINT_USING_PRINTER_BASE();
}; };
......
...@@ -261,6 +261,10 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetProjectFileParameters( void ) ...@@ -261,6 +261,10 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetProjectFileParameters( void )
&g_DefaultTextLabelSize, &g_DefaultTextLabelSize,
DEFAULT_SIZE_TEXT, 0, DEFAULT_SIZE_TEXT, 0,
1000 ) ); 1000 ) );
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "PrintMonochrome" ),
&m_printMonochrome, true ) );
m_projectFileParams.push_back( new PARAM_CFG_BOOL( wxT( "ShowSheetReferenceAndTitleBlock" ),
&m_showSheetReference, true ) );
return m_projectFileParams; return m_projectFileParams;
} }
...@@ -280,6 +284,7 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName, ...@@ -280,6 +284,7 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName,
fn = g_RootSheet->m_AssociatedScreen->m_FileName; fn = g_RootSheet->m_AssociatedScreen->m_FileName;
else else
fn = CfgFileName; fn = CfgFileName;
m_ComponentLibFiles.Clear(); m_ComponentLibFiles.Clear();
/* Change the schematic file extension (.sch) to the project file /* Change the schematic file extension (.sch) to the project file
...@@ -339,6 +344,14 @@ void WinEDA_SchematicFrame::SaveProjectFile( wxWindow* displayframe, bool askove ...@@ -339,6 +344,14 @@ void WinEDA_SchematicFrame::SaveProjectFile( wxWindow* displayframe, bool askove
static const wxString DefaultDrawLineWidthEntry( wxT( "DefaultDrawLineWidth" ) ); static const wxString DefaultDrawLineWidthEntry( wxT( "DefaultDrawLineWidth" ) );
static const wxString ShowHiddenPinsEntry( wxT( "ShowHiddenPins" ) ); static const wxString ShowHiddenPinsEntry( wxT( "ShowHiddenPins" ) );
static const wxString HorzVertLinesOnlyEntry( wxT( "HorizVertLinesOnly" ) ); static const wxString HorzVertLinesOnlyEntry( wxT( "HorizVertLinesOnly" ) );
static const wxString PreviewFramePositionXEntry( wxT( "PreviewFramePositionX" ) );
static const wxString PreviewFramePositionYEntry( wxT( "PreviewFramePositionY" ) );
static const wxString PreviewFrameWidthEntry( wxT( "PreviewFrameWidth" ) );
static const wxString PreviewFrameHeightEntry( wxT( "PreviewFrameHeight" ) );
static const wxString PrintDialogPositionXEntry( wxT( "PrintDialogPositionX" ) );
static const wxString PrintDialogPositionYEntry( wxT( "PrintDialogPositionY" ) );
static const wxString PrintDialogWidthEntry( wxT( "PrintDialogWidth" ) );
static const wxString PrintDialogHeightEntry( wxT( "PrintDialogHeight" ) );
/* /*
...@@ -437,6 +450,7 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void ) ...@@ -437,6 +450,7 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void )
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ), m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ),
&g_LayerDescr.LayerColor[LAYER_ERC_ERR], &g_LayerDescr.LayerColor[LAYER_ERC_ERR],
RED ) ); RED ) );
return m_configSettings; return m_configSettings;
} }
...@@ -448,6 +462,8 @@ void WinEDA_SchematicFrame::LoadSettings() ...@@ -448,6 +462,8 @@ void WinEDA_SchematicFrame::LoadSettings()
{ {
wxASSERT( wxGetApp().m_EDA_Config != NULL ); wxASSERT( wxGetApp().m_EDA_Config != NULL );
long tmp;
wxConfig* cfg = wxGetApp().m_EDA_Config; wxConfig* cfg = wxGetApp().m_EDA_Config;
WinEDA_DrawFrame::LoadSettings(); WinEDA_DrawFrame::LoadSettings();
...@@ -458,6 +474,23 @@ void WinEDA_SchematicFrame::LoadSettings() ...@@ -458,6 +474,23 @@ void WinEDA_SchematicFrame::LoadSettings()
(long) 6 ); (long) 6 );
cfg->Read( ShowHiddenPinsEntry, &m_ShowAllPins, false ); cfg->Read( ShowHiddenPinsEntry, &m_ShowAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true ); cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
m_previewPosition.x = (int) tmp;
cfg->Read( PreviewFramePositionYEntry, &tmp, -1 );
m_previewPosition.y = (int) tmp;
cfg->Read( PreviewFrameWidthEntry, &tmp, -1 );
m_previewSize.SetWidth( (int) tmp );
cfg->Read( PreviewFrameHeightEntry, &tmp, -1 );
m_previewSize.SetHeight( (int) tmp );
cfg->Read( PrintDialogPositionXEntry, &tmp, -1 );
m_printDialogPosition.x = (int) tmp;
cfg->Read( PrintDialogPositionYEntry, &tmp, -1 );
m_printDialogPosition.y = (int) tmp;
cfg->Read( PrintDialogWidthEntry, &tmp, -1 );
m_printDialogSize.SetWidth( (int) tmp );
cfg->Read( PrintDialogHeightEntry, &tmp, -1 );
m_printDialogSize.SetHeight( (int) tmp );
} }
...@@ -477,4 +510,14 @@ void WinEDA_SchematicFrame::SaveSettings() ...@@ -477,4 +510,14 @@ void WinEDA_SchematicFrame::SaveSettings()
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness ); cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness );
cfg->Write( ShowHiddenPinsEntry, m_ShowAllPins ); cfg->Write( ShowHiddenPinsEntry, m_ShowAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines ); cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x );
cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y );
cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() );
cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() );
cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x );
cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y );
cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() );
cfg->Write( PrintDialogHeightEntry, m_printDialogSize.GetHeight() );
} }
...@@ -57,21 +57,22 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -57,21 +57,22 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
wxMenu* openRecentMenu = new wxMenu(); wxMenu* openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu,
-1, _( "Open &Recent" ), -1, _( "Open &Recent" ),
_("Open a recent opened schematic project" ), _("Open a recent opened schematic project" ),
open_project_xpm ); open_project_xpm );
/* Separator */ /* Separator */
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
/* Save */ /* Save */
/* Save Project */ /* Save Project */
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save Whole Schematic Project\tCtrl+S" ), item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save Whole Schematic Project\tCtrl+S" ),
_( "Save all sheets in the schematic project" ) ); _( "Save all sheets in the schematic project" ) );
item->SetBitmap( save_project_xpm ); item->SetBitmap( save_project_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET, _( "&Save Current Sheet Only" ), item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET, _( "Save &Current Sheet Only" ),
_( "Save only current schematic sheet" ) ); _( "Save only current schematic sheet" ) );
item->SetBitmap( save_xpm ); item->SetBitmap( save_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
...@@ -87,8 +88,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -87,8 +88,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
/* Print */ /* Print */
item = new wxMenuItem( filesMenu, ID_GEN_PRINT, _( "P&rint\tCtrl+P" ), item = new wxMenuItem( filesMenu, wxID_PRINT, _( "P&rint\tCtrl+P" ),
_( "Print schematic sheet" ) ); _( "Print schematic" ) );
item->SetBitmap( print_button ); item->SetBitmap( print_button );
filesMenu->Append( item ); filesMenu->Append( item );
...@@ -131,7 +132,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -131,7 +132,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, choice_plot_fmt, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, choice_plot_fmt,
ID_GEN_PLOT, _( "&Plot" ), ID_GEN_PLOT, _( "&Plot" ),
_( "Plot schematic sheet in HPGL, PostScript or SVG format" ), plot_xpm ); _( "Plot schematic sheet in HPGL, PostScript or SVG format" ),
plot_xpm );
/* Quit on all platforms except WXMAC */ /* Quit on all platforms except WXMAC */
#if !defined(__WXMAC__) #if !defined(__WXMAC__)
...@@ -216,7 +218,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -216,7 +218,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
/* Zoom out */ /* Zoom out */
#if !defined( __WXMAC__) #if !defined( __WXMAC__)
text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_OUT ); HK_ZOOM_OUT );
#else #else
text = _( "Zoom Out\tCtrl+-" ); text = _( "Zoom Out\tCtrl+-" );
#endif /* !defined( __WXMAC__) */ #endif /* !defined( __WXMAC__) */
...@@ -229,7 +231,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -229,7 +231,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
/* Fit on screen */ /* Fit on screen */
#if !defined( __WXMAC__) #if !defined( __WXMAC__)
text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_AUTO ); HK_ZOOM_AUTO );
#else #else
text = _( "Fit on Screen\tCtrl+0" ); text = _( "Fit on Screen\tCtrl+0" );
#endif #endif
...@@ -245,7 +247,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -245,7 +247,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
/* Redraw view */ /* Redraw view */
#if !defined( __WXMAC__) #if !defined( __WXMAC__)
text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_REDRAW ); HK_ZOOM_REDRAW );
#else #else
text = _( "Redraw\tCtrl+R" ); text = _( "Redraw\tCtrl+R" );
#endif #endif
...@@ -323,7 +325,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -323,7 +325,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
/* Junction */ /* Junction */
item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, _( "Junction" ), item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, _( "Junction" ),
_( "Place junction" ), wxITEM_NORMAL ); _( "Place junction" ), wxITEM_NORMAL );
item->SetBitmap( add_junction_xpm ); item->SetBitmap( add_junction_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
...@@ -461,4 +463,3 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -461,4 +463,3 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
/* Associate the menu bar with the frame */ /* Associate the menu bar with the frame */
SetMenuBar( menuBar ); SetMenuBar( menuBar );
} }
...@@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) ...@@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_MENU( ID_SAVE_ONE_SHEET, WinEDA_SchematicFrame::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET, WinEDA_SchematicFrame::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET_AS, WinEDA_SchematicFrame::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET_AS, WinEDA_SchematicFrame::Save_File )
EVT_TOOL( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File ) EVT_TOOL( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File )
EVT_MENU( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter ) EVT_MENU( wxID_PRINT, WinEDA_SchematicFrame::OnPrint )
EVT_MENU( ID_GEN_PLOT_PS, WinEDA_SchematicFrame::ToPlot_PS ) EVT_MENU( ID_GEN_PLOT_PS, WinEDA_SchematicFrame::ToPlot_PS )
EVT_MENU( ID_GEN_PLOT_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL ) EVT_MENU( ID_GEN_PLOT_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print ) EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
...@@ -87,7 +87,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) ...@@ -87,7 +87,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
EVT_TOOL( wxID_REDO, EVT_TOOL( wxID_REDO,
WinEDA_SchematicFrame::GetSchematicFromRedoList ) WinEDA_SchematicFrame::GetSchematicFromRedoList )
EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate ) EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate )
EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter ) EVT_TOOL( wxID_PRINT, WinEDA_SchematicFrame::OnPrint )
EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc ) EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc )
EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist ) EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist )
EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials ) EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials )
...@@ -156,6 +156,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, ...@@ -156,6 +156,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
m_ViewlibFrame = NULL; // Frame for browsing component libraries m_ViewlibFrame = NULL; // Frame for browsing component libraries
m_DefaultSchematicFileName = wxT( "noname.sch" ); m_DefaultSchematicFileName = wxT( "noname.sch" );
m_ShowAllPins = false; m_ShowAllPins = false;
m_previewPosition = wxDefaultPosition;
m_previewSize = wxDefaultSize;
m_printMonochrome = true;
m_showSheetReference = true;
CreateScreens(); CreateScreens();
...@@ -186,6 +190,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, ...@@ -186,6 +190,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
ReCreateVToolbar(); ReCreateVToolbar();
ReCreateOptToolbar(); ReCreateOptToolbar();
/* Initialize print and page setup dialog settings. */
m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_HIGH );
m_pageSetupData.GetPrintData().SetOrientation( wxLANDSCAPE );
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
......
...@@ -80,7 +80,7 @@ void WinEDA_SchematicFrame::ReCreateHToolbar() ...@@ -80,7 +80,7 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
wxBitmap( redo_xpm ), msg ); wxBitmap( redo_xpm ), msg );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ), m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
_( "Print schematic" ) ); _( "Print schematic" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
......
...@@ -53,25 +53,32 @@ enum fl_rot_cmp ...@@ -53,25 +53,32 @@ enum fl_rot_cmp
class WinEDA_SchematicFrame : public WinEDA_DrawFrame class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{ {
public: public:
WinEDAChoiceBox* m_SelPartBox; WinEDAChoiceBox* m_SelPartBox;
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on. SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
int m_Multiflag; int m_Multiflag;
int m_NetlistFormat; int m_NetlistFormat;
bool m_ShowAllPins; bool m_ShowAllPins;
wxPoint m_OldPos; wxPoint m_OldPos;
WinEDA_LibeditFrame* m_LibeditFrame; WinEDA_LibeditFrame* m_LibeditFrame;
WinEDA_ViewlibFrame* m_ViewlibFrame; WinEDA_ViewlibFrame* m_ViewlibFrame;
wxString m_UserLibraryPath; wxString m_UserLibraryPath;
wxArrayString m_ComponentLibFiles; wxArrayString m_ComponentLibFiles;
private: private:
wxString m_DefaultSchematicFileName; wxString m_DefaultSchematicFileName;
SCH_FIELD* m_CurrentField; SCH_FIELD* m_CurrentField;
int m_TextFieldSize; int m_TextFieldSize;
bool m_ShowGrid; bool m_ShowGrid;
PARAM_CFG_ARRAY m_projectFileParams; PARAM_CFG_ARRAY m_projectFileParams;
PARAM_CFG_ARRAY m_configSettings; PARAM_CFG_ARRAY m_configSettings;
wxPageSetupDialogData m_pageSetupData;
wxPoint m_previewPosition;
wxSize m_previewSize;
wxPoint m_printDialogPosition;
wxSize m_printDialogSize;
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
bool m_showSheetReference;
public: public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_SchematicFrame( wxWindow* father,
...@@ -201,10 +208,30 @@ public: ...@@ -201,10 +208,30 @@ public:
*/ */
void SetSheetNumberAndCount(); void SetSheetNumberAndCount();
/** function ToPrinter /**
* Install the print dialog * Show the print dialog
*/ */
void ToPrinter( wxCommandEvent& event ); void OnPrint( wxCommandEvent& event );
wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
void SetPreviewPosition( const wxPoint& aPoint ) { m_previewPosition = aPoint; }
void SetPreviewSize( const wxSize& aSize ) { m_previewSize = aSize; }
const wxPoint& GetPreviewPosition() { return m_previewPosition; }
const wxSize& GetPreviewSize() { return m_previewSize; }
void SetPrintDialogPosition( const wxPoint& aPoint )
{
m_printDialogPosition = aPoint;
}
void SetPrintDialogSize( const wxSize& aSize ) { m_printDialogSize = aSize; }
const wxPoint& GetPrintDialogPosition() { return m_printDialogPosition; }
const wxSize& GetPrintDialogSize() { return m_printDialogSize; }
bool GetPrintMonochrome() { return m_printMonochrome; }
void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
bool GetShowSheetReference() { return m_showSheetReference; }
void SetShowSheetReference( bool aShow ) { m_showSheetReference = aShow; }
// Plot functions: // Plot functions:
void ToPlot_PS( wxCommandEvent& event ); void ToPlot_PS( wxCommandEvent& event );
......
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