Back to index

easystroke  0.5.5.1
Classes | Public Member Functions | Private Member Functions | Private Attributes
Actions Class Reference

#include <actions.h>

Collaboration diagram for Actions:
Collaboration graph
[legend]

List of all members.

Classes

class  Apps
class  AppsStore
class  ModelColumns
class  OnStroke
class  Single
class  Store

Public Member Functions

 Actions ()

Private Member Functions

void on_button_delete ()
void on_button_new ()
void on_button_record ()
void on_selection_changed ()
void on_cursor_changed ()
void on_name_edited (const Glib::ustring &path, const Glib::ustring &new_text)
void on_text_edited (const Glib::ustring &path, const Glib::ustring &new_text)
void on_type_edited (const Glib::ustring &path, const Glib::ustring &new_text)
void on_accel_edited (const Glib::ustring &path_string, guint accel_key, Gdk::ModifierType accel_mods, guint hardware_keycode)
void on_combo_edited (const Glib::ustring &path_string, guint item)
void on_arg_editing_started (Gtk::CellEditable *editable, const Glib::ustring &path)
void on_something_editing_started (Gtk::CellEditable *editable, const Glib::ustring &path)
void on_something_editing_canceled ()
void on_row_activated (const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *column)
void on_cell_data_name (Gtk::CellRenderer *cell, const Gtk::TreeModel::iterator &iter)
void on_cell_data_type (Gtk::CellRenderer *cell, const Gtk::TreeModel::iterator &iter)
void on_cell_data_arg (Gtk::CellRenderer *cell, const Gtk::TreeModel::iterator &iter)
int compare_ids (const Gtk::TreeModel::iterator &a, const Gtk::TreeModel::iterator &b)
Gtk::TreeRow get_selected_row ()
void focus (Unique *id, int col, bool edit)
bool do_focus (Unique *id, Gtk::TreeViewColumn *col, bool edit)
bool select_app (const Gtk::TreeModel::Path &path, const Gtk::TreeModel::iterator &iter, ActionListDiff *actions)
void on_add_app ()
void on_add_group ()
void on_group_name_edited (const Glib::ustring &path, const Glib::ustring &new_text)
void on_apps_selection_changed ()
void load_app_list (const Gtk::TreeNodeChildren &ch, ActionListDiff *actions)
void on_cell_data_apps (Gtk::CellRenderer *cell, const Gtk::TreeModel::iterator &iter)
void update_action_list ()
void update_row (const Gtk::TreeRow &row)
bool count_app_actions (const Gtk::TreeIter &i)
void update_counts ()
void on_reset_actions ()
void on_remove_app ()

Private Attributes

ModelColumns cols
TreeViewMulti tv
Glib::RefPtr< Storetm
Gtk::TreeView * apps_view
Glib::RefPtr< AppsStoreapps_model
Single type
Apps ca
Glib::RefPtr< Gtk::ListStore > type_store
Gtk::Button * button_record
Gtk::Button * button_delete
Gtk::Button * button_remove_app
Gtk::Button * button_reset_actions
Gtk::CheckButton * check_show_deleted
Gtk::Expander * expander_apps
bool editing_new
bool editing
ActionListDiffaction_list

Detailed Description

Definition at line 36 of file actions.h.


Constructor & Destructor Documentation

