Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
appmouse.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#include "appmouse.h"
12#include "topfisheyeview.h"
13#include "arcball.h"
14#include "glmotion.h"
15#include "hotkeymap.h"
16
17#include "selectionfuncs.h"
18#include <stdint.h>
19#include "topviewfuncs.h"
20
21static int lastAction;
22
23static void apply_actions(ViewInfo* v,int x,int y)
24{
25 int a;
26 gdouble seconds;
27 a=get_mode(v);
28 if (a == MM_PAN && view->guiMode == GUI_FULLSCREEN &&
30 a=MM_ROTATE;
31 switch (a) {
32 case MM_ROTATE :
33 seconds = g_timer_elapsed(view->timer3, NULL);
34 if (seconds > 0.1) {
35 g_timer_stop(view->timer3);
36 view->arcball->MousePt.s.X = (float)x;
37 view->arcball->MousePt.s.Y = (float)y;
38 if (!view->arcball->isDragging) {
41 }
42 else
44 g_timer_start(view->timer3);
45 }
46 return;
47 case MM_PAN :
48 glmotion_pan(v);
49 break;
50 case MM_MOVE :
51 break;
53 if (!view->mouse.down) {
55 }
56 break;
59 break;
60 case MM_SINGLE_SELECT :
62 break;
63 case MM_FISHEYE_PICK :
64 if (view->activeGraph >= 0) {
67
68 }
69 break;
70 }
71 lastAction=a;
72}
73
74static void appmouse_down(ViewInfo* v,int x,int y)
75{
76 view->mouse.dragX = 0;
77 view->mouse.dragY = 0;
78 v->mouse.down=1;
79 v->mouse.x = x;
80 v->mouse.y = y;
81
83 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
84}
85
86void appmouse_up(ViewInfo *v, int x, int y) {
87 v->mouse.down=0;
89 apply_actions(v,x,y);
90 view->mouse.dragX = 0;
91 view->mouse.dragY = 0;
93
94
95}
96
97void appmouse_drag(ViewInfo *v, int x, int y) {
98 v->mouse.x = x;
99 v->mouse.y = y;
100 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
101 apply_actions(v,x,y);
102}
103
105{
107 appmouse_down(v,x,y);
108
109
110}
111
113{
115 appmouse_down(v,x,y);
116
117
118}
119
121{
123 appmouse_down(v,x,y);
124
125
126}
127
128void appmouse_move(ViewInfo* v,int x,int y)
129{
130 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
131}
133{
135 {
136 glCompPoly_free(&view->Topview->sel.selPoly);
137 glexpose();
138 }
139 v->keyVal = 0;
140}
142{
143 v->keyVal = key;
144}
145
146
static int lastAction
Definition appmouse.c:21
void appmouse_drag(ViewInfo *v, int x, int y)
Definition appmouse.c:97
void appmouse_key_release(ViewInfo *v)
Definition appmouse.c:132
static void appmouse_down(ViewInfo *v, int x, int y)
Definition appmouse.c:74
void appmouse_move(ViewInfo *v, int x, int y)
Definition appmouse.c:128
void appmouse_key_press(ViewInfo *v, int key)
Definition appmouse.c:141
void appmouse_middle_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:120
static void apply_actions(ViewInfo *v, int x, int y)
Definition appmouse.c:23
void appmouse_left_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:104
void appmouse_right_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:112
void appmouse_up(ViewInfo *v, int x, int y)
Definition appmouse.c:86
void arcmouseClick(void)
Definition arcball.c:142
void arcmouseDrag(void)
Definition arcball.c:150
@ glMouseRightButton
Definition glcompdefs.h:67
@ glMouseMiddleButton
Definition glcompdefs.h:68
@ glMouseLeftButton
Definition glcompdefs.h:67
void glmotion_pan(ViewInfo *v)
Definition glmotion.c:70
void to3D(int x, int y, float *X, float *Y, float *Z)
Definition glutils.c:100
#define SIZE_MAX
Definition gmlscan.c:347
node NULL
Definition grammar.y:163
int get_mode(ViewInfo *v)
Definition hotkeymap.c:166
void add_selpoly(Agraph_t *g, glCompPoly_t *selPoly, glCompPoint pt)
void pick_objects_rect(Agraph_t *g)
void pick_object_xyz(Agraph_t *g, topview *t, float x, float y, float z)
#define GUI_FULLSCREEN
Definition smyrnadefs.h:211
ViewInfo * view
Definition viewport.c:37
#define MM_SINGLE_SELECT
Definition smyrnadefs.h:44
#define MM_ROTATE
Definition smyrnadefs.h:43
#define MM_FISHEYE_PICK
Definition smyrnadefs.h:50
#define MM_RECTANGULAR_SELECT
Definition smyrnadefs.h:45
#define MM_POLYGON_SELECT
Definition smyrnadefs.h:51
#define MM_MOVE
Definition smyrnadefs.h:47
void glexpose(void)
Definition viewport.c:540
#define MM_PAN
Definition smyrnadefs.h:41
Point2fT MousePt
Definition arcball.h:551
int isDragging
Definition arcball.h:554
ArcBall_t * arcball
Definition smyrnadefs.h:343
topview * Topview
Definition smyrnadefs.h:313
int keyVal
depressed key or 0 if none
Definition smyrnadefs.h:344
Agraph_t ** g
Definition smyrnadefs.h:296
int activeGraph
Definition smyrnadefs.h:300
glCompMouse mouse
Definition smyrnadefs.h:303
GTimer * timer3
Definition smyrnadefs.h:319
size_t active_camera
<number of cameras
Definition smyrnadefs.h:307
glCompPoly_t selPoly
Definition smyrnadefs.h:214
glCompPoint GLfinalPos
Definition glcompdefs.h:243
glMouseButtonType t
Definition glcompdefs.h:239
glCompPoint GLpos
Definition glcompdefs.h:241
glCompPoint GLinitPos
Definition glcompdefs.h:242
float y
current mouse pos
Definition glcompdefs.h:240
int active
Definition smyrnadefs.h:222
struct topview::@55 fisheyeParams
selection sel
Definition smyrnadefs.h:242
void changetopfishfocus(topview *t, float *x, float *y, int num_foci)