[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32066] trunk/blender/source/blender/ editors/interface/interface_handlers.c: patch [#23675] fix #22787 with workaround

Campbell Barton ideasman42 at gmail.com
Wed Sep 22 19:13:23 CEST 2010


Revision: 32066
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32066
Author:   campbellbarton
Date:     2010-09-22 19:13:23 +0200 (Wed, 22 Sep 2010)

Log Message:
-----------
patch [#23675] fix #22787 with workaround
from Shane Ambler (sambler)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_handlers.c

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2010-09-22 16:47:46 UTC (rev 32065)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2010-09-22 17:13:23 UTC (rev 32066)
@@ -5404,20 +5404,44 @@
 						if(event->val==KM_PRESS) {
 							but= ui_but_find_activated(ar);
 							if(but) {
-								if(ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) 
-									but= ui_but_next(but);
-								else
-									but= ui_but_prev(but);
+								/* is there a situation where UI_LEFT or UI_RIGHT would also change navigation direction? */
+								/* UI_TOP and UI_DOWN are inconsistant - should be UI_UP and UI_DOWN or UI_TOP and UI_BOTTOM */
+								if(	((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) ||
+									((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_TOP))
+								) {
+									/* the following is just a hack - uiBut->type set to BUT and BUTM have there menus built 
+									 * opposite ways - this should be changed so that all popup-menus use the same uiBlock->direction */
+									if(but->type & BUT)
+										but= ui_but_next(but);
+									else
+										but= ui_but_prev(but);
+								}
+								else {
+									if(but->type & BUT)
+										but= ui_but_prev(but);
+									else
+										but= ui_but_next(but);
+								}
 
 								if(but)
 									ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
 							}
 
 							if(!but) {
-								if(ELEM(event->type, UPARROWKEY, WHEELUPMOUSE))
-									bt= ui_but_last(block);
-								else
-									bt= ui_but_first(block);
+								if(	((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) ||
+									((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))
+								) {
+									if(ui_but_first(block)->type & BUT)
+										bt= ui_but_last(block);
+									else
+										bt= ui_but_first(block);
+								}
+								else {
+									if(ui_but_first(block)->type & BUT)
+										bt= ui_but_first(block);
+									else
+										bt= ui_but_last(block);
+							   }
 
 								if(bt)
 									ui_handle_button_activate(C, ar, bt, BUTTON_ACTIVATE);





More information about the Bf-blender-cvs mailing list