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.
This commit is contained in:
parent
3e838053aa
commit
9a6f753cac
|
@ -2,8 +2,6 @@
|
|||
/* 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 "appl_wxstruct.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -13,231 +11,185 @@
|
|||
|
||||
#include "program.h"
|
||||
#include "general.h"
|
||||
|
||||
#include <wx/dcps.h>
|
||||
#include "eeschema_config.h"
|
||||
|
||||
#include "dialog_print_using_printer_base.h"
|
||||
|
||||
|
||||
#define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE // other option is wxPORTRAIT
|
||||
#define WIDTH_MAX_VALUE 100
|
||||
#define WIDTH_MIN_VALUE 1
|
||||
|
||||
#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
|
||||
/**
|
||||
* Print schematic dialog.
|
||||
*
|
||||
* 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:
|
||||
DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* parent );
|
||||
DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent );
|
||||
~DIALOG_PRINT_USING_PRINTER() {};
|
||||
|
||||
WinEDA_SchematicFrame* GetParent() const;
|
||||
|
||||
private:
|
||||
void OnCloseWindow( wxCloseEvent& event );
|
||||
void OnInitDialog( wxInitDialogEvent& event );
|
||||
void OnPrintSetup( wxCommandEvent& event );
|
||||
void OnPageSetup( wxCommandEvent& event );
|
||||
void OnPrintPreview( wxCommandEvent& event );
|
||||
void OnPrintButtonClick( wxCommandEvent& event );
|
||||
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:
|
||||
bool m_Print_Sheet_Ref;
|
||||
private:
|
||||
DIALOG_PRINT_USING_PRINTER* m_Parent;
|
||||
|
||||
public:
|
||||
WinEDA_DrawFrame* m_Parent;
|
||||
DIALOG_PRINT_USING_PRINTER* m_PrintFrame;
|
||||
|
||||
EDA_Printout( DIALOG_PRINT_USING_PRINTER* aPrint_frame,
|
||||
WinEDA_DrawFrame* aParent,
|
||||
const wxString& aTitle,
|
||||
bool aPrint_ref ) :
|
||||
SCH_PRINTOUT( DIALOG_PRINT_USING_PRINTER* aParent, const wxString& aTitle ) :
|
||||
wxPrintout( aTitle )
|
||||
{
|
||||
m_PrintFrame = aPrint_frame;
|
||||
m_Parent = aParent;
|
||||
m_Print_Sheet_Ref = aPrint_ref;
|
||||
}
|
||||
wxASSERT( aParent != NULL );
|
||||
|
||||
m_Parent = aParent;
|
||||
}
|
||||
|
||||
bool OnPrintPage( int page );
|
||||
bool HasPage( int page );
|
||||
bool OnBeginDocument( int startPage, int endPage );
|
||||
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom,
|
||||
int* selPageTo );
|
||||
|
||||
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo );
|
||||
void DrawPage();
|
||||
};
|
||||
|
||||
// We want our dialog to remember its previous screen position
|
||||
wxPoint DIALOG_PRINT_USING_PRINTER::s_LastPos( -1, -1 );
|
||||
wxSize DIALOG_PRINT_USING_PRINTER::s_LastSize;
|
||||
|
||||
|
||||
/* Virtual function
|
||||
* Calls the print dialog for Eeschema
|
||||
/**
|
||||
* Custom schematic print preview frame.
|
||||
*/
|
||||
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() )
|
||||
{
|
||||
DisplayError( this,
|
||||
_( "Error initializing printer information." ) );
|
||||
}
|
||||
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH );
|
||||
g_PrintData->SetOrientation( DEFAULT_ORIENTATION_PAPER );
|
||||
}
|
||||
|
||||
DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this );
|
||||
DIALOG_PRINT_USING_PRINTER* GetParent()
|
||||
{
|
||||
return ( DIALOG_PRINT_USING_PRINTER* )wxWindow::GetParent();
|
||||
}
|
||||
|
||||
frame->ShowModal();
|
||||
frame->Destroy();
|
||||
void OnCloseWindow( wxCloseEvent& event )
|
||||
{
|
||||
if( !IsIconized() )
|
||||
{
|
||||
GetParent()->GetParent()->SetPreviewPosition( GetPosition() );
|
||||
GetParent()->GetParent()->SetPreviewSize( GetSize() );
|
||||
}
|
||||
|
||||
wxPreviewFrame::OnCloseWindow( event );
|
||||
}
|
||||
|
||||
private:
|
||||
DECLARE_CLASS( SCH_PREVIEW_FRAME )
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_NO_COPY_CLASS( SCH_PREVIEW_FRAME )
|
||||
};
|
||||
|
||||
|
||||
IMPLEMENT_CLASS( SCH_PREVIEW_FRAME, wxPreviewFrame )
|
||||
|
||||
BEGIN_EVENT_TABLE( SCH_PREVIEW_FRAME, wxPreviewFrame )
|
||||
EVT_CLOSE( SCH_PREVIEW_FRAME::OnCloseWindow )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn;
|
||||
DIALOG_PRINT_USING_PRINTER dlg( this );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
|
||||
if( fn.GetFullName() != wxT( "noname.sch" ) )
|
||||
{
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
wxGetApp().WriteProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* parent ) :
|
||||
DIALOG_PRINT_USING_PRINTER_base( parent )
|
||||
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ) :
|
||||
DIALOG_PRINT_USING_PRINTER_BASE( aParent )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_Config = wxGetApp().m_EDA_Config;
|
||||
wxASSERT( aParent != NULL );
|
||||
|
||||
m_checkReference->SetValue( aParent->GetShowSheetReference() );
|
||||
m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() );
|
||||
}
|
||||
|
||||
|
||||
WinEDA_SchematicFrame* DIALOG_PRINT_USING_PRINTER::GetParent() const
|
||||
{
|
||||
return ( WinEDA_SchematicFrame* ) wxWindow::GetParent();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
|
||||
{
|
||||
SetFocus();
|
||||
|
||||
if( m_Config )
|
||||
{
|
||||
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 );
|
||||
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
|
||||
WinEDA_SchematicFrame* parent = GetParent();
|
||||
|
||||
if ( GetSizer() )
|
||||
{
|
||||
GetSizer()->SetSizeHints(this);
|
||||
}
|
||||
}
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
/*************************************************/
|
||||
bool DIALOG_PRINT_USING_PRINTER::Show( bool show )
|
||||
/*************************************************/
|
||||
{
|
||||
bool ret;
|
||||
|
||||
if( show )
|
||||
if( parent->GetPrintDialogPosition() == wxDefaultPosition &&
|
||||
parent->GetPrintDialogSize() == wxDefaultSize )
|
||||
{
|
||||
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 );
|
||||
Center();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save the dialog's position before hiding
|
||||
s_LastPos = GetPosition();
|
||||
s_LastSize = GetSize();
|
||||
|
||||
ret = DIALOG_PRINT_USING_PRINTER_base::Show( show );
|
||||
SetPosition( parent->GetPrintDialogPosition() );
|
||||
SetSize( parent->GetPrintDialogSize() );
|
||||
}
|
||||
|
||||
return ret;
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
||||
{
|
||||
s_Print_Black_and_White = m_ModeColorOption->GetSelection();
|
||||
s_Print_Frame_Ref = m_Print_Sheet_Ref->GetValue();
|
||||
SetPenWidth();
|
||||
WinEDA_SchematicFrame* parent = GetParent();
|
||||
|
||||
if( m_Config )
|
||||
if( !IsIconized() )
|
||||
{
|
||||
m_Config->Write( PRINTMODECOLOR_KEY, s_Print_Black_and_White );
|
||||
parent->SetPrintDialogPosition( GetPosition() );
|
||||
parent->SetPrintDialogSize( GetSize() );
|
||||
}
|
||||
|
||||
EndModal( 0 );
|
||||
}
|
||||
parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() );
|
||||
parent->SetShowSheetReference( m_checkReference->IsChecked() );
|
||||
|
||||
|
||||
/* Get the new pen width value, and verify min et max value
|
||||
* NOTE: g_PlotLine_Width is in internal units
|
||||
*/
|
||||
void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
|
||||
{
|
||||
g_DrawDefaultLineThickness =
|
||||
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits );
|
||||
|
||||
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
|
||||
{
|
||||
g_DrawDefaultLineThickness = WIDTH_MAX_VALUE;
|
||||
}
|
||||
|
||||
if( g_DrawDefaultLineThickness < WIDTH_MIN_VALUE )
|
||||
{
|
||||
g_DrawDefaultLineThickness = WIDTH_MIN_VALUE;
|
||||
}
|
||||
|
||||
m_DialogPenWidth->SetValue(
|
||||
ReturnStringFromValue( g_UnitMetric, g_DrawDefaultLineThickness,
|
||||
m_Parent->m_InternalUnits ) );
|
||||
EndDialog( wxID_CANCEL );
|
||||
}
|
||||
|
||||
|
||||
/* 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() )
|
||||
{
|
||||
wxPrintDialog printerDialog( this, &printDialogData );
|
||||
wxPageSetupDialog pageSetupDialog( this, &parent->GetPageSetupData() );
|
||||
|
||||
printerDialog.ShowModal();
|
||||
pageSetupDialog.ShowModal();
|
||||
|
||||
*g_PrintData = printerDialog.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( this, _( "Printer error!" ) );
|
||||
}
|
||||
parent->GetPageSetupData() = pageSetupDialog.GetPageSetupDialogData();
|
||||
}
|
||||
|
||||
|
||||
|
@ -245,21 +197,16 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintSetup( wxCommandEvent& event )
|
|||
*/
|
||||
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
||||
{
|
||||
wxSize WSize;
|
||||
wxPoint WPos;
|
||||
bool print_ref = m_Print_Sheet_Ref->GetValue();
|
||||
WinEDA_SchematicFrame* parent = GetParent();
|
||||
|
||||
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.
|
||||
wxString title = _("Preview");
|
||||
wxPrintPreview* preview =
|
||||
new wxPrintPreview( new EDA_Printout( this, m_Parent, title, print_ref ),
|
||||
new EDA_Printout( this, m_Parent, title, print_ref ),
|
||||
g_PrintData );
|
||||
wxString title = _( "Preview" );
|
||||
wxPrintPreview* preview = new wxPrintPreview( new SCH_PRINTOUT( this, title ),
|
||||
new SCH_PRINTOUT( this, title ),
|
||||
&parent->GetPageSetupData().GetPrintData() );
|
||||
|
||||
if( preview == NULL )
|
||||
{
|
||||
|
@ -267,12 +214,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
WPos = m_Parent->GetPosition( );
|
||||
WSize = m_Parent->GetSize();
|
||||
|
||||
wxPreviewFrame* frame = new wxPreviewFrame( preview, this,
|
||||
title, WPos, WSize );
|
||||
preview->SetZoom( 100 );
|
||||
|
||||
SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title,
|
||||
parent->GetPreviewPosition(),
|
||||
parent->GetPreviewSize() );
|
||||
frame->Initialize();
|
||||
frame->Show( true );
|
||||
}
|
||||
|
@ -280,107 +226,83 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( 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();
|
||||
parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() );
|
||||
parent->SetShowSheetReference( m_checkReference->IsChecked() );
|
||||
|
||||
s_OptionPrintPage = 0;
|
||||
if( m_PagesOption )
|
||||
s_OptionPrintPage = m_PagesOption->GetSelection();
|
||||
wxPrintDialogData printDialogData( parent->GetPageSetupData().GetPrintData() );
|
||||
printDialogData.SetMaxPage( g_RootSheet->CountSheets() );
|
||||
|
||||
SetPenWidth();
|
||||
if( g_RootSheet->CountSheets() > 1 )
|
||||
printDialogData.EnablePageNumbers( true );
|
||||
|
||||
wxPrintDialogData printDialogData( *g_PrintData );
|
||||
|
||||
wxPrinter printer( &printDialogData );
|
||||
|
||||
wxString title = _("Preview");
|
||||
EDA_Printout printout( this, m_Parent, title, print_ref );
|
||||
|
||||
#if !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0)
|
||||
wxDC* dc = printout.GetDC();
|
||||
( (wxPostScriptDC*) dc )->SetResolution( 600 );
|
||||
#endif
|
||||
wxPrinter printer( &printDialogData );
|
||||
SCH_PRINTOUT printout( this, _( "Print Schematic" ) );
|
||||
|
||||
if( !printer.Print( this, &printout, true ) )
|
||||
{
|
||||
if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
|
||||
DisplayError( this, _( "There was a problem printing." ) );
|
||||
return;
|
||||
wxMessageBox( _( "An error occurred attempting to print the schematic." ),
|
||||
_( "Printing" ), wxOK );
|
||||
}
|
||||
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;
|
||||
|
||||
WinEDA_SchematicFrame* parent = m_Parent->GetParent();
|
||||
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( s_OptionPrintPage == 1 )
|
||||
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
||||
{
|
||||
/* Print all pages, so when called, the page is not the current page.
|
||||
* We must select it and setup references and others parameters
|
||||
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
||||
* is shared between many sheets
|
||||
*/
|
||||
SCH_SHEET_LIST SheetList( NULL );
|
||||
SCH_SHEET_PATH* sheetpath = SheetList.GetSheet( page - 1 );
|
||||
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
||||
{
|
||||
schframe->m_CurrentSheet = &list;
|
||||
schframe->m_CurrentSheet->UpdateAllScreenReferences();
|
||||
schframe->SetSheetNumberAndCount();
|
||||
screen = schframe->m_CurrentSheet->LastScreen();
|
||||
}
|
||||
else
|
||||
screen = NULL;
|
||||
parent->m_CurrentSheet = &list;
|
||||
parent->m_CurrentSheet->UpdateAllScreenReferences();
|
||||
parent->SetSheetNumberAndCount();
|
||||
screen = parent->m_CurrentSheet->LastScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
screen = NULL;
|
||||
}
|
||||
|
||||
if( screen == NULL )
|
||||
return false;
|
||||
|
||||
ActiveScreen = screen;
|
||||
DrawPage();
|
||||
ActiveScreen = oldscreen;
|
||||
schframe->m_CurrentSheet = oldsheetpath;
|
||||
schframe->m_CurrentSheet->UpdateAllScreenReferences();
|
||||
schframe->SetSheetNumberAndCount();
|
||||
parent->m_CurrentSheet = oldsheetpath;
|
||||
parent->m_CurrentSheet->UpdateAllScreenReferences();
|
||||
parent->SetSheetNumberAndCount();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void EDA_Printout::GetPageInfo( int* minPage, int* maxPage,
|
||||
void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage,
|
||||
int* selPageFrom, int* selPageTo )
|
||||
{
|
||||
int ii = 1;
|
||||
|
||||
*minPage = 1;
|
||||
*selPageFrom = 1;
|
||||
|
||||
if( s_OptionPrintPage == 1 )
|
||||
{
|
||||
ii = g_RootSheet->CountSheets();
|
||||
}
|
||||
|
||||
*maxPage = ii;
|
||||
*selPageTo = ii;
|
||||
*minPage = *selPageFrom = 1;
|
||||
*maxPage = *selPageTo = g_RootSheet->CountSheets();
|
||||
}
|
||||
|
||||
|
||||
bool EDA_Printout::HasPage( int pageNum )
|
||||
bool SCH_PRINTOUT::HasPage( int pageNum )
|
||||
{
|
||||
int pageCount;
|
||||
|
||||
|
@ -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 ) )
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -404,77 +339,80 @@ bool EDA_Printout::OnBeginDocument( int startPage, int endPage )
|
|||
/*
|
||||
* This is the real print function: print the active screen
|
||||
*/
|
||||
void EDA_Printout::DrawPage()
|
||||
void SCH_PRINTOUT::DrawPage()
|
||||
{
|
||||
int tmpzoom;
|
||||
wxPoint tmp_startvisu;
|
||||
wxSize PageSize_in_mm;
|
||||
wxSize SheetSize; // Page size in internal units
|
||||
wxSize PlotAreaSize; // plot area size in pixels
|
||||
double scaleX, scaleY, scale;
|
||||
wxPoint old_org;
|
||||
wxPoint DrawOffset;
|
||||
double DrawZoom = 1;
|
||||
wxDC* dc = GetDC();
|
||||
int oldZoom;
|
||||
wxPoint tmp_startvisu;
|
||||
wxSize SheetSize; // Page size in internal units
|
||||
wxPoint old_org;
|
||||
EDA_Rect oldClipBox;
|
||||
wxRect fitRect;
|
||||
wxDC* dc = GetDC();
|
||||
WinEDA_SchematicFrame* parent = m_Parent->GetParent();
|
||||
WinEDA_DrawPanel* panel = parent->DrawPanel;
|
||||
|
||||
wxBusyCursor dummy;
|
||||
|
||||
GetPageSizeMM( &PageSize_in_mm.x, &PageSize_in_mm.y );
|
||||
|
||||
/* Save old draw scale and draw offset */
|
||||
/* Save current scale factor, offsets, and clip box. */
|
||||
tmp_startvisu = ActiveScreen->m_StartVisu;
|
||||
tmpzoom = ActiveScreen->GetZoom();
|
||||
oldZoom = ActiveScreen->GetZoom();
|
||||
old_org = ActiveScreen->m_DrawOrg;
|
||||
/* Change draw scale and offset to draw the whole page */
|
||||
ActiveScreen->SetScalingFactor( DrawZoom );
|
||||
oldClipBox = panel->m_ClipBox;
|
||||
|
||||
/* 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_StartVisu.x = ActiveScreen->m_StartVisu.y = 0;
|
||||
|
||||
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
||||
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
|
||||
dc->SetUserScale( DrawZoom / scale, DrawZoom / scale );
|
||||
|
||||
ActiveScreen->m_DrawOrg = DrawOffset;
|
||||
|
||||
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 ) );
|
||||
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
|
||||
|
||||
screen->m_IsPrinting = true;
|
||||
bool printReference = parent->GetShowSheetReference();
|
||||
|
||||
if( printReference )
|
||||
{
|
||||
/* 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();
|
||||
}
|
||||
|
||||
wxLogDebug( wxT( "Fit rectangle: %d, %d, %d, %d" ),
|
||||
fitRect.x, fitRect.y, fitRect.width, fitRect.height );
|
||||
|
||||
GRResetPenAndBrush( dc );
|
||||
|
||||
if( parent->GetPrintMonochrome() )
|
||||
GRForceBlackPen( true );
|
||||
|
||||
ActiveScreen->m_IsPrinting = true;
|
||||
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;
|
||||
screen->m_IsPrinting = false;
|
||||
panel->m_ClipBox = tmp;
|
||||
g_DrawBgColor = bg_color;
|
||||
ActiveScreen->m_IsPrinting = false;
|
||||
panel->m_ClipBox = oldClipBox;
|
||||
|
||||
SetPenMinWidth( 1 );
|
||||
GRForceBlackPen( false );
|
||||
|
||||
ActiveScreen->m_StartVisu = tmp_startvisu;
|
||||
ActiveScreen->m_DrawOrg = old_org;
|
||||
ActiveScreen->SetZoom( tmpzoom );
|
||||
ActiveScreen->SetZoom( oldZoom );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
@ -19,80 +19,56 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
|
|||
wxBoxSizer* bleftSizer;
|
||||
bleftSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbOptionsSizer;
|
||||
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
|
||||
m_checkReference = new wxCheckBox( this, wxID_ANY, _("Print sheet &reference and title block"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkReference->SetValue(true);
|
||||
|
||||
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default Pen Size"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TextPenWidth->Wrap( -1 );
|
||||
sbOptionsSizer->Add( m_TextPenWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
m_checkReference->SetToolTip( _("Print (or not) the Frame references.") );
|
||||
|
||||
m_DialogPenWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
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 ) );
|
||||
bleftSizer->Add( m_checkReference, 0, wxALL, 5 );
|
||||
|
||||
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 );
|
||||
m_Print_Sheet_Ref->SetValue(true);
|
||||
bleftSizer->Add( m_checkMonochrome, 0, wxALL, 5 );
|
||||
|
||||
m_Print_Sheet_Ref->SetToolTip( _("Print (or not) the Frame references.") );
|
||||
|
||||
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 );
|
||||
bMainSizer->Add( bleftSizer, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 12 );
|
||||
|
||||
wxBoxSizer* bbuttonsSizer;
|
||||
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_buttonOption = new wxButton( this, wxID_PRINT_OPTIONS, _("Page Options"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bbuttonsSizer->Add( m_buttonOption, 0, wxALL, 5 );
|
||||
m_buttonPageSetup = new wxButton( this, wxID_ANY, _("Page Setup"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
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 );
|
||||
|
||||
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 );
|
||||
|
||||
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
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->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
|
||||
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_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_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnButtonCancelClick ), NULL, this );
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnInitDialog ) );
|
||||
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_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 );
|
||||
}
|
||||
|
||||
DIALOG_PRINT_USING_PRINTER_base::~DIALOG_PRINT_USING_PRINTER_base()
|
||||
DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
|
||||
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_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_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnButtonCancelClick ), NULL, this );
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnInitDialog ) );
|
||||
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_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 );
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</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="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
|
@ -30,9 +30,9 @@
|
|||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></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="size">336,268</property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="title">Print</property>
|
||||
|
@ -76,8 +76,8 @@
|
|||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="border">12</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -86,205 +86,32 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|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="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="choices">"Color" "Black and white"</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_PRINT_MODE</property>
|
||||
<property name="label">Print Mode</property>
|
||||
<property name="majorDimension">1</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Print sheet &reference and title block</property>
|
||||
<property name="maximum_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="pos"></property>
|
||||
<property name="selection">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip">Choose if you wand to draw the sheet like it appears on screen,
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_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>
|
||||
|
@ -301,7 +128,6 @@
|
|||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioBox"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
|
@ -312,33 +138,32 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="choices">"Current" "All"</property>
|
||||
<property name="checked">0</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_PAGE_MODE</property>
|
||||
<property name="label">Page Print</property>
|
||||
<property name="majorDimension">1</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Print in &black and white only</property>
|
||||
<property name="maximum_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="pos"></property>
|
||||
<property name="selection">0</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</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>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -355,7 +180,6 @@
|
|||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioBox"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
|
@ -367,8 +191,8 @@
|
|||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="border">12</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -377,7 +201,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="bg"></property>
|
||||
|
@ -387,11 +211,11 @@
|
|||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_PRINT_OPTIONS</property>
|
||||
<property name="label">Page Options</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Page Setup</property>
|
||||
<property name="maximum_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="pos"></property>
|
||||
<property name="size"></property>
|
||||
|
@ -401,7 +225,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnPrintSetup</event>
|
||||
<event name="OnButtonClick">OnPageSetup</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
|
@ -439,7 +263,7 @@
|
|||
<property name="fg"></property>
|
||||
<property name="font"></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="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -491,7 +315,7 @@
|
|||
<property name="fg"></property>
|
||||
<property name="font"></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="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
|
|
|
@ -11,44 +11,28 @@
|
|||
#include <wx/intl.h>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/button.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:
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
wxID_FRAME_SEL = 1000,
|
||||
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;
|
||||
wxCheckBox* m_checkReference;
|
||||
wxCheckBox* m_checkMonochrome;
|
||||
wxButton* m_buttonPageSetup;
|
||||
wxButton* m_buttonPreview;
|
||||
wxButton* m_buttonPrint;
|
||||
wxButton* m_buttonQuit;
|
||||
|
@ -56,15 +40,15 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
|
|||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCloseWindow( wxCloseEvent& 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 OnPrintButtonClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); }
|
||||
|
||||
|
||||
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();
|
||||
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();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -261,6 +261,10 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetProjectFileParameters( void )
|
|||
&g_DefaultTextLabelSize,
|
||||
DEFAULT_SIZE_TEXT, 0,
|
||||
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;
|
||||
}
|
||||
|
@ -280,6 +284,7 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName,
|
|||
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
else
|
||||
fn = CfgFileName;
|
||||
|
||||
m_ComponentLibFiles.Clear();
|
||||
|
||||
/* Change the schematic file extension (.sch) to the project file
|
||||
|
@ -339,6 +344,14 @@ void WinEDA_SchematicFrame::SaveProjectFile( wxWindow* displayframe, bool askove
|
|||
static const wxString DefaultDrawLineWidthEntry( wxT( "DefaultDrawLineWidth" ) );
|
||||
static const wxString ShowHiddenPinsEntry( wxT( "ShowHiddenPins" ) );
|
||||
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 )
|
|||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ),
|
||||
&g_LayerDescr.LayerColor[LAYER_ERC_ERR],
|
||||
RED ) );
|
||||
|
||||
return m_configSettings;
|
||||
}
|
||||
|
||||
|
@ -448,6 +462,8 @@ void WinEDA_SchematicFrame::LoadSettings()
|
|||
{
|
||||
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
||||
|
||||
long tmp;
|
||||
|
||||
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
||||
|
||||
WinEDA_DrawFrame::LoadSettings();
|
||||
|
@ -458,6 +474,23 @@ void WinEDA_SchematicFrame::LoadSettings()
|
|||
(long) 6 );
|
||||
cfg->Read( ShowHiddenPinsEntry, &m_ShowAllPins, false );
|
||||
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()
|
|||
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness );
|
||||
cfg->Write( ShowHiddenPinsEntry, m_ShowAllPins );
|
||||
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()
|
|||
wxMenu* openRecentMenu = new wxMenu();
|
||||
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu );
|
||||
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu,
|
||||
-1, _( "Open &Recent" ),
|
||||
_("Open a recent opened schematic project" ),
|
||||
open_project_xpm );
|
||||
-1, _( "Open &Recent" ),
|
||||
_("Open a recent opened schematic project" ),
|
||||
open_project_xpm );
|
||||
|
||||
/* Separator */
|
||||
filesMenu->AppendSeparator();
|
||||
|
||||
/* Save */
|
||||
/* 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" ) );
|
||||
item->SetBitmap( save_project_xpm );
|
||||
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" ) );
|
||||
item->SetBitmap( save_xpm );
|
||||
filesMenu->Append( item );
|
||||
|
@ -87,8 +88,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
|||
filesMenu->AppendSeparator();
|
||||
|
||||
/* Print */
|
||||
item = new wxMenuItem( filesMenu, ID_GEN_PRINT, _( "P&rint\tCtrl+P" ),
|
||||
_( "Print schematic sheet" ) );
|
||||
item = new wxMenuItem( filesMenu, wxID_PRINT, _( "P&rint\tCtrl+P" ),
|
||||
_( "Print schematic" ) );
|
||||
item->SetBitmap( print_button );
|
||||
filesMenu->Append( item );
|
||||
|
||||
|
@ -131,7 +132,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
|||
|
||||
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, choice_plot_fmt,
|
||||
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 */
|
||||
#if !defined(__WXMAC__)
|
||||
|
@ -216,7 +218,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
|||
/* Zoom out */
|
||||
#if !defined( __WXMAC__)
|
||||
text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ZOOM_OUT );
|
||||
HK_ZOOM_OUT );
|
||||
#else
|
||||
text = _( "Zoom Out\tCtrl+-" );
|
||||
#endif /* !defined( __WXMAC__) */
|
||||
|
@ -229,7 +231,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
|||
/* Fit on screen */
|
||||
#if !defined( __WXMAC__)
|
||||
text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ZOOM_AUTO );
|
||||
HK_ZOOM_AUTO );
|
||||
#else
|
||||
text = _( "Fit on Screen\tCtrl+0" );
|
||||
#endif
|
||||
|
@ -245,7 +247,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
|||
/* Redraw view */
|
||||
#if !defined( __WXMAC__)
|
||||
text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr,
|
||||
HK_ZOOM_REDRAW );
|
||||
HK_ZOOM_REDRAW );
|
||||
#else
|
||||
text = _( "Redraw\tCtrl+R" );
|
||||
#endif
|
||||
|
@ -323,7 +325,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
|||
|
||||
/* Junction */
|
||||
item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, _( "Junction" ),
|
||||
_( "Place junction" ), wxITEM_NORMAL );
|
||||
_( "Place junction" ), wxITEM_NORMAL );
|
||||
item->SetBitmap( add_junction_xpm );
|
||||
placeMenu->Append( item );
|
||||
|
||||
|
@ -461,4 +463,3 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
|||
/* Associate the menu bar with the frame */
|
||||
SetMenuBar( menuBar );
|
||||
}
|
||||
|
||||
|
|
|
@ -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_AS, 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_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL )
|
||||
EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
|
||||
|
@ -87,7 +87,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
|||
EVT_TOOL( wxID_REDO,
|
||||
WinEDA_SchematicFrame::GetSchematicFromRedoList )
|
||||
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_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist )
|
||||
EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials )
|
||||
|
@ -156,6 +156,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
|||
m_ViewlibFrame = NULL; // Frame for browsing component libraries
|
||||
m_DefaultSchematicFileName = wxT( "noname.sch" );
|
||||
m_ShowAllPins = false;
|
||||
m_previewPosition = wxDefaultPosition;
|
||||
m_previewSize = wxDefaultSize;
|
||||
m_printMonochrome = true;
|
||||
m_showSheetReference = true;
|
||||
|
||||
CreateScreens();
|
||||
|
||||
|
@ -186,6 +190,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
|||
ReCreateVToolbar();
|
||||
ReCreateOptToolbar();
|
||||
|
||||
/* Initialize print and page setup dialog settings. */
|
||||
m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_HIGH );
|
||||
m_pageSetupData.GetPrintData().SetOrientation( wxLANDSCAPE );
|
||||
|
||||
#if defined(KICAD_AUIMANAGER)
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
|
|||
wxBitmap( redo_xpm ), msg );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ),
|
||||
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
|
||||
_( "Print schematic" ) );
|
||||
|
||||
m_HToolBar->AddSeparator();
|
||||
|
|
|
@ -53,25 +53,32 @@ enum fl_rot_cmp
|
|||
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
|
||||
{
|
||||
public:
|
||||
WinEDAChoiceBox* m_SelPartBox;
|
||||
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
|
||||
int m_Multiflag;
|
||||
int m_NetlistFormat;
|
||||
bool m_ShowAllPins;
|
||||
wxPoint m_OldPos;
|
||||
WinEDA_LibeditFrame* m_LibeditFrame;
|
||||
WinEDA_ViewlibFrame* m_ViewlibFrame;
|
||||
wxString m_UserLibraryPath;
|
||||
wxArrayString m_ComponentLibFiles;
|
||||
WinEDAChoiceBox* m_SelPartBox;
|
||||
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
|
||||
int m_Multiflag;
|
||||
int m_NetlistFormat;
|
||||
bool m_ShowAllPins;
|
||||
wxPoint m_OldPos;
|
||||
WinEDA_LibeditFrame* m_LibeditFrame;
|
||||
WinEDA_ViewlibFrame* m_ViewlibFrame;
|
||||
wxString m_UserLibraryPath;
|
||||
wxArrayString m_ComponentLibFiles;
|
||||
|
||||
|
||||
private:
|
||||
wxString m_DefaultSchematicFileName;
|
||||
SCH_FIELD* m_CurrentField;
|
||||
int m_TextFieldSize;
|
||||
bool m_ShowGrid;
|
||||
PARAM_CFG_ARRAY m_projectFileParams;
|
||||
PARAM_CFG_ARRAY m_configSettings;
|
||||
wxString m_DefaultSchematicFileName;
|
||||
SCH_FIELD* m_CurrentField;
|
||||
int m_TextFieldSize;
|
||||
bool m_ShowGrid;
|
||||
PARAM_CFG_ARRAY m_projectFileParams;
|
||||
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:
|
||||
WinEDA_SchematicFrame( wxWindow* father,
|
||||
|
@ -201,10 +208,30 @@ public:
|
|||
*/
|
||||
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:
|
||||
void ToPlot_PS( wxCommandEvent& event );
|
||||
|
|
Loading…
Reference in New Issue