Graphviz 14.1.2~dev.20260118.1035
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 "config.h"
12
13#include "appmouse.h"
14#include "topfisheyeview.h"
15#include "arcball.h"
16#include "glmotion.h"
17#include "hotkeymap.h"
18
19#include "selectionfuncs.h"
20#include <stdbool.h>
21#include <stdint.h>
22#include <util/list.h>
23#include "topviewfuncs.h"
24
25static int lastAction;
26
27static void apply_actions(ViewInfo* v,int x,int y)
28{
29 int a;
30 gdouble seconds;
31 a=get_mode(v);
32 if (a == MM_PAN && view->guiMode == GUI_FULLSCREEN &&
34 a=MM_ROTATE;
35 switch (a) {
36 case MM_ROTATE :
37 seconds = g_timer_elapsed(view->timer3, NULL);
38 if (seconds > 0.1) {
39 g_timer_stop(view->timer3);
40 view->arcball->MousePt.X = (float)x;
41 view->arcball->MousePt.Y = (float)y;
42 if (!view->arcball->isDragging) {
45 }
46 else
48 g_timer_start(view->timer3);
49 }
50 return;
51 case MM_PAN :
52 glmotion_pan(v);
53 break;
54 case MM_MOVE :
55 break;
57 if (!view->mouse.down) {
59 }
60 break;
63 break;
64 case MM_SINGLE_SELECT :
66 break;
67 case MM_FISHEYE_PICK :
68 if (view->activeGraph >= 0) {
71
72 }
73 break;
74 }
75 lastAction=a;
76}
77
78static void appmouse_down(ViewInfo* v,int x,int y)
79{
80 view->mouse.dragX = 0;
81 view->mouse.dragY = 0;
82 v->mouse.down = true;
83 v->mouse.x = x;
84 v->mouse.y = y;
85
87 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
88}
89
90void appmouse_up(ViewInfo *v, int x, int y) {
91 v->mouse.down = false;
93 apply_actions(v,x,y);
94 view->mouse.dragX = 0;
95 view->mouse.dragY = 0;
97
98
99}
100
101void appmouse_drag(ViewInfo *v, int x, int y) {
102 v->mouse.x = x;
103 v->mouse.y = y;
104 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
105 apply_actions(v,x,y);
106}
107
109{
111 appmouse_down(v,x,y);
112
113
114}
115
117{
119 appmouse_down(v,x,y);
120
121
122}
123
125{
127 appmouse_down(v,x,y);
128
129
130}
131
132void appmouse_move(ViewInfo* v,int x,int y)
133{
134 to3D( x,y, &v->mouse.GLpos.x,&v->mouse.GLpos.y,&v->mouse.GLpos.z);
135}
137{
139 {
141 glexpose();
142 }
143 v->keyVal = 0;
144}
146{
147 v->keyVal = key;
148}
149
150
static int lastAction
Definition appmouse.c:25
void appmouse_drag(ViewInfo *v, int x, int y)
Definition appmouse.c:101
void appmouse_key_release(ViewInfo *v)
Definition appmouse.c:136
static void appmouse_down(ViewInfo *v, int x, int y)
Definition appmouse.c:78
void appmouse_move(ViewInfo *v, int x, int y)
Definition appmouse.c:132
void appmouse_key_press(ViewInfo *v, int key)
Definition appmouse.c:145
void appmouse_middle_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:124
static void apply_actions(ViewInfo *v, int x, int y)
Definition appmouse.c:27
void appmouse_left_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:108
void appmouse_right_click_down(ViewInfo *v, int x, int y)
Definition appmouse.c:116
void appmouse_up(ViewInfo *v, int x, int y)
Definition appmouse.c:90
void arcmouseClick(void)
Definition arcball.c:125
void arcmouseDrag(void)
Definition arcball.c:133
@ glMouseRightButton
Definition glcompdefs.h:67
@ glMouseMiddleButton
Definition glcompdefs.h:68
@ glMouseLeftButton
Definition glcompdefs.h:67
void glmotion_pan(ViewInfo *v)
Definition glmotion.c:71
void to3D(int x, int y, float *X, float *Y, float *Z)
Definition glutils.c:93
#define SIZE_MAX
Definition gmlscan.c:347
node NULL
Definition grammar.y:181
int get_mode(ViewInfo *v)
Definition hotkeymap.c:168
type-generic dynamically expanding list
#define LIST_FREE(list)
Definition list.h:370
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:203
ViewInfo * view
Definition viewport.c:40
#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:523
#define MM_PAN
Definition smyrnadefs.h:39
Point2fT MousePt
Definition arcball.h:426
int isDragging
Definition arcball.h:427
ArcBall_t * arcball
Definition smyrnadefs.h:331
topview * Topview
Definition smyrnadefs.h:305
int keyVal
depressed key or 0 if none
Definition smyrnadefs.h:332
Agraph_t ** g
Definition smyrnadefs.h:288
int activeGraph
Definition smyrnadefs.h:292
glCompMouse mouse
Definition smyrnadefs.h:295
GTimer * timer3
Definition smyrnadefs.h:311
size_t active_camera
<number of cameras
Definition smyrnadefs.h:299
glCompPoly_t selPoly
Definition smyrnadefs.h:206
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::@22 fisheyeParams
int active
Definition smyrnadefs.h:214
selection sel
Definition smyrnadefs.h:235
void changetopfishfocus(topview *t, float *x, float *y, int num_foci)