minor Configure / makefiles updates

Removed mor (egcs) warnings
  Updated version to 2.0.1 in version.h
  Several corrections for strict compilers
  OpenGL updates
  new wxApp::InitVisual() for overriding in order to set non-default visual
    (unportable, of course)
  Added makefiles for DialogEd and Tex2Rtf
  made wxGTK compile with Tex2Rtf
  Added BEGIN_DRAG event to tree ctrl
  Added missing #include to lexel.l (unistd.h) (MSW?)
  new wxGTK.spec
  turned one or two more #ifdef into #if


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-01-08 20:33:18 +00:00
parent ed38ec7e34
commit bbe0af5b15
67 changed files with 1777 additions and 1309 deletions

View File

@@ -976,6 +976,7 @@ typedef void* gpointer;
/* Stand-ins for GDK types */ /* Stand-ins for GDK types */
typedef gulong GdkAtom; typedef gulong GdkAtom;
typedef struct _GdkVisual GdkVisual;
typedef struct _GdkColor GdkColor; typedef struct _GdkColor GdkColor;
typedef struct _GdkColormap GdkColormap; typedef struct _GdkColormap GdkColormap;
typedef struct _GdkFont GdkFont; typedef struct _GdkFont GdkFont;
@@ -994,9 +995,7 @@ typedef struct _GtkList GtkList;
typedef struct _GtkToolbar GtkToolbar; typedef struct _GtkToolbar GtkToolbar;
typedef struct _GtkNotebook GtkNotebook; typedef struct _GtkNotebook GtkNotebook;
typedef struct _GtkNotebookPage GtkNotebookPage; typedef struct _GtkNotebookPage GtkNotebookPage;
#endif #endif
#endif #endif
// _WX_DEFS_H_ // _WX_DEFS_H_

View File

@@ -456,6 +456,7 @@ protected:
wxBrush *m_hilightBrush; wxBrush *m_hilightBrush;
wxImageList *m_imageListNormal, wxImageList *m_imageListNormal,
*m_imageListState; *m_imageListState;
int m_dragCount;
// the common part of all ctors // the common part of all ctors
void Init(); void Init();

View File

@@ -31,6 +31,9 @@ class wxLog;
extern wxApp *wxTheApp; extern wxApp *wxTheApp;
extern GdkVisual *wxVisualSetByExternal;
extern GdkColormap *wxColormapSetByExternal;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global functions // global functions
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -55,48 +58,56 @@ class wxApp: public wxEvtHandler
public: public:
wxApp(void); wxApp();
~wxApp(void); ~wxApp();
static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; } static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; } static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; }
virtual bool OnInit(void); /* this may have to be overwritten when special, non-default visuals have
virtual bool OnInitGui(void); to be set. it is also platform dependent as only X knows about displays
virtual int OnRun(void); and visuals. by standard, this routine looks at wxVisualSetByExternal
virtual int OnExit(void); which might have been set in the wxModule code of the OpenGL canvas */
virtual bool InitVisual();
wxWindow *GetTopWindow(void); virtual bool OnInit();
virtual bool OnInitGui();
virtual int OnRun();
virtual int OnExit();
wxWindow *GetTopWindow();
void SetTopWindow( wxWindow *win ); void SetTopWindow( wxWindow *win );
virtual int MainLoop(void); virtual int MainLoop();
void ExitMainLoop(void); void ExitMainLoop();
bool Initialized(void); bool Initialized();
virtual bool Pending(void); virtual bool Pending();
virtual void Dispatch(void); virtual void Dispatch();
inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; } inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
inline bool GetWantDebugOutput(void) { return m_wantDebugOutput; } inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
void OnIdle( wxIdleEvent &event ); void OnIdle( wxIdleEvent &event );
bool SendIdleEvents(void); bool SendIdleEvents();
bool SendIdleEvents( wxWindow* win ); bool SendIdleEvents( wxWindow* win );
inline wxString GetAppName(void) const { inline wxString GetAppName() const
{
if (m_appName != "") if (m_appName != "")
return m_appName; return m_appName;
else return m_className; else return m_className;
} }
inline void SetAppName(const wxString& name) { m_appName = name; }; inline void SetAppName(const wxString& name) { m_appName = name; };
inline wxString GetClassName(void) const { return m_className; } inline wxString GetClassName() const { return m_className; }
inline void SetClassName(const wxString& name) { m_className = name; } inline void SetClassName(const wxString& name) { m_className = name; }
const wxString& GetVendorName() const { return m_vendorName; } const wxString& GetVendorName() const { return m_vendorName; }
void SetVendorName(const wxString& name) { m_vendorName = name; } void SetVendorName(const wxString& name) { m_vendorName = name; }
inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; } inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; } inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
void SetPrintMode(int WXUNUSED(mode) ) {}; void SetPrintMode(int WXUNUSED(mode) ) {};
int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; }; int GetPrintMode() const { return wxPRINT_POSTSCRIPT; };
// override this function to create default log target of arbitrary // override this function to create default log target of arbitrary
// user-defined classv (default implementation creates a wxLogGui object) // user-defined classv (default implementation creates a wxLogGui object)
@@ -104,11 +115,11 @@ class wxApp: public wxEvtHandler
// GTK implementation // GTK implementation
static void CommonInit(void); static void CommonInit();
static void CommonCleanUp(void); static void CommonCleanUp();
bool ProcessIdle(void); bool ProcessIdle();
void DeletePendingObjects(void); void DeletePendingObjects();
bool m_initialized; bool m_initialized;
bool m_exitOnFrameDelete; bool m_exitOnFrameDelete;

View File

@@ -59,6 +59,13 @@ public:
inline bool IsEnabled(int Id) const { return Enabled(Id); }; inline bool IsEnabled(int Id) const { return Enabled(Id); };
inline bool IsChecked(int Id) const { return Checked(Id); }; inline bool IsChecked(int Id) const { return Checked(Id); };
wxString GetLabel( int id ) const;
void SetLabel( int id, const wxString &label );
void EnableTop( int pos, bool flag );
void SetLabelTop( int pos, const wxString& label );
wxString GetLabelTop( int pos ) const;
int GetMenuCount() const { return m_menus.Number(); } int GetMenuCount() const { return m_menus.Number(); }
wxMenu *GetMenu(int n) const { return (wxMenu *)m_menus.Nth(n)->Data(); } wxMenu *GetMenu(int n) const { return (wxMenu *)m_menus.Nth(n)->Data(); }
@@ -102,7 +109,7 @@ public:
bool IsChecked( int id ) const; bool IsChecked( int id ) const;
void SetLabel( int id, const wxString &label ); void SetLabel( int id, const wxString &label );
wxString GetLabel(int id) const; wxString GetLabel( int id ) const;
// helpstring // helpstring
virtual void SetHelpString(int id, const wxString& helpString); virtual void SetHelpString(int id, const wxString& helpString);

View File

@@ -24,6 +24,22 @@
class wxTimer; class wxTimer;
//-----------------------------------------------------------------------------
// global functions
//-----------------------------------------------------------------------------
/* Timer functions (milliseconds) */
void wxStartTimer();
/* Gets time since last wxStartTimer or wxGetElapsedTime */
long wxGetElapsedTime(bool resetTimer = TRUE);
/* EXPERIMENTAL: comment this out if it doesn't compile. */
bool wxGetLocalTime(long *timeZone, int *dstObserved);
/* Get number of seconds since 00:00:00 GMT, Jan 1st 1970. */
long wxGetCurrentTime();
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxTimer // wxTimer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -32,6 +32,12 @@
extern const char *wxFrameNameStr; extern const char *wxFrameNameStr;
extern wxList wxTopLevelWindows; extern wxList wxTopLevelWindows;
//-----------------------------------------------------------------------------
// global function
//-----------------------------------------------------------------------------
wxWindow* wxGetActiveWindow();
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // classes
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -31,6 +31,9 @@ class wxLog;
extern wxApp *wxTheApp; extern wxApp *wxTheApp;
extern GdkVisual *wxVisualSetByExternal;
extern GdkColormap *wxColormapSetByExternal;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global functions // global functions
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -55,48 +58,56 @@ class wxApp: public wxEvtHandler
public: public:
wxApp(void); wxApp();
~wxApp(void); ~wxApp();
static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; } static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; } static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; }
virtual bool OnInit(void); /* this may have to be overwritten when special, non-default visuals have
virtual bool OnInitGui(void); to be set. it is also platform dependent as only X knows about displays
virtual int OnRun(void); and visuals. by standard, this routine looks at wxVisualSetByExternal
virtual int OnExit(void); which might have been set in the wxModule code of the OpenGL canvas */
virtual bool InitVisual();
wxWindow *GetTopWindow(void); virtual bool OnInit();
virtual bool OnInitGui();
virtual int OnRun();
virtual int OnExit();
wxWindow *GetTopWindow();
void SetTopWindow( wxWindow *win ); void SetTopWindow( wxWindow *win );
virtual int MainLoop(void); virtual int MainLoop();
void ExitMainLoop(void); void ExitMainLoop();
bool Initialized(void); bool Initialized();
virtual bool Pending(void); virtual bool Pending();
virtual void Dispatch(void); virtual void Dispatch();
inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; } inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
inline bool GetWantDebugOutput(void) { return m_wantDebugOutput; } inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
void OnIdle( wxIdleEvent &event ); void OnIdle( wxIdleEvent &event );
bool SendIdleEvents(void); bool SendIdleEvents();
bool SendIdleEvents( wxWindow* win ); bool SendIdleEvents( wxWindow* win );
inline wxString GetAppName(void) const { inline wxString GetAppName() const
{
if (m_appName != "") if (m_appName != "")
return m_appName; return m_appName;
else return m_className; else return m_className;
} }
inline void SetAppName(const wxString& name) { m_appName = name; }; inline void SetAppName(const wxString& name) { m_appName = name; };
inline wxString GetClassName(void) const { return m_className; } inline wxString GetClassName() const { return m_className; }
inline void SetClassName(const wxString& name) { m_className = name; } inline void SetClassName(const wxString& name) { m_className = name; }
const wxString& GetVendorName() const { return m_vendorName; } const wxString& GetVendorName() const { return m_vendorName; }
void SetVendorName(const wxString& name) { m_vendorName = name; } void SetVendorName(const wxString& name) { m_vendorName = name; }
inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; } inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; } inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
void SetPrintMode(int WXUNUSED(mode) ) {}; void SetPrintMode(int WXUNUSED(mode) ) {};
int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; }; int GetPrintMode() const { return wxPRINT_POSTSCRIPT; };
// override this function to create default log target of arbitrary // override this function to create default log target of arbitrary
// user-defined classv (default implementation creates a wxLogGui object) // user-defined classv (default implementation creates a wxLogGui object)
@@ -104,11 +115,11 @@ class wxApp: public wxEvtHandler
// GTK implementation // GTK implementation
static void CommonInit(void); static void CommonInit();
static void CommonCleanUp(void); static void CommonCleanUp();
bool ProcessIdle(void); bool ProcessIdle();
void DeletePendingObjects(void); void DeletePendingObjects();
bool m_initialized; bool m_initialized;
bool m_exitOnFrameDelete; bool m_exitOnFrameDelete;

View File

@@ -59,6 +59,13 @@ public:
inline bool IsEnabled(int Id) const { return Enabled(Id); }; inline bool IsEnabled(int Id) const { return Enabled(Id); };
inline bool IsChecked(int Id) const { return Checked(Id); }; inline bool IsChecked(int Id) const { return Checked(Id); };
wxString GetLabel( int id ) const;
void SetLabel( int id, const wxString &label );
void EnableTop( int pos, bool flag );
void SetLabelTop( int pos, const wxString& label );
wxString GetLabelTop( int pos ) const;
int GetMenuCount() const { return m_menus.Number(); } int GetMenuCount() const { return m_menus.Number(); }
wxMenu *GetMenu(int n) const { return (wxMenu *)m_menus.Nth(n)->Data(); } wxMenu *GetMenu(int n) const { return (wxMenu *)m_menus.Nth(n)->Data(); }
@@ -102,7 +109,7 @@ public:
bool IsChecked( int id ) const; bool IsChecked( int id ) const;
void SetLabel( int id, const wxString &label ); void SetLabel( int id, const wxString &label );
wxString GetLabel(int id) const; wxString GetLabel( int id ) const;
// helpstring // helpstring
virtual void SetHelpString(int id, const wxString& helpString); virtual void SetHelpString(int id, const wxString& helpString);

View File

@@ -24,6 +24,22 @@
class wxTimer; class wxTimer;
//-----------------------------------------------------------------------------
// global functions
//-----------------------------------------------------------------------------
/* Timer functions (milliseconds) */
void wxStartTimer();
/* Gets time since last wxStartTimer or wxGetElapsedTime */
long wxGetElapsedTime(bool resetTimer = TRUE);
/* EXPERIMENTAL: comment this out if it doesn't compile. */
bool wxGetLocalTime(long *timeZone, int *dstObserved);
/* Get number of seconds since 00:00:00 GMT, Jan 1st 1970. */
long wxGetCurrentTime();
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxTimer // wxTimer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -32,6 +32,12 @@
extern const char *wxFrameNameStr; extern const char *wxFrameNameStr;
extern wxList wxTopLevelWindows; extern wxList wxTopLevelWindows;
//-----------------------------------------------------------------------------
// global function
//-----------------------------------------------------------------------------
wxWindow* wxGetActiveWindow();
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // classes
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -15,8 +15,8 @@
/* Bump-up with each new version */ /* Bump-up with each new version */
#define wxMAJOR_VERSION 2 #define wxMAJOR_VERSION 2
#define wxMINOR_VERSION 0 #define wxMINOR_VERSION 0
#define wxRELEASE_NUMBER 0 #define wxRELEASE_NUMBER 1
#define wxVERSION_STRING "wxWindows 2.0" #define wxVERSION_STRING "wxWindows 2.0.1"
#define wxVERSION_NUMBER (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER #define wxVERSION_NUMBER (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER
#define wxBETA_NUMBER 17 #define wxBETA_NUMBER 17
#define wxVERSION_FLOAT wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) #define wxVERSION_FLOAT wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0)

