00001
00022
00023
00024
00025
00026 #ifndef __SYNFIG_STUDIO_HISTORYTREESTORE_H
00027 #define __SYNFIG_STUDIO_HISTORYTREESTORE_H
00028
00029
00030
00031 #include <gtkmm/treestore.h>
00032 #include <synfigapp/canvasinterface.h>
00033 #include <gdkmm/pixbuf.h>
00034 #include <synfigapp/action.h>
00035
00036
00037
00038
00039
00040
00041
00042 namespace studio {
00043
00044 class Instance;
00045
00046 class HistoryTreeStore : virtual public Gtk::TreeStore
00047 {
00048
00049
00050
00051
00052 public:
00053
00054 class Model : public Gtk::TreeModel::ColumnRecord
00055 {
00056 public:
00057 public:
00058 Gtk::TreeModelColumn<etl::handle<synfigapp::Action::Undoable> > action;
00059 Gtk::TreeModelColumn<Glib::ustring> name;
00060 Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
00061 Gtk::TreeModelColumn<bool> is_active;
00062 Gtk::TreeModelColumn<bool> is_undo;
00063 Gtk::TreeModelColumn<bool> is_redo;
00064
00065 Gtk::TreeModelColumn<Glib::ustring> canvas_id;
00066 Gtk::TreeModelColumn<synfig::Canvas::Handle> canvas;
00067
00068 Model()
00069 {
00070 add(action);
00071 add(name);
00072 add(icon);
00073 add(is_active);
00074 add(is_undo);
00075 add(is_redo);
00076 add(canvas_id);
00077 add(canvas);
00078 }
00079 };
00080
00081
00082
00083
00084
00085 public:
00086
00087 const Model model;
00088
00089
00090
00091
00092
00093 private:
00094
00095 etl::loose_handle<studio::Instance> instance_;
00096 Gtk::TreeIter curr_row;
00097
00098
00099
00100
00101
00102 private:
00103
00104
00105
00106
00107
00108 private:
00109
00110 sigc::signal<void> signal_undo_tree_changed_;
00111
00112
00113
00114
00115
00116 public:
00117
00118 sigc::signal<void>& signal_undo_tree_changed() { return signal_undo_tree_changed_; }
00119
00120
00121
00122
00123
00124 private:
00125
00126 void on_undo();
00127
00128 void on_redo();
00129
00130 void on_undo_stack_cleared();
00131
00132 void on_redo_stack_cleared();
00133
00134 void on_new_action(etl::handle<synfigapp::Action::Undoable> action);
00135
00136 void on_action_status_changed(etl::handle<synfigapp::Action::Undoable> action);
00137
00138
00139
00140
00141
00142 public:
00143
00144 HistoryTreeStore(etl::loose_handle<studio::Instance> instance_);
00145 ~HistoryTreeStore();
00146
00147 etl::loose_handle<studio::Instance> instance() { return instance_; }
00148 etl::loose_handle<const studio::Instance> instance()const { return instance_; }
00149
00150 void rebuild();
00151
00152 void refresh() { rebuild(); }
00153
00154 void insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool is_active=true, bool is_undo=true, bool is_redo=false);
00155
00156 static bool search_func(const Glib::RefPtr<TreeModel>&,int,const Glib::ustring&,const TreeModel::iterator&);
00157
00158
00159
00160
00161
00162 public:
00163
00164 static Glib::RefPtr<HistoryTreeStore> create(etl::loose_handle<studio::Instance> instance);
00165
00166 };
00167
00168 };
00169
00170
00171
00172 #endif