Definition at line 192 of file actions.cc.

                 :
       apps_view(0),
       editing_new(false),
       editing(false),
       action_list(actions.get_root())
{
       Gtk::ScrolledWindow *sw;
       widgets->get_widget("scrolledwindow_actions", sw);
       widgets->get_widget("treeview_apps", apps_view);
       sw->add(tv);
       tv.show();

       Gtk::Button *button_add, *button_add_app, *button_add_group;
       widgets->get_widget("button_add_action", button_add);
       widgets->get_widget("button_delete_action", button_delete);
       widgets->get_widget("button_record", button_record);
       widgets->get_widget("button_add_app", button_add_app);
       widgets->get_widget("button_add_group", button_add_group);
       widgets->get_widget("button_remove_app", button_remove_app);
       widgets->get_widget("button_reset_actions", button_reset_actions);
       widgets->get_widget("check_show_deleted", check_show_deleted);
       widgets->get_widget("expander_apps", expander_apps);
       button_record->signal_clicked().connect(sigc::mem_fun(*this, &Actions::on_button_record));
       button_delete->signal_clicked().connect(sigc::mem_fun(*this, &Actions::on_button_delete));
       button_add->signal_clicked().connect(sigc::mem_fun(*this, &Actions::on_button_new));
       button_add_app->signal_clicked().connect(sigc::mem_fun(*this, &Actions::on_add_app));
       button_add_group->signal_clicked().connect(sigc::mem_fun(*this, &Actions::on_add_group));
       button_remove_app->signal_clicked().connect(sigc::mem_fun(*this, &Actions::on_remove_app));
       button_reset_actions->signal_clicked().connect(sigc::mem_fun(*this, &Actions::on_reset_actions));

       tv.signal_cursor_changed().connect(sigc::mem_fun(*this, &Actions::on_cursor_changed));
       tv.signal_row_activated().connect(sigc::mem_fun(*this, &Actions::on_row_activated));
       tv.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &Actions::on_selection_changed));

       tm = Store::create(cols, this);

       tv.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);

       int n;
       n = tv.append_column(_("Stroke"), cols.stroke);
       tv.get_column(n-1)->set_sort_column(cols.id);
       tm->set_sort_func(cols.id, sigc::mem_fun(*this, &Actions::compare_ids));
       tm->set_default_sort_func(sigc::mem_fun(*this, &Actions::compare_ids));
       tm->set_sort_column(Gtk::TreeSortable::DEFAULT_SORT_COLUMN_ID, Gtk::SORT_ASCENDING);

       n = tv.append_column(_("Name"), cols.name);
       Gtk::CellRendererText *name_renderer = dynamic_cast<Gtk::CellRendererText *>(tv.get_column_cell_renderer(n-1));
       name_renderer->property_editable() = true;
       name_renderer->signal_edited().connect(sigc::mem_fun(*this, &Actions::on_name_edited));
       name_renderer->signal_editing_started().connect(sigc::mem_fun(*this, &Actions::on_something_editing_started));
       name_renderer->signal_editing_canceled().connect(sigc::mem_fun(*this, &Actions::on_something_editing_canceled));
       Gtk::TreeView::Column *col_name = tv.get_column(n-1);
       col_name->set_sort_column(cols.name);
       col_name->set_cell_data_func(*name_renderer, sigc::mem_fun(*this, &Actions::on_cell_data_name));
       col_name->set_resizable();

       type_store = Gtk::ListStore::create(type);
       for (TypeInfo *i = all_types; i->name; i++)
              (*(type_store->append()))[type.type] = _(i->name);

       Gtk::CellRendererCombo *type_renderer = Gtk::manage(new Gtk::CellRendererCombo);
       type_renderer->property_model() = type_store;
       type_renderer->property_editable() = true;
       type_renderer->property_text_column() = 0;
       type_renderer->property_has_entry() = false;
       type_renderer->signal_edited().connect(sigc::mem_fun(*this, &Actions::on_type_edited));
       type_renderer->signal_editing_started().connect(sigc::mem_fun(*this, &Actions::on_something_editing_started));
       type_renderer->signal_editing_canceled().connect(sigc::mem_fun(*this, &Actions::on_something_editing_canceled));

       n = tv.append_column(_("Type"), *type_renderer);
       Gtk::TreeView::Column *col_type = tv.get_column(n-1);
       col_type->add_attribute(type_renderer->property_text(), cols.type);
       col_type->set_cell_data_func(*type_renderer, sigc::mem_fun(*this, &Actions::on_cell_data_type));

       CellRendererTextish *arg_renderer = Gtk::manage(new CellRendererTextish);
       n = tv.append_column(_("Details"), *arg_renderer);
       Gtk::TreeView::Column *col_arg = tv.get_column(n-1);
       col_arg->add_attribute(arg_renderer->property_text(), cols.arg);
       col_arg->set_cell_data_func(*arg_renderer, sigc::mem_fun(*this, &Actions::on_cell_data_arg));
       col_arg->set_resizable();
       arg_renderer->property_editable() = true;
       arg_renderer->signal_key_edited().connect(sigc::mem_fun(*this, &Actions::on_accel_edited));
       arg_renderer->signal_combo_edited().connect(sigc::mem_fun(*this, &Actions::on_combo_edited));
       arg_renderer->signal_edited().connect(sigc::mem_fun(*this, &Actions::on_text_edited));
       arg_renderer->signal_editing_started().connect(sigc::mem_fun(*this, &Actions::on_arg_editing_started));
       arg_renderer->items = Misc::types;

       update_action_list();
       tv.set_model(tm);
       tv.enable_model_drag_source();
       tv.enable_model_drag_dest();

       check_show_deleted->signal_toggled().connect(sigc::mem_fun(*this, &Actions::update_action_list));
       expander_apps->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &Actions::on_apps_selection_changed));
       apps_view->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &Actions::on_apps_selection_changed));
       apps_model = AppsStore::create(ca, this);

       load_app_list(apps_model->children(), actions.get_root());
       update_counts();

       apps_view->append_column_editable(_("Application"), ca.app);
       apps_view->get_column(0)->set_expand(true);
       apps_view->get_column(0)->set_cell_data_func(
                     *apps_view->get_column_cell_renderer(0), sigc::mem_fun(*this, &Actions::on_cell_data_apps));
       Gtk::CellRendererText *app_name_renderer =
              dynamic_cast<Gtk::CellRendererText *>(apps_view->get_column_cell_renderer(0));
       app_name_renderer->signal_edited().connect(sigc::mem_fun(*this, &Actions::on_group_name_edited));
       apps_view->append_column(_("Actions"), ca.count);

       apps_view->set_model(apps_model);
       apps_view->enable_model_drag_dest();
       apps_view->expand_all();
}

