input.cpp revision 55919b10f5e27d2fa50c03ca269bce594f5c8d82
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *eraser[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"16 16 5 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c green",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X c #808080",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"o c gray100",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOO OO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOO . O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOO . OO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOO . OOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOO . OOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOO . OOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOXo OOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOXoXOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOXoXOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOXoXOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOXoXOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOXoXOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOXXOOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOOOO"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *mouse[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"16 16 3 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c gray100",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXX XXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXX . XXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXX .... XXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXX .... XXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXX .... XXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXX .... XXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXX .... XXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXX .... XXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXX . XXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXX XXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *pen[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"16 16 3 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c gray100",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXX XX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXX . X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXX . XX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXX . XXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXX . XXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXX . XXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXX . XXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXX . XXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXX . XXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXX . XXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXX . XXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XX . XXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XX XXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *sidebuttons[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"16 16 4 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c #808080",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"o c green",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O..............O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O.OOOOOOOOOOOO.O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O OOOOOOOO O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O o OOOOOOOO o O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O o OOOOOOOO o O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O OOOOOOOO O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O.OOOOOOOOOOOO.O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O.OOOOOOOOOOOO.O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O.OOOOOOOOOOOO.O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O.OOOOOOOOOOOO.O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O.OOOOOOOOOOOO.O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O..............O",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOOOO"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *tablet[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"16 16 3 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c gray100",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X ............ X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXXXXXXXXXX"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *tip[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"16 16 5 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c green",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X c #808080",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"o c gray100",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"O c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOOXOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOOXoXO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOOXoXOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOOXoXOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOXoXOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOXoXOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOO oXOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOO . OOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOO . OOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOO . OOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOO . OOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OO . OOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OO OOOOOOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOXXXXXOOOOOOO",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"OOOOOOOOOXXXXXOO"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *button_none[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"8 8 3 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c #808080",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XX .. XX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X .XX. X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X.XXXX.X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X.XXXX.X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X .XX. X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XX .. XX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXX"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *button_off[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"8 8 4 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c #808080",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X c gray100",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"o c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"oooooooo",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"oo. .oo",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"o. XX .o",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"o XXXX o",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"o XXXX o",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"o. XX .o",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"oo. .oo",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"oooooooo"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* XPM */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmstatic char *button_on[] = {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* columns rows colors chars-per-pixel */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"8 8 3 1",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm" c black",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm". c green",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X c None",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/* pixels */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XX XX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X .. X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X .... X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X .... X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"X .. X",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XX XX",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm"XXXXXXXX"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <map>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <set>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <glib/gprintf.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <glibmm/i18n.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/comboboxtext.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/enums.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/frame.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/image.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/menubar.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/notebook.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/paned.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/scrolledwindow.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/table.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/eventbox.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/treemodel.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/treemodelcolumn.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/treestore.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include <gtkmm/treeview.h>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include "ui/widget/panel.h"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include "device-manager.h"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#include "input.h"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmusing Inkscape::InputDevice;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmnamespace Inkscape {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmnamespace UI {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmnamespace Dialog {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmclass MyModelColumns : public Gtk::TreeModel::ColumnRecord
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm{
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmpublic:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModelColumn<Glib::ustring> filename;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModelColumn<Glib::ustring> description;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > thumbnail;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModelColumn<InputDevice const *> device;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm MyModelColumns() { add(filename); add(description); add(thumbnail); add(device); }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmclass InputDialogImpl : public InputDialog {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmpublic:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm InputDialogImpl();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm virtual ~InputDialogImpl() {}
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmprivate:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> penPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> mousePix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> tipPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> tabletPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> eraserPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> sidebuttonsPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> buttonsNonePix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> buttonsOnPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gdk::Pixbuf> buttonsOffPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm std::map<Glib::ustring, std::set<guint> > buttonMap;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm GdkInputSource lastSourceSeen;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::ustring lastDevnameSeen;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm MyModelColumns cols;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gtk::TreeStore> store;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeView tree;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Frame frame2;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Frame testFrame;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::ScrolledWindow treeScroller;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::ScrolledWindow detailScroller;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::HPaned splitter;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::VPaned split2;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Label devName;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Label devKeyCount;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Label devAxesCount;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::ComboBoxText axesCombo;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::ComboBoxText buttonCombo;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::ComboBoxText modeCombo;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Label keyVal;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Entry keyEntry;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Table devDetails;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::HPaned confSplitter;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Notebook topHolder;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Image testThumb;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Image testButtons[24];
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Table imageTable;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::EventBox testDetector;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void setupValueAndCombo( gint reported, gint actual, Gtk::Label& label, Gtk::ComboBoxText& combo );
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool eventSnoop(GdkEvent* event);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void foo();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm};
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// Now that we've defined the *Impl class, we can do the method to aquire one.
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmInputDialog &InputDialog::getInstance()
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm{
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm InputDialog *dialog = new InputDialogImpl();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm return *dialog;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm}
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmInputDialogImpl::InputDialogImpl() :
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm InputDialog(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm penPix(Gdk::Pixbuf::create_from_xpm_data(pen)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm mousePix(Gdk::Pixbuf::create_from_xpm_data(mouse)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tipPix(Gdk::Pixbuf::create_from_xpm_data(tip)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tabletPix(Gdk::Pixbuf::create_from_xpm_data(tablet)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm eraserPix(Gdk::Pixbuf::create_from_xpm_data(eraser)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm sidebuttonsPix(Gdk::Pixbuf::create_from_xpm_data(sidebuttons)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm buttonsNonePix(Gdk::Pixbuf::create_from_xpm_data(button_none)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm buttonsOnPix(Gdk::Pixbuf::create_from_xpm_data(button_on)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm buttonsOffPix(Gdk::Pixbuf::create_from_xpm_data(button_off)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lastSourceSeen((GdkInputSource)-1),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lastDevnameSeen(""),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm cols(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm store(Gtk::TreeStore::create(cols)),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tree(store),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm frame2(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testFrame("Test Area"),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm treeScroller(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm detailScroller(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm splitter(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm split2(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails(6, 2),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm confSplitter(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm topHolder(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm imageTable(8, 4)
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm{
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Box *contents = _getContents();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm treeScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm treeScroller.add(tree);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm split2.pack1(testFrame);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm split2.pack2(frame2);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm splitter.pack1(treeScroller);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm splitter.pack2(split2);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testDetector.add(imageTable);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testFrame.add(testDetector);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testThumb.set(tabletPix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testThumb.set_padding(24, 24);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm imageTable.attach(testThumb, 0, 8, 0, 1, ::Gtk::EXPAND, ::Gtk::EXPAND);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm guint col = 0;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm guint row = 1;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm for ( guint num = 0; num < 24; num++ ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testButtons[num].set(buttonsNonePix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm imageTable.attach(testButtons[num], col, col + 1, row, row + 1, ::Gtk::FILL, ::Gtk::FILL);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm col++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if (col > 7) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm col = 0;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm row++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm topHolder.append_page(confSplitter, "Configuration");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm topHolder.append_page(splitter, "Hardware");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// confSplitter.show_all();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// splitter.show_all();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm topHolder.show_all();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm topHolder.set_current_page(1);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm contents->pack_start(topHolder);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm int rowNum = 0;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::Label* lbl = Gtk::manage(new Gtk::Label("Name:"));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(devName, 1, 2, rowNum, rowNum + 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm rowNum++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lbl = Gtk::manage(new Gtk::Label("Mode:"));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.append_text("Disabled");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.append_text("Screen");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.append_text("Window");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.set_active_text("Disabled");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.set_sensitive(false);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(modeCombo, 1, 2, rowNum, rowNum + 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm rowNum++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lbl = Gtk::manage(new Gtk::Label("Reported axes count:"));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(devAxesCount, 1, 2, rowNum, rowNum + 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm rowNum++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lbl = Gtk::manage(new Gtk::Label("Actual axes count:"));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(axesCombo, 1, 2, rowNum, rowNum + 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm rowNum++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lbl = Gtk::manage(new Gtk::Label("Reported button count:"));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(devKeyCount, 1, 2, rowNum, rowNum + 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm rowNum++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lbl = Gtk::manage(new Gtk::Label("Actual button count:"));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(buttonCombo, 1, 2, rowNum, rowNum + 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm rowNum++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(keyVal, 0, 2, rowNum, rowNum + 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm rowNum++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testDetector.signal_event().connect(sigc::mem_fun(*this, &InputDialogImpl::eventSnoop));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// void gdk_input_set_extension_events (GdkWindow *window,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// gint mask,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// GdkExtensionMode mode);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm gtk_widget_set_extension_events( GTK_WIDGET(testDetector.gobj()), GDK_EXTENSION_EVENTS_ALL );
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm 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);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.attach(keyEntry, 0, 2, rowNum, rowNum + 1,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::FILL,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ::Gtk::SHRINK);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm rowNum++;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.set_sensitive(false);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm detailScroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm detailScroller.add(devDetails);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm frame2.add(detailScroller);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm//- 16x16/devices
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// gnome-dev-mouse-optical
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// input-mouse
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// input-tablet
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// mouse
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModel::Row row;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModel::Row childrow;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModel::Row deviceRow;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm //Add the TreeView's view columns:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tree.append_column("I", cols.thumbnail);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tree.append_column("Bar", cols.description);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tree.set_enable_tree_lines();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tree.set_headers_visible(false);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tree.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::foo));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm std::list<InputDevice const *> devList = Inkscape::DeviceManager::getManager().getDevices();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( !devList.empty() ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("Found some");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm GdkModifierType defaultModMask = static_cast<GdkModifierType>(gtk_accelerator_get_default_mod_mask());
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm gchar* name = gtk_accelerator_name(GDK_a, defaultModMask);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm gchar* label = gtk_accelerator_get_label(GDK_a, defaultModMask);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("Name: [%s] label:[%s]", name, label);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_free(name);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_free(label);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm row = *(store->append());
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm row[cols.description] = "Hardware";
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm childrow = *(store->append(row.children()));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm childrow[cols.description] = "Tablet";
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm childrow[cols.thumbnail] = tabletPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm for ( std::list<InputDevice const *>::iterator it = devList.begin(); it != devList.end(); ++it ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm InputDevice const* dev = *it;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( dev ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm 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(),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm dev->hasCursor() ? "Yes":"no", dev->getNumAxes(), dev->getNumKeys());
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( dev->getSource() != Gdk::SOURCE_MOUSE ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm deviceRow = *(store->append(childrow.children()));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm deviceRow[cols.description] = dev->getName();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm deviceRow[cols.device] = dev;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm switch ( dev->getSource() ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_PEN:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if (deviceRow[cols.description] == "pad") {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm deviceRow[cols.thumbnail] = sidebuttonsPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm } else {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm deviceRow[cols.thumbnail] = tipPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_CURSOR:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm deviceRow[cols.thumbnail] = mousePix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_ERASER:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm deviceRow[cols.thumbnail] = eraserPix;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm default:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ; // nothing
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm } else {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_warning("Null device in list");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm } else {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("NO DEVICES FOUND");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tree.expand_all();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm show_all_children();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm}
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmvoid InputDialogImpl::foo() {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool clear = true;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::RefPtr<Gtk::TreeSelection> treeSel = tree.get_selection();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModel::iterator iter = treeSel->get_selected();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if (iter) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Gtk::TreeModel::Row row = *iter;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::ustring val = row[cols.description];
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm InputDevice const * dev = row[cols.device];
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( dev ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.set_sensitive(true);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.set_sensitive(true);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm switch( dev->getMode() ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_MODE_DISABLED:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.set_active(0);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_MODE_SCREEN:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.set_active(1);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_MODE_WINDOW:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modeCombo.set_active(2);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm default:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm clear = false;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devName.set_label(row[cols.description]);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm setupValueAndCombo( dev->getNumAxes(), dev->getNumAxes(), devAxesCount, axesCombo);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm setupValueAndCombo( dev->getNumKeys(), dev->getNumKeys(), devKeyCount, buttonCombo);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devDetails.set_sensitive(!clear);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if (clear) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devName.set_label("");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devAxesCount.set_label("");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devKeyCount.set_label("");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm}
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmvoid InputDialogImpl::setupValueAndCombo( gint reported, gint actual, Gtk::Label& label, Gtk::ComboBoxText& combo )
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm{
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm gchar *tmp = g_strdup_printf("%d", reported);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm label.set_label(tmp);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_free(tmp);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm combo.clear_items();
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm for ( gint i = 1; i <= reported; ++i ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm tmp = g_strdup_printf("%d", i);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm combo.append_text(tmp);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_free(tmp);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( (1 <= actual) && (actual <= reported) ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm combo.set_active(actual - 1);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm}
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrmbool InputDialogImpl::eventSnoop(GdkEvent* event)
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm{
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm int modmod = 0;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm GdkInputSource source = lastSourceSeen;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::ustring devName = lastDevnameSeen;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm switch ( event->type ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_KEY_PRESS:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_KEY_RELEASE:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm GdkEventKey* keyEvt = reinterpret_cast<GdkEventKey*>(event);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm gchar* name = gtk_accelerator_name(keyEvt->keyval, static_cast<GdkModifierType>(keyEvt->state));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm keyVal.set_label(name);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("%d KEY state:0x%08x 0x%04x [%s]", keyEvt->type, keyEvt->state, keyEvt->keyval, name);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_free(name);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_BUTTON_PRESS:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm modmod = 1;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm // fallthrough
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_BUTTON_RELEASE:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm GdkEventButton* btnEvt = reinterpret_cast<GdkEventButton*>(event);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Glib::ustring key;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( btnEvt->device ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm source = btnEvt->device->source;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devName = btnEvt->device->name;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm switch ( btnEvt->device->source ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_MOUSE:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm key = "M:";
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_CURSOR:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm key = "C:";
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_PEN:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm key = "P:";
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_ERASER:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm key = "E:";
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm default:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm key = "?:";
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm key += devName;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( buttonMap[key].find(btnEvt->button) == buttonMap[key].end() ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("New button found for %s = %d", key.c_str(), btnEvt->button);
ea8dd7683dd12883474f6cf9b5f424f8ed831166Kris buttonMap[key].insert(btnEvt->button);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm for ( guint i = 0; i < 24; i++ ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( buttonMap[key].find(i) != buttonMap[key].end() ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if (modmod && (i == btnEvt->button) ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testButtons[i].set(buttonsOnPix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm } else {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testButtons[i].set(buttonsOffPix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm } else {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testButtons[i].set(buttonsNonePix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm gchar* name = gtk_accelerator_name(0, static_cast<GdkModifierType>(btnEvt->state));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm keyVal.set_label(name);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("%d BTN state:0x%08x %c %4d [%s] dev:%p [%s] ",
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm btnEvt->type, btnEvt->state,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm (modmod ? '+':'-'),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm btnEvt->button, name, btnEvt->device,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm (btnEvt->device ? btnEvt->device->name : "null")
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm );
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_free(name);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_MOTION_NOTIFY:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm GdkEventMotion* btnMtn = reinterpret_cast<GdkEventMotion*>(event);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( btnMtn->device ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm source = btnMtn->device->source;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm devName = btnMtn->device->name;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm gchar* name = gtk_accelerator_name(0, static_cast<GdkModifierType>(btnMtn->state));
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm keyVal.set_label(name);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm 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,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm name, btnMtn->device,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm (btnMtn->device ? btnMtn->device->name : "null"),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 0)) ? btnMtn->axes[0]:0),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 1)) ? btnMtn->axes[1]:0),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 2)) ? btnMtn->axes[2]:0),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 3)) ? btnMtn->axes[3]:0),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 4)) ? btnMtn->axes[4]:0),
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 5)) ? btnMtn->axes[5]:0)
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm );
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_free(name);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm default:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm ;// nothing
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if ( (lastSourceSeen != source) || (lastDevnameSeen != devName) ) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("FLIPPIES %d => %d", lastSourceSeen, source);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm switch (source) {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_MOUSE:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testThumb.set(mousePix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_CURSOR:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("flip to cursor");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testThumb.set(mousePix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_PEN:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm if (devName == "pad") {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("flip to pad");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testThumb.set(sidebuttonsPix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm } else {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("flip to pen");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testThumb.set(tipPix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm case GDK_SOURCE_ERASER:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("flip to eraser");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm testThumb.set(eraserPix);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm break;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm default:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm g_message("gurgle");
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lastSourceSeen = source;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm lastDevnameSeen = devName;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm }
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm return false;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm}
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm} // end namespace Inkscape
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm} // end namespace UI
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm} // end namespace Dialog
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/*
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Local Variables:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm mode:c++
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm c-file-style:"stroustrup"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm indent-tabs-mode:nil
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm fill-column:99
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm End:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm*/
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm