[cairo-commit] cairo-demo/cairo-in-motion BUGS, 1.1, 1.2 ChangeLog, 1.1, 1.2 Makefile, 1.1, 1.2 NEWS, 1.1, 1.2 README, 1.1, 1.2 TODO, 1.1, 1.2 cairo-in-motion.glade, 1.1, 1.2 cairo-samples.cpp, 1.1, 1.2 cairo-samples.h, 1.1, 1.2 main.cpp, 1.1, 1.2

commit at pdx.freedesktop.org commit at pdx.freedesktop.org
Sat Dec 10 06:03:35 PST 2005


Committed by: macslow

Update of /cvs/cairo/cairo-demo/cairo-in-motion
In directory gabe:/tmp/cvs-serv5355

Modified Files:
	BUGS ChangeLog Makefile NEWS README TODO cairo-in-motion.glade 
	cairo-samples.cpp cairo-samples.h main.cpp 
Log Message:
Added two new cairo-hacks/samples, made cairo-in-motion use cairomm-0.2.0
and added a slider controlling the "smoothness" (read: updates per second)
of the animation


Index: BUGS
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/BUGS,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- BUGS	30 Sep 2005 10:04:11 -0000	1.1
+++ BUGS	10 Dec 2005 14:03:33 -0000	1.2
@@ -1,3 +1,11 @@
+cairo-samples.cpp: everything dealing with PNG-images doesn't work yet, because
+I moved all cairo-related things to use the new C++-bindings of cairomm-0.2.0,
+therefore I disabled the execution of the cairo-samples/hacks:
+
+	image
+	image_pattern
+	moving_clip_image
+
 main.cpp: on_font_set() doesn't handle all font-attributes (slant, weight)
 that can be found under the sun, it's just a quick hack to get some font-
 -attributes over to CairoSamples

Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ChangeLog	30 Sep 2005 10:04:11 -0000	1.1
+++ ChangeLog	10 Dec 2005 14:03:33 -0000	1.2
@@ -1,4 +1,14 @@
+2005-12-08 Mirco Mueller <macslow at bangang.de>
+
+	I changed the class CairoSamples to use the 0.2.0 version of
+	Murray Cummings newly released C++-bindings "cairomm". Futhermore
+	I added two new samples that are derived from some experiments
+	I did with the <canvas>-object and JavaScript. See the relating
+	blog-entry on my homepage here: http://macslow.mine.nu/?p=25.
+	It's nice to see the similarities of the cairo-API and the
+	JavaScript-API for utilizing the <canvas>-object.
+
 2005-09-30 Mirco Mueller <macslow at bangang.de>
 
 	Made the initial release on my blog at http://macslow.mine.nu and checked
-	it in at cvs.cairographics.org (/cvs/cairo/cairo-demo/cairo-in-motion)
\ No newline at end of file
+	it in at cvs.cairographics.org (/cvs/cairo/cairo-demo/cairo-in-motion)

Index: Makefile
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile	30 Sep 2005 10:04:11 -0000	1.1
+++ Makefile	10 Dec 2005 14:03:33 -0000	1.2
@@ -1,9 +1,10 @@
 APP=cairo-in-motion
 CC=c++
 
-CFLAGS= -Wall -Os `pkg-config --cflags libsvg-cairo gtkmm-2.4 libglademm-2.4`
+#CFLAGS= -Wall -Os `pkg-config --cflags cairomm-1.0 libsvg-cairo gtkmm-2.4 libglademm-2.4`
+CFLAGS= -Wall -g2 `pkg-config --cflags cairomm-1.0 libsvg-cairo gtkmm-2.4 libglademm-2.4`
 
-LDFLAGS=	`pkg-config --libs libsvg-cairo gtkmm-2.4 libglademm-2.4`
+LDFLAGS=	`pkg-config --libs cairomm-1.0 libsvg-cairo gtkmm-2.4 libglademm-2.4`
 
 SRC = main.cpp \
 	  cairo-samples.cpp \
@@ -15,7 +16,7 @@
 
 $(APP):  $(OBJ)
 	$(CC) $(LDFLAGS) $(OBJ) -o $(APP)
-	strip $(APP)
+	#strip $(APP)
 
 .cpp.o:
 	$(CC) $(CFLAGS) -c $< -o $@

