Use C++ linker
[oweals/cde.git] / cde / programs / dtwm / DataBaseLoad.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: DataBaseLoad.h /main/7 1996/10/30 11:14:37 drk $ */
24 /*****************************************************************************
25  *
26  *   File:         DataBaseLoad.h
27  *
28  *   Project:       DT
29  *
30  *   Description:  This file contains the external defines and function
31  *                 declarations for DataBaseLoad.c
32  *
33  * (c) Copyright 1993, 1994 Hewlett-Packard Company
34  * (c) Copyright 1993, 1994 International Business Machines Corp.
35  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
36  * (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of Novell, Inc.
37  *
38  ****************************************************************************/
39
40
41 #include <Xm/ColorObjP.h>
42 #include <Dt/Message.h>
43 #include <Dt/ActionP.h>
44
45 #ifndef _databaseload_h
46 #define _databaseload_h
47
48
49 /************************************************************************
50  *
51  *  Suffix definition for the front panel file type.
52  *
53  ************************************************************************/
54  
55 #define FILE_TYPE_SUFFIX  ".fp"
56
57
58
59 /************************************************************************
60  *
61  *  Defines for the total number of entry types and an array which
62  *  holds the string defining the entrys.
63  *
64  ************************************************************************/  
65  
66 #define TOTAL_ENTRY_COUNT       5
67
68 #define PANEL           0
69 #define BOX             1
70 #define SUBPANEL        2
71 #define SWITCH          3
72 #define CONTROL         4
73
74 extern char * entry_types[];
75 extern char * control_types[];
76 extern char * resolution_types[];
77 extern char * monitor_types[];
78
79 #define HIGH            0
80 #define MEDIUM          1
81 #define LOW             2
82 #define MATCH_DISPLAY   3
83
84 #define DOUBLE_CLICK    0
85 #define SINGLE_CLICK    1
86
87 #define CONTROL_BLANK           0
88 #define CONTROL_BUSY            1
89 #define CONTROL_ICON            2
90 #define CONTROL_CLIENT          3
91 #define CONTROL_CLOCK           4
92 #define CONTROL_DATE            5
93 #define CONTROL_FILE            6
94
95 #define POSITION_FIRST  0
96 #define POSITION_LAST   100
97
98 #define MONITOR_NONE    0
99 #define MONITOR_MAIL    1
100 #define MONITOR_FILE    2
101
102 #define FP_HELP_VOLUME "FPanel"
103 #define PANEL_HANDLE "FPOnItemPanelHandle"
104 #define PANEL_MENU "FPOnItemPanelMenu"
105 #define PANEL_ICONIFY "FPOnItemPanelIconify"
106 #define SUBPANEL_ACCESS_AREA "FPOnItemAccessArea"
107 #define MONITOR_INDICATOR "FPOnItemMonitorIndicator"
108 #define SWITCH_BUTTON "FPOnItemSwitchButton"
109 #define INSTALL_ZONE "FPOnItemInstallZone"
110
111
112 /************************************************************************
113  *
114  *  Main structure definitions for the data of each type of front panel
115  *  record.
116  *
117  ************************************************************************/
118
119 typedef struct
120 {
121    char *  record_keyword;
122    char ** field_keywords;
123    int     num_field_keywords;
124 } ComponentType;
125
126 typedef struct
127 {
128    Boolean   use_default;
129    char    * string_value;
130    void    * parsed_value;
131 } ElementValue;
132
133 typedef struct
134 {
135    ElementValue * element_values;
136 } RecordData;
137
138 typedef struct
139 {
140     int          flags;
141     int          x;
142     int          y;
143     int          width;
144     int          height;
145 } GeometryData;
146
147
148 typedef struct
149 {
150     char *        action_name;
151     char *        action_label;
152     DtActionArg * aap;
153     int           count;
154 } PanelActionData;
155
156
157
158 typedef struct
159 {
160    char  * file_name;
161    char  * component_name;
162    int     component_type;
163    char  * parent_name;
164    int     parent_type;   
165    Boolean delete;
166 } DynamicComponent;
167
168
169
170 /************************************************************************
171  *
172  *  Main structure definitions for each type of Front Panel record.
173  *  Each start with the set of element values.  This is required inorder
174  *  to cast to a generic structure which can then be used to process the
175  *  lists of data.
176  *
177  ************************************************************************/
178
179 typedef struct _PanelData     PanelData;
180 typedef struct _BoxData       BoxData;
181 typedef struct _SubpanelData  SubpanelData;
182 typedef struct _SwitchData    SwitchData;
183 typedef struct _ControlData   ControlData;
184 typedef struct _PopupData     PopupData;
185 typedef struct _AnimationData AnimationData;
186 typedef struct _AnimationItem AnimationItem;
187
188  
189 /*  Panel record defines and structure declarations  */
190
191 #define PANEL_KEYWORD_COUNT     13
192
193 #define PANEL_NAME                       0
194 #define PANEL_GEOMETRY                   1
195 #define PANEL_DISPLAY_HANDLES            2
196 #define PANEL_DISPLAY_MENU               3
197 #define PANEL_DISPLAY_MINIMIZE           4
198 #define PANEL_RESOLUTION                 5
199 #define PANEL_CONTROL_BEHAVIOR           6
200 #define PANEL_DISPLAY_CONTROL_LABELS     7
201 #define PANEL_SUBPANEL_UNPOST            8
202 #define PANEL_LOCKED                     9
203 #define PANEL_HELP_STRING               10
204 #define PANEL_HELP_VOLUME               11
205 #define PANEL_HELP_TOPIC                12
206
207 struct _PanelData
208 {
209    ElementValue * element_values;
210
211    BoxData ** box_data;
212    int        box_data_count;
213
214    Widget shell;
215    Widget form;
216    Widget left_handle;
217    Widget right_handle;
218    Widget menu;
219    Widget iconify;
220
221    int resolution;
222    unsigned int main_icon_size;
223    unsigned int sub_icon_size;
224    unsigned int switch_icon_size;
225    XmFontList font_list;
226    XmFontList date_font_list;
227    int color_use;
228
229    XmPixelSet * pixel_set;
230    XmPixelSet * active_pixel_set;
231    XmPixelSet * inactive_pixel_set;
232    XmPixelSet * primary_pixel_set;
233    XmPixelSet * secondary_pixel_set;
234    int          pixel_set_count;
235
236    Cursor busy_cursor;
237    ControlData * busy_light_data;
238    XtPointer global_data;
239    XtPointer screen_data;
240    PopupData * popup_data;
241
242    XtPointer push_recall_list;
243    int       push_recall_count;
244    int       max_push_recall_count;
245
246    XtPointer embedded_client_list;
247    int       embedded_client_count;
248    int       max_embedded_client_count;
249
250    AnimationData * animation_data;
251    int animation_count;
252
253    DynamicComponent ** dynamic_data_list;
254    int dynamic_data_count;
255    int max_dynamic_data_count;
256
257    Boolean use_color_icons;
258
259    int switch_row_count;
260    char * app_name;
261 };
262
263
264
265 /************************************************************************
266  *
267  *  panel -- This global contains the top of the frontpanel data, widgets,
268  *           and any other data defining the layout/content/processing.
269  *
270  ************************************************************************/
271
272 extern PanelData panel;
273
274 #define O_Shell(o)      (panel.shell)
275
276
277 /*  Box record defines and structure declarations  */
278
279 #define BOX_KEYWORD_COUNT       8
280
281 #define BOX_NAME                0
282 #define BOX_CONTAINER_NAME      1
283 #define BOX_POSITION_HINTS      2
284 #define BOX_LOCKED              3
285 #define BOX_DELETE              4
286 #define BOX_HELP_STRING         4
287 #define BOX_HELP_VOLUME         6
288 #define BOX_HELP_TOPIC          7
289
290 struct _BoxData
291 {
292    ElementValue * element_values;
293
294    ControlData ** control_data;
295    int            control_data_count;
296
297    Widget form;
298    Widget left_arrow_form;
299    Widget left_control_form;
300    Widget right_arrow_form;
301    Widget right_control_form;
302
303    SwitchData * switch_data;
304    Widget switch_form;
305    Widget switch_edit;
306
307    int subpanel_count;
308 };
309
310
311
312 /*  Subpanel record defines and structure declarations  */
313
314 #define SUBPANEL_KEYWORD_COUNT  9
315
316 #define SUBPANEL_NAME                   0
317 #define SUBPANEL_CONTAINER_NAME         1
318 #define SUBPANEL_CONTROL_INSTALL        2
319 #define SUBPANEL_TITLE                  3
320 #define SUBPANEL_LOCKED                 4
321 #define SUBPANEL_DELETE                 5
322 #define SUBPANEL_HELP_STRING            6
323 #define SUBPANEL_HELP_VOLUME            7
324 #define SUBPANEL_HELP_TOPIC             8
325
326 struct _SubpanelData
327 {
328    ElementValue * element_values;
329
330    ControlData ** control_data;
331    int            control_data_count;
332
333    ControlData * parent_control_data;
334    ControlData * default_control;
335
336    Widget shell;
337    Widget form;
338    Widget dropzone;
339    Widget separator;
340
341    Widget main_panel_icon_copy;
342
343    Boolean  torn;
344    Position posted_x;
345 };
346
347
348 /*  Switch record defines and structure declarations  */
349
350 #define SWITCH_KEYWORD_COUNT    9
351
352 #define SWITCH_NAME             0
353 #define SWITCH_CONTAINER_NAME   1
354 #define SWITCH_POSITION_HINTS   2
355 #define SWITCH_NUMBER_OF_ROWS   3
356 #define SWITCH_LOCKED           4
357 #define SWITCH_DELETE           5
358 #define SWITCH_HELP_STRING      6
359 #define SWITCH_HELP_VOLUME      7
360 #define SWITCH_HELP_TOPIC       8
361
362 struct _SwitchData
363 {
364    ElementValue * element_values;
365
366    ControlData ** control_data;
367    int            control_data_count;
368
369    BoxData * box_data;
370
371    Widget   rc;
372    Widget * buttons;
373
374    Atom  * atom_names;
375    char ** switch_names;
376    int     switch_count;
377    int     active_switch;
378
379    PopupData * popup_data;
380
381    Time    time_stamp;
382 };
383
384
385 /*  Control record defines and structure declarations  */
386
387 #define CONTROL_KEYWORD_COUNT   23
388
389 #define CONTROL_NAME             0
390 #define CONTROL_TYPE             1
391 #define CONTROL_CONTAINER_TYPE   2
392 #define CONTROL_CONTAINER_NAME   3
393 #define CONTROL_POSITION_HINTS   4
394 #define CONTROL_NORMAL_ICON      5
395 #define CONTROL_ALTERNATE_ICON   6
396 #define CONTROL_LABEL            7
397 #define CONTROL_PUSH_ACTION      8
398 #define CONTROL_PUSH_ANIMATION   9
399 #define CONTROL_DROP_ACTION     10
400 #define CONTROL_DROP_ANIMATION  11
401 #define CONTROL_PUSH_RECALL     12
402 #define CONTROL_MONITOR_TYPE    13
403 #define CONTROL_CLIENT_NAME     14
404 #define CONTROL_CLIENT_GEOMETRY 15
405 #define CONTROL_FILE_NAME       16
406 #define CONTROL_DATE_FORMAT     17
407 #define CONTROL_LOCKED          18
408 #define CONTROL_DELETE          19
409 #define CONTROL_HELP_STRING     20
410 #define CONTROL_HELP_VOLUME     21
411 #define CONTROL_HELP_TOPIC      22
412
413 struct _ControlData
414 {
415    ElementValue * element_values;
416
417    XtPointer      parent_data;
418    char           parent_type;
419    SubpanelData * subpanel_data;
420
421    Widget icon;
422    Widget arrow;
423    Widget arrow_separator;
424    Widget indicator;
425
426    PanelActionData ** actions;
427
428    Boolean is_action;
429
430    char * move_action;
431    char * copy_action;
432    char * link_action;
433
434    unsigned char operation;
435 };
436
437
438
439 /*  Popup structure declarations  */
440
441 struct _PopupData
442 {
443    Widget popup;
444    Widget popup_title;
445    Widget separator1;
446    Widget separator2;
447    Widget deinstall_item;
448    Widget toggle_item;
449    Widget modify_subpanel_item;
450    Widget add_ws_item;
451    Widget help_item;
452    Widget delete_ws_item;
453    Widget rename_ws_item;
454    Widget * action_item;
455    int action_count;
456    Boolean subpanel_add_state;
457 };
458
459
460 /*  Animation structure declarations  */
461
462 struct _AnimationData
463 {
464    String name;
465    int item_count;
466    AnimationItem * items;
467 };
468
469 struct _AnimationItem
470 {
471    String image_name;
472    int    delay;
473 };
474
475
476
477 /************************************************************************
478  *
479  *  External function declarations.
480  *
481  ************************************************************************/
482
483
484 extern Boolean FrontPanelReadDatabases (void);
485 extern void InitParse(char *, ElementValue **);
486 extern void InitializeControlFields( ElementValue *element_values, char *);
487 extern void _WriteControlElementValues(ElementValue *);
488 extern void WriteControlComponentFile(ControlData *);
489 extern void WriteSubpanelComponentFile(SubpanelData *);
490 extern void RemoveControlComponentFile(ControlData *);
491 extern void RemoveSubpanelComponentFile(SubpanelData *);
492 extern void    SessionAddFileData (char *, char *, int, char *, int, Boolean);
493 extern void    SessionDeleteFileData (char *);
494 extern void    SessionDeleteAll (void);
495 extern char *  SessionFileNameLookup (char *, int, char *, int);
496 extern void PanelTopicHelpCB(Widget, XtPointer, XtPointer);
497 extern void BoxTopicHelpCB(Widget, XtPointer, XtPointer);
498 extern void SubpanelTopicHelpCB(Widget, XtPointer, XtPointer);
499 extern void SwitchTopicHelpCB(Widget, XtPointer, XtPointer);
500 extern void ControlTopicHelpCB(Widget, XtPointer, XtPointer);
501 extern void GeneralTopicHelpCB(Widget, XtPointer, XtPointer);
502
503
504
505
506 /*
507  * macro to get message catalog strings
508  */
509
510 extern char *_DtGetMessage(char *filename, int set, int n, char *s);
511
512 #ifndef NO_MESSAGE_CATALOG
513 # ifdef __ultrix
514 #  define _FP_CLIENT_CAT_NAME "fp.cat"
515 # else  /* __ultrix */
516 #  define _FP_CLIENT_CAT_NAME "fp"
517 # endif /* __ultrix */
518 # define FPGETMESSAGE(set, number, string)\
519     _DtGetMessage(_FP_CLIENT_CAT_NAME, set, number, string)
520 #else
521 # define FPGETMESSAGE(set, number, string)\
522     string
523 #endif
524
525
526 #endif /* _databaseload_h */
527 /*  DON"T ADD ANYTHING AFTER THIS #endif  */