View File

@@ -40,7 +40,11 @@ enum Language {langENGLISH, langFRENCH, langGERMAN, langSPANISH, langOTHER};
class CeditorDlg; class CeditorDlg;
class CparameterDlg; class CparameterDlg;
#ifdef __WXGTK__
const char paramFilename[] = "../database.cfg";
#else
const char paramFilename[] = "database.cfg"; const char paramFilename[] = "database.cfg";
#endif
/* /*

View File

@@ -854,7 +854,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, const wxString& name )
} }
/* /*
* REading the image data * Reading the image data
*/ */
fseek(file, offset, SEEK_SET); fseek(file, offset, SEEK_SET);
data = ptr; data = ptr;

View File

@@ -12,6 +12,7 @@ WORDCHAR [^'\\]
* either lex and flex. * either lex and flex.
*/ */
#include <string.h> #include <string.h>
#include <unistd.h>
/* +++steve162e: added, otherwise, PROIO_input will be undefined (at least under LINUX) /* +++steve162e: added, otherwise, PROIO_input will be undefined (at least under LINUX)
please check, if this is also TRUE under other UNIXes. please check, if this is also TRUE under other UNIXes.

View File

@@ -510,8 +510,12 @@ void wxSocketBase::Discard()
// If what? Who seems to need unsigned int? // If what? Who seems to need unsigned int?
// BTW uint isn't even defined on wxMSW for VC++ for some reason. Even if it // BTW uint isn't even defined on wxMSW for VC++ for some reason. Even if it
// were, getpeername/getsockname don't take unsigned int*, they take int*. // were, getpeername/getsockname don't take unsigned int*, they take int*.
#if 0 //
#define wxSOCKET_INT unsigned int // Under glibc 2.0.7, socketbits.h declares socklen_t to be unsigned int
// and it uses *socklen_t as the 3rd parameter. Robert.
#ifdef __LINUX__
#define wxSOCKET_INT socklen_t
#else #else
#define wxSOCKET_INT int #define wxSOCKET_INT int
#endif #endif

View File

@@ -157,7 +157,9 @@ char *wxStreamBuffer::AllocSpaceWBack(size_t needed_size)
if (!temp_b) if (!temp_b)
return NULL; return NULL;
m_wback = temp_b; m_wback = temp_b;
printf("Buffer(0x%x)->Write: 0x%x, %d\n", this, m_wback, m_wbacksize);
/* printf("Buffer(0x%x)->Write: 0x%x, %d\n", this, m_wback, m_wbacksize); */
return (char *)(m_wback+(m_wbacksize-needed_size)); return (char *)(m_wback+(m_wbacksize-needed_size));
} }
@@ -165,7 +167,8 @@ size_t wxStreamBuffer::GetWBack(char *buf, size_t bsize)
{ {
size_t s_toget = m_wbacksize-m_wbackcur; size_t s_toget = m_wbacksize-m_wbackcur;
printf("Buffer(0x%x): 0x%x, %d\n", this, m_wback, m_wbacksize); /* printf("Buffer(0x%x): 0x%x, %d\n", this, m_wback, m_wbacksize); */
if (bsize < s_toget) if (bsize < s_toget)
s_toget = bsize; s_toget = bsize;

View File

@@ -335,16 +335,20 @@ void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event))
{ {
if (!m_useEvents) return; if (!m_useEvents) return;
int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection()); int fontFamily = 0; /* shut up buggy egcs warnings */
int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection()); fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection());
int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection()); int fontWeight = 0;
fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection());
int fontStyle = 0;
fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection());
int fontSize = atoi(pointSizeChoice->GetStringSelection()); int fontSize = atoi(pointSizeChoice->GetStringSelection());
int fontUnderline = underLineCheckBox->GetValue(); int fontUnderline = underLineCheckBox->GetValue();
dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0)); dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0));
if (colourChoice->GetStringSelection() != "") if (colourChoice->GetStringSelection() != "")
{ {
wxColour *col = wxTheColourDatabase->FindColour(colourChoice->GetStringSelection()); wxColour *col = (wxColour*) NULL;
col = wxTheColourDatabase->FindColour(colourChoice->GetStringSelection());
if (col) if (col)
{ {
fontData.fontColour = *col; fontData.fontColour = *col;

View File

@@ -49,7 +49,7 @@ IMPLEMENT_CLASS(wxExtHelpController, wxHelpControllerBase)
wxExtHelpController::wxExtHelpController(void) wxExtHelpController::wxExtHelpController(void)
{ {
m_MapList = NULL; m_MapList = (wxList*) NULL;
m_BrowserName = WXEXTHELP_DEFAULTBROWSER; m_BrowserName = WXEXTHELP_DEFAULTBROWSER;
m_BrowserIsNetscape = WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE; m_BrowserIsNetscape = WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE;
m_NumOfEntries = 0; m_NumOfEntries = 0;
@@ -76,7 +76,7 @@ wxExtHelpController::DeleteList(void)
node = m_MapList->First(); node = m_MapList->First();
} }
delete m_MapList; delete m_MapList;
m_MapList = NULL; m_MapList = (wxList*) NULL;
} }
} }

View File

@@ -359,6 +359,8 @@ void wxTreeCtrl::Init()
m_imageListNormal = m_imageListNormal =
m_imageListState = (wxImageList *) NULL; m_imageListState = (wxImageList *) NULL;
m_dragCount = 0;
} }
bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
@@ -1031,16 +1033,16 @@ void wxTreeCtrl::AdjustMyScrollbars()
void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
{ {
// render bold items in bold /* render bold items in bold */
wxFont fontOld; wxFont fontOld;
wxFont fontNew; wxFont fontNew;
if ( item->IsBold() ) if (item->IsBold())
{ {
fontOld = dc.GetFont(); fontOld = dc.GetFont();
if (fontOld.Ok()) if (fontOld.Ok())
{ {
// @@ is there any better way to make a bold variant of old font? /* @@ is there any better way to make a bold variant of old font? */
fontNew = wxFont( fontOld.GetPointSize(), fontNew = wxFont( fontOld.GetPointSize(),
fontOld.GetFamily(), fontOld.GetFamily(),
fontOld.GetStyle(), fontOld.GetStyle(),
@@ -1093,7 +1095,7 @@ void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
dc.DrawText( item->GetText(), image_w + item->GetX(), item->GetY() ); dc.DrawText( item->GetText(), image_w + item->GetX(), item->GetY() );
// restore normal font for bold items /* restore normal font for bold items */
if (fontOld.Ok()) if (fontOld.Ok())
{ {
dc.SetFont( fontOld); dc.SetFont( fontOld);
@@ -1134,8 +1136,10 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
dc.DrawLine( horizX+13, y, horizX+18, y ); dc.DrawLine( horizX+13, y, horizX+18, y );
if (!item->IsExpanded()) if (!item->IsExpanded())
{
dc.DrawLine( horizX+15, y-2, horizX+15, y+3 ); dc.DrawLine( horizX+15, y-2, horizX+15, y+3 );
} }
}
if (item->HasHilight()) if (item->HasHilight())
{ {
@@ -1165,7 +1169,7 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
} }
} }
if ( item->IsExpanded() ) if (item->IsExpanded())
{ {
int semiOldY = y; int semiOldY = y;
@@ -1175,15 +1179,13 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
{ {
y += m_lineHeight; y += m_lineHeight;
semiOldY = y; semiOldY = y;
PaintLevel( children[n], dc, level+1, y ); PaintLevel( children[n], dc, level+1, y );
} }
// it may happen that the item is expanded but has no items (when you /* it may happen that the item is expanded but has no items (when you
// delete all its children for example) - don't draw the vertical line * delete all its children for example) - don't draw the vertical line
// in this case * in this case */
if ( count > 0 ) if (count > 0) dc.DrawLine( horizX+15, oldY+5, horizX+15, semiOldY );
dc.DrawLine( horizX+15, oldY+5, horizX+15, semiOldY );
} }
} }
@@ -1211,15 +1213,15 @@ void wxTreeCtrl::OnPaint( wxPaintEvent &WXUNUSED(event) )
void wxTreeCtrl::OnSetFocus( wxFocusEvent &WXUNUSED(event) ) void wxTreeCtrl::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
{ {
m_hasFocus = TRUE; m_hasFocus = TRUE;
if ( m_current )
RefreshLine( m_current ); if (m_current) RefreshLine( m_current );
} }
void wxTreeCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) ) void wxTreeCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
{ {
m_hasFocus = FALSE; m_hasFocus = FALSE;
if ( m_current )
RefreshLine( m_current ); if (m_current) RefreshLine( m_current );
} }
void wxTreeCtrl::OnChar( wxKeyEvent &event ) void wxTreeCtrl::OnChar( wxKeyEvent &event )
@@ -1369,11 +1371,11 @@ wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& WXUNUSED(flags))
void wxTreeCtrl::OnMouse( wxMouseEvent &event ) void wxTreeCtrl::OnMouse( wxMouseEvent &event )
{ {
if ( !(event.LeftDown() || event.LeftDClick()) ) if (!event.LeftIsDown()) m_dragCount = 0;
return;
if ( !m_anchor ) if ( !(event.LeftDown() || event.LeftDClick() || event.Dragging()) ) return;
return;
if ( !m_anchor ) return;
wxClientDC dc(this); wxClientDC dc(this);
PrepareDC(dc); PrepareDC(dc);
@@ -1382,12 +1384,30 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
bool onButton = FALSE; bool onButton = FALSE;
wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y), onButton ); wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y), onButton );
if ( item == NULL )
if (item == NULL) return; /* we hit the blank area */
if (event.Dragging())
{
if (m_dragCount == 2) /* small drag latency (3?) */
{
m_dragCount = 0;
wxTreeEvent nevent(wxEVT_COMMAND_TREE_BEGIN_DRAG, GetId());
nevent.m_item = m_current;
nevent.SetEventObject(this);
GetEventHandler()->ProcessEvent(nevent);
}
else
{
m_dragCount++;
}
return; return;
}
if (!IsSelected(item)) SelectItem(item); if (!IsSelected(item)) SelectItem(item); /* we dont support multiple selections, BTW */
if ( event.LeftDClick() ) if (event.LeftDClick())
{ {
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
event.m_item = item; event.m_item = item;
@@ -1396,7 +1416,7 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
} }
if ( onButton ) if (onButton)
{ {
Toggle( item ); Toggle( item );
} }
@@ -1404,6 +1424,9 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
void wxTreeCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) ) void wxTreeCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
{ {
/* after all changes have been done to the tree control,
* we actually redraw the tree when everything is over */
if (!m_dirty) return; if (!m_dirty) return;
m_dirty = FALSE; m_dirty = FALSE;
@@ -1414,11 +1437,8 @@ void wxTreeCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item, void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &y )
wxDC &dc,
int level,
int &y )
{ {
int horizX = level*m_indent; int horizX = level*m_indent;
@@ -1426,24 +1446,24 @@ void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item,
item->SetY( y-m_lineHeight/3-2 ); item->SetY( y-m_lineHeight/3-2 );
item->SetHeight( m_lineHeight ); item->SetHeight( m_lineHeight );
// if ( item->IsExpanded() ) if ( !item->IsExpanded() )
// return; {
if ( !item->IsExpanded() ) // Surely this is correct? JACS /* we dont need to calculate collapsed branches */
return; return;
}
wxArrayTreeItems& children = item->GetChildren(); wxArrayTreeItems& children = item->GetChildren();
size_t count = children.Count(); size_t count = children.Count();
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
y += m_lineHeight; y += m_lineHeight;
CalculateLevel( children[n], dc, level+1, y ); CalculateLevel( children[n], dc, level+1, y ); /* recurse */
} }
} }
void wxTreeCtrl::CalculatePositions() void wxTreeCtrl::CalculatePositions()
{ {
if ( !m_anchor ) if ( !m_anchor ) return;
return;
wxClientDC dc(this); wxClientDC dc(this);
PrepareDC( dc ); PrepareDC( dc );
@@ -1454,7 +1474,7 @@ void wxTreeCtrl::CalculatePositions()
m_lineHeight = (int)(dc.GetCharHeight() + 4); m_lineHeight = (int)(dc.GetCharHeight() + 4);
int y = m_lineHeight / 2 + 2; int y = m_lineHeight / 2 + 2;
CalculateLevel( m_anchor, dc, 0, y ); CalculateLevel( m_anchor, dc, 0, y ); /* start recursion */
} }
void wxTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) void wxTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
@@ -1487,6 +1507,7 @@ void wxTreeCtrl::RefreshLine( wxGenericTreeItem *item )
rect.y = dc.LogicalToDeviceY( item->GetY() - 2 ); rect.y = dc.LogicalToDeviceY( item->GetY() - 2 );
rect.width = 1000; rect.width = 1000;
rect.height = dc.GetCharHeight() + 6; rect.height = dc.GetCharHeight() + 6;
Refresh( TRUE, &rect ); Refresh( TRUE, &rect );
} }

