11 #include "wx/stattext.h"
12 #include "wx/statbox.h"
13 #include "wx/button.h"
14 #include "wx/checkbox.h"
15 #include "wx/textctrl.h"
16 #include "wx/radiobox.h"
17 #include "wx/slider.h"
18 #include "wx/combobox.h"
21 #include "wx/cmndata.h"
24 #include "wx/statline.h"
27 #include "wx/prntbase.h"
28 #include "wx/printdlg.h"
30 #include "wx/filename.h"
31 #include "wx/tokenzr.h"
32 #include "wx/imaglist.h"
72 wxPageSetupDialogData* data)
74 , m_OrientationRadioBox(
NULL)
75 , m_MarginLeftText(
NULL)
76 , m_MarginTopText(
NULL)
77 , m_MarginRightText(
NULL)
78 , m_MarginBottomText(
NULL)
79 , m_PaperTypeChoice(
NULL)
98 size_t n = wxThePrintPaperDatabase->GetCount();
99 wxString *choices =
new wxString [
n];
101 for (
size_t i = 0;
i <
n;
i++)
103 wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(
i);
104 choices[
i] = paper->GetName();
112 wxSize(widget_width, wxDefaultCoord),
115 wxStaticBoxSizer *paper_choice_sizer =
new wxStaticBoxSizer(
119 paper_choice_sizer->Add(
m_PaperTypeChoice, 1, wxEXPAND|wxALL|wxALIGN_BOTTOM, 5 );
120 wxBoxSizer *paper_box =
new wxBoxSizer( wxHORIZONTAL );
121 paper_box->Add(paper_choice_sizer, 0, wxALL, 5);
123 wxString *choices2 =
new wxString[2];
124 choices2[0] =
wxT(
"Portrait");
125 choices2[1] =
wxT(
"Landscape");
127 wxDefaultPosition, wxDefaultSize, 2, choices2, 2);
132 mainsizer->Add( paper_box, 0, wxALL|wxALIGN_CENTER, 5 );
137 wxBoxSizer *
table =
new wxBoxSizer( wxHORIZONTAL );
139 wxBoxSizer *column1 =
new wxBoxSizer( wxVERTICAL );
140 column1->Add(
new wxStaticText(
this,
ePrintIDStatic,
wxT(
"Left margin (mm):")),1,wxALL|wxALIGN_CENTER,5 );
141 column1->Add(
new wxStaticText(
this,
ePrintIDStatic,
wxT(
"Top margin (mm):")),1,wxALL|wxALIGN_CENTER,5 );
142 table->Add( column1, 0, wxALL |wxEXPAND, 5 );
144 wxBoxSizer *column2 =
new wxBoxSizer( wxVERTICAL );
149 table->Add( column2, 0, wxRIGHT|wxTOP|wxBOTTOM |wxEXPAND, 5 );
151 wxBoxSizer *column3 =
new wxBoxSizer( wxVERTICAL );
152 column3->Add(
new wxStaticText(
this,
ePrintIDStatic,
wxT(
"Right margin (mm):")),1,wxALL|wxALIGN_CENTER,5 );
153 column3->Add(
new wxStaticText(
this,
ePrintIDStatic,
wxT(
"Bottom margin (mm):")),1,wxALL|wxALIGN_CENTER,5 );
154 table->Add( column3, 0, wxALL|wxEXPAND, 5 );
156 wxBoxSizer *column4 =
new wxBoxSizer( wxVERTICAL );
161 table->Add( column4, 0, wxRIGHT|wxTOP|wxBOTTOM|wxEXPAND, 5 );
163 mainsizer->Add(
table, 0, wxALIGN_CENTER );
184 if (
m_PageData.GetPrintData().GetOrientation() == wxPORTRAIT)
192 wxPrintPaperType*
type = wxThePrintPaperDatabase->FindPaperType(
195 if (!
type &&
m_PageData.GetPrintData().GetPaperId() != wxPAPER_NONE)
196 type = wxThePrintPaperDatabase->FindPaperType(
m_PageData.GetPrintData().GetPaperId());
214 m_PageData.SetMarginTopLeft( wxPoint(left,top) );
220 m_PageData.SetMarginBottomRight( wxPoint(right,bottom) );
228 m_PageData.GetPrintData().SetOrientation(wxPORTRAIT);
232 m_PageData.GetPrintData().SetOrientation(wxLANDSCAPE);
239 if (selectedItem != -1)
241 wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem);
244 m_PageData.SetPaperSize(wxSize(paper->GetWidth()/10, paper->GetHeight()/10));
245 m_PageData.GetPrintData().SetPaperId(paper->GetId());
263 size_t n = wxThePrintPaperDatabase->GetCount();
264 wxString *choices =
new wxString [
n];
266 for (
size_t i = 0;
i <
n;
i++)
268 wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(
i);
269 choices[
i] = paper->GetName();
272 (void)
new wxStaticText(
this,
ePrintIDStatic,
wxT(
"Paper size"), wxPoint(*x, *y));
275 wxComboBox *choice =
new wxComboBox(
this,
279 wxSize(300, wxDefaultCoord),
301 float large_side =
std::max(paperSize.GetWidth(), paperSize.GetHeight());
302 float small_side =
std::min(paperSize.GetWidth(), paperSize.GetHeight());
305 float small_side_cm = small_side / 10.0f;
307 wxPoint marginTopLeft =
m_PageData.GetMarginTopLeft();
308 wxPoint marginBottomRight =
m_PageData.GetMarginBottomRight();
309 int m_margin_left = marginTopLeft.x;
310 int m_margin_right = marginBottomRight.x;
311 int m_margin_top = marginTopLeft.y;
312 int m_margin_bottom = marginBottomRight.y;
314 float m_units_per_cm = 30.0f;
316 if (
m_PageData.GetPrintData().GetOrientation() == wxPORTRAIT)
318 float ratio = float(large_side - m_margin_top - m_margin_bottom) /
319 float(small_side - m_margin_left - m_margin_right);
322 m_margin_right/10.0f)*m_units_per_cm);
327 float ratio = float(large_side - m_margin_left - m_margin_right) /
328 float(small_side - m_margin_top - m_margin_bottom);
331 m_margin_bottom/10.0f)* m_units_per_cm);
338 float img_ratio = ((float)image_width)/(float)image_height;
349 if (paper_ratio > 1.0f && img_ratio < 1.0f) {
352 img_ratio = 1.0f/img_ratio;
354 else if (paper_ratio < 1.0f && img_ratio > 1.0f) {
357 img_ratio = 1.0f/img_ratio;
365 ylen = ((float)image_height) * (((float)
m_PrintCoordWidth)/((float)image_width));
virtual void UpdateMargins()
virtual void OnScroll(wxScrollEvent &event)
virtual bool TransferDataFromWindow()
wxRadioBox * m_MultiPageRadioBox
wxSlider * m_PageCountSlider
virtual void OnGuides(wxCommandEvent &event)
virtual void OnMultiPage(wxCommandEvent &event)
CGlPreviewSetupWidget * m_PreviewSetupWidget
virtual bool TransferDataToWindow()
wxTextCtrl * m_MarginRightText
virtual wxPageSetupDialogData & GetPageSetupDialogData()
Required as a subclass of wxPageSetupDialogBase.
wxTextCtrl * m_MarginLeftText
void OnPrinter(wxCommandEvent &event)
virtual ~CPrintSetupDlg()
wxComboBox * m_PaperTypeChoice
virtual bool TransferDataFromWindow()
wxComboBox * CreatePaperTypeChoice(int *x, int *y)
wxPageSetupDialogData m_PageData
virtual void x_Init(wxBoxSizer *mainsizer, int widget_width)
Provide virtual hook for subclasses to add their own controls below the main controls.
virtual bool TransferDataToWindow()
wxRadioBox * m_OrientationRadioBox
wxTextCtrl * m_MarginBottomText
wxTextCtrl * m_MarginTopText
IMPLEMENT_CLASS(CFloatingFrame, CFloatingFrameBaseClass) const static long kFloatFrameStyle
CFloatingFrame.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int
A callback function used to compare two keys in a database.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
WXDLLEXPORT_DATA(wxPrintPaperDatabase *) wxThePrintPaperDatabase