Added copyright lines for files I've edited this year.
[synfig.git] / synfig-studio / trunk / src / gtkmm / dock_history.cpp
index dde2718..4277f16 100644 (file)
@@ -1,20 +1,22 @@
-/* === S I N F G =========================================================== */
-/*!    \file dialog_history.cpp
+/* === S Y N F I G ========================================================= */
+/*!    \file dock_history.cpp
 **     \brief Template File
 **
-**     $Id: dock_history.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+**     $Id$
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 Chris Moore
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
 #include <sigc++/signal.h>
 #include <sigc++/hide.h>
 #include <sigc++/slot.h>
-#include <sinfgapp/action.h>
+#include <synfigapp/action.h>
 #include "historytreestore.h"
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
 
 using namespace std;
 using namespace etl;
-using namespace sinfg;
+using namespace synfig;
 using namespace studio;
 
 /* === M A C R O S ========================================================= */
@@ -67,12 +71,12 @@ Dock_History::Dock_History():
 {
        App::signal_instance_deleted().connect(sigc::mem_fun(*this,&studio::Dock_History::delete_instance));
        App::signal_instance_selected().connect(sigc::mem_fun(*this,&studio::Dock_History::set_selected_instance_signal));
-       
+
        action_group->add(Gtk::Action::create(
                "clear-undo",
-               Gtk::StockID("sinfg-clear_undo"),
-               _("Clear the UNDO Stack"),
-               _("Clear the UNDO Stack")
+               Gtk::StockID("synfig-clear_undo"),
+               _("Clear Undo Stack"),
+               _("Clear the undo stack")
        ),
                sigc::mem_fun(
                        *this,
@@ -81,9 +85,9 @@ Dock_History::Dock_History():
        );
        action_group->add(Gtk::Action::create(
                "clear-redo",
-               Gtk::StockID("sinfg-clear_redo"),
-               _("Clear the REDO Stack"),
-               _("Clear the REDO Stack")
+               Gtk::StockID("synfig-clear_redo"),
+               _("Clear Redo Stack"),
+               _("Clear the redo stack")
        ),
                sigc::mem_fun(
                        *this,
@@ -93,30 +97,30 @@ Dock_History::Dock_History():
        action_group->add(Gtk::Action::create(
                "undo",
                Gtk::StockID("gtk-undo"),
-               _("Undo previous action"),
-               _("Undo previous action")
+               _("Undo"),
+               _("Undo the previous action")
        ),
-               sigc::ptr_fun(studio::App::undo)        
+               sigc::ptr_fun(studio::App::undo)
        );
        action_group->add(Gtk::Action::create(
                "redo",
                Gtk::StockID("gtk-redo"),
-               _("Redo previous action"),
-               _("Redo previous action")
+               _("Redo"),
+               _("Redo the previously undone action")
        ),
-               sigc::ptr_fun(studio::App::redo)        
+               sigc::ptr_fun(studio::App::redo)
        );
 
-       action_group->add( Gtk::Action::create("toolbar-history", "History") );
+       action_group->add( Gtk::Action::create("toolbar-history", _("History")) );
        App::ui_manager()->insert_action_group(action_group);
 
        Glib::ustring ui_info =
        "<ui>"
        "       <toolbar action='toolbar-history'>"
        "       <toolitem action='undo' />"
+       "       <toolitem action='redo' />"
        "       <toolitem action='clear-undo' />"
        "       <toolitem action='clear-redo' />"
-       "       <toolitem action='redo' />"
        "       </toolbar>"
        "</ui>"
        ;
@@ -125,12 +129,12 @@ Dock_History::Dock_History():
 
        action_group->set_sensitive(false);
 
-       set_toolbar(*dynamic_cast<Gtk::Toolbar*>(App::ui_manager()->get_widget("/toolbar-history")));   
+       set_toolbar(*dynamic_cast<Gtk::Toolbar*>(App::ui_manager()->get_widget("/toolbar-history")));
        add(*create_action_tree());
-       
+
        /*
        add_button(
-               Gtk::StockID("sinfg-clear_undo"),
+               Gtk::StockID("synfig-clear_undo"),
                _("Clear the UNDO Stack")
        )->signal_clicked().connect(
                sigc::mem_fun(
@@ -139,7 +143,7 @@ Dock_History::Dock_History():
                )
        );
        add_button(
-               Gtk::StockID("sinfg-clear_redo"),
+               Gtk::StockID("synfig-clear_redo"),
                _("Clear the REDO Stack")
        )->signal_clicked().connect(
                sigc::mem_fun(
@@ -172,23 +176,23 @@ Dock_History::create_action_tree()
 
                Gtk::CellRendererToggle* toggle_cr = Gtk::manage( new Gtk::CellRendererToggle() );
                toggle_cr->signal_toggled().connect(sigc::mem_fun(*this, &studio::Dock_History::on_action_toggle) );
-               
+
                column->pack_start(*toggle_cr); //false = don't expand.
                column->add_attribute(toggle_cr->property_active(),history_tree_model.is_active);
                column->set_resizable();
                column->set_clickable();
-                               
+
                action_tree->append_column(*column);
        }
        /*{
-               Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column("Canvas") );
+               Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Canvas")) );
                Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText());
                text_cr->property_foreground()=Glib::ustring("#7f7f7f");
-               
+
                column->pack_start(*text_cr);
                column->add_attribute(text_cr->property_text(),history_tree_model.canvas_id);
                column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo);
-                               
+
                action_tree->append_column(*column);
        }*/
        {
@@ -196,35 +200,38 @@ Dock_History::create_action_tree()
 
                Gtk::CellRendererText* cell_renderer_jump=Gtk::manage(new Gtk::CellRendererText());
                column->pack_start(*cell_renderer_jump,true);
-               
-               cell_renderer_jump->property_text()="(JMP)";
+
+               cell_renderer_jump->property_text()=_("(JMP)");
                cell_renderer_jump->property_foreground()="#003a7f";
-               
+
                column->set_resizable();
                column->set_clickable();
-               
-               column->set_sort_column_id(COLUMNID_JUMP);
+
+               column->set_sort_column(COLUMNID_JUMP);
 
                action_tree->append_column(*column);
                //column->clicked();
        }
        {
-               Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column("Action") );
+               Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Action")) );
 
                Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText());
                text_cr->property_foreground()=Glib::ustring("#7f7f7f");
 
-               
+
 
                //column->pack_start(history_tree_model.icon, false); //false = don't expand.
                column->pack_start(*text_cr);
                column->add_attribute(text_cr->property_text(),history_tree_model.name);
                column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo);
-                               
+
                action_tree->append_column(*column);
        }
 
-       
+       action_tree->set_enable_search(true);
+       action_tree->set_search_column(history_tree_model.name);
+       action_tree->set_search_equal_func(sigc::ptr_fun(&studio::HistoryTreeStore::search_func));
+
        action_tree->set_rules_hint();
 //     action_tree->signal_row_activated().connect(sigc::mem_fun(*this,&Dock_History::on_row_activate));
        action_tree->signal_event().connect(sigc::mem_fun(*this,&Dock_History::on_action_event));
@@ -254,7 +261,7 @@ void
 Dock_History::clear_undo()
 {
        if(selected_instance && App::dialog_yes_no(_("Clear History"), _("You will not be able to undo any changes that you have made!\nAre you sure you want to clear the undo stack?")))
-       {               
+       {
                selected_instance->clear_undo_stack();
        }
 }
@@ -263,7 +270,7 @@ void
 Dock_History::clear_redo()
 {
        if(selected_instance && App::dialog_yes_no(_("Clear History"), _("You will not be able to redo any changes that you have made!\nAre you sure you want to clear the redo stack?")))
-       {               
+       {
                selected_instance->clear_redo_stack();
        }
 }
@@ -321,7 +328,7 @@ Dock_History::set_selected_instance(etl::loose_handle<studio::Instance> x)
 
        std::list<etl::handle<studio::Instance> >::iterator iter;
 
-       set_selected_instance_(x);      
+       set_selected_instance_(x);
 }
 
 void
@@ -356,11 +363,11 @@ Dock_History::on_action_event(GdkEvent *event)
                                )
                        ) break;
                        const Gtk::TreeRow row = *(action_tree->get_model()->get_iter(path));
