From: Julian Smart Date: Fri, 10 Mar 2000 11:18:22 +0000 (+0000) Subject: Small fixes for Tex2RTF but alas, we still get memory problems. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3f8e5072f7391db2158f44c6b9209bbb3db6eb06 Small fixes for Tex2RTF but alas, we still get memory problems. Added wxUSE_MFC setting (doesn't include windows.h, removes own memory tracing); added include in case where PCH isn't used; wxExit now exits :-) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/ilayout.tex b/docs/latex/wx/ilayout.tex index 9bbe08e3d9..6f88daa94b 100644 --- a/docs/latex/wx/ilayout.tex +++ b/docs/latex/wx/ilayout.tex @@ -1,6 +1,6 @@ \section{\class{wxIndividualLayoutConstraint}}\label{wxindividuallayoutconstraint} -Objects of this class are stored in the wxIndividualLayoutConstraint class +Objects of this class are stored in the wxLayoutConstraint class as one of eight possible constraints that a window can be involved in. Constraints are initially set to have the relationship wxUnconstrained, @@ -105,7 +105,7 @@ optional margin. Implicitly, this is relative to the left edge of the other wind \membersection{wxIndividualLayoutConstraint::PercentOf} -\func{void}{PercentOf}{\param{wxWindow *}{otherWin}, \param{wxEdge}{ edge}, \param{int}{ margin = 0}} +\func{void}{PercentOf}{\param{wxWindow *}{otherWin}, \param{wxEdge}{ edge}, \param{int}{ per}} Constrains this edge or dimension to be to a percentage of the given window, with an optional margin. diff --git a/include/wx/defs.h b/include/wx/defs.h index 0e5280b83f..bd68bd9699 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1228,11 +1228,6 @@ enum wxStretch // id for a separator line in the menu (invalid for normal item) #define wxID_SEPARATOR (-1) -// this one is for compatibility only, don't use in new code -#ifndef ID_SEPARATOR - #define ID_SEPARATOR wxID_SEPARATOR -#endif - // Standard menu IDs #define wxID_LOWEST 4999 diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 4c08a48dc6..869c5ba0ab 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -428,6 +428,9 @@ * */ +// Make settings compatible with MFC +#define wxUSE_MFC 0 + #define wxUSE_OLE 1 // drag-and-drop, clipboard, OLE Automation @@ -510,6 +513,19 @@ #define wxUSE_DEBUG_NEW_ALWAYS 0 #endif +// MFC duplicates these operators +#if wxUSE_MFC +#undef wxUSE_GLOBAL_MEMORY_OPERATORS +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +#ifndef _MBCS +// #define _MBCS +#endif +#endif + #if (!defined(WIN32) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) // Can't use OLE drag and drop in Windows 3.1 because we don't know how // to implement UUIDs diff --git a/include/wx/wxprec.h b/include/wx/wxprec.h index 6f28387b89..a1a2a865e0 100644 --- a/include/wx/wxprec.h +++ b/include/wx/wxprec.h @@ -28,7 +28,7 @@ #ifdef WX_PRECOMP // include standard Windows headers -#ifdef __WXMSW__ +#if defined(__WXMSW__) && !wxUSE_MFC #include #include "wx/msw/winundef.h" #endif diff --git a/samples/mfc/mfctest.cpp b/samples/mfc/mfctest.cpp index 91ed30dbdc..ab1e42de2e 100644 --- a/samples/mfc/mfctest.cpp +++ b/samples/mfc/mfctest.cpp @@ -26,14 +26,26 @@ // initially as the main frame, and allows wxWindows frames to be // created subsequently: // -// (1) Make MyApp::OnInit return NULL, not create a window. +// (1) Make MyApp::OnInit return FALSE, not creating a window. // (2) Restore the MFC code to create a window in InitInstance, and remove // creation of CDummyWindow. // -// IMPORTANT NOTE: to compile this sample, you must first edit -// wx/src/msw/wx_main.cc, set NOWINMAIN to 1, and remake wxWindows -// (it only needs to recompile wx_main.cc). -// This eliminates the duplicate WinMain function which MFC implements. +// IMPORTANT NOTES: +// +// (1) You need to set wxUSE_MFC to 1 in include/wx/msw/setup.h, which switches +// off some debugging features and also removes the windows.h inclusion +// in wxprec.h (MFC headers don't like this to have been included previously). +// Then recompile wxWindows and this sample. +// +// (2) 10/3/2000, wxWindows 2.1.14: unfortunately there is an assert when +// the sample tries to create an MFC window. Any suggestions welcome. It may be +// a problem with conflicting project settings. Ignoring the assert (several times) +// allows the sample to continue. In release mode the asserts don't happen. +// +// (3) I can't get the sample to link using a static MFC library, only the DLL +// version. Perhaps someone else is a wizard at working out the required settings +// in the wxWin library and the sample; then debugging the assert problem may be +// easier. // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -331,14 +343,13 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) { wxClientDC dc(this); dc.SetPen(* wxBLACK_PEN); - long x, y; - event.Position(&x, &y); + wxPoint pos = event.GetPosition(); if (xpos > -1 && ypos > -1 && event.Dragging()) { - dc.DrawLine(xpos, ypos, x, y); + dc.DrawLine(xpos, ypos, pos.x, pos.y); } - xpos = x; - ypos = y; + xpos = pos.x; + ypos = pos.y; } BEGIN_EVENT_TABLE(MyChild, wxFrame) diff --git a/src/common/tokenzr.cpp b/src/common/tokenzr.cpp index 64f49e5822..b6272da149 100644 --- a/src/common/tokenzr.cpp +++ b/src/common/tokenzr.cpp @@ -30,6 +30,9 @@ #include "wx/tokenzr.h" +// Required for wxIs... functions +#include + // ============================================================================ // implementation // ============================================================================ diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 196891b59a..741a9b7ae2 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -52,6 +52,9 @@ #include "wx/grid.h" #include "wx/generic/gridsel.h" +// Required for wxIs... functions +#include + // ---------------------------------------------------------------------------- // array classes // ---------------------------------------------------------------------------- diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 42f473f2f5..7b445e7df2 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -1199,6 +1199,7 @@ void wxExit() wxLogError(_("Fatal error: exiting")); wxApp::CleanUp(); + exit(0); } // Yield to incoming messages @@ -1223,7 +1224,8 @@ bool wxYield() } // If they are pending events, we must process them. - wxTheApp->ProcessPendingEvents(); + if (wxTheApp) + wxTheApp->ProcessPendingEvents(); // let the logs be flashed again wxLog::Resume(); diff --git a/utils/projgen/makeproj.cpp b/utils/projgen/makeproj.cpp index 76827a299f..7c31c2fe9d 100644 --- a/utils/projgen/makeproj.cpp +++ b/utils/projgen/makeproj.cpp @@ -268,8 +268,8 @@ void MyApp::GenerateSamples(const wxString& dir) GenerateSample("ListctrlVC", "listtest", dir + wxString("/samples/listctrl"), wxStringList("listtest.cpp", "listtest.h", 0)); GenerateSample("MdiVC", "mdi", dir + wxString("/samples/mdi"), wxStringList("mdi.cpp", "mdi.h", 0)); GenerateSample("MemcheckVC", "memcheck", dir + wxString("/samples/memcheck"), wxStringList("memcheck.cpp", 0)); - // Note: MFC sample will be different. - GenerateSample("MfcVC", "mfc", dir + wxString("/samples/mfc"), wxStringList("mfctest.cpp", "mfctest.h", 0)); + // Don't always generate this project since it has to be tweaked by hand. + // GenerateSample("MfcVC", "mfctest", dir + wxString("/samples/mfc"), wxStringList("mfctest.cpp", "mfctest.h", 0)); GenerateSample("MiniframVC", "test", dir + wxString("/samples/minifram"), wxStringList("test.cpp", "test.h", 0)); GenerateSample("MinimalVC", "minimal", dir + wxString("/samples/minimal"), wxStringList("minimal.cpp", 0)); GenerateSample("NativdlgVC", "nativdlg", dir + wxString("/samples/nativdlg"), wxStringList("nativdlg.cpp", "nativdlg.h", "resource.h", 0)); diff --git a/utils/tex2rtf/src/tex2rtf.cpp b/utils/tex2rtf/src/tex2rtf.cpp index 5b1bf16c67..fd069479dc 100644 --- a/utils/tex2rtf/src/tex2rtf.cpp +++ b/utils/tex2rtf/src/tex2rtf.cpp @@ -241,6 +241,7 @@ bool MyApp::OnInit() else { OnError("Incorrect argument for -charset"); + return FALSE; } } } @@ -254,6 +255,7 @@ bool MyApp::OnInit() ShowOptions(); exit(1); #endif + return FALSE; } } @@ -854,7 +856,7 @@ void OnError(char *msg) cerr << "Error: " << msg << "\n"; cerr.flush(); #else - if (isInteractive) + if (isInteractive && frame) (*frame->textWindow) << "Error: " << msg << "\n"; else #ifdef __UNIX__ @@ -876,7 +878,7 @@ void OnInform(char *msg) cout << msg << "\n"; cout.flush(); #else - if (isInteractive) + if (isInteractive && frame) (*frame->textWindow) << msg << "\n"; else #ifdef __WXMSW__ diff --git a/utils/tex2rtf/src/tex2rtf.ini b/utils/tex2rtf/src/tex2rtf.ini index 48800d37db..414eed45fa 100644 --- a/utils/tex2rtf/src/tex2rtf.ini +++ b/utils/tex2rtf/src/tex2rtf.ini @@ -1,17 +1,22 @@ +; Tex2RTF initialisation file runTwice = yes titleFontSize = 12 authorFontSize = 10 chapterFontSize = 12 sectionFontSize = 12 subsectionFontSize = 12 -; RTF only headerRule = yes footerRule = yes useHeadingStyles = yes +contentsDepth = 2 listItemIndent=40 -truncateFilenames = FALSE winHelpContents = yes -winHelpVersion = 4 ; 3 for Windows 3.x, 4 for Windows 95 -generateHPJ = true -\overview [2] { \image{}{books.bmp}\helpref{#1}{#2}} -; Some stuff \ No newline at end of file +winHelpVersion = 3 ; 3 for Windows 3.x, 4 for Windows 95 +generateHPJ = no +htmlBrowseButtons = bitmap +winHelpTitle = "Help Demo Document" +truncateFilenames = yes +combineSubSections = yes +htmlIndex = yes +htmlFrameContents = no +htmlWorkshopFiles = yes diff --git a/utils/tex2rtf/src/texutils.cpp b/utils/tex2rtf/src/texutils.cpp index 5746339422..eec52b6db1 100644 --- a/utils/tex2rtf/src/texutils.cpp +++ b/utils/tex2rtf/src/texutils.cpp @@ -1569,7 +1569,8 @@ void Tex2RTFYield(bool force) yieldCount = 0; if (yieldCount == 0) { - wxYield(); + if (wxTheApp) + wxYield(); yieldCount = 10; } yieldCount --;