From 806268790fd86193a5dc893e60c991e8d150319f Mon Sep 17 00:00:00 2001 From: Per Inge Mathisen Date: Sat, 3 Apr 2010 12:37:00 +0000 Subject: [PATCH] Move default form colours into external palette file. git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10457 4a71c877-e1ca-e34f-864e-861f7616d084 --- data/base/palette.txt | 8 ++++++ lib/ivis_common/piepalette.h | 10 ++++++- lib/widget/form.c | 51 ++++++------------------------------ lib/widget/form.h | 2 +- 4 files changed, 26 insertions(+), 45 deletions(-) diff --git a/data/base/palette.txt b/data/base/palette.txt index c3e7cc522..905da108b 100644 --- a/data/base/palette.txt +++ b/data/base/palette.txt @@ -57,3 +57,11 @@ A0,70,00,ff // team2 - orange 20,30,60,ff // team6 - blue 90,00,70,ff // team7 - purple 00,80,80,ff // team8 - teal +7f,7f,7f,ff // default form background +ff,ff,ff,ff // default form text +ff,ff,ff,ff // default form light +00,00,00,ff // default form dark +40,40,40,ff // default form hilite +ff,0,0,ff // default form cursor +30,30,30,ff // default form tip background +bf,bf,bf,ff // default form disabled diff --git a/lib/ivis_common/piepalette.h b/lib/ivis_common/piepalette.h index 0221db4a7..416b87cea 100644 --- a/lib/ivis_common/piepalette.h +++ b/lib/ivis_common/piepalette.h @@ -81,8 +81,16 @@ #define WZCOL_TEAM6 psPalette[56] #define WZCOL_TEAM7 psPalette[57] #define WZCOL_TEAM8 psPalette[58] +#define WZCOL_FORM_BACKGROUND psPalette[59] +#define WZCOL_FORM_TEXT psPalette[60] +#define WZCOL_FORM_LIGHT psPalette[61] +#define WZCOL_FORM_DARK psPalette[62] +#define WZCOL_FORM_HILITE psPalette[63] +#define WZCOL_FORM_CURSOR psPalette[64] +#define WZCOL_FORM_TIP_BACKGROUND psPalette[65] +#define WZCOL_FORM_DISABLE psPalette[66] -#define WZCOL_MAX 59 +#define WZCOL_MAX 67 //************************************************************************* diff --git a/lib/widget/form.c b/lib/widget/form.c index 77ed2641a..bae0b58a3 100644 --- a/lib/widget/form.c +++ b/lib/widget/form.c @@ -49,49 +49,14 @@ typedef struct _tab_pos /* Set default colours for a form */ static void formSetDefaultColours(W_FORM *psForm) { - static BOOL bDefaultsSet = false; - static PIELIGHT wcol_bkgrnd; - static PIELIGHT wcol_text; - static PIELIGHT wcol_light; - static PIELIGHT wcol_dark; - static PIELIGHT wcol_hilite; - static PIELIGHT wcol_cursor; - static PIELIGHT wcol_tipbkgrnd; - static PIELIGHT wcol_disable; - - if (bDefaultsSet) - { - psForm->aColours[WCOL_BKGRND] = wcol_bkgrnd; - psForm->aColours[WCOL_TEXT] = wcol_text; - psForm->aColours[WCOL_LIGHT] = wcol_light; - psForm->aColours[WCOL_DARK] = wcol_dark; - psForm->aColours[WCOL_HILITE] = wcol_hilite; - psForm->aColours[WCOL_CURSOR] = wcol_cursor; - psForm->aColours[WCOL_TIPBKGRND] = wcol_tipbkgrnd; - psForm->aColours[WCOL_DISABLE] = wcol_disable; - } - else - { - wcol_bkgrnd = pal_Colour(0x7f, 0x7f, 0x7f); - wcol_text = WZCOL_WHITE; - wcol_light = WZCOL_WHITE; - wcol_dark = WZCOL_BLACK; - wcol_hilite = pal_Colour(0x40, 0x40, 0x40); - wcol_cursor = pal_Colour(0xff, 0x00, 0x00); - wcol_tipbkgrnd = pal_Colour(0x30, 0x30, 0x60); - wcol_disable = pal_Colour(0xbf, 0xbf, 0xbf); - - bDefaultsSet = true; - - psForm->aColours[WCOL_BKGRND] = wcol_bkgrnd; - psForm->aColours[WCOL_TEXT] = wcol_text; - psForm->aColours[WCOL_LIGHT] = wcol_light; - psForm->aColours[WCOL_DARK] = wcol_dark; - psForm->aColours[WCOL_HILITE] = wcol_hilite; - psForm->aColours[WCOL_CURSOR] = wcol_cursor; - psForm->aColours[WCOL_TIPBKGRND] = wcol_tipbkgrnd; - psForm->aColours[WCOL_DISABLE] = wcol_disable; - } + psForm->aColours[WCOL_BKGRND] = WZCOL_FORM_BACKGROUND; + psForm->aColours[WCOL_TEXT] = WZCOL_FORM_TEXT; + psForm->aColours[WCOL_LIGHT] = WZCOL_FORM_LIGHT; + psForm->aColours[WCOL_DARK] = WZCOL_FORM_DARK; + psForm->aColours[WCOL_HILITE] = WZCOL_FORM_HILITE; + psForm->aColours[WCOL_CURSOR] = WZCOL_FORM_CURSOR; + psForm->aColours[WCOL_TIPBKGRND] = WZCOL_FORM_TIP_BACKGROUND; + psForm->aColours[WCOL_DISABLE] = WZCOL_FORM_DISABLE; } /* Create a plain form widget */ diff --git a/lib/widget/form.h b/lib/widget/form.h index 052a77b34..754654945 100644 --- a/lib/widget/form.h +++ b/lib/widget/form.h @@ -39,7 +39,7 @@ extern "C" UWORD Ax0,Ay0,Ax1,Ay1; /* Working coords for animations. */ \ UDWORD animCount; /* Animation counter. */ \ UDWORD startTime; /* Animation start time */ \ - PIELIGHT aColours[WCOL_MAX]; /* Colours for the form and its widgets. signed since aColours -1 means use bitmap. */ \ + PIELIGHT aColours[WCOL_MAX]; /* Colours for the form and its widgets */ \ WIDGET *psLastHiLite; /* The last widget to be hilited */ \ /* This is used to track when the mouse moves */ \ /* off something */ \