View File

@@ -15,6 +15,13 @@
#include <ctype.h> #include <ctype.h>
#ifdef __WXDEBUG__
#ifdef NULL
#undef NULL
#endif
#define NULL ((void*)0L)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxAcceleratorTable // wxAcceleratorTable
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -44,6 +44,9 @@ wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
extern wxResourceCache *wxTheResourceCache; extern wxResourceCache *wxTheResourceCache;
GdkVisual *wxVisualSetByExternal = (GdkVisual*) NULL;
GdkColormap *wxColormapSetByExternal = (GdkColormap*) NULL;
unsigned char g_palette[64*3] = unsigned char g_palette[64*3] =
{ {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@@ -169,14 +172,60 @@ wxApp::~wxApp(void)
gtk_idle_remove( m_idleTag ); gtk_idle_remove( m_idleTag );
} }
bool wxApp::OnInit(void) bool wxApp::InitVisual()
{ {
if (wxVisualSetByExternal)
{
/* this happens in the wxModule code of the OpenGl canvas.
it chooses the best display for OpenGl and stores it
in wxDisplaySetByExternal. we then have to make it the
default for the system */
gtk_widget_set_default_visual( wxVisualSetByExternal );
}
if (wxColormapSetByExternal)
{
/* OpenGl also gives us a colormap */
gtk_widget_set_default_colormap( wxColormapSetByExternal );
}
else
{
/* this initiates the standard palette as defined by GdkImlib
in the GNOME libraries. it ensures that all GNOME applications
use the same 64 colormap entries on 8-bit displays so you
can use several rather graphics-heavy applications at the
same time */
GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE );
for (int i = 0; i < 64; i++)
{
GdkColor col;
col.red = g_palette[i*3 + 0] << 8;
col.green = g_palette[i*3 + 1] << 8;
col.blue = g_palette[i*3 + 2] << 8;
col.pixel = 0;
gdk_color_alloc( cmap, &col );
}
gtk_widget_set_default_colormap( cmap );
}
return TRUE; return TRUE;
} }
bool wxApp::OnInitGui(void) bool wxApp::OnInitGui(void)
{ {
m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL );
return TRUE;
}
bool wxApp::OnInit(void)
{
return TRUE; return TRUE;
} }
@@ -320,12 +369,6 @@ void wxApp::SetTopWindow( wxWindow *win )
void wxApp::CommonInit(void) void wxApp::CommonInit(void)
{ {
/*
#if wxUSE_RESOURCES
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif
*/
wxSystemSettings::Init(); wxSystemSettings::Init();
wxTheFontNameDirectory = new wxFontNameDirectory; wxTheFontNameDirectory = new wxFontNameDirectory;
@@ -350,14 +393,19 @@ void wxApp::CommonInit(void)
void wxApp::CommonCleanUp(void) void wxApp::CommonCleanUp(void)
{ {
wxDELETE(wxTheColourDatabase); if (wxTheColourDatabase) delete wxTheColourDatabase;
wxDELETE(wxTheFontNameDirectory); wxTheColourDatabase = (wxColourDatabase*) NULL;
if (wxTheFontNameDirectory) delete wxTheFontNameDirectory;
wxTheFontNameDirectory = (wxFontNameDirectory*) NULL;
wxDeleteStockObjects(); wxDeleteStockObjects();
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES
wxFlushResources(); wxFlushResources();
wxDELETE(wxTheResourceCache); if (wxTheResourceCache) delete wxTheResourceCache;
wxTheResourceCache = (wxResourceCache*) NULL;
wxCleanUpResourceSystem(); wxCleanUpResourceSystem();
#endif #endif
@@ -419,29 +467,14 @@ int wxEntry( int argc, char *argv[] )
gtk_init( &argc, &argv ); gtk_init( &argc, &argv );
GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE );
for (int i = 0; i < 64; i++)
{
GdkColor col;
col.red = g_palette[i*3 + 0] << 8;
col.green = g_palette[i*3 + 1] << 8;
col.blue = g_palette[i*3 + 2] << 8;
col.pixel = 0;
gdk_color_alloc( cmap, &col );
}
gtk_widget_push_colormap( cmap );
gtk_widget_set_default_colormap( cmap );
wxApp::CommonInit();
wxModule::RegisterModules(); wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE; if (!wxModule::InitializeModules()) return FALSE;
wxTheApp->OnInitGui(); if (!wxTheApp->InitVisual()) return 0;
wxApp::CommonInit();
if (!wxTheApp->OnInitGui()) return 0;
// Here frames insert themselves automatically // Here frames insert themselves automatically
// into wxTopLevelWindows by getting created // into wxTopLevelWindows by getting created
@@ -481,11 +514,9 @@ int wxEntry( int argc, char *argv[] )
#endif #endif
wxLog *oldLog = wxLog::SetActiveTarget( NULL ); wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL );
if (oldLog) delete oldLog; if (oldLog) delete oldLog;
return retValue; return retValue;
} }
//-----------------------------------------------------------------------------

View File

@@ -27,14 +27,15 @@ wxCheckListBox::wxCheckListBox() :
{ {
m_hasCheckBoxes = TRUE; m_hasCheckBoxes = TRUE;
} }
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos,
const wxSize& size = wxDefaultSize, const wxSize& size,
int nStrings = 0, int nStrings,
const wxString choices[] = NULL, const wxString choices[],
long style = 0, long style,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator,
const wxString& name = wxListBoxNameStr) const wxString& name )
{ {
m_hasCheckBoxes = TRUE; m_hasCheckBoxes = TRUE;
wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name ); wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name );

View File

@@ -255,7 +255,7 @@ void wxComboBox::Delete( int n )
return; return;
} }
GList *list = g_list_append( NULL, child->data ); GList *list = g_list_append( (GList*) NULL, child->data );
gtk_list_remove_items( listbox, list ); gtk_list_remove_items( listbox, list );
g_list_free( list ); g_list_free( list );

View File

@@ -14,7 +14,6 @@
#pragma interface #pragma interface
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
#if wxUSE_POSTSCRIPT #if wxUSE_POSTSCRIPT

View File

@@ -733,8 +733,8 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
if (!m_data) return (wxDragResult) wxDragNone; if (!m_data) return (wxDragResult) wxDragNone;
static GtkWidget *drag_icon = NULL; static GtkWidget *drag_icon = (GtkWidget*) NULL;
static GtkWidget *drop_icon = NULL; static GtkWidget *drop_icon = (GtkWidget*) NULL;
GdkPoint hotspot_1 = {0,-5 }; GdkPoint hotspot_1 = {0,-5 };
@@ -872,7 +872,7 @@ void wxDropSource::UnregisterWindow(void)
/* /*
* Shaped Windows * Shaped Windows
*/ */
static GdkWindow *root_win = NULL; static GdkWindow *root_win = (GdkWindow*) NULL;
typedef struct _cursoroffset {gint x,y;} CursorOffset; typedef struct _cursoroffset {gint x,y;} CursorOffset;
@@ -895,7 +895,8 @@ shape_pressed (GtkWidget *widget, GdkEventButton *event)
(GDK_BUTTON_RELEASE_MASK | (GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_MOTION_MASK | GDK_BUTTON_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK), GDK_POINTER_MOTION_HINT_MASK),
NULL, NULL, 0); (GdkWindow*)NULL,
(GdkCursor*) NULL, 0);
} }

View File

@@ -423,7 +423,7 @@ void wxListBox::Delete( int n )
wxCHECK_RET( child, "wrong listbox index" ); wxCHECK_RET( child, "wrong listbox index" );
GList *list = g_list_append( NULL, child->data ); GList *list = g_list_append( (GList*) NULL, child->data );
gtk_list_remove_items( m_list, list ); gtk_list_remove_items( m_list, list );
g_list_free( list ); g_list_free( list );

View File

@@ -155,14 +155,38 @@ bool wxMenuBar::Enabled( int id ) const
return FALSE; return FALSE;
} }
wxString wxMenuBar::GetLabel( int id ) const
{
wxMenuItem* item = FindMenuItemById( id );
if (item) return item->GetText();
return "";
}
void wxMenuBar::SetLabel( int id, const wxString &label )
{
wxMenuItem* item = FindMenuItemById( id );
if (item) return item->SetText( label );
}
void wxMenuBar::EnableTop( int WXUNUSED(pos), bool WXUNUSED(flag) )
{
}
wxString wxMenuBar::GetLabelTop( int WXUNUSED(pos) ) const
{
return "menu";
}
void wxMenuBar::SetLabelTop( int WXUNUSED(pos), const wxString& WXUNUSED(label) )
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "activate" // "activate"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{ {
wxYield();
int id = menu->FindMenuIdByMenuItem(widget); int id = menu->FindMenuIdByMenuItem(widget);
/* should find it for normal (not popup) menu */ /* should find it for normal (not popup) menu */

View File

@@ -17,7 +17,6 @@
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "clicked" // "clicked"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -429,7 +429,7 @@ bool wxNotebook::SetPageImage( int page, int image )
if (image == -1 && nb_page->m_image == -1) if (image == -1 && nb_page->m_image == -1)
return TRUE; /* Case 1): Nothing to do. */ return TRUE; /* Case 1): Nothing to do. */
GtkWidget *pixmapwid = NULL; GtkWidget *pixmapwid = (GtkWidget*) NULL;
if (nb_page->m_image != -1) if (nb_page->m_image != -1)
{ {

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "radiobox.h" #pragma implementation "radiobox.h"
#endif #endif
@@ -148,8 +147,8 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
wxSize wxRadioBox::LayoutItems() wxSize wxRadioBox::LayoutItems()
{ {
int x = m_x+7; int x = 7;
int y = m_y+15; int y = 15;
int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1; int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1;
@@ -160,7 +159,7 @@ wxSize wxRadioBox::LayoutItems()
for (int j = 0; j < m_majorDim; j++) for (int j = 0; j < m_majorDim; j++)
{ {
y = m_y+15; y = 15;
int max_len = 0; int max_len = 0;
wxNode *node = m_boxes.Nth( j*num_per_major ); wxNode *node = m_boxes.Nth( j*num_per_major );
@@ -169,10 +168,10 @@ wxSize wxRadioBox::LayoutItems()
GtkWidget *button = GTK_WIDGET( node->Data() ); GtkWidget *button = GTK_WIDGET( node->Data() );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
GdkFont *font = m_widget->style->font; GdkFont *font = m_widget->style->font;
int len = 27+gdk_string_measure( font, label->label ); int len = 22+gdk_string_measure( font, label->label );
if (len > max_len) max_len = len; if (len > max_len) max_len = len;
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y ); gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
y += 22; y += 22;
node = node->Next(); node = node->Next();
@@ -197,8 +196,8 @@ wxSize wxRadioBox::LayoutItems()
x += max_len + 2; x += max_len + 2;
} }
res.y -= 3; res.x = x+4;
res.x = x-2; res.y += 9;
} }
else else
{ {
@@ -211,7 +210,7 @@ wxSize wxRadioBox::LayoutItems()
GtkLabel *label = GTK_LABEL( button->child ); GtkLabel *label = GTK_LABEL( button->child );
GdkFont *font = m_widget->style->font; GdkFont *font = m_widget->style->font;
int len = 27+gdk_string_measure( font, label->label ); int len = 22+gdk_string_measure( font, label->label );
if (len > max) max = len; if (len > max) max = len;
node = node->Next(); node = node->Next();
@@ -222,13 +221,13 @@ wxSize wxRadioBox::LayoutItems()
{ {
GtkWidget *button = GTK_WIDGET( node->Data() ); GtkWidget *button = GTK_WIDGET( node->Data() );
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y ); gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
x += max; x += max;
gtk_widget_set_usize( button, max, 20 ); gtk_widget_set_usize( button, max, 20 );
node = node->Next(); node = node->Next();
} }
res.x = x-2; res.x = x+4;
res.y = 42; res.y = 42;
} }

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "region.h" #pragma implementation "region.h"
#endif #endif
@@ -17,6 +16,13 @@
#include "gdk/gdk.h" #include "gdk/gdk.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
#ifdef __WXDEBUG__
#ifdef NULL
#undef NULL
#endif
#define NULL ((void*)0L)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxRegion // wxRegion
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -303,7 +303,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
Clear(); Clear();
FILE *fp = NULL; FILE *fp = (FILE*) NULL;
struct stat statb; struct stat statb;
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
@@ -358,7 +358,7 @@ bool wxTextCtrl::SaveFile( const wxString &file )
} }
else else
{ {
char *text = NULL; char *text = (char*) NULL;
gint len = 0; gint len = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)

View File

@@ -64,7 +64,7 @@ public:
wxMutex::wxMutex() wxMutex::wxMutex()
{ {
p_internal = new wxMutexInternal; p_internal = new wxMutexInternal;
pthread_mutex_init(&(p_internal->p_mutex), NULL); pthread_mutex_init( &(p_internal->p_mutex), (const pthread_mutexattr_t*) NULL );
m_locked = 0; m_locked = 0;
} }
@@ -73,46 +73,54 @@ wxMutex::~wxMutex()
if (m_locked > 0) if (m_locked > 0)
wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked );
pthread_mutex_destroy(&(p_internal->p_mutex)); pthread_mutex_destroy( &(p_internal->p_mutex) );
delete p_internal; delete p_internal;
} }
wxMutexError wxMutex::Lock() wxMutexError wxMutex::Lock()
{ {
int err; int err = pthread_mutex_lock( &(p_internal->p_mutex) );
err = pthread_mutex_lock(&(p_internal->p_mutex));
if (err == EDEADLK) if (err == EDEADLK)
{
return wxMUTEX_DEAD_LOCK; return wxMUTEX_DEAD_LOCK;
}
m_locked++; m_locked++;
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
wxMutexError wxMutex::TryLock() wxMutexError wxMutex::TryLock()
{ {
int err;
if (m_locked) if (m_locked)
{
return wxMUTEX_BUSY; return wxMUTEX_BUSY;
}
err = pthread_mutex_trylock(&(p_internal->p_mutex)); int err = pthread_mutex_trylock( &(p_internal->p_mutex) );
switch (err) switch (err)
{ {
case EBUSY: return wxMUTEX_BUSY; case EBUSY: return wxMUTEX_BUSY;
} }
m_locked++; m_locked++;
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
wxMutexError wxMutex::Unlock() wxMutexError wxMutex::Unlock()
{ {
if (m_locked > 0) if (m_locked > 0)
{
m_locked--; m_locked--;
}
else else
{
return wxMUTEX_UNLOCKED; return wxMUTEX_UNLOCKED;
}
pthread_mutex_unlock( &(p_internal->p_mutex) );
pthread_mutex_unlock(&(p_internal->p_mutex));
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
@@ -129,37 +137,38 @@ public:
wxCondition::wxCondition() wxCondition::wxCondition()
{ {
p_internal = new wxConditionInternal; p_internal = new wxConditionInternal;
pthread_cond_init(&(p_internal->p_condition), NULL); pthread_cond_init( &(p_internal->p_condition), (const pthread_condattr_t *) NULL );
} }
wxCondition::~wxCondition() wxCondition::~wxCondition()
{ {
pthread_cond_destroy(&(p_internal->p_condition)); pthread_cond_destroy( &(p_internal->p_condition) );
delete p_internal; delete p_internal;
} }
void wxCondition::Wait(wxMutex& mutex) void wxCondition::Wait(wxMutex& mutex)
{ {
pthread_cond_wait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex)); pthread_cond_wait( &(p_internal->p_condition), &(mutex.p_internal->p_mutex) );
} }
bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec) bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec)
{ {
struct timespec tspec; struct timespec tspec;
tspec.tv_sec = time(NULL)+sec; tspec.tv_sec = time(0L)+sec;
tspec.tv_nsec = nsec; tspec.tv_nsec = nsec;
return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT); return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT);
} }
void wxCondition::Signal() void wxCondition::Signal()
{ {
pthread_cond_signal(&(p_internal->p_condition)); pthread_cond_signal( &(p_internal->p_condition) );
} }
void wxCondition::Broadcast() void wxCondition::Broadcast()
{ {
pthread_cond_broadcast(&(p_internal->p_condition)); pthread_cond_broadcast( &(p_internal->p_condition) );
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@@ -183,7 +192,7 @@ void *wxThreadInternal::PthreadStart(void *ptr)
wxThread *thread = (wxThread *)ptr; wxThread *thread = (wxThread *)ptr;
/* Call the main entry */ /* Call the main entry */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL );
void* status = thread->Entry(); void* status = thread->Entry();
thread->Exit(status); thread->Exit(status);
@@ -246,9 +255,9 @@ int wxThread::GetPriority() const
void wxThread::DeferDestroy(bool on) void wxThread::DeferDestroy(bool on)
{ {
if (on) if (on)
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, (int*) NULL);
else else
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL);
} }
wxThreadError wxThread::Destroy() wxThreadError wxThread::Destroy()

