diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-02 15:09:43 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-02 15:09:43 +0400 |
commit | 9b3bd5582be99e26b6c3651f66db516982bc8461 (patch) | |
tree | 66178e37290f42cca50837ecf46c0010a675d8bc /source/blender/editors/space_clip/clip_buttons.c | |
parent | 4faef1e10c9d1177eae6350b4471206e91afaff8 (diff) |
Replace resize code of image scopes by use of new GRIP button.
This deduplicates/simplifies some code. Also cleanup up a bit scopes UI code!
Use new GRIP button for uiList grab-resize.
This allows us to greatly simplifies the code, and get rid of a few hacks in uiList event handling!
Note autosize mode of uiList is now trigered by any value of list_grip below a given threshold, rather than the fixed zero value...
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D343
Diffstat (limited to 'source/blender/editors/space_clip/clip_buttons.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_buttons.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 6c228d52a96..a5557f8150a 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -153,7 +153,7 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) PropertyRNA *prop; PointerRNA scopesptr; uiBlock *block; - rctf rect; + uiLayout *col; MovieClipScopes *scopes; if (!ptr->data) @@ -175,16 +175,21 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) scopesptr = RNA_property_pointer_get(ptr, prop); scopes = (MovieClipScopes *)scopesptr.data; - rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X; - rect.ymin = 0; rect.ymax = 6.0f * UI_UNIT_Y; + if (scopes->track_preview_height < UI_UNIT_Y) { + scopes->track_preview_height = UI_UNIT_Y; + } + else if (scopes->track_preview_height > UI_UNIT_Y * 20) { + scopes->track_preview_height = UI_UNIT_Y * 20; + } - block = uiLayoutAbsoluteBlock(layout); + col = uiLayoutColumn(layout, true); + block = uiLayoutGetBlock(col); - scopes->track_preview_height = - (scopes->track_preview_height <= 20) ? 20 : scopes->track_preview_height; + uiDefBut(block, TRACKPREVIEW, 0, "", 0, 0, UI_UNIT_X * 10, scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); - uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), - scopes->track_preview_height * UI_DPI_FAC, scopes, 0, 0, 0, 0, ""); + /* Resize grip. */ + uiDefIconButI(block, GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.8f), + &scopes->track_preview_height, UI_UNIT_Y, UI_UNIT_Y * 20.0f, 0.0f, 0.0f, ""); } /********************* Marker Template ************************/ |