-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwxTEDMain.h
350 lines (306 loc) · 13.1 KB
/
wxTEDMain.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
/***************************************************************
* Name: wxTEDMain.h
* Purpose: Defines Application Frame
* Author: Peter Kwan ([email protected])
* Created: 2014-10-30
* Copyright: Peter Kwan (c) 2014-2022
* License:
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for any purpose and without fee is hereby
* granted, provided that the above copyright notice appear in all
* copies and that both that the copyright notice and this
* permission notice and warranty disclaimer appear in supporting
* documentation, and that the name of the author not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* The author disclaims all warranties with regard to this
* software, including all implied warranties of merchantability
* and fitness. In no event shall the author be liable for any
* special, indirect or consequential damages or any damages
* whatsoever resulting from loss of use, data or profits, whether
* in an action of contract, negligence or other tortious action,
* arising out of or in connection with the use or performance of
* this software.
*************************************************************************** **/
#ifndef WXTEDMAIN_H
#define WXTEDMAIN_H
//(*Headers(wxTEDFrame)
#include <wx/filedlg.h>
#include <wx/frame.h>
#include <wx/menu.h>
#include <wx/panel.h>
#include <wx/statusbr.h>
#include <wx/timer.h>
//*)
#include <wx/clipbrd.h>
#include <wx/config.h>
#include <wx/persist.h>
#include <wx/persist/toplevel.h>
/*
<wx/confbase.h> - Base config class.
<wx/fileconf.h> - wxFileConfig class.
// <wx/msw/regconf.h> - wxRegConfig class, see also wxRegKey.
*/
#include "HelpFrame.h"
#include <sstream>
#include "ttxpage.h"
#include "PageSettingsDialog.h"
#include "mapchar.h"
// Version number
#define VERSION_STRING wxT("1.54")
// Publish setup
#include "PublishSetupDialog.h"
// Export to teletext40
#include "teletext40.h"
class wxTEDFrame: public wxFrame
{
public:
wxTEDFrame(wxWindow* parent,wxWindowID id = -1, wxString initialPage="wxtedsplash.tti");
virtual ~wxTEDFrame();
inline TTXPage* Page(){return m_rootPage;};
private:
bool m_escapeMode; /// True if the last key pressed was Escape
int m_menuCount; // How many menus are open
bool m_inhibitStatus; // Inhibit the status bar while menus are up
bool m_ShowMarkup; // If true, we show ttx markup
bool m_Released; // If true, m_ShowMarkup can be toggled
// Language menu
void SetRegionMenu(int region);
unsigned int m_ttxW; /// Font width
unsigned int m_ttxH; /// Font height
// Cursor
wxPoint m_cursorPoint; /// Cursor location (in character coordinates)
wxPoint m_subPixelPoint; /// Sub-pixel location when in graphics mode
bool m_blinkToggle; /// Blink state
bool m_cursorIsAlpha; /// Selects graphics or alpha
void m_SetStatus(); /// Shows cursor location and character info
bool m_reveal; /// True if we should reveal concealed text
// Copy buffer
bool m_dragging;
wxPoint m_MarqueeStart;
wxPoint m_MarqueeEnd;
void CopyTextToClipboard(wxString text);
wxString GetTextFromClipboard();
// Page
TTXPage* m_rootPage; /// This is the root page used for load/save
TTXPage* m_currentPage; /// This may point to a sub-page and is the page currently viewed and edited
void m_resize(wxSize event);
wchar_t mapTextChar(wchar_t ch); /// Maps a teletext character to a teletext2 font if they aren't the same
int m_iPageCount; /// How many pages in this set?
int iPage; /// Which page are we looking at?
wxPoint m_offset; /// The offset of the current page
wxPoint m_slideOrigin; /// X,Y Origin of a slide
bool m_slidePages; /// True if we are sliding the page with the right mouse key
bool m_focused; /// Frame
bool m_previewMode{false}; /// Preview carousel mode. @todo Hide the menu option for a single frame page
bool m_normalMode{true}; /// Normal mode means using the page's animation timings
bool m_bounceMode{false}; /// Does the animation direction bounce?
bool m_previewForwards{true}; /// true = forwards, false = backwards
void ShowPreviewMenu(); /// Show the preview menu if appropriate
std::string m_path{""}; /// Path of the last file that was loaded (Do we need to set this to dot? What about Windows?)
// Properties Dialog
PageSettingsDialog* m_propertiesDlg;
// Config
wxConfig *m_config;
// Help
HelpFrame* helpFrame;
// Publishing
wxString m_publish_ftp_server;
wxString m_publish_ftp_username;
wxString m_publish_ftp_password;
wxString m_publish_ftp_remote;
// Header
/** Takes a teletext header template and does the field substitutions
* \param line of text to transform
*/
void GenerateHeader(TTXLine* line);
//(*Handlers(wxTEDFrame)
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnMenuNew(wxCommandEvent& event);
void OnMenuSaveAs(wxCommandEvent& event);
void OnMenuItemProperties(wxCommandEvent& event);
void OnMenuItemPublish(wxCommandEvent& event);
void OnMenuItemUndo(wxCommandEvent& event);
void OnKillFocus(wxFocusEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnMenuItemInsertSubpage(wxCommandEvent& event);
void OnMenuItemDeletePage(wxCommandEvent& event);
void OnMenuItemLanguageSelected(wxCommandEvent& event);
void OnMenuItemLanguage(wxCommandEvent& event);
void OnMenuItemPublishSettings(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
void OnMenuItemConcealToggle(wxCommandEvent& event);
void OnMouseWheel(wxMouseEvent& event);
void OnLeftUp(wxMouseEvent& event);
void OnMouseMove(wxMouseEvent& event);
void OnMenuItemCopySelected(wxCommandEvent& event);
void OnMenuItemPasteSelected(wxCommandEvent& event);
void OnMenuItemSelectAllSelected(wxCommandEvent& event);
void OnMenuItemRegionSelected(wxCommandEvent& event);
void OnMenuSpecialKeys(wxCommandEvent& event);
void OnMenuItemExportTTX40Selected(wxCommandEvent& event);
void OnKeyDown(wxKeyEvent& event);
void OnKeyUp(wxKeyEvent& event);
void OnPanel1Paint(wxPaintEvent& event);
void OnMenuItemNewWindow(wxCommandEvent& event);
void OnMenuItemZXNetSelected(wxCommandEvent& event);
void OnRightDown(wxMouseEvent& event);
void OnRightUp(wxMouseEvent& event);
void OnPanel1MouseMove(wxMouseEvent& event);
void OnPanel1Paint1(wxPaintEvent& event);
void OnMenuNewFromTemplate(wxCommandEvent& event);
void OnMenuDeleteLineSelected(wxCommandEvent& event);
void OnMenuInsertLineSelected(wxCommandEvent& event);
void OnPanel1KeyDown(wxKeyEvent& event);
void OnLeftDown(wxMouseEvent& event);
void OnPaint(wxPaintEvent& event);
void OnSize(wxSizeEvent& event);
void OnChar(wxKeyEvent& event);
void OnTimer(wxTimerEvent& event);
void OnEraseBackground(wxEraseEvent& event);
void OnSave(wxCommandEvent& event);
void OnMenuOpen(wxMenuEvent& event); // On opening the menu
void OnMenuClose(wxMenuEvent& event); // On closing the menu
void OnPanel1Char(wxKeyEvent& event);
void OnPanelTEMPORARYPaint(wxPaintEvent& event);
void OnPanel1LeftDClick(wxMouseEvent& event);
void OnMenuOpenPage(wxCommandEvent& event);
void OnMenuPreviewModeSelected(wxCommandEvent& event);
void OnPreviewRunSelected(wxCommandEvent& event);
void OnPreviewSpeed(wxCommandEvent& event);
void OnPreviewNormalSelected(wxCommandEvent& event);
//*)
/* Set the language menu radio option */
void m_setLanguage();
/**
* \return true if the character is in the range of mosaics, not including A-Z.
*/
bool isMosaic(char ch);
/// Update the preview settings (speed and mode)
void UpdatePreview();
wxSize m_fontSize[100];
wxWindow* m_parentWindow;
//(*Identifiers(wxTEDFrame)
static const long ID_PANEL1;
static const long idNewPage;
static const long idNewFromTemplate;
static const long idOpenPage;
static const long idSavePage;
static const long isSavePageAs;
static const long idExportTTX40;
static const long isExportZxnet;
static const long idMenuQuit;
static const long idNewWindow;
static const long idUndo;
static const long idCut;
static const long idCopy;
static const long idPaste;
static const long idSelectAll;
static const long isInsertLine;
static const long isDeleteLine;
static const long idInsertPage;
static const long idDeleteSubPage;
static const long idLanguageEnglish;
static const long idLanguageFrench;
static const long idLanguageSwedish;
static const long idLanguageCzechSlovak;
static const long idLanguageGerman;
static const long idLanguageSpanish;
static const long idLanguageItalian;
static const long idLanguageUnused;
static const long ID_MENUITEM1;
static const long ID_REGION0;
static const long ID_REGION1;
static const long ID_REGION2;
static const long ID_REGION3;
static const long ID_REGION4;
static const long ID_REGION6;
static const long ID_REGION8;
static const long ID_REGION10;
static const long ID_REGION;
static const long idPageNumber;
static const long ID_MENUITEMSHOWHEADER;
static const long ID_HIDECONCEAL;
static const long idRun;
static const long idRadioMode;
static const long idRadioBounce;
static const long idRadioMode0;
static const long idRadioMode1;
static const long idRadioMode2;
static const long idRadioMode3;
static const long idRadioMode4;
static const long idRadioMode5;
static const long idSpecialKeys;
static const long idMenuAbout;
static const long ID_STATUSBAR1;
static const long ID_TIMER1;
//*)
static const long idMenuOpen;
static const long idMenuClose;
//(*Declarations(wxTEDFrame)
wxFileDialog* FileDialogSaveAs;
wxFileDialog* LoadPageFileDialog;
wxMenu* Menu2;
wxMenu* Menu3;
wxMenu* MenuItem2;
wxMenu* MenuItemLanguage;
wxMenu* MenuPresentation;
wxMenuItem* MenuDeleteLine;
wxMenuItem* MenuExportZxnet;
wxMenuItem* MenuInsertLine;
wxMenuItem* MenuItem11;
wxMenuItem* MenuItem1;
wxMenuItem* MenuItem3;
wxMenuItem* MenuItem4;
wxMenuItem* MenuItemConcealToggle;
wxMenuItem* MenuItemCopy;
wxMenuItem* MenuItemCzech;
wxMenuItem* MenuItemDeletePage;
wxMenuItem* MenuItemEnglish;
wxMenuItem* MenuItemExportTTX40;
wxMenuItem* MenuItemFrench;
wxMenuItem* MenuItemGerman;
wxMenuItem* MenuItemInsertSubpage;
wxMenuItem* MenuItemItalian;
wxMenuItem* MenuItemPageNumber;
wxMenuItem* MenuItemPaste;
wxMenuItem* MenuItemRegion0;
wxMenuItem* MenuItemRegion10;
wxMenuItem* MenuItemRegion1;
wxMenuItem* MenuItemRegion2;
wxMenuItem* MenuItemRegion3;
wxMenuItem* MenuItemRegion4;
wxMenuItem* MenuItemRegion6;
wxMenuItem* MenuItemRegion8;
wxMenuItem* MenuItemSave;
wxMenuItem* MenuItemSaveAs;
wxMenuItem* MenuItemSelectAll;
wxMenuItem* MenuItemShowHeader;
wxMenuItem* MenuItemSpanish;
wxMenuItem* MenuItemSpecialKeys;
wxMenuItem* MenuItemSwedish;
wxMenuItem* MenuItemTemplate;
wxMenuItem* MenuItemUndo;
wxMenuItem* MenuItemUnused;
wxMenuItem* ModeBounce;
wxMenuItem* ModeLoop;
wxMenuItem* Preview12fps;
wxMenuItem* Preview25fps;
wxMenuItem* Preview2fps;
wxMenuItem* Preview30fps;
wxMenuItem* Preview6fps;
wxMenuItem* PreviewNormal;
wxMenuItem* PreviewRun;
wxPanel* Panel1;
wxStatusBar* StatusBar1;
wxTimer m_Timer1;
//*)
DECLARE_EVENT_TABLE()
};
#ifdef __WXMSW__
int send(LPCTSTR ftp, LPCTSTR user, LPCTSTR pass, LPCTSTR pathondisk, LPTSTR nameonftp);
#endif // __WXMSW__
#endif // WXTEDMAIN_H