4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2008 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
32 /* start of a generic 2d view with should allow drawing grids,
33 * panning, zooming, scrolling, .. */
35 #define V2D_UNIT_SECONDS 0
36 #define V2D_UNIT_FRAMES 1
38 #define V2D_GRID_CLAMP 0
39 #define V2D_GRID_NOCLAMP 1
41 #define V2D_IS_CLIPPED 12000
43 #define V2D_HORIZONTAL_LINES 1
44 #define V2D_VERTICAL_LINES 2
45 #define V2D_HORIZONTAL_AXIS 4
46 #define V2D_VERTICAL_AXIS 8
52 typedef struct View2DGrid View2DGrid;
55 void UI_view2d_ortho(const struct bContext *C, struct View2D *v2d);
56 void UI_view2d_update_size(struct View2D *v2d, int winx, int winy);
59 View2DGrid *UI_view2d_calc_grid(const struct bContext *C, struct View2D *v2d, int unit, int type, int winx, int winy);
60 void UI_view2d_draw_grid(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag);
61 void UI_view2d_free_grid(View2DGrid *grid);
63 /* coordinate conversion */
64 void UI_view2d_region_to_view(struct View2D *v2d, short x, short y, float *viewx, float *viewy);
65 void UI_view2d_view_to_region(struct View2D *v2d, float x, float y, short *regionx, short *regiony);
66 void UI_view2d_to_region_no_clip(struct View2D *v2d, float x, float y, short *regionx, short *region_y);
68 #endif /* UI_VIEW2D_H */