[goocanvasmm] tests, examples: Avoid compiler warnings and deprecated API.



commit 16a978e160bb3bcb2a98d595d064c2da28ca6c54
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Oct 27 09:16:41 2011 +0200

    tests, examples: Avoid compiler warnings and deprecated API.
    
    * examples/Makefile.am:
    * tests/Makefile.am: Fix a typo so we really use warning flags.
    * examples/coordinates/window.cc:
    * examples/custom_item/exampleitem.cc:
    * examples/demo/primitives.cc:
    * examples/drag_to_canvas/examplewindow.cc:
    * examples/moving_shapes/window.cc:
    * examples/simple/examplewindow.cc:
    * examples/table/examplewindow.cc:
    * examples/text/window.cc: Fix the build with --enable-warinings=fatal.

 ChangeLog                                |   15 +++++++++++++++
 examples/Makefile.am                     |    2 +-
 examples/coordinates/window.cc           |    4 ++--
 examples/custom_item/exampleitem.cc      |    2 +-
 examples/demo/primitives.cc              |   25 +++++++++++++------------
 examples/drag_to_canvas/examplewindow.cc |    8 ++++----
 examples/moving_shapes/window.cc         |   11 ++++++-----
 examples/simple/examplewindow.cc         |    2 +-
 examples/table/examplewindow.cc          |    2 +-
 examples/text/window.cc                  |    2 +-
 tests/Makefile.am                        |    2 +-
 11 files changed, 46 insertions(+), 29 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index db2a4d5..f85f7a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2011-10-27  Murray Cumming  <murrayc murrayc com>
 
+	tests, examples: Avoid compiler warnings and deprecated API.
+
+	* examples/Makefile.am:
+	* tests/Makefile.am: Fix a typo so we really use warning flags.
+	* examples/coordinates/window.cc:
+	* examples/custom_item/exampleitem.cc:
+	* examples/demo/primitives.cc:
+	* examples/drag_to_canvas/examplewindow.cc:
+	* examples/moving_shapes/window.cc:
+	* examples/simple/examplewindow.cc:
+	* examples/table/examplewindow.cc:
+	* examples/text/window.cc: Fix the build with --enable-warinings=fatal.
+
+2011-10-27  Murray Cumming  <murrayc murrayc com>
+
 	init(): Add back the old deprecated method overload.
 
 	* goocanvas/goocanvasmm/init.[h|cc]: Add back the init() call with parameters,
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 700b741..5368130 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/examples/Makefile.am_fragment
 AUTOMAKE_OPTIONS = subdir-objects
 
 AM_CPPFLAGS = -I$(top_builddir) $(GOOCANVASMM_CFLAGS)
-AM_CXXFLAGS = $(GOOCANSASMM_WXXFLAGS)
+AM_CXXFLAGS = $(GOOCANVASMM_WXXFLAGS)
 LDADD       = $(GOOCANVASMM_LIBS)
 
 check_PROGRAMS = \
diff --git a/examples/coordinates/window.cc b/examples/coordinates/window.cc
index 241df03..bec4856 100644
--- a/examples/coordinates/window.cc
+++ b/examples/coordinates/window.cc
@@ -23,8 +23,8 @@ ExampleWindow::ExampleWindow()
   m_button_box(false, 6),
   m_label_origin("origin (0, 0)"),
   m_button_translate("translate(20, 20)"),
-  m_button_setxy("set x=50,y=50)"),
-  m_button_scale("scale(1.2, 1.2)")
+  m_button_scale("scale(1.2, 1.2)"),
+  m_button_setxy("set x=50,y=50)")
 {
   set_title("goocanvasmm Example");
 
diff --git a/examples/custom_item/exampleitem.cc b/examples/custom_item/exampleitem.cc
index aca0a48..031d8c7 100644
--- a/examples/custom_item/exampleitem.cc
+++ b/examples/custom_item/exampleitem.cc
@@ -25,7 +25,7 @@ ExampleItem::ExampleItem(double x, double y, double width, double height)
 
 Glib::RefPtr<ExampleItem> ExampleItem::create(double x, double y, double width, double height)
 {
-  return Glib::RefPtr<ExampleItem>(new ExampleItem());
+  return Glib::RefPtr<ExampleItem>(new ExampleItem(x, y, width, height));
 }
 
 /* The update method. This is called when the canvas is initially shown and
diff --git a/examples/demo/primitives.cc b/examples/demo/primitives.cc
index 7d49a30..0dd0e34 100644
--- a/examples/demo/primitives.cc
+++ b/examples/demo/primitives.cc
@@ -60,26 +60,26 @@ Primitives::getWidget()
 }
 
 bool
-Primitives::_on_background_button_press(const Glib::RefPtr<Goocanvas::Item>& item, GdkEventButton* ev)
+Primitives::_on_background_button_press(const Glib::RefPtr<Goocanvas::Item>& /* item */, GdkEventButton* /* ev */)
 {
   return false;
 }
 
 bool
