From 65568980ecbc4e8f3083b741d25f27fd2ad9cb30 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Tue, 7 Oct 2008 23:02:27 +0100 Subject: [PATCH] Corrected incorrect IconSize code, and made Tool icons borders darker --- icons/svg/tool-arrow.svg | 237 ++++++++++++++++++++++++------------- icons/svg/tool-i-beam.svg | 22 ++-- src/gui/window-manager.cpp | 30 +++-- src/gui/window-manager.hpp | 4 +- 4 files changed, 182 insertions(+), 111 deletions(-) diff --git a/icons/svg/tool-arrow.svg b/icons/svg/tool-arrow.svg index 026b6633f..3f0b72102 100644 --- a/icons/svg/tool-arrow.svg +++ b/icons/svg/tool-arrow.svg @@ -510,6 +510,89 @@ y1="-129.52815" x2="252.00447" y2="-135.47408" /> + + + + + + + + - - - - - + + + - - - - - - + + + + - - - - - - - + + + + + @@ -655,7 +655,7 @@ sodipodi:nodetypes="cssccccssscccsssccccssscccs" id="path7977" d="M 130.5,77.5 C 129.99037,77.5 129.5,78 129.5,78.5 C 129.5,79 130,79.5 130.5,79.5 L 130.5,79.5 C 131,79.5 131.5,80 131.5,80.5 L 131.5,87.5 C 131.5,88 131,88.5 130.5,88.5 L 130.5,88.5 C 130,88.5 129.5,89 129.5,89.5 C 129.5,90 130,90.5 130.5,90.5 L 131.5,90.5 C 132,90.5 132.5,90 132.5,89.5 C 132.5,90 133,90.5 133.5,90.5 L 134.5,90.5 C 135,90.5 135.5,90 135.5,89.5 C 135.5,89 135,88.5 134.5,88.5 L 134.5,88.5 C 134,88.5 133.5,88 133.5,87.5 L 133.5,80.5 C 133.5,80 134,79.5 134.5,79.5 L 134.5,79.5 C 135,79.5 135.5,79 135.5,78.5 C 135.5,78 135,77.5 134.5,77.5 L 133.5,77.5 C 133,77.5 132.5,78 132.5,78.5 C 132.5,78 132,77.5 131.5,77.5 L 130.5,77.5 z" - style="fill:#eeeeec;fill-rule:evenodd;stroke:#888a85;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#eeeeec;fill-rule:evenodd;stroke:#555753;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#eeeeec;fill-rule:evenodd;stroke:#555753;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:#eeeeec;fill-rule:evenodd;stroke:#555753;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/src/gui/window-manager.cpp b/src/gui/window-manager.cpp index 926d4ecac..2de30af93 100644 --- a/src/gui/window-manager.cpp +++ b/src/gui/window-manager.cpp @@ -97,11 +97,10 @@ WindowManager::add_stock_item_set( { Gtk::IconSet icon_set; - add_stock_icon(icon_set, icon_name, 16); - add_stock_icon(icon_set, icon_name, 22); - add_stock_icon(icon_set, icon_name, 24); - add_stock_icon(icon_set, icon_name, 32); - add_stock_icon(icon_set, icon_name, 48); + add_stock_icon(icon_set, icon_name, ICON_SIZE_MENU); + add_stock_icon(icon_set, icon_name, ICON_SIZE_SMALL_TOOLBAR); + add_stock_icon(icon_set, icon_name, ICON_SIZE_LARGE_TOOLBAR); + if(!icon_set.get_sizes().empty()) { @@ -118,7 +117,7 @@ WindowManager::add_stock_item_set( bool WindowManager::add_stock_icon(Gtk::IconSet &icon_set, - const Glib::ustring& icon_name, int size) + const Glib::ustring& icon_name, Gtk::IconSize size) { // Try the ~/.lumiera/icons folder if(add_stock_icon_source(icon_set, ustring::compose("%1/%2", @@ -136,28 +135,33 @@ WindowManager::add_stock_icon(Gtk::IconSet &icon_set, bool WindowManager::add_stock_icon_source(Gtk::IconSet &icon_set, const Glib::ustring& base_dir, const Glib::ustring& icon_name, - int size) + Gtk::IconSize size) { + ustring path; Gtk::IconSource source; + int width = 0, height = 0; + if(!IconSize::lookup(size, width, height)) + return false; + try { - ustring path = ustring::compose("%1/%2x%2/%3.png", - base_dir, size, icon_name); + ustring path = ustring::compose("%1/%2x%3/%4.png", + base_dir, width, height, icon_name); - g_message("%s", path.c_str()); + INFO(gui, "Attempting to load icon: %s", path.c_str()); // This throws an exception if the file is not found: source.set_pixbuf(Gdk::Pixbuf::create_from_file(path)); } catch(const Glib::Exception& ex) { - g_message("Failed"); + INFO(gui, "Failed to load icon: %s", path.c_str()); return false; } - source.set_size(IconSize(size)); - //source.set_size_wildcarded(); // Icon may be scaled. + source.set_size(size); + source.set_size_wildcarded(false); // Icon may be scaled. icon_set.add_source(source); diff --git a/src/gui/window-manager.hpp b/src/gui/window-manager.hpp index f9fc408ab..0a19b1839 100644 --- a/src/gui/window-manager.hpp +++ b/src/gui/window-manager.hpp @@ -58,11 +58,11 @@ private: const Glib::ustring& label); static bool add_stock_icon(Gtk::IconSet &icon_set, - const Glib::ustring& icon_name, int size); + const Glib::ustring& icon_name, Gtk::IconSize size); static bool add_stock_icon_source(Gtk::IconSet &icon_set, const Glib::ustring& base_dir, - const Glib::ustring& icon_name, int size); + const Glib::ustring& icon_name, Gtk::IconSize size); }; } // namespace gui