Added more uniode compile fixes.
Made prologio and resources optional. Added native GTK 2.0 size grip to status bar. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -555,8 +555,8 @@ else
|
|||||||
DEFAULT_wxUSE_DOC_VIEW_ARCHITECTURE=yes
|
DEFAULT_wxUSE_DOC_VIEW_ARCHITECTURE=yes
|
||||||
DEFAULT_wxUSE_PRINTING_ARCHITECTURE=yes
|
DEFAULT_wxUSE_PRINTING_ARCHITECTURE=yes
|
||||||
|
|
||||||
DEFAULT_wxUSE_PROLOGIO=yes
|
DEFAULT_wxUSE_PROLOGIO=no
|
||||||
DEFAULT_wxUSE_RESOURCES=yes
|
DEFAULT_wxUSE_RESOURCES=no
|
||||||
DEFAULT_wxUSE_CONSTRAINTS=yes
|
DEFAULT_wxUSE_CONSTRAINTS=yes
|
||||||
DEFAULT_wxUSE_IPC=yes
|
DEFAULT_wxUSE_IPC=yes
|
||||||
DEFAULT_wxUSE_HELP=yes
|
DEFAULT_wxUSE_HELP=yes
|
||||||
|
@@ -93,6 +93,9 @@ public:
|
|||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
|
void OnLeftDown(wxMouseEvent& event);
|
||||||
|
void OnRightDown(wxMouseEvent& event);
|
||||||
|
|
||||||
virtual void InitColours();
|
virtual void InitColours();
|
||||||
|
|
||||||
|
@@ -846,7 +846,7 @@
|
|||||||
#define wxUSE_RESOURCE_LOADING_IN_MSW 1
|
#define wxUSE_RESOURCE_LOADING_IN_MSW 1
|
||||||
// Use dynamic icon/cursor loading/saving code
|
// Use dynamic icon/cursor loading/saving code
|
||||||
// under MSW.
|
// under MSW.
|
||||||
#define wxUSE_WX_RESOURCES 1
|
#define wxUSE_WX_RESOURCES 0
|
||||||
// Use .wxr resource mechanism (requires PrologIO library)
|
// Use .wxr resource mechanism (requires PrologIO library)
|
||||||
|
|
||||||
#define wxUSE_MOUSEWHEEL 1
|
#define wxUSE_MOUSEWHEEL 1
|
||||||
|
@@ -364,7 +364,8 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
|
|||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
wxColour *col = new wxColour( colour );
|
wxColour *col = new wxColour( colour );
|
||||||
|
|
||||||
if (!(col->Ok())) {
|
if (!(col->Ok()))
|
||||||
|
{
|
||||||
delete col;
|
delete col;
|
||||||
return (wxColour *) NULL;
|
return (wxColour *) NULL;
|
||||||
}
|
}
|
||||||
@@ -382,7 +383,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
|
|||||||
Display* display = (Display*) wxGetDisplay();
|
Display* display = (Display*) wxGetDisplay();
|
||||||
#endif
|
#endif
|
||||||
/* MATTHEW: [4] Use wxGetMainColormap */
|
/* MATTHEW: [4] Use wxGetMainColormap */
|
||||||
if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour,&xcolour))
|
if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour.ToAscii() ,&xcolour))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#if wxUSE_NANOX
|
#if wxUSE_NANOX
|
||||||
|
@@ -59,7 +59,7 @@ wxPrintPaperType::wxPrintPaperType()
|
|||||||
{
|
{
|
||||||
m_paperId = wxPAPER_NONE;
|
m_paperId = wxPAPER_NONE;
|
||||||
m_platformId = 0;
|
m_platformId = 0;
|
||||||
m_paperName = "";
|
m_paperName = wxT("");
|
||||||
m_width = 0;
|
m_width = 0;
|
||||||
m_height = 0;
|
m_height = 0;
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,11 @@
|
|||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
#include "wx/gtk/private.h"
|
||||||
|
#include "wx/gtk/win_gtk.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
|
|
||||||
// we only have to do it here when we use wxStatusBarGeneric in addition to the
|
// we only have to do it here when we use wxStatusBarGeneric in addition to the
|
||||||
@@ -45,7 +50,8 @@
|
|||||||
BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow)
|
BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow)
|
||||||
EVT_PAINT(wxStatusBarGeneric::OnPaint)
|
EVT_PAINT(wxStatusBarGeneric::OnPaint)
|
||||||
EVT_SIZE(wxStatusBarGeneric::OnSize)
|
EVT_SIZE(wxStatusBarGeneric::OnSize)
|
||||||
|
EVT_LEFT_DOWN(wxStatusBarGeneric::OnLeftDown)
|
||||||
|
EVT_RIGHT_DOWN(wxStatusBarGeneric::OnRightDown)
|
||||||
EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged)
|
EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@@ -168,28 +174,41 @@ void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[])
|
|||||||
|
|
||||||
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
// Draw grip first
|
||||||
|
if (HasFlag( wxST_SIZEGRIP ))
|
||||||
|
{
|
||||||
|
int width, height;
|
||||||
|
GetClientSize(&width, &height);
|
||||||
|
|
||||||
|
gtk_paint_resize_grip( m_widget->style,
|
||||||
|
GTK_PIZZA(m_wxwindow)->bin_window,
|
||||||
|
(GtkStateType) GTK_WIDGET_STATE (m_widget),
|
||||||
|
NULL,
|
||||||
|
m_widget,
|
||||||
|
"statusbar",
|
||||||
|
GDK_WINDOW_EDGE_SOUTH_EAST,
|
||||||
|
width-height-2, 1, height-2, height-3 );
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int i;
|
if (GetFont().Ok())
|
||||||
if ( GetFont().Ok() )
|
dc.SetFont(GetFont());
|
||||||
dc.SetFont(GetFont());
|
|
||||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||||
|
|
||||||
#ifdef __WXPM__
|
#ifdef __WXPM__
|
||||||
wxColour vColor;
|
wxColour vColor;
|
||||||
|
|
||||||
vColor = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR);
|
vColor = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR);
|
||||||
::WinFillRect(dc.m_hPS, &dc.m_vRclPaint, vColor.GetPixel());
|
::WinFillRect(dc.m_hPS, &dc.m_vRclPaint, vColor.GetPixel());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for ( i = 0; i < m_nFields; i ++ )
|
for (int i = 0; i < m_nFields; i ++)
|
||||||
DrawField(dc, i);
|
DrawField(dc, i);
|
||||||
|
|
||||||
// VZ: again, what is this for?
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
dc.SetFont(wxNullFont);
|
|
||||||
#endif // MSW
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
|
void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
|
||||||
@@ -222,8 +241,8 @@ void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
|
|||||||
|
|
||||||
void wxStatusBarGeneric::DrawField(wxDC& dc, int i)
|
void wxStatusBarGeneric::DrawField(wxDC& dc, int i)
|
||||||
{
|
{
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
GetFieldRect(i, rect);
|
GetFieldRect(i, rect);
|
||||||
|
|
||||||
// Draw border
|
// Draw border
|
||||||
// Have grey background, plus 3-d border -
|
// Have grey background, plus 3-d border -
|
||||||
@@ -351,7 +370,7 @@ void wxStatusBarGeneric::SetMinHeight(int height)
|
|||||||
// current font
|
// current font
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
wxCoord y;
|
wxCoord y;
|
||||||
dc.GetTextExtent( _T("X"), NULL, &y );
|
dc.GetTextExtent( wxT("X"), NULL, &y );
|
||||||
|
|
||||||
if ( height > (11*y)/10 )
|
if ( height > (11*y)/10 )
|
||||||
{
|
{
|
||||||
@@ -367,5 +386,74 @@ void wxStatusBarGeneric::OnSize(wxSizeEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
int width, height;
|
||||||
|
GetClientSize(&width, &height);
|
||||||
|
|
||||||
|
if (HasFlag( wxST_SIZEGRIP ) && (event.GetX() > width-height))
|
||||||
|
{
|
||||||
|
GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget );
|
||||||
|
|
||||||
|
if (!GTK_IS_WINDOW (ancestor))
|
||||||
|
return;
|
||||||
|
|
||||||
|
GdkWindow *source = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||||
|
|
||||||
|
int org_x = 0;
|
||||||
|
int org_y = 0;
|
||||||
|
gdk_window_get_origin( source, &org_x, &org_y );
|
||||||
|
|
||||||
|
gtk_window_begin_resize_drag (GTK_WINDOW (ancestor),
|
||||||
|
GDK_WINDOW_EDGE_SOUTH_EAST,
|
||||||
|
1,
|
||||||
|
org_x + event.GetX(),
|
||||||
|
org_y + event.GetY(),
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event.Skip( TRUE );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
event.Skip( TRUE );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
int width, height;
|
||||||
|
GetClientSize(&width, &height);
|
||||||
|
|
||||||
|
if (HasFlag( wxST_SIZEGRIP ) && (event.GetX() > width-height))
|
||||||
|
{
|
||||||
|
GtkWidget *ancestor = gtk_widget_get_toplevel( m_widget );
|
||||||
|
|
||||||
|
if (!GTK_IS_WINDOW (ancestor))
|
||||||
|
return;
|
||||||
|
|
||||||
|
GdkWindow *source = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||||
|
|
||||||
|
int org_x = 0;
|
||||||
|
int org_y = 0;
|
||||||
|
gdk_window_get_origin( source, &org_x, &org_y );
|
||||||
|
|
||||||
|
gtk_window_begin_move_drag (GTK_WINDOW (ancestor),
|
||||||
|
2,
|
||||||
|
org_x + event.GetX(),
|
||||||
|
org_y + event.GetY(),
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event.Skip( TRUE );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
event.Skip( TRUE );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
|
1236
src/motif/utils.cpp
1236
src/motif/utils.cpp
File diff suppressed because it is too large
Load Diff
@@ -157,7 +157,7 @@ private:
|
|||||||
bool GetOrCreateTheme()
|
bool GetOrCreateTheme()
|
||||||
{
|
{
|
||||||
if ( !m_win32Theme )
|
if ( !m_win32Theme )
|
||||||
m_win32Theme = wxTheme::Create("win32");
|
m_win32Theme = wxTheme::Create( wxT("win32") );
|
||||||
return m_win32Theme != NULL;
|
return m_win32Theme != NULL;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
@@ -52,7 +52,7 @@ wxSourceUndoStep::wxSourceUndoStep( wxSourceUndo type, int y1, int y2, wxTextCtr
|
|||||||
for (int i = m_y1; i < m_y2+2; i++)
|
for (int i = m_y1; i < m_y2+2; i++)
|
||||||
{
|
{
|
||||||
if (i >= (int)m_owner->m_lines.GetCount())
|
if (i >= (int)m_owner->m_lines.GetCount())
|
||||||
m_lines.Add( "" );
|
m_lines.Add( wxT("") );
|
||||||
else
|
else
|
||||||
m_lines.Add( m_owner->m_lines[i].m_text );
|
m_lines.Add( m_owner->m_lines[i].m_text );
|
||||||
}
|
}
|
||||||
@@ -469,184 +469,6 @@ void wxTextCtrl::SetLanguage( wxSourceLanguage lang )
|
|||||||
m_lang = lang;
|
m_lang = lang;
|
||||||
|
|
||||||
m_keywords.Clear();
|
m_keywords.Clear();
|
||||||
|
|
||||||
if (m_lang == wxSOURCE_LANG_PYTHON)
|
|
||||||
{
|
|
||||||
m_keywords.Add( "class" );
|
|
||||||
m_keywords.Add( "__init__" );
|
|
||||||
m_keywords.Add( "return" );
|
|
||||||
m_keywords.Add( "def" );
|
|
||||||
m_keywords.Add( "try" );
|
|
||||||
m_keywords.Add( "except" );
|
|
||||||
m_keywords.Add( "if" );
|
|
||||||
m_keywords.Add( "else" );
|
|
||||||
m_keywords.Add( "finally" );
|
|
||||||
m_keywords.Add( "for" );
|
|
||||||
m_keywords.Add( "if" );
|
|
||||||
m_keywords.Add( "elif" );
|
|
||||||
m_keywords.Add( "in" );
|
|
||||||
m_keywords.Add( "and" );
|
|
||||||
m_keywords.Add( "del" );
|
|
||||||
m_keywords.Add( "is" );
|
|
||||||
m_keywords.Add( "raise" );
|
|
||||||
m_keywords.Add( "assert" );
|
|
||||||
m_keywords.Add( "lambda" );
|
|
||||||
m_keywords.Add( "break" );
|
|
||||||
m_keywords.Add( "global" );
|
|
||||||
m_keywords.Add( "not" );
|
|
||||||
m_keywords.Add( "or" );
|
|
||||||
m_keywords.Add( "while" );
|
|
||||||
m_keywords.Add( "continue" );
|
|
||||||
m_keywords.Add( "exec" );
|
|
||||||
m_keywords.Add( "pass" );
|
|
||||||
m_keywords.Add( "print" );
|
|
||||||
} else
|
|
||||||
if (m_lang == wxSOURCE_LANG_PERL)
|
|
||||||
{
|
|
||||||
m_keywords.Add( "main" );
|
|
||||||
m_keywords.Add( "sub" );
|
|
||||||
m_keywords.Add( "shift" );
|
|
||||||
m_keywords.Add( "push" );
|
|
||||||
m_keywords.Add( "split" );
|
|
||||||
m_keywords.Add( "join" );
|
|
||||||
m_keywords.Add( "chop" );
|
|
||||||
m_keywords.Add( "grep" );
|
|
||||||
m_keywords.Add( "open" );
|
|
||||||
m_keywords.Add( "print" );
|
|
||||||
m_keywords.Add( "sprint" );
|
|
||||||
m_keywords.Add( "printf" );
|
|
||||||
m_keywords.Add( "sprintf" );
|
|
||||||
m_keywords.Add( "my" );
|
|
||||||
m_keywords.Add( "local" );
|
|
||||||
m_keywords.Add( "exit" );
|
|
||||||
m_keywords.Add( "die" );
|
|
||||||
m_keywords.Add( "return" );
|
|
||||||
m_keywords.Add( "for" );
|
|
||||||
m_keywords.Add( "foreach" );
|
|
||||||
m_keywords.Add( "while" );
|
|
||||||
m_keywords.Add( "unless" );
|
|
||||||
m_keywords.Add( "if" );
|
|
||||||
m_keywords.Add( "next" );
|
|
||||||
m_keywords.Add( "last" );
|
|
||||||
m_keywords.Add( "else" );
|
|
||||||
m_keywords.Add( "elsif" );
|
|
||||||
m_keywords.Add( "ne" );
|
|
||||||
m_keywords.Add( "qe" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (m_lang == wxSOURCE_LANG_CPP)
|
|
||||||
{
|
|
||||||
m_keywords.Add( "class" );
|
|
||||||
m_keywords.Add( "return" );
|
|
||||||
m_keywords.Add( "if" );
|
|
||||||
m_keywords.Add( "then" );
|
|
||||||
m_keywords.Add( "else" );
|
|
||||||
m_keywords.Add( "struct" );
|
|
||||||
m_keywords.Add( "enum" );
|
|
||||||
m_keywords.Add( "while" );
|
|
||||||
m_keywords.Add( "do" );
|
|
||||||
m_keywords.Add( "for" );
|
|
||||||
m_keywords.Add( "continue" );
|
|
||||||
m_keywords.Add( "break" );
|
|
||||||
m_keywords.Add( "switch" );
|
|
||||||
m_keywords.Add( "case" );
|
|
||||||
m_keywords.Add( "goto" );
|
|
||||||
m_keywords.Add( "label" );
|
|
||||||
m_keywords.Add( "inline" );
|
|
||||||
m_keywords.Add( "operator" );
|
|
||||||
m_keywords.Add( "virtual" );
|
|
||||||
m_keywords.Add( "private" );
|
|
||||||
m_keywords.Add( "public" );
|
|
||||||
m_keywords.Add( "protected" );
|
|
||||||
m_keywords.Add( "friend" );
|
|
||||||
m_keywords.Add( "exception" );
|
|
||||||
m_keywords.Add( "throw" );
|
|
||||||
m_keywords.Add( "catch" );
|
|
||||||
m_keywords.Add( "delete" );
|
|
||||||
m_keywords.Add( "new" );
|
|
||||||
m_keywords.Add( "default" );
|
|
||||||
m_keywords.Add( "overload" );
|
|
||||||
m_keywords.Add( "using" );
|
|
||||||
m_keywords.Add( "template" );
|
|
||||||
m_keywords.Add( "try" );
|
|
||||||
m_keywords.Add( "typedef" );
|
|
||||||
m_keywords.Add( "union" );
|
|
||||||
m_keywords.Add( "volatile" );
|
|
||||||
m_keywords.Add( "asm" );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_defines.Clear();
|
|
||||||
|
|
||||||
if (m_lang == wxSOURCE_LANG_PYTHON)
|
|
||||||
{
|
|
||||||
m_defines.Add( "from" );
|
|
||||||
m_defines.Add( "import" );
|
|
||||||
} else
|
|
||||||
if (m_lang == wxSOURCE_LANG_PERL)
|
|
||||||
{
|
|
||||||
m_defines.Add( "use" );
|
|
||||||
m_defines.Add( "do" );
|
|
||||||
m_defines.Add( "package" );
|
|
||||||
m_defines.Add( "defined" );
|
|
||||||
} else
|
|
||||||
if (m_lang == wxSOURCE_LANG_CPP)
|
|
||||||
{
|
|
||||||
m_defines.Add( "#define" );
|
|
||||||
m_defines.Add( "#if" );
|
|
||||||
m_defines.Add( "#ifndef" );
|
|
||||||
m_defines.Add( "#ifdef" );
|
|
||||||
m_defines.Add( "#else" );
|
|
||||||
m_defines.Add( "#elif" );
|
|
||||||
m_defines.Add( "#endif" );
|
|
||||||
m_defines.Add( "#pragma" );
|
|
||||||
m_defines.Add( "#include" );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_variables.Clear();
|
|
||||||
|
|
||||||
if (m_lang == wxSOURCE_LANG_PYTHON)
|
|
||||||
{
|
|
||||||
m_variables.Add( "nil" );
|
|
||||||
m_variables.Add( "None" );
|
|
||||||
m_variables.Add( "self" );
|
|
||||||
m_variables.Add( "false" );
|
|
||||||
m_variables.Add( "true" );
|
|
||||||
} else
|
|
||||||
if (m_lang == wxSOURCE_LANG_PERL)
|
|
||||||
{
|
|
||||||
m_variables.Add( "undef" );
|
|
||||||
m_variables.Add( "class" );
|
|
||||||
m_variables.Add( "this" );
|
|
||||||
m_variables.Add( "IN" );
|
|
||||||
m_variables.Add( "OUT" );
|
|
||||||
m_variables.Add( "STDIN" );
|
|
||||||
m_variables.Add( "STDOUT" );
|
|
||||||
m_variables.Add( "STDERR" );
|
|
||||||
} else
|
|
||||||
if (m_lang == wxSOURCE_LANG_CPP)
|
|
||||||
{
|
|
||||||
m_variables.Add( "int" );
|
|
||||||
m_variables.Add( "bool" );
|
|
||||||
m_variables.Add( "void" );
|
|
||||||
m_variables.Add( "long" );
|
|
||||||
m_variables.Add( "short" );
|
|
||||||
m_variables.Add( "const" );
|
|
||||||
m_variables.Add( "signed" );
|
|
||||||
m_variables.Add( "unsigned" );
|
|
||||||
m_variables.Add( "char" );
|
|
||||||
m_variables.Add( "size_t" );
|
|
||||||
m_variables.Add( "wchar_t" );
|
|
||||||
m_variables.Add( "NULL" );
|
|
||||||
m_variables.Add( "this" );
|
|
||||||
m_variables.Add( "TRUE" );
|
|
||||||
m_variables.Add( "FALSE" );
|
|
||||||
m_variables.Add( "float" );
|
|
||||||
m_variables.Add( "double" );
|
|
||||||
m_variables.Add( "register" );
|
|
||||||
m_variables.Add( "extern" );
|
|
||||||
m_variables.Add( "static" );
|
|
||||||
m_variables.Add( "sizeof" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::WriteText(const wxString& text2)
|
void wxTextCtrl::WriteText(const wxString& text2)
|
||||||
@@ -862,12 +684,12 @@ void wxTextCtrl::Copy()
|
|||||||
{
|
{
|
||||||
tmp.Remove( 0, selStartX );
|
tmp.Remove( 0, selStartX );
|
||||||
sel = tmp;
|
sel = tmp;
|
||||||
sel.Append( "\n" );
|
sel.Append( wxT("\n") );
|
||||||
}
|
}
|
||||||
for (int i = selStartY+1; i < selEndY; i++)
|
for (int i = selStartY+1; i < selEndY; i++)
|
||||||
{
|
{
|
||||||
sel.Append( m_lines[i].m_text );
|
sel.Append( m_lines[i].m_text );
|
||||||
sel.Append( "\n" );
|
sel.Append( wxT("\n") );
|
||||||
}
|
}
|
||||||
tmp = m_lines[selEndY].m_text;
|
tmp = m_lines[selEndY].m_text;
|
||||||
if (selEndX > (int)tmp.Len())
|
if (selEndX > (int)tmp.Len())
|
||||||
@@ -2169,7 +1991,7 @@ void wxTextCtrl::Indent()
|
|||||||
|
|
||||||
for (int i = startY; i <= endY; i++)
|
for (int i = startY; i <= endY; i++)
|
||||||
{
|
{
|
||||||
m_lines[i].m_text.insert( 0u, " " );
|
m_lines[i].m_text.insert( 0u, wxT(" ") );
|
||||||
RefreshLine( i );
|
RefreshLine( i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2196,7 +2018,7 @@ void wxTextCtrl::Unindent()
|
|||||||
{
|
{
|
||||||
for (int n = 0; n < 4; n++)
|
for (int n = 0; n < 4; n++)
|
||||||
{
|
{
|
||||||
if (m_lines[i].m_text[0u] == ' ')
|
if (m_lines[i].m_text[0u] == wxT(' '))
|
||||||
m_lines[i].m_text.erase(0u,1u);
|
m_lines[i].m_text.erase(0u,1u);
|
||||||
}
|
}
|
||||||
RefreshLine( i );
|
RefreshLine( i );
|
||||||
|
@@ -47,18 +47,7 @@
|
|||||||
|
|
||||||
#include "wx/unix/execute.h"
|
#include "wx/unix/execute.h"
|
||||||
|
|
||||||
#ifdef __WXMOTIF__
|
|
||||||
#include <Xm/Xm.h>
|
|
||||||
#include "wx/motif/private.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __WXX11__
|
|
||||||
#include "wx/x11/private.h"
|
#include "wx/x11/private.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_RESOURCES
|
|
||||||
#include "X11/Xresource.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "X11/Xutil.h"
|
#include "X11/Xutil.h"
|
||||||
|
|
||||||
@@ -66,24 +55,6 @@
|
|||||||
#pragma message enable nosimpint
|
#pragma message enable nosimpint
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// private functions
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Yuck this is really BOTH site and platform dependent
|
|
||||||
// so we should use some other strategy!
|
|
||||||
#ifdef sun
|
|
||||||
#define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults"
|
|
||||||
#else
|
|
||||||
#define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char *GetIniFile (char *dest, const char *filename);
|
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// implementation
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// async event processing
|
// async event processing
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -112,8 +83,6 @@ void wxFlushEvents()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether this window wants to process messages, e.g. Stop button
|
|
||||||
// in long calculations.
|
|
||||||
bool wxCheckForInterrupt(wxWindow *wnd)
|
bool wxCheckForInterrupt(wxWindow *wnd)
|
||||||
{
|
{
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
@@ -152,20 +121,6 @@ bool wxCheckForInterrupt(wxWindow *wnd)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxExecute stuff
|
// wxExecute stuff
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
#ifdef __WXMOTIF__
|
|
||||||
static void xt_notify_end_process(XtPointer data, int *WXUNUSED(fid),
|
|
||||||
XtInputId *id)
|
|
||||||
{
|
|
||||||
wxEndProcessData *proc_data = (wxEndProcessData *)data;
|
|
||||||
|
|
||||||
wxHandleProcessTermination(proc_data);
|
|
||||||
|
|
||||||
// VZ: I think they should be the same...
|
|
||||||
wxASSERT( (int)*id == proc_data->tag );
|
|
||||||
|
|
||||||
XtRemoveInput(*id);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
|
int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
|
||||||
{
|
{
|
||||||
@@ -197,371 +152,17 @@ void wxBell()
|
|||||||
|
|
||||||
int wxGetOsVersion(int *majorVsn, int *minorVsn)
|
int wxGetOsVersion(int *majorVsn, int *minorVsn)
|
||||||
{
|
{
|
||||||
#ifdef __WXMOTIF__
|
|
||||||
// FIXME TODO
|
|
||||||
// This code is WRONG!! Does NOT return the
|
|
||||||
// Motif version of the libs but the X protocol
|
|
||||||
// version!
|
|
||||||
Display *display = XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
|
|
||||||
if (majorVsn)
|
|
||||||
*majorVsn = ProtocolVersion (display);
|
|
||||||
if (minorVsn)
|
|
||||||
*minorVsn = ProtocolRevision (display);
|
|
||||||
|
|
||||||
return wxMOTIF_X;
|
|
||||||
#endif
|
|
||||||
#ifdef __WXX11__
|
#ifdef __WXX11__
|
||||||
if (majorVsn)
|
if (majorVsn)
|
||||||
*majorVsn = 0;
|
*majorVsn = 0;
|
||||||
|
|
||||||
if (minorVsn)
|
if (minorVsn)
|
||||||
*minorVsn = 0;
|
*minorVsn = 0;
|
||||||
|
|
||||||
return wxX11;
|
return wxX11;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Read $HOME for what it says is home, if not
|
|
||||||
// read $USER or $LOGNAME for user name else determine
|
|
||||||
// the Real User, then determine the Real home dir.
|
|
||||||
static char * GetIniFile (char *dest, const char *filename)
|
|
||||||
{
|
|
||||||
char *home = NULL;
|
|
||||||
if (filename && wxIsAbsolutePath(filename))
|
|
||||||
{
|
|
||||||
strcpy(dest, filename);
|
|
||||||
}
|
|
||||||
else if ((home = wxGetUserHome("")) != NULL)
|
|
||||||
{
|
|
||||||
strcpy(dest, home);
|
|
||||||
if (dest[strlen(dest) - 1] != '/')
|
|
||||||
strcat (dest, "/");
|
|
||||||
if (filename == NULL)
|
|
||||||
{
|
|
||||||
if ((filename = getenv ("XENVIRONMENT")) == NULL)
|
|
||||||
filename = ".Xdefaults";
|
|
||||||
}
|
|
||||||
else if (*filename != '.')
|
|
||||||
strcat (dest, ".");
|
|
||||||
strcat (dest, filename);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
dest[0] = '\0';
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if wxUSE_RESOURCES
|
|
||||||
|
|
||||||
static char *GetResourcePath(char *buf, const char *name, bool create = FALSE)
|
|
||||||
{
|
|
||||||
if (create && wxFileExists (name) ) {
|
|
||||||
strcpy(buf, name);
|
|
||||||
return buf; // Exists so ...
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*name == '/')
|
|
||||||
strcpy(buf, name);
|
|
||||||
else {
|
|
||||||
// Put in standard place for resource files if not absolute
|
|
||||||
strcpy (buf, DEFAULT_XRESOURCE_DIR);
|
|
||||||
strcat (buf, "/");
|
|
||||||
strcat (buf, (const char*) wxFileNameFromPath (name));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (create) {
|
|
||||||
// Touch the file to create it
|
|
||||||
FILE *fd = fopen (buf, "w");
|
|
||||||
if (fd) fclose (fd);
|
|
||||||
}
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We have a cache for writing different resource files,
|
|
||||||
* which will only get flushed when we call wxFlushResources().
|
|
||||||
* Build up a list of resource databases waiting to be written.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
wxList wxResourceCache (wxKEY_STRING);
|
|
||||||
|
|
||||||
void
|
|
||||||
wxFlushResources (void)
|
|
||||||
{
|
|
||||||
char nameBuffer[512];
|
|
||||||
|
|
||||||
wxNode *node = wxResourceCache.First ();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
const char *file = node->GetKeyString();
|
|
||||||
// If file doesn't exist, create it first.
|
|
||||||
(void)GetResourcePath(nameBuffer, file, TRUE);
|
|
||||||
|
|
||||||
XrmDatabase database = (XrmDatabase) node->Data ();
|
|
||||||
XrmPutFileDatabase (database, nameBuffer);
|
|
||||||
XrmDestroyDatabase (database);
|
|
||||||
wxNode *next = node->Next ();
|
|
||||||
delete node;
|
|
||||||
node = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static XrmDatabase wxResourceDatabase = 0;
|
|
||||||
|
|
||||||
void wxXMergeDatabases (wxApp * theApp, Display * display);
|
|
||||||
|
|
||||||
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
|
|
||||||
{
|
|
||||||
char buffer[500];
|
|
||||||
|
|
||||||
(void) GetIniFile (buffer, file);
|
|
||||||
|
|
||||||
XrmDatabase database;
|
|
||||||
wxNode *node = wxResourceCache.Find (buffer);
|
|
||||||
if (node)
|
|
||||||
database = (XrmDatabase) node->Data ();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
database = XrmGetFileDatabase (buffer);
|
|
||||||
wxResourceCache.Append (buffer, (wxObject *) database);
|
|
||||||
}
|
|
||||||
|
|
||||||
char resName[300];
|
|
||||||
strcpy (resName, (const char*) section);
|
|
||||||
strcat (resName, ".");
|
|
||||||
strcat (resName, (const char*) entry);
|
|
||||||
|
|
||||||
XrmPutStringResource (&database, resName, value);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
|
|
||||||
{
|
|
||||||
char buf[50];
|
|
||||||
sprintf(buf, "%.4f", value);
|
|
||||||
return wxWriteResource(section, entry, buf, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
|
|
||||||
{
|
|
||||||
char buf[50];
|
|
||||||
sprintf(buf, "%ld", value);
|
|
||||||
return wxWriteResource(section, entry, buf, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
|
|
||||||
{
|
|
||||||
char buf[50];
|
|
||||||
sprintf(buf, "%d", value);
|
|
||||||
return wxWriteResource(section, entry, buf, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
|
|
||||||
{
|
|
||||||
if (!wxResourceDatabase)
|
|
||||||
{
|
|
||||||
Display *display = (Display*) wxGetDisplay();
|
|
||||||
wxXMergeDatabases (wxTheApp, display);
|
|
||||||
}
|
|
||||||
|
|
||||||
XrmDatabase database;
|
|
||||||
|
|
||||||
if (file != "")
|
|
||||||
{
|
|
||||||
char buffer[500];
|
|
||||||
|
|
||||||
// Is this right? Trying to get it to look in the user's
|
|
||||||
// home directory instead of current directory -- JACS
|
|
||||||
(void) GetIniFile (buffer, file);
|
|
||||||
|
|
||||||
wxNode *node = wxResourceCache.Find (buffer);
|
|
||||||
if (node)
|
|
||||||
database = (XrmDatabase) node->Data ();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
database = XrmGetFileDatabase (buffer);
|
|
||||||
wxResourceCache.Append (buffer, (wxObject *) database);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
database = wxResourceDatabase;
|
|
||||||
|
|
||||||
XrmValue xvalue;
|
|
||||||
char *str_type[20];
|
|
||||||
char buf[150];
|
|
||||||
strcpy (buf, section);
|
|
||||||
strcat (buf, ".");
|
|
||||||
strcat (buf, entry);
|
|
||||||
|
|
||||||
Bool success = XrmGetResource (database, buf, "*", str_type,
|
|
||||||
&xvalue);
|
|
||||||
// Try different combinations of upper/lower case, just in case...
|
|
||||||
if (!success)
|
|
||||||
{
|
|
||||||
buf[0] = (isupper (buf[0]) ? tolower (buf[0]) : toupper (buf[0]));
|
|
||||||
success = XrmGetResource (database, buf, "*", str_type,
|
|
||||||
&xvalue);
|
|
||||||
}
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
if (*value)
|
|
||||||
delete[] *value;
|
|
||||||
|
|
||||||
*value = new char[xvalue.size + 1];
|
|
||||||
strncpy (*value, xvalue.addr, (int) xvalue.size);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
|
|
||||||
{
|
|
||||||
char *s = NULL;
|
|
||||||
bool succ = wxGetResource(section, entry, (char **)&s, file);
|
|
||||||
if (succ)
|
|
||||||
{
|
|
||||||
*value = (float)strtod(s, NULL);
|
|
||||||
delete[] s;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
|
|
||||||
{
|
|
||||||
char *s = NULL;
|
|
||||||
bool succ = wxGetResource(section, entry, (char **)&s, file);
|
|
||||||
if (succ)
|
|
||||||
{
|
|
||||||
*value = strtol(s, NULL, 10);
|
|
||||||
delete[] s;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
|
|
||||||
{
|
|
||||||
char *s = NULL;
|
|
||||||
bool succ = wxGetResource(section, entry, (char **)&s, file);
|
|
||||||
if (succ)
|
|
||||||
{
|
|
||||||
// Handle True, False here
|
|
||||||
// True, Yes, Enables, Set or Activated
|
|
||||||
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
|
|
||||||
*value = TRUE;
|
|
||||||
// False, No, Disabled, Reset, Cleared, Deactivated
|
|
||||||
else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
|
|
||||||
*value = FALSE;
|
|
||||||
// Handle as Integer
|
|
||||||
else
|
|
||||||
*value = (int) strtol (s, NULL, 10);
|
|
||||||
delete[] s;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxXMergeDatabases (wxApp * theApp, Display * display)
|
|
||||||
{
|
|
||||||
XrmDatabase homeDB, serverDB, applicationDB;
|
|
||||||
char filenamebuf[1024];
|
|
||||||
|
|
||||||
char *filename = &filenamebuf[0];
|
|
||||||
char *environment;
|
|
||||||
wxString classname = theApp->GetClassName();
|
|
||||||
char name[256];
|
|
||||||
(void) strcpy (name, "/usr/lib/X11/app-defaults/");
|
|
||||||
(void) strcat (name, (const char*) classname);
|
|
||||||
|
|
||||||
/* Get application defaults file, if any */
|
|
||||||
applicationDB = XrmGetFileDatabase (name);
|
|
||||||
(void) XrmMergeDatabases (applicationDB, &wxResourceDatabase);
|
|
||||||
|
|
||||||
/* Merge server defaults, created by xrdb, loaded as a property of the root
|
|
||||||
* window when the server initializes and loaded into the display
|
|
||||||
* structure on XOpenDisplay;
|
|
||||||
* if not defined, use .Xdefaults
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (XResourceManagerString (display) != NULL)
|
|
||||||
{
|
|
||||||
serverDB = XrmGetStringDatabase (XResourceManagerString (display));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
(void) GetIniFile (filename, NULL);
|
|
||||||
serverDB = XrmGetFileDatabase (filename);
|
|
||||||
}
|
|
||||||
XrmMergeDatabases (serverDB, &wxResourceDatabase);
|
|
||||||
|
|
||||||
/* Open XENVIRONMENT file, or if not defined, the .Xdefaults,
|
|
||||||
* and merge into existing database
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ((environment = getenv ("XENVIRONMENT")) == NULL)
|
|
||||||
{
|
|
||||||
size_t len;
|
|
||||||
environment = GetIniFile (filename, NULL);
|
|
||||||
len = strlen (environment);
|
|
||||||
wxString hostname = wxGetHostName();
|
|
||||||
if ( !!hostname )
|
|
||||||
strncat(environment, hostname, 1024 - len);
|
|
||||||
}
|
|
||||||
homeDB = XrmGetFileDatabase (environment);
|
|
||||||
XrmMergeDatabases (homeDB, &wxResourceDatabase);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Not yet used but may be useful.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
wxSetDefaultResources (const Widget w, const char **resourceSpec, const char *name)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
Display *dpy = XtDisplay (w); // Retrieve the display pointer
|
|
||||||
|
|
||||||
XrmDatabase rdb = NULL; // A resource data base
|
|
||||||
|
|
||||||
// Create an empty resource database
|
|
||||||
rdb = XrmGetStringDatabase ("");
|
|
||||||
|
|
||||||
// Add the Component resources, prepending the name of the component
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (resourceSpec[i] != NULL)
|
|
||||||
{
|
|
||||||
char buf[1000];
|
|
||||||
|
|
||||||
sprintf (buf, "*%s%s", name, resourceSpec[i++]);
|
|
||||||
XrmPutLineResource (&rdb, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Merge them into the Xt database, with lowest precendence
|
|
||||||
|
|
||||||
if (rdb)
|
|
||||||
{
|
|
||||||
#if (XlibSpecificationRelease>=5)
|
|
||||||
XrmDatabase db = XtDatabase (dpy);
|
|
||||||
XrmCombineDatabase (rdb, &db, FALSE);
|
|
||||||
#else
|
|
||||||
XrmMergeDatabases (dpy->db, &rdb);
|
|
||||||
dpy->db = rdb;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// 0
|
|
||||||
|
|
||||||
#endif // wxUSE_RESOURCES
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// display info
|
// display info
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -665,30 +266,6 @@ bool wxSetDisplay(const wxString& display_name)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef __WXMOTIF__
|
|
||||||
Cardinal argc = 0;
|
|
||||||
|
|
||||||
Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(),
|
|
||||||
(const char*) display_name,
|
|
||||||
(const char*) wxTheApp->GetAppName(),
|
|
||||||
(const char*) wxTheApp->GetClassName(),
|
|
||||||
NULL,
|
|
||||||
#if XtSpecificationRelease < 5
|
|
||||||
0, &argc,
|
|
||||||
#else
|
|
||||||
0, (int *)&argc,
|
|
||||||
#endif
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (display)
|
|
||||||
{
|
|
||||||
gs_currentDisplay = (WXDisplay*) display;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
#ifdef __WXX11__
|
|
||||||
Display* display = XOpenDisplay((char*) display_name.c_str());
|
Display* display = XOpenDisplay((char*) display_name.c_str());
|
||||||
|
|
||||||
if (display)
|
if (display)
|
||||||
@@ -698,7 +275,6 @@ bool wxSetDisplay(const wxString& display_name)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1098,153 +674,6 @@ wxString wxGetXEventName(XEvent& event)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMOTIF__
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// accelerators
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Find the letter corresponding to the mnemonic, for Motif
|
|
||||||
char wxFindMnemonic (const char *s)
|
|
||||||
{
|
|
||||||
char mnem = 0;
|
|
||||||
int len = strlen (s);
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
{
|
|
||||||
if (s[i] == '&')
|
|
||||||
{
|
|
||||||
// Carefully handle &&
|
|
||||||
if ((i + 1) <= len && s[i + 1] == '&')
|
|
||||||
i++;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mnem = s[i + 1];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mnem;
|
|
||||||
}
|
|
||||||
|
|
||||||
char * wxFindAccelerator (const char *s)
|
|
||||||
{
|
|
||||||
// VZ: this function returns incorrect keysym which completely breaks kbd
|
|
||||||
// handling
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// The accelerator text is after the \t char.
|
|
||||||
while (*s && *s != '\t')
|
|
||||||
s++;
|
|
||||||
if (*s == '\0')
|
|
||||||
return (NULL);
|
|
||||||
s++;
|
|
||||||
/*
|
|
||||||
Now we need to format it as X standard:
|
|
||||||
|
|
||||||
input output
|
|
||||||
|
|
||||||
F7 --> <Key>F7
|
|
||||||
Ctrl+N --> Ctrl<Key>N
|
|
||||||
Alt+k --> Meta<Key>k
|
|
||||||
Ctrl+Shift+A --> Ctrl Shift<Key>A
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static char buf[256];
|
|
||||||
buf[0] = '\0';
|
|
||||||
char *tmp = copystring (s);
|
|
||||||
s = tmp;
|
|
||||||
char *p = tmp;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
while (*p && *p != '+')
|
|
||||||
p++;
|
|
||||||
if (*p)
|
|
||||||
{
|
|
||||||
*p = '\0';
|
|
||||||
if (buf[0])
|
|
||||||
strcat (buf, " ");
|
|
||||||
if (strcmp (s, "Alt"))
|
|
||||||
strcat (buf, s);
|
|
||||||
else
|
|
||||||
strcat (buf, "Meta");
|
|
||||||
s = p++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcat (buf, "<Key>");
|
|
||||||
strcat (buf, s);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[]tmp;
|
|
||||||
return buf;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
XmString wxFindAcceleratorText (const char *s)
|
|
||||||
{
|
|
||||||
// VZ: this function returns incorrect keysym which completely breaks kbd
|
|
||||||
// handling
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// The accelerator text is after the \t char.
|
|
||||||
while (*s && *s != '\t')
|
|
||||||
s++;
|
|
||||||
if (*s == '\0')
|
|
||||||
return (NULL);
|
|
||||||
s++;
|
|
||||||
XmString text = XmStringCreateSimple ((char *)s);
|
|
||||||
return text;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// These functions duplicate those in wxWindow, but are needed
|
|
||||||
// for use outside of wxWindow (e.g. wxMenu, wxMenuBar).
|
|
||||||
|
|
||||||
// Change a widget's foreground and background colours.
|
|
||||||
|
|
||||||
void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
|
|
||||||
{
|
|
||||||
// When should we specify the foreground, if it's calculated
|
|
||||||
// by wxComputeColours?
|
|
||||||
// Solution: say we start with the default (computed) foreground colour.
|
|
||||||
// If we call SetForegroundColour explicitly for a control or window,
|
|
||||||
// then the foreground is changed.
|
|
||||||
// Therefore SetBackgroundColour computes the foreground colour, and
|
|
||||||
// SetForegroundColour changes the foreground colour. The ordering is
|
|
||||||
// important.
|
|
||||||
|
|
||||||
XtVaSetValues ((Widget) widget,
|
|
||||||
XmNforeground, foregroundColour.AllocColour(XtDisplay((Widget) widget)),
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour)
|
|
||||||
{
|
|
||||||
wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
|
|
||||||
(wxColour*) NULL);
|
|
||||||
|
|
||||||
XtVaSetValues ((Widget) widget,
|
|
||||||
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
|
|
||||||
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
|
|
||||||
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
|
|
||||||
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (changeArmColour)
|
|
||||||
XtVaSetValues ((Widget) widget,
|
|
||||||
XmNarmColor, g_itemColors[wxSELE_INDEX].pixel,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// __WXMOTIF__
|
|
||||||
|
|
||||||
bool wxWindowIsVisible(Window win)
|
bool wxWindowIsVisible(Window win)
|
||||||
{
|
{
|
||||||
XWindowAttributes wa;
|
XWindowAttributes wa;
|
||||||
|
@@ -498,12 +498,11 @@ void wxWindowX11::DoCaptureMouse()
|
|||||||
if (res != GrabSuccess)
|
if (res != GrabSuccess)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf("Failed to grab pointer for window %s", this->GetClassInfo()->GetClassName());
|
msg.Printf(wxT("Failed to grab pointer for window %s"), this->GetClassInfo()->GetClassName());
|
||||||
wxLogDebug(msg);
|
wxLogDebug(msg);
|
||||||
if (res == GrabNotViewable)
|
if (res == GrabNotViewable)
|
||||||
{
|
wxLogDebug( wxT("This is not a viewable window - perhaps not shown yet?") );
|
||||||
wxLogDebug("This is not a viewable window - perhaps not shown yet?");
|
|
||||||
}
|
|
||||||
g_captureWindow = NULL;
|
g_captureWindow = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1242,8 +1241,9 @@ void wxWindowX11::OnInternalIdle()
|
|||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf("Setting focus for %s from OnInternalIdle\n", GetClassInfo()->GetClassName());
|
msg.Printf("Setting focus for %s from OnInternalIdle\n", GetClassInfo()->GetClassName());
|
||||||
printf(msg.c_str());
|
printf(msg.c_str());
|
||||||
#endif
|
#endif
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
||||||
// If it couldn't set the focus now, there's
|
// If it couldn't set the focus now, there's
|
||||||
// no point in trying again.
|
// no point in trying again.
|
||||||
m_needsInputFocus = FALSE;
|
m_needsInputFocus = FALSE;
|
||||||
@@ -1260,15 +1260,15 @@ bool wxAddWindowToTable(Window w, wxWindow *win)
|
|||||||
wxWindow *oldItem = NULL;
|
wxWindow *oldItem = NULL;
|
||||||
if ((oldItem = (wxWindow *)wxWidgetHashTable->Get ((long) w)))
|
if ((oldItem = (wxWindow *)wxWidgetHashTable->Get ((long) w)))
|
||||||
{
|
{
|
||||||
wxLogDebug("Widget table clash: new widget is %ld, %s",
|
wxLogDebug( wxT("Widget table clash: new widget is %ld, %s"),
|
||||||
(long)w, win->GetClassInfo()->GetClassName());
|
(long)w, win->GetClassInfo()->GetClassName());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWidgetHashTable->Put((long) w, win);
|
wxWidgetHashTable->Put((long) w, win);
|
||||||
|
|
||||||
wxLogTrace("widget", "XWindow 0x%08x <-> window %p (%s)",
|
wxLogTrace( wxT("widget"), wxT("XWindow 0x%08x <-> window %p (%s)"),
|
||||||
(unsigned int) w, win, win->GetClassInfo()->GetClassName());
|
(unsigned int) w, win, win->GetClassInfo()->GetClassName());
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1292,15 +1292,15 @@ bool wxAddClientWindowToTable(Window w, wxWindow *win)
|
|||||||
wxWindow *oldItem = NULL;
|
wxWindow *oldItem = NULL;
|
||||||
if ((oldItem = (wxWindow *)wxClientWidgetHashTable->Get ((long) w)))
|
if ((oldItem = (wxWindow *)wxClientWidgetHashTable->Get ((long) w)))
|
||||||
{
|
{
|
||||||
wxLogDebug("Client window table clash: new window is %ld, %s",
|
wxLogDebug( wxT("Client window table clash: new window is %ld, %s"),
|
||||||
(long)w, win->GetClassInfo()->GetClassName());
|
(long)w, win->GetClassInfo()->GetClassName());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClientWidgetHashTable->Put((long) w, win);
|
wxClientWidgetHashTable->Put((long) w, win);
|
||||||
|
|
||||||
wxLogTrace("widget", "XWindow 0x%08x <-> window %p (%s)",
|
wxLogTrace( wxT("widget"), wxT("XWindow 0x%08x <-> window %p (%s)"),
|
||||||
(unsigned int) w, win, win->GetClassInfo()->GetClassName());
|
(unsigned int) w, win, win->GetClassInfo()->GetClassName());
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1480,7 +1480,7 @@ bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win
|
|||||||
wxevent.m_altDown = XKeyEventAltIsDown(xevent);
|
wxevent.m_altDown = XKeyEventAltIsDown(xevent);
|
||||||
wxevent.m_metaDown = XKeyEventMetaIsDown(xevent);
|
wxevent.m_metaDown = XKeyEventMetaIsDown(xevent);
|
||||||
wxevent.SetEventObject(win);
|
wxevent.SetEventObject(win);
|
||||||
wxevent.m_keyCode = toupper(id);
|
wxevent.m_keyCode = wxToupper(id);
|
||||||
wxevent.SetTimestamp(XKeyEventGetTime(xevent));
|
wxevent.SetTimestamp(XKeyEventGetTime(xevent));
|
||||||
|
|
||||||
wxevent.m_x = XKeyEventGetX(xevent);
|
wxevent.m_x = XKeyEventGetX(xevent);
|
||||||
|
Reference in New Issue
Block a user