diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-11-19 04:41:11 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-11-19 04:41:11 +0400 |
commit | b7cd9ec3ada529bf1d57cf08cc96851ceb67a47d (patch) | |
tree | 4ec25ec70b30c3e4a18b384e1938e3aec957d264 /source/blender/windowmanager | |
parent | 6cee7bb2b77bc7b577a3067c30dc56e22b4752ce (diff) | |
parent | eb1fccd8a54c33a057fa3692eb3dfa1012f4fdfc (diff) |
Merged changes in the trunk up to revision 52340.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 10 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 28 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_playanim.c | 125 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_event_types.h | 6 |
7 files changed, 104 insertions, 72 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index c53c4dca74c..e35e3edfa33 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -181,6 +181,7 @@ int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imt /* poll callback, context checks */ int WM_operator_winactive (struct bContext *C); /* invoke callback, exec + redo popup */ +int WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, struct wmEvent *event); int WM_operator_props_popup (struct bContext *C, struct wmOperator *op, struct wmEvent *event); int WM_operator_props_dialog_popup (struct bContext *C, struct wmOperator *op, int width, int height); int WM_operator_redo_popup (struct bContext *C, struct wmOperator *op); diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 60e3f7d6164..bd6e752076d 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -711,14 +711,14 @@ static int wm_automatic_draw_method(wmWindow *win) if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) return USER_DRAW_OVERLAP; /* also Intel drivers are slow */ - /* 2.64 BCon3 period, let's try if intel now works... +#if 0 /* 2.64 BCon3 period, let's try if intel now works... */ else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_UNIX, GPU_DRIVER_ANY)) return USER_DRAW_OVERLAP; else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_ANY)) return USER_DRAW_OVERLAP_FLIP; else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY)) return USER_DRAW_OVERLAP_FLIP; - */ +#endif /* Windows software driver darkens color on each redraw */ else if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE)) return USER_DRAW_OVERLAP_FLIP; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 54e61df4f6a..5cbad42134c 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -340,7 +340,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve int retval; /* UI code doesn't handle return values - it just always returns break. - to make the DBL_CLICK conversion work, we just don't send this to UI */ + * to make the DBL_CLICK conversion work, we just don't send this to UI */ if (event->val == KM_DBL_CLICK) return WM_HANDLER_CONTINUE; @@ -1288,9 +1288,9 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi) /* the matching rules */ if (kmitype == KM_TEXTINPUT) - if (winevent->val == KM_PRESS) { // prevent double clicks + if (winevent->val == KM_PRESS) { /* prevent double clicks */ /* NOT using ISTEXTINPUT anymore because (at least on Windows) some key codes above 255 - could have printable ascii keys - BUG [#30479] */ + * could have printable ascii keys - BUG [#30479] */ if (ISKEYBOARD(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1; } @@ -1550,8 +1550,8 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa if (handler->op->reports->list.first) { /* FIXME, temp setting window, this is really bad! - * only have because lib linking errors need to be seen by users :( - * it can be removed without breaking anything but then no linking errors - campbell */ + * only have because lib linking errors need to be seen by users :( + * it can be removed without breaking anything but then no linking errors - campbell */ wmWindow *win_prev = CTX_wm_window(C); ScrArea *area_prev = CTX_wm_area(C); ARegion *ar_prev = CTX_wm_region(C); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 126d497e08e..896a24f3fba 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1201,8 +1201,11 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height) return OPERATOR_RUNNING_MODAL; } -/* operator menu needs undo, for redo callback */ -int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +/** + * For use by #WM_operator_props_popup_call, #WM_operator_props_popup only. + * + * \note operator menu needs undo flag enabled , for redo callback */ +static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const int do_call) { if ((op->type->flag & OPTYPE_REGISTER) == 0) { @@ -1210,15 +1213,34 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) "Operator '%s' does not have register enabled, incorrect invoke function", op->type->idname); return OPERATOR_CANCELLED; } - + ED_undo_push_op(C, op); + wm_operator_register(C, op); uiPupBlock(C, wm_block_create_redo, op); + if (do_call) { + WM_operator_repeat(C, op); + } + return OPERATOR_RUNNING_MODAL; } +/* Same as WM_operator_props_popup but call the operator first, + * This way - the button values correspond to the result of the operator. + * Without this, first access to a button will make the result jump, + * see [#32452] */ +int WM_operator_props_popup_call(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +{ + return wm_operator_props_popup_ex(C, op, TRUE); +} + +int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) +{ + return wm_operator_props_popup_ex(C, op, FALSE); +} + int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height) { wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup"); diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 96bbedfee1b..f4c2c13dcac 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -61,6 +61,7 @@ #include "BKE_blender.h" #include "BKE_global.h" +#include "BKE_image.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -74,6 +75,9 @@ #include "WM_api.h" /* only for WM_main_playanim */ +struct PlayState; +static void playanim_window_zoom(const struct PlayState *ps, const float zoom_offset); + typedef struct PlayState { /* playback state */ @@ -84,7 +88,6 @@ typedef struct PlayState { short pingpong; short noskip; short sstep; - short pause; short wait2; short stopped; short go; @@ -132,6 +135,7 @@ typedef enum eWS_Qual { WS_QUAL_ALT = (WS_QUAL_LALT | WS_QUAL_RALT), WS_QUAL_LCTRL = (1 << 4), WS_QUAL_RCTRL = (1 << 5), + WS_QUAL_CTRL = (WS_QUAL_LCTRL | WS_QUAL_RCTRL), WS_QUAL_LMOUSE = (1 << 16), WS_QUAL_MMOUSE = (1 << 17), WS_QUAL_RMOUSE = (1 << 18), @@ -179,12 +183,12 @@ static void playanim_event_qual_update(void) /* Alt */ GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyLeftAlt, &val); - if (val) g_WS.qual |= WS_QUAL_LCTRL; - else g_WS.qual &= ~WS_QUAL_LCTRL; + if (val) g_WS.qual |= WS_QUAL_LALT; + else g_WS.qual &= ~WS_QUAL_LALT; GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightAlt, &val); - if (val) g_WS.qual |= WS_QUAL_RCTRL; - else g_WS.qual &= ~WS_QUAL_RCTRL; + if (val) g_WS.qual |= WS_QUAL_RALT; + else g_WS.qual &= ~WS_QUAL_RALT; /* LMB */ GHOST_GetButtonState(g_WS.ghost_system, GHOST_kButtonMaskLeft, &val); @@ -234,7 +238,7 @@ static void playanim_toscreen(PlayAnimPict *picture, struct ImBuf *ibuf, int fon { if (ibuf == NULL) { - printf("no ibuf !\n"); + printf("%s: no ibuf for picture '%s'\n", __func__, picture ? picture->name : "<NIL>"); return; } if (ibuf->rect == NULL && ibuf->rect_float) { @@ -432,6 +436,11 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) ps->stopped = FALSE; } + if (ps->wait2) { + pupdate_time(); + ptottime = 0; + } + switch (type) { case GHOST_kEventKeyDown: case GHOST_kEventKeyUp: @@ -539,28 +548,6 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) } } break; - case GHOST_kKeyEqual: - if (val) { - if (g_WS.qual & WS_QUAL_SHIFT) { - ps->pause++; - printf("pause:%d\n", ps->pause); - } - else { - swaptime /= 1.1; - } - } - break; - case GHOST_kKeyMinus: - if (val) { - if (g_WS.qual & WS_QUAL_SHIFT) { - ps->pause--; - printf("pause:%d\n", ps->pause); - } - else { - swaptime *= 1.1; - } - } - break; case GHOST_kKeyNumpad0: if (val) { if (ps->once) { @@ -588,29 +575,28 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) } } break; + case GHOST_kKeyEqual: case GHOST_kKeyNumpadPlus: + { if (val == 0) break; - zoomx += 2.0f; - zoomy += 2.0f; - /* no break??? - is this intentional? - campbell XXX25 */ + if (g_WS.qual & WS_QUAL_CTRL) { + playanim_window_zoom(ps, 1.0f); + } + else { + swaptime /= 1.1; + } + break; + } + case GHOST_kKeyMinus: case GHOST_kKeyNumpadMinus: { - int sizex, sizey; - /* int ofsx, ofsy; */ /* UNUSED */ - if (val == 0) break; - if (zoomx > 1.0f) zoomx -= 1.0f; - if (zoomy > 1.0f) zoomy -= 1.0f; - // playanim_window_get_position(&ofsx, &ofsy); - playanim_window_get_size(&sizex, &sizey); - /* ofsx += sizex / 2; */ /* UNUSED */ - /* ofsy += sizey / 2; */ /* UNUSED */ - sizex = zoomx * ps->ibufx; - sizey = zoomy * ps->ibufy; - /* ofsx -= sizex / 2; */ /* UNUSED */ - /* ofsy -= sizey / 2; */ /* UNUSED */ - // window_set_position(g_WS.ghost_window,sizex,sizey); - GHOST_SetClientSize(g_WS.ghost_window, sizex, sizey); + if (g_WS.qual & WS_QUAL_CTRL) { + playanim_window_zoom(ps, -1.0f); + } + else { + swaptime *= 1.1; + } break; } case GHOST_kKeyEsc: @@ -716,6 +702,25 @@ static void playanim_window_open(const char *title, int posx, int posy, int size FALSE /* no stereo */, FALSE); } +static void playanim_window_zoom(const PlayState *ps, const float zoom_offset) +{ + int sizex, sizey; + /* int ofsx, ofsy; */ /* UNUSED */ + + if (zoomx + zoom_offset > 0.0f) zoomx += zoom_offset; + if (zoomy + zoom_offset > 0.0f) zoomy += zoom_offset; + + // playanim_window_get_position(&ofsx, &ofsy); + playanim_window_get_size(&sizex, &sizey); + /* ofsx += sizex / 2; */ /* UNUSED */ + /* ofsy += sizey / 2; */ /* UNUSED */ + sizex = zoomx * ps->ibufx; + sizey = zoomy * ps->ibufy; + /* ofsx -= sizex / 2; */ /* UNUSED */ + /* ofsy -= sizey / 2; */ /* UNUSED */ + // window_set_position(g_WS.ghost_window,sizex,sizey); + GHOST_SetClientSize(g_WS.ghost_window, sizex, sizey); +} void WM_main_playanim(int argc, const char **argv) { @@ -736,13 +741,12 @@ void WM_main_playanim(int argc, const char **argv) /* ps.doubleb = TRUE;*/ /* UNUSED */ ps.go = TRUE; ps.direction = TRUE; - ps.next = TRUE; + ps.next = 1; ps.once = FALSE; ps.turbo = FALSE; ps.pingpong = FALSE; ps.noskip = FALSE; ps.sstep = FALSE; - ps.pause = FALSE; ps.wait2 = FALSE; ps.stopped = FALSE; ps.picture = NULL; @@ -939,6 +943,7 @@ void WM_main_playanim(int argc, const char **argv) if (ptottime > 0.0) ptottime = 0.0; while (ps.picture) { + int hasevent; #ifndef USE_IMB_CACHE if (ibuf != NULL && ibuf->ftype == 0) IMB_freeImBuf(ibuf); #endif @@ -992,19 +997,22 @@ void WM_main_playanim(int argc, const char **argv) ps.next = ps.direction; - { - int hasevent = GHOST_ProcessEvents(g_WS.ghost_system, 0); + while ((hasevent = GHOST_ProcessEvents(g_WS.ghost_system, 0) || ps.wait2 != 0)) { if (hasevent) { GHOST_DispatchEvents(g_WS.ghost_system); } - } - - /* XXX25 - we should not have to do this, but it makes scrubbing functional! */ - if (g_WS.qual & WS_QUAL_LMOUSE) { - ps.next = 0; - } - else { - ps.sstep = 0; + if (ps.wait2) { + if (hasevent) { + if (ibuf) { + while (pupdate_time()) PIL_sleep_ms(1); + ptottime -= swaptime; + playanim_toscreen(ps.picture, ibuf, ps.fontid, ps.fstep); + } + } + } + if (!ps.go) { + break; + } } ps.wait2 = ps.sstep; @@ -1082,6 +1090,7 @@ void WM_main_playanim(int argc, const char **argv) /* we still miss freeing a lot!, * but many areas could skip initialization too for anim play */ IMB_exit(); + BKE_images_exit(); BLF_exit(); #endif GHOST_DisposeWindow(g_WS.ghost_system, g_WS.ghost_window); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index fbb3466032d..09f7e1692d9 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -337,7 +337,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) int scr_w, scr_h, posy; /* force setting multisamples only once, it requires restart - and you cannot - mix it, either all windows have it, or none (tested in OSX opengl) */ + * mix it, either all windows have it, or none (tested in OSX opengl) */ if (multisamples == -1) multisamples = U.ogl_multisamples; diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index ca0e9659a22..4d3d6ef89d9 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -285,9 +285,9 @@ enum { /* for event checks */ /* only used for KM_TEXTINPUT, so assume that we want all user-inputtable ascii codes included */ - /* UNUSED - see wm_eventmatch - BUG [#30479] -#define ISTEXTINPUT(event) (event >= ' ' && event <= 255) - */ + /* UNUSED - see wm_eventmatch - BUG [#30479] */ +// #define ISTEXTINPUT(event) (event >= ' ' && event <= 255) + /* test whether the event is a key on the keyboard */ #define ISKEYBOARD(event) (event >= ' ' && event <= 320) |