[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17734] branches/blender2.5/blender/source /blender/editors: View2D: Renamed a few API methods to follow standard naming conventions, and added define to use when an argument to these methods is irrelevant.
Joshua Leung
aligorith at gmail.com
Sun Dec 7 07:21:07 CET 2008
Revision: 17734
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17734
Author: aligorith
Date: 2008-12-07 07:21:06 +0100 (Sun, 07 Dec 2008)
Log Message:
-----------
View2D: Renamed a few API methods to follow standard naming conventions, and added define to use when an argument to these methods is irrelevant.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h
branches/blender2.5/blender/source/blender/editors/interface/view2d.c
branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c
branches/blender2.5/blender/source/blender/editors/space_time/space_time.c
Modified: branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h 2008-12-07 03:42:25 UTC (rev 17733)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h 2008-12-07 06:21:06 UTC (rev 17734)
@@ -38,6 +38,9 @@
/* generic value to use when coordinate lies out of view when converting */
#define V2D_IS_CLIPPED 12000
+/* 'dummy' argument to pass when argument is irrelevant */
+#define V2D_ARG_DUMMY -1
+
/* grid-units (for drawing time) */
#define V2D_UNIT_SECONDS 0
#define V2D_UNIT_FRAMES 1
@@ -84,7 +87,6 @@
/* Prototypes: */
/* refresh and validation (of view rects) */
- // XXX rename these...
void UI_view2d_size_update(struct View2D *v2d, int winx, int winy);
void UI_view2d_status_enforce(struct View2D *v2d);
@@ -97,14 +99,14 @@
void UI_view2d_view_restore(const struct bContext *C);
/* grid drawing */
-View2DGrid *UI_view2d_calc_grid(const struct bContext *C, struct View2D *v2d, short unit, short clamp, int winx, int winy);
-void UI_view2d_draw_grid(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag);
-void UI_view2d_free_grid(View2DGrid *grid);
+View2DGrid *UI_view2d_grid_calc(const struct bContext *C, struct View2D *v2d, short unit, short clamp, int winx, int winy);
+void UI_view2d_grid_draw(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag);
+void UI_view2d_grid_free(View2DGrid *grid);
/* scrollbar drawing */
-View2DScrollers *UI_view2d_calc_scrollers(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp);
-void UI_view2d_draw_scrollers(const struct bContext *C, struct View2D *v2d, View2DScrollers *scrollers);
-void UI_view2d_free_scrollers(View2DScrollers *scrollers);
+View2DScrollers *UI_view2d_scrollers_calc(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp);
+void UI_view2d_scrollers_draw(const struct bContext *C, struct View2D *v2d, View2DScrollers *scrollers);
+void UI_view2d_scrollers_free(View2DScrollers *scrollers);
/* coordinate conversion */
void UI_view2d_region_to_view(struct View2D *v2d, int x, int y, float *viewx, float *viewy);
Modified: branches/blender2.5/blender/source/blender/editors/interface/view2d.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/view2d.c 2008-12-07 03:42:25 UTC (rev 17733)
+++ branches/blender2.5/blender/source/blender/editors/interface/view2d.c 2008-12-07 06:21:06 UTC (rev 17734)
@@ -552,7 +552,7 @@
/* Intialise settings necessary for drawing gridlines in a 2d-view
* - Currently, will return pointer to View2DGrid struct that needs to
- * be freed with UI_view2d_free_grid()
+ * be freed with UI_view2d_grid_free()
* - Is used for scrollbar drawing too (for units drawing)
*
* - unit = V2D_UNIT_* grid steps in seconds or frames
@@ -560,7 +560,7 @@
* - winx = width of region we're drawing to
* - winy = height of region we're drawing into
*/
-View2DGrid *UI_view2d_calc_grid(const bContext *C, View2D *v2d, short unit, short clamp, int winx, int winy)
+View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short unit, short clamp, int winx, int winy)
{
View2DGrid *grid;
float space, pixels, seconddiv;
@@ -616,7 +616,7 @@
}
/* Draw gridlines in the given 2d-region */
-void UI_view2d_draw_grid(const bContext *C, View2D *v2d, View2DGrid *grid, int flag)
+void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int flag)
{
float vec1[2], vec2[2];
int a, step;
@@ -724,7 +724,7 @@
}
/* free temporary memory used for drawing grid */
-void UI_view2d_free_grid(View2DGrid *grid)
+void UI_view2d_grid_free(View2DGrid *grid)
{
MEM_freeN(grid);
}
@@ -745,7 +745,7 @@
};
/* Calculate relevant scroller properties */
-View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp)
+View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp)
{
View2DScrollers *scrollers;
rcti vert, hor;
@@ -764,7 +764,7 @@
/* horizontal scrollers */
if (v2d->scroll & (V2D_SCROLL_HORIZONTAL|V2D_SCROLL_HORIZONTAL_O)) {
- /* slider 'button' extents */
+ /* scroller 'button' extents */
totsize= v2d->tot.xmax - v2d->tot.xmin;
scrollsize= hor.xmax - hor.xmin;
@@ -782,7 +782,7 @@
/* vertical scrollers */
if (v2d->scroll & V2D_SCROLL_VERTICAL) {
- /* slider 'button' extents */
+ /* scroller 'button' extents */
totsize= v2d->tot.ymax - v2d->tot.ymin;
scrollsize= vert.ymax - vert.ymin;
@@ -808,9 +808,9 @@
/* calculate grid */
if (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL)
- scrollers->grid= UI_view2d_calc_grid(C, v2d, xunits, xclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
+ scrollers->grid= UI_view2d_grid_calc(C, v2d, xunits, xclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
else if (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL)
- scrollers->grid= UI_view2d_calc_grid(C, v2d, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
+ scrollers->grid= UI_view2d_grid_calc(C, v2d, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
}
/* return scrollers */
@@ -925,7 +925,7 @@
/* Draw scrollbars in the given 2d-region */
-void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *scrollers)
+void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *scrollers)
{
const int darker= -40, dark= 0, light= 20, lighter= 50;
rcti vert, hor;
@@ -1088,7 +1088,7 @@
}
/* free temporary memory used for drawing scrollers */
-void UI_view2d_free_scrollers(View2DScrollers *scrollers)
+void UI_view2d_scrollers_free(View2DScrollers *scrollers)
{
/* need to free grid as well... */
if (scrollers->grid) MEM_freeN(scrollers->grid);
Modified: branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c 2008-12-07 03:42:25 UTC (rev 17733)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c 2008-12-07 06:21:06 UTC (rev 17734)
@@ -403,7 +403,6 @@
/* update size of tot-rect (extents of data/viewable area) */
UI_view2d_totRect_set(v2d, width, height);
-
rct.xmin= 0;
rct.ymin= -height;
rct.xmax= width;
@@ -425,9 +424,9 @@
UI_view2d_view_restore(C);
/* scrollers */
- scrollers= UI_view2d_calc_scrollers(C, v2d, 0, 0, 0, 0);
- UI_view2d_draw_scrollers(C, v2d, scrollers);
- UI_view2d_free_scrollers(scrollers);
+ scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ UI_view2d_scrollers_draw(C, v2d, scrollers);
+ UI_view2d_scrollers_free(scrollers);
}
static void outliner_main_area_free(ARegion *ar)
Modified: branches/blender2.5/blender/source/blender/editors/space_time/space_time.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_time/space_time.c 2008-12-07 03:42:25 UTC (rev 17733)
+++ branches/blender2.5/blender/source/blender/editors/space_time/space_time.c 2008-12-07 06:21:06 UTC (rev 17734)
@@ -138,9 +138,9 @@
/* grid */
unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS;
- grid= UI_view2d_calc_grid(C, v2d, unit, V2D_GRID_CLAMP, winx, winy);
- UI_view2d_draw_grid(C, v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS));
- UI_view2d_free_grid(grid);
+ grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, winx, winy);
+ UI_view2d_grid_draw(C, v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS));
+ UI_view2d_grid_free(grid);
/* current frame */
time_draw_cfra_time(C, stime, ar);
@@ -153,9 +153,9 @@
UI_view2d_view_restore(C);
/* scrollers */
- scrollers= UI_view2d_calc_scrollers(C, v2d, unit, V2D_GRID_CLAMP, 0, 0);
- UI_view2d_draw_scrollers(C, v2d, scrollers);
- UI_view2d_free_scrollers(scrollers);
+ scrollers= UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ UI_view2d_scrollers_draw(C, v2d, scrollers);
+ UI_view2d_scrollers_free(scrollers);
}
static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
More information about the Bf-blender-cvs
mailing list