~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/ui/dialog/input.cpp

  • Committer: Steren Giannini
  • Date: 2010-05-29 15:00:23 UTC
  • mfrom: (9012.1.442 trunk)
  • Revision ID: steren.giannini@gmail.com-20100529150023-mi9r10jkhtfs7yyj
sync with rev 9454

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#include <set>
13
13
#include <glib/gprintf.h>
14
14
#include <glibmm/i18n.h>
 
15
#include <gtkmm/alignment.h>
 
16
#include <gtkmm/cellrenderercombo.h>
 
17
#include <gtkmm/checkbutton.h>
15
18
#include <gtkmm/comboboxtext.h>
16
19
#include <gtkmm/enums.h>
17
20
#include <gtkmm/eventbox.h>
18
21
#include <gtkmm/frame.h>
19
22
#include <gtkmm/image.h>
 
23
#include <gtkmm/liststore.h>
20
24
#include <gtkmm/menubar.h>
21
25
#include <gtkmm/notebook.h>
22
26
#include <gtkmm/paned.h>
28
32
#include <gtkmm/treestore.h>
29
33
#include <gtkmm/treeview.h>
30
34
 
 
35
#include "device-manager.h"
 
36
#include "preferences.h"
31
37
#include "ui/widget/panel.h"
32
 
#include "device-manager.h"
33
38
 
34
39
#include "input.h"
35
40
 
323
328
 
324
329
 
325
330
 
326
 
class MyModelColumns : public Gtk::TreeModel::ColumnRecord
 
331
class DeviceModelColumns : public Gtk::TreeModel::ColumnRecord
327
332
{
328
333
public:
329
 
    Gtk::TreeModelColumn<Glib::ustring>                filename;
330
334
    Gtk::TreeModelColumn<Glib::ustring>                description;
331
335
    Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> >  thumbnail;
332
 
    Gtk::TreeModelColumn<InputDevice const *>          device;
 
336
    Gtk::TreeModelColumn<Glib::RefPtr<InputDevice const> > device;
 
337
    Gtk::TreeModelColumn<Gdk::InputMode>               mode;
333
338
 
334
 
    MyModelColumns() { add(filename); add(description); add(thumbnail); add(device); }
 
339
    DeviceModelColumns() { add(description); add(thumbnail); add(device); add(mode); }
335
340
};
336
341
 
 
342
static std::map<Gdk::InputMode, Glib::ustring> &getModeToString()
 
343
{
 
344
    static std::map<Gdk::InputMode, Glib::ustring> mapping;
 
345
    if (mapping.empty()) {
 
346
        mapping[Gdk::MODE_DISABLED] = _("Disabled");
 
347
        mapping[Gdk::MODE_SCREEN]   = _("Screen");
 
348
        mapping[Gdk::MODE_WINDOW]   = _("Window");
 
349
    }
 
350
 
 
351
    return mapping;
 
352
}
 
353
 
 
354
static std::map<Glib::ustring, Gdk::InputMode> &getStringToMode()
 
355
{
 
356
    static std::map<Glib::ustring, Gdk::InputMode> mapping;
 
357
    if (mapping.empty()) {
 
358
        mapping[_("Disabled")] = Gdk::MODE_DISABLED;
 
359
        mapping[_("Screen")]   = Gdk::MODE_SCREEN;
 
360
        mapping[_("Window")]   = Gdk::MODE_WINDOW;
 
361
    }
 
362
 
 
363
    return mapping;
 
364
}
 
365
 
 
366
 
 
367
 
337
368
class InputDialogImpl : public InputDialog {
338
369
public:
339
370
    InputDialogImpl();
340
371
    virtual ~InputDialogImpl() {}
341
372
 
342
373
private:
343
 
    Glib::RefPtr<Gdk::Pixbuf> corePix;
344
 
    Glib::RefPtr<Gdk::Pixbuf> penPix;
345
 
    Glib::RefPtr<Gdk::Pixbuf> mousePix;
346
 
    Glib::RefPtr<Gdk::Pixbuf> tipPix;
347
 
    Glib::RefPtr<Gdk::Pixbuf> tabletPix;
348
 
    Glib::RefPtr<Gdk::Pixbuf> eraserPix;
349
 
    Glib::RefPtr<Gdk::Pixbuf> sidebuttonsPix;
350
 
 
351
 
    Glib::RefPtr<Gdk::Pixbuf> buttonsNonePix;
352
 
    Glib::RefPtr<Gdk::Pixbuf> buttonsOnPix;
353
 
    Glib::RefPtr<Gdk::Pixbuf> buttonsOffPix;
354
 
 
355
 
    Glib::RefPtr<Gdk::Pixbuf> axisNonePix;
356
 
    Glib::RefPtr<Gdk::Pixbuf> axisOnPix;
357
 
    Glib::RefPtr<Gdk::Pixbuf> axisOffPix;
 
374
    class ConfPanel : public Gtk::VBox
 
375
    {
 
376
    public:
 
377
        ConfPanel();
 
378
        ~ConfPanel();
 
379
 
 
380
        class Blink : public Preferences::Observer
 
381
        {
 
382
        public:
 
383
            Blink(ConfPanel &parent);
 
384
            virtual ~Blink();
 
385
            virtual void notify(Preferences::Entry const &new_val);
 
386
 
 
387
            ConfPanel &parent;
 
388
        };
 
389
 
 
390
        static void commitCellModeChange(Glib::ustring const &path, Glib::ustring const &newText, Glib::RefPtr<Gtk::TreeStore> store);
 
391
        static void setModeCellString(Gtk::CellRenderer *rndr, Gtk::TreeIter const &iter);
 
392
 
 
393
        void saveSettings();
 
394
        void useExtToggled();
 
395
 
 
396
        Glib::RefPtr<Gtk::TreeStore> store;
 
397
        Gtk::TreeIter tabletIter;
 
398
        Gtk::TreeView tree;
 
399
        Gtk::ScrolledWindow treeScroller;
 
400
        Blink watcher;
 
401
        Gtk::CheckButton useExt;
 
402
        Gtk::Button save;
 
403
    };
 
404
 
 
405
    static DeviceModelColumns &getCols();
 
406
 
 
407
    enum PixId {PIX_CORE, PIX_PEN, PIX_MOUSE, PIX_TIP, PIX_TABLET, PIX_ERASER, PIX_SIDEBUTTONS,
 
408
                PIX_BUTTONS_NONE, PIX_BUTTONS_ON, PIX_BUTTONS_OFF,
 
409
                PIX_AXIS_NONE, PIX_AXIS_ON, PIX_AXIS_OFF};
 
410
 
 
411
    static Glib::RefPtr<Gdk::Pixbuf> getPix(PixId id);
358
412
 
359
413
    std::map<Glib::ustring, std::set<guint> > buttonMap;
360
414
    std::map<Glib::ustring, std::map<guint, std::pair<guint, gdouble> > > axesMap;
362
416
    GdkInputSource lastSourceSeen;
363
417
    Glib::ustring lastDevnameSeen;
364
418
 
365
 
