From ebbfc46bea44c8900eca3deedd25bb990d1fa923 Mon Sep 17 00:00:00 2001 From: "Sv. Lockal" Date: Sun, 2 Sep 2012 13:36:33 +0000 Subject: Use function pointers instead of hard-coded english button names in color picker block. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This solves the problem with es/ru translations of color picker block reported by Gabriel Gazzán in Bf-translations-dev. --- .../blender/editors/interface/interface_regions.c | 35 +++++++++------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 96c1b00d46d..301aea896bc 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2021,27 +2021,20 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode) /* tag buttons */ for (bt = block->buttons.first; bt; bt = bt->next) { - - if (bt->type == LABEL) { - if (bt->str[1] == 'G') { - if (colormode == 2) bt->flag &= ~UI_HIDDEN; - else bt->flag |= UI_HIDDEN; - } - } - - if (bt->type == NUMSLI || bt->type == TEX) { - if (bt->str[1] == 'e') { - if (colormode == 2) bt->flag &= ~UI_HIDDEN; - else bt->flag |= UI_HIDDEN; - } - else if (ELEM3(bt->str[0], 'R', 'G', 'B')) { - if (colormode == 0) bt->flag &= ~UI_HIDDEN; - else bt->flag |= UI_HIDDEN; - } - else if (ELEM3(bt->str[0], 'H', 'S', 'V')) { - if (colormode == 1) bt->flag &= ~UI_HIDDEN; - else bt->flag |= UI_HIDDEN; - } + if (bt->func == do_picker_rna_cb && bt->type == NUMSLI) { + /* RGB sliders (color circle is always shown) */ + if (colormode == 0) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; + } + else if (bt->func == do_hsv_rna_cb) { + /* HSV sliders */ + if (colormode == 1) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; + } + else if (bt->func == do_hex_rna_cb || bt->type == LABEL) { + /* hex input or gamma correction status label */ + if (colormode == 2) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; } } } -- cgit v1.2.3