From: Julian Smart Date: Wed, 8 Mar 2000 13:04:51 +0000 (+0000) Subject: Added WinHelp sample doc to samples/help, and made it possible to show X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7c4a59a881c4b58111b104fb18597009c6b55fec?ds=inline Added WinHelp sample doc to samples/help, and made it possible to show both native and wxHTML help git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6522 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 929cfa6f9a..bad4201992 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -238,13 +238,15 @@ utils/dialoged/test/*.ico utils/dialoged/test/*.prj utils/dialoged/test/*.bmp +contrib/configure +contrib/configure.in + contrib/include/wx/mmedia/*.h contrib/include/wx/mmedia/internal/*.h contrib/src/mmedia/makefile* contrib/src/mmedia/README contrib/src/mmedia/*.h contrib/src/mmedia/*.cpp -contrib/src/mmedia/makefile* contrib/samples/mmedia/*.h contrib/samples/mmedia/*.cpp contrib/samples/mmedia/makefile* @@ -322,7 +324,13 @@ samples/help/makefile* samples/help/*.xbm samples/help/*.xpm samples/help/*.ico +samples/help/*.bmp samples/help/*.rc +samples/help/*.hlp +samples/help/*.cnt +samples/help/*.hpj +samples/help/*.tex +samples/help/*.ini samples/help/doc/*.html samples/help/doc/*.htm samples/help/doc/*.class diff --git a/distrib/msw/makefile.rsp b/distrib/msw/makefile.rsp index 9c309552b9..03a58c081e 100644 --- a/distrib/msw/makefile.rsp +++ b/distrib/msw/makefile.rsp @@ -57,14 +57,11 @@ samples/treelay/Makefile.in samples/opengl/cube/Makefile.in samples/opengl/penguin/Makefile.in samples/opengl/isosurf/Makefile.in -samples/ogl/ogledit/Makefile.in -samples/ogl/studio/Makefile.in demos/bombs/Makefile.in demos/forty/Makefile.in demos/fractal/Makefile.in demos/poem/Makefile.in demos/life/Makefile.in -utils/glcanvas/motif/Makefile.in utils/HelpGen/Makefile.in utils/tex2rtf/Makefile.in utils/tex2rtf/src/Makefile.in @@ -72,6 +69,10 @@ utils/dialoged/Makefile.in utils/dialoged/src/Makefile.in utils/hhp2cached/Makefile.in utils/Makefile.in -utils/wxMMedia2/Makefile.in -utils/wxMMedia2/lib/Makefile.in -utils/wxMMedia2/sample/Makefile.in +contrib/Makefile.in +contrib/src/ogl/Makefile.in +contrib/src/mmedia/Makefile.in +contrib/samples/ogl/ogledit/Makefile.in +contrib/samples/ogl/studio/Makefile.in +contrib/samples/mmedia/Makefile.in + diff --git a/distrib/msw/msw.rsp b/distrib/msw/msw.rsp index dcdddd05bd..976642cfa6 100644 --- a/distrib/msw/msw.rsp +++ b/distrib/msw/msw.rsp @@ -53,7 +53,6 @@ src/common/doslex.c src/common/y_tab.c src/common/lex_yy.c -src/msw/files.lst src/msw/*.cpp src/msw/*.h src/msw/makefile.* @@ -151,32 +150,3 @@ samples/oleauto/*.txt samples/oleauto/*.bmp samples/oleauto/*.ico -utils/nplugin/make*.* -utils/nplugin/src/*.cpp -utils/nplugin/src/*.h -utils/nplugin/src/*.rc -utils/nplugin/src/*.def -utils/nplugin/src/makefile.* -utils/nplugin/src/*.txt -utils/nplugin/samples/simple/*.cpp -utils/nplugin/samples/simple/*.h -utils/nplugin/samples/simple/*.rc -utils/nplugin/samples/simple/*.def -utils/nplugin/samples/simple/makefile.* -utils/nplugin/samples/simple/*.txt -utils/nplugin/samples/gui/*.cpp -utils/nplugin/samples/gui/*.h -utils/nplugin/samples/gui/*.rc -utils/nplugin/samples/gui/*.def -utils/nplugin/samples/gui/makefile.* -utils/nplugin/samples/gui/*.txt -utils/nplugin/docs/*.tex -utils/nplugin/docs/*.txt -utils/nplugin/docs/*.hpj -utils/nplugin/docs/*.eps -utils/nplugin/docs/*.ps -utils/nplugin/docs/*.ini -utils/nplugin/docs/*.cnt -utils/nplugin/docs/*.hlp -utils/nplugin/lib/dummy - diff --git a/distrib/msw/nplugin.rsp b/distrib/msw/nplugin.rsp new file mode 100644 index 0000000000..98c928c283 --- /dev/null +++ b/distrib/msw/nplugin.rsp @@ -0,0 +1,29 @@ +utils/nplugin/make*.* +utils/nplugin/src/*.cpp +utils/nplugin/src/*.h +utils/nplugin/src/*.rc +utils/nplugin/src/*.def +utils/nplugin/src/makefile.* +utils/nplugin/src/*.txt +utils/nplugin/samples/simple/*.cpp +utils/nplugin/samples/simple/*.h +utils/nplugin/samples/simple/*.rc +utils/nplugin/samples/simple/*.def +utils/nplugin/samples/simple/makefile.* +utils/nplugin/samples/simple/*.txt +utils/nplugin/samples/gui/*.cpp +utils/nplugin/samples/gui/*.h +utils/nplugin/samples/gui/*.rc +utils/nplugin/samples/gui/*.def +utils/nplugin/samples/gui/makefile.* +utils/nplugin/samples/gui/*.txt +utils/nplugin/docs/*.tex +utils/nplugin/docs/*.txt +utils/nplugin/docs/*.hpj +utils/nplugin/docs/*.eps +utils/nplugin/docs/*.ps +utils/nplugin/docs/*.ini +utils/nplugin/docs/*.cnt +utils/nplugin/docs/*.hlp +utils/nplugin/lib/dummy + diff --git a/include/wx/generic/helpwxht.h b/include/wx/generic/helpwxht.h index 9f1f8f9fca..449c20f085 100644 --- a/include/wx/generic/helpwxht.h +++ b/include/wx/generic/helpwxht.h @@ -6,8 +6,8 @@ * $Id$ *******************************************************************/ -#ifndef __WX_HELPWXHT_H_ -#define __WX_HELPWXHT_H_ +#ifndef _WX_HELPWXHT_H_ +#define _WX_HELPWXHT_H_ #if wxUSE_HELP #if wxUSE_HTML @@ -72,4 +72,4 @@ protected: #endif // wxUSE_HELP #endif // wxUSE_HTML -#endif // __WX_HELPEXT_H_ +#endif // _WX_HELPWXHT_H_ diff --git a/include/wx/help.h b/include/wx/help.h index 98f7cee571..e67d49358a 100644 --- a/include/wx/help.h +++ b/include/wx/help.h @@ -9,7 +9,22 @@ #define wxHelpController wxWinHelpController #define sm_classwxHelpController sm_classwxWinHelpController #else // !MSW - #include "wx/helpbase.h" + +/* By default, if wxHTML is compiled in, use the + wxHelpControllerHtml. If not, use the external help controller. + (of course, we shouldn't do it for wxMSW) +*/ + +#if wxUSE_HTML +# include "wx/generic/helpwxht.h" +# define wxHelpController wxHelpControllerHtml +# define sm_classwxHelpController sm_classwxHelpControllerHtml +#else +# include "wx/generic/helpext.h" +# define wxHelpController wxExtHelpController +# define sm_classwxHelpController sm_classwxExtHelpController +#endif + #endif // MSW/!MSW #endif diff --git a/include/wx/helpbase.h b/include/wx/helpbase.h index 9479573ecb..37cc6ea158 100644 --- a/include/wx/helpbase.h +++ b/include/wx/helpbase.h @@ -72,23 +72,6 @@ class WXDLLEXPORT wxHelpControllerBase: public wxObject virtual void OnQuit(void) {}; }; - -/* By default, if wxHTML is compiled in, use the - wxHelpControllerHtml. If not, use the external help controller. - (of course, we shouldn't do it for wxMSW) -*/ -#ifndef __WXMSW__ -#if wxUSE_HTML -# include "wx/generic/helpwxht.h" -# define wxHelpController wxHelpControllerHtml -# define sm_classwxHelpController sm_classwxHelpControllerHtml -#else -# include "wx/generic/helpext.h" -# define wxHelpController wxExtHelpController -# define sm_classwxHelpController sm_classwxExtHelpController -#endif -#endif // wxMSW - #endif // wxUSE_HELP #endif // _WX_HELPBASEH__ diff --git a/samples/help/bullet.bmp b/samples/help/bullet.bmp new file mode 100644 index 0000000000..aad8fc793e Binary files /dev/null and b/samples/help/bullet.bmp differ diff --git a/samples/help/demo.cpp b/samples/help/demo.cpp index e4b02bca0e..a27dfef41a 100644 --- a/samples/help/demo.cpp +++ b/samples/help/demo.cpp @@ -30,13 +30,22 @@ # include "wx/wx.h" #endif +# include "wx/image.h" +# include "wx/help.h" + // define this to 1 to use HTML help even under Windows (by default, Windows -// version will HLP-based help) +// version will use WinHelp). +// Please also see samples/html/helpview for a more complex help viewer. + #define USE_HTML_HELP 1 + +#if !wxUSE_HTML +#undef USE_HTML_HELP +#define USE_HTML_HELP 0 +#endif + #if USE_HTML_HELP -# include "wx/helpbase.h" -#else -# include "wx/help.h" +# include "wx/generic/helpwxht.h" #endif // ---------------------------------------------------------------------------- @@ -73,12 +82,21 @@ public: wxHelpController& GetHelpController() { return m_help; } +#if USE_HTML_HELP + wxHelpControllerHtml& GetHtmlHelpController() { return m_htmlHelp; } +#endif + // event handlers (these functions should _not_ be virtual) void OnQuit(wxCommandEvent& event); void OnHelp(wxCommandEvent& event); + void OnHtmlHelp(wxCommandEvent& event); private: - wxHelpController m_help; + wxHelpController m_help; + +#if USE_HTML_HELP + wxHelpControllerHtml m_htmlHelp; +#endif // any class wishing to process wxWindows events must use this macro DECLARE_EVENT_TABLE() @@ -97,10 +115,17 @@ enum HelpDemo_Help_Classes, HelpDemo_Help_Functions, HelpDemo_Help_Help, + HelpDemo_Help_Search, + + HelpDemo_Html_Help_Index, + HelpDemo_Html_Help_Classes, + HelpDemo_Html_Help_Functions, + HelpDemo_Html_Help_Help, + HelpDemo_Html_Help_Search, + HelpDemo_Help_KDE, HelpDemo_Help_GNOME, HelpDemo_Help_Netscape, - HelpDemo_Help_Search, // controls start here (the numbers are, of course, arbitrary) HelpDemo_Text = 1000, }; @@ -118,10 +143,17 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(HelpDemo_Help_Classes, MyFrame::OnHelp) EVT_MENU(HelpDemo_Help_Functions, MyFrame::OnHelp) EVT_MENU(HelpDemo_Help_Help, MyFrame::OnHelp) + EVT_MENU(HelpDemo_Help_Search, MyFrame::OnHelp) + + EVT_MENU(HelpDemo_Html_Help_Index, MyFrame::OnHtmlHelp) + EVT_MENU(HelpDemo_Html_Help_Classes, MyFrame::OnHtmlHelp) + EVT_MENU(HelpDemo_Html_Help_Functions, MyFrame::OnHtmlHelp) + EVT_MENU(HelpDemo_Html_Help_Help, MyFrame::OnHtmlHelp) + EVT_MENU(HelpDemo_Html_Help_Search, MyFrame::OnHtmlHelp) + EVT_MENU(HelpDemo_Help_KDE, MyFrame::OnHelp) EVT_MENU(HelpDemo_Help_GNOME, MyFrame::OnHelp) EVT_MENU(HelpDemo_Help_Netscape, MyFrame::OnHelp) - EVT_MENU(HelpDemo_Help_Search, MyFrame::OnHelp) END_EVENT_TABLE() // Create a new application object: this macro will allow wxWindows to create @@ -142,6 +174,13 @@ IMPLEMENT_APP(MyApp) // `Main program' equivalent: the program execution "starts" here bool MyApp::OnInit() { +#if wxUSE_HTML +#if wxUSE_GIF + // Required for images in the online documentation + wxImage::AddHandler(new wxGIFHandler); +#endif +#endif + // Create the main application window MyFrame *frame = new MyFrame("HelpDemo wxWindows App", wxPoint(50, 50), wxSize(450, 340)); @@ -149,7 +188,6 @@ bool MyApp::OnInit() frame->Show(TRUE); SetTopWindow(frame); - // initialise the help system: this means that we'll use doc.hlp file under // Windows and that the HTML docs are in the subdirectory doc for platforms // using HTML help @@ -160,6 +198,17 @@ bool MyApp::OnInit() return FALSE; } +#if USE_HTML_HELP + // initialise the help system: this means that the HTML docs are in the + // subdirectory doc for platforms using HTML help + if ( !frame->GetHtmlHelpController().Initialize("doc") ) + { + wxLogError("Cannot initialize the HTML help system, aborting."); + + return FALSE; + } +#endif + return TRUE; } @@ -183,6 +232,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) menuFile->Append(HelpDemo_Help_Help, "&About Help Demo..."); menuFile->AppendSeparator(); menuFile->Append(HelpDemo_Help_Search, "&Search help..."); +#if USE_HTML_HELP + menuFile->AppendSeparator(); + menuFile->Append(HelpDemo_Html_Help_Index, "HTML &Help Index..."); + menuFile->Append(HelpDemo_Html_Help_Classes, "HTML &Help on Classes..."); + menuFile->Append(HelpDemo_Html_Help_Functions, "HTML &Help on Functions..."); + menuFile->Append(HelpDemo_Html_Help_Help, "HTML &About Help Demo..."); + menuFile->AppendSeparator(); + menuFile->Append(HelpDemo_Html_Help_Search, "HTML &Search help..."); +#endif + #ifndef __WXMSW__ #if !wxUSE_HTML menuFile->AppendSeparator(); @@ -229,14 +288,15 @@ void MyFrame::OnHelp(wxCommandEvent& event) switch(event.GetId()) { - // Note: these DisplaySection calls use ids that are specific to wxExtHelpController - // (on Unix). For WinHelp, we'd need to use different context ids. + // Note: For WinHelp, these ids are specified in the map session, mapping + // topic names to numbers. + // For HTML and external help, a wxhelp.map file is used. case HelpDemo_Help_Classes: - m_help.DisplaySection(1); + m_help.DisplaySection(2); break; case HelpDemo_Help_Functions: - m_help.DisplaySection(2); + m_help.DisplaySection(1); break; case HelpDemo_Help_Help: m_help.DisplaySection(3); @@ -271,3 +331,37 @@ void MyFrame::OnHelp(wxCommandEvent& event) } } +void MyFrame::OnHtmlHelp(wxCommandEvent& event) +{ +#if USE_HTML_HELP + switch(event.GetId()) + { + + case HelpDemo_Html_Help_Classes: + m_htmlHelp.DisplaySection(2); + break; + case HelpDemo_Html_Help_Functions: + m_htmlHelp.DisplaySection(1); + break; + case HelpDemo_Html_Help_Help: + m_htmlHelp.DisplaySection(3); + break; + + case HelpDemo_Html_Help_Search: + { + wxString key = wxGetTextFromUser("Search for?", + "Search help for keyword", + "", + this); + if(! key.IsEmpty()) + m_htmlHelp.KeywordSearch(key); + } + break; + case HelpDemo_Html_Help_Index: + default: + m_htmlHelp.DisplayContents(); + break; + } +#endif +} + diff --git a/samples/help/doc.cnt b/samples/help/doc.cnt new file mode 100644 index 0000000000..ff60ab9f0d --- /dev/null +++ b/samples/help/doc.cnt @@ -0,0 +1,8 @@ +:Base doc.hlp +1 Introduction +2 Introduction=intro +2 Classes=classes +2 Functions=functions +2 About=about +1 Chapter 2 +2 Chapter 2=chapter2 diff --git a/samples/help/doc.hlp b/samples/help/doc.hlp new file mode 100644 index 0000000000..23177dc5c6 Binary files /dev/null and b/samples/help/doc.hlp differ diff --git a/samples/help/doc.hpj b/samples/help/doc.hpj new file mode 100644 index 0000000000..71c302f064 --- /dev/null +++ b/samples/help/doc.hpj @@ -0,0 +1,21 @@ +[OPTIONS] +BMROOT=D:\wx2\wxWind~1\samples\help +TITLE=Help Demo Document +CONTENTS=Contents +COMPRESS=HIGH + +[FILES] +doc.rtf + +[CONFIG] +CreateButton("Up", "&Up", "JumpId(`doc.hlp', `Contents')") +BrowseButtons() + +[MAP] +#define intro 100 +#define functions 1 +#define classes 2 +#define about 3 + +[BITMAPS] + diff --git a/samples/help/doc.tex b/samples/help/doc.tex new file mode 100644 index 0000000000..30edc88ec5 --- /dev/null +++ b/samples/help/doc.tex @@ -0,0 +1,59 @@ +\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report}% +\parskip=10pt% +\parindent=0pt% +\title{Help Demo}% +\author{by Julian Smart}% +\makeindex% +\begin{document}% +\maketitle% +\pagestyle{fancyplain}% +\bibliographystyle{plain}% +\pagenumbering{roman}% +\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}}% +\setfooter{\thepage}{}{}{}{}{\thepage}% +\tableofcontents% + +\chapter{Introduction}\label{intro} +\pagenumbering{arabic}% +\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% +\setfooter{\thepage}{}{}{}{}{\thepage}% + +This is a demo document for the wxWindows 'help' sample. + +You should process this file with Tex2RTF, for example: + +{\tt tex2rtf -winhelp -twice doc.tex doc.hlp} + +and then run: + +{\tt hc doc} + +where hc is the help compiler. + +Note that you can also generate HTML and Word RTF with Tex2RTF. + +\section{Classes}\label{classes} + +This would say something about classes, but doesn't yet. + +\section{Functions}\label{functions} + +This would say something about functions, but doesn't yet. + +\section{About}\label{about} + +About this HelpDemo: this file is really not much of a demo, but it's a start. + +\chapter{Chapter 2}\label{chapter2} +\pagenumbering{arabic}% +\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% +\setfooter{\thepage}{}{}{}{}{\thepage}% + +Another chapter in this enticing little manual. + +\addcontentsline{toc}{chapter}{Index} +\setheader{{\it INDEX}}{}{}{}{}{{\it INDEX}}% +\setfooter{\thepage}{}{}{}{}{\thepage}% +\printindex% + +\end{document} diff --git a/samples/help/doc/wxhelp.map b/samples/help/doc/wxhelp.map index 41eab79d24..2b4d4104ca 100644 --- a/samples/help/doc/wxhelp.map +++ b/samples/help/doc/wxhelp.map @@ -5,6 +5,6 @@ ; First, some wxWindows documentation files: ; 0 wx.htm ; wxWindows: Help index; additional keywords like overview -1 wx204.htm ; wxWindows Class References -2 wx34.htm ; wxWindows Function References; methods -3 aindex.html +1 wx204.htm ; wxWindows Function Reference +2 wx34.htm ; wxWindows Class Reference +3 aindex.html ; diff --git a/samples/help/tex2rtf.ini b/samples/help/tex2rtf.ini new file mode 100644 index 0000000000..fe33da72c2 --- /dev/null +++ b/samples/help/tex2rtf.ini @@ -0,0 +1,21 @@ +; Tex2RTF initialisation file +runTwice = yes +titleFontSize = 12 +authorFontSize = 10 +chapterFontSize = 12 +sectionFontSize = 12 +subsectionFontSize = 12 +headerRule = yes +footerRule = yes +useHeadingStyles = yes +contentsDepth = 2 +listItemIndent=40 +winHelpContents = yes +winHelpVersion = 3 ; 3 for Windows 3.x, 4 for Windows 95 +generateHPJ = no +htmlBrowseButtons = bitmap +winHelpTitle = "Help Demo Document" +truncateFilenames = yes +combineSubSections = yes +htmlIndex = yes +htmlFrameContents = no diff --git a/samples/plot/makefile.b32 b/samples/plot/makefile.b32 new file mode 100644 index 0000000000..63dd8d51e1 --- /dev/null +++ b/samples/plot/makefile.b32 @@ -0,0 +1,16 @@ +# +# File: makefile.b32 +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: +# +# Makefile : Builds sample for 32-bit BC++ + +WXDIR = $(WXWIN) + +TARGET=plot +OBJECTS = $(TARGET).obj + +!include $(WXDIR)\src\makeprog.b32 + diff --git a/samples/plot/makefile.bcc b/samples/plot/makefile.bcc new file mode 100644 index 0000000000..af467844fc --- /dev/null +++ b/samples/plot/makefile.bcc @@ -0,0 +1,19 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1998 +# Updated: +# +# Builds a BC++ 16-bit sample + +!if "$(WXWIN)" == "" +!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx +!endif + +WXDIR = $(WXWIN) + +TARGET=plot +OBJECTS=$(TARGET).obj + +!include $(WXDIR)\src\makeprog.bcc + diff --git a/samples/plot/makefile.dos b/samples/plot/makefile.dos new file mode 100644 index 0000000000..14899f62a6 --- /dev/null +++ b/samples/plot/makefile.dos @@ -0,0 +1,17 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1998 +# Updated: +# +# Makefile : Builds 16-bit sample, VC++ 1.5 +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +TARGET=plot +OBJECTS=$(TARGET).obj + +!include $(WXDIR)\src\makeprog.msc + diff --git a/samples/plot/makefile.vc b/samples/plot/makefile.vc new file mode 100644 index 0000000000..df5f8c09d9 --- /dev/null +++ b/samples/plot/makefile.vc @@ -0,0 +1,18 @@ +# +# File: makefile.vc +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: (c) Julian Smart +# +# Makefile : Builds sample (VC++, WIN32) +# Use FINAL=1 argument to nmake to build final version with no debug info. + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +PROGRAM=plot +OBJECTS = $(PROGRAM).obj + +!include $(WXDIR)\src\makeprog.vc + diff --git a/samples/plot/makefile.wat b/samples/plot/makefile.wat new file mode 100644 index 0000000000..7fb6525054 --- /dev/null +++ b/samples/plot/makefile.wat @@ -0,0 +1,15 @@ +# +# Makefile for WATCOM +# +# Created by Julian Smart, January 1999 +# +# + +WXDIR = $(%WXWIN) + +PROGRAM = plot +OBJECTS = $(PROGRAM).obj + +!include $(WXDIR)\src\makeprog.wat + +