    MyModelColumns cols;
366
419
    Glib::RefPtr<Gtk::TreeStore> store;
367
420
    Gtk::TreeIter tabletIter;
368
421
    Gtk::TreeView tree;
383
436
    Gtk::Label keyVal;
384
437
    Gtk::Entry keyEntry;
385
438
    Gtk::Table devDetails;
386
 
    Gtk::HPaned confSplitter;
387
439
    Gtk::Notebook topHolder;
388
440
    Gtk::Image testThumb;
389
441
    Gtk::Image testButtons[24];
391
443
    Gtk::Table imageTable;
392
444
    Gtk::EventBox testDetector;
393
445
 
 
446
    ConfPanel cfgPanel;
 
447
 
 
448
    static void setupTree( Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeIter &tablet );
394
449
    void setupValueAndCombo( gint reported, gint actual, Gtk::Label& label, Gtk::ComboBoxText& combo );
395
450
    void updateTestButtons( Glib::ustring const& key, gint hotButton );
396
451
    void updateTestAxes( Glib::ustring const& key, GdkDevice* dev );
399
454
    bool eventSnoop(GdkEvent* event);
400
455
    void linkComboChanged();
401
456
    void resyncToSelection();
402
 
    void handleDeviceChange(const Glib::RefPtr<InputDevice>& device);
403
 
    void updateDeviceAxes(const Glib::RefPtr<InputDevice>& device);
404
 
    void updateDeviceButtons(const Glib::RefPtr<InputDevice>& device);
405
 
    void updateDeviceLinks(const Glib::RefPtr<InputDevice>& device);
406
 
 
407
 
    bool findDevice(const Gtk::TreeModel::iterator& iter,
408
 
                    Glib::ustring id,
409
 
                    Gtk::TreeModel::iterator* result);
410
 
    bool findDeviceByLink(const Gtk::TreeModel::iterator& iter,
411
 
                          Glib::ustring link,
412
 
                          Gtk::TreeModel::iterator* result);
413
 
};
 
457
    void handleDeviceChange(Glib::RefPtr<InputDevice const> device);
 
458
    void updateDeviceAxes(Glib::RefPtr<InputDevice const> device);
 
459
    void updateDeviceButtons(Glib::RefPtr<InputDevice const> device);
 
460
    static void updateDeviceLinks(Glib::RefPtr<InputDevice const> device, Gtk::TreeIter tabletIter, Glib::RefPtr<Gtk::TreeView> tree);
 
461
 
 
462
    static bool findDevice(const Gtk::TreeModel::iterator& iter,
 
463
                           Glib::ustring id,
 
464
                           Gtk::TreeModel::iterator* result);
 
465
    static bool findDeviceByLink(const Gtk::TreeModel::iterator& iter,
 
466
                                 Glib::ustring link,
 
467
                                 Gtk::TreeModel::iterator* result);
 
468
 
 
469
}; // class InputDialogImpl
 
470
 
 
471
 
 
472
DeviceModelColumns &InputDialogImpl::getCols()
 
473
{
 
474
    static DeviceModelColumns cols;
 
475
    return cols;
 
476
}
 
477
 
 
478
Glib::RefPtr<Gdk::Pixbuf> InputDialogImpl::getPix(PixId id)
 
479
{
 
480
    static std::map<PixId, Glib::RefPtr<Gdk::Pixbuf> > mappings;
 
481
 
 
482
    mappings[PIX_CORE]          = Gdk::Pixbuf::create_from_xpm_data(core_xpm);
 
483
    mappings[PIX_PEN]           = Gdk::Pixbuf::create_from_xpm_data(pen);
 
484
    mappings[PIX_MOUSE]         = Gdk::Pixbuf::create_from_xpm_data(mouse);
 
485
    mappings[PIX_TIP]           = Gdk::Pixbuf::create_from_xpm_data(tip);
 
486
    mappings[PIX_TABLET]        = Gdk::Pixbuf::create_from_xpm_data(tablet);
 
487
    mappings[PIX_ERASER]        = Gdk::Pixbuf::create_from_xpm_data(eraser);
 
488
    mappings[PIX_SIDEBUTTONS]   = Gdk::Pixbuf::create_from_xpm_data(sidebuttons);
 
489
 
 
490
    mappings[PIX_BUTTONS_NONE]  = Gdk::Pixbuf::create_from_xpm_data(button_none);
 
491
    mappings[PIX_BUTTONS_ON]    = Gdk::Pixbuf::create_from_xpm_data(button_on);
 
492
    mappings[PIX_BUTTONS_OFF]   = Gdk::Pixbuf::create_from_xpm_data(button_off);
 
493
 
 
494
    mappings[PIX_AXIS_NONE]     = Gdk::Pixbuf::create_from_xpm_data(axis_none_xpm);
 
495
    mappings[PIX_AXIS_ON]       = Gdk::Pixbuf::create_from_xpm_data(axis_on_xpm);
 
496
    mappings[PIX_AXIS_OFF]      = Gdk::Pixbuf::create_from_xpm_data(axis_off_xpm);
 
497
 
 
498
    Glib::RefPtr<Gdk::Pixbuf> pix;
 
499
    if (mappings.find(id) != mappings.end()) {
 
500
        pix = mappings[id];
 
501
    }
 
502
 
 
503
    return pix;
 
504
}
414
505
 
415
506
 
416
507
// Now that we've defined the *Impl class, we can do the method to aquire one.
424
515
InputDialogImpl::InputDialogImpl() :
425
516
    InputDialog(),
