OpenCPN Partial API docs
Loading...
Searching...
No Matches
trackprintout.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: OpenCP Track printout
5 * Author: Pavel Saviankou, Sean D'Epagnier
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 __TRACKPRINTOUT_H__
29#define __TRACKPRINTOUT_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 "TrackPropDlg.h"
42#include "printtable.h"
43#include "ocpn_frame.h"
44
46public:
47 MyTrackPrintout(std::vector<bool> _toPrintOut, Track* track,
48 OCPNTrackListCtrl* lcPoints,
49 const wxString& title = _T( "My Track printout" ));
50 virtual bool OnPrintPage(int page);
51 void DrawPage(wxDC* dc);
52 virtual void OnPreparePrinting();
53 virtual bool HasPage(int num) { return num > 0 && num <= numberOfPages; };
54
55 virtual void GetPageInfo(int* minPage, int* maxPage, int* selPageFrom,
56 int* selPageTo);
57
58protected:
59 wxDC* myDC;
60 PrintTable table;
61 Track* myTrack;
62 std::vector<bool> toPrintOut; // list of fields of bool, if certain element
63 // should be print out.
64 static const int pN = 5; // number of fields sofar
65 int pageToPrint;
66 int numberOfPages;
67 int marginX;
68 int marginY;
69 int textOffsetX;
70 int textOffsetY;
71};
72
73// track elements selection dialog
75#define ID_TRACKPRINTSELECTION 9000
76#define SYMBOL_TRACKPRINT_SELECTION_STYLE \
77 wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
78#define SYMBOL_TRACKPRINT_SELECTION_TITLE _("Print Track Selection")
79#define SYMBOL_TRACKPRINT_SELECTION_IDNAME ID_TRACKPRINTSELECTION
80#define SYMBOL_TRACKPRINT_SELECTION_SIZE wxSize(750, 300)
81#define SYMBOL_TRACKPRINT_SELECTION_POSITION wxDefaultPosition
82
83#define ID_TRACKPRINT_SELECTION_OK 9001
84#define ID_TRACKPRINT_SELECTION_CANCEL 9002
85
86class TrackPrintSelection : public wxDialog {
87 DECLARE_DYNAMIC_CLASS(TrackPrintSelection)
88 DECLARE_EVENT_TABLE()
89
90public:
91 // Constructors
94 wxWindow* parent, Track* track, OCPNTrackListCtrl* lcPoints,
95 wxWindowID id = SYMBOL_TRACKPRINT_SELECTION_IDNAME,
96 const wxString& caption = SYMBOL_TRACKPRINT_SELECTION_TITLE,
97 const wxPoint& pos = SYMBOL_TRACKPRINT_SELECTION_POSITION,
98 const wxSize& size = SYMBOL_TRACKPRINT_SELECTION_SIZE,
99 long style = SYMBOL_TRACKPRINT_SELECTION_STYLE);
101
102 // Creation
103 bool Create(wxWindow* parent,
104 wxWindowID id = SYMBOL_TRACKPRINT_SELECTION_IDNAME,
105 const wxString& caption = SYMBOL_TRACKPRINT_SELECTION_TITLE,
106 const wxPoint& pos = SYMBOL_TRACKPRINT_SELECTION_POSITION,
107 const wxSize& size = SYMBOL_TRACKPRINT_SELECTION_SIZE,
108 long style = SYMBOL_TRACKPRINT_SELECTION_STYLE);
109
110 void CreateControls();
111 void SetColorScheme(ColorScheme cs);
112 void SetDialogTitle(const wxString& title);
113 void OnTrackpropCancelClick(wxCommandEvent& event);
114 void OnTrackpropOkClick(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_checkBoxPosition;
123 wxCheckBox* m_checkBoxCourse;
124 wxCheckBox* m_checkBoxDistance;
125 wxCheckBox* m_checkBoxTime;
126 wxCheckBox* m_checkBoxSpeed;
127
128 Track* track;
129 OCPNTrackListCtrl* m_lcPoints;
130};
131
132#endif
Extension of a class Table with printing into dc.
Definition: printtable.h:185
bool Create(wxWindow *parent, wxWindowID id=SYMBOL_TRACKPRINT_SELECTION_IDNAME, const wxString &caption=SYMBOL_TRACKPRINT_SELECTION_TITLE, const wxPoint &pos=SYMBOL_TRACKPRINT_SELECTION_POSITION, const wxSize &size=SYMBOL_TRACKPRINT_SELECTION_SIZE, long style=SYMBOL_TRACKPRINT_SELECTION_STYLE)
Definition: track.h:79