Made wxStubs compile on Unix.

Improvements to doc/view on MDI, including multiple menus for wxFileHistory.
Added wxDirExists to wxMSW; moved wxMatchWild to filefn.cpp


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 1998-09-16 21:52:23 +00:00
parent f93ce4dadc
commit 7f555861b7
43 changed files with 1266 additions and 465 deletions

View File

@ -321,15 +321,25 @@ samples/ipc/*.xpm
samples/ipc/*.ico
samples/ipc/*.rc
samples/types/*.cpp
samples/types/*.h
samples/types/*.def
samples/types/*.rc
samples/types/*.txt
samples/types/makefile*
samples/types/*.xbm
samples/types/*.xpm
samples/types/*.ico
samples/typetest/*.cpp
samples/typetest/*.h
samples/typetest/*.def
samples/typetest/*.rc
samples/typetest/*.txt
samples/typetest/makefile*
samples/typetest/*.xbm
samples/typetest/*.xpm
samples/typetest/*.ico
samples/sashtest/*.cpp
samples/sashtest/*.h
samples/sashtest/*.def
samples/sashtest/*.rc
samples/sashtest/*.txt
samples/sashtest/makefile*
samples/sashtest/*.xbm
samples/sashtest/*.xpm
samples/sashtest/*.ico
samples/resource/*.cpp
samples/resource/*.h

View File

@ -12,7 +12,7 @@ and \helpref{wxDocTemplate}{wxdoctemplate} classes.
\wxheading{See also}
\helpref{wxDocManager overview}{wxdocmanageroverview}, \helpref{wxDocument}{wxdocument},\rtfsp
\helpref{wxView}{wxview}, \helpref{wxDocTemplate}{wxdoctemplate}
\helpref{wxView}{wxview}, \helpref{wxDocTemplate}{wxdoctemplate}, \helpref{wxFileHistory}{wxfilehistory}
\latexignore{\rtfignore{\wxheading{Members}}}
@ -139,28 +139,54 @@ of view is presented to the user.
Removes the template from the list of templates.
\membersection{wxDocManager::FileHistoryLoad}
\membersection{wxDocManager::FileHistoryAddFilesToMenu}\label{wxdocmanagerfilehistoryaddfilestomenu}
\func{void}{FileHistoryLoad}{\param{const wxString\& }{resourceFile}, \param{const wxString\& }{sectionName}}
\func{void}{FileHistoryAddFilesToMenu}{\void}
Loads the file history from a resource file, using the given section. This must be called
Appends the files in the history list, to all menus managed by the file history object.
\func{void}{FileHistoryAddFilesToMenu}{\param{wxMenu*}{ menu}}
Appends the files in the history list, to the given menu only.
\membersection{wxDocManager::FileHistoryLoad}\label{wxdocmanagerfilehistoryload}
\func{void}{FileHistoryLoad}{\param{wxConfigBase\& }{config}}
Loads the file history from a config object.
\wxheading{See also}
\helpref{wxConfig}{wxconfigbase}
\membersection{wxDocManager::FileHistoryRemoveMenu}\label{wxdocmanagerfilehistoryremovemenu}
\func{void}{FileHistoryRemoveMenu}{\param{wxMenu*}{ menu}}
Removes the given menu from the list of menus managed by the file history object.
\membersection{wxDocManager::FileHistorySave}\label{wxdocmanagerfilehistorysave}
\func{void}{FileHistorySave}{\param{wxConfigBase\& }{resourceFile}}
Saves the file history into a config object. This must be called
explicitly by the application.
\membersection{wxDocManager::FileHistorySave}
\wxheading{See also}
\func{void}{FileHistorySave}{\param{const wxString\& }{resourceFile}, \param{const wxString\& }{sectionName}}
\helpref{wxConfig}{wxconfigbase}
Saves the file history into a resource file, using the given section. This must be called
explicitly by the application.
\membersection{wxDocManager::FileHistoryUseMenu}\label{wxdocmanagerfilehistoryusemenu}
\membersection{wxDocManager::FileHistoryUseMenu}
\func{void}{FileHistoryUseMenu}{\param{wxMenu *}{menu}}
\func{void}{FileHistoryUseMenu}{\param{wxMenu*}{ menu}}
Use this menu for appending recently-visited document filenames, for convenient
access. Calling this function with a valid menu pointer enables the history
list functionality.
Note that you can add multiple menus using this function, to be managed by the
file history object.
\membersection{wxDocManager::FindTemplateForPath}
\func{wxDocTemplate *}{FindTemplateForPath}{\param{const wxString\& }{path}}

View File

@ -324,4 +324,8 @@ Sets the title for this document. The document title is used for an associated
frame (if any), and is usually constructed by the framework from
the filename.
\membersection{wxDocument::UpdateAllViews}\label{wxdocumentupdateallviews}
\func{void}{UpdateAllViews}{\param{wxView* }{sender = NULL}}
Updates all views. If {\it sender} is non-NULL, does not update this view.

View File

@ -3,13 +3,17 @@
The wxFileHistory encapsulates a user interface convenience, the
list of most recently visited files as shown on a menu (usually the File menu).
wxFileHistory can manage one or more file menus. More than one menu may be required
in an MDI application, where the file history should appear on each MDI child menu
as well as the MDI parent frame.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{See also}
\overview{wxFileHistory overview}{wxfilehistoryoverview}
\helpref{wxFileHistory overview}{wxfilehistoryoverview}, \helpref{wxDocManager}{wxdocmanager}
\latexignore{\rtfignore{\wxheading{Members}}}
@ -56,38 +60,65 @@ Destructor.
Adds a file to the file history list, if the object has a pointer to an appropriate file menu.
\membersection{wxFileHistory::FileHistoryLoad}
\membersection{wxFileHistory::AddFilesToMenu}\label{wxfilehistoryaddfilestomenu}
\func{void}{FileHistoryLoad}{\param{const wxString\& }{resourceFile}, \param{const wxString\& }{sectionName}}
\func{void}{AddFilesToMenu}{\void}
Loads the file history from a resource file, using the given section. This must be called
explicitly by the application.
Appends the files in the history list, to all menus managed by the file history object.
\membersection{wxFileHistory::FileHistorySave}
\func{void}{AddFilesToMenu}{\param{wxMenu*}{ menu}}
\func{void}{FileHistorySave}{\param{const wxString\& }{resourceFile}, \param{const wxString\& }{sectionName}}
Appends the files in the history list, to the given menu only.
Saves the file history into a resource file, using the given section. This must be called
explicitly by the application.
\membersection{wxFileHistory::GetHistoryFile}\label{wxfilehistorygethistoryfile}
\membersection{wxFileHistory::FileHistoryUseMenu}
\constfunc{wxString}{GetHistoryFile}{\param{int}{ index}}
\func{void}{FileHistoryUseMenu}{\param{wxMenu* }{menu}}
Use this menu for appending recently-visited document filenames, for convenient
access. Calling this function with a valid menu pointer enables the history
list functionality.
Returns the file at this index (zero-based).
\membersection{wxFileHistory::GetMaxFiles}
\func{int}{GetMaxFiles}{\void}
\constfunc{int}{GetMaxFiles}{\void}
Returns the maximum number of files that can be stored.
\membersection{wxFileHistory::GetNoHistoryFiles}
\func{int}{GetNoHistoryFiles}{\void}
\constfunc{int}{GetNoHistoryFiles}{\void}
Returns the number of files currently stored in the file history.
\membersection{wxFileHistory::Load}
\func{void}{Load}{\param{wxConfigBase\& }{config}}
Loads the file history from the given config object. This function should be called explicitly by the application.
\wxheading{See also}
\helpref{wxConfig}{wxconfigbase}
\membersection{wxFileHistory::RemoveMenu}
\func{void}{RemoveMenu}{\param{wxMenu* }{menu}}
Removes this menu from the list of those managed by this object.
\membersection{wxFileHistory::Save}
\func{void}{Save}{\param{wxConfigBase\& }{config}}
Saves the file history into the given config object. This must be called
explicitly by the application.
\wxheading{See also}
\helpref{wxConfig}{wxconfigbase}
\membersection{wxFileHistory::UseMenu}
\func{void}{UseMenu}{\param{wxMenu* }{menu}}
Adds this menu to the list of those managed by this object.

View File

@ -525,6 +525,18 @@ Use only after the menubar has been associated with a frame.
\helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop}
\membersection{wxMenuBar::GetMenu}\label{wxmenubargetmenu}
\constfunc{wxMenu*}{GetMenu}{\param{int}{ menuIndex}}
Returns the menu at {\it menuIndex} (zero-based).
\membersection{wxMenuBar::GetMenuCount}\label{wxmenubargetmenucount}
\constfunc{int}{GetMenuCount}{\void}
Returns the number of menus in this menubar.
\membersection{wxMenuBar::IsChecked}\label{wxmenubarischecked}
\constfunc{bool}{IsChecked}{\param{int}{ id}}

View File

@ -39,6 +39,12 @@ Deletes string list, deallocating strings.
Adds string to list, allocating memory.
\membersection{wxStringList::Clear}
\func{void}{Clear}{\void}
Clears all strings from the list.
\membersection{wxStringList::Delete}
\func{void}{Delete}{\param{const wxString\& }{s}}

View File

@ -824,6 +824,7 @@ enum {
#define wxID_PASTE 5032
#define wxID_CLEAR 5033
#define wxID_FIND 5034
#define wxID_DUPLICATE 5035
#define wxID_FILE1 5050
#define wxID_FILE2 5051

View File

@ -34,6 +34,7 @@ class WXDLLEXPORT wxPrintInfo;
class WXDLLEXPORT wxCommand;
class WXDLLEXPORT wxCommandProcessor;
class WXDLLEXPORT wxFileHistory;
class WXDLLEXPORT wxConfigBase;
class WXDLLIMPORT ostream;
class WXDLLIMPORT istream;
@ -332,8 +333,11 @@ class WXDLLEXPORT wxDocManager: public wxEvtHandler
virtual int GetNoHistoryFiles(void) const;
virtual wxString GetHistoryFile(int i) const;
virtual void FileHistoryUseMenu(wxMenu *menu);
virtual void FileHistoryLoad(const wxString& resourceFile, const wxString& section);
virtual void FileHistorySave(const wxString& resourceFile, const wxString& section);
virtual void FileHistoryRemoveMenu(wxMenu *menu);
virtual void FileHistoryLoad(wxConfigBase& config);
virtual void FileHistorySave(wxConfigBase& config);
virtual void FileHistoryAddFilesToMenu();
virtual void FileHistoryAddFilesToMenu(wxMenu* menu);
protected:
long m_flags;
int m_defaultDocumentNameCounter;
@ -465,7 +469,8 @@ class WXDLLEXPORT wxCommandProcessor: public wxObject
virtual bool Submit(wxCommand *command, bool storeIt = TRUE);
virtual bool Undo(void);
virtual bool Redo(void);
virtual bool CanUndo(void);
virtual bool CanUndo(void) const;
virtual bool CanRedo(void) const;
// Call this to manage an edit menu.
inline void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; }
@ -484,6 +489,8 @@ class WXDLLEXPORT wxCommandProcessor: public wxObject
wxMenu* m_commandEditMenu;
};
// File history management
class WXDLLEXPORT wxFileHistory: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxFileHistory)
@ -491,21 +498,36 @@ class WXDLLEXPORT wxFileHistory: public wxObject
wxFileHistory(int maxFiles = 9);
~wxFileHistory(void);
// File history management
// Operations
virtual void AddFileToHistory(const wxString& file);
inline virtual int GetNoHistoryFiles(void) const { return m_fileHistoryN; }
virtual wxString GetHistoryFile(int i) const;
virtual int GetMaxFiles(void) const { return m_fileMaxFiles; }
virtual void FileHistoryUseMenu(wxMenu *menu);
virtual void FileHistoryLoad(const wxString& resourceFile, const wxString& section);
virtual void FileHistorySave(const wxString& resourceFile, const wxString& section);
virtual void UseMenu(wxMenu *menu);
// Remove menu from the list (MDI child may be closing)
virtual void RemoveMenu(wxMenu *menu);
virtual void Load(wxConfigBase& config);
virtual void Save(wxConfigBase& config);
virtual void AddFilesToMenu();
virtual void AddFilesToMenu(wxMenu* menu); // Single menu
// Accessors
virtual wxString GetHistoryFile(int i) const;
// A synonym for GetNoHistoryFiles
virtual int GetCount() const { return m_fileHistoryN; }
inline int GetNoHistoryFiles(void) const { return m_fileHistoryN; }
inline wxList& GetMenus() const { return (wxList&) m_fileMenus; }
protected:
// Last n files
char** m_fileHistory;
// Number of files saved
int m_fileHistoryN;
// Menu to maintain
wxMenu* m_fileMenu;
// Menus to maintain (may need several for an MDI app)
wxList m_fileMenus;
// Max files to maintain
int m_fileMaxFiles;
};

View File

@ -57,7 +57,7 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
virtual bool Pending() ;
virtual void Dispatch() ;
virtual void OnIdle(wxIdleEvent& event);
void OnIdle(wxIdleEvent& event);
// Generic
virtual bool OnInit() { return FALSE; };

View File

@ -28,7 +28,7 @@ public:
wxControl(void);
~wxControl(void);
virtual void Command(wxCommandEvent& WXUNUSED(event)) = 0; // Simulates an event
virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
// appropriate event handlers
virtual void SetClientSize(int width, int height);

View File

@ -71,9 +71,9 @@ class WXDLLEXPORT wxMetaFileDC: public wxDC
// Should be called at end of drawing
virtual wxMetaFile *Close(void);
virtual void SetMapMode(int mode);
virtual void GetTextExtent(const wxString& string, float *x, float *y,
float *descent = NULL, float *externalLeading = NULL,
wxFont *theFont = NULL, bool use16bit = FALSE);
virtual void GetTextExtent(const wxString& string, long *x, long *y,
long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL, bool use16bit = FALSE) const;
// Implementation
inline wxMetaFile *GetMetaFile(void) { return m_metaFile; }

View File

@ -403,6 +403,7 @@ public:
// Does this window want to accept keyboard focus?
virtual bool AcceptsFocus() const;
virtual void PrepareDC( wxDC &dc ) {};
public:
////////////////////////////////////////////////////////////////////////
//// IMPLEMENTATION

View File

@ -67,7 +67,7 @@ BEGIN
BEGIN
MENUITEM "&Cascade", 4002
MENUITEM "&Tile", 4001
MENUITEM "&Arrange icons", 4003
MENUITEM "&Arrange Icons", 4003
MENUITEM "&Next", 4004
END
END

View File

@ -59,7 +59,7 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
virtual bool Pending() ;
virtual void Dispatch() ;
virtual void OnIdle(wxIdleEvent& event);
void OnIdle(wxIdleEvent& event);
// Generic
virtual bool OnInit() { return FALSE; };

View File

@ -161,10 +161,10 @@ public:
void SetQuality(int q);
void SetOk(bool isOk);
inline wxPalette* GetPalette() const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : NULL); }
inline wxPalette* GetPalette() const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : (wxPalette*) NULL); }
void SetPalette(const wxPalette& palette);
inline wxMask *GetMask() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_bitmapMask : NULL); }
inline wxMask *GetMask() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_bitmapMask : (wxMask*) NULL); }
void SetMask(wxMask *mask) ;
inline wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; }

View File

@ -28,7 +28,7 @@ public:
wxControl();
~wxControl();
virtual void Command(wxCommandEvent& WXUNUSED(event)) = 0; // Simulates an event
virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
// appropriate event handlers
virtual void SetLabel(const wxString& label);

View File

@ -85,10 +85,10 @@ public:
inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); };
inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); };
inline int GetDashes(wxDash **ptr) const {
*ptr = (M_PENDATA ? M_PENDATA->m_dash : NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0);
*ptr = (M_PENDATA ? M_PENDATA->m_dash : (wxDash*) NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0);
}
inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : NULL); };
inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); };
// Implementation

View File

@ -17,6 +17,8 @@
*
*/
#define USE_CONSTRAINTS 1
// Use constraints mechanism
#define USE_CONFIG 1
// Use wxConfig, with CreateConfig in wxApp
#define _WX_GOODCOMPILER__
@ -92,7 +94,7 @@
#define USE_C_MAIN 0
// Set to 1 to use main.c instead of main.cpp (UNIX only)
#define USE_ODBC 1
#define USE_ODBC 0
// Define 1 to use ODBC classes
#define USE_IOSTREAMH 1