426
517
 
427
 
    corePix(Gdk::Pixbuf::create_from_xpm_data(core_xpm)),
428
 
    penPix(Gdk::Pixbuf::create_from_xpm_data(pen)),
429
 
    mousePix(Gdk::Pixbuf::create_from_xpm_data(mouse)),
430
 
    tipPix(Gdk::Pixbuf::create_from_xpm_data(tip)),
431
 
    tabletPix(Gdk::Pixbuf::create_from_xpm_data(tablet)),
432
 
    eraserPix(Gdk::Pixbuf::create_from_xpm_data(eraser)),
433
 
    sidebuttonsPix(Gdk::Pixbuf::create_from_xpm_data(sidebuttons)),
434
 
 
435
 
    buttonsNonePix(Gdk::Pixbuf::create_from_xpm_data(button_none)),
436
 
    buttonsOnPix(Gdk::Pixbuf::create_from_xpm_data(button_on)),
437
 
    buttonsOffPix(Gdk::Pixbuf::create_from_xpm_data(button_off)),
438
 
 
439
 
    axisNonePix(Gdk::Pixbuf::create_from_xpm_data(axis_none_xpm)),
440
 
    axisOnPix(Gdk::Pixbuf::create_from_xpm_data(axis_on_xpm)),
441
 
    axisOffPix(Gdk::Pixbuf::create_from_xpm_data(axis_off_xpm)),
442
 
 
443
518
    lastSourceSeen((GdkInputSource)-1),
444
519
    lastDevnameSeen(""),
445
 
    cols(),
446
 
    store(Gtk::TreeStore::create(cols)),
 
520
    store(Gtk::TreeStore::create(getCols())),
 
521
    tabletIter(),
447
522
    tree(store),
448
523
    frame2(),
449
 
    testFrame("Test Area"),
 
524
    testFrame(_("Test Area")),
450
525
    treeScroller(),
451
526
    detailScroller(),
452
527
    splitter(),
453
528
    split2(),
454
529
    linkCombo(),
455
530
    devDetails(12, 2),
456
 
    confSplitter(),
457
531
    topHolder(),
458
 
    imageTable(8, 7)
 
532
    imageTable(8, 7),
 
533
    testDetector(),
 
534
    cfgPanel()
459
535
{
460
536
    Gtk::Box *contents = _getContents();
461
537
 
469
545
 
470
546
    testDetector.add(imageTable);
471
547
    testFrame.add(testDetector);
472
 
    testThumb.set(tabletPix);
 
548
    testThumb.set(getPix(PIX_TABLET));
473
549
    testThumb.set_padding(24, 24);
474
550
    imageTable.attach(testThumb, 0, 8, 0, 1, ::Gtk::EXPAND, ::Gtk::EXPAND);
475
551
    {
476
552
        guint col = 0;
477
553
        guint row = 1;
478
554
        for ( guint num = 0; num < G_N_ELEMENTS(testButtons); num++ ) {
479
 
            testButtons[num].set(buttonsNonePix);
 
555
            testButtons[num].set(getPix(PIX_BUTTONS_NONE));
480
556
            imageTable.attach(testButtons[num], col, col + 1, row, row + 1, ::Gtk::FILL, ::Gtk::FILL);
481
557
            col++;
482
558
            if (col > 7) {
487
563
 
488
564
        col = 0;
489
565
        for ( guint num = 0; num < G_N_ELEMENTS(testAxes); num++ ) {
490
 
            testAxes[num].set(axisNonePix);
 
566
            testAxes[num].set(getPix(PIX_AXIS_NONE));
491
567
            imageTable.attach(testAxes[num], col * 2, (col + 1) * 2, row, row + 1, ::Gtk::FILL, ::Gtk::FILL);
492
568
            col++;
493
569
            if (col > 3) {
498
574
    }
499
575
 
500
576
 
501
 
    topHolder.append_page(confSplitter, "Configuration");
502
 
    topHolder.append_page(splitter, "Hardware");
503
 
//     confSplitter.show_all();
504
 
//     splitter.show_all();
 
577
    topHolder.append_page(cfgPanel, _("Configuration"));
 
578
    topHolder.append_page(splitter, _("Hardware"));
505
579
    topHolder.show_all();
506
 
    topHolder.set_current_page(1);
 
580
    topHolder.set_current_page(0);
507
581
 
508
582
    contents->pack_start(topHolder);
509
583
 
510
584
    int rowNum = 0;
511
585
 
512
 
    Gtk::Label* lbl = Gtk::manage(new Gtk::Label("Name:"));
 
586
    Gtk::Label* lbl = Gtk::manage(new Gtk::Label(_("Name:")));
513
587
    devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
514
588
                      ::Gtk::FILL,
515
589
                      ::Gtk::SHRINK);
519
593
 
520
594
    rowNum++;
521
595
 
522
 
    lbl = Gtk::manage(new Gtk::Label("Link:"));
 
596
    lbl = Gtk::manage(new Gtk::Label(_("Link:")));
523
597
    devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
524
598
                      ::Gtk::FILL,
525
599
                      ::Gtk::SHRINK);
526
600
 
527
 
    linkCombo.append_text("None");
528
 
    linkCombo.set_active_text("None");
 
601
    linkCombo.append_text(_("None"));
 
602
    linkCombo.set_active_text(_("None"));
529
603
    linkCombo.set_sensitive(false);
530
604
    linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged));
531
605
 
534
608
                      ::Gtk::SHRINK);
535
609
    rowNum++;
536
610
 
537
 
    lbl = Gtk::manage(new Gtk::Label("Axes count:"));
 
611
    lbl = Gtk::manage(new Gtk::Label(_("Axes count:")));
538
612
    devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
539
613
                      ::Gtk::FILL,
540
614
                      ::Gtk::SHRINK);
545
619
    rowNum++;
546
620
 
547
621
/*
548
 
    lbl = Gtk::manage(new Gtk::Label("Actual axes count:"));
 
622
    lbl = Gtk::manage(new Gtk::Label(_("Actual axes count:")));
549
623
    devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
550
624
                      ::Gtk::FILL,
551
625
                      ::Gtk::SHRINK);
557
631
*/
558
632
 