-Primitives::_on_button_press(const Glib::RefPtr<Goocanvas::Item>& item, GdkEventButton* ev)
+Primitives::_on_button_press(const Glib::RefPtr<Goocanvas::Item>& /* item */, GdkEventButton* /* ev */)
 {
   std::cerr << "Clicked!" << std::endl ;
   return false;
 }
 
 bool
-Primitives::_on_button_release(const Glib::RefPtr<Goocanvas::Item>& item, GdkEventButton* ev)
+Primitives::_on_button_release(const Glib::RefPtr<Goocanvas::Item>& /* item */, GdkEventButton* /* ev */)
 {
   return false;
 }
 
 bool
-Primitives::_on_motion_notify(const Glib::RefPtr<Goocanvas::Item>& item, GdkEventMotion* ev)
+Primitives::_on_motion_notify(const Glib::RefPtr<Goocanvas::Item>& /* item */, GdkEventMotion* /* ev */)
 {
   return false;
 }
@@ -298,12 +298,12 @@ Primitives::_setup_ellipses()
 void
 Primitives::_setup_texts()
 {
-  Glib::RefPtr<Goocanvas::Text> text ;
-        Glib::RefPtr<Goocanvas::Item> anchor;
-
-  anchor = _create_anchor(420, 20);
-  text = Goocanvas::Text::create("Anchor NW", 0, 0, -1, Goocanvas::ANCHOR_NW);
+  Glib::RefPtr<Goocanvas::Item> anchor
+    = _create_anchor(420, 20);
+  Glib::RefPtr<Goocanvas::Text> text
+    = Goocanvas::Text::create("Anchor NW", 0, 0, -1, Goocanvas::ANCHOR_NW);
   anchor->add_child(text);
+
   //ellipse->property_fill_pattern() = _create_stipple("blue");
   Cairo::RefPtr<Cairo::Pattern> p = _create_stipple("blue");
   g_object_set(text->gobj(), "fill-pattern", p->cobj(), NULL);
@@ -509,8 +509,9 @@ Primitives::_create_anchor(double x, double y)
   return group ;
 }
 
+//TODO: What is this anchor parameter for?
 void
-Primitives::_create_flower(double x, double y, Goocanvas::AnchorType anchor)
+Primitives::_create_flower(double x, double y, Goocanvas::AnchorType /* anchor */)
 {
   Cairo::RefPtr<Cairo::ImageSurface> surface ;
 
@@ -525,8 +526,8 @@ Primitives::_create_flower(double x, double y, Goocanvas::AnchorType anchor)
     return ;
   }
 
-  double w = surface->get_width();
-  double h = surface->get_height();
+  const double w = surface->get_width();
+  const double h = surface->get_height();
 
   Cairo::RefPtr<Cairo::SurfacePattern> pattern = Cairo::SurfacePattern::create(surface);
 
diff --git a/examples/drag_to_canvas/examplewindow.cc b/examples/drag_to_canvas/examplewindow.cc
index f78d13b..f696dad 100644
--- a/examples/drag_to_canvas/examplewindow.cc
+++ b/examples/drag_to_canvas/examplewindow.cc
@@ -85,7 +85,7 @@ void ExampleWindow::make_widget_draggable(Gtk::Widget& widget, DragItem drag_ite
     sigc::bind( sigc::mem_fun(*this, &ExampleWindow::on_button_drag_data_get), drag_item) );
 }
 
-bool ExampleWindow::on_canvas_drag_drop(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, guint timestamp)
+bool ExampleWindow::on_canvas_drag_drop(const Glib::RefPtr<Gdk::DragContext>& drag_context, int /* x */, int /* y */, guint timestamp)
 {
   std::cout << "ExampleWindow::on_canvas_drag_drop" << std::endl;
   Glib::ustring target = m_canvas.drag_dest_find_target(drag_context);
@@ -152,7 +152,7 @@ ExampleWindow::DragItem ExampleWindow::get_drag_item_from_selection_data(const G
   return item_type;
 }
 
-void ExampleWindow::on_canvas_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, const Gtk::SelectionData& selection_data, guint info, guint timestamp)
+void ExampleWindow::on_canvas_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& drag_context, int x, int y, const Gtk::SelectionData& selection_data, guint /* info */, guint timestamp)
 {
   std::cout << "ExampleWindow::on_canvas_drag_data_received" << std::endl;
 
@@ -173,7 +173,7 @@ void ExampleWindow::on_canvas_drag_data_received(const Glib::RefPtr<Gdk::DragCon
     if(m_layout_item_dropping)
       m_layout_item_dropping->remove();
 
-    m_layout_item_dropping.clear();
+    m_layout_item_dropping.reset();
     create_canvas_item(drag_item, x, y);
   }
   
@@ -191,7 +191,7 @@ void ExampleWindow::on_canvas_drag_data_received(const Glib::RefPtr<Gdk::DragCon
   }
 }
 
