X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Ftoolbox.cpp;h=3a9456e26a7315c91e1759094380b744502a2538;hb=37600b4b217caa5e316984ec0b035c5e8f9698af;hp=7559f32c5ee70d0eea1e28d56b1f302039043962;hpb=f59b7cc0fa5bcd11c52025fe7b06287cffae4cd5;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/toolbox.cpp b/synfig-studio/trunk/src/gtkmm/toolbox.cpp index 7559f32..3a9456e 100644 --- a/synfig-studio/trunk/src/gtkmm/toolbox.cpp +++ b/synfig-studio/trunk/src/gtkmm/toolbox.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -131,8 +132,7 @@ save_selected_instance() return; } - if(!studio::App::get_selected_instance()->save()) - App::dialog_error_blocking("Save - Error","Unable to save file"); + studio::App::get_selected_instance()->save(); } void @@ -218,6 +218,8 @@ Toolbox::Toolbox(): dock_dialogs->items().push_back(Gtk::Menu_Helpers::MenuElem("Canvases, History",sigc::ptr_fun(_create_stock_dialog1))); dock_dialogs->items().push_back(Gtk::Menu_Helpers::MenuElem("Layers, Children, Params",sigc::ptr_fun(_create_stock_dialog2))); dock_dialogs->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); + dock_dialogs->items().push_back(Gtk::Menu_Helpers::MenuElem("Reset Windows to Original Layout",sigc::ptr_fun(App::reset_initial_window_configuration))); + dock_dialogs->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); filemenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::NEW, @@ -481,12 +483,15 @@ Toolbox::add_state(const Smach::state_base *state) String name=state->get_name(); + Gtk::StockItem stock_item; + Gtk::Stock::lookup(Gtk::StockID("synfig-"+name),stock_item); + Gtk::ToggleButton* button; button=manage(new class Gtk::ToggleButton()); - icon=manage(new Gtk::Image(Gtk::StockID("synfig-"+name),Gtk::IconSize(4))); + icon=manage(new Gtk::Image(stock_item.get_stock_id(),Gtk::IconSize(4))); button->add(*icon); - tooltips.set_tip(*button,name); + tooltips.set_tip(*button,stock_item.get_label()); icon->show(); button->show(); @@ -554,19 +559,27 @@ Toolbox::on_recent_files_changed() recent_files_menu->remove(**recent_files_menu->get_children().begin()); list::const_iterator iter; - // Check to see if the file is already on the list. - // If it is, then remove it from the list for(iter=App::get_recent_files().begin();iter!=App::get_recent_files().end();iter++) - recent_files_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(basename(*iter), + { + string raw = basename(*iter), quoted; + size_t pos = 0, last_pos = 0; + + // replace _ in filenames by __ or it won't show up in the menu + for (pos = last_pos = 0; (pos = raw.find('_', pos)) != string::npos; last_pos = pos) + quoted += raw.substr(last_pos, ++pos - last_pos) + '_'; + quoted += raw.substr(last_pos); + + recent_files_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(quoted, sigc::hide_return(sigc::bind(sigc::ptr_fun(&App::open),*iter)) )); + } // HACK show(); } void -Toolbox::on_drop_drag_data_received(const Glib::RefPtr& context, int x, int y, const Gtk::SelectionData& selection_data_, guint info, guint time) +Toolbox::on_drop_drag_data_received(const Glib::RefPtr& context, int /*x*/, int /*y*/, const Gtk::SelectionData& selection_data_, guint /*info*/, guint time) { // We will make this true once we have a solid drop bool success(false);