stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus data/ccl/human/ui.ccl data/ccl/orc/ui...


From: Jimmy Salmon
Subject: [Stratagus-CVS] stratagus data/ccl/human/ui.ccl data/ccl/orc/ui...
Date: Thu, 16 Oct 2003 18:10:45 -0400

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Jimmy Salmon <address@hidden>   03/10/16 18:10:44

Modified files:
        data/ccl/human : ui.ccl 
        data/ccl/orc   : ui.ccl 
        src/include    : ui.h 
        src/ui         : ccl_ui.c ui.c 

Log message:
        Moved button-buttons inside button-panel

Patches:
Index: stratagus/data/ccl/human/ui.ccl
diff -u stratagus/data/ccl/human/ui.ccl:1.41 
stratagus/data/ccl/human/ui.ccl:1.42
--- stratagus/data/ccl/human/ui.ccl:1.41        Mon Oct 13 00:43:18 2003
+++ stratagus/data/ccl/human/ui.ccl     Thu Oct 16 18:10:44 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: ui.ccl,v 1.41 2003/10/13 04:43:18 jsalmon3 Exp $
+;;     $Id: ui.ccl,v 1.42 2003/10/16 22:10:44 jsalmon3 Exp $
 
 (define-cursor 'cursor-point           'human
     'image "ui/human/cursors/human_gauntlet.png"
@@ -158,10 +158,22 @@
     )
 
     'button-panel (list