View File

@@ -15,6 +15,51 @@
#include "wx/timer.h" #include "wx/timer.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
/*
#include "glib.h"
*/
//-----------------------------------------------------------------------------
// global functions
//-----------------------------------------------------------------------------
/*
static GTimer *g_timer = (GTimer*) NULL;
void wxStartTimer()
{
if (g_timer)
{
g_timer_rest( g_timer );
}
else
{
g_timer = g_timer_new();
g_timer_start( g_timer );
}
}
long wxGetElapsedTime( bool resetTimer )
{
gulong res = 0;
if (g_timer)
{
g_timer_elapsed( g_timer, &res );
if (resetTimer) g_timer_reset( g_timer );
}
return res;
}
bool wxGetLocalTime( long *timeZone, int *dstObserved )
{
}
long wxGetCurrentTime()
{
}
*/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxTimer // wxTimer

View File

@@ -30,13 +30,10 @@
#include <netdb.h> #include <netdb.h>
#include <signal.h> #include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include "glib.h" #include "glib.h"
#include "gdk/gdk.h" #include "gdk/gdk.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "gtk/gtkfeatures.h"
#include "gdk/gdkx.h" #include "gdk/gdkx.h"
#ifdef __SVR4__ #ifdef __SVR4__
@@ -79,12 +76,7 @@ void wxDisplaySize( int *width, int *height )
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
{ {
Window dumw; gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
int dumi;
unsigned int dumu;
XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(),
&dumw,&dumw,x,y,&dumi,&dumi,&dumu );
} }
bool wxColourDisplay(void) bool wxColourDisplay(void)
@@ -97,6 +89,14 @@ int wxDisplayDepth(void)
return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth; return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
} }
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
if (majorVsn) *majorVsn = GTK_MAJOR_VERSION;
if (minorVsn) *minorVsn = GTK_MINOR_VERSION;
return wxGTK;
}
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// user and home routines // user and home routines
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@@ -124,7 +124,8 @@ char *wxGetUserHome( const wxString &user )
{ {
who = getpwnam(ptr); who = getpwnam(ptr);
} }
// We now make sure the the user exists!
/* We now make sure the the user exists! */
if (who == NULL) if (who == NULL)
{ {
who = getpwuid(getuid()); who = getpwuid(getuid());
@@ -266,7 +267,7 @@ static void GTK_EndProcessDetector(gpointer data, gint source,
* not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-) * not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-)
* --- offer@sgi.com */ * --- offer@sgi.com */
#if !defined(__sgi) #if !defined(__sgi)
wait4(proc_data->pid, NULL, 0, NULL); wait4(proc_data->pid, (int*) NULL, 0, (rusage *) NULL);
#else #else
wait3((int *) NULL, 0, (rusage *) NULL); wait3((int *) NULL, 0, (rusage *) NULL);
#endif #endif
@@ -291,8 +292,9 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
wxCHECK_MSG( *argv, 0, "can't exec empty command" ); wxCHECK_MSG( *argv, 0, "can't exec empty command" );
/* Create pipes */ /* Create pipes */
if (pipe(end_proc_detect) == -1) { if (pipe(end_proc_detect) == -1)
wxLogSysError(_("Pipe creation failed")); {
wxLogSysError( "Pipe creation failed" );
return 0; return 0;
} }
@@ -302,12 +304,13 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
#else #else
pid_t pid = fork(); pid_t pid = fork();
#endif #endif
if (pid == -1) { if (pid == -1)
// error {
wxLogSysError(_("Fork failed")); wxLogSysError( "Fork failed" );
return 0; return 0;
} }
else if (pid == 0) { else if (pid == 0)
{
// we're in child // we're in child
close(end_proc_detect[0]); // close reading side close(end_proc_detect[0]); // close reading side
// These three lines close the open file descriptors to // These three lines close the open file descriptors to
@@ -325,20 +328,23 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
execvp (*argv, argv); execvp (*argv, argv);
#endif #endif
// there is no return after successful exec() // there is no return after successful exec()
wxLogSysError(_("Can't execute '%s'"), *argv); wxLogSysError( "Can't execute '%s'", *argv);
_exit(-1); _exit(-1);
} }
else { else
{
// we're in parent // we're in parent
close(end_proc_detect[1]); // close writing side close(end_proc_detect[1]); // close writing side
data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ, data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
GTK_EndProcessDetector, (gpointer)data); GTK_EndProcessDetector, (gpointer)data);
data->pid = pid; data->pid = pid;
if (!sync) { if (!sync)
{
data->process = process; data->process = process;
} }
else { else
{
data->process = (wxProcess *) NULL; data->process = (wxProcess *) NULL;
data->pid = -(data->pid); data->pid = -(data->pid);

View File

@@ -255,10 +255,14 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
// home directory instead of current directory -- JACS // home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
wxNode *node = wxTheResourceCache->Find(buffer); wxNode *node = (wxNode*) NULL; /* suppress egcs warning */
node = wxTheResourceCache->Find(buffer);
if (node) if (node)
{
database = (XrmDatabase)node->Data(); database = (XrmDatabase)node->Data();
else { }
else
{
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(buffer);
wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number()); wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database); wxTheResourceCache->Append(buffer, (wxObject *)database);

View File

@@ -33,6 +33,9 @@
#include "wx/file.h" #include "wx/file.h"
#include "wx/wave.h" #include "wx/wave.h"
//-----------------------------------------------------------------
// wxWave
//-----------------------------------------------------------------
wxWave::wxWave() wxWave::wxWave()
: m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL)
@@ -63,7 +66,6 @@ bool wxWave::Create(const wxString& fileName, bool isResource)
if (isResource) if (isResource)
{ {
// todo // todo
return (m_waveData ? TRUE : FALSE); return (m_waveData ? TRUE : FALSE);
} }
else else
@@ -72,13 +74,17 @@ bool wxWave::Create(const wxString& fileName, bool isResource)
wxFile fileWave; wxFile fileWave;
if (!fileWave.Open(fileName, wxFile::read)) if (!fileWave.Open(fileName, wxFile::read))
{
return FALSE; return FALSE;
}
m_waveLength = (int) fileWave.Length(); m_waveLength = (int) fileWave.Length();
m_waveData = new byte[m_waveLength]; m_waveData = new byte[m_waveLength];
if (!m_waveData) if (!m_waveData)
{
return FALSE; return FALSE;
}
fileWave.Read(m_waveData, m_waveLength); fileWave.Read(m_waveData, m_waveLength);
@@ -93,20 +99,22 @@ bool wxWave::Create(int size, const byte* data)
m_waveLength=size; m_waveLength=size;
m_waveData = new byte[size]; m_waveData = new byte[size];
if (!m_waveData) if (!m_waveData)
{
return FALSE; return FALSE;
}
for (int i=0; i<size; i++) m_waveData[i] = data[i]; for (int i=0; i<size; i++) m_waveData[i] = data[i];
return TRUE; return TRUE;
} }
bool wxWave::Play(bool async, bool looped) bool wxWave::Play(bool async, bool looped)
{ {
if (!IsOk()) if (!IsOk()) return FALSE;
return FALSE;
int dev=OpenDSP(); int dev = OpenDSP();
if(dev<0)
return FALSE; if (dev<0) return FALSE;
ioctl(dev,SNDCTL_DSP_SYNC,0); ioctl(dev,SNDCTL_DSP_SYNC,0);
@@ -116,14 +124,14 @@ bool wxWave::Play(bool async, bool looped)
{ {
i= (int)((l+m_DSPblkSize) < m_sizeData ? m_DSPblkSize : (m_sizeData-l)); i= (int)((l+m_DSPblkSize) < m_sizeData ? m_DSPblkSize : (m_sizeData-l));
if ( write(dev,&m_data[l],i) != i ) if ( write(dev,&m_data[l],i) != i )
{
play=FALSE; play=FALSE;
}
l +=i; l +=i;
}while(play == TRUE && l<m_sizeData); } while (play == TRUE && l<m_sizeData);
close(dev); close(dev);
return TRUE; return TRUE;
} }
bool wxWave::Free() bool wxWave::Free()
@@ -148,8 +156,7 @@ typedef struct
unsigned long ulAvgBytesPerSec; unsigned long ulAvgBytesPerSec;
unsigned short uiBlockAlign; unsigned short uiBlockAlign;
unsigned short uiBitsPerSample; unsigned short uiBitsPerSample;
}WAVEFORMAT; } WAVEFORMAT;
#define MONO 1 // and stereo is 2 by wav format #define MONO 1 // and stereo is 2 by wav format
#define WAVE_FORMAT_PCM 1 #define WAVE_FORMAT_PCM 1

View File

