From 9838df2cefc5b368bb11f98c784ecc78f45ecaf7 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 24 Jan 1999 14:57:09 +0000 Subject: [PATCH] Added some Motif wxGLCanvas support; some more Motif bugs cured; print dialogs look OK on Motif now; got rid of some #ifdef wxUSE_... instances git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1459 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/generic.rsp | 66 ---------------------- distrib/msw/zipdist.bat | 4 ++ docs/html/faq.htm | 2 +- docs/html/faqmsw.htm | 19 ++++++- docs/html/index.htm | 2 +- docs/latex/wx/list.tex | 14 ++--- docs/latex/wx/point.tex | 2 +- docs/latex/wx/rect.tex | 2 +- docs/latex/wx/size.tex | 2 +- docs/motif/todo.txt | 9 ++- include/wx/confbase.h | 2 +- include/wx/date.h | 2 +- include/wx/image.h | 4 +- include/wx/motif/radiobox.h | 4 +- include/wx/motif/setup.h | 3 + include/wx/object.h | 6 +- include/wx/stubs/setup.h | 3 + include/wx/thread.h | 2 +- include/wx/time.h | 2 +- include/wx/wx.h | 2 +- include/wx/zstream.h | 2 +- samples/controls/controls.cpp | 22 +++++--- samples/printing/printing.cpp | 37 +----------- src/common/config.cpp | 2 +- src/common/date.cpp | 2 +- src/common/image.cpp | 6 +- src/common/log.cpp | 2 +- src/common/prntbase.cpp | 9 ++- src/common/serbase.cpp | 2 +- src/common/time.cpp | 2 +- src/common/zstream.cpp | 2 +- src/generic/prntdlgg.cpp | 51 +++++++++++++++-- src/motif/checkbox.cpp | 8 ++- src/motif/choice.cpp | 10 ++-- src/motif/dialog.cpp | 1 + src/motif/radiobox.cpp | 31 +++++++++- src/motif/radiobut.cpp | 7 +++ src/motif/spinbutt.cpp | 4 +- src/msw/dialog.cpp | 13 ++++- src/msw/printwin.cpp | 2 - utils/glcanvas/samples/cube/cube.cpp | 4 ++ utils/glcanvas/samples/isosurf/isosurf.cpp | 4 +- 42 files changed, 207 insertions(+), 168 deletions(-) diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 547746163d..0c7f4f0050 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -119,18 +119,6 @@ utils/wxgraph/src/*.ico utils/wxgraph/src/*.def utils/wxgraph/src/*.rc -utils/mfutils/src/*.cpp -utils/mfutils/src/*.h -utils/mfutils/src/*.rc -utils/mfutils/src/*.def -utils/mfutils/src/makefile* -utils/mfutils/src/*.txt -utils/mfutils/lib/dummy -utils/mfutils/src/*.ico -utils/mfutils/src/*.def -utils/mfutils/src/*.bmp -utils/mfutils/src/*.ico - utils/rcparser/src/*.cpp utils/rcparser/src/*.c utils/rcparser/src/*.h @@ -188,60 +176,6 @@ utils/dialoged/test/*.ico utils/dialoged/test/*.prj utils/dialoged/test/*.bmp -utils/glcanvas/Makefile -utils/glcanvas/win/*.h -utils/glcanvas/win/*.cpp -utils/glcanvas/win/*.def -utils/glcanvas/win/*.rc -utils/glcanvas/win/makefile* -utils/glcanvas/win/*.xbm -utils/glcanvas/win/*.xpm -utils/glcanvas/win/*.txt -utils/glcanvas/win/*.ico -utils/glcanvas/win/*.bmp - -utils/glcanvas/src/*.h -utils/glcanvas/src/*.cpp -utils/glcanvas/src/*.def -utils/glcanvas/src/*.rc -utils/glcanvas/src/makefile* -utils/glcanvas/src/*.xbm -utils/glcanvas/src/*.xpm -utils/glcanvas/src/*.txt -utils/glcanvas/src/*.ico -utils/glcanvas/src/*.bmp - -utils/glcanvas/motif/*.h -utils/glcanvas/motif/*.cpp -utils/glcanvas/motif/makefile* -utils/glcanvas/motif/*.txt - -utils/glcanvas/samples/cube/*.h -utils/glcanvas/samples/cube/*.cpp -utils/glcanvas/samples/cube/*.def -utils/glcanvas/samples/cube/*.rc -utils/glcanvas/samples/cube/makefile* -utils/glcanvas/samples/cube/*.xbm -utils/glcanvas/samples/cube/*.xpm -utils/glcanvas/samples/cube/*.txt -utils/glcanvas/samples/cube/*.ico -utils/glcanvas/samples/cube/*.bmp -utils/glcanvas/samples/isosurf/*.h -utils/glcanvas/samples/isosurf/*.cpp -utils/glcanvas/samples/isosurf/*.def -utils/glcanvas/samples/isosurf/*.rc -utils/glcanvas/samples/isosurf/makefile* -utils/glcanvas/samples/isosurf/*.xbm -utils/glcanvas/samples/isosurf/*.xpm -utils/glcanvas/samples/isosurf/*.txt -utils/glcanvas/samples/isosurf/*.ico -utils/glcanvas/samples/isosurf/*.bmp -utils/glcanvas/samples/isosurf/*.gz -utils/glcanvas/docs/*.tex -utils/glcanvas/docs/*.txt -utils/glcanvas/docs/*.bmp -utils/glcanvas/docs/*.gif - samples/*.txt samples/makefile* diff --git a/distrib/msw/zipdist.bat b/distrib/msw/zipdist.bat index 420220df5a..fccf5a15b5 100755 --- a/distrib/msw/zipdist.bat +++ b/distrib/msw/zipdist.bat @@ -33,8 +33,12 @@ zip32 -@ %dest\wx200vc.zip < %src\distrib\msw\vc.rsp rem CodeWarrior project files zip32 -@ %dest\wx200cw.zip < %src\distrib\msw\cw.rsp +rem OGL 3 zip32 -@ %dest\ogl3.zip < %src\utils\ogl\distrib\ogl.rsp +rem GLCanvas +zip32 -@ %dest\glcanvas.zip < %src\distrib\glcanvas.rsp + rem Tex2RTF zip32 -@ %dest\tex2rtf2.zip < %src\distrib\msw\tex2rtf.rsp diff --git a/docs/html/faq.htm b/docs/html/faq.htm index 00463cf2f2..cbe471dcb6 100644 --- a/docs/html/faq.htm +++ b/docs/html/faq.htm @@ -32,7 +32,7 @@ Welcome to the wxWindows FAQ. Please select a category:

