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

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

View File

@@ -44,6 +44,9 @@ wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete;
extern wxResourceCache *wxTheResourceCache;
GdkVisual *wxVisualSetByExternal = (GdkVisual*) NULL;
GdkColormap *wxColormapSetByExternal = (GdkColormap*) NULL;
unsigned char g_palette[64*3] =
{
0x0, 0x0, 0x0,
@@ -169,14 +172,60 @@ wxApp::~wxApp(void)
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;
}
bool wxApp::OnInitGui(void)
{
m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL );
return TRUE;
}
bool wxApp::OnInit(void)
{
return TRUE;
}
@@ -320,12 +369,6 @@ void wxApp::SetTopWindow( wxWindow *win )
void wxApp::CommonInit(void)
{
/*
#if wxUSE_RESOURCES
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif
*/
wxSystemSettings::Init();
wxTheFontNameDirectory = new wxFontNameDirectory;
@@ -350,14 +393,19 @@ void wxApp::CommonInit(void)
void wxApp::CommonCleanUp(void)
{
wxDELETE(wxTheColourDatabase);
wxDELETE(wxTheFontNameDirectory);
if (wxTheColourDatabase) delete wxTheColourDatabase;
wxTheColourDatabase = (wxColourDatabase*) NULL;
if (wxTheFontNameDirectory) delete wxTheFontNameDirectory;
wxTheFontNameDirectory = (wxFontNameDirectory*) NULL;
wxDeleteStockObjects();
#if wxUSE_WX_RESOURCES
wxFlushResources();
wxDELETE(wxTheResourceCache);
if (wxTheResourceCache) delete wxTheResourceCache;
wxTheResourceCache = (wxResourceCache*) NULL;
wxCleanUpResourceSystem();
#endif
@@ -419,29 +467,14 @@ int wxEntry( int argc, char *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 );
wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE;
if (!wxTheApp->InitVisual()) return 0;
wxApp::CommonInit();
wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE;
wxTheApp->OnInitGui();
if (!wxTheApp->OnInitGui()) return 0;
// Here frames insert themselves automatically
// into wxTopLevelWindows by getting created
@@ -481,11 +514,9 @@ int wxEntry( int argc, char *argv[] )
#endif
wxLog *oldLog = wxLog::SetActiveTarget( NULL );
wxLog *oldLog = wxLog::SetActiveTarget( (wxLog*) NULL );
if (oldLog) delete oldLog;
return retValue;
}
//-----------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

@@ -733,8 +733,8 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
if (!m_data) return (wxDragResult) wxDragNone;
static GtkWidget *drag_icon = NULL;
static GtkWidget *drop_icon = NULL;
static GtkWidget *drag_icon = (GtkWidget*) NULL;
static GtkWidget *drop_icon = (GtkWidget*) NULL;
GdkPoint hotspot_1 = {0,-5 };
@@ -872,7 +872,7 @@ void wxDropSource::UnregisterWindow(void)
/*
* Shaped Windows
*/
static GdkWindow *root_win = NULL;
static GdkWindow *root_win = (GdkWindow*) NULL;
typedef struct _cursoroffset {gint x,y;} CursorOffset;
@@ -895,7 +895,8 @@ shape_pressed (GtkWidget *widget, GdkEventButton *event)
(GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_MOTION_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" );
GList *list = g_list_append( NULL, child->data );
GList *list = g_list_append( (GList*) NULL, child->data );
gtk_list_remove_items( m_list, list );
g_list_free( list );

View File

@@ -155,14 +155,38 @@ bool wxMenuBar::Enabled( int id ) const
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"
//-----------------------------------------------------------------------------
static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{
wxYield();
int id = menu->FindMenuIdByMenuItem(widget);
/* should find it for normal (not popup) menu */

View File

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

View File

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

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "radiobox.h"
#endif
@@ -148,8 +147,8 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
wxSize wxRadioBox::LayoutItems()
{
int x = m_x+7;
int y = m_y+15;
int x = 7;
int y = 15;
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++)
{
y = m_y+15;
y = 15;
int max_len = 0;
wxNode *node = m_boxes.Nth( j*num_per_major );
@@ -169,10 +168,10 @@ wxSize wxRadioBox::LayoutItems()
GtkWidget *button = GTK_WIDGET( node->Data() );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
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;
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;
node = node->Next();
@@ -197,8 +196,8 @@ wxSize wxRadioBox::LayoutItems()
x += max_len + 2;
}
res.y -= 3;
res.x = x-2;
res.x = x+4;
res.y += 9;
}
else
{
@@ -211,7 +210,7 @@ wxSize wxRadioBox::LayoutItems()
GtkLabel *label = GTK_LABEL( button->child );
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;
node = node->Next();
@@ -222,13 +221,13 @@ wxSize wxRadioBox::LayoutItems()
{
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;
gtk_widget_set_usize( button, max, 20 );
node = node->Next();
}
res.x = x-2;
res.x = x+4;
res.y = 42;
}

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "region.h"
#endif
@@ -17,6 +16,13 @@
#include "gdk/gdk.h"
#include "gtk/gtk.h"
#ifdef __WXDEBUG__
#ifdef NULL
#undef NULL
#endif
#define NULL ((void*)0L)
#endif
//-----------------------------------------------------------------------------
// wxRegion
//-----------------------------------------------------------------------------
@@ -36,20 +42,20 @@ class wxRegionRefData: public wxObjectRefData
wxRegionRefData::wxRegionRefData(void)
{
m_region = (GdkRegion *) NULL;
m_region = (GdkRegion *) NULL;
}
wxRegionRefData::~wxRegionRefData(void)
{
if (m_region) gdk_region_destroy( m_region );
if (m_region) gdk_region_destroy( m_region );
wxNode *node = m_rects.First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
delete r;
node = node->Next();
}
wxNode *node = m_rects.First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
delete r;
node = node->Next();
}
}
//-----------------------------------------------------------------------------
@@ -60,57 +66,57 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject);
wxRegion::wxRegion( long x, long y, long w, long h )
{
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
gdk_region_destroy( reg );
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,w,h) );
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
gdk_region_destroy( reg );
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,w,h) );
}
wxRegion::wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
{
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle rect;
rect.x = topLeft.x;
rect.y = topLeft.y;
rect.width = bottomRight.x - rect.x;
rect.height = bottomRight.y - rect.y;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
gdk_region_destroy( reg );
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(topLeft,bottomRight) );
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle rect;
rect.x = topLeft.x;
rect.y = topLeft.y;
rect.width = bottomRight.x - rect.x;
rect.height = bottomRight.y - rect.y;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
gdk_region_destroy( reg );
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(topLeft,bottomRight) );
}
wxRegion::wxRegion( const wxRect& rect )
{
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle g_rect;
g_rect.x = rect.x;
g_rect.y = rect.y;
g_rect.width = rect.width;
g_rect.height = rect.height;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect );
gdk_region_destroy( reg );
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle g_rect;
g_rect.x = rect.x;
g_rect.y = rect.y;
g_rect.width = rect.width;
g_rect.height = rect.height;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect );
gdk_region_destroy( reg );
wxNode *node = M_REGIONDATA->m_rects.First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) );
node = node->Next();
}
wxNode *node = M_REGIONDATA->m_rects.First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) );
node = node->Next();
}
}
wxRegion::wxRegion(void)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
wxRegion::~wxRegion(void)
@@ -119,241 +125,241 @@ wxRegion::~wxRegion(void)
bool wxRegion::operator == ( const wxRegion& region )
{
return m_refData == region.m_refData;
return m_refData == region.m_refData;
}
bool wxRegion::operator != ( const wxRegion& region )
{
return m_refData != region.m_refData;
return m_refData != region.m_refData;
}
void wxRegion::Clear(void)
{
UnRef();
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
UnRef();
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
bool wxRegion::Union( long x, long y, long width, long height )
{
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) );
return TRUE;
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) );
return TRUE;
}
bool wxRegion::Union( const wxRect& rect )
{
GdkRectangle g_rect;
g_rect.x = rect.x;
g_rect.y = rect.y;
g_rect.width = rect.width;
g_rect.height = rect.height;
GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &g_rect );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(rect.x,rect.y,rect.width,rect.height) );
return TRUE;
GdkRectangle g_rect;
g_rect.x = rect.x;
g_rect.y = rect.y;
g_rect.width = rect.width;
g_rect.height = rect.height;
GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &g_rect );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(rect.x,rect.y,rect.width,rect.height) );
return TRUE;
}
bool wxRegion::Union( const wxRegion& region )
{
GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
wxNode *node = region.GetRectList()->First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) );
node = node->Next();
}
wxNode *node = region.GetRectList()->First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) );
node = node->Next();
}
return TRUE;
return TRUE;
}
bool wxRegion::Intersect( long x, long y, long width, long height )
{
wxRegion reg( x, y, width, height );
Intersect( reg );
return TRUE;
wxRegion reg( x, y, width, height );
Intersect( reg );
return TRUE;
}
bool wxRegion::Intersect( const wxRect& rect )
{
wxRegion reg( rect );
Intersect( reg );
return TRUE;
wxRegion reg( rect );
Intersect( reg );
return TRUE;
}
bool wxRegion::Intersect( const wxRegion& region )
{
GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
}
bool wxRegion::Subtract( long x, long y, long width, long height )
{
wxRegion reg( x, y, width, height );
Subtract( reg );
return TRUE;
wxRegion reg( x, y, width, height );
Subtract( reg );
return TRUE;
}
bool wxRegion::Subtract( const wxRect& rect )
{
wxRegion reg( rect );
Subtract( reg );
return TRUE;
wxRegion reg( rect );
Subtract( reg );
return TRUE;
}
bool wxRegion::Subtract( const wxRegion& region )
{
GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
}
bool wxRegion::Xor( long x, long y, long width, long height )
{
wxRegion reg( x, y, width, height );
Xor( reg );
return TRUE;
wxRegion reg( x, y, width, height );
Xor( reg );
return TRUE;
}
bool wxRegion::Xor( const wxRect& rect )
{
wxRegion reg( rect );
Xor( reg );
return TRUE;
wxRegion reg( rect );
Xor( reg );
return TRUE;
}
bool wxRegion::Xor( const wxRegion& region )
{
GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
wxNode *node = region.GetRectList()->First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) );
node = node->Next();
}
wxNode *node = region.GetRectList()->First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(r->x,r->y,r->width,r->height) );
node = node->Next();
}
return TRUE;
return TRUE;
}
void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const
{
x = 0;
y = 0;
w = -1;
h = -1;
wxNode *node = GetRectList()->First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
if (node == GetRectList()->First())
x = 0;
y = 0;
w = -1;
h = -1;
wxNode *node = GetRectList()->First();
while (node)
{
x = r->x;
y = r->y;
w = r->width;
h = r->height;
wxRect *r = (wxRect*)node->Data();
if (node == GetRectList()->First())
{
x = r->x;
y = r->y;
w = r->width;
h = r->height;
}
else
{
if (r->x < x)
{
x = r->x;
w += x - r->x;
}
if (r->y < y)
{
y = r->y;
h += y - r->y;
}
if (r->width+r->x > x+w)
{
w = r->x + r->width - x;
}
if (r->height+r->y > y+h)
{
h = r->y + r->height - y;
}
}
node = node->Next();
}
else
{
if (r->x < x)
{
x = r->x;
w += x - r->x;
}
if (r->y < y)
{
y = r->y;
h += y - r->y;
}
if (r->width+r->x > x+w)
{
w = r->x + r->width - x;
}
if (r->height+r->y > y+h)
{
h = r->y + r->height - y;
}
}
node = node->Next();
}
}
wxRect wxRegion::GetBox(void) const
{
long x = 0;
long y = 0;
long w = -1;
long h = -1;
GetBox( x, y, w, h );
return wxRect( x, y, w, h );
long x = 0;
long y = 0;
long w = -1;
long h = -1;
GetBox( x, y, w, h );
return wxRect( x, y, w, h );
}
bool wxRegion::Empty(void) const
{
return gdk_region_empty( M_REGIONDATA->m_region );
return gdk_region_empty( M_REGIONDATA->m_region );
}
wxRegionContain wxRegion::Contains( long x, long y ) const
{
if (gdk_region_point_in( M_REGIONDATA->m_region, x, y ))
return wxInRegion;
else
return wxOutRegion;
if (gdk_region_point_in( M_REGIONDATA->m_region, x, y ))
return wxInRegion;
else
return wxOutRegion;
}
wxRegionContain wxRegion::Contains( long x, long y, long w, long h ) const
{
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
GdkOverlapType res = gdk_region_rect_in( M_REGIONDATA->m_region, &rect );
switch (res)
{
case GDK_OVERLAP_RECTANGLE_IN: return wxInRegion;
case GDK_OVERLAP_RECTANGLE_OUT: return wxOutRegion;
case GDK_OVERLAP_RECTANGLE_PART: return wxPartRegion;
}
return wxOutRegion;
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
GdkOverlapType res = gdk_region_rect_in( M_REGIONDATA->m_region, &rect );
switch (res)
{
case GDK_OVERLAP_RECTANGLE_IN: return wxInRegion;
case GDK_OVERLAP_RECTANGLE_OUT: return wxOutRegion;
case GDK_OVERLAP_RECTANGLE_PART: return wxPartRegion;
}
return wxOutRegion;
}
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
{
return Contains( pt.x, pt.y );
return Contains( pt.x, pt.y );
}
wxRegionContain wxRegion::Contains(const wxRect& rect) const
{
return Contains( rect.x, rect.y, rect.width, rect.height );
return Contains( rect.x, rect.y, rect.width, rect.height );
}
GdkRegion *wxRegion::GetRegion(void) const
{
return M_REGIONDATA->m_region;
return M_REGIONDATA->m_region;
}
wxList *wxRegion::GetRectList() const
{
return &(M_REGIONDATA->m_rects);
return &(M_REGIONDATA->m_rects);
}
//-----------------------------------------------------------------------------
@@ -364,71 +370,71 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
wxRegionIterator::wxRegionIterator(void)
{
m_current = 0;
m_current = 0;
}
wxRegionIterator::wxRegionIterator( const wxRegion& region )
{
m_region = region;
m_current = 0;
m_region = region;
m_current = 0;
}
void wxRegionIterator::Reset( const wxRegion& region )
{
m_region = region;
m_current = 0;
m_region = region;
m_current = 0;
}
wxRegionIterator::operator bool (void) const
{
return m_current < m_region.GetRectList()->Number();
return m_current < m_region.GetRectList()->Number();
}
bool wxRegionIterator::HaveRects(void) const
{
return m_current < m_region.GetRectList()->Number();
return m_current < m_region.GetRectList()->Number();
}
void wxRegionIterator::operator ++ (void)
{
if (m_current < m_region.GetRectList()->Number()) ++m_current;
if (m_current < m_region.GetRectList()->Number()) ++m_current;
}
void wxRegionIterator::operator ++ (int)
{
if (m_current < m_region.GetRectList()->Number()) ++m_current;
if (m_current < m_region.GetRectList()->Number()) ++m_current;
}
long wxRegionIterator::GetX(void) const
{
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
wxRect *r = (wxRect*)node->Data();
return r->x;
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
wxRect *r = (wxRect*)node->Data();
return r->x;
}
long wxRegionIterator::GetY(void) const
{
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
wxRect *r = (wxRect*)node->Data();
return r->y;
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
wxRect *r = (wxRect*)node->Data();
return r->y;
}
long wxRegionIterator::GetW(void) const
{
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
wxRect *r = (wxRect*)node->Data();
return r->width;
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
wxRect *r = (wxRect*)node->Data();
return r->width;
}
long wxRegionIterator::GetH(void) const
{
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
wxRect *r = (wxRect*)node->Data();
return r->height;
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
wxRect *r = (wxRect*)node->Data();
return r->height;
}

