mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 11:01:41 +00:00
Cleanup.
This commit is contained in:
parent
5f06f0d863
commit
857d4f3803
@ -318,8 +318,8 @@ set( EESCHEMA_IMPORT_GFX
|
||||
)
|
||||
|
||||
set( EESCHEMA_PRINTING
|
||||
printing/dialog_print_using_printer.cpp
|
||||
printing/dialog_print_using_printer_base.cpp
|
||||
printing/dialog_print.cpp
|
||||
printing/dialog_print_base.cpp
|
||||
printing/sch_printout.cpp
|
||||
)
|
||||
|
||||
|
@ -61,10 +61,6 @@ class SCH_EDIT_FRAME;
|
||||
int InvokeDialogRescueEach( wxWindow* aParent, RESCUER& aRescuer, SCH_SHEET_PATH* aCurrentSheet,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aGalBackEndType, bool aAskShowAgain );
|
||||
|
||||
/// Create and show DIALOG_PRINT_USING_PRINTER and return whatever
|
||||
/// DIALOG_PRINT_USING_PRINTER::ShowModal() returns.
|
||||
int InvokeDialogPrintUsingPrinter( SCH_EDIT_FRAME* aCaller );
|
||||
|
||||
/// Create and show DIALOG_BOM and return whatever
|
||||
/// DIALOG_BOM::ShowModal() returns.
|
||||
int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller );
|
||||
|
@ -26,47 +26,15 @@
|
||||
#include <confirm.h>
|
||||
#include <sch_screen.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <base_units.h>
|
||||
#include <math/vector2wx.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <schematic.h>
|
||||
#include <sch_sheet_path.h>
|
||||
#include "dialog_print_using_printer_base.h"
|
||||
#include <sch_painter.h>
|
||||
#include <wx/print.h>
|
||||
#include <wx/printdlg.h>
|
||||
|
||||
#include <advanced_config.h>
|
||||
|
||||
#include "dialog_print.h"
|
||||
#include "sch_printout.h"
|
||||
|
||||
|
||||
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent );
|
||||
~DIALOG_PRINT_USING_PRINTER() override;
|
||||
|
||||
protected:
|
||||
void OnOutputChoice( wxCommandEvent& event ) override;
|
||||
void OnUseColorThemeChecked( wxCommandEvent& event ) override;
|
||||
|
||||
private:
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
void OnPageSetup( wxCommandEvent& event ) override;
|
||||
void OnPrintPreview( wxCommandEvent& event ) override;
|
||||
|
||||
void SavePrintOptions();
|
||||
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
bool m_useCairo;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Custom schematic print preview frame.
|
||||
* This derived preview frame remembers its size and position during a session
|
||||
@ -77,7 +45,7 @@ public:
|
||||
SCH_PREVIEW_FRAME( wxPrintPreview* aPreview, wxWindow* aParent,
|
||||
const wxString& aTitle, const wxPoint& aPos = wxDefaultPosition,
|
||||
const wxSize& aSize = wxDefaultSize ) :
|
||||
wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
|
||||
wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
|
||||
{
|
||||
}
|
||||
|
||||
@ -116,9 +84,9 @@ wxPoint SCH_PREVIEW_FRAME::s_pos;
|
||||
wxSize SCH_PREVIEW_FRAME::s_size;
|
||||
|
||||
|
||||
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ) :
|
||||
DIALOG_PRINT_USING_PRINTER_BASE( aParent ),
|
||||
m_parent( aParent )
|
||||
DIALOG_PRINT::DIALOG_PRINT( SCH_EDIT_FRAME* aParent ) :
|
||||
DIALOG_PRINT_BASE( aParent ),
|
||||
m_parent( aParent )
|
||||
{
|
||||
wxASSERT( aParent );
|
||||
m_useCairo = ADVANCED_CFG::GetCfg().m_EnableEeschemaPrintCairo;
|
||||
@ -144,13 +112,13 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
|
||||
}
|
||||
|
||||
|
||||
DIALOG_PRINT_USING_PRINTER::~DIALOG_PRINT_USING_PRINTER()
|
||||
DIALOG_PRINT::~DIALOG_PRINT()
|
||||
{
|
||||
SavePrintOptions();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow()
|
||||
bool DIALOG_PRINT::TransferDataToWindow()
|
||||
{
|
||||
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
|
||||
|
||||
@ -197,11 +165,15 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow()
|
||||
if( pageInfo.IsCustom() )
|
||||
{
|
||||
if( pageInfo.IsPortrait() )
|
||||
{
|
||||
pageSetupDialogData.SetPaperSize( wxSize( EDA_UNIT_UTILS::Mils2mm( pageInfo.GetWidthMils() ),
|
||||
EDA_UNIT_UTILS::Mils2mm( pageInfo.GetHeightMils() ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
pageSetupDialogData.SetPaperSize( wxSize( EDA_UNIT_UTILS::Mils2mm( pageInfo.GetHeightMils() ),
|
||||
EDA_UNIT_UTILS::Mils2mm( pageInfo.GetWidthMils() ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
|
||||
@ -212,13 +184,13 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow()
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::OnUseColorThemeChecked( wxCommandEvent& event )
|
||||
void DIALOG_PRINT::OnUseColorThemeChecked( wxCommandEvent& event )
|
||||
{
|
||||
m_colorTheme->Enable( m_checkUseColorTheme->GetValue() );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::OnOutputChoice( wxCommandEvent& event )
|
||||
void DIALOG_PRINT::OnOutputChoice( wxCommandEvent& event )
|
||||
{
|
||||
long sel = event.GetSelection();
|
||||
m_checkBackgroundColor->Enable( sel == 0 );
|
||||
@ -230,7 +202,7 @@ void DIALOG_PRINT_USING_PRINTER::OnOutputChoice( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::SavePrintOptions()
|
||||
void DIALOG_PRINT::SavePrintOptions()
|
||||
{
|
||||
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
|
||||
|
||||
@ -252,7 +224,7 @@ void DIALOG_PRINT_USING_PRINTER::SavePrintOptions()
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
|
||||
void DIALOG_PRINT::OnPageSetup( wxCommandEvent& event )
|
||||
{
|
||||
wxPageSetupDialog pageSetupDialog( this, &m_parent->GetPageSetupData() );
|
||||
pageSetupDialog.ShowModal();
|
||||
@ -261,7 +233,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
||||
void DIALOG_PRINT::OnPrintPreview( wxCommandEvent& event )
|
||||
{
|
||||
SavePrintOptions();
|
||||
|
||||
@ -300,7 +272,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_PRINT_USING_PRINTER::TransferDataFromWindow()
|
||||
bool DIALOG_PRINT::TransferDataFromWindow()
|
||||
{
|
||||
if( Pgm().m_Printing )
|
||||
{
|
||||
@ -400,11 +372,3 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataFromWindow()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int InvokeDialogPrintUsingPrinter( SCH_EDIT_FRAME* aCaller )
|
||||
{
|
||||
DIALOG_PRINT_USING_PRINTER dlg( aCaller );
|
||||
|
||||
return dlg.ShowModal();
|
||||
}
|
53
eeschema/printing/dialog_print.h
Normal file
53
eeschema/printing/dialog_print.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dialog_print_base.h"
|
||||
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_SCREEN;
|
||||
|
||||
|
||||
class DIALOG_PRINT : public DIALOG_PRINT_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_PRINT( SCH_EDIT_FRAME* aParent );
|
||||
~DIALOG_PRINT() override;
|
||||
|
||||
protected:
|
||||
void OnOutputChoice( wxCommandEvent& event ) override;
|
||||
void OnUseColorThemeChecked( wxCommandEvent& event ) override;
|
||||
|
||||
private:
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
void OnPageSetup( wxCommandEvent& event ) override;
|
||||
void OnPrintPreview( wxCommandEvent& event ) override;
|
||||
|
||||
void SavePrintOptions();
|
||||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
bool m_useCairo;
|
||||
};
|
||||
|
||||
|
@ -5,11 +5,11 @@
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_print_using_printer_base.h"
|
||||
#include "dialog_print_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
DIALOG_PRINT_BASE::DIALOG_PRINT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||
|
||||
@ -96,20 +96,20 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
|
||||
m_colorPrint->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnOutputChoice ), NULL, this );
|
||||
m_checkUseColorTheme->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnUseColorThemeChecked ), NULL, this );
|
||||
m_buttonPageSetup->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
|
||||
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_BASE::OnCloseWindow ) );
|
||||
m_colorPrint->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnOutputChoice ), NULL, this );
|
||||
m_checkUseColorTheme->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnUseColorThemeChecked ), NULL, this );
|
||||
m_buttonPageSetup->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnPageSetup ), NULL, this );
|
||||
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnPrintPreview ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE()
|
||||
DIALOG_PRINT_BASE::~DIALOG_PRINT_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnCloseWindow ) );
|
||||
m_colorPrint->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnOutputChoice ), NULL, this );
|
||||
m_checkUseColorTheme->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnUseColorThemeChecked ), NULL, this );
|
||||
m_buttonPageSetup->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
|
||||
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_BASE::OnCloseWindow ) );
|
||||
m_colorPrint->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnOutputChoice ), NULL, this );
|
||||
m_checkUseColorTheme->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnUseColorThemeChecked ), NULL, this );
|
||||
m_buttonPageSetup->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnPageSetup ), NULL, this );
|
||||
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnPrintPreview ), NULL, this );
|
||||
|
||||
}
|
@ -13,12 +13,12 @@
|
||||
<property name="cpp_use_enum">1</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="file">dialog_print_using_printer_base</property>
|
||||
<property name="file">dialog_print_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="lua_skip_events">1</property>
|
||||
<property name="lua_ui_table">UI</property>
|
||||
<property name="name">dialog_print_schematic</property>
|
||||
<property name="name">dialog_print</property>
|
||||
<property name="path">.</property>
|
||||
<property name="php_disconnect_events">0</property>
|
||||
<property name="php_disconnect_mode">source_name</property>
|
||||
@ -48,7 +48,7 @@
|
||||
<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_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
@ -29,9 +29,9 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_PRINT_USING_PRINTER_BASE
|
||||
/// Class DIALOG_PRINT_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
|
||||
class DIALOG_PRINT_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
@ -58,9 +58,9 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
|
||||
|
||||
public:
|
||||
|
||||
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_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_BASE();
|
||||
|
||||
};
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include <tools/ee_selection.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <tools/ee_tool_utils.h>
|
||||
#include <tools/sch_edit_table_tool.h>
|
||||
#include <drawing_sheet/ds_proxy_undo_item.h>
|
||||
#include <eda_list_dialog.h>
|
||||
#include <view/view_controls.h>
|
||||
@ -78,7 +79,7 @@
|
||||
#include <wx/treectrl.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <io/kicad/kicad_io_utils.h>
|
||||
#include "sch_edit_table_tool.h"
|
||||
#include <printing/dialog_print.h>
|
||||
|
||||
#ifdef KICAD_IPC_API
|
||||
#include <api/api_plugin_manager.h>
|
||||
@ -295,7 +296,10 @@ int SCH_EDITOR_CONTROL::RemapSymbols( const TOOL_EVENT& aEvent )
|
||||
|
||||
int SCH_EDITOR_CONTROL::Print( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
InvokeDialogPrintUsingPrinter( m_frame );
|
||||
DIALOG_PRINT dlg( m_frame );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user