OpenCPN Partial API docs
Loading...
Searching...
No Matches
routeprintout.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: OpenCP Route printout
5 * Author: Pavel Saviankou
6 *
7 ***************************************************************************
8 * Copyright (C) 2010 by David S. Register *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24 **************************************************************************/
25
26#include <iostream>
27
28#ifndef __ROUTEPRINTOUT_H__
29#define __ROUTEPRINTOUT_H__
30
31#include <wx/print.h>
32#include <wx/datetime.h>
33#include <wx/cmdline.h>
34
35#ifdef __WXMSW__
36#include <wx/msw/private.h>
37#endif
38
39#include "ocpn_types.h"
40#include "navutil.h"
41#include "printtable.h"
42#include "ocpn_frame.h"
43
45public:
46 MyRoutePrintout(std::vector<bool> _toPrintOut, Route* route,
47 const wxString& title = _T( "My Route printout" ));
48 virtual bool OnPrintPage(int page);
49 void DrawPage(wxDC* dc);
50 virtual void OnPreparePrinting();
51
52 virtual bool HasPage(int num) { return num > 0 && num <= numberOfPages; };
53
54 virtual void GetPageInfo(int* minPage, int* maxPage, int* selPageFrom,
55 int* selPageTo);
56
57protected:
58 wxDC* myDC;
59 PrintTable table;
60 Route* myRoute;
61 std::vector<bool> toPrintOut; // list of fields of bool, if certain element
62 // should be print out.
63 static const int pN = 5; // number of fields sofar
64 int pageToPrint;
65 int numberOfPages;
66 int marginX;
67 int marginY;
68 int textOffsetX;
69 int textOffsetY;
70};
71
72// route elements selection dialog
74#define ID_ROUTEPRINTSELECTION 9000
75#define SYMBOL_ROUTEPRINT_SELECTION_STYLE \
76 wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
77#define SYMBOL_ROUTEPRINT_SELECTION_TITLE _("Print Route Selection")
78#define SYMBOL_ROUTEPRINT_SELECTION_IDNAME ID_ROUTEPRINTSELECTION
79#define SYMBOL_ROUTEPRINT_SELECTION_SIZE wxSize(750, 300)
80#define SYMBOL_ROUTEPRINT_SELECTION_POSITION wxDefaultPosition
81
82#define ID_ROUTEPRINT_SELECTION_OK 9001
83#define ID_ROUTEPRINT_SELECTION_CANCEL 9002
84
85class RoutePrintSelection : public wxDialog {
86 DECLARE_DYNAMIC_CLASS(RoutePrintSelection)
87 DECLARE_EVENT_TABLE()
88
89public:
90 // Constructors
93 wxWindow* parent, Route* route,
94 wxWindowID id = SYMBOL_ROUTEPRINT_SELECTION_IDNAME,
95 const wxString& caption = SYMBOL_ROUTEPRINT_SELECTION_TITLE,
96 const wxPoint& pos = SYMBOL_ROUTEPRINT_SELECTION_POSITION,
97 const wxSize& size = SYMBOL_ROUTEPRINT_SELECTION_SIZE,
98 long style = SYMBOL_ROUTEPRINT_SELECTION_STYLE);
100
101 // Creation
102 bool Create(wxWindow* parent,
103 wxWindowID id = SYMBOL_ROUTEPRINT_SELECTION_IDNAME,
104 const wxString& caption = SYMBOL_ROUTEPRINT_SELECTION_TITLE,
105 const wxPoint& pos = SYMBOL_ROUTEPRINT_SELECTION_POSITION,
106 const wxSize& size = SYMBOL_ROUTEPRINT_SELECTION_SIZE,
107 long style = SYMBOL_ROUTEPRINT_SELECTION_STYLE);
108
109 void CreateControls();
110
111 void SetColorScheme(ColorScheme cs);
112 void SetDialogTitle(const wxString& title);
113 void OnRoutepropCancelClick(wxCommandEvent& event);
114 void OnRoutepropOkClick(wxCommandEvent& event);
115
116 // Should we show tooltips?
117 static bool ShowToolTips();
118
119 wxButton* m_CancelButton;
120 wxButton* m_OKButton;
121
122 wxCheckBox* m_checkBoxWPName;
123 wxCheckBox* m_checkBoxWPPosition;
124 wxCheckBox* m_checkBoxWPCourse;
125 wxCheckBox* m_checkBoxWPDistanceToNext;
126 wxCheckBox* m_checkBoxWPDescription;
127
128 Route* route;
129};
130
131#endif
Extension of a class Table with printing into dc.
Definition: printtable.h:185
bool Create(wxWindow *parent, wxWindowID id=SYMBOL_ROUTEPRINT_SELECTION_IDNAME, const wxString &caption=SYMBOL_ROUTEPRINT_SELECTION_TITLE, const wxPoint &pos=SYMBOL_ROUTEPRINT_SELECTION_POSITION, const wxSize &size=SYMBOL_ROUTEPRINT_SELECTION_SIZE, long style=SYMBOL_ROUTEPRINT_SELECTION_STYLE)
Definition: route.h:70