diff --git a/SConstruct b/SConstruct index 717609d76..26674fc25 100644 --- a/SConstruct +++ b/SConstruct @@ -42,7 +42,7 @@ srcConf = 'data/config' buildExe = '#$TARGDIR' buildLib = '#$TARGDIR/modules' buildPlug = '#$TARGDIR/modules' -buildIcon = '#$TARGDIR/icons' +buildIcon = '#$TARGDIR/gui/icons' buildUIRes = '#$TARGDIR/' buildConf = '#$TARGDIR/config' installExe = '#$DESTDIR/lib/lumiera' diff --git a/data/config/setup.ini b/data/config/setup.ini index 60c92ed0d..9ea9af1a3 100644 --- a/data/config/setup.ini +++ b/data/config/setup.ini @@ -11,4 +11,12 @@ gui = gtk_gui.lum modulepath = $ORIGIN/modules configpath = /usr/share/lumiera/config:~/.lumiera +title = Lumiera version = 0.pre.01 +website = http://www.lumiera.org +authors = Joel Holdsworth|Christian Thäter|Hermann Voßeler|[Other Authors Here] + +[Gui] +stylesheet = lumiera_ui.rc +iconpath = $ORIGIN/../../share/lumiera/icons:$ORIGIN/gui/icons:~/.lumiera/icons +resourcepath = $ORIGIN/../../share/lumiera/gui:$ORIGIN/gui diff --git a/src/common/basic-setup.cpp b/src/common/basic-setup.cpp index 5abeee2c0..030d76623 100644 --- a/src/common/basic-setup.cpp +++ b/src/common/basic-setup.cpp @@ -83,15 +83,27 @@ namespace lumiera { "search path for extended configuration. " "Extended Config system not yet implemented " "Ignored as of 2/2011") + ("Lumiera.title", opt::value(), + "title of the Lumiera Application, e.g. for windows") ("Lumiera.version", opt::value(), "Application version string") + ("Lumiera.website", opt::value(), + "URL of the Lumiera website") + ("Lumiera.authors", opt::value(), + "names of Lumiera authors, for 'about' dialog. Separated by '|'") + + ("Gui.stylesheet", opt::value(), + "name of the GTK stylesheet to use. Will be searched in resource path") + ("Gui.iconpath", opt::value(), + "search path for icons") + ("Gui.resourcepath", opt::value(), + "general search path for UI resources") ; ifstream configIn (resolve(bootstrapIni).c_str()); - opt::parsed_options parsed = - opt::parse_config_file (configIn, syntax); + opt::parsed_options parsed = opt::parse_config_file (configIn, syntax); opt::store (parsed, settings); opt::notify(settings); diff --git a/src/common/configfacade.cpp b/src/common/configfacade.cpp index f17d9163d..3509c435e 100644 --- a/src/common/configfacade.cpp +++ b/src/common/configfacade.cpp @@ -132,7 +132,7 @@ extern "C" { /* ==== implementation C interface for accessing setup.ini ======= // fetch plugin search path from setup.ini and expand any $ORIGIN token SearchPathSplitter pathElement(Config::get (KEY_PLUGIN_PATH)); while (pathElement) - pathSpec += pathElement.fetch() +":"; + pathSpec += pathElement.next() +":"; } return cStr(pathSpec); diff --git a/src/gui/gtk-lumiera.cpp b/src/gui/gtk-lumiera.cpp index a67d419d1..c44e737fd 100644 --- a/src/gui/gtk-lumiera.cpp +++ b/src/gui/gtk-lumiera.cpp @@ -27,21 +27,45 @@ #include "gui/controller/controller.hpp" #include "gui/model/project.hpp" #include "lib/singleton.hpp" +#include "lib/symbol.hpp" +#include "include/config-facade.h" -using namespace Gtk; -using namespace Glib; -using namespace gui; -using namespace gui::workspace; -using namespace gui::model; -using namespace gui::controller; -using namespace std; +#include +#include +#include namespace gui { +using namespace Gtk; +using namespace Glib; +using namespace gui::model; +using namespace gui::workspace; +using namespace gui::controller; + +using boost::algorithm::is_any_of; +using boost::algorithm::split; + +using lumiera::Config; +using lib::Literal; + +typedef std::vector UVector; + + + namespace { + /** storage for the Main Application object */ lib::Singleton theApplicationInstance; + + Literal KEY_TITLE = "Lumiera.title"; + Literal KEY_VERSION = "Lumiera.version"; + Literal KEY_WEBSITE = "Lumiera.website"; + Literal KEY_AUTHORS = "Lumiera.authors"; + + Literal KEY_STYLESHEET = "Gui.stylesheet"; + Literal KEY_UIRES_PATH = "Gui.resourcepath"; + Literal KEY_ICON_PATH = "Gui.iconpath"; } @@ -62,68 +86,63 @@ GtkLumiera::main (int argc, char *argv[]) Main kit(argc, argv); - Glib::set_application_name (get_app_title()); + Glib::set_application_name (getAppTitle()); Project project; Controller controller(project); - windowManagerInstance_.init(); - windowManagerInstance_.set_theme ("lumiera_ui.rc"); - windowManagerInstance_.new_window (project, controller); - - kit.run(); + windowManagerInstance_.init (Config::get (KEY_ICON_PATH), Config::get (KEY_UIRES_PATH)); + windowManagerInstance_.setTheme (Config::get (KEY_STYLESHEET)); + + + windowManagerInstance_.newWindow (project, controller); + kit.run(); // GTK event loop } + WindowManager& GtkLumiera::windowManager() { return windowManagerInstance_; } -Glib::ustring -GtkLumiera::get_home_data_path() + +cuString +GtkLumiera::getAppTitle() { - const ustring app_name("lumiera"); - const ustring path(Glib::get_home_dir()); - return ustring::compose("%1/.%2", path, app_name); + return Config::get (KEY_TITLE); } -const Glib::ustring -GtkLumiera::get_app_title() + +cuString +GtkLumiera::getAppVersion() { - return "Lumiera"; + return Config::get (KEY_VERSION); } -const Glib::ustring -GtkLumiera::get_app_version() + +cuString +GtkLumiera::getCopyright() { - return "0.pre.01"; + return _("© 2012 The Lumiera Team"); } -const Glib::ustring GtkLumiera::get_app_copyright() + +cuString +GtkLumiera::getLumieraWebsite() { - return _("© 2008 The Lumiera Team"); + return Config::get (KEY_WEBSITE); } -const Glib::ustring GtkLumiera::get_app_website() -{ - return "http://www.lumiera.org"; -} -const std::vector -GtkLumiera::get_app_authors() +const UVector +GtkLumiera::getLumieraAuthors() { - const gchar* app_authors[] = { - "Joel Holdsworth", - "Christian Thaeter", - "Hermann Vosseler", - "[Other Authors Here]"}; + string authors = Config::get (KEY_AUTHORS); + UVector authorsList; - const int count = sizeof(app_authors) / sizeof(gchar*); - std::vector list(count); - for(int i = 0; i < count; i++) - list[i] = app_authors[i]; - return list; + split (authorsList, authors, is_any_of (",|")); + return authorsList; } diff --git a/src/gui/gtk-lumiera.hpp b/src/gui/gtk-lumiera.hpp index 9d403ccfa..65ee00e9c 100644 --- a/src/gui/gtk-lumiera.hpp +++ b/src/gui/gtk-lumiera.hpp @@ -19,10 +19,32 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + /** @file gtk-lumiera.hpp - ** This file contains application wide global definitions - ** user actions. - ** @see gtk-lumiera.cpp + ** The main application object. + ** Invoking the GtkLumiera::main() function brings up the GUI; this + ** function will block in the GTK event thread until the Application gets + ** closed by user interaction or by triggering a shutdown via the GuiNotificationFacade. + ** GtkLumiera is a singleton and owns the central WindowManager instance used for + ** opening all windows and registering and loading icons and resources. + ** + ** \par configuration and resource search + ** The GUI object retrieves the necessary configuration values from lumiera::Config, + ** the config facade in the application core. Currently as of 2/2011 these values are + ** loaded from setup.ini, because the full-blown config system is not yet implemented. + ** Amongst others, this configuration defines a search path for icons and a + ** separate search path for resources. These path specs may use the token \c $ORIGIN + ** to refer to the installation directory of the currently executing program. + ** This allows for a relocatable Lumiera installation bundle. + ** + ** @see guistart.cpp the plugin to pull up this GUI + ** @see gui::GuiFacade access point for starting the GUI + ** @see gui::GuiNotification interface for communication with the gui from the lower layers + ** @see lumiera::Config + ** @see lumiera::BasicSetup definition of the acceptable configuration values + ** @see lumiera::AppState general Lumiera application main + ** */ #ifndef GUI_GTK_LUMIERA_H diff --git a/src/gui/window-manager.cpp b/src/gui/window-manager.cpp index 461c9c01c..ea8322deb 100644 --- a/src/gui/window-manager.cpp +++ b/src/gui/window-manager.cpp @@ -24,6 +24,12 @@ #include "gui/window-manager.hpp" #include "gui/gtk-lumiera.hpp" #include "gui/workspace/workspace-window.hpp" +#include "lib/searchpath.hpp" +#include "lib/util.hpp" + +#include + +using util::cStr; using namespace Gtk; using namespace Glib; @@ -31,21 +37,37 @@ using namespace boost; using namespace std; using namespace gui::workspace; +namespace fsys = boost::filesystem; + + namespace gui { IconSize WindowManager::GiantIconSize = ICON_SIZE_INVALID; IconSize WindowManager::MenuIconSize = ICON_SIZE_INVALID; + void -WindowManager::init() +WindowManager::init (string const& iconPath, string const& resourcePath) { + this->iconSearchPath_ = iconPath; + this->resourceSerachPath_ = resourcePath; + register_app_icon_sizes(); register_stock_items(); } + void -WindowManager::new_window(gui::model::Project &source_project, - gui::controller::Controller &source_controller) +WindowManager::setTheme (string const& stylesheetName) +{ + gtk_rc_parse (cStr(lib::resolveModulePath (stylesheetName, resourceSerachPath_))); + gtk_rc_reset_styles (gtk_settings_get_default()); +} + + +void +WindowManager::newWindow (gui::model::Project& source_project, + gui::controller::Controller &source_controller) { shared_ptr window( new WorkspaceWindow(source_project, source_controller)); @@ -61,25 +83,9 @@ WindowManager::new_window(gui::model::Project &source_project, update_close_window_in_menus(); } -bool -WindowManager::set_theme(Glib::ustring path) -{ - if(access(path.c_str(), R_OK)) - { - // gdk defines 'ERROR' need to prefix it with 'NOBUG_' here - NOBUG_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; -} bool -WindowManager::on_window_closed(GdkEventAny* event) +WindowManager::on_window_closed (GdkEventAny* event) { REQUIRE(event); REQUIRE(event->window); @@ -87,7 +93,7 @@ WindowManager::on_window_closed(GdkEventAny* event) list< shared_ptr >::iterator iterator = windowList.begin(); - while(iterator != windowList.end()) + while (iterator != windowList.end()) { shared_ptr workspace_window(*iterator); REQUIRE(workspace_window); @@ -103,7 +109,7 @@ WindowManager::on_window_closed(GdkEventAny* event) iterator++; } - if(windowList.empty()) + if (windowList.empty()) { // All windows have been closed - we should exit Main *main = Main::instance(); @@ -117,6 +123,7 @@ WindowManager::on_window_closed(GdkEventAny* event) return false; } + void WindowManager::update_close_window_in_menus() { @@ -135,10 +142,11 @@ WindowManager::update_close_window_in_menus() } } + Cairo::RefPtr -WindowManager::read_style_colour_property ( - Gtk::Widget &widget, const gchar *property_name, - guint16 red, guint16 green, guint16 blue) +WindowManager::read_style_colour_property (Gtk::Widget& widget, + const gchar *property_name, + guint16 red, guint16 green, guint16 blue) { REQUIRE (property_name); @@ -164,6 +172,7 @@ WindowManager::read_style_colour_property ( return pattern; } + void WindowManager::register_app_icon_sizes() { @@ -173,34 +182,35 @@ WindowManager::register_app_icon_sizes() MenuIconSize = IconSize::register_new ("menu", 16, 16); } + void WindowManager::register_stock_items() { Glib::RefPtr factory = IconFactory::create(); - add_stock_icon_set(factory, "panel-assets", "panel_assets", _("_Assets")); - add_stock_icon_set(factory, "panel-timeline", "panel_timeline", _("_Timeline")); - add_stock_icon_set(factory, "panel-viewer", "panel_viewer", _("_Viewer")); + add_stock_icon_set(factory, "panel-assets", "panel_assets", _("_Assets")); + add_stock_icon_set(factory, "panel-timeline", "panel_timeline",_("_Timeline")); + add_stock_icon_set(factory, "panel-viewer", "panel_viewer", _("_Viewer")); - add_stock_icon_set(factory, "window-new", "new_window", _("New _Window")); + add_stock_icon_set(factory, "window-new", "new_window", _("New _Window")); - add_stock_icon_set(factory, "tool-arrow", "tool_arrow", _("_Arrow")); - add_stock_icon_set(factory, "tool-i-beam", "tool_i_beam", _("_I-Beam")); + add_stock_icon_set(factory, "tool-arrow", "tool_arrow", _("_Arrow")); + add_stock_icon_set(factory, "tool-i-beam", "tool_i_beam", _("_I-Beam")); - add_stock_icon_set(factory, "track-disabled", "track_disabled", _("Track Disabled")); - add_stock_icon_set(factory, "track-enabled", "track_enabled", _("Track Enabled")); - add_stock_icon_set(factory, "track-locked", "track_locked", _("Track Locked")); - add_stock_icon_set(factory, "track-unlocked", "track_unlocked", _("Track Unlocked")); + add_stock_icon_set(factory, "track-disabled", "track_disabled",_("Track Disabled")); + add_stock_icon_set(factory, "track-enabled", "track_enabled", _("Track Enabled")); + add_stock_icon_set(factory, "track-locked", "track_locked", _("Track Locked")); + add_stock_icon_set(factory, "track-unlocked", "track_unlocked",_("Track Unlocked")); factory->add_default(); //Add factory to list of factories. } + bool -WindowManager::add_stock_icon_set( - const Glib::RefPtr& factory, - const Glib::ustring& icon_name, - const Glib::ustring& id, - const Glib::ustring& label) +WindowManager::add_stock_icon_set (Glib::RefPtr const& factory, + cuString& icon_name, + cuString& id, + cuString& label) { Gtk::IconSet icon_set; @@ -221,7 +231,7 @@ WindowManager::add_stock_icon_set( if(no_icons) { // No icons were loaded - ERROR(gui, "Unable to load icon \"%s\"", icon_name.c_str()); + ERROR (gui, "Unable to load icon '%s'", cStr(icon_name)); return false; } @@ -232,31 +242,36 @@ WindowManager::add_stock_icon_set( return true; } + bool -WindowManager::add_stock_icon(Gtk::IconSet &icon_set, - const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard) +WindowManager::add_stock_icon (Gtk::IconSet &icon_set, + cuString& icon_name, + Gtk::IconSize size, + bool wildcard) { // Try the icon theme if(add_theme_icon_source(icon_set, icon_name, size, wildcard)) return true; - - // Try the ~/.lumiera/icons folder - if(add_non_theme_icon_source(icon_set, ustring::compose("%1/%2", - GtkLumiera::get_home_data_path(), ustring("icons")), - icon_name, size, wildcard)) - return true; - // Try the local directory - if(add_non_theme_icon_source( - icon_set, get_current_dir(), icon_name, size, wildcard)) - return true; - - return false; + // Try to resolve the icon via the configured search path + lib::SearchPathSplitter iconLocations (iconSearchPath_); + while (iconLocations) + if (add_non_theme_icon_source (icon_set + ,iconLocations.next() + ,icon_name + ,size + ,wildcard)) + return true; + + return false; // icon not found } + bool -WindowManager::add_theme_icon_source(Gtk::IconSet &icon_set, - const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard) +WindowManager::add_theme_icon_source (Gtk::IconSet &icon_set, + cuString& icon_name, + Gtk::IconSize size, + bool wildcard) { // Get the size int width = 0, height = 0; @@ -269,22 +284,19 @@ WindowManager::add_theme_icon_source(Gtk::IconSet &icon_set, REQUIRE(theme); TODO ("find out how IconInfo could be made const. For example, GTKmm 2.10.10 is missing the const on operator bool() in iconinfo.h"); - IconInfo info = theme->lookup_icon(icon_name, width, - (IconLookupFlags)0); - if(info) - { - const ustring path(info.get_filename()); - if(add_stock_icon_from_path(path, icon_set, size, wildcard)) - return true; - } - - return false; + IconInfo info = theme->lookup_icon(icon_name, width, (IconLookupFlags)0); + + if (!info) return false; // unable to resolve Icon + + cuString path(info.get_filename()); + return add_stock_icon_from_path(path, icon_set, size, wildcard); } + bool -WindowManager::add_non_theme_icon_source(Gtk::IconSet &icon_set, - const Glib::ustring& base_dir, const Glib::ustring& icon_name, - Gtk::IconSize size, bool wildcard) +WindowManager::add_non_theme_icon_source (Gtk::IconSet &icon_set, + cuString& base_dir, cuString& icon_name, + Gtk::IconSize size, bool wildcard) { // Get the size int width = 0, height = 0; @@ -293,33 +305,37 @@ WindowManager::add_non_theme_icon_source(Gtk::IconSet &icon_set, REQUIRE(width > 0); // Try to load the icon - const ustring path(ustring::compose("%1/%2x%3/%4.png", + cuString path(ustring::compose("%1/%2x%3/%4.png", base_dir, width, height, icon_name)); return add_stock_icon_from_path(path, icon_set, size, wildcard); } + bool -WindowManager::add_stock_icon_from_path(Glib::ustring path, - Gtk::IconSet &icon_set, Gtk::IconSize size, bool wildcard) +WindowManager::add_stock_icon_from_path (string path, + Gtk::IconSet &icon_set, + Gtk::IconSize size, + bool wildcard) { - Gtk::IconSource source; + if (!fsys::exists (path)) return false; - try - { - // This throws an exception if the file is not found: + try { + Gtk::IconSource source; source.set_pixbuf(Gdk::Pixbuf::create_from_file(path)); + source.set_size_wildcarded(wildcard); + source.set_size(size); + + icon_set.add_source(source); + + return true; } - catch(const Glib::Exception& ex) + + catch(Glib::Exception const& ex) { + WARN (gui, "Failure when accessing icon '%s'. Problem: %s", cStr(path), cStr(ex.what())); return false; } - - source.set_size(size); - source.set_size_wildcarded(wildcard); - - icon_set.add_source(source); - - return true; } + } // namespace gui diff --git a/src/gui/window-manager.hpp b/src/gui/window-manager.hpp index 090babdc2..2dbd91e93 100644 --- a/src/gui/window-manager.hpp +++ b/src/gui/window-manager.hpp @@ -41,51 +41,55 @@ #include #include #include - +#include namespace gui { + +using std::string; -namespace model { - class Project; -} // model -namespace controller { - class Controller; -} // model +namespace model { class Project; } +namespace controller { class Controller; } +namespace workspace { class WorkspaceWindow;} -namespace workspace { - class WorkspaceWindow; -} /** - * The centralised manager of all lumiera-gui's windows. + * The centralised manager of all the windows, + * icons and resources within Lumiera's GUI. */ class WindowManager : boost::noncopyable { + string iconSearchPath_; + string resourceSerachPath_; + + public: /** * Initialise the window manager on application start. - * Register the icon configuration and sizes. + * Register the icon configuration and sizes and lookup + * all the icons -- either from the default theme of via + * the given Lumiera icon search paths (see \c setup.ini ). + * @see lumiera::Config */ - void init(); + void init (string const& iconPath, string const& resourcePath); /** - * Creates a new window connected to a specified project and - * controller + * Creates a new window connected to a specified project and controller * @param source_project The project to connect the window to. * @param source_controller The controller to connect the window to. */ - void new_window(gui::model::Project &source_project, - gui::controller::Controller &source_controller); + void newWindow (gui::model::Project&, gui::controller::Controller&); /** - * Sets the theme of the lumiera-gui's. - * @param path This string must specify a path where a GTK stylesheet - * will be found. + * Sets the theme to use for the Lumiera GUI. + * @param stylesheetName GTK stylesheet to load from the resourceSearchPath_ + * @throw error::Config if this stylesheet can't be resolved on the searchpath + * @see #init + * @see lumiera::Config */ - bool set_theme(Glib::ustring path); + void setTheme (string const& stylesheetName); /** * A utility function which reads a colour style from the GTK Style. @@ -102,9 +106,7 @@ public: private: - /** - * An event handler for when a window has been closed. - */ + /** Event handler for when a window has been closed */ bool on_window_closed(GdkEventAny* event); private: @@ -134,14 +136,14 @@ private: * @param icon_name The file name of the icon to add. * @param id The id name of the icon. * @param label The user readable icon name for this icon. - * @return Returns true if the icon was successfully loaded, returns - * false otherwise. + * @return \c true if the icon was successfully loaded, + * returns \c false otherwise. */ bool add_stock_icon_set( const Glib::RefPtr& factory, - const Glib::ustring& icon_name, - const Glib::ustring& id, - const Glib::ustring& label); + cuString& icon_name, + cuString& id, + cuString& label); /** * Loads an icon, searching standard icon locations, @@ -149,24 +151,22 @@ private: * @param icon_set The icon set to add the icon to. * @param icon_name The file name of the icon to load. * @param size The size of the icon to load. - * @param wildcard This value is set to true if this icon is - * wildcarded. - * @return Returns true if the icon was loaded successfully. + * @param wildcard \c true if this icon is to be wildcarded. + * @return \c true if the icon was loaded successfully. */ bool add_stock_icon(Gtk::IconSet &icon_set, - const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard); + cuString& icon_name, Gtk::IconSize size, bool wildcard); /** * Loads an icon from a the icon theme * @param icon_set The icon set to add the icon to. * @param icon_name The name of the icon to load. * @param size The size of the icon to load. - * @param wildcard This value is set to true if this icon is - * wildcarded. - * @return Returns true if the icon was loaded successfully. + * @param wildcard \c true if this icon is to be wildcarded. + * @return \c true if the icon was loaded successfully. */ bool add_theme_icon_source(Gtk::IconSet &icon_set, - const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard); + cuString& icon_name, Gtk::IconSize size, bool wildcard); /** * Loads an icon from a non theme set. @@ -174,12 +174,11 @@ private: * @param base_dir The root icons directory to load from. * @param icon_name The file name of the icon to load. * @param size The size of the icon to load. - * @param wildcard This value is set to true if this icon is - * wildcarded. - * @return Returns true if the icon was loaded successfully. + * @param wildcard \c true if this icon is to be wildcarded. + * @return \c true if the icon was loaded successfully. */ bool add_non_theme_icon_source(Gtk::IconSet &icon_set, - const Glib::ustring& base_dir, const Glib::ustring& icon_name, + cuString& base_dir, cuString& icon_name, Gtk::IconSize size, bool wildcard); /** @@ -187,13 +186,13 @@ private: * @param path The path to load from. * @param icon_set The icon set to add the icon to. * @param size The size of the icon to load. - * @param wildcard This value is set to true if this icon is - * wildcarded. - * @return Returns true if the icon was loaded successfully. + * @param wildcard \c true if this icon is to be wildcarded. + * @return \c true if the icon was loaded successfully. */ - bool add_stock_icon_from_path(Glib::ustring path, + bool add_stock_icon_from_path(string path, Gtk::IconSet &icon_set, Gtk::IconSize size, bool wildcard); - + + private: std::list< boost::shared_ptr > windowList; diff --git a/src/gui/workspace/actions.cpp b/src/gui/workspace/actions.cpp index 90bc89967..fffdd7f71 100644 --- a/src/gui/workspace/actions.cpp +++ b/src/gui/workspace/actions.cpp @@ -58,13 +58,13 @@ Actions::populate_main_actions(Glib::RefPtr uiManager) // File menu actionGroup->add(Action::create("FileMenu", _("_File"))); - actionGroup->add(Action::create("FileNewProject", Stock::NEW, _("_New Project...")), + actionGroup->add(Action::create("FileNewProject", Stock::NEW, _("_New Project...")), mem_fun(*this, &Actions::on_menu_file_new_project)); - actionGroup->add(Action::create("FileOpenProject", Stock::OPEN, _("_Open Project...")), + actionGroup->add(Action::create("FileOpenProject", Stock::OPEN, _("_Open Project...")), mem_fun(*this, &Actions::on_menu_file_open_project)); - actionGroup->add(Action::create("FileSaveProject", Stock::SAVE, _("_Save Project")), + actionGroup->add(Action::create("FileSaveProject", Stock::SAVE, _("_Save Project")), mem_fun(*this, &Actions::on_menu_others)); - actionGroup->add(Action::create("FileSaveProjectAs", Stock::SAVE_AS, _("_Save Project As...")), + actionGroup->add(Action::create("FileSaveProjectAs",Stock::SAVE_AS, _("_Save Project As...")), mem_fun(*this, &Actions::on_menu_others)); actionGroup->add(Action::create("FileRender", _("_Render...")), AccelKey("R"), @@ -78,11 +78,11 @@ Actions::populate_main_actions(Glib::RefPtr uiManager) mem_fun(*this, &Actions::on_menu_others)); actionGroup->add(Action::create("EditRedo", Stock::REDO), mem_fun(*this, &Actions::on_menu_others)); - actionGroup->add(Action::create("EditCut", Stock::CUT), + actionGroup->add(Action::create("EditCut", Stock::CUT), mem_fun(*this, &Actions::on_menu_others)); actionGroup->add(Action::create("EditCopy", Stock::COPY), mem_fun(*this, &Actions::on_menu_others)); - actionGroup->add(Action::create("EditPaste", Stock::PASTE), + actionGroup->add(Action::create("EditPaste",Stock::PASTE), mem_fun(*this, &Actions::on_menu_others)); actionGroup->add(Action::create("EditPreferences", Stock::PREFERENCES), mem_fun(*this, &Actions::on_menu_edit_preferences)); @@ -360,9 +360,8 @@ Actions::on_menu_help_about() // Configure the about dialog AboutDialog dialog; - //dialog.set_program_name(AppTitle); + dialog.set_program_name(GtkLumiera::getAppTitle()); dialog.set_version(GtkLumiera::getAppVersion()); - //dialog.set_version(AppState::get("version")); dialog.set_copyright(GtkLumiera::getCopyright()); dialog.set_website(GtkLumiera::getLumieraWebsite()); dialog.set_authors(GtkLumiera::getLumieraAuthors()); diff --git a/src/gui/workspace/workspace-window.cpp b/src/gui/workspace/workspace-window.cpp index b8ef1ea56..015daa4c5 100644 --- a/src/gui/workspace/workspace-window.cpp +++ b/src/gui/workspace/workspace-window.cpp @@ -84,7 +84,7 @@ WorkspaceWindow::create_ui() //set_default_direction (TEXT_DIR_RTL); //----- Configure the Window -----// - set_title(GtkLumiera::get_app_title()); + set_title(GtkLumiera::getAppTitle()); set_default_size(1024, 768); //----- Set up the UI Manager -----// diff --git a/src/lib/cmdline.cpp b/src/lib/cmdline.cpp index bffbd2e8e..249121e60 100644 --- a/src/lib/cmdline.cpp +++ b/src/lib/cmdline.cpp @@ -27,18 +27,12 @@ #include "include/logging.h" #include -#include #include -#include - -using boost::algorithm::split; -using boost::algorithm::join; -using boost::algorithm::is_any_of; -using boost::algorithm::token_compress_on; using boost::regex; using boost::smatch; using boost::regex_search; +using boost::algorithm::join; using util::noneg; diff --git a/src/lib/searchpath.cpp b/src/lib/searchpath.cpp index 809cc4889..393c16b66 100644 --- a/src/lib/searchpath.cpp +++ b/src/lib/searchpath.cpp @@ -80,7 +80,7 @@ namespace lib { // try / continue search path if (searchLocation.isValid()) - modulePathName = fsys::path() / searchLocation.fetch() / moduleName; + modulePathName = fsys::path() / searchLocation.next() / moduleName; else throw error::Config ("Module \""+moduleName+"\" not found" + (searchPath.empty()? ".":" in search path: "+searchPath)); diff --git a/src/lib/searchpath.hpp b/src/lib/searchpath.hpp index eff8b2510..64b420903 100644 --- a/src/lib/searchpath.hpp +++ b/src/lib/searchpath.hpp @@ -27,7 +27,6 @@ #include "lib/error.hpp" #include "lib/bool-checkable.hpp" -#include #include #include #include @@ -88,7 +87,7 @@ namespace lib { } string - fetch () + next () { if (!isValid()) throw error::Logic ("Search path exhausted." @@ -133,11 +132,13 @@ namespace lib { - /** helper to establish the location to search for loadable modules. - * This is a simple demonstration of the basic technique used in the - * real application source to establish a plugin search path, based - * on the actual executable position plus compiled in and configured - * relative and absolute path specifications. + /** helper to establish the location to search for loadable modules, + * configuration files, icons and further resources. After first trying + * the moduleName directly, the given search path is walked using the + * SearchPathSplitter, until encountering an existing file with the + * given name. + * @return the absolute pathname of the module file found + * @throws error::Config when the resolution fails */ string resolveModulePath (string moduleName, string searchPath = ""); diff --git a/src/lib/time.cpp b/src/lib/time.cpp index c9dc31a4b..a7efb8009 100644 --- a/src/lib/time.cpp +++ b/src/lib/time.cpp @@ -2,7 +2,8 @@ Time - Utilities for handling time Copyright (C) Lumiera.org - 2011, Christian Thaeter + 2008, Christian Thaeter + 2011, Hermann Vosseler This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/tests/lib/search-path-splitter-test.cpp b/tests/lib/search-path-splitter-test.cpp index bd58190e3..b9d1b1396 100644 --- a/tests/lib/search-path-splitter-test.cpp +++ b/tests/lib/search-path-splitter-test.cpp @@ -66,7 +66,7 @@ namespace test { walk ("/usr/bin:/usr/lib"); SearchPathSplitter sp(""); - VERIFY_ERROR (ITER_EXHAUST, sp.fetch() ); + VERIFY_ERROR (ITER_EXHAUST, sp.next() ); } void @@ -74,7 +74,7 @@ namespace test { { SearchPathSplitter path(spec); while (path) - cout << "➢➢" << path.fetch() << endl; + cout << "➢➢" << path.next() << endl; } @@ -86,9 +86,9 @@ namespace test { string expected = (exePath.remove_leaf() / "modules").string(); SearchPathSplitter sp("xyz:$ORIGIN/modules:abc"); - CHECK ("xyz" == sp.fetch()); - CHECK (sp.fetch() == expected); - CHECK ("abc" == sp.fetch()); + CHECK ("xyz" == sp.next()); + CHECK (sp.next() == expected); + CHECK ("abc" == sp.next()); CHECK (!sp.isValid()); } };