4 * Edit icon dialogue box
6 * © 1994-1998 Straylight
9 /*----- Licensing note ----------------------------------------------------*
11 * This file is part of Straylight's Glass.
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)
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.
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.
28 /*----- Header files ------------------------------------------------------*/
31 * ANSI standard headers
44 #include "steel/Steel.h"
46 #include "steel/buttons.h"
47 #include "steel/fontMenu.h"
48 #include "steel/akbd.h"
49 #include "steel/bbc.h"
50 #include "steel/buffer.h"
51 #include "steel/font.h"
66 #include "colSelect.h"
70 /*----- Static variables --------------------------------------------------*/
72 static char *editIcon__panels[]=
82 /*----- Support routines --------------------------------------------------*/
84 #define max2(a,b) ((a)>(b) ? (a) : (b))
85 #define min2(a,b) ((a)<(b) ? (a) : (b))
88 * void editIcon__setupPanel(glass_editIcon *ed)
91 * Sets up a panel from the icon description given.
94 * glass_editIcon *ed == the edit to handle.
97 static void editIcon__setupPanel(glass_editIcon *ed)
104 dbox_setfield(ed->e.pd,glass_EIDVALSTRING,"%s",ed->valid);
105 dbox_setfield(ed->e.pd,glass_EIDDATA,"%s",ed->data);
106 if (!(ed->idef.flags&3))
108 dbox_shadeicon(ed->e.pd,glass_EIDINDIR,TRUE);
109 dbox_shadeicon(ed->e.pd,glass_EIDDATA,TRUE);
110 dbox_selecticon(ed->e.pd,glass_EIDINDIR,FALSE);
111 dbox_selecticon(ed->e.pd,glass_EIDVALID,FALSE);
112 dbox_shadeicon(ed->e.pd,glass_EIDVALSTRING,TRUE);
113 dbox_shadeicon(ed->e.pd,glass_EIDVALID,TRUE);
114 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,TRUE);
115 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,TRUE);
116 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,TRUE);
117 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,TRUE);
118 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,TRUE);
119 dbox_setfield(ed->e.pd,glass_EIDINDSIZE,"%i",12);
121 else if (ed->idef.flags & wimp_INDIRECT)
123 dbox_shadeicon(ed->e.pd,glass_EIDINDIR,FALSE);
124 dbox_shadeicon(ed->e.pd,glass_EIDDATA,FALSE);
125 dbox_selecticon(ed->e.pd,glass_EIDINDIR,TRUE);
126 dbox_selecticon(ed->e.pd,glass_EIDVALID,ed->hasValid);
127 dbox_shadeicon(ed->e.pd,glass_EIDVALSTRING,!ed->hasValid);
128 dbox_shadeicon(ed->e.pd,glass_EIDVALID,
129 !(ed->idef.flags&wimp_ITEXT));
130 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,FALSE);
131 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,FALSE);
132 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,FALSE);
133 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,FALSE);
134 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,FALSE);
135 dbox_setfield(ed->e.pd,glass_EIDINDSIZE,"%i",ed->indLen);
139 dbox_shadeicon(ed->e.pd,glass_EIDINDIR,FALSE);
140 dbox_shadeicon(ed->e.pd,glass_EIDDATA,FALSE);
141 dbox_selecticon(ed->e.pd,glass_EIDINDIR,FALSE);
142 dbox_selecticon(ed->e.pd,glass_EIDVALID,FALSE);
143 dbox_shadeicon(ed->e.pd,glass_EIDVALSTRING,TRUE);
144 dbox_shadeicon(ed->e.pd,glass_EIDVALID,TRUE);
145 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,TRUE);
146 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,TRUE);
147 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,TRUE);
148 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,TRUE);
149 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,TRUE);
150 dbox_setfield(ed->e.pd,glass_EIDINDSIZE,"%i",12);
152 dbox_selecticon(ed->e.pd,glass_EIDTEXT,
153 !!(ed->idef.flags&wimp_ITEXT));
154 dbox_selecticon(ed->e.pd,glass_EIDSPRITE,
155 !!(ed->idef.flags&wimp_ISPRITE));
157 case glass_EIAPPEARANCE:
158 dbox_setfield(ed->e.pd,glass_EIAFONTNAME,"%.%s",ed->font);
159 dbox_setfield(ed->e.pd,glass_EIAFSIZEWRITE,"%i",ed->fontSize);
160 if (ed->idef.flags & wimp_ITEXT)
162 if (ed->idef.flags & wimp_IFONT)
164 dbox_selecticon(ed->e.pd,glass_EIAFONT,TRUE);
165 dbox_shadeicon(ed->e.pd,glass_EIAFONTNAME,FALSE);
166 dbox_shadeicon(ed->e.pd,glass_EIAFONTMENU,FALSE);
167 dbox_shadeicon(ed->e.pd,glass_EIAFONT,FALSE);
168 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEUP,FALSE);
169 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEDOWN,FALSE);
170 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEWRITE,FALSE);
174 dbox_selecticon(ed->e.pd,glass_EIAFONT,FALSE);
175 dbox_shadeicon(ed->e.pd,glass_EIAFONT,FALSE);
176 dbox_shadeicon(ed->e.pd,glass_EIAFONTNAME,TRUE);
177 dbox_shadeicon(ed->e.pd,glass_EIAFONTMENU,TRUE);
178 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEUP,TRUE);
179 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEDOWN,TRUE);
180 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEWRITE,TRUE);
185 dbox_selecticon(ed->e.pd,glass_EIAFONT,FALSE);
186 dbox_shadeicon(ed->e.pd,glass_EIAFONT,TRUE);
187 dbox_shadeicon(ed->e.pd,glass_EIAFONTNAME,TRUE);
188 dbox_shadeicon(ed->e.pd,glass_EIAFONTMENU,TRUE);
189 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEUP,TRUE);
190 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEDOWN,TRUE);
191 dbox_shadeicon(ed->e.pd,glass_EIAFSIZEWRITE,TRUE);
193 dbox_selecticon(ed->e.pd,glass_EIAHCENTRE,
194 !!(ed->idef.flags & wimp_IHCENTRE));
195 dbox_selecticon(ed->e.pd,glass_EIAVCENTRE,
196 !!(ed->idef.flags & wimp_IVCENTRE));
197 dbox_selecticon(ed->e.pd,glass_EIARALIGN,
198 !!(ed->idef.flags & wimp_IRJUST));
199 dbox_selecticon(ed->e.pd,glass_EIABORDER,
200 !!(ed->idef.flags & wimp_IBORDER));
201 dbox_selecticon(ed->e.pd,glass_EIAFILL,
202 !!(ed->idef.flags & wimp_IFILLED));
203 if (ed->idef.flags & wimp_ISPRITE)
205 dbox_selecticon(ed->e.pd,glass_EIAHALFSIZE,
206 !!(ed->idef.flags & wimp_IHALVESPRITE));
207 dbox_shadeicon(ed->e.pd,glass_EIAHALFSIZE,FALSE);
211 dbox_selecticon(ed->e.pd,glass_EIAHALFSIZE,FALSE);
212 dbox_shadeicon(ed->e.pd,glass_EIAHALFSIZE,TRUE);
214 dbox_selecticon(ed->e.pd,glass_EIANEEDSHELP,
215 !!(ed->idef.flags & wimp_IREDRAW));
217 case glass_EIACTIONS:
219 sprintf(p,"eiBTYPE%i",(ed->idef.flags>>12) & 0x0f);
220 dbox_setfield(ed->e.pd,glass_EIABTYPE,"%s",msgs_lookup(p));
221 dbox_setfield(ed->e.pd,glass_EIAESGWRITE,"%i",
222 (ed->idef.flags>>16) & 0x1f);
223 dbox_selecticon(ed->e.pd,glass_EIAADJUST,
224 !!(ed->idef.flags & wimp_IESG_NOC));
225 dbox_selecticon(ed->e.pd,glass_EIASELECT,
226 !!(ed->idef.flags & wimp_ISELECTED));
227 dbox_selecticon(ed->e.pd,glass_EIASHADE,
228 !!(ed->idef.flags & wimp_INOSELECT));
230 case glass_EICOLOURS:
231 colSelect_setColourButton(ed->e.pd,glass_EICFORE,
232 (ed->idef.flags>>24) & 15);
233 colSelect_setColourButton(ed->e.pd,glass_EICBACK,
234 (ed->idef.flags>>28) & 15);
237 dbox_setfield(ed->e.pd,
240 ed->idef.box.x1-ed->idef.box.x0,
241 ed->idef.box.y1-ed->idef.box.y0);
242 dbox_shadeicon(ed->e.pd,glass_EIPSETSIZE,!(ed->idef.flags & 3));
244 case glass_EIPOSITION:
245 dbox_setfield(ed->e.pd,
255 * BOOL editIcon__getSpriteSize(char *name,sprite_area *a,int *x,int *y)
258 * Attempts to read the size of a sprite in OS units.
261 * TRUE if it really worked
264 static BOOL editIcon__getSpriteSize(char *name,sprite_area *a,int *x,int *y)
269 /* --- First look in the given area --- */
271 e=os_swivr(OS_SpriteOp,&r,40+256,a,name);
273 /* --- Now, OS version permitting, look in the WIMP area --- */
275 if (e && wimpt_getVersion()>=300)
276 e=os_swivr(Wimp_SpriteOp,&r,40,0,name);
278 /* --- If it worked, read out all the info and return it --- */
282 *x=r.r[3]<<bbc_modevar(r.r[6],bbc_XEigFactor);
283 *y=r.r[4]<<bbc_modevar(r.r[6],bbc_YEigFactor);
286 /* --- Return the success value --- */
292 * void editIcon__setSize(glass_editIcon *ed)
295 * Reads the size of the icon correctly from the definition, assuming
298 * 1. The icon isn't word-wrapped
299 * 2. Both selected and unselected versions of the sprite to use are the
301 * 3. Size is independent of things like button type
304 static void editIcon__setSize(glass_editIcon *ed)
309 static int posns[]={1,1,2,2,1,1,3,2};
313 /* --- Read the current width and height from dbox --- */
315 dbox_scanfield(ed->e.pd,glass_EIPWRITE,"%d,%d",&w,&h);
317 /* --- Find out if this is going to be easy --- */
319 switch (ed->idef.flags & 3)
321 /* --- No icon data -- ignore this operation --- */
326 /* --- Only text -- work it out (assuming system font size) --- */
330 w=16*(strlen(ed->data)+1);
333 /* --- Only a sprite -- use the size of the sprite --- */
336 if (!editIcon__getSpriteSize(ed->data,ed->w->t->s,&w,&h))
337 note(msgs_lookup("eiSPRGONE"),ed->data);
340 /* --- Text and sprite together --- */
345 if ((ed->idef.flags & 0x100) && ed->hasValid)
347 /* --- Parse the validation string to find the sprite name --- */
353 for (;*p>31 && state!=3;p++)
413 if (editIcon__getSpriteSize(sprname,ed->w->t->s,&sw,&sh))
418 w=16*(strlen(ed->data)+1);
420 f=posns[(tst(ed->idef.flags,3)<<2) |
421 (tst(ed->idef.flags,4)<<1) |
422 (tst(ed->idef.flags,9)<<0)];
441 note(msgs_lookup("eiSPRGONE"),sprname);
445 dbox_setfield(ed->e.pd,glass_EIPWRITE,"%i,%i",w,h);
449 * void editIcon__closePanel(glass_editIcon *ed)
452 * Records the settings in a panel for future reference, for example when
453 * the panel is being replaced by a different one.
456 * glass_editIcon *ed == the edit box we're talking about
459 #define Q dbox_READSTATE
461 static void editIcon__closePanel(glass_editIcon *ed)
468 dbox_getfield(ed->e.pd,glass_EIDDATA,ed->data,256);
469 dbox_getfield(ed->e.pd,glass_EIDVALSTRING,ed->valid,256);
470 dbox_scanfield(ed->e.pd,glass_EIDINDSIZE,"%d",&ed->indLen);
471 ed->hasValid=dbox_selecticon(ed->e.pd,glass_EIDVALID,Q);
472 ed->idef.flags&=~0x00000103;
473 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIDTEXT,Q)<<0;
474 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIDSPRITE,Q)<<1;
475 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIDINDIR,Q)<<8;
477 case glass_EIAPPEARANCE:
478 ed->idef.flags&=~0x00000afc;
479 dbox_scanfield(ed->e.pd,glass_EIAFSIZEWRITE,"%d",&ed->fontSize);
480 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIAHCENTRE,Q)<<3;
481 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIAVCENTRE,Q)<<4;
482 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIABORDER,Q)<<2;
483 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIAFILL,Q)<<5;
484 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIAFONT,Q)<<6;
485 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIANEEDSHELP,Q)<<7;
486 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIARALIGN,Q)<<9;
487 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIAHALFSIZE,Q)<<11;
489 case glass_EIACTIONS:
490 ed->idef.flags&=~0x007f0400;
491 dbox_scanfield(ed->e.pd,glass_EIAESGWRITE,"%d",&esg);
492 ed->idef.flags|=esg<<16;
493 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIAADJUST,Q)<<10;
494 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIASELECT,Q)<<21;
495 ed->idef.flags|=dbox_selecticon(ed->e.pd,glass_EIASHADE,Q)<<22;
498 dbox_scanfield(ed->e.pd,glass_EIPWRITE,"%d,%d",&x,&y);
499 ed->idef.box.x1=ed->idef.box.x0+x;
500 ed->idef.box.y1=ed->idef.box.y0+y;
502 case glass_EIPOSITION:
503 dbox_scanfield(ed->e.pd,glass_EIPWRITE,"%d,%d",&x,&y);
504 ed->idef.box.x1+=x-ed->idef.box.x0;
505 ed->idef.box.y1+=y-ed->idef.box.y0;
515 * void editIcon__setPanel(glass_editIcon *ed,dbox_field f)
518 * Creates a new panel based on a radio button click or some-such.
521 * glass_editIcon *ed == the edit window to change panel
522 * dbox_field f == the radio button associated with the desired panel
525 static void editIcon__panelHandler(dbox d,dbox_field f,void *handle);
526 static BOOL editIcon__panelRaw(dbox d,wimp_eventstr *e,void *handle);
528 static void editIcon__setPanel(glass_editIcon *ed,dbox_field f)
540 editIcon__closePanel(ed);
541 wimpt_noerr(wimp_get_wind_state(dbox_syshandle(ed->e.d),&s));
542 wimpt_noerr(wimp_get_icon_info(dbox_syshandle(ed->e.d),
546 mem_useUser(indir_alloc,indir_free);
548 d=dbox_create("iconNowt");
550 d=dbox_create(editIcon__panels[f-glass_EIDATA]);
556 dbox_eventHandler(d,editIcon__panelHandler,ed);
557 dbox_rawEventHandler(d,editIcon__panelRaw,ed);
560 wimpt_noerr(wimp_get_caret_pos(&c));
561 ownCaret=(c.w==dbox_syshandle(ed->e.pd));
562 dbox_selecticon(ed->e.d,ed->e.panel,dbox_RESETSTATE);
563 wimpt_noerr(wimp_get_wind_state(dbox_syshandle(ed->e.pd),&s));
564 pane_removePane(ed->e.p,dbox_syshandle(ed->e.pd));
565 dbox_delete(ed->e.pd);
567 dbox_selecticon(ed->e.d,f,dbox_SETSTATE);
569 wimpt_noerr(wimp_get_wind_state(dbox_syshandle(d),&s));
570 width=s.o.box.x1-s.o.box.x0;
571 height=s.o.box.y1-s.o.box.y0;
572 s.o.box.x0=i.box.x0+ox+wimpt_dx();
573 s.o.box.y0=i.box.y0+oy+wimpt_dy();
574 s.o.box.x1=s.o.box.x0+width;
575 s.o.box.y1=s.o.box.y0+height;
580 editIcon__setupPanel(ed);
581 wimpt_noerr(wimp_open_wind(&s.o));
584 c.w=dbox_syshandle(d);
589 wimpt_noerr(wimp_set_caret_pos(&c));
591 pane_addPane(ed->e.p,dbox_syshandle(d));
596 * void editIcon__recreate(glass_editIcon *ed)
599 * Recreates the icon from the dialogue box settings
602 * glass_editIcon *ed == info about the edit
605 static void editIcon__recreate(glass_editIcon *ed)
611 ed->w->def->i[ed->i].edit=0; /* Delink temporarily */
612 window_redrawIcon(ed->w,ed->i); /* Force redraw of old icon */
614 if (!(ed->idef.flags & wimp_INDIRECT))
619 if (strlen(ed->data)>=ed->indLen)
621 ed->idef.flags|=wimp_INDIRECT;
622 ed->indLen=strlen(ed->data)+1;
624 if (ed->idef.flags & wimp_INDIRECT)
626 if (p=indir_alloc(ed->indLen),!p)
628 werr(FALSE,msgs_lookup("eiNEMUI"));
631 if (ed->hasValid && (ed->idef.flags & wimp_ITEXT))
633 if (q=indir_alloc(strlen(ed->valid)+1),!q)
636 werr(FALSE,msgs_lookup("eiNEMUI"));
640 ed->w->size+=strlen(ed->valid)+1;
643 ed->w->size+=ed->indLen;
646 if (ed->w->def->i[ed->i].i.flags & wimp_IFONT) /* Was old anti? */
648 fhandle=(ed->w->def->i[ed->i].i.flags >> 24) & 255;
649 wimpt_noerr(font_lose(fhandle));
650 ed->w->fonts[fhandle]--;
652 if (ed->idef.flags & wimp_IFONT) /* Is new icon antialiased? */
654 if (font_find(ed->font,ed->fontSize*16,ed->fontSize*16,0,0,&fhandle))
656 werr(FALSE,msgs_lookup("eiCFF"),ed->font);
657 ed->idef.flags&=~wimp_IFONT;
661 ed->w->antiAliased=TRUE;
662 ed->w->fonts[fhandle]++;
663 ed->idef.flags=(ed->idef.flags & 0x00ffffff) | (fhandle<<24);
667 if (ed->w->def->i[ed->i].i.flags & wimp_INDIRECT)
669 indir_free(ed->w->def->i[ed->i].i.data.indirecttext.buffer);
670 ed->w->size-=ed->w->def->i[ed->i].i.data.indirecttext.bufflen;
671 if ((ed->w->def->i[ed->i].i.flags & wimp_ITEXT) &&
672 (ed->w->def->i[ed->i].i.data.indirecttext.validstring!=(char *)-1))
674 utils_ctermToNterm(ed->w->def->i[ed->i].
675 i.data.indirecttext.validstring);
677 strlen(ed->w->def->i[ed->i].i.data.indirecttext.validstring)+1;
678 indir_free(ed->w->def->i[ed->i].i.data.indirecttext.validstring);
684 ed->idef.data.indirecttext.buffer=p;
685 ed->idef.data.indirecttext.bufflen=ed->indLen;
687 ed->idef.data.indirecttext.validstring=q;
688 else if (ed->idef.flags & wimp_ITEXT)
689 ed->idef.data.indirecttext.validstring=(char *)-1;
691 ed->idef.data.indirectsprite.spritearea=ed->w->t->s;
694 memcpy(ed->idef.data.text,ed->data,12);
696 ed->w->def->i[ed->i].i=ed->idef;
697 dbox_scanfield(ed->e.d,glass_EINUMWRITE,"%d",&inum);
698 if (!window_renumber(ed->w,ed->i,inum))
699 dbox_setfield(ed->e.d,glass_EINUMWRITE,"%i",ed->i);
703 window_redrawIcon(ed->w,ed->i); /* Force redraw of new icon */
704 ed->w->def->i[ed->i].edit=ed; /* Relink again */
705 tfile_markAsAltered(ed->w->t);
709 * void editIcon__nextPanel(glass_editIcon *ed,int dir)
712 * Changes panel to the next one in the given direction. Skips shaded
713 * panels and handles everything nicely.
716 * glass_editIcon *ed == the edit dialogue box to move about in
717 * int dir == the direction (-1 for up, 1 for down)
720 static void editIcon__nextPanel(glass_editIcon *ed,int dir)
725 i=(dir==1 ? glass_EIDATA : glass_EISIZE);
729 for (;i>=glass_EIDATA && i<=glass_EISIZE;i+=dir)
731 if (!dbox_shadeicon(ed->e.d,i,dbox_READSTATE))
733 editIcon__setPanel(ed,i);
739 /*----- Event handlers ----------------------------------------------------*/
742 * void editIcon__dboxHandler(dbox d,dbox_field f,void *handle)
745 * Handles any and all events directed at the dbox. Well, almost all...
748 * dbox d == the dbox handle
749 * dbox_field f == the event that happened
750 * void *handle == pointer to the dialogue box control info
753 static void editIcon__dboxHandler(dbox d,dbox_field f,void *handle)
755 glass_editIcon *ed=handle;
756 buttons_simpleArrow sa={0,9999,FALSE};
762 dbox_deleteNoUpdate(ed->e.pd);
763 pane_delete(ed->e.p);
764 dbox_delete(ed->e.d);
765 ed->w->def->i[ed->i].edit=0;
770 help_addLine(msgs_lookup("eihEIDB"));
776 if (!dbox_wasAdjustClick())
780 /* --- set up for old icon --- */
781 ed->idef=ed->w->def->i[ed->i].i;
782 editIcon_readData(ed->w,ed->i);
783 dbox_setfield(ed->e.d,glass_EINUMWRITE,"%i",ed->i);
784 editIcon__setupPanel(ed);
787 if (!dbox_wasAdjustClick())
788 editIcon_close(ed->w,ed->i);
792 editIcon__closePanel(ed);
793 if (!dbox_wasAdjustClick())
796 editIcon__recreate(ed);
798 editIcon_close(ed->w,ed->i);
802 editIcon__recreate(ed);
803 editIcon_readData(ed->w,ed->i);
804 editIcon__setupPanel(ed);
810 if (gPrefs_current()->cDelIcon)
812 if (!warning(msgs_lookup("eiCDIP"),
813 msgs_lookup("eiCDI")))
821 window_deleteIcon(ed->w,ed->i); /* Closes the edit for us */
824 case glass_EIAPPEARANCE:
825 case glass_EIACTIONS:
826 case glass_EICOLOURS:
827 case glass_EIPOSITION:
829 editIcon__setPanel(ed,f);
832 buttons_arrow(d,f,d,glass_EINUMWRITE,0,+1,&sa);
834 case glass_EINUMDOWN:
835 buttons_arrow(d,f,d,glass_EINUMWRITE,0,-1,&sa);
841 * BOOL editIcon__dboxRaw(dbox d,wimp_eventstr *e,void *handle)
844 * Handles open window requests and things for the main Preferences dbox.
847 * dbox d == the dbox handle
848 * wimp_eventstr *e == the event that happened
849 * void *handle == a unused pointer
852 * TRUE if the event has been handled;
855 static BOOL editIcon__dboxRaw(dbox d,wimp_eventstr *e,void *handle)
858 glass_editIcon *ed=handle;
868 switch (e->data.key.chcode)
870 case akbd_UpK+akbd_Sh:
871 editIcon__nextPanel(ed,-1);
874 case akbd_DownK+akbd_Sh:
875 editIcon__nextPanel(ed,+1);
881 case wimp_ESENDWANTACK:
882 switch (e->data.msg.hdr.action)
885 m=intMsgs_receive(e);
886 switch(e->data.msg.data.words[0])
888 case glass_DELETEFILE:
889 if (m->df.t==ed->w->t)
890 editIcon_close(ed->w,ed->i);
892 case glass_DELETEWINDOW:
894 editIcon_close(ed->w,ed->i);
898 dbox_setfield(ed->e.d,glass_EIWINDISP,"%s",ed->w->id);
909 * menu editIcon__fontMaker(void *handle)
912 * Sets up the font menu.
915 * void *handle == pointer to this edit
921 static menu editIcon__fontMaker(void *handle)
923 glass_editIcon *ed=handle;
924 menu m=fontMenu_createFontMenu(FALSE);
925 fontMenu_tickGivenName(ed->font);
930 * void editIcon__fontHandler(int hit[],void *handle)
933 * Gets the font chosen from the font menu.
936 * int hit[] == the hit string
937 * void *handle == pointer to this edit
940 static void editIcon__fontHandler(int hit[],void *handle)
942 glass_editIcon *ed=handle;
945 strcpy(ed->font,fontMenu_fontname(hit[0],hit[1]));
946 dbox_setfield(ed->e.pd,glass_EIAFONTNAME,"%.%s",ed->font);
951 * void editIcon__fontHelp(int hit[],void *handle)
954 * Gives help on a font menu item
957 * int hit[] == the hit string
958 * void *handle == pointer to this edit
961 static void editIcon__fontHelp(int hit[],void *handle)
967 help_addLine(msgs_lookup("eimhFONT"),fontMenu_fontname(hit[0],hit[1]));
973 * menu editIcon__btypeMaker(void *handle)
976 * Generates and sets up a button type menu for an edit dialogue box
979 * void *handle == pointer to the edit
985 static menu editIcon__btypeMaker(void *handle)
989 glass_editIcon *ed=handle;
991 char *buf=buffer_find();
994 m=menu_new(msgs_lookup("eiBTMT"),msgs_lookup("eiBTYPE0"));
997 sprintf(buf,"eiBTYPE%i",i);
998 menu_extend(m,msgs_lookup(buf));
1002 menu_setflags(m,ticked,FALSE,FALSE);
1003 ticked=((ed->idef.flags>>12)&0x0f)+1;
1004 menu_setflags(m,ticked,TRUE,FALSE);
1009 * void editIcon__btypeHandler(int hit[],void *handle)
1012 * Handles a click on the button type menu.
1015 * int hit[] == the mouse click info
1016 * void *handle == pointer to edit information
1019 static void editIcon__btypeHandler(int hit[],void *handle)
1021 glass_editIcon *ed=handle;
1022 char *buf=buffer_find();
1025 ed->idef.flags&=~0x0000f000;
1026 ed->idef.flags+=(hit[0]-1)<<12;
1027 sprintf(buf,"eiBTYPE%i",hit[0]-1);
1028 dbox_setfield(ed->e.pd,glass_EIABTYPE,"%s",msgs_lookup(buf));
1033 * void editIcon__colProc(dbox d,dbox_field f,int colour, void *handle)
1036 * This routine is called when a colour is selected in the colours panel.
1039 * dbox d == the panel's handle
1040 * dbox_field f == the colour button that has changed
1041 * int colour == the new colour for the button
1042 * void *handle == pointer to this edit
1045 static void editIcon__colProc(dbox d,dbox_field f,int colour,void *handle)
1047 glass_editIcon *ed=handle;
1052 ed->idef.flags=(ed->idef.flags & ~0x0f000000)+(colour<<24);
1055 ed->idef.flags=(ed->idef.flags & ~0xf0000000)+(colour<<28);
1061 * void editIcon__btypeHelp(int hit[],void *handle)
1064 * Handles a help request for the button type menu.
1067 * int hit[] == the helpq info
1068 * void *handle == pointer to edit information
1071 static void editIcon__btypeHelp(int hit[],void *handle)
1073 char *buf=buffer_find();
1078 sprintf(buf,"eiBTYPE%i",hit[0]-1);
1079 help_addLine(msgs_lookup("eimhBTYPE"),msgs_lookup(buf));
1085 * void editIcon__posSizeArrows(dbox d,dbox_field f,int diff,void *handle)
1088 * Handles a click event on one of the position or size arrow buttons in
1089 * the dialogue box. See the structure definition below for a description
1090 * of the data structure required.
1098 editIcon__posSizeArrowstr;
1100 static void editIcon__posSizeArrows(dbox d,
1105 editIcon__posSizeArrowstr *s=handle;
1109 dbox_scanfield(d,f,"%d,%d",&x,&y);
1110 v=s->xOrY ? &x : &y;
1112 if (s->sizing && *v<0)
1114 dbox_setfield(d,f,"%i,%i",x,y);
1118 * void editIcon__panelHandler(dbox d,dbox_field f,void *handle)
1121 * Handles simple click events for the current panel in an edit dbox
1124 * dbox d == the panel's dbox handle
1125 * dbox_field f == the icon that was clicked
1126 * void *handle == pointer to edit information
1129 static void editIcon__panelHandler(dbox d,dbox_field f,void *handle)
1131 glass_editIcon *ed=handle;
1132 buttons_simpleArrow sa={0,9999,FALSE};
1133 buttons_simpleArrow esga={0,31,FALSE};
1134 editIcon__posSizeArrowstr psa={0,FALSE};
1143 editIcon__dboxHandler(ed->e.d,f,ed);
1147 switch (ed->e.panel)
1152 case glass_EIDINDIR:
1153 if (dbox_selecticon(d,f,dbox_READSTATE))
1155 if (dbox_selecticon(ed->e.pd,glass_EIDTEXT,dbox_READSTATE))
1157 dbox_shadeicon(ed->e.pd,glass_EIDVALID,FALSE);
1158 dbox_shadeicon(ed->e.pd,
1160 !dbox_selecticon(ed->e.pd,
1164 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,FALSE);
1165 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,FALSE);
1166 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,FALSE);
1167 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,FALSE);
1168 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,FALSE);
1172 dbox_shadeicon(ed->e.pd,glass_EIDVALSTRING,TRUE);
1173 dbox_shadeicon(ed->e.pd,glass_EIDVALID,TRUE);
1174 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,TRUE);
1175 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,TRUE);
1176 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,TRUE);
1177 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,TRUE);
1178 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,TRUE);
1181 case glass_EIDINDUP:
1182 buttons_arrow(ed->e.pd,f,ed->e.pd,glass_EIDINDSIZE,0,+1,&sa);
1184 case glass_EIDINDDOWN:
1185 buttons_arrow(ed->e.pd,f,ed->e.pd,glass_EIDINDSIZE,0,-1,&sa);
1187 case glass_EIDVALID:
1188 dbox_shadeicon(ed->e.pd,glass_EIDVALSTRING,dbox_TOGGLESTATE);
1190 case glass_EIDMINIMISE:
1191 dbox_clickicon(d,f);
1192 dbox_getfield(d,glass_EIDDATA,ed->data,256);
1193 dbox_setfield(d,glass_EIDINDSIZE,"%i",strlen(ed->data)+1);
1197 if (dbox_selecticon(ed->e.pd,glass_EIDTEXT,dbox_READSTATE))
1199 dbox_shadeicon(ed->e.pd,glass_EIDDATA,FALSE);
1200 dbox_shadeicon(ed->e.pd,glass_EIDINDIR,FALSE);
1201 if (dbox_selecticon(d,glass_EIDINDIR,dbox_READSTATE))
1203 dbox_shadeicon(ed->e.pd,glass_EIDVALID,FALSE);
1204 dbox_shadeicon(ed->e.pd,glass_EIDVALSTRING,
1205 !dbox_selecticon(ed->e.pd,glass_EIDVALID,dbox_READSTATE));
1206 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,FALSE);
1207 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,FALSE);
1208 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,FALSE);
1209 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,FALSE);
1210 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,FALSE);
1214 dbox_shadeicon(ed->e.pd,glass_EIDVALID,TRUE);
1215 dbox_shadeicon(ed->e.pd,glass_EIDVALSTRING,TRUE);
1216 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,TRUE);
1217 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,TRUE);
1218 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,TRUE);
1219 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,TRUE);
1220 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,TRUE);
1222 dbox_shadeicon(ed->e.d,glass_EICOLOURS,
1223 !!(ed->idef.flags & wimp_IFONT));
1227 dbox_shadeicon(ed->e.pd,glass_EIDVALID,TRUE);
1228 dbox_shadeicon(ed->e.pd,glass_EIDVALSTRING,TRUE);
1229 if (dbox_selecticon(d,glass_EIDSPRITE,dbox_READSTATE))
1231 dbox_shadeicon(ed->e.pd,glass_EIDDATA,FALSE);
1232 dbox_shadeicon(ed->e.pd,glass_EIDINDIR,FALSE);
1233 indon=dbox_selecticon(d,glass_EIDINDIR,dbox_READSTATE);
1234 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,!indon);
1235 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,!indon);
1236 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,!indon);
1237 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,!indon);
1238 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,!indon);
1242 dbox_shadeicon(ed->e.pd,glass_EIDDATA,TRUE);
1243 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,TRUE);
1244 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,TRUE);
1245 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,TRUE);
1246 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,TRUE);
1247 dbox_shadeicon(ed->e.pd,glass_EIDINDIR,TRUE);
1248 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,TRUE);
1250 dbox_shadeicon(ed->e.d,glass_EICOLOURS,FALSE);
1253 case glass_EIDSPRITE:
1254 if (dbox_selecticon(ed->e.pd,glass_EIDSPRITE,dbox_READSTATE))
1256 dbox_shadeicon(ed->e.pd,glass_EIDDATA,FALSE);
1257 dbox_shadeicon(ed->e.pd,glass_EIDINDIR,FALSE);
1258 indon=dbox_selecticon(d,glass_EIDINDIR,dbox_READSTATE);
1259 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,!indon);
1260 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,!indon);
1261 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,!indon);
1262 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,!indon);
1263 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,!indon);
1265 else if (!dbox_selecticon(ed->e.pd,glass_EIDTEXT,dbox_READSTATE))
1267 dbox_shadeicon(ed->e.pd,glass_EIDDATA,TRUE);
1268 dbox_shadeicon(ed->e.pd,glass_EIDINDIR,TRUE);
1269 dbox_shadeicon(ed->e.pd,glass_EIDINDSIZE,TRUE);
1270 dbox_shadeicon(ed->e.pd,glass_EIDINDUP,TRUE);
1271 dbox_shadeicon(ed->e.pd,glass_EIDINDDOWN,TRUE);
1272 dbox_shadeicon(ed->e.pd,glass_EIDMINIMISE,TRUE);
1273 dbox_shadeicon(ed->e.pd,glass_EIDINDPART,TRUE);
1278 case glass_EIAPPEARANCE:
1282 if (dbox_selecticon(d,f,dbox_READSTATE) ||
1283 fontMenu_createFontMenu(FALSE))
1285 dbox_selecticon(d,f,dbox_TOGGLESTATE);
1286 dbox_shadeicon(d,glass_EIAFONTNAME,dbox_TOGGLESTATE);
1287 dbox_shadeicon(d,glass_EIAFONTMENU,dbox_TOGGLESTATE);
1288 dbox_shadeicon(d,glass_EIAFSIZEUP,dbox_TOGGLESTATE);
1289 dbox_shadeicon(d,glass_EIAFSIZEDOWN,dbox_TOGGLESTATE);
1290 dbox_shadeicon(d,glass_EIAFSIZEWRITE,dbox_TOGGLESTATE);
1291 dbox_shadeicon(ed->e.d,glass_EICOLOURS,dbox_TOGGLESTATE);
1294 case glass_EIAFSIZEUP:
1295 buttons_arrow(ed->e.pd,f,ed->e.pd,glass_EIAFSIZEWRITE,0,+1,&sa);
1297 case glass_EIAFSIZEDOWN:
1298 buttons_arrow(ed->e.pd,f,ed->e.pd,glass_EIAFSIZEWRITE,0,-1,&sa);
1302 case glass_EIACTIONS:
1305 case glass_EIAESGUP:
1306 buttons_arrow(d,f,d,glass_EIAESGWRITE,0,+1,&esga);
1308 case glass_EIAESGDOWN:
1309 buttons_arrow(d,f,d,glass_EIAESGWRITE,0,-1,&esga);
1313 case glass_EICOLOURS:
1319 case glass_EIPOSITION:
1324 buttons_arrow(d,f,d,glass_EIPWRITE,
1325 editIcon__posSizeArrows,
1331 buttons_arrow(d,f,d,glass_EIPWRITE,
1332 editIcon__posSizeArrows,
1338 buttons_arrow(d,f,d,glass_EIPWRITE,
1339 editIcon__posSizeArrows,
1343 case glass_EIPRIGHT:
1345 buttons_arrow(d,f,d,glass_EIPWRITE,
1346 editIcon__posSizeArrows,
1350 case glass_EIPSETSIZE:
1351 dbox_clickicon(d,f);
1352 editIcon__setSize(ed);
1361 * BOOL editIcon__panelRaw(dbox d,wimp_eventstr *e,void *handle)
1364 * Handles the more wierd events for a particular panel.
1367 * dbox d == the dbox handle of the panel
1368 * wimp_eventstr *e == the event to look at
1369 * void *handle == pointer to the current edit
1372 * TRUE if the event is dead (long live the event...)
1375 static BOOL editIcon__panelRaw(dbox d,wimp_eventstr *e,void *handle)
1378 glass_editIcon *ed=handle;
1380 if (e->e==wimp_EKEY)
1382 switch (e->data.key.chcode)
1384 case akbd_UpK+akbd_Sh:
1385 editIcon__nextPanel(ed,-1);
1388 case akbd_DownK+akbd_Sh:
1389 editIcon__nextPanel(ed,+1);
1394 if (!handled) switch (ed->e.panel)
1399 case glass_EIAPPEARANCE:
1403 switch (e->data.but.m.i)
1405 case glass_EIAFONTNAME:
1406 menu_make(editIcon__fontMaker,editIcon__fontHandler,
1407 editIcon__fontHelp,ed);
1410 case glass_EIAFONTMENU:
1411 dbox_clickicon(d,glass_EIAFONTMENU);
1412 menu_make(editIcon__fontMaker,editIcon__fontHandler,
1413 editIcon__fontHelp,ed);
1421 case glass_EIACTIONS:
1425 switch (e->data.but.m.i)
1427 case glass_EIABTYPE:
1428 menu_make(editIcon__btypeMaker,editIcon__btypeHandler,
1429 editIcon__btypeHelp,ed);
1432 case glass_EIABTMENU:
1433 dbox_clickicon(d,glass_EIABTMENU);
1434 menu_make(editIcon__btypeMaker,editIcon__btypeHandler,
1435 editIcon__btypeHelp,ed);
1442 switch (e->data.key.c.i)
1444 case glass_EIAESGWRITE:
1445 switch (e->data.key.chcode)
1450 case akbd_TabK+akbd_Sh:
1451 case akbd_UpK+akbd_Ctl:
1452 case akbd_DownK+akbd_Ctl:
1456 handled=buttons_insertChar(d,e->data.key.chcode,'0','9');
1457 if (handled || cursor)
1458 buttons_arrowClick(d,glass_EIAESGWRITE,0,31,0,FALSE);
1464 case glass_EICOLOURS:
1468 switch (e->data.but.m.i)
1471 colSelect(ed->e.pd,glass_EICFORE,e->data.but.m.bbits,
1472 msgs_lookup("eiFGC"),FALSE,
1473 editIcon__colProc,ed);
1476 colSelect(ed->e.pd,glass_EICBACK,e->data.but.m.bbits,
1477 msgs_lookup("eiBGC"),FALSE,
1478 editIcon__colProc,ed);
1485 case glass_EIPOSITION:
1492 /*----- External routines -------------------------------------------------*/
1495 * void editIcon_renumber(glass_windPointer *w,int icon,int new)
1498 * Informs an edit dialogue that an icon has been renumbered.
1501 * glass_windPointer *w == the window containing the icon
1502 * int icon == the icon number
1503 * int new == the new number for the icon
1506 void editIcon_renumber(glass_windPointer *w,int icon,int new)
1508 glass_editIcon *ed=w->def->i[icon].edit;
1512 dbox_setfield(ed->e.d,glass_EINUMWRITE,"%i",new);
1516 * void editIcon_iconMoved(glass_windPointer *w,int icon)
1519 * Informs an edit dialogue that an icon has been moved.
1522 * glass_windPointer *w == the window containing the icon
1523 * int icon == the icon number. This may not be the same during the edit...
1526 void editIcon_iconMoved(glass_windPointer *w,int icon)
1528 glass_editIcon *ed=w->def->i[icon].edit;
1531 ed->idef.box=ed->w->def->i[ed->i].i.box;
1532 if (ed->e.panel==glass_EIPOSITION || ed->e.panel==glass_EISIZE)
1533 editIcon__setupPanel(ed);
1537 * void editIcon_readData(glass_windPointer *w,int icon)
1540 * Forces a re-read of the icon data for the given icon edit
1543 * glass_windPointer *w == the window containing the icon
1544 * int icon == the icon number. This may not be the same during the edit...
1547 void editIcon_readData(glass_windPointer *w,int icon)
1549 glass_editIcon *ed=w->def->i[icon].edit;
1552 ed->idef.data=ed->w->def->i[ed->i].i.data;
1553 if (ed->idef.flags & wimp_INDIRECT)
1555 utils_ctermToNterm(ed->idef.data.indirecttext.buffer);
1556 strcpy(ed->data,ed->idef.data.indirecttext.buffer);
1557 ed->indLen=ed->idef.data.indirecttext.bufflen;
1558 if (ed->idef.flags & wimp_ITEXT &&
1559 ed->idef.data.indirecttext.validstring!=(char *)-1)
1561 utils_ctermToNterm(ed->idef.data.indirecttext.validstring);
1562 strcpy(ed->valid,ed->idef.data.indirecttext.validstring);
1574 memcpy(ed->data,ed->idef.data.text,12);
1575 utils_ctermToNterm(ed->data);
1579 if (ed->e.panel==glass_EIDATA)
1580 editIcon__setupPanel(ed);
1581 if (ed->idef.flags & wimp_IFONT)
1583 if (ed->e.panel==glass_EICOLOURS)
1584 editIcon__setPanel(ed,-1);
1585 dbox_shadeicon(ed->e.d,glass_EICOLOURS,TRUE);
1588 dbox_shadeicon(ed->e.d,glass_EICOLOURS,FALSE);
1592 * void editIcon_close(glass_windPointer *w,int icon)
1595 * Closes an edit window
1598 * glass_windPointer *w == the window containing the icon
1599 * int icon == the icon number. This may not be the same during the edit...
1602 void editIcon_close(glass_windPointer *w,int icon)
1604 glass_editIcon *ed=w->def->i[icon].edit;
1608 dbox_deleteNoUpdate(ed->e.pd);
1609 pane_delete(ed->e.p);
1610 dbox_deleteNoUpdate(ed->e.d);
1611 ed->w->def->i[ed->i].edit=0;
1617 * void editIcon(glass_windPointer *w,int icon)
1620 * Edits the given icon in a dialogue box.
1623 * glass_windPointer *w == the window containing the icon
1624 * int icon == the icon number. This may not be the same during the edit...
1627 void editIcon(glass_windPointer *w,int icon)
1631 if (w->def->i[icon].edit)
1633 dbox_display(w->def->i[icon].edit->e.d,TRUE);
1634 pane_front(w->def->i[icon].edit->e.p);
1637 mem_useUser(indir_alloc,indir_free);
1638 ed=mem_alloc(sizeof(glass_editIcon));
1641 werr(FALSE,msgs_lookup("eiNEM"));
1645 if (ed->e.d=dbox_create("editIcon"),!ed->e.d)
1651 if (ed->e.p=pane_create(dbox_syshandle(ed->e.d)),!ed->e.p)
1653 dbox_delete(ed->e.d);
1661 ed->idef=w->def->i[icon].i;
1662 w->def->i[icon].edit=ed;
1665 /* --- Set up icon data now --- */
1666 editIcon_readData(w,icon);
1667 if (ed->idef.flags & wimp_IFONT)
1669 r.r[0]=ed->idef.flags >> 24;
1670 r.r[1]=(int)(ed->font);
1671 wimpt_noerr(os_swix(XFont_ReadDefn,&r));
1672 utils_ctermToNterm(ed->font);
1673 ed->fontSize=r.r[2]/16;
1674 dbox_shadeicon(ed->e.d,glass_EICOLOURS,TRUE);
1678 strcpy(ed->font,"Homerton.Medium");
1680 dbox_shadeicon(ed->e.d,glass_EICOLOURS,FALSE);
1683 /* --- Now do handlers, and final setting up --- */
1684 dbox_setfield(ed->e.d,glass_EINUMWRITE,"%i",icon);
1685 dbox_setfield(ed->e.d,glass_EIWINDISP,"%s",w->id);
1686 dbox_eventHandler(ed->e.d,editIcon__dboxHandler,ed);
1687 dbox_rawEventHandler(ed->e.d,editIcon__dboxRaw,ed);
1688 dbox_openDisplaced(ed->e.d);
1689 editIcon__setPanel(ed,glass_EIDATA);