7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Revert "fix commit 4ef2853a on non Windows platforms"

This reverts commit e587e5029c.

Revert "Print dlgs: add panel printer to select the current printer. Windows only"

This reverts commit 4ef2853ae5.
This commit is contained in:
jean-pierre charras 2025-02-06 14:27:30 +01:00
parent e587e5029c
commit 69c6412b43
14 changed files with 26 additions and 886 deletions

View File

@ -404,9 +404,6 @@ set( COMMON_DLG_SRCS
dialogs/panel_plugin_settings.cpp
dialogs/panel_plugin_settings_base.cpp
dialogs/panel_setup_netclasses.cpp
dialogs/panel_printer_list.cpp
dialogs/panel_printer_list_base.cpp
dialogs/panel_setup_netclasses_base.cpp
dialogs/panel_setup_severities.cpp
dialogs/panel_text_variables.cpp

View File

@ -27,8 +27,6 @@
#include <wx/print.h>
#include <wx/printdlg.h>
#include <dialogs/panel_printer_list.h>
// Define min and max reasonable values for print scale
static constexpr double MIN_SCALE = 0.01;
static constexpr double MAX_SCALE = 100.0;
@ -95,9 +93,6 @@ DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SE
m_scaleValidator.SetRange( 0.0, MAX_SCALE );
m_scaleCustomText->SetValidator( m_scaleValidator );
// Show m_panelPrinters only if there are printers to list:
m_panelPrinters->Show( m_panelPrinters->AsPrintersAvailable() );
SetupStandardButtons( { { wxID_OK, _( "Print" ) },
{ wxID_APPLY, _( "Print Preview" ) },
{ wxID_CANCEL, _( "Close" ) } } );
@ -250,13 +245,6 @@ void DIALOG_PRINT_GENERIC::onPrintPreview( wxCommandEvent& event )
return;
}
wxString selectedPrinterName;
if( m_panelPrinters )
selectedPrinterName = m_panelPrinters->GetSelectedPrinterName();
s_PrintData->SetPrinterName( selectedPrinterName );
// Pass two printout objects: for preview, and possible printing.
wxString title = _( "Print Preview" );
wxPrintPreview* preview =
@ -308,13 +296,6 @@ void DIALOG_PRINT_GENERIC::onPrintButtonClick( wxCommandEvent& event )
return;
}
wxString selectedPrinterName;
if( m_panelPrinters )
selectedPrinterName = m_panelPrinters->GetSelectedPrinterName();
s_PrintData->SetPrinterName( selectedPrinterName );
wxPrintDialogData printDialogData( *s_PrintData );
printDialogData.SetMaxPage( m_settings->m_pageCount );

View File

