summaryrefslogtreecommitdiff
path: root/graphics/plplot/patches/patch-ag
blob: d9df44e498538bc81e3aad8a1c62f014f88850c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
$NetBSD: patch-ag,v 1.5 2004/01/20 10:18:25 agc Exp $

--- drivers/ntk.c	2004/01/20 09:40:12	1.1
+++ drivers/ntk.c	2004/01/20 09:43:23
@@ -105,18 +105,18 @@
   tk_cmd(cmd);
 
   /* add new canvas to option menu */
-  sprintf(cmd, "$plf.f1.mb.menu add command -label \"Page $ccanv\" -command {
-set w $plf.f2.c%d;
-$hs configure -command \"$w xview\";
-$vs configure -command \"$w yview\";
-set dname \"Page %d\";
-pack forget $ocanvas;
-set ocanvas $plf.f2.c%d;
-pack $ocanvas -fill both -expand 1;
-scan [$w xview] \"%%f %%f\" i j;
-$hs set $i $j;
-scan [$w yview] \"%%f %%f\" i j;
-$vs set $i $j;}",
+  sprintf(cmd, "$plf.f1.mb.menu add command -label \"Page $ccanv\" -command {\n"
+"set w $plf.f2.c%d;\n"
+"$hs configure -command \"$w xview\";\n"
+"$vs configure -command \"$w yview\";\n"
+"set dname \"Page %d\";\n"
+"pack forget $ocanvas;\n"
+"set ocanvas $plf.f2.c%d;\n"
+"pack $ocanvas -fill both -expand 1;\n"
+"scan [$w xview] \"%%f %%f\" i j;\n"
+"$hs set $i $j;\n"
+"scan [$w yview] \"%%f %%f\" i j;\n"
+"$vs set $i $j;}",
 	  ccanv, ccanv, ccanv);
   tk_cmd(cmd);
   
@@ -126,47 +126,47 @@
   /* Shif-B1, zooms in */
   /* FIXME inform the core lib of the zoom, see plframe.c around line 2818 */
 
-  sprintf(cmd, "bind $plf.f2.c$ccanv <Shift-Button-1> {
-set cc %d;
-incr item($cc); set tt $item($cc);
-if {$tt == 1} {
-incr scroll_use;
-pack $hs -side bottom -fill x;
-pack $vs -side right -fill y;
-pack forget %%W; pack %%W -fill both -expand 1}
-set zx($cc,$tt) %%x;
-set zy($cc,$tt) %%y;
-%%W scale all %%x %%y 1.6 1.6;
-%%W configure -scrollregion [%%W bbox all];
-}", ccanv);
+  sprintf(cmd, "bind $plf.f2.c$ccanv <Shift-Button-1> {\n"
+"set cc %d;\n"
+"incr item($cc); set tt $item($cc);\n"
+"if {$tt == 1} {\n"
+"incr scroll_use;\n"
+"pack $hs -side bottom -fill x;\n"
+"pack $vs -side right -fill y;\n"
+"pack forget %%W; pack %%W -fill both -expand 1}\n"
+"set zx($cc,$tt) %%x;\n"
+"set zy($cc,$tt) %%y;\n"
+"%%W scale all %%x %%y 1.6 1.6;\n"
+"%%W configure -scrollregion [%%W bbox all];\n"
+"}", ccanv);
 
   tk_cmd(cmd);
   
   /* Shif-B3, zooms out */
