From: Robert Roebling Date: Sat, 4 Mar 2000 09:24:17 +0000 (+0000) Subject: Adapted wxGTK to wxMSW's notion of region setting. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/993f97eed6e67c6c43d54f390b3dc1944d36656b Adapted wxGTK to wxMSW's notion of region setting. Made Julian's gc_include_inferior hack a bit less radical. Small addition to changes.txt, Compile fix to dbbrowse sample. Still crashes upon startup. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/demos/dbbrowse/dbtree.cpp b/demos/dbbrowse/dbtree.cpp index 8bacf0a371..33bc980d71 100644 --- a/demos/dbbrowse/dbtree.cpp +++ b/demos/dbbrowse/dbtree.cpp @@ -159,7 +159,7 @@ int DBTree::OnPopulate() Temp2 = ((ct_BrowserDB->pTableInf+x)->pColInf+y)->PkTableName; if (Temp2 == "") Temp2 = _("None"); - Temp2.Printf(_("This Primary Key is used in the following Tables : %s"),Temp2); + Temp2.Printf(_("This Primary Key is used in the following Tables : %s"),Temp2.c_str()); Funkt = AppendItem(Docu,Temp2,TreeIc_DocClosed,TreeIc_DocOpen,new DBTreeData("KEY")); } else diff --git a/docs/gtk/changes.txt b/docs/gtk/changes.txt index 5bb7d1c5d7..abc2c00ef3 100644 --- a/docs/gtk/changes.txt +++ b/docs/gtk/changes.txt @@ -1,5 +1,13 @@ 12th March '2000: wxWindows 2.1.14 released + + +Added support for pipes and a stream class to get data +out of them. + +Added memory file system (so you can save html pages with +images in memory). + Added wxDragImage class for dragging easily images. The DEB and RPM packages now conform better to various diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 91a4cc4169..0f1cf27ffd 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -897,14 +897,18 @@ void MyCanvas::DrawRegions(wxDC& dc) dc.SetPen( *wxTRANSPARENT_PEN ); dc.DrawRectangle( 10,10,310,310 ); - wxRegion region( 20,20,100,270 ); - dc.SetClippingRegion( region ); + dc.SetClippingRegion( 20,20,100,270 ); dc.SetBrush( *wxRED_BRUSH ); dc.DrawRectangle( 10,10,310,310 ); + + dc.SetClippingRegion( 20,20,100,100 ); - region = wxRegion( 120,30,100,270 ); - dc.SetClippingRegion( region ); + dc.SetBrush( *wxCYAN_BRUSH ); + dc.DrawRectangle( 10,10,310,310 ); + + dc.DestroyClippingRegion(); + dc.SetClippingRegion( 120,30,100,270 ); dc.SetBrush( *wxGREY_BRUSH ); dc.DrawRectangle( 10,10,310,310 ); diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 15b1c16e4b..153341d175 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -21,6 +21,7 @@ #include // for floating-point functions #include +#include #include //----------------------------------------------------------------------------- @@ -153,10 +154,6 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type ) { wxGCPool[i].m_gc = gdk_gc_new( window ); gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE ); - // This allows you to e.g. copy from the screen - // without clipping the windows on it. - gdk_gc_set_subwindow( wxGCPool[i].m_gc, - GDK_INCLUDE_INFERIORS ); wxGCPool[i].m_type = type; wxGCPool[i].m_used = FALSE; } @@ -909,7 +906,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 */ @@ -986,6 +983,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 @@ -1028,10 +1026,21 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he for a different implementation of the same problem. */ wxBitmap bitmap( width, height ); - gdk_window_copy_area( bitmap.GetPixmap(), m_penGC, 0, 0, + + /* We have to use the srcDC's GC as it might be a + wxScreenDC and we only have the GDK_INCLUDE_INFERIORS + flag set there. */ + + if (srcDC->GetWindow() == GDK_ROOT_PARENT()) + gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS ); + + gdk_window_copy_area( bitmap.GetPixmap(), srcDC->m_penGC, 0, 0, srcDC->GetWindow(), xsrc, ysrc, width, height ); + if (srcDC->GetWindow() == GDK_ROOT_PARENT()) + gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN ); + /* scale image */ wxImage image( bitmap ); @@ -1048,11 +1057,17 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he } else { - /* no scaling and not a memory dc with a mask either */ + /* No scaling and not a memory dc with a mask either */ + + if (srcDC->GetWindow() == GDK_ROOT_PARENT()) + gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS ); gdk_window_copy_area( m_window, m_penGC, xx, yy, srcDC->GetWindow(), xsrc, ysrc, width, height ); + + if (srcDC->GetWindow() == GDK_ROOT_PARENT()) + gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN ); } } @@ -1635,8 +1650,11 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo rect.width = XLOG2DEVREL(width); rect.height = YLOG2DEVREL(height); - m_currentClippingRegion.Clear(); - m_currentClippingRegion.Union( rect ); + if (!m_currentClippingRegion.IsEmpty()) + m_currentClippingRegion.Intersect( rect ); + else + m_currentClippingRegion.Union( rect ); + #if USE_PAINT_REGION if (!m_paintClippingRegion.IsEmpty()) m_currentClippingRegion.Intersect( m_paintClippingRegion ); @@ -1665,8 +1683,11 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion ) if (!m_window) return; - m_currentClippingRegion.Clear(); - m_currentClippingRegion.Union( region ); + if (!m_currentClippingRegion.IsEmpty()) + m_currentClippingRegion.Intersect( region ); + else + m_currentClippingRegion.Union( region ); + #if USE_PAINT_REGION if (!m_paintClippingRegion.IsEmpty()) m_currentClippingRegion.Intersect( m_paintClippingRegion ); @@ -1686,8 +1707,10 @@ void wxWindowDC::DestroyClippingRegion() m_currentClippingRegion.Clear(); +#if USE_PAINT_REGION if (!m_paintClippingRegion.IsEmpty()) m_currentClippingRegion.Union( m_paintClippingRegion ); +#endif if (!m_window) return; diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 15b1c16e4b..153341d175 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -21,6 +21,7 @@ #include // for floating-point functions #include +#include #include //----------------------------------------------------------------------------- @@ -153,10 +154,6 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type ) { wxGCPool[i].m_gc = gdk_gc_new( window ); gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE ); - // This allows you to e.g. copy from the screen - // without clipping the windows on it. - gdk_gc_set_subwindow( wxGCPool[i].m_gc, - GDK_INCLUDE_INFERIORS ); wxGCPool[i].m_type = type; wxGCPool[i].m_used = FALSE; } @@ -909,7 +906,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 */ @@ -986,6 +983,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 @@ -1028,10 +1026,21 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he for a different implementation of the same problem. */ wxBitmap bitmap( width, height ); - gdk_window_copy_area( bitmap.GetPixmap(), m_penGC, 0, 0, + + /* We have to use the srcDC's GC as it might be a + wxScreenDC and we only have the GDK_INCLUDE_INFERIORS + flag set there. */ + + if (srcDC->GetWindow() == GDK_ROOT_PARENT()) + gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS ); + + gdk_window_copy_area( bitmap.GetPixmap(), srcDC->m_penGC, 0, 0, srcDC->GetWindow(), xsrc, ysrc, width, height ); + if (srcDC->GetWindow() == GDK_ROOT_PARENT()) + gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN ); + /* scale image */ wxImage image( bitmap ); @@ -1048,11 +1057,17 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he } else { - /* no scaling and not a memory dc with a mask either */ + /* No scaling and not a memory dc with a mask either */ + + if (srcDC->GetWindow() == GDK_ROOT_PARENT()) + gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS ); gdk_window_copy_area( m_window, m_penGC, xx, yy, srcDC->GetWindow(), xsrc, ysrc, width, height ); + + if (srcDC->GetWindow() == GDK_ROOT_PARENT()) + gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN ); } } @@ -1635,8 +1650,11 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo rect.width = XLOG2DEVREL(width); rect.height = YLOG2DEVREL(height); - m_currentClippingRegion.Clear(); - m_currentClippingRegion.Union( rect ); + if (!m_currentClippingRegion.IsEmpty()) + m_currentClippingRegion.Intersect( rect ); + else + m_currentClippingRegion.Union( rect ); + #if USE_PAINT_REGION if (!m_paintClippingRegion.IsEmpty()) m_currentClippingRegion.Intersect( m_paintClippingRegion ); @@ -1665,8 +1683,11 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion ) if (!m_window) return; - m_currentClippingRegion.Clear(); - m_currentClippingRegion.Union( region ); + if (!m_currentClippingRegion.IsEmpty()) + m_currentClippingRegion.Intersect( region ); + else + m_currentClippingRegion.Union( region ); + #if USE_PAINT_REGION if (!m_paintClippingRegion.IsEmpty()) m_currentClippingRegion.Intersect( m_paintClippingRegion ); @@ -1686,8 +1707,10 @@ void wxWindowDC::DestroyClippingRegion() m_currentClippingRegion.Clear(); +#if USE_PAINT_REGION if (!m_paintClippingRegion.IsEmpty()) m_currentClippingRegion.Union( m_paintClippingRegion ); +#endif if (!m_window) return;