Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/view2d.c
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2008 Blender Foundation. | * The Original Code is Copyright (C) 2008 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup edinterface | * \ingroup edinterface | ||||
| */ | */ | ||||
| #include <CLG_log.h> | |||||
| #include <float.h> | #include <float.h> | ||||
| #include <limits.h> | #include <limits.h> | ||||
| #include <math.h> | #include <math.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| Show All 23 Lines | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "interface_intern.h" | #include "interface_intern.h" | ||||
| static CLG_LogRef LOG = {"interface.view2d"}; | |||||
| static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize); | static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize); | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Internal Utilities | /** \name Internal Utilities | ||||
| * \{ */ | * \{ */ | ||||
| BLI_INLINE int clamp_float_to_int(const float f) | BLI_INLINE int clamp_float_to_int(const float f) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 914 Lines • ▼ Show 20 Lines | |||||
| /* Change the size of the maximum viewable area (i.e. 'tot' rect) */ | /* Change the size of the maximum viewable area (i.e. 'tot' rect) */ | ||||
| void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resize) | void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resize) | ||||
| { | { | ||||
| /* don't do anything if either value is 0 */ | /* don't do anything if either value is 0 */ | ||||
| width = abs(width); | width = abs(width); | ||||
| height = abs(height); | height = abs(height); | ||||
| if (ELEM(0, width, height)) { | if (ELEM(0, width, height)) { | ||||
| if (G.debug & G_DEBUG) { | CLOG_ERROR( | ||||
| printf("Error: View2D totRect set exiting: v2d=%p width=%d height=%d\n", | &LOG, "View2D totRect set exiting: v2d=%p width=%d height=%d", (void *)v2d, width, height); | ||||
| (void *)v2d, | |||||
| width, | |||||
| height); // XXX temp debug info | |||||
| } | |||||
| return; | return; | ||||
| } | } | ||||
| /* handle width - posx and negx flags are mutually exclusive, so watch out */ | /* handle width - posx and negx flags are mutually exclusive, so watch out */ | ||||
| if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) { | if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) { | ||||
| /* width is in negative-x half */ | /* width is in negative-x half */ | ||||
| v2d->tot.xmin = (float)-width; | v2d->tot.xmin = (float)-width; | ||||
| v2d->tot.xmax = 0.0f; | v2d->tot.xmax = 0.0f; | ||||
| ▲ Show 20 Lines • Show All 1,228 Lines • Show Last 20 Lines | |||||