-  sprintf(cmd,"bind $plf.f2.c$ccanv <Shift-Button-3> {
-set cc %d; set tt $item($cc);
-if {$tt != 0} {
-%%W scale all $zx($cc,$tt) $zy($cc,$tt) 0.625 0.625
-%%W configure -scrollregion [%%W bbox all];
-set item($cc) [expr $tt - 1]}
-if { $item($cc) == 0} {
-set scroll_use [expr $scroll_use - 1];
-if {$scroll_use == 0} {
-pack forget $plf.f2.hscroll $plf.f2.vscroll}
-%%W configure -scrollregion \"0 0 $xmax $ymax\"}}", ccanv);
+  sprintf(cmd,"bind $plf.f2.c$ccanv <Shift-Button-3> {\n"
+"set cc %d; set tt $item($cc);\n"
+"if {$tt != 0} {\n"
+"%%W scale all $zx($cc,$tt) $zy($cc,$tt) 0.625 0.625\n"
+"%%W configure -scrollregion [%%W bbox all];\n"
+"set item($cc) [expr $tt - 1]}\n"
+"if { $item($cc) == 0} {\n"
+"set scroll_use [expr $scroll_use - 1];\n"
+"if {$scroll_use == 0} {\n"
+"pack forget $plf.f2.hscroll $plf.f2.vscroll}\n"
+"%%W configure -scrollregion \"0 0 $xmax $ymax\"}}", ccanv);
   tk_cmd(cmd);
 
   /* Shift-B2, resets */
-  sprintf(cmd,"bind $plf.f2.c$ccanv <Shift-Button-2> {
-set cc %d; set tt $item($cc); 
-while {$tt != 0} {
-%%W scale all $zx($cc,$tt) $zy($cc,$tt) 0.625 0.625
-set tt [expr $tt - 1]};
-set item($cc) 0;
-%%W configure -scrollregion \"0 0 $xmax $ymax\";
-set scroll_use [expr $scroll_use - 1];
-if {$scroll_use == 0} {
-pack forget $plf.f2.hscroll $plf.f2.vscroll}}", ccanv);
+  sprintf(cmd,"bind $plf.f2.c$ccanv <Shift-Button-2> {\n"
+"set cc %d; set tt $item($cc); \n"
+"while {$tt != 0} {\n"
+"%%W scale all $zx($cc,$tt) $zy($cc,$tt) 0.625 0.625\n"
+"set tt [expr $tt - 1]};\n"
+"set item($cc) 0;\n"
+"%%W configure -scrollregion \"0 0 $xmax $ymax\";\n"
+"set scroll_use [expr $scroll_use - 1];\n"
+"if {$scroll_use == 0} {\n"
+"pack forget $plf.f2.hscroll $plf.f2.vscroll}}", ccanv);
   tk_cmd(cmd);
 
   /* Control-B1-Motion, pan */
@@ -177,12 +177,12 @@
   tk_cmd(cmd);
 
   /* Control-B2, identify and (in the far future) edit object */
-  tk_cmd("bind $plf.f2.c$ccanv <Control-Button-2> {
-set xx [ expr [winfo pointerx .] - [winfo rootx %W]];
-set yy [ expr [winfo pointery .] - [winfo rooty %W]];
-set near [%W find closest $xx $yy];
-%W move $near 20 20;
-after 500 \"%W move $near -20 -20\"}");
+  tk_cmd("bind $plf.f2.c$ccanv <Control-Button-2> {\n"
+"set xx [ expr [winfo pointerx .] - [winfo rootx %W]];\n"
+"set yy [ expr [winfo pointery .] - [winfo rooty %W]];\n"
+"set near [%W find closest $xx $yy];\n"
+"%W move $near 20 20;\n"
+"after 500 \"%W move $near -20 -20\"}");
 
   /* change view to the new canvas by invoking the menu buttom */
   sprintf(cmd, "$plf.f1.mb.menu invoke %d", ccanv-1);
@@ -247,27 +247,27 @@
       
     tk_cmd("catch \"frame $plf\"; pack $plf -fill both -expand 1");
 
-    sprintf(cmd, "frame $plf.f1;
-frame $plf.f2 -width %d -height %d;
-pack $plf.f1 -fill x;
-pack $plf.f2 -fill both -expand 1", xmax, ymax);
+    sprintf(cmd, "frame $plf.f1;\n"
+"frame $plf.f2 -width %d -height %d;\n"
+"pack $plf.f1 -fill x;\n"
+"pack $plf.f2 -fill both -expand 1", xmax, ymax);
     tk_cmd(cmd);
 
-    tk_cmd("scrollbar $plf.f2.hscroll -orient horiz;
-scrollbar $plf.f2.vscroll");
+    tk_cmd("scrollbar $plf.f2.hscroll -orient horiz;\n"
+"scrollbar $plf.f2.vscroll");
 
-    tk_cmd("menubutton $plf.f1.mb -text \"Page 1\" -textvariable dname -relief raised -indicatoron 1 -menu $plf.f1.mb.menu;
-menu $plf.f1.mb.menu -tearoff 0;
-pack $plf.f1.mb -side left");
+    tk_cmd("menubutton $plf.f1.mb -text \"Page 1\" -textvariable dname -relief raised -indicatoron 1 -menu $plf.f1.mb.menu;\n"
+"menu $plf.f1.mb.menu -tearoff 0;\n"
+"pack $plf.f1.mb -side left");
 
     if (local)
-      tk_cmd("button $plf.f1.quit -text Quit -command exit;
-pack $plf.f1.quit -side right");
+      tk_cmd("button $plf.f1.quit -text Quit -command exit;\n"
+"pack $plf.f1.quit -side right");
     else
-      tk_cmd("button $plf.f1.quit -text Quit -command {send -async $client exit;
-destroy $plf;
-wm withdraw .};
-pack $plf.f1.quit -side right");
+      tk_cmd("button $plf.f1.quit -text Quit -command {send -async $client exit;\n"
+"destroy $plf;\n"
+"wm withdraw .};\n"
+"pack $plf.f1.quit -side right");
 
     /* FIXME: I just discovered that Tcl_Eval is slower than Tcl_EvalObj. Fix it global-wide, `man Tcl_Eval' */
 
@@ -403,11 +403,11 @@
     tk_cmd("set ocursor [lindex [$plf.f2.c$ccanv configure -cursor] 4]");
   }
 
-  tk_cmd("$plf.f2.c$ccanv configure -cursor cross;
-bind $plf.f2.c$ccanv <Button> {set xloc %x; set yloc %y; set bloc %b; set sloc %s};
-bind $plf.f2.c$ccanv <B1-Motion> {set xloc %x; set yloc %y; set bloc %b; set sloc %s};
-bind $plf.f2.c$ccanv <B2-Motion> {set xloc %x; set yloc %y; set bloc %b; set sloc %s};
-bind $plf.f2.c$ccanv <B3-Motion> {set xloc %x; set yloc %y; set bloc %b; set sloc %s};");
+  tk_cmd("$plf.f2.c$ccanv configure -cursor cross;\n"
+"bind $plf.f2.c$ccanv <Button> {set xloc %x; set yloc %y; set bloc %b; set sloc %s};\n"
+"bind $plf.f2.c$ccanv <B1-Motion> {set xloc %x; set yloc %y; set bloc %b; set sloc %s};\n"
+"bind $plf.f2.c$ccanv <B2-Motion> {set xloc %x; set yloc %y; set bloc %b; set sloc %s};\n"
+"bind $plf.f2.c$ccanv <B3-Motion> {set xloc %x; set yloc %y; set bloc %b; set sloc %s};");
 
   while (st != 1) {
     tk_cmd("update");
@@ -426,11 +426,11 @@
   gin.dX = (PLFLT) gin.pX/xmax;
   gin.dY = 1. - (PLFLT) gin.pY/ymax;
 
-  tk_cmd("bind $plf.f2.c$ccanv <ButtonPress> {};
-bind $plf.f2.c$ccanv <ButtonMotion> {};
-bind $plf.f2.c$ccanv <B2-Motion> {};
-bind $plf.f2.c$ccanv <B3-Motion> {};
-unset xloc");
+  tk_cmd("bind $plf.f2.c$ccanv <ButtonPress> {};\n"
+"bind $plf.f2.c$ccanv <ButtonMotion> {};\n"
+"bind $plf.f2.c$ccanv <B2-Motion> {};\n"
+"bind $plf.f2.c$ccanv <B3-Motion> {};\n"
+"unset xloc");
 
   /* seg fault, see above. tk_cmd("$plf.f2.c$ccanv configure -cursor $ocursor"); */
   tk_cmd("$plf.f2.c$ccanv configure -cursor {}");