diff --git a/icons/Makefile.am b/icons/Makefile.am index 3edff311d..0b5d5f58a 100644 --- a/icons/Makefile.am +++ b/icons/Makefile.am @@ -34,21 +34,21 @@ iconcommand = python $(top_srcdir)/admin/render-icon.py lumigui_DEPENDENCIES += \ rsvg-convert \ - $(16x16)/arrow.png $(22x22)/arrow.png $(24x24)/arrow.png $(32x32)/arrow.png $(48x48)/arrow.png \ - $(16x16)/i-beam.png $(22x22)/i-beam.png $(24x24)/i-beam.png $(32x32)/i-beam.png $(48x48)/i-beam.png \ - $(16x16)/assets-panel.png \ - $(16x16)/timeline-panel.png \ - $(16x16)/viewer-panel.png + $(16x16)/tool-arrow.png $(22x22)/tool-arrow.png $(24x24)/tool-arrow.png $(32x32)/tool-arrow.png $(48x48)/tool-arrow.png \ + $(16x16)/tool-i-beam.png $(22x22)/tool-i-beam.png $(24x24)/tool-i-beam.png $(32x32)/tool-i-beam.png $(48x48)/tool-i-beam.png \ + $(16x16)/panel-assets.png \ + $(16x16)/panel-timeline.png \ + $(16x16)/panel-viewer.png -$(16x16)/arrow.png $(22x22)/arrow.png $(24x24)/arrow.png $(32x32)/arrow.png $(48x48)/arrow.png : $(svgdir)/arrow.svg +$(16x16)/tool-arrow.png $(22x22)/tool-arrow.png $(24x24)/tool-arrow.png $(32x32)/tool-arrow.png $(48x48)/tool-arrow.png : $(svgdir)/tool-arrow.svg $(iconcommand) $< $(icondir) -$(16x16)/i-beam.png $(22x22)/i-beam.png $(24x24)/i-beam.png $(32x32)/i-beam.png $(48x48)/i-beam.png : $(svgdir)/i-beam.svg +$(16x16)/tool-i-beam.png $(22x22)/tool-i-beam.png $(24x24)/tool-i-beam.png $(32x32)/tool-i-beam.png $(48x48)/tool-i-beam.png : $(svgdir)/tool-i-beam.svg $(iconcommand) $< $(icondir) -$(16x16)/assets-panel.png: - cp $(16x16pre)/assets-panel.png $(16x16) -$(16x16)/timeline-panel.png: - cp $(16x16pre)/timeline-panel.png $(16x16) -$(16x16)/viewer-panel.png: - cp $(16x16pre)/viewer-panel.png $(16x16) +$(16x16)/panel-assets.png: + cp $(16x16pre)/panel-assets.png $(16x16) +$(16x16)/panel-timeline.png: + cp $(16x16pre)/panel-timeline.png $(16x16) +$(16x16)/panel-viewer.png: + cp $(16x16pre)/panel-viewer.png $(16x16) diff --git a/icons/prerendered/16x16/assets-panel.png b/icons/prerendered/16x16/panel-assets.png similarity index 100% rename from icons/prerendered/16x16/assets-panel.png rename to icons/prerendered/16x16/panel-assets.png diff --git a/icons/prerendered/16x16/timeline-panel.png b/icons/prerendered/16x16/panel-timeline.png similarity index 100% rename from icons/prerendered/16x16/timeline-panel.png rename to icons/prerendered/16x16/panel-timeline.png diff --git a/icons/prerendered/16x16/viewer-panel.png b/icons/prerendered/16x16/panel-viewer.png similarity index 100% rename from icons/prerendered/16x16/viewer-panel.png rename to icons/prerendered/16x16/panel-viewer.png diff --git a/icons/svg/arrow.svg b/icons/svg/tool-arrow.svg similarity index 99% rename from icons/svg/arrow.svg rename to icons/svg/tool-arrow.svg index 2434fad9d..026b6633f 100644 --- a/icons/svg/arrow.svg +++ b/icons/svg/tool-arrow.svg @@ -15,7 +15,7 @@ sodipodi:version="0.32" inkscape:version="0.46" version="1.0" - sodipodi:docname="arrow.svg" + sodipodi:docname="tool-arrow.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape"> @@ -522,10 +522,10 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="5.6568543" - inkscape:cx="90.247594" + inkscape:cx="64.614973" inkscape:cy="46.534319" inkscape:document-units="px" - inkscape:current-layer="layer4" + inkscape:current-layer="layer3" showgrid="true" inkscape:snap-nodes="false" inkscape:snap-bbox="true" @@ -559,7 +559,7 @@ @@ -592,7 +592,7 @@ "}; +/** + * An alphabetical list of the application's authors + */ +static const gchar* AppAuthors[] = { + "Joel Holdsworth", + "Christian Thaeter", + "Hermann Vosseler", + ""}; - /** - * The main application class. - */ - class GtkLumiera - { - public: - int main(int argc, char *argv[]); +/** + * The main application class. + */ +class GtkLumiera +{ +public: + int main(int argc, char *argv[]); + + static Glib::ustring get_home_data_path(); - }; +}; - /** - * Returns a reference to the global application object - */ - GtkLumiera& application(); +/** + * Returns a reference to the global application object + */ +GtkLumiera& application(); } // namespace gui } // namespace lumiera diff --git a/src/gui/panels/assets-panel.cpp b/src/gui/panels/assets-panel.cpp index 431b92019..58535f0e0 100644 --- a/src/gui/panels/assets-panel.cpp +++ b/src/gui/panels/assets-panel.cpp @@ -28,7 +28,7 @@ namespace gui { namespace panels { AssetsPanel::AssetsPanel() : - Panel("assets", _("Assets"), "assets_panel"), + Panel("assets", _("Assets"), "panel_assets"), placeholder("Placeholder label. Is this supposed to be titled assets\nas in the proc layer? or resources\nas in cinelerra?") { pack_start(placeholder); diff --git a/src/gui/panels/timeline-panel.cpp b/src/gui/panels/timeline-panel.cpp index b03b4604f..00a3c3f0f 100644 --- a/src/gui/panels/timeline-panel.cpp +++ b/src/gui/panels/timeline-panel.cpp @@ -34,9 +34,9 @@ namespace panels { const int TimelinePanel::ZoomToolSteps = 2; // 2 seems comfortable TimelinePanel::TimelinePanel() : - Panel("timeline", _("Timeline"), "timeline_panel"), - arrowTool(Gtk::StockID("arrow")), - iBeamTool(Gtk::StockID("i_beam")), + Panel("timeline", _("Timeline"), "panel_timeline"), + arrowTool(Gtk::StockID("tool_arrow")), + iBeamTool(Gtk::StockID("tool_i_beam")), zoomIn(Stock::ZOOM_IN), zoomOut(Stock::ZOOM_OUT), updatingToolbar(false) diff --git a/src/gui/panels/viewer-panel.cpp b/src/gui/panels/viewer-panel.cpp index ff64138ed..323859b9a 100644 --- a/src/gui/panels/viewer-panel.cpp +++ b/src/gui/panels/viewer-panel.cpp @@ -31,7 +31,7 @@ namespace gui { namespace panels { ViewerPanel::ViewerPanel() : - Panel("viewer", _("Viewer"), "viewer_panel"), + Panel("viewer", _("Viewer"), "panel_viewer"), previousButton(Stock::MEDIA_PREVIOUS), rewindButton(Stock::MEDIA_REWIND), playPauseButton(Stock::MEDIA_PLAY), diff --git a/src/gui/window-manager.cpp b/src/gui/window-manager.cpp index ba66ba954..9ffc84a20 100644 --- a/src/gui/window-manager.cpp +++ b/src/gui/window-manager.cpp @@ -22,52 +22,154 @@ #include "window-manager.hpp" +using namespace Gtk; +using namespace Glib; + namespace lumiera { namespace gui { WindowManager::WindowManager() - { +{ + register_stock_items(); - } + g_message("get_home_dir() : %s", get_home_dir().c_str()); + g_message("get_tmp_dir() : %s", get_tmp_dir().c_str()); + g_message("get_current_dir() : %s", get_current_dir().c_str()); + g_message("get_user_data_dir() : %s", get_user_data_dir().c_str()); + g_message("get_user_config_dir() : %s", get_user_config_dir().c_str()); + g_message("get_user_cache_dir () : %s", get_user_cache_dir().c_str()); +} bool WindowManager::set_theme(Glib::ustring path) - { - if(access(path.c_str(), R_OK)) - { - ERROR(gui, "WindowManger: Unable to load rc file \"%s\"", path.c_str()); - return false; - } - - gtk_rc_parse(path.c_str()); - gtk_rc_reset_styles (gtk_settings_get_default()); +{ + if(access(path.c_str(), R_OK)) + { + ERROR(gui, "WindowManger: Unable to load rc file \"%s\"", + path.c_str()); + return false; + } + + gtk_rc_parse(path.c_str()); + gtk_rc_reset_styles (gtk_settings_get_default()); - return true; - } + return true; +} GdkColor WindowManager::read_style_colour_property( Gtk::Widget &widget, const gchar *property_name, guint16 red, guint16 green, guint16 blue) +{ + GdkColor *colour; + + gtk_widget_style_get(widget.gobj(), property_name, &colour, NULL); + + // Did the color load successfully? + if(colour != NULL) + return *colour; + else { - GdkColor *colour; - - gtk_widget_style_get(widget.gobj(), property_name, &colour, NULL); - - // Did the color load successfully? - if(colour != NULL) - return *colour; - else - { - WARN(gui, "%s style value failed to load", property_name); - - GdkColor default_colour; - default_colour.red = red; - default_colour.green = green; - default_colour.blue = blue; - return default_colour; - } + WARN(gui, "%s style value failed to load", property_name); + + GdkColor default_colour; + default_colour.red = red; + default_colour.green = green; + default_colour.blue = blue; + return default_colour; } +} + +void +WindowManager::register_stock_items() +{ + RefPtr factory = IconFactory::create(); + + add_stock_item_set(factory, "panel-assets", "panel_assets", _("_Assets")); + add_stock_item_set(factory, "panel-timeline", "panel_timeline", _("_Timeline")); + add_stock_item_set(factory, "panel-viewer", "panel_viewer", _("_Viewer")); + + add_stock_item_set(factory, "tool-arrow", "tool_arrow", _("_Arrow")); + add_stock_item_set(factory, "tool-i-beam", "tool_i_beam", _("_I-Beam")); + + factory->add_default(); //Add factory to list of factories. +} + +bool +WindowManager::add_stock_item_set( + const Glib::RefPtr& factory, + const Glib::ustring& icon_name, + const Glib::ustring& id, + const Glib::ustring& label) +{ + 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); + + if(!icon_set.get_sizes().empty()) + { + const Gtk::StockID stock_id(id); + factory->add(stock_id, icon_set); + Gtk::Stock::add(Gtk::StockItem(stock_id, label)); + return true; + } + + ERROR(gui, "Unable to load icon \"%s\"", icon_name.c_str()); + + return false; +} + +bool +WindowManager::add_stock_icon(Gtk::IconSet &icon_set, + const Glib::ustring& icon_name, int size) +{ + // Try the ~/.lumiera/icons folder + if(add_stock_icon_source(icon_set, ustring::compose("%1/%2", + GtkLumiera::get_home_data_path(), ustring("icons")), + icon_name, size)) + return true; + + if(add_stock_icon_source( + icon_set, get_current_dir(), icon_name, size)) + return true; + + return false; +} + +bool +WindowManager::add_stock_icon_source(Gtk::IconSet &icon_set, + const Glib::ustring& base_dir, const Glib::ustring& icon_name, + int size) +{ + Gtk::IconSource source; + + try + { + ustring path = ustring::compose("%1/%2x%2/%3.png", + base_dir, size, icon_name); + + g_message("%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"); + return false; + } + + source.set_size(IconSize(size)); + //source.set_size_wildcarded(); // Icon may be scaled. + + icon_set.add_source(source); + + return true; +} } // namespace gui } // namespace lumiera diff --git a/src/gui/window-manager.hpp b/src/gui/window-manager.hpp index 504f30529..1c93fddfd 100644 --- a/src/gui/window-manager.hpp +++ b/src/gui/window-manager.hpp @@ -44,9 +44,25 @@ namespace gui { static GdkColor read_style_colour_property( Gtk::Widget &widget, const gchar *property_name, guint16 red, guint16 green, guint16 blue); + + private: + /** + * Registers application stock items: icons and + * labels associated with IDs */ + static void register_stock_items(); - protected: - + static bool add_stock_item_set( + const Glib::RefPtr& factory, + const Glib::ustring& icon_name, + const Glib::ustring& id, + const Glib::ustring& label); + + static bool add_stock_icon(Gtk::IconSet &icon_set, + const Glib::ustring& icon_name, int size); + + static bool add_stock_icon_source(Gtk::IconSet &icon_set, + const Glib::ustring& base_dir, + const Glib::ustring& icon_name, int size); }; } // namespace gui diff --git a/src/gui/workspace/actions.cpp b/src/gui/workspace/actions.cpp index f3ebcd450..2bcb9c40a 100644 --- a/src/gui/workspace/actions.cpp +++ b/src/gui/workspace/actions.cpp @@ -39,8 +39,6 @@ Actions::Actions(WorkspaceWindow &workspace_window) : workspaceWindow(workspace_window), is_updating_action_state(false) { - register_stock_items(); - workspace_window.signal_show ().connect_notify(mem_fun(this, &Actions::update_action_state)); //----- Create the Action Group -----// @@ -91,71 +89,6 @@ Actions::Actions(WorkspaceWindow &workspace_window) : sigc::mem_fun(*this, &Actions::on_menu_help_about) ); } -void -Actions::register_stock_items() -{ - RefPtr factory = IconFactory::create(); - - add_stock_item_set(factory, "assets-panel.png", "assets_panel", _("_Assets")); - add_stock_item_set(factory, "timeline-panel.png", "timeline_panel", _("_Timeline")); - add_stock_item_set(factory, "viewer-panel.png", "viewer_panel", _("_Viewer")); - - add_stock_item_set(factory, "arrow.png", "arrow", _("_Arrow")); - add_stock_item_set(factory, "i-beam.png", "i_beam", _("_I-Beam")); - - factory->add_default(); //Add factory to list of factories. -} - -bool -Actions::add_stock_item_set(const Glib::RefPtr& factory, - const Glib::ustring& filename, - const Glib::ustring& id, - const Glib::ustring& label) -{ - Gtk::IconSet icon_set; - - add_stock_icon_source(icon_set, 16, filename); - add_stock_icon_source(icon_set, 22, filename); - add_stock_icon_source(icon_set, 24, filename); - add_stock_icon_source(icon_set, 32, filename); - add_stock_icon_source(icon_set, 48, filename); - - if(!icon_set.get_sizes().empty()) - { - const Gtk::StockID stock_id(id); - factory->add(stock_id, icon_set); - Gtk::Stock::add(Gtk::StockItem(stock_id, label)); - return true; - } - - return false; -} - -bool -Actions::add_stock_icon_source(Gtk::IconSet &icon_set, - int size, const Glib::ustring& filename) -{ - Gtk::IconSource source; - - try - { - //This throws an exception if the file is not found: - source.set_pixbuf( Gdk::Pixbuf::create_from_file( - Glib::ustring::compose("%1x%1/%2", size, filename) ) ); - } - catch(const Glib::Exception& ex) - { - return false; - } - - source.set_size(IconSize(size)); - //source.set_size_wildcarded(); // Icon may be scaled. - - icon_set.add_source(source); - - return true; -} - void Actions::update_action_state() { diff --git a/src/gui/workspace/actions.hpp b/src/gui/workspace/actions.hpp index c4c764027..8976c5e29 100644 --- a/src/gui/workspace/actions.hpp +++ b/src/gui/workspace/actions.hpp @@ -48,20 +48,6 @@ private: /* ===== Internals ===== */ private: - /** - * Registers application stock items: icons and - * labels associated with IDs */ - static void register_stock_items(); - - static bool add_stock_item_set( - const Glib::RefPtr& factory, - const Glib::ustring& filename, - const Glib::ustring& id, - const Glib::ustring& label); - - static bool add_stock_icon_source(Gtk::IconSet &icon_set, - int size, const Glib::ustring& filename); - /** * Updates the state of the menu/toolbar actions * to reflect the current state of the workspace */ @@ -102,7 +88,7 @@ private: /* ===== Internals ===== */ private: bool is_updating_action_state; - + friend class WorkspaceWindow; };