Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r--source/blender/editors/interface/interface_handlers.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 1a36130b522..066d7c470af 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1290,7 +1290,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
else if(ELEM(but->type, TEX, SEARCH_MENU)) {
startx += 5;
if (but->flag & UI_HAS_ICON)
- startx += 16;
+ startx += UI_DPI_ICON_SIZE;
}
/* mouse dragged outside the widget to the left */
@@ -2856,7 +2856,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- int mx, my, click= 0;
+ int mx, my /*, click= 0 */;
int retval= WM_UI_HANDLER_CONTINUE;
int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
@@ -2878,8 +2878,10 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
- else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
+ /* UNUSED - otherwise code is ok, add back if needed */
+ /* else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
click= 1;
+ */
}
}
else if(data->state == BUTTON_STATE_NUM_EDITING) {
@@ -3677,6 +3679,9 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
return WM_UI_HANDLER_BREAK;
}
+ /* UNUSED but keep for now */
+ (void)changed;
+
return WM_UI_HANDLER_CONTINUE;
}
@@ -3691,12 +3696,12 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
Histogram *hist = (Histogram *)but->poin;
/* rcti rect; */
int changed= 1;
- float dx, dy, yfac=1.f;
+ float /* dx, */ dy, yfac=1.f; /* UNUSED */
/* rect.xmin= but->x1; rect.xmax= but->x2; */
/* rect.ymin= but->y1; rect.ymax= but->y2; */
- dx = mx - data->draglastx;
+ /* dx = mx - data->draglastx; */ /* UNUSED */
dy = my - data->draglasty;
@@ -3774,12 +3779,12 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
Scopes *scopes = (Scopes *)but->poin;
/* rcti rect; */
int changed= 1;
- float dx, dy, yfac=1.f;
+ float /* dx, */ dy /* , yfac=1.f */; /* UNUSED */
/* rect.xmin= but->x1; rect.xmax= but->x2; */
/* rect.ymin= but->y1; rect.ymax= but->y2; */
- dx = mx - data->draglastx;
+ /* dx = mx - data->draglastx; */ /* UNUSED */
dy = my - data->draglasty;
@@ -3788,7 +3793,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
scopes->wavefrm_height = (but->y2 - but->y1) + (data->dragstarty - my);
} else {
/* scale waveform values */
- yfac = scopes->wavefrm_yfac;
+ /* yfac = scopes->wavefrm_yfac; */ /* UNUSED */
scopes->wavefrm_yfac += dy/200.0f;
CLAMP(scopes->wavefrm_yfac, 0.5f, 2.f);
@@ -4067,7 +4072,6 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
/* complex code to change name of button */
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
- wmKeyMap *km= NULL;
char *butstr_orig;
// XXX but->str changed... should not, remove the hotkey from it
@@ -4080,10 +4084,6 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
but->str= but->strdata;
ui_check_but(but);
-
- /* set the keymap editable else the key wont save */
- WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
- WM_keymap_copy_to_user(km);
}
else {
/* shortcut was removed */
@@ -4095,6 +4095,7 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
{
+ wmWindowManager *wm= CTX_wm_manager(C);
uiBlock *block;
uiBut *but = (uiBut *)arg;
wmKeyMap *km;
@@ -4107,7 +4108,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
kmi = WM_keymap_item_find_id(km, kmi_id);
- RNA_pointer_create(NULL, &RNA_KeyMapItem, kmi, &ptr);
+ RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetHandleFunc(block, but_shortcut_name_func, but);
@@ -4126,6 +4127,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
{
+ wmWindowManager *wm= CTX_wm_manager(C);
uiBlock *block;
uiBut *but = (uiBut *)arg;
wmKeyMap *km;
@@ -4134,19 +4136,25 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
uiLayout *layout;
uiStyle *style= UI_GetStyle();
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
+ int kmi_id;
/* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
km = WM_keymap_guess_opname(C, but->optype->idname);
kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
+ kmi_id = kmi->id;
- if (prop) {
+ /* copy properties, prop can be NULL for reset */
+ if(prop)
prop= IDP_CopyProperty(prop);
- }
-
- /* prop can be NULL */
WM_keymap_properties_reset(kmi, prop);
- RNA_pointer_create(NULL, &RNA_KeyMapItem, kmi, &ptr);
+ /* update and get pointers again */
+ WM_keyconfig_update(wm);
+
+ km = WM_keymap_guess_opname(C, but->optype->idname);
+ kmi = WM_keymap_item_find_id(km, kmi_id);
+
+ RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetHandleFunc(block, but_shortcut_name_func, but);