@@ -1106,6 +1106,15 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
child->m_height ); child->m_height );
} }
//-----------------------------------------------------------------------------
// global functions
//-----------------------------------------------------------------------------
wxWindow* wxGetActiveWindow()
{
return g_focusWindow;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxWindow // wxWindow
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -15,6 +15,13 @@
#include <ctype.h> #include <ctype.h>
#ifdef __WXDEBUG__
#ifdef NULL
#undef NULL
#endif
#define NULL ((void*)0L)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxAcceleratorTable // wxAcceleratorTable
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -44,6 +44,9 @@ wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
extern wxResourceCache *wxTheResourceCache; extern wxResourceCache *wxTheResourceCache;
GdkVisual *wxVisualSetByExternal = (GdkVisual*) NULL;
GdkColormap *wxColormapSetByExternal = (GdkColormap*) NULL;
unsigned char g_palette[64*3] = unsigned char g_palette[64*3] =
{ {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@@ -169,14 +172,60 @@ wxApp::~wxApp(void)
gtk_idle_remove( m_idleTag ); gtk_idle_remove( m_idleTag );
} }
bool wxApp::OnInit(void) bool wxApp::InitVisual()
{ {
if (wxVisualSetByExternal)
{
/* this happens in the wxModule code of the OpenGl canvas.
it chooses the best display for OpenGl and stores it
in wxDisplaySetByExternal. we then have to make it the
default for the system */
gtk_widget_set_default_visual( wxVisualSetByExternal );
}
if (wxColormapSetByExternal)
{
/* OpenGl also gives us a colormap */
gtk_widget_set_default_colormap( wxColormapSetByExternal );
}
else
{
/* this initiates the standard palette as defined by GdkImlib
in the GNOME libraries. it ensures that all GNOME applications
use the same 64 colormap entries on 8-bit displays so you
can use several rather graphics-heavy applications at the
same time */
GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE );
for (int i = 0; i < 64; i++)
{
GdkColor col;
col.red = g_palette[i*3 + 0] << 8;
col.green = g_palette[i*3 + 1] << 8;
col.blue = g_palette[i*3 + 2] << 8;
col.pixel = 0;
gdk_color_alloc( cmap, &col );
}
gtk_widget_set_default_colormap( cmap );
}
return TRUE; return TRUE;
} }
bool wxApp::OnInitGui(void) bool wxApp::OnInitGui(void)
{ {
m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL );
return TRUE;
}
bool wxApp::OnInit(void)
{
return TRUE; return TRUE;
} }
@@ -320,12 +369,6 @@ void wxApp::SetTopWindow( wxWindow *win )
void wxApp::CommonInit(void) void wxApp::CommonInit(void)
{ {
/*
#if wxUSE_RESOURCES
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif
*/
wxSystemSettings::Init(); wxSystemSettings::Init();
wxTheFontNameDirectory = new wxFontNameDirectory; wxTheFontNameDirectory = new wxFontNameDirectory;
@@ -350,14 +393,19 @@ void wxApp::CommonInit(void)
void wxApp::CommonCleanUp(void) void wxApp::CommonCleanUp(void)
{ {
wxDELETE(wxTheColourDatabase); if (wxTheColourDatabase) delete wxTheColourDatabase;
wxDELETE(wxTheFontNameDirectory); wxTheColourDatabase = (wxColourDatabase*) NULL;
if (wxTheFontNameDirectory) delete wxTheFontNameDirectory;
wxTheFontNameDirectory = (wxFontNameDirectory*) NULL;
wxDeleteStockObjects(); wxDeleteStockObjects();
#if wxUSE_WX_RESOURCES #if wxUSE_WX_RESOURCES
wxFlushResources(); wxFlushResources();
wxDELETE(wxTheResourceCache); if (wxTheResourceCache) delete wxTheResourceCache;
wxTheResourceCache = (wxResourceCache*) NULL;
wxCleanUpResourceSystem(); wxCleanUpResourceSystem();
#endif #endif
@@ -419,29 +467,14 @@ int wxEntry( int argc, char *argv[] )
gtk_init( &argc, &argv ); gtk_init( &argc, &argv );
GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE );
for (int i = 0; i < 64; i++)
{
GdkColor col;
col.red = g_palette[i*3 + 0] << 8;
col.green = g_palette[i*3 + 1] << 8;
col.blue = g_palette[i*3 + 2] << 8;
col.pixel = 0;
gdk_color_alloc( cmap, &col );
}
gtk_widget_push_colormap( cmap );
gtk_widget_set_default_colormap( cmap );
wxApp::CommonInit();
wxModule::RegisterModules(); wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE; if (!wxModule::InitializeModules()) return FALSE;
wxTheApp->OnInitGui(); if (!wxTheApp->InitVisual()) return 0;
wxApp::CommonInit();
if (!wxTheApp->OnInitGui()) return 0;
// Here frames insert themselves automatically // Here frames insert themselves automatically
// into wxTopLevelWindows by getting created // into wxTopLevelWindows by getting created
@@ -481,11 +514,9 @@ int wxEntry( int argc, char *argv[] )
#endif #endif
wxLog *oldLog = wxLog::SetActiveTarget( NULL ); wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL );
if (oldLog) delete oldLog; if (oldLog) delete oldLog;
return retValue; return retValue;
} }
//-----------------------------------------------------------------------------

View File

@@ -27,14 +27,15 @@ wxCheckListBox::wxCheckListBox() :
{ {
m_hasCheckBoxes = TRUE; m_hasCheckBoxes = TRUE;
} }
wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos,
const wxSize& size = wxDefaultSize, const wxSize& size,
int nStrings = 0, int nStrings,
const wxString choices[] = NULL, const wxString choices[],
long style = 0, long style,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator,
const wxString& name = wxListBoxNameStr) const wxString& name )
{ {
m_hasCheckBoxes = TRUE; m_hasCheckBoxes = TRUE;
wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name ); wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name );

View File

@@ -255,7 +255,7 @@ void wxComboBox::Delete( int n )
return; return;
} }
GList *list = g_list_append( NULL, child->data ); GList *list = g_list_append( (GList*) NULL, child->data );
gtk_list_remove_items( listbox, list ); gtk_list_remove_items( listbox, list );
g_list_free( list ); g_list_free( list );

View File

@@ -14,7 +14,6 @@
#pragma interface #pragma interface
#endif #endif
#include "wx/defs.h" #include "wx/defs.h"
#if wxUSE_POSTSCRIPT #if wxUSE_POSTSCRIPT

View File

@@ -733,8 +733,8 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
if (!m_data) return (wxDragResult) wxDragNone; if (!m_data) return (wxDragResult) wxDragNone;
static GtkWidget *drag_icon = NULL; static GtkWidget *drag_icon = (GtkWidget*) NULL;
static GtkWidget *drop_icon = NULL; static GtkWidget *drop_icon = (GtkWidget*) NULL;
GdkPoint hotspot_1 = {0,-5 }; GdkPoint hotspot_1 = {0,-5 };
@@ -872,7 +872,7 @@ void wxDropSource::UnregisterWindow(void)
/* /*
* Shaped Windows * Shaped Windows
*/ */
static GdkWindow *root_win = NULL; static GdkWindow *root_win = (GdkWindow*) NULL;
typedef struct _cursoroffset {gint x,y;} CursorOffset; typedef struct _cursoroffset {gint x,y;} CursorOffset;
@@ -895,7 +895,8 @@ shape_pressed (GtkWidget *widget, GdkEventButton *event)
(GDK_BUTTON_RELEASE_MASK | (GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_MOTION_MASK | GDK_BUTTON_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK), GDK_POINTER_MOTION_HINT_MASK),
NULL, NULL, 0); (GdkWindow*)NULL,
(GdkCursor*) NULL, 0);
} }

View File

@@ -423,7 +423,7 @@ void wxListBox::Delete( int n )
wxCHECK_RET( child, "wrong listbox index" ); wxCHECK_RET( child, "wrong listbox index" );
GList *list = g_list_append( NULL, child->data ); GList *list = g_list_append( (GList*) NULL, child->data );
gtk_list_remove_items( m_list, list ); gtk_list_remove_items( m_list, list );
g_list_free( list ); g_list_free( list );

View File

@@ -155,14 +155,38 @@ bool wxMenuBar::Enabled( int id ) const
return FALSE; return FALSE;
} }
wxString wxMenuBar::GetLabel( int id ) const
{
wxMenuItem* item = FindMenuItemById( id );
if (item) return item->GetText();
return "";
}
void wxMenuBar::SetLabel( int id, const wxString &label )
{
wxMenuItem* item = FindMenuItemById( id );
if (item) return item->SetText( label );
}
void wxMenuBar::EnableTop( int WXUNUSED(pos), bool WXUNUSED(flag) )
{
}
wxString wxMenuBar::GetLabelTop( int WXUNUSED(pos) ) const
{
return "menu";
}
void wxMenuBar::SetLabelTop( int WXUNUSED(pos), const wxString& WXUNUSED(label) )
{
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "activate" // "activate"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{ {
wxYield();
int id = menu->FindMenuIdByMenuItem(widget); int id = menu->FindMenuIdByMenuItem(widget);
/* should find it for normal (not popup) menu */ /* should find it for normal (not popup) menu */

View File

@@ -17,7 +17,6 @@
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "clicked" // "clicked"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -429,7 +429,7 @@ bool wxNotebook::SetPageImage( int page, int image )
if (image == -1 && nb_page->m_image == -1) if (image == -1 && nb_page->m_image == -1)
return TRUE; /* Case 1): Nothing to do. */ return TRUE; /* Case 1): Nothing to do. */
GtkWidget *pixmapwid = NULL; GtkWidget *pixmapwid = (GtkWidget*) NULL;
if (nb_page->m_image != -1) if (nb_page->m_image != -1)
{ {

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "radiobox.h" #pragma implementation "radiobox.h"
#endif #endif
@@ -148,8 +147,8 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
wxSize wxRadioBox::LayoutItems() wxSize wxRadioBox::LayoutItems()
{ {
int x = m_x+7; int x = 7;
int y = m_y+15; int y = 15;
int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1; int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1;
@@ -160,7 +159,7 @@ wxSize wxRadioBox::LayoutItems()
for (int j = 0; j < m_majorDim; j++) for (int j = 0; j < m_majorDim; j++)
{ {
y = m_y+15; y = 15;
int max_len = 0; int max_len = 0;
wxNode *node = m_boxes.Nth( j*num_per_major ); wxNode *node = m_boxes.Nth( j*num_per_major );
@@ -169,10 +168,10 @@ wxSize wxRadioBox::LayoutItems()
GtkWidget *button = GTK_WIDGET( node->Data() ); GtkWidget *button = GTK_WIDGET( node->Data() );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
GdkFont *font = m_widget->style->font; GdkFont *font = m_widget->style->font;
int len = 27+gdk_string_measure( font, label->label ); int len = 22+gdk_string_measure( font, label->label );
if (len > max_len) max_len = len; if (len > max_len) max_len = len;
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y ); gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
y += 22; y += 22;
node = node->Next(); node = node->Next();
@@ -197,8 +196,8 @@ wxSize wxRadioBox::LayoutItems()
x += max_len + 2; x += max_len + 2;
} }
res.y -= 3; res.x = x+4;
res.x = x-2; res.y += 9;
} }
else else
{ {
@@ -211,7 +210,7 @@ wxSize wxRadioBox::LayoutItems()
GtkLabel *label = GTK_LABEL( button->child ); GtkLabel *label = GTK_LABEL( button->child );
GdkFont *font = m_widget->style->font; GdkFont *font = m_widget->style->font;
int len = 27+gdk_string_measure( font, label->label ); int len = 22+gdk_string_measure( font, label->label );
if (len > max) max = len; if (len > max) max = len;
node = node->Next(); node = node->Next();
@@ -222,13 +221,13 @@ wxSize wxRadioBox::LayoutItems()
{ {
GtkWidget *button = GTK_WIDGET( node->Data() ); GtkWidget *button = GTK_WIDGET( node->Data() );
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y ); gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
x += max; x += max;
gtk_widget_set_usize( button, max, 20 ); gtk_widget_set_usize( button, max, 20 );
node = node->Next(); node = node->Next();
} }
res.x = x-2; res.x = x+4;
res.y = 42; res.y = 42;
} }

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "region.h" #pragma implementation "region.h"
#endif #endif
@@ -17,6 +16,13 @@
#include "gdk/gdk.h" #include "gdk/gdk.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
#ifdef __WXDEBUG__
#ifdef NULL
#undef NULL
#endif
#define NULL ((void*)0L)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxRegion // wxRegion
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -303,7 +303,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
Clear(); Clear();
FILE *fp = NULL; FILE *fp = (FILE*) NULL;
struct stat statb; struct stat statb;
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
@@ -358,7 +358,7 @@ bool wxTextCtrl::SaveFile( const wxString &file )
} }
else else
{ {
char *text = NULL; char *text = (char*) NULL;
gint len = 0; gint len = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)

View File

@@ -64,7 +64,7 @@ public:
wxMutex::wxMutex() wxMutex::wxMutex()
{ {
p_internal = new wxMutexInternal; p_internal = new wxMutexInternal;
pthread_mutex_init(&(p_internal->p_mutex), NULL); pthread_mutex_init( &(p_internal->p_mutex), (const pthread_mutexattr_t*) NULL );
m_locked = 0; m_locked = 0;
} }
@@ -73,46 +73,54 @@ wxMutex::~wxMutex()
if (m_locked > 0) if (m_locked > 0)
wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked );
pthread_mutex_destroy(&(p_internal->p_mutex)); pthread_mutex_destroy( &(p_internal->p_mutex) );
delete p_internal; delete p_internal;
} }
wxMutexError wxMutex::Lock() wxMutexError wxMutex::Lock()
{ {
int err; int err = pthread_mutex_lock( &(p_internal->p_mutex) );
err = pthread_mutex_lock(&(p_internal->p_mutex));
if (err == EDEADLK) if (err == EDEADLK)
{
return wxMUTEX_DEAD_LOCK; return wxMUTEX_DEAD_LOCK;
}
m_locked++; m_locked++;
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
wxMutexError wxMutex::TryLock() wxMutexError wxMutex::TryLock()
{ {
int err;
if (m_locked) if (m_locked)
{
return wxMUTEX_BUSY; return wxMUTEX_BUSY;
}
err = pthread_mutex_trylock(&(p_internal->p_mutex)); int err = pthread_mutex_trylock( &(p_internal->p_mutex) );
switch (err) switch (err)
{ {
case EBUSY: return wxMUTEX_BUSY; case EBUSY: return wxMUTEX_BUSY;
} }
m_locked++; m_locked++;
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
wxMutexError wxMutex::Unlock() wxMutexError wxMutex::Unlock()
{ {
if (m_locked > 0) if (m_locked > 0)
{
m_locked--; m_locked--;
}
else else
{
return wxMUTEX_UNLOCKED; return wxMUTEX_UNLOCKED;
}
pthread_mutex_unlock( &(p_internal->p_mutex) );
pthread_mutex_unlock(&(p_internal->p_mutex));
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
@@ -129,37 +137,38 @@ public:
wxCondition::wxCondition() wxCondition::wxCondition()
{ {
p_internal = new wxConditionInternal; p_internal = new wxConditionInternal;
pthread_cond_init(&(p_internal->p_condition), NULL); pthread_cond_init( &(p_internal->p_condition), (const pthread_condattr_t *) NULL );
} }
wxCondition::~wxCondition() wxCondition::~wxCondition()
{ {
pthread_cond_destroy(&(p_internal->p_condition)); pthread_cond_destroy( &(p_internal->p_condition) );
delete p_internal; delete p_internal;
} }
void wxCondition::Wait(wxMutex& mutex) void wxCondition::Wait(wxMutex& mutex)
{ {
pthread_cond_wait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex)); pthread_cond_wait( &(p_internal->p_condition), &(mutex.p_internal->p_mutex) );
} }
bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec) bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec)
{ {
struct timespec tspec; struct timespec tspec;
tspec.tv_sec = time(NULL)+sec; tspec.tv_sec = time(0L)+sec;
tspec.tv_nsec = nsec; tspec.tv_nsec = nsec;
return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT); return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT);
} }
void wxCondition::Signal() void wxCondition::Signal()
{ {
pthread_cond_signal(&(p_internal->p_condition)); pthread_cond_signal( &(p_internal->p_condition) );
} }
void wxCondition::Broadcast() void wxCondition::Broadcast()
{ {
pthread_cond_broadcast(&(p_internal->p_condition)); pthread_cond_broadcast( &(p_internal->p_condition) );
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@@ -183,7 +192,7 @@ void *wxThreadInternal::PthreadStart(void *ptr)
wxThread *thread = (wxThread *)ptr; wxThread *thread = (wxThread *)ptr;
/* Call the main entry */ /* Call the main entry */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL );
void* status = thread->Entry(); void* status = thread->Entry();
thread->Exit(status); thread->Exit(status);
@@ -246,9 +255,9 @@ int wxThread::GetPriority() const
void wxThread::DeferDestroy(bool on) void wxThread::DeferDestroy(bool on)
{ {
if (on) if (on)
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, (int*) NULL);
else else
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL);
} }
wxThreadError wxThread::Destroy() wxThreadError wxThread::Destroy()

