You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

452 lines
16 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
8 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
8 years ago
8 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2010-2016 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
  5. * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. // Set this to 1 if you want to test PostScript printing under MSW.
  25. //#define wxTEST_POSTSCRIPT_IN_MSW 1
  26. #include <fctsys.h>
  27. #include <kiface_i.h>
  28. #include <class_drawpanel.h>
  29. #include <confirm.h>
  30. #include <pcb_edit_frame.h>
  31. #include <base_units.h>
  32. #include <printout_controler.h>
  33. #include <pcbnew.h>
  34. #include <pcbplot.h>
  35. #include <class_board.h>
  36. #include <enabler.h>
  37. #include <widgets/unit_binder.h>
  38. #include <dialog_print_using_printer_base.h>
  39. #define PEN_WIDTH_MAX_VALUE ( KiROUND( 5 * IU_PER_MM ) )
  40. #define PEN_WIDTH_MIN_VALUE ( KiROUND( 0.005 * IU_PER_MM ) )
  41. extern int g_DrawDefaultLineThickness;
  42. // Local variables
  43. static double s_ScaleList[] = { 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
  44. // Define min et max reasonable values for print scale
  45. #define MIN_SCALE 0.01
  46. #define MAX_SCALE 100.0
  47. // static print data and page setup data, to remember settings during the session
  48. static wxPrintData* s_PrintData;
  49. static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
  50. static PRINT_PARAMETERS s_Parameters;
  51. /**
  52. * Dialog to print schematic. Class derived from DIALOG_PRINT_USING_PRINTER_BASE
  53. * created by wxFormBuilder
  54. */
  55. class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
  56. {
  57. public:
  58. DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent );
  59. ~DIALOG_PRINT_USING_PRINTER() override;
  60. private:
  61. PCB_EDIT_FRAME* m_parent;
  62. wxConfigBase* m_config;
  63. // the list of existing board layers in wxCheckListBox, with the board layers id:
  64. std::pair<wxCheckListBox*, int> m_layers[PCB_LAYER_ID_COUNT];
  65. static bool m_ExcludeEdgeLayer;
  66. UNIT_BINDER m_defaultPenWidth;
  67. bool TransferDataToWindow() override;
  68. void OnPageSetup( wxCommandEvent& event ) override;
  69. void OnPrintPreview( wxCommandEvent& event ) override;
  70. void OnPrintButtonClick( wxCommandEvent& event ) override;
  71. void OnScaleSelectionClick( wxCommandEvent& event ) override;
  72. void SetPrintParameters();
  73. int SetLayerSetFromListSelection();
  74. };
  75. bool DIALOG_PRINT_USING_PRINTER::m_ExcludeEdgeLayer;
  76. void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
  77. {
  78. const PAGE_INFO& pageInfo = GetPageSettings();
  79. if( s_PrintData == NULL ) // First print
  80. {
  81. s_PrintData = new wxPrintData();
  82. if( !s_PrintData->Ok() )
  83. DisplayError( this, _( "Error Init Printer info" ) );
  84. s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
  85. }
  86. if( s_pageSetupData == NULL )
  87. s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
  88. s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
  89. s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
  90. if( pageInfo.IsCustom() )
  91. {
  92. if( pageInfo.IsPortrait() )
  93. s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ),
  94. Mils2mm( pageInfo.GetHeightMils() ) ) );
  95. else
  96. s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
  97. Mils2mm( pageInfo.GetWidthMils() ) ) );
  98. }
  99. *s_PrintData = s_pageSetupData->GetPrintData();
  100. DIALOG_PRINT_USING_PRINTER dlg( this );
  101. dlg.ShowModal();
  102. }
  103. DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent ) :
  104. DIALOG_PRINT_USING_PRINTER_BASE( parent ),
  105. m_parent( parent ),
  106. m_defaultPenWidth( parent, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits, true,
  107. PEN_WIDTH_MIN_VALUE, PEN_WIDTH_MAX_VALUE )
  108. {
  109. m_config = Kiface().KifaceSettings();
  110. memset( m_layers, 0, sizeof( m_layers ) );
  111. // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
  112. // that requires us to correct the button labels here.
  113. m_sdbSizer1OK->SetLabel( _( "Print" ) );
  114. m_sdbSizer1Apply->SetLabel( _( "Print Preview" ) );
  115. m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
  116. m_sdbSizer1->Layout();
  117. m_sdbSizer1OK->SetDefault();
  118. #ifdef __WXMAC__
  119. /* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
  120. m_sdbSizer1Apply->Hide();
  121. #endif
  122. FinishDialogSettings();
  123. }
  124. DIALOG_PRINT_USING_PRINTER::~DIALOG_PRINT_USING_PRINTER()
  125. {
  126. SetPrintParameters();
  127. if( m_config )
  128. {
  129. ConfigBaseWriteDouble( m_config, OPTKEY_PRINT_X_FINESCALE_ADJ, s_Parameters.m_XScaleAdjust );
  130. ConfigBaseWriteDouble( m_config, OPTKEY_PRINT_Y_FINESCALE_ADJ, s_Parameters.m_YScaleAdjust );
  131. m_config->Write( OPTKEY_PRINT_SCALE, m_ScaleOption->GetSelection() );
  132. m_config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref);
  133. m_config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
  134. m_config->Write( OPTKEY_PRINT_PAGE_PER_LAYER, s_Parameters.m_OptionPrintPage );
  135. m_config->Write( OPTKEY_PRINT_PADS_DRILL, (long) s_Parameters.m_DrillShapeOpt );
  136. for( unsigned layer = 0; layer < DIM(m_layers); ++layer )
  137. {
  138. if( m_layers[layer].first )
  139. {
  140. wxString key = wxString::Format( OPTKEY_LAYERBASE, layer );
  141. bool value = m_layers[layer].first->IsChecked( m_layers[layer].second );
  142. m_config->Write( key, value );
  143. }
  144. }
  145. }
  146. }
  147. bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow()
  148. {
  149. wxString msg;
  150. BOARD* board = m_parent->GetBoard();
  151. s_Parameters.m_PageSetupData = s_pageSetupData;
  152. // Create layer list.
  153. for( LSEQ seq = board->GetEnabledLayers().UIOrder(); seq; ++seq )
  154. {
  155. PCB_LAYER_ID layer = *seq;
  156. int checkIndex;
  157. if( IsCopperLayer( layer ) )
  158. {
  159. checkIndex = m_CopperLayersList->Append( board->GetLayerName( layer ) );
  160. m_layers[layer] = std::make_pair( m_CopperLayersList, checkIndex );
  161. }
  162. else
  163. {
  164. checkIndex = m_TechnicalLayersList->Append( board->GetLayerName( layer ) );
  165. m_layers[layer] = std::make_pair( m_TechnicalLayersList, checkIndex );
  166. }
  167. if( m_config )
  168. {
  169. wxString layerKey;
  170. layerKey.Printf( OPTKEY_LAYERBASE, layer );
  171. bool option;
  172. if( m_config->Read( layerKey, &option ) )
  173. m_layers[layer].first->Check( checkIndex, option );
  174. }
  175. }
  176. // Option for excluding contents of "Edges Pcb" layer
  177. m_Exclude_Edges_Pcb->Show( true );
  178. // Read the scale adjust option
  179. int scale_idx = 4; // default selected scale = ScaleList[4] = 1.000
  180. if( m_config )
  181. {
  182. m_config->Read( OPTKEY_PRINT_X_FINESCALE_ADJ, &s_Parameters.m_XScaleAdjust );
  183. m_config->Read( OPTKEY_PRINT_Y_FINESCALE_ADJ, &s_Parameters.m_YScaleAdjust );
  184. m_config->Read( OPTKEY_PRINT_SCALE, &scale_idx );
  185. m_config->Read( OPTKEY_PRINT_PAGE_FRAME, &s_Parameters.m_Print_Sheet_Ref, 1);
  186. m_config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1);
  187. m_config->Read( OPTKEY_PRINT_PAGE_PER_LAYER, &s_Parameters.m_OptionPrintPage, 0);
  188. int tmp;
  189. m_config->Read( OPTKEY_PRINT_PADS_DRILL, &tmp, PRINT_PARAMETERS::SMALL_DRILL_SHAPE );
  190. s_Parameters.m_DrillShapeOpt = (PRINT_PARAMETERS::DrillShapeOptT) tmp;
  191. // Test for a reasonable scale value. Set to 1 if problem
  192. if( s_Parameters.m_XScaleAdjust < MIN_SCALE || s_Parameters.m_XScaleAdjust > MAX_SCALE ||
  193. s_Parameters.m_YScaleAdjust < MIN_SCALE || s_Parameters.m_YScaleAdjust > MAX_SCALE )
  194. s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0;
  195. }
  196. m_ScaleOption->SetSelection( scale_idx );
  197. scale_idx = m_ScaleOption->GetSelection();
  198. s_Parameters.m_PrintScale = s_ScaleList[scale_idx];
  199. m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror);
  200. m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer);
  201. m_Print_Sheet_Ref->SetValue( s_Parameters.m_Print_Sheet_Ref );
  202. // Options to plot pads and vias holes
  203. m_drillMarksChoice->SetSelection( s_Parameters.m_DrillShapeOpt );
  204. m_outputMode->SetSelection( s_Parameters.m_Print_Black_and_White ? 1 : 0 );
  205. m_PagesOption->SetSelection(s_Parameters.m_OptionPrintPage);
  206. s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
  207. m_defaultPenWidth.SetValue( s_Parameters.m_PenDefaultSize );
  208. // Create scale adjust option
  209. msg.Printf( wxT( "%f" ), s_Parameters.m_XScaleAdjust );
  210. m_FineAdjustXscaleOpt->SetValue( msg );
  211. msg.Printf( wxT( "%f" ), s_Parameters.m_YScaleAdjust );
  212. m_FineAdjustYscaleOpt->SetValue( msg );
  213. bool enable = ( s_Parameters.m_PrintScale == 1.0 );
  214. m_FineAdjustXscaleOpt->Enable(enable);
  215. m_FineAdjustYscaleOpt->Enable(enable);
  216. return true;
  217. }
  218. int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
  219. {
  220. int page_count = 0;
  221. s_Parameters.m_PrintMaskLayer = LSET();
  222. for( unsigned layer = 0; layer < DIM(m_layers); ++layer )
  223. {
  224. if( m_layers[layer].first && m_layers[layer].first->IsChecked( m_layers[layer].second ) )
  225. {
  226. page_count++;
  227. s_Parameters.m_PrintMaskLayer.set( layer );
  228. }
  229. }
  230. // In Pcbnew force the EDGE layer to be printed or not with the other layers
  231. m_ExcludeEdgeLayer = m_Exclude_Edges_Pcb->IsChecked();
  232. s_Parameters.m_Flags = m_ExcludeEdgeLayer ? 0 : 1;
  233. if( m_PagesOption->GetSelection() != 0 )
  234. page_count = 1;
  235. s_Parameters.m_PageCount = page_count;
  236. return page_count;
  237. }
  238. void DIALOG_PRINT_USING_PRINTER::SetPrintParameters()
  239. {
  240. PCB_PLOT_PARAMS plot_opts = m_parent->GetPlotSettings();
  241. s_Parameters.m_PrintMirror = m_Print_Mirror->GetValue();
  242. s_Parameters.m_Print_Sheet_Ref = m_Print_Sheet_Ref->GetValue();
  243. s_Parameters.m_Print_Black_and_White = m_outputMode->GetSelection() != 0;
  244. s_Parameters.m_DrillShapeOpt =
  245. (PRINT_PARAMETERS::DrillShapeOptT) m_drillMarksChoice->GetSelection();
  246. s_Parameters.m_OptionPrintPage = m_PagesOption->GetSelection() != 0;
  247. SetLayerSetFromListSelection();
  248. int idx = m_ScaleOption->GetSelection();
  249. s_Parameters.m_PrintScale = s_ScaleList[idx];
  250. plot_opts.SetScale( s_Parameters.m_PrintScale );
  251. if( m_FineAdjustXscaleOpt )
  252. {
  253. if( s_Parameters.m_XScaleAdjust > MAX_SCALE || s_Parameters.m_YScaleAdjust > MAX_SCALE )
  254. DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very large value" ) );
  255. m_FineAdjustXscaleOpt->GetValue().ToDouble( &s_Parameters.m_XScaleAdjust );
  256. }
  257. if( m_FineAdjustYscaleOpt )
  258. {
  259. // Test for a reasonable scale value
  260. if( s_Parameters.m_XScaleAdjust < MIN_SCALE || s_Parameters.m_YScaleAdjust < MIN_SCALE )
  261. DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very small value" ) );
  262. m_FineAdjustYscaleOpt->GetValue().ToDouble( &s_Parameters.m_YScaleAdjust );
  263. }
  264. plot_opts.SetFineScaleAdjustX( s_Parameters.m_XScaleAdjust );
  265. plot_opts.SetFineScaleAdjustY( s_Parameters.m_YScaleAdjust );
  266. m_parent->SetPlotSettings( plot_opts );
  267. s_Parameters.m_PenDefaultSize = m_defaultPenWidth.GetValue();
  268. g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize;
  269. }
  270. void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )
  271. {
  272. double scale = s_ScaleList[m_ScaleOption->GetSelection()];
  273. bool enable = (scale == 1.0);
  274. if( m_FineAdjustXscaleOpt )
  275. m_FineAdjustXscaleOpt->Enable(enable);
  276. if( m_FineAdjustYscaleOpt )
  277. m_FineAdjustYscaleOpt->Enable(enable);
  278. }
  279. void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
  280. {
  281. wxPageSetupDialog pageSetupDialog( this, s_pageSetupData );
  282. pageSetupDialog.ShowModal();
  283. (*s_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
  284. (*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
  285. }
  286. void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
  287. {
  288. SetPrintParameters( );
  289. // If no layer selected, we have no plot. prompt user if it happens
  290. // because he could think there is a bug in Pcbnew:
  291. if( s_Parameters.m_PrintMaskLayer == 0 )
  292. {
  293. DisplayError( this, _( "No layer selected" ) );
  294. return;
  295. }
  296. // Pass two printout objects: for preview, and possible printing.
  297. wxString title = _( "Print Preview" );
  298. wxPrintPreview* preview =
  299. new wxPrintPreview( new BOARD_PRINTOUT_CONTROLLER( s_Parameters, m_parent, title ),
  300. new BOARD_PRINTOUT_CONTROLLER( s_Parameters, m_parent, title ),
  301. s_PrintData );
  302. preview->SetZoom( 100 );
  303. wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, m_parent->GetPosition(),
  304. m_parent->GetSize() );
  305. frame->SetMinSize( wxSize( 550, 350 ) );
  306. frame->Center();
  307. // On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want
  308. // close the frame using the X box in caption, when the preview frame is run
  309. // from a dialog
  310. frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
  311. // We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame
  312. // modal for its caller only.
  313. // An other reason is the fact when closing the frame without this option,
  314. // all top level frames are reenabled.
  315. // With this option, only the parent is reenabled.
  316. // Reenabling all top level frames should be made by the parent dialog.
  317. frame->InitializeWithModality( wxPreviewFrame_WindowModal );
  318. frame->Raise(); // Needed on Ubuntu/Unity to display the frame
  319. frame->Show( true );
  320. }
  321. void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
  322. {
  323. SetPrintParameters();
  324. // If no layer selected, we have no plot. prompt user if it happens
  325. // because he could think there is a bug in Pcbnew:
  326. if( s_Parameters.m_PrintMaskLayer == 0 )
  327. {
  328. DisplayError( this, _( "No layer selected." ) );
  329. return;
  330. }
  331. wxPrintDialogData printDialogData( *s_PrintData );
  332. printDialogData.SetMaxPage( s_Parameters.m_PageCount );
  333. wxPrinter printer( &printDialogData );
  334. wxString title = _( "Print" );
  335. BOARD_PRINTOUT_CONTROLLER printout( s_Parameters, m_parent, title );
  336. // Disable 'Print' button to prevent issuing another print
  337. // command before the previous one is finished (causes problems on Windows)
  338. ENABLER printBtnDisable( *m_sdbSizer1OK, false );
  339. if( !printer.Print( this, &printout, true ) )
  340. {
  341. if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
  342. DisplayError( this, _( "There was a problem printing." ) );
  343. }
  344. else
  345. {
  346. *s_PrintData = printer.GetPrintDialogData().GetPrintData();
  347. }
  348. }