- if (!hatch_bitmap)
- {
- hatch_bitmap = hatches;
- hatch_bitmap[0] = gdk_bitmap_create_from_data( NULL, bdiag_bits, bdiag_width, bdiag_height );
- hatch_bitmap[1] = gdk_bitmap_create_from_data( NULL, cdiag_bits, cdiag_width, cdiag_height );
- hatch_bitmap[2] = gdk_bitmap_create_from_data( NULL, fdiag_bits, fdiag_width, fdiag_height );
- hatch_bitmap[3] = gdk_bitmap_create_from_data( NULL, cross_bits, cross_width, cross_height );
- hatch_bitmap[4] = gdk_bitmap_create_from_data( NULL, horiz_bits, horiz_width, horiz_height );
- hatch_bitmap[5] = gdk_bitmap_create_from_data( NULL, verti_bits, verti_width, verti_height );
- };
-};
+ if (!m_window) return;
+
+ gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
+ gdk_gc_set_clip_rectangle( m_brushGC, (GdkRectangle *) NULL );
+ gdk_gc_set_clip_rectangle( m_textGC, (GdkRectangle *) NULL );
+ gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL );
+}
+
+void wxWindowDC::SetUpDC()
+{
+ Destroy();
+ m_ok = TRUE;
+ m_logicalFunction = wxCOPY;
+ m_penGC = gdk_gc_new( m_window );
+ m_brushGC = gdk_gc_new( m_window );
+ m_textGC = gdk_gc_new( m_window );
+ m_bgGC = gdk_gc_new( m_window );
+
+ wxColour tmp_col( m_textForegroundColour );
+ m_textForegroundColour = wxNullColour;
+ SetTextForeground( tmp_col );
+ tmp_col = m_textBackgroundColour;
+ m_textBackgroundColour = wxNullColour;
+ SetTextBackground( tmp_col );
+
+ wxPen tmp_pen( m_pen );
+ m_pen = wxNullPen;
+ SetPen( tmp_pen );
+
+ wxFont tmp_font( m_font );
+ m_font = wxNullFont;
+ SetFont( tmp_font );
+
+ wxBrush tmp_brush( m_brush );
+ m_brush = wxNullBrush;
+ SetBrush( tmp_brush );
+
+/*
+ tmp_brush = m_backgroundBrush;
+ m_backgroundBrush = wxNullBrush;
+ SetBackground( tmp_brush );
+*/
+ tmp_brush = m_backgroundBrush;
+ m_backgroundBrush = wxNullBrush;
+ SetBackground( *wxWHITE_BRUSH );
+ m_backgroundBrush = tmp_brush;
+
+ if (!hatch_bitmap)
+ {
+ hatch_bitmap = hatches;
+ hatch_bitmap[0] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, bdiag_bits, bdiag_width, bdiag_height );
+ hatch_bitmap[1] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, cdiag_bits, cdiag_width, cdiag_height );
+ hatch_bitmap[2] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, fdiag_bits, fdiag_width, fdiag_height );
+ hatch_bitmap[3] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, cross_bits, cross_width, cross_height );
+ hatch_bitmap[4] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, horiz_bits, horiz_width, horiz_height );
+ hatch_bitmap[5] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, verti_bits, verti_width, verti_height );
+ }
+}
+
+void wxWindowDC::Destroy()
+{
+ if (m_penGC) gdk_gc_unref( m_penGC );
+ m_penGC = (GdkGC*) NULL;
+ if (m_brushGC) gdk_gc_unref( m_brushGC );
+ m_brushGC = (GdkGC*) NULL;
+ if (m_textGC) gdk_gc_unref( m_textGC );
+ m_textGC = (GdkGC*) NULL;
+ if (m_bgGC) gdk_gc_unref( m_bgGC );
+ m_bgGC = (GdkGC*) NULL;
+}
+
+void wxWindowDC::ComputeScaleAndOrigin()
+{
+ /* CMB: copy scale to see if it changes */
+ double origScaleX = m_scaleX;
+ double origScaleY = m_scaleY;
+
+ wxDC::ComputeScaleAndOrigin();
+
+ /* CMB: if scale has changed call SetPen to recalulate the line width */
+ if ((m_scaleX != origScaleX || m_scaleY != origScaleY) &&
+ (m_pen.Ok()))
+ {
+ /* this is a bit artificial, but we need to force wxDC to think
+ the pen has changed */
+ wxPen pen = m_pen;
+ m_pen = wxNullPen;
+ SetPen( pen );
+ }
+}
+
+// Resolution in pixels per logical inch
+wxSize wxWindowDC::GetPPI() const
+{
+ return wxSize(100, 100);
+}