From c8e15de2859eadb45f4c40ac1f4bebb7fed4463a Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Sat, 3 Jul 2010 11:12:42 +0000 Subject: [PATCH] inv align modes --- debian/changelog | 1 + src/sdl-instead/game.c | 6 +++--- src/sdl-instead/themes.c | 18 +++++++++++++----- src/sdl-instead/themes.h | 3 +++ themes/clearlooks/theme.ini | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index f59480d..438bd80 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ instead (1.2.0) unstable; urgency=low * clearlooks theme; + * inv align modes; * unpack/install feature; * browse feature (win32 and gtk); * clever game/themes sorting; diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c index 505b8b6..85497e9 100644 --- a/src/sdl-instead/game.c +++ b/src/sdl-instead/game.c @@ -458,8 +458,8 @@ int game_apply_theme(void) if (inv_enabled()) { - lay = txt_layout(game_theme.inv_font, (game_theme.inv_mode == INV_MODE_HORIZ)? - ALIGN_CENTER:ALIGN_LEFT, game_theme.inv_w, game_theme.inv_h); + lay = txt_layout(game_theme.inv_font, INV_ALIGN(game_theme.inv_mode), + game_theme.inv_w, game_theme.inv_h); if (!lay) return -1; txt_layout_color(lay, game_theme.icol); @@ -1534,7 +1534,7 @@ inv: invstr = instead_cmd("inv"); instead_clear(); - if (invstr && game_theme.inv_mode == INV_MODE_HORIZ) + if (invstr && INV_MODE(game_theme.inv_mode) == INV_MODE_HORIZ) invstr = horiz_inv(invstr); off = txt_box_off(el_box(el_inv)); diff --git a/src/sdl-instead/themes.c b/src/sdl-instead/themes.c index 5fd3ba1..4120f0d 100644 --- a/src/sdl-instead/themes.c +++ b/src/sdl-instead/themes.c @@ -20,12 +20,20 @@ static int parse_gfx_mode(const char *v, void *data) static int parse_inv_mode(const char *v, void *data) { int *i = (int *)data; - if (!strcmp(v, "vertical") || !strcmp(v, "0")) - *i = INV_MODE_VERT; - else if (!strcmp(v, "horizontal") || !strcmp(v, "1")) - *i = INV_MODE_HORIZ; + if (!strcmp(v, "vertical") || !strcmp(v, "0") || !strcmp(v, "vertical-left")) + *i = INV_MODE_VERT | INV_ALIGN_SET(ALIGN_LEFT); + else if (!strcmp(v, "horizontal") || !strcmp(v, "1") || !strcmp(v, "horizontal-center")) + *i = INV_MODE_HORIZ | INV_ALIGN_SET(ALIGN_CENTER); + else if (!strcmp(v, "horizontal-left") || !strcmp(v, "1")) + *i = INV_MODE_HORIZ | INV_ALIGN_SET(ALIGN_LEFT); + else if (!strcmp(v, "horizontal-right") || !strcmp(v, "1")) + *i = INV_MODE_HORIZ | INV_ALIGN_SET(ALIGN_RIGHT); else if (!strcmp(v, "disabled") || !strcmp(v, "-1")) *i = INV_MODE_DISABLED; + else if (!strcmp(v, "vertical-right")) + *i = INV_MODE_VERT | INV_ALIGN_SET(ALIGN_RIGHT); + else if (!strcmp(v, "vertical-center")) + *i = INV_MODE_VERT | INV_ALIGN_SET(ALIGN_CENTER); else return -1; return 0; @@ -149,7 +157,7 @@ struct game_theme game_theme = { .menu_button_name = NULL, .menu_button = NULL, .gfx_mode = GFX_MODE_EMBEDDED, - .inv_mode = INV_MODE_VERT, + .inv_mode = INV_MODE_VERT | INV_ALIGN_SET(ALIGN_LEFT), .click_name = NULL, .click = NULL, .xoff = 0, diff --git a/src/sdl-instead/themes.h b/src/sdl-instead/themes.h index 7cefd4c..bb7191a 100644 --- a/src/sdl-instead/themes.h +++ b/src/sdl-instead/themes.h @@ -121,5 +121,8 @@ extern int theme_img_scale(img_t *p); #define INV_MODE_DISABLED -1 #define INV_MODE_VERT 0 #define INV_MODE_HORIZ 1 +#define INV_MODE(v) ((v)&0xff) +#define INV_ALIGN(v) ((v)>>8) +#define INV_ALIGN_SET(v) ((v)<<8) #endif diff --git a/themes/clearlooks/theme.ini b/themes/clearlooks/theme.ini index fb94740..8f362ca 100644 --- a/themes/clearlooks/theme.ini +++ b/themes/clearlooks/theme.ini @@ -39,7 +39,7 @@ inv.gfx.down = adown.png inv.col.fg = #606060 inv.col.link = #000000 inv.col.alink = #b02c00 -inv.mode = vertical +inv.mode = vertical-right menu.col.bg = #f0f0f0 menu.col.fg = #000000