From c693edf3bc9539378a7ac56d90d41d89c7dc7579 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 28 Jun 1999 13:22:00 +0000 Subject: [PATCH] Applied fixes for AIX (GTK 1.0 compilation). Removed ostream from property classes. Removed Lisp output from wxExpr. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/bmpbuttn.h | 2 +- include/wx/gtk1/bmpbuttn.h | 2 +- include/wx/prop.h | 7 +- include/wx/wxexpr.h | 2 - src/common/resource.cpp | 9 +-- src/common/wxexpr.cpp | 61 ----------------- src/generic/prop.cpp | 107 ++++++++++-------------------- src/generic/propform.cpp | 16 +---- src/generic/proplist.cpp | 18 +---- src/gtk/dialog.cpp | 13 +++- src/gtk/frame.cpp | 15 ++++- src/gtk/notebook.cpp | 2 +- src/gtk/tbargtk.cpp | 33 +++------- src/gtk/utilsres.cpp | 8 +-- src/gtk/window.cpp | 132 ++++++++++++++++++++++++++++++++++++- src/gtk1/dialog.cpp | 13 +++- src/gtk1/frame.cpp | 15 ++++- src/gtk1/notebook.cpp | 2 +- src/gtk1/tbargtk.cpp | 33 +++------- src/gtk1/utilsres.cpp | 8 +-- src/gtk1/window.cpp | 132 ++++++++++++++++++++++++++++++++++++- 21 files changed, 377 insertions(+), 253 deletions(-) diff --git a/include/wx/gtk/bmpbuttn.h b/include/wx/gtk/bmpbuttn.h index ec13253586..7806bc1471 100644 --- a/include/wx/gtk/bmpbuttn.h +++ b/include/wx/gtk/bmpbuttn.h @@ -75,7 +75,7 @@ public: void SetBitmapLabel( const wxBitmap& bitmap ); void SetBitmapSelected( const wxBitmap& bitmap ); - virtual bool Enable(const bool); + virtual bool Enable(bool enable); // implementation diff --git a/include/wx/gtk1/bmpbuttn.h b/include/wx/gtk1/bmpbuttn.h index ec13253586..7806bc1471 100644 --- a/include/wx/gtk1/bmpbuttn.h +++ b/include/wx/gtk1/bmpbuttn.h @@ -75,7 +75,7 @@ public: void SetBitmapLabel( const wxBitmap& bitmap ); void SetBitmapSelected( const wxBitmap& bitmap ); - virtual bool Enable(const bool); + virtual bool Enable(bool enable); // implementation diff --git a/include/wx/prop.h b/include/wx/prop.h index 9afa515b19..24348b1e70 100644 --- a/include/wx/prop.h +++ b/include/wx/prop.h @@ -67,9 +67,6 @@ class WXDLLEXPORT wxPropertySheet: public wxObject // Clear all properties virtual void Clear(void); - virtual bool Save(ostream& str); - virtual bool Load(ostream& str); - virtual void UpdateAllViews(wxPropertyView *thisView = NULL); inline virtual wxList& GetProperties(void) const { return (wxList&) m_properties; } @@ -231,8 +228,8 @@ class WXDLLEXPORT wxPropertyValue: public wxObject virtual wxPropertyValue *NewCopy(void) const; virtual void Copy(wxPropertyValue& copyFrom); - virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause - virtual void WritePropertyType(ostream& stream); // Write as any other subexpression + virtual void WritePropertyClause(wxString &stream); // Write this expression as a top-level clause + virtual void WritePropertyType(wxString &stream); // Write as any other subexpression // Append an expression to a list virtual void Append(wxPropertyValue *expr); diff --git a/include/wx/wxexpr.h b/include/wx/wxexpr.h index 30d32fda62..adaaa4c7f5 100644 --- a/include/wx/wxexpr.h +++ b/include/wx/wxexpr.h @@ -141,7 +141,6 @@ class WXDLLEXPORT wxExpr bool IsFunctor(const wxString& s) const; // Only for a clause void WriteClause(FILE* stream); // Write this expression as a top-level clause void WriteExpr(FILE* stream); // Write as any other subexpression - void WriteLispExpr(FILE* stream); // Append an expression to a list void Append(wxExpr *expr); @@ -243,7 +242,6 @@ public: bool ReadFromString(const wxString& buffer); bool Write(const wxString& fileName); bool Write(FILE* stream); - void WriteLisp(FILE* stream); // Compatibility inline bool ReadProlog(wxChar *filename) { return Read(wxString(filename)); } diff --git a/src/common/resource.cpp b/src/common/resource.cpp index f194ea4167..95c3840d98 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -39,7 +39,6 @@ #include "wx/button.h" #include "wx/bmpbuttn.h" #include "wx/radiobox.h" -#include "wx/radiobut.h" #include "wx/listbox.h" #include "wx/choice.h" #include "wx/checkbox.h" @@ -48,15 +47,13 @@ #include "wx/icon.h" #include "wx/statbox.h" #include "wx/statbmp.h" -#if wxUSE_GAUGE #include "wx/gauge.h" -#endif #include "wx/textctrl.h" #include "wx/msgdlg.h" #include "wx/intl.h" #endif -#if wxUSE_RADIOBUTTON +#if wxUSE_RADIOBTN #include "wx/radiobut.h" #endif @@ -373,7 +370,7 @@ wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* c ((wxGauge *)control)->SetValue((int)childResource->GetValue1()); } #endif -#if wxUSE_RADIOBUTTON +#if wxUSE_RADIOBTN else if (itemType == wxString(_T("wxRadioButton"))) { control = new wxRadioButton(parent, id, childResource->GetTitle(), // (int)childResource->GetValue1(), @@ -862,7 +859,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); } } -#if wxUSE_RADIOBUTTON +#if wxUSE_RADIOBTN else if (controlType == _T("wxRadioButton")) { // Check for default value diff --git a/src/common/wxexpr.cpp b/src/common/wxexpr.cpp index 67e5f100e7..08f4affcd7 100644 --- a/src/common/wxexpr.cpp +++ b/src/common/wxexpr.cpp @@ -796,54 +796,6 @@ void wxExpr::WriteExpr(FILE* stream) // Write as any other subexpression } } -void wxExpr::WriteLispExpr(FILE* stream) -{ - switch (type) - { - case wxExprInteger: - { - fprintf( stream, "%ld", value.integer ); - break; - } - case wxExprReal: - { - fprintf( stream, "%.6g", value.real ); - break; - } - case wxExprString: - { - fprintf( stream, "\"" ); - const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.string); - fprintf( stream, (const char*) val ); - fprintf( stream, "\"" ); - break; - } - case wxExprWord: - { - const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.word); - fprintf( stream, (const char*) val ); - break; - } - case wxExprList: - { - wxExpr *expr = value.first; - - fprintf( stream, "(" ); - while (expr) - { - expr->WriteLispExpr(stream); - expr = expr->next; - if (expr) - fprintf( stream, " " ); - } - - fprintf( stream, ")" ); - break; - } - case wxExprNull: break; - } -} - /* * wxExpr 'database' (list of expressions) */ @@ -1095,19 +1047,6 @@ bool wxExprDatabase::Write(FILE *stream) return (noErrors == 0); } -void wxExprDatabase::WriteLisp(FILE* stream) -{ - noErrors = 0; - wxNode *node = First(); - while (node) - { - wxExpr *expr = (wxExpr *)node->Data(); - expr->WriteLispExpr(stream); - fprintf( stream, "\n\n" ); - node = node->Next(); - } -} - void add_expr(wxExpr * expr) { thewxExprDatabase->Append(expr); diff --git a/src/generic/prop.cpp b/src/generic/prop.cpp index 11214bbb97..2e913449ef 100644 --- a/src/generic/prop.cpp +++ b/src/generic/prop.cpp @@ -24,26 +24,14 @@ #include "wx/wx.h" #endif +#include "wx/debug.h" +#include "wx/prop.h" + #include #include #include #include -#if wxUSE_IOSTREAMH -#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXWINE__) -#include -#else -#include -#endif -#else -#include -#endif - -#include "wx/window.h" -#include "wx/utils.h" -#include "wx/list.h" -#include "wx/debug.h" -#include "wx/prop.h" IMPLEMENT_DYNAMIC_CLASS(wxPropertyValue, wxObject) @@ -457,7 +445,7 @@ int wxPropertyValue::Number(void) const return i; } -void wxPropertyValue::WritePropertyClause(ostream& stream) // Write this expression as a top-level clause +void wxPropertyValue::WritePropertyClause(wxString& stream) // Write this expression as a top-level clause { if (m_type != wxPropertyValueList) return; @@ -466,86 +454,73 @@ void wxPropertyValue::WritePropertyClause(ostream& stream) // Write this expres if (node) { node->WritePropertyType(stream); - stream << "("; + stream.Append( _T("(") ); node = node->m_next; bool first = TRUE; while (node) { if (!first) - stream << " "; + stream.Append( _T(" ") ); node->WritePropertyType(stream); node = node->m_next; - if (node) stream << ",\n"; + if (node) + stream.Append( _T(",\n" ) ); first = FALSE; } - stream << ").\n\n"; + stream.Append( _T(").\n\n") ); } } -void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any other subexpression +void wxPropertyValue::WritePropertyType(wxString& stream) // Write as any other subexpression { + wxString tmp; switch (m_type) { case wxPropertyValueInteger: { - stream << m_value.integer; + tmp.Printf( _T("%ld"), m_value.integer ); + stream.Append( tmp ); break; } case wxPropertyValueIntegerPtr: { - stream << *m_value.integerPtr; + tmp.Printf( _T("%ld"), *m_value.integerPtr ); + stream.Append( tmp ); break; } case wxPropertyValuebool: { if (m_value.integer) - stream << "True"; + stream.Append( _T("True") ); else - stream << "False"; + stream.Append( _T("False") ); break; } case wxPropertyValueboolPtr: { if (*m_value.integerPtr) - stream << "True"; + stream.Append( _T("True") ); else - stream << "False"; + stream.Append( _T("False") ); break; } case wxPropertyValueReal: { - float f = m_value.real; - wxSprintf(wxBuffer, _T("%.6g"), (double)f); - stream << wxBuffer; + double d = m_value.real; + tmp.Printf( _T("%.6g"), d ); + stream.Append( tmp ); break; } case wxPropertyValueRealPtr: { - float f = *m_value.realPtr; -/* Now the parser can cope with this. - // Prevent printing in 'e' notation. Any better way? - if (fabs(f) < 0.00001) - f = 0.0; -*/ - wxSprintf(wxBuffer, _T("%.6g"), f); - stream << wxBuffer; + double d = *m_value.realPtr; + tmp.Printf( _T("%.6g"), d ); + stream.Append( tmp ); break; } case wxPropertyValueString: { -// stream << "\""; - int i; - const wxWX2MBbuf strbuf = wxConvCurrent->cWX2MB(m_value.string); - int len = strlen(strbuf); - for (i = 0; i < len; i++) - { - char ch = strbuf[i]; -// if (ch == '"' || ch == '\\') -// stream << "\\"; - stream << ch; - } - -// stream << "\""; + stream.Append( m_value.string ); break; } case wxPropertyValueStringPtr: @@ -565,19 +540,20 @@ void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any othe case wxPropertyValueList: { if (!m_value.first) - stream << "[]"; + stream.Append( _T("[]") ); else { wxPropertyValue *expr = m_value.first; - stream << "["; + stream.Append( _T("[") ); while (expr) { expr->WritePropertyType(stream); expr = expr->m_next; - if (expr) stream << ", "; + if (expr) + stream.Append( _T(", ") ); } - stream << "]"; + stream.Append( _T("]") ); } break; } @@ -587,16 +563,9 @@ void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any othe wxString wxPropertyValue::GetStringRepresentation(void) { - char buf[500]; - buf[0] = 0; - - ostrstream str((char *)buf, (int)500, ios::out); + wxString str; WritePropertyType(str); - str << '\0'; - str.flush(); - - wxString theString(buf); - return theString; + return str; } void wxPropertyValue::operator=(const wxPropertyValue& val) @@ -952,16 +921,6 @@ wxPropertySheet::~wxPropertySheet(void) Clear(); } -bool wxPropertySheet::Save( ostream& WXUNUSED(str) ) -{ - return FALSE; -} - -bool wxPropertySheet::Load( ostream& WXUNUSED(str) ) -{ - return FALSE; -} - void wxPropertySheet::UpdateAllViews( wxPropertyView *WXUNUSED(thisView) ) { } diff --git a/src/generic/propform.cpp b/src/generic/propform.cpp index 9a9e513763..686db00abf 100644 --- a/src/generic/propform.cpp +++ b/src/generic/propform.cpp @@ -24,25 +24,13 @@ #include "wx/wx.h" #endif +#include "wx/propform.h" + #include #include #include #include -#if wxUSE_IOSTREAMH -#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXWINE__) -#include -#else -#include -#endif -#else -#include -#endif - -#include "wx/window.h" -#include "wx/utils.h" -#include "wx/list.h" -#include "wx/propform.h" /* * Property view diff --git a/src/generic/proplist.cpp b/src/generic/proplist.cpp index 3c0922e09d..4a44094a8e 100644 --- a/src/generic/proplist.cpp +++ b/src/generic/proplist.cpp @@ -24,26 +24,14 @@ #include "wx/wx.h" #endif +#include "wx/colordlg.h" +#include "wx/proplist.h" + #include #include #include #include -#if wxUSE_IOSTREAMH -#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__WXWINE__) -#include -#else -#include -#endif -#else -#include -#endif - -#include "wx/window.h" -#include "wx/utils.h" -#include "wx/list.h" -#include "wx/colordlg.h" -#include "wx/proplist.h" /* * Property text edit control diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 68afab7f74..fe199dd6de 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -69,19 +69,28 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation // "configure_event" //----------------------------------------------------------------------------- -static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDialog *win ) +static gint +#if (GTK_MINOR_VERSON > 0) +gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDialog *win ) +#else +gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxDialog *win ) +#endif { if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; +#if (GTK_MINOR_VERSON > 0) int x = 0; int y = 0; gdk_window_get_root_origin( win->m_widget->window, &x, &y ); - win->m_x = x; win->m_y = y; +#else + win->m_x = event->x; + win->m_y = event->y; +#endif wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() ); mevent.SetEventObject( win ); diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 0963513426..61259fad4b 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -152,19 +152,28 @@ static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSE // "configure_event" //----------------------------------------------------------------------------- -static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrame *win ) +static gint +#if (GTK_MINOR_VERSON > 0) +gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrame *win ) +#else +gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win ) +#endif { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; +#if (GTK_MINOR_VERSON > 0) int x = 0; int y = 0; gdk_window_get_root_origin( win->m_widget->window, &x, &y ); - win->m_x = x; win->m_y = y; +#else + win->m_x = event->x; + win->m_y = event->y; +#endif wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() ); mevent.SetEventObject( win ); diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 3bb33c9e2e..2ea952be80 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -520,7 +520,7 @@ bool wxNotebook::InsertPage( int position, wxWindow* win, const wxString& text, else gtk_notebook_insert_page( notebook, win->m_widget, page->m_box, position ); - page->m_page = GTK_NOTEBOOK_PAGE( g_list_last(notebook->children)->data ); + page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data; gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win ); diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 651c6ba081..4c07013c12 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -80,8 +80,8 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget), wxToolBar *tb = tool->m_owner; - /* we grey-out the tip text of disabled tool */ -#if 0 +#if (GTK_MINOR_VERSION == 0) + /* we grey-out the tip text of disabled tool in GTK 1.0 */ if (tool->m_enabled) { if (tb->m_fg->red != 0) @@ -91,17 +91,7 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget), tb->m_fg->blue = 0; gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg ); -#if (GTK_MINOR_VERSION > 0) - GtkStyle *g_style = - gtk_style_copy( - gtk_widget_get_style( - GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window ) ); - - g_style->fg[GTK_STATE_NORMAL] = *tb->m_fg; - gtk_widget_set_style( GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window, g_style ); -#else gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg ); -#endif } } else @@ -112,17 +102,7 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget), tb->m_fg->green = 33000; tb->m_fg->blue = 33000; gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg ); -#if (GTK_MINOR_VERSION > 0) - GtkStyle *g_style = - gtk_style_copy( - gtk_widget_get_style( - GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window ) ); - - g_style->fg[GTK_STATE_NORMAL] = *tb->m_fg; - gtk_widget_set_style( GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window, g_style ); -#else gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg ); -#endif } } #endif @@ -294,7 +274,9 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap, mask = bitmap.GetMask()->GetBitmap(); tool_pixmap = gtk_pixmap_new( pixmap, mask ); +#if (GTK_MINOR_VERSION > 0) gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE ); +#endif gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 ); @@ -376,11 +358,12 @@ void wxToolBar::EnableTool(int toolIndex, bool enable) { tool->m_enabled = enable; -/* we don't disable the tools for now as the bitmaps don't get - greyed anyway and this also disables tooltips */ - +#if (GTK_MINOR_VERSION > 0) + /* we don't disable the tools for GTK 1.0 as the bitmaps don't get + greyed anyway and this also disables tooltips */ if (tool->m_item) gtk_widget_set_sensitive( tool->m_item, enable ); +#endif return; } diff --git a/src/gtk/utilsres.cpp b/src/gtk/utilsres.cpp index 783d2087a2..fda2bf5e9d 100644 --- a/src/gtk/utilsres.cpp +++ b/src/gtk/utilsres.cpp @@ -15,13 +15,14 @@ #include "wx/utils.h" #include "wx/string.h" #include "wx/list.h" +#include "wx/log.h" #include #include #include -#ifdef __SVR4__ -#include -#endif +//#ifdef __SVR4__ +//#include +//#endif #include "gdk/gdkx.h" // GDK_DISPLAY #include "gdk/gdkprivate.h" // gdk_progclass @@ -30,7 +31,6 @@ #include #include -#include "wx/log.h" //----------------------------------------------------------------------------- // constants diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 2f86fc9602..8262d26b9d 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -215,6 +215,134 @@ extern bool g_isIdle; //----------------------------------------------------------------------------- #if (GTK_MINOR_VERSION == 0) +/* these functions are copied verbatim from GTK 1.2 */ +static void +gdkx_XConvertCase (KeySym symbol, + KeySym *lower, + KeySym *upper) +{ + register KeySym sym = symbol; + + g_return_if_fail (lower != NULL); + g_return_if_fail (upper != NULL); + + *lower = sym; + *upper = sym; + + switch (sym >> 8) + { +#if defined (GDK_A) && defined (GDK_Ooblique) + case 0: /* Latin 1 */ + if ((sym >= GDK_A) && (sym <= GDK_Z)) + *lower += (GDK_a - GDK_A); + else if ((sym >= GDK_a) && (sym <= GDK_z)) + *upper -= (GDK_a - GDK_A); + else if ((sym >= GDK_Agrave) && (sym <= GDK_Odiaeresis)) + *lower += (GDK_agrave - GDK_Agrave); + else if ((sym >= GDK_agrave) && (sym <= GDK_odiaeresis)) + *upper -= (GDK_agrave - GDK_Agrave); + else if ((sym >= GDK_Ooblique) && (sym <= GDK_Thorn)) + *lower += (GDK_oslash - GDK_Ooblique); + else if ((sym >= GDK_oslash) && (sym <= GDK_thorn)) + *upper -= (GDK_oslash - GDK_Ooblique); + break; +#endif /* LATIN1 */ + +#if defined (GDK_Aogonek) && defined (GDK_tcedilla) + case 1: /* Latin 2 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym == GDK_Aogonek) + *lower = GDK_aogonek; + else if (sym >= GDK_Lstroke && sym <= GDK_Sacute) + *lower += (GDK_lstroke - GDK_Lstroke); + else if (sym >= GDK_Scaron && sym <= GDK_Zacute) + *lower += (GDK_scaron - GDK_Scaron); + else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot) + *lower += (GDK_zcaron - GDK_Zcaron); + else if (sym == GDK_aogonek) + *upper = GDK_Aogonek; + else if (sym >= GDK_lstroke && sym <= GDK_sacute) + *upper -= (GDK_lstroke - GDK_Lstroke); + else if (sym >= GDK_scaron && sym <= GDK_zacute) + *upper -= (GDK_scaron - GDK_Scaron); + else if (sym >= GDK_zcaron && sym <= GDK_zabovedot) + *upper -= (GDK_zcaron - GDK_Zcaron); + else if (sym >= GDK_Racute && sym <= GDK_Tcedilla) + *lower += (GDK_racute - GDK_Racute); + else if (sym >= GDK_racute && sym <= GDK_tcedilla) + *upper -= (GDK_racute - GDK_Racute); + break; +#endif /* LATIN2 */ + +#if defined (GDK_Hstroke) && defined (GDK_Cabovedot) + case 2: /* Latin 3 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex) + *lower += (GDK_hstroke - GDK_Hstroke); + else if (sym >= GDK_Gbreve && sym <= GDK_Jcircumflex) + *lower += (GDK_gbreve - GDK_Gbreve); + else if (sym >= GDK_hstroke && sym <= GDK_hcircumflex) + *upper -= (GDK_hstroke - GDK_Hstroke); + else if (sym >= GDK_gbreve && sym <= GDK_jcircumflex) + *upper -= (GDK_gbreve - GDK_Gbreve); + else if (sym >= GDK_Cabovedot && sym <= GDK_Scircumflex) + *lower += (GDK_cabovedot - GDK_Cabovedot); + else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex) + *upper -= (GDK_cabovedot - GDK_Cabovedot); + break; +#endif /* LATIN3 */ + +#if defined (GDK_Rcedilla) && defined (GDK_Amacron) + case 3: /* Latin 4 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= GDK_Rcedilla && sym <= GDK_Tslash) + *lower += (GDK_rcedilla - GDK_Rcedilla); + else if (sym >= GDK_rcedilla && sym <= GDK_tslash) + *upper -= (GDK_rcedilla - GDK_Rcedilla); + else if (sym == GDK_ENG) + *lower = GDK_eng; + else if (sym == GDK_eng) + *upper = GDK_ENG; + else if (sym >= GDK_Amacron && sym <= GDK_Umacron) + *lower += (GDK_amacron - GDK_Amacron); + else if (sym >= GDK_amacron && sym <= GDK_umacron) + *upper -= (GDK_amacron - GDK_Amacron); + break; +#endif /* LATIN4 */ + +#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu) + case 6: /* Cyrillic */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE) + *lower -= (GDK_Serbian_DJE - GDK_Serbian_dje); + else if (sym >= GDK_Serbian_dje && sym <= GDK_Serbian_dze) + *upper += (GDK_Serbian_DJE - GDK_Serbian_dje); + else if (sym >= GDK_Cyrillic_YU && sym <= GDK_Cyrillic_HARDSIGN) + *lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu); + else if (sym >= GDK_Cyrillic_yu && sym <= GDK_Cyrillic_hardsign) + *upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu); + break; +#endif /* CYRILLIC */ + +#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma) + case 7: /* Greek */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent) + *lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); + else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent && + sym != GDK_Greek_iotaaccentdieresis && + sym != GDK_Greek_upsilonaccentdieresis) + *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); + else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA) + *lower += (GDK_Greek_alpha - GDK_Greek_ALPHA); + else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega && + sym != GDK_Greek_finalsmallsigma) + *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA); + break; +#endif /* GREEK */ + } +} + static guint gdk_keyval_to_upper (guint keyval) { @@ -223,7 +351,7 @@ gdk_keyval_to_upper (guint keyval) KeySym lower_val = 0; KeySym upper_val = 0; - XConvertCase (keyval, &lower_val, &upper_val); + gdkx_XConvertCase (keyval, &lower_val, &upper_val); return upper_val; } return 0; @@ -2384,7 +2512,7 @@ bool wxWindow::AcceptsFocus() const bool wxWindow::Reparent( wxWindow *newParent ) { - wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") ); wxWindow *oldParent = m_parent; diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 68afab7f74..fe199dd6de 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -69,19 +69,28 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation // "configure_event" //----------------------------------------------------------------------------- -static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDialog *win ) +static gint +#if (GTK_MINOR_VERSON > 0) +gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDialog *win ) +#else +gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxDialog *win ) +#endif { if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; +#if (GTK_MINOR_VERSON > 0) int x = 0; int y = 0; gdk_window_get_root_origin( win->m_widget->window, &x, &y ); - win->m_x = x; win->m_y = y; +#else + win->m_x = event->x; + win->m_y = event->y; +#endif wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() ); mevent.SetEventObject( win ); diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 0963513426..61259fad4b 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -152,19 +152,28 @@ static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSE // "configure_event" //----------------------------------------------------------------------------- -static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrame *win ) +static gint +#if (GTK_MINOR_VERSON > 0) +gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrame *win ) +#else +gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win ) +#endif { - if (g_isIdle) + if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return FALSE; +#if (GTK_MINOR_VERSON > 0) int x = 0; int y = 0; gdk_window_get_root_origin( win->m_widget->window, &x, &y ); - win->m_x = x; win->m_y = y; +#else + win->m_x = event->x; + win->m_y = event->y; +#endif wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() ); mevent.SetEventObject( win ); diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 3bb33c9e2e..2ea952be80 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -520,7 +520,7 @@ bool wxNotebook::InsertPage( int position, wxWindow* win, const wxString& text, else gtk_notebook_insert_page( notebook, win->m_widget, page->m_box, position ); - page->m_page = GTK_NOTEBOOK_PAGE( g_list_last(notebook->children)->data ); + page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data; gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win ); diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 651c6ba081..4c07013c12 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -80,8 +80,8 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget), wxToolBar *tb = tool->m_owner; - /* we grey-out the tip text of disabled tool */ -#if 0 +#if (GTK_MINOR_VERSION == 0) + /* we grey-out the tip text of disabled tool in GTK 1.0 */ if (tool->m_enabled) { if (tb->m_fg->red != 0) @@ -91,17 +91,7 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget), tb->m_fg->blue = 0; gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg ); -#if (GTK_MINOR_VERSION > 0) - GtkStyle *g_style = - gtk_style_copy( - gtk_widget_get_style( - GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window ) ); - - g_style->fg[GTK_STATE_NORMAL] = *tb->m_fg; - gtk_widget_set_style( GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window, g_style ); -#else gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg ); -#endif } } else @@ -112,17 +102,7 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget), tb->m_fg->green = 33000; tb->m_fg->blue = 33000; gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(tb->m_toolbar) ), tb->m_fg ); -#if (GTK_MINOR_VERSION > 0) - GtkStyle *g_style = - gtk_style_copy( - gtk_widget_get_style( - GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window ) ); - - g_style->fg[GTK_STATE_NORMAL] = *tb->m_fg; - gtk_widget_set_style( GTK_TOOLBAR(tb->m_toolbar)->tooltips->tip_window, g_style ); -#else gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg ); -#endif } } #endif @@ -294,7 +274,9 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap, mask = bitmap.GetMask()->GetBitmap(); tool_pixmap = gtk_pixmap_new( pixmap, mask ); +#if (GTK_MINOR_VERSION > 0) gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE ); +#endif gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 ); @@ -376,11 +358,12 @@ void wxToolBar::EnableTool(int toolIndex, bool enable) { tool->m_enabled = enable; -/* we don't disable the tools for now as the bitmaps don't get - greyed anyway and this also disables tooltips */ - +#if (GTK_MINOR_VERSION > 0) + /* we don't disable the tools for GTK 1.0 as the bitmaps don't get + greyed anyway and this also disables tooltips */ if (tool->m_item) gtk_widget_set_sensitive( tool->m_item, enable ); +#endif return; } diff --git a/src/gtk1/utilsres.cpp b/src/gtk1/utilsres.cpp index 783d2087a2..fda2bf5e9d 100644 --- a/src/gtk1/utilsres.cpp +++ b/src/gtk1/utilsres.cpp @@ -15,13 +15,14 @@ #include "wx/utils.h" #include "wx/string.h" #include "wx/list.h" +#include "wx/log.h" #include #include #include -#ifdef __SVR4__ -#include -#endif +//#ifdef __SVR4__ +//#include +//#endif #include "gdk/gdkx.h" // GDK_DISPLAY #include "gdk/gdkprivate.h" // gdk_progclass @@ -30,7 +31,6 @@ #include #include -#include "wx/log.h" //----------------------------------------------------------------------------- // constants diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 2f86fc9602..8262d26b9d 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -215,6 +215,134 @@ extern bool g_isIdle; //----------------------------------------------------------------------------- #if (GTK_MINOR_VERSION == 0) +/* these functions are copied verbatim from GTK 1.2 */ +static void +gdkx_XConvertCase (KeySym symbol, + KeySym *lower, + KeySym *upper) +{ + register KeySym sym = symbol; + + g_return_if_fail (lower != NULL); + g_return_if_fail (upper != NULL); + + *lower = sym; + *upper = sym; + + switch (sym >> 8) + { +#if defined (GDK_A) && defined (GDK_Ooblique) + case 0: /* Latin 1 */ + if ((sym >= GDK_A) && (sym <= GDK_Z)) + *lower += (GDK_a - GDK_A); + else if ((sym >= GDK_a) && (sym <= GDK_z)) + *upper -= (GDK_a - GDK_A); + else if ((sym >= GDK_Agrave) && (sym <= GDK_Odiaeresis)) + *lower += (GDK_agrave - GDK_Agrave); + else if ((sym >= GDK_agrave) && (sym <= GDK_odiaeresis)) + *upper -= (GDK_agrave - GDK_Agrave); + else if ((sym >= GDK_Ooblique) && (sym <= GDK_Thorn)) + *lower += (GDK_oslash - GDK_Ooblique); + else if ((sym >= GDK_oslash) && (sym <= GDK_thorn)) + *upper -= (GDK_oslash - GDK_Ooblique); + break; +#endif /* LATIN1 */ + +#if defined (GDK_Aogonek) && defined (GDK_tcedilla) + case 1: /* Latin 2 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym == GDK_Aogonek) + *lower = GDK_aogonek; + else if (sym >= GDK_Lstroke && sym <= GDK_Sacute) + *lower += (GDK_lstroke - GDK_Lstroke); + else if (sym >= GDK_Scaron && sym <= GDK_Zacute) + *lower += (GDK_scaron - GDK_Scaron); + else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot) + *lower += (GDK_zcaron - GDK_Zcaron); + else if (sym == GDK_aogonek) + *upper = GDK_Aogonek; + else if (sym >= GDK_lstroke && sym <= GDK_sacute) + *upper -= (GDK_lstroke - GDK_Lstroke); + else if (sym >= GDK_scaron && sym <= GDK_zacute) + *upper -= (GDK_scaron - GDK_Scaron); + else if (sym >= GDK_zcaron && sym <= GDK_zabovedot) + *upper -= (GDK_zcaron - GDK_Zcaron); + else if (sym >= GDK_Racute && sym <= GDK_Tcedilla) + *lower += (GDK_racute - GDK_Racute); + else if (sym >= GDK_racute && sym <= GDK_tcedilla) + *upper -= (GDK_racute - GDK_Racute); + break; +#endif /* LATIN2 */ + +#if defined (GDK_Hstroke) && defined (GDK_Cabovedot) + case 2: /* Latin 3 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex) + *lower += (GDK_hstroke - GDK_Hstroke); + else if (sym >= GDK_Gbreve && sym <= GDK_Jcircumflex) + *lower += (GDK_gbreve - GDK_Gbreve); + else if (sym >= GDK_hstroke && sym <= GDK_hcircumflex) + *upper -= (GDK_hstroke - GDK_Hstroke); + else if (sym >= GDK_gbreve && sym <= GDK_jcircumflex) + *upper -= (GDK_gbreve - GDK_Gbreve); + else if (sym >= GDK_Cabovedot && sym <= GDK_Scircumflex) + *lower += (GDK_cabovedot - GDK_Cabovedot); + else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex) + *upper -= (GDK_cabovedot - GDK_Cabovedot); + break; +#endif /* LATIN3 */ + +#if defined (GDK_Rcedilla) && defined (GDK_Amacron) + case 3: /* Latin 4 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= GDK_Rcedilla && sym <= GDK_Tslash) + *lower += (GDK_rcedilla - GDK_Rcedilla); + else if (sym >= GDK_rcedilla && sym <= GDK_tslash) + *upper -= (GDK_rcedilla - GDK_Rcedilla); + else if (sym == GDK_ENG) + *lower = GDK_eng; + else if (sym == GDK_eng) + *upper = GDK_ENG; + else if (sym >= GDK_Amacron && sym <= GDK_Umacron) + *lower += (GDK_amacron - GDK_Amacron); + else if (sym >= GDK_amacron && sym <= GDK_umacron) + *upper -= (GDK_amacron - GDK_Amacron); + break; +#endif /* LATIN4 */ + +#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu) + case 6: /* Cyrillic */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE) + *lower -= (GDK_Serbian_DJE - GDK_Serbian_dje); + else if (sym >= GDK_Serbian_dje && sym <= GDK_Serbian_dze) + *upper += (GDK_Serbian_DJE - GDK_Serbian_dje); + else if (sym >= GDK_Cyrillic_YU && sym <= GDK_Cyrillic_HARDSIGN) + *lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu); + else if (sym >= GDK_Cyrillic_yu && sym <= GDK_Cyrillic_hardsign) + *upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu); + break; +#endif /* CYRILLIC */ + +#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma) + case 7: /* Greek */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent) + *lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); + else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent && + sym != GDK_Greek_iotaaccentdieresis && + sym != GDK_Greek_upsilonaccentdieresis) + *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent); + else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA) + *lower += (GDK_Greek_alpha - GDK_Greek_ALPHA); + else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega && + sym != GDK_Greek_finalsmallsigma) + *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA); + break; +#endif /* GREEK */ + } +} + static guint gdk_keyval_to_upper (guint keyval) { @@ -223,7 +351,7 @@ gdk_keyval_to_upper (guint keyval) KeySym lower_val = 0; KeySym upper_val = 0; - XConvertCase (keyval, &lower_val, &upper_val); + gdkx_XConvertCase (keyval, &lower_val, &upper_val); return upper_val; } return 0; @@ -2384,7 +2512,7 @@ bool wxWindow::AcceptsFocus() const bool wxWindow::Reparent( wxWindow *newParent ) { - wxCHECK_MSG( (m_widget != NULL), (wxWindow*) NULL, _T("invalid window") ); + wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") ); wxWindow *oldParent = m_parent; -- 2.45.2