Code::Blocks  SVN r11506
printing_types.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 10769 $
6  * $Id: printing_types.cpp 10769 2016-02-06 14:26:58Z mortenmacfly $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/printing_types.cpp $
8  */
9 
10 #include "sdk_precomp.h"
11 #include "printing_types.h"
12 
13 #ifndef CB_PRECOMP
14  #include "manager.h"
15  #include "configmanager.h"
16 #endif
17 
18 // NOTE (Tiwag#1#): 061012 global wxPrinter, used in cbeditorprintout
19 // to get correct settings if changed in printer dialog
20 wxPrinter* g_printer = nullptr;
21 
22 // TODO (Tiwag#1#): 061012 Page Setup not implemented
23 // wxPageSetupData* g_pageSetupData = 0;
24 
26 {
27  if (!g_printer)
28  {
29  g_printer = new wxPrinter;
30  int paperid = Manager::Get()->GetConfigManager(_T("app"))->ReadInt(_T("/printerdialog/paperid"), wxPAPER_A4 );
31  #if wxCHECK_VERSION(3, 0, 0)
32  wxPrintOrientation paperorientation = static_cast<wxPrintOrientation>( Manager::Get()->GetConfigManager(_T("app"))->ReadInt(_T("/printerdialog/paperorientation"), wxPORTRAIT ) );
33  #else
34  int paperorientation = Manager::Get()->GetConfigManager(_T("app"))->ReadInt(_T("/printerdialog/paperorientation"), wxPORTRAIT );
35  #endif
36  wxPrintData* ppd = &(g_printer->GetPrintDialogData().GetPrintData());
37  ppd->SetPaperId((wxPaperSize)paperid);
38  #if wxCHECK_VERSION(3, 0, 0)
39  if (paperorientation == wxPORTRAIT)
41  else
43  #else
44  ppd->SetOrientation(paperorientation);
45  #endif
46  }
47 
48 // if (!g_pageSetupData)
49 // g_pageSetupData = new wxPageSetupDialogData;
50 }
51 
53 {
54  delete g_printer;
55  g_printer = nullptr;
56 // delete g_pageSetupData;
57 // g_pageSetupData = 0;
58 }
ConfigManager * GetConfigManager(const wxString &name_space) const
Definition: manager.cpp:474
int ReadInt(const wxString &name, int defaultVal=0)
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
Definition: manager.cpp:182
void SetOrientation(wxPrintOrientation orientation)
wxPaperSize
#define _T(string)
void InitPrinting()
wxPrintData & GetPrintData()
void DeInitPrinting()
wxPrinter * g_printer
wxPrintOrientation
virtual wxPrintDialogData & GetPrintDialogData() const
void SetPaperId(wxPaperSize paperId)