-      (string-append "graphics/ui/human/"
-        (number->string screen_width) "x" (number->string screen_height)
-        "/buttonpanel.png")
-       0 336)
+      'panel (list
+        'file (string-append "graphics/ui/human/"
+          (number->string screen_width) "x" (number->string screen_height)
+          "/buttonpanel.png")
+        'pos '(0 336))
+      'icons (list
+        (list 'pos '(  6 337) 'size icon_size)
+        (list 'pos '( 62 337) 'size icon_size)
+        (list 'pos '(118 337) 'size icon_size)
+        (list 'pos '(  6 384) 'size icon_size)
+        (list 'pos '( 62 384) 'size icon_size)
+        (list 'pos '(118 384) 'size icon_size)
+        (list 'pos '(  6 431) 'size icon_size)
+        (list 'pos '( 62 431) 'size icon_size)
+        (list 'pos '(118 431) 'size icon_size))
+    )
 
     'map-area (list
       'pos '(176 16)
@@ -200,17 +212,6 @@
       size (80 19)
       caption "Diplomacy"
       style network)
-
-    'button-buttons (list
-      (list 'pos '(  6 337) 'size icon_size)
-      (list 'pos '( 62 337) 'size icon_size)
-      (list 'pos '(118 337) 'size icon_size)
-      (list 'pos '(  6 384) 'size icon_size)
-      (list 'pos '( 62 384) 'size icon_size)
-      (list 'pos '(118 384) 'size icon_size)
-      (list 'pos '(  6 431) 'size icon_size)
-      (list 'pos '( 62 431) 'size icon_size)
-      (list 'pos '(118 431) 'size icon_size))
 
     'cursors '(
       point cursor-point
Index: stratagus/data/ccl/orc/ui.ccl
diff -u stratagus/data/ccl/orc/ui.ccl:1.40 stratagus/data/ccl/orc/ui.ccl:1.41
--- stratagus/data/ccl/orc/ui.ccl:1.40  Mon Oct 13 00:43:18 2003
+++ stratagus/data/ccl/orc/ui.ccl       Thu Oct 16 18:10:44 2003
@@ -26,7 +26,7 @@
 ;;      along with this program; if not, write to the Free Software
 ;;      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
USA
 ;;
-;;     $Id: ui.ccl,v 1.40 2003/10/13 04:43:18 jsalmon3 Exp $
+;;     $Id: ui.ccl,v 1.41 2003/10/16 22:10:44 jsalmon3 Exp $
 
 (define-cursor 'cursor-point           'orc
     'image "ui/orc/cursors/orcish_claw.png"
@@ -159,10 +159,22 @@
     )
 
     'button-panel (list
-      (string-append "graphics/ui/orc/"
-        (number->string screen_width) "x" (number->string screen_height)
-        "/buttonpanel.png")
-       0 336)
+      'panel (list
+        'file (string-append "graphics/ui/orc/"
+          (number->string screen_width) "x" (number->string screen_height)
+          "/buttonpanel.png")
+        'pos '(0 336))
+      'icons (list
+        (list 'pos '(  6 337) 'size icon_size)
+        (list 'pos '( 62 337) 'size icon_size)
+        (list 'pos '(118 337) 'size icon_size)
+        (list 'pos '(  6 384) 'size icon_size)
+        (list 'pos '( 62 384) 'size icon_size)
+        (list 'pos '(118 384) 'size icon_size)
+        (list 'pos '(  6 431) 'size icon_size)
+        (list 'pos '( 62 431) 'size icon_size)
+        (list 'pos '(118 431) 'size icon_size))
+    )
 
     'map-area (list
       'pos '(176 16)
@@ -201,17 +213,6 @@
       size (80 19)
       caption "Diplomacy"
       style network)
-
-    'button-buttons (list
-      (list 'pos '(  6 337) 'size icon_size)
-      (list 'pos '( 62 337) 'size icon_size)
-      (list 'pos '(118 337) 'size icon_size)
-      (list 'pos '(  6 384) 'size icon_size)
-      (list 'pos '( 62 384) 'size icon_size)
-      (list 'pos '(118 384) 'size icon_size)
-      (list 'pos '(  6 431) 'size icon_size)
-      (list 'pos '( 62 431) 'size icon_size)
-      (list 'pos '(118 431) 'size icon_size))
 
     'cursors '(
       point cursor-point
Index: stratagus/src/include/ui.h
diff -u stratagus/src/include/ui.h:1.73 stratagus/src/include/ui.h:1.74
--- stratagus/src/include/ui.h:1.73     Thu Oct 16 13:03:01 2003
+++ stratagus/src/include/ui.h  Thu Oct 16 18:10:44 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ui.h,v 1.73 2003/10/16 17:03:01 jsalmon3 Exp $
+//     $Id: ui.h,v 1.74 2003/10/16 22:10:44 jsalmon3 Exp $
 
 #ifndef __UI_H__
 #define __UI_H__
@@ -241,6 +241,8 @@
 
     // Button panel
     GraphicConfig ButtonPanel;         /// Button panel background
+    Button*    ButtonButtons;          /// Button panel buttons
+    int                NumButtonButtons;       /// Number of button panel 
buttons
     int                ButtonPanelX;           /// Button panel screen X 
position
     int                ButtonPanelY;           /// Button panel screen Y 
position
 
@@ -288,9 +290,6 @@
     int                StatusLineTextX;        /// status line screen text X 
position
     int                StatusLineTextY;        /// status line screen text Y 
position
     int                StatusLineFont;         /// Status line font
-
-    Button*    ButtonButtons;          /// Button panel buttons
-    int                NumButtonButtons;       /// Number of button panel 
buttons
 
     // Offsets for 640x480 center used by menus
     int                Offset640X;             /// Offset for 640x480 X 
position
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.136 stratagus/src/ui/ccl_ui.c:1.137
--- stratagus/src/ui/ccl_ui.c:1.136     Thu Oct 16 13:03:01 2003
+++ stratagus/src/ui/ccl_ui.c   Thu Oct 16 18:10:44 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ccl_ui.c,v 1.136 2003/10/16 17:03:01 jsalmon3 Exp $
+//     $Id: ccl_ui.c,v 1.137 2003/10/16 22:10:44 jsalmon3 Exp $
 
 //@{
 
@@ -694,9 +694,9 @@
 }
 
 /**
-**     Parse info panel icon
+**     Parse icon
 */
-local void CclParseInfoIcon(SCM list, Button* icon)
+local void CclParseIcon(SCM list, Button* icon)
 {
     SCM value;
 
@@ -749,7 +749,7 @@
                    value = gh_car(sublist);
                    sublist = gh_cdr(sublist);
                    ui->SingleSelectedButton = calloc(1, sizeof(Button));
-                   CclParseInfoIcon(value, ui->SingleSelectedButton);
+                   CclParseIcon(value, ui->SingleSelectedButton);
                } else {
                    errl("Unsupported tag", value);
                }
@@ -781,7 +781,7 @@
                    while (!gh_null_p(slist)) {
                        value = gh_car(slist);
                        slist = gh_cdr(slist);
-                       CclParseInfoIcon(value, &ui->SelectedButtons[i++]);
+                       CclParseIcon(value, &ui->SelectedButtons[i++]);
                    }
                } else {
                    errl("Unsupported tag", value);
@@ -823,7 +823,7 @@
                    value = gh_car(sublist);
                    sublist = gh_cdr(sublist);
                    ui->SingleTrainingButton = calloc(1, sizeof(Button));
-                   CclParseInfoIcon(value, ui->SingleTrainingButton);
+                   CclParseIcon(value, ui->SingleTrainingButton);
                } else {
                    errl("Unsupported tag", value);
                }
@@ -855,7 +855,7 @@
                    while (!gh_null_p(slist)) {
                        value = gh_car(slist);
                        slist = gh_cdr(slist);
-                       CclParseInfoIcon(value, &ui->TrainingButtons[i++]);
+                       CclParseIcon(value, &ui->TrainingButtons[i++]);
                    }
                } else {
                    errl("Unsupported tag", value);
@@ -890,7 +890,7 @@
            value = gh_car(list);
            list = gh_cdr(list);
            ui->UpgradingButton = calloc(1, sizeof(Button));
-           CclParseInfoIcon(value, ui->UpgradingButton);
+           CclParseIcon(value, ui->UpgradingButton);
        } else {
            errl("Unsupported tag", value);
        }
@@ -920,7 +920,7 @@
            value = gh_car(list);
            list = gh_cdr(list);
            ui->ResearchingButton = calloc(1, sizeof(Button));
-           CclParseInfoIcon(value, ui->ResearchingButton);
+           CclParseIcon(value, ui->ResearchingButton);
        } else {
            errl("Unsupported tag", value);
        }
@@ -959,7 +959,7 @@
            while (!gh_null_p(sublist)) {
                value = gh_car(sublist);
                sublist = gh_cdr(sublist);
-               CclParseInfoIcon(value, &ui->TransportingButtons[i++]);
+               CclParseIcon(value, &ui->TransportingButtons[i++]);
            }
        } else {
            errl("Unsupported tag", value);
@@ -968,6 +968,24 @@
 }
 
 /**
+**     Parse button panel icons section
+*/
+local void CclParseButtonIcons(SCM list, UI* ui)
+{
+    SCM value;
+    int i;
+
+    ui->NumButtonButtons = gh_length(list);
+    ui->ButtonButtons = calloc(ui->NumButtonButtons, sizeof(Button));
+    i = 0;
+    while (!gh_null_p(list)) {
+       value = gh_car(list);
+       list = gh_cdr(list);
+       CclParseIcon(value, &ui->ButtonButtons[i++]);
+    }
+}
+
+/**
 **     Define the look+feel of the user interface.
 **
 **     FIXME: need some general data structure to make this parsing easier.
@@ -1270,9 +1288,38 @@
        } else if (gh_eq_p(value, gh_symbol2scm("button-panel"))) {
            sublist = gh_car(list);
            list = gh_cdr(list);
-           ui->ButtonPanel.File = SCM_PopNewStr(&sublist);
-           ui->ButtonPanelX = SCM_PopInt(&sublist);
-           ui->ButtonPanelY = SCM_PopInt(&sublist);
+           while (!gh_null_p(sublist)) {
+               value = gh_car(sublist);
+               sublist = gh_cdr(sublist);
+               if (gh_eq_p(value, gh_symbol2scm("panel"))) {
+                   SCM slist;
+
+                   slist = gh_car(sublist);
+                   sublist = gh_cdr(sublist);
+                   while (!gh_null_p(slist)) {
+                       value = gh_car(slist);
+                       slist = gh_cdr(slist);
+                       if (gh_eq_p(value, gh_symbol2scm("file"))) {
+                           value = gh_car(slist);
+                           slist = gh_cdr(slist);
+                           ui->ButtonPanel.File = gh_scm2newstr(value, NULL);
+                       } else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+                           value = gh_car(slist);
+                           slist = gh_cdr(slist);
+                           ui->ButtonPanelX = gh_scm2int(gh_car(value));
+                           ui->ButtonPanelY = 
gh_scm2int(gh_car(gh_cdr(value)));
+                       } else {
+                           errl("Unsupported tag", value);
+                       }
+                   }
+               } else if (gh_eq_p(value, gh_symbol2scm("icons"))) {
+                   value = gh_car(sublist);
+                   sublist = gh_cdr(sublist);
+                   CclParseButtonIcons(value, ui);
+               } else {
+                   errl("Unsupported tag", value);
+               }
+           }
        } else if (gh_eq_p(value, gh_symbol2scm("map-area"))) {
            int w;
            int h;
@@ -1447,38 +1494,6 @@
                    ui->NetworkDiplomacyButton.Button = scm2buttonid(value);
                } else {
                    errl("Unsupported tag", value);
-               }
-           }
-       } else if (gh_eq_p(value, gh_symbol2scm("button-buttons"))) {
-           SCM slist;
-           SCM sslist;
-           Button* b;
-           
-           slist = gh_car(list);
-           list = gh_cdr(list);
-           while (!gh_null_p(slist)) {
-               sslist = gh_car(slist);
-               slist = gh_cdr(slist);
-               ui->NumButtonButtons++;
-               ui->ButtonButtons = realloc(ui->ButtonButtons,
-                   ui->NumButtonButtons * sizeof(*ui->ButtonButtons));
-               b = &ui->ButtonButtons[ui->NumButtonButtons - 1];
-               while (!gh_null_p(sslist)) {
-                   value = gh_car(sslist);
-                   sslist = gh_cdr(sslist);
-                   if (gh_eq_p(value, gh_symbol2scm("pos"))) {
-                       value = gh_car(sslist);
-                       sslist = gh_cdr(sslist);
-                       b->X = gh_scm2int(gh_car(value));
-                       b->Y = gh_scm2int(gh_car(gh_cdr(value)));
-                   } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
-                       value = gh_car(sslist);
-                       sslist = gh_cdr(sslist);
-                       b->Width = gh_scm2int(gh_car(value));
-                       b->Height = gh_scm2int(gh_car(gh_cdr(value)));
-                   } else {
-                       errl("Unsupported tag", value);
-                   }
                }
            }
        } else if (gh_eq_p(value, gh_symbol2scm("cursors"))) {
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.81 stratagus/src/ui/ui.c:1.82
--- stratagus/src/ui/ui.c:1.81  Thu Oct 16 13:03:01 2003
+++ stratagus/src/ui/ui.c       Thu Oct 16 18:10:44 2003
@@ -27,7 +27,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: ui.c,v 1.81 2003/10/16 17:03:01 jsalmon3 Exp $
+//     $Id: ui.c,v 1.82 2003/10/16 22:10:44 jsalmon3 Exp $
 
 //@{
 
@@ -488,8 +488,19 @@
 
     CLprintf(file, ")\n");    // 'info-panel
 
-    CLprintf(file, "\n  'button-panel (list \"%s\" %d %d)",
-       ui->ButtonPanel.File, ui->ButtonPanelX, ui->ButtonPanelY);
+    CLprintf(file, "\n  'button-panel (list\n");
+    CLprintf(file, "\n    'panel (list\n");
+    CLprintf(file, "\n      'file \"%s\"\n", ui->ButtonPanel.File);
+    CLprintf(file, "\n      'pos '(%d %d))",
+       ui->ButtonPanelX, ui->ButtonPanelY);
+    CLprintf(file, "\n    'icons (list\n");
+    for (i = 0; i < ui->NumButtonButtons; ++i) {
+       CLprintf(file, "\n      (list 'pos '(%d %d) 'size '(%d %d))",
+           ui->ButtonButtons[i].X, ui->ButtonButtons[i].Y,
+           ui->ButtonButtons[i].Width, ui->ButtonButtons[i].Height);
+    }
+    CLprintf(file, ")");
+    CLprintf(file, ")\n");
 
     CLprintf(file, "\n  'map-area (list");
     CLprintf(file, "\n    'pos '(%3d %3d)",
@@ -557,15 +568,7 @@
        MenuButtonStyle(ui->NetworkDiplomacyButton.Button));
     CLprintf(file, ")\n");
 
-    CLprintf(file, "\n  'button-buttons '(");
-    for (i = 0; i < ui->NumButtonButtons; ++i) {
-       CLprintf(file, "\n    (pos (%3d %3d) size (%d %d))",
-           ui->ButtonButtons[i].X, ui->ButtonButtons[i].Y,
-           ui->ButtonButtons[i].Width, ui->ButtonButtons[i].Height);
-    }
-    CLprintf(file, ")");
-
-    CLprintf(file, "\n\n  'cursors '(");
+    CLprintf(file, "\n  'cursors '(");
     CLprintf(file, "\n    point %s", ui->Point.Name);
     CLprintf(file, "\n    glass %s", ui->Glass.Name);
     CLprintf(file, "\n    cross %s", ui->Cross.Name);
@@ -630,7 +633,7 @@
     int i;
 
     CLprintf(file, "\n;;; -----------------------------------------\n");
-    CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.81 2003/10/16 17:03:01 
jsalmon3 Exp $\n\n");
+    CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.82 2003/10/16 22:10:44 
jsalmon3 Exp $\n\n");
 
     // Contrast, Brightness, Saturation
     CLprintf(file, "(set-contrast! %d)\n", TheUI.Contrast);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]