Index: NEWS
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/NEWS,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- NEWS	30 Sep 2005 10:04:11 -0000	1.1
+++ NEWS	10 Dec 2005 14:03:33 -0000	1.2
@@ -0,0 +1,5 @@
+I added two new cairo-hacks to the list of available samples. Check out:
+
+	clock
+	moving_zini
+

Index: README
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/README,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- README	30 Sep 2005 10:04:11 -0000	1.1
+++ README	10 Dec 2005 14:03:33 -0000	1.2
@@ -38,8 +38,9 @@
 	cairo 1.1.1 (grabbed as HEAD from cairographics.org-CVS)
 	libsvg 0.1.4 (grabbed as HEAD from cairographics.org-CVS)
 	libsvg-cairo 0.1.6 (grabbed as HEAD from cairographics.org-CVS)
-	gtk+ 2.8.3
+	gtk+ 2.8.8
 	gtkmm 2.8.0
+	cairomm 0.1.0
 	libglade 2.5.1
 	libglademm 2.6.1
 
@@ -56,4 +57,4 @@
 
 Best regards...
 
-MacSlow
\ No newline at end of file
+MacSlow

Index: TODO
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/TODO,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- TODO	30 Sep 2005 10:04:11 -0000	1.1
+++ TODO	10 Dec 2005 14:03:33 -0000	1.2
@@ -1,3 +1,6 @@
+finish the cairomm-related use of dealing with PNG-images (image, image_pattern,
+moving_clip_image)
+
 support for glitz-surfaces would be nice, so one can switch between "normal" and
 glitz-surfaces at runtime to see the impact on performance
 

Index: cairo-in-motion.glade
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/cairo-in-motion.glade,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-in-motion.glade	30 Sep 2005 10:04:11 -0000	1.1
+++ cairo-in-motion.glade	10 Dec 2005 14:03:33 -0000	1.2
@@ -122,7 +122,7 @@
 			    <widget class="GtkTable" id="controlsTable">
 			      <property name="border_width">5</property>
 			      <property name="visible">True</property>
-			      <property name="n_rows">13</property>
+			      <property name="n_rows">14</property>
 			      <property name="n_columns">2</property>
 			      <property name="homogeneous">False</property>
 			      <property name="row_spacing">5</property>
@@ -737,6 +737,55 @@
 				  <property name="y_options">fill</property>
 				</packing>
 			      </child>
+
+			      <child>
+				<widget class="GtkLabel" id="animSmoothnessLabel">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">Anim. Smoothness:</property>
+				  <property name="use_underline">False</property>
+				  <property name="use_markup">False</property>
+				  <property name="justify">GTK_JUSTIFY_LEFT</property>
+				  <property name="wrap">False</property>
+				  <property name="selectable">False</property>
+				  <property name="xalign">0</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
+				</widget>
+				<packing>
+				  <property name="left_attach">0</property>
+				  <property name="right_attach">1</property>
+				  <property name="top_attach">13</property>
+				  <property name="bottom_attach">14</property>
+				  <property name="x_options">fill</property>
+				  <property name="y_options"></property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkHScale" id="animSmoothnessHScale">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="draw_value">True</property>
+				  <property name="value_pos">GTK_POS_RIGHT</property>
+				  <property name="digits">1</property>
+				  <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+				  <property name="inverted">False</property>
+				  <property name="adjustment">25 10 250 1 0 0</property>
+				</widget>
+				<packing>
+				  <property name="left_attach">1</property>
+				  <property name="right_attach">2</property>
+				  <property name="top_attach">13</property>
+				  <property name="bottom_attach">14</property>
+				  <property name="x_options">fill</property>
+				  <property name="y_options">fill</property>
+				</packing>
+			      </child>
 			    </widget>
 			  </child>
 			</widget>

Index: cairo-samples.cpp
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/cairo-samples.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-samples.cpp	30 Sep 2005 10:04:11 -0000	1.1
+++ cairo-samples.cpp	10 Dec 2005 14:03:33 -0000	1.2
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <iostream>
 #include <svg-cairo.h>
+#include <sys/time.h>
 
 #include "cairo-samples.h"
 
@@ -57,6 +58,8 @@
 	Entry* pEntry = new Entry;
 	pEntry->name = "curve_rectangle";
 	m_sampleList.push_back (*pEntry);
