Code::Blocks
SVN r11506
src
printdlg.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3
* http://www.gnu.org/licenses/gpl-3.0.html
4
*
5
* $Revision: 10912 $
6
* $Id: printdlg.cpp 10912 2016-09-25 16:10:13Z fuscated $
7
* $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/src/printdlg.cpp $
8
*/
9
10
#include "
sdk.h
"
11
#ifndef CB_PRECOMP
12
#include <
wx/button.h
>
13
#include <
wx/intl.h
>
14
#include <
wx/checkbox.h
>
15
#include <
wx/radiobox.h
>
16
#include <
wx/string.h
>
17
#include <
wx/xrc/xmlres.h
>
18
#include "
cbeditor.h
"
19
#include "
configmanager.h
"
20
#include "
editormanager.h
"
21
#include "manager.h"
22
#endif
23
#include "
cbstyledtextctrl.h
"
24
25
#include "
printdlg.h
"
26
27
PrintDialog::PrintDialog
(
wxWindow
* parent)
28
{
29
//ctor
30
wxXmlResource::Get
()->
LoadObject
(
this
, parent,
_T
(
"dlgPrint"
),
_T
(
"wxScrollingDialog"
));
31
XRCCTRL(*
this
,
"wxID_OK"
,
wxButton
)->SetDefault();
32
33
cbEditor
* ed =
Manager::Get
()->
GetEditorManager
()->
GetBuiltinActiveEditor
();
34
if
(ed)
35
{
36
bool
hasSel = ed->
GetControl
()->
GetSelectedText
().
Length
();
37
XRCCTRL(*
this
,
"rbScope"
,
wxRadioBox
)->SetSelection(hasSel ? 0 : 1);
38
}
39
else
40
XRCCTRL(*
this
,
"rbScope"
,
wxRadioBox
)->SetSelection(1);
41
42
int
mode =
Manager::Get
()->
GetConfigManager
(
_T
(
"app"
))->
ReadInt
(
_T
(
"/print_mode"
), 1);
43
XRCCTRL(*
this
,
"rbColourMode"
,
wxRadioBox
)->SetSelection(mode);
44
bool
print_line_numbers =
Manager::Get
()->
GetConfigManager
(
_T
(
"app"
))->
ReadBool
(
_T
(
"/print_line_numbers"
),
true
);
45
XRCCTRL(*
this
,
"chkLineNumbers"
,
wxCheckBox
)->SetValue(print_line_numbers);
46
}
47
48
PrintDialog::~PrintDialog
()
49
{
50
//dtor
51
}
52
53
PrintScope
PrintDialog::GetPrintScope
()
const
54
{
55
return
(
PrintScope
)XRCCTRL(*
this
,
"rbScope"
,
wxRadioBox
)->GetSelection();
56
}
57
58
PrintColourMode
PrintDialog::GetPrintColourMode
()
const
59
{
60
return
(
PrintColourMode
)XRCCTRL(*
this
,
"rbColourMode"
,
wxRadioBox
)->GetSelection();
61
}
62
63
bool
PrintDialog::GetPrintLineNumbers
()
const
64
{
65
return
XRCCTRL(*
this
,
"chkLineNumbers"
,
wxCheckBox
)->GetValue();
66
}
67
68
void
PrintDialog::EndModal
(
int
retCode)
69
{
70
if
(retCode ==
wxID_OK
)
71
{
72
int
mode = XRCCTRL(*
this
,
"rbColourMode"
,
wxRadioBox
)->GetSelection();
73
Manager::Get
()->
GetConfigManager
(
_T
(
"app"
))->
Write
(
_T
(
"/print_mode"
), (
int
)mode);
74
Manager::Get
()->
GetConfigManager
(
_T
(
"app"
))->
Write
(
_T
(
"/print_line_numbers"
),
GetPrintLineNumbers
());
75
}
76
return
wxScrollingDialog::EndModal
(retCode);
77
}
button.h
ScriptBindings::EndModal
void EndModal(int retCode)
Definition:
sc_dialog.cpp:112
radiobox.h
intl.h
Manager::GetConfigManager
ConfigManager * GetConfigManager(const wxString &name_space) const
Definition:
manager.cpp:474
ConfigManager::ReadInt
int ReadInt(const wxString &name, int defaultVal=0)
Definition:
configmanager.cpp:1011
Manager::Get
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
string.h
PrintDialog::PrintDialog
PrintDialog(wxWindow *parent)
Definition:
printdlg.cpp:27
PrintColourMode
PrintColourMode
Definition:
printing_types.h:27
ConfigManager::ReadBool
bool ReadBool(const wxString &name, bool defaultVal=false)
Definition:
configmanager.cpp:1044
wxString::Length
size_t Length() const
_T
#define _T(string)
printdlg.h
wxButton
Manager::GetEditorManager
EditorManager * GetEditorManager() const
Definition:
manager.cpp:434
wxScintilla::GetSelectedText
wxString GetSelectedText()
Retrieve the selected text.
ConfigManager::Write
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
Definition:
configmanager.cpp:859
wxID_OK
cbEditor::GetControl
cbStyledTextCtrl * GetControl() const
Returns a pointer to the underlying cbStyledTextCtrl object (which itself is the wxWindows implementa...
Definition:
cbeditor.cpp:842
cbeditor.h
PrintDialog::GetPrintScope
PrintScope GetPrintScope() const
Definition:
printdlg.cpp:53
EditorManager::GetBuiltinActiveEditor
cbEditor * GetBuiltinActiveEditor()
Definition:
editormanager.h:95
editormanager.h
checkbox.h
PrintScope
PrintScope
Definition:
printing_types.h:19
wxCheckBox
PrintDialog::~PrintDialog
virtual ~PrintDialog()
Definition:
printdlg.cpp:48
cbEditor
A file editor.
Definition:
cbeditor.h:43
cbstyledtextctrl.h
xmlres.h
wxXmlResource::Get
static wxXmlResource * Get()
PrintDialog::GetPrintColourMode
PrintColourMode GetPrintColourMode() const
Definition:
printdlg.cpp:58
PrintDialog::GetPrintLineNumbers
bool GetPrintLineNumbers() const
Definition:
printdlg.cpp:63
PrintDialog::EndModal
virtual void EndModal(int retCode)
Definition:
printdlg.cpp:68
wxRadioBox
sdk.h
wxWindow
wxXmlResource::LoadObject
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
configmanager.h
Generated by
1.8.13