View File

@ -122,8 +122,8 @@ public:
// callbacks
// ---------
void OnDropFiles(wxDropFilesEvent& event);
void OnChar(wxKeyEvent& event); // Process 'enter' if required
void OnEraseBackground(wxEraseEvent& event);
// void OnChar(wxKeyEvent& event); // Process 'enter' if required
// void OnEraseBackground(wxEraseEvent& event);
// Implementation
// --------------

View File

@ -334,12 +334,6 @@ public:
virtual wxControl *CreateItem(const wxItemResource *childResource, const wxResourceTable *table = NULL);
#endif
// Native resource loading
virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
virtual wxWindow* GetWindowChild1(wxWindowID& id);
virtual wxWindow* GetWindowChild(wxWindowID& id);
virtual void GetTextExtent(const wxString& string, int *x, int *y,
int *descent = NULL,
int *externalLeading = NULL,
@ -376,6 +370,9 @@ public:
// Does this window want to accept keyboard focus?
virtual bool AcceptsFocus() const;
virtual void PrepareDC( wxDC &dc ) {};
public:
////////////////////////////////////////////////////////////////////////
//// IMPLEMENTATION
@ -501,7 +498,7 @@ inline int wxWindow::GetId() const { return m_windowId; }
inline void wxWindow::SetId(int id) { m_windowId = id; }
inline wxWindow *wxWindow::GetParent() const { return m_windowParent; }
inline void wxWindow::SetParent(wxWindow *p) { m_windowParent = p; }
inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : NULL); }
inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : (wxWindow*) NULL); }
inline wxList *wxWindow::GetChildren() const { return m_children; }
inline wxFont *wxWindow::GetFont() const { return (wxFont *) & m_windowFont; }
inline wxString wxWindow::GetName() const { return m_windowName; }

