Slightly better GC pooling,

Implemented automatic updateregion clipping as MSW does.
  Made drawing sample a bit saner.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6183 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2000-02-21 18:01:02 +00:00
parent 1618dca721
commit 0e09f76e6d
9 changed files with 319 additions and 276 deletions

View File

@@ -20,7 +20,6 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza) #define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza)
#define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass) #define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass)
#define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ()) #define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ())
@@ -57,6 +56,7 @@ struct _GtkPizza
gint scroll_y; gint scroll_y;
gboolean clear_on_draw; gboolean clear_on_draw;
gboolean use_filter;
}; };
struct _GtkPizzaClass struct _GtkPizzaClass
@@ -77,6 +77,9 @@ void gtk_pizza_set_shadow_type (GtkPizza *pizza,
void gtk_pizza_set_clear (GtkPizza *pizza, void gtk_pizza_set_clear (GtkPizza *pizza,
gboolean clear); gboolean clear);
void gtk_pizza_set_filter (GtkPizza *pizza,
gboolean use);
void gtk_pizza_scroll (GtkPizza *pizza, void gtk_pizza_scroll (GtkPizza *pizza,
gint dx, gint dx,
gint dy); gint dy);

View File

@@ -20,7 +20,6 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza) #define GTK_PIZZA(obj) GTK_CHECK_CAST (obj, gtk_pizza_get_type (), GtkPizza)
#define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass) #define GTK_PIZZA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pizza_get_type (), GtkPizzaClass)
#define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ()) #define GTK_IS_PIZZA(obj) GTK_CHECK_TYPE (obj, gtk_pizza_get_type ())
@@ -57,6 +56,7 @@ struct _GtkPizza
gint scroll_y; gint scroll_y;
gboolean clear_on_draw; gboolean clear_on_draw;
gboolean use_filter;
}; };
struct _GtkPizzaClass struct _GtkPizzaClass
@@ -77,6 +77,9 @@ void gtk_pizza_set_shadow_type (GtkPizza *pizza,
void gtk_pizza_set_clear (GtkPizza *pizza, void gtk_pizza_set_clear (GtkPizza *pizza,
gboolean clear); gboolean clear);
void gtk_pizza_set_filter (GtkPizza *pizza,
gboolean use);
void gtk_pizza_scroll (GtkPizza *pizza, void gtk_pizza_scroll (GtkPizza *pizza,
gint dx, gint dx,
gint dy); gint dy);

View File

@@ -154,6 +154,8 @@ private:
MyFrame *m_owner; MyFrame *m_owner;
ScreenToShow m_show; ScreenToShow m_show;
wxBitmap m_smile_bmp;
wxIcon m_std_icon;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -310,10 +312,14 @@ BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
EVT_MOTION (MyCanvas::OnMouseMove) EVT_MOTION (MyCanvas::OnMouseMove)
END_EVENT_TABLE() END_EVENT_TABLE()
#include "../image/smile.xpm"
MyCanvas::MyCanvas( MyFrame *parent ) : wxScrolledWindow( parent ) MyCanvas::MyCanvas( MyFrame *parent ) : wxScrolledWindow( parent )
{ {
m_owner = parent; m_owner = parent;
m_show = Show_Default; m_show = Show_Default;
m_smile_bmp = wxBitmap(smile_xpm);
m_std_icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
} }
//draw a polygon and an overlapping rectangle //draw a polygon and an overlapping rectangle
@@ -578,29 +584,26 @@ void MyCanvas::DrawDefault(wxDC& dc)
dc.DrawCheckMark(25, 80, 30, 30); dc.DrawCheckMark(25, 80, 30, 30);
dc.DrawCheckMark(60, 80, 60, 60); dc.DrawCheckMark(60, 80, 60, 60);
// this is the test for "blitting bitmap into DC damages selected brush" // this is the test for "blitting bitmap into DC damages selected brush" bug
// bug wxIcon m_std_icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION); wxCoord rectSize = m_std_icon.GetWidth() + 10;
wxCoord rectSize = icon.GetWidth() + 10;
wxCoord x = 100; wxCoord x = 100;
dc.SetPen(*wxTRANSPARENT_PEN); dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush( *wxGREEN_BRUSH ); dc.SetBrush( *wxGREEN_BRUSH );
dc.DrawRectangle(x, 10, rectSize, rectSize); dc.DrawRectangle(x, 10, rectSize, rectSize);
dc.DrawBitmap(icon, x + 5, 15, TRUE); dc.DrawBitmap(m_std_icon, x + 5, 15, TRUE);
x += rectSize + 10; x += rectSize + 10;
dc.DrawRectangle(x, 10, rectSize, rectSize); dc.DrawRectangle(x, 10, rectSize, rectSize);
dc.DrawIcon(wxTheApp->GetStdIcon(wxICON_INFORMATION), x + 5, 15); dc.DrawIcon(m_std_icon, x + 5, 15);
x += rectSize + 10; x += rectSize + 10;
dc.DrawRectangle(x, 10, rectSize, rectSize); dc.DrawRectangle(x, 10, rectSize, rectSize);
// test for "transparent" bitmap drawing (it intersects with the last // test for "transparent" bitmap drawing (it intersects with the last
// rectangle above) // rectangle above)
//dc.SetBrush( *wxTRANSPARENT_BRUSH ); //dc.SetBrush( *wxTRANSPARENT_BRUSH );
#include "../image/smile.xpm"
wxBitmap bmp(smile_xpm);
if (bmp.Ok()) if (m_smile_bmp.Ok())
dc.DrawBitmap(bmp, x + rectSize - 20, rectSize - 10, TRUE); dc.DrawBitmap(m_smile_bmp, x + rectSize - 20, rectSize - 10, TRUE);
dc.SetBrush( *wxBLACK_BRUSH ); dc.SetBrush( *wxBLACK_BRUSH );
dc.DrawRectangle( 0, 160, 1000, 300 ); dc.DrawRectangle( 0, 160, 1000, 300 );

View File

@@ -100,10 +100,23 @@ void gdk_draw_bitmap (GdkDrawable *drawable,
// Implement Pool of Graphic contexts. Creating them takes too much time. // Implement Pool of Graphic contexts. Creating them takes too much time.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
enum wxPoolGCType
{
wxGC_ERROR = 0,
wxTEXT_MONO,
wxBG_MONO,
wxPEN_MONO,
wxBRUSH_MONO,
wxTEXT_COLOUR,
wxBG_COLOUR,
wxPEN_COLOUR,
wxBRUSH_COLOUR
};
struct wxGC struct wxGC
{ {
GdkGC *m_gc; GdkGC *m_gc;
bool m_mono; wxPoolGCType m_type;
bool m_used; bool m_used;
}; };
@@ -123,7 +136,7 @@ static void wxCleanUpGCPool()
} }
} }
static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE ) static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
{ {
for (int i = 0; i < 200; i++) for (int i = 0; i < 200; i++)
{ {
@@ -131,10 +144,10 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
{ {
wxGCPool[i].m_gc = gdk_gc_new( window ); wxGCPool[i].m_gc = gdk_gc_new( window );
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE ); gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
wxGCPool[i].m_mono = mono; wxGCPool[i].m_type = type;
wxGCPool[i].m_used = FALSE; wxGCPool[i].m_used = FALSE;
} }
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_mono == mono)) if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type))
{ {
wxGCPool[i].m_used = TRUE; wxGCPool[i].m_used = TRUE;
return wxGCPool[i].m_gc; return wxGCPool[i].m_gc;
@@ -1587,10 +1600,10 @@ void wxWindowDC::SetUpDC()
if (!m_penGC) if (!m_penGC)
{ {
m_penGC = wxGetPoolGC( m_window ); m_penGC = wxGetPoolGC( m_window, wxPEN_COLOUR );
m_brushGC = wxGetPoolGC( m_window ); m_brushGC = wxGetPoolGC( m_window, wxBRUSH_COLOUR );
m_textGC = wxGetPoolGC( m_window ); m_textGC = wxGetPoolGC( m_window, wxTEXT_COLOUR );
m_bgGC = wxGetPoolGC( m_window ); m_bgGC = wxGetPoolGC( m_window, wxBG_COLOUR );
} }
/* background colour */ /* background colour */
@@ -1606,14 +1619,12 @@ void wxWindowDC::SetUpDC()
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() ); gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
gdk_gc_set_fill( m_textGC, GDK_SOLID ); gdk_gc_set_fill( m_textGC, GDK_SOLID );
gdk_gc_set_line_attributes( m_textGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
/* m_penGC */ /* m_penGC */
m_pen.GetColour().CalcPixel( m_cmap ); m_pen.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() ); gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
gdk_gc_set_background( m_penGC, bg_col ); gdk_gc_set_background( m_penGC, bg_col );
gdk_gc_set_fill( m_penGC, GDK_SOLID );
gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND ); gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
@@ -1623,7 +1634,6 @@ void wxWindowDC::SetUpDC()
gdk_gc_set_background( m_brushGC, bg_col ); gdk_gc_set_background( m_brushGC, bg_col );
gdk_gc_set_fill( m_brushGC, GDK_SOLID ); gdk_gc_set_fill( m_brushGC, GDK_SOLID );
gdk_gc_set_line_attributes( m_brushGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
/* m_bgGC */ /* m_bgGC */
@@ -1631,13 +1641,11 @@ void wxWindowDC::SetUpDC()
gdk_gc_set_foreground( m_bgGC, bg_col ); gdk_gc_set_foreground( m_bgGC, bg_col );
gdk_gc_set_fill( m_bgGC, GDK_SOLID ); gdk_gc_set_fill( m_bgGC, GDK_SOLID );
gdk_gc_set_line_attributes( m_bgGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
/* ROPs */ /* ROPs */
gdk_gc_set_function( m_textGC, GDK_COPY ); gdk_gc_set_function( m_textGC, GDK_COPY );
gdk_gc_set_function( m_brushGC, GDK_COPY ); gdk_gc_set_function( m_brushGC, GDK_COPY );
gdk_gc_set_function( m_penGC, GDK_COPY ); gdk_gc_set_function( m_penGC, GDK_COPY );
gdk_gc_set_function( m_bgGC, GDK_COPY );
/* clipping */ /* clipping */
gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL ); gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
@@ -1886,7 +1894,6 @@ wxPaintDC::wxPaintDC()
wxPaintDC::wxPaintDC( wxWindow *win ) wxPaintDC::wxPaintDC( wxWindow *win )
: wxWindowDC( win ) : wxWindowDC( win )
{ {
/*
if (!win->GetUpdateRegion().IsEmpty()) if (!win->GetUpdateRegion().IsEmpty())
{ {
m_paintClippingRegion = win->GetUpdateRegion(); m_paintClippingRegion = win->GetUpdateRegion();
@@ -1897,7 +1904,6 @@ wxPaintDC::wxPaintDC( wxWindow *win )
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
} }
*/
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -193,6 +193,7 @@ gtk_pizza_init (GtkPizza *pizza)
pizza->visibility = GDK_VISIBILITY_PARTIAL; pizza->visibility = GDK_VISIBILITY_PARTIAL;
pizza->clear_on_draw = TRUE; pizza->clear_on_draw = TRUE;
pizza->use_filter = FALSE;
} }
GtkWidget* GtkWidget*
@@ -242,6 +243,16 @@ gtk_pizza_set_clear (GtkPizza *pizza,
pizza->clear_on_draw = clear; pizza->clear_on_draw = clear;
} }
void
gtk_pizza_set_filter (GtkPizza *pizza,
gboolean use)
{
g_return_if_fail (pizza != NULL);
g_return_if_fail (GTK_IS_PIZZA (pizza));
pizza->use_filter = use;
}
void void
gtk_pizza_put (GtkPizza *pizza, gtk_pizza_put (GtkPizza *pizza,
GtkWidget *widget, GtkWidget *widget,
@@ -274,11 +285,14 @@ gtk_pizza_put (GtkPizza *pizza,
if (!IS_ONSCREEN (x, y)) if (!IS_ONSCREEN (x, y))
GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN); GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN);
/*
if (GTK_WIDGET_REALIZED (pizza)) if (GTK_WIDGET_REALIZED (pizza))
gtk_widget_realize (widget); gtk_widget_realize (widget);
*/
gtk_widget_set_usize (widget, width, height); gtk_widget_set_usize (widget, width, height);
/*
if (GTK_WIDGET_VISIBLE (pizza) && GTK_WIDGET_VISIBLE (widget)) if (GTK_WIDGET_VISIBLE (pizza) && GTK_WIDGET_VISIBLE (widget))
{ {
if (GTK_WIDGET_MAPPED (pizza)) if (GTK_WIDGET_MAPPED (pizza))
@@ -286,6 +300,7 @@ gtk_pizza_put (GtkPizza *pizza,
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
} }
*/
} }
void void
@@ -683,14 +698,6 @@ gtk_pizza_expose (GtkWidget *widget,
pizza = GTK_PIZZA (widget); pizza = GTK_PIZZA (widget);
/*
if (event->window == widget->window)
{
gtk_pizza_draw_border( pizza );
return FALSE;
}
*/
if (event->window != pizza->bin_window) if (event->window != pizza->bin_window)
return FALSE; return FALSE;
@@ -898,10 +905,12 @@ gtk_pizza_adjust_allocations (GtkPizza *pizza,
if (GTK_WIDGET_NO_WINDOW (child->widget) && if (GTK_WIDGET_NO_WINDOW (child->widget) &&
GTK_IS_CONTAINER (child->widget)) GTK_IS_CONTAINER (child->widget))
{
gtk_container_forall (GTK_CONTAINER (child->widget), gtk_container_forall (GTK_CONTAINER (child->widget),
gtk_pizza_adjust_allocations_recurse, gtk_pizza_adjust_allocations_recurse,
&data); &data);
} }
}
} }
/* Callbacks */ /* Callbacks */
@@ -1147,6 +1156,7 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent,
GtkPizza *pizza; GtkPizza *pizza;
xevent = (XEvent *)gdk_xevent; xevent = (XEvent *)gdk_xevent;
pizza = GTK_PIZZA (data); pizza = GTK_PIZZA (data);
switch (xevent->type) switch (xevent->type)
@@ -1214,7 +1224,6 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent,
return GDK_FILTER_REMOVE; return GDK_FILTER_REMOVE;
} }
return GDK_FILTER_CONTINUE; return GDK_FILTER_CONTINUE;
} }

