[gtkmm] Remove duplicate image files for pixbuf-demo
- From: Daniel Elstner <daniel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtkmm] Remove duplicate image files for pixbuf-demo
- Date: Wed, 12 Aug 2009 23:22:26 +0000 (UTC)
commit 27b14fbf221b787414d451a83a0375b325219546
Author: Daniel Elstner <daniel kitta gmail com>
Date: Thu Aug 13 01:19:26 2009 +0200
Remove duplicate image files for pixbuf-demo
* demos/pixbuf-demo.cc: Clean up a few minor things.
(background_name), (image_names): Prefix "gtk-demo/" to the file
names so that it can pick up the files from the subdirectory.
* demos/Makefile.am (dist_democode_DATA): Split into two variables
$(democode_DATA) and $(dist_democode_DATA) to avoid copying source
code files twice into the distribution.
* demos/background.jpg, demos/*.png: Delete duplicate image files.
.gitignore | 4 +--
ChangeLog | 12 +++++++++
demos/Makefile.am | 7 ++---
demos/apple-red.png | Bin 3545 -> 0 bytes
demos/background.jpg | Bin 22219 -> 0 bytes
demos/gnome-applets.png | Bin 3090 -> 0 bytes
demos/gnome-calendar.png | Bin 2755 -> 0 bytes
demos/gnome-foot.png | Bin 2916 -> 0 bytes
demos/gnome-gimp.png | Bin 3410 -> 0 bytes
demos/gnome-gmush.png | Bin 3244 -> 0 bytes
demos/gnome-gsame.png | Bin 4263 -> 0 bytes
demos/gnu-keys.png | Bin 3852 -> 0 bytes
demos/pixbuf-demo.cc | 57 ++++++++++++++++++++-------------------------
13 files changed, 41 insertions(+), 39 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 06e7b9a..ac02c62 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,9 +9,6 @@ Makefile.in
.dirstamp
stamp-h?
-# generated private headers
-/*/*mm/private/*_p.h
-
# /
/aclocal.m4
/INSTALL
@@ -22,6 +19,7 @@ stamp-h?
/config.status
/configure
/configure.lineno
+/gtkmm-*.tar.*
/libtool
# MSVC
diff --git a/ChangeLog b/ChangeLog
index c7a0a65..66aa3fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-08-12 Daniel Elstner <daniel kitta gmail com>
+
+ Remove duplicate image files for pixbuf-demo
+
+ * demos/pixbuf-demo.cc: Clean up a few minor things.
+ (background_name), (image_names): Prefix "gtk-demo/" to the file
+ names so that it can pick up the files from the subdirectory.
+ * demos/Makefile.am (dist_democode_DATA): Split into two variables
+ $(democode_DATA) and $(dist_democode_DATA) to avoid copying source
+ code files twice into the distribution.
+ * demos/background.jpg, demos/*.png: Delete duplicate image files.
+
2009-08-12 Daniel Elstner <danielk openismus com>
Bring back demos/ and make it non-recursive
diff --git a/demos/Makefile.am b/demos/Makefile.am
index 21e0020..da9c735 100644
--- a/demos/Makefile.am
+++ b/demos/Makefile.am
@@ -49,7 +49,9 @@ gtk_demo_gtkmm_demo_SOURCES = \
gtk-demo/textwidget.cc \
gtk-demo/textwidget.h
-image_files = \
+democodedir = $(datadir)/$(GTKMM_MODULE_NAME)/demo
+democode_DATA = $(gtk_demo_gtkmm_demo_SOURCES)
+dist_democode_DATA = \
gtk-demo/alphatest.png \
gtk-demo/apple-red.png \
gtk-demo/background.jpg \
@@ -65,9 +67,6 @@ image_files = \
gtk-demo/gnu-keys.png \
gtk-demo/gtk-logo-rgb.gif
-democodedir = $(datadir)/$(GTKMM_MODULE_NAME)/demo
-dist_democode_DATA = $(gtk_demo_gtkmm_demo_SOURCES) $(image_files)
-
if GTKMM_ATKMM_ENABLED
atkmm_includes = -I$(top_builddir)/atk $(if $(srcdir:.=),-I$(top_srcdir)/atk)
atkmm_ldadd = $(top_builddir)/atk/atkmm/libatkmm-$(ATKMM_API_VERSION).la
diff --git a/demos/pixbuf-demo.cc b/demos/pixbuf-demo.cc
index ee0cbc9..279e603 100644
--- a/demos/pixbuf-demo.cc
+++ b/demos/pixbuf-demo.cc
@@ -3,7 +3,7 @@
* Copyright (C) 2002 The gtkmm Development Team
*
* Authors: Federico Mena-Quintero <federico gimp org>
- * gtkmm port: Daniel Elstner <daniel elstner gmx net>
+ * gtkmm port: Daniel Elstner <daniel kitta gmail com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -37,12 +37,9 @@
#include <gtkmm/style.h>
#include <gtkmm/window.h>
-
namespace
{
-const double pi = 3.14159265358979323844;
-
/*
* These values control the smoothness and speed of the animation.
* For instance, FRAME_DELAY=25 and CYCLE_LEN=90 looks much better
@@ -55,21 +52,20 @@ enum
};
const char * const background_name =
- "background.jpg";
+ "gtk-demo/background.jpg";
const char * const image_names[] =
{
- "apple-red.png",
- "gnome-applets.png",
- "gnome-calendar.png",
- "gnome-foot.png",
- "gnome-gmush.png",
- "gnome-gimp.png",
- "gnome-gsame.png",
- "gnu-keys.png"
+ "gtk-demo/apple-red.png",
+ "gtk-demo/gnome-applets.png",
+ "gtk-demo/gnome-calendar.png",
+ "gtk-demo/gnome-foot.png",
+ "gtk-demo/gnome-gmush.png",
+ "gtk-demo/gnome-gimp.png",
+ "gtk-demo/gnome-gsame.png",
+ "gtk-demo/gnu-keys.png"
};
-
class DemoRenderArea : public Gtk::DrawingArea
{
public:
@@ -88,15 +84,15 @@ private:
void generate_next_frame();
};
-
Glib::RefPtr<Gdk::Pixbuf> create_pixbuf(const std::string& name)
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
return Gdk::Pixbuf::create_from_file(name);
- #else
+#else
+ // Ignore this; it's broken by design.
std::auto_ptr<Glib::Error> error;
return Gdk::Pixbuf::create_from_file(name, error);
- #endif //GLIBMM_EXCEPTIONS_ENABLED
+#endif
}
/*
@@ -106,15 +102,15 @@ Glib::RefPtr<Gdk::Pixbuf> create_pixbuf(const std::string& name)
*/
DemoRenderArea::DemoRenderArea()
:
- frame_num_ (0)
+ frame_num_ (0)
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
background_ = Gdk::Pixbuf::create_from_file(background_name);
- #else
+#else
+ // Ignore this; it's broken by design.
std::auto_ptr<Glib::Error> error;
background_ = Gdk::Pixbuf::create_from_file(background_name, error);
- #endif //GLIBMM_EXCEPTIONS_ENABLED
-
+#endif
std::transform(
&image_names[0], &image_names[G_N_ELEMENTS(image_names)],
std::back_inserter(images_),
@@ -170,14 +166,14 @@ void DemoRenderArea::generate_next_frame()
const double xmid = back_width / 2.0;
const double ymid = back_height / 2.0;
- const double f = 2.0 * pi * double(frame_num_) / CYCLE_LEN;
+ const double f = 2.0 * G_PI * double(frame_num_) / CYCLE_LEN;
double r = std::min(xmid, ymid) / 2.0;
r += (r / 3.0) * std::sin(f);
for(unsigned i = 0; i < images_.size(); ++i)
{
- const double ang = 2.0 * pi * double(i) / images_.size() - f;
+ const double ang = 2.0 * G_PI * double(i) / images_.size() - f;
const double iw = images_[i]->get_width();
const double ih = images_[i]->get_height();
@@ -203,7 +199,6 @@ void DemoRenderArea::generate_next_frame()
overall_alpha);
}
}
-
frame_num_ = (frame_num_ + 1) % CYCLE_LEN;
// Tell GTK+ the widget should be redrawn soon. This will trigger the
@@ -213,13 +208,12 @@ void DemoRenderArea::generate_next_frame()
} // anonymous namespace
-
int main(int argc, char** argv)
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
+#endif
{
- #endif //GLIBMM_EXCEPTIONS_ENABLED
Gtk::Main main_instance (&argc, &argv);
Gtk::Window window;
@@ -229,15 +223,14 @@ int main(int argc, char** argv)
window.show_all();
Gtk::Main::run(window);
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
catch(const Glib::Error& error)
{
std::cerr << error.what() << std::endl;
return EXIT_FAILURE;
}
- #endif //GLIBMM_EXCEPTIONS_ENABLED
-
+#endif
return EXIT_SUCCESS;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]