]>
Commit | Line | Data |
---|---|---|
8ec2b484 HH |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: helpfrm.cpp | |
3 | // Purpose: wxHtmlHelpFrame | |
d5bb85a0 | 4 | // Notes: Based on htmlhelp.cpp, implementing a monolithic |
8ec2b484 HH |
5 | // HTML Help controller class, by Vaclav Slavik |
6 | // Author: Harm van der Heijden and Vaclav Slavik | |
69941f05 | 7 | // RCS-ID: $Id$ |
8ec2b484 HH |
8 | // Copyright: (c) Harm van der Heijden and Vaclav Slavik |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifdef __GNUG__ | |
69941f05 | 13 | #pragma implementation |
8ec2b484 HH |
14 | #endif |
15 | ||
c32bfc10 VS |
16 | // For compilers that support precompilation, includes "wx.h" |
17 | ||
8ec2b484 HH |
18 | #include "wx/wxprec.h" |
19 | ||
20 | #ifdef __BORLANDC__ | |
21 | #pragma hdrstop | |
22 | #endif | |
23 | ||
24 | #include "wx/defs.h" | |
25 | ||
26 | #if wxUSE_HTML | |
8ec2b484 | 27 | #ifndef WXPRECOMP |
3096bd2f | 28 | #include "wx/wx.h" |
8ec2b484 HH |
29 | #endif |
30 | ||
31 | #include "wx/html/helpfrm.h" | |
32 | #include "wx/notebook.h" | |
33 | #include "wx/imaglist.h" | |
34 | #include "wx/treectrl.h" | |
35 | #include "wx/tokenzr.h" | |
36 | #include "wx/wfstream.h" | |
37 | #include "wx/html/htmlwin.h" | |
38 | #include "wx/busyinfo.h" | |
39 | #include "wx/progdlg.h" | |
2bd5bbc9 | 40 | #include "wx/toolbar.h" |
83efdf33 | 41 | #include "wx/fontenum.h" |
0646614d VS |
42 | #include "wx/stream.h" |
43 | #include "wx/filedlg.h" | |
8ec2b484 HH |
44 | |
45 | // Bitmaps: | |
46 | ||
47 | #ifndef __WXMSW__ | |
83efdf33 VS |
48 | #include "bitmaps/wpanel.xpm" |
49 | #include "bitmaps/wback.xpm" | |
50 | #include "bitmaps/wforward.xpm" | |
51 | #include "bitmaps/wbook.xpm" | |
52 | #include "bitmaps/woptions.xpm" | |
53 | #include "bitmaps/wfolder.xpm" | |
54 | #include "bitmaps/wpage.xpm" | |
55 | #include "bitmaps/whelp.xpm" | |
56 | #include "bitmaps/whlproot.xpm" | |
382e6efe VS |
57 | #include "bitmaps/wbkadd.xpm" |
58 | #include "bitmaps/wbkdel.xpm" | |
0646614d VS |
59 | #include "bitmaps/wup.xpm" |
60 | #include "bitmaps/wupnode.xpm" | |
61 | #include "bitmaps/wdown.xpm" | |
62 | #include "bitmaps/wopen.xpm" | |
63 | #include "bitmaps/wprint.xpm" | |
8ec2b484 HH |
64 | #endif |
65 | ||
8ec2b484 | 66 | |
f0b6a33f VS |
67 | // what is considered "small index"? |
68 | #define INDEX_IS_SMALL 100 | |
69 | ||
70 | ||
8ec2b484 | 71 | //-------------------------------------------------------------------------- |
382e6efe | 72 | // wxHtmlHelpTreeItemData (private) |
8ec2b484 HH |
73 | //-------------------------------------------------------------------------- |
74 | ||
75 | class wxHtmlHelpTreeItemData : public wxTreeItemData | |
76 | { | |
0646614d VS |
77 | public: |
78 | wxHtmlHelpTreeItemData(int id) : wxTreeItemData() | |
79 | { m_Id = id;} | |
80 | ||
81 | int m_Id; | |
82 | }; | |
8ec2b484 | 83 | |
0646614d VS |
84 | |
85 | //-------------------------------------------------------------------------- | |
86 | // wxHtmlHelpHashData (private) | |
87 | //-------------------------------------------------------------------------- | |
88 | ||
89 | class wxHtmlHelpHashData : public wxObject | |
90 | { | |
8ec2b484 | 91 | public: |
0646614d VS |
92 | wxHtmlHelpHashData(int index, wxTreeItemId id) : wxObject() |
93 | { m_Index = index; m_Id = id;} | |
94 | ||
95 | int m_Index; | |
96 | wxTreeItemId m_Id; | |
8ec2b484 HH |
97 | }; |
98 | ||
382e6efe | 99 | |
0646614d VS |
100 | //-------------------------------------------------------------------------- |
101 | // wxHtmlHelpHtmlWindow (private) | |
102 | //-------------------------------------------------------------------------- | |
103 | ||
104 | class wxHtmlHelpHtmlWindow : public wxHtmlWindow | |
105 | { | |
106 | public: | |
107 | wxHtmlHelpHtmlWindow(wxHtmlHelpFrame *fr, wxWindow *parent) : wxHtmlWindow(parent), m_Frame(fr) {} | |
108 | ||
109 | virtual void OnLinkClicked(const wxHtmlLinkInfo& link) | |
110 | { | |
111 | wxHtmlWindow::OnLinkClicked(link); | |
112 | m_Frame -> NotifyPageChanged(); | |
113 | } | |
114 | ||
115 | private: | |
116 | wxHtmlHelpFrame *m_Frame; | |
117 | }; | |
118 | ||
382e6efe VS |
119 | |
120 | ||
8ec2b484 HH |
121 | //--------------------------------------------------------------------------- |
122 | // wxHtmlHelpFrame | |
123 | //--------------------------------------------------------------------------- | |
124 | ||
125 | IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpFrame, wxFrame) | |
126 | ||
127 | wxHtmlHelpFrame::wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, const wxString& title, | |
d5bb85a0 | 128 | int style, wxHtmlHelpData* data) |
8ec2b484 HH |
129 | { |
130 | Init(data); | |
131 | Create(parent, id, title, style); | |
132 | } | |
d5bb85a0 | 133 | |
8ec2b484 HH |
134 | void wxHtmlHelpFrame::Init(wxHtmlHelpData* data) |
135 | { | |
136 | if (data) { | |
d5bb85a0 VS |
137 | m_Data = data; |
138 | m_DataCreated = FALSE; | |
139 | } else { | |
140 | m_Data = new wxHtmlHelpData(); | |
141 | m_DataCreated = TRUE; | |
8ec2b484 HH |
142 | } |
143 | ||
68364659 | 144 | m_ContentsImageList = new wxImageList(16, 16); |
83efdf33 VS |
145 | m_ContentsImageList -> Add(wxICON(wbook)); |
146 | m_ContentsImageList -> Add(wxICON(wfolder)); | |
147 | m_ContentsImageList -> Add(wxICON(wpage)); | |
148 | m_ContentsImageList -> Add(wxICON(whlproot)); | |
8ec2b484 HH |
149 | |
150 | m_ContentsBox = NULL; | |
f0b6a33f VS |
151 | m_IndexList = NULL; |
152 | m_IndexButton = NULL; | |
153 | m_IndexButtonAll = NULL; | |
154 | m_IndexText = NULL; | |
8ec2b484 HH |
155 | m_SearchList = NULL; |
156 | m_SearchButton = NULL; | |
157 | m_SearchText = NULL; | |
158 | m_SearchChoice = NULL; | |
240c2873 | 159 | m_IndexCountInfo = NULL; |
8ec2b484 HH |
160 | m_Splitter = NULL; |
161 | m_NavigPan = NULL; | |
162 | m_HtmlWin = NULL; | |
382e6efe | 163 | m_Bookmarks = NULL; |
c4971147 VS |
164 | m_SearchCaseSensitive = NULL; |
165 | m_SearchWholeWords = NULL; | |
166 | ||
8ec2b484 HH |
167 | m_Config = NULL; |
168 | m_ConfigRoot = wxEmptyString; | |
169 | ||
170 | m_Cfg.x = m_Cfg.y = 0; | |
d5bb85a0 VS |
171 | m_Cfg.w = 700; |
172 | m_Cfg.h = 480; | |
8ec2b484 HH |
173 | m_Cfg.sashpos = 240; |
174 | m_Cfg.navig_on = TRUE; | |
83efdf33 VS |
175 | |
176 | m_NormalFonts = m_FixedFonts = NULL; | |
83efdf33 | 177 | m_NormalFace = m_FixedFace = wxEmptyString; |
0646614d VS |
178 | m_FontSize = 1; |
179 | ||
180 | #if wxUSE_PRINTING_ARCHITECTURE | |
181 | m_Printer = NULL; | |
182 | #endif | |
183 | ||
184 | m_PagesHash = NULL; | |
185 | m_UpdateContents = TRUE; | |
8ec2b484 HH |
186 | } |
187 | ||
d5bb85a0 VS |
188 | // Create: builds the GUI components. |
189 | // with the style flag it's possible to toggle the toolbar, contents, index and search | |
190 | // controls. | |
191 | // m_HtmlWin will *always* be created, but it's important to realize that | |
f0b6a33f | 192 | // m_ContentsBox, m_IndexList, m_SearchList, m_SearchButton, m_SearchText and |
d5bb85a0 VS |
193 | // m_SearchButton may be NULL. |
194 | // moreover, if no contents, index or searchpage is needed, m_Splitter and | |
195 | // m_NavigPan will be NULL too (with m_HtmlWin directly connected to the frame) | |
196 | ||
8ec2b484 | 197 | bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& title, |
d5bb85a0 | 198 | int style) |
8ec2b484 HH |
199 | { |
200 | // Do the config in two steps. We read the HtmlWindow customization after we | |
201 | // create the window. | |
d5bb85a0 VS |
202 | if (m_Config) |
203 | ReadCustomization(m_Config, m_ConfigRoot); | |
8ec2b484 | 204 | |
8eb2940f | 205 | wxFrame::Create(parent, id, _("Help"), wxPoint(m_Cfg.x, m_Cfg.y), wxSize(m_Cfg.w, m_Cfg.h), wxDEFAULT_FRAME_STYLE, "wxHtmlHelp"); |
8ec2b484 | 206 | |
5c172c17 VS |
207 | GetPosition(&m_Cfg.x, &m_Cfg.y); |
208 | ||
83efdf33 | 209 | SetIcon(wxICON(whelp)); |
9ffdee80 | 210 | |
8ec2b484 HH |
211 | int notebook_page = 0; |
212 | ||
213 | CreateStatusBar(); | |
214 | ||
215 | // toolbar? | |
216 | if (style & wxHF_TOOLBAR) { | |
83efdf33 | 217 | wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_DOCKABLE); |
00655497 | 218 | toolBar->SetMargins( 2, 2 ); |
b854b7b8 | 219 | AddToolbarButtons(toolBar, style); |
83efdf33 | 220 | toolBar -> Realize(); |
8ec2b484 | 221 | } |
d5bb85a0 | 222 | |
8ec2b484 | 223 | if (style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH)) { |
d5bb85a0 VS |
224 | // traditional help controller; splitter window with html page on the |
225 | // right and a notebook containing various pages on the left | |
226 | m_Splitter = new wxSplitterWindow(this); | |
227 | ||
0646614d | 228 | m_HtmlWin = new wxHtmlHelpHtmlWindow(this, m_Splitter); |
d5bb85a0 VS |
229 | m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK, |
230 | wxDefaultPosition, wxDefaultSize); | |
231 | } else { // only html window, no notebook with index,contents etc | |
232 | m_HtmlWin = new wxHtmlWindow(this); | |
8ec2b484 HH |
233 | } |
234 | ||
235 | m_HtmlWin -> SetRelatedFrame(this, m_TitleFormat); | |
236 | m_HtmlWin -> SetRelatedStatusBar(0); | |
d5bb85a0 VS |
237 | if (m_Config) |
238 | m_HtmlWin -> ReadCustomization(m_Config, m_ConfigRoot); | |
8ec2b484 HH |
239 | |
240 | // contents tree panel? | |
241 | if (style & wxHF_CONTENTS) { | |
ae80f837 VS |
242 | wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE); |
243 | ||
244 | if (style & wxHF_BOOKMARKS) { | |
245 | wxLayoutConstraints *b1 = new wxLayoutConstraints; | |
246 | wxBitmapButton *bmpbt = new wxBitmapButton(dummy, wxID_HTML_BOOKMARKSREMOVE, wxBITMAP(wbkdel), wxDefaultPosition, wxSize(20,20)); | |
247 | ||
248 | b1 -> top.SameAs (dummy, wxTop, 10); | |
249 | b1 -> right.SameAs (dummy, wxRight, 10); | |
250 | b1 -> height.AsIs(); | |
251 | b1 -> width.AsIs(); | |
252 | bmpbt -> SetConstraints(b1); | |
253 | ||
254 | wxLayoutConstraints *b2 = new wxLayoutConstraints; | |
255 | wxBitmapButton *bmpbt2 = new wxBitmapButton(dummy, wxID_HTML_BOOKMARKSADD, wxBITMAP(wbkadd), wxDefaultPosition, wxSize(20,20)); | |
256 | ||
257 | b2 -> top.SameAs (dummy, wxTop, 10); | |
258 | b2 -> right.LeftOf (bmpbt, 2); | |
259 | b2 -> height.AsIs(); | |
260 | b2 -> width.AsIs(); | |
261 | bmpbt2 -> SetConstraints(b2); | |
262 | ||
263 | #if wxUSE_TOOLTIPS | |
264 | bmpbt -> SetToolTip(_("Remove current page from bookmarks")); | |
265 | bmpbt2 -> SetToolTip(_("Add current page to bookmarks")); | |
266 | #endif //wxUSE_TOOLTIPS | |
267 | ||
268 | wxLayoutConstraints *b3 = new wxLayoutConstraints; | |
269 | m_Bookmarks = new wxComboBox(dummy, wxID_HTML_BOOKMARKSLIST, wxEmptyString, | |
270 | wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY | wxCB_SORT); | |
271 | m_Bookmarks -> Append(_("(bookmarks)")); | |
272 | for (unsigned i = 0; i < m_BookmarksNames.GetCount(); i++) | |
273 | m_Bookmarks -> Append(m_BookmarksNames[i]); | |
274 | m_Bookmarks -> SetSelection(0); | |
275 | ||
276 | b3 -> centreY.SameAs (bmpbt2, wxCentreY); | |
277 | b3 -> left.SameAs (dummy, wxLeft, 10); | |
278 | b3 -> right.LeftOf (bmpbt2, 5); | |
279 | b3 -> height.AsIs(); | |
280 | m_Bookmarks -> SetConstraints(b3); | |
281 | ||
282 | ||
283 | wxLayoutConstraints *b4 = new wxLayoutConstraints; | |
284 | m_ContentsBox = new wxTreeCtrl(dummy, wxID_HTML_TREECTRL, | |
285 | wxDefaultPosition, wxDefaultSize, | |
286 | wxTR_HAS_BUTTONS | wxSUNKEN_BORDER); | |
287 | m_ContentsBox -> SetImageList(m_ContentsImageList); | |
288 | ||
289 | b4 -> top.Below (m_Bookmarks, 10); | |
290 | b4 -> left.SameAs (dummy, wxLeft, 0); | |
291 | b4 -> right.SameAs (dummy, wxRight, 0); | |
292 | b4 -> bottom.SameAs (dummy, wxBottom, 0); | |
293 | m_ContentsBox -> SetConstraints(b4); | |
294 | ||
295 | dummy -> SetAutoLayout(TRUE); | |
296 | dummy -> Layout(); | |
297 | ||
298 | m_NavigPan -> AddPage(dummy, _("Contents")); | |
299 | } | |
300 | ||
301 | else | |
302 | { | |
303 | m_ContentsBox = new wxTreeCtrl(m_NavigPan, wxID_HTML_TREECTRL, | |
304 | wxDefaultPosition, wxDefaultSize, | |
305 | wxTR_HAS_BUTTONS | wxSUNKEN_BORDER); | |
306 | m_ContentsBox -> SetImageList(m_ContentsImageList); | |
307 | m_NavigPan -> AddPage(m_ContentsBox, _("Contents")); | |
308 | } | |
309 | ||
d5bb85a0 | 310 | m_ContentsPage = notebook_page++; |
8ec2b484 HH |
311 | } |
312 | ||
313 | // index listbox panel? | |
314 | if (style & wxHF_INDEX) { | |
d5bb85a0 | 315 | wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE); |
f0b6a33f | 316 | |
d5bb85a0 | 317 | wxLayoutConstraints *b1 = new wxLayoutConstraints; |
f0b6a33f VS |
318 | m_IndexText = new wxTextCtrl(dummy, wxID_HTML_INDEXTEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); |
319 | b1 -> top.SameAs (dummy, wxTop, 10); | |
320 | b1 -> left.SameAs (dummy, wxLeft, 10); | |
321 | b1 -> right.SameAs (dummy, wxRight, 10); | |
322 | b1 -> height.AsIs(); | |
323 | m_IndexText -> SetConstraints(b1); | |
324 | ||
325 | wxLayoutConstraints *b4 = new wxLayoutConstraints; | |
326 | m_IndexButtonAll = new wxButton(dummy, wxID_HTML_INDEXBUTTONALL, _("Show all")); | |
7618e374 | 327 | |
f0b6a33f VS |
328 | b4 -> top.Below (m_IndexText, 10); |
329 | b4 -> right.SameAs (dummy, wxRight, 10); | |
330 | b4 -> width.AsIs(); | |
331 | b4 -> height.AsIs(); | |
332 | m_IndexButtonAll -> SetConstraints(b4); | |
333 | ||
334 | wxLayoutConstraints *b2 = new wxLayoutConstraints; | |
335 | m_IndexButton = new wxButton(dummy, wxID_HTML_INDEXBUTTON, _("Find")); | |
f0b6a33f VS |
336 | b2 -> top.Below (m_IndexText, 10); |
337 | b2 -> right.LeftOf (m_IndexButtonAll, 10); | |
338 | b2 -> width.AsIs(); | |
339 | b2 -> height.AsIs(); | |
340 | m_IndexButton -> SetConstraints(b2); | |
341 | ||
240c2873 VS |
342 | wxLayoutConstraints *b5 = new wxLayoutConstraints; |
343 | m_IndexCountInfo = new wxStaticText(dummy, wxID_HTML_COUNTINFO, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT | wxST_NO_AUTORESIZE); | |
344 | ||
345 | b5 -> top.Below (m_IndexButton, 5); | |
346 | b5 -> right.SameAs (dummy, wxRight, 10); | |
347 | b5 -> left.SameAs (dummy, wxLeft, 10); | |
348 | b5 -> height.AsIs(); | |
349 | m_IndexCountInfo -> SetConstraints(b5); | |
350 | ||
f0b6a33f | 351 | wxLayoutConstraints *b3 = new wxLayoutConstraints; |
721ab905 | 352 | m_IndexList = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); |
240c2873 | 353 | b3 -> top.Below (m_IndexCountInfo, 5); |
f0b6a33f VS |
354 | b3 -> left.SameAs (dummy, wxLeft, 0); |
355 | b3 -> right.SameAs (dummy, wxRight, 0); | |
356 | b3 -> bottom.SameAs (dummy, wxBottom, 0); | |
357 | m_IndexList -> SetConstraints(b3); | |
358 | ||
7618e374 VS |
359 | #if wxUSE_TOOLTIPS |
360 | m_IndexButtonAll -> SetToolTip(_("Show all items in index")); | |
240c2873 | 361 | m_IndexButton -> SetToolTip(_("Display all index items that contain given substring. Search is case insensitive.")); |
7618e374 VS |
362 | #endif //wxUSE_TOOLTIPS |
363 | ||
d5bb85a0 | 364 | dummy -> SetAutoLayout(TRUE); |
f0b6a33f VS |
365 | dummy -> Layout(); |
366 | ||
d5bb85a0 VS |
367 | m_NavigPan -> AddPage(dummy, _("Index")); |
368 | m_IndexPage = notebook_page++; | |
8ec2b484 HH |
369 | } |
370 | ||
371 | // search list panel? | |
372 | if (style & wxHF_SEARCH) { | |
d5bb85a0 VS |
373 | wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE); |
374 | ||
375 | wxLayoutConstraints *b1 = new wxLayoutConstraints; | |
f0b6a33f | 376 | m_SearchText = new wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); |
d5bb85a0 VS |
377 | b1 -> top.SameAs (dummy, wxTop, 10); |
378 | b1 -> left.SameAs (dummy, wxLeft, 10); | |
379 | b1 -> right.SameAs (dummy, wxRight, 10); | |
380 | b1 -> height.AsIs(); | |
381 | m_SearchText -> SetConstraints(b1); | |
382 | ||
d5bb85a0 VS |
383 | wxLayoutConstraints *b4 = new wxLayoutConstraints; |
384 | m_SearchChoice = new wxChoice(dummy, wxID_HTML_SEARCHCHOICE, wxDefaultPosition, | |
385 | wxDefaultSize); | |
386 | b4 -> top.Below (m_SearchText, 10); | |
ae80f837 | 387 | b4 -> left.SameAs (dummy, wxLeft, 10); |
d5bb85a0 VS |
388 | b4 -> right.SameAs (dummy, wxRight, 10); |
389 | b4 -> height.AsIs(); | |
390 | m_SearchChoice -> SetConstraints(b4); | |
391 | ||
c4971147 VS |
392 | wxLayoutConstraints *b5 = new wxLayoutConstraints; |
393 | m_SearchCaseSensitive = new wxCheckBox(dummy, -1, _("Case sensitive")); | |
ae80f837 | 394 | b5 -> top.Below (m_SearchChoice, 10); |
c4971147 | 395 | b5 -> left.SameAs (dummy, wxLeft, 10); |
ae80f837 | 396 | b5 -> width.AsIs(); |
c4971147 VS |
397 | b5 -> height.AsIs (); |
398 | m_SearchCaseSensitive -> SetConstraints(b5); | |
399 | ||
400 | wxLayoutConstraints *b6 = new wxLayoutConstraints; | |
401 | m_SearchWholeWords = new wxCheckBox(dummy, -1, _("Whole words only")); | |
402 | b6 -> top.Below (m_SearchCaseSensitive, 0); | |
403 | b6 -> left.SameAs (dummy, wxLeft, 10); | |
ae80f837 | 404 | b6 -> width.AsIs(); |
c4971147 VS |
405 | b6 -> height.AsIs (); |
406 | m_SearchWholeWords -> SetConstraints(b6); | |
407 | ||
ae80f837 VS |
408 | wxLayoutConstraints *b2 = new wxLayoutConstraints; |
409 | m_SearchButton = new wxButton(dummy, wxID_HTML_SEARCHBUTTON, _("Search")); | |
410 | #if wxUSE_TOOLTIPS | |
411 | m_SearchButton -> SetToolTip(_("Search contents of help book(s) for all occurences of the text you typed above")); | |
412 | #endif //wxUSE_TOOLTIPS | |
413 | b2 -> top.Below (m_SearchWholeWords, 0); | |
414 | b2 -> right.SameAs (dummy, wxRight, 10); | |
415 | b2 -> width.AsIs(); | |
416 | b2 -> height.AsIs(); | |
417 | m_SearchButton -> SetConstraints(b2); | |
418 | ||
954269e6 | 419 | wxLayoutConstraints *b3 = new wxLayoutConstraints; |
721ab905 | 420 | m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); |
ae80f837 | 421 | b3 -> top.Below (m_SearchButton, 10); |
954269e6 VS |
422 | b3 -> left.SameAs (dummy, wxLeft, 0); |
423 | b3 -> right.SameAs (dummy, wxRight, 0); | |
424 | b3 -> bottom.SameAs (dummy, wxBottom, 0); | |
425 | m_SearchList -> SetConstraints(b3); | |
426 | ||
d5bb85a0 VS |
427 | dummy -> SetAutoLayout(TRUE); |
428 | dummy -> Layout(); | |
429 | m_NavigPan -> AddPage(dummy, _("Search")); | |
430 | m_SearchPage = notebook_page++; | |
8ec2b484 | 431 | } |
c32bfc10 | 432 | m_HtmlWin -> Show(TRUE); |
0646614d | 433 | |
b5a7b000 | 434 | RefreshLists(); |
8ec2b484 HH |
435 | |
436 | // showtime | |
437 | if (m_NavigPan && m_Splitter) { | |
d5bb85a0 | 438 | m_Splitter -> SetMinimumPaneSize(20); |
f38374d0 DW |
439 | if (m_Cfg.navig_on) |
440 | m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); | |
441 | else { | |
442 | m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); | |
443 | m_Splitter -> Unsplit(); | |
444 | } | |
c32bfc10 VS |
445 | if (m_Cfg.navig_on) { |
446 | m_NavigPan -> Show(TRUE); | |
d5bb85a0 | 447 | m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); |
c32bfc10 | 448 | } |
68364659 | 449 | else { |
c32bfc10 VS |
450 | m_NavigPan -> Show(FALSE); |
451 | m_Splitter -> Initialize(m_HtmlWin); | |
68364659 | 452 | } |
8ec2b484 | 453 | } |
8ec2b484 HH |
454 | return TRUE; |
455 | } | |
456 | ||
457 | wxHtmlHelpFrame::~wxHtmlHelpFrame() | |
458 | { | |
b854b7b8 | 459 | PopEventHandler(); // wxhtmlhelpcontroller |
8ec2b484 HH |
460 | delete m_ContentsImageList; |
461 | if (m_DataCreated) | |
d5bb85a0 | 462 | delete m_Data; |
83efdf33 VS |
463 | if (m_NormalFonts) delete m_NormalFonts; |
464 | if (m_FixedFonts) delete m_FixedFonts; | |
8ec2b484 HH |
465 | } |
466 | ||
b854b7b8 VS |
467 | |
468 | void wxHtmlHelpFrame::AddToolbarButtons(wxToolBar *toolBar, int style) | |
469 | { | |
470 | toolBar -> AddTool(wxID_HTML_PANEL, wxBITMAP(wpanel), wxNullBitmap, | |
471 | FALSE, -1, -1, (wxObject *) NULL, | |
472 | _("Show/hide navigation panel")); | |
0646614d | 473 | |
b854b7b8 VS |
474 | toolBar -> AddSeparator(); |
475 | toolBar -> AddTool(wxID_HTML_BACK, wxBITMAP(wback), wxNullBitmap, | |
476 | FALSE, -1, -1, (wxObject *) NULL, | |
0646614d | 477 | _("Go back")); |
b854b7b8 VS |
478 | toolBar -> AddTool(wxID_HTML_FORWARD, wxBITMAP(wforward), wxNullBitmap, |
479 | FALSE, -1, -1, (wxObject *) NULL, | |
0646614d | 480 | _("Go forward")); |
b854b7b8 VS |
481 | toolBar -> AddSeparator(); |
482 | ||
0646614d VS |
483 | toolBar -> AddTool(wxID_HTML_UPNODE, wxBITMAP(wupnode), wxNullBitmap, |
484 | FALSE, -1, -1, (wxObject *) NULL, | |
485 | _("Go one level up in document hierarchy")); | |
486 | toolBar -> AddTool(wxID_HTML_UP, wxBITMAP(wup), wxNullBitmap, | |
487 | FALSE, -1, -1, (wxObject *) NULL, | |
488 | _("Previous page")); | |
489 | toolBar -> AddTool(wxID_HTML_DOWN, wxBITMAP(wdown), wxNullBitmap, | |
490 | FALSE, -1, -1, (wxObject *) NULL, | |
491 | _("Next page")); | |
492 | ||
493 | if ((style & wxHF_PRINT) || (style & wxHF_OPENFILES)) | |
494 | toolBar -> AddSeparator(); | |
495 | ||
496 | if (style & wxHF_OPENFILES) | |
497 | toolBar -> AddTool(wxID_HTML_OPENFILE, wxBITMAP(wopen), wxNullBitmap, | |
498 | FALSE, -1, -1, (wxObject *) NULL, | |
499 | _("Open HTML document")); | |
500 | ||
501 | #if wxUSE_PRINTING_ARCHITECTURE | |
502 | if (style & wxHF_PRINT) | |
503 | toolBar -> AddTool(wxID_HTML_PRINT, wxBITMAP(wprint), wxNullBitmap, | |
504 | FALSE, -1, -1, (wxObject *) NULL, | |
505 | _("Print this page")); | |
506 | #endif | |
507 | ||
b854b7b8 VS |
508 | toolBar -> AddSeparator(); |
509 | toolBar -> AddTool(wxID_HTML_OPTIONS, wxBITMAP(woptions), wxNullBitmap, | |
510 | FALSE, -1, -1, (wxObject *) NULL, | |
511 | _("Display options dialog")); | |
512 | } | |
513 | ||
514 | ||
721ab905 VS |
515 | void wxHtmlHelpFrame::SetTitleFormat(const wxString& format) |
516 | { | |
517 | if (m_HtmlWin) | |
518 | m_HtmlWin->SetRelatedFrame(this, format); | |
519 | m_TitleFormat = format; | |
520 | } | |
521 | ||
b854b7b8 | 522 | |
8ec2b484 HH |
523 | bool wxHtmlHelpFrame::Display(const wxString& x) |
524 | { | |
525 | wxString url = m_Data->FindPageByName(x); | |
526 | if (! url.IsEmpty()) { | |
d5bb85a0 | 527 | m_HtmlWin->LoadPage(url); |
0646614d | 528 | NotifyPageChanged(); |
d5bb85a0 | 529 | return TRUE; |
8ec2b484 HH |
530 | } |
531 | return FALSE; | |
532 | } | |
533 | ||
534 | bool wxHtmlHelpFrame::Display(const int id) | |
535 | { | |
536 | wxString url = m_Data->FindPageById(id); | |
537 | if (! url.IsEmpty()) { | |
d5bb85a0 | 538 | m_HtmlWin->LoadPage(url); |
0646614d | 539 | NotifyPageChanged(); |
d5bb85a0 | 540 | return TRUE; |
8ec2b484 HH |
541 | } |
542 | return FALSE; | |
543 | } | |
544 | ||
545 | ||
546 | ||
547 | bool wxHtmlHelpFrame::DisplayContents() | |
548 | { | |
549 | if (! m_ContentsBox) | |
d5bb85a0 | 550 | return FALSE; |
8ec2b484 | 551 | if (!m_Splitter -> IsSplit()) { |
d5bb85a0 VS |
552 | m_NavigPan -> Show(TRUE); |
553 | m_HtmlWin -> Show(TRUE); | |
554 | m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); | |
c32bfc10 | 555 | m_Cfg.navig_on = TRUE; |
8ec2b484 HH |
556 | } |
557 | m_NavigPan -> SetSelection(0); | |
558 | return TRUE; | |
559 | } | |
560 | ||
561 | ||
562 | ||
563 | bool wxHtmlHelpFrame::DisplayIndex() | |
564 | { | |
f0b6a33f | 565 | if (! m_IndexList) |
d5bb85a0 | 566 | return FALSE; |
8ec2b484 | 567 | if (!m_Splitter -> IsSplit()) { |
d5bb85a0 VS |
568 | m_NavigPan -> Show(TRUE); |
569 | m_HtmlWin -> Show(TRUE); | |
570 | m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); | |
8ec2b484 HH |
571 | } |
572 | m_NavigPan -> SetSelection(1); | |
573 | return TRUE; | |
574 | } | |
575 | ||
b854b7b8 VS |
576 | |
577 | ||
8ec2b484 HH |
578 | bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword) |
579 | { | |
580 | if (! (m_SearchList && m_SearchButton && m_SearchText && m_SearchChoice)) | |
d5bb85a0 | 581 | return FALSE; |
8ec2b484 | 582 | |
c4971147 | 583 | int foundcnt = 0, curi; |
8ec2b484 HH |
584 | wxString foundstr; |
585 | wxString book = wxEmptyString; | |
586 | ||
587 | if (!m_Splitter -> IsSplit()) { | |
d5bb85a0 VS |
588 | m_NavigPan -> Show(TRUE); |
589 | m_HtmlWin -> Show(TRUE); | |
590 | m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); | |
8ec2b484 HH |
591 | } |
592 | m_NavigPan -> SetSelection(m_SearchPage); | |
593 | m_SearchList -> Clear(); | |
594 | m_SearchText -> SetValue(keyword); | |
595 | m_SearchButton -> Enable(FALSE); | |
596 | ||
597 | if (m_SearchChoice->GetSelection() != 0) | |
d5bb85a0 | 598 | book = m_SearchChoice->GetStringSelection(); |
8ec2b484 | 599 | |
c4971147 VS |
600 | wxHtmlSearchStatus status(m_Data, keyword, |
601 | m_SearchCaseSensitive -> GetValue(), m_SearchWholeWords -> GetValue(), | |
602 | book); | |
8ec2b484 | 603 | |
d5bb85a0 VS |
604 | wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), |
605 | status.GetMaxIndex(), this, | |
2686e01b | 606 | wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE | wxGA_SMOOTH); |
8ec2b484 HH |
607 | |
608 | while (status.IsActive()) { | |
c4971147 | 609 | curi = status.GetCurIndex(); |
b5a7b000 | 610 | if (curi % 32 == 0 && progress.Update(curi) == FALSE) |
d5bb85a0 VS |
611 | break; |
612 | if (status.Search()) { | |
613 | foundstr.Printf(_("Found %i matches"), ++foundcnt); | |
614 | progress.Update(status.GetCurIndex(), foundstr); | |
615 | m_SearchList -> Append(status.GetName(), status.GetContentsItem()); | |
616 | } | |
8ec2b484 HH |
617 | } |
618 | ||
619 | m_SearchButton -> Enable(TRUE); | |
620 | m_SearchText -> SetSelection(0, keyword.Length()); | |
621 | m_SearchText -> SetFocus(); | |
622 | if (foundcnt) { | |
623 | wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(0); | |
0646614d VS |
624 | if (it) |
625 | { | |
626 | m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); | |
627 | NotifyPageChanged(); | |
628 | } | |
8ec2b484 HH |
629 | } |
630 | return (foundcnt > 0); | |
631 | } | |
632 | ||
633 | #define MAX_ROOTS 64 | |
634 | ||
b5a7b000 | 635 | void wxHtmlHelpFrame::CreateContents() |
8ec2b484 HH |
636 | { |
637 | if (! m_ContentsBox) | |
d5bb85a0 | 638 | return ; |
8ec2b484 | 639 | |
8ec2b484 | 640 | m_ContentsBox->Clear(); |
0646614d VS |
641 | |
642 | if (m_PagesHash) delete m_PagesHash; | |
643 | m_PagesHash = new wxHashTable(wxKEY_STRING, 2 * m_Data -> GetContentsCnt()); | |
644 | m_PagesHash -> DeleteContents(TRUE); | |
8ec2b484 HH |
645 | |
646 | int cnt = m_Data->GetContentsCnt(); | |
8ec2b484 HH |
647 | int i; |
648 | ||
83efdf33 | 649 | wxHtmlContentsItem *it; |
d5bb85a0 | 650 | |
8ec2b484 HH |
651 | wxTreeItemId roots[MAX_ROOTS]; |
652 | bool imaged[MAX_ROOTS]; | |
653 | ||
654 | m_ContentsBox -> DeleteAllItems(); | |
655 | roots[0] = m_ContentsBox -> AddRoot(_("(Help)")); | |
5c172c17 VS |
656 | m_ContentsBox -> SetItemImage(roots[0], IMG_RootFolder); |
657 | m_ContentsBox -> SetItemSelectedImage(roots[0], IMG_RootFolder); | |
8ec2b484 HH |
658 | imaged[0] = TRUE; |
659 | ||
83efdf33 | 660 | for (it = m_Data->GetContents(), i = 0; i < cnt; i++, it++) { |
382e6efe | 661 | roots[it -> m_Level + 1] = m_ContentsBox -> AppendItem( |
d5bb85a0 | 662 | roots[it -> m_Level], it -> m_Name, IMG_Page, -1, |
0646614d VS |
663 | new wxHtmlHelpTreeItemData(i)); |
664 | m_PagesHash -> Put(it -> m_Book -> GetBasePath() + it -> m_Page, | |
665 | new wxHtmlHelpHashData(i, roots[it -> m_Level + 1])); | |
8ec2b484 HH |
666 | |
667 | if (it -> m_Level == 0) { | |
668 | m_ContentsBox -> SetItemBold(roots[1], TRUE); | |
669 | m_ContentsBox -> SetItemImage(roots[1], IMG_Book); | |
670 | m_ContentsBox -> SetItemSelectedImage(roots[1], IMG_Book); | |
671 | imaged[1] = TRUE; | |
d5bb85a0 | 672 | } else imaged[it -> m_Level + 1] = FALSE; |
8ec2b484 HH |
673 | |
674 | if (!imaged[it -> m_Level]) { | |
675 | m_ContentsBox -> SetItemImage(roots[it -> m_Level], IMG_Folder); | |
676 | m_ContentsBox -> SetItemSelectedImage(roots[it -> m_Level], IMG_Folder); | |
677 | imaged[it -> m_Level] = TRUE; | |
678 | } | |
679 | } | |
8ec2b484 HH |
680 | m_ContentsBox -> Expand(roots[0]); |
681 | } | |
682 | ||
683 | ||
b5a7b000 | 684 | void wxHtmlHelpFrame::CreateIndex() |
8ec2b484 | 685 | { |
f0b6a33f | 686 | if (! m_IndexList) |
d5bb85a0 | 687 | return ; |
8ec2b484 | 688 | |
f0b6a33f | 689 | m_IndexList->Clear(); |
8ec2b484 HH |
690 | |
691 | int cnt = m_Data->GetIndexCnt(); | |
f0b6a33f | 692 | |
240c2873 VS |
693 | wxString cnttext; |
694 | if (cnt > INDEX_IS_SMALL) cnttext.Printf(_("%i of %i"), 0, cnt); | |
695 | else cnttext.Printf(_("%i of %i"), cnt, cnt); | |
696 | m_IndexCountInfo -> SetLabel(cnttext); | |
f0b6a33f VS |
697 | if (cnt > INDEX_IS_SMALL) return; |
698 | ||
8ec2b484 HH |
699 | wxHtmlContentsItem* index = m_Data->GetIndex(); |
700 | ||
b5a7b000 | 701 | for (int i = 0; i < cnt; i++) |
f0b6a33f | 702 | m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); |
8ec2b484 HH |
703 | } |
704 | ||
705 | void wxHtmlHelpFrame::CreateSearch() | |
706 | { | |
707 | if (! (m_SearchList && m_SearchChoice)) | |
d5bb85a0 | 708 | return ; |
8ec2b484 HH |
709 | m_SearchList -> Clear(); |
710 | m_SearchChoice -> Clear(); | |
ae80f837 | 711 | m_SearchChoice -> Append(_("Search in all books")); |
8ec2b484 HH |
712 | const wxHtmlBookRecArray& bookrec = m_Data->GetBookRecArray(); |
713 | int i, cnt = bookrec.GetCount(); | |
d5bb85a0 VS |
714 | for (i = 0; i < cnt; i++) |
715 | m_SearchChoice->Append(bookrec[i].GetTitle()); | |
8ec2b484 HH |
716 | m_SearchChoice->SetSelection(0); |
717 | } | |
718 | ||
719 | ||
b5a7b000 | 720 | void wxHtmlHelpFrame::RefreshLists() |
8ec2b484 | 721 | { |
b5a7b000 VS |
722 | CreateContents(); |
723 | CreateIndex(); | |
8ec2b484 HH |
724 | CreateSearch(); |
725 | } | |
726 | ||
727 | void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path) | |
728 | { | |
729 | wxString oldpath; | |
730 | wxString tmp; | |
731 | ||
732 | if (path != wxEmptyString) { | |
733 | oldpath = cfg -> GetPath(); | |
3e5296e7 | 734 | cfg -> SetPath(_T("/") + path); |
8ec2b484 HH |
735 | } |
736 | ||
0646614d VS |
737 | m_Cfg.navig_on = cfg -> Read(wxT("hcNavigPanel"), m_Cfg.navig_on) != 0; |
738 | m_Cfg.sashpos = cfg -> Read(wxT("hcSashPos"), m_Cfg.sashpos); | |
739 | m_Cfg.x = cfg -> Read(wxT("hcX"), m_Cfg.x); | |
740 | m_Cfg.y = cfg -> Read(wxT("hcY"), m_Cfg.y); | |
741 | m_Cfg.w = cfg -> Read(wxT("hcW"), m_Cfg.w); | |
742 | m_Cfg.h = cfg -> Read(wxT("hcH"), m_Cfg.h); | |
8ec2b484 | 743 | |
0646614d VS |
744 | m_FixedFace = cfg -> Read(wxT("hcFixedFace"), m_FixedFace); |
745 | m_NormalFace = cfg -> Read(wxT("hcNormalFace"), m_NormalFace); | |
746 | m_FontSize = cfg -> Read(wxT("hcFontSize"), m_FontSize); | |
83efdf33 | 747 | |
382e6efe VS |
748 | { |
749 | int i; | |
750 | int cnt; | |
751 | wxString val, s; | |
752 | ||
0646614d | 753 | cnt = cfg -> Read(wxT("hcBookmarksCnt"), 0L); |
382e6efe VS |
754 | if (cnt != 0) { |
755 | m_BookmarksNames.Clear(); | |
756 | m_BookmarksPages.Clear(); | |
757 | if (m_Bookmarks) { | |
758 | m_Bookmarks -> Clear(); | |
ae80f837 | 759 | m_Bookmarks -> Append(_("(bookmarks)")); |
382e6efe VS |
760 | } |
761 | ||
762 | for (i = 0; i < cnt; i++) { | |
0413cec5 | 763 | val.Printf(wxT("hcBookmark_%i"), i); |
382e6efe VS |
764 | s = cfg -> Read(val); |
765 | m_BookmarksNames.Add(s); | |
766 | if (m_Bookmarks) m_Bookmarks -> Append(s); | |
0413cec5 | 767 | val.Printf(wxT("hcBookmark_%i_url"), i); |
382e6efe VS |
768 | s = cfg -> Read(val); |
769 | m_BookmarksPages.Add(s); | |
770 | } | |
771 | } | |
772 | } | |
773 | ||
8ec2b484 | 774 | if (m_HtmlWin) |
3e5296e7 | 775 | m_HtmlWin->ReadCustomization(cfg); |
8ec2b484 HH |
776 | |
777 | if (path != wxEmptyString) | |
778 | cfg -> SetPath(oldpath); | |
779 | } | |
780 | ||
781 | void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path) | |
782 | { | |
783 | wxString oldpath; | |
784 | wxString tmp; | |
8ec2b484 HH |
785 | |
786 | if (path != wxEmptyString) { | |
787 | oldpath = cfg -> GetPath(); | |
3e5296e7 | 788 | cfg -> SetPath(_T("/") + path); |
8ec2b484 HH |
789 | } |
790 | ||
0646614d VS |
791 | cfg -> Write(wxT("hcNavigPanel"), m_Cfg.navig_on); |
792 | cfg -> Write(wxT("hcSashPos"), (long)m_Cfg.sashpos); | |
793 | cfg -> Write(wxT("hcX"), (long)m_Cfg.x); | |
794 | cfg -> Write(wxT("hcY"), (long)m_Cfg.y); | |
795 | cfg -> Write(wxT("hcW"), (long)m_Cfg.w); | |
796 | cfg -> Write(wxT("hcH"), (long)m_Cfg.h); | |
797 | cfg -> Write(wxT("hcFixedFace"), m_FixedFace); | |
798 | cfg -> Write(wxT("hcNormalFace"), m_NormalFace); | |
799 | cfg -> Write(wxT("hcFontSize"), (long)m_FontSize); | |
382e6efe VS |
800 | |
801 | if (m_Bookmarks) { | |
802 | int i; | |
803 | int cnt = m_BookmarksNames.GetCount(); | |
804 | wxString val; | |
805 | ||
0646614d | 806 | cfg -> Write(wxT("hcBookmarksCnt"), (long)cnt); |
382e6efe | 807 | for (i = 0; i < cnt; i++) { |
0413cec5 | 808 | val.Printf(wxT("hcBookmark_%i"), i); |
382e6efe | 809 | cfg -> Write(val, m_BookmarksNames[i]); |
0413cec5 | 810 | val.Printf(wxT("hcBookmark_%i_url"), i); |
382e6efe VS |
811 | cfg -> Write(val, m_BookmarksPages[i]); |
812 | } | |
813 | } | |
8ec2b484 HH |
814 | |
815 | if (m_HtmlWin) | |
3e5296e7 | 816 | m_HtmlWin->WriteCustomization(cfg); |
8ec2b484 HH |
817 | |
818 | if (path != wxEmptyString) | |
819 | cfg -> SetPath(oldpath); | |
820 | } | |
821 | ||
822 | ||
83efdf33 VS |
823 | |
824 | ||
825 | ||
8eb2940f | 826 | static void SetFontsToHtmlWin(wxHtmlWindow *win, wxString scalf, wxString fixf, int size) |
83efdf33 | 827 | { |
0646614d | 828 | static int f_sizes[5][7] = |
83efdf33 | 829 | { |
0646614d | 830 | { 6, 7, 9, 12, 14, 16, 19}, |
f151e8b5 | 831 | { 8, 9, 12, 14, 16, 19, 22}, |
83efdf33 | 832 | {10, 12, 14, 16, 19, 24, 32}, |
0646614d VS |
833 | {14, 16, 18, 24, 32, 38, 45}, |
834 | {16, 20, 24, 32, 38, 45, 50} | |
83efdf33 | 835 | }; |
f151e8b5 | 836 | |
8eb2940f | 837 | win -> SetFonts(scalf, fixf, f_sizes[size]); |
83efdf33 VS |
838 | } |
839 | ||
840 | ||
841 | class wxHtmlHelpFrameOptionsDialog : public wxDialog | |
842 | { | |
843 | public: | |
f151e8b5 | 844 | wxComboBox *NormalFont, *FixedFont; |
83efdf33 VS |
845 | wxRadioBox *RadioBox; |
846 | wxHtmlWindow *TestWin; | |
847 | ||
848 | wxHtmlHelpFrameOptionsDialog(wxWindow *parent) : wxDialog(parent, -1, wxString(_("Help Browser Options"))) | |
849 | { | |
0646614d | 850 | wxString choices[5] = {_("very small"), _("small"), _("medium"), _("large"), _("very large")}; |
8eb2940f | 851 | wxBoxSizer *topsizer, *sizer, *sizer2; |
83efdf33 VS |
852 | |
853 | topsizer = new wxBoxSizer(wxVERTICAL); | |
854 | ||
855 | sizer = new wxBoxSizer(wxHORIZONTAL); | |
856 | ||
6f67eafe | 857 | sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Normal font:")), wxVERTICAL); |
382e6efe | 858 | sizer2 -> Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, |
382e6efe | 859 | wxSize(200, 200), |
382e6efe | 860 | 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), |
83efdf33 VS |
861 | 1, wxEXPAND | wxLEFT | wxRIGHT, 10); |
862 | ||
6f67eafe | 863 | sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); |
83efdf33 | 864 | |
6f67eafe | 865 | sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Fixed font:")), wxVERTICAL); |
382e6efe | 866 | sizer2 -> Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, |
382e6efe | 867 | wxSize(200, 200), |
382e6efe | 868 | 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), |
83efdf33 VS |
869 | 1, wxEXPAND | wxLEFT | wxRIGHT, 10); |
870 | ||
6f67eafe | 871 | sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); |
83efdf33 VS |
872 | |
873 | topsizer -> Add(sizer); | |
874 | ||
875 | topsizer -> Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"), | |
0646614d | 876 | wxDefaultPosition, wxDefaultSize, 5, choices, 5), |
6f67eafe | 877 | 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); |
83efdf33 VS |
878 | |
879 | topsizer -> Add(new wxStaticText(this, -1, _("Preview:")), | |
880 | 0, wxLEFT | wxTOP, 10); | |
881 | topsizer -> Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)), | |
6f67eafe | 882 | 1, wxEXPAND | wxLEFT|wxTOP|wxRIGHT, 10); |
83efdf33 VS |
883 | |
884 | sizer = new wxBoxSizer(wxHORIZONTAL); | |
885 | sizer -> Add(new wxButton(this, wxID_OK, _("OK")), 0, wxALL, 10); | |
886 | sizer -> Add(new wxButton(this, wxID_CANCEL, _("Cancel")), 0, wxALL, 10); | |
887 | topsizer -> Add(sizer, 0, wxALIGN_RIGHT); | |
888 | ||
889 | SetAutoLayout(TRUE); | |
890 | SetSizer(topsizer); | |
891 | topsizer -> Fit(this); | |
892 | Centre(wxBOTH); | |
893 | } | |
894 | ||
895 | ||
896 | void UpdateTestWin() | |
897 | { | |
898 | wxBusyCursor bcur; | |
899 | SetFontsToHtmlWin(TestWin, | |
8eb2940f VS |
900 | NormalFont -> GetStringSelection(), |
901 | FixedFont -> GetStringSelection(), | |
83efdf33 VS |
902 | RadioBox -> GetSelection()); |
903 | TestWin -> SetPage(_("<html><body>" | |
904 | "Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> " | |
905 | "<b>Bold face.</b> <b><i>Bold italic face.</i></b><br>" | |
906 | "<font size=-2>font size -2</font><br>" | |
907 | "<font size=-1>font size -1</font><br>" | |
908 | "<font size=+0>font size +0</font><br>" | |
909 | "<font size=+1>font size +1</font><br>" | |
910 | "<font size=+2>font size +2</font><br>" | |
911 | "<font size=+3>font size +3</font><br>" | |
912 | "<font size=+4>font size +4</font><br>" | |
913 | ||
914 | "<p><tt>Fixed size face.<br> <b>bold</b> <i>italic</i> " | |
74cfc369 | 915 | "<b><i>bold italic <u>underlined</u></i></b><br>" |
83efdf33 VS |
916 | "<font size=-2>font size -2</font><br>" |
917 | "<font size=-1>font size -1</font><br>" | |
918 | "<font size=+0>font size +0</font><br>" | |
919 | "<font size=+1>font size +1</font><br>" | |
920 | "<font size=+2>font size +2</font><br>" | |
921 | "<font size=+3>font size +3</font><br>" | |
74cfc369 | 922 | "<font size=+4>font size +4</font></tt>" |
83efdf33 VS |
923 | "</body></html>")); |
924 | } | |
925 | ||
926 | void OnUpdate(wxCloseEvent& event) | |
927 | { | |
928 | UpdateTestWin(); | |
929 | } | |
930 | ||
931 | DECLARE_EVENT_TABLE() | |
932 | }; | |
933 | ||
934 | BEGIN_EVENT_TABLE(wxHtmlHelpFrameOptionsDialog, wxDialog) | |
f151e8b5 | 935 | EVT_COMBOBOX(-1, wxHtmlHelpFrameOptionsDialog::OnUpdate) |
83efdf33 | 936 | EVT_RADIOBOX(-1, wxHtmlHelpFrameOptionsDialog::OnUpdate) |
83efdf33 VS |
937 | END_EVENT_TABLE() |
938 | ||
939 | ||
940 | void wxHtmlHelpFrame::OptionsDialog() | |
941 | { | |
942 | wxHtmlHelpFrameOptionsDialog dlg(this); | |
943 | unsigned i; | |
944 | ||
945 | if (m_NormalFonts == NULL) { | |
946 | wxFontEnumerator enu; | |
947 | enu.EnumerateFacenames(); | |
948 | m_NormalFonts = new wxArrayString; | |
949 | *m_NormalFonts = *enu.GetFacenames(); | |
950 | m_NormalFonts -> Sort(); | |
951 | } | |
952 | if (m_FixedFonts == NULL) { | |
953 | wxFontEnumerator enu; | |
954 | enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE); | |
955 | m_FixedFonts = new wxArrayString; | |
956 | *m_FixedFonts = *enu.GetFacenames(); | |
957 | m_FixedFonts -> Sort(); | |
958 | } | |
959 | ||
960 | for (i = 0; i < m_NormalFonts -> GetCount(); i++) | |
961 | dlg.NormalFont -> Append((*m_NormalFonts)[i]); | |
962 | for (i = 0; i < m_FixedFonts -> GetCount(); i++) | |
963 | dlg.FixedFont -> Append((*m_FixedFonts)[i]); | |
964 | if (!m_NormalFace.IsEmpty()) dlg.NormalFont -> SetStringSelection(m_NormalFace); | |
965 | else dlg.NormalFont -> SetSelection(0); | |
966 | if (!m_FixedFace.IsEmpty()) dlg.FixedFont -> SetStringSelection(m_FixedFace); | |
967 | else dlg.FixedFont -> SetSelection(0); | |
968 | dlg.RadioBox -> SetSelection(m_FontSize); | |
83efdf33 VS |
969 | dlg.UpdateTestWin(); |
970 | ||
971 | if (dlg.ShowModal() == wxID_OK) { | |
972 | m_NormalFace = dlg.NormalFont -> GetStringSelection(); | |
973 | m_FixedFace = dlg.FixedFont -> GetStringSelection(); | |
974 | m_FontSize = dlg.RadioBox -> GetSelection(); | |
8eb2940f | 975 | SetFontsToHtmlWin(m_HtmlWin, m_NormalFace, m_FixedFace, m_FontSize); |
83efdf33 VS |
976 | } |
977 | } | |
978 | ||
979 | ||
980 | ||
0646614d VS |
981 | void wxHtmlHelpFrame::NotifyPageChanged() |
982 | { | |
983 | if (m_UpdateContents && m_PagesHash) | |
984 | { | |
985 | wxString an = m_HtmlWin -> GetOpenedAnchor(); | |
986 | wxHtmlHelpHashData *ha; | |
987 | if (an.IsEmpty()) | |
988 | ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage()); | |
989 | else | |
990 | ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an); | |
991 | if (ha) | |
992 | { | |
993 | bool olduc = m_UpdateContents; | |
994 | m_UpdateContents = FALSE; | |
995 | m_ContentsBox -> SelectItem(ha -> m_Id); | |
996 | m_ContentsBox -> EnsureVisible(ha -> m_Id); | |
997 | m_UpdateContents = olduc; | |
998 | } | |
999 | } | |
1000 | } | |
1001 | ||
83efdf33 VS |
1002 | |
1003 | ||
8ec2b484 HH |
1004 | /* |
1005 | EVENT HANDLING : | |
1006 | */ | |
1007 | ||
1008 | ||
1009 | void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) | |
1010 | { | |
1011 | switch (event.GetId()) { | |
382e6efe | 1012 | |
8ec2b484 HH |
1013 | case wxID_HTML_BACK : |
1014 | m_HtmlWin -> HistoryBack(); | |
0646614d | 1015 | NotifyPageChanged(); |
8ec2b484 | 1016 | break; |
382e6efe | 1017 | |
8ec2b484 HH |
1018 | case wxID_HTML_FORWARD : |
1019 | m_HtmlWin -> HistoryForward(); | |
0646614d VS |
1020 | NotifyPageChanged(); |
1021 | break; | |
1022 | ||
1023 | case wxID_HTML_UP : | |
1024 | if (m_PagesHash) | |
1025 | { | |
1026 | wxString an = m_HtmlWin -> GetOpenedAnchor(); | |
1027 | wxHtmlHelpHashData *ha; | |
1028 | if (an.IsEmpty()) | |
1029 | ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage()); | |
1030 | else | |
1031 | ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an); | |
1032 | if (ha && ha -> m_Index > 0) | |
1033 | { | |
1034 | wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index - 1); | |
1035 | m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); | |
1036 | NotifyPageChanged(); | |
1037 | } | |
1038 | } | |
1039 | break; | |
1040 | ||
1041 | case wxID_HTML_UPNODE : | |
1042 | if (m_PagesHash) | |
1043 | { | |
1044 | wxString an = m_HtmlWin -> GetOpenedAnchor(); | |
1045 | wxHtmlHelpHashData *ha; | |
1046 | if (an.IsEmpty()) | |
1047 | ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage()); | |
1048 | else | |
1049 | ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an); | |
1050 | if (ha && ha -> m_Index > 0) | |
1051 | { | |
1052 | int level = m_Data -> GetContents()[ha -> m_Index].m_Level - 1; | |
1053 | wxHtmlContentsItem *it; | |
1054 | int ind = ha -> m_Index - 1; | |
1055 | ||
1056 | it = m_Data -> GetContents() + ind; | |
1057 | while (ind >= 0 && it -> m_Level != level) ind--, it--; | |
1058 | if (ind >= 0) | |
1059 | { | |
1060 | m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); | |
1061 | NotifyPageChanged(); | |
1062 | } | |
1063 | } | |
1064 | } | |
1065 | break; | |
1066 | ||
1067 | case wxID_HTML_DOWN : | |
1068 | if (m_PagesHash) | |
1069 | { | |
1070 | wxString an = m_HtmlWin -> GetOpenedAnchor(); | |
721ab905 | 1071 | wxString adr; |
0646614d | 1072 | wxHtmlHelpHashData *ha; |
721ab905 VS |
1073 | |
1074 | if (an.IsEmpty()) adr = m_HtmlWin -> GetOpenedPage(); | |
1075 | else adr = m_HtmlWin -> GetOpenedPage() + wxT("#") + an; | |
1076 | ||
1077 | ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(adr); | |
0646614d VS |
1078 | |
1079 | if (ha && ha -> m_Index < m_Data -> GetContentsCnt() - 1) | |
1080 | { | |
1081 | wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index + 1); | |
721ab905 VS |
1082 | |
1083 | while (it -> m_Book -> GetBasePath() + it -> m_Page == adr) it++; | |
0646614d VS |
1084 | m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); |
1085 | NotifyPageChanged(); | |
1086 | } | |
1087 | } | |
8ec2b484 | 1088 | break; |
382e6efe | 1089 | |
8ec2b484 | 1090 | case wxID_HTML_PANEL : |
0646614d VS |
1091 | { |
1092 | if (! (m_Splitter && m_NavigPan)) | |
1093 | return ; | |
1094 | if (m_Splitter -> IsSplit()) { | |
1095 | m_Cfg.sashpos = m_Splitter -> GetSashPosition(); | |
1096 | m_Splitter -> Unsplit(m_NavigPan); | |
1097 | m_Cfg.navig_on = FALSE; | |
1098 | } else { | |
1099 | m_NavigPan -> Show(TRUE); | |
1100 | m_HtmlWin -> Show(TRUE); | |
1101 | m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); | |
1102 | m_Cfg.navig_on = TRUE; | |
1103 | } | |
8ec2b484 HH |
1104 | } |
1105 | break; | |
382e6efe | 1106 | |
83efdf33 VS |
1107 | case wxID_HTML_OPTIONS : |
1108 | OptionsDialog(); | |
1109 | break; | |
382e6efe VS |
1110 | |
1111 | case wxID_HTML_BOOKMARKSADD : | |
1112 | { | |
1113 | wxString item; | |
1114 | wxString url; | |
1115 | ||
1116 | item = m_HtmlWin -> GetOpenedPageTitle(); | |
1117 | url = m_HtmlWin -> GetOpenedPage(); | |
1118 | if (item == wxEmptyString) item = url.AfterLast(wxT('/')); | |
1119 | if (m_BookmarksPages.Index(url) == wxNOT_FOUND) { | |
1120 | m_Bookmarks -> Append(item); | |
1121 | m_BookmarksNames.Add(item); | |
1122 | m_BookmarksPages.Add(url); | |
1123 | } | |
1124 | } | |
1125 | break; | |
1126 | ||
1127 | case wxID_HTML_BOOKMARKSREMOVE : | |
1128 | { | |
1129 | wxString item; | |
1130 | int pos; | |
1131 | ||
1132 | item = m_Bookmarks -> GetStringSelection(); | |
1133 | pos = m_BookmarksNames.Index(item); | |
1134 | if (pos != wxNOT_FOUND) { | |
1135 | m_BookmarksNames.Remove(pos); | |
1136 | m_BookmarksPages.Remove(pos); | |
1137 | m_Bookmarks -> Delete(m_Bookmarks -> GetSelection()); | |
1138 | } | |
1139 | } | |
1140 | break; | |
0646614d VS |
1141 | |
1142 | #if wxUSE_PRINTING_ARCHITECTURE | |
1143 | case wxID_HTML_PRINT : | |
1144 | { | |
1145 | if (m_Printer == NULL) | |
1146 | m_Printer = new wxHtmlEasyPrinting(_("Help Printing"), this); | |
1147 | m_Printer -> PrintFile(m_HtmlWin -> GetOpenedPage()); | |
1148 | } | |
1149 | break; | |
1150 | #endif | |
1151 | ||
1152 | case wxID_HTML_OPENFILE : | |
1153 | { | |
1154 | wxString s = wxFileSelector(_("Open HTML document"), wxEmptyString, wxEmptyString, wxEmptyString, | |
1155 | wxT("HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|" | |
1156 | "Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|" | |
1157 | "HTML Help Project (*.hhp)|*.hhp|" | |
1158 | "All files (*.*)|*"), | |
1159 | wxOPEN | wxFILE_MUST_EXIST, this); | |
1160 | if (!s.IsEmpty()) | |
1161 | { | |
1162 | wxString ext = s.Right(4).Lower(); | |
1163 | if (ext == _T(".zip") || ext == _T(".htb") || ext == _T(".hhp")) | |
1164 | { | |
1165 | wxBusyCursor bcur; | |
1166 | m_Data -> AddBook(s); | |
1167 | RefreshLists(); | |
1168 | } | |
1169 | else | |
1170 | m_HtmlWin -> LoadPage(s); | |
1171 | } | |
1172 | } | |
1173 | break; | |
8ec2b484 HH |
1174 | } |
1175 | } | |
1176 | ||
1177 | ||
1178 | ||
1179 | void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event) | |
1180 | { | |
1181 | wxHtmlHelpTreeItemData *pg; | |
0646614d | 1182 | wxHtmlContentsItem *it; |
8ec2b484 HH |
1183 | |
1184 | pg = (wxHtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem()); | |
0646614d VS |
1185 | |
1186 | if (pg && m_UpdateContents) | |
1187 | { | |
1188 | it = m_Data -> GetContents() + (pg -> m_Id); | |
1189 | m_UpdateContents = FALSE; | |
1190 | m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); | |
1191 | m_UpdateContents = TRUE; | |
1192 | } | |
8ec2b484 HH |
1193 | } |
1194 | ||
1195 | ||
1196 | ||
a4c97004 | 1197 | void wxHtmlHelpFrame::OnIndexSel(wxCommandEvent& WXUNUSED(event)) |
8ec2b484 | 1198 | { |
f0b6a33f | 1199 | wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexList -> GetClientData(m_IndexList -> GetSelection()); |
c32bfc10 | 1200 | m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); |
0646614d | 1201 | NotifyPageChanged(); |
8ec2b484 HH |
1202 | } |
1203 | ||
1204 | ||
f0b6a33f VS |
1205 | void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) |
1206 | { | |
1207 | wxString sr = m_IndexText -> GetLineText(0); | |
240c2873 | 1208 | sr.MakeLower(); |
f0b6a33f VS |
1209 | if (sr == wxEmptyString) |
1210 | OnIndexAll(event); | |
1211 | ||
1212 | else { | |
1213 | wxBusyCursor bcur; | |
1214 | const wxChar *cstr = sr.c_str(); | |
240c2873 | 1215 | wxChar mybuff[512], *ptr; |
f0b6a33f VS |
1216 | bool first = TRUE; |
1217 | ||
1218 | m_IndexList->Clear(); | |
1219 | int cnt = m_Data->GetIndexCnt(); | |
1220 | wxHtmlContentsItem* index = m_Data->GetIndex(); | |
1221 | ||
240c2873 | 1222 | int displ = 0; |
f0b6a33f | 1223 | for (int i = 0; i < cnt; i++) |
240c2873 VS |
1224 | { |
1225 | wxStrncpy(mybuff, index[i].m_Name, 512); | |
1226 | mybuff[511] = 0; | |
1227 | for (ptr = mybuff; *ptr != 0; ptr++) | |
1228 | if (*ptr >= 'A' && *ptr <= 'Z') *ptr -= 'A' - 'a'; | |
1229 | if (wxStrstr(mybuff, cstr) != NULL) { | |
f0b6a33f | 1230 | m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); |
240c2873 | 1231 | displ++; |
f0b6a33f VS |
1232 | if (first) { |
1233 | m_HtmlWin -> LoadPage(index[i].m_Book -> GetBasePath() + index[i].m_Page); | |
0646614d | 1234 | NotifyPageChanged(); |
f0b6a33f VS |
1235 | first = FALSE; |
1236 | } | |
1237 | } | |
240c2873 VS |
1238 | } |
1239 | ||
1240 | wxString cnttext; | |
1241 | cnttext.Printf(_("%i of %i"), displ, cnt); | |
1242 | m_IndexCountInfo -> SetLabel(cnttext); | |
f0b6a33f VS |
1243 | |
1244 | m_IndexText -> SetSelection(0, sr.Length()); | |
1245 | m_IndexText -> SetFocus(); | |
1246 | } | |
1247 | } | |
1248 | ||
1249 | void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event)) | |
1250 | { | |
1251 | wxBusyCursor bcur; | |
1252 | ||
1253 | m_IndexList->Clear(); | |
1254 | int cnt = m_Data->GetIndexCnt(); | |
1255 | bool first = TRUE; | |
1256 | wxHtmlContentsItem* index = m_Data->GetIndex(); | |
1257 | ||
1258 | for (int i = 0; i < cnt; i++) { | |
1259 | m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); | |
1260 | if (first) { | |
1261 | m_HtmlWin -> LoadPage(index[i].m_Book -> GetBasePath() + index[i].m_Page); | |
0646614d | 1262 | NotifyPageChanged(); |
f0b6a33f VS |
1263 | first = FALSE; |
1264 | } | |
1265 | } | |
240c2873 VS |
1266 | |
1267 | wxString cnttext; | |
1268 | cnttext.Printf(_("%i of %i"), cnt, cnt); | |
1269 | m_IndexCountInfo -> SetLabel(cnttext); | |
f0b6a33f VS |
1270 | } |
1271 | ||
8ec2b484 | 1272 | |
a4c97004 | 1273 | void wxHtmlHelpFrame::OnSearchSel(wxCommandEvent& WXUNUSED(event)) |
8ec2b484 HH |
1274 | { |
1275 | wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection()); | |
0646614d VS |
1276 | if (it) |
1277 | { | |
1278 | m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); | |
1279 | NotifyPageChanged(); | |
1280 | } | |
8ec2b484 HH |
1281 | } |
1282 | ||
a4c97004 | 1283 | void wxHtmlHelpFrame::OnSearch(wxCommandEvent& WXUNUSED(event)) |
8ec2b484 HH |
1284 | { |
1285 | wxString sr = m_SearchText -> GetLineText(0); | |
1286 | ||
1287 | if (sr != wxEmptyString) KeywordSearch(sr); | |
1288 | } | |
1289 | ||
382e6efe VS |
1290 | void wxHtmlHelpFrame::OnBookmarksSel(wxCommandEvent& WXUNUSED(event)) |
1291 | { | |
1292 | wxString sr = m_Bookmarks -> GetStringSelection(); | |
1293 | ||
ae80f837 | 1294 | if (sr != wxEmptyString && sr != _("(bookmarks)")) |
0646614d VS |
1295 | { |
1296 | m_HtmlWin -> LoadPage(m_BookmarksPages[m_BookmarksNames.Index(sr)]); | |
1297 | NotifyPageChanged(); | |
1298 | } | |
382e6efe VS |
1299 | } |
1300 | ||
8ec2b484 HH |
1301 | void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt) |
1302 | { | |
68364659 VS |
1303 | GetSize(&m_Cfg.w, &m_Cfg.h); |
1304 | GetPosition(&m_Cfg.x, &m_Cfg.y); | |
5c172c17 | 1305 | |
68364659 VS |
1306 | if (m_Splitter && m_Cfg.navig_on) m_Cfg.sashpos = m_Splitter -> GetSashPosition(); |
1307 | ||
d5bb85a0 VS |
1308 | if (m_Config) |
1309 | WriteCustomization(m_Config, m_ConfigRoot); | |
68364659 | 1310 | |
8ec2b484 HH |
1311 | evt.Skip(); |
1312 | } | |
1313 | ||
1314 | BEGIN_EVENT_TABLE(wxHtmlHelpFrame, wxFrame) | |
ae80f837 VS |
1315 | EVT_TOOL_RANGE(wxID_HTML_PANEL, wxID_HTML_OPTIONS, wxHtmlHelpFrame::OnToolbar) |
1316 | EVT_BUTTON(wxID_HTML_BOOKMARKSREMOVE, wxHtmlHelpFrame::OnToolbar) | |
1317 | EVT_BUTTON(wxID_HTML_BOOKMARKSADD, wxHtmlHelpFrame::OnToolbar) | |
8ec2b484 HH |
1318 | EVT_TREE_SEL_CHANGED(wxID_HTML_TREECTRL, wxHtmlHelpFrame::OnContentsSel) |
1319 | EVT_LISTBOX(wxID_HTML_INDEXLIST, wxHtmlHelpFrame::OnIndexSel) | |
1320 | EVT_LISTBOX(wxID_HTML_SEARCHLIST, wxHtmlHelpFrame::OnSearchSel) | |
1321 | EVT_BUTTON(wxID_HTML_SEARCHBUTTON, wxHtmlHelpFrame::OnSearch) | |
1322 | EVT_TEXT_ENTER(wxID_HTML_SEARCHTEXT, wxHtmlHelpFrame::OnSearch) | |
f0b6a33f VS |
1323 | EVT_BUTTON(wxID_HTML_INDEXBUTTON, wxHtmlHelpFrame::OnIndexFind) |
1324 | EVT_TEXT_ENTER(wxID_HTML_INDEXTEXT, wxHtmlHelpFrame::OnIndexFind) | |
1325 | EVT_BUTTON(wxID_HTML_INDEXBUTTONALL, wxHtmlHelpFrame::OnIndexAll) | |
382e6efe VS |
1326 | EVT_COMBOBOX(wxID_HTML_BOOKMARKSLIST, wxHtmlHelpFrame::OnBookmarksSel) |
1327 | EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow) | |
8ec2b484 HH |
1328 | END_EVENT_TABLE() |
1329 | ||
1330 | #endif |