View File

@@ -15,6 +15,51 @@
#include "wx/timer.h" #include "wx/timer.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
/*
#include "glib.h"
*/
//-----------------------------------------------------------------------------
// global functions
//-----------------------------------------------------------------------------
/*
static GTimer *g_timer = (GTimer*) NULL;
void wxStartTimer()
{
if (g_timer)
{
g_timer_rest( g_timer );
}
else
{
g_timer = g_timer_new();
g_timer_start( g_timer );
}
}
long wxGetElapsedTime( bool resetTimer )
{
gulong res = 0;
if (g_timer)
{
g_timer_elapsed( g_timer, &res );
if (resetTimer) g_timer_reset( g_timer );
}
return res;
}
bool wxGetLocalTime( long *timeZone, int *dstObserved )
{
}
long wxGetCurrentTime()
{
}
*/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxTimer // wxTimer

View File

@@ -30,13 +30,10 @@
#include <netdb.h> #include <netdb.h>
#include <signal.h> #include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include "glib.h" #include "glib.h"
#include "gdk/gdk.h" #include "gdk/gdk.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "gtk/gtkfeatures.h"
#include "gdk/gdkx.h" #include "gdk/gdkx.h"
#ifdef __SVR4__ #ifdef __SVR4__
@@ -79,12 +76,7 @@ void wxDisplaySize( int *width, int *height )
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
{ {
Window dumw; gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
int dumi;
unsigned int dumu;
XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(),
&dumw,&dumw,x,y,&dumi,&dumi,&dumu );
} }
bool wxColourDisplay(void) bool wxColourDisplay(void)
@@ -97,6 +89,14 @@ int wxDisplayDepth(void)
return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth; return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
} }
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
if (majorVsn) *majorVsn = GTK_MAJOR_VERSION;
if (minorVsn) *minorVsn = GTK_MINOR_VERSION;
return wxGTK;
}
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// user and home routines // user and home routines
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@@ -124,7 +124,8 @@ char *wxGetUserHome( const wxString &user )
{ {
who = getpwnam(ptr); who = getpwnam(ptr);
} }
// We now make sure the the user exists!
/* We now make sure the the user exists! */
if (who == NULL) if (who == NULL)
{ {
who = getpwuid(getuid()); who = getpwuid(getuid());
@@ -266,7 +267,7 @@ static void GTK_EndProcessDetector(gpointer data, gint source,
* not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-) * not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-)
* --- offer@sgi.com */ * --- offer@sgi.com */
#if !defined(__sgi) #if !defined(__sgi)
wait4(proc_data->pid, NULL, 0, NULL); wait4(proc_data->pid, (int*) NULL, 0, (rusage *) NULL);
#else #else
wait3((int *) NULL, 0, (rusage *) NULL); wait3((int *) NULL, 0, (rusage *) NULL);
#endif #endif
@@ -291,8 +292,9 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
wxCHECK_MSG( *argv, 0, "can't exec empty command" ); wxCHECK_MSG( *argv, 0, "can't exec empty command" );
/* Create pipes */ /* Create pipes */
if (pipe(end_proc_detect) == -1) { if (pipe(end_proc_detect) == -1)
wxLogSysError(_("Pipe creation failed")); {
wxLogSysError( "Pipe creation failed" );
return 0; return 0;
} }
@@ -302,12 +304,13 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
#else #else
pid_t pid = fork(); pid_t pid = fork();
#endif #endif
if (pid == -1) { if (pid == -1)
// error {
wxLogSysError(_("Fork failed")); wxLogSysError( "Fork failed" );
return 0; return 0;
} }
else if (pid == 0) { else if (pid == 0)
{
// we're in child // we're in child
close(end_proc_detect[0]); // close reading side close(end_proc_detect[0]); // close reading side
// These three lines close the open file descriptors to // These three lines close the open file descriptors to
@@ -325,20 +328,23 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
execvp (*argv, argv); execvp (*argv, argv);
#endif #endif
// there is no return after successful exec() // there is no return after successful exec()
wxLogSysError(_("Can't execute '%s'"), *argv); wxLogSysError( "Can't execute '%s'", *argv);
_exit(-1); _exit(-1);
} }
else { else
{
// we're in parent // we're in parent
close(end_proc_detect[1]); // close writing side close(end_proc_detect[1]); // close writing side
data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ, data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
GTK_EndProcessDetector, (gpointer)data); GTK_EndProcessDetector, (gpointer)data);
data->pid = pid; data->pid = pid;
if (!sync) { if (!sync)
{
data->process = process; data->process = process;
} }
else { else
{
data->process = (wxProcess *) NULL; data->process = (wxProcess *) NULL;
data->pid = -(data->pid); data->pid = -(data->pid);

View File

@@ -255,10 +255,14 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
// home directory instead of current directory -- JACS // home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
wxNode *node = wxTheResourceCache->Find(buffer); wxNode *node = (wxNode*) NULL; /* suppress egcs warning */
node = wxTheResourceCache->Find(buffer);
if (node) if (node)
{
database = (XrmDatabase)node->Data(); database = (XrmDatabase)node->Data();
else { }
else
{
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(buffer);
wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number()); wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database); wxTheResourceCache->Append(buffer, (wxObject *)database);

View File

@@ -33,6 +33,9 @@
#include "wx/file.h" #include "wx/file.h"
#include "wx/wave.h" #include "wx/wave.h"
//-----------------------------------------------------------------
// wxWave
//-----------------------------------------------------------------
wxWave::wxWave() wxWave::wxWave()
: m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL)
@@ -63,7 +66,6 @@ bool wxWave::Create(const wxString& fileName, bool isResource)
if (isResource) if (isResource)
{ {
// todo // todo
return (m_waveData ? TRUE : FALSE); return (m_waveData ? TRUE : FALSE);
} }
else else
@@ -72,13 +74,17 @@ bool wxWave::Create(const wxString& fileName, bool isResource)
wxFile fileWave; wxFile fileWave;
if (!fileWave.Open(fileName, wxFile::read)) if (!fileWave.Open(fileName, wxFile::read))
{
return FALSE; return FALSE;
}
m_waveLength = (int) fileWave.Length(); m_waveLength = (int) fileWave.Length();
m_waveData = new byte[m_waveLength]; m_waveData = new byte[m_waveLength];
if (!m_waveData) if (!m_waveData)
{
return FALSE; return FALSE;
}
fileWave.Read(m_waveData, m_waveLength); fileWave.Read(m_waveData, m_waveLength);
@@ -93,20 +99,22 @@ bool wxWave::Create(int size, const byte* data)
m_waveLength=size; m_waveLength=size;
m_waveData = new byte[size]; m_waveData = new byte[size];
if (!m_waveData) if (!m_waveData)
{
return FALSE; return FALSE;
}
for (int i=0; i<size; i++) m_waveData[i] = data[i]; for (int i=0; i<size; i++) m_waveData[i] = data[i];
return TRUE; return TRUE;
} }
bool wxWave::Play(bool async, bool looped) bool wxWave::Play(bool async, bool looped)
{ {
if (!IsOk()) if (!IsOk()) return FALSE;
return FALSE;
int dev=OpenDSP(); int dev = OpenDSP();
if(dev<0)
return FALSE; if (dev<0) return FALSE;
ioctl(dev,SNDCTL_DSP_SYNC,0); ioctl(dev,SNDCTL_DSP_SYNC,0);
@@ -116,14 +124,14 @@ bool wxWave::Play(bool async, bool looped)
{ {
i= (int)((l+m_DSPblkSize) < m_sizeData ? m_DSPblkSize : (m_sizeData-l)); i= (int)((l+m_DSPblkSize) < m_sizeData ? m_DSPblkSize : (m_sizeData-l));
if ( write(dev,&m_data[l],i) != i ) if ( write(dev,&m_data[l],i) != i )
{
play=FALSE; play=FALSE;
}
l +=i; l +=i;
}while(play == TRUE && l<m_sizeData); } while (play == TRUE && l<m_sizeData);
close(dev); close(dev);
return TRUE; return TRUE;
} }
bool wxWave::Free() bool wxWave::Free()
@@ -148,8 +156,7 @@ typedef struct
unsigned long ulAvgBytesPerSec; unsigned long ulAvgBytesPerSec;
unsigned short uiBlockAlign; unsigned short uiBlockAlign;
unsigned short uiBitsPerSample; unsigned short uiBitsPerSample;
}WAVEFORMAT; } WAVEFORMAT;
#define MONO 1 // and stereo is 2 by wav format #define MONO 1 // and stereo is 2 by wav format
#define WAVE_FORMAT_PCM 1 #define WAVE_FORMAT_PCM 1

View File

