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
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
/* File: dialog_print_using_printer.cpp */ /* File: dialog_print_using_printer.cpp */
/****************************************/ /****************************************/
// Set this to 1 if you want to test PostScript printing under MSW.
#define wxTEST_POSTSCRIPT_IN_MSW 1
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -13,231 +11,185 @@ ...@@ -13,231 +11,185 @@
#include "program.h" #include "program.h"
#include "general.h" #include "general.h"
#include "eeschema_config.h"
#include <wx/dcps.h>
#include "dialog_print_using_printer_base.h" #include "dialog_print_using_printer_base.h"
#define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE // other option is wxPORTRAIT /**
#define WIDTH_MAX_VALUE 100 * Print schematic dialog.
#define WIDTH_MIN_VALUE 1 *
* Class derived from DIALOG_PRINT_USING_PRINTER_base created by wxFormBuilder
#define PRINTMODECOLOR_KEY wxT("PrintModeColor")
// static print data and page setup data, to remember settings during the
// session
static wxPrintData* g_PrintData;
// Variables locales
static int s_OptionPrintPage = 0;
static int s_Print_Black_and_White = true;
static bool s_Print_Frame_Ref = true;
/* Dialog to print schematic. Class derived from DIALOG_PRINT_USING_PRINTER_base
* created by wxFormBuilder
*/ */
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_base 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: public:
DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* parent ); DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent );
~DIALOG_PRINT_USING_PRINTER() {}; ~DIALOG_PRINT_USING_PRINTER() {};
WinEDA_SchematicFrame* GetParent() const;
private: private:
void OnCloseWindow( wxCloseEvent& event ); void OnCloseWindow( wxCloseEvent& event );
void OnInitDialog( wxInitDialogEvent& event ); void OnInitDialog( wxInitDialogEvent& event );
void OnPrintSetup( wxCommandEvent& event ); void OnPageSetup( wxCommandEvent& event );
void OnPrintPreview( wxCommandEvent& event ); void OnPrintPreview( wxCommandEvent& event );
void OnPrintButtonClick( wxCommandEvent& event ); void OnPrintButtonClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); } void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
void SetPenWidth();
bool Show( bool show ); // overload stock function
}; };
class EDA_Printout : public wxPrintout /**
* Custom print out for printing schematics.
*/
class SCH_PRINTOUT : public wxPrintout
{ {
public: private:
bool m_Print_Sheet_Ref; DIALOG_PRINT_USING_PRINTER* m_Parent;
public: public:
WinEDA_DrawFrame* m_Parent; SCH_PRINTOUT( DIALOG_PRINT_USING_PRINTER* aParent, const wxString& aTitle ) :
DIALOG_PRINT_USING_PRINTER* m_PrintFrame;
EDA_Printout( DIALOG_PRINT_USING_PRINTER* aPrint_frame,
WinEDA_DrawFrame* aParent,
const wxString& aTitle,
bool aPrint_ref ) :
wxPrintout( aTitle ) wxPrintout( aTitle )
{ {
m_PrintFrame = aPrint_frame; wxASSERT( aParent != NULL );
m_Parent = aParent;
m_Print_Sheet_Ref = aPrint_ref;
}
m_Parent = aParent;
}
bool OnPrintPage( int page ); bool OnPrintPage( int page );
bool HasPage( int page ); bool HasPage( int page );
bool OnBeginDocument( int startPage, int endPage ); bool OnBeginDocument( int startPage, int endPage );
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo );
int* selPageTo );
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 * Custom schematic print preview frame.
* Calls the print dialog for Eeschema
*/ */
void WinEDA_SchematicFrame::ToPrinter( wxCommandEvent& event ) class SCH_PREVIEW_FRAME : public wxPreviewFrame
{ {
if( g_PrintData == NULL ) // First call. creates print handlers public:
SCH_PREVIEW_FRAME( wxPrintPreview* aPreview, DIALOG_PRINT_USING_PRINTER* aParent,
const wxString& aTitle, const wxPoint& aPos = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize ) :
wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
{ {
g_PrintData = new wxPrintData(); }
if( !g_PrintData->Ok() ) DIALOG_PRINT_USING_PRINTER* GetParent()
{
return ( DIALOG_PRINT_USING_PRINTER* )wxWindow::GetParent();
}
void OnCloseWindow( wxCloseEvent& event )
{
if( !IsIconized() )
{ {
DisplayError( this, GetParent()->GetParent()->SetPreviewPosition( GetPosition() );
_( "Error initializing printer information." ) ); GetParent()->GetParent()->SetPreviewSize( GetSize() );
} }
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH );
g_PrintData->SetOrientation( DEFAULT_ORIENTATION_PAPER ); wxPreviewFrame::OnCloseWindow( event );
} }
DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this ); private:
DECLARE_CLASS( SCH_PREVIEW_FRAME )
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS( SCH_PREVIEW_FRAME )
};
frame->ShowModal();
frame->Destroy();
}
IMPLEMENT_CLASS( SCH_PREVIEW_FRAME, wxPreviewFrame )
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* parent ) : BEGIN_EVENT_TABLE( SCH_PREVIEW_FRAME, wxPreviewFrame )
DIALOG_PRINT_USING_PRINTER_base( parent ) EVT_CLOSE( SCH_PREVIEW_FRAME::OnCloseWindow )
{ END_EVENT_TABLE()
m_Parent = parent;
m_Config = wxGetApp().m_EDA_Config;
}
void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event )
{ {
SetFocus(); wxFileName fn;
DIALOG_PRINT_USING_PRINTER dlg( this );
if( m_Config ) dlg.ShowModal();
{
m_Config->Read( PRINTMODECOLOR_KEY, &s_Print_Black_and_White );
}
AddUnitSymbol( *m_TextPenWidth, g_DrawDefaultLineThickness );
m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UnitMetric, g_DrawDefaultLineThickness,
m_Parent->m_InternalUnits ) );
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
m_ModeColorOption->SetSelection( s_Print_Black_and_White ? 1 : 0 ); fn = g_RootSheet->m_AssociatedScreen->m_FileName;
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
if ( GetSizer() ) if( fn.GetFullName() != wxT( "noname.sch" ) )
{ {
GetSizer()->SetSizeHints(this); fn.SetExt( ProjectFileExtension );
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
} }
} }
/*************************************************/
bool DIALOG_PRINT_USING_PRINTER::Show( bool show ) DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ) :
/*************************************************/ DIALOG_PRINT_USING_PRINTER_BASE( aParent )
{ {
bool ret; wxASSERT( aParent != NULL );
if( show ) m_checkReference->SetValue( aParent->GetShowSheetReference() );
{ m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() );
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; WinEDA_SchematicFrame* DIALOG_PRINT_USING_PRINTER::GetParent() const
{
return ( WinEDA_SchematicFrame* ) wxWindow::GetParent();
} }
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
{ {
s_Print_Black_and_White = m_ModeColorOption->GetSelection(); WinEDA_SchematicFrame* parent = GetParent();
s_Print_Frame_Ref = m_Print_Sheet_Ref->GetValue();
SetPenWidth();
if( m_Config ) if ( GetSizer() )
GetSizer()->SetSizeHints( this );
if( parent->GetPrintDialogPosition() == wxDefaultPosition &&
parent->GetPrintDialogSize() == wxDefaultSize )
{ {
m_Config->Write( PRINTMODECOLOR_KEY, s_Print_Black_and_White ); Center();
}
else
{
SetPosition( parent->GetPrintDialogPosition() );
SetSize( parent->GetPrintDialogSize() );
} }
EndModal( 0 ); SetFocus();
} }
/* Get the new pen width value, and verify min et max value void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
* NOTE: g_PlotLine_Width is in internal units
*/
void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
{ {
g_DrawDefaultLineThickness = WinEDA_SchematicFrame* parent = GetParent();
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE ) if( !IsIconized() )
{ {
g_DrawDefaultLineThickness = WIDTH_MAX_VALUE; parent->SetPrintDialogPosition( GetPosition() );
parent->SetPrintDialogSize( GetSize() );
} }
if( g_DrawDefaultLineThickness < WIDTH_MIN_VALUE ) parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() );
{ parent->SetShowSheetReference( m_checkReference->IsChecked() );
g_DrawDefaultLineThickness = WIDTH_MIN_VALUE;
}
m_DialogPenWidth->SetValue( EndDialog( wxID_CANCEL );
ReturnStringFromValue( g_UnitMetric, g_DrawDefaultLineThickness,
m_Parent->m_InternalUnits ) );
} }
/* Open a dialog box for printer setup (printer options, page size ...) /* Open a dialog box for printer setup (printer options, page size ...)
*/ */
void DIALOG_PRINT_USING_PRINTER::OnPrintSetup( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
{ {
wxPrintDialogData printDialogData( *g_PrintData ); WinEDA_SchematicFrame* parent = GetParent();
if( printDialogData.Ok() ) wxPageSetupDialog pageSetupDialog( this, &parent->GetPageSetupData() );
{
wxPrintDialog printerDialog( this, &printDialogData );
printerDialog.ShowModal(); pageSetupDialog.ShowModal();
*g_PrintData = printerDialog.GetPrintDialogData().GetPrintData(); parent->GetPageSetupData() = pageSetupDialog.GetPageSetupDialogData();
}
else
{
DisplayError( this, _( "Printer error!" ) );
}
} }
...@@ -245,21 +197,16 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintSetup( wxCommandEvent& event ) ...@@ -245,21 +197,16 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintSetup( wxCommandEvent& event )
*/ */
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
{ {
wxSize WSize; WinEDA_SchematicFrame* parent = GetParent();
wxPoint WPos;
bool print_ref = m_Print_Sheet_Ref->GetValue();
s_Print_Black_and_White = m_ModeColorOption->GetSelection();
SetPenWidth();
s_OptionPrintPage = m_PagesOption->GetSelection(); parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() );
parent->SetShowSheetReference( m_checkReference->IsChecked() );
// Pass two printout objects: for preview, and possible printing. // Pass two printout objects: for preview, and possible printing.
wxString title = _("Preview"); wxString title = _( "Preview" );
wxPrintPreview* preview = wxPrintPreview* preview = new wxPrintPreview( new SCH_PRINTOUT( this, title ),
new wxPrintPreview( new EDA_Printout( this, m_Parent, title, print_ref ), new SCH_PRINTOUT( this, title ),
new EDA_Printout( this, m_Parent, title, print_ref ), &parent->GetPageSetupData().GetPrintData() );
g_PrintData );
if( preview == NULL ) if( preview == NULL )
{ {
...@@ -267,12 +214,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -267,12 +214,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
return; return;
} }
WPos = m_Parent->GetPosition( ); preview->SetZoom( 100 );
WSize = m_Parent->GetSize();
wxPreviewFrame* frame = new wxPreviewFrame( preview, this,
title, WPos, WSize );
SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title,
parent->GetPreviewPosition(),
parent->GetPreviewSize() );
frame->Initialize(); frame->Initialize();
frame->Show( true ); frame->Show( true );
} }
...@@ -280,107 +226,83 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -280,107 +226,83 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
{ {
bool print_ref = m_Print_Sheet_Ref->GetValue(); WinEDA_SchematicFrame* parent = GetParent();
s_Print_Black_and_White = m_ModeColorOption->GetSelection();
s_OptionPrintPage = 0;
if( m_PagesOption )
s_OptionPrintPage = m_PagesOption->GetSelection();
SetPenWidth();
wxPrintDialogData printDialogData( *g_PrintData ); parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() );
parent->SetShowSheetReference( m_checkReference->IsChecked() );
wxPrinter printer( &printDialogData ); wxPrintDialogData printDialogData( parent->GetPageSetupData().GetPrintData() );
printDialogData.SetMaxPage( g_RootSheet->CountSheets() );
wxString title = _("Preview"); if( g_RootSheet->CountSheets() > 1 )
EDA_Printout printout( this, m_Parent, title, print_ref ); printDialogData.EnablePageNumbers( true );
#if !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0) wxPrinter printer( &printDialogData );
wxDC* dc = printout.GetDC(); SCH_PRINTOUT printout( this, _( "Print Schematic" ) );
( (wxPostScriptDC*) dc )->SetResolution( 600 );
#endif
if( !printer.Print( this, &printout, true ) ) if( !printer.Print( this, &printout, true ) )
{ {
if( wxPrinter::GetLastError() == wxPRINTER_ERROR ) if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
DisplayError( this, _( "There was a problem printing." ) ); wxMessageBox( _( "An error occurred attempting to print the schematic." ),
return; _( "Printing" ), wxOK );
} }
else else
{ {
*g_PrintData = printer.GetPrintDialogData().GetPrintData(); parent->GetPageSetupData() = printer.GetPrintDialogData().GetPrintData();
} }
} }
bool EDA_Printout::OnPrintPage( int page ) bool SCH_PRINTOUT::OnPrintPage( int page )
{ {
wxString msg; wxString msg;
WinEDA_SchematicFrame* parent = m_Parent->GetParent();
msg.Printf( _( "Print page %d" ), page ); msg.Printf( _( "Print page %d" ), page );
m_Parent->AppendMsgPanel( msg, wxEmptyString, CYAN ); parent->ClearMsgPanel();
parent->AppendMsgPanel( msg, wxEmptyString, CYAN );
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SCREEN* oldscreen = screen;
SCH_SHEET_PATH* oldsheetpath = schframe->GetSheet();
SCH_SCREEN* screen = parent->GetScreen();
SCH_SCREEN* oldscreen = screen;
SCH_SHEET_PATH* oldsheetpath = parent->GetSheet();
SCH_SHEET_PATH list;
SCH_SHEET_LIST SheetList( NULL );
SCH_SHEET_PATH* sheetpath = SheetList.GetSheet( page - 1 );
SCH_SHEET_PATH list; if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
if( s_OptionPrintPage == 1 )
{ {
/* Print all pages, so when called, the page is not the current page. parent->m_CurrentSheet = &list;
* We must select it and setup references and others parameters parent->m_CurrentSheet->UpdateAllScreenReferences();
* because in complex hierarchies a SCH_SCREEN (a schematic drawings) parent->SetSheetNumberAndCount();
* is shared between many sheets screen = parent->m_CurrentSheet->LastScreen();
*/ }
SCH_SHEET_LIST SheetList( NULL ); else
SCH_SHEET_PATH* sheetpath = SheetList.GetSheet( page - 1 ); {
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) screen = NULL;
{
schframe->m_CurrentSheet = &list;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
screen = schframe->m_CurrentSheet->LastScreen();
}
else
screen = NULL;
} }
if( screen == NULL ) if( screen == NULL )
return false; return false;
ActiveScreen = screen; ActiveScreen = screen;
DrawPage(); DrawPage();
ActiveScreen = oldscreen; ActiveScreen = oldscreen;
schframe->m_CurrentSheet = oldsheetpath; parent->m_CurrentSheet = oldsheetpath;
schframe->m_CurrentSheet->UpdateAllScreenReferences(); parent->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount(); parent->SetSheetNumberAndCount();
return true; return true;
} }
void EDA_Printout::GetPageInfo( int* minPage, int* maxPage, void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage,
int* selPageFrom, int* selPageTo ) int* selPageFrom, int* selPageTo )
{ {
int ii = 1; *minPage = *selPageFrom = 1;
*maxPage = *selPageTo = g_RootSheet->CountSheets();
*minPage = 1;
*selPageFrom = 1;
if( s_OptionPrintPage == 1 )
{
ii = g_RootSheet->CountSheets();
}
*maxPage = ii;
*selPageTo = ii;
} }
bool EDA_Printout::HasPage( int pageNum ) bool SCH_PRINTOUT::HasPage( int pageNum )
{ {
int pageCount; int pageCount;
...@@ -392,11 +314,24 @@ bool EDA_Printout::HasPage( int pageNum ) ...@@ -392,11 +314,24 @@ bool EDA_Printout::HasPage( int pageNum )
} }
bool EDA_Printout::OnBeginDocument( int startPage, int endPage ) bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
{ {
if( !wxPrintout::OnBeginDocument( startPage, endPage ) ) if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
return false; return false;
WinEDA_SchematicFrame* parent = m_Parent->GetParent();
wxLogDebug( wxT( "Printer name: " ) +
parent->GetPageSetupData().GetPrintData().GetPrinterName() );
wxLogDebug( wxT( "Paper ID: %d" ),
parent->GetPageSetupData().GetPrintData().GetPaperId() );
wxLogDebug( wxT( "Color: %d" ),
(int) parent->GetPageSetupData().GetPrintData().GetColour() );
wxLogDebug( wxT( "Monochrome: %d" ), parent->GetPrintMonochrome() );
wxLogDebug( wxT( "Orientation: %d:" ),
parent->GetPageSetupData().GetPrintData().GetOrientation() );
wxLogDebug( wxT( "Quality: %d"),
parent->GetPageSetupData().GetPrintData().GetQuality() );
return true; return true;
} }
...@@ -404,77 +339,80 @@ bool EDA_Printout::OnBeginDocument( int startPage, int endPage ) ...@@ -404,77 +339,80 @@ bool EDA_Printout::OnBeginDocument( int startPage, int endPage )
/* /*
* This is the real print function: print the active screen * This is the real print function: print the active screen
*/ */
void EDA_Printout::DrawPage() void SCH_PRINTOUT::DrawPage()
{ {
int tmpzoom; int oldZoom;
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxSize PageSize_in_mm; wxSize SheetSize; // Page size in internal units
wxSize SheetSize; // Page size in internal units wxPoint old_org;
wxSize PlotAreaSize; // plot area size in pixels EDA_Rect oldClipBox;
double scaleX, scaleY, scale; wxRect fitRect;
wxPoint old_org; wxDC* dc = GetDC();
wxPoint DrawOffset; WinEDA_SchematicFrame* parent = m_Parent->GetParent();
double DrawZoom = 1; WinEDA_DrawPanel* panel = parent->DrawPanel;
wxDC* dc = GetDC();
wxBusyCursor dummy; wxBusyCursor dummy;
GetPageSizeMM( &PageSize_in_mm.x, &PageSize_in_mm.y ); /* Save current scale factor, offsets, and clip box. */
/* Save old draw scale and draw offset */
tmp_startvisu = ActiveScreen->m_StartVisu; tmp_startvisu = ActiveScreen->m_StartVisu;
tmpzoom = ActiveScreen->GetZoom(); oldZoom = ActiveScreen->GetZoom();
old_org = ActiveScreen->m_DrawOrg; old_org = ActiveScreen->m_DrawOrg;
/* Change draw scale and offset to draw the whole page */ oldClipBox = panel->m_ClipBox;
ActiveScreen->SetScalingFactor( DrawZoom );
/* Change scale factor, offsets, and clip box to print the whole page. */
ActiveScreen->SetScalingFactor( 1.0 );
ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0; ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0;
ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0; ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0;
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch bool printReference = parent->GetShowSheetReference();
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels
// Get the size of the DC in pixels
dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y );
// Calculate a suitable scaling factor
scaleX = (double) SheetSize.x / PlotAreaSize.x;
scaleY = (double) SheetSize.y / PlotAreaSize.y;
scale = wxMax( scaleX, scaleY ); // Use x or y scaling factor, whichever
// fits on the DC
// adjust the real draw scale if( printReference )
dc->SetUserScale( DrawZoom / scale, DrawZoom / scale ); {
/* Draw the page to a memory and let the dc calculate the drawing
* limits.
*/
wxBitmap psuedoBitmap( 1, 1 );
wxMemoryDC memDC;
memDC.SelectObject( psuedoBitmap );
panel->PrintPage( &memDC, true, 0xFFFFFFFF, false, NULL );
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
SheetSize.x = memDC.MaxX() - memDC.MinX();
SheetSize.y = memDC.MaxY() - memDC.MinY();
FitThisSizeToPageMargins( SheetSize, parent->GetPageSetupData() );
fitRect = GetLogicalPageMarginsRect( parent->GetPageSetupData() );
}
else
{
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size;
FitThisSizeToPaper( SheetSize );
fitRect = GetLogicalPaperRect();
}
ActiveScreen->m_DrawOrg = DrawOffset; wxLogDebug( wxT( "Fit rectangle: %d, %d, %d, %d" ),
fitRect.x, fitRect.y, fitRect.width, fitRect.height );
GRResetPenAndBrush( dc ); GRResetPenAndBrush( dc );
if( s_Print_Black_and_White )
GRForceBlackPen( true );
/* set Pen min width (not used now) */
SetPenMinWidth( 1 );
WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
BASE_SCREEN* screen = panel->GetScreen();
EDA_Rect tmp = panel->m_ClipBox;
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) ); if( parent->GetPrintMonochrome() )
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ); GRForceBlackPen( true );
screen->m_IsPrinting = true; ActiveScreen->m_IsPrinting = true;
int bg_color = g_DrawBgColor; int bg_color = g_DrawBgColor;
panel->PrintPage( dc, m_Print_Sheet_Ref, 0xFFFFFFFF, false, NULL ); panel->PrintPage( dc, printReference, 0xFFFFFFFF, false, NULL );
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
screen->m_IsPrinting = false; ActiveScreen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = oldClipBox;
SetPenMinWidth( 1 );
GRForceBlackPen( false ); GRForceBlackPen( false );
ActiveScreen->m_StartVisu = tmp_startvisu; ActiveScreen->m_StartVisu = tmp_startvisu;
ActiveScreen->m_DrawOrg = old_org; ActiveScreen->m_DrawOrg = old_org;
ActiveScreen->SetZoom( tmpzoom ); ActiveScreen->SetZoom( oldZoom );
} }
...@@ -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,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">DialogSVGPrint_base</property> <property name="name">dialog_print_schematic</property>
<property name="namespace"></property> <property name="namespace"></property>
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_PRINT_USING_PRINTER_base</property> <property name="name">DIALOG_PRINT_USING_PRINTER_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">336,268</property> <property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Print</property> <property name="title">Print</property>
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">12</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
...@@ -86,205 +86,32 @@ ...@@ -86,205 +86,32 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property> <property name="flag">wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Options:</property>
<property name="minimum_size"></property>
<property name="name">sbOptionsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Default Pen Size</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_TextPenWidth</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size">200,-1</property>
<property name="name">m_DialogPenWidth</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">Selection of the default pen thickness used to draw items, when their thickness is set to 0.</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="bg"></property>
<property name="checked">1</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_FRAME_SEL</property>
<property name="label">Print frame ref</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_Print_Sheet_Ref</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">Print (or not) the Frame references.</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="choices">&quot;Color&quot; &quot;Black and white&quot;</property> <property name="checked">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_PRINT_MODE</property> <property name="id">wxID_ANY</property>
<property name="label">Print Mode</property> <property name="label">Print sheet &amp;reference and title block</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_ModeColorOption</property> <property name="name">m_checkReference</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="selection">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip">Choose if you wand to draw the sheet like it appears on screen,&#x0A;or in black and white mode, better to print it when using black and white printers</property> <property name="tooltip">Print (or not) the Frame references.</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event> <event name="OnKeyDown"></event>
...@@ -301,7 +128,6 @@ ...@@ -301,7 +128,6 @@
<event name="OnMouseEvents"></event> <event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event> <event name="OnMouseWheel"></event>
<event name="OnPaint"></event> <event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event> <event name="OnRightDClick"></event>
<event name="OnRightDown"></event> <event name="OnRightDown"></event>
<event name="OnRightUp"></event> <event name="OnRightUp"></event>
...@@ -312,33 +138,32 @@ ...@@ -312,33 +138,32 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="choices">&quot;Current&quot; &quot;All&quot;</property> <property name="checked">0</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_PAGE_MODE</property> <property name="id">wxID_ANY</property>
<property name="label">Page Print</property> <property name="label">Print in &amp;black and white only</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_PagesOption</property> <property name="name">m_checkMonochrome</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event> <event name="OnKeyDown"></event>
...@@ -355,7 +180,6 @@ ...@@ -355,7 +180,6 @@
<event name="OnMouseEvents"></event> <event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event> <event name="OnMouseWheel"></event>
<event name="OnPaint"></event> <event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event> <event name="OnRightDClick"></event>
<event name="OnRightDown"></event> <event name="OnRightDown"></event>
<event name="OnRightUp"></event> <event name="OnRightUp"></event>
...@@ -367,8 +191,8 @@ ...@@ -367,8 +191,8 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">12</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property> <property name="flag">wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
...@@ -377,7 +201,7 @@ ...@@ -377,7 +201,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="bg"></property> <property name="bg"></property>
...@@ -387,11 +211,11 @@ ...@@ -387,11 +211,11 @@
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_PRINT_OPTIONS</property> <property name="id">wxID_ANY</property>
<property name="label">Page Options</property> <property name="label">Page Setup</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_buttonOption</property> <property name="name">m_buttonPageSetup</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
...@@ -401,7 +225,7 @@ ...@@ -401,7 +225,7 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnButtonClick">OnPrintSetup</event> <event name="OnButtonClick">OnPageSetup</event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
...@@ -439,7 +263,7 @@ ...@@ -439,7 +263,7 @@
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_PREVIEW</property> <property name="id">wxID_ANY</property>
<property name="label">Preview</property> <property name="label">Preview</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
...@@ -491,7 +315,7 @@ ...@@ -491,7 +315,7 @@
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_PRINT_ALL</property> <property name="id">wxID_ANY</property>
<property name="label">Print</property> <property name="label">Print</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
......
...@@ -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