-void ExampleWindow::on_button_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& drag_context, Gtk::SelectionData& selection_data, guint info, guint time, DragItem drag_item)
+void ExampleWindow::on_button_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& /* drag_context */, Gtk::SelectionData& selection_data, guint /* info */, guint /* time */, DragItem drag_item)
 {
   std::cout << "ExampleWindow::on_button_drag_data_get" << std::endl;
   
diff --git a/examples/moving_shapes/window.cc b/examples/moving_shapes/window.cc
index e2a6d7a..194dfe4 100644
--- a/examples/moving_shapes/window.cc
+++ b/examples/moving_shapes/window.cc
@@ -15,9 +15,9 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <goocanvasrect.h>
 #include <iostream>
 #include "window.h"
+#include <goocanvasrect.h>
 
 Window::Window()
 {
@@ -73,10 +73,11 @@ Window::Window()
 }
 
 void
-Window::on_item_created(const Glib::RefPtr<Goocanvas::Item>& item, const Glib::RefPtr<Goocanvas::ItemModel>& model)
+Window::on_item_created(const Glib::RefPtr<Goocanvas::Item>& item, const Glib::RefPtr<Goocanvas::ItemModel>& /* model */)
 {
   Glib::RefPtr<Goocanvas::Group> group = Glib::RefPtr<Goocanvas::Group>::cast_dynamic(item);
-  if(group) return ;
+  if(group)
+    return ;
 
   item->signal_button_press_event().connect(sigc::mem_fun(*this, &Window::on_item_button_press_event));
   item->signal_button_release_event().connect(sigc::mem_fun(*this, &Window::on_item_button_release_event));
@@ -96,11 +97,11 @@ Window::on_item_button_press_event(const Glib::RefPtr<Goocanvas::Item>& item, Gd
 }
 
 bool
-Window::on_item_button_release_event(const Glib::RefPtr<Goocanvas::Item>& item, GdkEventButton* event)
+Window::on_item_button_release_event(const Glib::RefPtr<Goocanvas::Item>& /* item */, GdkEventButton* event)
 {
   if(event->button == 1)
   {
-    _dragging.clear();
+    _dragging.reset();
   }
   return false;
 }
diff --git a/examples/simple/examplewindow.cc b/examples/simple/examplewindow.cc
index afa24b8..01dfa6b 100644
--- a/examples/simple/examplewindow.cc
+++ b/examples/simple/examplewindow.cc
@@ -63,7 +63,7 @@ ExampleWindow::ExampleWindow()
 }
 
 bool
-ExampleWindow::on_rect_button_press(const Glib::RefPtr<Goocanvas::Item>& item, GdkEventButton* event)
+ExampleWindow::on_rect_button_press(const Glib::RefPtr<Goocanvas::Item>& /* item */, GdkEventButton* /* event */)
 {
   std::cout << "You clicked the rectangle." << std::endl ;
   return true ;
diff --git a/examples/table/examplewindow.cc b/examples/table/examplewindow.cc
index dc80d2b..ce2bae5 100644
--- a/examples/table/examplewindow.cc
+++ b/examples/table/examplewindow.cc
@@ -67,7 +67,7 @@ void ExampleWindow::add_text_to_cell(const Glib::RefPtr<Goocanvas::Table>& table
 }
 
 bool
-ExampleWindow::on_rect_button_press(const Glib::RefPtr<Goocanvas::Item>& item, GdkEventButton* event)
+ExampleWindow::on_rect_button_press(const Glib::RefPtr<Goocanvas::Item>& /* item */, GdkEventButton* /* event */)
 {
   std::cout << "You clicked the rectangle!" << std::endl ;
   return true ;
diff --git a/examples/text/window.cc b/examples/text/window.cc
index cb61511..e864077 100644
--- a/examples/text/window.cc
+++ b/examples/text/window.cc
@@ -24,8 +24,8 @@ ExampleWindow::ExampleWindow()
   m_button_box2(false, 6),
   m_label_origin("origin (0, 0)"),
   m_button_translate("translate(20, 20)"),
-  m_button_setxy("set x=50,y=50)"),
   m_button_scale("scale(1.2, 1.2)"),
+  m_button_setxy("set x=50,y=50)"),
   m_button_zoom("scale (zoom) canvas"),
   m_button_set_width("set width=40"),
   m_button_set_width_unlimited("set width=-1 (unlimited)")
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 61610b1..dbca8bf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/examples/Makefile.am_fragment
 AUTOMAKE_OPTIONS = subdir-objects
 
 AM_CPPFLAGS = -I$(top_builddir) $(GOOCANVASMM_CFLAGS)
-AM_CXXFLAGS = $(GOOCANSASMM_WXXFLAGS)
+AM_CXXFLAGS = $(GOOCANVASMM_WXXFLAGS)
 LDADD       = $(GOOCANVASMM_LIBS)
 
 check_PROGRAMS = \



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