]> granicus.if.org Git - graphviz/commitdiff
custom key combo
authorarif <devnull@localhost>
Fri, 6 Nov 2009 18:15:27 +0000 (18:15 +0000)
committerarif <devnull@localhost>
Fri, 6 Nov 2009 18:15:27 +0000 (18:15 +0000)
cmd/smyrna/hotkeymap.c [new file with mode: 0644]
cmd/smyrna/hotkeymap.h [new file with mode: 0644]

diff --git a/cmd/smyrna/hotkeymap.c b/cmd/smyrna/hotkeymap.c
new file mode 100644 (file)
index 0000000..919ca5c
--- /dev/null
@@ -0,0 +1,37 @@
+
+#include "hotkeymap.h"
+int get_mode(ViewInfo* v)
+{
+/*#define MM_PAN                                       0
+#define MM_ZOOM                                        1
+#define MM_ROTATE                              2
+#define MM_SINGLE_SELECT               3
+#define MM_RECTANGULAR_SELECT  4
+#define MM_RECTANGULAR_X_SELECT        5
+#define MM_MOVE                                        10
+#define MM_MAGNIFIER                   20
+#define MM_FISHEYE_MAGNIFIER   21*/
+
+
+/*#define F_BUTTON1   B_LSHIFT
+#define F_BUTTON2   B_RSHIFT
+#define F_BUTTON3   B_LCTRL
+#define F_BUTTON4   B_LCTRL
+
+#define MOUSE_BUTTON_1 LEFT_MOUSE_BUTTON
+#define MOUSE_BUTTON_2  RIGHT_MOUSE_BUTTON
+#define MOUSE_BUTTON_3 MIDDLE_MOUSE_BUTTON*/
+
+
+    if ((view->mouse.t==MOUSE_BUTTON_1)&&(view->keymap.down) && (view->keymap.keyVal ==F_BUTTON1) && (view->active_camera==-1))
+       return MM_FISHEYE_MAGNIFIER;
+    if ((view->mouse.t==MOUSE_BUTTON_1)&&(view->keymap.down) && (view->keymap.keyVal == F_BUTTON1) && (view->active_camera>-1))
+       return MM_ROTATE;
+    if ((view->mouse.t==MOUSE_BUTTON_1)&&(view->keymap.down) && (view->keymap.keyVal == F_BUTTON3)) 
+       return MM_MOVE;
+    if ((view->mouse.t==MOUSE_BUTTON_1)&&(view->mouse.down) ) 
+       return MM_PAN;
+    if ((view->mouse.t==MOUSE_BUTTON_2)&&(view->mouse.down) ) 
+       return MM_RECTANGULAR_SELECT;
+
+}
diff --git a/cmd/smyrna/hotkeymap.h b/cmd/smyrna/hotkeymap.h
new file mode 100644 (file)
index 0000000..86fbb3e
--- /dev/null
@@ -0,0 +1,49 @@
+/* $Id$Revision: */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+*      This software is part of the graphviz package      *
+*                http://www.graphviz.org/                 *
+*                                                         *
+*            Copyright (c) 1994-2004 AT&T Corp.           *
+*                and is licensed under the                *
+*            Common Public License, Version 1.0           *
+*                      by AT&T Corp.                      *
+*                                                         *
+*        Information and Software Systems Research        *
+*              AT&T Research, Florham Park NJ             *
+**********************************************************/
+
+#ifndef HOTKEYMAP_H
+#define HOTKEYMAP_H
+#include "smyrnadefs.h"
+
+#define B_LSHIFT           65505
+#define B_RSHIFT           65506
+#define B_LCTRL                    65507
+#define B_RCTRL                    65508
+#define LEFT_MOUSE_BUTTON      glMouseLeftButton
+#define RIGHT_MOUSE_BUTTON     glMouseRightButton
+#define MIDDLE_MOUSE_BUTTON    glMouseMiddleButton
+
+
+
+/*key combinations defined here,dont modify the code above here*/
+#define F_BUTTON1   B_LSHIFT
+#define F_BUTTON2   B_RSHIFT
+#define F_BUTTON3   B_LCTRL
+#define F_BUTTON4   B_LCTRL
+
+#define MOUSE_BUTTON_1 LEFT_MOUSE_BUTTON
+#define MOUSE_BUTTON_2  RIGHT_MOUSE_BUTTON
+#define MOUSE_BUTTON_3 MIDDLE_MOUSE_BUTTON
+
+
+
+
+
+extern int get_mode(ViewInfo* v);
+
+
+
+#endif