[...2372 lines suppressed...]
+	m_pCairoContext->line_to (0.7f, 0.3f);
 
-	cairo_line_to (m_pCairoContext, 0.5f, 0.3f);
-	cairo_line_to (m_pCairoContext, 0.5f, 0.7f);
+	m_pCairoContext->line_to (0.5f, 0.3f);
+	m_pCairoContext->line_to (0.5f, 0.7f);
 
-	cairo_set_line_width (m_pCairoContext, m_fLineWidth);
-	cairo_set_line_cap  (m_pCairoContext, m_cairoCapStyle);
-	cairo_set_line_join  (m_pCairoContext, m_cairoJoinStyle);
-	cairo_set_source_rgb (m_pCairoContext, 0.0f, 0.0f, 0.0f);
-	cairo_stroke (m_pCairoContext);
+	m_pCairoContext->set_line_width (m_fLineWidth);
+	m_pCairoContext->set_line_cap (m_cairoCapStyle);
+	m_pCairoContext->set_line_join (m_cairoJoinStyle);
+	m_pCairoContext->set_source_rgb (0.0f, 0.0f, 0.0f);
+	m_pCairoContext->stroke ();
        
 	return true;
 }

Index: cairo-samples.h
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/cairo-samples.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-samples.h	30 Sep 2005 10:04:11 -0000	1.1
+++ cairo-samples.h	10 Dec 2005 14:03:33 -0000	1.2
@@ -20,7 +20,7 @@
 #ifndef _CAIROSAMPLES_H_
 #define _CAIROSAMPLES_H_
 
-#include <cairo.h>
+#include <cairomm/cairomm.h>
 #include <string>
 #include <gdkmm.h>
 
@@ -46,6 +46,7 @@
 		enum Sample
 		{
 			CurveRectangle = 0,
+			Clock,
 			FillAndStroke,
 			FillAndStroke2,
 			Fontmania,
@@ -61,6 +62,7 @@
 			MovingCurveTo,
 			MovingGradient,
 			MovingGradient2,
+			MovingZini,
 			OperatorAdd,
 			OperatorAtop,
 			OperatorAtopReverse,
@@ -96,28 +98,28 @@
 			DashedFunky
 		};
 
-		void do_animation_step ();
-		void set_context (cairo_t* pCairoContext);
+		void do_animation_step (unsigned long ulMilliSeconds);
+		void set_context (Cairo::Context* pCairoContext);
 		void normalize_canvas (double fWidth, double fHeight) const;
-		void set_bg_svg (std::string strSVGFileName) const;
-		bool do_sample (Sample sample) const;
-		void set_cap_style (cairo_line_cap_t cairoCapStyle);
-		void set_join_style (cairo_line_join_t cairoJoinStyle);
+		void set_bg_svg (std::string strSVGFileName);
+		bool do_sample (Sample sample);
+		void set_cap_style (Cairo::LineCap cairoCapStyle);
+		void set_join_style (Cairo::LineJoin cairoJoinStyle);
 		void set_dash_style (DashStyle dashStyle);
-		void set_operator (cairo_operator_t cairoOperator);
-		void set_extend_mode (cairo_extend_t cairoExtendMode);
-		void set_filter_mode (cairo_filter_t cairoFilterMode);
+		void set_operator (Cairo::Operator cairoOperator);
+		void set_extend_mode (Cairo::Extend cairoExtendMode);
+		void set_filter_mode (Cairo::Filter cairoFilterMode);
 		void set_line_width (double fLineWidth);
 		void set_bg_color (Gdk::Color bgColor);
 		void set_font_family (std::string strFontFamily);
 		void set_font_size (double fFontSize);
-		void set_font_weight (cairo_font_weight_t cairoFontWeight);
-		void set_font_slant (cairo_font_slant_t cairoFontSlant);
+		void set_font_weight (Cairo::FontWeight cairoFontWeight);
+		void set_font_slant (Cairo::FontSlant cairoFontSlant);
 		void set_some_text (std::string strSomeText);
 		void set_image_file_name (std::string strFileName);
 		void set_svg_file_name (std::string strFileName);
 		void add_samples_to_list_store (SampleListStore* pSampleListStore);
