File: gui.h

package info (click to toggle)
pgn2web 0.4-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 2,116 kB
  • sloc: ansic: 1,938; cpp: 419; makefile: 39
file content (124 lines) | stat: -rw-r--r-- 2,715 bytes parent folder | download | duplicates (5)
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
#include <wx/wx.h>
#include <wx/config.h>
#include <wx/filename.h>
#include <wx/image.h>

#include "pgn2web.h"

//include icon resource
#include "pgn2web.xpm"

//define constant for system dependent file seperator
#ifdef WINDOWS
const wxChar SEPERATOR = wxT('\\');
#else
const wxChar SEPERATOR = wxT('/');
#endif

// default installation path (*nix)
#ifndef INSTALL_PATH
#define INSTALL_PATH "/usr/share/pgn2web/"
#endif

//define event ids
enum { ID_BROWSEPGN = (wxID_HIGHEST   1), ID_BROWSEHTML, ID_CHOOSE, ID_CONVERT,
       ID_UPDATE_PROGRESS };

DECLARE_EVENT_TYPE(wxEVT_UPDATE_PROGRESS, -1) //custom event type for progress updates

class PiecesView : public wxWindow {

 public:
  PiecesView(wxWindow* parent, const wxString& resourcePath);
  ~PiecesView();

  void onPaint(wxPaintEvent& event);

  void setPieceSet(int set);

 protected:
  static const wxChar* pieceSets[16];

  int pieceSet;
  wxBitmap* pieceBitmaps[16][6];

  DECLARE_EVENT_TABLE()
};

class pgn2webThread : public wxThread {

 public:
  pgn2webThread(wxEvtHandler *listener, const wxString& resourcePath,
		const wxString& PGNFilename, const wxString& HTMLFilename, bool credit,
		const wxString& pieces, STRUCTURE layout);

  ExitCode Entry();

 protected:
  // parameters for pgn2web function
  wxString     m_resourcePath;
  wxEvtHandler *m_listener;
  wxString     m_PGNFilename;
  wxString     m_HTMLFilename;
  bool         m_credit;
  wxString     m_pieces;
  STRUCTURE    m_layout;
};

class ProgressDialog : public wxDialog {

 public:
  ProgressDialog(wxWindow* parent);

  void updateProgress(wxCommandEvent& event);

 private:
  void set_properties();
  void do_layout();
  
 protected:
  wxStaticText* progressText;
  wxGauge*      progressGauge;
  wxButton*     progressOk;

  DECLARE_EVENT_TABLE()
};

class p2wFrame: public wxFrame {

 public:
  p2wFrame(const wxString& installPath);

  void browsePGN(wxCommandEvent& event);
  void browseHTML(wxCommandEvent& event);
  void choosePieceSet(wxCommandEvent& event);
  void convert(wxCommandEvent& event);
  void quit(wxCommandEvent& event);

 private:
  void set_properties();
  void do_layout();
  
 protected:
  wxString       m_installPath;

  wxPanel*       rootPanel;
  wxStaticBox*   optionsBox;
  wxStaticText*  pgnLabel;
  wxTextCtrl*    pgnText;
  wxButton*      pgnButton;
  wxStaticText*  htmlLabel;
  wxTextCtrl*    htmlText;
  wxButton*      htmlButton;
  wxCheckBox*    linkCheckBox;
  PiecesView*    piecesView;
  wxChoice*      piecesChoice;
  wxStaticText*  layoutLabel;
  wxRadioButton* framesetRadio;
  wxRadioButton* linkedRadio;
  wxRadioButton* individuaRadio;
  wxButton*      convertButton;
  wxButton*      quitButton;

  DECLARE_EVENT_TABLE()
};