From 5dcf05ae082a2da39102dec13ab3ad4c483221c8 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 11 Dec 1998 16:09:06 +0000 Subject: [PATCH] Some stubs includes removed from wxMotif; wxNotebook sample hack to make it display; changes to defs.h and memory.h etc. for Solaris compilation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/motif/install.txt | 6 +++++- docs/symbols.txt | 2 +- include/wx/defs.h | 11 +++++++++++ include/wx/memory.h | 12 ++++++++++-- include/wx/object.h | 5 ++++- samples/notebook/test.cpp | 9 ++++++++- src/common/memory.cpp | 6 +++--- src/common/object.cpp | 2 +- src/generic/helpext.cpp | 24 ++++++++++++------------ src/make.env | 2 +- src/motif/colordlg.cpp | 2 +- src/motif/dialog.cpp | 2 +- src/motif/fontdlg.cpp | 2 +- src/motif/helpxxxx.cpp | 2 +- src/motif/imaglist.cpp | 2 +- src/motif/listctrl.cpp | 4 ++-- src/motif/metafile.cpp | 2 +- src/motif/msgdlg.cpp | 2 +- src/motif/notebook.cpp | 10 ++++++++++ src/motif/print.cpp | 4 ++-- src/motif/printdlg.cpp | 2 +- src/motif/statusbr.cpp | 2 +- src/motif/treectrl.cpp | 4 ++-- src/motif/utils.cpp | 10 +++++++--- src/motif/utilsexc.cpp | 4 ++-- src/motif/wave.cpp | 2 +- src/msw/ole/automtn.cpp | 4 ++++ src/stubs/metafile.cpp | 2 +- 28 files changed, 96 insertions(+), 45 deletions(-) diff --git a/docs/motif/install.txt b/docs/motif/install.txt index 9d6bd53a91..a70b5c6f79 100644 --- a/docs/motif/install.txt +++ b/docs/motif/install.txt @@ -15,7 +15,11 @@ wxWindows 2.0 for Motif installation - Edit src/make.env to change options according to your local environment. In particular, change WXDIR to where wxWindows is - found on your system. + found on your system, or set the WXWIN environment variable + before compilation, e.g.: + + export WXWIN=/home/jacs/wx2 + Later, there will be a better makefile system and/or alternate make.env files as per wxWindows 1.68. Please feel free to contribute settings files for your environment. diff --git a/docs/symbols.txt b/docs/symbols.txt index e0ec59f648..c92794bd71 100644 --- a/docs/symbols.txt +++ b/docs/symbols.txt @@ -50,7 +50,7 @@ __BORLANDC__ Borland C++ __WATCOMC__ Watcom C++ __SYMANTECC__ Symantec C++ __VISUALC__ VC++ -__SUNCC__ +__SUNCC__ Sun CC __XLC__ ?? compiler wxWindows modes: diff --git a/include/wx/defs.h b/include/wx/defs.h index 41cef19c96..cc731991c3 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -41,6 +41,14 @@ #endif #endif +#if defined(sun) || defined(__SUN__) +# if !defined(__GNUG__) +# ifndef __SUNCC__ +# define __SUNCC__ +# endif +# endif +#endif + // suppress some Visual C++ warnings #ifdef _MSC_VER # pragma warning(disable:4244) // cobversion from double to float @@ -114,6 +122,9 @@ #define bool unsigned int #elif defined(__BORLANDC__) && (__BORLANDC__ < 0x500) typedef unsigned int bool; +#elif defined(__SUNCC__) + // If we use int, we get identically overloaded functions in config.cpp + typedef unsigned char bool; #endif #if ( defined(_MSC_VER) && (_MSC_VER <= 800) ) || defined(__GNUWIN32__) diff --git a/include/wx/memory.h b/include/wx/memory.h index 664db4e288..8f4d7a1270 100644 --- a/include/wx/memory.h +++ b/include/wx/memory.h @@ -53,17 +53,25 @@ void wxDebugFree(void * buf, bool isVect = FALSE); #undef new #endif +#if defined(__SUNCC__) +#define wxUSE_ARRAY_MEMORY_OPERATORS 0 +#elif !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) || defined( __MWERKS__) +#define wxUSE_ARRAY_MEMORY_OPERATORS 1 +#else +#define wxUSE_ARRAY_MEMORY_OPERATORS 0 +#endif + // Added JACS 25/11/98: needed for some compilers void * operator new (size_t size); -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) || defined( __MWERKS__) +#if wxUSE_ARRAY_MEMORY_OPERATORS void * operator new[] (size_t size); #endif void * operator new (size_t size, char * fileName, int lineNum); void operator delete (void * buf); -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) || defined( __MWERKS__) +#if wxUSE_ARRAY_MEMORY_OPERATORS void * operator new[] (size_t size, char * fileName, int lineNum); void operator delete[] (void * buf); #endif diff --git a/include/wx/object.h b/include/wx/object.h index b8051a90a3..df3a08ca97 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -197,15 +197,18 @@ class WXDLLEXPORT wxObject #endif // Cause problems for VC++ -#ifndef _MSC_VER +// #ifndef _MSC_VER +#if !defined(_MSC_VER) && wxUSE_ARRAY_MEMORY_OPERATORS void * operator new[] (size_t size, char * fileName = NULL, int lineNum = 0); void operator delete[] (void * buf); #endif +/* #ifdef __MWERKS__ void * operator new[] (size_t size, char * fileName , int lineNum = 0); void operator delete[] (void * buf); #endif +*/ #endif diff --git a/samples/notebook/test.cpp b/samples/notebook/test.cpp index e9867c144c..feffe3ee58 100644 --- a/samples/notebook/test.cpp +++ b/samples/notebook/test.cpp @@ -44,6 +44,13 @@ bool MyApp::OnInit(void) #else frame = new MyFrame((wxFrame*) NULL, -1, (char *) "Notebook", wxPoint(-1, -1), wxSize(365, 390), wxDEFAULT_FRAME_STYLE); + // Problem with Motif whereby it doesn't size properly unless + // you set the size again (to a different size than before, + // since SetSize is optimized) +#ifdef __WXMOTIF__ + frame->SetSize(-1, -1, 370, 390); +#endif + return TRUE; #endif } @@ -82,7 +89,7 @@ void MyApp::InitTabView(wxNotebook* notebook, wxWindow* window) (void)new wxButton(panel1, -1, "Press me", wxPoint(10, 10)); (void)new wxTextCtrl(panel1, -1, "1234", wxPoint(10, 40), wxSize(120, 150)); - notebook->AddPage(panel1, "Cat"); + notebook->AddPage(panel1, "Cat", TRUE); wxPanel *panel2 = new wxPanel(notebook, -1); panel2->SetBackgroundColour(wxColour("BLUE")); diff --git a/src/common/memory.cpp b/src/common/memory.cpp index 3f8ea5028d..ee71e7fd3a 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -965,7 +965,7 @@ void * operator new (size_t size) #endif } -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) +#if wxUSE_ARRAY_MEMORY_OPERATORS void * operator new[] (size_t size) { #ifdef NO_DEBUG_ALLOCATION @@ -976,7 +976,7 @@ void * operator new[] (size_t size) } #endif -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) +#if wxUSE_ARRAY_MEMORY_OPERATORS void * operator new[] (size_t size, char * fileName, int lineNum) { #ifdef NO_DEBUG_ALLOCATION @@ -1011,7 +1011,7 @@ void operator delete[](void* pData, char* /* fileName */, int /* lineNum */) } #endif -#if !( defined (_MSC_VER) && (_MSC_VER <= 1020) ) +#if wxUSE_ARRAY_MEMORY_OPERATORS void operator delete[] (void * buf) { diff --git a/src/common/object.cpp b/src/common/object.cpp index 15e3f0fec0..decda33776 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -125,7 +125,7 @@ void wxObject::operator delete(void* pData, char* /* fileName */, int /* lineNum #endif // Cause problems for VC++ - crashes -#ifndef _MSC_VER +#if !defined(_MSC_VER) && wxUSE_ARRAY_MEMORY_OPERATORS void * wxObject::operator new[] (size_t size, char * fileName, int lineNum) { return wxDebugAlloc(size, fileName, lineNum, TRUE, TRUE); diff --git a/src/generic/helpext.cpp b/src/generic/helpext.cpp index a785361d42..41448949d2 100644 --- a/src/generic/helpext.cpp +++ b/src/generic/helpext.cpp @@ -127,7 +127,7 @@ wxExtHelpController::LoadFile(const wxString& ifile) file = ifile; if(! wxDirExists(file)) - return false; + return FALSE; mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE; } @@ -135,7 +135,7 @@ wxExtHelpController::LoadFile(const wxString& ifile) mapFile = m_MapFile; if(! wxFileExists(mapFile)) - return false; + return FALSE; DeleteList(); m_MapList = new wxList; @@ -143,7 +143,7 @@ wxExtHelpController::LoadFile(const wxString& ifile) FILE *input = fopen(mapFile.c_str(),"rt"); if(! input) - return false; + return FALSE; do { if(fgets(buffer,WXEXTHELP_BUFLEN,input) && *buffer != WXEXTHELP_COMMENTCHAR) @@ -171,7 +171,7 @@ wxExtHelpController::LoadFile(const wxString& ifile) fclose(input); m_MapFile = file; // now it's valid - return true; + return TRUE; } bool @@ -196,7 +196,7 @@ wxExtHelpController::CallBrowser(wxString const &relativeURL) << WXEXTHELP_SEPARATOR << relativeURL << ")"; success = wxExecute(command); if(success != 0 ) // returns PID on success - return true; + return TRUE; } } command = m_BrowserName; @@ -209,7 +209,7 @@ bool wxExtHelpController::DisplayContents(void) { if(! m_NumOfEntries) - return false; + return FALSE; wxBusyCursor b; // display a busy cursor return KeywordSearch(""); } @@ -218,7 +218,7 @@ bool wxExtHelpController::DisplaySection(int sectionNo) { if(! m_NumOfEntries) - return false; + return FALSE; wxBusyCursor b; // display a busy cursor wxNode *node = m_MapList->First(); @@ -230,7 +230,7 @@ wxExtHelpController::DisplaySection(int sectionNo) return CallBrowser(entry->url); node = node->Next(); } - return false; + return FALSE; } bool @@ -243,7 +243,7 @@ bool wxExtHelpController::KeywordSearch(const wxString& k) { if(! m_NumOfEntries) - return false; + return FALSE; wxBusyCursor b; // display a busy cursor wxString *choices = new wxString[m_NumOfEntries]; @@ -282,7 +282,7 @@ wxExtHelpController::KeywordSearch(const wxString& k) else if(idx == 0) { wxMessageBox(_("No entries found.")); - rc = false; + rc = FALSE; } else { @@ -292,7 +292,7 @@ wxExtHelpController::KeywordSearch(const wxString& k) if(idx != -1) rc = CallBrowser(urls[idx]); else - rc = false; + rc = FALSE; } delete[] urls; delete[] choices; @@ -304,7 +304,7 @@ wxExtHelpController::KeywordSearch(const wxString& k) bool wxExtHelpController::Quit(void) { - return true; + return TRUE; } void diff --git a/src/make.env b/src/make.env index 465773788c..8ed42b1152 100644 --- a/src/make.env +++ b/src/make.env @@ -8,7 +8,7 @@ ########################### Programs ################################# # Replace this with your own path if necessary -WXDIR = $(wx) +WXDIR = $(WXWIN) # C++ compiler CC = g++ diff --git a/src/motif/colordlg.cpp b/src/motif/colordlg.cpp index 784dc7650a..9326ffd42b 100644 --- a/src/motif/colordlg.cpp +++ b/src/motif/colordlg.cpp @@ -14,7 +14,7 @@ #pragma implementation "colordlg.h" #endif -#include "wx/stubs/colordlg.h" +#include "wx/motif/colordlg.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index b76fe887a8..90258bd2af 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -478,7 +478,7 @@ int wxDialog::ShowModal() XEvent event; // Loop until we signal that the dialog should be closed - while ((wxModalShowingStack.Number() > 0) && (bool)wxModalShowingStack.First()->Data()) + while ((wxModalShowingStack.Number() > 0) && ((int)(wxModalShowingStack.First()->Data()) != 0)) { // XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll); diff --git a/src/motif/fontdlg.cpp b/src/motif/fontdlg.cpp index 66da67ae20..f7ebeed956 100644 --- a/src/motif/fontdlg.cpp +++ b/src/motif/fontdlg.cpp @@ -14,7 +14,7 @@ #pragma implementation "fontdlg.h" #endif -#include "wx/stubs/fontdlg.h" +#include "wx/motif/fontdlg.h" #include "wx/cmndata.h" #if !USE_SHARED_LIBRARY diff --git a/src/motif/helpxxxx.cpp b/src/motif/helpxxxx.cpp index 0214bc2073..439c9acde3 100644 --- a/src/motif/helpxxxx.cpp +++ b/src/motif/helpxxxx.cpp @@ -13,7 +13,7 @@ #pragma implementation "helpxxxx.h" #endif -#include "wx/stubs/helpxxxx.h" +#include "wx/motif/helpxxxx.h" #include diff --git a/src/motif/imaglist.cpp b/src/motif/imaglist.cpp index 81ec05178a..c1ba3ce5fb 100644 --- a/src/motif/imaglist.cpp +++ b/src/motif/imaglist.cpp @@ -13,7 +13,7 @@ #pragma implementation "imaglist.h" #endif -#include "wx/stubs/imaglist.h" +#include "wx/motif/imaglist.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) diff --git a/src/motif/listctrl.cpp b/src/motif/listctrl.cpp index 02fcd7f0fc..5bfc309eef 100644 --- a/src/motif/listctrl.cpp +++ b/src/motif/listctrl.cpp @@ -13,8 +13,8 @@ #pragma implementation "listctrl.h" #endif -#include "wx/stubs/textctrl.h" -#include "wx/stubs/listctrl.h" +#include "wx/motif/textctrl.h" +#include "wx/motif/listctrl.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl) diff --git a/src/motif/metafile.cpp b/src/motif/metafile.cpp index e084a9a45f..348440fd79 100644 --- a/src/motif/metafile.cpp +++ b/src/motif/metafile.cpp @@ -16,7 +16,7 @@ #include "wx/object.h" #include "wx/string.h" #include "wx/dc.h" -#include "wx/stubs/metafile.h" +#include "wx/motif/metafile.h" #include "wx/clipbrd.h" extern bool wxClipboardIsOpen; diff --git a/src/motif/msgdlg.cpp b/src/motif/msgdlg.cpp index 3bfa6db6dd..2c4a2369e1 100644 --- a/src/motif/msgdlg.cpp +++ b/src/motif/msgdlg.cpp @@ -13,7 +13,7 @@ #pragma implementation "msgdlg.h" #endif -#include "wx/stubs/msgdlg.h" +#include "wx/motif/msgdlg.h" #if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxMessageDialog, wxDialog) diff --git a/src/motif/notebook.cpp b/src/motif/notebook.cpp index ae9e5c7252..4523b93e05 100644 --- a/src/motif/notebook.cpp +++ b/src/motif/notebook.cpp @@ -400,11 +400,21 @@ void wxNotebook::OnIdle(wxIdleEvent& event) { static bool s_bFirstTime = TRUE; if ( s_bFirstTime ) { + /* + wxSize sz(GetSize()); + sz.x ++; + SetSize(sz); + sz.x --; + SetSize(sz); + */ + + /* wxSize sz(GetSize()); wxSizeEvent sizeEvent(sz, GetId()); sizeEvent.SetEventObject(this); GetEventHandler()->ProcessEvent(sizeEvent); Refresh(); + */ s_bFirstTime = FALSE; } event.Skip(); diff --git a/src/motif/print.cpp b/src/motif/print.cpp index 7b8db95a8c..edcfef0548 100644 --- a/src/motif/print.cpp +++ b/src/motif/print.cpp @@ -13,8 +13,8 @@ #pragma implementation "print.h" #endif -#include "wx/stubs/print.h" -#include "wx/stubs/printdlg.h" +#include "wx/motif/print.h" +#include "wx/motif/printdlg.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxPrinter, wxPrinterBase) diff --git a/src/motif/printdlg.cpp b/src/motif/printdlg.cpp index aa24e6ad64..7136ec67a7 100644 --- a/src/motif/printdlg.cpp +++ b/src/motif/printdlg.cpp @@ -14,7 +14,7 @@ #endif #include "wx/object.h" -#include "wx/stubs/printdlg.h" +#include "wx/motif/printdlg.h" #include "wx/dcprint.h" // Use generic page setup dialog: use your own native one if one exists. diff --git a/src/motif/statusbr.cpp b/src/motif/statusbr.cpp index 9785132368..040c3371f1 100644 --- a/src/motif/statusbr.cpp +++ b/src/motif/statusbr.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#include "wx/stubs/statusbr.h" +#include "wx/motif/statusbr.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxStatusBarXX, wxStatusBar); diff --git a/src/motif/treectrl.cpp b/src/motif/treectrl.cpp index 45299b9375..97805939c7 100644 --- a/src/motif/treectrl.cpp +++ b/src/motif/treectrl.cpp @@ -13,8 +13,8 @@ #pragma implementation "treectrl.h" #endif -#include "wx/stubs/textctrl.h" -#include "wx/stubs/treectrl.h" +#include "wx/motif/textctrl.h" +#include "wx/motif/treectrl.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl) diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index 29f7b5488a..cf188f5c4f 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -34,10 +34,14 @@ #include #include -#ifdef __SVR4__ +#if defined(__SVR4__) && !defined(__HPUX__) #include #endif +#if (defined(__SUNCC__) || defined(__CLCC__)) +#include +#endif + #include #include "wx/motif/private.h" @@ -57,7 +61,7 @@ extern wxList wxTopLevelWindows; // Get full hostname (eg. DoDo.BSn-Germany.crg.de) bool wxGetHostName(char *buf, int maxSize) { -#if defined(SVR4) && !defined(__hpux) +#if defined(__SVR4__) && !defined(__HPUX__) return (sysinfo (SI_HOSTNAME, buf, maxSize) != -1); #else /* BSD Sockets */ char name[255]; @@ -487,7 +491,7 @@ void wxXMergeDatabases (wxApp * theApp, Display * display) size_t len; environment = GetIniFile (filename, NULL); len = strlen (environment); -#if defined(SVR4) && !defined(__hpux) +#if defined(__SVR4__) && !defined(__HPUX__) (void) sysinfo (SI_HOSTNAME, environment + len, 1024 - len); #else (void) gethostname (environment + len, 1024 - len); diff --git a/src/motif/utilsexc.cpp b/src/motif/utilsexc.cpp index a748ea126e..05e0fb5ef7 100644 --- a/src/motif/utilsexc.cpp +++ b/src/motif/utilsexc.cpp @@ -36,11 +36,11 @@ #else -#if defined(_AIX) || defined(__xlC__) +#if defined(__AIX__) || defined(__xlC__) #include #include #else -#ifndef DG +#ifndef __DATA_GENERAL__ #include #endif #endif diff --git a/src/motif/wave.cpp b/src/motif/wave.cpp index 177586f130..5368adbdd0 100644 --- a/src/motif/wave.cpp +++ b/src/motif/wave.cpp @@ -15,7 +15,7 @@ #include "wx/object.h" #include "wx/string.h" -#include "wx/stubs/wave.h" +#include "wx/motif/wave.h" wxWave::wxWave() : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE) diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index 2d94102905..44207bb733 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -680,6 +680,10 @@ bool wxAutomationObject::ConvertOleToVariant(const VARIANTARG& oleVariant, wxVar variant.MakeNull(); break; } + case VT_EMPTY: + { + break; // Ignore Empty Variant, used only during destruction of objects + } default: { wxLogError("wxAutomationObject::ConvertOleToVariant: Unknown variant value type"); diff --git a/src/stubs/metafile.cpp b/src/stubs/metafile.cpp index 251c855970..a92874b336 100644 --- a/src/stubs/metafile.cpp +++ b/src/stubs/metafile.cpp @@ -52,7 +52,7 @@ bool wxMetaFile::SetClipboard(int width, int height) bool wxMetaFile::Play(wxDC *dc) { // TODO - return false; + return FALSE; } /* -- 2.45.2