-		std::string get_sample_name (Sample sample) const;
+		std::string get_sample_name (Sample sample);
 
 	private:
 		void update_var (double* pfValue,
@@ -126,58 +128,60 @@
 						 double* pfStep,
 						 double fGrow,
 						 double fShrink);
-		HandlePoint get_center () const;
-		HandlePoint get_point1 () const;
-		HandlePoint get_point2 () const;
-		HandlePoint get_point3 () const;
-		HandlePoint get_point4 () const;
-		double get_radius () const;
-		double get_angle_1 () const;
-		double get_angle_2 () const;
-		void draw_background () const;
-		void draw_background (Gdk::Color color) const;
-		void draw_handle (double fX, double fY) const;
-		void draw_handle (HandlePoint* pPoint) const;
-		bool sample_not_found () const;
-		bool curve_rectangle () const;
-		bool fill_and_stroke () const;
-		bool fill_and_stroke2 () const;
-		bool fontmania () const;
-		bool gradient () const;
-		bool image () const;
-		bool image_pattern () const;
-		bool libsvg () const;
-		bool moving_arc () const;
-		bool moving_arc_negative () const;
-		bool moving_cairo_logo () const;
-		bool moving_clip () const;
-		bool moving_clip_image () const;
-		bool moving_curve_to () const;
-		bool moving_gradient () const;
-		bool moving_gradient2 () const;
-		bool operator_add () const;
-		bool operator_atop () const;
-		bool operator_atop_reverse () const;
-		bool operator_in () const;
-		bool operator_in_reverse () const;
-		bool operator_out () const;
-		bool operator_out_reverse () const;
-		bool operator_over () const;
-		bool operator_over_reverse () const;
-		bool operator_saturate () const;
-		bool operator_xor () const;
-		bool path () const;
-		bool pattern_fill () const;
-		bool set_line_cap () const;
-		bool set_line_join () const;
-		bool text_align_center () const;
-		bool text () const;
-		bool text_extents () const;
-		bool xxx_clip_rectangle () const;
-		bool xxx_dash () const;
-		bool xxx_long_lines () const;
-		bool xxx_multi_segment_caps () const;
-		bool xxx_self_intersect () const;
+		HandlePoint get_center ();
+		HandlePoint get_point1 ();
+		HandlePoint get_point2 ();
+		HandlePoint get_point3 ();
+		HandlePoint get_point4 ();
+		double get_radius ();
+		double get_angle_1 ();
+		double get_angle_2 ();
+		void draw_background ();
+		void draw_background (Gdk::Color color);
+		void draw_handle (double fX, double fY);
+		void draw_handle (HandlePoint* pPoint);
+		bool sample_fallback (std::string strMessage);
+		bool curve_rectangle ();
+		bool clock ();
+		bool fill_and_stroke ();
+		bool fill_and_stroke2 ();
+		bool fontmania ();
+		bool gradient ();
+		bool image ();
+		bool image_pattern ();
+		bool libsvg ();
+		bool moving_arc ();
+		bool moving_arc_negative ();
+		bool moving_cairo_logo ();
+		bool moving_clip ();
+		bool moving_clip_image ();
+		bool moving_curve_to ();
+		bool moving_gradient ();
+		bool moving_gradient2 ();
+		bool moving_zini ();
+		bool operator_add ();
+		bool operator_atop ();
+		bool operator_atop_reverse ();
+		bool operator_in ();
+		bool operator_in_reverse ();
+		bool operator_out ();
+		bool operator_out_reverse ();
+		bool operator_over ();
+		bool operator_over_reverse ();
+		bool operator_saturate ();
+		bool operator_xor ();
+		bool path ();
+		bool pattern_fill ();
+		bool set_line_cap ();
+		bool set_line_join ();
+		bool text_align_center ();
+		bool text ();
+		bool text_extents ();
+		bool xxx_clip_rectangle ();
+		bool xxx_dash ();
+		bool xxx_long_lines ();
+		bool xxx_multi_segment_caps ();
+		bool xxx_self_intersect ();
 
 	protected:
 		HandlePoint			m_center;
@@ -201,23 +205,24 @@
 		double				m_fRadiusStep;
 		double				m_fAngle1Step;
 		double				m_fAngle2Step;
