diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-05 10:26:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-05 10:26:03 +0400 |
commit | 6976866d5ada2bd25216c84cb6f6f6fa2aa7aea5 (patch) | |
tree | dff5a6b983252bddf30f24ddda5d6f71c209f8b4 /source/blender/editors | |
parent | 8003f0606d934be957981415fabd6401e9a99fcb (diff) |
User Interface: Ctrl+C over a menu copies the py command
also use bools rather then ints
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 10 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 10 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 4 |
4 files changed, 18 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 46ee1700a06..79db94e5da8 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3972,7 +3972,7 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...) const char *tc1, *tc2; tc1 = strstr(but->str, "%t"); - tc2 = strstr(but->str, "|"); /* XXX For some reason strchr seems to not work here? */ + tc2 = strstr(but->str, UI_SEP_CHAR_S); if (tc2 && (!tc1 || tc1 > tc2)) tc1 = tc2; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e5140152847..5e17831fc42 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -60,6 +60,7 @@ #include "BKE_context.h" #include "BKE_idprop.h" #include "BKE_report.h" +#include "BKE_screen.h" #include "BKE_texture.h" #include "BKE_tracking.h" #include "BKE_unit.h" @@ -1556,6 +1557,15 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, MEM_freeN(str); } } + /* menu (any type) */ + else if (ELEM(but->type, MENU, PULLDOWN)) { + MenuType *mt = uiButGetMenuType(but); + if (mt) { + char str[32 + sizeof(mt->idname)]; + BLI_snprintf(str, sizeof(str), "bpy.ops.wm.call_menu(name=\"%s\")", mt->idname); + WM_clipboard_text_set(str, 0); + } + } } /* ************************ password text ****************************** diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 30ee9d29407..3bb88d08f1f 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1128,7 +1128,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar) retval = WM_UI_HANDLER_CONTINUE; for (block = ar->uiblocks.last; block; block = block->prev) { - int inside = 0, inside_header = 0, inside_scale = 0; + bool inside = false, inside_header = false, inside_scale = false; mx = event->x; my = event->y; @@ -1145,24 +1145,24 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar) /* clicked at panel header? */ if (pa->flag & PNL_CLOSEDX) { if (block->rect.xmin <= mx && block->rect.xmin + PNL_HEADER >= mx) - inside_header = 1; + inside_header = true; } else if (block->rect.xmin > mx || block->rect.xmax < mx) { /* outside left/right side */ } else if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my)) { - inside_header = 1; + inside_header = true; } else if (!(pa->flag & PNL_CLOSEDY)) { /* open panel */ if (pa->control & UI_PNL_SCALE) { if (block->rect.xmax - PNL_HEADER <= mx) if (block->rect.ymin + PNL_HEADER >= my) - inside_scale = 1; + inside_scale = true; } if (block->rect.xmin <= mx && block->rect.xmax >= mx) if (block->rect.ymin <= my && block->rect.ymax + PNL_HEADER >= my) - inside = 1; + inside = true; } /* XXX hardcoded key warning */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 474b9bc56fb..5c0bcabe62b 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1144,7 +1144,7 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) /* wake up animtimer */ if (win->screen->animtimer) - WM_event_timer_sleep(wm, win, win->screen->animtimer, 0); + WM_event_timer_sleep(wm, win, win->screen->animtimer, false); } if (G.debug & G_DEBUG_EVENTS) { @@ -1423,7 +1423,7 @@ void ED_screen_set(bContext *C, bScreen *sc) /* we put timer to sleep, so screen_exit has to think there's no timer */ oldscreen->animtimer = NULL; if (wt) - WM_event_timer_sleep(wm, win, wt, 1); + WM_event_timer_sleep(wm, win, wt, true); ED_screen_exit(C, win, oldscreen); oldscreen->animtimer = wt; |