[glom/glom-1-18] Fix the build with latest gtkmm.



commit 6e5ade1fca53dfceb6e81dd750300f9c0dd70a0b
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Sep 2 17:28:30 2010 +0200

    Fix the build with latest gtkmm.
    
    * glom/utility_widgets/flowtable.[h|cc]: on_expose_event(): Use
      Cairo for drawing instead of Gdk::GC, which no longer exists.

 ChangeLog                         |    7 +++++++
 glom/utility_widgets/flowtable.cc |   27 ++++++++++++++-------------
 glom/utility_widgets/flowtable.h  |    1 -
 3 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 84b24d8..6c9c157 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-02  Murray Cumming  <murrayc murrayc com>
+
+	Fix the build with latest gtkmm.
+
+	* glom/utility_widgets/flowtable.[h|cc]: on_expose_event(): Use
+  Cairo for drawing instead of Gdk::GC, which no longer exists.
+
 2011-01-27  Murray Cumming  <murrayc murrayc com>
 
 	Fix ComboBoxEntry removal.
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 97689cd..de87df4 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -1023,14 +1023,12 @@ void FlowTable::on_realize()
   if(!m_refGdkWindow)
   {
     m_refGdkWindow = get_window();
-    m_refGC = Gdk::GC::create(m_refGdkWindow);
   }
 }
 
 void FlowTable::on_unrealize()
 {
   m_refGdkWindow.reset();
-  m_refGC.reset();
 
 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
   Gtk::Container::on_unrealize();
@@ -1047,28 +1045,31 @@ bool FlowTable::on_expose_event(GdkEventExpose* event)
     m_refGdkWindow = get_window();
     if(m_refGdkWindow)
     {
-      m_refGC = Gdk::GC::create(m_refGdkWindow);
-      m_refGC->set_line_attributes(1 /* width */, Gdk::LINE_ON_OFF_DASH, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER);
+      Cairo::RefPtr<Cairo::Context> cr = m_refGdkWindow->create_cairo_context();
+      cr->set_line_width(1);
+      cr->set_line_cap(Cairo::LINE_CAP_SQUARE);
+      cr->set_line_join(Cairo::LINE_JOIN_MITER);
+      std::vector<double> dashes;
+      dashes.push_back(10);
+      cr->set_dash(dashes, 0);
 
       for(type_vecLines::iterator iter = m_lines_horizontal.begin(); iter != m_lines_horizontal.end(); ++iter)
       {
-        //TODO: Add draw_line(point, point) to gdkmm:
-        m_refGdkWindow->draw_line(m_refGC, iter->first.get_x(), iter->first.get_y(), iter->second.get_x(), iter->second.get_y());
+        cr->move_to(iter->first.get_x(), iter->first.get_y());
+        cr->line_to(iter->second.get_x(), iter->second.get_y());
+        cr->stroke();
       }
 
       for(type_vecLines::iterator iter = m_lines_vertical.begin(); iter != m_lines_vertical.end(); ++iter)
       {
-        m_refGdkWindow->draw_line(m_refGC, iter->first.get_x(), iter->first.get_y(), iter->second.get_x(), iter->second.get_y());
+        cr->move_to(iter->first.get_x(), iter->first.get_y());
+        cr->line_to(iter->second.get_x(), iter->second.get_y());
+        cr->stroke();
       }
     }
   }
-#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
+
   return Gtk::Container::on_expose_event(event);
-#else
-  if(GTK_WIDGET_CLASS(parent_class)->expose_event)
-    return GTK_WIDGET_CLASS(parent_class)->expose_event(GTK_WIDGET(gobj()), event);
-  return true;
-#endif
 }
 
 bool FlowTable::get_column_for_first_widget(const Gtk::Widget& first, guint& column)
diff --git a/glom/utility_widgets/flowtable.h b/glom/utility_widgets/flowtable.h
index 87010bf..974f58e 100644
--- a/glom/utility_widgets/flowtable.h
+++ b/glom/utility_widgets/flowtable.h
@@ -176,7 +176,6 @@ private:
 
   //For drawing:
   Glib::RefPtr<Gdk::Window> m_refGdkWindow;
-  Glib::RefPtr<Gdk::GC> m_refGC;
 };
 
 } //namespace Glom



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]