From f57fe24c6389876d7ddf02aa7a09f3b48a6956de Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 15 Nov 1998 21:53:27 +0000 Subject: [PATCH] Fix to parser.y to make it compile with makefile.unx; wxFileConfig adds a / to user path if necessary; OGL sample cleans itself up; wxLog fixes in app.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1002 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/motif/todo.txt | 10 ++++++++++ include/wx/motif/mdi.h | 11 ++++++++--- include/wx/motif/setup.h | 5 +++++ src/common/fileconf.cpp | 3 +++ src/common/parser.y | 2 +- src/common/timercmn.cpp | 6 +++--- src/makeprog.env | 2 +- src/motif/app.cpp | 11 ++++++++++- src/motif/makefile.unx | 2 +- src/motif/window.cpp | 24 ++++++++++++++++++++++++ src/msw/app.cpp | 7 +++++++ src/msw/utils.cpp | 4 ---- utils/ogl/samples/ogledit/ogledit.cpp | 13 ++++++++++--- utils/ogl/samples/ogledit/ogledit.h | 2 ++ 14 files changed, 85 insertions(+), 17 deletions(-) diff --git a/docs/motif/todo.txt b/docs/motif/todo.txt index e717d2aa19..1043abd94c 100644 --- a/docs/motif/todo.txt +++ b/docs/motif/todo.txt @@ -53,6 +53,16 @@ High Priority - wxGrid: scrollbars don't hide; problem with cell selection. +- MDI: seems to be broken for a more complex application I'm testing. + Frame decorations don't draw properly, and a child window doesn't + process events properly. So probably we should have an alternative + implementation that uses tabs, a la wxGTK. The system menu could + be implemented using a pop-up menu that applies to the currently + active window. + +- Controls in a wxToolBar don't work. Probably due to form layout + problems; the workaround is to use a separate panel for controls. + - Miscellaneous events. - Write makefiles for all samples and utilities. diff --git a/include/wx/motif/mdi.h b/include/wx/motif/mdi.h index bcffddeb6b..b843dc4e60 100644 --- a/include/wx/motif/mdi.h +++ b/include/wx/motif/mdi.h @@ -1,8 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: mdi.h // Purpose: MDI (Multiple Document Interface) classes. -// This doesn't have to be implemented just like Windows, -// it could be a tabbed design as in wxGTK. // Author: Julian Smart // Modified by: // Created: 17/09/98 @@ -26,8 +24,10 @@ WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr; class WXDLLEXPORT wxMDIClientWindow; class WXDLLEXPORT wxMDIChildFrame; +#if wxUSE_MDI_WIDGETS class XsMDICanvas; class wxXsMDIWindow; +#endif class WXDLLEXPORT wxMDIParentFrame: public wxFrame { @@ -147,7 +147,9 @@ public: bool Show(bool show); void BuildClientArea(WXWidget parent); inline WXWidget GetTopWidget() const { return m_mainWidget; }; +#if wxUSE_MDI_WIDGETS inline wxXsMDIWindow *GetMDIWindow() const { return m_mdiWindow; }; +#endif virtual void OnRaise(); virtual void OnLower(); @@ -189,14 +191,17 @@ class WXDLLEXPORT wxMDIClientWindow: public wxWindow // Explicitly call default scroll behaviour void OnScroll(wxScrollEvent& event); +#if wxUSE_MDI_WIDGETS inline XsMDICanvas* GetMDICanvas() const { return m_mdiCanvas; } - WXWidget GetTopWidget() const { return m_topWidget; } +#endif protected: +#if wxUSE_MDI_WIDGETS XsMDICanvas* m_mdiCanvas; WXWidget m_topWidget; +#endif DECLARE_EVENT_TABLE() }; diff --git a/include/wx/motif/setup.h b/include/wx/motif/setup.h index b69937aca0..8b9f9762e5 100644 --- a/include/wx/motif/setup.h +++ b/include/wx/motif/setup.h @@ -117,6 +117,11 @@ #define wxUSE_GADGETS 0 // Use gadgets where possible +#define wxUSE_MDI_WIDGETS 1 + // Use Scott Sadler's MDI widgets (buggy). + // If 0, uses normal frames. + + /* * Finer detail * diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index cb7ca2fa10..873515cc50 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -114,6 +114,9 @@ wxString wxFileConfig::GetLocalDir() wxGetHomeDir(&strDir); + if (strDir.Last() != '/' && strDir.Last() != '\\') + strDir += "/"; + return strDir; } diff --git a/src/common/parser.y b/src/common/parser.y index 243a49feb7..3973c3948c 100644 --- a/src/common/parser.y +++ b/src/common/parser.y @@ -124,7 +124,7 @@ arg1 : WORD %% -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if (defined(__WXGTK__) || defined(__WXMOTIF__)) && !defined(NO_CONFIGURE) #include "lexer.c" #else #include "../common/lex_yy.c" diff --git a/src/common/timercmn.cpp b/src/common/timercmn.cpp index f25a817409..93e8beb8cc 100644 --- a/src/common/timercmn.cpp +++ b/src/common/timercmn.cpp @@ -70,7 +70,7 @@ void wxStartTimer(void) { #if defined(__xlC__) || defined(__AIX__) || defined(__SVR4__) || defined(__SYSV__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) // || defined(__AIXV3__) struct timeval tp; -#ifdef __SYSV__ +#if defined(__SYSV__) || (defined (__GNUWIN32__) && !defined (__MINGW32__)) gettimeofday(&tp, (struct timezone *)NULL); #else gettimeofday(&tp); @@ -94,7 +94,7 @@ long wxGetElapsedTime(bool resetTimer) { #if defined(__xlC__) || defined(__AIX__) || defined(__SVR4__) || defined(__SYSV__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) // || defined(__AIXV3__) struct timeval tp; -#ifdef __SYSV__ +#if defined(__SYSV__) || (defined (__GNUWIN32__) && !defined (__MINGW32__)) gettimeofday(&tp, (struct timezone *)NULL); #else gettimeofday(&tp); @@ -190,7 +190,7 @@ long wxGetCurrentTime(void) { #if defined(__xlC__) || defined(__AIX__) || defined(__SVR4__) || defined(__SYSV__) // || defined(__AIXV3__) struct timeval tp; -#ifdef __SYSV__ +#if defined(__SYSV__) || (defined (__GNUWIN32__) && !defined (__MINGW32__)) gettimeofday(&tp, (struct timezone *)NULL); #else gettimeofday(&tp); diff --git a/src/makeprog.env b/src/makeprog.env index 8a1ee6de2b..8f3c8ad371 100644 --- a/src/makeprog.env +++ b/src/makeprog.env @@ -8,4 +8,4 @@ $(PROGRAM)$(GUISUFFIX): $(OBJECTS) $(WXLIB) $(CC) $(LDFLAGS) -o $(PROGRAM)$(GUISUFFIX) $(OBJECTS) $(LDLIBS) clean: - rm -f $(OBJECTS) minimal$(GUISUFFIX) core + rm -f $(OBJECTS) $(PROGRAM)$(GUISUFFIX) core diff --git a/src/motif/app.cpp b/src/motif/app.cpp index 8c006f4e9a..79e667aa01 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -197,6 +197,14 @@ int wxEntry( int argc, char *argv[] ) if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun(); + // flush the logged messages if any + wxLog *pLog = wxLog::GetActiveTarget(); + if ( pLog != NULL && pLog->HasPendingMessages() ) + pLog->Flush(); + + delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used + // for further messages + if (wxTheApp->GetTopWindow()) { delete wxTheApp->GetTopWindow(); @@ -206,6 +214,7 @@ int wxEntry( int argc, char *argv[] ) wxTheApp->DeletePendingObjects(); wxTheApp->OnExit(); + wxApp::CleanUp(); @@ -294,7 +303,7 @@ void wxApp::ProcessXEvent(WXEvent* _event) { XEvent* event = (XEvent*) _event; - if (CheckForAccelerator(_event)) + if ((event->type == KeyPress) && CheckForAccelerator(_event)) { // Do nothing! We intercepted and processed the event as an accelerator. return; diff --git a/src/motif/makefile.unx b/src/motif/makefile.unx index 05383b11ed..066a208ce4 100644 --- a/src/motif/makefile.unx +++ b/src/motif/makefile.unx @@ -198,7 +198,7 @@ $(WXLIB) : $(OBJECTS) $(RANLIB) $@ ../common/y_tab.$(OBJSUFF): ../common/y_tab.c ../common/lex_yy.c - $(CCLEX) -c $(CFLAGS) -o $@ ../common/y_tab.c + $(CCLEX) -c $(CFLAGS) -DNO_CONFIGURE -o $@ ../common/y_tab.c # Replace lex with flex if you run into compilation # problems with lex_yy.c. See also note about LEX_SCANNER diff --git a/src/motif/window.cpp b/src/motif/window.cpp index dc47a226d6..618603b721 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -2217,6 +2217,30 @@ void wxCanvasInputEvent (Widget drawingArea, XtPointer data, XmDrawingAreaCallba local_event = *(cbs->event); // We must keep a copy! + /* + switch (local_event.xany.type) + { + case EnterNotify: + cout << "EnterNotify\n"; + break; + case LeaveNotify: + cout << "LeaveNotify\n"; + break; + case ButtonPress: + cout << "ButtonPress\n"; + break; + case ButtonRelease: + cout << "ButtonRelease\n"; + break; + case MotionNotify: + cout << "MotionNotify\n"; + break; + default: + cout << "Something else\n"; + break; + } + */ + switch (local_event.xany.type) { case EnterNotify: diff --git a/src/msw/app.cpp b/src/msw/app.cpp index e67b404eed..a38890a323 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -568,6 +568,13 @@ int wxEntry(WXHINSTANCE hInstance, } wxTheApp->OnExit(); + + // flush the logged messages if any + wxLog *pLog = wxLog::GetActiveTarget(); + if ( pLog != NULL && pLog->HasPendingMessages() ) + pLog->Flush(); + + wxApp::CleanUp(); delete wxTheApp; diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 447b3be632..907a17eeea 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -40,10 +40,6 @@ #ifdef __GNUWIN32__ #include #include -#ifndef __MINGW32__ -#include -#endif //MINGW32 - #endif //GNUWIN32 #include "wx/log.h" diff --git a/utils/ogl/samples/ogledit/ogledit.cpp b/utils/ogl/samples/ogledit/ogledit.cpp index c10fa51ee0..f58c265293 100644 --- a/utils/ogl/samples/ogledit/ogledit.cpp +++ b/utils/ogl/samples/ogledit/ogledit.cpp @@ -44,6 +44,7 @@ IMPLEMENT_APP(MyApp) MyApp::MyApp(void) { frame = NULL; + myDocManager= NULL; } // The `main program' equivalent, creating the windows and returning the @@ -53,7 +54,7 @@ bool MyApp::OnInit(void) wxOGLInitialize(); //// Create a document manager - wxDocManager *myDocManager = new wxDocManager; + myDocManager = new wxDocManager; //// Create a template relating drawing documents to their views (void) new wxDocTemplate(myDocManager, "Diagram", "*.dia", "", "dia", "Diagram Doc", "Diagram View", @@ -126,6 +127,13 @@ bool MyApp::OnInit(void) return TRUE; } +int MyApp::OnExit(void) +{ + wxOGLCleanUp(); + delete myDocManager; + return 0; +} + /* * This is the top-level window of the application. */ @@ -191,8 +199,7 @@ MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent) // Non-retained canvas MyCanvas *canvas = new MyCanvas(view, parent, -1, wxPoint(0, 0), wxSize(width, height), 0); - wxCursor *cursor = new wxCursor(wxCURSOR_HAND); - canvas->SetCursor(cursor); + canvas->SetCursor(wxCursor(wxCURSOR_HAND)); // Give it scrollbars canvas->SetScrollbars(20, 20, 50, 50); diff --git a/utils/ogl/samples/ogledit/ogledit.h b/utils/ogl/samples/ogledit/ogledit.h index c44195b6a7..3f0408c949 100644 --- a/utils/ogl/samples/ogledit/ogledit.h +++ b/utils/ogl/samples/ogledit/ogledit.h @@ -25,9 +25,11 @@ class MyApp: public wxApp { public: MyFrame *frame; + wxDocManager* myDocManager; MyApp(void); bool OnInit(void); + int OnExit(void); // Palette stuff EditorToolPalette *CreatePalette(wxFrame *parent); -- 2.45.2