1 /* $TOG: cmncbs.c /main/8 1999/09/17 15:44:29 mgreess $ */
2 /*****************************************************************************/
8 /*****************************************************************************/
10 #include <sys/signal.h>
11 #include <X11/cursorfont.h>
15 #include <Dt/HelpDialog.h>
21 #include "CreateActionAppShell.h"
23 #include "icon_selection_dialog.h"
26 /******************************************************************************/
27 /* Initialize global values. */
28 /******************************************************************************/
29 Boolean bRegisteredSignal = FALSE;
30 int (*sigchildRoutine)();
32 /******************************************************************************/
33 /* activateCB_open_FindSet - Callback for the "Find Set" button on */
34 /* CreateActionAppShell and AddFiletype windows. */
35 /* This callback will pop up the Icon Selection */
38 /* INPUT: Widget filesel - file selection box widget id */
39 /* XtPointer cdata - client data */
40 /* XmFileSelectionBoxCallbackStruct *cbstruct - callback data */
44 /******************************************************************************/
45 void activateCB_open_FindSet (Widget find_set_button, XtPointer cdata,
46 XmFileSelectionBoxCallbackStruct *cbstruct)
49 Boolean use_bm = False;
50 static char *use_bm_filter = "*.m.bm";
51 static char *use_pm_filter = "*.m.pm";
53 char *filter_field_title = NULL;
54 int use_filter_field = False;
57 char **directories_list = GetIconSearchPathList();
58 int numberOfTopButtons = 0;
59 void *top_button_one_cb = NULL;
60 void *top_button_two_cb = NULL;
61 void *top_button_three_cb = NULL;
62 char *top_button_one_label = NULL;
63 char *top_button_two_label = NULL;
64 char *top_button_three_label = NULL;
65 int use_icon_name_field = True;
66 int numberOfBottomButtons = 3;
67 void *bottom_button_one_cb = (void *)load_icons;
68 void *bottom_button_two_cb = NULL;
69 void *bottom_button_three_cb = NULL;
70 void *bottom_button_four_cb = NULL;
71 char *bottom_button_one_label = NULL; /* use default */
72 char *bottom_button_two_label = NULL; /* use default */
73 char *bottom_button_three_label = NULL; /* use default */
74 char *bottom_button_four_label = NULL; /* use default */
76 char *name_field_title;
77 char *container_title;
78 char *directory_title;
79 char *dialog_title, *pre, *suf;
81 name_field_title = XtNewString(GETMESSAGE(11, 12, "Enter Icon Filename"));
82 container_title = XtNewString(GETMESSAGE(11, 11, "Icon Files"));
83 directory_title = XtNewString(GETMESSAGE(11, 30, "Icon Folders"));
85 pre = GETMESSAGE(3, 10, "Create Action");
86 suf = GETMESSAGE(6, 18, "Find Set");
87 dialog_title = XtMalloc(strlen(pre) + strlen(suf) + 2);
88 sprintf(dialog_title, "%s - %s", pre, suf);
91 printf("activate Find Set button; client_data = %p\n", cdata); /* debug */
94 XtVaGetValues (COLOR_MONO_OPTION, XmNset, &use_bm, NULL);
96 if (use_bm) file_filter = use_bm_filter;
97 else file_filter = use_pm_filter;
99 #ifndef _ICONSELECTOR_DESTROY_ENABLED
101 #endif /* _ICONSELECTOR_DESTROY_ENABLED */
102 IconSelector = create_icon_selection_dialog ((swidget) CreateActionAppShell,
103 (unsigned char *)dialog_title,
104 (unsigned char *)filter_field_title,
106 (unsigned char *)file_filter,
107 (unsigned char *)directory_title,
108 (unsigned char **)directories_list,
109 (unsigned char *)container_title,
111 (unsigned char *)top_button_one_label,
112 (void (*)())top_button_one_cb,
113 (unsigned char *)top_button_two_label,
114 (void (*)())top_button_two_cb,
115 (unsigned char *)top_button_three_label,
116 (void (*)())top_button_three_cb,
118 (unsigned char *)name_field_title,
119 numberOfBottomButtons,
120 (unsigned char *)bottom_button_one_label,
121 (void (*)())bottom_button_one_cb,
122 (unsigned char *)bottom_button_two_label,
123 (void (*)())bottom_button_two_cb,
124 (unsigned char *)bottom_button_three_label,
125 (void (*)())bottom_button_three_cb,
126 (unsigned char *)bottom_button_four_label,
127 (void (*)())bottom_button_four_cb);
128 #ifndef _ICONSELECTOR_DESTROY_ENABLED
130 #endif /* _ICONSELECTOR_DESTROY_ENABLED */
131 XtFree(name_field_title);
132 XtFree(container_title);
133 XtFree(directory_title);
134 XtFree(dialog_title);
135 FreeIconSearchPathList(directories_list);
136 XtVaSetValues (IconSelector, XmNuserData, cdata, NULL);
137 UxPopupInterface (IconSelector, no_grab);
138 XmProcessTraversal(ISD_SelectedIconTextField, XmTRAVERSE_CURRENT);
142 /******************************************************************************/
144 /* createCB_IconGadget */
146 /* INPUT: Widget wid - icon gadget windet id */
147 /* Boolean bActionIcons - is this an action widget */
148 /* enum icon_size_range - size of icon this widget represents */
152 /******************************************************************************/
153 void createCB_IconGadget(Widget wid,
154 Boolean bActionIcons,
155 enum icon_size_range IconSize)
159 (char *)((bActionIcons) ?
160 ca_full_icon_default : af_full_icon_default),
165 /******************************************************************************/
166 /* activateCB_edit_icon - brings up icon editor with selected icon */
168 /* INPUT: Widget wid - widget id */
169 /* XtPointer cd - client data */
170 /* XmPushButtonCallbackStruct *cbs - callback data */
173 /******************************************************************************/
174 void activateCB_edit_icon (Widget wid, XtPointer client_data,
175 XmPushButtonCallbackStruct *cbs)
178 Boolean IsActionIcons;
180 if (bIconEditorDisplayed) return;
182 if ((int)client_data == CA_ACTION_ICONS) {
183 IsActionIcons = True;
184 widSelectedIcon = get_selected_action_icon();
185 widEditSource = CreateActionAppShell;
187 IsActionIcons = False;
188 widSelectedIcon = (Widget)get_selected_filetype_icon();
189 widEditSource = AddFiletype;
191 XtVaGetValues (widSelectedIcon, XmNimageName, &pszIconToEdit, NULL);
193 /***************************************************************/
194 /* Call routine to send tooltalk message to start icon editor. */
195 /***************************************************************/
196 UxDoEditPixmap(widSelectedIcon, pszIconToEdit);
201 /******************************************************************************/
203 /* closeCB_mainHelpDialog */
205 /* INPUT: Widget wid - widget id */
206 /* XtPointer cd - client data */
207 /* XtPointer cbs - callback data */
210 /******************************************************************************/
211 void closeCB_mainHelpDialog(Widget wid, XtPointer client_data,
214 XtDestroyWidget(wid);
217 /******************************************************************************/
219 /* DisplayHelpDialog */
221 /* INPUT: Widget wid - widget id */
222 /* XtPointer cd - client data */
223 /* XtPointer cbs - callback data */
226 /******************************************************************************/
227 void DisplayHelpDialog(Widget wid, XtPointer client_data, XtPointer cbs)
229 static Widget mainHelpDialog = NULL;
233 char pszTitle[MAXBUFSIZE];
234 char pszTopic[MAXBUFSIZE];
238 /***********************************************************************/
239 /* Get help dialog window title. */
240 /***********************************************************************/
242 sprintf(pszTitle, "%s - %s", GETMESSAGE(3, 10, "Create Action"),
243 GETMESSAGE(2, 53, "Help"));
245 sprintf(pszTitle, "%s - ", GETMESSAGE(3, 10, "Create Action"));
246 strcat(pszTitle, GETMESSAGE(2, 53, "Help"));
247 XtSetArg(args[i], XmNtitle, pszTitle); i++;
249 /***********************************************************************/
250 /* Now set the particular helpvolume and topic to view */
251 /***********************************************************************/
252 XtSetArg(args[i], DtNhelpType, DtHELP_TYPE_TOPIC); i++;
253 XtSetArg(args[i], DtNhelpVolume, "CreatAct"); i++;
254 XtSetArg(args[i], DtNlocationId, pszTopic); i++;
256 switch ((int)client_data) {
258 strcpy(pszTopic, "_hometopic");
261 strcpy(pszTopic, "Tasks");
264 strcpy(pszTopic, "Reference");
267 strcpy(pszTopic, "_HOMETOPIC");
268 XtSetArg(args[i], DtNhelpVolume, "Help4Help"); i++;
271 strcpy(pszTopic, "_copyright");
274 strcpy(pszTopic, "CreateActionMainWindow");
276 case HELP_ADDFILETYPE:
277 strcpy(pszTopic, "AddDatatypeWindow");
280 strcpy(pszTopic, "DatatypeCriteriaWindow");
282 case HELP_ICONSELECTOR:
283 strcpy(pszTopic, "FindIconSetDialog");
286 strcpy(pszTopic, "openDialog");
290 /***********************************************************************/
291 /* Create the Help dialog. */
292 /***********************************************************************/
293 /* **** old method of getting parent ****
294 XtVaGetValues(wid, XmNuserData, &parent, NULL);
299 parent = GetTrueToplevel(wid);
300 TurnOnHourGlassAllWindows();
301 if ( mainHelpDialog == NULL ) {
302 mainHelpDialog = DtCreateHelpDialog(parent, "mainHelpDialog", args, i);
303 XtAddCallback(mainHelpDialog, DtNcloseCallback,
304 (void (*)())closeCB_mainHelpDialog,
306 XtManageChild(mainHelpDialog);
308 XtSetValues( mainHelpDialog, args, i );
310 TurnOffHourGlassAllWindows();
312 /******************************************************************************/
316 /* INPUT: Widget wid - widget id */
317 /* XtPointer cd - client data */
318 /* XtPointer cbs - callback data */
321 /******************************************************************************/
322 void helpCB_general(Widget UxWidget,
323 XtPointer UxClientData,
324 XtPointer UxCallbackArg)
327 DisplayHelpDialog(UxWidget, UxClientData, UxCallbackArg);