diff options
author | Thomas Dinges <blender@dingto.org> | 2013-06-10 00:28:16 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2013-06-10 00:28:16 +0400 |
commit | cca324e468db471d7988a37e5804bc3f432160d6 (patch) | |
tree | b902f5a35a433a7d7b43086c176d2a7d3afe7802 /source/blender | |
parent | e50ef3c2b63f97323d53ce4678061e0070a98164 (diff) | |
parent | 28add50083204e99121c5290242652ccd3fcca9e (diff) |
SVN merge r57315-57319 into soc-2013-dingto
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 19 | ||||
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 18 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 104 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 270 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 6 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 91 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 98 | ||||
-rw-r--r-- | source/blender/editors/mesh/editface.c | 73 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude.c | 17 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 71 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 41 |
14 files changed, 124 insertions, 691 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 2dfdce49a71..dfab15a6f12 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -96,7 +96,6 @@ extern void BKE_undo_step(struct bContext *C, int step); extern void BKE_undo_name(struct bContext *C, const char *name); extern int BKE_undo_valid(const char *name); extern void BKE_reset_undo(void); -extern char *BKE_undo_menu_string(void); extern void BKE_undo_number(struct bContext *C, int nr); extern const char *BKE_undo_get_name(int nr, int *active); extern int BKE_undo_save_file(const char *filename); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index d3f4d6d06b0..87a8def52bf 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -792,25 +792,6 @@ const char *BKE_undo_get_name(int nr, int *active) return NULL; } -char *BKE_undo_menu_string(void) -{ - UndoElem *uel; - DynStr *ds = BLI_dynstr_new(); - char *menu; - - BLI_dynstr_append(ds, "Global Undo History %t"); - - for (uel = undobase.first; uel; uel = uel->next) { - BLI_dynstr_append(ds, "|"); - BLI_dynstr_append(ds, uel->name); - } - - menu = BLI_dynstr_get_cstring(ds); - BLI_dynstr_free(ds); - - return menu; -} - /* saves .blend using undo buffer, returns 1 == success */ int BKE_undo_save_file(const char *filename) { diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index e64a5a4af57..cb2f3e3286e 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -210,20 +210,14 @@ typedef enum { BUT = (1 << 9), ROW = (2 << 9), TOG = (3 << 9), - SLI = (4 << 9), NUM = (5 << 9), TEX = (6 << 9), - TOG3 = (7 << 9), - TOGR = (8 << 9), TOGN = (9 << 9), LABEL = (10 << 9), MENU = (11 << 9), /* Dropdown list, actually! */ - ICONROW = (12 << 9), ICONTOG = (13 << 9), NUMSLI = (14 << 9), COLOR = (15 << 9), - IDPOIN = (16 << 9), - /* HSVSLI = (17 << 9), */ /* UNUSED */ SCROLL = (18 << 9), BLOCK = (19 << 9), BUTM = (20 << 9), @@ -231,18 +225,13 @@ typedef enum { LINK = (22 << 9), INLINK = (23 << 9), KEYEVT = (24 << 9), - ICONTEXTROW = (25 << 9), HSVCUBE = (26 << 9), PULLDOWN = (27 << 9), /* Menu, actually! */ ROUNDBOX = (28 << 9), - CHARTAB = (29 << 9), BUT_COLORBAND = (30 << 9), BUT_NORMAL = (31 << 9), BUT_CURVE = (32 << 9), - BUT_TOGDUAL = (33 << 9), ICONTOGN = (34 << 9), - /* FTPREVIEW = (35 << 9), */ /* UNUSED */ - NUMABS = (36 << 9), TOGBUT = (37 << 9), OPTION = (38 << 9), OPTIONN = (39 << 9), @@ -560,7 +549,6 @@ void uiButGetStrInfo(struct bContext *C, uiBut *but, ...); /* Special Buttons * * Buttons with a more specific purpose: - * - IDPoinBut: for creating buttons that work on a pointer to an ID block. * - MenuBut: buttons that popup a menu (in headers usually). * - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility). * - BlockBut: buttons that popup a block with more buttons. @@ -582,12 +570,6 @@ void uiButGetStrInfo(struct bContext *C, uiBut *but, ...); #define UI_ID_PREVIEWS 2048 #define UI_ID_FULL (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL) -typedef void (*uiIDPoinFuncFP)(struct bContext *C, const char *str, struct ID **idpp); -typedef void (*uiIDPoinFunc)(struct bContext *C, struct ID *id, int event); - -uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str, - int x, int y, short width, short height, void *idpp, const char *tip); - int uiIconFromID(struct ID *id); uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index cce9ec50c1e..1bebfa8a7a0 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1140,9 +1140,6 @@ int ui_is_but_push_ex(uiBut *but, double *value) break; case TOGBUT: case TOG: - case TOGR: - case TOG3: - case BUT_TOGDUAL: case ICONTOG: case OPTION: UI_GET_BUT_VALUE_INIT(but, *value); @@ -1420,7 +1417,7 @@ bool ui_is_but_float(uiBut *but) bool ui_is_but_bool(uiBut *but) { - if (ELEM5(but->type, TOG, TOGN, TOGR, ICONTOG, ICONTOGN)) + if (ELEM4(but->type, TOG, TOGN, ICONTOG, ICONTOGN)) return true; if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN) @@ -1620,8 +1617,6 @@ int ui_get_but_string_max_length(uiBut *but) { if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) return but->hardmax; - else if (but->type == IDPOIN) - return MAX_ID_NAME - 2; else return UI_MAX_DRAW_STR; } @@ -1716,7 +1711,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default) */ void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int float_precision) { - if (but->rnaprop && ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (but->rnaprop && ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { PropertyType type; const char *buf = NULL; int buf_len; @@ -1753,18 +1748,6 @@ void ui_get_but_string_ex(uiBut *but, char *str, const size_t maxlen, const int MEM_freeN((void *)buf); } } - else if (but->type == IDPOIN) { - /* ID pointer */ - if (but->idpoin_idpp) { /* Can be NULL for ID properties by python */ - ID *id = *(but->idpoin_idpp); - if (id) { - BLI_strncpy(str, id->name + 2, maxlen); - return; - } - } - str[0] = '\0'; - return; - } else if (but->type == TEX) { /* string */ BLI_strncpy(str, but->poin, maxlen); @@ -1865,7 +1848,7 @@ bool ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double bool ui_set_but_string(bContext *C, uiBut *but, const char *str) { - if (but->rnaprop && ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (but->rnaprop && ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { if (RNA_property_editable(&but->rnapoin, but->rnaprop)) { PropertyType type; @@ -1910,11 +1893,6 @@ bool ui_set_but_string(bContext *C, uiBut *but, const char *str) } } } - else if (but->type == IDPOIN) { - /* ID pointer */ - but->idpoin_func(C, str, but->idpoin_idpp); - return true; - } else if (but->type == TEX) { /* string */ if (ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax); @@ -1944,7 +1922,6 @@ bool ui_set_but_string(bContext *C, uiBut *but, const char *str) } if (!ui_is_but_float(but)) value = (int)floor(value + 0.5); - if (but->type == NUMABS) value = fabs(value); /* not that we use hard limits here */ if (value < (double)but->hardmin) value = but->hardmin; @@ -2285,7 +2262,6 @@ void ui_check_but(uiBut *but) /* test for min and max, icon sliders, etc */ switch (but->type) { case NUM: - case SLI: case SCROLL: case NUMSLI: UI_GET_BUT_VALUE_INIT(but, value); @@ -2293,15 +2269,6 @@ void ui_check_but(uiBut *but) else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax); break; - case NUMABS: - { - double value_abs; - UI_GET_BUT_VALUE_INIT(but, value); - value_abs = fabs(value); - if (value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin); - else if (value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax); - break; - } case ICONTOG: case ICONTOGN: if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) { @@ -2310,20 +2277,6 @@ void ui_check_but(uiBut *but) } break; - case ICONROW: - if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) { - UI_GET_BUT_VALUE_INIT(but, value); - but->iconadd = (int)value - (int)(but->hardmin); - } - break; - - case ICONTEXTROW: - if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) { - UI_GET_BUT_VALUE_INIT(but, value); - but->iconadd = (int)value - (int)(but->hardmin); - } - break; - /* quiet warnings for unhandled types */ default: break; @@ -2337,7 +2290,6 @@ void ui_check_but(uiBut *but) switch (but->type) { case MENU: - case ICONTEXTROW: if (BLI_rctf_size_x(&but->rect) > 24.0f) { UI_GET_BUT_VALUE_INIT(but, value); @@ -2347,7 +2299,6 @@ void ui_check_but(uiBut *but) case NUM: case NUMSLI: - case NUMABS: UI_GET_BUT_VALUE_INIT(but, value); @@ -2394,7 +2345,6 @@ void ui_check_but(uiBut *but) break; - case IDPOIN: case TEX: case SEARCH_MENU: case SEARCH_MENU_UNLINK: @@ -2444,14 +2394,6 @@ void ui_check_but(uiBut *but) break; - case BUT_TOGDUAL: - /* trying to get the dual-icon to left of text... not very nice */ - if (but->str[0]) { - BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR); - BLI_strncpy(but->drawstr + 2, but->str, UI_MAX_DRAW_STR - 2); - } - break; - case HSVCUBE: case HSVCIRCLE: break; @@ -2771,7 +2713,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, but->pos = -1; /* cursor invisible */ - if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* add a space to name */ + if (ELEM(but->type, NUM, NUMSLI)) { /* add a space to name */ /* slen remains unchanged from previous assignment, ensure this stays true */ if (slen > 0 && slen < UI_MAX_NAME_STR - 2) { if (but->str[slen - 1] != ' ') { @@ -2782,13 +2724,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, } if ((block->flag & UI_BLOCK_LOOP) || - ELEM9(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR, SEARCH_MENU_UNLINK)) + ELEM8(but->type, MENU, TEX, LABEL, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR, SEARCH_MENU_UNLINK)) { but->flag |= (UI_TEXT_LEFT | UI_ICON_LEFT); } - else if (but->type == BUT_TOGDUAL) { - but->flag |= UI_ICON_LEFT; - } but->flag |= (block->flag & UI_BUT_ALIGN); @@ -3164,26 +3103,6 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname) MEM_freeN(autocpl); } -/* autocomplete callback for ID buttons */ -static void autocomplete_id(bContext *C, char *str, void *arg_v) -{ - int blocktype = (intptr_t)arg_v; - ListBase *listb = which_libbase(CTX_data_main(C), blocktype); - - if (listb == NULL) return; - - /* search if str matches the beginning of an ID struct */ - if (str[0]) { - AutoComplete *autocpl = autocomplete_begin(str, MAX_ID_NAME - 2); - ID *id; - - for (id = listb->first; id; id = id->next) - autocomplete_do_name(autocpl, id->name + 2); - - autocomplete_end(autocpl, str); - } -} - static void ui_check_but_and_iconize(uiBut *but, int icon) { if (icon) { @@ -3675,19 +3594,6 @@ void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg) but->autofunc_arg = arg; } -uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str, int x, int y, short width, short height, void *idpp, const char *tip) -{ - uiBut *but = ui_def_but(block, IDPOIN, retval, str, x, y, width, height, NULL, 0.0, 0.0, 0.0, 0.0, tip); - but->idpoin_func = func; - but->idpoin_idpp = (ID **) idpp; - ui_check_but(but); - - if (blocktype) - uiButSetCompleteFunc(but, autocomplete_id, (void *)(intptr_t)blocktype); - - return but; -} - uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip) { uiBut *but = ui_def_but(block, BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 0d8c11c0036..d431115d84e 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -321,7 +321,7 @@ static uiBut *ui_but_last(uiBlock *block) static bool ui_is_a_warp_but(uiBut *but) { if (U.uiflag & USER_CONTINUOUS_MOUSE) { - if (ELEM7(but->type, NUM, NUMSLI, NUMABS, HSVCIRCLE, TRACKPREVIEW, HSVCUBE, BUT_CURVE)) { + if (ELEM6(but->type, NUM, NUMSLI, HSVCIRCLE, TRACKPREVIEW, HSVCUBE, BUT_CURVE)) { return true; } } @@ -431,7 +431,7 @@ static void ui_apply_undo(uiBut *but) /* define which string to use for undo */ if (ELEM(but->type, LINK, INLINK)) str = "Add button link"; - else if (ELEM(but->type, MENU, ICONTEXTROW)) str = but->drawstr; + else if (but->type == MENU) str = but->drawstr; else if (but->drawstr[0]) str = but->drawstr; else str = but->tip; @@ -544,7 +544,7 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data) { - if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) + if (but->type == MENU) ui_set_but_val(but, data->value); ui_check_but(but); @@ -558,16 +558,6 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data) double value; int w, lvalue, push; - /* local hack... */ - if (but->type == BUT_TOGDUAL && data->togdual) { - if (but->pointype == UI_BUT_POIN_SHORT) { - but->poin += 2; - } - else if (but->pointype == UI_BUT_POIN_INT) { - but->poin += 4; - } - } - value = ui_get_but_val(but); lvalue = (int)value; @@ -576,17 +566,6 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data) if (w) lvalue = UI_BITBUT_CLR(lvalue, but->bitnr); else lvalue = UI_BITBUT_SET(lvalue, but->bitnr); - if (but->type == TOGR) { - if (!data->togonly) { - lvalue = 1 << (but->bitnr); - - ui_set_but_val(but, (double)lvalue); - } - else { - if (lvalue == 0) lvalue = 1 << (but->bitnr); - } - } - ui_set_but_val(but, (double)lvalue); if (but->type == ICONTOG || but->type == ICONTOGN) ui_check_but(but); } @@ -600,16 +579,6 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data) if (but->type == ICONTOG || but->type == ICONTOGN) ui_check_but(but); } - /* end local hack... */ - if (but->type == BUT_TOGDUAL && data->togdual) { - if (but->pointype == UI_BUT_POIN_SHORT) { - but->poin -= 2; - } - else if (but->pointype == UI_BUT_POIN_INT) { - but->poin -= 4; - } - } - ui_apply_but_func(C, but); data->retval = but->retval; @@ -673,41 +642,6 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data) data->applied = true; } -static void ui_apply_but_TOG3(bContext *C, uiBut *but, uiHandleButtonData *data) -{ - if (but->pointype == UI_BUT_POIN_SHORT) { - short *sp = (short *)but->poin; - - if (UI_BITBUT_TEST(sp[1], but->bitnr)) { - sp[1] = UI_BITBUT_CLR(sp[1], but->bitnr); - sp[0] = UI_BITBUT_CLR(sp[0], but->bitnr); - } - else if (UI_BITBUT_TEST(sp[0], but->bitnr)) { - sp[1] = UI_BITBUT_SET(sp[1], but->bitnr); - } - else { - sp[0] = UI_BITBUT_SET(sp[0], but->bitnr); - } - } - else { - if (UI_BITBUT_TEST(*(but->poin + 2), but->bitnr)) { - *(but->poin + 2) = UI_BITBUT_CLR(*(but->poin + 2), but->bitnr); - *(but->poin) = UI_BITBUT_CLR(*(but->poin), but->bitnr); - } - else if (UI_BITBUT_TEST(*(but->poin), but->bitnr)) { - *(but->poin + 2) = UI_BITBUT_SET(*(but->poin + 2), but->bitnr); - } - else { - *(but->poin) = UI_BITBUT_SET(*(but->poin), but->bitnr); - } - } - - ui_check_but(but); - ui_apply_but_func(C, but); - data->retval = but->retval; - data->applied = true; -} - static void ui_apply_but_VEC(bContext *C, uiBut *but, uiHandleButtonData *data) { ui_set_but_vectorf(but, data->vec); @@ -732,24 +666,6 @@ static void ui_apply_but_CURVE(bContext *C, uiBut *but, uiHandleButtonData *data data->applied = true; } -static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *data) -{ - ui_set_but_string(C, but, data->str); - ui_check_but(but); - ui_apply_but_func(C, but); - data->retval = but->retval; - data->applied = true; -} - -#ifdef WITH_INTERNATIONAL -static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *data) -{ - ui_apply_but_func(C, but); - data->retval = but->retval; - data->applied = true; -} -#endif - /* ****************** drag drop code *********************** */ #ifdef USE_DRAG_TOGGLE @@ -1292,11 +1208,9 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut break; case TOGBUT: case TOG: - case TOGR: case ICONTOG: case ICONTOGN: case TOGN: - case BUT_TOGDUAL: case OPTION: case OPTIONN: ui_apply_but_TOG(C, but, data); @@ -1307,17 +1221,10 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut break; case SCROLL: case NUM: - case NUMABS: - case SLI: case NUMSLI: ui_apply_but_NUM(C, but, data); break; - case TOG3: - ui_apply_but_TOG3(C, but, data); - break; case MENU: - case ICONROW: - case ICONTEXTROW: case BLOCK: case PULLDOWN: ui_apply_but_BLOCK(C, but, data); @@ -1342,14 +1249,6 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut case BUT_CURVE: ui_apply_but_CURVE(C, but, data); break; - case IDPOIN: - ui_apply_but_IDPOIN(C, but, data); - break; -#ifdef WITH_INTERNATIONAL - case CHARTAB: - ui_apply_but_CHARTAB(C, but, data); - break; -#endif case KEYEVT: case HOTKEYEVT: ui_apply_but_BUT(C, but, data); @@ -1392,7 +1291,7 @@ static void ui_but_drop(bContext *C, const wmEvent *event, uiBut *but, uiHandleB for (wmd = drags->first; wmd; wmd = wmd->next) { if (wmd->type == WM_DRAG_ID) { /* align these types with UI_but_active_drop_name */ - if (ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { ID *id = (ID *)wmd->poin; if (but->poin == NULL && but->rnapoin.data == NULL) {} @@ -1433,7 +1332,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } /* numeric value */ - if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { + if (ELEM(but->type, NUM, NUMSLI)) { if (but->poin == NULL && but->rnapoin.data == NULL) { /* pass */ @@ -1497,7 +1396,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } /* text/string and ID data */ - else if (ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + else if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { uiHandleButtonData *active_data = but->active; if (but->poin == NULL && but->rnapoin.data == NULL) { @@ -2041,7 +1940,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) BLI_str_rstrip_float_zero(data->str, '\0'); } - if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { + if (ELEM(but->type, NUM, NUMSLI)) { ui_convert_to_unit_alt_name(but, data->str, data->maxlen); } @@ -2113,7 +2012,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa return; for (but = actbut->next; but; but = but->next) { - if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM5(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) { if (!(but->flag & UI_BUT_DISABLED)) { data->postbut = but; data->posttype = BUTTON_ACTIVATE_TEXT_EDITING; @@ -2122,7 +2021,7 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa } } for (but = block->buttons.first; but != actbut; but = but->next) { - if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM5(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) { if (!(but->flag & UI_BUT_DISABLED)) { data->postbut = but; data->posttype = BUTTON_ACTIVATE_TEXT_EDITING; @@ -2141,7 +2040,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa return; for (but = actbut->prev; but; but = but->prev) { - if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM5(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) { if (!(but->flag & UI_BUT_DISABLED)) { data->postbut = but; data->posttype = BUTTON_ACTIVATE_TEXT_EDITING; @@ -2150,7 +2049,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa } } for (but = block->buttons.last; but != actbut; but = but->prev) { - if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM5(but->type, TEX, NUM, NUMSLI, SEARCH_MENU, SEARCH_MENU_UNLINK)) { if (!(but->flag & UI_BUT_DISABLED)) { data->postbut = but; data->posttype = BUTTON_ACTIVATE_TEXT_EDITING; @@ -2345,7 +2244,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle /* exception that's useful for number buttons, some keyboard * numpads have a comma instead of a period */ - if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/ + if (ELEM(but->type, NUM, NUMSLI)) { /* could use data->min*/ if (event->type == PADPERIOD && ascii == ',') { ascii = '.'; utf8_buf = NULL; /* force ascii fallback */ @@ -2517,14 +2416,6 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data menustr = but->str; } break; - case ICONROW: - menufunc = ui_block_func_ICONROW; - arg = but; - break; - case ICONTEXTROW: - menufunc = ui_block_func_ICONTEXTROW; - arg = but; - break; case COLOR: ui_get_but_vectorf(but, data->origvec); copy_v3_v3(data->vec, data->origvec); @@ -3530,7 +3421,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } - else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) { + else if (but->type == MENU) { if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) { const int direction = (event->type == WHEELDOWNMOUSE) ? -1 : 1; @@ -4793,112 +4684,6 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand return WM_UI_HANDLER_CONTINUE; } -#ifdef WITH_INTERNATIONAL -static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), const wmEvent *UNUSED(event)) -{ - /* XXX 2.50 bad global and state access */ -#if 0 - float sx, sy, ex, ey; - float width, height; - float butw, buth; - int mx, my, x, y, cs, che; - - mx = event->x; - my = event->y; - ui_window_to_block(data->region, block, &mx, &my); - - if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { - /* Calculate the size of the button */ - width = abs(BLI_rctf_size_x(&but->rect)); - height = abs(BLI_rctf_size_y(&but->rect)); - - butw = floor(width / 12); - buth = floor(height / 6); - - /* Initialize variables */ - sx = but->rect.xmin; - ex = but->rect.xmin + butw; - sy = but->rect.ymin + height - buth; - ey = but->rect.ymin + height; - - cs = G.charstart; - - /* And the character is */ - x = (int) ((mx / butw) - 0.5); - y = (int) (6 - ((my / buth) - 0.5)); - - che = cs + (y * 12) + x; - - if (che > G.charmax) - che = 0; - - if (G.obedit) { - do_textedit(0, 0, che); - } - - button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; - } - else if (ELEM(event->type, WHEELUPMOUSE, PAGEUPKEY)) { - for (but = block->buttons.first; but; but = but->next) { - if (but->type == CHARTAB) { - G.charstart = G.charstart - (12 * 6); - if (G.charstart < 0) - G.charstart = 0; - if (G.charstart < G.charmin) - G.charstart = G.charmin; - ui_draw_but(but); - - //Really nasty... to update the num button from the same butblock - for (bt = block->buttons.first; bt; bt = bt->next) - { - if (ELEM(bt->type, NUM, NUMABS)) { - ui_check_but(bt); - ui_draw_but(bt); - } - } - retval = UI_CONT; - break; - } - } - - return WM_UI_HANDLER_BREAK; - } - else if (ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) { - for (but = block->buttons.first; but; but = but->next) { - if (but->type == CHARTAB) { - G.charstart = G.charstart + (12 * 6); - if (G.charstart > (0xffff - 12 * 6)) - G.charstart = 0xffff - (12 * 6); - if (G.charstart > G.charmax - 12 * 6) - G.charstart = G.charmax - 12 * 6; - ui_draw_but(but); - - for (bt = block->buttons.first; bt; bt = bt->next) - { - if (ELEM(bt->type, NUM, NUMABS)) { - ui_check_but(bt); - ui_draw_but(bt); - } - } - - but->flag |= UI_ACTIVE; - retval = UI_RETURN_OK; - break; - } - } - - return WM_UI_HANDLER_BREAK; - } - } -#endif - - return WM_UI_HANDLER_CONTINUE; -} -#endif - - static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { VECCOPY2D(but->linkto, event->mval); @@ -5552,11 +5337,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * break; case TOGBUT: case TOG: - case TOGR: case ICONTOG: case ICONTOGN: case TOGN: - case BUT_TOGDUAL: case OPTION: case OPTIONN: retval = ui_do_but_TOG(C, but, data, event); @@ -5565,17 +5348,14 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * retval = ui_do_but_SCROLL(C, block, but, data, event); break; case NUM: - case NUMABS: retval = ui_do_but_NUM(C, block, but, data, event); break; - case SLI: case NUMSLI: retval = ui_do_but_SLI(C, block, but, data, event); break; case ROUNDBOX: case LISTBOX: case LABEL: - case TOG3: case ROW: case LISTROW: case BUT_IMAGE: @@ -5593,7 +5373,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * retval = ui_do_but_VECTORSCOPE(C, block, but, data, event); break; case TEX: - case IDPOIN: case SEARCH_MENU: retval = ui_do_but_TEX(C, block, but, data, event); break; @@ -5601,8 +5380,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * retval = ui_do_but_SEARCH_UNLINK(C, block, but, data, event); break; case MENU: - case ICONROW: - case ICONTEXTROW: case BLOCK: case PULLDOWN: retval = ui_do_but_BLOCK(C, but, data, event); @@ -5631,16 +5408,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * case HSVCIRCLE: retval = ui_do_but_HSVCIRCLE(C, block, but, data, event); break; -#ifdef WITH_INTERNATIONAL - case CHARTAB: - retval = ui_do_but_CHARTAB(C, block, but, data, event); - break; -#else - /* do nothing */ - case CHARTAB: - break; -#endif - case LINK: case INLINK: retval = ui_do_but_LINK(C, but, data, event); @@ -5713,7 +5480,7 @@ int UI_but_active_drop_name(bContext *C) uiBut *but = ui_but_find_activated(ar); if (but) { - if (ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) + if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) return 1; } @@ -5923,7 +5690,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s button_tooltip_timer_reset(C, but); /* automatic open pulldown block timer */ - if (ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) { + if (ELEM(but->type, BLOCK, PULLDOWN)) { if (data->used_mouse && !data->autoopentimer) { int time; @@ -6733,7 +6500,7 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) { if (but->type == COLOR) copy_v3_v3(data->vec, menu->retvec); - else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) + else if (but->type == MENU) data->value = menu->retvalue; } @@ -7207,11 +6974,6 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH doit = TRUE; } } - /* exception for menus like layer buts, with button aligning they're not drawn in order */ - else if (but->type == TOGR) { - if (but->bitnr == act - 1) - doit = TRUE; - } else if (count == act) { doit = TRUE; } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 5621aa2d0cc..14a4d42946c 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -230,10 +230,6 @@ struct uiBut { short modifier_key; short iconadd; - /* IDPOIN data */ - uiIDPoinFuncFP idpoin_func; - ID **idpoin_idpp; - /* BLOCK data */ uiBlockCreateFunc block_create_func; @@ -460,8 +456,6 @@ struct uiPopupBlockHandle { }; uiBlock *ui_block_func_COLOR(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but); -void ui_block_func_ICONROW(struct bContext *C, uiLayout *layout, void *arg_but); -void ui_block_func_ICONTEXTROW(struct bContext *C, uiLayout *layout, void *arg_but); struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, uiBut *but); void ui_tooltip_free(struct bContext *C, struct ARegion *ar); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 76e523f1329..8621a61a2d1 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -481,7 +481,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->totline++; } - if (ELEM4(but->type, TEX, IDPOIN, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { /* full string */ ui_get_but_string(but, buf, sizeof(buf)); if (buf[0]) { @@ -1768,18 +1768,34 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a const char *instr = arg_str; int columns, rows, a, b; int column_start = 0, column_end = 0; + int nbr_entries_nosepr = 0; uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); /* compute menu data */ md = decompose_menu_string(instr); - /* columns and row estimation */ - columns = (md->nitems + 20) / 20; + /* Run some "tweaking" checks. */ + entry = md->items; + for (a = 0; a < md->nitems; a++, entry++) { + if (entry->sepr) { + /* inconsistent, but menus with labels do not look good flipped */ + if (entry->str[0]) { + block->flag |= UI_BLOCK_NO_FLIP; + nbr_entries_nosepr++; + } + /* We do not want simple separators in nbr_entries_nosepr count */ + continue; + } + nbr_entries_nosepr++; + } + + /* Columns and row estimation. Ignore simple separators here. */ + columns = (nbr_entries_nosepr + 20) / 20; if (columns < 1) columns = 1; if (columns > 8) - columns = (md->nitems + 25) / 25; + columns = (nbr_entries_nosepr + 25) / 25; rows = md->nitems / columns; if (rows < 1) @@ -1799,15 +1815,6 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a } } - /* inconsistent, but menus with labels do not look good flipped */ - entry = md->items; - for (a = 0; a < md->nitems; a++, entry++) { - if (entry->sepr && entry->str[0]) { - block->flag |= UI_BLOCK_NO_FLIP; - break; - } - } - /* create items */ split = uiLayoutSplit(layout, 0.0f, FALSE); @@ -1837,9 +1844,14 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a entry = &md->items[column_start + column_end - 1 - a]; if (entry->sepr) { - uiItemL(column, entry->str, entry->icon); - bt = block->buttons.last; - bt->flag = UI_TEXT_LEFT; + if (entry->str[0]) { + uiItemL(column, entry->str, entry->icon); + bt = block->buttons.last; + bt->flag = UI_TEXT_LEFT; + } + else { + uiItemS(column); + } } else if (entry->icon) { uiDefIconTextButF(block, BUTM, B_NOP, entry->icon, entry->str, 0, 0, @@ -1854,53 +1866,6 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a menudata_free(md); } -void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but) -{ - uiBlock *block = uiLayoutGetBlock(layout); - uiPopupBlockHandle *handle = block->handle; - uiBut *but = arg_but; - int a; - - uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); - - for (a = (int)but->hardmin; a <= (int)but->hardmax; a++) - uiDefIconButF(block, BUTM, B_NOP, but->icon + (a - but->hardmin), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, - &handle->retvalue, (float)a, 0.0, 0, -1, ""); -} - -void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but) -{ - uiBlock *block = uiLayoutGetBlock(layout); - uiPopupBlockHandle *handle = block->handle; - uiBut *but = arg_but, *bt; - MenuData *md; - MenuEntry *entry; - int a; - - uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); - - md = decompose_menu_string(but->str); - - /* title */ - if (md->title) { - bt = uiDefBut(block, LABEL, 0, md->title, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); - bt->flag = UI_TEXT_LEFT; - } - - /* loop through the menu options and draw them out with icons & text labels */ - for (a = 0; a < md->nitems; a++) { - entry = &md->items[md->nitems - a - 1]; - - if (entry->sepr) - uiItemS(layout); - else - uiDefIconTextButF(block, BUTM, B_NOP, (short)((but->icon) + (entry->retval - but->hardmin)), entry->str, - 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, -1, ""); - } - - menudata_free(md); -} - #if 0 static void ui_warp_pointer(int x, int y) { diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 3bf1a1a7701..7da12277372 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -113,7 +113,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind if (icon == ICON_DOT) icon = 0; - but = uiDefIconTextButR_prop(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); + but = uiDefIconTextButR_prop(block, SEARCH_MENU, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL); break; } case PROP_COLLECTION: diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c8062cd3ed2..00eabad729e 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -891,23 +891,12 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, const rcti float ofs = 1.0f / aspect; if (but->flag & UI_ICON_LEFT) { - if (but->type == BUT_TOGDUAL) { - if (but->drawstr[0]) { - xs = rect->xmin - ofs; - } - else { - xs = (rect->xmin + rect->xmax - height) / 2.0f; - } - } - else if (but->block->flag & UI_BLOCK_LOOP) { + if (but->block->flag & UI_BLOCK_LOOP) { if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) xs = rect->xmin + 4.0f * ofs; else xs = rect->xmin + ofs; } - else if ((but->type == ICONROW) || (but->type == ICONTEXTROW)) { - xs = rect->xmin + 3.0f * ofs; - } else { xs = rect->xmin + 4.0f * ofs; } @@ -1220,13 +1209,12 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b #if 0 ui_rasterpos_safe(x, y, but->aspect); - if (but->type == IDPOIN) transopts = 0; /* no translation, of course! */ - else transopts = ui_translate_buttons(); + transopts = ui_translate_buttons(); #endif /* cut string in 2 parts - only for menu entries */ if ((but->block->flag & UI_BLOCK_LOOP)) { - if (ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS) == 0) { + if (ELEM3(but->type, NUM, TEX, NUMSLI) == 0) { cpoin = strchr(but->drawstr, '|'); if (cpoin) *cpoin = 0; } @@ -1292,7 +1280,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB if (but->editstr && but->pos >= 0) { ui_text_clip_cursor(fstyle, but, rect); } - else if (ELEM4(but->type, NUM, NUMABS, NUMSLI, SLI)) { + else if (ELEM(but->type, NUM, NUMSLI)) { ui_text_clip_right_label(fstyle, but, rect); } else if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { @@ -1306,65 +1294,47 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB } /* check for button text label */ - if (but->type == ICONTEXTROW) { - widget_draw_icon(but, (BIFIconID) (but->icon + but->iconadd), 1.0f, rect); + if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) { + int tmp = rect->xmin; + rect->xmin = rect->xmax - BLI_rcti_size_y(rect) - 1; + widget_draw_icon(but, ICON_LAYER_USED, alpha, rect); + rect->xmin = tmp; } - else { - if (but->type == BUT_TOGDUAL) { - int dualset = 0; - if (but->pointype == UI_BUT_POIN_SHORT) { - dualset = UI_BITBUT_TEST(*(((short *)but->poin) + 1), but->bitnr); - } - else if (but->pointype == UI_BUT_POIN_INT) { - dualset = UI_BITBUT_TEST(*(((int *)but->poin) + 1), but->bitnr); - } - - widget_draw_icon(but, ICON_DOT, dualset ? alpha : 0.25f, rect); - } - else if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) { - int tmp = rect->xmin; - rect->xmin = rect->xmax - BLI_rcti_size_y(rect) - 1; - widget_draw_icon(but, ICON_LAYER_USED, alpha, rect); - rect->xmin = tmp; - } - - /* If there's an icon too (made with uiDefIconTextBut) then draw the icon - * and offset the text label to accommodate it */ + /* If there's an icon too (made with uiDefIconTextBut) then draw the icon + * and offset the text label to accommodate it */ - if (but->flag & UI_HAS_ICON) { - widget_draw_icon(but, but->icon + but->iconadd, alpha, rect); - - /* icons default draw 0.8f x height */ - rect->xmin += (int)(0.8f * BLI_rcti_size_y(rect)); + if (but->flag & UI_HAS_ICON) { + widget_draw_icon(but, but->icon + but->iconadd, alpha, rect); + + /* icons default draw 0.8f x height */ + rect->xmin += (int)(0.8f * BLI_rcti_size_y(rect)); - if (but->editstr || (but->flag & UI_TEXT_LEFT)) { - rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect; - } - else if ((but->flag & UI_TEXT_RIGHT)) { - rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect; - } - } - else if ((but->flag & UI_TEXT_LEFT)) { + if (but->editstr || (but->flag & UI_TEXT_LEFT)) { rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect; } else if ((but->flag & UI_TEXT_RIGHT)) { rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect; } - - /* unlink icon for this button type */ - if (but->type == SEARCH_MENU_UNLINK && !but->editstr && but->drawstr[0]) { - rcti temp = *rect; - - temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f); - widget_draw_icon(but, ICON_X, alpha, &temp); - } - - /* always draw text for textbutton cursor */ - widget_draw_text(fstyle, wcol, but, rect); + } + else if ((but->flag & UI_TEXT_LEFT)) { + rect->xmin += (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect; + } + else if ((but->flag & UI_TEXT_RIGHT)) { + rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect; + } + + /* unlink icon for this button type */ + if (but->type == SEARCH_MENU_UNLINK && !but->editstr && but->drawstr[0]) { + rcti temp = *rect; + temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f); + widget_draw_icon(but, ICON_X, alpha, &temp); } + /* always draw text for textbutton cursor */ + widget_draw_text(fstyle, wcol, but, rect); + ui_button_text_password_hide(password_str, but, TRUE); } @@ -3279,7 +3249,6 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct case TOGBUT: case TOG: case TOGN: - case TOG3: wt = widget_type(UI_WTYPE_TOGGLE); break; @@ -3300,7 +3269,6 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct case MENU: case BLOCK: - case ICONTEXTROW: /* new node-link button, not active yet XXX */ if (but->flag & UI_BUT_NODE_LINK) wt = widget_type(UI_WTYPE_MENU_NODE_LINK); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index a7afa3f108b..234a45856d2 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -395,79 +395,6 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3]) return ok; } -/* *************************************** */ -#if 0 -static void seam_edgehash_insert_face(EdgeHash *ehash, MPoly *mp, MLoop *loopstart) -{ - MLoop *ml1, *ml2; - int a; - - for (a = 0; a < mp->totloop; a++) { - ml1 = loopstart + a; - ml2 = loopstart + (a + 1) % mp->totloop; - - BLI_edgehash_insert(ehash, ml1->v, ml2->v, NULL); - } -} - -void seam_mark_clear_tface(Scene *scene, short mode) -{ - Mesh *me; - MPoly *mp; - MLoop *ml1, *ml2; - MEdge *med; - int a, b; - - me = BKE_mesh_from_object(OBACT); - if (me == 0 || me->totpoly == 0) return; - - if (mode == 0) - mode = pupmenu(IFACE_("Seams %t|Mark Border Seam %x1|Clear Seam %x2")); - - if (mode != 1 && mode != 2) - return; - - if (mode == 2) { - EdgeHash *ehash = BLI_edgehash_new(); - - for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++) - if (!(mp->flag & ME_HIDE) && (mp->flag & ME_FACE_SEL)) - seam_edgehash_insert_face(ehash, mp, me->mloop + mp->loopstart); - - for (a = 0, med = me->medge; a < me->totedge; a++, med++) - if (BLI_edgehash_haskey(ehash, med->v1, med->v2)) - med->flag &= ~ME_SEAM; - - BLI_edgehash_free(ehash, NULL); - } - else { - /* mark edges that are on both selected and deselected faces */ - EdgeHash *ehash1 = BLI_edgehash_new(); - EdgeHash *ehash2 = BLI_edgehash_new(); - - for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++) { - if ((mp->flag & ME_HIDE) || !(mp->flag & ME_FACE_SEL)) - seam_edgehash_insert_face(ehash1, mp, me->mloop + mp->loopstart); - else - seam_edgehash_insert_face(ehash2, mp, me->mloop + mp->loopstart); - } - - for (a = 0, med = me->medge; a < me->totedge; a++, med++) - if (BLI_edgehash_haskey(ehash1, med->v1, med->v2) && - BLI_edgehash_haskey(ehash2, med->v1, med->v2)) - med->flag |= ME_SEAM; - - BLI_edgehash_free(ehash1, NULL); - BLI_edgehash_free(ehash2, NULL); - } - -// XXX if (G.debug_value == 8) -// unwrap_lscm(1); - - me->drawflag |= ME_DRAWSEAMS; -} -#endif - bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], bool extend, bool deselect, bool toggle) { Mesh *me; diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index c1017dfce7c..cccf08cfe1a 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -329,36 +329,27 @@ static int edbm_extrude_mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOpe zero_v3(nor); - /* XXX If those popup menus were to be enabled again, please get rid of this "menu string" syntax! */ if (em->selectmode & SCE_SELECT_VERTEX) { if (em->bm->totvertsel == 0) nr = 0; else if (em->bm->totvertsel == 1) nr = 4; else if (em->bm->totedgesel == 0) nr = 4; else if (em->bm->totfacesel == 0) - nr = 3; /* pupmenu("Extrude %t|Only Edges %x3|Only Vertices %x4"); */ + nr = 3; else if (em->bm->totfacesel == 1) - nr = 1; /* pupmenu("Extrude %t|Region %x1|Only Edges% x3|Only Vertices %x4"); */ + nr = 1; else - nr = 1; /* pupmenu("Extrude %t|Region %x1|Individual Faces %x2|Only Edges %x3|Only Vertices %x4"); */ + nr = 1; } else if (em->selectmode & SCE_SELECT_EDGE) { if (em->bm->totedgesel == 0) nr = 0; nr = 1; -#if 0 - else if (em->totedgesel == 1) nr = 3; - else if (em->totfacesel == 0) nr = 3; - else if (em->totfacesel == 1) - nr = 1; /* pupmenu("Extrude %t|Region %x1|Only Edges %x3"); */ - else - nr = 1; /* pupmenu("Extrude %t|Region %x1|Individual Faces %x2|Only Edges %x3"); */ -#endif } else { if (em->bm->totfacesel == 0) nr = 0; else if (em->bm->totfacesel == 1) nr = 1; else - nr = 1; /* pupmenu("Extrude %t|Region %x1|Individual Faces %x2"); */ + nr = 1; } if (nr < 1) return 'g'; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 9196fdc1980..69c1d2cf169 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -46,6 +46,9 @@ #include "BKE_global.h" #include "BKE_screen.h" +#include "RNA_access.h" +#include "RNA_types.h" + #include "WM_api.h" #include "WM_types.h" #include "wm_subwindow.h" @@ -1494,71 +1497,19 @@ void ED_area_prevspace(bContext *C, ScrArea *sa) WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, sa); } -static const char *editortype_pup(void) -{ - const char *types = N_( - "Editor type: %t" - "|3D View %x1" - - "|%l" - - "|Timeline %x15" - "|Graph Editor %x2" - "|Dope Sheet %x12" - "|NLA Editor %x13" - - "|%l" - - "|UV/Image Editor %x6" - - "|Video Sequence Editor %x8" - "|Movie Clip Editor %x20" - "|Text Editor %x9" - "|Node Editor %x16" - "|Logic Editor %x17" - - "|%l" - - "|Properties %x4" - "|Outliner %x3" - "|User Preferences %x19" - "|Info %x7" - - "|%l" - - "|File Browser %x5" - - "|%l" - - "|Python Console %x18" - ); - - return IFACE_(types); -} - -static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) -{ - ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype); - ED_area_tag_redraw(CTX_wm_area(C)); - - /* send space change notifier */ - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, CTX_wm_area(C)); -} - /* returns offset for next button in header */ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) { ScrArea *sa = CTX_wm_area(C); - uiBut *but; + bScreen *scr = CTX_wm_screen(C); + PointerRNA areaptr; int xco = 0.4 * U.widget_unit; - - but = uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D, - editortype_pup(), xco, yco, 1.5 * U.widget_unit, U.widget_unit, - &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0, - TIP_("Display current editor type (click for a menu of available types)")); - uiButSetFunc(but, spacefunc, NULL, NULL); - uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - + + RNA_pointer_create(&(scr->id), &RNA_Area, sa, &areaptr); + + uiDefButR(block, MENU, 0, NULL, xco, yco, 1.5 * U.widget_unit, U.widget_unit, + &areaptr, "type", 0, 0.0f, 0.0f, 0.0f, 0.0f, ""); + return xco + 1.7 * U.widget_unit; } diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 32e388598f5..7db522d7f5e 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -105,6 +105,7 @@ static int rna_Screen_fullscreen_get(PointerRNA *ptr) return (sc->full != 0); } + static void rna_Area_type_set(PointerRNA *ptr, int value) { ScrArea *sa = (ScrArea *)ptr->data; @@ -204,8 +205,9 @@ static void rna_def_area(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "spacetype"); RNA_def_property_enum_items(prop, space_type_items); RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", NULL); - RNA_def_property_ui_text(prop, "Type", "Space type"); + RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area"); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, 0, "rna_Area_type_update"); prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 114773a0c13..7bc42700d2b 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -58,25 +58,30 @@ #include "RNA_enum_types.h" + EnumPropertyItem space_type_items[] = { - {SPACE_EMPTY, "EMPTY", 0, "Empty", ""}, - {SPACE_VIEW3D, "VIEW_3D", 0, "3D View", ""}, - {SPACE_IPO, "GRAPH_EDITOR", 0, "Graph Editor", ""}, - {SPACE_OUTLINER, "OUTLINER", 0, "Outliner", ""}, - {SPACE_BUTS, "PROPERTIES", 0, "Properties", ""}, - {SPACE_FILE, "FILE_BROWSER", 0, "File Browser", ""}, - {SPACE_IMAGE, "IMAGE_EDITOR", 0, "Image Editor", ""}, - {SPACE_INFO, "INFO", 0, "Info", ""}, - {SPACE_SEQ, "SEQUENCE_EDITOR", 0, "Sequence Editor", ""}, - {SPACE_TEXT, "TEXT_EDITOR", 0, "Text Editor", ""}, - {SPACE_ACTION, "DOPESHEET_EDITOR", 0, "Dope Sheet Editor", ""}, - {SPACE_NLA, "NLA_EDITOR", 0, "NLA Editor", ""}, - {SPACE_TIME, "TIMELINE", 0, "Timeline", ""}, - {SPACE_NODE, "NODE_EDITOR", 0, "Node Editor", ""}, - {SPACE_LOGIC, "LOGIC_EDITOR", 0, "Logic Editor", ""}, - {SPACE_CONSOLE, "CONSOLE", 0, "Python Console", ""}, - {SPACE_USERPREF, "USER_PREFERENCES", 0, "User Preferences", ""}, - {SPACE_CLIP, "CLIP_EDITOR", 0, "Clip Editor", ""}, + {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D View", ""}, + {0, "", ICON_NONE, NULL, NULL}, + {SPACE_TIME, "TIMELINE", ICON_TIME, "Timeline", ""}, + {SPACE_IPO, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""}, + {SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", ""}, + {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "NLA Editor", ""}, + {0, "", ICON_NONE, NULL, NULL}, + {SPACE_IMAGE, "IMAGE_EDITOR", ICON_IMAGE_COL, "UV/Image Editor", ""}, + {SPACE_SEQ, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""}, + {SPACE_CLIP, "CLIP_EDITOR", ICON_CLIP, "Movie Clip Editor", ""}, + {SPACE_TEXT, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""}, + {SPACE_NODE, "NODE_EDITOR", ICON_NODETREE, "Node Editor", ""}, + {SPACE_LOGIC, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", ""}, + {0, "", ICON_NONE, NULL, NULL}, + {SPACE_BUTS, "PROPERTIES", ICON_BUTS, "Properties", ""}, + {SPACE_OUTLINER, "OUTLINER", ICON_OOPS, "Outliner", ""}, + {SPACE_USERPREF, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", ""}, + {SPACE_INFO, "INFO", ICON_INFO, "Info", ""}, + {0, "", ICON_NONE, NULL, NULL}, + {SPACE_FILE, "FILE_BROWSER", ICON_FILESEL, "File Browser", ""}, + {0, "", ICON_NONE, NULL, NULL}, + {SPACE_CONSOLE, "CONSOLE", ICON_CONSOLE, "Python Console", ""}, {0, NULL, 0, NULL, NULL} }; |