559
633
    for ( guint barNum = 0; barNum < static_cast<guint>(G_N_ELEMENTS(axesValues)); barNum++ ) {
560
 
        lbl = Gtk::manage(new Gtk::Label("axis:"));
 
634
        lbl = Gtk::manage(new Gtk::Label(_("axis:")));
561
635
        devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
562
636
                          ::Gtk::FILL,
563
637
                          ::Gtk::SHRINK);
569
643
        rowNum++;
570
644
    }
571
645
 
572
 
    lbl = Gtk::manage(new Gtk::Label("Button count:"));
 
646
    lbl = Gtk::manage(new Gtk::Label(_("Button count:")));
573
647
    devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
574
648
                      ::Gtk::FILL,
575
649
                      ::Gtk::SHRINK);
580
654
    rowNum++;
581
655
 
582
656
/*
583
 
    lbl = Gtk::manage(new Gtk::Label("Actual button count:"));
 
657
    lbl = Gtk::manage(new Gtk::Label(_("Actual button count:")));
584
658
    devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
585
659
                      ::Gtk::FILL,
586
660
                      ::Gtk::SHRINK);
625
699
 
626
700
 
627
701
 
628
 
    Gtk::TreeModel::Row row;
629
 
    Gtk::TreeModel::Row childrow;
630
 
    Gtk::TreeModel::Row deviceRow;
631
 
 
632
 
 
633
702
    //Add the TreeView's view columns:
634
 
    tree.append_column("I", cols.thumbnail);
635
 
    tree.append_column("Bar", cols.description);
 
703
    tree.append_column("I", getCols().thumbnail);
 
704
    tree.append_column("Bar", getCols().description);
636
705
 
637
706
    tree.set_enable_tree_lines();
638
707
    tree.set_headers_visible(false);
639
708
    tree.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::resyncToSelection));
640
709
 
641
710
 
642
 
 
643
 
    std::list<InputDevice const *> devList = Inkscape::DeviceManager::getManager().getDevices();
 
711
    setupTree( store, tabletIter );
 
712
 
 
713
    Inkscape::DeviceManager::getManager().signalDeviceChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::handleDeviceChange));
 
714
    Inkscape::DeviceManager::getManager().signalAxesChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceAxes));
 
715
    Inkscape::DeviceManager::getManager().signalButtonsChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceButtons));
 
716
    Glib::RefPtr<Gtk::TreeView> treePtr(&tree);
 
717
    Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::bind(sigc::ptr_fun(&InputDialogImpl::updateDeviceLinks), tabletIter, treePtr));
 
718
 
 
719
    tree.expand_all();
 
720
    show_all_children();
 
721
}
 
722
 
 
723
void InputDialogImpl::setupTree( Glib::RefPtr<Gtk::TreeStore> store, Gtk::TreeIter &tablet )
 
724
{
 
725
    std::list<Glib::RefPtr<InputDevice const> > devList = Inkscape::DeviceManager::getManager().getDevices();
644
726
    if ( !devList.empty() ) {
645
 
        row = *(store->append());
646
 
        row[cols.description] = "Hardware";
647
 
 
648
 
        tabletIter = store->append(row.children());
649
 
        childrow = *tabletIter;
650
 
        childrow[cols.description] = "Tablet";
651
 
        childrow[cols.thumbnail] = tabletPix;
652
 
 
653
 
        for ( std::list<InputDevice const *>::iterator it = devList.begin(); it != devList.end(); ++it ) {
654
 
            InputDevice const* dev = *it;
 
727
        Gtk::TreeModel::Row row = *(store->append());
 
728
        row[getCols().description] = _("Hardware");
 
729
 
 
730
        tablet = store->append(row.children());
 
731
        Gtk::TreeModel::Row childrow = *tablet;
 
732
        childrow[getCols().description] = _("Tablet");
 
733
        childrow[getCols().thumbnail] = getPix(PIX_TABLET);
 
734
 
 
735
        for ( std::list<Glib::RefPtr<InputDevice const> >::iterator it = devList.begin(); it != devList.end(); ++it ) {
 
736
            Glib::RefPtr<InputDevice const> dev = *it;
655
737
            if ( dev ) {
656
738
//                 g_message("device: name[%s] source[0x%x] mode[0x%x] cursor[%s] axis count[%d] key count[%d]", dev->getName().c_str(), dev->getSource(), dev->getMode(),
657
739
//                           dev->hasCursor() ? "Yes":"no", dev->getNumAxes(), dev->getNumKeys());
658
740
 
659
741
//                 if ( dev->getSource() != Gdk::SOURCE_MOUSE ) {
660
742
                if ( dev ) {
661
 
                    deviceRow = *(store->append(childrow.children()));
662
 
                    deviceRow[cols.description] = dev->getName();
663
 
                    deviceRow[cols.device] = dev;
 
743
                    Gtk::TreeModel::Row deviceRow = *(store->append(childrow.children()));
 
744
                    deviceRow[getCols().description] = dev->getName();
 
745
                    deviceRow[getCols().device] = dev;
 
746
                    deviceRow[getCols().mode] = dev->getMode();
664
747
                    switch ( dev->getSource() ) {
665
748
                        case GDK_SOURCE_MOUSE:
666
 
                            deviceRow[cols.thumbnail] = corePix;
 
749
                            deviceRow[getCols().thumbnail] = getPix(PIX_CORE);
667
750
                            break;
668
751
                        case GDK_SOURCE_PEN:
669
 
                            if (deviceRow[cols.description] == "pad") {
670
 
                                deviceRow[cols.thumbnail] = sidebuttonsPix;
 
752
                            if (deviceRow[getCols().description] == _("pad")) {
 
753
                                deviceRow[getCols().thumbnail] = getPix(PIX_SIDEBUTTONS);
671
754
                            } else {
672
 
                                deviceRow[cols.thumbnail] = tipPix;
 
755
                                deviceRow[getCols().thumbnail] = getPix(PIX_TIP);
673
756
                            }
674
757
                            break;
675
758
                        case GDK_SOURCE_CURSOR:
676
 
                            deviceRow[cols.thumbnail] = mousePix;
 
759
                            deviceRow[getCols().thumbnail] = getPix(PIX_MOUSE);
677
760
                            break;
678
761
                        case GDK_SOURCE_ERASER:
679
 
                            deviceRow[cols.thumbnail] = eraserPix;
 
762
                            deviceRow[getCols().thumbnail] = getPix(PIX_ERASER);
680
763
                            break;
681
764
                        default:
682
765
                            ; // nothing
689
772
    } else {
690
773
        g_warning("No devices found");
691
774
    }
692
 
    Inkscape::DeviceManager::getManager().signalDeviceChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::handleDeviceChange));
693
 
    Inkscape::DeviceManager::getManager().signalAxesChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceAxes));
694
 
    Inkscape::DeviceManager::getManager().signalButtonsChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceButtons));
695
 
    Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceLinks));
 
775
}
 
776
 
 
777
 
 
778
InputDialogImpl::ConfPanel::ConfPanel() :
 
779
    Gtk::VBox(),
 
780
    store(Gtk::TreeStore::create(getCols())),
 
781
    tabletIter(),
 
782
    tree(store),
 
783
    treeScroller(),
 
784
    watcher(*this),
 
785
    useExt(_("Use pressure-sensitive tablet (requires restart)")),
 
786
    save(_("Save"))
 
787
{
 
788
    pack_start(treeScroller);
 
789
 
 
790
    treeScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
 
791
    treeScroller.add(tree);
 
792
 
 
793
    class Foo : public Gtk::TreeModel::ColumnRecord {
 
794
    public :
 
795
        Gtk::TreeModelColumn<Glib::ustring> one;
 
796
        Foo() {add(one);}
 
797
    };
 
798
    static Foo foo;
 
799
    Glib::RefPtr<Gtk::ListStore> poppers = Gtk::ListStore::create(foo);
 
800
    poppers->reference();
 
801
 
 
802
    Gtk::TreeModel::Row row = *(poppers->append());
 
803
    row[foo.one] = getModeToString()[Gdk::MODE_DISABLED];
 
804
    row = *(poppers->append());
 
805
    row[foo.one] = getModeToString()[Gdk::MODE_SCREEN];
 
806
    row = *(poppers->append());
 
807
    row[foo.one] = getModeToString()[Gdk::MODE_WINDOW];
 
808
 
 
809
    Gtk::CellRendererCombo *rendr = new Gtk::CellRendererCombo();
 
810
    rendr->property_model().set_value(poppers);
 
811
    rendr->property_text_column().set_value(0);
 
812
    rendr->property_has_entry() = false;
 
813
 
 
814
    //Add the TreeView's view columns:
 
815
    tree.append_column("I", getCols().thumbnail);
 
816
    tree.append_column("Bar", getCols().description);
 
817
    Gtk::TreeViewColumn *col = new Gtk::TreeViewColumn("X", *rendr);
 
818
    if (col) {
 
819
        tree.append_column(*col);
 
820
        col->set_cell_data_func(*rendr, sigc::ptr_fun(setModeCellString));
 
821
        rendr->signal_edited().connect(sigc::bind(sigc::ptr_fun(commitCellModeChange), store));
 
822
        rendr->property_editable() = true;
 
823
    }
 
824
 
 
825
    tree.set_enable_tree_lines();
 
826
    tree.set_headers_visible(false);
 
827
 
 
828
    setupTree( store, tabletIter );
 
829
 
 
830
    Glib::RefPtr<Gtk::TreeView> treePtr(&tree);
 
831
    Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::bind(sigc::ptr_fun(&InputDialogImpl::updateDeviceLinks), tabletIter, treePtr));
696
832
 
697
833
    tree.expand_all();
698
 
    show_all_children();
699
 
}
700
 
 
701
 
void InputDialogImpl::handleDeviceChange(const Glib::RefPtr<InputDevice>& /*device*/)
 