View File

@@ -612,10 +612,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
{ {
DEBUG_MAIN_THREAD DEBUG_MAIN_THREAD
if (!win->m_hasVMT)
return;
/*
if (win->GetName() == wxT("columntitles")) if (win->GetName() == wxT("columntitles"))
{ {
wxPrintf( wxT("OnExpose from ") ); wxPrintf( wxT("OnExpose from ") );
@@ -626,7 +622,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
(int)gdk_event->area.width, (int)gdk_event->area.width,
(int)gdk_event->area.height ); (int)gdk_event->area.height );
} }
*/
win->GetUpdateRegion().Union( gdk_event->area.x, win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y, gdk_event->area.y,
@@ -637,6 +632,9 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
if (gdk_event->count > 0) if (gdk_event->count > 0)
return; return;
if (!win->m_hasVMT)
return;
wxEraseEvent eevent( win->GetId() ); wxEraseEvent eevent( win->GetId() );
eevent.SetEventObject( win ); eevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent(eevent); win->GetEventHandler()->ProcessEvent(eevent);
@@ -660,8 +658,10 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
/* if ((rect->x == 0) && (rect->y == 0) && (rect->width <= 1) && (rect->height <= 1))
if ((win->GetName() == wxT("columntitles")) && (rect->x == 2)) return;
if (win->GetName() == wxT("columntitles"))
{ {
wxPrintf( wxT("OnDraw from ") ); wxPrintf( wxT("OnDraw from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -671,11 +671,13 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
(int)rect->width, (int)rect->width,
(int)rect->height ); (int)rect->height );
} }
*/
win->GetUpdateRegion().Union( rect->x, rect->y, win->GetUpdateRegion().Union( rect->x, rect->y,
rect->width, rect->height ); rect->width, rect->height );
if (!win->m_hasVMT)
return;
wxEraseEvent eevent( win->GetId() ); wxEraseEvent eevent( win->GetId() );
eevent.SetEventObject( win ); eevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent(eevent); win->GetEventHandler()->ProcessEvent(eevent);

View File

@@ -100,10 +100,23 @@ void gdk_draw_bitmap (GdkDrawable *drawable,
// Implement Pool of Graphic contexts. Creating them takes too much time. // Implement Pool of Graphic contexts. Creating them takes too much time.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
enum wxPoolGCType
{
wxGC_ERROR = 0,
wxTEXT_MONO,
wxBG_MONO,
wxPEN_MONO,
wxBRUSH_MONO,
wxTEXT_COLOUR,
wxBG_COLOUR,
wxPEN_COLOUR,
wxBRUSH_COLOUR
};
struct wxGC struct wxGC
{ {
GdkGC *m_gc; GdkGC *m_gc;
bool m_mono; wxPoolGCType m_type;
bool m_used; bool m_used;
}; };
@@ -123,7 +136,7 @@ static void wxCleanUpGCPool()
} }
} }
static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE ) static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
{ {
for (int i = 0; i < 200; i++) for (int i = 0; i < 200; i++)
{ {
@@ -131,10 +144,10 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
{ {
wxGCPool[i].m_gc = gdk_gc_new( window ); wxGCPool[i].m_gc = gdk_gc_new( window );
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE ); gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
wxGCPool[i].m_mono = mono; wxGCPool[i].m_type = type;
wxGCPool[i].m_used = FALSE; wxGCPool[i].m_used = FALSE;
} }
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_mono == mono)) if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type))
{ {
wxGCPool[i].m_used = TRUE; wxGCPool[i].m_used = TRUE;
return wxGCPool[i].m_gc; return wxGCPool[i].m_gc;
@@ -1587,10 +1600,10 @@ void wxWindowDC::SetUpDC()
if (!m_penGC) if (!m_penGC)
{ {
m_penGC = wxGetPoolGC( m_window ); m_penGC = wxGetPoolGC( m_window, wxPEN_COLOUR );
m_brushGC = wxGetPoolGC( m_window ); m_brushGC = wxGetPoolGC( m_window, wxBRUSH_COLOUR );
m_textGC = wxGetPoolGC( m_window ); m_textGC = wxGetPoolGC( m_window, wxTEXT_COLOUR );
m_bgGC = wxGetPoolGC( m_window ); m_bgGC = wxGetPoolGC( m_window, wxBG_COLOUR );
} }
/* background colour */ /* background colour */
@@ -1606,14 +1619,12 @@ void wxWindowDC::SetUpDC()
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() ); gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
gdk_gc_set_fill( m_textGC, GDK_SOLID ); gdk_gc_set_fill( m_textGC, GDK_SOLID );
gdk_gc_set_line_attributes( m_textGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
/* m_penGC */ /* m_penGC */
m_pen.GetColour().CalcPixel( m_cmap ); m_pen.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() ); gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
gdk_gc_set_background( m_penGC, bg_col ); gdk_gc_set_background( m_penGC, bg_col );
gdk_gc_set_fill( m_penGC, GDK_SOLID );
gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND ); gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
@@ -1623,7 +1634,6 @@ void wxWindowDC::SetUpDC()
gdk_gc_set_background( m_brushGC, bg_col ); gdk_gc_set_background( m_brushGC, bg_col );
gdk_gc_set_fill( m_brushGC, GDK_SOLID ); gdk_gc_set_fill( m_brushGC, GDK_SOLID );
gdk_gc_set_line_attributes( m_brushGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
/* m_bgGC */ /* m_bgGC */
@@ -1631,13 +1641,11 @@ void wxWindowDC::SetUpDC()
gdk_gc_set_foreground( m_bgGC, bg_col ); gdk_gc_set_foreground( m_bgGC, bg_col );
gdk_gc_set_fill( m_bgGC, GDK_SOLID ); gdk_gc_set_fill( m_bgGC, GDK_SOLID );
gdk_gc_set_line_attributes( m_bgGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
/* ROPs */ /* ROPs */
gdk_gc_set_function( m_textGC, GDK_COPY ); gdk_gc_set_function( m_textGC, GDK_COPY );
gdk_gc_set_function( m_brushGC, GDK_COPY ); gdk_gc_set_function( m_brushGC, GDK_COPY );
gdk_gc_set_function( m_penGC, GDK_COPY ); gdk_gc_set_function( m_penGC, GDK_COPY );
gdk_gc_set_function( m_bgGC, GDK_COPY );
/* clipping */ /* clipping */
gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL ); gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
@@ -1886,7 +1894,6 @@ wxPaintDC::wxPaintDC()
wxPaintDC::wxPaintDC( wxWindow *win ) wxPaintDC::wxPaintDC( wxWindow *win )
: wxWindowDC( win ) : wxWindowDC( win )
{ {
/*
if (!win->GetUpdateRegion().IsEmpty()) if (!win->GetUpdateRegion().IsEmpty())
{ {
m_paintClippingRegion = win->GetUpdateRegion(); m_paintClippingRegion = win->GetUpdateRegion();
@@ -1897,7 +1904,6 @@ wxPaintDC::wxPaintDC( wxWindow *win )
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
} }
*/
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -193,6 +193,7 @@ gtk_pizza_init (GtkPizza *pizza)
pizza->visibility = GDK_VISIBILITY_PARTIAL; pizza->visibility = GDK_VISIBILITY_PARTIAL;
pizza->clear_on_draw = TRUE; pizza->clear_on_draw = TRUE;
pizza->use_filter = FALSE;
} }
GtkWidget* GtkWidget*
@@ -242,6 +243,16 @@ gtk_pizza_set_clear (GtkPizza *pizza,
pizza->clear_on_draw = clear; pizza->clear_on_draw = clear;
} }
void
gtk_pizza_set_filter (GtkPizza *pizza,
gboolean use)
{
g_return_if_fail (pizza != NULL);
g_return_if_fail (GTK_IS_PIZZA (pizza));
pizza->use_filter = use;
}
void void
gtk_pizza_put (GtkPizza *pizza, gtk_pizza_put (GtkPizza *pizza,
GtkWidget *widget, GtkWidget *widget,
@@ -274,11 +285,14 @@ gtk_pizza_put (GtkPizza *pizza,
if (!IS_ONSCREEN (x, y)) if (!IS_ONSCREEN (x, y))
GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN); GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN);
/*
if (GTK_WIDGET_REALIZED (pizza)) if (GTK_WIDGET_REALIZED (pizza))
gtk_widget_realize (widget); gtk_widget_realize (widget);
*/
gtk_widget_set_usize (widget, width, height); gtk_widget_set_usize (widget, width, height);
/*
if (GTK_WIDGET_VISIBLE (pizza) && GTK_WIDGET_VISIBLE (widget)) if (GTK_WIDGET_VISIBLE (pizza) && GTK_WIDGET_VISIBLE (widget))
{ {
if (GTK_WIDGET_MAPPED (pizza)) if (GTK_WIDGET_MAPPED (pizza))
@@ -286,6 +300,7 @@ gtk_pizza_put (GtkPizza *pizza,
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
} }
*/
} }
void void
@@ -683,14 +698,6 @@ gtk_pizza_expose (GtkWidget *widget,
pizza = GTK_PIZZA (widget); pizza = GTK_PIZZA (widget);
/*
if (event->window == widget->window)
{
gtk_pizza_draw_border( pizza );
return FALSE;
}
*/
if (event->window != pizza->bin_window) if (event->window != pizza->bin_window)
return FALSE; return FALSE;
@@ -898,10 +905,12 @@ gtk_pizza_adjust_allocations (GtkPizza *pizza,
if (GTK_WIDGET_NO_WINDOW (child->widget) && if (GTK_WIDGET_NO_WINDOW (child->widget) &&
GTK_IS_CONTAINER (child->widget)) GTK_IS_CONTAINER (child->widget))
{
gtk_container_forall (GTK_CONTAINER (child->widget), gtk_container_forall (GTK_CONTAINER (child->widget),
gtk_pizza_adjust_allocations_recurse, gtk_pizza_adjust_allocations_recurse,
&data); &data);
} }
}
} }
/* Callbacks */ /* Callbacks */
@@ -1147,6 +1156,7 @@ gtk_pizza_filter (GdkXEvent *gdk_xevent,
GtkPizza *pizza; GtkPizza *pizza;
xevent = (XEvent *)gdk_xevent; xevent = (XEvent *)gdk_xevent;
pizza = GTK_PIZZA (data); pizza = GTK_PIZZA (data);
switch (xevent->type) switch (xevent->type)
@@ -1214,7 +1224,6 @@ gtk_pizza_main_filter (GdkXEvent *gdk_xevent,
return GDK_FILTER_REMOVE; return GDK_FILTER_REMOVE;
} }
return GDK_FILTER_CONTINUE; return GDK_FILTER_CONTINUE;
} }

