[niepce] Add support for icons in HScales.
- From: Hubert FiguiÃre <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] Add support for icons in HScales.
- Date: Sat, 12 Nov 2011 06:16:25 +0000 (UTC)
commit 9cecd21895606983689e70a4a3ace05e34487bdb
Author: Hub Figuiere <hub figuiere net>
Date: Sun Nov 6 08:27:04 2011 -0800
Add support for icons in HScales.
data/icons/Makefile.am | 1 +
data/icons/niepce-transform-rotate.png | Bin 0 -> 863 bytes
src/fwk/toolkit/widgets/editablehscale.cpp | 24 ++++++++++++++++++++-
src/fwk/toolkit/widgets/editablehscale.hpp | 5 ++++
src/niepce/modules/darkroom/toolboxcontroller.cpp | 7 +++++-
5 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index c8d6b92..39a2e07 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -7,4 +7,5 @@ dist_icons_DATA = niepce-jpg-fmt.png niepce-raw-fmt.png niepce-rawjpeg-fmt.png\
niepce-set-star.png niepce-unset-star.png\
niepce-rotate-left.png niepce-rotate-right.png \
niepce-flag-pick.png niepce-flag-reject.png \
+ niepce-transform-rotate.png \
$(NULL)
diff --git a/data/icons/niepce-transform-rotate.png b/data/icons/niepce-transform-rotate.png
new file mode 100644
index 0000000..38dae1f
Binary files /dev/null and b/data/icons/niepce-transform-rotate.png differ
diff --git a/src/fwk/toolkit/widgets/editablehscale.cpp b/src/fwk/toolkit/widgets/editablehscale.cpp
index 0d0b576..d63c903 100644
--- a/src/fwk/toolkit/widgets/editablehscale.cpp
+++ b/src/fwk/toolkit/widgets/editablehscale.cpp
@@ -28,10 +28,32 @@
namespace fwk {
EditableHScale::EditableHScale(double min, double max, double step)
- : m_adj(0, min, max, step),
+ : m_icon(NULL),
+ m_adj(0, min, max, step),
m_scale(m_adj), m_entry(m_adj),
m_dirty(false)
{
+ _init();
+}
+
+
+EditableHScale::EditableHScale(const std::string & icon_path,
+ double min, double max, double step)
+ : m_icon(Gtk::manage(new Gtk::Image(icon_path))),
+ m_adj(0, min, max, step),
+ m_scale(m_adj), m_entry(m_adj),
+ m_dirty(false)
+{
+ _init();
+}
+
+
+
+void EditableHScale::_init()
+{
+ if(m_icon) {
+ pack_start(*m_icon, false, true);
+ }
m_scale.property_draw_value() = false;
m_scale.add_events(Gdk::BUTTON_RELEASE_MASK);
m_scale.signal_button_release_event()
diff --git a/src/fwk/toolkit/widgets/editablehscale.hpp b/src/fwk/toolkit/widgets/editablehscale.hpp
index f25ab2c..ae06a8c 100644
--- a/src/fwk/toolkit/widgets/editablehscale.hpp
+++ b/src/fwk/toolkit/widgets/editablehscale.hpp
@@ -35,6 +35,8 @@ class EditableHScale
{
public:
EditableHScale(double min, double max, double step);
+ EditableHScale(const std::string & icon_name,
+ double min, double max, double step);
Gtk::Adjustment & get_adjustment()
{ return m_adj; }
@@ -50,6 +52,9 @@ private:
void on_adj_value_changed();
+ void _init();
+
+ Gtk::Image *m_icon;
Gtk::Adjustment m_adj;
Gtk::HScale m_scale;
Gtk::SpinButton m_entry;
diff --git a/src/niepce/modules/darkroom/toolboxcontroller.cpp b/src/niepce/modules/darkroom/toolboxcontroller.cpp
index 3200f3c..404adfc 100644
--- a/src/niepce/modules/darkroom/toolboxcontroller.cpp
+++ b/src/niepce/modules/darkroom/toolboxcontroller.cpp
@@ -29,6 +29,10 @@
#include "fwk/toolkit/widgets/editablehscale.hpp"
#include "dritemwidget.hpp"
+#ifndef DATADIR
+#error DATADIR is not defined
+#endif
+
namespace darkroom {
ToolboxController::ToolboxController()
@@ -52,7 +56,8 @@ ToolboxController::buildWidget(const Glib::RefPtr<Gtk::UIManager> & )
item = manage(new DrItemWidget(_("Crop")));
toolbox->pack_start(*item, Gtk::PACK_SHRINK);
- s = Gtk::manage(new fwk::EditableHScale(-45.0, 45.0, 0.5));
+ s = Gtk::manage(new fwk::EditableHScale(DATADIR"/niepce/pixmaps/niepce-transform-rotate.png",
+ -45.0, 45.0, 0.5));
item->add_widget(_("Tilt"), *s);
item = manage(new DrItemWidget(_("White balance")));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]