@ -5,8 +5,6 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialogs/panel_printer_list.h"
#include "dialog_print_generic_base.h"
///////////////////////////////////////////////////////////////////////////
@ -18,15 +16,6 @@ DIALOG_PRINT_GENERIC_BASE::DIALOG_PRINT_GENERIC_BASE( wxWindow* parent, wxWindow
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerPanelPrinters;
bSizerPanelPrinters = new wxBoxSizer( wxVERTICAL );
m_panelPrinters = new PANEL_PRINTER_LIST( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
bSizerPanelPrinters->Add( m_panelPrinters, 1, wxEXPAND | wxALL, 5 );
bMainSizer->Add( bSizerPanelPrinters, 0, wxEXPAND, 5 );
m_bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bRightCol;

View File

@ -65,75 +65,6 @@
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bSizerPanelPrinters</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panelPrinters</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">PANEL_PRINTER_LIST; dialogs/panel_printer_list.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>

View File

@ -10,20 +10,17 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class PANEL_PRINTER_LIST;
#include "dialog_shim.h"
#include <wx/panel.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#include <wx/gbsizer.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobut.h>
#include <wx/textctrl.h>
@ -49,7 +46,6 @@ class DIALOG_PRINT_GENERIC_BASE : public DIALOG_SHIM
wxID_PRINT_OPTIONS,
};
PANEL_PRINTER_LIST* m_panelPrinters;
wxBoxSizer* m_bUpperSizer;
wxStaticBoxSizer* m_sbOptionsSizer;
wxGridBagSizer* m_gbOptionsSizer;

View File

@ -1,192 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015-2023 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/>.
*/
#include <dialogs/panel_printer_list.h>
// Define CUPS_LIST_PRINTERS to allow printer selection in PANEL_PRINTER_LIST
// on Unices. It needs cups and cups dev files
// Currently not tested and not finished for cups, so disable it
// However the code (from wxWidgets forum) is kept here, just in case
//#define CUPS_LIST_PRINTERS
#ifdef __WXMSW__
#include <Windows.h>
#elif defined( CUPS_LIST_PRINTERS )
#include <cups/cups.h>
#endif
// GetPrinterList code comes from samples on:
// https://forums.wxwidgets.org/viewtopic.php?t=13251
// https://forums.wxwidgets.org/viewtopic.php?t=43930
static bool GetPrinterList(wxArrayString &aPrinterList, wxString &aDefaultPrinterName)
{
aPrinterList.Empty();
aDefaultPrinterName.Empty();
#ifdef __WXMSW__
DWORD dwSize, dwPrinters;
BYTE *pBuffer;
DWORD szz = 255;
WCHAR c[256];
GetDefaultPrinter(&c[0], &szz);
aDefaultPrinterName = c;
::EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 5, NULL, 0, &dwSize, &dwPrinters);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER || dwSize == 0)
return false;
pBuffer = new BYTE[dwSize];
::EnumPrinters(PRINTER_ENUM_LOCAL, NULL, 5, pBuffer, dwSize, &dwSize, &dwPrinters);
if (dwPrinters != 0)
{
PRINTER_INFO_5 *pPrnInfo = (PRINTER_INFO_5 *)pBuffer;
for (UINT i = 0; i < dwPrinters; i++)
{
aPrinterList.Add(pPrnInfo->pPrinterName);
pPrnInfo++;
}
}
if (pBuffer)
{
delete[] pBuffer;
pBuffer = NULL;
}
return true;
#elif defined( CUPS_LIST_PRINTERS )
cups_dest_t* dests;
int num_dests = cupsGetDests(&dests);
for (int i = 0; i < num_dests; i++)
{
wxString sz;
if (dests[i].instance)
sz = wxString::Format("%s%s", dests[i].name, dests[i].instance);
else
sz = wxString::Format("%s", dests[i].name);
if (dests[i].is_default)
aDefaultPrinterName = sz;
aPrinterList.Add(sz);
}
//free memory from cups data
cupsFreeDests(num_dests, dests);
if(aPrinterList.GetCount())
return true;
#endif
return false;
}
wxString PANEL_PRINTER_LIST::m_selectedPrinterName;
PANEL_PRINTER_LIST::PANEL_PRINTER_LIST( wxWindow* aParent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style,
const wxString& name ):
PANEL_PRINTER_LIST_BASE( aParent, id, pos, size, style, name )
{
GetPrinterList( m_printer_list, m_defaultPrinterName);
if( m_printer_list.size() )
{
m_choicePrinter->Append( m_printer_list );
m_stPrinterState->SetLabel( wxEmptyString );
bool selected = false;
if( !m_selectedPrinterName.IsEmpty() )
{
for( size_t ii = 0; ii < m_printer_list.GetCount(); ii++ )
{
if( m_selectedPrinterName == m_printer_list[ii] )
{
m_choicePrinter->SetSelection( ii );
selected = true;
break;
}
}
}
if( !selected )
{
for( size_t ii = 0; ii < m_printer_list.GetCount(); ii++ )
{
if( m_defaultPrinterName == m_printer_list[ii] )
{
m_choicePrinter->SetSelection( ii );
m_selectedPrinterName = m_defaultPrinterName;
break;
}
}
}
if( m_selectedPrinterName == m_defaultPrinterName )
m_stPrinterState->SetLabel( _( "Default printer" ) );
}
}
PANEL_PRINTER_LIST::~PANEL_PRINTER_LIST()
{
}
bool PANEL_PRINTER_LIST::AsPrintersAvailable()
{
return m_choicePrinter->GetCount() > 0;
}
void PANEL_PRINTER_LIST::onPrinterChoice( wxCommandEvent& event )
{
int select = m_choicePrinter->GetSelection();
if( m_choicePrinter->GetString( select ) == m_defaultPrinterName )
m_stPrinterState->SetLabel( _( "Default printer" ) );
else
m_stPrinterState->SetLabel( wxEmptyString );
m_selectedPrinterName = m_choicePrinter->GetString( select );
}
wxString PANEL_PRINTER_LIST::GetSelectedPrinterName()
{
if( AsPrintersAvailable() )
{
int select = m_choicePrinter->GetSelection();
m_selectedPrinterName = m_choicePrinter->GetString( select );
}
else
m_selectedPrinterName.Empty();
return m_selectedPrinterName;
}

View File

