~bkerensa/ubuntu/precise/easystroke/fix-for-966714

« back to all changes in this revision

Viewing changes to actions.cc

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Jaeger, Thomas Jaeger, Benjamin Drung
  • Date: 2010-01-03 01:02:54 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100103010254-dwczji4lkt8ldcwh
Tags: 0.5.2-0ubuntu1
[ Thomas Jaeger ]
* New upstream release (LP: #502366)
  - Fixes crash when the third axis is a relative one (LP: #466532)
  - Uses XI2 now, so upgrade Build-Depends accordingly

[ Benjamin Drung ]
* Wrap Build-Depends
* Bump Standards-Version to 3.8.3
* Add ${misc:Depends} to dependency list
* Switch to debhelper v7.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
                }
91
91
                guint key = gdk_keyval_to_lower(event->keyval);
92
92
                guint mods = event->state & gtk_accelerator_get_default_mod_mask();
 
93
                if (key == event->keyval)
 
94
                        mods &= ~GDK_Shift_L & ~GDK_Shift_R;
93
95
 
94
96
                editing_done();
95
97
                remove_widget();
219
221
        tm = Store::create(cols, this);
220
222
 
221
223
        tv.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
222
 
        tv.set_row_separator_func(sigc::mem_fun(*this, &Actions::on_row_separator));
223
224
 
224
225
        int n;
225
226
        n = tv.append_column(_("Stroke"), cols.stroke);
236
237
        name_renderer->signal_editing_canceled().connect(sigc::mem_fun(*this, &Actions::on_something_editing_canceled));
237
238
        Gtk::TreeView::Column *col_name = tv.get_column(n-1);
238
239
        col_name->set_sort_column(cols.name);
239
 
//      col_name->add_attribute(name_renderer->property_text(), cols.name);
240
240
        col_name->set_cell_data_func(*name_renderer, sigc::mem_fun(*this, &Actions::on_cell_data_name));
 
241
        col_name->set_resizable();
241
242
 
242
243
        type_store = Gtk::ListStore::create(type);
243
244
        for (TypeInfo *i = all_types; i->name; i++)
262
263
        Gtk::TreeView::Column *col_arg = tv.get_column(n-1);
263
264
        col_arg->add_attribute(arg_renderer->property_text(), cols.arg);
264
265
        col_arg->set_cell_data_func(*arg_renderer, sigc::mem_fun(*this, &Actions::on_cell_data_arg));
 
266
        col_arg->set_resizable();
265
267
        arg_renderer->property_editable() = true;
266
268
        arg_renderer->signal_key_edited().connect(sigc::mem_fun(*this, &Actions::on_accel_edited));
267
269
        arg_renderer->signal_combo_edited().connect(sigc::mem_fun(*this, &Actions::on_combo_edited));
280
282
        apps_model = AppsStore::create(ca, this);
281
283
 
282
284
        load_app_list(apps_model->children(), actions.get_root());
 
285
        update_counts();
283
286
 
284
287
        apps_view->append_column_editable(_("Application"), ca.app);
 
288
        apps_view->get_column(0)->set_expand(true);
285
289
        apps_view->get_column(0)->set_cell_data_func(
286
290
                        *apps_view->get_column_cell_renderer(0), sigc::mem_fun(*this, &Actions::on_cell_data_apps));
287
291
        Gtk::CellRendererText *app_name_renderer =
288
292
                dynamic_cast<Gtk::CellRendererText *>(apps_view->get_column_cell_renderer(0));
289
293
        app_name_renderer->signal_edited().connect(sigc::mem_fun(*this, &Actions::on_group_name_edited));
 
294
        apps_view->append_column(_("Actions"), ca.count);
290
295
 
291
296
        apps_view->set_model(apps_model);
292
297
        apps_view->enable_model_drag_dest();
332
337
        renderer->mode = all_types[from_name(str)].mode;
333
338
}
334
339
 
335
 
bool Actions::on_row_separator(const Glib::RefPtr<Gtk::TreeModel> &model, const Gtk::TreeModel::iterator &iter) {
336
 
        return false; //(*iter)[cols.separator];
337
 
}
338
 
 
339
340
int Actions::compare_ids(const Gtk::TreeModel::iterator &a, const Gtk::TreeModel::iterator &b) {
340
341
        Unique *x = (*a)[cols.id];
341
342
        Unique *y = (*b)[cols.id];
512
513
                        row[cols.cmd_save] = (Glib::ustring)row[cols.arg];
513
514
                }
514
515
                if (new_type == KEY) {
515
 
                        new_action = SendKey::create(0, (Gdk::ModifierType)0, 0);
 
516
                        new_action = SendKey::create(0, (Gdk::ModifierType)0);
516
517
                        edit = true;
517
518
                }
518
519
                if (new_type == TEXT) {
574
575
        }
575
576
        update_action_list();
576
577
        update_actions();
 
578
        update_counts();
577
579
}
578
580
 
579
581
void Actions::on_cell_data_apps(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter) {
694
696
        }
695
697
}
696
698
 
 
699
bool Actions::count_app_actions(const Gtk::TreeIter &i) {
 
700
        (*i)[ca.count] = ((ActionListDiff*)(*i)[ca.actions])->count_actions();
 
701
        return false;
 
702
}
 
703
 
 
704
void Actions::update_counts() {
 
705
        apps_model->foreach_iter(sigc::mem_fun(*this, &Actions::count_app_actions));
 
706
}
 
707
 
697
708
void Actions::update_action_list() {
698
709
        boost::shared_ptr<std::set<Unique *> > ids = action_list->get_ids(check_show_deleted->get_active());
699
710
        const Gtk::TreeNodeChildren &ch = tm->children();
878
889
        update_row(row);
879
890
        focus(id, 1, true);
880
891
        update_actions();
 
892
        update_counts();
881
893
}
882
894
 
883
895
bool Actions::do_focus(Unique *id, Gtk::TreeViewColumn *col, bool edit) {
920
932
        Gtk::TreeRow row(*tm->get_iter(path_string));
921
933
        Type type = from_name(row[cols.type]);
922
934
        if (type == KEY) {
923
 
                RSendKey send_key = SendKey::create(accel_key, accel_mods, hardware_keycode);
 
935
                RSendKey send_key = SendKey::create(accel_key, accel_mods);
924
936
                Glib::ustring str = send_key->get_label();
925
937
                if (row[cols.arg] == str)
926
938
                        return;
982
994
}
983
995
 
984
996
const Glib::ustring SendKey::get_label() const {
985
 
        Glib::ustring str = Gtk::AccelGroup::get_label(key, mods);
986
 
        if (key == 0) {
987
 
                char buf[10];
988
 
                snprintf(buf, 9, "0x%x", code);
989
 
                str += buf;
990
 
        }
991
 
        return str;
 
997
        return Gtk::AccelGroup::get_label(key, mods);
992
998
}
993
999
 
994
1000
const Glib::ustring ModAction::get_label() const {