[glom] Fix the build with latest gtkmm.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Fix the build with latest gtkmm.
- Date: Thu, 2 Sep 2010 15:42:45 +0000 (UTC)
commit e350d80e90f7290682390e9388aa75c5fc3dc712
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 | 21 ++++++++++++++-------
glom/utility_widgets/flowtable.h | 1 -
3 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 277cfdc..e69efeb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
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.
+
+2010-09-02 Murray Cumming <murrayc murrayc com>
+
Avoid use of deprecated cairomm API.
* configure.ac: Also check for CAIROMM deprecations.
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 65e4ed8..c090f10 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -861,14 +861,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();
Gtk::Container::on_unrealize();
}
@@ -880,21 +878,30 @@ 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();
}
}
}
+
return Gtk::Container::on_expose_event(event);
}
diff --git a/glom/utility_widgets/flowtable.h b/glom/utility_widgets/flowtable.h
index a20013a..56fb090 100644
--- a/glom/utility_widgets/flowtable.h
+++ b/glom/utility_widgets/flowtable.h
@@ -164,7 +164,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]