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 "model/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_EVENT_TABLE()
87
88public:
89 // Constructors
92 wxWindow* parent, Route* route,
93 wxWindowID id = SYMBOL_ROUTEPRINT_SELECTION_IDNAME,
94 const wxString& caption = SYMBOL_ROUTEPRINT_SELECTION_TITLE,
95 const wxPoint& pos = SYMBOL_ROUTEPRINT_SELECTION_POSITION,
96 const wxSize& size = SYMBOL_ROUTEPRINT_SELECTION_SIZE,
97 long style = SYMBOL_ROUTEPRINT_SELECTION_STYLE);
99
100 // Creation
101 bool Create(wxWindow* parent,
102 wxWindowID id = SYMBOL_ROUTEPRINT_SELECTION_IDNAME,
103 const wxString& caption = SYMBOL_ROUTEPRINT_SELECTION_TITLE,
104 const wxPoint& pos = SYMBOL_ROUTEPRINT_SELECTION_POSITION,
105 const wxSize& size = SYMBOL_ROUTEPRINT_SELECTION_SIZE,
106 long style = SYMBOL_ROUTEPRINT_SELECTION_STYLE);
107
108 void CreateControls();
109
110 void SetColorScheme(ColorScheme cs);
111 void SetDialogTitle(const wxString& title);
112 void OnRoutepropCancelClick(wxCommandEvent& event);
113 void OnRoutepropOkClick(wxCommandEvent& event);
114
115 // Should we show tooltips?
116 static bool ShowToolTips();
117
118 wxButton* m_CancelButton;
119 wxButton* m_OKButton;
120
121 wxCheckBox* m_checkBoxWPName;
122 wxCheckBox* m_checkBoxWPPosition;
123 wxCheckBox* m_checkBoxWPCourse;
124 wxCheckBox* m_checkBoxWPDistanceToNext;
125 wxCheckBox* m_checkBoxWPDescription;
126
127 Route* route;
128};
129
130#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:75