X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Ftoolbox.cpp;h=22ba151fcb171b01fc80fd3a323564871e203ecd;hb=c3ad95144d148602f672e95ddda1f18fc35502f8;hp=435f0d97ee79ee16d1c86a58b9a13a043a6962a4;hpb=55e0ee1a66bc612e4da9d19eb778bc1e2c50d051;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/toolbox.cpp b/synfig-studio/trunk/src/gtkmm/toolbox.cpp index 435f0d9..22ba151 100644 --- a/synfig-studio/trunk/src/gtkmm/toolbox.cpp +++ b/synfig-studio/trunk/src/gtkmm/toolbox.cpp @@ -192,12 +192,6 @@ void _create_stock_dialog2() dock_dialog->present(); } -static void -show_dialog_color() -{ - App::dialog_color->present(); -} - Toolbox::Toolbox(): Gtk::Window(Gtk::WINDOW_TOPLEVEL), dialog_settings(this,"toolbox") @@ -275,22 +269,14 @@ Toolbox::Toolbox(): Gtk::Image *icon; - ADD_TOOLBOX_BUTTON(button_new,"gtk-new","New"); - ADD_TOOLBOX_BUTTON(button_open,"gtk-open","Open"); + ADD_TOOLBOX_BUTTON(button_new,"gtk-new","New..."); + ADD_TOOLBOX_BUTTON(button_open,"gtk-open","Open..."); ADD_TOOLBOX_BUTTON(button_save,"gtk-save","Save"); - ADD_TOOLBOX_BUTTON(button_saveas,"gtk-save-as","SaveAs"); + ADD_TOOLBOX_BUTTON(button_saveas,"gtk-save-as","Save as..."); ADD_TOOLBOX_BUTTON(button_save_all,"synfig-saveall","Save All"); TOOLBOX_BUTTON(button_undo,"gtk-undo","Undo"); TOOLBOX_BUTTON(button_redo,"gtk-redo","Redo"); ADD_TOOLBOX_BUTTON(button_about,"synfig-about","About Synfig Studio"); - ADD_TOOLBOX_BUTTON(button_color,"synfig-color","Color Dialog"); - - TOOLBOX_BUTTON(button_rotoscope_bline,"synfig-rotoscope_bline",_("Old Rotoscope BLine")); - TOOLBOX_BUTTON(button_rotoscope_polygon,"synfig-rotoscope_polygon",_("Rotoscope Polygon")); - TOOLBOX_BUTTON(button_eyedrop,"synfig-eyedrop",_("Eyedrop Tool")); - TOOLBOX_BUTTON(button_rotoscope,"synfig-rotoscope_bline",_("Rotoscope 2")); - - button_about->signal_clicked().connect(sigc::ptr_fun(studio::App::dialog_about)); button_new->signal_clicked().connect(sigc::ptr_fun(studio::App::new_instance)); @@ -300,19 +286,20 @@ Toolbox::Toolbox(): button_save_all->signal_clicked().connect(sigc::ptr_fun(save_all)); button_undo->signal_clicked().connect(sigc::ptr_fun(studio::App::undo)); button_redo->signal_clicked().connect(sigc::ptr_fun(studio::App::redo)); - button_color->signal_clicked().connect(sigc::ptr_fun(show_dialog_color)); // Create the file button cluster Gtk::Table *file_buttons=manage(new class Gtk::Table(4, 4, false)); - file_buttons->attach(*button_new,0,1,0,1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - file_buttons->attach(*button_open,1,2,0,1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - file_buttons->attach(*button_save,2,3,0,1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - file_buttons->attach(*button_saveas,3,4,0,1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - file_buttons->attach(*button_save_all,0,1,1,2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - file_buttons->attach(*button_undo,1,2,1,2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - file_buttons->attach(*button_redo,2,3,1,2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - file_buttons->attach(*button_about,3,4,1,2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - //file_buttons->attach(*button_color,0,1,2,3, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + + file_buttons->attach(*button_new, 0,1, 0,1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + file_buttons->attach(*button_open, 1,2, 0,1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + file_buttons->attach(*button_save, 2,3, 0,1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + file_buttons->attach(*button_saveas, 3,4, 0,1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + + file_buttons->attach(*button_save_all, 0,1, 1,2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + file_buttons->attach(*button_undo, 1,2, 1,2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + file_buttons->attach(*button_redo, 2,3, 1,2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + file_buttons->attach(*button_about, 3,4, 1,2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + file_buttons->show(); tool_table=manage(new class Gtk::Table(4, 4, false)); @@ -335,11 +322,11 @@ Toolbox::Toolbox(): Gtk::Table *table1 = manage(new class Gtk::Table(1, 2, false)); table1->set_row_spacings(0); table1->set_col_spacings(0); - table1->attach(*menubar1, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK, 0, 0); - table1->attach(*file_buttons, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND,Gtk::EXPAND|Gtk::FILL, 0, 0); + table1->attach(*menubar1, 0,1, 0,1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK, 0, 0); + table1->attach(*file_buttons, 0,1, 1,2, Gtk::FILL|Gtk::EXPAND,Gtk::EXPAND|Gtk::FILL, 0, 0); //table1->attach(*manage(new Gtk::Label(_("Tools"))), 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND,Gtk::EXPAND|Gtk::FILL, 0, 0); - table1->attach(*handle_tools, 0, 1, 3, 4, Gtk::FILL|Gtk::EXPAND,Gtk::EXPAND|Gtk::FILL, 0, 0); - table1->attach(*handle_defaults, 0, 1, 4, 5, Gtk::FILL|Gtk::EXPAND,Gtk::EXPAND|Gtk::FILL, 0, 0); + table1->attach(*handle_tools, 0,1, 3,4, Gtk::FILL|Gtk::EXPAND,Gtk::EXPAND|Gtk::FILL, 0, 0); + table1->attach(*handle_defaults, 0,1, 4,5, Gtk::FILL|Gtk::EXPAND,Gtk::EXPAND|Gtk::FILL, 0, 0); table1->show_all(); @@ -366,11 +353,6 @@ Toolbox::Toolbox(): button_undo->set_sensitive(false); button_redo->set_sensitive(false); - button_rotoscope_bline->set_sensitive(false); - button_rotoscope->set_sensitive(false); - button_rotoscope_polygon->set_sensitive(false); - button_eyedrop->set_sensitive(false); - std::list listTargets; listTargets.push_back( Gtk::TargetEntry("text/plain") ); @@ -499,18 +481,18 @@ 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(); - - - int row=state_button_map.size()/4; int col=state_button_map.size()%4; @@ -525,7 +507,6 @@ Toolbox::add_state(const Smach::state_base *state) ) ); - refresh(); } @@ -542,7 +523,7 @@ Toolbox::update_undo_redo() // This should probably go elsewhere, but it should // work fine here with no troubles. - // These next several lines just adjust the rotoscope buttons + // These next several lines just adjust the tool buttons // so that they are only clickable when they should be. if(instance && App::get_selected_canvas_view()) { @@ -576,19 +557,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);