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
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-03-01 08:45:44 +0300
committerJoshua Leung <aligorith@gmail.com>2009-03-01 08:45:44 +0300
commit7f8b81c5d40f0623bac06f8b4a515b935ad53d59 (patch)
treed5fecdf258e4cac789dc4068bf3eb8fda0676bae /source/blender/editors/interface/view2d.c
parent31750bf1de38ccfc5012441bdc95304372fa6208 (diff)
2.5 - Animation related tweaks
* Scrollers for zoomable views are now always shown again. The previous method was quite bad for these, as there would be flickering as the view was zoomed + panned. Also, the old method was not suggestive of the drag-zoom features on the scrollers, which was provided by the shaded bars. (Non-zoomable views will still only show scrollers where appropriate). * Insert-Key in 3d-view (i.e. the 'temp' operator which still needs to be ported to use builtin relative keyingsets) had a bug where the wrong keyframe were being inserted (rotation in instead of location, scaling instead of rotation) for bones.
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r--source/blender/editors/interface/view2d.c189
1 files changed, 99 insertions, 90 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 15b345e5992..693f540128f 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1375,61 +1375,65 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* scroller 'button'
* - if view is zoomable in x, draw handles too
* - handles are drawn darker
- * - no slider when view is > total
+ * - no slider when view is > total for non-zoomable views
+ * (otherwise, zoomable ones tend to flicker)
*/
- if (v2d->tot.xmax-v2d->tot.xmin <= v2d->cur.xmax-v2d->cur.xmin);
- else if (v2d->keepzoom & V2D_LOCKZOOM_X) {
- /* draw base bar as rounded shape */
- UI_ThemeColorShade(TH_SHADE1, dark);
- uiSetRoundBox(15);
-
- /* check that box is large enough for round drawing */
- if ((vs->hor_max - vs->hor_min) < (V2D_SCROLLCAP_RAD * 2)) {
- /* Rounded box still gets drawn at the minimum size limit
- * This doesn't represent extreme scaling well, but looks nicer...
- */
- float mid= 0.5f * (vs->hor_max + vs->hor_min);
+ if ( (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) ||
+ ((v2d->tot.xmax - v2d->tot.xmin) > (v2d->cur.xmax - v2d->cur.xmin)) )
+ {
+ if (v2d->keepzoom & V2D_LOCKZOOM_X) {
+ /* draw base bar as rounded shape */
+ UI_ThemeColorShade(TH_SHADE1, dark);
+ uiSetRoundBox(15);
- gl_round_box_shade(GL_POLYGON,
- mid-V2D_SCROLLCAP_RAD, (float)hor.ymin+2,
- mid+V2D_SCROLLCAP_RAD, (float)hor.ymax-2,
- V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+ /* check that box is large enough for round drawing */
+ if ((vs->hor_max - vs->hor_min) < (V2D_SCROLLCAP_RAD * 2)) {
+ /* Rounded box still gets drawn at the minimum size limit
+ * This doesn't represent extreme scaling well, but looks nicer...
+ */
+ float mid= 0.5f * (vs->hor_max + vs->hor_min);
+
+ gl_round_box_shade(GL_POLYGON,
+ mid-V2D_SCROLLCAP_RAD, (float)hor.ymin+2,
+ mid+V2D_SCROLLCAP_RAD, (float)hor.ymax-2,
+ V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+ }
+ else {
+ /* draw rounded box as per normal */
+ gl_round_box_shade(GL_POLYGON,
+ (float)vs->hor_min, (float)hor.ymin+2,
+ (float)vs->hor_max, (float)hor.ymax-2,
+ V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+ }
}
else {
- /* draw rounded box as per normal */
+ /* base bar drawn as shaded rect */
+ UI_ThemeColorShade(TH_SHADE1, dark);
+ uiSetRoundBox(0);
gl_round_box_shade(GL_POLYGON,
(float)vs->hor_min, (float)hor.ymin+2,
(float)vs->hor_max, (float)hor.ymax-2,
V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+
+ /* 'minimum' handle */
+ uiSetRoundBox(9);
+ UI_ThemeColorShade(TH_SHADE1, darker);
+
+ gl_round_box_shade(GL_POLYGON,
+ (float)vs->hor_min-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2,
+ (float)vs->hor_min+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2,
+ V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
+
+ /* maximum handle */
+ uiSetRoundBox(6);
+ UI_ThemeColorShade(TH_SHADE1, darker);
+
+ gl_round_box_shade(GL_POLYGON,
+ (float)vs->hor_max-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2,
+ (float)vs->hor_max+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2,
+ V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
}
}
- else {
- /* base bar drawn as shaded rect */
- UI_ThemeColorShade(TH_SHADE1, dark);
- uiSetRoundBox(0);
- gl_round_box_shade(GL_POLYGON,
- (float)vs->hor_min, (float)hor.ymin+2,
- (float)vs->hor_max, (float)hor.ymax-2,
- V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
-
- /* 'minimum' handle */
- uiSetRoundBox(9);
- UI_ThemeColorShade(TH_SHADE1, darker);
-
- gl_round_box_shade(GL_POLYGON,
- (float)vs->hor_min-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2,
- (float)vs->hor_min+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2,
- V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
-
- /* maximum handle */
- uiSetRoundBox(6);
- UI_ThemeColorShade(TH_SHADE1, darker);
-
- gl_round_box_shade(GL_POLYGON,
- (float)vs->hor_max-V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymin+2,
- (float)vs->hor_max+V2D_SCROLLER_HANDLE_SIZE, (float)hor.ymax-2,
- V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
- }
/* scale indicators */
// XXX will need to update the font drawing when the new stuff comes in
@@ -1512,60 +1516,65 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* scroller 'button'
* - if view is zoomable in y, draw handles too
* - handles are drawn darker
+ * - no slider when view is > total for non-zoomable views
+ * (otherwise, zoomable ones tend to flicker)
*/
- if (v2d->tot.ymax-v2d->tot.ymin <= v2d->cur.ymax-v2d->cur.ymin);
- else if (v2d->keepzoom & V2D_LOCKZOOM_Y) {
- /* draw base bar as rounded shape */
- UI_ThemeColorShade(TH_SHADE1, dark);
- uiSetRoundBox(15);
-
- /* check that box is large enough for round drawing */
- if ((vs->vert_max - vs->vert_min) < (V2D_SCROLLCAP_RAD * 2)) {
- /* Rounded box still gets drawn at the minimum size limit
- * This doesn't represent extreme scaling well, but looks nicer...
- */
- float mid= 0.5f * (vs->vert_max + vs->vert_min);
+ if ( (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) ||
+ ((v2d->tot.ymax - v2d->tot.ymin) > (v2d->cur.ymax - v2d->cur.ymin)) )
+ {
+ if (v2d->keepzoom & V2D_LOCKZOOM_Y) {
+ /* draw base bar as rounded shape */
+ UI_ThemeColorShade(TH_SHADE1, dark);
+ uiSetRoundBox(15);
- gl_round_box_vertical_shade(GL_POLYGON,
- (float)vert.xmin+2, mid-V2D_SCROLLCAP_RAD,
- (float)vert.xmax-2, mid+V2D_SCROLLCAP_RAD,
- V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+ /* check that box is large enough for round drawing */
+ if ((vs->vert_max - vs->vert_min) < (V2D_SCROLLCAP_RAD * 2)) {
+ /* Rounded box still gets drawn at the minimum size limit
+ * This doesn't represent extreme scaling well, but looks nicer...
+ */
+ float mid= 0.5f * (vs->vert_max + vs->vert_min);
+
+ gl_round_box_vertical_shade(GL_POLYGON,
+ (float)vert.xmin+2, mid-V2D_SCROLLCAP_RAD,
+ (float)vert.xmax-2, mid+V2D_SCROLLCAP_RAD,
+ V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+ }
+ else {
+ /* draw rounded box as per normal */
+ gl_round_box_vertical_shade(GL_POLYGON,
+ (float)vert.xmin+2, (float)vs->vert_min,
+ (float)vert.xmax-2, (float)vs->vert_max,
+ V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+ }
}
else {
- /* draw rounded box as per normal */
+ /* base bar drawn as shaded rect */
+ UI_ThemeColorShade(TH_SHADE1, dark);
+ uiSetRoundBox(0);
gl_round_box_vertical_shade(GL_POLYGON,
(float)vert.xmin+2, (float)vs->vert_min,
- (float)vert.xmax-2, (float)vs->vert_max,
+ (float)vert.xmax-2, (float)vs->vert_max,
V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
+
+ /* 'minimum' handle */
+ UI_ThemeColorShade(TH_SHADE1, darker);
+ uiSetRoundBox(12);
+
+ gl_round_box_vertical_shade(GL_POLYGON,
+ (float)vert.xmin+2, (float)vs->vert_min-V2D_SCROLLER_HANDLE_SIZE,
+ (float)vert.xmax-2, (float)vs->vert_min+V2D_SCROLLER_HANDLE_SIZE,
+ V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
+
+ /* maximum handle */
+ UI_ThemeColorShade(TH_SHADE1, darker);
+ uiSetRoundBox(3);
+
+ gl_round_box_vertical_shade(GL_POLYGON,
+ (float)vert.xmin+2, (float)vs->vert_max-V2D_SCROLLER_HANDLE_SIZE,
+ (float)vert.xmax-2, (float)vs->vert_max+V2D_SCROLLER_HANDLE_SIZE,
+ V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
}
}
- else {
- /* base bar drawn as shaded rect */
- UI_ThemeColorShade(TH_SHADE1, dark);
- uiSetRoundBox(0);
- gl_round_box_vertical_shade(GL_POLYGON,
- (float)vert.xmin+2, (float)vs->vert_min,
- (float)vert.xmax-2, (float)vs->vert_max,
- V2D_SCROLLCAP_RAD, V2D_SCROLLBAR_SHADE, -V2D_SCROLLBAR_SHADE);
-
- /* 'minimum' handle */
- UI_ThemeColorShade(TH_SHADE1, darker);
- uiSetRoundBox(12);
-
- gl_round_box_vertical_shade(GL_POLYGON,
- (float)vert.xmin+2, (float)vs->vert_min-V2D_SCROLLER_HANDLE_SIZE,
- (float)vert.xmax-2, (float)vs->vert_min+V2D_SCROLLER_HANDLE_SIZE,
- V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
-
- /* maximum handle */
- UI_ThemeColorShade(TH_SHADE1, darker);
- uiSetRoundBox(3);
-
- gl_round_box_vertical_shade(GL_POLYGON,
- (float)vert.xmin+2, (float)vs->vert_max-V2D_SCROLLER_HANDLE_SIZE,
- (float)vert.xmax-2, (float)vs->vert_max+V2D_SCROLLER_HANDLE_SIZE,
- V2D_SCROLLCAP_RAD, V2D_SCROLLCAP_SHADE, -V2D_SCROLLCAP_SHADE);
- }
/* scale indiators */
// XXX will need to update the font drawing when the new stuff comes in