Looks good to me. Finally got the patch into CVS after I figured out the '-l' option 
for patch ;-)

Also noticed that the field isn't updating properly any more. When I added the state 
optimization to div_setstate, it optimizes out the field updates! I also fixed this 
and comitted to CVS.

Since you're a PicoGUI developer now, if you get a username at Sourceforge I'll be 
more than happy to add you to the developer list so you can have read/write CVS access.

Thank you!

On Sat, 26 May 2001, Shane Nay wrote:

> 
> I'm not totally sure this is right.  First time I've mucked about on the 
> interior of PicoGUI.  As an aside, I think some of the text field stuff is a 
> bit messed up..., seems like multiple copies of the buffer are laying about?  
> (Probably my imagination)
> 
> Anyway, patch inlined below, and a ChangeLog entry.
> 
> 2001-05-14    Shane Nay <[EMAIL PROTECTED]>
> 
> Added sizing to text size to field widget.
> 
>     * widget/field.c: added resizefield() routine, and calling it when
>       the font changes, or when the text is changed.
> 
> Index: field.c
> ===================================================================
> RCS file: /cvsroot/pgui/pgserver/widget/field.c,v
> retrieving revision 1.24
> diff -u -r1.24 field.c
> --- field.c    2001/04/29 17:28:40    1.24
> +++ field.c    2001/05/26 05:12:46
> @@ -20,9 +20,9 @@
>   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
> USA.
>   * 
>   * Contributors:
> + * Shane R. Nay <[EMAIL PROTECTED]>
>   * 
>   * 
> - * 
>   */
>  
>  #include <pgserver/common.h>
> @@ -39,6 +39,8 @@
>  #define FLASHTIME_ON   250
>  #define FLASHTIME_OFF  150
>  
> +void resizefield(struct widget *self);
> +
>  struct fielddata {
>    handle font;
>    int focus,on,flash_on;
> @@ -166,6 +168,7 @@
>      if (self->in->split != psplit) {
>        self->in->flags |= DIVNODE_PROPAGATE_RECALC;
>      }
> +    resizefield(self);
>      self->in->flags |= DIVNODE_NEED_RECALC;
>      self->dt->flags |= DIVTREE_NEED_RECALC;
>      break;
> @@ -188,6 +191,7 @@
>       
>       /* Update text */
>       strcpy(DATA->buffer,str);
> +     resizefield(self);
>  //     div_setstate(self->in->div,self->in->div->state);
>       break;
>  
> @@ -378,6 +382,38 @@
>    return rehandle(DATA->hbuffer,DATA->buffer);
>  }
>  
> +/* Resize the field.  Mostly taken from label.c */
> +void resizefield(struct widget *self) {
> +  s16 w,h,m = theme_lookup(self->in->div->state,PGTH_P_MARGIN);
> +  s16 osplit;
> +  struct fontdesc *fd;
> +  char *str;
> +  handle font = DATA->font ? DATA->font : 
> +    theme_lookup(self->in->div->state, PGTH_P_FONT);
> +
> +  /* Redraw the containing widget if we're transparent
> +  if (DATA->transparent || DATA->osplit!=self->in->split)
> +  redraw_bg(self); */
> +
> +  /* With PG_S_ALL we'll get ignored anyway... */
> +  if (self->in->flags & PG_S_ALL) return;
> +  if (self->sizelock) return;
> +  if (iserror(rdhandle((void **)&fd,PG_TYPE_FONTDESC,-1,font))
> +          || !fd) return;
> +  sizetext(fd,&w,&h,DATA->buffer);
> +
> +  osplit = self->in->split;
> +  if ((self->in->flags & PG_S_TOP) ||
> +      (self->in->flags & PG_S_BOTTOM))
> +    self->in->split = h+m;
> +  else if ((self->in->flags & PG_S_LEFT) ||
> +       (self->in->flags & PG_S_RIGHT))
> +    self->in->split = w+m;
> +  if (osplit!=self->in->split) {
> +    self->in->flags |= DIVNODE_NEED_RECALC | DIVNODE_PROPAGATE_RECALC;
> +    self->dt->flags |= DIVTREE_NEED_RECALC;
> +  }
> +}
>  /* The End */
>  
>  
> 
> _______________________________________________
> Pgui-devel mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/pgui-devel

--
To the systems programmer, users and applications server only to provide a 
test load.


_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/pgui-devel

Reply via email to