@@ -1106,6 +1106,15 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
child->m_height ); child->m_height );
} }
//-----------------------------------------------------------------------------
// global functions
//-----------------------------------------------------------------------------
wxWindow* wxGetActiveWindow()
{
return g_focusWindow;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxWindow // wxWindow
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -14,73 +14,73 @@ static struct {
char* symbol; char* symbol;
} odbcapi_symtab[] = { } odbcapi_symtab[] = {
#if (ODBCVER >= 0x0300) #if (ODBCVER >= 0x0300)
en_AllocHandle CLI_NAME_PREFIX "AllocHandle", { en_AllocHandle CLI_NAME_PREFIX "AllocHandle" },
en_FreeHandle CLI_NAME_PREFIX "FreeHandle", { en_FreeHandle CLI_NAME_PREFIX "FreeHandle" },
#endif #endif
en_AllocEnv, CLI_NAME_PREFIX "AllocEnv", { en_AllocEnv, CLI_NAME_PREFIX "AllocEnv" },
en_AllocConnect, CLI_NAME_PREFIX "AllocConnect", { en_AllocConnect, CLI_NAME_PREFIX "AllocConnect" },
en_Connect, CLI_NAME_PREFIX "Connect", { en_Connect, CLI_NAME_PREFIX "Connect" },
en_DriverConnect, CLI_NAME_PREFIX "DriverConnect", { en_DriverConnect, CLI_NAME_PREFIX "DriverConnect" },
en_BrowseConnect, CLI_NAME_PREFIX "BrowseConnect", { en_BrowseConnect, CLI_NAME_PREFIX "BrowseConnect" },
en_DataSources, CLI_NAME_PREFIX "DataSources", { en_DataSources, CLI_NAME_PREFIX "DataSources" },
en_Drivers, CLI_NAME_PREFIX "Driver", { en_Drivers, CLI_NAME_PREFIX "Driver" },
en_GetInfo, CLI_NAME_PREFIX "GetInfo", { en_GetInfo, CLI_NAME_PREFIX "GetInfo" },
en_GetFunctions, CLI_NAME_PREFIX "GetFunctions", { en_GetFunctions, CLI_NAME_PREFIX "GetFunctions" },
en_GetTypeInfo, CLI_NAME_PREFIX "GetTypeInfo", { en_GetTypeInfo, CLI_NAME_PREFIX "GetTypeInfo" },
en_SetConnectOption, CLI_NAME_PREFIX "SetConnectOption", { en_SetConnectOption, CLI_NAME_PREFIX "SetConnectOption" },
en_GetConnectOption, CLI_NAME_PREFIX "GetConnectOption", { en_GetConnectOption, CLI_NAME_PREFIX "GetConnectOption" },
en_SetStmtOption, CLI_NAME_PREFIX "SetStmtOption", { en_SetStmtOption, CLI_NAME_PREFIX "SetStmtOption" },
en_GetStmtOption, CLI_NAME_PREFIX "GetStmtOption", { en_GetStmtOption, CLI_NAME_PREFIX "GetStmtOption" },
en_AllocStmt, CLI_NAME_PREFIX "AllocStmt", { en_AllocStmt, CLI_NAME_PREFIX "AllocStmt" },
en_Prepare, CLI_NAME_PREFIX "Prepare", { en_Prepare, CLI_NAME_PREFIX "Prepare" },
en_BindParameter, CLI_NAME_PREFIX "BindParameter", { en_BindParameter, CLI_NAME_PREFIX "BindParameter" },
en_ParamOptions, CLI_NAME_PREFIX "ParamOptions", { en_ParamOptions, CLI_NAME_PREFIX "ParamOptions" },
en_GetCursorName, CLI_NAME_PREFIX "GetCursorName", { en_GetCursorName, CLI_NAME_PREFIX "GetCursorName" },
en_SetCursorName, CLI_NAME_PREFIX "SetCursorName", { en_SetCursorName, CLI_NAME_PREFIX "SetCursorName" },
en_SetScrollOptions, CLI_NAME_PREFIX "SetScrollOptions", { en_SetScrollOptions, CLI_NAME_PREFIX "SetScrollOptions" },
en_SetParam, CLI_NAME_PREFIX "SetParam", { en_SetParam, CLI_NAME_PREFIX "SetParam" },
en_Execute, CLI_NAME_PREFIX "Execute", { en_Execute, CLI_NAME_PREFIX "Execute" },
en_ExecDirect, CLI_NAME_PREFIX "ExecDirect", { en_ExecDirect, CLI_NAME_PREFIX "ExecDirect" },
en_NativeSql, CLI_NAME_PREFIX "NativeSql", { en_NativeSql, CLI_NAME_PREFIX "NativeSql" },
en_DescribeParam, CLI_NAME_PREFIX "DescribeParam", { en_DescribeParam, CLI_NAME_PREFIX "DescribeParam" },
en_NumParams, CLI_NAME_PREFIX "NumParams", { en_NumParams, CLI_NAME_PREFIX "NumParams" },
en_ParamData, CLI_NAME_PREFIX "ParamData", { en_ParamData, CLI_NAME_PREFIX "ParamData" },
en_PutData, CLI_NAME_PREFIX "PutData", { en_PutData, CLI_NAME_PREFIX "PutData" },
en_RowCount, CLI_NAME_PREFIX "RowCount", { en_RowCount, CLI_NAME_PREFIX "RowCount" },
en_NumResultCols, CLI_NAME_PREFIX "NumResultCols", { en_NumResultCols, CLI_NAME_PREFIX "NumResultCols" },
en_DescribeCol, CLI_NAME_PREFIX "DescribeCol", { en_DescribeCol, CLI_NAME_PREFIX "DescribeCol" },
en_ColAttributes, CLI_NAME_PREFIX "ColAttributes", { en_ColAttributes, CLI_NAME_PREFIX "ColAttributes" },
en_BindCol, CLI_NAME_PREFIX "BindCol", { en_BindCol, CLI_NAME_PREFIX "BindCol" },
en_Fetch, CLI_NAME_PREFIX "Fetch", { en_Fetch, CLI_NAME_PREFIX "Fetch" },
en_ExtendedFetch, CLI_NAME_PREFIX "ExtendedFetch", { en_ExtendedFetch, CLI_NAME_PREFIX "ExtendedFetch" },
en_GetData, CLI_NAME_PREFIX "GetData", { en_GetData, CLI_NAME_PREFIX "GetData" },
en_SetPos, CLI_NAME_PREFIX "SetPos", { en_SetPos, CLI_NAME_PREFIX "SetPos" },
en_MoreResults, CLI_NAME_PREFIX "MoreResults", { en_MoreResults, CLI_NAME_PREFIX "MoreResults" },
en_Error, CLI_NAME_PREFIX "Error", { en_Error, CLI_NAME_PREFIX "Error" },
en_ColumnPrivileges, CLI_NAME_PREFIX "ColumnPrivileges", { en_ColumnPrivileges, CLI_NAME_PREFIX "ColumnPrivileges" },
en_Columns, CLI_NAME_PREFIX "Columns", { en_Columns, CLI_NAME_PREFIX "Columns" },
en_ForeignKeys, CLI_NAME_PREFIX "ForeignKeys", { en_ForeignKeys, CLI_NAME_PREFIX "ForeignKeys" },
en_PrimaryKeys, CLI_NAME_PREFIX "PrimaryKeys", { en_PrimaryKeys, CLI_NAME_PREFIX "PrimaryKeys" },
en_ProcedureColumns, CLI_NAME_PREFIX "ProcedureColumns", { en_ProcedureColumns, CLI_NAME_PREFIX "ProcedureColumns" },
en_Procedures, CLI_NAME_PREFIX "Procedures", { en_Procedures, CLI_NAME_PREFIX "Procedures" },
en_SpecialColumns, CLI_NAME_PREFIX "SpecialColumns", { en_SpecialColumns, CLI_NAME_PREFIX "SpecialColumns" },
en_Statistics, CLI_NAME_PREFIX "Statistics", { en_Statistics, CLI_NAME_PREFIX "Statistics" },
en_TablePrivileges, CLI_NAME_PREFIX "TablePrivileges", { en_TablePrivileges, CLI_NAME_PREFIX "TablePrivileges" },
en_Tables, CLI_NAME_PREFIX "Tables", { en_Tables, CLI_NAME_PREFIX "Tables" },
en_FreeStmt, CLI_NAME_PREFIX "FreeStmt", { en_FreeStmt, CLI_NAME_PREFIX "FreeStmt" },
en_Cancel, CLI_NAME_PREFIX "Cancel", { en_Cancel, CLI_NAME_PREFIX "Cancel" },
en_Transact, CLI_NAME_PREFIX "Transact", { en_Transact, CLI_NAME_PREFIX "Transact" },
en_Disconnect, CLI_NAME_PREFIX "Disconnect", { en_Disconnect, CLI_NAME_PREFIX "Disconnect" },
en_FreeConnect, CLI_NAME_PREFIX "FreeConnect", { en_FreeConnect, CLI_NAME_PREFIX "FreeConnect" },
en_FreeEnv, CLI_NAME_PREFIX "FreeEnv", { en_FreeEnv, CLI_NAME_PREFIX "FreeEnv" },
en_NullProc, NULL { en_NullProc, NULL }
}; };

View File

@@ -1,98 +1,98 @@
static const sqlerrmsg_t sqlerrmsg_tab[] = static const sqlerrmsg_t sqlerrmsg_tab[] =
{ {
en_00000, "00000", "", { en_00000, "00000", "" },
en_01000, "01000", "General warning", { en_01000, "01000", "General warning" },
en_01002, "01002", "Disconnect error", { en_01002, "01002", "Disconnect error" },
en_01004, "01004", "Data truncated", { en_01004, "01004", "Data truncated" },
en_01006, "01006", "Privilege not revoked", { en_01006, "01006", "Privilege not revoked" },
en_01S00, "01S00", "Invalid connection string attribute", { en_01S00, "01S00", "Invalid connection string attribute" },
en_01S01, "01S01", "Error in row", { en_01S01, "01S01", "Error in row" },
en_01S02, "01S02", "Optional value changed", { en_01S02, "01S02", "Optional value changed" },
en_01S03, "01S03", "No rows updated or deleted", { en_01S03, "01S03", "No rows updated or deleted" },
en_01S04, "01S04", "More than one row updated or deleted", { en_01S04, "01S04", "More than one row updated or deleted" },
en_07001, "07001", "Wrong number of parameters", { en_07001, "07001", "Wrong number of parameters" },
en_07006, "07006", "Restricted data type attribute violation", { en_07006, "07006", "Restricted data type attribute violation" },
en_08001, "08001", "Unable to connect to data source", { en_08001, "08001", "Unable to connect to data source" },
en_08002, "08002", "Connection in use", { en_08002, "08002", "Connection in use" },
en_08003, "08003", "Connect not open", { en_08003, "08003", "Connect not open" },
en_08004, "08004", "Data source rejected establishment of connection", { en_08004, "08004", "Data source rejected establishment of connection" },
en_08007, "08007", "Connection failure during transaction", { en_08007, "08007", "Connection failure during transaction" },
en_08S01, "08S01", "Communication link failure", { en_08S01, "08S01", "Communication link failure" },
en_21S01, "21S01", "Insert value list does not match", { en_21S01, "21S01", "Insert value list does not match" },
en_21S02, "21S02", "Degree of derived table does not match column list", { en_21S02, "21S02", "Degree of derived table does not match column list" },
en_22001, "22001", "String data right truncation", { en_22001, "22001", "String data right truncation" },
en_22003, "22003", "Numeric value out of range", { en_22003, "22003", "Numeric value out of range" },
en_22005, "22005", "Error in assignment", { en_22005, "22005", "Error in assignment" },
en_22008, "22008", "Datetime field overflow", { en_22008, "22008", "Datetime field overflow" },
en_22012, "22012", "Division by zero", { en_22012, "22012", "Division by zero" },
en_22026, "22026", "String data, length mismatch", { en_22026, "22026", "String data, length mismatch" },
en_23000, "23000", "Integrity constraint violation", { en_23000, "23000", "Integrity constraint violation" },
en_24000, "24000", "Invalid cursor state", { en_24000, "24000", "Invalid cursor state" },
en_25000, "25000", "Invalid transaction state", { en_25000, "25000", "Invalid transaction state" },
en_28000, "28000", "Invalid authorization specification", { en_28000, "28000", "Invalid authorization specification" },
en_34000, "34000", "Invalid cursor name", { en_34000, "34000", "Invalid cursor name" },
en_37000, "37000", "Syntex error or access violation", { en_37000, "37000", "Syntex error or access violation" },
en_3C000, "3C000", "Duplicate cursor name", { en_3C000, "3C000", "Duplicate cursor name" },
en_40001, "40001", "Serialization failure", { en_40001, "40001", "Serialization failure" },
en_42000, "42000", "Syntax error or access violation", { en_42000, "42000", "Syntax error or access violation" },
en_70100, "70100", "Operation aborted", { en_70100, "70100", "Operation aborted" },
en_IM001, "IM001", "Driver does not support this function", { en_IM001, "IM001", "Driver does not support this function" },
en_IM002, "IM002", "Data source name not found and no default " { en_IM002, "IM002", "Data source name not found and no default "
"driver specified. Driver could not be loaded", "driver specified. Driver could not be loaded" },
en_IM003, "IM003", "Specified driver could not be loaded", { en_IM003, "IM003", "Specified driver could not be loaded" },
en_IM004, "IM004", "Driver's SQLAllocEnv() failed", { en_IM004, "IM004", "Driver's SQLAllocEnv() failed" },
en_IM005, "IM005", "Driver's SQLAllocConnect() failed", { en_IM005, "IM005", "Driver's SQLAllocConnect() failed" },
en_IM006, "IM006", "Driver's SQLSetConnectOption failed", { en_IM006, "IM006", "Driver's SQLSetConnectOption failed" },
en_IM007, "IM007", "No data source or driver specified, dialog prohibited", { en_IM007, "IM007", "No data source or driver specified, dialog prohibited" },
en_IM008, "IM008", "Dialog failed", { en_IM008, "IM008", "Dialog failed" },
en_IM009, "IM009", "Unable to load translation DLL", { en_IM009, "IM009", "Unable to load translation DLL" },
en_IM010, "IM010", "Data source name too long", { en_IM010, "IM010", "Data source name too long" },
en_IM011, "IM011", "Driver name too long", { en_IM011, "IM011", "Driver name too long" },
en_IM012, "IM012", "DRIVER keyword syntax error", { en_IM012, "IM012", "DRIVER keyword syntax error" },
en_IM013, "IM013", "Trace file error", { en_IM013, "IM013", "Trace file error" },
en_IM014, "IM014", "Try to change tracing file while tracing is on", { en_IM014, "IM014", "Try to change tracing file while tracing is on" },
en_S0001, "S0001", "Base table or view already exists", { en_S0001, "S0001", "Base table or view already exists" },
en_S0002, "S0002", "Base table not found", { en_S0002, "S0002", "Base table not found" },
en_S0011, "S0011", "Index already exists", { en_S0011, "S0011", "Index already exists" },
en_S0012, "S0012", "Index not found", { en_S0012, "S0012", "Index not found" },
en_S0021, "S0021", "Column already exists", { en_S0021, "S0021", "Column already exists" },
en_S0022, "S0022", "Column not found", { en_S0022, "S0022", "Column not found" },
en_S0023, "S0023", "No default for column", { en_S0023, "S0023", "No default for column" },
en_S1000, "S1000", "General error", { en_S1000, "S1000", "General error" },
en_S1001, "S1001", "Memory allocation failure", { en_S1001, "S1001", "Memory allocation failure" },
en_S1002, "S1002", "Invalid column number", { en_S1002, "S1002", "Invalid column number" },
en_S1003, "S1003", "Program type out of range", { en_S1003, "S1003", "Program type out of range" },
en_S1004, "S1004", "SQL data type out of range", { en_S1004, "S1004", "SQL data type out of range" },
en_S1008, "S1008", "Operation canceled", { en_S1008, "S1008", "Operation canceled" },
en_S1009, "S1009", "Invalid argument value", { en_S1009, "S1009", "Invalid argument value" },
en_S1010, "S1010", "Function sequence error", { en_S1010, "S1010", "Function sequence error" },
en_S1011, "S1011", "Operation invalid at this time", { en_S1011, "S1011", "Operation invalid at this time" },
en_S1012, "S1012", "Invalid transaction operation code specified", { en_S1012, "S1012", "Invalid transaction operation code specified" },
en_S1015, "S1015", "No cursor name available", { en_S1015, "S1015", "No cursor name available" },
en_S1090, "S1090", "Invalid string or buffer length", { en_S1090, "S1090", "Invalid string or buffer length" },
en_S1091, "S1091", "Descriptor type out of range", { en_S1091, "S1091", "Descriptor type out of range" },
en_S1092, "S1092", "Option type out of range", { en_S1092, "S1092", "Option type out of range" },
en_S1093, "S1093", "Invalid parameter", { en_S1093, "S1093", "Invalid parameter" },
en_S1094, "S1094", "Invalid scale value", { en_S1094, "S1094", "Invalid scale value" },
en_S1095, "S1095", "Function type out of range", { en_S1095, "S1095", "Function type out of range" },
en_S1096, "S1096", "Information type out of range", { en_S1096, "S1096", "Information type out of range" },
en_S1097, "S1097", "Column type out of range", { en_S1097, "S1097", "Column type out of range" },
en_S1098, "S1098", "Scope type out of range", { en_S1098, "S1098", "Scope type out of range" },
en_S1099, "S1099", "Nullable type out of range", { en_S1099, "S1099", "Nullable type out of range" },
en_S1100, "S1100", "Uniquenss option type out of range", { en_S1100, "S1100", "Uniquenss option type out of range" },
en_S1101, "S1101", "Accuracy option type out of range", { en_S1101, "S1101", "Accuracy option type out of range" },
en_S1103, "S1103", "Direction option out of range", { en_S1103, "S1103", "Direction option out of range" },
en_S1104, "S1104", "Invalid precision value", { en_S1104, "S1104", "Invalid precision value" },
en_S1105, "S1105", "Invalid parameter type", { en_S1105, "S1105", "Invalid parameter type" },
en_S1106, "S1106", "Fetch type out of range", { en_S1106, "S1106", "Fetch type out of range" },
en_S1107, "S1107", "Row value out of range", { en_S1107, "S1107", "Row value out of range" },
en_S1108, "S1108", "Concurrency option out of range", { en_S1108, "S1108", "Concurrency option out of range" },
en_S1109, "S1109", "Invalid cursor position", { en_S1109, "S1109", "Invalid cursor position" },
en_S1110, "S1110", "Invalid driver completion", { en_S1110, "S1110", "Invalid driver completion" },
en_S1111, "S1111", "Invalid bookmark value", { en_S1111, "S1111", "Invalid bookmark value" },
en_S1C00, "S1C00", "Driver not capable", { en_S1C00, "S1C00", "Driver not capable" },
en_S1T00, "S1T00", "Timeout expired", { en_S1T00, "S1T00", "Timeout expired" },
en_sqlstat_total, NULL, NULL { en_sqlstat_total, NULL, NULL }
}; };
static char FAR* sqlerrhd = "[iODBC][Driver Manager]"; static char FAR* sqlerrhd = "[iODBC][Driver Manager]";