834
 
 
835
    useExt.set_active(Preferences::get()->getBool("/options/useextinput/value"));
 
836
    useExt.signal_toggled().connect(sigc::mem_fun(*this, &InputDialogImpl::ConfPanel::useExtToggled));
 
837
    pack_start(useExt, Gtk::PACK_SHRINK);
 
838
 
 
839
    save.signal_clicked().connect(sigc::mem_fun(*this, &InputDialogImpl::ConfPanel::saveSettings));
 
840
    Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_RIGHT, Gtk::ALIGN_TOP, 0, 0);
 
841
    align->add(save);
 
842
    pack_start(*Gtk::manage(align), Gtk::PACK_SHRINK);
 
843
}
 
844
 
 
845
InputDialogImpl::ConfPanel::~ConfPanel()
 
846
{
 
847
}
 
848
 
 
849
void InputDialogImpl::ConfPanel::setModeCellString(Gtk::CellRenderer *rndr, Gtk::TreeIter const &iter)
 
850
{
 
851
    if (iter) {
 
852
        Gtk::CellRendererCombo *combo = dynamic_cast<Gtk::CellRendererCombo *>(rndr);
 
853
        if (combo) {
 
854
            Glib::RefPtr<InputDevice const> dev = (*iter)[getCols().device];
 
855
            Gdk::InputMode mode = (*iter)[getCols().mode];
 
856
            if (dev && (getModeToString().find(mode) != getModeToString().end())) {
 
857
                combo->property_text() = getModeToString()[mode];
 
858
            } else {
 
859
                combo->property_text() = "";
 
860
            }
 
861
        }
 
862
    }
 
863
}
 
864
 
 
865
void InputDialogImpl::ConfPanel::commitCellModeChange(Glib::ustring const &path, Glib::ustring const &newText, Glib::RefPtr<Gtk::TreeStore> store)
 
866
{
 
867
    Gtk::TreeIter iter = store->get_iter(path);
 
868
    if (iter) {
 
869
        Glib::RefPtr<InputDevice const> dev = (*iter)[getCols().device];
 
870
        if (dev && (getStringToMode().find(newText) != getStringToMode().end())) {
 
871
            Gdk::InputMode mode = getStringToMode()[newText];
 
872
            Inkscape::DeviceManager::getManager().setMode( dev->getId(), mode );
 
873
        }
 
874
    }
 
875
}
 
876
 
 
877
void InputDialogImpl::ConfPanel::saveSettings()
 
878
{
 
879
    Inkscape::DeviceManager::getManager().saveConfig();
 
880
}
 
881
 
 
882
void InputDialogImpl::ConfPanel::useExtToggled()
 