Here is the call graph for this function:


Member Function Documentation

int Actions::compare_ids ( const Gtk::TreeModel::iterator &  a,
const Gtk::TreeModel::iterator &  b 
) [private]

Definition at line 345 of file actions.cc.

                                                                                     {
       Unique *x = (*a)[cols.id];
       Unique *y = (*b)[cols.id];
       if (x->level == y->level) {
              if (x->i == y->i)
                     return 0;
              if (x->i < y->i)
                     return -1;
              else
                     return 1;
       }
       if (x->level < y->level)
              return -1;
       else
              return 1;
}

Here is the caller graph for this function:

bool Actions::count_app_actions ( const Gtk::TreeIter &  i) [private]

Definition at line 704 of file actions.cc.

                                                    {
       (*i)[ca.count] = ((ActionListDiff*)(*i)[ca.actions])->count_actions();
       return false;
}

Here is the caller graph for this function:

bool Actions::do_focus ( Unique id,
Gtk::TreeViewColumn *  col,
bool  edit 
) [private]

Definition at line 900 of file actions.cc.

                                                                    {
       if (!editing) {
              Gtk::TreeModel::Children chs = tm->children();
              for (Gtk::TreeIter i = chs.begin(); i != chs.end(); ++i)
                     if ((*i)[cols.id] == id) {
                            tv.set_cursor(Gtk::TreePath(*i), *col, edit);
                     }
       }
       return false;
}

Here is the caller graph for this function:

void Actions::focus ( Unique id,
int  col,
bool  edit 
) [private]

