// twindow.h // // This is the header file for the GUI layer of Twistory. // // by John D. de Boer // GUI structs typedef struct { bool coord, // whether coordinate lines are to be shown in map unc, // whether time and place uncertainties are to be shown always, // whether locations are always shown, regardless of period of reference alt, // whether to display alternate place names on map term, // whether leaders are only shown during their terms in office region, // whether to show items from the larger region along left of view gpvoy, // whether to group itinerary points the same as regular locations age, // whether age/date of birth is shown after name fullnam, // whether to use full names for people on the map fill, // whether to fill continent polygons (to make water a different colour) focus, // whether the map should focus automatically on the selection onmap, // whether to filter the time-line according to map visibility thin, // whether the timeline should be thinned out to avoid crowding ticon, // whether person icons are to be shown in the timeline windows flag, // whether national flag graphics are to be used to fill timeline boxes dyn, // whether dynasty lines are shown on timeline ticks, // whether to show age/duration ticks on timeline bars elide, // whether to ignore items in timeline when they are very long pink, // whether to fill gen boxes in blue and pink round, // whether to round gen boxes for females italic; // whether to use italics in gen boxes for females short trip, // whether to show voyage lines (0=none; 1=sel only; 2=everyone) group; // grouping strength in map (0=none; 1=weakest; etc.) float size; // font size (and smallest font size used for map) } GlobalOpts; // prototypes from twayitwas.c typedef struct { bool good; // whether they were read from a valid prefs file float theta, // fields that should be saved phi, mag; } MapPrefs; void ReadPreferences(void); void WritePreferences(void); // prototypes from twabout.c void InitAboutWindow(void); // prototypes from drawyear.c void DrawTimeCoordinates(window *W, int PAGES, bool Printing); // prototypes from drawline.c void LineMapText(window *W, point P, const char *S, void *V); void DrawTimeLine(window *W); short TimeLinePages(window *W, rect R); void PrintTimeLine(window *W, short PAGE); bool LinePDFSize(window *W, rect *R); void LineDrawPDF(window *W); void *TimeLineHit(mouseclick *M); void TimeFocus(void); // prototypes from linewind.c #define MAXLINEWINDS (1) typedef struct { ControlRef slow, // button to shorten time scale fast; // button to lengthen time scale } LineInfo; //void DoLineMenu(menuitem *M); bool ArrowKey(keystroke *K); void InitLineViews(void); bool IsLineWindow(window *W); void AddLineWindow(void); void SwitchToTimeLine(void); // prototypes from drawglobe.c void StrokeIsland(window *W, vectorpoly **P); void DrawGlobe(window *W); void DrawLegends(window *W); void InitDrawGlobe(void); // prototypes from drawplace.c enum { tooSmall,sizeOkay,tooBig }; void DrawSpheres(window *W); void DoLocationCalcs(void); void DrawLocations(window *W); Place *CurrentPlace(const Place *C); Place *EffectivePlace(const Place *C); void CalcLegPoint(point P1, point P2, real Frac, point *P); void DrawTravels(window *W, Travels *T, int COLOUR); bool GoodLeg(const Travels *T); void GroupTravels(Travels *T); // prototypes from drawmap.c void DrawMap(window *W); void PrintMap(window *W, short PAGE); void *MapHit(mouseclick *M); void MapFocus(window *W); // prototypes from mapwind.c #define MAXMAPWINDS (2) typedef struct { ControlRef slow, // button to shorten time step fast, // button to lengthen time step rwnd, // button to start animation in reverse stop, // button to stop animation play; // button to start animation bool **vis; // map-visibility of Order[] items for timeline filtering spheretask sphere; // information on how much of the sphere is visible in the view } MapInfo; bool IsMapWindow(window *W); bool SeenOnAMap(int i); void MaintainFocus(void); void AdjustMapControlState(window *W, int STATE); void RecordMapPrefs(void); void InitMapViews(void); void AddMapWindow(void); void SwitchToMap(void); // prototypes from twsize.c void InitSizeMenu(void); void SetUpSizeMenu(void); void AdjustSizeMenu(window *W); bool SizeCommand(window *W, UInt32 C); void InitSortMenu(void); void SetUpSortMenu(void); void AdjustSortMenu(window *W); bool SortCommand(window *W, UInt32 C); // prototypes from twfilt.c void InsertFilterMenus(void); void AdjustFilterMenus(void); bool FilterCommand(window *W, UInt32 C); // prototypes from infowind.c #define MAXINFOWINDS (12) typedef struct { void *obj; // (Person *) or (Event *) InfoPara info; // non-GUI-specific data about item's information TXNObject txn; // MLTE object short size; // font size with which the window was last drawn } InfoInfo; void InitInfoViews(void); bool IsInfoWindow(window *W); window *InfoWindOf(void *V); void CloseAllInfo(void); void SwitchToInfo(void); // prototypes from twimage.c #define MAXIMAGEWINDS (12) typedef struct { void *obj; // (Person *) or (Event *) picture pict; // the picture string cap; // caption } ImageInfo; void InitImageViews(void); void CloseAllImages(void); void OpenImage(void *V, Point Pt); // prototypes from drawgen.c #define MAXGENWINDS (4) typedef struct { Person *pers; // the person whose family tree is shown short lastsize; // font size with which the window was last drawn genvars var; // drawing parameters rect total; // rectangle of the complete genealogy, with "pers" at origin bool recalc, // whether the tree needs to be recalculated compr; // whether text is condensed in this view short vert; // vertical scale for this view (0=small; 1=normal; 2=extend) } GenInfo; void ScrollGenToSubject(window *W); void DoGenDrawCalcs(window *W); void GenGrow(window *W); void DrawGen(window *W); short GenPages(window *W, rect R); void PrintGen(window *W, short PAGE); bool GenPDFSize(window *W, rect *R); void GenPDFDraw(window *W); Person *GenHit(mouseclick *M); // prototypes from genwind.c void InitGenViews(void); window *GenWindOf(Person *P); void CloseAllGens(void); void SwitchToGen(void); // prototypes from drawthis.c typedef struct { void *obj; // (Person *) or (Event *) string str; // string describing event short year; // for sorting } ThisItem; typedef struct { short month, // date, // num, // number of events found for that day fit; // number of items that fit in the window ThisItem ***item; // } ThisInfo; void EmptyThisInfo(ThisInfo *D); string TitleString(ThisInfo *D); void DoThisDayCalcs(window *W); void SetThisScrolls(window *W); void DrawThisDay(window *W); void PrintThisDay(window *W, short PAGE); string ThisDayString(ThisInfo *D); void *ThisHit(mouseclick *M); // prototypes from thisday.c #define MAXTHISWINDS (2) void InitThisViews(void); void CloseAllThis(void); void AddThisWindow(void); // prototypes from drawfind.c void DrawFind(window *W); void *FindHit(mouseclick *M); void InitFindInfo(void); void PurgeFindInfo(void); void Find(string S); // prototypes from findwind.c void SetFindScroll(void); void FindIdle(void); void BringFindToFront(void); void InitFindWindow(void); // prototypes from twist.c int StackableWindows(void); int AnimatedWindows(void); bool Highlight(window *W, void *V); void Redisplay(void); void RedisplayAll(void); void SetUpFileMenu(void); void SetUpWindowMenu(void); void AdjustFileMenu(window *W); bool FileCommand(struct window *W, UInt32 C); bool PersonPopup(window *W, point Pt, bool Time, bool Map, bool Info, bool Gen, Person *P); bool EventPopup(window *W, point Pt, bool Time, bool Map, bool Info, Event *E);