Graphviz
13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
toolboxcallbacks.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 "
toolboxcallbacks.h
"
12
#include "
viewport.h
"
13
14
#include "
gltemplate.h
"
15
#include <
glcomp/glutils.h
>
16
#include "
glmotion.h
"
17
#include <stdint.h>
18
19
void
btnToolZoomOut_clicked
(GtkWidget *widget,
void
*user_data) {
20
(void)widget;
21
(void)user_data;
22
23
glmotion_zoom_inc
(0);
24
}
25
26
void
btnToolZoomFit_clicked
(GtkWidget *widget,
void
*user_data) {
27
(void)widget;
28
(void)user_data;
29
30
float
z
=
view
->
active_camera
!=
SIZE_MAX
31
?
view
->
cameras
[
view
->
active_camera
]->
r
32
: -
view
->
zoom
;
33
34
float
GDX =
view
->
bdxRight
/
z
-
view
->
bdxLeft
/
z
;
35
float
SDX =
view
->
clipX2
-
view
->
clipX1
;
36
float
GDY =
view
->
bdyTop
/
z
-
view
->
bdyBottom
/
z
;
37
float
SDY =
view
->
clipY2
-
view
->
clipY1
;
38
39
if
(SDX / GDX <= SDY / GDY) {
40
if
(
view
->
active_camera
!=
SIZE_MAX
) {
41
view
->
cameras
[
view
->
active_camera
]->
r
/= SDX / GDX;
42
}
else
{
43
view
->
zoom
/= SDX / GDX;
44
}
45
}
else
{
46
if
(
view
->
active_camera
!=
SIZE_MAX
) {
47
view
->
cameras
[
view
->
active_camera
]->
r
/= SDY / GDY;
48
}
else
{
49
view
->
zoom
/= SDY / GDY;
50
}
51
52
}
53
btnToolFit_clicked
(
NULL
,
NULL
);
54
}
55
56
void
btnToolFit_clicked
(GtkWidget *widget,
void
*user_data) {
57
(void)widget;
58
(void)user_data;
59
60
float
scx, scy, gcx, gcy,
z
;
61
62
(
view
->
active_camera
!=
SIZE_MAX
)
63
? (
z
=
view
->
cameras
[
view
->
active_camera
]->
r
) : (
z
=
64
view
->
zoom
* -1);
65
66
gcx =
view
->
bdxLeft
/
z
+ (
view
->
bdxRight
/
z
-
view
->
bdxLeft
/
z
) / 2.0f;
67
scx =
view
->
clipX1
+ (
view
->
clipX2
-
view
->
clipX1
) / 2.0f;
68
gcy =
view
->
bdyBottom
/
z
+ (
view
->
bdyTop
/
z
-
view
->
bdyBottom
/
z
) / 2.0f;
69
scy =
view
->
clipY1
+ (
view
->
clipY2
-
view
->
clipY1
) / 2.0f;
70
71
if
(
view
->
active_camera
!=
SIZE_MAX
) {
72
view
->
cameras
[
view
->
active_camera
]->
targetx
+= (gcx - scx);
73
view
->
cameras
[
view
->
active_camera
]->
targety
+= (gcx - scy);
74
}
else
{
75
view
->
panx
+= gcx - scx;
76
view
->
pany
+= gcy - scy;
77
}
78
view
->
Topview
->
fitin_zoom
=
view
->
zoom
;
79
80
glexpose
();
81
}
82
83
void
on_btnActivateGraph_clicked
(GtkWidget *widget,
void
*user_data) {
84
(void)widget;
85
(void)user_data;
86
87
int
graphId;
88
graphId = gtk_combo_box_get_active(
view
->
graphComboBox
);
89
/* fprintf (stderr, "switch to graph %d\n",graphId); */
90
switch_graph
(graphId);
91
}
glmotion_zoom_inc
void glmotion_zoom_inc(int zoomin)
Definition
glmotion.c:44
glmotion.h
gltemplate.h
glutils.h
SIZE_MAX
#define SIZE_MAX
Definition
gmlscan.c:347
NULL
node NULL
Definition
grammar.y:163
z
static int z
Definition
gvrender_core_pov.c:316
view
ViewInfo * view
Definition
viewport.c:37
glexpose
void glexpose(void)
Definition
viewport.c:540
_ViewInfo::bdxLeft
float bdxLeft
Definition
smyrnadefs.h:290
_ViewInfo::Topview
topview * Topview
Definition
smyrnadefs.h:313
_ViewInfo::pany
float pany
Definition
smyrnadefs.h:256
_ViewInfo::clipX2
float clipX2
Definition
smyrnadefs.h:261
_ViewInfo::bdyTop
float bdyTop
Definition
smyrnadefs.h:290
_ViewInfo::graphComboBox
GtkComboBox * graphComboBox
Definition
smyrnadefs.h:342
_ViewInfo::panx
float panx
Definition
smyrnadefs.h:255
_ViewInfo::cameras
viewport_camera ** cameras
Definition
smyrnadefs.h:305
_ViewInfo::bdxRight
float bdxRight
Definition
smyrnadefs.h:291
_ViewInfo::bdyBottom
float bdyBottom
Definition
smyrnadefs.h:291
_ViewInfo::zoom
float zoom
Definition
smyrnadefs.h:258
_ViewInfo::clipY1
float clipY1
Definition
smyrnadefs.h:261
_ViewInfo::clipX1
float clipX1
Definition
smyrnadefs.h:261
_ViewInfo::clipY2
float clipY2
Definition
smyrnadefs.h:261
_ViewInfo::active_camera
size_t active_camera
<number of cameras
Definition
smyrnadefs.h:307
_viewport_camera::targetx
float targetx
Definition
smyrnadefs.h:137
_viewport_camera::targety
float targety
Definition
smyrnadefs.h:138
_viewport_camera::r
float r
Definition
smyrnadefs.h:141
topview::fitin_zoom
float fitin_zoom
Definition
smyrnadefs.h:236
btnToolZoomOut_clicked
void btnToolZoomOut_clicked(GtkWidget *widget, void *user_data)
Definition
toolboxcallbacks.c:19
btnToolFit_clicked
void btnToolFit_clicked(GtkWidget *widget, void *user_data)
Definition
toolboxcallbacks.c:56
btnToolZoomFit_clicked
void btnToolZoomFit_clicked(GtkWidget *widget, void *user_data)
Definition
toolboxcallbacks.c:26
on_btnActivateGraph_clicked
void on_btnActivateGraph_clicked(GtkWidget *widget, void *user_data)
Definition
toolboxcallbacks.c:83
toolboxcallbacks.h
switch_graph
void switch_graph(int graphId)
Definition
viewport.c:449
viewport.h
cmd
smyrna
gui
toolboxcallbacks.c
Generated by
1.9.8