@ -1,57 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_printer_list_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_PRINTER_LIST_BASE::PANEL_PRINTER_LIST_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_sbSizerPrinters = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Printers") ), wxVERTICAL );
wxArrayString m_choicePrinterChoices;
m_choicePrinter = new wxChoice( m_sbSizerPrinters->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePrinterChoices, 0 );
m_choicePrinter->SetSelection( 0 );
m_sbSizerPrinters->Add( m_choicePrinter, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxBoxSizer* bSizerPrinterState;
bSizerPrinterState = new wxBoxSizer( wxHORIZONTAL );
m_staticTextPrn = new wxStaticText( m_sbSizerPrinters->GetStaticBox(), wxID_ANY, _("Info:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPrn->Wrap( -1 );
bSizerPrinterState->Add( m_staticTextPrn, 0, wxALL, 5 );
bSizerPrinterState->Add( 0, 0, 0, wxRIGHT|wxLEFT, 5 );
m_stPrinterState = new wxStaticText( m_sbSizerPrinters->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_stPrinterState->Wrap( -1 );
bSizerPrinterState->Add( m_stPrinterState, 0, wxALL, 5 );
m_sbSizerPrinters->Add( bSizerPrinterState, 0, wxEXPAND, 5 );
bSizerMain->Add( m_sbSizerPrinters, 0, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
// Connect Events
m_choicePrinter->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_PRINTER_LIST_BASE::onPrinterChoice ), NULL, this );
}
PANEL_PRINTER_LIST_BASE::~PANEL_PRINTER_LIST_BASE()
{
// Disconnect Events
m_choicePrinter->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_PRINTER_LIST_BASE::onPrinterChoice ), NULL, this );
}

View File

@ -1,289 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">panel_printer_list_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">panel_printer_list</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</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="minimum_size"></property>
<property name="name">PANEL_PRINTER_LIST_BASE</property>
<property name="pos"></property>
<property name="size">378,136</property>
<property name="subclass">; ; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Printers</property>
<property name="minimum_size"></property>
<property name="name">m_sbSizerPrinters</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices"></property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_choicePrinter</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChoice">onPrinterChoice</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerPrinterState</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Info:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextPrn</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</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>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">dummy</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_stPrinterState</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</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>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -1,50 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/choice.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_PRINTER_LIST_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_PRINTER_LIST_BASE : public wxPanel
{
private:
protected:
wxStaticBoxSizer* m_sbSizerPrinters;
wxChoice* m_choicePrinter;
wxStaticText* m_staticTextPrn;
wxStaticText* m_stPrinterState;
// Virtual event handlers, override them in your derived class
virtual void onPrinterChoice( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_PRINTER_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 378,109 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_PRINTER_LIST_BASE();
};

View File

@ -32,12 +32,6 @@
#include <wx/print.h>
#include <wx/printdlg.h>
#include "dialog_print.h"
#include <dialogs/panel_printer_list.h>
#include <advanced_config.h>
#include "sch_printout.h"
@ -97,16 +91,13 @@ DIALOG_PRINT::DIALOG_PRINT( SCH_EDIT_FRAME* aParent ) :
wxASSERT( aParent );
m_useCairo = ADVANCED_CFG::GetCfg().m_EnableEeschemaPrintCairo;
// Show m_panelPrinters only if there are printers to list:
m_panelPrinters->Show( m_panelPrinters->AsPrintersAvailable() );
SetupStandardButtons( { { wxID_OK, _( "Print" ) },
{ wxID_APPLY, _( "Print Preview" ) },
{ wxID_CANCEL, _( "Close" ) } } );
#ifdef __WXMAC__
// Problems with modal on wx-2.9 - Anyway preview is standard for OSX
m_sdbSizerApply->Hide();
m_sdbSizer1Apply->Hide();
#endif
#if defined(__WXGTK__)
// Preview using Cairo does not work on GTK,
@ -115,9 +106,7 @@ DIALOG_PRINT::DIALOG_PRINT( SCH_EDIT_FRAME* aParent ) :
m_sdbSizer1Apply->Hide();
#endif
m_sdbSizerOK->SetFocus();
Layout();
m_sdbSizer1OK->SetFocus();
finishDialogSettings();
}
@ -247,20 +236,12 @@ void DIALOG_PRINT::OnPageSetup( wxCommandEvent& event )
void DIALOG_PRINT::OnPrintPreview( wxCommandEvent& event )
{
SavePrintOptions();
wxPrintData& prn_data = m_parent->GetPageSetupData().GetPrintData();
wxString selectedPrinterName;
if( m_panelPrinters )
selectedPrinterName = m_panelPrinters->GetSelectedPrinterName();
prn_data.SetPrinterName( selectedPrinterName );
// Pass two printout objects: for preview, and possible printing.
wxString title = _( "Preview" );
wxPrintPreview* preview = new wxPrintPreview( new SCH_PRINTOUT( m_parent, title, m_useCairo ),
new SCH_PRINTOUT( m_parent, title, m_useCairo ),
&prn_data );
&m_parent->GetPageSetupData().GetPrintData() );
preview->SetZoom( 100 );
@ -303,7 +284,7 @@ bool DIALOG_PRINT::TransferDataFromWindow()
int sheet_count = m_parent->Schematic().Root().CountSheets();
wxPrintData& data = m_parent->GetPageSetupData().GetPrintData();
wxPrintData data = m_parent->GetPageSetupData().GetPrintData();
#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 2, 3 )
// In GTK, the default bottom margin is bigger by 0.31 inches for
@ -365,12 +346,6 @@ bool DIALOG_PRINT::TransferDataFromWindow()
}
#endif
wxString selectedPrinterName;
if( m_panelPrinters )
selectedPrinterName = m_panelPrinters->GetSelectedPrinterName();
data.SetPrinterName( selectedPrinterName );
wxPrintDialogData printDialogData( data );
printDialogData.SetMaxPage( sheet_count );