-		cairo_t*			m_pCairoContext;
-		cairo_line_cap_t	m_cairoCapStyle;
-		cairo_line_join_t	m_cairoJoinStyle;
+		Cairo::Context*		m_pCairoContext;
+		Cairo::LineCap		m_cairoCapStyle;
+		Cairo::LineJoin		m_cairoJoinStyle;
 		DashStyle			m_dashStyle;
-		cairo_operator_t	m_cairoOperator;
-		cairo_extend_t		m_cairoExtendMode;
-		cairo_filter_t		m_cairoFilterMode;
+		Cairo::Operator		m_cairoOperator;
+		Cairo::Extend		m_cairoExtendMode;
+		Cairo::Filter		m_cairoFilterMode;
 		double				m_fLineWidth;
 		Gdk::Color			m_bgColor;
 		std::string			m_strFontFamily;
 		double				m_fFontSize;
-		cairo_font_weight_t	m_cairoFontWeight;
-		cairo_font_slant_t	m_cairoFontSlant;
+		Cairo::FontWeight	m_cairoFontWeight;
+		Cairo::FontSlant	m_cairoFontSlant;
 		std::string			m_strSomeText;
 		std::string			m_strImageFileName;
 		std::string			m_strSvgFileName;
 		std::vector<Entry>	m_sampleList;
+		unsigned long		m_ulMilliSeconds;
 };
 
 #endif /*_CAIROSAMPLES_H_*/

Index: main.cpp
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo-in-motion/main.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- main.cpp	30 Sep 2005 10:04:11 -0000	1.1
+++ main.cpp	10 Dec 2005 14:03:33 -0000	1.2
@@ -45,22 +45,23 @@
 Gtk::Entry* pTextEntry = NULL;
 Gtk::FileChooserButton* pImageFileFileChooserButton = NULL;
 Gtk::FileChooserButton* pSvgFileFileChooserButton = NULL;
+Gtk::HScale* pAnimSmoothnessHScale = NULL;
 
 // those here are just used to give some proper default values to everything
 // later during runtime most of those here aren't touch anymore... rather the
 // values are directly passed to the class CairoSamples
-cairo_line_cap_t m_capStyle = CAIRO_LINE_CAP_ROUND;
-cairo_line_join_t m_joinStyle = CAIRO_LINE_JOIN_ROUND;
+Cairo::LineCap m_capStyle = CAIRO_LINE_CAP_ROUND;
+Cairo::LineJoin m_joinStyle = CAIRO_LINE_JOIN_ROUND;
 CairoSamples::DashStyle m_dashStyle = CairoSamples::DashOff;
-cairo_operator_t m_operator = CAIRO_OPERATOR_CLEAR;
-cairo_extend_t m_extendMode = CAIRO_EXTEND_REPEAT;
-cairo_filter_t m_filterMode = CAIRO_FILTER_GOOD;
+Cairo::Operator m_operator = CAIRO_OPERATOR_CLEAR;
+Cairo::Extend m_extendMode = CAIRO_EXTEND_REPEAT;
+Cairo::Filter m_filterMode = CAIRO_FILTER_GOOD;
 double m_fLineWidth = 0.01f;
 Gdk::Color m_bgColor ("#B0B0B0");
 std::string m_strFontFamily = "Sans";
 int m_iFontSize = 35;
-cairo_font_weight_t m_fontWeight = CAIRO_FONT_WEIGHT_NORMAL;
-cairo_font_slant_t m_fontSlant = CAIRO_FONT_SLANT_NORMAL;
+Cairo::FontWeight m_fontWeight = CAIRO_FONT_WEIGHT_NORMAL;
+Cairo::FontSlant m_fontSlant = CAIRO_FONT_SLANT_NORMAL;
 std::string m_strImageFileName = "/home/mirco/workspace/cairo-in-motion/gotroot.png";
 std::string m_strSvgFileName = "/home/mirco/workspace/cairo-in-motion/freedesktop.svg";
 std::string m_strSomeText = "laber";
@@ -68,11 +69,13 @@
 // additional stuff we need/use for the cairo-drawing
 Gdk::Window* m_pGdkWindow = NULL;
 bool m_bAnimate = true;
-cairo_t* m_pCairoContext = NULL;
+Cairo::Context* m_pCairoContext = NULL;
 CairoSamples* m_pCairoSamples = NULL;
 SampleListStore* m_pSampleListStore = NULL;