883
{
 
884
    bool active = useExt.get_active();
 
885
    if (active != Preferences::get()->getBool("/options/useextinput/value")) {
 
886
        Preferences::get()->setBool("/options/useextinput/value", active);
 
887
        if (active) {
 
888
            // As a work-around for a common problem, enable tablet toggles on the calligraphic tool.
 
889
            // Covered in Launchpad bug #196195.
 
890
            Preferences::get()->setBool("/tools/tweak/usepressure", true);
 
891
            Preferences::get()->setBool("/tools/calligraphic/usepressure", true);
 
892
            Preferences::get()->setBool("/tools/calligraphic/usetilt", true);
 
893
        }
 
894
    }
 
895
}
 
896
 
 
897
InputDialogImpl::ConfPanel::Blink::Blink(ConfPanel &parent) :
 
898
    Preferences::Observer("/options/useextinput/value"),
 
899
    parent(parent)
 
900
{
 
901
    Preferences::get()->addObserver(*this);
 
902
}
 
903
 
 
904
InputDialogImpl::ConfPanel::Blink::~Blink()
 
905
{
 
906
    Preferences::get()->removeObserver(*this);
 
907
}
 
908
 
 
909
void InputDialogImpl::ConfPanel::Blink::notify(Preferences::Entry const &new_val)
 
910
{
 
911
    parent.useExt.set_active(new_val.getBool());
 
912
}
 
913
 
 
914
void InputDialogImpl::handleDeviceChange(Glib::RefPtr<InputDevice const> device)
702
915
{
703
916
//     g_message("OUCH!!!! for %p  hits %s", &device, device->getId().c_str());
 
917
    std::vector<Glib::RefPtr<Gtk::TreeStore> > stores;
 
918
    stores.push_back(store);
 
919
    stores.push_back(cfgPanel.store);
 
920
 
 
921
    for (std::vector<Glib::RefPtr<Gtk::TreeStore> >::iterator it = stores.begin(); it != stores.end(); ++it) {
 
922
        Gtk::TreeModel::iterator deviceIter;
 
923
        (*it)->foreach_iter( sigc::bind<Glib::ustring, Gtk::TreeModel::iterator*>(
 
924
                                 sigc::ptr_fun(&InputDialogImpl::findDevice),
 
925
                                 device->getId(),
 
926
                                 &deviceIter) );
 
927
        if ( deviceIter ) {
 
928
            Gdk::InputMode mode = device->getMode();
 
929
            Gtk::TreeModel::Row row = *deviceIter;
 
930
            if (row[getCols().mode] != mode) {
 
931
                row[getCols().mode] = mode;
 
932
            }
 
933
        }
 
934
    }
704
935
}
705
936
 
706
 
void InputDialogImpl::updateDeviceAxes(const Glib::RefPtr<InputDevice>& device)
 
937
void InputDialogImpl::updateDeviceAxes(Glib::RefPtr<InputDevice const> device)
707
938
{
708
939
    gint live = device->getLiveAxes();
709
940
 
720
951
    updateTestAxes( device->getId(), 0 );
721
952
}
722
953
 
723
 
void InputDialogImpl::updateDeviceButtons(const Glib::RefPtr<InputDevice>& device)
 
954
void InputDialogImpl::updateDeviceButtons(Glib::RefPtr<InputDevice const> device)
724
955
{
725
956
    gint live = device->getLiveButtons();
726
957
    std::set<guint> existing = buttonMap[device->getId()];
741
972
                                 Gtk::TreeModel::iterator* result)