-For further information, please see the wxWindows Web site, +For further information, please see the wxWindows Web site, plus install.txt (per port), todo.txt (per port), and bugs.txt (all ports).

diff --git a/docs/html/faqmsw.htm b/docs/html/faqmsw.htm index 061c2a9c89..2f600a7cf6 100644 --- a/docs/html/faqmsw.htm +++ b/docs/html/faqmsw.htm @@ -111,7 +111,7 @@ for the port to Windows CE (see above).

Can you compile wxWindows 2 as a DLL?

-Yes (using the Visual C++ makefile), but be aware that distributing DLLs is a thorny issue +Yes (using the Visual C++ or Borland C++ makefile), but be aware that distributing DLLs is a thorny issue and you may be better off compiling statically-linked applications, unless you're delivering a suite of separate programs, or you're compiling a lot of wxWindows applications and have limited hard disk space.

@@ -122,6 +122,23 @@ negating the point of using DLLs. Of course, this is not a problem just associat wxWindows!

+

How can I reduce executable size?

+ +You can compile wxWindows as a DLL (see above, VC++/BC++ only at present). You should also +compile your programs for release using non-debugging and space-optimisation options.

+ +Statically-linked wxWindows 2 programs are smaller than wxWindows 1.xx programs, because of the way +wxWindows 2 has been designed to reduce dependencies between classes, and other +techniques. The linker will not include code from the library that is not (directly or +indirectly) referenced +by your application. So for example, the 'minimal' sample is less than 300KB using VC++ 6.

+ +If you want to distribute really small executables, you can +use Petite +by Ian Luck. This nifty utility compresses Windows executables by around 50%, so your 500KB executable +will shrink to a mere 250KB. With this sort of size, there is reduced incentive to +use DLLs.

+

Will wxWindows be compatible with MFC?

diff --git a/docs/html/index.htm b/docs/html/index.htm index 7cabab0b41..f5c242aab4 100644 --- a/docs/html/index.htm +++ b/docs/html/index.htm @@ -26,7 +26,7 @@ Welcome to wxWindows 2.0, the premiere cross-platform C++ framework. This is an index of the plain text and HTML documentation. Documentation is also available in Acrobat (PDF) and Windows Help, -from the wxWindows Web site.

+from the wxWindows Web site.

Installation and release notes