View File

@@ -303,7 +303,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
Clear();
FILE *fp = NULL;
FILE *fp = (FILE*) NULL;
struct stat statb;
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
{
char *text = NULL;
char *text = (char*) NULL;
gint len = 0;
if (m_windowStyle & wxTE_MULTILINE)

View File

@@ -64,7 +64,7 @@ public:
wxMutex::wxMutex()
{
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;
}
@@ -73,46 +73,54 @@ wxMutex::~wxMutex()
if (m_locked > 0)
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;
}
wxMutexError wxMutex::Lock()
{
int err;
err = pthread_mutex_lock(&(p_internal->p_mutex));
int err = pthread_mutex_lock( &(p_internal->p_mutex) );
if (err == EDEADLK)
{
return wxMUTEX_DEAD_LOCK;
}
m_locked++;
return wxMUTEX_NO_ERROR;
}
wxMutexError wxMutex::TryLock()
{
int err;
if (m_locked)
{
return wxMUTEX_BUSY;
}
err = pthread_mutex_trylock(&(p_internal->p_mutex));
int err = pthread_mutex_trylock( &(p_internal->p_mutex) );
switch (err)
{
case EBUSY: return wxMUTEX_BUSY;
}
m_locked++;
return wxMUTEX_NO_ERROR;
}
wxMutexError wxMutex::Unlock()
{
if (m_locked > 0)
{
m_locked--;
}
else
{
return wxMUTEX_UNLOCKED;
}
pthread_mutex_unlock(&(p_internal->p_mutex));
pthread_mutex_unlock( &(p_internal->p_mutex) );
return wxMUTEX_NO_ERROR;
}
@@ -129,37 +137,38 @@ public:
wxCondition::wxCondition()
{
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()
{
pthread_cond_destroy(&(p_internal->p_condition));
pthread_cond_destroy( &(p_internal->p_condition) );
delete p_internal;
}
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)
{
struct timespec tspec;
tspec.tv_sec = time(NULL)+sec;
tspec.tv_sec = time(0L)+sec;
tspec.tv_nsec = nsec;
return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT);
}
void wxCondition::Signal()
{
pthread_cond_signal(&(p_internal->p_condition));
pthread_cond_signal( &(p_internal->p_condition) );
}
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;
/* Call the main entry */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL );
void* status = thread->Entry();
thread->Exit(status);
@@ -246,9 +255,9 @@ int wxThread::GetPriority() const
void wxThread::DeferDestroy(bool on)
{
if (on)
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, (int*) NULL);
else
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, (int*) NULL);
}
wxThreadError wxThread::Destroy()