View File

@ -16,7 +16,7 @@
#endif
#include <wx/stream.h>
#include "../zlib/zlib.h"
#include "../zlib/zlib.h" // don't change this, Robert
class wxZlibInputStream: public wxFilterInputStream {
public:

View File

@ -0,0 +1,16 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1998
# Updated:
# Copyright: (c) 1998 Julian Smart
#
# "%W% %G%"
#
# Makefile for minimal example (UNIX).
include ../../src/makeprog.env
PROGRAM=minimal
OBJECTS=$(PROGRAM).o

View File

@ -108,9 +108,6 @@ wxDocMDIChildFrame::~wxDocMDIChildFrame(void)
// Extend event processing to search the view's event table
bool wxDocMDIChildFrame::ProcessEvent(wxEvent& event)
{
if (m_childView)
m_childView->Activate(TRUE);
if ( !m_childView || ! m_childView->ProcessEvent(event) )
{
// Only hand up to the parent if it's a menu command
@ -127,7 +124,7 @@ void wxDocMDIChildFrame::OnActivate(wxActivateEvent& event)
{
wxMDIChildFrame::OnActivate(event);
if (m_childView)
if (event.GetActive() && m_childView)
m_childView->Activate(event.GetActive());
}

View File

@ -48,6 +48,7 @@
#include "wx/printdlg.h"
#include "wx/generic/prntdlgg.h"
#include "wx/generic/printps.h"
#include "wx/confbase.h"
#include <stdio.h>
#include <string.h>
@ -290,6 +291,7 @@ bool wxDocument::OnOpenDocument(const wxString& file)
}
SetFilename(file, TRUE);
Modify(FALSE);
m_savedYet = TRUE;
UpdateAllViews();
@ -1059,19 +1061,37 @@ wxString wxDocManager::GetHistoryFile(int i) const
void wxDocManager::FileHistoryUseMenu(wxMenu *menu)
{
if (m_fileHistory)
m_fileHistory->FileHistoryUseMenu(menu);
m_fileHistory->UseMenu(menu);
}
void wxDocManager::FileHistoryLoad(const wxString& resourceFile, const wxString& section)
void wxDocManager::FileHistoryRemoveMenu(wxMenu *menu)
{
if (m_fileHistory)
m_fileHistory->FileHistoryLoad(resourceFile, section);
m_fileHistory->RemoveMenu(menu);
}
void wxDocManager::FileHistorySave(const wxString& resourceFile, const wxString& section)
void wxDocManager::FileHistoryLoad(wxConfigBase& config)
{
if (m_fileHistory)
m_fileHistory->FileHistorySave(resourceFile, section);
m_fileHistory->Load(config);
}
void wxDocManager::FileHistorySave(wxConfigBase& config)
{
if (m_fileHistory)
m_fileHistory->Save(config);
}
void wxDocManager::FileHistoryAddFilesToMenu(wxMenu* menu)
{
if (m_fileHistory)
m_fileHistory->AddFilesToMenu(menu);
}
void wxDocManager::FileHistoryAddFilesToMenu()
{
if (m_fileHistory)
m_fileHistory->AddFilesToMenu();
}
int wxDocManager::GetNoHistoryFiles(void) const
@ -1610,13 +1630,18 @@ bool wxCommandProcessor::Redo(void)
return FALSE;
}
bool wxCommandProcessor::CanUndo(void)
bool wxCommandProcessor::CanUndo(void) const
{
if (m_currentCommand)
return ((wxCommand *)m_currentCommand->Data())->CanUndo();
return FALSE;
}
bool wxCommandProcessor::CanRedo(void) const
{
return ((m_currentCommand && m_currentCommand->Next()));
}
void wxCommandProcessor::Initialize(void)
{
m_currentCommand = m_commands.Last();
@ -1704,7 +1729,6 @@ void wxCommandProcessor::ClearCommands(void)
wxFileHistory::wxFileHistory(int maxFiles)
{
m_fileMaxFiles = maxFiles;
m_fileMenu = (wxMenu *) NULL;
m_fileHistoryN = 0;
m_fileHistory = new char *[m_fileMaxFiles];
}
@ -1720,18 +1744,14 @@ wxFileHistory::~wxFileHistory(void)
// File history management
void wxFileHistory::AddFileToHistory(const wxString& file)
{
if (!m_fileMenu)
return;
int i;
// Check we don't already have this file
for (i = 0; i < m_fileHistoryN; i++)
{
if (m_fileHistory[i] && wxString(m_fileHistory[i]) == file)
return;
if (m_fileHistory[i] && wxString(m_fileHistory[i]) == file)
return;
}
// Add to the project file history:
// Move existing files (if any) down so we can insert file at beginning.
@ -1743,9 +1763,15 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
}
if (m_fileHistoryN < m_fileMaxFiles)
{
if (m_fileHistoryN == 0)
m_fileMenu->AppendSeparator();
m_fileMenu->Append(wxID_FILE1+m_fileHistoryN, _("[EMPTY]"));
wxNode* node = m_fileMenus.First();
while (node)
{
wxMenu* menu = (wxMenu*) node->Data();
if (m_fileHistoryN == 0)
menu->AppendSeparator();
menu->Append(wxID_FILE1+m_fileHistoryN, _("[EMPTY]"));
node = node->Next();
}
m_fileHistoryN ++;
}
// Shuffle filenames down
@ -1760,7 +1786,13 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
{
char buf[400];
sprintf(buf, "&%d %s", i+1, m_fileHistory[i]);
m_fileMenu->SetLabel(wxID_FILE1+i, buf);
wxNode* node = m_fileMenus.First();
while (node)
{
wxMenu* menu = (wxMenu*) node->Data();
menu->SetLabel(wxID_FILE1+i, buf);
node = node->Next();
}
}
}
@ -1772,40 +1804,84 @@ wxString wxFileHistory::GetHistoryFile(int i) const
return wxString("");
}
void wxFileHistory::FileHistoryUseMenu(wxMenu *menu)
void wxFileHistory::UseMenu(wxMenu *menu)
{
m_fileMenu = menu;
if (!m_fileMenus.Member(menu))
m_fileMenus.Append(menu);
}
void wxFileHistory::FileHistoryLoad(const wxString& resourceFile, const wxString& section)
void wxFileHistory::RemoveMenu(wxMenu *menu)
{
m_fileMenus.DeleteObject(menu);
}
void wxFileHistory::Load(wxConfigBase& config)
{
#if USE_RESOURCES
m_fileHistoryN = 0;
char buf[400];
sprintf(buf, "file%d", m_fileHistoryN+1);
char *historyFile = (char *) NULL;
while ((m_fileHistoryN <= m_fileMaxFiles) && wxGetResource(section, buf, &historyFile, resourceFile) && historyFile)
wxString historyFile("");
while ((m_fileHistoryN <= m_fileMaxFiles) && config.Read(buf, &historyFile) && (historyFile != ""))
{
// wxGetResource allocates memory so this is o.k.
m_fileHistory[m_fileHistoryN] = historyFile;
m_fileHistory[m_fileHistoryN] = copystring((const char*) historyFile);
m_fileHistoryN ++;
sprintf(buf, "file%d", m_fileHistoryN+1);
historyFile = (char *) NULL;
historyFile = "";
}
#endif
AddFilesToMenu();
}
void wxFileHistory::FileHistorySave(const wxString& resourceFile, const wxString& section)
void wxFileHistory::Save(wxConfigBase& config)
{
#if USE_RESOURCES
char buf[400];
int i;
for (i = 0; i < m_fileHistoryN; i++)
{
sprintf(buf, "file%d", i+1);
wxWriteResource(section, buf, m_fileHistory[i], resourceFile);
wxString buf;
buf.Printf("file%d", i+1);
config.Write(buf, wxString(m_fileHistory[i]));
}
#endif
}
void wxFileHistory::AddFilesToMenu()
{
if (m_fileHistoryN > 0)
{
wxNode* node = m_fileMenus.First();
while (node)
{
wxMenu* menu = (wxMenu*) node->Data();
menu->AppendSeparator();
int i;
for (i = 0; i < m_fileHistoryN; i++)
{
if (m_fileHistory[i])
{
wxString buf;
buf.Printf("&%d %s", i+1, m_fileHistory[i]);
menu->Append(wxID_FILE1+i, buf);
}
}
node = node->Next();
}
}
}
void wxFileHistory::AddFilesToMenu(wxMenu* menu)
{
if (m_fileHistoryN > 0)
{
menu->AppendSeparator();
int i;
for (i = 0; i < m_fileHistoryN; i++)
{
if (m_fileHistory[i])
{
wxString buf;
buf.Printf("&%d %s", i+1, m_fileHistory[i]);
menu->Append(wxID_FILE1+i, buf);
}
}
}
}
#if 0

