Graphviz 13.1.3~dev.20250905.1412
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 <stdbool.h>
19#include <stdint.h>
20#include <util/list.h>
21#include "topviewfuncs.h"
22
23static int lastAction;
24
25static void apply_actions(ViewInfo* v,int x,int y)
26{
27 int a;
28 gdouble seconds;
29 a=get_mode(v);
30 if (a == MM_PAN && view->guiMode == GUI_FULLSCREEN &&
32 a=MM_ROTATE;
33 switch (a) {
34 case MM_ROTATE :
35 seconds = g_timer_elapsed(view->timer3, NULL);
36 if (seconds > 0.1) {
37 g_timer_stop(view->timer3);
38 view->arcball->MousePt.s.X = (float)x;
39 view->arcball->MousePt.s.Y = (float)y;
40 if (!view->arcball->isDragging) {
43 }
44 else
46 g_timer_start(view->timer3);
47 }
48 return;
49 case MM_PAN :
50 glmotion_pan(v);
51 break;
52 case MM_MOVE :
53 break;
55 if (!view->mouse.down) {
57 }
58 break;
61 break;
62 case MM_SINGLE_SELECT :
64 break;
65 case MM_FISHEYE_PICK :
66 if (view->activeGraph >= 0) {
69
70 }
71 break;
72 }
73 lastAction=a;
74}
75
76static void appmouse_down(ViewInfo* v,int x,int y)
77{
78 view->mouse.dragX = 0;
79 view->mouse.dragY = 0;
80 v->mouse.down = true;
81 v->mouse.x = x;
82 v->mouse.y = y;
83
85 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
86}
87
88void appmouse_up(ViewInfo *v, int x, int y) {
89 v->mouse.down = false;
91 apply_actions(v,x,y);
92 view->mouse.dragX = 0;
93 view->mouse.dragY = 0;
95
96
97}
98
99void appmouse_drag(ViewInfo *v, int x, int y) {
100 v->mouse.x = x;
101 v->mouse.y = y;
102 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
103 apply_actions(v,x,y);
104}
105
107{
109 appmouse_down(v,x,y);
110
111
112}
113
115{
117 appmouse_down(v,x,y);
118
119
120}
121
123{
125 appmouse_down(v,x,y);
126
127
128}
129
130void appmouse_move(ViewInfo* v,int x,int y)
131{
132 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
133}
135{
137 {
139 glexpose();
140 }
141 v->keyVal = 0;
142}
144{
145 v->keyVal = key;
146}
147
148
static int lastAction
Definition appmouse.c:23
void appmouse_drag(ViewInfo *v, int x, int y)
Definition appmouse.c:99
void appmouse_key_release(ViewInfo *v)
Definition appmouse.c:134
static void appmouse_down(ViewInfo *v, int x, int y)
Definition appmouse.c:76
void appmouse_move(ViewInfo *v, int x, int y)
Definition appmouse.c:130
void appmouse_key_press(ViewInfo *v, int key)
Definition appmouse.c:143
void appmouse_middle_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:122
static void apply_actions(ViewInfo *v, int x, int y)
Definition appmouse.c:25
void appmouse_left_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:106
void appmouse_right_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:114
void appmouse_up(ViewInfo *v, int x, int y)
Definition appmouse.c:88
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:69
void to3D(int x, int y, float *X, float *Y, float *Z)
Definition glutils.c:91
#define SIZE_MAX
Definition gmlscan.c:347
node NULL
Definition grammar.y:181
int get_mode(ViewInfo *v)
Definition hotkeymap.c:166
type-generic dynamically expanding list
#define LIST_FREE(list)
Definition list.h:379
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:205
ViewInfo * view
Definition viewport.c:37
#define MM_SINGLE_SELECT
Definition smyrnadefs.h:42
#define MM_ROTATE
Definition smyrnadefs.h:41
#define MM_FISHEYE_PICK
Definition smyrnadefs.h:48
#define MM_RECTANGULAR_SELECT
Definition smyrnadefs.h:43
#define MM_POLYGON_SELECT
Definition smyrnadefs.h:49
#define MM_MOVE
Definition smyrnadefs.h:45
void glexpose(void)
Definition viewport.c:520
#define MM_PAN
Definition smyrnadefs.h:39
Point2fT MousePt
Definition arcball.h:550
int isDragging
Definition arcball.h:553
ArcBall_t * arcball
Definition smyrnadefs.h:333
topview * Topview
Definition smyrnadefs.h:307
int keyVal
depressed key or 0 if none
Definition smyrnadefs.h:334
Agraph_t ** g
Definition smyrnadefs.h:290
int activeGraph
Definition smyrnadefs.h:294
glCompMouse mouse
Definition smyrnadefs.h:297
GTimer * timer3
Definition smyrnadefs.h:313
size_t active_camera
<number of cameras
Definition smyrnadefs.h:301
glCompPoly_t selPoly
Definition smyrnadefs.h:208
glCompPoint GLfinalPos
Definition glcompdefs.h:227
glMouseButtonType t
Definition glcompdefs.h:223
glCompPoint GLpos
Definition glcompdefs.h:225
glCompPoint GLinitPos
Definition glcompdefs.h:226
float y
current mouse pos
Definition glcompdefs.h:224
struct topview::@56 fisheyeParams
int active
Definition smyrnadefs.h:216
selection sel
Definition smyrnadefs.h:237
void changetopfishfocus(topview *t, float *x, float *y, int num_foci)