This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] windres: icon control



OK to apply?

2000-06-12  DJ Delorie  <dj@cygnus.com>

	* rcparse.y (control): ICON controls take an id as the first
 	parameter, not an optional string.  Also, call new convenience
 	function that takes res_id's.
	* resrc.c (define_control): missing text means zero-length string,
 	not zero ID.
	(define_icon_control): New.
	* windres.h: declare define_icon_control.

Index: rcparse.y
===================================================================
RCS file: /cvs/src/src/binutils/rcparse.y,v
retrieving revision 1.2
diff -p -2 -r1.2 rcparse.y
*** rcparse.y	1999/05/12 22:03:10	1.2
--- rcparse.y	2000/06/12 19:36:48
*************** control:
*** 637,673 ****
  	    res_string_to_id (&$$->class, "HEDIT");
  	  }
! 	| ICON optstringc numexpr cnumexpr cnumexpr opt_control_data
! 	  {
! 	    $$ = define_control ($2, $3, $4, $5, 0, 0, CTL_STATIC,
! 				 SS_ICON | WS_CHILD | WS_VISIBLE, 0);
! 	    if ($6 != NULL)
! 	      {
! 		if (dialog.ex == NULL)
! 		  rcparse_warning (_("control data requires DIALOGEX"));
! 		$$->data = $6;
! 	      }
! 	  }
! 	| ICON optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
  	    icon_styleexpr optcnumexpr opt_control_data
! 	  {
!     	    $$ = define_control ($2, $3, $4, $5, $6, $7, CTL_STATIC,
! 				 style, $9);
! 	    if ($10 != NULL)
! 	      {
! 		if (dialog.ex == NULL)
! 		  rcparse_warning (_("control data requires DIALOGEX"));
! 		$$->data = $10;
! 	      }
! 	  }
! 	| ICON optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
  	    icon_styleexpr cnumexpr cnumexpr opt_control_data
! 	  {
!     	    $$ = define_control ($2, $3, $4, $5, $6, $7, CTL_STATIC,
! 				 style, $9);
! 	    if (dialog.ex == NULL)
! 	      rcparse_warning (_("help ID requires DIALOGEX"));
! 	    $$->help = $10;
! 	    $$->data = $11;
! 	  }
  	| IEDIT
  	    {
--- 637,663 ----
  	    res_string_to_id (&$$->class, "HEDIT");
  	  }
! 	| ICON id cnumexpr cnumexpr cnumexpr opt_control_data
!           {
! 	    $$ = define_icon_control ($2, $3, $4, $5, 0, 0, 0, $6,
! 				      dialog.ex);
!           }
! 	| ICON id cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr
! 	    opt_control_data
!           {
! 	    $$ = define_icon_control ($2, $3, $4, $5, 0, 0, 0, $8,
! 				      dialog.ex);
!           }
! 	| ICON id cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr
  	    icon_styleexpr optcnumexpr opt_control_data
!           {
! 	    $$ = define_icon_control ($2, $3, $4, $5, style, $9, 0, $10,
! 				      dialog.ex);
!           }
! 	| ICON id numexpr cnumexpr cnumexpr cnumexpr cnumexpr
  	    icon_styleexpr cnumexpr cnumexpr opt_control_data
!           {
! 	    $$ = define_icon_control ($2, $3, $4, $5, style, $9, $10, $11,
! 				      dialog.ex);
!           }
  	| IEDIT
  	    {
Index: resrc.c
===================================================================
RCS file: /cvs/src/src/binutils/resrc.c,v
retrieving revision 1.8
diff -p -2 -r1.8 resrc.c
*** resrc.c	2000/05/26 18:46:47	1.8
--- resrc.c	2000/06/12 19:36:52
*************** define_control (text, id, x, y, width, h
*** 848,860 ****
    n->class.named = 0;
    n->class.u.id = class;
!   if (text != NULL)
!     res_string_to_id (&n->text, text);
!   else
!     {
!       n->text.named = 0;
!       n->text.u.id = 0;
!     }
    n->data = NULL;
    n->help = 0;
  
    return n;
--- 848,883 ----
    n->class.named = 0;
    n->class.u.id = class;
!   if (text == NULL)
!     text = "";
!   res_string_to_id (&n->text, text);
    n->data = NULL;
    n->help = 0;
+ 
+   return n;
+ }
+ 
+ struct dialog_control *
+ define_icon_control (iid, id, x, y, style, exstyle, help, data, ex)
+      struct res_id iid;
+      unsigned long id;
+      unsigned long x;
+      unsigned long y;
+      unsigned long style;
+      unsigned long exstyle;
+      unsigned long help;
+      struct rcdata_item *data;
+      struct dialog_ex *ex;
+ {
+   struct dialog_control *n;
+   if (style == 0)
+     style = SS_ICON | WS_CHILD | WS_VISIBLE;
+   n = define_control (0, id, x, y, 0, 0, CTL_STATIC, style, exstyle);
+   n->text = iid;
+   if (help && !ex)
+     rcparse_warning (_("help ID requires DIALOGEX"));
+   if (data && !ex)
+     rcparse_warning (_("control data requires DIALOGEX"));
+   n->help = help;
+   n->data = data;
  
    return n;
Index: windres.h
===================================================================
RCS file: /cvs/src/src/binutils/windres.h,v
retrieving revision 1.3
diff -p -2 -r1.3 windres.h
*** windres.h	2000/01/07 22:33:48	1.3
--- windres.h	2000/06/12 19:36:54
*************** extern struct dialog_control *define_con
*** 813,816 ****
--- 813,820 ----
  	   unsigned long, unsigned long, unsigned long, unsigned long,
  	   unsigned long));
+ extern struct dialog_control *define_icon_control
+   PARAMS ((struct res_id, unsigned long, unsigned long,
+ 	   unsigned long, unsigned long, unsigned long, unsigned long,
+ 	   struct rcdata_item *, struct dialog_ex *));
  extern void define_font
    PARAMS ((struct res_id, const struct res_res_info *, const char *));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]