View File

@ -1371,3 +1371,160 @@ void WXDLLEXPORT wxSplitPath(const char *pszFileName,
pstrExt->Empty();
}
}
//------------------------------------------------------------------------
// wild character routines
//------------------------------------------------------------------------
bool wxIsWild( const wxString& pattern )
{
wxString tmp = pattern;
char *pat = WXSTRINGCAST(tmp);
while (*pat) {
switch (*pat++) {
case '?': case '*': case '[': case '{':
return TRUE;
case '\\':
if (!*pat++)
return FALSE;
}
}
return FALSE;
};
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
{
wxString tmp1 = pat;
char *pattern = WXSTRINGCAST(tmp1);
wxString tmp2 = text;
char *str = WXSTRINGCAST(tmp2);
char c;
char *cp;
bool done = FALSE, ret_code, ok;
// Below is for vi fans
const char OB = '{', CB = '}';
// dot_special means '.' only matches '.'
if (dot_special && *str == '.' && *pattern != *str)
return FALSE;
while ((*pattern != '\0') && (!done)
&& (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
switch (*pattern) {
case '\\':
pattern++;
if (*pattern != '\0')
pattern++;
break;
case '*':
pattern++;
ret_code = FALSE;
while ((*str!='\0')
&& (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
/*loop*/;
if (ret_code) {
while (*str != '\0')
str++;
while (*pattern != '\0')
pattern++;
}
break;
case '[':
pattern++;
repeat:
if ((*pattern == '\0') || (*pattern == ']')) {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if (*(pattern + 1) == '-') {
c = *pattern;
pattern += 2;
if (*pattern == ']') {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if ((*str < c) || (*str > *pattern)) {
pattern++;
goto repeat;
}
} else if (*pattern != *str) {
pattern++;
goto repeat;
}
pattern++;
while ((*pattern != ']') && (*pattern != '\0')) {
if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
pattern++;
pattern++;
}
if (*pattern != '\0') {
pattern++, str++;
}
break;
case '?':
pattern++;
str++;
break;
case OB:
pattern++;
while ((*pattern != CB) && (*pattern != '\0')) {
cp = str;
ok = TRUE;
while (ok && (*cp != '\0') && (*pattern != '\0')
&& (*pattern != ',') && (*pattern != CB)) {
if (*pattern == '\\')
pattern++;
ok = (*pattern++ == *cp++);
}
if (*pattern == '\0') {
ok = FALSE;
done = TRUE;
break;
} else if (ok) {
str = cp;
while ((*pattern != CB) && (*pattern != '\0')) {
if (*++pattern == '\\') {
if (*++pattern == CB)
pattern++;
}
}
} else {
while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
if (*++pattern == '\\') {
if (*++pattern == CB || *pattern == ',')
pattern++;
}
}
}
if (*pattern != '\0')
pattern++;
}
break;
default:
if (*str == *pattern) {
str++, pattern++;
} else {
done = TRUE;
}
}
}
while (*pattern == '*')
pattern++;
return ((*str == '\0') && (*pattern == '\0'));
};

View File

@ -31,6 +31,9 @@
#include <wx/timer.h>
#include <wx/utils.h>
// Not enough OS behaviour defined for wxStubs
#ifndef __WXSTUBS__
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@ -1537,3 +1540,6 @@ HWND wxSocketHandler::GetHWND() const
}
#endif
#endif
// __WXSTUBS__

View File

@ -41,7 +41,7 @@ wxZlibInputStream::wxZlibInputStream(wxInputStream& stream)
m_inflate.zalloc = (alloc_func)0;
m_inflate.zfree = (free_func)0;
m_inflate.opaque = (voidpf)0;
m_inflate.opaque = (void*)0;
err = inflateInit(&m_inflate);
if (err != Z_OK) {
@ -107,7 +107,7 @@ wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream)
m_deflate.zalloc = (alloc_func)0;
m_deflate.zfree = (free_func)0;
m_deflate.opaque = (voidpf)0;
m_deflate.opaque = (void*)0;
err = deflateInit(&m_deflate, Z_DEFAULT_COMPRESSION);
if (err != Z_OK) {

View File

@ -542,7 +542,7 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
if (hilight)
dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
else
dc->SetTextForeground( info->GetColour() );
dc->SetTextForeground( * info->GetColour() );
dc->DrawText( s, info->GetX()+2, info->GetY() );
dc->DestroyClippingRegion();
node = node->Next();
@ -565,7 +565,7 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
if (hilight)
dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
else
dc->SetTextForeground( item->GetColour() );
dc->SetTextForeground( * item->GetColour() );
dc->DrawText( s, m_bound_label.x, m_bound_label.y );
}
}
@ -978,9 +978,9 @@ void wxListMainWindow::HilightAll( bool on )
void wxListMainWindow::ActivateLine( wxListLineData *line )
{
if (!m_parent) return;
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, m_parent->GetId() );
le.SetEventObject( m_parent );
if (!GetParent()) return;
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
le.SetEventObject( GetParent() );
le.m_code = 0;
le.m_itemIndex = GetIndexOfLine( line );
le.m_col = 0;
@ -990,9 +990,9 @@ void wxListMainWindow::ActivateLine( wxListLineData *line )
void wxListMainWindow::SendNotify( wxListLineData *line, wxEventType command )
{
if (!m_parent) return;
wxListEvent le( command, m_parent->GetId() );
le.SetEventObject( m_parent );
if (!GetParent()) return;
wxListEvent le( command, GetParent()->GetId() );
le.SetEventObject( GetParent() );
le.m_code = 0;
le.m_itemIndex = GetIndexOfLine( line );
le.m_col = 0;
@ -1032,10 +1032,10 @@ void wxListMainWindow::StartLabelEdit( wxListLineData *line )
void wxListMainWindow::RenameLine( wxListLineData *line, const wxString &newName )
{
if (!m_parent) return;
if (!GetParent()) return;
wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, m_parent->GetId() );
le.SetEventObject( m_parent );
wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() );
le.SetEventObject( GetParent() );
le.m_code = 0;
le.m_itemIndex = GetIndexOfLine( line );
le.m_col = 0;
@ -1087,7 +1087,7 @@ void wxListMainWindow::OnRenameAccept()
void wxListMainWindow::OnMouse( wxMouseEvent &event )
{
if (m_parent->ProcessEvent( event)) return;
if (GetParent()->ProcessEvent( event)) return;
if (!m_current) return;
if (m_dirty) return;
@ -1117,7 +1117,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
if (event.Dragging() && (m_dragCount > 3))
{
m_dragCount = 0;
wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, m_parent->GetId() );
wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, GetParent()->GetId() );
le.SetEventObject( this );
le.m_code = 0;
le.m_itemIndex = 0;
@ -1398,11 +1398,11 @@ void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
m_hasFocus = TRUE;
RefreshLine( m_current );
if (!m_parent) return;
if (!GetParent()) return;
wxFocusEvent event( wxEVT_SET_FOCUS, m_parent->GetId() );
event.SetEventObject( m_parent );
m_parent->ProcessEvent( event );
wxFocusEvent event( wxEVT_SET_FOCUS, GetParent()->GetId() );
event.SetEventObject( GetParent() );
GetParent()->ProcessEvent( event );
}
void wxListMainWindow::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
@ -2054,7 +2054,7 @@ void wxListMainWindow::SortItems( wxListCtrlCompare fn, long data )
bool wxListMainWindow::OnListNotify( wxListEvent &event )
{
if (m_parent) m_parent->ProcessEvent( event );
if (GetParent()) GetParent()->ProcessEvent( event );
return FALSE;
}

View File

@ -198,162 +198,6 @@ bool wxDirExists( const wxString& dir )
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
};
//------------------------------------------------------------------------
// wild character routines
//------------------------------------------------------------------------
bool wxIsWild( const wxString& pattern )
{
wxString tmp = pattern;
char *pat = WXSTRINGCAST(tmp);
while (*pat) {
switch (*pat++) {
case '?': case '*': case '[': case '{':
return TRUE;
case '\\':
if (!*pat++)
return FALSE;
}
}
return FALSE;
};
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
{
wxString tmp1 = pat;
char *pattern = WXSTRINGCAST(tmp1);
wxString tmp2 = text;
char *str = WXSTRINGCAST(tmp2);
char c;
char *cp;
bool done = FALSE, ret_code, ok;
// Below is for vi fans
const char OB = '{', CB = '}';
// dot_special means '.' only matches '.'
if (dot_special && *str == '.' && *pattern != *str)
return FALSE;
while ((*pattern != '\0') && (!done)
&& (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
switch (*pattern) {
case '\\':
pattern++;
if (*pattern != '\0')
pattern++;
break;
case '*':
pattern++;
ret_code = FALSE;
while ((*str!='\0')
&& (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
/*loop*/;
if (ret_code) {
while (*str != '\0')
str++;
while (*pattern != '\0')
pattern++;
}
break;
case '[':
pattern++;
repeat:
if ((*pattern == '\0') || (*pattern == ']')) {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if (*(pattern + 1) == '-') {
c = *pattern;
pattern += 2;
if (*pattern == ']') {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if ((*str < c) || (*str > *pattern)) {
pattern++;
goto repeat;
}
} else if (*pattern != *str) {
pattern++;
goto repeat;
}
pattern++;
while ((*pattern != ']') && (*pattern != '\0')) {
if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
pattern++;
pattern++;
}
if (*pattern != '\0') {
pattern++, str++;
}
break;
case '?':
pattern++;
str++;
break;
case OB:
pattern++;
while ((*pattern != CB) && (*pattern != '\0')) {
cp = str;
ok = TRUE;
while (ok && (*cp != '\0') && (*pattern != '\0')
&& (*pattern != ',') && (*pattern != CB)) {
if (*pattern == '\\')
pattern++;
ok = (*pattern++ == *cp++);
}
if (*pattern == '\0') {
ok = FALSE;
done = TRUE;
break;
} else if (ok) {
str = cp;
while ((*pattern != CB) && (*pattern != '\0')) {
if (*++pattern == '\\') {
if (*++pattern == CB)
pattern++;
}
}
} else {
while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
if (*++pattern == '\\') {
if (*++pattern == CB || *pattern == ',')
pattern++;
}
}
}
if (*pattern != '\0')
pattern++;
}
break;
default:
if (*str == *pattern) {
str++, pattern++;
} else {
done = TRUE;
}
}
}
while (*pattern == '*')
pattern++;
return ((*str == '\0') && (*pattern == '\0'));
};
//------------------------------------------------------------------------
// subprocess routines
//------------------------------------------------------------------------

View File

@ -198,162 +198,6 @@ bool wxDirExists( const wxString& dir )
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
};
//------------------------------------------------------------------------
// wild character routines
//------------------------------------------------------------------------
bool wxIsWild( const wxString& pattern )
{
wxString tmp = pattern;
char *pat = WXSTRINGCAST(tmp);
while (*pat) {
switch (*pat++) {
case '?': case '*': case '[': case '{':
return TRUE;
case '\\':
if (!*pat++)
return FALSE;
}
}
return FALSE;
};
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
{
wxString tmp1 = pat;
char *pattern = WXSTRINGCAST(tmp1);
wxString tmp2 = text;
char *str = WXSTRINGCAST(tmp2);
char c;
char *cp;
bool done = FALSE, ret_code, ok;
// Below is for vi fans
const char OB = '{', CB = '}';
// dot_special means '.' only matches '.'
if (dot_special && *str == '.' && *pattern != *str)
return FALSE;
while ((*pattern != '\0') && (!done)
&& (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
switch (*pattern) {
case '\\':
pattern++;
if (*pattern != '\0')
pattern++;
break;
case '*':
pattern++;
ret_code = FALSE;
while ((*str!='\0')
&& (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
/*loop*/;
if (ret_code) {
while (*str != '\0')
str++;
while (*pattern != '\0')
pattern++;
}
break;
case '[':
pattern++;
repeat:
if ((*pattern == '\0') || (*pattern == ']')) {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if (*(pattern + 1) == '-') {
c = *pattern;
pattern += 2;
if (*pattern == ']') {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if ((*str < c) || (*str > *pattern)) {
pattern++;
goto repeat;
}
} else if (*pattern != *str) {
pattern++;
goto repeat;
}
pattern++;
while ((*pattern != ']') && (*pattern != '\0')) {
if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
pattern++;
pattern++;
}
if (*pattern != '\0') {
pattern++, str++;
}
break;
case '?':
pattern++;
str++;
break;
case OB:
pattern++;
while ((*pattern != CB) && (*pattern != '\0')) {
cp = str;
ok = TRUE;
while (ok && (*cp != '\0') && (*pattern != '\0')
&& (*pattern != ',') && (*pattern != CB)) {
if (*pattern == '\\')
pattern++;
ok = (*pattern++ == *cp++);
}
if (*pattern == '\0') {
ok = FALSE;
done = TRUE;
break;
} else if (ok) {
str = cp;
while ((*pattern != CB) && (*pattern != '\0')) {
if (*++pattern == '\\') {
if (*++pattern == CB)
pattern++;
}
}
} else {
while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
if (*++pattern == '\\') {
if (*++pattern == CB || *pattern == ',')
pattern++;
}
}
}
if (*pattern != '\0')
pattern++;
}
break;
default:
if (*str == *pattern) {
str++, pattern++;
} else {
done = TRUE;
}
}
}
while (*pattern == '*')
pattern++;
return ((*str == '\0') && (*pattern == '\0'));
};
//------------------------------------------------------------------------
// subprocess routines
//------------------------------------------------------------------------

121
src/make.env Normal file
View File

@ -0,0 +1,121 @@
# generic.env
# Linux/generic
#
# Common makefile settings for wxWindows programs
# This file is included by all the other makefiles, thus changes
# made here take effect everywhere (except where overriden).
#
# An alternative to editing this file is to create a shell script
# to export specific variables, and call make with the -e switch
# to override makefile variables. See wx/install/install.txt.
# And you can override specific variables on the make command line, e.g.
#
# make -f makefile.unix DEBUG=''
#
# You may prefer to use the GNU configure script than raw makefiles -
# see contrib/wxshlib.
#
########################### Programs #################################
# Replace this with your own path if necessary
WXDIR = /home/jacs/wx2
# C++ compiler
CC = g++
# C compiler
CCC = gcc
# Compiler for lex/yacc .c programs
CCLEX = $(CCC)
LEX = lex
YACC = yacc
MAKE = make
AROPTIONS = ruv
RANLIB = ranlib
############################ Switches #################################
# Debug/trace mode. 1 or more for debugging.
DEBUG = 0
GUI = -D__WXSTUBS__ -D__LINUX__ -D__UNIX__
GUISUFFIX = _stubs
########################## Compiler flags #############################
# Misc options
OPTIONS = -D__WXDEBUG__ -DWXDEBUG
COPTIONS =
DEBUGFLAGS = -ggdb
INCLUDE =
WARN = -Wall -Wno-unused # -w
CWARN = -Wall -Wno-unused # -w
OPT = # -O2
############################ Includes #################################
# Compiler or system-specific include paths
COMPPATHS =
XINCLUDE = -I/usr/openwin/include -I/usr/include/X11 -I/usr/include/Xm \
-I/usr/include/X11/Xm -I/usr/include
XLIB = -L/usr/local/X11/lib -L/usr/openwin/lib -L/usr/X11/lib -L/usr/X11R6/lib
############################ Libraries ################################
COMPLIBS = -lstdc++
GUILDLIBS = -lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm
############################# Suffixes ################################
# Change cpp to c if you want to use main.c instead of main.cpp.
# Edit wx_setup.h accordingly (USE_C_MAIN=1)
OBJSUFF =o
SRCSUFF =cpp
MAINSUFF =cpp
####################### No changes below this line ####################
WXINC = $(WXDIR)/include
WXLIB = $(WXDIR)/lib/libwx$(GUISUFFIX).a
INC = -I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/src/zlib $(COMPPATHS)
# Directory for object files
OBJDIR = objects$(GUISUFFIX)
CPPFLAGS = $(EXTRACPPFLAGS) $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) -DDEBUG='$(DEBUG)' $(WARN) $(OPT)
CFLAGS = $(EXTRACFLAGS) $(XINCLUDE) $(INC) $(COPTIONS) $(GUI) $(DEBUGFLAGS) -DDEBUG='$(DEBUG)' $(CWARN) $(OPT)
LDFLAGS = $(EXTRALDFLAGS) $(XLIB) -L$(WXDIR)/lib
LDLIBS = $(EXTRALDLIBS) $(GUILDLIBS)
# Clears all default suffixes
.SUFFIXES: .o .cpp .c
.c.o :
$(CC) -c $(CFLAGS) -o $@ $<
.cpp.o :
$(CC) -c $(CPPFLAGS) -o $@ $<
####################### Targets to allow multiple GUIs ####################
dummy:
echo Use a target: one of motif, stubs
stubs:
make -f makefile.unx all GUI='-D__WXSTUBS__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_stubs' GUILDLIBS='-lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
motif:
make -f makefile.unx all GUI='-D__WXMOTIF__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_motif' GUILDLIBS='-lwx_motif $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
cleanstubs:
make -f makefile.unx clean GUI='-D__WXSTUBS__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_stubs' GUILDLIBS='-lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
cleanmotif:
make -f makefile.unx clean GUI='-D__WXMOTIF__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_motif' GUILDLIBS='-lwx_motif $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
$(OBJDIR):
mkdir $(OBJDIR)

11
src/makeprog.env Normal file
View File

@ -0,0 +1,11 @@
# Replace this with your own path if necessary
WXDIR = /home/jacs/wx2
include $(WXDIR)/src/make.env
all: $(PROGRAM)$(GUISUFFIX)
$(PROGRAM)$(GUISUFFIX): $(OBJECTS) $(WXLIB)
$(CC) $(LDFLAGS) -o $(PROGRAM)$(GUISUFFIX) $(OBJECTS) $(LDLIBS)
clean:
rm -f $(OBJECTS) minimal$(GUISUFFIX) core

View File

@ -108,9 +108,13 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
if (!file.IsNull() && wxFileExists(file))
wxRemoveFile(file);
m_hDC = (WXHDC) CreateMetaFile(file);
m_ok = TRUE;
if (!file.IsNull() && (file != ""))
m_hDC = (WXHDC) CreateMetaFile(file);
else
m_hDC = (WXHDC) CreateMetaFile(NULL);
m_ok = (m_hDC != (WXHDC) 0) ;
// Actual Windows mapping mode, for future reference.
m_windowsMappingMode = MM_TEXT;
@ -145,12 +149,12 @@ wxMetaFileDC::~wxMetaFileDC(void)
m_hDC = 0;
}
void wxMetaFileDC::GetTextExtent(const wxString& string, float *x, float *y,
float *descent, float *externalLeading, wxFont *theFont, bool use16bit)
void wxMetaFileDC::GetTextExtent(const wxString& string, long *x, long *y,
long *descent, long *externalLeading, wxFont *theFont, bool use16bit) const
{
wxFont *fontToUse = theFont;
if (!fontToUse)
fontToUse = &m_font;
fontToUse = (wxFont*) &m_font;
HDC dc = GetDC(NULL);
@ -161,10 +165,10 @@ void wxMetaFileDC::GetTextExtent(const wxString& string, float *x, float *y,
ReleaseDC(NULL, dc);
*x = (float)XDEV2LOGREL(sizeRect.cx);
*y = (float)YDEV2LOGREL(sizeRect.cy);
if (descent) *descent = (float)tm.tmDescent;
if (externalLeading) *externalLeading = (float)tm.tmExternalLeading;
*x = XDEV2LOGREL(sizeRect.cx);
*y = YDEV2LOGREL(sizeRect.cy);
if (descent) *descent = tm.tmDescent;
if (externalLeading) *externalLeading = tm.tmExternalLeading;
}
wxMetaFile *wxMetaFileDC::Close(void)

View File

@ -697,3 +697,196 @@ void wxDisplaySize(int *width, int *height)
ReleaseDC(NULL, dc);
}
bool wxDirExists(const wxString& dir)
{
/* MATTHEW: [6] Always use same code for Win32, call FindClose */
#if defined(__WIN32__)
WIN32_FIND_DATA fileInfo;
#else
#ifdef __BORLANDC__
struct ffblk fileInfo;
#else
struct find_t fileInfo;
#endif
#endif
#if defined(__WIN32__)
HANDLE h = FindFirstFile((LPTSTR) WXSTRINGCAST dir,(LPWIN32_FIND_DATA)&fileInfo);
if (h==INVALID_HANDLE_VALUE)
return FALSE;
else {
FindClose(h);
return ((fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
}
#else
// In Borland findfirst has a different argument
// ordering from _dos_findfirst. But _dos_findfirst
// _should_ be ok in both MS and Borland... why not?
#ifdef __BORLANDC__
return ((findfirst(WXSTRINGCAST dir, &fileInfo, _A_SUBDIR) == 0 && (fileInfo.ff_attrib & _A_SUBDIR) != 0));
#else
return (((_dos_findfirst(WXSTRINGCAST dir, _A_SUBDIR, &fileInfo) == 0) && (fileInfo.attrib & _A_SUBDIR)) != 0);
#endif
#endif
}
#if 0
//------------------------------------------------------------------------
// wild character routines
//------------------------------------------------------------------------
bool wxIsWild( const wxString& pattern )
{
wxString tmp = pattern;
char *pat = WXSTRINGCAST(tmp);
while (*pat) {
switch (*pat++) {
case '?': case '*': case '[': case '{':
return TRUE;
case '\\':
if (!*pat++)
return FALSE;
}
}
return FALSE;
};
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
{
wxString tmp1 = pat;
char *pattern = WXSTRINGCAST(tmp1);
wxString tmp2 = text;
char *str = WXSTRINGCAST(tmp2);
char c;
char *cp;
bool done = FALSE, ret_code, ok;
// Below is for vi fans
const char OB = '{', CB = '}';
// dot_special means '.' only matches '.'
if (dot_special && *str == '.' && *pattern != *str)
return FALSE;
while ((*pattern != '\0') && (!done)
&& (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
switch (*pattern) {
case '\\':
pattern++;
if (*pattern != '\0')
pattern++;
break;
case '*':
pattern++;
ret_code = FALSE;
while ((*str!='\0')
&& (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
/*loop*/;
if (ret_code) {
while (*str != '\0')
str++;
while (*pattern != '\0')
pattern++;
}
break;
case '[':
pattern++;
repeat:
if ((*pattern == '\0') || (*pattern == ']')) {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if (*(pattern + 1) == '-') {
c = *pattern;
pattern += 2;
if (*pattern == ']') {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if ((*str < c) || (*str > *pattern)) {
pattern++;
goto repeat;
}
} else if (*pattern != *str) {
pattern++;
goto repeat;
}
pattern++;
while ((*pattern != ']') && (*pattern != '\0')) {
if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
pattern++;
pattern++;
}
if (*pattern != '\0') {
pattern++, str++;
}
break;
case '?':
pattern++;
str++;
break;
case OB:
pattern++;
while ((*pattern != CB) && (*pattern != '\0')) {
cp = str;
ok = TRUE;
while (ok && (*cp != '\0') && (*pattern != '\0')
&& (*pattern != ',') && (*pattern != CB)) {
if (*pattern == '\\')
pattern++;
ok = (*pattern++ == *cp++);
}
if (*pattern == '\0') {
ok = FALSE;
done = TRUE;
break;
} else if (ok) {
str = cp;
while ((*pattern != CB) && (*pattern != '\0')) {
if (*++pattern == '\\') {
if (*++pattern == CB)
pattern++;
}
}
} else {
while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
if (*++pattern == '\\') {
if (*++pattern == CB || *pattern == ',')
pattern++;
}
}
}
if (*pattern != '\0')
pattern++;
}
break;
default:
if (*str == *pattern) {
str++, pattern++;
} else {
done = TRUE;
}
}
}
while (*pattern == '*')
pattern++;
return ((*str == '\0') && (*pattern == '\0'));
};
#endif

201
src/stubs.inc Normal file
View File

@ -0,0 +1,201 @@
# needed for unactivated
NONE =
# define library name
LIB_TARGET=wx_stubs
LIB_MAJOR=1
LIB_MINOR=0
# define library sources
LIB_CPP_SRC=\
\
common/cmndata.cpp \
common/config.cpp \
common/date.cpp \
common/docmdi.cpp \
common/docview.cpp \
common/dynarray.cpp \
common/dynlib.cpp \
common/event.cpp \
common/file.cpp \
common/fileconf.cpp \
common/filefn.cpp \
common/gdicmn.cpp \
common/hash.cpp \
common/helpbase.cpp \
common/intl.cpp \
common/ipcbase.cpp \
common/layout.cpp \
common/list.cpp \
common/log.cpp \
common/matrix.cpp \
common/memory.cpp \
common/module.cpp \
common/object.cpp \
common/odbc.cpp \
common/postscrp.cpp \
common/prntbase.cpp \
common/resource.cpp \
common/serbase.cpp \
common/string.cpp \
common/textfile.cpp \
common/time.cpp \
common/timercmn.cpp \
common/utilscmn.cpp \
common/wincmn.cpp \
common/framecmn.cpp \
common/stream.cpp \
common/datstrm.cpp \
common/fstream.cpp \
common/mstream.cpp \
common/zstream.cpp \
common/objstrm.cpp \
common/sckstrm.cpp \
common/validate.cpp \
common/valtext.cpp \
common/variant.cpp \
common/wxexpr.cpp \
common/socket.cpp \
common/sckaddr.cpp \
common/sckipc.cpp \
common/protocol.cpp \
common/ftp.cpp \
common/http.cpp \
common/url.cpp \
common/tokenzr.cpp \
\
stubs/accel.cpp \
stubs/app.cpp \
stubs/bitmap.cpp \
stubs/bmpbuttn.cpp \
stubs/brush.cpp \
stubs/button.cpp \
stubs/checkbox.cpp \
stubs/choice.cpp \
stubs/clipbrd.cpp \
stubs/colour.cpp \
stubs/colordlg.cpp \
stubs/control.cpp \
stubs/combobox.cpp \
stubs/cursor.cpp \
stubs/data.cpp \
stubs/dc.cpp \
stubs/dcclient.cpp \
stubs/dcmemory.cpp \
stubs/dcscreen.cpp \
stubs/dialog.cpp \
stubs/dirdlg.cpp \
stubs/dnd.cpp \
stubs/filedlg.cpp \
stubs/font.cpp \
stubs/fontdlg.cpp \
stubs/frame.cpp \
stubs/gauge.cpp \
stubs/gdiobj.cpp \
stubs/helpxxxx.cpp \
stubs/icon.cpp \
stubs/imaglist.cpp \
stubs/listbox.cpp \
stubs/joystick.cpp \
stubs/main.cpp \
stubs/mdi.cpp \
stubs/menu.cpp \
stubs/menuitem.cpp \
stubs/metafile.cpp \
stubs/minifram.cpp \
stubs/msgdlg.cpp \
stubs/notebook.cpp \
stubs/palette.cpp \
stubs/pen.cpp \
stubs/print.cpp \
stubs/radiobox.cpp \
stubs/radiobut.cpp \
stubs/region.cpp \
stubs/scrolbar.cpp \
stubs/settings.cpp \
stubs/slider.cpp \
stubs/spinbutt.cpp \
stubs/statbox.cpp \
stubs/statbmp.cpp \
stubs/stattext.cpp \
stubs/statusbr.cpp \
stubs/taskbar.cpp \
stubs/textctrl.cpp \
stubs/thread.cpp \
stubs/timer.cpp \
stubs/toolbar.cpp \
stubs/treectrl.cpp \
stubs/utils.cpp \
stubs/utilsexc.cpp \
stubs/wave.cpp \
stubs/window.cpp \
\
generic/choicdgg.cpp \
generic/colrdlgg.cpp \
generic/fontdlgg.cpp \
generic/gridg.cpp \
generic/imaglist.cpp \
generic/listctrl.cpp \
generic/laywin.cpp \
generic/msgdlgg.cpp \
generic/panelg.cpp \
generic/printps.cpp \
generic/prntdlgg.cpp \
generic/sashwin.cpp \
generic/scrolwin.cpp \
generic/splitter.cpp \
generic/statusbr.cpp \
generic/tabg.cpp \
generic/textdlgg.cpp \
generic/treectrl.cpp
LIB_C_SRC=\
common/extended.c \
png/png.c \
png/pngset.c \
png/pngget.c \
png/pngrutil.c \
png/pngtrans.c \
png/pngwutil.c \
png/pngread.c \
png/pngrio.c \
png/pngwio.c \
png/pngwrite.c \
png/pngrtran.c \
png/pngwtran.c \
png/pngmem.c \
png/pngerror.c \
png/pngpread.c \
\
zlib/adler32.c \
zlib/compress.c \
zlib/crc32.c \
zlib/gzio.c \
zlib/uncompr.c \
zlib/deflate.c \
zlib/trees.c \
zlib/zutil.c \
zlib/inflate.c \
zlib/infblock.c \
zlib/inftrees.c \
zlib/infcodes.c \
zlib/infutil.c \
zlib/inffast.c \
\
iodbc/dlf.c \
iodbc/dlproc.c \
iodbc/herr.c \
iodbc/henv.c \
iodbc/hdbc.c \
iodbc/hstmt.c \
iodbc/connect.c \
iodbc/prepare.c \
iodbc/result.c \
iodbc/execute.c \
iodbc/fetch.c \
iodbc/info.c \
iodbc/catalog.c \
iodbc/misc.c \
iodbc/itrace.c

View File

@ -95,6 +95,7 @@ void wxApp::CommonCleanUp()
wxDeleteStockObjects() ;
// Destroy all GDI lists, etc.
delete wxTheBrushList;
wxTheBrushList = NULL;
@ -121,6 +122,10 @@ void wxApp::CommonCleanUp()
delete[] wxBuffer;
wxBuffer = NULL;
wxClassInfo::CleanUpClasses();
// do it as the very last thing because everything else can log messages
wxLog::DontCreateOnDemand();
// do it as the very last thing because everything else can log messages
delete wxLog::SetActiveTarget(NULL);
}
@ -177,12 +182,21 @@ int wxEntry( int argc, char *argv[] )
int retValue = 0;
if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
if (wxTheApp->GetTopWindow())
{
delete wxTheApp->GetTopWindow();
wxTheApp->SetTopWindow(NULL);
}
wxTheApp->DeletePendingObjects();
wxTheApp->OnExit();
wxApp::CommonCleanUp();
delete wxTheApp;
wxTheApp = NULL;
#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
// At this point we want to check if there are any memory

View File

@ -289,3 +289,6 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
Refresh();
}
void wxDialog::Fit()
{
}

View File

@ -99,21 +99,21 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
wxDropSource::wxDropSource( wxWindow *win )
{
// TODO
m_window = win;
// m_window = win;
m_data = NULL;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
// m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
// m_goaheadCursor = wxCursor( wxCURSOR_HAND );
};
wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
{
// TODO
m_window = win;
// m_window = win;
m_data = &data;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
// m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
// m_goaheadCursor = wxCursor( wxCURSOR_HAND );
};
void wxDropSource::SetData( wxDataObject &data )

199
src/stubs/makefile.unx Normal file
View File

@ -0,0 +1,199 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1998
# Updated:
# Copyright: (c) 1998
#
#
# Makefile for wxStubs library, Unix
EXTRACFLAGS=-DLEX_SCANNER
include ../make.env
LIB_CPP_SRC=\
\
../common/cmndata.cpp \
../common/config.cpp \
../common/date.cpp \
../common/docmdi.cpp \
../common/docview.cpp \
../common/dynarray.cpp \
../common/dynlib.cpp \
../common/event.cpp \
../common/file.cpp \
../common/fileconf.cpp \
../common/filefn.cpp \
../common/gdicmn.cpp \
../common/hash.cpp \
../common/helpbase.cpp \
../common/intl.cpp \
../common/ipcbase.cpp \
../common/layout.cpp \
../common/list.cpp \
../common/log.cpp \
../common/matrix.cpp \
../common/memory.cpp \
../common/module.cpp \
../common/object.cpp \
../common/odbc.cpp \
../common/postscrp.cpp \
../common/prntbase.cpp \
../common/resource.cpp \
../common/serbase.cpp \
../common/string.cpp \
../common/textfile.cpp \
../common/tbarbase.cpp \
../common/tbarsmpl.cpp \
../common/timercmn.cpp \
../common/utilscmn.cpp \
../common/wincmn.cpp \
../common/framecmn.cpp \
../common/stream.cpp \
../common/datstrm.cpp \
../common/fstream.cpp \
../common/mstream.cpp \
../common/zstream.cpp \
../common/objstrm.cpp \
../common/sckstrm.cpp \
../common/validate.cpp \
../common/valtext.cpp \
../common/variant.cpp \
../common/wxexpr.cpp \
../common/socket.cpp \
../common/sckaddr.cpp \
../common/sckipc.cpp \
../common/protocol.cpp \
../common/ftp.cpp \
../common/http.cpp \
../common/url.cpp \
../common/tokenzr.cpp \
\
accel.cpp \
app.cpp \
bitmap.cpp \
bmpbuttn.cpp \
brush.cpp \
button.cpp \
checkbox.cpp \
choice.cpp \
clipbrd.cpp \
colour.cpp \
colordlg.cpp \
control.cpp \
combobox.cpp \
cursor.cpp \
data.cpp \
dc.cpp \
dcclient.cpp \
dcmemory.cpp \
dcscreen.cpp \
dialog.cpp \
dirdlg.cpp \
dnd.cpp \
filedlg.cpp \
font.cpp \
fontdlg.cpp \
frame.cpp \
gauge.cpp \
gdiobj.cpp \
helpxxxx.cpp \
icon.cpp \
listbox.cpp \
joystick.cpp \
main.cpp \
mdi.cpp \
menu.cpp \
menuitem.cpp \
metafile.cpp \
minifram.cpp \
msgdlg.cpp \
notebook.cpp \
palette.cpp \
pen.cpp \
print.cpp \
radiobox.cpp \
radiobut.cpp \
region.cpp \
scrolbar.cpp \
settings.cpp \
slider.cpp \
spinbutt.cpp \
statbox.cpp \
statbmp.cpp \
stattext.cpp \
taskbar.cpp \
textctrl.cpp \
thread.cpp \
timer.cpp \
toolbar.cpp \
utils.cpp \
utilsexc.cpp \
wave.cpp \
window.cpp \
\
../generic/choicdgg.cpp \
../generic/colrdlgg.cpp \
../generic/fontdlgg.cpp \
../generic/gridg.cpp \
../generic/imaglist.cpp \
../generic/listctrl.cpp \
../generic/laywin.cpp \
../generic/msgdlgg.cpp \
../generic/panelg.cpp \
../generic/printps.cpp \
../generic/prntdlgg.cpp \
../generic/sashwin.cpp \
../generic/scrolwin.cpp \
../generic/splitter.cpp \
../generic/statusbr.cpp \
../generic/tabg.cpp \
../generic/textdlgg.cpp \
../generic/treectrl.cpp
# If you're not using the generic ones, you
# may wish to define platform-specific ones
# treectrl.cpp \
# listctrl.cpp \
# imaglist.cpp \
# statusbr.cpp \
LIB_C_SRC=\
\
../common/y_tab.c \
../common/extended.c
all: $(WXLIB)
# Define library objects
OBJECTS=\
$(LIB_CPP_SRC:.cpp=.o) $(LIB_C_SRC:.c=.o)
$(WXLIB) : $(OBJECTS)
ar $(AROPTIONS) $@ $(OBJECTS)
$(RANLIB) $@
../common/y_tab.$(OBJSUFF): ../common/y_tab.c ../common/lex_yy.c
$(CCLEX) -c $(CFLAGS) -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
# above.
../common/lex_yy.c: ../common/lexer.l
$(LEX) -o../common/lex.yy.c ../common/lexer.l
sed -e "s/BUFSIZ/5000/g" < ../common/lex.yy.c | \
sed -e "s/yyoutput(c)/void yyoutput(c)/g" | \
sed -e "s/YYLMAX 200/YYLMAX 5000/g" > ../common/lex_yy.c
/bin/rm -f ../common/lex.yy.c
# Replace yacc with bison if you run into compilation
# problems with y_tab.c.
../common/y_tab.c: ../common/parser.y
$(YACC) ../common/parser.y
mv y.tab.c ../common/y_tab.c
clean:
rm -f $(OBJECTS) $(WXLIB)

View File

@ -277,8 +277,8 @@ void wxNotebook::OnSize(wxSizeEvent& event)
int w, h;
GetSize(&w, &h);
uint nCount = m_aPages.Count();
for ( uint nPage = 0; nPage < nCount; nPage++ ) {
unsigned int nCount = m_aPages.Count();
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
wxNotebookPage *pPage = m_aPages[nPage];
pPage->SetSize(0, 0, w, h);
if ( pPage->GetAutoLayout() )

View File

@ -42,13 +42,13 @@ bool wxPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
bool wxPrinter::PrintDialog(wxWindow *parent)
{
wxPrintDialog dialog(parent, & printData);
wxPrintDialog dialog(parent, & m_printData);
return (dialog.ShowModal() == wxID_OK);
}
bool wxPrinter::Setup(wxWindow *parent)
{
wxPrintDialog dialog(parent, & printData);
wxPrintDialog dialog(parent, & m_printData);
dialog.GetPrintData().SetSetupDialog(TRUE);
return (dialog.ShowModal() == wxID_OK);
}
@ -69,10 +69,10 @@ wxPrintPreview::~wxPrintPreview()
bool wxPrintPreview::Print(bool interactive)
{
if (!printPrintout)
if (!m_printPrintout)
return FALSE;
wxPrinter printer(&printData);
return printer.Print(previewFrame, printPrintout, interactive);
wxPrinter printer(&m_printData);
return printer.Print(m_previewFrame, m_printPrintout, interactive);
}
void wxPrintPreview::DetermineScaling()

View File

@ -17,8 +17,13 @@
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
BEGIN_EVENT_TABLE(wxSlider, wxControl)
END_EVENT_TABLE()
#endif
// Slider
wxSlider::wxSlider()
{

View File

@ -34,9 +34,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE()
#endif