1. some patches from Janos Vegh to docview template detection
2. fixed reentrancy bug in wxGetTranslation/wxLogError resulting in infinite number of messageboxes 3. wxMenuItem::GetLabelFromText("&Foo") now returns "Foo", not "&Foo" in GTK as well 4. test for update region being NULL in wxPaintDC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6655 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -333,6 +333,10 @@ public:
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
// called when file format detection didn't work, can be overridden to do
|
||||
// something in this case
|
||||
virtual void OnOpenFileFailure() { wxFAIL_MSG(_T("file format mismatch")); }
|
||||
|
||||
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
|
||||
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
|
||||
virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
|
||||
|
@@ -298,6 +298,12 @@ protected:
|
||||
// empty everything
|
||||
void Clear();
|
||||
|
||||
// the translated titles for misc message boxes: only translate ones to
|
||||
// avoid reentrancy problems later
|
||||
wxString m_error,
|
||||
m_warning,
|
||||
m_info;
|
||||
|
||||
wxArrayString m_aMessages; // the log message texts
|
||||
wxArrayInt m_aSeverity; // one of wxLOG_XXX values
|
||||
wxArrayLong m_aTimes; // the time of each message
|
||||
|
@@ -806,7 +806,10 @@ void wxDocManager::OnFileNew(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void wxDocManager::OnFileOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
CreateDocument(wxString(""), 0);
|
||||
if ( !CreateDocument(wxString(""), 0) )
|
||||
{
|
||||
OnOpenFileFailure();
|
||||
}
|
||||
}
|
||||
|
||||
void wxDocManager::OnFileRevert(wxCommandEvent& WXUNUSED(event))
|
||||
|
@@ -79,7 +79,7 @@ typedef unsigned char size_t8;
|
||||
{
|
||||
// Asserting a sizeof directly causes some compilers to
|
||||
// issue a "using constant in a conditional expression" warning
|
||||
size_t intsize = sizeof(int);
|
||||
size_t intsize = sizeof(int);
|
||||
|
||||
wxASSERT_MSG( intsize == 4,
|
||||
"size_t32 is incorrectly defined!" );
|
||||
@@ -97,7 +97,7 @@ const size_t32 MSGCATALOG_MAGIC = 0x950412de;
|
||||
const size_t32 MSGCATALOG_MAGIC_SW = 0xde120495;
|
||||
|
||||
// extension of ".mo" files
|
||||
#define MSGCATALOG_EXTENSION ".mo"
|
||||
#define MSGCATALOG_EXTENSION _T(".mo")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global functions
|
||||
@@ -290,14 +290,20 @@ static wxString GetFullSearchPath(const wxChar *lang)
|
||||
<< wxPATH_SEP;
|
||||
}
|
||||
|
||||
// LC_PATH is a standard env var containing the search path for the .mo
|
||||
// files
|
||||
const wxChar *pszLcPath = wxGetenv("LC_PATH");
|
||||
if ( pszLcPath != NULL )
|
||||
searchPath << GetAllMsgCatalogSubdirs(pszLcPath, lang);
|
||||
|
||||
// then take the current directory
|
||||
// FIXME it should be the directory of the executable
|
||||
searchPath << GetAllMsgCatalogSubdirs(wxT("."), lang) << wxPATH_SEP;
|
||||
|
||||
// and finally add some standard ones
|
||||
searchPath
|
||||
<< GetAllMsgCatalogSubdirs(wxT("/usr/share/locale"), lang) << wxPATH_SEP
|
||||
<< GetAllMsgCatalogSubdirs(wxT("/usr/lib/locale"), lang) << wxPATH_SEP
|
||||
<< GetAllMsgCatalogSubdirs(wxT("/usr/share/locale"), lang)
|
||||
<< GetAllMsgCatalogSubdirs(wxT("/usr/lib/locale"), lang)
|
||||
<< GetAllMsgCatalogSubdirs(wxT("/usr/local/share/locale"), lang);
|
||||
|
||||
return searchPath;
|
||||
@@ -314,14 +320,6 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0, bool b
|
||||
if(szName.Find(wxT('.')) != -1) // contains a dot
|
||||
szName = szName.Left(szName.Find(wxT('.')));
|
||||
|
||||
// FIXME VZ: I forgot the exact meaning of LC_PATH - anyone to remind me?
|
||||
// KB: search path where to find the mo files, probably : delimited
|
||||
#if 0
|
||||
const wxChar *pszLcPath = wxGetenv("LC_PATH");
|
||||
if ( pszLcPath != NULL )
|
||||
strPath += pszLcPath + wxString(szDirPrefix) + MSG_PATH;
|
||||
#endif // 0
|
||||
|
||||
wxString searchPath = GetFullSearchPath(szDirPrefix);
|
||||
const wxChar *sublocale = wxStrchr(szDirPrefix, wxT('_'));
|
||||
if ( sublocale )
|
||||
@@ -343,7 +341,7 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0, bool b
|
||||
// (we're using an object because we have several return paths)
|
||||
|
||||
NoTransErr noTransErr;
|
||||
wxLogVerbose(wxT("looking for catalog '%s' in path '%s'."),
|
||||
wxLogVerbose(_("looking for catalog '%s' in path '%s'."),
|
||||
szName.c_str(), searchPath.c_str());
|
||||
|
||||
wxString strFullName;
|
||||
@@ -405,7 +403,8 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0, bool b
|
||||
m_pszName = new wxChar[wxStrlen(szName) + 1];
|
||||
wxStrcpy(m_pszName, szName);
|
||||
|
||||
if (bConvertEncoding) ConvertEncoding();
|
||||
if (bConvertEncoding)
|
||||
ConvertEncoding();
|
||||
|
||||
// everything is fine
|
||||
return TRUE;
|
||||
|
@@ -99,6 +99,9 @@ private:
|
||||
// the listctrl (not shown initially)
|
||||
wxListCtrl *m_listctrl;
|
||||
|
||||
// the translated "Details" string
|
||||
static wxString ms_details;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
@@ -170,12 +173,22 @@ void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
|
||||
|
||||
wxLogGui::wxLogGui()
|
||||
{
|
||||
// we must translate them here in the very beginning or we risk to have
|
||||
// reentrancy problems when called from inside wxGetTranslation() leading
|
||||
// to inifnite recursion
|
||||
m_error = _("Error");
|
||||
m_warning = _("Warning");
|
||||
m_info = _("Information");
|
||||
|
||||
Clear();
|
||||
}
|
||||
|
||||
void wxLogGui::Clear()
|
||||
{
|
||||
m_bErrors = m_bWarnings = FALSE;
|
||||
m_bErrors =
|
||||
m_bWarnings =
|
||||
m_bHasMessages = FALSE;
|
||||
|
||||
m_aMessages.Empty();
|
||||
m_aSeverity.Empty();
|
||||
m_aTimes.Empty();
|
||||
@@ -198,15 +211,15 @@ void wxLogGui::Flush()
|
||||
|
||||
long style;
|
||||
if ( m_bErrors ) {
|
||||
title += _("Error");
|
||||
title += m_error;
|
||||
style = wxICON_STOP;
|
||||
}
|
||||
else if ( m_bWarnings ) {
|
||||
title += _("Warning");
|
||||
title += m_warning;
|
||||
style = wxICON_EXCLAMATION;
|
||||
}
|
||||
else {
|
||||
title += _("Information");
|
||||
title += m_info;
|
||||
style = wxICON_INFORMATION;
|
||||
}
|
||||
|
||||
@@ -260,9 +273,6 @@ void wxLogGui::Flush()
|
||||
// no undisplayed messages whatsoever
|
||||
Clear();
|
||||
}
|
||||
|
||||
// do it here again
|
||||
m_bHasMessages = FALSE;
|
||||
}
|
||||
|
||||
// log all kinds of messages
|
||||
@@ -653,6 +663,8 @@ wxLogWindow::~wxLogWindow()
|
||||
|
||||
static const size_t MARGIN = 10;
|
||||
|
||||
wxString wxLogDialog::ms_details;
|
||||
|
||||
wxLogDialog::wxLogDialog(wxWindow *parent,
|
||||
const wxArrayString& messages,
|
||||
const wxArrayInt& severity,
|
||||
@@ -661,6 +673,13 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
|
||||
long style)
|
||||
: wxDialog(parent, -1, caption )
|
||||
{
|
||||
if ( ms_details )
|
||||
{
|
||||
// ensure that we won't try to call wxGetTranslation() twice
|
||||
ms_details = _T("&Details");
|
||||
ms_details = wxGetTranslation(ms_details);
|
||||
}
|
||||
|
||||
size_t count = messages.GetCount();
|
||||
m_messages.Alloc(count);
|
||||
m_severity.Alloc(count);
|
||||
@@ -690,9 +709,9 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
|
||||
wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxButton *btnOk = new wxButton(this, wxID_OK, _T("OK"));
|
||||
wxButton *btnOk = new wxButton(this, wxID_OK, _("OK"));
|
||||
sizerButtons->Add(btnOk, 0, wxCENTRE|wxBOTTOM, MARGIN/2);
|
||||
m_btnDetails = new wxButton(this, wxID_MORE, _T("&Details >>"));
|
||||
m_btnDetails = new wxButton(this, wxID_MORE, ms_details + _T(" >>"));
|
||||
sizerButtons->Add(m_btnDetails, 0, wxCENTRE|wxTOP, MARGIN/2 - 1);
|
||||
|
||||
wxIcon icon = wxTheApp->GetStdIcon((int)(style & wxICON_MASK));
|
||||
@@ -743,13 +762,13 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
if ( m_showingDetails )
|
||||
{
|
||||
m_btnDetails->SetLabel(_T("&Details >>"));
|
||||
m_btnDetails->SetLabel(ms_details + _T(">>"));
|
||||
|
||||
sizer->Remove(m_listctrl);
|
||||
}
|
||||
else // show details now
|
||||
{
|
||||
m_btnDetails->SetLabel(_T("<< &Details"));
|
||||
m_btnDetails->SetLabel(wxString(_T("<< ")) + ms_details);
|
||||
|
||||
if ( !m_listctrl )
|
||||
{
|
||||
@@ -760,8 +779,10 @@ void wxLogDialog::OnDetails(wxCommandEvent& WXUNUSED(event))
|
||||
wxLC_REPORT |
|
||||
wxLC_NO_HEADER |
|
||||
wxLC_SINGLE_SEL);
|
||||
m_listctrl->InsertColumn(0, _("Message"));
|
||||
m_listctrl->InsertColumn(1, _("Time"));
|
||||
// no need to translate these strings as they're not shown to the
|
||||
// user anyhow (we use wxLC_NO_HEADER style)
|
||||
m_listctrl->InsertColumn(0, _T("Message"));
|
||||
m_listctrl->InsertColumn(1, _T("Time"));
|
||||
|
||||
// prepare the imagelist
|
||||
static const int ICON_SIZE = 16;
|
||||
|
@@ -165,9 +165,9 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||
return wxGCPool[i].m_gc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxFAIL_MSG( wxT("No GC available") );
|
||||
|
||||
|
||||
return (GdkGC*) NULL;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ static void wxFreePoolGC( GdkGC *gc )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxFAIL_MSG( wxT("Wrong GC") );
|
||||
}
|
||||
|
||||
@@ -264,9 +264,9 @@ wxWindowDC::~wxWindowDC()
|
||||
void wxWindowDC::SetUpDC()
|
||||
{
|
||||
m_ok = TRUE;
|
||||
|
||||
|
||||
wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
|
||||
|
||||
|
||||
if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1))
|
||||
{
|
||||
m_penGC = wxGetPoolGC( m_window, wxPEN_MONO );
|
||||
@@ -300,27 +300,27 @@ void wxWindowDC::SetUpDC()
|
||||
m_pen.GetColour().CalcPixel( m_cmap );
|
||||
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
|
||||
gdk_gc_set_background( m_penGC, bg_col );
|
||||
|
||||
|
||||
gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
||||
|
||||
|
||||
/* m_brushGC */
|
||||
m_brush.GetColour().CalcPixel( m_cmap );
|
||||
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
|
||||
gdk_gc_set_background( m_brushGC, bg_col );
|
||||
|
||||
|
||||
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
|
||||
|
||||
|
||||
/* m_bgGC */
|
||||
gdk_gc_set_background( m_bgGC, bg_col );
|
||||
gdk_gc_set_foreground( m_bgGC, bg_col );
|
||||
|
||||
gdk_gc_set_fill( m_bgGC, GDK_SOLID );
|
||||
|
||||
|
||||
/* ROPs */
|
||||
gdk_gc_set_function( m_textGC, GDK_COPY );
|
||||
gdk_gc_set_function( m_brushGC, GDK_COPY );
|
||||
gdk_gc_set_function( m_penGC, GDK_COPY );
|
||||
|
||||
|
||||
/* clipping */
|
||||
gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
|
||||
gdk_gc_set_clip_rectangle( m_brushGC, (GdkRectangle *) NULL );
|
||||
@@ -530,16 +530,16 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoor
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_polygon( m_window, m_textGC, TRUE, gdkpoints, n );
|
||||
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
@@ -588,16 +588,16 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_rectangle( m_window, m_textGC, TRUE, xx, yy, ww, hh );
|
||||
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
|
||||
}
|
||||
else if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
@@ -664,8 +664,8 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_rectangle( m_window, m_textGC, TRUE, xx+rr, yy, ww-dd+1, hh );
|
||||
gdk_draw_rectangle( m_window, m_textGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
|
||||
@@ -677,8 +677,8 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
}
|
||||
else if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
|
||||
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
|
||||
@@ -736,16 +736,16 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_arc( m_window, m_textGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
|
||||
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
|
||||
}
|
||||
else if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
@@ -803,7 +803,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
if (tmp.IsEmpty())
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* scale bitmap if required */
|
||||
wxBitmap use_bitmap;
|
||||
if ((w != ww) || (h != hh))
|
||||
@@ -846,7 +846,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
|
||||
gdk_gc_unref( gc );
|
||||
}
|
||||
|
||||
|
||||
if (is_mono)
|
||||
{
|
||||
if (new_mask)
|
||||
@@ -977,7 +977,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
|
||||
int old_logical_func = m_logicalFunction;
|
||||
SetLogicalFunction( logical_func );
|
||||
|
||||
|
||||
if (use_bitmap_method)
|
||||
{
|
||||
/* scale/translate bitmap size */
|
||||
@@ -1031,7 +1031,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, bm_ww, bm_hh );
|
||||
gdk_gc_unref( gc );
|
||||
}
|
||||
|
||||
|
||||
if (is_mono)
|
||||
{
|
||||
if (new_mask)
|
||||
@@ -1054,7 +1054,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
|
||||
/* Draw XPixmap or XBitmap, depending on what the wxBitmap contains. For
|
||||
drawing a mono-bitmap (XBitmap) we use the current text GC */
|
||||
|
||||
|
||||
if (is_mono)
|
||||
gdk_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, xx, yy, ww, hh );
|
||||
else
|
||||
@@ -1097,14 +1097,14 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
for a different implementation of the same problem. */
|
||||
|
||||
wxBitmap bitmap( width, height );
|
||||
|
||||
|
||||
/* copy including child window contents */
|
||||
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
|
||||
gdk_window_copy_area( bitmap.GetPixmap(), m_penGC, 0, 0,
|
||||
srcDC->GetWindow(),
|
||||
xsrc, ysrc, width, height );
|
||||
gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
|
||||
|
||||
|
||||
/* scale image */
|
||||
wxImage image( bitmap );
|
||||
image = image.Scale( ww, hh );
|
||||
@@ -1705,13 +1705,13 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo
|
||||
rect.y = YLOG2DEV(y);
|
||||
rect.width = XLOG2DEVREL(width);
|
||||
rect.height = YLOG2DEVREL(height);
|
||||
|
||||
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( rect );
|
||||
else
|
||||
m_currentClippingRegion.Union( rect );
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
if (!m_paintClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( m_paintClippingRegion );
|
||||
#endif
|
||||
@@ -1737,13 +1737,13 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
||||
}
|
||||
|
||||
if (!m_window) return;
|
||||
|
||||
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( region );
|
||||
else
|
||||
m_currentClippingRegion.Union( region );
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
if (!m_paintClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( m_paintClippingRegion );
|
||||
#endif
|
||||
@@ -1765,8 +1765,8 @@ void wxWindowDC::DestroyClippingRegion()
|
||||
wxDC::DestroyClippingRegion();
|
||||
|
||||
m_currentClippingRegion.Clear();
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
if (!m_paintClippingRegion.IsEmpty())
|
||||
m_currentClippingRegion.Union( m_paintClippingRegion );
|
||||
#endif
|
||||
@@ -2023,12 +2023,16 @@ wxPaintDC::wxPaintDC( wxWindow *win )
|
||||
return;
|
||||
|
||||
m_paintClippingRegion = win->GetUpdateRegion();
|
||||
m_currentClippingRegion.Union( m_paintClippingRegion );
|
||||
|
||||
gdk_gc_set_clip_region( m_penGC, m_paintClippingRegion.GetRegion() );
|
||||
gdk_gc_set_clip_region( m_brushGC, m_paintClippingRegion.GetRegion() );
|
||||
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
|
||||
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
|
||||
GdkRegion *region = m_paintClippingRegion.GetRegion();
|
||||
if ( region )
|
||||
{
|
||||
m_currentClippingRegion.Union( m_paintClippingRegion );
|
||||
|
||||
gdk_gc_set_clip_region( m_penGC, region );
|
||||
gdk_gc_set_clip_region( m_brushGC, region );
|
||||
gdk_gc_set_clip_region( m_textGC, region );
|
||||
gdk_gc_set_clip_region( m_bgGC, region );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -641,9 +641,10 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
||||
{
|
||||
if ( *pc == wxT('_') )
|
||||
if ( *pc == wxT('_') || *pc == wxT('&') )
|
||||
{
|
||||
// this is the escape character for GTK+ - skip it
|
||||
// '_' is the escape character for GTK+ and '&' is the one for
|
||||
// wxWindows - skip both of them
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -165,9 +165,9 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||
return wxGCPool[i].m_gc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxFAIL_MSG( wxT("No GC available") );
|
||||
|
||||
|
||||
return (GdkGC*) NULL;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ static void wxFreePoolGC( GdkGC *gc )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxFAIL_MSG( wxT("Wrong GC") );
|
||||
}
|
||||
|
||||
@@ -264,9 +264,9 @@ wxWindowDC::~wxWindowDC()
|
||||
void wxWindowDC::SetUpDC()
|
||||
{
|
||||
m_ok = TRUE;
|
||||
|
||||
|
||||
wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
|
||||
|
||||
|
||||
if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1))
|
||||
{
|
||||
m_penGC = wxGetPoolGC( m_window, wxPEN_MONO );
|
||||
@@ -300,27 +300,27 @@ void wxWindowDC::SetUpDC()
|
||||
m_pen.GetColour().CalcPixel( m_cmap );
|
||||
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
|
||||
gdk_gc_set_background( m_penGC, bg_col );
|
||||
|
||||
|
||||
gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
|
||||
|
||||
|
||||
/* m_brushGC */
|
||||
m_brush.GetColour().CalcPixel( m_cmap );
|
||||
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
|
||||
gdk_gc_set_background( m_brushGC, bg_col );
|
||||
|
||||
|
||||
gdk_gc_set_fill( m_brushGC, GDK_SOLID );
|
||||
|
||||
|
||||
/* m_bgGC */
|
||||
gdk_gc_set_background( m_bgGC, bg_col );
|
||||
gdk_gc_set_foreground( m_bgGC, bg_col );
|
||||
|
||||
gdk_gc_set_fill( m_bgGC, GDK_SOLID );
|
||||
|
||||
|
||||
/* ROPs */
|
||||
gdk_gc_set_function( m_textGC, GDK_COPY );
|
||||
gdk_gc_set_function( m_brushGC, GDK_COPY );
|
||||
gdk_gc_set_function( m_penGC, GDK_COPY );
|
||||
|
||||
|
||||
/* clipping */
|
||||
gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
|
||||
gdk_gc_set_clip_rectangle( m_brushGC, (GdkRectangle *) NULL );
|
||||
@@ -530,16 +530,16 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoor
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_polygon( m_window, m_textGC, TRUE, gdkpoints, n );
|
||||
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
@@ -588,16 +588,16 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_rectangle( m_window, m_textGC, TRUE, xx, yy, ww, hh );
|
||||
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
|
||||
}
|
||||
else if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
@@ -664,8 +664,8 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_rectangle( m_window, m_textGC, TRUE, xx+rr, yy, ww-dd+1, hh );
|
||||
gdk_draw_rectangle( m_window, m_textGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
|
||||
@@ -677,8 +677,8 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
}
|
||||
else if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
|
||||
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
|
||||
@@ -736,16 +736,16 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_arc( m_window, m_textGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
|
||||
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
|
||||
}
|
||||
else if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
gdk_gc_set_ts_origin( m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
|
||||
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
|
||||
@@ -803,7 +803,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
if (tmp.IsEmpty())
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* scale bitmap if required */
|
||||
wxBitmap use_bitmap;
|
||||
if ((w != ww) || (h != hh))
|
||||
@@ -846,7 +846,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
|
||||
gdk_gc_unref( gc );
|
||||
}
|
||||
|
||||
|
||||
if (is_mono)
|
||||
{
|
||||
if (new_mask)
|
||||
@@ -977,7 +977,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
|
||||
int old_logical_func = m_logicalFunction;
|
||||
SetLogicalFunction( logical_func );
|
||||
|
||||
|
||||
if (use_bitmap_method)
|
||||
{
|
||||
/* scale/translate bitmap size */
|
||||
@@ -1031,7 +1031,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, bm_ww, bm_hh );
|
||||
gdk_gc_unref( gc );
|
||||
}
|
||||
|
||||
|
||||
if (is_mono)
|
||||
{
|
||||
if (new_mask)
|
||||
@@ -1054,7 +1054,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
|
||||
/* Draw XPixmap or XBitmap, depending on what the wxBitmap contains. For
|
||||
drawing a mono-bitmap (XBitmap) we use the current text GC */
|
||||
|
||||
|
||||
if (is_mono)
|
||||
gdk_draw_bitmap( m_window, m_textGC, use_bitmap.GetBitmap(), xsrc, ysrc, xx, yy, ww, hh );
|
||||
else
|
||||
@@ -1097,14 +1097,14 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
for a different implementation of the same problem. */
|
||||
|
||||
wxBitmap bitmap( width, height );
|
||||
|
||||
|
||||
/* copy including child window contents */
|
||||
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
|
||||
gdk_window_copy_area( bitmap.GetPixmap(), m_penGC, 0, 0,
|
||||
srcDC->GetWindow(),
|
||||
xsrc, ysrc, width, height );
|
||||
gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
|
||||
|
||||
|
||||
/* scale image */
|
||||
wxImage image( bitmap );
|
||||
image = image.Scale( ww, hh );
|
||||
@@ -1705,13 +1705,13 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo
|
||||
rect.y = YLOG2DEV(y);
|
||||
rect.width = XLOG2DEVREL(width);
|
||||
rect.height = YLOG2DEVREL(height);
|
||||
|
||||
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( rect );
|
||||
else
|
||||
m_currentClippingRegion.Union( rect );
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
if (!m_paintClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( m_paintClippingRegion );
|
||||
#endif
|
||||
@@ -1737,13 +1737,13 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
||||
}
|
||||
|
||||
if (!m_window) return;
|
||||
|
||||
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( region );
|
||||
else
|
||||
m_currentClippingRegion.Union( region );
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
if (!m_paintClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( m_paintClippingRegion );
|
||||
#endif
|
||||
@@ -1765,8 +1765,8 @@ void wxWindowDC::DestroyClippingRegion()
|
||||
wxDC::DestroyClippingRegion();
|
||||
|
||||
m_currentClippingRegion.Clear();
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
|
||||
#if USE_PAINT_REGION
|
||||
if (!m_paintClippingRegion.IsEmpty())
|
||||
m_currentClippingRegion.Union( m_paintClippingRegion );
|
||||
#endif
|
||||
@@ -2023,12 +2023,16 @@ wxPaintDC::wxPaintDC( wxWindow *win )
|
||||
return;
|
||||
|
||||
m_paintClippingRegion = win->GetUpdateRegion();
|
||||
m_currentClippingRegion.Union( m_paintClippingRegion );
|
||||
|
||||
gdk_gc_set_clip_region( m_penGC, m_paintClippingRegion.GetRegion() );
|
||||
gdk_gc_set_clip_region( m_brushGC, m_paintClippingRegion.GetRegion() );
|
||||
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
|
||||
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
|
||||
GdkRegion *region = m_paintClippingRegion.GetRegion();
|
||||
if ( region )
|
||||
{
|
||||
m_currentClippingRegion.Union( m_paintClippingRegion );
|
||||
|
||||
gdk_gc_set_clip_region( m_penGC, region );
|
||||
gdk_gc_set_clip_region( m_brushGC, region );
|
||||
gdk_gc_set_clip_region( m_textGC, region );
|
||||
gdk_gc_set_clip_region( m_bgGC, region );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -641,9 +641,10 @@ wxString wxMenuItemBase::GetLabelFromText(const wxString& text)
|
||||
#if (GTK_MINOR_VERSION > 0)
|
||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
||||
{
|
||||
if ( *pc == wxT('_') )
|
||||
if ( *pc == wxT('_') || *pc == wxT('&') )
|
||||
{
|
||||
// this is the escape character for GTK+ - skip it
|
||||
// '_' is the escape character for GTK+ and '&' is the one for
|
||||
// wxWindows - skip both of them
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user