-                       
+
                        //signal_user_click()(event->button.button,row,(ColumnID)column->get_sort_column_id());
                        if((ColumnID)column->get_sort_column_id()==COLUMNID_JUMP)
                        {
-                               etl::handle<sinfgapp::Action::Undoable> action(row[model.action]);
+                               etl::handle<synfigapp::Action::Undoable> action(row[model.action]);
                                try{
                                if((bool)row[model.is_undo])
                                {
@@ -381,7 +388,7 @@ Dock_History::on_action_event(GdkEvent *event)
                                }
                        }
                }
-               
+
        case GDK_BUTTON_RELEASE:
                break;
        default:
@@ -396,10 +403,10 @@ Dock_History::on_action_toggle(const Glib::ustring& path_string)
        studio::HistoryTreeStore::Model history_tree_model;
 
        Gtk::TreePath path(path_string);
-       
+
        const Gtk::TreeRow row = *(selected_instance->history_tree_store()->get_iter(path));
 
-       handle<sinfgapp::Action::Undoable> action=row[history_tree_model.action];
-       
-       selected_instance->sinfgapp::Instance::set_action_status(action,!action->is_active());
+       handle<synfigapp::Action::Undoable> action=row[history_tree_model.action];
+
+       selected_instance->synfigapp::Instance::set_action_status(action,!action->is_active());
 }