View File

@ -5,8 +5,6 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialogs/panel_printer_list.h"
#include "dialog_print_base.h"
///////////////////////////////////////////////////////////////////////////
@ -18,15 +16,6 @@ DIALOG_PRINT_BASE::DIALOG_PRINT_BASE( wxWindow* parent, wxWindowID id, const wxS
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerPrintersPanel;
bSizerPrintersPanel = new wxBoxSizer( wxVERTICAL );
m_panelPrinters = new PANEL_PRINTER_LIST( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
bSizerPrintersPanel->Add( m_panelPrinters, 1, wxEXPAND | wxALL, 5 );
bMainSizer->Add( bSizerPrintersPanel, 0, wxEXPAND, 5 );
wxBoxSizer* bleftSizer;
bleftSizer = new wxBoxSizer( wxVERTICAL );
@ -87,16 +76,16 @@ DIALOG_PRINT_BASE::DIALOG_PRINT_BASE( wxWindow* parent, wxWindowID id, const wxS
bbuttonsSizer->Add( 20, 0, 1, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerApply = new wxButton( this, wxID_APPLY );
m_sdbSizer->AddButton( m_sdbSizerApply );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Apply = new wxButton( this, wxID_APPLY );
m_sdbSizer1->AddButton( m_sdbSizer1Apply );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bbuttonsSizer->Add( m_sdbSizer, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bbuttonsSizer->Add( m_sdbSizer1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bbuttonsSizer, 0, wxEXPAND|wxLEFT, 10 );
@ -111,7 +100,7 @@ DIALOG_PRINT_BASE::DIALOG_PRINT_BASE( wxWindow* parent, wxWindowID id, const wxS
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_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnPrintPreview ), NULL, this );
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnPrintPreview ), NULL, this );
}
DIALOG_PRINT_BASE::~DIALOG_PRINT_BASE()
@ -121,6 +110,6 @@ DIALOG_PRINT_BASE::~DIALOG_PRINT_BASE()
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_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnPrintPreview ), NULL, this );
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_BASE::OnPrintPreview ), NULL, this );
}

View File

@ -65,75 +65,6 @@
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bSizerPrintersPanel</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxPanel" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panelPrinters</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">PANEL_PRINTER_LIST; dialogs/panel_printer_list.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
@ -674,7 +605,7 @@
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick">OnPrintPreview</event>
</object>

View File

@ -10,19 +10,16 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class PANEL_PRINTER_LIST;
#include "dialog_shim.h"
#include <wx/panel.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/bitmap.h>
#include <wx/image.h>
@ -39,7 +36,6 @@ class DIALOG_PRINT_BASE : public DIALOG_SHIM
private:
protected:
PANEL_PRINTER_LIST* m_panelPrinters;
wxCheckBox* m_checkReference;
wxStaticText* m_staticText1;
wxChoice* m_colorPrint;
@ -47,10 +43,10 @@ class DIALOG_PRINT_BASE : public DIALOG_SHIM
wxCheckBox* m_checkUseColorTheme;
wxChoice* m_colorTheme;
wxButton* m_buttonPageSetup;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerApply;
wxButton* m_sdbSizerCancel;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Apply;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, override them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }

View File

@ -1,57 +0,0 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2023 jean-pierre.charras
* Copyright (C) 2023 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/>.
*/
#ifndef PANEL_PRINTER_LIST_H
#define PANEL_PRINTER_LIST_H
#include <panel_printer_list_base.h>
class PANEL_PRINTER_LIST : public PANEL_PRINTER_LIST_BASE
{
public:
PANEL_PRINTER_LIST( wxWindow* aParent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize( 378,109 ), long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString );
~PANEL_PRINTER_LIST();
/// @return the selected printer name or a empty name
/// for the default printer
wxString GetSelectedPrinterName();
/// @return false if no printer in list
bool AsPrintersAvailable();
private:
void onPrinterChoice( wxCommandEvent& event ) override;
// The printer name selected in this dialog
// static to store the choice during a session
static wxString m_selectedPrinterName;
// The default printer name selected by the OS
wxString m_defaultPrinterName;
// The list of available printer names
wxArrayString m_printer_list;
};
#endif