Some UI tweaks as listed by William
(http://wiki.blender.org/index.php/BlenderDev/Blender2.5/Todo/UserInterface) * Removed panel docking. "It is too easy to do by accident when reordering panels, is very hard to control and use, and has no real benefit." * Scoll bars have minimum size now, so that the 'thumb' doesn't disappear in long lists.
This commit is contained in:
@@ -963,6 +963,7 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 // XXX panel docking/tabbing code that's no longer used
|
||||||
static void test_add_new_tabs(ARegion *ar)
|
static void test_add_new_tabs(ARegion *ar)
|
||||||
{
|
{
|
||||||
Panel *pa, *pasel=NULL, *palap=NULL;
|
Panel *pa, *pasel=NULL, *palap=NULL;
|
||||||
@@ -1016,6 +1017,7 @@ static void test_add_new_tabs(ARegion *ar)
|
|||||||
pa= pa->next;
|
pa= pa->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************ panel dragging ****************************/
|
/************************ panel dragging ****************************/
|
||||||
|
|
||||||
@@ -1382,7 +1384,12 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
|
|||||||
|
|
||||||
if(state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
|
if(state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
|
||||||
if(data && data->state != PANEL_STATE_ANIMATION) {
|
if(data && data->state != PANEL_STATE_ANIMATION) {
|
||||||
test_add_new_tabs(ar); // also copies locations of tabs in dragged panel
|
/* XXX:
|
||||||
|
* - the panel tabbing function call below (test_add_new_tabs()) has been commented out
|
||||||
|
* "It is too easy to do by accident when reordering panels, is very hard to control and use, and has no real benefit." - BillRey
|
||||||
|
* Aligorith, 2009Sep
|
||||||
|
*/
|
||||||
|
//test_add_new_tabs(ar); // also copies locations of tabs in dragged panel
|
||||||
check_panel_overlap(ar, NULL); // clears
|
check_panel_overlap(ar, NULL); // clears
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1351,7 +1351,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
|
|||||||
vert= v2d->vert;
|
vert= v2d->vert;
|
||||||
hor= v2d->hor;
|
hor= v2d->hor;
|
||||||
|
|
||||||
/* slider rects smaller than region */
|
/* slider rects need to be smaller than region */
|
||||||
hor.xmin+=4;
|
hor.xmin+=4;
|
||||||
hor.xmax-=4;
|
hor.xmax-=4;
|
||||||
if (scroll & V2D_SCROLL_BOTTOM)
|
if (scroll & V2D_SCROLL_BOTTOM)
|
||||||
@@ -1393,14 +1393,19 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
|
|||||||
else
|
else
|
||||||
scrollers->hor_max= (int)(hor.xmin + (fac2 * scrollsize));
|
scrollers->hor_max= (int)(hor.xmin + (fac2 * scrollsize));
|
||||||
|
|
||||||
|
/* prevent inverted sliders */
|
||||||
if (scrollers->hor_min > scrollers->hor_max)
|
if (scrollers->hor_min > scrollers->hor_max)
|
||||||
scrollers->hor_min= scrollers->hor_max;
|
scrollers->hor_min= scrollers->hor_max;
|
||||||
|
/* prevent sliders from being too small, and disappearing */
|
||||||
|
if ((scrollers->hor_max - scrollers->hor_min) < V2D_SCROLLER_HANDLE_SIZE)
|
||||||
|
scrollers->hor_max+= V2D_SCROLLER_HANDLE_SIZE;
|
||||||
|
|
||||||
/* check whether sliders can disappear */
|
/* check whether sliders can disappear */
|
||||||
if(v2d->keeptot)
|
if(v2d->keeptot) {
|
||||||
if(fac1 <= 0.0f && fac2 >= 1.0f)
|
if(fac1 <= 0.0f && fac2 >= 1.0f)
|
||||||
scrollers->horfull= 1;
|
scrollers->horfull= 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* vertical scrollers */
|
/* vertical scrollers */
|
||||||
if (scroll & V2D_SCROLL_VERTICAL) {
|
if (scroll & V2D_SCROLL_VERTICAL) {
|
||||||
@@ -1420,14 +1425,19 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
|
|||||||
else
|
else
|
||||||
scrollers->vert_max= (int)(vert.ymin + (fac2 * scrollsize));
|
scrollers->vert_max= (int)(vert.ymin + (fac2 * scrollsize));
|
||||||
|
|
||||||
|
/* prevent inverted sliders */
|
||||||
if (scrollers->vert_min > scrollers->vert_max)
|
if (scrollers->vert_min > scrollers->vert_max)
|
||||||
scrollers->vert_min= scrollers->vert_max;
|
scrollers->vert_min= scrollers->vert_max;
|
||||||
|
/* prevent sliders from being too small, and disappearing */
|
||||||
|
if ((scrollers->vert_max - scrollers->vert_min) < V2D_SCROLLER_HANDLE_SIZE)
|
||||||
|
scrollers->vert_max+= V2D_SCROLLER_HANDLE_SIZE;
|
||||||
|
|
||||||
/* check whether sliders can disappear */
|
/* check whether sliders can disappear */
|
||||||
if(v2d->keeptot)
|
if(v2d->keeptot) {
|
||||||
if(fac1 <= 0.0f && fac2 >= 1.0f)
|
if(fac1 <= 0.0f && fac2 >= 1.0f)
|
||||||
scrollers->vertfull= 1;
|
scrollers->vertfull= 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* grid markings on scrollbars */
|
/* grid markings on scrollbars */
|
||||||
if (scroll & (V2D_SCROLL_SCALE_HORIZONTAL|V2D_SCROLL_SCALE_VERTICAL)) {
|
if (scroll & (V2D_SCROLL_SCALE_HORIZONTAL|V2D_SCROLL_SCALE_VERTICAL)) {
|
||||||
@@ -1550,14 +1560,6 @@ static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, f
|
|||||||
BLF_draw_default(x, y, 0.0f, str);
|
BLF_draw_default(x, y, 0.0f, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* local defines for scrollers drawing */
|
|
||||||
/* radius of scroller 'button' caps */
|
|
||||||
#define V2D_SCROLLCAP_RAD 5
|
|
||||||
/* shading factor for scroller 'bar' */
|
|
||||||
#define V2D_SCROLLBAR_SHADE 0.1f
|
|
||||||
/* shading factor for scroller 'button' caps */
|
|
||||||
#define V2D_SCROLLCAP_SHADE 0.2f
|
|
||||||
|
|
||||||
/* Draw scrollbars in the given 2d-region */
|
/* Draw scrollbars in the given 2d-region */
|
||||||
void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs)
|
void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs)
|
||||||
{
|
{
|
||||||
@@ -1571,7 +1573,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
|||||||
|
|
||||||
/* horizontal scrollbar */
|
/* horizontal scrollbar */
|
||||||
if (scroll & V2D_SCROLL_HORIZONTAL) {
|
if (scroll & V2D_SCROLL_HORIZONTAL) {
|
||||||
|
/* only draw scrollbar when it doesn't fill the entire space */
|
||||||
if(vs->horfull==0) {
|
if(vs->horfull==0) {
|
||||||
bTheme *btheme= U.themes.first;
|
bTheme *btheme= U.themes.first;
|
||||||
uiWidgetColors wcol= btheme->tui.wcol_scroll;
|
uiWidgetColors wcol= btheme->tui.wcol_scroll;
|
||||||
@@ -1584,13 +1586,15 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
|||||||
slider.ymax= hor.ymax;
|
slider.ymax= hor.ymax;
|
||||||
|
|
||||||
state= (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE)?UI_SCROLL_PRESSED:0;
|
state= (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE)?UI_SCROLL_PRESSED:0;
|
||||||
|
|
||||||
|
// TODO: disable this for button regions...
|
||||||
if (!(v2d->keepzoom & V2D_LOCKZOOM_X))
|
if (!(v2d->keepzoom & V2D_LOCKZOOM_X))
|
||||||
state |= UI_SCROLL_ARROWS;
|
state |= UI_SCROLL_ARROWS;
|
||||||
|
|
||||||
uiWidgetScrollDraw(&wcol, &hor, &slider, state);
|
uiWidgetScrollDraw(&wcol, &hor, &slider, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scale indicators */
|
/* scale indicators */
|
||||||
// XXX will need to update the font drawing when the new stuff comes in
|
|
||||||
if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) {
|
if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) {
|
||||||
View2DGrid *grid= vs->grid;
|
View2DGrid *grid= vs->grid;
|
||||||
float fac, dfac, fac2, val;
|
float fac, dfac, fac2, val;
|
||||||
@@ -1667,7 +1671,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
|||||||
|
|
||||||
/* vertical scrollbar */
|
/* vertical scrollbar */
|
||||||
if (scroll & V2D_SCROLL_VERTICAL) {
|
if (scroll & V2D_SCROLL_VERTICAL) {
|
||||||
|
/* only draw scrollbar when it doesn't fill the entire space */
|
||||||
if(vs->vertfull==0) {
|
if(vs->vertfull==0) {
|
||||||
bTheme *btheme= U.themes.first;
|
bTheme *btheme= U.themes.first;
|
||||||
uiWidgetColors wcol= btheme->tui.wcol_scroll;
|
uiWidgetColors wcol= btheme->tui.wcol_scroll;
|
||||||
@@ -1680,14 +1684,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
|||||||
slider.ymax= vs->vert_max;
|
slider.ymax= vs->vert_max;
|
||||||
|
|
||||||
state= (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE)?UI_SCROLL_PRESSED:0;
|
state= (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE)?UI_SCROLL_PRESSED:0;
|
||||||
|
|
||||||
|
// TODO: disable this for button regions...
|
||||||
if (!(v2d->keepzoom & V2D_LOCKZOOM_Y))
|
if (!(v2d->keepzoom & V2D_LOCKZOOM_Y))
|
||||||
state |= UI_SCROLL_ARROWS;
|
state |= UI_SCROLL_ARROWS;
|
||||||
|
|
||||||
uiWidgetScrollDraw(&wcol, &vert, &slider, state);
|
uiWidgetScrollDraw(&wcol, &vert, &slider, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* scale indiators */
|
/* scale indiators */
|
||||||
// XXX will need to update the font drawing when the new stuff comes in
|
|
||||||
if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) {
|
if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) {
|
||||||
View2DGrid *grid= vs->grid;
|
View2DGrid *grid= vs->grid;
|
||||||
float fac, dfac, val;
|
float fac, dfac, val;
|
||||||
|
|||||||
Reference in New Issue
Block a user