/* * gStruct.h * * Data structure definitions (annotated) * * © 1994-1998 Straylight */ /*----- Licensing note ----------------------------------------------------* * * This file is part of Straylight's Glass. * * Glass is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * Glass is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Glass. If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __gStruct_h #define __gStruct_h #ifndef __gPrefs_h #include "gPrefs.h" #endif #ifndef __wimp_h #include "steel/wimp.h" #endif #ifndef __dbox_h #include "steel/dbox.h" #endif #ifndef __viewer_h #include "steel/viewer.h" #endif #ifndef __pane_h #include "steel/pane.h" #endif typedef struct glass_tfile /* * Structure contains information about template file in general. Specifics * are handled by viewer segment of Steel as handles for viewer icons. */ { viewer v; /* The viewer window displaying this file */ sprite_area *s; /* The sprite area for the template file */ viewer vs; /* The viewer for the sprite area */ int alts; /* Number of alterations since saving */ int autoTime; /* Time of first alteration */ int autoAlarm; /* Alarm time for next autosave */ char filename[256]; /* What is the file's name? */ dbox autod; /* Dialogue box for autosave */ gPrefs_iconSize isz; /* Icon size for displaying */ gPrefs_sortType sort; /* How to sort icons in the display */ BOOL loaded : 1; /* Does the file have a sensible name? */ BOOL autoSaved : 1; /* Has the file been autosaved? */ } glass_tfile; typedef struct glass_edit /* * Contains common edit information (dbox handles, panel number and so on) */ { dbox d; /* Dialogue box handle for the edit */ pane p; /* Pane holding current panel in place */ dbox pd; /* Dbox handle of the current panel */ dbox_field panel; /* The currently selcted panel */ } glass_edit; typedef struct glass_editWindow /* * Contains complete information about an edit window window */ { glass_edit e; /* Common edit information */ struct glass_windPointer *w; /* The window to edit */ wimp_wind wdef; /* The window definition in the dbox */ char data[256]; /* The title bar data text */ char valid[256]; /* The title bar validation string */ int indLen; /* Length of indirected data */ BOOL hasValid; /* Short cut to whether vstring exists */ char font[40]; /* Font name for the title */ int fontSize; /* Font size */ } glass_editWindow; typedef struct glass_editIcon /* * Contains complete information about an edit icon window */ { glass_edit e; /* Common edit information */ struct glass_windPointer *w; /* The window containing the icon to edit*/ int i; /* The icon number to edit */ wimp_icon idef; /* The icon definition in the dbox */ char data[256]; /* The icon data text */ char valid[256]; /* The icon validation string */ int indLen; /* Length of indirected data */ BOOL hasValid; /* Short cut to whether vstring exists */ char font[40]; /* Font name for the icon */ int fontSize; /* Font size */ } glass_editIcon; typedef struct glass_guide /* * Contains information on window guide lines. */ { int coord; /* The guide's position */ BOOL active : 1; /* Is it currently active? */ BOOL horiz : 1; /* TRUE == horizontal, FALSE == vertical */ BOOL selected : 1; /* Is the guideline selected? */ } glass_guide; #define glass_GUIDELIMIT 16 /* Allow 16 guides per window */ typedef struct glass_windPointer /* * Contains mainly status information about a window, and points to the flex * block containing the actual window definition in internal form. */ { char id[15]; /* The window identifier */ glass_tfile *t; /* The template file */ viewer_icon i; /* The viewer icon handle */ struct glass_window *def; /* Flex anchor point for definiton block */ wimp_w h; /* Window handle if open (or 0) */ int selno; /* Number of icons selected */ int lastClicked; /* Last icon clicked (for depthwise sel) */ glass_editWindow *edit; /* Pointer to edit information, or 0 */ int gridx; /* Grid width */ int gridy; /* Grid height */ int size; /* Memory taken up by the definition */ int serial; /* Serial number of this window */ glass_guide guide[glass_GUIDELIMIT]; /* Array of guide defs */ wimp_box tex; /* Current temporary window extent */ char fonts[256]; /* Font usage array for this window */ BOOL ownPointer : 1; /* TRUE if this window contains the ptr */ BOOL renumber : 1; /* TRUE if we're reordering icons */ BOOL gridShow : 1; /* Display the grid onsceeen? */ BOOL gridLock : 1; /* Snap to the grid? */ BOOL antiAliased : 1; /* Quick check for fonts */ #ifndef glass_DEMO BOOL testMode : 1; /* TRUE if the window is in test mode */ #endif } glass_windPointer; typedef struct glass_windDescription /* * Defines how a window is laid out internally in Glass's workspace. */ { wimp_wind w; /* The window definition */ } glass_windDescription; typedef struct glass_iconDescription /* * Icon description (internal format) used in flex block. */ { glass_editIcon *edit; /* Is the icon being edited? */ wimp_icon i; /* The icon definition */ BOOL selected : 1; /* Is the icon selected (for manipulation */ /* in Glass, not in the WIMP sense) */ BOOL copied : 1; /* Is the icon a new copy (i.e. select it */ /* after a copy op) */ } glass_iconDescription; typedef struct glass_window /* * Contains a complete window definiton. This describes exactly what is * contained in the window definiton flex block. */ { glass_windDescription desc; /* Description of window (not icons) */ glass_iconDescription i[1]; /* Description of icons */ } glass_window; /* * Macros to allow indirection to a structure in a flex block * * flex == flex pointer (any pointer) * offset == integer offset (in bytes) * * Example * iconptr(w->def,off)->flags.indirect=TRUE; */ #define intptr(flex,offset) \ ((int *)(((char *)(flex))+(offset))) #define charptr(flex,offset) \ (((char *)(flex))+(offset)) #define winptr(flex,offset) \ ((glass_window *)(((char *)(flex))+(offset))) #define iconptr(flex,offset) \ ((glass_iconDescription *)(((char *)(flex))+(offset))) #define _ptr(type,flex,offset) \ ((type *)(((char *)(flex))+(offset))) #endif