~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/sdk/printing_types.cpp

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: 9426 $
 
6
 * $Id: printing_types.cpp 9426 2013-11-02 19:42:20Z alpha0010 $
 
7
 * $HeadURL: http://svn.code.sf.net/p/codeblocks/code/branches/release-16.xx/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
 
 
25
void InitPrinting()
 
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(2, 9, 1)
 
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(2, 9, 1)
 
39
        if (paperorientation == wxPORTRAIT)
 
40
            ppd->SetOrientation(wxPORTRAIT);
 
41
        else
 
42
            ppd->SetOrientation(wxLANDSCAPE);
 
43
        #else
 
44
        ppd->SetOrientation(paperorientation);
 
45
        #endif
 
46
    }
 
47
 
 
48
//    if (!g_pageSetupData)
 
49
//        g_pageSetupData = new wxPageSetupDialogData;
 
50
}
 
51
 
 
52
void DeInitPrinting()
 
53
{
 
54
    delete g_printer;
 
55
    g_printer = nullptr;
 
56
//    delete g_pageSetupData;
 
57
//    g_pageSetupData = 0;
 
58
}