View File

@@ -612,10 +612,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
{ {
DEBUG_MAIN_THREAD DEBUG_MAIN_THREAD
if (!win->m_hasVMT)
return;
/*
if (win->GetName() == wxT("columntitles")) if (win->GetName() == wxT("columntitles"))
{ {
wxPrintf( wxT("OnExpose from ") ); wxPrintf( wxT("OnExpose from ") );
@@ -626,7 +622,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
(int)gdk_event->area.width, (int)gdk_event->area.width,
(int)gdk_event->area.height ); (int)gdk_event->area.height );
} }
*/
win->GetUpdateRegion().Union( gdk_event->area.x, win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y, gdk_event->area.y,
@@ -637,6 +632,9 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
if (gdk_event->count > 0) if (gdk_event->count > 0)
return; return;
if (!win->m_hasVMT)
return;
wxEraseEvent eevent( win->GetId() ); wxEraseEvent eevent( win->GetId() );
eevent.SetEventObject( win ); eevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent(eevent); win->GetEventHandler()->ProcessEvent(eevent);
@@ -660,8 +658,10 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
/* if ((rect->x == 0) && (rect->y == 0) && (rect->width <= 1) && (rect->height <= 1))
if ((win->GetName() == wxT("columntitles")) && (rect->x == 2)) return;
if (win->GetName() == wxT("columntitles"))
{ {
wxPrintf( wxT("OnDraw from ") ); wxPrintf( wxT("OnDraw from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -671,11 +671,13 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
(int)rect->width, (int)rect->width,
(int)rect->height ); (int)rect->height );
} }
*/
win->GetUpdateRegion().Union( rect->x, rect->y, win->GetUpdateRegion().Union( rect->x, rect->y,
rect->width, rect->height ); rect->width, rect->height );
if (!win->m_hasVMT)
return;
wxEraseEvent eevent( win->GetId() ); wxEraseEvent eevent( win->GetId() );
eevent.SetEventObject( win ); eevent.SetEventObject( win );
win->GetEventHandler()->ProcessEvent(eevent); win->GetEventHandler()->ProcessEvent(eevent);