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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-12-03 16:14:01 +0300
committerTon Roosendaal <ton@blender.org>2008-12-03 16:14:01 +0300
commitd8ed4c389c750f0513a7024fa5dadeb28c05749b (patch)
treeb84d16e983691c3b95b1bf01ee6264a986eeddf9 /source
parent92cbb4b033ee236aafefbf22b2e2adfb363d36b1 (diff)
2.5 fixes
- View2d bug: it was taking sliders into account for setting the window matrix, which it shouldn't (glViewport does). This caused error offset in drawing, like for current-frame scrolling. - Current frame scrolling in TimeWindow back on window level. (used to crash, but that was fixed in WM) - Made UI_view2d_region_to_view accept ints, no shorts - removed debug function in interface_ops.c
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_view2d.h2
-rw-r--r--source/blender/editors/interface/interface_ops.c15
-rw-r--r--source/blender/editors/interface/view2d.c44
-rw-r--r--source/blender/editors/space_time/time_ops.c6
4 files changed, 15 insertions, 52 deletions
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index cd2345bf247..86f47efd284 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -99,7 +99,7 @@ void UI_view2d_draw_scrollers(const struct bContext *C, struct View2D *v2d, View
void UI_view2d_free_scrollers(View2DScrollers *scrollers);
/* coordinate conversion */
-void UI_view2d_region_to_view(struct View2D *v2d, short x, short y, float *viewx, float *viewy);
+void UI_view2d_region_to_view(struct View2D *v2d, int x, int y, float *viewx, float *viewy);
void UI_view2d_view_to_region(struct View2D *v2d, float x, float y, short *regionx, short *regiony);
void UI_view2d_to_region_no_clip(struct View2D *v2d, float x, float y, short *regionx, short *region_y);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index aa09a0a7ba7..2852b758c81 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -3080,25 +3080,14 @@ static int menu_block_handle_block_open(uiBlock *block)
return 0;
}
-#include "wm_event_system.h"
-static void testing123(bContext *C)
-{
- wmEventHandler *handler;
-
- for(handler= C->window->handlers.first; handler; handler= handler->next) {
- if(handler->op)
- printf("handler has op %s\n", handler->op->type->idname);
- }
-}
-
/* moves focus on button/menu from mousemove-based to hotkey */
static void menu_block_handle_activate_button(bContext *C, wmEvent *event, ARegion *butregion, uiBut *but, int activateflag)
{
wmOperatorType *ot;
ot= WM_operatortype_find("ED_UI_OT_button_activate");
- testing123(C);
-// XXX WM_operator_cancel(C, &butregion->modalops, ot);
+
+ // XXX WM_operator_cancel(C, &butregion->modalops, ot);
but->activateflag= activateflag;
SWAP(ARegion*, C->region, butregion); /* XXX 2.50 bad state manipulation? */
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index d16b41f4f74..863c116825a 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -326,32 +326,18 @@ void UI_view2d_enforce_status(View2D *v2d, int winx, int winy)
/* View Matrix Setup */
/* Set view matrices to use 'cur' rect as viewing frame for View2D drawing
- * - Scrollbars are taken into account when making this matrix, given that most regions have them
+ * - this assumes viewport/scissor been set for the region, taking scrollbars into account
*/
void UI_view2d_view_ortho(const bContext *C, View2D *v2d)
{
- float ofsx1, ofsy1, ofsx2, ofsy2;
-
- ofsx1= ofsy1= ofsx2= ofsy2= 0.0f;
-
- /* calculate offset factor required on each axis */
- if (v2d->scroll & L_SCROLL)
- ofsy1= (float)SCROLLB;
- if (v2d->scroll & R_SCROLL)
- ofsy2= (float)SCROLLB;
- if (v2d->scroll & T_SCROLL)
- ofsx1= (float)SCROLLH;
- if (v2d->scroll & B_SCROLL)
- ofsx2= (float)SCROLLH;
-
/* set the matrix - pixel offsets (-0.375) for 1:1 correspondance are not applied,
* as they were causing some unwanted offsets when drawing
*/
- wmOrtho2(C->window, v2d->cur.xmin-ofsx1, v2d->cur.xmax-ofsx2, v2d->cur.ymin-ofsy1, v2d->cur.ymax-ofsx2);
+ wmOrtho2(C->window, v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
}
-/* Set view matices to only use one axis of 'cur' only
- * - Scrollbars on appropriate axis will be taken into account
+/* Set view matrices to only use one axis of 'cur' only
+ * - this assumes viewport/scissor been set for the region, taking scrollbars into account
*
* - xaxis = if non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x)
*/
@@ -359,30 +345,18 @@ void UI_view2d_view_orthospecial(const bContext *C, View2D *v2d, short xaxis)
{
ARegion *region= C->region;
int winx, winy;
- float ofsx1, ofsy1, ofsx2, ofsy2;
/* calculate extents of region */
winx= region->winrct.xmax - region->winrct.xmin;
winy= region->winrct.ymax - region->winrct.ymin;
- ofsx1= ofsy1= ofsx2= ofsy2= 0.0f;
-
- /* calculate offset factor required on each axis */
- if (v2d->scroll & L_SCROLL)
- ofsy1= (float)SCROLLB;
- if (v2d->scroll & R_SCROLL)
- ofsy2= (float)SCROLLB;
- if (v2d->scroll & T_SCROLL)
- ofsx1= (float)SCROLLH;
- if (v2d->scroll & B_SCROLL)
- ofsx2= (float)SCROLLH;
/* set the matrix - pixel offsets (-0.375) for 1:1 correspondance are not applied,
* as they were causing some unwanted offsets when drawing
*/
if (xaxis)
- wmOrtho2(C->window, v2d->cur.xmin-ofsx1, v2d->cur.xmax-ofsx2, 0, winy);
+ wmOrtho2(C->window, v2d->cur.xmin, v2d->cur.xmax, 0, winy);
else
- wmOrtho2(C->window, 0, winx, v2d->cur.ymin-ofsy1, v2d->cur.ymax-ofsx2);
+ wmOrtho2(C->window, 0, winx, v2d->cur.ymin, v2d->cur.ymax);
}
@@ -777,7 +751,7 @@ void UI_view2d_free_scrollers(View2DScrollers *scrollers)
* - x,y = coordinates to convert
* - viewx,viewy = resultant coordinates
*/
-void UI_view2d_region_to_view(View2D *v2d, short x, short y, float *viewx, float *viewy)
+void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *viewx, float *viewy)
{
float div, ofs;
@@ -785,14 +759,14 @@ void UI_view2d_region_to_view(View2D *v2d, short x, short y, float *viewx, float
div= v2d->mask.xmax - v2d->mask.xmin;
ofs= v2d->mask.xmin;
- *viewx= v2d->cur.xmin + (v2d->cur.xmax-v2d->cur.xmin) * (x - ofs) / div;
+ *viewx= v2d->cur.xmin + (v2d->cur.xmax-v2d->cur.xmin) * ((float)x - ofs) / div;
}
if (viewy) {
div= v2d->mask.ymax - v2d->mask.ymin;
ofs= v2d->mask.ymin;
- *viewy= v2d->cur.ymin + (v2d->cur.ymax - v2d->cur.ymin) * (y - ofs) / div;
+ *viewy= v2d->cur.ymin + (v2d->cur.ymax - v2d->cur.ymin) * ((float)y - ofs) / div;
}
}
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index 27e89422f98..657cf30e17e 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -27,6 +27,7 @@
*/
#include <stdlib.h>
+#include <math.h>
#include "MEM_guardedalloc.h"
@@ -107,7 +108,6 @@ static int change_frame_exec(bContext *C, wmOperator *op)
static int frame_from_event(bContext *C, wmEvent *event)
{
- SpaceTime *stime= C->area->spacedata.first;
ARegion *region= C->region;
int x, y;
float viewx;
@@ -116,7 +116,7 @@ static int frame_from_event(bContext *C, wmEvent *event)
y= event->y - region->winrct.ymin;
UI_view2d_region_to_view(&region->v2d, x, y, &viewx, NULL);
- return (int)(viewx+0.5f);
+ return (int)floor(viewx+0.5f);
}
static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -126,7 +126,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
change_frame_apply(C, op);
/* add temp handler */
- WM_event_add_modal_handler(C, &C->region->handlers, op);// XXX should be for window, but we crash otherwise
+ WM_event_add_modal_handler(C, &C->window->handlers, op);
return OPERATOR_RUNNING_MODAL;
}