input.cpp revision d5edbcb9362e1d1e28bf53abade939e610bb3cd4
/* XPM */
static char * core_xpm[] = {
"16 16 4 1",
" c None",
". c #808080",
"+ c #000000",
"@ c #FFFFFF",
" ",
" ",
" ",
" .++++++. ",
" +@+@@+@+ ",
" +@+@@+@+ ",
" +.+..+.+ ",
" +@@@@@@+ ",
" +@@@@@@+ ",
" +@@@@@@+ ",
" +@@@@@@+ ",
" +@@@@@@+ ",
" .++++++. ",
" ",
" ",
" "};
/* XPM */
static char *eraser[] = {
/* columns rows colors chars-per-pixel */
"16 16 5 1",
" c black",
". c green",
"X c #808080",
"o c gray100",
"O c None",
/* pixels */
"OOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOO OO",
"OOOOOOOOOOOO . O",
"OOOOOOOOOOO . OO",
"OOOOOOOOOO . OOO",
"OOOOOOOOO . OOOO",
"OOOOOOOO . OOOOO",
"OOOOOOOXo OOOOOO",
"OOOOOOXoXOOOOOOO",
"OOOOOXoXOOOOOOOO",
"OOOOXoXOOOOOOOOO",
"OOOXoXOOOOOOOOOO",
"OOXoXOOOOOOOOOOO",
"OOXXOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOO"
};
/* XPM */
static char *mouse[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c black",
". c gray100",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXX XXXXXXX",
"XXXXX . XXXXXXX",
"XXXX .... XXXXXX",
"XXXX .... XXXXXX",
"XXXXX .... XXXXX",
"XXXXX .... XXXXX",
"XXXXXX .... XXXX",
"XXXXXX .... XXXX",
"XXXXXXX . XXXXX",
"XXXXXXX XXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX"
};
/* XPM */
static char *pen[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c black",
". c gray100",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXX XX",
"XXXXXXXXXXXX . X",
"XXXXXXXXXXX . XX",
"XXXXXXXXXX . XXX",
"XXXXXXXXX . XXXX",
"XXXXXXXX . XXXXX",
"XXXXXXX . XXXXXX",
"XXXXXX . XXXXXXX",
"XXXXX . XXXXXXXX",
"XXXX . XXXXXXXXX",
"XXX . XXXXXXXXXX",
"XX . XXXXXXXXXXX",
"XX XXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX"
};
/* XPM */
static char *sidebuttons[] = {
/* columns rows colors chars-per-pixel */
"16 16 4 1",
" c black",
". c #808080",
"o c green",
"O c None",
/* pixels */
"OOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOO",
"O..............O",
"O.OOOOOOOOOOOO.O",
"O OOOOOOOO O",
"O o OOOOOOOO o O",
"O o OOOOOOOO o O",
"O OOOOOOOO O",
"O.OOOOOOOOOOOO.O",
"O.OOOOOOOOOOOO.O",
"O.OOOOOOOOOOOO.O",
"O.OOOOOOOOOOOO.O",
"O.OOOOOOOOOOOO.O",
"O..............O",
"OOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOO"
};
/* XPM */
static char *tablet[] = {
/* columns rows colors chars-per-pixel */
"16 16 3 1",
" c black",
". c gray100",
"X c None",
/* pixels */
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX",
"X X",
"X ............ X",
"X ............ X",
"X ............ X",
"X ............ X",
"X ............ X",
"X ............ X",
"X ............ X",
"X ............ X",
"X ............ X",
"X ............ X",
"X X",
"XXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXX"
};
/* XPM */
static char *tip[] = {
/* columns rows colors chars-per-pixel */
"16 16 5 1",
" c black",
". c green",
"X c #808080",
"o c gray100",
"O c None",
/* pixels */
"OOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOXOO",
"OOOOOOOOOOOOXoXO",
"OOOOOOOOOOOXoXOO",
"OOOOOOOOOOXoXOOO",
"OOOOOOOOOXoXOOOO",
"OOOOOOOOXoXOOOOO",
"OOOOOOO oXOOOOOO",
"OOOOOO . OOOOOOO",
"OOOOO . OOOOOOOO",
"OOOO . OOOOOOOOO",
"OOO . OOOOOOOOOO",
"OO . OOOOOOOOOOO",
"OO OOOOOOOOOOOO",
"OOOOXXXXXOOOOOOO",
"OOOOOOOOOXXXXXOO"
};
/* XPM */
static char *button_none[] = {
/* columns rows colors chars-per-pixel */
"8 8 3 1",
" c black",
". c #808080",
"X c None",
/* pixels */
"XXXXXXXX",
"XX .. XX",
"X .XX. X",
"X.XX X.X",
"X.X XX.X",
"X .XX. X",
"XX .. XX",
"XXXXXXXX"
};
/* XPM */
static char *button_off[] = {
/* columns rows colors chars-per-pixel */
"8 8 4 1",
" c black",
". c #808080",
"X c gray100",
"o c None",
/* pixels */
"oooooooo",
"oo. .oo",
"o. XX .o",
"o XXXX o",
"o XXXX o",
"o. XX .o",
"oo. .oo",
"oooooooo"
};
/* XPM */
static char *button_on[] = {
/* columns rows colors chars-per-pixel */
"8 8 3 1",
" c black",
". c green",
"X c None",
/* pixels */
"XXXXXXXX",
"XX XX",
"X .. X",
"X .... X",
"X .... X",
"X .. X",
"XX XX",
"XXXXXXXX"
};
/* XPM */
static char * axis_none_xpm[] = {
"24 8 3 1",
" c None",
". c #000000",
"+ c #808080",
" ",
" .++++++++++++++++++. ",
" .+ . .+. ",
" + . . . + ",
" + . . . + ",
" .+. . +. ",
" .++++++++++++++++++. ",
" "};
/* XPM */
static char * axis_off_xpm[] = {
"24 8 4 1",
" c None",
". c #808080",
"+ c #000000",
"@ c #FFFFFF",
" ",
" .++++++++++++++++++. ",
" .+@@@@@@@@@@@@@@@@@@+. ",
" +@@@@@@@@@@@@@@@@@@@@+ ",
" +@@@@@@@@@@@@@@@@@@@@+ ",
" .+@@@@@@@@@@@@@@@@@@+. ",
" .++++++++++++++++++. ",
" "};
/* XPM */
static char * axis_on_xpm[] = {
"24 8 3 1",
" c None",
". c #000000",
"+ c #00FF00",
" ",
" .................... ",
" ..++++++++++++++++++.. ",
" .++++++++++++++++++++. ",
" .++++++++++++++++++++. ",
" ..++++++++++++++++++.. ",
" .................... ",
" "};
#include <map>
#include <set>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/notebook.h>
#include <gtkmm/progressbar.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/treemodelcolumn.h>
#include <gtkmm/treestore.h>
#include <gtkmm/treeview.h>
#include "device-manager.h"
#include "input.h"
using Inkscape::InputDevice;
namespace Inkscape {
namespace UI {
namespace Dialog {
{
public:
};
class InputDialogImpl : public InputDialog {
public:
virtual ~InputDialogImpl() {}
private:
void linkComboChanged();
void resyncToSelection();
};
// Now that we've defined the *Impl class, we can do the method to aquire one.
{
return *dialog;
}
InputDialog(),
lastDevnameSeen(""),
cols(),
frame2(),
testFrame("Test Area"),
treeScroller(),
splitter(),
split2(),
linkCombo(),
confSplitter(),
topHolder(),
{
{
col++;
if (col > 7) {
col = 0;
row++;
}
}
col = 0;
col++;
if (col > 3) {
col = 0;
row++;
}
}
}
// confSplitter.show_all();
// splitter.show_all();
int rowNum = 0;
rowNum++;
linkCombo.set_sensitive(false);
linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged));
rowNum++;
rowNum++;
rowNum++;
rowNum++;
}
rowNum++;
/*
lbl = Gtk::manage(new Gtk::Label("Actual button count:"));
devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
::Gtk::FILL,
::Gtk::SHRINK);
devDetails.attach(buttonCombo, 1, 2, rowNum, rowNum + 1,
::Gtk::SHRINK,
::Gtk::SHRINK);
rowNum++;
*/
rowNum++;
// void gdk_input_set_extension_events (GdkWindow *window,
// gint mask,
// GdkExtensionMode mode);
testDetector.add_events(Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK |Gdk::PROXIMITY_IN_MASK|Gdk::PROXIMITY_OUT_MASK|Gdk::SCROLL_MASK);
rowNum++;
devDetails.set_sensitive(false);
// gnome-dev-mouse-optical
// input-mouse
// input-tablet
// mouse
//Add the TreeView's view columns:
tree.set_headers_visible(false);
tree.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::resyncToSelection));
if ( dev ) {
// 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(),
// dev->hasCursor() ? "Yes":"no", dev->getNumAxes(), dev->getNumKeys());
// if ( dev->getSource() != Gdk::SOURCE_MOUSE ) {
if ( dev ) {
case GDK_SOURCE_MOUSE:
break;
case GDK_SOURCE_PEN:
} else {
}
break;
case GDK_SOURCE_CURSOR:
break;
case GDK_SOURCE_ERASER:
break;
default:
; // nothing
}
}
} else {
g_warning("Null device in list");
}
}
} else {
g_warning("No devices found");
}
Inkscape::DeviceManager::getManager().signalDeviceChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::handleDeviceChange));
Inkscape::DeviceManager::getManager().signalButtonsChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceButtons));
Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceLinks));
tree.expand_all();
}
{
// g_message("OUCH!!!! for %p hits %s", &device, device->getId().c_str());
}
{
}
}
}
}
{
// g_message("Links!!!! for %p hits %s with link of %s", &device, device->getId().c_str(), device->getLink().c_str());
}
void InputDialogImpl::linkComboChanged() {
if (iter) {
if ( dev ) {
for ( std::list<InputDevice const *>::const_iterator it = devList.begin(); it != devList.end(); ++it ) {
break;
}
}
}
}
}
void InputDialogImpl::resyncToSelection() {
bool clear = true;
if (iter) {
if ( dev ) {
devDetails.set_sensitive(true);
linkCombo.set_active(0);
for ( std::list<InputDevice const *>::const_iterator it = devList.begin(); it != devList.end(); ++it ) {
}
}
}
linkCombo.set_sensitive(true);
} else {
linkCombo.set_sensitive(false);
}
clear = false;
}
}
if (clear) {
}
}
void InputDialogImpl::setupValueAndCombo( gint reported, gint actual, Gtk::Label& label, Gtk::ComboBoxText& combo )
{
combo.clear_items();
}
}
}
{
if ( i == hotButton ) {
} else {
}
} else {
}
}
}
{
{
if (iter) {
dev = 0;
}
}
}
case 0:
case 1:
axesValues[i].set_sensitive(false);
}
break;
case 2:
axesValues[i].set_sensitive(true);
axesValues[i].set_sensitive(true);
axesValues[i].set_fraction( (axesMap[key][i].second- dev->axes[i].min) / (dev->axes[i].max - dev->axes[i].min) );
}
}
break;
case 3:
axesValues[i].set_sensitive(true);
axesValues[i].set_sensitive(true);
axesValues[i].set_fraction( (axesMap[key][i].second- dev->axes[i].min) / (dev->axes[i].max - dev->axes[i].min) );
}
}
}
} else {
}
}
if ( !dev ) {
axesValues[i].set_sensitive(false);
}
}
}
void InputDialogImpl::mapAxesValues( Glib::ustring const& key, guint numAxes, gdouble const * axes, GdkDevice* dev )
{
// 0 == new, 1 == set value, 2 == changed value, 3 == active
case 0:
{
}
break;
case 1:
{
// g_message("Axis %d changed on %s]", axesNum, key.c_str());
}
}
break;
case 2:
{
}
}
break;
case 3:
{
} else {
}
}
}
}
}
// std::map<Glib::ustring, std::map<guint, std::pair<guint, gdouble> > > axesMap;
}
{
case GDK_SOURCE_MOUSE:
key = "M:";
break;
case GDK_SOURCE_CURSOR:
key = "C:";
break;
case GDK_SOURCE_PEN:
key = "P:";
break;
case GDK_SOURCE_ERASER:
key = "E:";
break;
default:
key = "?:";
}
return key;
}
{
int modmod = 0;
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
{
// g_message("%d KEY state:0x%08x 0x%04x [%s]", keyEvt->type, keyEvt->state, keyEvt->keyval, name);
}
break;
case GDK_BUTTON_PRESS:
modmod = 1;
// fallthrough
case GDK_BUTTON_RELEASE:
{
// g_message("New button found for %s = %d", key.c_str(), btnEvt->button);
}
}
// g_message("%d BTN state:0x%08x %c %4d [%s] dev:%p [%s] ",
// btnEvt->type, btnEvt->state,
// (modmod ? '+':'-'),
// btnEvt->button, name, btnEvt->device,
// (btnEvt->device ? btnEvt->device->name : "null")
// );
}
break;
case GDK_MOTION_NOTIFY:
{
}
// g_message("%d MOV state:0x%08x [%s] dev:%p [%s] %3.2f %3.2f %3.2f %3.2f %3.2f %3.2f", btnMtn->type, btnMtn->state,
// name, btnMtn->device,
// (btnMtn->device ? btnMtn->device->name : "null"),
// ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 0)) ? btnMtn->axes[0]:0),
// ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 1)) ? btnMtn->axes[1]:0),
// ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 2)) ? btnMtn->axes[2]:0),
// ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 3)) ? btnMtn->axes[3]:0),
// ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 4)) ? btnMtn->axes[4]:0),
// ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 5)) ? btnMtn->axes[5]:0)
// );
}
break;
default:
;// nothing
}
switch (source) {
case GDK_SOURCE_MOUSE:
{
}
break;
case GDK_SOURCE_CURSOR:
{
// g_message("flip to cursor");
}
break;
case GDK_SOURCE_PEN:
{
if (devName == "pad") {
// g_message("flip to pad");
} else {
// g_message("flip to pen");
}
}
break;
case GDK_SOURCE_ERASER:
{
// g_message("flip to eraser");
}
break;
// default:
// g_message("gurgle");
}
}
return false;
}
} // end namespace Inkscape
} // end namespace UI
} // end namespace Dialog
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :