diff --git a/.cvsignore b/.cvsignore index 4650dfe..da55403 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -wxGTK-2.8.0.tar.bz2 +wxGTK-2.8.3.tar.bz2 diff --git a/sources b/sources index 062c743..1da59bc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9de30aeaad9bac6f8869907fa42fe950 wxGTK-2.8.0.tar.bz2 +758a7aa5d1a0403a571823762b0ebe2a wxGTK-2.8.3.tar.bz2 diff --git a/wxGTK-2.8.0.1-cvs.patch b/wxGTK-2.8.0.1-cvs.patch deleted file mode 100644 index ca3c61a..0000000 --- a/wxGTK-2.8.0.1-cvs.patch +++ /dev/null @@ -1,5248 +0,0 @@ -# Generated with `cvs diff -u -R -N -r WX_2_8_0 -r wxPy_2_8_0_1`, and then -# trimmed for non-platform-relevant changes - -Index: wxWidgets/Makefile.in -=================================================================== -RCS file: /pack/cvsroots/wxwidgets/wxWidgets/Makefile.in,v -retrieving revision 1.669 -retrieving revision 1.670 -diff -u -r1.669 -r1.670 ---- wxWidgets/Makefile.in 2006/12/04 01:14:25 1.669 -+++ wxWidgets/Makefile.in 2006/12/11 06:19:27 1.670 -@@ -2157,6 +2157,7 @@ - wx/mac/sound.h \ - wx/mac/spinbutt.h \ - wx/mac/spinctrl.h \ -+ wx/mac/srchctrl.h \ - wx/mac/statbmp.h \ - wx/mac/statbox.h \ - wx/mac/statline.h \ -@@ -2230,6 +2231,9 @@ - wx/mac/carbon/printdlg.h \ - wx/mac/carbon/printmac.h \ - wx/mac/carbon/private.h \ -+ wx/mac/carbon/private/mactext.h \ -+ wx/mac/carbon/private/overlay.h \ -+ wx/mac/carbon/private/print.h \ - wx/mac/carbon/radiobox.h \ - wx/mac/carbon/radiobut.h \ - wx/mac/carbon/region.h \ -@@ -2237,6 +2241,7 @@ - wx/mac/carbon/slider.h \ - wx/mac/carbon/spinbutt.h \ - wx/mac/carbon/spinctrl.h \ -+ wx/mac/carbon/srchctrl.h \ - wx/mac/carbon/statbmp.h \ - wx/mac/carbon/statbox.h \ - wx/mac/carbon/statline.h \ -@@ -2871,6 +2876,7 @@ - wx/generic/scrolwin.h \ - wx/generic/spinctlg.h \ - wx/generic/splitter.h \ -+ wx/generic/srchctlg.h \ - wx/generic/textdlgg.h \ - wx/generic/timer.h \ - wx/generic/treectlg.h \ -@@ -2988,6 +2994,7 @@ - wx/spinbutt.h \ - wx/spinctrl.h \ - wx/splitter.h \ -+ wx/srchctrl.h \ - wx/statline.h \ - wx/tab.h \ - wx/tabctrl.h \ -@@ -3497,6 +3504,7 @@ - monodll_rgncmn.o \ - monodll_settcmn.o \ - monodll_sizer.o \ -+ monodll_srchcmn.o \ - monodll_statbar.o \ - monodll_stockitem.o \ - monodll_tbarbase.o \ -@@ -3532,6 +3540,7 @@ - monodll_selstore.o \ - monodll_spinctlg.o \ - monodll_splitter.o \ -+ monodll_srchctlg.o \ - monodll_textdlgg.o \ - monodll_tipwin.o \ - monodll_toolbkg.o \ -@@ -3670,6 +3679,7 @@ - monodll_rgncmn.o \ - monodll_settcmn.o \ - monodll_sizer.o \ -+ monodll_srchcmn.o \ - monodll_statbar.o \ - monodll_stockitem.o \ - monodll_tbarbase.o \ -@@ -3705,6 +3715,7 @@ - monodll_selstore.o \ - monodll_spinctlg.o \ - monodll_splitter.o \ -+ monodll_srchctlg.o \ - monodll_textdlgg.o \ - monodll_tipwin.o \ - monodll_toolbkg.o \ -@@ -4263,6 +4274,7 @@ - monodll_slider.o \ - monodll_spinbutt.o \ - monodll_spinctrl.o \ -+ monodll_srchctrl.o \ - monodll_statbmp.o \ - monodll_statbox.o \ - monodll_statbrma.o \ -@@ -5271,6 +5283,7 @@ - monolib_rgncmn.o \ - monolib_settcmn.o \ - monolib_sizer.o \ -+ monolib_srchcmn.o \ - monolib_statbar.o \ - monolib_stockitem.o \ - monolib_tbarbase.o \ -@@ -5306,6 +5319,7 @@ - monolib_selstore.o \ - monolib_spinctlg.o \ - monolib_splitter.o \ -+ monolib_srchctlg.o \ - monolib_textdlgg.o \ - monolib_tipwin.o \ - monolib_toolbkg.o \ -@@ -5444,6 +5458,7 @@ - monolib_rgncmn.o \ - monolib_settcmn.o \ - monolib_sizer.o \ -+ monolib_srchcmn.o \ - monolib_statbar.o \ - monolib_stockitem.o \ - monolib_tbarbase.o \ -@@ -5479,6 +5494,7 @@ - monolib_selstore.o \ - monolib_spinctlg.o \ - monolib_splitter.o \ -+ monolib_srchctlg.o \ - monolib_textdlgg.o \ - monolib_tipwin.o \ - monolib_toolbkg.o \ -@@ -6038,6 +6054,7 @@ - monolib_slider.o \ - monolib_spinbutt.o \ - monolib_spinctrl.o \ -+ monolib_srchctrl.o \ - monolib_statbmp.o \ - monolib_statbox.o \ - monolib_statbrma.o \ -@@ -7275,6 +7292,7 @@ - coredll_rgncmn.o \ - coredll_settcmn.o \ - coredll_sizer.o \ -+ coredll_srchcmn.o \ - coredll_statbar.o \ - coredll_stockitem.o \ - coredll_tbarbase.o \ -@@ -7310,6 +7328,7 @@ - coredll_selstore.o \ - coredll_spinctlg.o \ - coredll_splitter.o \ -+ coredll_srchctlg.o \ - coredll_textdlgg.o \ - coredll_tipwin.o \ - coredll_toolbkg.o \ -@@ -7448,6 +7467,7 @@ - coredll_rgncmn.o \ - coredll_settcmn.o \ - coredll_sizer.o \ -+ coredll_srchcmn.o \ - coredll_statbar.o \ - coredll_stockitem.o \ - coredll_tbarbase.o \ -@@ -7483,6 +7503,7 @@ - coredll_selstore.o \ - coredll_spinctlg.o \ - coredll_splitter.o \ -+ coredll_srchctlg.o \ - coredll_textdlgg.o \ - coredll_tipwin.o \ - coredll_toolbkg.o \ -@@ -8042,6 +8063,7 @@ - coredll_slider.o \ - coredll_spinbutt.o \ - coredll_spinctrl.o \ -+ coredll_srchctrl.o \ - coredll_statbmp.o \ - coredll_statbox.o \ - coredll_statbrma.o \ -@@ -8723,6 +8745,7 @@ - corelib_rgncmn.o \ - corelib_settcmn.o \ - corelib_sizer.o \ -+ corelib_srchcmn.o \ - corelib_statbar.o \ - corelib_stockitem.o \ - corelib_tbarbase.o \ -@@ -8758,6 +8781,7 @@ - corelib_selstore.o \ - corelib_spinctlg.o \ - corelib_splitter.o \ -+ corelib_srchctlg.o \ - corelib_textdlgg.o \ - corelib_tipwin.o \ - corelib_toolbkg.o \ -@@ -8896,6 +8920,7 @@ - corelib_rgncmn.o \ - corelib_settcmn.o \ - corelib_sizer.o \ -+ corelib_srchcmn.o \ - corelib_statbar.o \ - corelib_stockitem.o \ - corelib_tbarbase.o \ -@@ -8931,6 +8956,7 @@ - corelib_selstore.o \ - corelib_spinctlg.o \ - corelib_splitter.o \ -+ corelib_srchctlg.o \ - corelib_textdlgg.o \ - corelib_tipwin.o \ - corelib_toolbkg.o \ -@@ -9490,6 +9516,7 @@ - corelib_slider.o \ - corelib_spinbutt.o \ - corelib_spinctrl.o \ -+ corelib_srchctrl.o \ - corelib_statbmp.o \ - corelib_statbox.o \ - corelib_statbrma.o \ -@@ -12852,6 +12879,9 @@ - monodll_printmac.o: $(srcdir)/src/mac/carbon/printmac.cpp $(MONODLL_ODEP) - $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/carbon/printmac.cpp - -+monodll_srchctrl.o: $(srcdir)/src/mac/carbon/srchctrl.cpp $(MONODLL_ODEP) -+ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/carbon/srchctrl.cpp -+ - monodll_statbrma.o: $(srcdir)/src/mac/carbon/statbrma.cpp $(MONODLL_ODEP) - $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/carbon/statbrma.cpp - -@@ -16224,6 +16254,9 @@ - @COND_USE_GUI_1@monodll_sizer.o: $(srcdir)/src/common/sizer.cpp $(MONODLL_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/sizer.cpp - -+@COND_USE_GUI_1@monodll_srchcmn.o: $(srcdir)/src/common/srchcmn.cpp $(MONODLL_ODEP) -+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/srchcmn.cpp -+ - @COND_USE_GUI_1@monodll_statbar.o: $(srcdir)/src/common/statbar.cpp $(MONODLL_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/statbar.cpp - -@@ -16329,6 +16362,9 @@ - @COND_USE_GUI_1@monodll_splitter.o: $(srcdir)/src/generic/splitter.cpp $(MONODLL_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/splitter.cpp - -+@COND_USE_GUI_1@monodll_srchctlg.o: $(srcdir)/src/generic/srchctlg.cpp $(MONODLL_ODEP) -+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/srchctlg.cpp -+ - @COND_USE_GUI_1@monodll_textdlgg.o: $(srcdir)/src/generic/textdlgg.cpp $(MONODLL_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/textdlgg.cpp - -@@ -16959,6 +16995,9 @@ - monolib_printmac.o: $(srcdir)/src/mac/carbon/printmac.cpp $(MONOLIB_ODEP) - $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/carbon/printmac.cpp - -+monolib_srchctrl.o: $(srcdir)/src/mac/carbon/srchctrl.cpp $(MONOLIB_ODEP) -+ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/carbon/srchctrl.cpp -+ - monolib_statbrma.o: $(srcdir)/src/mac/carbon/statbrma.cpp $(MONOLIB_ODEP) - $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/carbon/statbrma.cpp - -@@ -20331,6 +20370,9 @@ - @COND_USE_GUI_1@monolib_sizer.o: $(srcdir)/src/common/sizer.cpp $(MONOLIB_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/sizer.cpp - -+@COND_USE_GUI_1@monolib_srchcmn.o: $(srcdir)/src/common/srchcmn.cpp $(MONOLIB_ODEP) -+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/srchcmn.cpp -+ - @COND_USE_GUI_1@monolib_statbar.o: $(srcdir)/src/common/statbar.cpp $(MONOLIB_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/statbar.cpp - -@@ -20436,6 +20478,9 @@ - @COND_USE_GUI_1@monolib_splitter.o: $(srcdir)/src/generic/splitter.cpp $(MONOLIB_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/splitter.cpp - -+@COND_USE_GUI_1@monolib_srchctlg.o: $(srcdir)/src/generic/srchctlg.cpp $(MONOLIB_ODEP) -+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/srchctlg.cpp -+ - @COND_USE_GUI_1@monolib_textdlgg.o: $(srcdir)/src/generic/textdlgg.cpp $(MONOLIB_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/textdlgg.cpp - -@@ -22065,6 +22110,9 @@ - coredll_printmac.o: $(srcdir)/src/mac/carbon/printmac.cpp $(COREDLL_ODEP) - $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/carbon/printmac.cpp - -+coredll_srchctrl.o: $(srcdir)/src/mac/carbon/srchctrl.cpp $(COREDLL_ODEP) -+ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/carbon/srchctrl.cpp -+ - coredll_statbrma.o: $(srcdir)/src/mac/carbon/statbrma.cpp $(COREDLL_ODEP) - $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/carbon/statbrma.cpp - -@@ -24783,6 +24831,9 @@ - @COND_USE_GUI_1@coredll_sizer.o: $(srcdir)/src/common/sizer.cpp $(COREDLL_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/sizer.cpp - -+@COND_USE_GUI_1@coredll_srchcmn.o: $(srcdir)/src/common/srchcmn.cpp $(COREDLL_ODEP) -+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/srchcmn.cpp -+ - @COND_USE_GUI_1@coredll_statbar.o: $(srcdir)/src/common/statbar.cpp $(COREDLL_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/statbar.cpp - -@@ -24888,6 +24939,9 @@ - @COND_USE_GUI_1@coredll_splitter.o: $(srcdir)/src/generic/splitter.cpp $(COREDLL_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/splitter.cpp - -+@COND_USE_GUI_1@coredll_srchctlg.o: $(srcdir)/src/generic/srchctlg.cpp $(COREDLL_ODEP) -+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/srchctlg.cpp -+ - @COND_USE_GUI_1@coredll_textdlgg.o: $(srcdir)/src/generic/textdlgg.cpp $(COREDLL_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/textdlgg.cpp - -@@ -25008,6 +25062,9 @@ - corelib_printmac.o: $(srcdir)/src/mac/carbon/printmac.cpp $(CORELIB_ODEP) - $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/carbon/printmac.cpp - -+corelib_srchctrl.o: $(srcdir)/src/mac/carbon/srchctrl.cpp $(CORELIB_ODEP) -+ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/carbon/srchctrl.cpp -+ - corelib_statbrma.o: $(srcdir)/src/mac/carbon/statbrma.cpp $(CORELIB_ODEP) - $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/carbon/statbrma.cpp - -@@ -27726,6 +27783,9 @@ - @COND_USE_GUI_1@corelib_sizer.o: $(srcdir)/src/common/sizer.cpp $(CORELIB_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/sizer.cpp - -+@COND_USE_GUI_1@corelib_srchcmn.o: $(srcdir)/src/common/srchcmn.cpp $(CORELIB_ODEP) -+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/srchcmn.cpp -+ - @COND_USE_GUI_1@corelib_statbar.o: $(srcdir)/src/common/statbar.cpp $(CORELIB_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/statbar.cpp - -@@ -27830,6 +27890,9 @@ - - @COND_USE_GUI_1@corelib_splitter.o: $(srcdir)/src/generic/splitter.cpp $(CORELIB_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/splitter.cpp -+ -+@COND_USE_GUI_1@corelib_srchctlg.o: $(srcdir)/src/generic/srchctlg.cpp $(CORELIB_ODEP) -+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/srchctlg.cpp - - @COND_USE_GUI_1@corelib_textdlgg.o: $(srcdir)/src/generic/textdlgg.cpp $(CORELIB_ODEP) - @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/textdlgg.cpp -Index: wxWidgets/configure.in -=================================================================== -RCS file: /pack/cvsroots/wxwidgets/wxWidgets/configure.in,v -retrieving revision 1.1226 -retrieving revision 1.1228 -diff -u -r1.1226 -r1.1228 ---- wxWidgets/configure.in 2006/12/09 23:43:54 1.1226 -+++ wxWidgets/configure.in 2006/12/12 01:52:43 1.1228 -@@ -1,5 +1,5 @@ - dnl Process this file with autoconf to produce a configure script. --AC_REVISION($Id: configure.in,v 1.1226 2006/12/09 23:43:54 MW Exp $)dnl -+AC_REVISION($Id: configure.in,v 1.1228 2006/12/12 01:52:43 RD Exp $)dnl - - AC_PREREQ(2.58) - -@@ -10,7 +10,7 @@ - dnl - dnl This script is under the wxWidgets licence. - dnl --dnl Version: $Id: configure.in,v 1.1226 2006/12/09 23:43:54 MW Exp $ -+dnl Version: $Id: configure.in,v 1.1228 2006/12/12 01:52:43 RD Exp $ - dnl --------------------------------------------------------------------------- - - dnl --------------------------------------------------------------------------- -@@ -35,7 +35,7 @@ - wx_major_version_number=2 - wx_minor_version_number=8 - wx_release_number=0 --wx_subrelease_number=0 -+wx_subrelease_number=1 - - WX_RELEASE=$wx_major_version_number.$wx_minor_version_number - WX_VERSION=$WX_RELEASE.$wx_release_number -@@ -552,6 +552,7 @@ - DEFAULT_wxUSE_RADIOBTN=no - DEFAULT_wxUSE_SASH=no - DEFAULT_wxUSE_SCROLLBAR=no -+ DEFAULT_wxUSE_SEARCHCTRL=no - DEFAULT_wxUSE_SLIDER=no - DEFAULT_wxUSE_SPINBTN=no - DEFAULT_wxUSE_SPINCTRL=no -@@ -775,6 +776,7 @@ - DEFAULT_wxUSE_RADIOBTN=yes - DEFAULT_wxUSE_SASH=yes - DEFAULT_wxUSE_SCROLLBAR=yes -+ DEFAULT_wxUSE_SEARCHCTRL=yes - DEFAULT_wxUSE_SLIDER=yes - DEFAULT_wxUSE_SPINBTN=yes - DEFAULT_wxUSE_SPINCTRL=yes -@@ -1107,6 +1109,7 @@ - DEFAULT_wxUSE_RADIOBTN=yes - DEFAULT_wxUSE_SASH=yes - DEFAULT_wxUSE_SCROLLBAR=yes -+ DEFAULT_wxUSE_SEARCHCTRL=yes - DEFAULT_wxUSE_SLIDER=yes - DEFAULT_wxUSE_SPINBTN=yes - DEFAULT_wxUSE_SPINCTRL=yes -@@ -1159,6 +1162,7 @@ - DEFAULT_wxUSE_RADIOBTN=no - DEFAULT_wxUSE_SASH=no - DEFAULT_wxUSE_SCROLLBAR=no -+ DEFAULT_wxUSE_SEARCHCTRL=no - DEFAULT_wxUSE_SLIDER=no - DEFAULT_wxUSE_SPINBTN=no - DEFAULT_wxUSE_SPINCTRL=no -@@ -1214,6 +1218,7 @@ - WX_ARG_ENABLE(radiobtn, [ --enable-radiobtn use wxRadioButton class], wxUSE_RADIOBTN) - WX_ARG_ENABLE(sash, [ --enable-sash use wxSashWindow class], wxUSE_SASH) - WX_ARG_ENABLE(scrollbar, [ --enable-scrollbar use wxScrollBar class and scrollable windows], wxUSE_SCROLLBAR) -+WX_ARG_ENABLE(searchctrl, [ --enable-searchctrl use wxSearchCtrl class], wxUSE_SEARCHCTRL) - WX_ARG_ENABLE(slider, [ --enable-slider use wxSlider class], wxUSE_SLIDER) - WX_ARG_ENABLE(spinbtn, [ --enable-spinbtn use wxSpinButton class], wxUSE_SPINBTN) - WX_ARG_ENABLE(spinctrl, [ --enable-spinctrl use wxSpinCtrl class], wxUSE_SPINCTRL) -@@ -6880,6 +6885,11 @@ - AC_DEFINE(wxUSE_SCROLLBAR) - USES_CONTROLS=1 - SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS scroll scrollsub" -+fi -+ -+if test "$wxUSE_SEARCHCTRL" = "yes"; then -+ AC_DEFINE(wxUSE_SEARCHCTRL) -+ USES_CONTROLS=1 - fi - - if test "$wxUSE_SLIDER" = "yes"; then -Index: wxWidgets/setup.h.in -=================================================================== -RCS file: /pack/cvsroots/wxwidgets/wxWidgets/setup.h.in,v -retrieving revision 1.247 -retrieving revision 1.248 -diff -u -r1.247 -r1.248 ---- wxWidgets/setup.h.in 2006/12/03 21:59:40 1.247 -+++ wxWidgets/setup.h.in 2006/12/11 06:19:16 1.248 -@@ -332,6 +332,7 @@ - #define wxUSE_RADIOBOX 0 - #define wxUSE_RADIOBTN 0 - #define wxUSE_SCROLLBAR 0 -+#define wxUSE_SEARCHCTRL 0 - #define wxUSE_SLIDER 0 - #define wxUSE_SPINBTN 0 - #define wxUSE_SPINCTRL 0 -Index: wxWidgets/build/bakefiles/files.bkl -=================================================================== -RCS file: /pack/cvsroots/wxwidgets/wxWidgets/build/bakefiles/files.bkl,v -retrieving revision 1.412 -retrieving revision 1.413 -diff -u -r1.412 -r1.413 ---- wxWidgets/build/bakefiles/files.bkl 2006/12/04 01:14:19 1.412 -+++ wxWidgets/build/bakefiles/files.bkl 2006/12/11 06:19:13 1.413 -@@ -1,5 +1,5 @@ - -- -+ - - - -+ - - - -@@ -22,6 +22,7 @@ - notebook.cpp - odcombobox.cpp - radiobox.cpp -+ searchctrl.cpp - slider.cpp - spinbtn.cpp - static.cpp -Index: wxWidgets/src/common/srchcmn.cpp -=================================================================== -RCS file: srchcmn.cpp -diff -N srchcmn.cpp ---- /dev/null Thu Dec 14 21:47:38 2006 -+++ wxWidgets/src/common/srchcmn.cpp Thu Dec 14 21:47:38 2006 -@@ -0,0 +1,42 @@ -+///////////////////////////////////////////////////////////////////////////// -+// Name: src/common/srchcmn.cpp -+// Purpose: common (to all ports) bits of wxSearchCtrl -+// Author: Robin Dunn -+// Modified by: -+// Created: 19-Dec-2006 -+// RCS-ID: $Id: srchcmn.cpp,v 1.2 2006/12/11 20:32:03 KO Exp $ -+// Copyright: (c) wxWidgets team -+// Licence: wxWindows licence -+///////////////////////////////////////////////////////////////////////////// -+ -+// ============================================================================ -+// declarations -+// ============================================================================ -+ -+// ---------------------------------------------------------------------------- -+// headers -+// ---------------------------------------------------------------------------- -+ -+// For compilers that support precompilation, includes "wx.h". -+#include "wx/wxprec.h" -+ -+#ifdef __BORLANDC__ -+ #pragma hdrstop -+#endif -+ -+#if wxUSE_SEARCHCTRL -+ -+#include "wx/srchctrl.h" -+ -+#ifndef WX_PRECOMP -+#endif -+ -+// ---------------------------------------------------------------------------- -+ -+const wxChar wxSearchCtrlNameStr[] = wxT("searchCtrl"); -+ -+DEFINE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN) -+DEFINE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN) -+ -+ -+#endif // wxUSE_SEARCHCTRL -Index: wxWidgets/src/generic/srchctlg.cpp -=================================================================== -RCS file: srchctlg.cpp -diff -N srchctlg.cpp ---- /dev/null Thu Dec 14 21:47:42 2006 -+++ wxWidgets/src/generic/srchctlg.cpp Thu Dec 14 21:47:44 2006 -@@ -0,0 +1,1079 @@ -+/////////////////////////////////////////////////////////////////////////////// -+// Name: src/generic/srchctlg.cpp -+// Purpose: implements wxSearchCtrl as a composite control -+// Author: Vince Harron -+// Created: 2006-02-19 -+// RCS-ID: $Id: srchctlg.cpp,v 1.10 2006/12/12 00:53:47 RD Exp $ -+// Copyright: Vince Harron -+// License: wxWindows licence -+/////////////////////////////////////////////////////////////////////////////// -+ -+// For compilers that support precompilation, includes "wx.h". -+#include "wx/wxprec.h" -+ -+#ifdef __BORLANDC__ -+ #pragma hdrstop -+#endif -+ -+#if wxUSE_SEARCHCTRL -+ -+#include "wx/srchctrl.h" -+ -+#ifndef WX_PRECOMP -+ #include "wx/button.h" -+ #include "wx/dcclient.h" -+ #include "wx/menu.h" -+ #include "wx/dcmemory.h" -+#endif //WX_PRECOMP -+ -+#if !wxUSE_NATIVE_SEARCH_CONTROL -+ -+#include "wx/image.h" -+ -+#define WXMAX(a,b) ((a)>(b)?(a):(b)) -+ -+// ---------------------------------------------------------------------------- -+// constants -+// ---------------------------------------------------------------------------- -+ -+// the margin between the text control and the search/cancel buttons -+static const wxCoord MARGIN = 2; -+ -+// border around all controls to compensate for wxSIMPLE_BORDER -+#if defined(__WXMSW__) -+static const wxCoord BORDER = 0; -+static const wxCoord ICON_MARGIN = 2; -+static const wxCoord ICON_OFFSET = 2; -+#else -+static const wxCoord BORDER = 2; -+static const wxCoord ICON_MARGIN = 0; -+static const wxCoord ICON_OFFSET = 0; -+#endif -+ -+// ---------------------------------------------------------------------------- -+// wxSearchTextCtrl: text control used by search control -+// ---------------------------------------------------------------------------- -+ -+class wxSearchTextCtrl : public wxTextCtrl -+{ -+public: -+ wxSearchTextCtrl(wxSearchCtrl *search, const wxString& value, int style) -+ : wxTextCtrl(search, wxID_ANY, value, wxDefaultPosition, wxDefaultSize, -+ style | wxNO_BORDER) -+ { -+ m_search = search; -+ -+ // remove the default minsize, the searchctrl will have one instead -+ SetSizeHints(wxDefaultCoord,wxDefaultCoord); -+ } -+ -+protected: -+ void OnText(wxCommandEvent& eventText) -+ { -+ wxCommandEvent event(eventText); -+ event.SetEventObject(m_search); -+ event.SetId(m_search->GetId()); -+ -+ m_search->GetEventHandler()->ProcessEvent(event); -+ } -+ -+ void OnTextUrl(wxTextUrlEvent& eventText) -+ { -+ // copy constructor is disabled for some reason? -+ //wxTextUrlEvent event(eventText); -+ wxTextUrlEvent event( -+ m_search->GetId(), -+ eventText.GetMouseEvent(), -+ eventText.GetURLStart(), -+ eventText.GetURLEnd() -+ ); -+ event.SetEventObject(m_search); -+ -+ m_search->GetEventHandler()->ProcessEvent(event); -+ } -+ -+private: -+ wxSearchCtrl* m_search; -+ -+ DECLARE_EVENT_TABLE() -+}; -+ -+BEGIN_EVENT_TABLE(wxSearchTextCtrl, wxTextCtrl) -+ EVT_TEXT(wxID_ANY, wxSearchTextCtrl::OnText) -+ EVT_TEXT_ENTER(wxID_ANY, wxSearchTextCtrl::OnText) -+ EVT_TEXT_URL(wxID_ANY, wxSearchTextCtrl::OnTextUrl) -+ EVT_TEXT_MAXLEN(wxID_ANY, wxSearchTextCtrl::OnText) -+END_EVENT_TABLE() -+ -+// ---------------------------------------------------------------------------- -+// wxSearchButton: search button used by search control -+// ---------------------------------------------------------------------------- -+ -+class wxSearchButton : public wxControl -+{ -+public: -+ wxSearchButton(wxSearchCtrl *search, int eventType, const wxBitmap& bmp) -+ : wxControl(search, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER), -+ m_search(search), -+ m_eventType(eventType), -+ m_bmp(bmp) -+ { } -+ -+ void SetBitmapLabel(const wxBitmap& label) { m_bmp = label; } -+ -+ -+protected: -+ wxSize DoGetBestSize() const -+ { -+ return wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()); -+ } -+ -+ void OnLeftUp(wxMouseEvent&) -+ { -+ wxCommandEvent event(m_eventType, m_search->GetId()); -+ event.SetEventObject(m_search); -+ -+ GetEventHandler()->ProcessEvent(event); -+ -+ m_search->SetFocus(); -+ -+ if ( m_eventType == wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN ) -+ { -+ // this happens automatically, just like on Mac OS X -+ m_search->PopupSearchMenu(); -+ } -+ } -+ -+ void OnPaint(wxPaintEvent&) -+ { -+ wxPaintDC dc(this); -+ dc.DrawBitmap(m_bmp, 0,0, true); -+ } -+ -+ -+private: -+ wxSearchCtrl *m_search; -+ wxEventType m_eventType; -+ wxBitmap m_bmp; -+ -+ DECLARE_EVENT_TABLE() -+}; -+ -+BEGIN_EVENT_TABLE(wxSearchButton, wxControl) -+ EVT_LEFT_UP(wxSearchButton::OnLeftUp) -+ EVT_PAINT(wxSearchButton::OnPaint) -+END_EVENT_TABLE() -+ -+BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase) -+ EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, wxSearchCtrl::OnSearchButton) -+ EVT_SET_FOCUS(wxSearchCtrl::OnSetFocus) -+ EVT_SIZE(wxSearchCtrl::OnSize) -+END_EVENT_TABLE() -+ -+IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase) -+ -+// ============================================================================ -+// implementation -+// ============================================================================ -+ -+// ---------------------------------------------------------------------------- -+// wxSearchCtrl creation -+// ---------------------------------------------------------------------------- -+ -+// creation -+// -------- -+ -+wxSearchCtrl::wxSearchCtrl() -+{ -+ Init(); -+} -+ -+wxSearchCtrl::wxSearchCtrl(wxWindow *parent, wxWindowID id, -+ const wxString& value, -+ const wxPoint& pos, -+ const wxSize& size, -+ long style, -+ const wxValidator& validator, -+ const wxString& name) -+{ -+ Init(); -+ -+ Create(parent, id, value, pos, size, style, validator, name); -+} -+ -+void wxSearchCtrl::Init() -+{ -+ m_text = 0; -+ m_searchButton = 0; -+ m_cancelButton = 0; -+ m_menu = 0; -+ -+ m_searchButtonVisible = true; -+ m_cancelButtonVisible = false; -+ -+ m_searchMenuBitmapUser = false; -+ m_searchBitmapUser = false; -+ m_cancelBitmapUser = false; -+} -+ -+bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, -+ const wxString& value, -+ const wxPoint& pos, -+ const wxSize& size, -+ long style, -+ const wxValidator& validator, -+ const wxString& name) -+{ -+ if ( !wxTextCtrlBase::Create(parent, id, pos, size, wxSIMPLE_BORDER | style, validator, name) ) -+ { -+ return false; -+ } -+ -+ m_text = new wxSearchTextCtrl(this, value, style & ~wxBORDER_MASK); -+ -+ wxSize sizeText = m_text->GetBestSize(); -+ -+ m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN,m_searchBitmap); -+ m_cancelButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN,m_cancelBitmap); -+ -+ SetForegroundColour( m_text->GetForegroundColour() ); -+ m_searchButton->SetForegroundColour( m_text->GetForegroundColour() ); -+ m_cancelButton->SetForegroundColour( m_text->GetForegroundColour() ); -+ -+ SetBackgroundColour( m_text->GetBackgroundColour() ); -+ m_searchButton->SetBackgroundColour( m_text->GetBackgroundColour() ); -+ m_cancelButton->SetBackgroundColour( m_text->GetBackgroundColour() ); -+ -+ RecalcBitmaps(); -+ -+ SetInitialSize(size); -+ Move(pos); -+ return true; -+} -+ -+wxSearchCtrl::~wxSearchCtrl() -+{ -+ delete m_text; -+ delete m_searchButton; -+ delete m_cancelButton; -+ delete m_menu; -+} -+ -+ -+// search control specific interfaces -+void wxSearchCtrl::SetMenu( wxMenu* menu ) -+{ -+ if ( menu == m_menu ) -+ { -+ // no change -+ return; -+ } -+ bool hadMenu = (m_menu != NULL); -+ delete m_menu; -+ m_menu = menu; -+ -+ if ( m_menu && !hadMenu ) -+ { -+ m_searchButton->SetBitmapLabel(m_searchMenuBitmap); -+ m_searchButton->Refresh(); -+ if ( !m_searchButtonVisible ) -+ { -+ // adding the menu will force the search button to be visible -+ wxRect rect = GetRect(); -+ LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); -+ } -+ } -+ else if ( !m_menu && hadMenu ) -+ { -+ m_searchButton->SetBitmapLabel(m_searchBitmap); -+ if ( m_searchButtonVisible ) -+ { -+ m_searchButton->Refresh(); -+ } -+ else -+ { -+ wxRect rect = GetRect(); -+ LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); -+ } -+ } -+} -+ -+wxMenu* wxSearchCtrl::GetMenu() -+{ -+ return m_menu; -+} -+ -+void wxSearchCtrl::ShowSearchButton( bool show ) -+{ -+ if ( m_searchButtonVisible == show ) -+ { -+ // no change -+ return; -+ } -+ m_searchButtonVisible = show; -+ if ( m_searchButtonVisible ) -+ { -+ RecalcBitmaps(); -+ } -+ -+ wxRect rect = GetRect(); -+ LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); -+} -+ -+bool wxSearchCtrl::IsSearchButtonVisible() const -+{ -+ return m_searchButtonVisible; -+} -+ -+ -+void wxSearchCtrl::ShowCancelButton( bool show ) -+{ -+ if ( m_cancelButtonVisible == show ) -+ { -+ // no change -+ return; -+ } -+ m_cancelButtonVisible = show; -+ -+ wxRect rect = GetRect(); -+ LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); -+} -+ -+bool wxSearchCtrl::IsCancelButtonVisible() const -+{ -+ return m_cancelButtonVisible; -+} -+ -+ -+// ---------------------------------------------------------------------------- -+// geometry -+// ---------------------------------------------------------------------------- -+ -+wxSize wxSearchCtrl::DoGetBestSize() const -+{ -+ wxSize sizeText = m_text->GetBestSize(); -+ wxSize sizeSearch(0,0); -+ wxSize sizeCancel(0,0); -+ int searchMargin = 0; -+ int cancelMargin = 0; -+ if ( m_searchButtonVisible || m_menu ) -+ { -+ sizeSearch = m_searchButton->GetBestSize(); -+ searchMargin = MARGIN; -+ } -+ if ( m_cancelButtonVisible ) -+ { -+ sizeCancel = m_cancelButton->GetBestSize(); -+ cancelMargin = MARGIN; -+ } -+ -+ int horizontalBorder = 1 + ( sizeText.y - sizeText.y * 14 / 21 ) / 2; -+ -+ // buttons are square and equal to the height of the text control -+ int height = sizeText.y; -+ return wxSize(sizeSearch.x + searchMargin + sizeText.x + cancelMargin + sizeCancel.x + 2*horizontalBorder, -+ height + 2*BORDER); -+} -+ -+void wxSearchCtrl::DoMoveWindow(int x, int y, int width, int height) -+{ -+ wxSearchCtrlBase::DoMoveWindow(x, y, width, height); -+ -+ LayoutControls(0, 0, width, height); -+} -+ -+void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) -+{ -+ if ( !m_text ) -+ return; -+ -+ wxSize sizeText = m_text->GetBestSize(); -+ // make room for the search menu & clear button -+ int horizontalBorder = 1 + ( sizeText.y - sizeText.y * 14 / 21 ) / 2; -+ x += horizontalBorder; -+ y += BORDER; -+ width -= horizontalBorder*2; -+ height -= BORDER*2; -+ -+ wxSize sizeSearch(0,0); -+ wxSize sizeCancel(0,0); -+ int searchMargin = 0; -+ int cancelMargin = 0; -+ if ( m_searchButtonVisible || m_menu ) -+ { -+ sizeSearch = m_searchButton->GetBestSize(); -+ searchMargin = MARGIN; -+ } -+ if ( m_cancelButtonVisible ) -+ { -+ sizeCancel = m_cancelButton->GetBestSize(); -+ cancelMargin = MARGIN; -+ } -+ m_searchButton->Show( m_searchButtonVisible || m_menu ); -+ m_cancelButton->Show( m_cancelButtonVisible ); -+ -+ if ( sizeSearch.x + sizeCancel.x > width ) -+ { -+ sizeSearch.x = width/2; -+ sizeCancel.x = width/2; -+ searchMargin = 0; -+ cancelMargin = 0; -+ } -+ wxCoord textWidth = width - sizeSearch.x - sizeCancel.x - searchMargin - cancelMargin; -+ -+ // position the subcontrols inside the client area -+ -+ m_searchButton->SetSize(x, y + ICON_OFFSET, sizeSearch.x, height); -+ m_text->SetSize(x + sizeSearch.x + searchMargin, y + ICON_OFFSET, textWidth, height); -+ m_cancelButton->SetSize(x + sizeSearch.x + searchMargin + textWidth + cancelMargin, -+ y + ICON_OFFSET, sizeCancel.x, height); -+} -+ -+ -+// accessors -+// --------- -+ -+wxString wxSearchCtrl::GetValue() const -+{ -+ return m_text->GetValue(); -+} -+void wxSearchCtrl::SetValue(const wxString& value) -+{ -+ m_text->SetValue(value); -+} -+ -+wxString wxSearchCtrl::GetRange(long from, long to) const -+{ -+ return m_text->GetRange(from, to); -+} -+ -+int wxSearchCtrl::GetLineLength(long lineNo) const -+{ -+ return m_text->GetLineLength(lineNo); -+} -+wxString wxSearchCtrl::GetLineText(long lineNo) const -+{ -+ return m_text->GetLineText(lineNo); -+} -+int wxSearchCtrl::GetNumberOfLines() const -+{ -+ return m_text->GetNumberOfLines(); -+} -+ -+bool wxSearchCtrl::IsModified() const -+{ -+ return m_text->IsModified(); -+} -+bool wxSearchCtrl::IsEditable() const -+{ -+ return m_text->IsEditable(); -+} -+ -+// more readable flag testing methods -+bool wxSearchCtrl::IsSingleLine() const -+{ -+ return m_text->IsSingleLine(); -+} -+bool wxSearchCtrl::IsMultiLine() const -+{ -+ return m_text->IsMultiLine(); -+} -+ -+// If the return values from and to are the same, there is no selection. -+void wxSearchCtrl::GetSelection(long* from, long* to) const -+{ -+ m_text->GetSelection(from, to); -+} -+ -+wxString wxSearchCtrl::GetStringSelection() const -+{ -+ return m_text->GetStringSelection(); -+} -+ -+// operations -+// ---------- -+ -+// editing -+void wxSearchCtrl::Clear() -+{ -+ m_text->Clear(); -+} -+void wxSearchCtrl::Replace(long from, long to, const wxString& value) -+{ -+ m_text->Replace(from, to, value); -+} -+void wxSearchCtrl::Remove(long from, long to) -+{ -+ m_text->Remove(from, to); -+} -+ -+// load/save the controls contents from/to the file -+bool wxSearchCtrl::LoadFile(const wxString& file) -+{ -+ return m_text->LoadFile(file); -+} -+bool wxSearchCtrl::SaveFile(const wxString& file) -+{ -+ return m_text->SaveFile(file); -+} -+ -+// sets/clears the dirty flag -+void wxSearchCtrl::MarkDirty() -+{ -+ m_text->MarkDirty(); -+} -+void wxSearchCtrl::DiscardEdits() -+{ -+ m_text->DiscardEdits(); -+} -+ -+// set the max number of characters which may be entered in a single line -+// text control -+void wxSearchCtrl::SetMaxLength(unsigned long len) -+{ -+ m_text->SetMaxLength(len); -+} -+ -+// writing text inserts it at the current position, appending always -+// inserts it at the end -+void wxSearchCtrl::WriteText(const wxString& text) -+{ -+ m_text->WriteText(text); -+} -+void wxSearchCtrl::AppendText(const wxString& text) -+{ -+ m_text->AppendText(text); -+} -+ -+// insert the character which would have resulted from this key event, -+// return true if anything has been inserted -+bool wxSearchCtrl::EmulateKeyPress(const wxKeyEvent& event) -+{ -+ return m_text->EmulateKeyPress(event); -+} -+ -+// text control under some platforms supports the text styles: these -+// methods allow to apply the given text style to the given selection or to -+// set/get the style which will be used for all appended text -+bool wxSearchCtrl::SetStyle(long start, long end, const wxTextAttr& style) -+{ -+ return m_text->SetStyle(start, end, style); -+} -+bool wxSearchCtrl::GetStyle(long position, wxTextAttr& style) -+{ -+ return m_text->GetStyle(position, style); -+} -+bool wxSearchCtrl::SetDefaultStyle(const wxTextAttr& style) -+{ -+ return m_text->SetDefaultStyle(style); -+} -+const wxTextAttr& wxSearchCtrl::GetDefaultStyle() const -+{ -+ return m_text->GetDefaultStyle(); -+} -+ -+// translate between the position (which is just an index in the text ctrl -+// considering all its contents as a single strings) and (x, y) coordinates -+// which represent column and line. -+long wxSearchCtrl::XYToPosition(long x, long y) const -+{ -+ return m_text->XYToPosition(x, y); -+} -+bool wxSearchCtrl::PositionToXY(long pos, long *x, long *y) const -+{ -+ return m_text->PositionToXY(pos, x, y); -+} -+ -+void wxSearchCtrl::ShowPosition(long pos) -+{ -+ m_text->ShowPosition(pos); -+} -+ -+// find the character at position given in pixels -+// -+// NB: pt is in device coords (not adjusted for the client area origin nor -+// scrolling) -+wxTextCtrlHitTestResult wxSearchCtrl::HitTest(const wxPoint& pt, long *pos) const -+{ -+ return m_text->HitTest(pt, pos); -+} -+wxTextCtrlHitTestResult wxSearchCtrl::HitTest(const wxPoint& pt, -+ wxTextCoord *col, -+ wxTextCoord *row) const -+{ -+ return m_text->HitTest(pt, col, row); -+} -+ -+// Clipboard operations -+void wxSearchCtrl::Copy() -+{ -+ m_text->Copy(); -+} -+void wxSearchCtrl::Cut() -+{ -+ m_text->Cut(); -+} -+void wxSearchCtrl::Paste() -+{ -+ m_text->Paste(); -+} -+ -+bool wxSearchCtrl::CanCopy() const -+{ -+ return m_text->CanCopy(); -+} -+bool wxSearchCtrl::CanCut() const -+{ -+ return m_text->CanCut(); -+} -+bool wxSearchCtrl::CanPaste() const -+{ -+ return m_text->CanPaste(); -+} -+ -+// Undo/redo -+void wxSearchCtrl::Undo() -+{ -+ m_text->Undo(); -+} -+void wxSearchCtrl::Redo() -+{ -+ m_text->Redo(); -+} -+ -+bool wxSearchCtrl::CanUndo() const -+{ -+ return m_text->CanUndo(); -+} -+bool wxSearchCtrl::CanRedo() const -+{ -+ return m_text->CanRedo(); -+} -+ -+// Insertion point -+void wxSearchCtrl::SetInsertionPoint(long pos) -+{ -+ m_text->SetInsertionPoint(pos); -+} -+void wxSearchCtrl::SetInsertionPointEnd() -+{ -+ m_text->SetInsertionPointEnd(); -+} -+long wxSearchCtrl::GetInsertionPoint() const -+{ -+ return m_text->GetInsertionPoint(); -+} -+wxTextPos wxSearchCtrl::GetLastPosition() const -+{ -+ return m_text->GetLastPosition(); -+} -+ -+void wxSearchCtrl::SetSelection(long from, long to) -+{ -+ m_text->SetSelection(from, to); -+} -+void wxSearchCtrl::SelectAll() -+{ -+ m_text->SelectAll(); -+} -+ -+void wxSearchCtrl::SetEditable(bool editable) -+{ -+ m_text->SetEditable(editable); -+} -+ -+bool wxSearchCtrl::SetFont(const wxFont& font) -+{ -+ bool result = wxSearchCtrlBase::SetFont(font); -+ if ( result && m_text ) -+ { -+ result = m_text->SetFont(font); -+ } -+ RecalcBitmaps(); -+ return result; -+} -+ -+// search control generic only -+void wxSearchCtrl::SetSearchBitmap( const wxBitmap& bitmap ) -+{ -+ m_searchBitmap = bitmap; -+ m_searchBitmapUser = bitmap.Ok(); -+ if ( m_searchBitmapUser ) -+ { -+ if ( m_searchButton && !m_menu ) -+ { -+ m_searchButton->SetBitmapLabel( m_searchBitmap ); -+ } -+ } -+ else -+ { -+ // the user bitmap was just cleared, generate one -+ RecalcBitmaps(); -+ } -+} -+ -+void wxSearchCtrl::SetSearchMenuBitmap( const wxBitmap& bitmap ) -+{ -+ m_searchMenuBitmap = bitmap; -+ m_searchMenuBitmapUser = bitmap.Ok(); -+ if ( m_searchMenuBitmapUser ) -+ { -+ if ( m_searchButton && m_menu ) -+ { -+ m_searchButton->SetBitmapLabel( m_searchMenuBitmap ); -+ } -+ } -+ else -+ { -+ // the user bitmap was just cleared, generate one -+ RecalcBitmaps(); -+ } -+} -+ -+void wxSearchCtrl::SetCancelBitmap( const wxBitmap& bitmap ) -+{ -+ m_cancelBitmap = bitmap; -+ m_cancelBitmapUser = bitmap.Ok(); -+ if ( m_cancelBitmapUser ) -+ { -+ if ( m_cancelButton ) -+ { -+ m_cancelButton->SetBitmapLabel( m_cancelBitmap ); -+ } -+ } -+ else -+ { -+ // the user bitmap was just cleared, generate one -+ RecalcBitmaps(); -+ } -+} -+ -+#if 0 -+ -+// override streambuf method -+#if wxHAS_TEXT_WINDOW_STREAM -+int overflow(int i); -+#endif // wxHAS_TEXT_WINDOW_STREAM -+ -+// stream-like insertion operators: these are always available, whether we -+// were, or not, compiled with streambuf support -+wxTextCtrl& operator<<(const wxString& s); -+wxTextCtrl& operator<<(int i); -+wxTextCtrl& operator<<(long i); -+wxTextCtrl& operator<<(float f); -+wxTextCtrl& operator<<(double d); -+wxTextCtrl& operator<<(const wxChar c); -+#endif -+ -+void wxSearchCtrl::DoSetValue(const wxString& value, int flags) -+{ -+ m_text->ChangeValue( value ); -+ if ( flags & SetValue_SendEvent ) -+ SendTextUpdatedEvent(); -+} -+ -+// do the window-specific processing after processing the update event -+void wxSearchCtrl::DoUpdateWindowUI(wxUpdateUIEvent& event) -+{ -+ wxSearchCtrlBase::DoUpdateWindowUI(event); -+} -+ -+bool wxSearchCtrl::ShouldInheritColours() const -+{ -+ return true; -+} -+ -+// icons are rendered at 3-8 times larger than necessary and downscaled for -+// antialiasing -+static int GetMultiplier() -+{ -+#ifdef __WXWINCE__ -+ // speed up bitmap generation by using a small bitmap -+ return 3; -+#else -+ int depth = ::wxDisplayDepth(); -+ -+ if ( depth >= 24 ) -+ { -+ return 8; -+ } -+ return 6; -+#endif -+} -+ -+wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop ) -+{ -+ wxColour bg = GetBackgroundColour(); -+ wxColour fg = GetForegroundColour(); -+ -+ //=============================================================================== -+ // begin drawing code -+ //=============================================================================== -+ // image stats -+ -+ // force width:height ratio -+ if ( 14*x > y*20 ) -+ { -+ // x is too big -+ x = y*20/14; -+ } -+ else -+ { -+ // y is too big -+ y = x*14/20; -+ } -+ -+ // glass 11x11, top left corner -+ // handle (9,9)-(13,13) -+ // drop (13,16)-(19,6)-(16,9) -+ -+ int multiplier = GetMultiplier(); -+ int penWidth = multiplier * 2; -+ -+ penWidth = penWidth * x / 20; -+ -+ wxBitmap bitmap( multiplier*x, multiplier*y ); -+ wxMemoryDC mem; -+ mem.SelectObject(bitmap); -+ -+ // clear background -+ mem.SetBrush( wxBrush(bg) ); -+ mem.SetPen( wxPen(bg) ); -+ mem.DrawRectangle(0,0,bitmap.GetWidth(),bitmap.GetHeight()); -+ -+ // draw drop glass -+ mem.SetBrush( wxBrush(fg) ); -+ mem.SetPen( wxPen(fg) ); -+ int glassBase = 5 * x / 20; -+ int glassFactor = 2*glassBase + 1; -+ int radius = multiplier*glassFactor/2; -+ mem.DrawCircle(radius,radius,radius); -+ mem.SetBrush( wxBrush(bg) ); -+ mem.SetPen( wxPen(bg) ); -+ mem.DrawCircle(radius,radius,radius-penWidth); -+ -+ // draw handle -+ int lineStart = radius + (radius-penWidth/2) * 707 / 1000; // 707 / 1000 = 0.707 = 1/sqrt(2); -+ -+ mem.SetPen( wxPen(fg) ); -+ mem.SetBrush( wxBrush(fg) ); -+ int handleCornerShift = penWidth * 707 / 1000 / 2; // 707 / 1000 = 0.707 = 1/sqrt(2); -+ handleCornerShift = WXMAX( handleCornerShift, 1 ); -+ int handleBase = 4 * x / 20; -+ int handleLength = 2*handleBase+1; -+ wxPoint handlePolygon[] = -+ { -+ wxPoint(-handleCornerShift,+handleCornerShift), -+ wxPoint(+handleCornerShift,-handleCornerShift), -+ wxPoint(multiplier*handleLength/2+handleCornerShift,multiplier*handleLength/2-handleCornerShift), -+ wxPoint(multiplier*handleLength/2-handleCornerShift,multiplier*handleLength/2+handleCornerShift), -+ }; -+ mem.DrawPolygon(WXSIZEOF(handlePolygon),handlePolygon,lineStart,lineStart); -+ -+ // draw drop triangle -+ int triangleX = 13 * x / 20; -+ int triangleY = 5 * x / 20; -+ int triangleBase = 3 * x / 20; -+ int triangleFactor = triangleBase*2+1; -+ if ( renderDrop ) -+ { -+ wxPoint dropPolygon[] = -+ { -+ wxPoint(multiplier*0,multiplier*0), // triangle left -+ wxPoint(multiplier*triangleFactor-1,multiplier*0), // triangle right -+ wxPoint(multiplier*triangleFactor/2,multiplier*triangleFactor/2), // triangle bottom -+ }; -+ mem.DrawPolygon(WXSIZEOF(dropPolygon),dropPolygon,multiplier*triangleX,multiplier*triangleY); -+ } -+ -+ //=============================================================================== -+ // end drawing code -+ //=============================================================================== -+ -+ if ( multiplier != 1 ) -+ { -+ wxImage image = bitmap.ConvertToImage(); -+ image.Rescale(x,y); -+ bitmap = wxBitmap( image ); -+ } -+ -+ return bitmap; -+} -+ -+wxBitmap wxSearchCtrl::RenderCancelBitmap( int x, int y ) -+{ -+ wxColour bg = GetBackgroundColour(); -+ wxColour fg = GetForegroundColour(); -+ -+ //=============================================================================== -+ // begin drawing code -+ //=============================================================================== -+ // image stats -+ -+ // total size 14x14 -+ // force 1:1 ratio -+ if ( x > y ) -+ { -+ // x is too big -+ x = y; -+ } -+ else -+ { -+ // y is too big -+ y = x; -+ } -+ -+ // 14x14 circle -+ // cross line starts (4,4)-(10,10) -+ // drop (13,16)-(19,6)-(16,9) -+ -+ int multiplier = GetMultiplier(); -+ -+ int penWidth = multiplier * x / 14; -+ -+ wxBitmap bitmap( multiplier*x, multiplier*y ); -+ wxMemoryDC mem; -+ mem.SelectObject(bitmap); -+ -+ // clear background -+ mem.SetBrush( wxBrush(bg) ); -+ mem.SetPen( wxPen(bg) ); -+ mem.DrawRectangle(0,0,bitmap.GetWidth(),bitmap.GetHeight()); -+ -+ // draw drop glass -+ mem.SetBrush( wxBrush(fg) ); -+ mem.SetPen( wxPen(fg) ); -+ int radius = multiplier*x/2; -+ mem.DrawCircle(radius,radius,radius); -+ -+ // draw cross -+ int lineStartBase = 4 * x / 14; -+ int lineLength = x - 2*lineStartBase; -+ -+ mem.SetPen( wxPen(bg) ); -+ mem.SetBrush( wxBrush(bg) ); -+ int handleCornerShift = penWidth/2; -+ handleCornerShift = WXMAX( handleCornerShift, 1 ); -+ wxPoint handlePolygon[] = -+ { -+ wxPoint(-handleCornerShift,+handleCornerShift), -+ wxPoint(+handleCornerShift,-handleCornerShift), -+ wxPoint(multiplier*lineLength+handleCornerShift,multiplier*lineLength-handleCornerShift), -+ wxPoint(multiplier*lineLength-handleCornerShift,multiplier*lineLength+handleCornerShift), -+ }; -+ mem.DrawPolygon(WXSIZEOF(handlePolygon),handlePolygon,multiplier*lineStartBase,multiplier*lineStartBase); -+ wxPoint handlePolygon2[] = -+ { -+ wxPoint(+handleCornerShift,+handleCornerShift), -+ wxPoint(-handleCornerShift,-handleCornerShift), -+ wxPoint(multiplier*lineLength-handleCornerShift,-multiplier*lineLength-handleCornerShift), -+ wxPoint(multiplier*lineLength+handleCornerShift,-multiplier*lineLength+handleCornerShift), -+ }; -+ mem.DrawPolygon(WXSIZEOF(handlePolygon2),handlePolygon2,multiplier*lineStartBase,multiplier*(x-lineStartBase)); -+ -+ //=============================================================================== -+ // end drawing code -+ //=============================================================================== -+ -+ if ( multiplier != 1 ) -+ { -+ wxImage image = bitmap.ConvertToImage(); -+ image.Rescale(x,y); -+ bitmap = wxBitmap( image ); -+ } -+ -+ return bitmap; -+} -+ -+void wxSearchCtrl::RecalcBitmaps() -+{ -+ if ( !m_text ) -+ { -+ return; -+ } -+ wxSize sizeText = m_text->GetBestSize(); -+ -+ int bitmapHeight = sizeText.y - 2 * ICON_MARGIN; -+ int bitmapWidth = sizeText.y * 20 / 14; -+ -+ if ( !m_searchBitmapUser ) -+ { -+ if ( -+ !m_searchBitmap.Ok() || -+ m_searchBitmap.GetHeight() != bitmapHeight || -+ m_searchBitmap.GetWidth() != bitmapWidth -+ ) -+ { -+ m_searchBitmap = RenderSearchBitmap(bitmapWidth,bitmapHeight,false); -+ if ( !m_menu ) -+ { -+ m_searchButton->SetBitmapLabel(m_searchBitmap); -+ } -+ } -+ // else this bitmap was set by user, don't alter -+ } -+ -+ if ( !m_searchMenuBitmapUser ) -+ { -+ if ( -+ !m_searchMenuBitmap.Ok() || -+ m_searchMenuBitmap.GetHeight() != bitmapHeight || -+ m_searchMenuBitmap.GetWidth() != bitmapWidth -+ ) -+ { -+ m_searchMenuBitmap = RenderSearchBitmap(bitmapWidth,bitmapHeight,true); -+ if ( m_menu ) -+ { -+ m_searchButton->SetBitmapLabel(m_searchMenuBitmap); -+ } -+ } -+ // else this bitmap was set by user, don't alter -+ } -+ -+ if ( !m_cancelBitmapUser ) -+ { -+ if ( -+ !m_cancelBitmap.Ok() || -+ m_cancelBitmap.GetHeight() != bitmapHeight || -+ m_cancelBitmap.GetWidth() != bitmapHeight -+ ) -+ { -+ m_cancelBitmap = RenderCancelBitmap(bitmapHeight-BORDER,bitmapHeight-BORDER); // square -+ m_cancelButton->SetBitmapLabel(m_cancelBitmap); -+ } -+ // else this bitmap was set by user, don't alter -+ } -+} -+ -+void wxSearchCtrl::OnSearchButton( wxCommandEvent& event ) -+{ -+ event.Skip(); -+} -+ -+void wxSearchCtrl::OnSetFocus( wxFocusEvent& /*event*/ ) -+{ -+ if ( m_text ) -+ { -+ m_text->SetFocus(); -+ } -+} -+ -+void wxSearchCtrl::OnSize( wxSizeEvent& event ) -+{ -+ int width, height; -+ GetSize(&width, &height); -+ LayoutControls(0, 0, width, height); -+} -+ -+void wxSearchCtrl::PopupSearchMenu() -+{ -+ if ( m_menu ) -+ { -+ wxSize size = GetSize(); -+ PopupMenu( m_menu, 0, size.y ); -+ } -+} -+ -+#endif // !wxUSE_NATIVE_SEARCH_CONTROL -+ -+#endif // wxUSE_SEARCHCTRL -Index: wxWidgets/src/html/htmlfilter.cpp -=================================================================== -RCS file: htmlfilter.cpp -diff -N htmlfilter.cpp ---- /dev/null Thu Dec 14 21:47:46 2006 -+++ wxWidgets/src/html/htmlfilter.cpp Thu Dec 14 21:47:50 2006 -@@ -0,0 +1,172 @@ -+///////////////////////////////////////////////////////////////////////////// -+// Name: filter.cpp -+// Purpose: wxHtmlFilter - input filter for translating into HTML format -+// Author: Vaclav Slavik -+// Copyright: (c) 1999 Vaclav Slavik -+// Licence: wxWindows Licence -+///////////////////////////////////////////////////////////////////////////// -+ -+ -+#ifdef __GNUG__ -+#pragma implementation "htmlfilter.h" -+#endif -+ -+#include "wx/wxprec.h" -+ -+#if wxUSE_HTML -+ -+#ifdef __BORDLANDC__ -+#pragma hdrstop -+#endif -+ -+#ifndef WXPRECOMP -+#endif -+ -+#include "wx/html/htmlfilter.h" -+#include "wx/html/htmlwin.h" -+ -+ -+/* -+ -+There is code for several default filters: -+ -+*/ -+ -+IMPLEMENT_ABSTRACT_CLASS(wxHtmlFilter, wxObject) -+ -+//-------------------------------------------------------------------------------- -+// wxHtmlFilterPlainText -+// filter for text/plain or uknown -+//-------------------------------------------------------------------------------- -+ -+IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterPlainText, wxHtmlFilter) -+ -+bool wxHtmlFilterPlainText::CanRead(const wxFSFile& WXUNUSED(file)) const -+{ -+ return TRUE; -+} -+ -+ -+ -+wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file) const -+{ -+ wxInputStream *s = file.GetStream(); -+ char *src; -+ wxString doc, doc2; -+ -+ if (s == NULL) return wxEmptyString; -+ src = new char[s -> GetSize()+1]; -+ src[s -> GetSize()] = 0; -+ s -> Read(src, s -> GetSize()); -+ doc = src; -+ delete [] src; -+ -+ doc.Replace(_T("<"), _T("<"), TRUE); -+ doc.Replace(_T(">"), _T(">"), TRUE); -+ doc2 = _T("
\n") + doc + _T("\n
"); -+ return doc2; -+} -+ -+ -+ -+ -+ -+//-------------------------------------------------------------------------------- -+// wxHtmlFilterImage -+// filter for image/* -+//-------------------------------------------------------------------------------- -+ -+class wxHtmlFilterImage : public wxHtmlFilter -+{ -+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterImage) -+ -+ public: -+ virtual bool CanRead(const wxFSFile& file) const; -+ virtual wxString ReadFile(const wxFSFile& file) const; -+}; -+ -+IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterImage, wxHtmlFilter) -+ -+ -+ -+bool wxHtmlFilterImage::CanRead(const wxFSFile& file) const -+{ -+ return (file.GetMimeType().Left(6) == "image/"); -+} -+ -+ -+ -+wxString wxHtmlFilterImage::ReadFile(const wxFSFile& file) const -+{ -+ return (""); -+} -+ -+ -+ -+ -+//-------------------------------------------------------------------------------- -+// wxHtmlFilterPlainText -+// filter for text/plain or uknown -+//-------------------------------------------------------------------------------- -+ -+class wxHtmlFilterHTML : public wxHtmlFilter -+{ -+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterHTML) -+ -+ public: -+ virtual bool CanRead(const wxFSFile& file) const; -+ virtual wxString ReadFile(const wxFSFile& file) const; -+}; -+ -+ -+IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterHTML, wxHtmlFilter) -+ -+bool wxHtmlFilterHTML::CanRead(const wxFSFile& file) const -+{ -+// return (file.GetMimeType() == "text/html"); -+// This is true in most case but some page can return: -+// "text/html; char-encoding=...." -+// So we use Find instead -+ return (file.GetMimeType().Find(_T("text/html")) == 0); -+} -+ -+ -+ -+wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const -+{ -+ wxInputStream *s = file.GetStream(); -+ char *src; -+ wxString doc; -+ -+ if (s == NULL) return wxEmptyString; -+ src = new char[s -> GetSize() + 1]; -+ src[s -> GetSize()] = 0; -+ s -> Read(src, s -> GetSize()); -+ doc = src; -+ delete[] src; -+ -+ return doc; -+} -+ -+ -+ -+ -+///// Module: -+ -+class wxHtmlFilterModule : public wxModule -+{ -+ DECLARE_DYNAMIC_CLASS(wxHtmlFilterModule) -+ -+ public: -+ virtual bool OnInit() -+ { -+ wxHtmlWindow::AddFilter(new wxHtmlFilterHTML); -+ wxHtmlWindow::AddFilter(new wxHtmlFilterImage); -+ return TRUE; -+ } -+ virtual void OnExit() {} -+}; -+ -+IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterModule, wxModule) -+ -+#endif -Index: wxWidgets/src/html/htmlhelp.cpp -=================================================================== -RCS file: htmlhelp.cpp -diff -N htmlhelp.cpp ---- /dev/null Thu Dec 14 21:47:46 2006 -+++ wxWidgets/src/html/htmlhelp.cpp Thu Dec 14 21:47:50 2006 -@@ -0,0 +1,839 @@ -+// Name: htmlhelp.cpp -+// Purpose: Help controller -+// Author: Vaclav Slavik -+// Copyright: (c) 1999 Vaclav Slavik -+// Licence: wxWindows Licence -+///////////////////////////////////////////////////////////////////////////// -+ -+#error This file should not be compiled! Update your build system! \ -+(configure users, rerun configure to get a new Makefile) \ -+Instead of htmlhelp[_io], use helpdata, helpfrm and helpctrl. This \ -+file is only left to point out the problem and will be removed r.s.n. -+ -+#ifdef __GNUG__ -+#pragma implementation "htmlhelp.h" -+#endif -+ -+#include "wx/wxprec.h" -+ -+#if wxUSE_HTML -+ -+#ifdef __BORDLANDC__ -+#pragma hdrstop -+#endif -+ -+#ifndef WXPRECOMP -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#if !((wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7))) -+#include -+#endif -+ -+ -+// Bitmaps: -+ -+#ifndef __WXMSW__ -+ // XPM hack: make the arrays const -+ #define static static const -+ -+ #include "bitmaps/panel.xpm" -+ #include "bitmaps/back.xpm" -+ #include "bitmaps/forward.xpm" -+ #include "bitmaps/book.xpm" -+ #include "bitmaps/folder.xpm" -+ #include "bitmaps/page.xpm" -+ -+ #undef static -+#endif -+ -+#include "search.h" -+ -+ -+ -+ -+#include -+WX_DEFINE_OBJARRAY(HtmlBookRecArray) -+ -+ -+ -+ -+ -+ -+ -+ -+ -+//----------------------------------------------------------------------------- -+// wxHtmlHelpController -+//----------------------------------------------------------------------------- -+ -+ -+IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpController, wxEvtHandler) -+ -+ -+wxHtmlHelpController::wxHtmlHelpController() : wxEvtHandler() -+{ -+ m_Frame = NULL; -+ m_Config = NULL; -+ m_ConfigRoot = wxEmptyString; -+ m_TitleFormat = _("Help : %s"); -+ m_TempPath = wxEmptyString; -+ -+ m_Cfg.x = m_Cfg.y = 0; -+ m_Cfg.w = 700; m_Cfg.h = 480; -+ m_Cfg.sashpos = 240; -+ m_Cfg.navig_on = TRUE; -+ -+ m_ContentsImageList = new wxImageList(12, 12); -+ m_ContentsImageList -> Add(wxICON(book)); -+ m_ContentsImageList -> Add(wxICON(folder)); -+ m_ContentsImageList -> Add(wxICON(page)); -+ -+ m_Contents = NULL; -+ m_ContentsCnt = 0; -+ m_Index = NULL; -+ m_IndexCnt = 0; -+ -+ m_IndexBox = NULL; -+ m_ContentsBox = NULL; -+ m_SearchList = NULL; -+ m_SearchText = NULL; -+ m_SearchButton = NULL; -+ m_HtmlWin = NULL; -+ m_Splitter = NULL; -+ m_NavigPan = NULL; -+} -+ -+ -+ -+wxHtmlHelpController::~wxHtmlHelpController() -+{ -+ int i; -+ -+ m_BookRecords.Empty(); -+ delete m_ContentsImageList; -+ if (m_Contents) { -+ for (i = 0; i < m_ContentsCnt; i++) { -+ delete[] m_Contents[i].m_Page; -+ delete[] m_Contents[i].m_Name; -+ } -+ free(m_Contents); -+ } -+ if (m_Index) { -+ for (i = 0; i < m_IndexCnt; i++) { -+ delete[] m_Index[i].m_Page; -+ delete[] m_Index[i].m_Name; -+ } -+ free(m_Index); -+ } -+} -+ -+ -+ -+void wxHtmlHelpController::SetTempDir(const wxString& path) -+{ -+ if (path == wxEmptyString) m_TempPath = path; -+ else { -+ if (wxIsAbsolutePath(path)) m_TempPath = path; -+ else m_TempPath = wxGetCwd() + "/" + path; -+ -+ if (m_TempPath[m_TempPath.Length() - 1] != '/') -+ m_TempPath << "/"; -+ } -+} -+ -+ -+ -+ -+// Reads one line, stores it into buf and returns pointer to new line or NULL. -+static char* ReadLine(char *line, char *buf) -+{ -+ char *writeptr = buf, *readptr = line; -+ -+ while (*readptr != 0 && *readptr != '\r' && *readptr != '\n') *(writeptr++) = *(readptr++); -+ *writeptr = 0; -+ while (*readptr == '\r' || *readptr == '\n') readptr++; -+ if (*readptr == 0) return NULL; -+ else return readptr; -+} -+ -+ -+static wxString SafeFileName(const wxString& s) -+{ -+ wxString res = s; -+ res.Replace(_T(":"), _T("_"), TRUE); -+ res.Replace(_T(" "), _T("_"), TRUE); -+ res.Replace(_T("/"), _T("_"), TRUE); -+ res.Replace(_T("\\"), _T("_"), TRUE); -+ res.Replace(_T("#"), _T("_"), TRUE); -+ res.Replace(_T("."), _T("_"), TRUE); -+ return res; -+} -+ -+ -+static int IndexCompareFunc(const void *a, const void *b) -+{ -+ return strcmp(((HtmlContentsItem*)a) -> m_Name, ((HtmlContentsItem*)b) -> m_Name); -+} -+ -+ -+ -+bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) -+{ -+ wxFSFile *fi; -+ wxFileSystem fsys; -+ wxInputStream *s; -+ HtmlBookRecord *bookr; -+ wxString bookFull; -+ -+ int sz; -+ char *buff, *lineptr; -+ char linebuf[300]; -+ -+ wxString title = _("noname"), -+ safetitle, -+ start = wxEmptyString, -+ contents = wxEmptyString, index = wxEmptyString; -+ -+ if (wxIsAbsolutePath(book)) bookFull = book; -+ else bookFull = wxGetCwd() + "/" + book; -+ -+ fi = fsys.OpenFile(bookFull); -+ if (fi == NULL) return FALSE; -+ fsys.ChangePathTo(bookFull); -+ s = fi -> GetStream(); -+ sz = s -> GetSize(); -+ buff = new char[sz+1]; -+ buff[sz] = 0; -+ s -> Read(buff, sz); -+ lineptr = buff; -+ delete fi; -+ -+ while ((lineptr = ReadLine(lineptr, linebuf)) != NULL) { -+ if (strstr(linebuf, "Title=") == linebuf) -+ title = linebuf + strlen("Title="); -+ if (strstr(linebuf, "Default topic=") == linebuf) -+ start = linebuf + strlen("Default topic="); -+ if (strstr(linebuf, "Index file=") == linebuf) -+ index = linebuf + strlen("Index file="); -+ if (strstr(linebuf, "Contents file=") == linebuf) -+ contents = linebuf + strlen("Contents file="); -+ } -+ delete[] buff; -+ -+ bookr = new HtmlBookRecord(fsys.GetPath(), title, start); -+ -+ if (m_ContentsCnt % HTML_REALLOC_STEP == 0) -+ m_Contents = (HtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + HTML_REALLOC_STEP) * sizeof(HtmlContentsItem)); -+ m_Contents[m_ContentsCnt].m_Level = 0; -+ m_Contents[m_ContentsCnt].m_ID = 0; -+ m_Contents[m_ContentsCnt].m_Page = new char[start.Length() + 1]; -+ strcpy(m_Contents[m_ContentsCnt].m_Page, start.c_str()); -+ m_Contents[m_ContentsCnt].m_Name = new char [title.Length() + 1]; -+ strcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str()); -+ m_Contents[m_ContentsCnt].m_Book = bookr; -+ m_ContentsCnt++; -+ -+ // Try to find cached binary versions: -+ safetitle = SafeFileName(title); -+ fi = fsys.OpenFile(safetitle + ".cached"); -+ if (fi == NULL) fi = fsys.OpenFile(m_TempPath + safetitle + ".cached"); -+ if ((fi == NULL) || (m_TempPath == wxEmptyString)) { -+ LoadMSProject(bookr, fsys, index, contents, show_wait_msg); -+ if (m_TempPath != wxEmptyString) { -+ wxFileOutputStream *outs = new wxFileOutputStream(m_TempPath + safetitle + ".cached"); -+ SaveCachedBook(bookr, outs); -+ delete outs; -+ } -+ } -+ else { -+ LoadCachedBook(bookr, fi -> GetStream()); -+ delete fi; -+ } -+ -+ m_BookRecords.Add(bookr); -+ if (m_IndexCnt > 0) -+ qsort(m_Index, m_IndexCnt, sizeof(HtmlContentsItem), IndexCompareFunc); -+ -+ return TRUE; -+} -+ -+ -+ -+ -+void wxHtmlHelpController::Display(const wxString& x) -+{ -+ int cnt; -+ int i; -+ wxFileSystem fsys; -+ wxFSFile *f; -+ -+ CreateHelpWindow(); -+ -+ /* 1. try to open given file: */ -+ -+ cnt = m_BookRecords.GetCount(); -+ for (i = 0; i < cnt; i++) { -+ f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x); -+ if (f) { -+ m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + x); -+ delete f; -+ return; -+ } -+ } -+ -+ -+ /* 2. try to find a book: */ -+ -+ for (i = 0; i < cnt; i++) { -+ if (m_BookRecords[i].GetTitle() == x) { -+ m_HtmlWin -> LoadPage(m_BookRecords[i].GetBasePath() + m_BookRecords[i].GetStart()); -+ return; -+ } -+ } -+ -+ /* 3. try to find in contents: */ -+ -+ cnt = m_ContentsCnt; -+ for (i = 0; i < cnt; i++) { -+ if (strcmp(m_Contents[i].m_Name, x) == 0) { -+ m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page); -+ return; -+ } -+ } -+ -+ -+ /* 4. try to find in index: */ -+ -+ cnt = m_IndexCnt; -+ for (i = 0; i < cnt; i++) { -+ if (strcmp(m_Index[i].m_Name, x) == 0) { -+ m_HtmlWin -> LoadPage(m_Index[i].m_Book -> GetBasePath() + m_Index[i].m_Page); -+ return; -+ } -+ } -+ -+ -+ /* 5. if everything failed, search the documents: */ -+ -+ KeywordSearch(x); -+} -+ -+ -+ -+void wxHtmlHelpController::Display(const int id) -+{ -+ CreateHelpWindow(); -+ -+ for (int i = 0; i < m_ContentsCnt; i++) { -+ if (m_Contents[i].m_ID == id) { -+ m_HtmlWin -> LoadPage(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page); -+ return; -+ } -+ } -+} -+ -+ -+ -+void wxHtmlHelpController::DisplayContents() -+{ -+ CreateHelpWindow(); -+ m_Frame -> Raise(); -+ if (!m_Splitter -> IsSplit()) { -+ m_NavigPan -> Show(TRUE); -+ m_HtmlWin -> Show(TRUE); -+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); -+ } -+ m_NavigPan -> SetSelection(0); -+} -+ -+ -+ -+void wxHtmlHelpController::DisplayIndex() -+{ -+ CreateHelpWindow(); -+ m_Frame -> Raise(); -+ if (!m_Splitter -> IsSplit()) { -+ m_NavigPan -> Show(TRUE); -+ m_HtmlWin -> Show(TRUE); -+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); -+ } -+ m_NavigPan -> SetSelection(1); -+} -+ -+ -+ -+ -+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) -+ -+class MyProgressDlg : public wxDialog -+{ -+ public: -+ bool m_Canceled; -+ -+ MyProgressDlg(wxWindow *parent) : wxDialog(parent, -1, -+ _("Searching..."), -+ wxPoint(0, 0), -+#ifdef __WXGTK__ -+ wxSize(300, 110) -+#else -+ wxSize(300, 130) -+#endif -+ ) -+ {m_Canceled = FALSE;} -+ void OnCancel(wxCommandEvent& event) {m_Canceled = TRUE;} -+ DECLARE_EVENT_TABLE() -+}; -+BEGIN_EVENT_TABLE(MyProgressDlg, wxDialog) -+ EVT_BUTTON(wxID_CANCEL, MyProgressDlg::OnCancel) -+END_EVENT_TABLE() -+ -+#endif -+ -+ -+bool wxHtmlHelpController::KeywordSearch(const wxString& keyword) -+{ -+ int foundcnt = 0; -+ CreateHelpWindow(); -+ // if these are not set, we can't continue -+ if (! (m_SearchList && m_HtmlWin)) -+ return FALSE; -+ m_Frame -> Raise(); -+ if (m_Splitter && m_NavigPan && m_SearchButton) { -+ if (!m_Splitter -> IsSplit()) { -+ m_NavigPan -> Show(TRUE); -+ m_HtmlWin -> Show(TRUE); -+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); -+ } -+ m_NavigPan -> SetSelection(2); -+ m_SearchList -> Clear(); -+ m_SearchText -> SetValue(keyword); -+ m_SearchButton -> Enable(FALSE); -+ } -+ { -+ int cnt = m_ContentsCnt; -+ wxSearchEngine engine; -+ wxFileSystem fsys; -+ wxFSFile *file; -+ wxString lastpage = wxEmptyString; -+ wxString foundstr; -+ -+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) -+ MyProgressDlg progress(m_Frame); -+ -+ wxStaticText *prompt = new wxStaticText(&progress, -1, "", wxPoint(20, 50), wxSize(260, 25), wxALIGN_CENTER); -+ wxGauge *gauge = new wxGauge(&progress, -1, cnt, wxPoint(20, 20), wxSize(260, 25)); -+ wxButton *btn = new wxButton(&progress, wxID_CANCEL, _("Cancel"), wxPoint(110, 70), wxSize(80, 25)); -+ btn = btn; /* fool compiler :-) */ -+ prompt -> SetLabel(_("No matching page found yet")); -+ -+ progress.Centre(wxBOTH); -+ progress.Show(TRUE); -+#else -+ wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), cnt, m_Frame, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE); -+#endif -+ -+ engine.LookFor(keyword); -+ -+ for (int i = 0; i < cnt; i++) { -+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) -+ gauge -> SetValue(i); -+ if (progress.m_Canceled) break; -+#else -+ if (progress.Update(i) == FALSE) break; -+#endif -+ wxYield(); -+ -+ file = fsys.OpenFile(m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page); -+ if (file) { -+ if (lastpage != file -> GetLocation()) { -+ lastpage = file -> GetLocation(); -+ if (engine.Scan(file -> GetStream())) { -+ foundstr.Printf(_("Found %i matches"), ++foundcnt); -+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) -+ prompt -> SetLabel(foundstr); -+#else -+ progress.Update(i, foundstr); -+#endif -+ wxYield(); -+ m_SearchList -> Append(m_Contents[i].m_Name, (char*)(m_Contents + i)); -+ } -+ } -+ delete file; -+ } -+ } -+ -+#if (wxVERSION_NUMBER < 2100) || ((wxVERSION_NUMBER == 2100) && (wxBETA_NUMBER < 7)) -+ progress.Close(TRUE); -+#endif -+ } -+ if (m_SearchButton) -+ m_SearchButton -> Enable(TRUE); -+ if (m_SearchText) { -+ m_SearchText -> SetSelection(0, keyword.Length()); -+ m_SearchText -> SetFocus(); -+ } -+ if (foundcnt) { -+ HtmlContentsItem *it = (HtmlContentsItem*) m_SearchList -> GetClientData(0); -+ if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); -+ } -+ return (foundcnt > 0); -+} -+ -+ -+ -+ -+ -+ -+void wxHtmlHelpController::CreateHelpWindow() -+{ -+ wxBusyCursor cur; -+ wxString oldpath; -+ wxStatusBar *sbar; -+ -+ if (m_Frame) { -+ m_Frame -> Raise(); -+ m_Frame -> Show(TRUE); -+ return; -+ } -+ -+#if wxUSE_BUSYINFO -+ wxBusyInfo busyinfo(_("Preparing help window...")); -+#endif -+ -+ if (m_Config) ReadCustomization(m_Config, m_ConfigRoot); -+ -+ m_Frame = new wxFrame(NULL, -1, "", wxPoint(m_Cfg.x, m_Cfg.y), wxSize(m_Cfg.w, m_Cfg.h)); -+ m_Frame -> PushEventHandler(this); -+ sbar = m_Frame -> CreateStatusBar(); -+ -+ { -+ wxToolBar *toolBar; -+ toolBar = m_Frame -> CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE); -+ toolBar -> SetMargins(2, 2); -+ wxBitmap* toolBarBitmaps[3]; -+ -+#ifdef __WXMSW__ -+ toolBarBitmaps[0] = new wxBitmap("panel"); -+ toolBarBitmaps[1] = new wxBitmap("back"); -+ toolBarBitmaps[2] = new wxBitmap("forward"); -+ int width = 24; -+#else -+ toolBarBitmaps[0] = new wxBitmap(panel_xpm); -+ toolBarBitmaps[1] = new wxBitmap(back_xpm); -+ toolBarBitmaps[2] = new wxBitmap(forward_xpm); -+ int width = 16; -+#endif -+ -+ int currentX = 5; -+ -+ toolBar -> AddTool(wxID_HTML_PANEL, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Show/hide navigation panel")); -+ currentX += width + 5; -+ toolBar -> AddSeparator(); -+ toolBar -> AddTool(wxID_HTML_BACK, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Go back to the previous HTML page")); -+ currentX += width + 5; -+ toolBar -> AddTool(wxID_HTML_FORWARD, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _("Go forward to the next HTML page")); -+ currentX += width + 5; -+ -+ toolBar -> Realize(); -+ -+ // Can delete the bitmaps since they're reference counted -+ for (int i = 0; i < 3; i++) delete toolBarBitmaps[i]; -+ } -+ -+ -+ { -+ m_Splitter = new wxSplitterWindow(m_Frame); -+ -+ m_HtmlWin = new wxHtmlWindow(m_Splitter); -+ m_HtmlWin -> SetRelatedFrame(m_Frame, m_TitleFormat); -+ m_HtmlWin -> SetRelatedStatusBar(0); -+ if (m_Config) m_HtmlWin -> ReadCustomization(m_Config, m_ConfigRoot); -+ -+ m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK, wxDefaultPosition, wxDefaultSize); -+ { -+ m_ContentsBox = new wxTreeCtrl(m_NavigPan, wxID_HTML_TREECTRL, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxSUNKEN_BORDER); -+ m_ContentsBox -> SetImageList(m_ContentsImageList); -+ m_NavigPan -> AddPage(m_ContentsBox, _("Contents")); -+ } -+ -+ { -+ wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE); -+ wxLayoutConstraints *b1 = new wxLayoutConstraints; -+ b1 -> top.SameAs (dummy, wxTop, 0); -+ b1 -> left.SameAs (dummy, wxLeft, 0); -+ b1 -> width.PercentOf (dummy, wxWidth, 100); -+ b1 -> bottom.SameAs (dummy, wxBottom, 0); -+ m_IndexBox = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0); -+ m_IndexBox -> SetConstraints(b1); -+ dummy -> SetAutoLayout(TRUE); -+ m_NavigPan -> AddPage(dummy, _("Index")); -+ } -+ -+ { -+ wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE); -+ -+ wxLayoutConstraints *b1 = new wxLayoutConstraints; -+ m_SearchText = new wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT); -+ b1 -> top.SameAs (dummy, wxTop, 0); -+ b1 -> left.SameAs (dummy, wxLeft, 0); -+ b1 -> right.SameAs (dummy, wxRight, 0); -+ b1 -> height.AsIs(); -+ m_SearchText -> SetConstraints(b1); -+ -+ wxLayoutConstraints *b2 = new wxLayoutConstraints; -+ m_SearchButton = new wxButton(dummy, wxID_HTML_SEARCHBUTTON, _("Search!")); -+ b2 -> top.Below (m_SearchText, 10); -+ b2 -> right.SameAs (dummy, wxRight, 10); -+ b2 -> width.AsIs(); -+ b2 -> height.AsIs(); -+ m_SearchButton -> SetConstraints(b2); -+ -+ wxLayoutConstraints *b3 = new wxLayoutConstraints; -+ m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0); -+ b3 -> top.Below (m_SearchButton, 10); -+ b3 -> left.SameAs (dummy, wxLeft, 0); -+ b3 -> right.SameAs (dummy, wxRight, 0); -+ b3 -> bottom.SameAs (dummy, wxBottom, 0); -+ m_SearchList -> SetConstraints(b3); -+ -+ dummy -> SetAutoLayout(TRUE); -+ dummy -> Layout(); -+ m_NavigPan -> AddPage(dummy, _("Search")); -+ } -+ -+ RefreshLists(); -+ m_NavigPan -> Show(TRUE); -+ m_HtmlWin -> Show(TRUE); -+ m_Splitter -> SetMinimumPaneSize(20); -+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); -+ if (!m_Cfg.navig_on) m_Splitter -> Unsplit(m_NavigPan); -+ wxYield(); -+ } -+ -+ m_Frame -> Show(TRUE); -+ wxYield(); -+} -+ -+ -+ -+#define MAX_ROOTS 64 -+ -+void wxHtmlHelpController::CreateContents() -+{ -+ HtmlContentsItem *it; -+ wxTreeItemId roots[MAX_ROOTS]; -+ bool imaged[MAX_ROOTS]; -+ int count = m_ContentsCnt; -+ -+ m_ContentsBox -> DeleteAllItems(); -+ roots[0] = m_ContentsBox -> AddRoot(_("(Help)")); -+ imaged[0] = TRUE; -+ -+ for (int i = 0; i < count; i++) { -+ it = m_Contents + i; -+ roots[it -> m_Level + 1] = m_ContentsBox -> AppendItem(roots[it -> m_Level], it -> m_Name, IMG_Page, -1, new wxHtmlHelpTreeItemData(it)); -+ if (it -> m_Level == 0) { -+ m_ContentsBox -> SetItemBold(roots[1], TRUE); -+ m_ContentsBox -> SetItemImage(roots[1], IMG_Book); -+ m_ContentsBox -> SetItemSelectedImage(roots[1], IMG_Book); -+ imaged[1] = TRUE; -+ } -+ else imaged[it -> m_Level + 1] = FALSE; -+ -+ if (!imaged[it -> m_Level]) { -+ m_ContentsBox -> SetItemImage(roots[it -> m_Level], IMG_Folder); -+ m_ContentsBox -> SetItemSelectedImage(roots[it -> m_Level], IMG_Folder); -+ imaged[it -> m_Level] = TRUE; -+ } -+ } -+ -+ m_ContentsBox -> Expand(roots[0]); -+} -+ -+ -+ -+ -+void wxHtmlHelpController::CreateIndex() -+{ -+ m_IndexBox -> Clear(); -+ -+ for (int i = 0; i < m_IndexCnt; i++) -+ m_IndexBox -> Append(m_Index[i].m_Name, (char*)(m_Index + i)); -+} -+ -+ -+ -+void wxHtmlHelpController::RefreshLists() -+{ -+ if (m_Frame) { -+ CreateContents(); -+ CreateIndex(); -+ m_SearchList -> Clear(); -+ } -+} -+ -+ -+ -+ -+ -+ -+ -+void wxHtmlHelpController::ReadCustomization(wxConfigBase *cfg, wxString path) -+{ -+ wxString oldpath; -+ wxString tmp; -+ -+ if (path != wxEmptyString) { -+ oldpath = cfg -> GetPath(); -+ cfg -> SetPath(path); -+ } -+ -+ m_Cfg.navig_on = cfg -> Read("hcNavigPanel", m_Cfg.navig_on) != 0; -+ m_Cfg.sashpos = cfg -> Read("hcSashPos", m_Cfg.sashpos); -+ m_Cfg.x = cfg -> Read("hcX", m_Cfg.x); -+ m_Cfg.y = cfg -> Read("hcY", m_Cfg.y); -+ m_Cfg.w = cfg -> Read("hcW", m_Cfg.w); -+ m_Cfg.h = cfg -> Read("hcH", m_Cfg.h); -+ -+ if (path != wxEmptyString) -+ cfg -> SetPath(oldpath); -+} -+ -+ -+ -+void wxHtmlHelpController::WriteCustomization(wxConfigBase *cfg, wxString path) -+{ -+ wxString oldpath; -+ wxString tmp; -+ -+ if (path != wxEmptyString) { -+ oldpath = cfg -> GetPath(); -+ cfg -> SetPath(path); -+ } -+ -+ cfg -> Write("hcNavigPanel", m_Cfg.navig_on); -+ cfg -> Write("hcSashPos", (long)m_Cfg.sashpos); -+ cfg -> Write("hcX", (long)m_Cfg.x); -+ cfg -> Write("hcY", (long)m_Cfg.y); -+ cfg -> Write("hcW", (long)m_Cfg.w); -+ cfg -> Write("hcH", (long)m_Cfg.h); -+ -+ if (path != wxEmptyString) -+ cfg -> SetPath(oldpath); -+} -+ -+ -+ -+ -+ -+/* -+EVENT HANDLING : -+*/ -+ -+ -+void wxHtmlHelpController::OnToolbar(wxCommandEvent& event) -+{ -+ switch (event.GetId()) { -+ case wxID_HTML_BACK : -+ m_HtmlWin -> HistoryBack(); -+ break; -+ case wxID_HTML_FORWARD : -+ m_HtmlWin -> HistoryForward(); -+ break; -+ case wxID_HTML_PANEL : -+ if (m_Splitter -> IsSplit()) { -+ m_Cfg.sashpos = m_Splitter -> GetSashPosition(); -+ m_Splitter -> Unsplit(m_NavigPan); -+ } -+ else { -+ m_NavigPan -> Show(TRUE); -+ m_HtmlWin -> Show(TRUE); -+ m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); -+ } -+ break; -+ } -+} -+ -+ -+ -+void wxHtmlHelpController::OnContentsSel(wxTreeEvent& event) -+{ -+ wxHtmlHelpTreeItemData *pg; -+ -+ pg = (wxHtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem()); -+ if (pg) m_HtmlWin -> LoadPage(pg -> GetPage()); -+} -+ -+ -+ -+void wxHtmlHelpController::OnIndexSel(wxCommandEvent& event) -+{ -+ HtmlContentsItem *it = (HtmlContentsItem*) m_IndexBox -> GetClientData(m_IndexBox -> GetSelection()); -+ if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); -+} -+ -+ -+ -+void wxHtmlHelpController::OnSearchSel(wxCommandEvent& event) -+{ -+ HtmlContentsItem *it = (HtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection()); -+ if (it) m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); -+} -+ -+ -+ -+void wxHtmlHelpController::OnCloseWindow(wxCloseEvent& event) -+{ -+ int a, b; -+ -+ m_Cfg.navig_on = m_Splitter -> IsSplit(); -+ if (m_Cfg.navig_on) -+ m_Cfg.sashpos = m_Splitter -> GetSashPosition(); -+ m_Frame -> GetPosition(&a, &b); -+ m_Cfg.x = a, m_Cfg.y = b; -+ m_Frame -> GetSize(&a, &b); -+ m_Cfg.w = a, m_Cfg.h = b; -+ -+ if (m_Config) { -+ WriteCustomization(m_Config, m_ConfigRoot); -+ m_HtmlWin -> WriteCustomization(m_Config, m_ConfigRoot); -+ } -+ m_Frame = NULL; -+ -+ event.Skip(); -+} -+ -+ -+ -+void wxHtmlHelpController::OnSearch(wxCommandEvent& event) -+{ -+ wxString sr = m_SearchText -> GetLineText(0); -+ -+ if (sr != wxEmptyString) KeywordSearch(sr); -+} -+ -+ -+ -+BEGIN_EVENT_TABLE(wxHtmlHelpController, wxEvtHandler) -+ EVT_TOOL_RANGE(wxID_HTML_PANEL, wxID_HTML_FORWARD, wxHtmlHelpController::OnToolbar) -+ EVT_TREE_SEL_CHANGED(wxID_HTML_TREECTRL, wxHtmlHelpController::OnContentsSel) -+ EVT_LISTBOX(wxID_HTML_INDEXLIST, wxHtmlHelpController::OnIndexSel) -+ EVT_LISTBOX(wxID_HTML_SEARCHLIST, wxHtmlHelpController::OnSearchSel) -+ EVT_CLOSE(wxHtmlHelpController::OnCloseWindow) -+ EVT_BUTTON(wxID_HTML_SEARCHBUTTON, wxHtmlHelpController::OnSearch) -+ EVT_TEXT_ENTER(wxID_HTML_SEARCHTEXT, wxHtmlHelpController::OnSearch) -+END_EVENT_TABLE() -+ -+ -+ -+#endif -+ -Index: wxWidgets/src/html/search.cpp -=================================================================== -RCS file: search.cpp -diff -N search.cpp ---- /dev/null Thu Dec 14 21:47:46 2006 -+++ wxWidgets/src/html/search.cpp Thu Dec 14 21:47:51 2006 -@@ -0,0 +1,72 @@ -+///////////////////////////////////////////////////////////////////////////// -+// Name: search.cpp -+// Purpose: search engine -+// Author: Vaclav Slavik -+// RCS-ID: $Id: search.cpp,v 1.9 2001/07/05 18:48:48 VZ Exp $ -+// Copyright: (c) 1999 Vaclav Slavik -+// Licence: wxWindows Licence -+///////////////////////////////////////////////////////////////////////////// -+ -+ -+ -+#ifdef __GNUG__ -+#pragma implementation -+#endif -+ -+#include "wx/wxprec.h" -+ -+#include "wx/defs.h" -+#if wxUSE_HTML -+ -+#ifdef __BORDLANDC__ -+#pragma hdrstop -+#endif -+ -+#ifndef WXPRECOMP -+#endif -+ -+#include "wx/html/helpdata.h" -+ -+ -+//-------------------------------------------------------------------------------- -+// wxSearchEngine -+//-------------------------------------------------------------------------------- -+ -+void wxSearchEngine::LookFor(const wxString& keyword) -+{ -+ if (m_Keyword) delete[] m_Keyword; -+ m_Keyword = new wxChar[keyword.Length() + 1]; -+ wxStrcpy(m_Keyword, keyword.c_str()); -+ for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--) -+ if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z'))) -+ m_Keyword[i] += wxT('a') - wxT('A'); -+} -+ -+ -+ -+bool wxSearchEngine::Scan(wxInputStream *stream) -+{ -+ wxASSERT_MSG(m_Keyword != NULL, _("wxSearchEngine::LookFor must be called before scanning!")); -+ -+ int i, j; -+ int lng = stream ->GetSize(); -+ int wrd = wxStrlen(m_Keyword); -+ bool found = FALSE; -+ char *buf = new char[lng + 1]; -+ stream -> Read(buf, lng); -+ buf[lng] = 0; -+ -+ for (i = 0; i < lng; i++) -+ if ((buf[i] >= 'A') && (buf[i] <= 'Z')) buf[i] += 'a' - 'A'; -+ -+ for (i = 0; i < lng - wrd; i++) { -+ j = 0; -+ while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++; -+ if (j == wrd) {found = TRUE; break;} -+ } -+ -+ delete[] buf; -+ return found; -+} -+ -+#endif -Index: wxWidgets/src/unix/net.cpp -=================================================================== -RCS file: net.cpp -diff -N net.cpp ---- /dev/null Thu Dec 14 21:48:09 2006 -+++ wxWidgets/src/unix/net.cpp Thu Dec 14 21:48:13 2006 -@@ -0,0 +1,422 @@ -+// -*- c++ -*- /////////////////////////////////////////////////////////////// -+// Name: unix/net.cpp -+// Purpose: Network related wxWindows classes and functions -+// Author: Karsten Ball�der -+// Modified by: -+// Created: 03.10.99 -+// RCS-ID: $Id: net.cpp,v 1.3 1999/10/03 17:26:45 KB Exp $ -+// Copyright: (c) Karsten Ball�der -+// Licence: wxWindows licence -+///////////////////////////////////////////////////////////////////////////// -+ -+#include "wx/setup.h" -+ -+#if wxUSE_DIALUP_MANAGER -+ -+#ifndef WX_PRECOMP -+# include "wx/defs.h" -+#endif // !PCH -+ -+#include "wx/string.h" -+#include "wx/event.h" -+#include "wx/net.h" -+#include "wx/timer.h" -+#include "wx/filefn.h" -+#include "wx/utils.h" -+#include "wx/log.h" -+#include "wx/file.h" -+ -+#include -+#include -+#include -+#include -+#define __STRICT_ANSI__ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+// ---------------------------------------------------------------------------- -+// A class which groups functions dealing with connecting to the network from a -+// workstation using dial-up access to the net. There is at most one instance -+// of this class in the program accessed via GetDialUpManager(). -+// ---------------------------------------------------------------------------- -+ -+/* TODO -+ * -+ * 1. more configurability for Unix: i.e. how to initiate the connection, how -+ * to check for online status, &c. -+ * 2. add a "long Dial(long connectionId = -1)" function which asks the user -+ * about which connection to dial (this may be done using native dialogs -+ * under NT, need generic dialogs for all others) and returns the identifier -+ * of the selected connection (it's opaque to the application) - it may be -+ * reused later to dial the same connection later (or use strings instead of -+ * longs may be?) -+ * 3. add an async version of dialing functions which notify the caller about -+ * the progress (or may be even start another thread to monitor it) -+ * 4. the static creation/accessor functions are not MT-safe - but is this -+ * really crucial? I think we may suppose they're always called from the -+ * main thread? -+ */ -+ -+class WXDLLEXPORT wxDialUpManagerImpl : public wxDialUpManager -+{ -+public: -+ wxDialUpManagerImpl() -+ { -+ m_IsOnline = -1; // unknown -+ m_timer = NULL; -+ m_CanUseIfconfig = -1; // unknown -+ m_BeaconHost = WXDIALUP_MANAGER_DEFAULT_BEACONHOST; -+ m_BeaconPort = 80; -+ } -+ -+ /** Could the dialup manager be initialized correctly? If this function -+ returns FALSE, no other functions will work neither, so it's a good idea -+ to call this function and check its result before calling any other -+ wxDialUpManager methods. -+ */ -+ virtual bool IsOk() const -+ { return TRUE; } -+ -+ /** The simplest way to initiate a dial up: this function dials the given -+ ISP (exact meaning of the parameter depends on the platform), returns -+ TRUE on success or FALSE on failure and logs the appropriate error -+ message in the latter case. -+ @param nameOfISP optional paramater for dial program -+ @param username unused -+ @param password unused -+ */ -+ virtual bool Dial(const wxString& nameOfISP, -+ const wxString& WXUNUSED(username), -+ const wxString& WXUNUSED(password)); -+ -+ /// Hang up the currently active dial up connection. -+ virtual bool HangUp(); -+ -+ // returns TRUE if the computer is connected to the network: under Windows, -+ // this just means that a RAS connection exists, under Unix we check that -+ // the "well-known host" (as specified by SetWellKnownHost) is reachable -+ virtual bool IsOnline() const -+ { -+ if( (! m_timer) // we are not polling, so test now: -+ || m_IsOnline == -1 -+ ) -+ CheckStatus(); -+ return m_IsOnline != 0; -+ } -+ -+ // sometimes the built-in logic for determining the online status may fail, -+ // so, in general, the user should be allowed to override it. This function -+ // allows to forcefully set the online status - whatever our internal -+ // algorithm may think about it. -+ virtual void SetOnlineStatus(bool isOnline = TRUE) -+ { m_IsOnline = isOnline; } -+ -+ // set misc wxDialUpManager options -+ // -------------------------------- -+ -+ // enable automatical checks for the connection status and sending of -+ // wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval -+ // parameter is only for Unix where we do the check manually: under -+ // Windows, the notification about the change of connection status is -+ // instantenous. -+ // -+ // Returns FALSE if couldn't set up automatic check for online status. -+ virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds); -+ -+ // disable automatic check for connection status change - notice that the -+ // wxEVT_DIALUP_XXX events won't be sent any more neither. -+ virtual void DisableAutoCheckOnlineStatus(); -+ -+ // under Unix, the value of well-known host is used to check whether we're -+ // connected to the internet. It's unused under Windows, but this function -+ // is always safe to call. The default value is www.yahoo.com. -+ virtual void SetWellKnownHost(const wxString& hostname, -+ int portno = 80); -+ /** Sets the commands to start up the network and to hang up -+ again. Used by the Unix implementations only. -+ */ -+ virtual void SetConnectCommand(const wxString &command, const wxString &hupcmd) -+ { m_ConnectCommand = command; m_HangUpCommand = hupcmd; } -+ -+private: -+ /// -1: don�t know, 0 = no, 1 = yes -+ int m_IsOnline; -+ -+ /// Can we use ifconfig to list active devices? -+ int m_CanUseIfconfig; -+ /// The path to ifconfig -+ wxString m_IfconfigPath; -+ -+ /// beacon host: -+ wxString m_BeaconHost; -+ /// beacon host portnumber for connect: -+ int m_BeaconPort; -+ -+ /// command to connect to network -+ wxString m_ConnectCommand; -+ /// command to hang up -+ wxString m_HangUpCommand; -+ /// name of ISP -+ wxString m_ISPname; -+ /// a timer for regular testing -+ class AutoCheckTimer *m_timer; -+ -+ friend class AutoCheckTimer; -+ /// determine status -+ void CheckStatus(void) const; -+ -+ /// real status check -+ void CheckStatusInternal(void); -+}; -+ -+ -+class AutoCheckTimer : public wxTimer -+{ -+public: -+ AutoCheckTimer(wxDialUpManagerImpl *dupman) -+ { -+ m_dupman = dupman; -+ m_started = FALSE; -+ } -+ -+ virtual bool Start( int millisecs = -1 ) -+ { m_started = TRUE; return wxTimer::Start(millisecs, FALSE); } -+ -+ virtual void Notify() -+ { wxLogTrace("Checking dial up network status."); m_dupman->CheckStatus(); } -+ -+ virtual void Stop() -+ { if ( m_started ) wxTimer::Stop(); } -+public: -+ bool m_started; -+ wxDialUpManagerImpl *m_dupman; -+}; -+ -+bool -+wxDialUpManagerImpl::Dial(const wxString &isp, -+ const wxString & WXUNUSED(username), -+ const wxString & WXUNUSED(password)) -+{ -+ if(m_IsOnline == 1) -+ return FALSE; -+ m_IsOnline = -1; -+ m_ISPname = isp; -+ wxString cmd; -+ if(m_ConnectCommand.Find("%s")) -+ cmd.Printf(m_ConnectCommand,m_ISPname.c_str()); -+ else -+ cmd = m_ConnectCommand; -+ return wxExecute(cmd, /* sync */ TRUE) == 0; -+} -+ -+bool -+wxDialUpManagerImpl::HangUp(void) -+{ -+ if(m_IsOnline == 0) -+ return FALSE; -+ m_IsOnline = -1; -+ wxString cmd; -+ if(m_HangUpCommand.Find("%s")) -+ cmd.Printf(m_HangUpCommand,m_ISPname.c_str()); -+ else -+ cmd = m_HangUpCommand; -+ return wxExecute(cmd, /* sync */ TRUE) == 0; -+} -+ -+ -+bool -+wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds) -+{ -+ wxASSERT(m_timer == NULL); -+ m_timer = new AutoCheckTimer(this); -+ bool rc = m_timer->Start(nSeconds*1000); -+ if(! rc) -+ { -+ delete m_timer; -+ m_timer = NULL; -+ } -+ return rc; -+} -+ -+void -+wxDialUpManagerImpl::DisableAutoCheckOnlineStatus() -+{ -+ wxASSERT(m_timer != NULL); -+ m_timer->Stop(); -+ delete m_timer; -+ m_timer = NULL; -+} -+ -+ -+void -+wxDialUpManagerImpl::SetWellKnownHost(const wxString& hostname, int portno) -+{ -+ /// does hostname contain a port number? -+ wxString port = hostname.After(':'); -+ if(port.Length()) -+ { -+ m_BeaconHost = hostname.Before(':'); -+ m_BeaconPort = atoi(port); -+ } -+ else -+ { -+ m_BeaconHost = hostname; -+ m_BeaconPort = portno; -+ } -+} -+ -+ -+void -+wxDialUpManagerImpl::CheckStatus(void) const -+{ -+ // This function calls the CheckStatusInternal() helper function -+ // which is OS - specific and then sends the events. -+ -+ int oldIsOnline = m_IsOnline; -+ ( /* non-const */ (wxDialUpManagerImpl *)this)->CheckStatusInternal(); -+ -+ // now send the events as appropriate: -+ if(m_IsOnline != oldIsOnline) -+ { -+ if(m_IsOnline) -+ ; // send ev -+ else -+ ; // send ev -+ } -+} -+ -+/* -+ We have three methods that we can use: -+ -+ 1. test via /sbin/ifconfig and grep for "sl", "ppp", "pl" -+ --> should be fast enough for regular polling -+ 2. test if we can reach the well known beacon host -+ --> too slow for polling -+ 3. check /proc/net/dev on linux?? -+ This method should be preferred, if possible. Need to do more -+ testing. -+ -+*/ -+ -+void -+wxDialUpManagerImpl::CheckStatusInternal(void) -+{ -+ m_IsOnline = -1; -+ -+ // First time check for ifconfig location. We only use the variant -+ // which does not take arguments, a la GNU. -+ if(m_CanUseIfconfig == -1) // unknown -+ { -+ if(wxFileExists("/sbin/ifconfig")) -+ m_IfconfigPath = "/sbin/ifconfig"; -+ else if(wxFileExists("/usr/sbin/ifconfig")) -+ m_IfconfigPath = "/usr/sbin/ifconfig"; -+ } -+ -+ wxLogNull ln; // suppress all error messages -+ // Let�s try the ifconfig method first, should be fastest: -+ if(m_CanUseIfconfig != 0) // unknown or yes -+ { -+ wxASSERT(m_IfconfigPath.length()); -+ -+ wxString tmpfile = wxGetTempFileName("_wxdialuptest"); -+ wxString cmd = "/bin/sh -c \'"; -+ cmd << m_IfconfigPath << " >" << tmpfile << '\''; -+ /* I tried to add an option to wxExecute() to not close stdout, -+ so we could let ifconfig write directly to the tmpfile, but -+ this does not work. That should be faster, as it doesn�t call -+ the shell first. I have no idea why. :-( (KB) */ -+#if 0 -+ // temporarily redirect stdout/stderr: -+ int -+ new_stdout = dup(STDOUT_FILENO), -+ new_stderr = dup(STDERR_FILENO); -+ close(STDOUT_FILENO); -+ close(STDERR_FILENO); -+ -+ int -+ // new stdout: -+ output_fd = open(tmpfile, O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR), -+ // new stderr: -+ null_fd = open("/dev/null", O_CREAT, S_IRUSR|S_IWUSR); -+ // verify well behaved unix behaviour: -+ wxASSERT(output_fd == STDOUT_FILENO); -+ wxASSERT(null_fd == STDERR_FILENO); -+ int rc = wxExecute(m_IfconfigPath,TRUE /* sync */,NULL ,wxEXECUTE_DONT_CLOSE_FDS); -+ close(null_fd); close(output_fd); -+ // restore old stdout, stderr: -+ int test; -+ test = dup(new_stdout); close(new_stdout); wxASSERT(test == STDOUT_FILENO); -+ test = dup(new_stderr); close(new_stderr); wxASSERT(test == STDERR_FILENO); -+ if(rc == 0) -+#endif -+ if(wxExecute(cmd,TRUE /* sync */) == 0) -+ { -+ m_CanUseIfconfig = 1; -+ wxFile file; -+ if( file.Open(tmpfile) ) -+ { -+ char *output = new char [file.Length()+1]; -+ output[file.Length()] = '\0'; -+ if(file.Read(output,file.Length()) == file.Length()) -+ { -+ if(strstr(output,"ppp") // ppp -+ || strstr(output,"sl") // slip -+ || strstr(output,"pl") // plip -+ ) -+ m_IsOnline = 1; -+ else -+ m_IsOnline = 0; -+ } -+ file.Close(); -+ delete [] output; -+ } -+ // else m_IsOnline remains -1 as we don't know for sure -+ } -+ else // could not run ifconfig correctly -+ m_CanUseIfconfig = 0; // don�t try again -+ (void) wxRemoveFile(tmpfile); -+ if(m_IsOnline != -1) // we are done -+ return; -+ } -+ -+ // second method: try to connect to well known host: -+ // This can be used under Win 9x, too! -+ struct hostent *hp; -+ struct sockaddr_in serv_addr; -+ int sockfd; -+ -+ m_IsOnline = 0; // assume false -+ if((hp = gethostbyname(m_BeaconHost)) == NULL) -+ return; // no DNS no net -+ -+ serv_addr.sin_family = hp->h_addrtype; -+ memcpy(&serv_addr.sin_addr,hp->h_addr, hp->h_length); -+ serv_addr.sin_port = htons(m_BeaconPort); -+ if( ( sockfd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) -+ { -+ // sys_error("cannot create socket for gw"); -+ return; -+ } -+ if( connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) -+ { -+ //sys_error("cannot connect to server"); -+ return; -+ } -+ //connected! -+ close(sockfd); -+} -+ -+ -+/* static */ -+wxDialUpManager * -+wxDialUpManager::wxDialUpManager::Create(void) -+{ -+ return new wxDialUpManagerImpl; -+} -+ -+#endif // wxUSE_DIALUP_MANAGER -Index: wxWidgets/utils/wxprop/src/prop.cpp -=================================================================== -RCS file: prop.cpp -diff -N prop.cpp ---- /dev/null Thu Dec 14 21:48:56 2006 -+++ wxWidgets/utils/wxprop/src/prop.cpp Thu Dec 14 21:48:57 2006 -@@ -0,0 +1,1119 @@ -+///////////////////////////////////////////////////////////////////////////// -+// Name: prop.cpp -+// Purpose: Propert sheet classes implementation -+// Author: Julian Smart -+// Modified by: -+// Created: 04/01/98 -+// RCS-ID: $Id: prop.cpp,v 1.11 1999/06/28 21:39:49 VZ Exp $ -+// Copyright: (c) Julian Smart -+// Licence: wxWindows license -+///////////////////////////////////////////////////////////////////////////// -+ -+#ifdef __GNUG__ -+#pragma implementation "prop.h" -+#endif -+ -+// For compilers that support precompilation, includes "wx/wx.h". -+#include "wx/wxprec.h" -+ -+#ifdef __BORLANDC__ -+#pragma hdrstop -+#endif -+ -+#ifndef WX_PRECOMP -+#include "wx/wx.h" -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#if wxUSE_IOSTREAMH -+#if defined(__WXMSW__) && !defined(__GNUWIN32__) -+#include -+#else -+#include -+#endif -+#else -+#include -+#endif -+ -+#include "wx/window.h" -+#include "wx/utils.h" -+#include "wx/list.h" -+#include "prop.h" -+ -+IMPLEMENT_DYNAMIC_CLASS(wxPropertyValue, wxObject) -+ -+wxPropertyValue::wxPropertyValue(void) -+{ -+ m_type = wxPropertyValueNull; -+ m_next = NULL; -+ m_last = NULL; -+ m_value.first = NULL; -+ m_clientData = NULL; -+ m_modifiedFlag = FALSE; -+} -+ -+wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom) -+{ -+ m_modifiedFlag = FALSE; -+ Copy((wxPropertyValue& )copyFrom); -+} -+ -+wxPropertyValue::wxPropertyValue(const char *val) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueString; -+ -+ m_value.string = copystring(val); -+ m_clientData = NULL; -+ m_next = NULL; -+ m_last = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(const wxString& val) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueString; -+ -+ m_value.string = copystring((const char *)val); -+ m_clientData = NULL; -+ m_next = NULL; -+ m_last = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(long the_integer) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueInteger; -+ m_value.integer = the_integer; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(bool val) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValuebool; -+ m_value.integer = val; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(float the_real) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueReal; -+ m_value.real = the_real; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(double the_real) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueReal; -+ m_value.real = (float)the_real; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+// Pointer versions: we have a pointer to the real C++ value. -+wxPropertyValue::wxPropertyValue(char **val) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueStringPtr; -+ -+ m_value.stringPtr = val; -+ m_clientData = NULL; -+ m_next = NULL; -+ m_last = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(long *val) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueIntegerPtr; -+ m_value.integerPtr = val; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(bool *val) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueboolPtr; -+ m_value.boolPtr = val; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(float *val) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueRealPtr; -+ m_value.realPtr = val; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+wxPropertyValue::wxPropertyValue(wxList *the_list) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueList; -+ m_clientData = NULL; -+ m_last = NULL; -+ m_value.first = NULL; -+ -+ wxNode *node = the_list->First(); -+ while (node) -+ { -+ wxPropertyValue *expr = (wxPropertyValue *)node->Data(); -+ Append(expr); -+ node = node->Next(); -+ } -+ -+ delete the_list; -+} -+ -+wxPropertyValue::wxPropertyValue(wxStringList *the_list) -+{ -+ m_modifiedFlag = FALSE; -+ m_type = wxPropertyValueList; -+ m_clientData = NULL; -+ m_last = NULL; -+ m_value.first = NULL; -+ -+ wxNode *node = the_list->First(); -+ while (node) -+ { -+ char *s = (char *)node->Data(); -+ Append(new wxPropertyValue(s)); -+ node = node->Next(); -+ } -+ delete the_list; -+} -+ -+wxPropertyValue::~wxPropertyValue(void) -+{ -+ switch (m_type) -+ { -+ case wxPropertyValueInteger: -+ case wxPropertyValuebool: -+ case wxPropertyValueReal: -+ { -+ break; -+ } -+ case wxPropertyValueString: -+ { -+ delete[] m_value.string; -+ break; -+ } -+ case wxPropertyValueList: -+ { -+ wxPropertyValue *expr = m_value.first; -+ while (expr) -+ { -+ wxPropertyValue *expr1 = expr->m_next; -+ -+ delete expr; -+ expr = expr1; -+ } -+ break; -+ } -+ default: -+ case wxPropertyValueNull: break; -+ } -+} -+ -+void wxPropertyValue::Append(wxPropertyValue *expr) -+{ -+ m_modifiedFlag = TRUE; -+ if (!m_value.first) -+ m_value.first = expr; -+ -+ if (m_last) -+ m_last->m_next = expr; -+ m_last = expr; -+} -+ -+void wxPropertyValue::Insert(wxPropertyValue *expr) -+{ -+ m_modifiedFlag = TRUE; -+ expr->m_next = m_value.first; -+ m_value.first = expr; -+ -+ if (!m_last) -+ m_last = expr; -+} -+ -+// Delete from list -+void wxPropertyValue::Delete(wxPropertyValue *node) -+{ -+ wxPropertyValue *expr = GetFirst(); -+ -+ wxPropertyValue *previous = NULL; -+ while (expr && (expr != node)) -+ { -+ previous = expr; -+ expr = expr->GetNext(); -+ } -+ -+ if (expr) -+ { -+ if (previous) -+ previous->m_next = expr->m_next; -+ -+ // If node was the first in the list, -+ // make the list point to the NEXT one. -+ if (GetFirst() == expr) -+ { -+ m_value.first = expr->m_next; -+ } -+ -+ // If node was the last in the list, -+ // make the list 'last' pointer point to the PREVIOUS one. -+ if (GetLast() == expr) -+ { -+ if (previous) -+ m_last = previous; -+ else -+ m_last = NULL; -+ } -+ m_modifiedFlag = TRUE; -+ delete expr; -+ } -+ -+} -+ -+void wxPropertyValue::ClearList(void) -+{ -+ wxPropertyValue *val = GetFirst(); -+ if (val) -+ m_modifiedFlag = TRUE; -+ -+ while (val) -+ { -+ wxPropertyValue *next = val->GetNext(); -+ delete val; -+ val = next; -+ } -+ m_value.first = NULL; -+ m_last = NULL; -+} -+ -+wxPropertyValue *wxPropertyValue::NewCopy(void) const -+{ -+ switch (m_type) -+ { -+ case wxPropertyValueInteger: -+ return new wxPropertyValue(m_value.integer); -+ case wxPropertyValuebool: -+ return new wxPropertyValue((bool) (m_value.integer != 0)); -+ case wxPropertyValueReal: -+ return new wxPropertyValue(m_value.real); -+ case wxPropertyValueString: -+ return new wxPropertyValue(m_value.string); -+ case wxPropertyValueList: -+ { -+ wxPropertyValue *expr = m_value.first; -+ wxPropertyValue *new_list = new wxPropertyValue; -+ new_list->SetType(wxPropertyValueList); -+ while (expr) -+ { -+ wxPropertyValue *expr2 = expr->NewCopy(); -+ new_list->Append(expr2); -+ expr = expr->m_next; -+ } -+ return new_list; -+ } -+ case wxPropertyValueIntegerPtr: -+ return new wxPropertyValue(m_value.integerPtr); -+ case wxPropertyValueRealPtr: -+ return new wxPropertyValue(m_value.realPtr); -+ case wxPropertyValueboolPtr: -+ return new wxPropertyValue(m_value.boolPtr); -+ case wxPropertyValueStringPtr: -+ return new wxPropertyValue(m_value.stringPtr); -+ -+ case wxPropertyValueNull: -+#ifdef __X__ -+ cerr << "Should never get here!\n"; -+#endif -+ break; -+ } -+ return NULL; -+} -+ -+void wxPropertyValue::Copy(wxPropertyValue& copyFrom) -+{ -+ m_type = copyFrom.Type(); -+ -+ switch (m_type) -+ { -+ case wxPropertyValueInteger: -+ (*this) = copyFrom.IntegerValue(); -+ return ; -+ -+ case wxPropertyValueReal: -+ (*this) = copyFrom.RealValue(); -+ return ; -+ -+ case wxPropertyValueString: -+ (*this) = wxString(copyFrom.StringValue()); -+ return ; -+ -+ case wxPropertyValuebool: -+ (*this) = copyFrom.BoolValue(); -+ return ; -+ -+ // Pointers -+ case wxPropertyValueboolPtr: -+ (*this) = copyFrom.BoolValuePtr(); -+ return ; -+ case wxPropertyValueRealPtr: -+ (*this) = copyFrom.RealValuePtr(); -+ return ; -+ case wxPropertyValueIntegerPtr: -+ (*this) = copyFrom.IntegerValuePtr(); -+ return ; -+ case wxPropertyValueStringPtr: -+ { -+ char** s = copyFrom.StringValuePtr(); -+ (*this) = s != 0; -+ return ; -+ } -+ -+ case wxPropertyValueList: -+ { -+ m_value.first = NULL; -+ m_next = NULL; -+ m_last = NULL; -+ wxPropertyValue *expr = copyFrom.m_value.first; -+ while (expr) -+ { -+ wxPropertyValue *expr2 = expr->NewCopy(); -+ Append(expr2); -+ expr = expr->m_next; -+ } -+ return; -+ } -+ case wxPropertyValueNull: -+#ifdef __X__ -+ cerr << "Should never get here!\n"; -+#endif -+ break; -+ } -+} -+ -+// Return nth argument of a clause (starting from 1) -+wxPropertyValue *wxPropertyValue::Arg(wxPropertyValueType type, int arg) const -+{ -+ wxPropertyValue *expr = m_value.first; -+ for (int i = 1; i < arg; i++) -+ if (expr) -+ expr = expr->m_next; -+ -+ if (expr && (expr->m_type == type)) -+ return expr; -+ else -+ return NULL; -+} -+ -+// Return nth argument of a list expression (starting from zero) -+wxPropertyValue *wxPropertyValue::Nth(int arg) const -+{ -+ if (m_type != wxPropertyValueList) -+ return NULL; -+ -+ wxPropertyValue *expr = m_value.first; -+ for (int i = 0; i < arg; i++) -+ if (expr) -+ expr = expr->m_next; -+ else return NULL; -+ -+ if (expr) -+ return expr; -+ else -+ return NULL; -+} -+ -+ // Returns the number of elements in a list expression -+int wxPropertyValue::Number(void) const -+{ -+ if (m_type != wxPropertyValueList) -+ return 0; -+ -+ int i = 0; -+ wxPropertyValue *expr = m_value.first; -+ while (expr) -+ { -+ expr = expr->m_next; -+ i ++; -+ } -+ return i; -+} -+ -+void wxPropertyValue::WritePropertyClause(ostream& stream) // Write this expression as a top-level clause -+{ -+ if (m_type != wxPropertyValueList) -+ return; -+ -+ wxPropertyValue *node = m_value.first; -+ if (node) -+ { -+ node->WritePropertyType(stream); -+ stream << "("; -+ node = node->m_next; -+ bool first = TRUE; -+ while (node) -+ { -+ if (!first) -+ stream << " "; -+ node->WritePropertyType(stream); -+ node = node->m_next; -+ if (node) stream << ",\n"; -+ first = FALSE; -+ } -+ stream << ").\n\n"; -+ } -+} -+ -+void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any other subexpression -+{ -+ switch (m_type) -+ { -+ case wxPropertyValueInteger: -+ { -+ stream << m_value.integer; -+ break; -+ } -+ case wxPropertyValueIntegerPtr: -+ { -+ stream << *m_value.integerPtr; -+ break; -+ } -+ case wxPropertyValuebool: -+ { -+ if (m_value.integer) -+ stream << "True"; -+ else -+ stream << "False"; -+ break; -+ } -+ case wxPropertyValueboolPtr: -+ { -+ if (*m_value.integerPtr) -+ stream << "True"; -+ else -+ stream << "False"; -+ break; -+ } -+ case wxPropertyValueReal: -+ { -+ float f = m_value.real; -+ sprintf(wxBuffer, "%.6g", (double)f); -+ stream << wxBuffer; -+ break; -+ } -+ case wxPropertyValueRealPtr: -+ { -+ float f = *m_value.realPtr; -+/* Now the parser can cope with this. -+ // Prevent printing in 'e' notation. Any better way? -+ if (fabs(f) < 0.00001) -+ f = 0.0; -+*/ -+ sprintf(wxBuffer, "%.6g", f); -+ stream << wxBuffer; -+ break; -+ } -+ case wxPropertyValueString: -+ { -+// stream << "\""; -+ int i; -+ int len = strlen(m_value.string); -+ for (i = 0; i < len; i++) -+ { -+ char ch = m_value.string[i]; -+// if (ch == '"' || ch == '\\') -+// stream << "\\"; -+ stream << ch; -+ } -+ -+// stream << "\""; -+ break; -+ } -+ case wxPropertyValueStringPtr: -+ { -+ int i; -+ int len = strlen(*(m_value.stringPtr)); -+ for (i = 0; i < len; i++) -+ { -+ char ch = *(m_value.stringPtr)[i]; -+ -+ } -+ break; -+ } -+ case wxPropertyValueList: -+ { -+ if (!m_value.first) -+ stream << "[]"; -+ else -+ { -+ wxPropertyValue *expr = m_value.first; -+ -+ stream << "["; -+ while (expr) -+ { -+ expr->WritePropertyType(stream); -+ expr = expr->m_next; -+ if (expr) stream << ", "; -+ } -+ stream << "]"; -+ } -+ break; -+ } -+ case wxPropertyValueNull: break; -+ } -+} -+ -+wxString wxPropertyValue::GetStringRepresentation(void) -+{ -+ char buf[500]; -+ buf[0] = 0; -+ -+ ostrstream str((char *)buf, (int)500, ios::out); -+ WritePropertyType(str); -+ str << '\0'; -+ str.flush(); -+ -+ wxString theString(buf); -+ return theString; -+} -+ -+void wxPropertyValue::operator=(const wxPropertyValue& val) -+{ -+ m_modifiedFlag = TRUE; -+ Copy((wxPropertyValue&)val); -+} -+ -+// void wxPropertyValue::operator=(const char *val) -+void wxPropertyValue::operator=(const wxString& val1) -+{ -+ const char *val = (const char *)val1; -+ -+ m_modifiedFlag = TRUE; -+ if (m_type == wxPropertyValueNull) -+ m_type = wxPropertyValueString; -+ -+ if (m_type == wxPropertyValueString) -+ { -+ if (val) -+ m_value.string = copystring(val); -+ else -+ m_value.string = NULL; -+ } -+ else if (m_type == wxPropertyValueStringPtr) -+ { -+ if (*m_value.stringPtr) -+ delete[] *m_value.stringPtr; -+ if (val) -+ *m_value.stringPtr = copystring(val); -+ else -+ *m_value.stringPtr = NULL; -+ } -+ -+ m_clientData = NULL; -+ m_next = NULL; -+ m_last = NULL; -+ -+} -+ -+void wxPropertyValue::operator=(const long val) -+{ -+ m_modifiedFlag = TRUE; -+ if (m_type == wxPropertyValueNull) -+ m_type = wxPropertyValueInteger; -+ -+ if (m_type == wxPropertyValueInteger) -+ m_value.integer = val; -+ else if (m_type == wxPropertyValueIntegerPtr) -+ *m_value.integerPtr = val; -+ else if (m_type == wxPropertyValueReal) -+ m_value.real = (float)val; -+ else if (m_type == wxPropertyValueRealPtr) -+ *m_value.realPtr = (float)val; -+ -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+void wxPropertyValue::operator=(const bool val) -+{ -+ m_modifiedFlag = TRUE; -+ if (m_type == wxPropertyValueNull) -+ m_type = wxPropertyValuebool; -+ -+ if (m_type == wxPropertyValuebool) -+ m_value.integer = (long)val; -+ else if (m_type == wxPropertyValueboolPtr) -+ *m_value.boolPtr = val; -+ -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+void wxPropertyValue::operator=(const float val) -+{ -+ m_modifiedFlag = TRUE; -+ if (m_type == wxPropertyValueNull) -+ m_type = wxPropertyValueReal; -+ -+ if (m_type == wxPropertyValueInteger) -+ m_value.integer = (long)val; -+ else if (m_type == wxPropertyValueIntegerPtr) -+ *m_value.integerPtr = (long)val; -+ else if (m_type == wxPropertyValueReal) -+ m_value.real = val; -+ else if (m_type == wxPropertyValueRealPtr) -+ *m_value.realPtr = val; -+ -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+void wxPropertyValue::operator=(const char **val) -+{ -+ m_modifiedFlag = TRUE; -+ m_type = wxPropertyValueStringPtr; -+ -+ if (val) -+ m_value.stringPtr = (char **)val; -+ else -+ m_value.stringPtr = NULL; -+ m_clientData = NULL; -+ m_next = NULL; -+ m_last = NULL; -+ -+} -+ -+void wxPropertyValue::operator=(const long *val) -+{ -+ m_modifiedFlag = TRUE; -+ m_type = wxPropertyValueIntegerPtr; -+ m_value.integerPtr = (long *)val; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+void wxPropertyValue::operator=(const bool *val) -+{ -+ m_modifiedFlag = TRUE; -+ m_type = wxPropertyValueboolPtr; -+ m_value.boolPtr = (bool *)val; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+void wxPropertyValue::operator=(const float *val) -+{ -+ m_modifiedFlag = TRUE; -+ m_type = wxPropertyValueRealPtr; -+ m_value.realPtr = (float *)val; -+ m_clientData = NULL; -+ m_next = NULL; -+} -+ -+long wxPropertyValue::IntegerValue(void) const -+ { -+ if (m_type == wxPropertyValueInteger) -+ return m_value.integer; -+ else if (m_type == wxPropertyValueReal) -+ return (long)m_value.real; -+ else if (m_type == wxPropertyValueIntegerPtr) -+ return *m_value.integerPtr; -+ else if (m_type == wxPropertyValueRealPtr) -+ return (long)(*m_value.realPtr); -+ else return 0; -+ } -+ -+long *wxPropertyValue::IntegerValuePtr(void) const -+{ -+ return m_value.integerPtr; -+} -+ -+float wxPropertyValue::RealValue(void) const { -+ if (m_type == wxPropertyValueReal) -+ return m_value.real; -+ else if (m_type == wxPropertyValueRealPtr) -+ return *m_value.realPtr; -+ else if (m_type == wxPropertyValueInteger) -+ return (float)m_value.integer; -+ else if (m_type == wxPropertyValueIntegerPtr) -+ return (float)*(m_value.integerPtr); -+ else return 0.0; -+ } -+ -+float *wxPropertyValue::RealValuePtr(void) const -+{ -+ return m_value.realPtr; -+} -+ -+bool wxPropertyValue::BoolValue(void) const { -+ if (m_type == wxPropertyValueReal) -+ return (m_value.real != 0.0); -+ if (m_type == wxPropertyValueRealPtr) -+ return (*(m_value.realPtr) != 0.0); -+ else if (m_type == wxPropertyValueInteger) -+ return (m_value.integer != 0); -+ else if (m_type == wxPropertyValueIntegerPtr) -+ return (*(m_value.integerPtr) != 0); -+ else if (m_type == wxPropertyValuebool) -+ return (m_value.integer != 0); -+ else if (m_type == wxPropertyValueboolPtr) -+ return (*(m_value.boolPtr) != 0); -+ else return FALSE; -+ } -+ -+bool *wxPropertyValue::BoolValuePtr(void) const -+{ -+ return m_value.boolPtr; -+} -+ -+char *wxPropertyValue::StringValue(void) const { -+ if (m_type == wxPropertyValueString) -+ return m_value.string; -+ else if (m_type == wxPropertyValueStringPtr) -+ return *(m_value.stringPtr); -+ else return NULL; -+ } -+ -+char **wxPropertyValue::StringValuePtr(void) const -+{ -+ return m_value.stringPtr; -+} -+ -+/* -+ * A property (name plus value) -+ */ -+ -+IMPLEMENT_DYNAMIC_CLASS(wxProperty, wxObject) -+ -+wxProperty::wxProperty(void) -+{ -+ m_propertyRole = (char *)NULL; -+ m_propertyValidator = NULL; -+ m_propertyWindow = NULL; -+ m_enabled = TRUE; -+} -+ -+wxProperty::wxProperty(wxProperty& copyFrom) -+{ -+ m_value = copyFrom.GetValue(); -+ m_name = copyFrom.GetName(); -+ m_propertyRole = copyFrom.GetRole(); -+ m_propertyValidator = copyFrom.GetValidator(); -+ m_enabled = copyFrom.IsEnabled(); -+ m_propertyWindow = NULL; -+} -+ -+wxProperty::wxProperty(wxString nm, wxString role, wxPropertyValidator *ed):m_name(nm), m_propertyRole(role) -+{ -+ m_propertyValidator = ed; -+ m_propertyWindow = NULL; -+ m_enabled = TRUE; -+} -+ -+wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed): -+ m_name(nm), m_value(val), m_propertyRole(role) -+{ -+ m_propertyValidator = ed; -+ m_propertyWindow = NULL; -+ m_enabled = TRUE; -+} -+ -+wxProperty::~wxProperty(void) -+{ -+ if (m_propertyValidator) -+ delete m_propertyValidator; -+} -+ -+wxPropertyValue& wxProperty::GetValue(void) const -+{ -+ return (wxPropertyValue&) m_value; -+} -+ -+wxPropertyValidator *wxProperty::GetValidator(void) const -+{ -+ return m_propertyValidator; -+} -+ -+wxString& wxProperty::GetName(void) const -+{ -+ return (wxString&) m_name; -+} -+ -+wxString& wxProperty::GetRole(void) const -+{ -+ return (wxString&) m_propertyRole; -+} -+ -+void wxProperty::SetValue(const wxPropertyValue& val) -+{ -+ m_value = val; -+} -+ -+void wxProperty::SetValidator(wxPropertyValidator *ed) -+{ -+ m_propertyValidator = ed; -+} -+ -+void wxProperty::SetRole(wxString& role) -+{ -+ m_propertyRole = role; -+} -+ -+void wxProperty::SetName(wxString& nm) -+{ -+ m_name = nm; -+} -+ -+void wxProperty::operator=(const wxPropertyValue& val) -+{ -+ m_value = val; -+} -+ -+/* -+ * Base property view class -+ */ -+ -+IMPLEMENT_DYNAMIC_CLASS(wxPropertyView, wxEvtHandler) -+ -+wxPropertyView::wxPropertyView(long flags) -+{ -+ m_buttonFlags = flags; -+ m_propertySheet = NULL; -+ m_currentValidator = NULL; -+ m_currentProperty = NULL; -+} -+ -+wxPropertyView::~wxPropertyView(void) -+{ -+} -+ -+void wxPropertyView::AddRegistry(wxPropertyValidatorRegistry *registry) -+{ -+ m_validatorRegistryList.Append(registry); -+} -+ -+wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property) -+{ -+ if (property->GetValidator()) -+ return property->GetValidator(); -+ -+ wxNode *node = m_validatorRegistryList.First(); -+ while (node) -+ { -+ wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->Data(); -+ wxPropertyValidator *validator = registry->GetValidator(property->GetRole()); -+ if (validator) -+ return validator; -+ node = node->Next(); -+ } -+ return NULL; -+/* -+ if (!wxDefaultPropertyValidator) -+ wxDefaultPropertyValidator = new wxPropertyListValidator; -+ return wxDefaultPropertyValidator; -+*/ -+} -+ -+/* -+ * Property sheet -+ */ -+ -+IMPLEMENT_DYNAMIC_CLASS(wxPropertySheet, wxObject) -+ -+wxPropertySheet::wxPropertySheet(void):m_properties(wxKEY_STRING) -+{ -+} -+ -+wxPropertySheet::~wxPropertySheet(void) -+{ -+ Clear(); -+} -+ -+bool wxPropertySheet::Save( ostream& WXUNUSED(str) ) -+{ -+ return FALSE; -+} -+ -+bool wxPropertySheet::Load( ostream& WXUNUSED(str) ) -+{ -+ return FALSE; -+} -+ -+void wxPropertySheet::UpdateAllViews( wxPropertyView *WXUNUSED(thisView) ) -+{ -+} -+ -+// Add a property -+void wxPropertySheet::AddProperty(wxProperty *property) -+{ -+ m_properties.Append((const char*) property->GetName(), property); -+} -+ -+// Get property by name -+wxProperty *wxPropertySheet::GetProperty(wxString name) -+{ -+ wxNode *node = m_properties.Find((const char*) name); -+ if (!node) -+ return NULL; -+ else -+ return (wxProperty *)node->Data(); -+} -+ -+// Clear all properties -+void wxPropertySheet::Clear(void) -+{ -+ wxNode *node = m_properties.First(); -+ while (node) -+ { -+ wxProperty *prop = (wxProperty *)node->Data(); -+ wxNode *next = node->Next(); -+ delete prop; -+ delete node; -+ node = next; -+ } -+} -+ -+// Sets/clears the modified flag for each property value -+void wxPropertySheet::SetAllModified(bool flag) -+{ -+ wxNode *node = m_properties.First(); -+ while (node) -+ { -+ wxProperty *prop = (wxProperty *)node->Data(); -+ prop->GetValue().SetModified(flag); -+ node = node->Next(); -+ } -+} -+ -+/* -+ * Property validator registry -+ * -+ */ -+ -+IMPLEMENT_DYNAMIC_CLASS(wxPropertyValidatorRegistry, wxHashTable) -+ -+wxPropertyValidatorRegistry::wxPropertyValidatorRegistry(void):wxHashTable(wxKEY_STRING) -+{ -+} -+ -+wxPropertyValidatorRegistry::~wxPropertyValidatorRegistry(void) -+{ -+ ClearRegistry(); -+} -+ -+void wxPropertyValidatorRegistry::RegisterValidator(const wxString& typeName, wxPropertyValidator *validator) -+{ -+ Put((const char*) typeName, validator); -+} -+ -+wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(const wxString& typeName) -+{ -+ return (wxPropertyValidator *)Get((const char*) typeName); -+} -+ -+void wxPropertyValidatorRegistry::ClearRegistry(void) -+{ -+ BeginFind(); -+ wxNode *node; -+ while (node = Next()) -+ { -+ delete (wxPropertyValidator *)node->Data(); -+ } -+} -+ -+ /* -+ * Property validator -+ */ -+ -+ -+IMPLEMENT_ABSTRACT_CLASS(wxPropertyValidator, wxEvtHandler) -+ -+wxPropertyValidator::wxPropertyValidator(long flags) -+{ -+ m_validatorFlags = flags; -+ m_validatorProperty = NULL; -+} -+ -+wxPropertyValidator::~wxPropertyValidator(void) -+{} -+ -+bool wxPropertyValidator::StringToFloat (char *s, float *number) { -+ double num; -+ bool ok = StringToDouble (s, &num); -+ *number = (float) num; -+ return ok; -+} -+ -+bool wxPropertyValidator::StringToDouble (char *s, double *number) { -+ bool ok = TRUE; -+ char *value_ptr; -+ *number = strtod (s, &value_ptr); -+ if (value_ptr) { -+ int len = strlen (value_ptr); -+ for (int i = 0; i < len; i++) { -+ ok = (isspace (value_ptr[i]) != 0); -+ if (!ok) return FALSE; -+ } -+ } -+ return ok; -+} -+ -+bool wxPropertyValidator::StringToInt (char *s, int *number) { -+ long num; -+ bool ok = StringToLong (s, &num); -+ *number = (int) num; -+ return ok; -+} -+ -+bool wxPropertyValidator::StringToLong (char *s, long *number) { -+ bool ok = TRUE; -+ char *value_ptr; -+ *number = strtol (s, &value_ptr, 10); -+ if (value_ptr) { -+ int len = strlen (value_ptr); -+ for (int i = 0; i < len; i++) { -+ ok = (isspace (value_ptr[i]) != 0); -+ if (!ok) return FALSE; -+ } -+ } -+ return ok; -+} -+ -+char *wxPropertyValidator::FloatToString (float number) { -+ static char buf[20]; -+ sprintf (buf, "%.6g", number); -+ return buf; -+} -+ -+char *wxPropertyValidator::DoubleToString (double number) { -+ static char buf[20]; -+ sprintf (buf, "%.6g", number); -+ return buf; -+} -+ -+char *wxPropertyValidator::IntToString (int number) { -+ return ::IntToString (number); -+} -+ -+char *wxPropertyValidator::LongToString (long number) { -+ return ::LongToString (number); -+ } -+ -+ diff --git a/wxGTK.spec b/wxGTK.spec index 17002cd..ce8ad77 100644 --- a/wxGTK.spec +++ b/wxGTK.spec @@ -5,8 +5,8 @@ %define withodbc 0 Name: wxGTK -Version: 2.8.0 -Release: 2.8.0.1.3%{?dist} +Version: 2.8.3 +Release: 1%{?dist} Summary: GTK2 port of the wxWidgets GUI library # The wxWindows licence is the LGPL with a specific exemption allowing # distribution of derived binaries under any terms. (This will eventually @@ -15,7 +15,6 @@ License: wxWidgets Library Licence Group: System Environment/Libraries URL: http://www.wxwidgets.org/ Source0: http://dl.sf.net/wxwindows/%{name}-%{version}.tar.bz2 -Patch0: wxGTK-2.8.0.1-cvs.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gtk2-devel, zlib-devel >= 1.1.4 @@ -91,15 +90,15 @@ ODBC (a SQL database connectivity API) add-on for the wxWidgets library. %prep %setup -q -%patch0 -p1 -b .2.8.0.1 sed -i -e 's|/usr/lib\b|%{_libdir}|' wx-config.in configure %build -# must do this to regenerate ./configure after the 2.8.0.1 patch. -autoconf +# must do this to regenerate ./configure if patching to a cvs +# version. +#autoconf export GDK_USE_XFT=1 @@ -214,6 +213,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Sun Apr 15 2007 Matthew Miller - 2.8.3-1 +- update to 2.8.3 + * Sun Dec 17 2006 Matthew Miller - 2.8.0-2.8.0.1.3 - add --enable-timer to build wxTimer class for XaraLX. - NOTE: if anyone else needs any non-default classes or features enabled,