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
|
/*
* tkUnixDialog.c --
*
* Contains the Unix implementation of the common dialog boxes:
*
* Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkUnixInt.h"
/*
* The wrapper code for Unix is actually set up in library/tk.tcl these days;
* the procedure names used here are probably wrong too...
*/
#ifdef TK_OBSOLETE_UNIX_DIALOG_WRAPPERS
/*
*----------------------------------------------------------------------
*
* EvalObjv --
*
* Invokes the Tcl procedure with the arguments.
*
* Results:
* Returns the result of the evaluation of the command.
*
* Side effects:
* The command may be autoloaded.
*
*----------------------------------------------------------------------
*/
static int
EvalObjv(
Tcl_Interp *interp, /* Current interpreter. */
char *cmdName, /* Name of the TCL command to call */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Arguments. */
{
Tcl_Obj *cmdObj, **objs;
int result;
cmdObj = Tcl_NewStringObj(cmdName, -1);
Tcl_IncrRefCount(cmdObj);
objs = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc+1));
objs[0] = cmdObj;
memcpy(objs+1, objv, sizeof(Tcl_Obj *) * (unsigned)objc);
result = Tcl_EvalObjv(interp, objc+1, objs, 0);
Tcl_DecrRefCount(cmdObj);
ckfree(objs);
return result;
}
/*
*----------------------------------------------------------------------
*
* Tk_ChooseColorObjCmd --
*
* This procedure implements the color dialog box for the Unix platform.
* See the user documentation for details on what it does.
*
* Results:
* See user documentation.
*
* Side effects:
* A dialog window is created the first time this procedure is called.
* This window is not destroyed and will be reused the next time the
* application invokes the "tk_chooseColor" command.
*
*----------------------------------------------------------------------
*/
int
Tk_ChooseColorObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Arguments. */
{
return EvalObjv(interp, "tk::ColorDialog", objc-1, objv+1);
}
/*
*----------------------------------------------------------------------
*
* Tk_GetOpenFileCmd --
*
* This procedure implements the "open file" dialog box for the Unix
* platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
*
* Side effects:
* A dialog window is created the first this procedure is called. This
* window is not destroyed and will be reused the next time the
* application invokes the "tk_getOpenFile" or "tk_getSaveFile" command.
*
*----------------------------------------------------------------------
*/
int
Tk_GetOpenFileObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Arguments. */
{
Tk_Window tkwin = clientData;
if (Tk_StrictMotif(tkwin)) {
return EvalObjv(interp, "tk::MotifOpenFDialog", objc-1, objv+1);
} else {
return EvalObjv(interp, "tk::OpenFDialog", objc-1, objv+1);
}
}
/*
*----------------------------------------------------------------------
*
* Tk_GetSaveFileCmd --
*
* Same as Tk_GetOpenFileCmd but opens a "save file" dialog box instead.
*
* Results:
* Same as Tk_GetOpenFileCmd.
*
* Side effects:
* Same as Tk_GetOpenFileCmd.
*
*----------------------------------------------------------------------
*/
int
Tk_GetSaveFileObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Arguments. */
{
Tk_Window tkwin = clientData;
if (Tk_StrictMotif(tkwin)) {
return EvalObjv(interp, "tk::MotifSaveFDialog", objc-1, objv+1);
} else {
return EvalObjv(interp, "tk::SaveFDialog", objc-1, objv+1);
}
}
/*
*----------------------------------------------------------------------
*
* Tk_MessageBoxCmd --
*
* This procedure implements the MessageBox window for the Unix
* platform. See the user documentation for details on what it does.
*
* Results:
* See user documentation.
*
* Side effects:
* None. The MessageBox window will be destroy before this procedure
* returns.
*
*----------------------------------------------------------------------
*/
int
Tk_MessageBoxCmd(
ClientData clientData, /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Arguments. */
{
return EvalObjv(interp, "tk::MessageBox", objc-1, objv+1);
}
#endif /* TK_OBSOLETE_UNIX_DIALOG_WRAPPERS */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
|