4 ** Copyright (C) 1993,94,95,96,98 by Bernardo Innocenti
6 ** Various definitions for the user interface.
9 #ifndef INTUITION_INTUITION_H
10 #include <intuition/intuition.h>
13 #ifndef XMODULE_PRIV_H
14 #include <XModulePriv.h>
22 /* This structure holds data needed to handle windows
23 * in a nice Object oriented way (no more endless switches :-)
27 struct MinNode Link; /* Used to mantain a list of all open windows. */
31 struct Gadget **Gadgets;
34 struct TextAttr *Attr;
35 struct TextFont *Font;
36 struct NewMenu *NewMenu;
37 struct Menu *MenuStrip;
40 struct WindowBorder *Borders;
41 struct AppWindow *AppWin;
47 struct IBox WindowSize;
48 struct IBox WindowZoom;
53 /* Window specific user functions */
54 LONG (*PreOpenFunc)(struct WinUserData *);
55 void (*PostOpenFunc)(struct WinUserData *);
56 LONG (*PreCloseFunc)(struct WinUserData *);
57 void (*PostCloseFunc)(struct WinUserData *);
58 void (*IDCMPFunc)(struct WinUserData *);
59 void (*DropIcon)(struct AppMessage *);
60 void (*LayoutCleanupFunc)(struct WinUserData *);
64 /* Flags for WinUserData->WUDFlags */
66 #define WUDF_REOPENME (1<<0) /* Open this window again later */
67 #define WUDF_LOCALEDONE (1<<1) /* Set when menustrip has been localized */
68 #define WUDF_JUSTRESIZED (1<<3) /* Set just after an IDCMP_NEWSIZE */
70 #define WUDF_CUSTOMLAYOUT (1<<2)
71 /* Do not use the standard layout routines for
72 * this window. If not NULL, wud->LayoutArgs must point to
73 * a user function which should create and position the gadgets.
75 * struct Gadget *CustomLayoutFunc (struct WinUserData *wud);
82 struct WinUserData *Wud; /* Pointer to WinUserData */
83 UWORD UseCnt; /* Number of WUDs of this kind */
84 UWORD Flags; /* Some flags, see below */
85 struct TagItem *CreationTags; /* See <gui.h> for possible tags */
90 /* Flags for WDescr->Flags */
91 #define XMWINF_OPENMULTI (1<<0) /* Allow opening multiple times */
92 #define XMWINF_LOCALEDONE (1<<1) /* Set when menustrip has been localized */
120 /* Tags for MyOpenWindow() */
121 #define XMWIN_Dummy (TAG_USER + 'WN' << 8)
122 #define XMWIN_NewMenu (XMWIN_Dummy + 1) /* Pointer to NewMenu array */
123 #define XMWIN_LayoutArgs (XMWIN_Dummy + 2) /* Pointer to layout args array */
124 #define XMWIN_GCount (XMWIN_Dummy + 3) /* Number of gadgets in window */
125 #define XMWIN_Title (XMWIN_Dummy + 4) /* Window title */
126 #define XMWIN_WindowFlags (XMWIN_Dummy + 5) /* Window flags for WA_Flags */
127 #define XMWIN_IDCMPFlags (XMWIN_Dummy + 6) /* Flags for WA_IDCMPFlags */
128 #define XMWIN_IDCMPFunc (XMWIN_Dummy + 7) /* Custom IDCMP handler */
129 #define XMWIN_DropIconFunc (XMWIN_Dummy + 8) /* AppWindow handler */
130 #define XMWIN_LayoutFunc (XMWIN_Dummy + 9) /* Your custom layout function */
131 #define XMWIN_PreOpenFunc (XMWIN_Dummy + 10) /* Called just before opening win */
132 #define XMWIN_PostOpenFunc (XMWIN_Dummy + 11) /* Called just after opening win */
133 #define XMWIN_PreCloseFunc (XMWIN_Dummy + 12) /* Called just before closing win */
134 #define XMWIN_PostCloseFunc (XMWIN_Dummy + 13) /* Called just after closing win */
135 #define XMWIN_HelpNode (XMWIN_Dummy + 14) /* Name of AmigaGuide node for help */
136 #define XMWIN_UserData (XMWIN_Dummy + 15) /* Whatever you want... */
137 #define XMWIN_LayoutCleanup (XMWIN_Dummy + 16) /* Cleanup for custom layout func */
139 /* You can also use standard OpenWindow() tags */
143 /* This structure is used by LockWindows() to
144 * track modifications made to the windows.
148 struct Requester Req;
162 /* A linked list of these structures is attached to all
163 * WUDs to keep track of the bevel boxes inside the window.
167 struct WindowBorder *NextBorder;
178 /* Each WUD gets an array of GInfo structures to store
179 * some precalculated layout data. Each gadget and group
180 * has a GInfo structure in the array.
184 WORD GKind; /* Object kind (#?_KIND) */
185 UWORD MinWidth, MinHeight; /* Minimum size */
186 UWORD LabelWidth; /* Label width for this object */
187 UWORD Flags; /* See below */
188 UWORD Dummy; /* Keep structure long aligned */
190 APTR SpecialStorage; /* For gadget objects */
192 UWORD Width, Height; /* For group objects */
197 /* Flags for GInfo->Flags */
198 #define GIF_FIXEDWIDTH (1<<0)
199 #define GIF_FIXEDHEIGHT (1<<1)
200 #define GIF_HASBORDER (1<<4)
204 /*********************/
205 /* LayoutGadgetsArgs */
206 /*********************/
208 /* LayoutGadgetsArgs is used to pass arguments to LayoutGadgets()
209 * and CreateGadgets().
211 struct LayoutGadgetsArgs
213 ULONG *Args; /* Arguments array */
214 ULONG Count; /* GInfo array counter */
215 struct GInfo *GInfo; /* GInfo array */
216 struct WinUserData *Wud; /* The window we are working for */
217 struct RastPort *DummyRast; /* RastPort initialzied for TextLength() */
218 void *VInfo; /* VisualInfo for GadTools gadgets */
219 struct Gadget *PrevGad; /* Used to link gadgets together */
220 ULONG *SpecialTags; /* Storage for additional tags for gadgets */
224 /* Layout modes for LayoutGadgets and CreateGadgets() */
225 #define LAYOUTMODE_V 0
226 #define LAYOUTMODE_H 1
228 #define VSPACING 1 /* Vertical spacing between GUI elements */
229 #define HSPACING 2 /* Horizontal spacing between GUI elements */
230 #define LABELSPACING 8 /* Extra horizontal spacing for labels */
240 ULONG DisplayID; /* Display mode ID */
241 ULONG Width; /* Width of display in pixels */
242 ULONG Height; /* Height of display in pixels */
243 UWORD Depth; /* Number of bit-planes */
244 UWORD OverscanType; /* Type of overscan of display */
245 BOOL AutoScroll; /* Display should auto-scroll? */
248 UBYTE PubScreenName[32];
253 /*******************/
254 /* File requesters */
255 /*******************/
257 /* This structure is used to reference all the file requesters.
261 APTR FReq; /* Real file requester (ASL or ReqTools) */
262 ULONG Title; /* Message number for title */
263 ULONG Flags; /* FRF_DOSAVEMODE, FRF_DOPATTERNS, FRF_DOMULTISELECT... */
333 UBYTE BackupTemplate[64];
339 WORD AdvanceTracks, AdvanceLines;
340 ULONG MaxUndoLevels, MaxUndoMem;
341 ULONG Flags; /* See <patteditclass.h> for possible flags */
342 WORD VScrollerPlace, HScrollerPlace;
343 UBYTE ClipboardUnit, Pad0;
344 UWORD TrackChars, Backdrop;
345 ULONG BGPen, TextPen, LinesPen, TinyLinesPen;
350 /* Possible values for (H|V)ScrollerPlace */
351 #define SCROLLERPLACE_NONE 0
352 #define SCROLLERPLACE_RIGHT 1
353 #define SCROLLERPLACE_BOTTOM 1
354 #define SCROLLERPLACE_LEFT 2
358 /* Instrument save modes */
367 /* Handy macros to get a gadget string/number */
369 #define GetString(g) (((struct StringInfo *)g->SpecialInfo)->Buffer)
370 #define GetNumber(g) (((struct StringInfo *)g->SpecialInfo)->LongInt)
373 /* Some handy definitions missing in <devices/inputevent.h> */
375 #define IEQUALIFIER_SHIFT (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
376 #define IEQUALIFIER_ALT (IEQUALIFIER_LALT | IEQUALIFIER_RALT)
377 #define IEQUALIFIER_COMMAND (IEQUALIFIER_LCOMMAND | IEQUALIFIER_RCOMMAND)
382 #define SIGBREAKFLAGS (SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F)
385 /**************************/
386 /* XModule custom gadgets */
387 /**************************/
390 #define ENDGROUP_KIND -1 /* End of group */
391 #define VGROUP_KIND -2 /* Vertical group */
392 #define HGROUP_KIND -3 /* Horizontal group */
393 #define IMAGEBUTTON_KIND 20 /* button with vector image label */
394 #define BOOPSI_KIND 21 /* BOOPSI gadget */
397 /* ti_Data is a pointer to a setup function for custom gadgets.
398 * It receives the newly allocated Gadget structure and should customize
399 * all fields it is interested in, as well as doing all the allocations
400 * and precalculations which are needed for the custom gadget.
402 * When the XMGAD_BOOPSI tag is specified, SetupFunc() receves the
403 * tag array pointer and the NewGadget structure associated with the
404 * gadget. SetupFunc() should then return a pointer to the BOOPSI
405 * Gadget it has allocated.
407 #define XMGAD_SetupFunc (TAG_USER+1)
410 /* If ti_Data is TRUE, the layout routines will let the SetupFunc()
411 * allocate a BOOPSI gadget itself, So the gadget is _not_ allocated with
412 * the GadTools function CreateGadget(). When the window is closed with
413 * MyCloseWindow(), or when MyOpenWindow() fails after creating the object,
414 * it is your duty to DisposeObject() on these gadgets.
416 //#define XMGAD_BOOPSI (TAG_USER+2)
420 /********************/
421 /* External symbols */
422 /********************/
424 XREF struct Screen *Scr;
425 XREF struct DrawInfo *DrawInfo;
426 XREF APTR VisualInfo;
427 XREF struct ScrInfo ScrInfo;
428 XREF struct WDescr WDescr[];
429 XREF CxObj *MyBroker;
430 XREF UWORD __chip *BlockPointer; /* for OS2.0 only */
431 XREF Class *ScrollButtonClass;
432 XREF UWORD OffX, OffY;
433 XREF WORD SizeWidth, SizeHeight;
436 XREF struct IntuiMessage IntuiMsg;
449 XREF struct TextFont *TopazFont;
458 Signals; // Global Wait() signals
461 XREF struct XMFileReq FileReqs[FREQ_COUNT];
472 XREF struct SaveSwitches SaveSwitches;
473 XREF struct ClearSwitches ClearSwitches;
474 XREF struct OptSwitches OptSwitches;
475 XREF struct GuiSwitches GuiSwitches;
476 XREF struct PattSwitches PattSwitches;
478 XREF BOOL DoNextSelect;
479 XREF BOOL ShowRequesters;
487 InstrumentsWinTags[],
492 OptimizationWinTags[],
502 /***********************/
503 /* Function prototypes */
504 /***********************/
506 GLOBALCALL void OpenProgressWindow (void);
507 GLOBALCALL void CloseProgressWindow (void);
509 GLOBALCALL void UpdateInstrList (void);
510 GLOBALCALL void UpdateInstrInfo (void);
511 GLOBALCALL void DetatchSongInfoList (void);
512 GLOBALCALL void UpdateSongInfoList (void);
513 GLOBALCALL void UpdateSongInfo (void);
514 GLOBALCALL void UpdatePatternList (void);
515 GLOBALCALL void UpdateSequenceList (void);
517 GLOBALCALL void UpdateSample (void);
518 GLOBALCALL void UpdateSampInfo (void);
519 GLOBALCALL void UpdateSampGraph (void);
521 GLOBALCALL void UpdateSampleMenu (void);
522 GLOBALCALL void UpdateGuiSwitches (void);
523 GLOBALCALL void UpdateInstrSwitches (void);
524 GLOBALCALL void UpdateClearSwitches (void);
525 GLOBALCALL void UpdateSaveSwitches (void);
526 GLOBALCALL void UpdateOptSwitches (void);
527 GLOBALCALL void UpdatePrefsWindow (void);
528 GLOBALCALL void UpdatePattern (void);
529 GLOBALCALL void UpdateEditorInst (void);
530 //GLOBALCALL void UpdatePlay (void);
532 GLOBALCALL void UpdatePattSize (void);
533 GLOBALCALL void UpdatePattPrefs (void);
535 GLOBALCALL void ToolBoxDropIcon (struct AppMessage *msg);
537 GLOBALCALL void HandleIDCMP (void);
538 GLOBALCALL void LockWindows (void);
539 GLOBALCALL void UnlockWindows (void);
540 GLOBALCALL void RevealWindow (struct WinUserData *wud);
541 GLOBALCALL void SetGadgets (struct WinUserData *wud, LONG arg, ...);
543 GLOBALCALL LONG AddListViewNodeA (struct List *lv, CONST_STRPTR label, LONG *args);
544 GLOBALCALL LONG AddListViewNode (struct List *lv, CONST_STRPTR label, ...);
545 GLOBALCALL void RemListViewNode (struct Node *n);
546 GLOBALCALL struct Image *NewImageObject (ULONG which);
547 GLOBALCALL struct Window *NewWindow (ULONG id);
548 GLOBALCALL struct Window *MyOpenWindow (struct WinUserData *wud);
549 GLOBALCALL void MyCloseWindow (struct WinUserData *wud);
550 GLOBALCALL struct WinUserData *CreateWUD (ULONG id);
551 GLOBALCALL void DeleteLayoutInfo (struct WinUserData *wud);
553 GLOBALCALL void ReopenWindows (void);
554 GLOBALCALL LONG SetupScreen (void);
555 GLOBALCALL void CloseDownScreen (void);
557 GLOBALCALL struct Gadget *CreateUpButton (ULONG id, struct Gadget *target, LONG *map, LONG Place);
558 GLOBALCALL struct Gadget *CreateDnButton (ULONG id, struct Gadget *target, LONG *map, LONG Place);
559 GLOBALCALL struct Gadget *CreateSxButton (ULONG id, struct Gadget *target, LONG *map);
560 GLOBALCALL struct Gadget *CreateDxButton (ULONG id, struct Gadget *target, LONG *map);
561 GLOBALCALL struct Gadget *CreateVSlider (ULONG id, struct Gadget *target, LONG *map, LONG ButtonsSpacing, LONG Place);
562 GLOBALCALL struct Gadget *CreateHSlider (ULONG id, struct Gadget *target, LONG *map, LONG ButtonsSpacing);