diff --git a/docs/latex/wx/list.tex b/docs/latex/wx/list.tex index 6e53b0e541..5fb29e84c1 100644 --- a/docs/latex/wx/list.tex +++ b/docs/latex/wx/list.tex @@ -72,27 +72,25 @@ future versions completely. \helpref{wxObject}{wxobject} -{\bf WARNING: } the rest of documentation may be out-of-date. - \wxheading{Example} It is very common to iterate on a list as follows: \begin{verbatim} ... - wxPoint *point1 = new wxPoint(100, 100); - wxPoint *point2 = new wxPoint(200, 200); + wxWindow *win1 = new wxWindow(...); + wxWindow *win2 = new wxWindow(...); wxList SomeList; - SomeList.Append(point1); - SomeList.Append(point2); + SomeList.Append(win1); + SomeList.Append(win2); ... wxNode *node = SomeList.GetFirst(); while (node) { - wxPoint *point = (wxPoint *)node->Data(); + wxWindow *win = (wxWindow *)node->Data(); ... node = node->Next(); } @@ -110,7 +108,7 @@ with \begin{verbatim} ... - delete point; + delete win; delete node; node = SomeList.GetFirst(); ... diff --git a/docs/latex/wx/point.tex b/docs/latex/wx/point.tex index 9446ebb6fa..056b85c451 100644 --- a/docs/latex/wx/point.tex +++ b/docs/latex/wx/point.tex @@ -7,7 +7,7 @@ See also \helpref{wxRealPoint}{wxrealpoint} for a floating point version. \wxheading{Derivation} -\helpref{wxObject}{wxobject} +None \wxheading{See also} diff --git a/docs/latex/wx/rect.tex b/docs/latex/wx/rect.tex index 48d4889041..c99b66b423 100644 --- a/docs/latex/wx/rect.tex +++ b/docs/latex/wx/rect.tex @@ -4,7 +4,7 @@ A class for manipulating rectangles. \wxheading{Derived from} -\helpref{wxObject}{wxobject} +None \wxheading{See also} diff --git a/docs/latex/wx/size.tex b/docs/latex/wx/size.tex index be8212ff75..2f9579b6e1 100644 --- a/docs/latex/wx/size.tex +++ b/docs/latex/wx/size.tex @@ -5,7 +5,7 @@ It simply contains integer {\it x} and {\it y} members. \wxheading{Derivation} -\helpref{wxObject}{wxobject} +None \wxheading{See also} diff --git a/docs/motif/todo.txt b/docs/motif/todo.txt index 403e317428..46c6938dd5 100644 --- a/docs/motif/todo.txt +++ b/docs/motif/todo.txt @@ -35,16 +35,19 @@ High Priority painting a tiled bitmap, then a slight flicker might be seen unless X can be persuaded not to repaint the window background by default. +- wxRadioBox doesn't show up in the controls sample, though it's + OK on other dialogs (e.g. printing sample). + +- Word wrapping in wxStaticText: how? + - wxSpinButton - Miscellaneous events. -- Get wxGLCanvas from 1.68 working. +- wxGLCanvas: cure bad flicker - Use wxImage to load other formats into wxBitmaps, such as PNG, BMP. -- Printing dialogs need some tidying. - Low Priority ------------ diff --git a/include/wx/confbase.h b/include/wx/confbase.h index b2a4ceb21f..2fcb50efee 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -20,7 +20,7 @@ #include "wx/defs.h" -#ifdef wxUSE_CONFIG +#if wxUSE_CONFIG #include "wx/string.h" diff --git a/include/wx/date.h b/include/wx/date.h index ea1b894c69..86c503ec49 100644 --- a/include/wx/date.h +++ b/include/wx/date.h @@ -20,7 +20,7 @@ #include "wx/object.h" #include "wx/string.h" -#ifdef wxUSE_TIMEDATE +#if wxUSE_TIMEDATE enum wxdate_format_type {wxMDY, wxDAY, wxMONTH, wxFULL, wxEUROPEAN}; diff --git a/include/wx/image.h b/include/wx/image.h index 76a1fdc6e8..c548f26c91 100644 --- a/include/wx/image.h +++ b/include/wx/image.h @@ -28,7 +28,7 @@ //----------------------------------------------------------------------------- class WXDLLEXPORT wxImageHandler; -#ifdef wxUSE_LIBPNG +#if wxUSE_LIBPNG class WXDLLEXPORT wxPNGHandler; #endif class WXDLLEXPORT wxBMPHandler; @@ -70,7 +70,7 @@ protected: // wxPNGHandler //----------------------------------------------------------------------------- -#ifdef wxUSE_LIBPNG +#if wxUSE_LIBPNG class WXDLLEXPORT wxPNGHandler: public wxImageHandler { DECLARE_DYNAMIC_CLASS(wxPNGHandler) diff --git a/include/wx/motif/radiobox.h b/include/wx/motif/radiobox.h index 78168c845f..527f9772b7 100644 --- a/include/wx/motif/radiobox.h +++ b/include/wx/motif/radiobox.h @@ -61,7 +61,7 @@ public: void Enable(bool enable); void Enable(int item, bool enable); void Show(int item, bool show) ; - bool Show(bool show) { return wxControl::Show(show); }; + bool Show(bool show) ; virtual wxString GetStringSelection() const; virtual bool SetStringSelection(const wxString& s); @@ -77,6 +77,7 @@ public: virtual void ChangeForegroundColour(); WXWidget GetTopWidget() const { return m_formWidget; } WXWidget GetLabelWidget() const { return m_labelWidget; } + WXWidget GetFrameWidget() const { return m_frameWidget; } inline WXWidget* GetRadioButtons() const { return m_radioButtons; } inline void SetSel(int i) { m_selectedButton = i; } @@ -88,6 +89,7 @@ protected: WXWidget m_formWidget; WXWidget m_labelWidget; + WXWidget m_frameWidget; WXWidget* m_radioButtons; wxString* m_radioButtonLabels; }; diff --git a/include/wx/motif/setup.h b/include/wx/motif/setup.h index c9c7b0e38d..923e2fef2a 100644 --- a/include/wx/motif/setup.h +++ b/include/wx/motif/setup.h @@ -137,6 +137,9 @@ #define wxUSE_STREAMS 1 // Use wxStream implementation within wxWindows code +#define wxUSE_SERIAL 0 + // Use serialization + /* * Finer detail * diff --git a/include/wx/object.h b/include/wx/object.h index b16265669a..b914b190dc 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -101,7 +101,7 @@ public: WXDLLEXPORT wxObject* wxCreateDynamicObject(const char *name); -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL WXDLLEXPORT wxObject* wxCreateStoredObject( wxInputStream& stream ); #endif @@ -222,7 +222,7 @@ class WXDLLEXPORT wxObject virtual void Dump(ostream& str); #endif -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL virtual void StoreObject( wxObjectOutputStream &stream ); virtual void LoadObject( wxObjectInputStream &stream ); #endif @@ -238,7 +238,7 @@ class WXDLLEXPORT wxObject protected: wxObjectRefData* m_refData; -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL wxObject_Serialize* m_serialObj; #endif }; diff --git a/include/wx/stubs/setup.h b/include/wx/stubs/setup.h index 9b2a42e62f..0456d8c1a6 100644 --- a/include/wx/stubs/setup.h +++ b/include/wx/stubs/setup.h @@ -123,6 +123,9 @@ #define wxUSE_STD_IOSTREAM 1 // Use standard C++ streams if 1. If 0, use wxWin // streams implementation. + +#define wxUSE_SERIAL 0 + // Use serialization /* * Finer detail * diff --git a/include/wx/thread.h b/include/wx/thread.h index 3a850853fa..1acb78279f 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -369,7 +369,7 @@ public: // ----------------------------------------------------------------------------- // implementation only until the end of file // ----------------------------------------------------------------------------- -#ifdef wxUSE_THREADS +#if wxUSE_THREADS #ifdef __WXMSW__ // unlock GUI if there are threads waiting for and lock it back when // there are no more of them - should be called periodically by the main diff --git a/include/wx/time.h b/include/wx/time.h index a0137da932..49dbc62105 100644 --- a/include/wx/time.h +++ b/include/wx/time.h @@ -14,7 +14,7 @@ #include "wx/object.h" -#ifdef wxUSE_TIMEDATE +#if wxUSE_TIMEDATE #ifdef __GNUG__ #pragma interface "time.h" diff --git a/include/wx/wx.h b/include/wx/wx.h index f1199332a0..6fab5a9334 100644 --- a/include/wx/wx.h +++ b/include/wx/wx.h @@ -66,7 +66,7 @@ #include "wx/cmndata.h" #include "wx/intl.h" #include "wx/valtext.h" -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL #include "wx/objstrm.h" #include "wx/serbase.h" #endif diff --git a/include/wx/zstream.h b/include/wx/zstream.h index 9538abcff6..9a4f11c6ad 100644 --- a/include/wx/zstream.h +++ b/include/wx/zstream.h @@ -17,7 +17,7 @@ #include "wx/defs.h" -#ifdef wxUSE_ZLIB +#if wxUSE_ZLIB #include diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 1053d0653c..424dad13ac 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -262,7 +262,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : "is one of my", "really", "wonderful", - "examples.", + "examples." }; #ifdef USE_XPM @@ -324,6 +324,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : // m_notebook->SetBackgroundColour("cadet blue"); wxPanel *panel = (wxPanel*) NULL; + panel = new wxPanel(m_notebook); // panel->SetBackgroundColour("cadet blue"); // panel->SetForegroundColour("blue"); @@ -338,7 +339,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : // button->SetForegroundColour( "red" ); m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) ); m_checkbox->SetValue(FALSE); - m_notebook->AddPage(panel, "wxList", FALSE, Image_List); + m_notebook->AddPage(panel, "wxList", TRUE, Image_List); panel = new wxPanel(m_notebook); // panel->SetBackgroundColour("cadet blue"); @@ -410,11 +411,19 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : // panel->SetBackgroundColour("cadet blue"); // panel->SetForegroundColour("blue"); (void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(180,130) ); - m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155,-1) ); + m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30) ); // m_gauge->SetBackgroundColour("wheat"); m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1) ); // m_slider->SetBackgroundColour("wheat"); (void)new wxStaticBox( panel, -1, "Explanation", wxPoint(200,10), wxSize(290,130) ); +#ifdef __WXMOTIF__ + // No wrapping text in wxStaticText yet :-( + (void)new wxStaticText( panel, -1, + "Drag the slider!", + wxPoint(208,30), + wxSize(210, -1) + ); +#else (void)new wxStaticText( panel, -1, "In order see the gauge (aka progress bar)\n" "control do something you have to drag the\n" @@ -422,11 +431,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : "\n" "This is also supposed to demonstrate how\n" "to use static controls.\n", - wxPoint(208,25) -#ifdef __WXMSW__ - ,wxSize(210, 110) -#endif + wxPoint(208,25), + wxSize(210, 110) ); +#endif m_spintext = new wxTextCtrl( panel, -1, "0", wxPoint(20,160), wxSize(80,-1) ); // m_spintext->SetBackgroundColour("wheat"); m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,159), wxSize(-1,-1) ); diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 3106790de3..89743d913b 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -160,11 +160,6 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ - wxGetApp().SetPrintMode(wxPRINT_WINDOWS); -#else - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); -#endif wxPrinter printer; MyPrintout printout("My printout"); if (!printer.Print(this, &printout, TRUE)) @@ -173,11 +168,6 @@ void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ - wxGetApp().SetPrintMode(wxPRINT_WINDOWS); -#else - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); -#endif wxPrintData printData; printData.SetOrientation(orientation); @@ -198,19 +188,11 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ - wxGetApp().SetPrintMode(wxPRINT_WINDOWS); -#else - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); -#endif wxPrintData data; data.SetOrientation(orientation); -#ifdef __WXMSW__ wxPrintDialog printerDialog(this, & data); -#else - wxGenericPrintDialog printerDialog(this, & data); -#endif + printerDialog.GetPrintData().SetSetupDialog(TRUE); printerDialog.ShowModal(); @@ -219,19 +201,10 @@ void MyFrame::OnPrintSetup(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) { -#ifdef __WXMSW__ - wxGetApp().SetPrintMode(wxPRINT_WINDOWS); -#else - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); -#endif wxPageSetupData data; data.SetOrientation(orientation); -#ifdef __WXMSW__ wxPageSetupDialog pageSetupDialog(this, & data); -#else - wxGenericPageSetupDialog pageSetupDialog(this, & data); -#endif pageSetupDialog.ShowModal(); data = pageSetupDialog.GetPageSetupData(); @@ -241,8 +214,6 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event)) { - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); - wxPostScriptPrinter printer; MyPrintout printout("My printout"); printer.Print(this, &printout, TRUE); @@ -250,8 +221,6 @@ void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event)) { - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); - wxPrintData printData; printData.SetOrientation(orientation); @@ -265,8 +234,6 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event)) { - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); - wxPrintData data; data.SetOrientation(orientation); @@ -279,8 +246,6 @@ void MyFrame::OnPrintSetupPS(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPageSetupPS(wxCommandEvent& WXUNUSED(event)) { - wxGetApp().SetPrintMode(wxPRINT_POSTSCRIPT); - wxPageSetupData data; data.SetOrientation(orientation); diff --git a/src/common/config.cpp b/src/common/config.cpp index 9551a9b94c..66e8d2017f 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -25,7 +25,7 @@ #include -#ifdef wxUSE_CONFIG +#if wxUSE_CONFIG #ifdef __BORLANDC__ #pragma hdrstop diff --git a/src/common/date.cpp b/src/common/date.cpp index 5bc7dbd22a..bd67ec071a 100644 --- a/src/common/date.cpp +++ b/src/common/date.cpp @@ -28,7 +28,7 @@ #include "wx/setup.h" -#ifdef wxUSE_TIMEDATE +#if wxUSE_TIMEDATE #include "wx/date.h" #include diff --git a/src/common/image.cpp b/src/common/image.cpp index e749f5d39d..a5b3a74df6 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -23,7 +23,7 @@ #include "wx/debug.h" #include "wx/log.h" #include "wx/app.h" -#ifdef wxUSE_LIBPNG +#if wxUSE_LIBPNG #include "../png/png.h" #endif #include "wx/filefn.h" @@ -447,7 +447,7 @@ wxImageHandler *wxImage::FindHandler( long bitmapType ) void wxImage::InitStandardHandlers() { AddHandler( new wxBMPHandler ); -#ifdef wxUSE_LIBPNG +#if wxUSE_LIBPNG AddHandler( new wxPNGHandler ); #endif } @@ -489,7 +489,7 @@ bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSE // wxPNGHandler //----------------------------------------------------------------------------- -#ifdef wxUSE_LIBPNG +#if wxUSE_LIBPNG #if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler) diff --git a/src/common/log.cpp b/src/common/log.cpp index 679df1715e..f28e32fc80 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -996,7 +996,7 @@ void wxOnAssert(const char *szFile, int nLine, const char *szMsg) // send it to the normal log destination wxLogDebug(szBuf); - #ifdef wxUSE_NOGUI + #if wxUSE_NOGUI Trap(); #else strcat(szBuf, _("\nDo you want to stop the program?" diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 035a76c16d..03532a1b97 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -312,6 +312,7 @@ void wxPreviewControlBar::CreateButtons() { SetSize(0, 0, 400, 40); + /* #ifdef __WXMSW__ int fontSize = 9; #else @@ -320,6 +321,7 @@ void wxPreviewControlBar::CreateButtons() wxFont buttonFont(fontSize, wxSWISS, wxNORMAL, wxBOLD); SetFont(buttonFont); + */ int buttonWidth = 65; #ifdef __WXGTK__ @@ -330,7 +332,12 @@ void wxPreviewControlBar::CreateButtons() int x = 5; int y = 5; + +#ifdef __WXMOTIF__ + int gap = 15; +#else int gap = 5; +#endif m_closeButton = new wxButton(this, wxID_PREVIEW_CLOSE, _("Close"), wxPoint(x, y), wxSize(buttonWidth, buttonHeight)); @@ -394,7 +401,7 @@ void wxPreviewControlBar::CreateButtons() delete[] choices; - m_closeButton->SetDefault(); + // m_closeButton->SetDefault(); } void wxPreviewControlBar::SetZoomControl(int zoom) diff --git a/src/common/serbase.cpp b/src/common/serbase.cpp index 5bc2ae125e..cf00ab21d5 100644 --- a/src/common/serbase.cpp +++ b/src/common/serbase.cpp @@ -24,7 +24,7 @@ #pragma hdrstop #endif -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL // ---------------------------------------------------------------------------- // wxObject_Serialize diff --git a/src/common/time.cpp b/src/common/time.cpp index 3b9ce52b58..d709f8b212 100644 --- a/src/common/time.cpp +++ b/src/common/time.cpp @@ -27,7 +27,7 @@ seconds since January 1, 1901, GMT. #include "wx/setup.h" -#ifdef wxUSE_TIMEDATE +#if wxUSE_TIMEDATE #include "wx/time.h" #include "wx/date.h" diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index 773776fe4c..4e896e2fd8 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -17,7 +17,7 @@ #include "wx/zstream.h" -#ifdef wxUSE_ZLIB +#if wxUSE_ZLIB #include "wx/utils.h" #include "wx/intl.h" diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index a9d860300b..f7dc47a9df 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -22,8 +22,6 @@ #include "wx/defs.h" -#define WINDOWS_PRINTING (wxTheApp->GetPrintMode() == wxPRINT_WINDOWS) - #ifndef WX_PRECOMP #include "wx/utils.h" #include "wx/dc.h" @@ -295,8 +293,14 @@ wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSe orientationRadioBox->SetSelection(0); (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Options"), wxPoint(10, 130), wxSize(200,50) ); + + int colourXPos = 145; + +#ifdef __WXMOTIF__ + colourXPos = 150; +#endif - colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, 145)); + colourCheckBox = new wxCheckBox(this, wxPRINTID_PRINTCOLOUR, _("Print in colour"), wxPoint(15, colourXPos)); (void) new wxStaticBox(this, wxPRINTID_STATIC, _("Print spooling"), wxPoint(230, 10), wxSize(200,170) ); @@ -367,6 +371,7 @@ bool wxGenericPrintSetupDialog::TransferDataFromWindow(void) if (!val.IsNull() && val != "") printData.SetPaperName((char *)(const char *)val); } + *wxThePrintSetupData = GetPrintData(); return TRUE; } @@ -389,7 +394,12 @@ wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y) sel = i; } - wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(170, -1), n, + int width = 170; +#ifdef __WXMOTIF__ + width = 150; +#endif + + wxChoice *choice = new wxChoice(this, wxPRINTID_PAPERSIZE, wxPoint(*x, *y), wxSize(width, -1), n, choices); delete[] choices; @@ -404,6 +414,22 @@ wxChoice *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y) void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event)) { + // We no longer query GetPrintMode, so we can eliminate the need + // to call SetPrintMode. + // This has the limitation that we can't explicitly call the PostScript + // print setup dialog from the generic Page Setup dialog under Windows, + // but since this choice would only happen when trying to do PostScript + // printing under Windows (and only in 16-bit Windows which + // doesn't have a Windows-specific page setup dialog) it's worth it. + + wxPrintData data; + data.SetSetupDialog(TRUE); + wxPrintDialog *printDialog = new wxPrintDialog(this, & data); + int ret = printDialog->ShowModal(); + + printDialog->Destroy(); + +#if 0 if (wxTheApp->GetPrintMode() == wxPRINT_POSTSCRIPT) { wxGenericPrintSetupDialog *genericPrintSetupDialog = @@ -420,9 +446,11 @@ void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event)) wxPrintData data; data.SetSetupDialog(TRUE); wxPrintDialog printDialog(this, & data); - printDialog.Show(TRUE); + printDialog.ShowModal(); } #endif +#endif + // 0 } wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetupData* data): @@ -434,6 +462,10 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetup int buttonWidth = 75; int buttonHeight = 25; int spacing = 5; +#ifdef __WXMOTIF__ + spacing = 15; +#endif + int yPos = 5; int xPos = 5; @@ -454,6 +486,10 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetup xPos = 5; yPos += 35; +#ifdef __WXMOTIF__ + yPos += 10; +#endif + paperTypeChoice = CreatePaperTypeChoice(&xPos, &yPos); xPos = 5; @@ -469,6 +505,10 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog(wxWindow *parent, wxPageSetup yPos += 60; int staticWidth = 110; +#ifdef __WXMOTIF__ + staticWidth += 20; +#endif + int textWidth = 60; spacing = 10; @@ -563,6 +603,7 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow(void) } } } + return TRUE; } diff --git a/src/motif/checkbox.cpp b/src/motif/checkbox.cpp index b9215f9d6a..ee43e5def3 100644 --- a/src/motif/checkbox.cpp +++ b/src/motif/checkbox.cpp @@ -14,6 +14,7 @@ #endif #include "wx/checkbox.h" +#include "wx/utils.h" #include #include @@ -169,8 +170,13 @@ void wxCheckBox::ChangeBackgroundColour() XmNforeground, g_itemColors[wxFORE_INDEX].pixel, NULL); + int selectPixel = wxBLACK->AllocColour(wxGetDisplay()); + + // Better to have the checkbox selection in black, or it's + // hard to determine what state it is in. XtVaSetValues ((Widget) m_mainWidget, - XmNselectColor, g_itemColors[wxSELE_INDEX].pixel, + // XmNselectColor, g_itemColors[wxSELE_INDEX].pixel, + XmNselectColor, selectPixel, NULL); } diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index ea99402163..b67015a958 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -112,7 +112,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, m_mainWidget = m_buttonWidget; XtManageChild ((Widget) m_buttonWidget); - + // New code from Roland Haenel (roland_haenel@ac.cybercity.de) // Some time ago, I reported a problem with wxChoice-items under // Linux and Motif 2.0 (they caused sporadic GPFs). Now it seems @@ -120,14 +120,16 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, #if XmVersion >= 1002 #if XmVersion < 2000 Widget optionLabel = XmOptionLabelGadget ((Widget) m_buttonWidget); - XtUnmanageChild (optionLabel); + // JACS, 24/1/99: this seems to cause a malloc crash later on, e.g. + // in controls sample. + // XtUnmanageChild (optionLabel); #endif #endif - + XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL); ChangeFont(FALSE); - + AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y); ChangeBackgroundColour(); diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index 3aad3f823b..16fc52abd5 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -611,6 +611,7 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) void wxDialog::Fit() { + wxWindow::Fit(); } // Handle a close event from the window manager diff --git a/src/motif/radiobox.cpp b/src/motif/radiobox.cpp index 9ca15fe708..feb57fe5d4 100644 --- a/src/motif/radiobox.cpp +++ b/src/motif/radiobox.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -41,6 +42,7 @@ wxRadioBox::wxRadioBox() m_majorDim = 0 ; m_formWidget = (WXWidget) 0; + m_frameWidget = (WXWidget) 0; m_labelWidget = (WXWidget) 0; m_radioButtons = (WXWidget*) NULL; m_radioButtonLabels = (wxString*) NULL; @@ -54,6 +56,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, { m_selectedButton = -1; m_noItems = n; + m_formWidget = (WXWidget) 0; + m_frameWidget = (WXWidget) 0; m_labelWidget = (WXWidget) 0; m_radioButtons = (WXWidget*) NULL; m_radioButtonLabels = (wxString*) NULL; @@ -113,6 +117,15 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, XmStringFree (text); } + Widget frameWidget = XtVaCreateManagedWidget ("frame", + xmFrameWidgetClass, formWidget, + XmNshadowType, XmSHADOW_IN, +// XmNmarginHeight, 0, +// XmNmarginWidth, 0, + NULL); + + m_frameWidget = (WXWidget) frameWidget; + Arg args[3]; majorDim = (n + majorDim - 1) / majorDim; @@ -121,7 +134,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, XmHORIZONTAL : XmVERTICAL)); XtSetArg (args[1], XmNnumColumns, majorDim); - Widget radioBoxWidget = XmCreateRadioBox (formWidget, "radioBoxWidget", args, 2); + Widget radioBoxWidget = XmCreateRadioBox (frameWidget, "radioBoxWidget", args, 2); m_mainWidget = (WXWidget) radioBoxWidget; @@ -137,6 +150,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, XmNtopWidget, m_labelWidget ? (Widget) m_labelWidget : formWidget, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, NULL); // if (style & wxFLAT) @@ -166,6 +180,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, m_windowFont = parent->GetFont(); ChangeFont(FALSE); + // XtManageChild((Widget) m_formWidget); XtManageChild (radioBoxWidget); SetCanAddEventHandler(TRUE); @@ -339,6 +354,12 @@ void wxRadioBox::Enable(bool enable) XtSetSensitive ((Widget) m_radioButtons[i], (Boolean) enable); } +bool wxRadioBox::Show(bool show) +{ + // TODO: show/hide all children + return wxControl::Show(show); +} + // Show a specific button void wxRadioBox::Show(int n, bool show) { @@ -418,12 +439,20 @@ void wxRadioBox::ChangeBackgroundColour() { wxWindow::ChangeBackgroundColour(); + DoChangeBackgroundColour((Widget) m_frameWidget, m_backgroundColour); + + int selectPixel = wxBLACK->AllocColour(wxGetDisplay()); + int i; for (i = 0; i < m_noItems; i++) { WXWidget radioButton = m_radioButtons[i]; DoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE); + + XtVaSetValues ((Widget) radioButton, + XmNselectColor, selectPixel, + NULL); } } diff --git a/src/motif/radiobut.cpp b/src/motif/radiobut.cpp index cea6c974d0..7fe7f99d31 100644 --- a/src/motif/radiobut.cpp +++ b/src/motif/radiobut.cpp @@ -121,6 +121,13 @@ void wxRadioButton::ChangeFont(bool keepOriginalSize) void wxRadioButton::ChangeBackgroundColour() { wxWindow::ChangeBackgroundColour(); + + // What colour should this be? + int selectPixel = wxBLACK->AllocColour(wxGetDisplay()); + + XtVaSetValues ((Widget) GetMainWidget(), + XmNselectColor, selectPixel, + NULL); } void wxRadioButton::ChangeForegroundColour() diff --git a/src/motif/spinbutt.cpp b/src/motif/spinbutt.cpp index 6c7c4d4424..73cedd396d 100644 --- a/src/motif/spinbutt.cpp +++ b/src/motif/spinbutt.cpp @@ -32,8 +32,8 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c m_windowStyle = style; - SetParent(parent); - + if (parent) parent->AddChild(this); + m_min = 0; m_max = 100; diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index af8ad17747..d5f08d2412 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -361,6 +361,10 @@ bool wxDialog::Show(bool show) TranslateMessage(&msg); DispatchMessage(&msg); } + + // If we get crashes (as per George Tasker's message) with nested modal dialogs, + // we should try removing the m_modalShowing test + if (m_modalShowing && !::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) // dfgg: NB MUST test m_modalShowing again as the message loop could have triggered // a Show(FALSE) in the mean time!!! @@ -376,9 +380,12 @@ bool wxDialog::Show(bool show) node=disabledWindows.First(); while(node) { wxWindow* win = (wxWindow*) node->Data(); - HWND hWnd = (HWND) win->GetHWND(); - if (::IsWindow(hWnd) && (wxModalDialogs.Member(win) || wxModelessWindows.Member(win) )) - ::EnableWindow(hWnd,TRUE); + if (wxModalDialogs.Member(win) || wxModelessWindows.Member(win)) + { + HWND hWnd = (HWND) win->GetHWND(); + if (::IsWindow(hWnd)) + ::EnableWindow(hWnd,TRUE); + } node=node->Next(); } } diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index f66d48fde2..3171efe667 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -22,8 +22,6 @@ #include "wx/defs.h" -#define WINDOWS_PRINTING (wxTheApp->GetPrintMode() == wxPRINT_WINDOWS) - #ifndef WX_PRECOMP #include "wx/utils.h" #include "wx/dc.h" diff --git a/utils/glcanvas/samples/cube/cube.cpp b/utils/glcanvas/samples/cube/cube.cpp index 73542bd7db..6b4fc01e6e 100644 --- a/utils/glcanvas/samples/cube/cube.cpp +++ b/utils/glcanvas/samples/cube/cube.cpp @@ -106,7 +106,9 @@ void TestGLCanvas::OnPaint( wxPaintEvent& event ) // OnPaint handlers must always create a wxPaintDC. wxPaintDC dc(this); +#ifndef __WXMOTIF__ if (!GetContext()) return; +#endif SetCurrent(); @@ -155,7 +157,9 @@ void TestGLCanvas::OnSize(wxSizeEvent& event) int width, height; GetClientSize(& width, & height); +#ifndef __WXMOTIF__ if (GetContext()) +#endif { SetCurrent(); glViewport(0, 0, width, height); diff --git a/utils/glcanvas/samples/isosurf/isosurf.cpp b/utils/glcanvas/samples/isosurf/isosurf.cpp index 31b49e3b51..f16ea041c8 100644 --- a/utils/glcanvas/samples/isosurf/isosurf.cpp +++ b/utils/glcanvas/samples/isosurf/isosurf.cpp @@ -255,13 +255,13 @@ bool MyApp::OnInit(void) #endif if(!doubleBuffer -#ifdef __X__ // JACS +#ifdef __WXGTK__ // JACS || !wxGLCanvas::HaveVisual(gl_attrib) #endif ) { printf("don't have double buffer, disabling\n"); -#ifndef __WXMSW__ +#ifdef __WXGTK__ gl_attrib[9] = None; #endif doubleBuffer = GL_FALSE; -- 2.45.2