View File

@@ -15,6 +15,51 @@
#include "wx/timer.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

View File

@@ -30,13 +30,10 @@
#include <netdb.h>
#include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include "glib.h"
#include "gdk/gdk.h"
#include "gtk/gtk.h"
#include "gtk/gtkfeatures.h"
#include "gdk/gdkx.h"
#ifdef __SVR4__
@@ -79,12 +76,7 @@ void wxDisplaySize( int *width, int *height )
void wxGetMousePosition( int* x, int* y )
{
Window dumw;
int dumi;
unsigned int dumu;
XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(),
&dumw,&dumw,x,y,&dumi,&dumi,&dumu );
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
}
bool wxColourDisplay(void)
@@ -97,6 +89,14 @@ int wxDisplayDepth(void)
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
//------------------------------------------------------------------------
@@ -124,7 +124,8 @@ char *wxGetUserHome( const wxString &user )
{
who = getpwnam(ptr);
}
// We now make sure the the user exists!
/* We now make sure the the user exists! */
if (who == NULL)
{
who = getpwuid(getuid());
@@ -250,37 +251,37 @@ bool wxDirExists( const wxString& dir )
struct wxEndProcessData
{
gint pid, tag;
wxProcess *process;
gint pid, tag;
wxProcess *process;
};
static void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) )
{
wxEndProcessData *proc_data = (wxEndProcessData *)data;
int pid;
wxEndProcessData *proc_data = (wxEndProcessData *)data;
int pid;
pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
/* wait4 is not part of any standard, use at own risk
* not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-)
* --- offer@sgi.com */
/* wait4 is not part of any standard, use at own risk
* not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-)
* --- offer@sgi.com */
#if !defined(__sgi)
wait4(proc_data->pid, NULL, 0, NULL);
wait4(proc_data->pid, (int*) NULL, 0, (rusage *) NULL);
#else
wait3((int *) NULL, 0, (rusage *) NULL);
wait3((int *) NULL, 0, (rusage *) NULL);
#endif
close(source);
gdk_input_remove(proc_data->tag);
close(source);
gdk_input_remove(proc_data->tag);
if (proc_data->process)
proc_data->process->OnTerminate(proc_data->pid);
if (proc_data->process)
proc_data->process->OnTerminate(proc_data->pid);
if (proc_data->pid > 0)
delete proc_data;
else
proc_data->pid = 0;
if (proc_data->pid > 0)
delete proc_data;
else
proc_data->pid = 0;
}
long wxExecute( char **argv, bool sync, wxProcess *process )
@@ -291,8 +292,9 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
wxCHECK_MSG( *argv, 0, "can't exec empty command" );
/* Create pipes */
if (pipe(end_proc_detect) == -1) {
wxLogSysError(_("Pipe creation failed"));
if (pipe(end_proc_detect) == -1)
{
wxLogSysError( "Pipe creation failed" );
return 0;
}
@@ -302,12 +304,13 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
#else
pid_t pid = fork();
#endif
if (pid == -1) {
// error
wxLogSysError(_("Fork failed"));
if (pid == -1)
{
wxLogSysError( "Fork failed" );
return 0;
}
else if (pid == 0) {
else if (pid == 0)
{
// we're in child
close(end_proc_detect[0]); // close reading side
// These three lines close the open file descriptors to
@@ -325,20 +328,23 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
execvp (*argv, argv);
#endif
// there is no return after successful exec()
wxLogSysError(_("Can't execute '%s'"), *argv);
wxLogSysError( "Can't execute '%s'", *argv);
_exit(-1);
}
else {
else
{
// we're in parent
close(end_proc_detect[1]); // close writing side
data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
GTK_EndProcessDetector, (gpointer)data);
data->pid = pid;
if (!sync) {
if (!sync)
{
data->process = process;
}
else {
else
{
data->process = (wxProcess *) NULL;
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
(void)GetIniFile(buffer, file);
wxNode *node = wxTheResourceCache->Find(buffer);
wxNode *node = (wxNode*) NULL; /* suppress egcs warning */
node = wxTheResourceCache->Find(buffer);
if (node)
{
database = (XrmDatabase)node->Data();
else {
}
else
{
database = XrmGetFileDatabase(buffer);
wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database);

View File

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

View File

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