View File

@@ -1 +0,0 @@
include ../../setup/general/makedirs

View File

@@ -1,3 +1,7 @@
Linux Linux
linux-gnu linux-gnu
linux linux
Test.h
Test.wxr
dialog.h
dialog.wxr

View File

@@ -1 +1,38 @@
include ../../../setup/general/makedirs
CC = g++
DialogEd: dialoged.o dlghndlr.o edlist.o edtree.o reseditr.o reswrite.o \
symbtabl.o winprop.o winstyle.o
$(CC) -o DialogEd \
dialoged.o dlghndlr.o edlist.o edtree.o reseditr.o reswrite.o \
symbtabl.o winprop.o winstyle.o `wx-config --libs`
dialoged.o: dialoged.cpp
$(CC) `wx-config --cflags` -c dialoged.cpp
dlghndlr.o: dlghndlr.cpp
$(CC) `wx-config --cflags` -c dlghndlr.cpp
edlist.o: edlist.cpp
$(CC) `wx-config --cflags` -c edlist.cpp
edtree.o: edtree.cpp
$(CC) `wx-config --cflags` -c edtree.cpp
reseditr.o: reseditr.cpp
$(CC) `wx-config --cflags` -c reseditr.cpp
reswrite.o: reswrite.cpp
$(CC) `wx-config --cflags` -c reswrite.cpp
symbtabl.o: symbtabl.cpp
$(CC) `wx-config --cflags` -c symbtabl.cpp
winprop.o: winprop.cpp
$(CC) `wx-config --cflags` -c winprop.cpp
winstyle.o: winstyle.cpp
$(CC) `wx-config --cflags` -c winstyle.cpp
clean:
rm -f *.o DialogEd

View File

@@ -1,26 +0,0 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a library only
RULE=bin
# define library name
BIN_TARGET=dialoged
# define library sources
BIN_SRC=dialoged.cpp dlghndlr.cpp edlist.cpp edtree.cpp \
reseditr.cpp reswrite.cpp symbtabl.cpp winprop.cpp winstyle.cpp
#define library objects
BIN_OBJ=dialoged.o dlghndlr.o edlist.o edtree.o \
reseditr.o reswrite.o symbtabl.o winprop.o winstyle.o
# additional things needed to link
BIN_LINK=
# additional things needed to compile
ADD_COMPILE=
# include the definitions now
include ../../../../template.mak

View File

@@ -1,5 +1,5 @@
# #
# wGLCanvas source makefile for Unix # wxGLCanvas source makefile for Unix
# #
# Copyright 1998, Robert Roebling # Copyright 1998, Robert Roebling
# #
@@ -18,8 +18,8 @@ NONE=
# define library name # define library name
LIB_TARGET=wx_opengl_gtk LIB_TARGET=wx_opengl_gtk
LIB_MAJOR=0 LIB_MAJOR=1
LIB_MINOR=1 LIB_MINOR=0
# define library sources # define library sources

View File

@@ -13,12 +13,24 @@
#pragma implementation "glcanvas.h" #pragma implementation "glcanvas.h"
#endif #endif
#include "wx/wxprec.h" #include "glcanvas.h"
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/colour.h" #include "wx/colour.h"
#include "glcanvas.h" #include "wx/module.h"
#include <gdk/gdkx.h> #include "wx/app.h"
#include "gtk/gtk.h"
#include "gdk/gdk.h"
extern "C" {
#include "gdk/gdkx.h"
}
//---------------------------------------------------------------------------
// global variables
//---------------------------------------------------------------------------
XVisualInfo *g_visual_info = (XVisualInfo*) NULL;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// wxGLContext // wxGLContext
@@ -31,29 +43,22 @@ wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette&
m_window = win; m_window = win;
m_widget = win->m_wxwindow; m_widget = win->m_wxwindow;
int data[] = {GLX_RGBA,GLX_RED_SIZE,1,GLX_GREEN_SIZE,1, wxCHECK_RET( g_visual_info != NULL, "invalid visual for OpenGl" );
GLX_BLUE_SIZE,1,GLX_DOUBLEBUFFER,None};
Display *display = GDK_WINDOW_XDISPLAY( m_widget->window ); m_glContext = glXCreateContext( GDK_DISPLAY(), g_visual_info, None, GL_TRUE );
XVisualInfo *visual_info = glXChooseVisual( display, DefaultScreen(display), data );
wxCHECK_RET( visual_info != NULL, "Couldn't choose visual for OpenGl" );
m_glContext = glXCreateContext( display, visual_info, None, GL_TRUE );
wxCHECK_RET( m_glContext != NULL, "Couldn't create OpenGl context" ); wxCHECK_RET( m_glContext != NULL, "Couldn't create OpenGl context" );
glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext ); glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
} }
wxGLContext::~wxGLContext() wxGLContext::~wxGLContext()
{ {
if (m_glContext) if (m_glContext)
{ {
Display *display = GDK_WINDOW_XDISPLAY( m_widget->window ); glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
glXDestroyContext( display, m_glContext ); glXDestroyContext( GDK_DISPLAY(), m_glContext );
} }
} }
@@ -61,8 +66,7 @@ void wxGLContext::SwapBuffers()
{ {
if (m_glContext) if (m_glContext)
{ {
Display *display = GDK_WINDOW_XDISPLAY( m_widget->window ); glXSwapBuffers( GDK_DISPLAY(), GDK_WINDOW_XWINDOW( m_widget->window ) );
glXSwapBuffers( display, GDK_WINDOW_XWINDOW( m_widget->window ) );
} }
} }
@@ -70,8 +74,7 @@ void wxGLContext::SetCurrent()
{ {
if (m_glContext) if (m_glContext)
{ {
Display *display = GDK_WINDOW_XDISPLAY( m_widget->window ); glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
glXMakeCurrent( display, GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
} }
} }
@@ -158,4 +161,39 @@ void wxGLCanvas::SetColour( const char *colour )
if (m_glContext) m_glContext->SetColour( colour ); if (m_glContext) m_glContext->SetColour( colour );
} }
//--------------------------------------------------------------------
// wxGLModule
//--------------------------------------------------------------------
class wxGLModule : public wxModule
{
public:
virtual bool OnInit();
virtual void OnExit();
private:
DECLARE_DYNAMIC_CLASS(wxGLModule)
};
IMPLEMENT_DYNAMIC_CLASS(wxGLModule, wxModule)
bool wxGLModule::OnInit()
{
int data[] = { GLX_RGBA,GLX_RED_SIZE,1,GLX_GREEN_SIZE,1,
GLX_BLUE_SIZE,1,GLX_DOUBLEBUFFER,None};
g_visual_info = glXChooseVisual( GDK_DISPLAY(), DefaultScreen(GDK_DISPLAY()), data );
wxCHECK_MSG( g_visual_info != NULL, FALSE, "Couldn't choose visual for OpenGl" );
wxVisualSetByExternal = gdkx_visual_get(g_visual_info->visualid);
wxColormapSetByExternal = gdk_colormap_new( gdkx_visual_get(g_visual_info->visualid), TRUE );
return TRUE;
}
void wxGLModule::OnExit()
{
}

View File

@@ -4,17 +4,17 @@ Version: 2b1
Release: 1 Release: 1
Copyright: LGPL Copyright: LGPL
Group: X11/Libraries Group: X11/Libraries
Source: ftp://wesley.informatik.uni-freiburg.de/pub/linux/wxxt/source/wxGTK2b1.tgz Source0: ftp://wesley.informatik.uni-freiburg.de/pub/linux/wxxt/source/wxGTK2b1.tgz
URL: http://www.freiburg.linux.de/~wxxt/docs.html URL: http://www.freiburg.linux.de/~wxxt/docs.html
Packager: Michael Kiefte <mkiefte@gpu.srv.ualberta.ca> Packager: Michael Kiefte <mkiefte@gpu.srv.ualberta.ca>
Requires: gtk+ >= 1.0.4 Requires: gtk+ >= 1.0.4
%description %description
wxWindows is a free C++ library for cross-platform GUI development. With wxWindows, you can create applications for different GUIs from the same source code. wxWindows is a free C++ library for cross-platform GUI development. With wxWindows, you can create applications for different GUIs from the same source code. This package also contains a dialog editor.
%prep %prep
%setup -n wxGTK %setup -n wxGTK
./configure --with-threads ./configure --prefix=/usr --with-threads
%build %build
make src make src
@@ -30,5 +30,10 @@ make install
%files %files
%doc COPYING.LIB INSTALL.txt LICENCE.txt README.txt SYMBOLS.txt TODO.txt %doc COPYING.LIB INSTALL.txt LICENCE.txt README.txt SYMBOLS.txt TODO.txt
/usr/local/include /usr/include/wx
/usr/local/lib /usr/lib/wx
/usr/lib/libwx_gtk_1_0.a
/usr/lib/libwx_gtk_1_0.so
/usr/lib/libwx_gtk_1_0.so.1
/usr/lib/libwx_gtk_1_0.so.1.99
/usr/bin/wx-config