-int m_iSample = 10;
+int m_iSample = 17;
+int m_iAnimSmoothness = 25;
 sigc::connection timeoutHandlerConnection;
+Glib::Timer timer;
 
 void on_quit_menu_item ()
 {
@@ -349,7 +352,10 @@
 
 bool on_timeout ()
 {
-	m_pCairoSamples->do_animation_step ();
+	static unsigned long ulMicroSeconds;
+
+	timer.elapsed (ulMicroSeconds);
+	m_pCairoSamples->do_animation_step (ulMicroSeconds/1000);
 
 	// force a redraw of the cairo-context
 	pMainDrawingArea->queue_draw ();
@@ -357,11 +363,29 @@
 	return true;
 }
 
+void on_anim_smoothness_changed ()
+{
+	m_iAnimSmoothness = (int) pAnimSmoothnessHScale->get_value ();
+
+	std::stringstream message;
+	message << "animation smoothness changed to " << pAnimSmoothnessHScale->get_value ();
+	pMainStatusBar->push (message.str ());
+
+	if (m_bAnimate)
+	{
+		timeoutHandlerConnection.disconnect ();
+		timeoutHandlerConnection = Glib::signal_timeout().connect (sigc::ptr_fun(&on_timeout), m_iAnimSmoothness);
+	}
+
+	// force a redraw of the cairo-context
+	pMainDrawingArea->queue_draw ();
+}
+
 void on_animate_toggled ()
 {
 	if (pAnimateToggleButton->get_active ())
 	{
-		timeoutHandlerConnection = Glib::signal_timeout().connect (sigc::ptr_fun(&on_timeout), 100);
+		timeoutHandlerConnection = Glib::signal_timeout().connect (sigc::ptr_fun(&on_timeout), m_iAnimSmoothness);
 		m_bAnimate = true;
 		pMainStatusBar->push ("animation is turned on");
 	}
@@ -394,14 +418,14 @@
 
 bool on_expose_event (GdkEventExpose* pEvent)
 {
-	m_pCairoContext = gdk_cairo_create (pMainDrawingArea->get_window()->gobj ());
+	m_pCairoContext = new Cairo::Context (gdk_cairo_create (pMainDrawingArea->get_window()->gobj ()));
 	if (m_pCairoContext)
 	{
 		m_pCairoSamples->set_context (m_pCairoContext);
 		m_pCairoSamples->normalize_canvas ((double) pMainDrawingArea->get_allocation().get_width (),
 										   (double) pMainDrawingArea->get_allocation().get_height ());
 		m_pCairoSamples->do_sample ((CairoSamples::Sample) m_iSample);
-		cairo_destroy (m_pCairoContext);
+		delete m_pCairoContext;
 	}
 
 	return true;
@@ -641,7 +665,7 @@
 		refXml->get_widget ("animateToggleButton", pAnimateToggleButton);
 		if (pAnimateToggleButton)
 		{
-			timeoutHandlerConnection = Glib::signal_timeout().connect(sigc::ptr_fun (&on_timeout), 100);
+			timeoutHandlerConnection = Glib::signal_timeout().connect(sigc::ptr_fun (&on_timeout), m_iAnimSmoothness);
 
 			if (!m_bAnimate)
 				timeoutHandlerConnection.disconnect ();
@@ -759,6 +783,13 @@
 			pSvgFileFileChooserButton->signal_selection_changed ().connect (sigc::ptr_fun (on_svg_selection_changed));
 		}
 
+		refXml->get_widget ("animSmoothnessHScale", pAnimSmoothnessHScale);
+		if (pAnimSmoothnessHScale)
+		{
+			pAnimSmoothnessHScale->set_value (m_iAnimSmoothness);
+			pAnimSmoothnessHScale->signal_value_changed().connect (sigc::ptr_fun (on_anim_smoothness_changed));
+		}
+
 		refXml->get_widget ("textEntry", pTextEntry);
 		if (pTextEntry)
 		{
@@ -766,9 +797,10 @@
 			pTextEntry->signal_activate().connect (sigc::ptr_fun (on_text_entry_activated));
 		}
 
+		timer.start ();
 		app.run (*pMainWindow);
+		timer.stop ();
 	}
 
-
 	return 0;
 }



More information about the cairo-commit mailing list