742
973
{
743
974
    bool stop = false;
744
 
    const InputDevice* dev = (*iter)[cols.device];
 
975
    Glib::RefPtr<InputDevice const> dev = (*iter)[getCols().device];
745
976
    if ( dev && (dev->getId() == id) ) {
746
977
        if ( result ) {
747
978
            *result = iter;
756
987
                                       Gtk::TreeModel::iterator* result)
757
988
{
758
989
    bool stop = false;
759
 
    const InputDevice* dev = (*iter)[cols.device];
 
990
    Glib::RefPtr<InputDevice const> dev = (*iter)[getCols().device];
760
991
    if ( dev && (dev->getLink() == link) ) {
761
992
        if ( result ) {
762
993
            *result = iter;
766
997
    return stop;
767
998
}
768
999
 
769
 
void InputDialogImpl::updateDeviceLinks(const Glib::RefPtr<InputDevice>& device)
 
1000
void InputDialogImpl::updateDeviceLinks(Glib::RefPtr<InputDevice const> device, Gtk::TreeIter tabletIter, Glib::RefPtr<Gtk::TreeView> tree)
770
1001
{
 
1002
    Glib::RefPtr<Gtk::TreeStore> store = Glib::RefPtr<Gtk::TreeStore>::cast_dynamic(tree->get_model());
 
1003
 
771
1004
//     g_message("Links!!!! for %p  hits [%s]  with link of [%s]", &device, device->getId().c_str(), device->getLink().c_str());
772
1005
    Gtk::TreeModel::iterator deviceIter;
773
1006
    store->foreach_iter( sigc::bind<Glib::ustring, Gtk::TreeModel::iterator*>(
774
 
                             sigc::mem_fun(*this, &InputDialogImpl::findDevice),
 
1007
                             sigc::ptr_fun(&InputDialogImpl::findDevice),
775
1008
                             device->getId(),
776
1009
                             &deviceIter) );
777
1010
 
783
1016
//             g_message("Item %s is unlinked", device->getId().c_str());
784
1017
            if ( deviceIter->parent() != tabletIter ) {
785
1018
                // Not the child of the tablet. move on up
786
 
                
787
 
                InputDevice const *dev = (*deviceIter)[cols.device];
788
 
                Glib::ustring descr = (*deviceIter)[cols.description];
789
 
                Glib::RefPtr<Gdk::Pixbuf> thumb = (*deviceIter)[cols.thumbnail];
 
1019
 
 
1020
                Glib::RefPtr<InputDevice const> dev = (*deviceIter)[getCols().device];
 
1021
                Glib::ustring descr = (*deviceIter)[getCols().description];
 
1022
                Glib::RefPtr<Gdk::Pixbuf> thumb = (*deviceIter)[getCols().thumbnail];
790
1023
 
791
1024
                Gtk::TreeModel::Row deviceRow = *store->append(tabletIter->children());
792
 
                deviceRow[cols.description] = descr;
793
 
                deviceRow[cols.thumbnail] = thumb;
794
 
                deviceRow[cols.device] = dev;
 
1025
                deviceRow[getCols().description] = descr;
 
1026
                deviceRow[getCols().thumbnail] = thumb;
 
1027
                deviceRow[getCols().device] = dev;
 
1028
                deviceRow[getCols().mode] = dev->getMode();
795
1029
 
796
1030
                Gtk::TreeModel::iterator oldParent = deviceIter->parent();
797
1031
                store->erase(deviceIter);
805
1039
                // Simple case. Not already linked
806
1040
 
807
1041
                Gtk::TreeIter newGroup = store->append(tabletIter->children());
808
 
                (*newGroup)[cols.description] = "Pen";
809
 
                (*newGroup)[cols.thumbnail] = penPix;
 
1042
                (*newGroup)[getCols().description] = _("Pen");
 
1043
                (*newGroup)[getCols().thumbnail] = getPix(PIX_PEN);
810
1044
 
811
 
                InputDevice const *dev = (*deviceIter)[cols.device];
812
 
                Glib::ustring descr = (*deviceIter)[cols.description];
813
 
                Glib::RefPtr<Gdk::Pixbuf> thumb = (*deviceIter)[cols.thumbnail];
 
1045
                Glib::RefPtr<InputDevice const> dev = (*deviceIter)[getCols().device];
 
1046
                Glib::ustring descr = (*deviceIter)[getCols().description];
 
1047
                Glib::RefPtr<Gdk::Pixbuf> thumb = (*deviceIter)[getCols().thumbnail];
814
1048
 
815
1049
                Gtk::TreeModel::Row deviceRow = *store->append(newGroup->children());
816
 
                deviceRow[cols.description] = descr;
817
 
                deviceRow[cols.thumbnail] = thumb;
818
 
                deviceRow[cols.device] = dev;
819
 
 
820
 
                
 
1050
                deviceRow[getCols().description] = descr;
 
1051
                deviceRow[getCols().thumbnail] = thumb;
 
1052
                deviceRow[getCols().device] = dev;
 
1053
                deviceRow[getCols().mode] = dev->getMode();
 
1054
 
 
1055
 
821
1056
                Gtk::TreeModel::iterator linkIter;
822
1057
                store->foreach_iter( sigc::bind<Glib::ustring, Gtk::TreeModel::iterator*>(
823
 
                                         sigc::mem_fun(*this, &InputDialogImpl::findDeviceByLink),
 
1058
                                         sigc::ptr_fun(&InputDialogImpl::findDeviceByLink),
824
1059
                                         device->getId(),
825
1060
                                         &linkIter) );
826
1061
                if ( linkIter ) {
827
 
                    dev = (*linkIter)[cols.device];
828
 
                    descr = (*linkIter)[cols.description];
829
 
                    thumb = (*linkIter)[cols.thumbnail];
 
1062
                    dev = (*linkIter)[getCols().device];
 
1063
                    descr = (*linkIter)[getCols().description];
 
1064
                    thumb = (*linkIter)[getCols().thumbnail];
830
1065
 
831
1066
                    deviceRow = *store->append(newGroup->children());
832
 
                    deviceRow[cols.description] = descr;
833
 
                    deviceRow[cols.thumbnail] = thumb;
834
 
                    deviceRow[cols.device] = dev;
 
1067
                    deviceRow[getCols().description] = descr;
 
1068
                    deviceRow[getCols().thumbnail] = thumb;
 
1069
                    deviceRow[getCols().device] = dev;
 
1070
                    deviceRow[getCols().mode] = dev->getMode();
835
1071
                    Gtk::TreeModel::iterator oldParent = linkIter->parent();
836
1072
                    store->erase(linkIter);
837
1073
                    if ( oldParent->children().empty() ) {
844
1080
                if ( oldParent->children().empty() ) {
845
1081
                    store->erase(oldParent);
846
1082
                }
847
 
                tree.expand_row(Gtk::TreePath(newGroup), true);
 
1083
                tree->expand_row(Gtk::TreePath(newGroup), true);
848
1084
            }
849
1085
        }
850
1086
    }
855
1091
    Gtk::TreeModel::iterator iter = treeSel->get_selected();
856
1092
    if (iter) {
857
1093
        Gtk::TreeModel::Row row = *iter;
858
 
        Glib::ustring val = row[cols.description];
859
 
        InputDevice const * dev = row[cols.device];
 
1094
        Glib::ustring val = row[getCols().description];
 
1095
        Glib::RefPtr<InputDevice const> dev = row[getCols().device];
860
1096
        if ( dev ) {
861
1097
            if ( linkCombo.get_active_row_number() == 0 ) {
862
1098
                // It is the "None" entry
863
1099
                DeviceManager::getManager().setLinkedTo(dev->getId(), "");
864
1100
            } else {
865
1101
                Glib::ustring linkName = linkCombo.get_active_text();
866
 
                std::list<InputDevice const *> devList = Inkscape::DeviceManager::getManager().getDevices();
867
 
                for ( std::list<InputDevice const *>::const_iterator it = devList.begin(); it != devList.end(); ++it ) {
 
1102
                std::list<Glib::RefPtr<InputDevice const> > devList = Inkscape::DeviceManager::getManager().getDevices();
 
1103
                for ( std::list<Glib::RefPtr<InputDevice const> >::const_iterator it = devList.begin(); it != devList.end(); ++it ) {
868
1104
                    if ( linkName == (*it)->getName() ) {
869
1105
                        DeviceManager::getManager().setLinkedTo(dev->getId(), (*it)->getId());
870
1106
                        break;
881
1117
    Gtk::TreeModel::iterator iter = treeSel->get_selected();
882
1118
    if (iter) {
883
1119
        Gtk::TreeModel::Row row = *iter;
884
 
        Glib::ustring val = row[cols.description];
885
 
        InputDevice const * dev = row[cols.device];
 
1120
        Glib::ustring val = row[getCols().description];
 
1121
        Glib::RefPtr<InputDevice const> dev = row[getCols().device];
886
1122
        if ( dev ) {
887
1123
            devDetails.set_sensitive(true);
888
1124
 
889
1125
            linkConnection.block();
890
1126
            linkCombo.clear_items();
891
 
            linkCombo.append_text("None");
 
1127
            linkCombo.append_text(_("None"));
892
1128
            linkCombo.set_active(0);
893
1129
            if ( dev->getSource() != Gdk::SOURCE_MOUSE ) {
894
1130
                Glib::ustring linked = dev->getLink();
895
 
                std::list<InputDevice const *> devList = Inkscape::DeviceManager::getManager().getDevices();
896
 
                for ( std::list<InputDevice const *>::const_iterator it = devList.begin(); it != devList.end(); ++it ) {
 
1131
                std::list<Glib::RefPtr<InputDevice const> > devList = Inkscape::DeviceManager::getManager().getDevices();
 
1132
                for ( std::list<Glib::RefPtr<InputDevice const> >::const_iterator it = devList.begin(); it != devList.end(); ++it ) {
897
1133
                    if ( ((*it)->getSource() != Gdk::SOURCE_MOUSE) && ((*it) != dev) ) {
898
1134
                        linkCombo.append_text((*it)->getName().c_str());
899
1135
                        if ( (linked.length() > 0) && (linked == (*it)->getId()) ) {
908
1144
            linkConnection.unblock();
909
1145
 
910
1146
            clear = false;
911
 
            devName.set_label(row[cols.description]);
 
1147
            devName.set_label(row[getCols().description]);
912
1148
            setupValueAndCombo( dev->getNumAxes(), dev->getNumAxes(), devAxesCount, axesCombo);
913
1149
            setupValueAndCombo( dev->getNumKeys(), dev->getNumKeys(), devKeyCount, buttonCombo);
914
1150
        }
945
1181
    for ( gint i = 0; i < static_cast<gint>(G_N_ELEMENTS(testButtons)); i++ ) {
946
1182
        if ( buttonMap[key].find(i) != buttonMap[key].end() ) {
947
1183
            if ( i == hotButton ) {
948
 
                testButtons[i].set(buttonsOnPix);
 
1184
                testButtons[i].set(getPix(PIX_BUTTONS_ON));
949
1185
            } else {
950
 
                testButtons[i].set(buttonsOffPix);
 
1186
                testButtons[i].set(getPix(PIX_BUTTONS_OFF));
951
1187
            }
952
1188
        } else {
953
 
            testButtons[i].set(buttonsNonePix);
 
1189
            testButtons[i].set(getPix(PIX_BUTTONS_NONE));
954
1190
        }
955
1191
    }
956
1192
}
963
1199
        Gtk::TreeModel::iterator iter = treeSel->get_selected();
964
1200
        if (iter) {
965
1201
            Gtk::TreeModel::Row row = *iter;
966
 
            Glib::ustring val = row[cols.description];
967
 
            InputDevice const * idev = row[cols.device];
 
1202
            Glib::ustring val = row[getCols().description];
 
1203
            Glib::RefPtr<InputDevice const> idev = row[getCols().device];
968
1204
            if ( !idev || (idev->getId() != key) ) {
969
1205
                dev = 0;
970
1206
            }
977
1213
            switch ( axesMap[key][i].first ) {
978
1214
                case 0:
979
1215
                case 1:
980
 
                    testAxes[i].set(axisNonePix);
 
1216
                    testAxes[i].set(getPix(PIX_AXIS_NONE));
981
1217
                    if ( dev && (i < static_cast<gint>(G_N_ELEMENTS(axesValues)) ) ) {
982
1218
                        axesValues[i].set_sensitive(false);
983
1219
                    }
984
1220
                    break;
985
1221
                case 2:
986
 
                    testAxes[i].set(axisOffPix);
 
1222
                    testAxes[i].set(getPix(PIX_AXIS_OFF));
987
1223
                    axesValues[i].set_sensitive(true);
988
1224
                    if ( dev && (i < static_cast<gint>(G_N_ELEMENTS(axesValues)) ) ) {
989
1225
                        if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) {
996
1232
                    }
997
1233
                    break;
998
1234
                case 3:
999
 
                    testAxes[i].set(axisOnPix);
 
1235
                    testAxes[i].set(getPix(PIX_AXIS_ON));
1000
1236
                    axesValues[i].set_sensitive(true);
1001
1237
                    if ( dev && (i < static_cast<gint>(G_N_ELEMENTS(axesValues)) ) ) {
1002
1238
                        if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) {
1010
1246
            }
1011
1247
 
1012
1248
        } else {
1013
 
            testAxes[i].set(axisNonePix);
 
1249
            testAxes[i].set(getPix(PIX_AXIS_NONE));
1014
1250
        }
1015
1251
    }
1016
1252
    if ( !dev ) {
1180
1416
        switch (source) {
1181
1417
            case GDK_SOURCE_MOUSE:
1182
1418
            {
1183
 
                testThumb.set(corePix);
 
1419
                testThumb.set(getPix(PIX_CORE));
1184
1420
            }
1185
1421
            break;
1186
1422
            case GDK_SOURCE_CURSOR:
1187
1423
            {
1188
1424
//                 g_message("flip to cursor");
1189
 
                testThumb.set(mousePix);
 
1425
                testThumb.set(getPix(PIX_MOUSE));
1190
1426
            }
1191
1427
            break;
1192
1428
            case GDK_SOURCE_PEN:
1193
1429
            {
1194
 
                if (devName == "pad") {
 
1430
                if (devName == _("pad")) {
1195
1431
//                     g_message("flip to pad");
1196
 
                    testThumb.set(sidebuttonsPix);
 
1432
                    testThumb.set(getPix(PIX_SIDEBUTTONS));
1197
1433
                } else {
1198
1434
//                     g_message("flip to pen");
1199
 
                    testThumb.set(tipPix);
 
1435
                    testThumb.set(getPix(PIX_TIP));
1200
1436
                }
1201
1437
            }
1202
1438
            break;
1203
1439
            case GDK_SOURCE_ERASER:
1204
1440
            {
1205
1441
//                 g_message("flip to eraser");
1206
 
                testThumb.set(eraserPix);
 
1442
                testThumb.set(getPix(PIX_ERASER));
1207
1443
            }
1208
1444
            break;
1209
1445
//             default: