2 * Grace - GRaphing, Advanced Computation and Exploration of data
4 * Home page: http://plasma-gate.weizmann.ac.il/Grace/
6 * Copyright (c) 1991-1995 Paul J Turner, Portland, OR
7 * Copyright (c) 1996-2003 Grace Development Team
9 * Maintained by Evgeny Stambulchik
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 * for Motif specific items
37 #include <X11/Intrinsic.h>
38 /* for XmString; TODO: remove! */
44 * Accept/Apply/Close for aac_cb callbacks
50 #define LIST_TYPE_SINGLE 0
51 #define LIST_TYPE_MULTIPLE 1
53 #define SPIN_TYPE_INT 0
54 #define SPIN_TYPE_FLOAT 1
56 #define ALIGN_BEGINNING 0
57 #define ALIGN_CENTER 1
60 #define CreateMenuSeparator(w) CreateSeparator(w)
62 extern Widget app_shell
; /* defined in xmgrace.c */
71 unsigned char *bitmap
;
81 int ncols
; /* preferred number of columns */
84 OptionWidgetItem
*options
;
95 /* Storage labeling procedure */
96 typedef char * (*Storage_LabelingProc
)(
101 typedef struct _StorageStructure StorageStructure
;
103 typedef void (*SS_PopupCBProc
)(
104 StorageStructure
*ss
,
105 int nselected
/* # of selected list items */
108 struct _StorageStructure
{
114 Storage_LabelingProc labeling_proc
;
121 Widget popup_hide_bt
;
122 Widget popup_show_bt
;
124 Widget popup_delete_bt
;
125 Widget popup_duplicate_bt
;
127 Widget popup_bring_to_front_bt
;
128 Widget popup_send_to_back_bt
;
129 Widget popup_move_up_bt
;
130 Widget popup_move_down_bt
;
132 Widget popup_select_all_bt
;
133 Widget popup_unselect_all_bt
;
134 Widget popup_invert_selection_bt
;
136 SS_PopupCBProc popup_cb
;
166 Widget duplicate_item
;
201 StorageStructure
*graph_sel
;
202 StorageStructure
*set_sel
;
207 GraphSetStructure
*src
;
208 GraphSetStructure
*dest
;
219 OptionStructure
*r_sel
;
221 } RestrictionStructure
;
223 typedef struct _TransformStructure TransformStructure
;
225 typedef void* (*TDBuild_CBProc
)(
226 TransformStructure
*tdialog
229 typedef void* (*TDGet_CBProc
)(
230 void *gui
/* specific GUI structure */
233 typedef void (*TDFree_CBProc
)(
234 void *tddata
/* data */
237 typedef int (*TDRun_CBProc
)(
240 void *tddata
/* data */
243 struct _TransformStructure
{
247 SrcDestStructure
*srcdest
;
249 TDBuild_CBProc build_cb
;
251 TDFree_CBProc free_cb
;
257 TDBuild_CBProc build_cb
;
259 TDFree_CBProc free_cb
;
263 /* OptionChoice CB procedure */
264 typedef void (*OC_CBProc
)(
265 OptionStructure
*opt
,
266 int value
, /* value */
267 void * /* data the application registered */
270 /* ToggleButton CB procedure */
271 typedef void (*TB_CBProc
)(
273 int onoff
, /* True/False */
274 void * /* data the application registered */
277 /* FileSelectionBox CB procedure */
278 typedef int (*FSB_CBProc
)(
280 char *, /* filename */
281 void * /* data the application registered */
284 /* Button CB procedure */
285 typedef void (*Button_CBProc
)(
287 void * /* data the application registered */
290 /* List CB procedure */
291 typedef void (*List_CBProc
)(
292 ListStructure
*listp
,
293 int n
, /* # of items selected */
294 int *values
, /* list of values of the selected items */
295 void * /* data the application registered */
298 /* Storage CB procedure */
299 typedef void (*Storage_CBProc
)(
300 StorageStructure
*ss
,
301 int n
, /* # of items selected */
302 Quark
**values
, /* list of values of the selected items */
303 void *data
/* data the application registered */
306 /* Storage double click CB procedure */
307 typedef void (*Storage_DCCBProc
)(
308 StorageStructure
*ss
,
309 Quark
*value
, /* list of values of the selected items */
310 void *data
/* data the application registered */
313 /* Spin Button CB procedure */
314 typedef void (*Spin_CBProc
)(
315 SpinStructure
*spinp
,
316 double, /* value of spinner */
317 void * /* data the application registered */
320 /* Text input CB procedure */
321 typedef void (*Text_CBProc
)(
323 char *, /* text string */
324 void * /* data the application registered */
327 /* Text item CB procedure */
328 typedef void (*TItem_CBProc
)(
330 char *, /* text string */
331 void * /* data the application registered */
334 /* Scale input CB procedure */
335 typedef void (*Scale_CBProc
)(
337 int, /* scale value */
338 void * /* data the application registered */
341 /* AAC Dialog CB procedure */
342 typedef int (*AACDialog_CBProc
)(
343 void * /* data the application registered */
346 /* PenChoice input CB procedure */
347 typedef void (*Pen_CBProc
)(
349 const Pen
*, /* pen value */
350 void * /* data the application registered */
354 void ManageChild(Widget w
);
355 void UnmanageChild(Widget w
);
356 int IsManaged(Widget w
);
357 void SetSensitive(Widget w
, int onoff
);
359 Widget
GetParent(Widget w
);
361 void RegisterEditRes(Widget shell
);
363 void SetDimensions(Widget w
, unsigned int width
, unsigned int height
);
364 void GetDimensions(Widget w
, unsigned int *width
, unsigned int *height
);
366 void *GetUserData(Widget w
);
367 void SetUserData(Widget w
, void *udata
);
369 Widget
CreateDialogForm(Widget parent
, const char *s
);
370 void SetDialogFormResizable(Widget form
, int onoff
);
371 void AddDialogFormChild(Widget form
, Widget child
);
372 void FixateDialogFormChild(Widget w
);
374 Widget
CreateFrame(Widget parent
, char *s
);
376 Widget
CreateSeparator(Widget parent
);
378 Widget
CreateVContainer(Widget parent
);
379 Widget
CreateHContainer(Widget parent
);
381 Widget
CreateGrid(Widget parent
, int ncols
, int nrows
);
382 void PlaceGridChild(Widget grid
, Widget w
, int col
, int row
);
384 Widget
CreateTab(Widget parent
);
385 Widget
CreateTabPage(Widget parent
, char *s
);
386 void SelectTabPage(Widget tab
, Widget w
);
388 Widget
CreateScale(Widget parent
, char *s
, int min
, int max
, int delta
);
389 void SetScaleValue(Widget w
, int value
);
390 int GetScaleValue(Widget w
);
391 void SetScaleWidth(Widget w
, int width
);
392 void AddScaleCB(Widget w
, Scale_CBProc cbproc
, void *);
394 SpinStructure
*CreateCharSizeChoice(Widget parent
, char *s
);
396 Widget
CreateAngleChoice(Widget parent
, char *s
);
397 int GetAngleChoice(Widget w
);
398 void SetAngleChoice(Widget w
, int angle
);
400 Widget
CreateToggleButton(Widget parent
, char *s
);
401 int GetToggleButtonState(Widget w
);
402 void SetToggleButtonState(Widget w
, int value
);
403 void AddToggleButtonCB(Widget w
, TB_CBProc cbproc
, void *anydata
);
405 Widget
CreateButton(Widget parent
, char *label
);
406 Widget
CreateBitmapButton(Widget parent
,
407 int width
, int height
, const unsigned char *bits
);
408 void AddButtonCB(Widget button
, Button_CBProc cbproc
, void *data
);
410 WidgetList
CreateAACDialog(Widget form
,
411 Widget container
, AACDialog_CBProc cbproc
, void *data
);
413 Widget
CreateAACButtons(Widget parent
, Widget form
, Button_CBProc aac_cb
);
415 OptionStructure
*CreateOptionChoice(Widget parent
, char *labelstr
, int ncols
,
416 int nchoices
, OptionItem
*items
);
417 OptionStructure
*CreateOptionChoiceVA(Widget parent
, char *labelstr
, ...);
418 OptionStructure
*CreateBitmapOptionChoice(Widget parent
, char *labelstr
, int ncols
,
419 int nchoices
, int width
, int height
, BitmapOptionItem
*items
);
420 void SetOptionChoice(OptionStructure
*opt
, int value
);
421 int GetOptionChoice(OptionStructure
*opt
);
422 void UpdateOptionChoice(OptionStructure
*optp
, int nchoices
, OptionItem
*items
);
424 void AddOptionChoiceCB(OptionStructure
*opt
, OC_CBProc cbproc
, void *anydata
);
426 ListStructure
*CreateListChoice(Widget parent
, char *labelstr
, int type
,
427 int nvisible
, int nchoices
, OptionItem
*items
);
428 int SelectListChoice(ListStructure
*listp
, int choice
);
429 void SelectListChoices(ListStructure
*listp
, int nchoices
, int *choices
);
430 void UpdateListChoice(ListStructure
*listp
, int nchoices
, OptionItem
*items
);
431 int GetListChoices(ListStructure
*listp
, int **values
);
432 int GetSingleListChoice(ListStructure
*listp
, int *value
);
433 void AddListChoiceCB(ListStructure
*listp
, List_CBProc cbproc
, void *anydata
);
435 void list_selectall_action(Widget w
, XEvent
*e
, String
*par
, Cardinal
*npar
);
436 void list_unselectall_action(Widget w
, XEvent
*e
, String
*par
, Cardinal
*npar
);
437 void list_invertselection_action(Widget w
, XEvent
*e
, String
*par
,
440 StorageStructure
*CreateStorageChoice(Widget parent
,
441 char *labelstr
, int type
, int nvisible
);
442 void SetStorageChoiceLabeling(StorageStructure
*ss
, Storage_LabelingProc proc
);
443 int GetStorageChoices(StorageStructure
*ss
, Quark
***values
);
444 int GetSingleStorageChoice(StorageStructure
*ss
, Quark
**value
);
445 int SelectStorageChoice(StorageStructure
*ss
, Quark
*choice
);
446 int SelectStorageChoices(StorageStructure
*ss
, int nchoices
, Quark
**choices
);
447 void UpdateStorageChoice(StorageStructure
*ss
);
448 void SetStorageChoiceQuark(StorageStructure
*ss
, Quark
*q
);
449 void AddStorageChoiceCB(StorageStructure
*ss
,
450 Storage_CBProc cbproc
, void *anydata
);
451 void AddStorageChoiceDblClickCB(StorageStructure
*ss
,
452 Storage_DCCBProc cbproc
, void *anydata
);
454 SpinStructure
*CreateSpinChoice(Widget parent
, char *s
, int len
,
455 int type
, double min
, double max
, double incr
);
456 double GetSpinChoice(SpinStructure
*spinp
);
457 void SetSpinChoice(SpinStructure
*spinp
, double value
);
458 void AddSpinChoiceCB(SpinStructure
*spinp
, Spin_CBProc cbproc
, void *data
);
460 TextStructure
*CreateTextInput(Widget parent
, char *s
);
461 TextStructure
*CreateCSText(Widget parent
, char *s
);
462 char *GetTextString(TextStructure
*cst
);
463 void SetTextString(TextStructure
*cst
, char *s
);
464 void AddTextInputCB(TextStructure
*cst
, Text_CBProc cbproc
, void *data
);
465 int GetTextCursorPos(TextStructure
*cst
);
466 void SetTextCursorPos(TextStructure
*cst
, int pos
);
467 void TextInsert(TextStructure
*cst
, int pos
, char *s
);
468 void SetTextEditable(TextStructure
*cst
, int onoff
);
469 void cstext_edit_action(Widget w
, XEvent
*e
, String
*par
, Cardinal
*npar
);
471 FSBStructure
*CreateFileSelectionBox(Widget parent
, char *s
);
472 void AddFileSelectionBoxCB(FSBStructure
*fsbp
, FSB_CBProc cbproc
, void *anydata
);
473 void SetFileSelectionBoxPattern(FSBStructure
*fsb
, char *pattern
);
475 Widget
CreateLabel(Widget parent
, char *s
);
477 OptionStructure
*CreateFontChoice(Widget parent
, char *s
);
478 OptionStructure
*CreatePatternChoice(Widget parent
, char *s
);
479 OptionStructure
*CreateLineStyleChoice(Widget parent
, char *s
);
480 OptionStructure
*CreateSetTypeChoice(Widget parent
, char *s
);
481 OptionStructure
*CreateColorChoice(Widget parent
, char *s
);
482 OptionStructure
*CreateFormatChoice(Widget parent
, char *s
);
483 OptionStructure
*CreateASChoice(Widget parent
, char *s
);
484 OptionStructure
*CreateTextJustChoice(Widget parent
, char *s
);
485 OptionStructure
*CreateJustChoice(Widget parent
, char *s
);
487 OptionStructure
*CreateCharOptionChoice(Widget parent
, char *s
);
488 void UpdateCharOptionChoice(OptionStructure
*opt
, int font
);
490 Widget
CreatePenChoice(Widget parent
, char *s
);
491 void SetPenChoice(Widget button
, Pen
*pen
);
492 int GetPenChoice(Widget pen_button
, Pen
*pen
);
493 void AddPenChoiceCB(Widget button
, Pen_CBProc cbproc
, void *anydata
);
495 SpinStructure
*CreateViewCoordInput(Widget parent
, char *s
);
497 RestrictionStructure
*CreateRestrictionChoice(Widget parent
, char *s
);
499 StorageStructure
*CreateFrameChoice(Widget parent
, char *labelstr
, int type
);
501 StorageStructure
*CreateGraphChoice(Widget parent
, char *labelstr
, int type
);
503 StorageStructure
*CreateSetChoice(Widget parent
, char *labelstr
,
504 int type
, StorageStructure
*graphss
);
505 void UpdateSetChoice(StorageStructure
*ss
);
506 Quark
*get_set_choice_gr(StorageStructure
*ss
);
508 GraphSetStructure
*CreateGraphSetSelector(Widget parent
, char *s
, int sel_type
);
509 SrcDestStructure
*CreateSrcDestSelector(Widget parent
, int sel_type
);
510 void UpdateSrcDestSelector(SrcDestStructure
*srcdest
);
512 void switch_focus_proc(void *data
);
513 void hide_graph_proc(void *data
);
514 void show_graph_proc(void *data
);
515 void duplicate_graph_proc(void *data
);
516 void kill_graph_proc(void *data
);
517 void copy12_graph_proc(void *data
);
518 void copy21_graph_proc(void *data
);
519 void move12_graph_proc(void *data
);
520 void move21_graph_proc(void *data
);
521 void swap_graph_proc(void *data
);
522 void create_new_graph_proc(void *data
);
524 void hide_set_proc(void *data
);
525 void show_set_proc(void *data
);
526 void duplicate_set_proc(void *data
);
527 void kill_set_proc(void *data
);
528 void killd_set_proc(void *data
);
529 void copy12_set_proc(void *data
);
530 void copy21_set_proc(void *data
);
531 void move12_set_proc(void *data
);
532 void move21_set_proc(void *data
);
533 void swap_set_proc(void *data
);
534 void newF_set_proc(void *data
);
535 void newS_set_proc(void *data
);
536 void newE_set_proc(void *data
);
537 void newB_set_proc(void *data
);
538 void editS_set_proc(void *data
);
539 void editE_set_proc(void *data
);
541 SpinStructure
*CreateLineWidthChoice(Widget parent
, char *s
);
543 OptionStructure
*CreatePanelChoice(Widget parent
, char *labstr
, ...);
544 OptionStructure
*CreatePrecisionChoice(Widget parent
, char *s
);
545 OptionStructure
*CreatePlacementChoice(Widget parent
, char *s
);
546 OptionStructure
*CreatePaperOrientationChoice(Widget parent
, char *s
);
547 OptionStructure
*CreatePaperFormatChoice(Widget parent
, char *s
);
549 Widget
CreateTextItem2(Widget parent
, int len
, char *s
);
550 Widget
CreateTextItem4(Widget parent
, int len
, char *s
);
551 Widget
CreateScrollTextItem2(Widget parent
, int hgt
, char *s
);
552 void AddTextItemCB(Widget ti
, TItem_CBProc cbproc
, void *data
);
554 Widget
CreateCommandButtons(Widget parent
, int n
, Widget
* buts
, char **l
);
555 Widget
CreateCommandButtonsNoDefault(Widget parent
, int n
, Widget
* buts
, char **l
);
557 TransformStructure
*CreateTransformDialogForm(Widget parent
,
558 const char *s
, int sel_type
, int exclusive
, const TD_CBProcs
*cbs
);
559 int GetTransformDialogSettings(TransformStructure
*tdialog
,
560 int *nssrc
, Quark
***srcsets
, Quark
***destsets
);
561 void RaiseTransformationDialog(TransformStructure
*tdialog
);
563 void SetLabel(Widget w
, char *s
);
564 void AlignLabel(Widget w
, int alignment
);
565 void SetFixedFont(Widget w
);
567 Widget
CreateMenuBar(Widget parent
);
568 Widget
CreateMenu(Widget parent
, char *label
, char mnemonic
, int help
);
569 void ManageMenu(Widget menupane
);
570 void UnmanageMenu(Widget menupane
);
571 Widget
CreateMenuButton(Widget parent
, char *label
, char mnemonic
,
572 Button_CBProc cb
, void *data
);
573 Widget
CreateMenuCloseButton(Widget parent
, Widget shell
);
574 Widget
CreateMenuHelpButton(Widget parent
, char *label
, char mnemonic
,
575 Widget form
, char *ha
);
576 Widget
CreateMenuToggle(Widget parent
, char *label
, char mnemonic
,
577 TB_CBProc cb
, void *data
);
578 Widget
CreateMenuLabel(Widget parent
, char *name
);
580 void AddHelpCB(Widget w
, char *ha
);
581 void ContextHelpCB(Widget w
, void *data
);
583 char *GetStringSimple(XmString xms
);
585 char *xv_getstr(Widget w
);
586 Boolean
xv_evalexpr(Widget w
, double *);
587 Boolean
xv_evalexpri(Widget w
, int *);
588 void xv_setstr(Widget w
, char *s
);
589 void handle_close(Widget w
);
590 void RaiseWindow(Widget w
);
591 void destroy_dialog(Widget w
, XtPointer client_data
, XtPointer call_data
);
592 void destroy_dialog_cb(Widget but
, void *data
);
593 void savewidget(Widget w
);
594 void deletewidget(Widget w
);
596 void DefineDialogCursor(Cursor c
);
597 void UndefineDialogCursor(void);
599 #endif /* __MOTIFINC_H_ */