* rcparse.y (control): ICON controls take an id as the first
authorDJ Delorie <dj@redhat.com>
Tue, 13 Jun 2000 21:21:43 +0000 (21:21 +0000)
committerDJ Delorie <dj@redhat.com>
Tue, 13 Jun 2000 21:21:43 +0000 (21:21 +0000)
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.

binutils/ChangeLog
binutils/rcparse.y
binutils/resrc.c
binutils/windres.h

index e6988df5d24da6b3a57ffc5ffb3a3d6a2ae79104..d2d2080570ccee0a671c43dfb1cb91458c68dabf 100644 (file)
@@ -1,3 +1,13 @@
+2000-06-13  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.
+
 2000-06-13  H.J. Lu  <hjl@gnu.org>
 
        * configure: Regenerate.
index 03cbbdc5b67e194bc894f96c364a0f0400a43c5f..39551c2bf7b22f61ed1ee2372091dc2bf70c7cb6 100644 (file)
@@ -636,39 +636,29 @@ control:
              rcparse_warning (_("IEDIT requires DIALOGEX"));
            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 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_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
+          {
+           $$ = 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_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;
-         }
+          {
+           $$ = define_icon_control ($2, $3, $4, $5, style, $9, $10, $11,
+                                     dialog.ex);
+          }
        | IEDIT
            {
              default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
index 814809e240af7c043cedfbac11f89dc4c02dea17..a30719b1e95d3dace9bad1e20de0ce013e7d34ac 100644 (file)
@@ -847,19 +847,42 @@ define_control (text, id, x, y, width, height, class, style, exstyle)
   n->height = height;
   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;
-    }
+  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;
+}
+
 /* Define a font resource.  */
 
 void
index ba736129828e8b999c22faa477030588ae3abcb0..8adc1ef35710b4bb365f5042437d3717f5cfaf7f 100644 (file)
@@ -812,6 +812,10 @@ extern struct dialog_control *define_control
   PARAMS ((const char *, unsigned long, unsigned long, unsigned long,
           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 *));
 extern void define_icon
This page took 0.030999 seconds and 4 git commands to generate.