Definition at line 911 of file actions.cc.

                                                  {
       editing = false;
       Glib::signal_idle().connect(sigc::bind(sigc::mem_fun(*this, &Actions::do_focus), id, tv.get_column(col), edit));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Gtk::TreeRow Actions::get_selected_row ( ) [private]

Definition at line 849 of file actions.cc.

                                     {
       std::vector<Gtk::TreePath> paths = tv.get_selection()->get_selected_rows();
       return Gtk::TreeRow(*tm->get_iter(*paths.begin()));
}

Here is the caller graph for this function:

void Actions::load_app_list ( const Gtk::TreeNodeChildren &  ch,
ActionListDiff actions 
) [private]

Definition at line 306 of file actions.cc.

                                                                                  {
       Gtk::TreeRow row = *(apps_model->append(ch));
       row[ca.app] = app_name_hr(actions->name);
       row[ca.actions] = actions;
       for (ActionListDiff::iterator i = actions->begin(); i != actions->end(); i++)
              load_app_list(row.children(), &(*i));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_accel_edited ( const Glib::ustring &  path_string,
guint  accel_key,
Gdk::ModifierType  accel_mods,
guint  hardware_keycode 
) [private]

Definition at line 936 of file actions.cc.

                                                                                                                                 {
       Gtk::TreeRow row(*tm->get_iter(path_string));
       Type type = from_name(row[cols.type]);
       if (type == KEY) {
              RSendKey send_key = SendKey::create(accel_key, accel_mods);
              Glib::ustring str = send_key->get_label();
              if (row[cols.arg] == str)
                     return;
              action_list->set_action(row[cols.id], boost::static_pointer_cast<Action>(send_key));
       } else if (type == SCROLL) {
              RScroll scroll = Scroll::create(accel_mods);
              Glib::ustring str = scroll->get_label();
              if (row[cols.arg] == str)
                     return;
              action_list->set_action(row[cols.id], boost::static_pointer_cast<Action>(scroll));
       } else if (type == IGNORE) {
              RIgnore ignore = Ignore::create(accel_mods);
              Glib::ustring str = ignore->get_label();
              if (row[cols.arg] == str)
                     return;
              action_list->set_action(row[cols.id], boost::static_pointer_cast<Action>(ignore));
       } else return;
       update_row(row);
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_add_app ( ) [private]

Definition at line 602 of file actions.cc.

                         {
       std::string name = select_window();
       if (actions.apps.count(name)) {
              apps_model->foreach(sigc::bind(sigc::mem_fun(*this, &Actions::select_app), actions.apps[name]));
              return;
       }
       ActionListDiff *parent = action_list->app ? actions.get_root() : action_list;
       ActionListDiff *child = parent->add_child(name, true);
       const Gtk::TreeNodeChildren &ch = parent == actions.get_root() ?
              apps_model->children().begin()->children() :
              apps_view->get_selection()->get_selected()->children();
       Gtk::TreeRow row = *(apps_model->append(ch));
       row[ca.app] = app_name_hr(name);
       row[ca.actions] = child;
       actions.apps[name] = child;
       Gtk::TreePath path = apps_model->get_path(row);
       apps_view->expand_to_path(path);
       apps_view->set_cursor(path);
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_add_group ( ) [private]

Definition at line 663 of file actions.cc.

                           {
       ActionListDiff *parent = action_list->app ? actions.get_root() : action_list;
       Glib::ustring name = _("Group");
       ActionListDiff *child = parent->add_child(name, false);
       const Gtk::TreeNodeChildren &ch = parent == actions.get_root() ?
              apps_model->children().begin()->children() :
              apps_view->get_selection()->get_selected()->children();
       Gtk::TreeRow row = *(apps_model->append(ch));
       row[ca.app] = name;
       row[ca.actions] = child;
       actions.apps[name] = child;
       Gtk::TreePath path = apps_model->get_path(row);
       apps_view->expand_to_path(path);
       apps_view->set_cursor(path, *apps_view->get_column(0), true);
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 688 of file actions.cc.

                                        {
       ActionListDiff *new_action_list = actions.get_root();
       if (expander_apps->property_expanded().get_value()) {
              if (apps_view->get_selection()->count_selected_rows()) {
                     Gtk::TreeIter i = apps_view->get_selection()->get_selected();
                     new_action_list = (*i)[ca.actions];
              }
              button_remove_app->set_sensitive(new_action_list != actions.get_root());
       }
       if (action_list != new_action_list) {
              action_list = new_action_list;
              update_action_list();
              on_selection_changed();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_arg_editing_started ( Gtk::CellEditable *  editable,
const Glib::ustring &  path 
) [private]

Definition at line 983 of file actions.cc.

                                                                                       {
       tv.grab_focus();
       Gtk::TreeRow row(*tm->get_iter(path));
       if (from_name(row[cols.type]) != BUTTON)
              return;
       ButtonInfo bi;
       RButton bt = boost::static_pointer_cast<Button>(action_list->get_info(row[cols.id])->action);
       if (bt)
              bi = bt->get_button_info();
       SelectButton sb(bi, false, false);
       if (!sb.run())
              return;
       bt = boost::static_pointer_cast<Button>(Button::create(Gdk::ModifierType(sb.event.state), sb.event.button));
       action_list->set_action(row[cols.id], bt);
       update_row(row);
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_button_delete ( ) [private]

Definition at line 552 of file actions.cc.

                               {
       int n = tv.get_selection()->count_selected_rows();

       Glib::ustring str;
       if (n == 1)
              str = Glib::ustring::compose(_("Action \"%1\" is about to be deleted."), get_selected_row()[cols.name]);
       else
              str = Glib::ustring::compose(ngettext("One action is about to be deleted.",
                                   "%1 actions are about to be deleted", n), n);

       Gtk::MessageDialog *dialog;
       widgets->get_widget("dialog_delete", dialog);
       dialog->set_message(ngettext("Delete an Action", "Delete Actions", n));
       dialog->set_secondary_text(str);
       Gtk::Button *del;
       widgets->get_widget("button_delete_delete", del);

       dialog->show();
       del->grab_focus();
       bool ok = dialog->run() == 1;
       dialog->hide();
       if (!ok)
              return;

       std::vector<Gtk::TreePath> paths = tv.get_selection()->get_selected_rows();
       for (std::vector<Gtk::TreePath>::iterator i = paths.begin(); i != paths.end(); ++i) {
              Gtk::TreeRow row(*tm->get_iter(*i));
              action_list->remove(row[cols.id]);
       }
       update_action_list();
       update_actions();
       update_counts();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_button_new ( ) [private]

Definition at line 872 of file actions.cc.

                            {
       editing_new = true;
       Unique *before = 0;
       if (tv.get_selection()->count_selected_rows()) {
              std::vector<Gtk::TreePath> paths = tv.get_selection()->get_selected_rows();
              Gtk::TreeIter i = tm->get_iter(paths[paths.size()-1]);
              i++;
              if (i != tm->children().end())
                     before = (*i)[cols.id];
       }

       Gtk::TreeModel::Row row = *(tm->append());
       StrokeInfo si;
       si.action = Command::create("");
       Unique *id = action_list->add(si, before);
       row[cols.id] = id;
       std::string name;
       if (action_list != actions.get_root())
              name = action_list->name + " ";
       name += Glib::ustring::compose(_("Gesture %1"), action_list->order_size());
       action_list->set_name(id, name);

       update_row(row);
       focus(id, 1, true);
       update_actions();
       update_counts();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_button_record ( ) [private]

Definition at line 835 of file actions.cc.

                               {
       Gtk::TreeModel::Path path;
       Gtk::TreeViewColumn *col;
       tv.get_cursor(path, col);
       on_row_activated(path, col);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_cell_data_apps ( Gtk::CellRenderer *  cell,
const Gtk::TreeModel::iterator &  iter 
) [private]

Definition at line 586 of file actions.cc.

                                                                                       {
       ActionListDiff *as = (*iter)[ca.actions];
       Gtk::CellRendererText *renderer = dynamic_cast<Gtk::CellRendererText *>(cell);
       if (renderer)
              renderer->property_editable().set_value(actions.get_root() != as && !as->app);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_cell_data_arg ( Gtk::CellRenderer *  cell,
const Gtk::TreeModel::iterator &  iter 
) [private]

Definition at line 332 of file actions.cc.

                                                                                      {
       bool bold = (*iter)[cols.action_bold];
       bool deactivated = (*iter)[cols.deactivated];
       cell->property_sensitive().set_value(!deactivated);
       CellRendererTextish *renderer = dynamic_cast<CellRendererTextish *>(cell);
       if (!renderer)
              return;
       renderer->property_weight().set_value(bold ? 700 : 400);

       Glib::ustring str = (*iter)[cols.type];
       renderer->mode = all_types[from_name(str)].mode;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_cell_data_name ( Gtk::CellRenderer *  cell,
const Gtk::TreeModel::iterator &  iter 
) [private]

Definition at line 314 of file actions.cc.

                                                                                       {
       bool bold = (*iter)[cols.name_bold];
       bool deactivated = (*iter)[cols.deactivated];
       Gtk::CellRendererText *renderer = dynamic_cast<Gtk::CellRendererText *>(cell);
       if (renderer)
              renderer->property_weight().set_value(bold ? 700 : 400);
       cell->property_sensitive().set_value(!deactivated);
}

Here is the caller graph for this function:

void Actions::on_cell_data_type ( Gtk::CellRenderer *  cell,
const Gtk::TreeModel::iterator &  iter 
) [private]

Definition at line 323 of file actions.cc.

                                                                                       {
       bool bold = (*iter)[cols.action_bold];
       bool deactivated = (*iter)[cols.deactivated];
       Gtk::CellRendererText *renderer = dynamic_cast<Gtk::CellRendererText *>(cell);
       if (renderer)
              renderer->property_weight().set_value(bold ? 700 : 400);
       cell->property_sensitive().set_value(!deactivated);
}

Here is the caller graph for this function:

void Actions::on_combo_edited ( const Glib::ustring &  path_string,
guint  item 
) [private]

Definition at line 962 of file actions.cc.

                                                                        {
       if (item < 0)
              item = 0;
       RMisc misc = Misc::create((Misc::Type)item);
       Glib::ustring str = misc->get_label();
       Gtk::TreeRow row(*tm->get_iter(path_string));
       if (row[cols.arg] == str)
              return;
       action_list->set_action(row[cols.id], boost::static_pointer_cast<Action>(misc));
       update_row(row);
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_cursor_changed ( ) [private]

Definition at line 842 of file actions.cc.

                                {
       Gtk::TreeModel::Path path;
       Gtk::TreeViewColumn *col;
       tv.get_cursor(path, col);
       Gtk::TreeRow row(*tm->get_iter(path));
}

Here is the caller graph for this function:

void Actions::on_group_name_edited ( const Glib::ustring &  path,
const Glib::ustring &  new_text 
) [private]

Definition at line 680 of file actions.cc.

                                                                                       {
       Gtk::TreeRow row(*apps_model->get_iter(path));
       row[ca.app] = new_text;
       ActionListDiff *as = row[ca.actions];
       as->name = new_text;
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_name_edited ( const Glib::ustring &  path,
const Glib::ustring &  new_text 
) [private]

Definition at line 916 of file actions.cc.

                                                                                 {
       Gtk::TreeRow row(*tm->get_iter(path));
       action_list->set_name(row[cols.id], new_text);
       update_actions();
       update_row(row);
       focus(row[cols.id], 2, editing_new);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_remove_app ( ) [private]

Definition at line 623 of file actions.cc.

                            {
       if (action_list == actions.get_root())
              return;
       int size = action_list->size_rec();
       if (size) {
              Gtk::MessageDialog *dialog;
              widgets->get_widget("dialog_delete", dialog);
              Glib::ustring str = Glib::ustring::compose(_("%1 \"%2\" (containing %3 %4) is about to be deleted."),
                            action_list->app ? _("The application") : _("The group"),
                            action_list->name,
                            size,
                            ngettext("action", "actions", size));
              dialog->set_message(action_list->app ? _("Delete an Application") : _("Delete an Application Group"));
              dialog->set_secondary_text(str);
              Gtk::Button *del;
              widgets->get_widget("button_delete_delete", del);
              dialog->show();
              del->grab_focus();
              bool ok = dialog->run() == 1;
              dialog->hide();
              if (!ok)
                     return;
       }
       if (!action_list->remove())
              return;
       apps_model->erase(*apps_view->get_selection()->get_selected());
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_reset_actions ( ) [private]

Definition at line 652 of file actions.cc.

                               {
       std::vector<Gtk::TreePath> paths = tv.get_selection()->get_selected_rows();
       for (std::vector<Gtk::TreePath>::iterator i = paths.begin(); i != paths.end(); ++i) {
              Gtk::TreeRow row(*tm->get_iter(*i));
              action_list->reset(row[cols.id]);
       }
       update_action_list();
       on_selection_changed();
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_row_activated ( const Gtk::TreeModel::Path &  path,
Gtk::TreeViewColumn *  column 
) [private]

Definition at line 794 of file actions.cc.

                                                                                      {
       Gtk::TreeRow row(*tm->get_iter(path));
       Gtk::MessageDialog *dialog;
       widgets->get_widget("dialog_record", dialog);
       dialog->set_message(_("Record a New Stroke"));
       dialog->set_secondary_text(Glib::ustring::compose(_("The next stroke will be associated with the action \"%1\".  You can draw it anywhere on the screen (except for the two buttons below)."), row[cols.name]));

       static Gtk::Button *del = 0, *cancel = 0;
       if (!del) {
              widgets->get_widget("button_record_delete", del);
              del->signal_enter().connect(sigc::mem_fun(*grabber, &Grabber::queue_suspend));
              del->signal_leave().connect(sigc::mem_fun(*grabber, &Grabber::queue_resume));
       }
       if (!cancel) {
              widgets->get_widget("button_record_cancel", cancel);
              cancel->signal_enter().connect(sigc::mem_fun(*grabber, &Grabber::queue_suspend));
              cancel->signal_leave().connect(sigc::mem_fun(*grabber, &Grabber::queue_resume));
       }
       RStrokeInfo si = action_list->get_info(row[cols.id]);
       if (si)
              del->set_sensitive(si->strokes.size());

       OnStroke ps(this, dialog, row);
       stroke_action.reset(new sigc::slot<void, RStroke>(sigc::mem_fun(ps, &OnStroke::delayed_run)));
       stroke_app.set(action_list);

       dialog->show();
       cancel->grab_focus();
       int response = dialog->run();
       dialog->hide();
       stroke_action.reset();
       stroke_app.set(NULL);
       if (response != 1)
              return;

       action_list->set_strokes(row[cols.id], StrokeSet());
       update_row(row);
       on_selection_changed();
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_selection_changed ( ) [private]

Definition at line 854 of file actions.cc.

                                   {
       int n = tv.get_selection()->count_selected_rows();
       button_record->set_sensitive(n == 1);
       button_delete->set_sensitive(n >= 1);
       bool resettable = false;
       if (n) {
              std::vector<Gtk::TreePath> paths = tv.get_selection()->get_selected_rows();
              for (std::vector<Gtk::TreePath>::iterator i = paths.begin(); i != paths.end(); ++i) {
                     Gtk::TreeRow row(*tm->get_iter(*i));
                     if (action_list->resettable(row[cols.id])) {
                            resettable = true;
                            break;
                     }
              }
       }
       button_reset_actions->set_sensitive(resettable);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 975 of file actions.cc.

                                            {
       editing_new = false;
}

Here is the caller graph for this function:

void Actions::on_something_editing_started ( Gtk::CellEditable *  editable,
const Glib::ustring &  path 
) [private]

Definition at line 979 of file actions.cc.

                                                                                             {
       editing = true;
}

Here is the caller graph for this function:

void Actions::on_text_edited ( const Glib::ustring &  path,
const Glib::ustring &  new_text 
) [private]

Definition at line 924 of file actions.cc.

                                                                                 {
       Gtk::TreeRow row(*tm->get_iter(path));
       Type type = from_name(row[cols.type]);
       if (type == COMMAND) {
              action_list->set_action(row[cols.id], Command::create(new_text));
       } else if (type == TEXT) {
              action_list->set_action(row[cols.id], SendText::create(new_text));
       } else return;
       update_row(row);
       update_actions();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::on_type_edited ( const Glib::ustring &  path,
const Glib::ustring &  new_text 
) [private]

Definition at line 500 of file actions.cc.

                                                                                 {
       tv.grab_focus();
       Gtk::TreeRow row(*tm->get_iter(path));
       Type new_type = from_name(new_text);
       Type old_type = from_name(row[cols.type]);
       bool edit = true;
       if (old_type == new_type) {
              edit = editing_new;
       } else {
              row[cols.type] = new_text;
              RAction new_action;
              if (new_type == COMMAND) {
                     Glib::ustring cmd_save = row[cols.cmd_save];
                     if (cmd_save != "")
                            edit = false;
                     new_action = Command::create(cmd_save);
              }
              if (old_type == COMMAND) {
                     row[cols.cmd_save] = (Glib::ustring)row[cols.arg];
              }
              if (new_type == KEY) {
                     new_action = SendKey::create(0, (Gdk::ModifierType)0);
                     edit = true;
              }
              if (new_type == TEXT) {
                     new_action = SendText::create(Glib::ustring());
                     edit = true;
              }
              if (new_type == SCROLL) {
                     new_action = Scroll::create((Gdk::ModifierType)0);
                     edit = false;
              }
              if (new_type == IGNORE) {
                     new_action = Ignore::create((Gdk::ModifierType)0);
                     edit = false;
              }
              if (new_type == BUTTON) {
                     new_action = Button::create((Gdk::ModifierType)0, 0);
                     edit = true;
              }
              if (new_type == MISC) {
                     new_action = Misc::create(Misc::NONE);
                     edit = true;
              }
              action_list->set_action(row[cols.id], new_action);
              update_row(row);
              update_actions();
       }
       editing_new = false;
       focus(row[cols.id], 3, edit);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Actions::select_app ( const Gtk::TreeModel::Path &  path,
const Gtk::TreeModel::iterator &  iter,
ActionListDiff actions 
) [private]

Definition at line 593 of file actions.cc.

                                                                                                                {
       if ((*iter)[ca.actions] == actions) {
              apps_view->expand_to_path(path);
              apps_view->set_cursor(path);
              return true;
       }
       return false;
}

Here is the caller graph for this function:

void Actions::update_action_list ( ) [private]

Definition at line 713 of file actions.cc.

                                 {
       boost::shared_ptr<std::set<Unique *> > ids = action_list->get_ids(check_show_deleted->get_active());
       const Gtk::TreeNodeChildren &ch = tm->children();

       std::list<Gtk::TreeRowReference> refs;
       for (Gtk::TreeIter i = ch.begin(); i != ch.end(); i++) {
              Gtk::TreeRowReference ref(tm, Gtk::TreePath(*i));
              refs.push_back(ref);
       }

       for (std::list<Gtk::TreeRowReference>::iterator ref = refs.begin(); ref != refs.end(); ref++) {
              Gtk::TreeIter i = tm->get_iter(ref->get_path());
              std::set<Unique *>::iterator id = ids->find((*i)[cols.id]);
              if (id == ids->end()) {
                     tm->erase(i);
              } else {
                     ids->erase(id);
                     update_row(*i);
              }
       }
       for (std::set<Unique *>::const_iterator i = ids->begin(); i != ids->end(); i++) {
              Gtk::TreeRow row = *tm->append();
              row[cols.id] = *i;
              update_row(row);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::update_counts ( ) [private]

Definition at line 709 of file actions.cc.

                            {
       apps_model->foreach_iter(sigc::mem_fun(*this, &Actions::count_app_actions));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Actions::update_row ( const Gtk::TreeRow &  row) [private]

Definition at line 740 of file actions.cc.

                                              {
       bool deleted, stroke, name, action;
       RStrokeInfo si = action_list->get_info(row[cols.id], &deleted, &stroke, &name, &action);
       row[cols.stroke] = !si->strokes.empty() && *si->strokes.begin() ? 
              (*si->strokes.begin())->draw(STROKE_SIZE, stroke ? 4.0 : 2.0) : Stroke::drawEmpty(STROKE_SIZE);
       row[cols.name] = si->name;
       row[cols.type] = si->action ? type_info_to_name(&typeid(*si->action)) : "";
       row[cols.arg]  = si->action ? si->action->get_label() : "";
       row[cols.deactivated] = deleted;
       row[cols.name_bold] = name;
       row[cols.action_bold] = action;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 147 of file actions.h.

Glib::RefPtr<AppsStore> Actions::apps_model [private]

Definition at line 118 of file actions.h.

Gtk::TreeView* Actions::apps_view [private]

Definition at line 117 of file actions.h.

Gtk::Button * Actions::button_delete [private]

Definition at line 140 of file actions.h.

Gtk::Button* Actions::button_record [private]

Definition at line 140 of file actions.h.

Gtk::Button * Actions::button_remove_app [private]

Definition at line 140 of file actions.h.

Gtk::Button * Actions::button_reset_actions [private]

Definition at line 140 of file actions.h.

Apps Actions::ca [private]

Definition at line 134 of file actions.h.

Gtk::CheckButton* Actions::check_show_deleted [private]

Definition at line 141 of file actions.h.

Definition at line 113 of file actions.h.

bool Actions::editing [private]

Definition at line 145 of file actions.h.

bool Actions::editing_new [private]

Definition at line 144 of file actions.h.

Gtk::Expander* Actions::expander_apps [private]

Definition at line 142 of file actions.h.

Glib::RefPtr<Store> Actions::tm [private]

Definition at line 115 of file actions.h.

Definition at line 114 of file actions.h.

Single Actions::type [private]

Definition at line 125 of file actions.h.

Glib::RefPtr<Gtk::ListStore> Actions::type_store [private]

Definition at line 136 of file actions.h.


The documentation for this class was generated from the following files: