chiark / gitweb /
Initial revision
[ssr] / StraySrc / Glass / !Glass / c / wToolbars
1 /*
2  * wToolbars.c
3  *
4  * Handling of the tool and info bars
5  *
6  * © 1994-1998 Straylight
7  */
8
9 /*----- Licensing note ----------------------------------------------------*
10  *
11  * This file is part of Straylight's Glass.
12  *
13  * Glass is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2, or (at your option)
16  * any later version.
17  *
18  * Glass is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with Glass.  If not, write to the Free Software Foundation,
25  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26  */
27
28 /*----- Header files ------------------------------------------------------*/
29
30 /*
31  * ANSI standard headers
32  */
33
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <string.h>
37
38 /*
39  * Steel headers
40  */
41
42 #define _STDAPP
43 #define _LOWLVL
44 #include "steel/Steel.h"
45
46 #include "steel/interface.h"
47 #include "steel/sculptrix.h"
48 #include "steel/buttons.h"
49 #include "steel/caretPtr.h"
50 #include "steel/flex.h"
51 #include "steel/akbd.h"
52 #include "steel/coords.h"
53 #include "steel/pointer.h"
54 #include "steel/bbc.h"
55 #include "steel/colourtran.h"
56 #include "steel/font.h"
57
58 /*
59  * Glass headers
60  */
61
62 #include "gStruct.h"
63 #include "gMenus.h"
64 #include "gIcons.h"
65
66 #include "glass.h"
67 #include "gPrefs.h"
68 #include "tfile.h"
69 #include "window.h"
70 #include "_window.h"
71 #include "intMsgs.h"
72 #include "toolbox.h"
73 #include "editIcon.h"
74 #include "editWin.h"
75 #include "indir.h"
76 #include "align.h"
77 #include "iconData.h"
78 #include "tearEdit.h"
79
80 /*----- Private variables -------------------------------------------------*/
81
82 static dbox window__toolbar;     /* Dialogue box handle for the tool bar   */
83 static dbox window__infobar;     /* Dialogue box handle for the info bar   */
84 static window__infoWidth;        /* The natural width of the info bar      */
85 static window__infoMax;          /* The maximum width of the info bar      */
86 static int window__toolX=98;
87 static int window__toolY=912;
88 static int window__infoX=234;
89 static int window__infoY=260;
90
91 /*----- Main code ---------------------------------------------------------*/
92
93 /*
94  * void window__setToolBarPositions(wimp_openstr *o)
95  *
96  * Use
97  *  Displays the tool and info bars according to current settings etc.
98  *
99  * Parameters
100  *  wimp_openstr *o == the position of the selection owner window, or 0.
101  *    This is updated to put the window somewhere nice without flicker.
102  */
103
104 void window__setToolBarPositions(wimp_openstr *o)
105 {
106   wimp_wstate s;
107   wimp_wstate t;
108   wimp_redrawstr r;
109   int width;
110   int height;
111   int tgap,bgap,lgap,rgap;
112   glass_windPointer *w=window_selectionOwner();
113
114   /* --- More WindowManager cunningness --- *
115    *
116    * When you click on the scroll arrows, the Wimp decides it'd be a good
117    * plan to ask you to open the window behind *itself*.  This gets nobbled
118    * here, and so the whole window frame flickes disgustingly.  We bodge.
119    * We also try to do absolutely nothing if the window isn't going anywhere.
120    */
121
122   if (o &&
123       !wimpt_justChangedMode() &&
124      (o->behind==o->w ||
125        (!memcmp(&o->box,&w->def->desc.w.box,sizeof(wimp_box)) &&
126        o->behind==w->def->desc.w.behind)))
127   {
128     wimpt_noerr(wimp_open_wind(o));
129     return;
130   }
131
132   wimpt_noerr(wimp_get_wind_state(w->h,&t));
133   r.w=t.o.w;
134   wimpt_noerr(wimp_getwindowoutline(&r));
135   lgap=t.o.box.x0-r.box.x0;
136   rgap=r.box.x1-t.o.box.x1;
137   tgap=r.box.y1-t.o.box.y1;
138   bgap=t.o.box.y0-r.box.y0;
139   if (o)
140   {
141     t.o=*o;
142     if (o->behind==-2)
143     {
144       wimpt_noerr(wimp_open_wind(o));
145       wimpt_noerr(wimp_get_wind_state(w->h,&t));
146     }
147   }
148   if (window__infobar && !gPrefs_current()->iFloating)
149   {
150     if (t.o.behind==dbox_syshandle(window__infobar))
151     {
152       wimpt_noerr(wimp_get_wind_state(dbox_syshandle(window__infobar),&s));
153       t.o.behind=s.o.behind;
154     }
155   }
156   if (window__toolbar && !gPrefs_current()->tFloating)
157   {
158     if (t.o.behind==dbox_syshandle(window__toolbar))
159     {
160       wimpt_noerr(wimp_get_wind_state(dbox_syshandle(window__toolbar),&s));
161       t.o.behind=s.o.behind;
162     }
163   }
164   if (t.flags & wimp_WCLICK_TOGGLE && o)
165   {
166     wimpt_noerr(wimp_open_wind(o));
167     wimpt_noerr(wimp_get_wind_state(w->h,&t));
168   }
169
170   if (window__toolbar)
171   {
172     wimpt_noerr(wimp_get_wind_state(dbox_syshandle(window__toolbar),&s));
173     width=s.o.box.x1-s.o.box.x0;
174     height=s.o.box.y1-s.o.box.y0;
175     if (!gPrefs_current()->tFloating)
176     {
177       if (gPrefs_current()->tLeft)
178         s.o.box.x0=gPrefs_current()->tPosn.x-width+t.o.box.x0-lgap;
179       else
180         s.o.box.x0=gPrefs_current()->tPosn.x-width+t.o.box.x1+rgap;
181       s.o.box.x1=s.o.box.x0+width;
182       s.o.box.y1=gPrefs_current()->tPosn.y+t.o.box.y1+tgap-wimpt_dy();
183       s.o.box.y0=s.o.box.y1-height;
184       window__toolX=s.o.box.x1;
185       window__toolY=s.o.box.y1;
186       s.o.behind=t.o.behind;
187       t.o.behind=s.o.w;
188     }
189     else
190     {
191       s.o.box.x0=window__toolX-width;
192       s.o.box.x1=s.o.box.x0+width;
193       s.o.box.y1=window__toolY;
194       s.o.box.y0=s.o.box.y1-height;
195     }
196     win_adjustBox(&s.o);
197     wimpt_noerr(wimp_open_wind(&s.o));
198   }
199   if (window__infobar)
200   {
201     wimpt_noerr(wimp_get_wind_state(dbox_syshandle(window__infobar),&s));
202     height=s.o.box.y1-s.o.box.y0;
203     width=(w->renumber ? window__infoMax : window__infoWidth);
204     if (!gPrefs_current()->iFloating)
205     {
206       s.o.box.x0=gPrefs_current()->iPosn.x+t.o.box.x0-lgap+wimpt_dx();
207       s.o.box.x1=s.o.box.x0+width;
208       if (gPrefs_current()->iUnder)
209         s.o.box.y1=gPrefs_current()->iPosn.y+t.o.box.y0-bgap;
210       else
211         s.o.box.y1=gPrefs_current()->iPosn.y+t.o.box.y1+tgap;
212       s.o.box.y0=s.o.box.y1-height;
213       window__infoX=s.o.box.x0;
214       window__infoY=s.o.box.y1;
215       s.o.behind=t.o.behind;
216       t.o.behind=s.o.w;
217     }
218     else
219     {
220       s.o.box.x0=window__infoX;
221       s.o.box.x1=s.o.box.x0+width;
222       s.o.box.y1=window__infoY;
223       s.o.box.y0=s.o.box.y1-height;
224     }
225     win_adjustBox(&s.o);
226     wimpt_noerr(wimp_open_wind(&s.o));
227   }
228   if (o)
229   {
230     o->behind=t.o.behind;
231     wimpt_noerr(wimp_open_wind(o));
232   }
233 }
234
235 /*
236  * void window__updateInfoBar(void)
237  *
238  * Use
239  *  Updates the settings on the info bar.  If a setting hasn't changed, then
240  *  it isn't updated (reducing flicker).
241  *
242  * Parameters
243  *  BOOL force == whether to force an update of everything.
244  */
245
246 void window__updateInfoBar(BOOL force)
247 {
248   static int ox=-1;
249   static int oy=-1;
250   static glass_windPointer *ow;
251   static int oi=-2;
252   static int orenum=-1;
253   int x,y;
254   int ni;
255   glass_windPointer *wso=window_selectionOwner();
256   wimp_mousestr m;
257   unused(orenum);
258
259   if (force)
260   {
261     ox=-1;
262     oy=-1;
263     ow=0;
264     oi=-2;
265     orenum=-1;
266   }
267   if (!window__infobar)
268     return;
269   if (wso!=ow)
270     dbox_setfield(window__infobar,glass_IBWIND,"%s",wso->id);
271   ow=wso;
272   wimpt_noerr(wimp_get_point_info(&m));
273   x=ow->def->desc.w.box.x0-ow->def->desc.w.scx;
274   y=ow->def->desc.w.box.y1-ow->def->desc.w.scy;
275   m.x-=x;
276   m.y-=y;
277   if (m.w!=ow->h || m.i<-1)
278   {
279     m.x=-3;
280     m.y=-3;
281   }
282   if (m.x!=ox)
283   {
284     switch (m.x)
285     {
286       case -3:
287         dbox_setfield(window__infobar,glass_IBX,"");
288         break;
289       default:
290         dbox_setfield(window__infobar,glass_IBX,"%i",m.x);
291         break;
292     }
293   }
294   if (m.y!=oy)
295   {
296     switch (m.y)
297     {
298       case -3:
299         dbox_setfield(window__infobar,glass_IBY,"");
300         break;
301       default:
302         dbox_setfield(window__infobar,glass_IBY,"%i",m.y);
303         break;
304     }
305   }
306   ox=m.x;
307   oy=m.y;
308   if (m.x==-3)
309     ni=-3;
310 #ifndef glass_DEMO
311   else if (wso->testMode)
312     ni=m.i;
313 #endif
314   else
315   {
316     ni=window__pointerInfo(ow,-1,FALSE);
317     if (ni & window__ZONEMASK)
318       ni=-1;
319   }
320   if (ni!=oi)
321   {
322     switch (ni)
323     {
324       case -3:
325         dbox_setfield(window__infobar,glass_IBICON,"");
326         break;
327       case -1:
328         dbox_setfield(window__infobar,glass_IBICON,msgs_lookup("wdBACKG"));
329         break;
330       default:
331         dbox_setfield(window__infobar,glass_IBICON,"%i",ni);
332         break;
333     }
334     oi=ni;
335   }
336 }
337
338 /*
339  * BOOL window__toolRaw(dbox d,wimp_eventstr *e,void *handle)
340  *
341  * Use
342  *  Handles odd events for tool and info boxes (mainly moves - getting the
343  *  positioning right, updating the preferences entries and so on).
344  *
345  * Parameters
346  *  dbox d == the dialogue box handle
347  *  wimp_eventstr *e == the event that happened
348  *  void *handle == a pointer (ignored)
349  *
350  * Returns
351  *  TRUE if the event has been processed.
352  */
353
354 static BOOL window__toolRaw(dbox d,wimp_eventstr *e,void *handle)
355 {
356   BOOL handled=FALSE;
357   wimp_wstate s;
358   wimp_wstate t;
359   wimp_redrawstr r;
360   int tgap,bgap,lgap,rgap;
361   BOOL more;
362   glass_windPointer *wso=window_selectionOwner();
363   unused(handle);
364
365   switch (e->e)
366   {
367     case wimp_EREDRAW:
368       if (d==window__infobar)
369       {
370         r.w=e->data.o.w;
371         wimpt_noerr(wimp_redraw_wind(&r,&more));
372         while (more)
373         {
374           wimp_setcolour(0x81);
375           bbc_clg();
376           sculptrix_redrawWindow(&r);
377           wimpt_noerr(wimp_get_rectangle(&r,&more));
378         }
379         handled=TRUE;
380       }
381       break;
382     case wimp_EOPEN:
383       if (wimpt_justChangedMode()) /* We've already moved them with the */
384       {                            /* main window, so the WIMP just messes */
385         handled=TRUE;              /* it all up */
386         break;
387       }
388       win_adjustBox(&e->data.o);
389       wimpt_noerr(wimp_get_wind_state(wso->h,&s));
390       r.w=s.o.w;
391       wimpt_noerr(wimp_getwindowoutline(&r));
392       lgap=s.o.box.x0-r.box.x0;
393       rgap=r.box.x1-s.o.box.x1;
394       tgap=r.box.y1-s.o.box.y1;
395       bgap=s.o.box.y0-r.box.y0;
396       wimpt_noerr(wimp_get_wind_state(e->data.o.w,&t));
397       if (d==window__toolbar)
398       {
399         if (!gPrefs_current()->tFloating)
400         {
401           gPrefs_current()->tLeft=abs(e->data.o.box.x1-s.o.box.x0)<
402                                    abs(e->data.o.box.x0-s.o.box.x1);
403           if (gPrefs_current()->tLeft)
404             gPrefs_current()->tPosn.x=e->data.o.box.x1-s.o.box.x0+lgap;
405           else
406             gPrefs_current()->tPosn.x=e->data.o.box.x1-s.o.box.x1-rgap;
407           gPrefs_current()->tPosn.y=e->data.o.box.y1-s.o.box.y1-tgap+
408                                                                   wimpt_dy();
409           e->data.o.behind=t.o.behind;
410         }
411         window__toolX=e->data.o.box.x1;
412         window__toolY=e->data.o.box.y1;
413       }
414       else if (d==window__infobar)
415       {
416         if (!gPrefs_current()->iFloating)
417         {
418           gPrefs_current()->iUnder=abs(e->data.o.box.y1-s.o.box.y0)<
419                                     abs(e->data.o.box.y0-s.o.box.y1);
420           gPrefs_current()->iPosn.x=e->data.o.box.x0-s.o.box.x0;
421           if (gPrefs_current()->iUnder)
422             gPrefs_current()->iPosn.y=e->data.o.box.y1-s.o.box.y0+bgap;
423           else
424             gPrefs_current()->iPosn.y=e->data.o.box.y1-s.o.box.y1-tgap;
425           e->data.o.behind=t.o.behind;
426         }
427         window__infoX=e->data.o.box.x0;
428         window__infoY=e->data.o.box.y1;
429       }
430       wimpt_noerr(wimp_open_wind(&e->data.o));
431       handled=TRUE;
432       break;
433   }
434   return (handled);
435 }
436
437 /*
438  * void window__infoEvents(dbox d,dbox_field f,void *handle)
439  *
440  * Use
441  *  Handles events on the info bar.
442  *
443  * Parameters
444  *  dbox d == the dialogue box handle
445  *  dbox_field f == the event that happened
446  *  void *handle == a pointer (ignored)
447  */
448
449 static void window__infoEvents(dbox d,dbox_field f,void *handle)
450 {
451   wimp_dragstr dr;
452 #ifndef glass_DEMO
453   glass_windPointer *wso=window_selectionOwner();
454 #endif
455   unused(handle);
456
457   switch (f)
458   {
459     case glass_IBDRAG:
460       dr.window=dbox_syshandle(d);
461       dr.type=wimp_MOVE_WIND;
462       wimp_drag_box(&dr);
463       break;
464   #ifndef glass_DEMO
465     case glass_IBEDIT:
466       if (wso->testMode)
467         window__simMenu(wso,glass_TWMISC,glass_TWMTEST);
468       break;
469     case glass_IBTEST:
470       if (!wso->testMode)
471         window__simMenu(wso,glass_TWMISC,glass_TWMTEST);
472       break;
473   #endif
474     case dbox_HELP:
475       help_startHelp();
476       help_addLine(msgs_lookup("wdhIB"));
477       help_readFromIcon();
478       help_endHelp();
479       break;
480   }
481 }
482
483 /*
484  * void window__toolEvents(dbox d,dbox_field f,void *handle)
485  *
486  * Use
487  *  Handles events on the tool bar.
488  *
489  * Parameters
490  *  dbox d == the dialogue box handle
491  *  dbox_field f == the event that happened
492  *  void *handle == a pointer (ignored)
493  */
494
495 static void window__toolEvents(dbox d,dbox_field f,void *handle)
496 {
497   wimp_dragstr dr;
498   glass_windPointer *wso=window_selectionOwner();
499   static int hit1[]=
500   {
501     0,
502     glass_TWMISC,
503     glass_TWICON,
504     glass_TWSELECT,
505     glass_TWSELECT,
506     glass_TWMISC,
507     glass_TWSELECT,
508     glass_TWSELECT,
509   };
510   static int hit2[]=
511   {
512     0,
513     glass_TWMCLOSE,
514     glass_TWINEW,
515     glass_TWSDEL,
516     glass_TWSCOPY,
517     glass_TWMEDITWIN,
518     glass_TWSEDIT,
519     glass_TWSORDER,
520   };
521   unused(handle);
522
523   switch (f)
524   {
525     case glass_TBDRAG:
526       dr.window=dbox_syshandle(d);
527       dr.type=wimp_MOVE_WIND;
528       wimp_drag_box(&dr);
529       break;
530     case dbox_HELP:
531       help_startHelp();
532       help_addLine(msgs_lookup("wdhTB"));
533       help_readFromIcon();
534       help_endHelp();
535       break;
536     default:
537       if (f>=0 && f<=(sizeof(hit1)/sizeof(int)))
538       {
539         dbox_clickicon(d,f);
540         window__simMenu(wso,hit1[f],hit2[f]);
541         dbox_unclick();
542       }
543       break;
544   }
545 }
546
547 /*
548  * void window_updateToolbar(void)
549  *
550  * Use
551  *  Updates the display of toolbars as necessary in line with new
552  *  Preferences settings.  It is assumed that Preferences is intelligent
553  *  enough to only call this if something actually needs to be done!
554  */
555
556 void window_updateToolbar(void)
557 {
558   glass_windPointer *wso=window_selectionOwner();
559   if (!wso)         /* Nothing doing if no current window     */
560     return;
561   if (gPrefs_current()->tDisplay)
562   {
563     if (!window__toolbar)
564     {
565       window__toolbar=dbox_create("toolbar");
566       if (window__toolbar)
567       {
568         dbox_eventHandler(window__toolbar,window__toolEvents,0);
569         dbox_rawEventHandler(window__toolbar,window__toolRaw,0);
570       }
571     }
572   }
573   else
574   {
575     if (window__toolbar)
576       dbox_delete(window__toolbar);
577     window__toolbar=0;
578   }
579   if (gPrefs_current()->iDisplay)
580   {
581     if (!window__infobar)
582     {
583       window__infobar=dbox_create("infobar");
584       if (window__infobar)
585       {
586         dbox_eventHandler(window__infobar,window__infoEvents,0);
587         dbox_rawEventHandler(window__infobar,window__toolRaw,0);
588       #ifdef glass_DEMO
589         dbox_shadeicon(window__infobar,glass_IBEDIT,TRUE);
590         dbox_shadeicon(window__infobar,glass_IBTEST,TRUE);
591         dbox_selecticon(window__infobar,glass_IBEDIT,TRUE);
592         dbox_selecticon(window__infobar,glass_IBTEST,FALSE);
593       #else
594         dbox_selecticon(window__infobar,glass_IBEDIT,!wso->testMode);
595         dbox_selecticon(window__infobar, glass_IBTEST,wso->testMode);
596         dbox_shadeicon(window__infobar,glass_IBEDIT,wso->renumber);
597         dbox_shadeicon(window__infobar,glass_IBTEST,wso->renumber);
598       #endif
599         if (wso->renumber)
600         {
601           dbox_setfield(window__infobar,
602                         glass_IBRENUM,"%i",
603                         window__lowestSelected(wso));
604         }
605       }
606     }
607     window__updateInfoBar(TRUE);
608   }
609   else
610   {
611     if (window__infobar)
612       dbox_delete(window__infobar);
613     window__infobar=0;
614   }
615   window__setToolBarPositions(0);
616 }
617
618 /*
619  * void window__toggleRenumber(glass_windPointer *w)
620  *
621  * Use
622  *  Updates the info bar after entering or leaving renumber-mode.  w is
623  *  the currently selected window.
624  */
625
626 void window__toggleRenumber(glass_windPointer *w)
627 {
628   if (window__infobar)
629   {
630     if (w->renumber)
631     {
632       dbox_setfield(window__infobar,
633                     glass_IBRENUM,
634                     "%i",
635                     window__lowestSelected(w));
636     }
637
638   #ifndef glass_DEMO
639     dbox_shadeicon(window__infobar,glass_IBEDIT,w->renumber);
640     dbox_shadeicon(window__infobar,glass_IBTEST,w->renumber);
641   #else
642     dbox_shadeicon(window__infobar,glass_IBEDIT,TRUE);
643     dbox_shadeicon(window__infobar,glass_IBTEST,TRUE);
644   #endif
645
646     window__setToolBarPositions(0);
647   }
648 }
649
650 /*
651  * void window__toggleTest(glass_windPointer *w)
652  *
653  * Use
654  *  Updates the info bar after entering or leaving test-mode.  w is the
655  *  currently selected window.
656  */
657
658 #ifndef glass_DEMO
659 void window__toggleTest(glass_windPointer *w)
660 {
661   if (window__infobar)
662   {
663     dbox_selecticon(window__infobar,glass_IBEDIT,!w->testMode);
664     dbox_selecticon(window__infobar,glass_IBTEST,w->testMode);
665   }
666 }
667 #endif
668
669 /*
670  * void window__updateInfoName(char *newname)
671  *
672  * Use
673  *  Updates the name in the info bar
674  */
675
676 void window__updateInfoName(char *newname)
677 {
678   if (window__infobar)
679     dbox_setfield(window__infobar,glass_IBWIND,"%s",newname);
680 }
681
682 /*
683  * void window__nextRenumber(glass_windPointer *w)
684  *
685  * Use
686  *  Updates the next renumber icon number display.
687  */
688
689 void window__nextRenumber(glass_windPointer *w)
690 {
691   if (window__infobar)
692   {
693     dbox_setfield(window__infobar,glass_IBRENUM,"%i",
694                   window__lowestSelected(w));
695   }
696 }
697
698 /*
699  * void window__moveToolbars(glass_windPointer *w)
700  *
701  * Use
702  *  Moves the toolbars and attaches them to a new window
703  *
704  * Parameters
705  *  glass_windPointer *w == the window to attach the bars to
706  */
707
708 void window__moveToolbars(glass_windPointer *w)
709 {
710   if (w)
711   {
712     if (!window__toolbar && gPrefs_current()->tDisplay)
713     {
714       window__toolbar=dbox_create("toolbar");
715       if (window__toolbar)
716       {
717         dbox_eventHandler(window__toolbar,window__toolEvents,0);
718         dbox_rawEventHandler(window__toolbar,window__toolRaw,0);
719       }
720     }
721     if (!window__infobar && gPrefs_current()->iDisplay)
722     {
723       window__infobar=dbox_create("infobar");
724       if (window__infobar)
725       {
726         dbox_eventHandler(window__infobar,window__infoEvents,0);
727         dbox_rawEventHandler(window__infobar,window__toolRaw,0);
728       }
729     }
730     window__updateInfoBar(TRUE);
731     window__setToolBarPositions(0);
732     if (window__infobar)
733     {
734     #ifdef glass_DEMO
735       dbox_shadeicon(window__infobar,glass_IBEDIT,TRUE);
736       dbox_shadeicon(window__infobar,glass_IBTEST,TRUE);
737       dbox_selecticon(window__infobar,glass_IBEDIT,TRUE);
738       dbox_selecticon(window__infobar,glass_IBTEST,FALSE);
739     #else
740       dbox_selecticon(window__infobar,glass_IBEDIT,!w->testMode);
741       dbox_selecticon(window__infobar,glass_IBTEST,w->testMode);
742       dbox_shadeicon(window__infobar,glass_IBEDIT,w->renumber);
743       dbox_shadeicon(window__infobar,glass_IBTEST,w->renumber);
744     #endif
745       if (w->renumber)
746       {
747         dbox_setfield(window__infobar,
748                       glass_IBRENUM,
749                       "%i",
750                       window__lowestSelected(w));
751       }
752     }
753   }
754   else
755   {
756     if (window__toolbar)
757       dbox_delete(window__toolbar);
758     if (window__infobar)
759       dbox_delete(window__infobar);
760     window__toolbar=0;
761     window__infobar=0;
762   }
763 }
764
765 /*
766  * void window__tbarInit(void)
767  *
768  * Use
769  *  Initialises the toolbar system
770  */
771
772 void window__tbarInit(void)
773 {
774   wimp_wind *wdef;
775   wdef=&template_find("infobar")->window;
776   window__infoWidth=wdef->box.x1-wdef->box.x0;
777   window__infoMax=wdef->ex.x1-wdef->ex.x0;
778 }