[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21824] branches/blender2.5/blender/source /blender/editors: 2.5: UI
Brecht Van Lommel
brecht at blender.org
Thu Jul 23 22:50:24 CEST 2009
Revision: 21824
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21824
Author: blendix
Date: 2009-07-23 22:50:24 +0200 (Thu, 23 Jul 2009)
Log Message:
-----------
2.5: UI
* Fix issue where it would automatically scroll when collapsing panels.
* Fix panel dragging not taking zoom level into account.
* Fix enum menu having too small default width in headers.
* Fix tooltips not showing shortcuts etc. if there was not tooltip
defined for the button.
* Fix some refresh issues with color ramps.
* Add a bit more space between columns in the layout engine.
* Make scrollers darker so they are less distracting, and highlight
instead of reverse shading when dragging.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c
branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
branches/blender2.5/blender/source/blender/editors/interface/interface_style.c
branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c
branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c
branches/blender2.5/blender/source/blender/editors/screen/area.c
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c 2009-07-23 20:40:51 UTC (rev 21823)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c 2009-07-23 20:50:24 UTC (rev 21824)
@@ -724,8 +724,8 @@
subtype= RNA_property_subtype(prop);
len= RNA_property_array_length(prop);
- if(ELEM(type, PROP_STRING, PROP_POINTER) && !name[0])
- name= "non-empty";
+ if(ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0])
+ name= "non-empty text";
else if(type == PROP_BOOLEAN && !name[0])
icon= ICON_DOT;
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c 2009-07-23 20:40:51 UTC (rev 21823)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c 2009-07-23 20:50:24 UTC (rev 21824)
@@ -1031,6 +1031,9 @@
dx= (event->x-data->startx) & ~(PNL_GRID-1);
dy= (event->y-data->starty) & ~(PNL_GRID-1);
+
+ dx *= (float)(ar->v2d.cur.xmax - ar->v2d.cur.xmin)/(float)(ar->winrct.xmax - ar->winrct.xmin);
+ dy *= (float)(ar->v2d.cur.ymax - ar->v2d.cur.ymin)/(float)(ar->winrct.ymax - ar->winrct.ymin);
if(data->state == PANEL_STATE_DRAG_SCALE) {
panel->sizex = MAX2(data->startsizex+dx, UI_PANEL_MINX);
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c 2009-07-23 20:40:51 UTC (rev 21823)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c 2009-07-23 20:50:24 UTC (rev 21824)
@@ -291,10 +291,13 @@
/************************* Creating Tooltips **********************/
+#define MAX_TOOLTIP_LINES 8
+
typedef struct uiTooltipData {
rcti bbox;
uiFontStyle fstyle;
- char lines[5][512];
+ char lines[MAX_TOOLTIP_LINES][512];
+ int linedark[MAX_TOOLTIP_LINES];
int totline;
int toth, spaceh, lineh;
} uiTooltipData;
@@ -314,7 +317,7 @@
bbox.ymin= bbox.ymax - data->lineh;
for(a=0; a<data->totline; a++) {
- if(a == 0) glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ if(!data->linedark[a]) glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
else glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
uiStyleFontDraw(&data->fstyle, &bbox, data->lines[a]);
@@ -344,22 +347,13 @@
float x1f, x2f, y1f, y2f;
int x1, x2, y1, y2, winx, winy, ofsx, ofsy, w, h, a;
- if(!but->tip || strlen(but->tip)==0)
- return NULL;
-
- /* create area region */
- ar= ui_add_temporary_region(CTX_wm_screen(C));
-
- memset(&type, 0, sizeof(ARegionType));
- type.draw= ui_tooltip_region_draw;
- type.free= ui_tooltip_region_free;
- ar->type= &type;
-
/* create tooltip data */
data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
- BLI_strncpy(data->lines[0], but->tip, sizeof(data->lines[0]));
- data->totline= 1;
+ if(but->tip && strlen(but->tip)) {
+ BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
+ data->totline++;
+ }
if(but->optype && !(but->block->flag & UI_BLOCK_LOOP)) {
/* operator keymap (not menus, they already have it) */
@@ -367,6 +361,7 @@
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Shortcut: %s", buf);
+ data->linedark[data->totline]= 1;
data->totline++;
}
}
@@ -376,6 +371,7 @@
ui_get_but_string(but, buf, sizeof(buf));
if(buf[0]) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Value: %s", buf);
+ data->linedark[data->totline]= 1;
data->totline++;
}
}
@@ -385,14 +381,29 @@
if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
/* expression */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Expression: %s", buf);
+ data->linedark[data->totline]= 1;
data->totline++;
}
}
/* rna info */
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
+ data->linedark[data->totline]= 1;
data->totline++;
}
+
+ if(data->totline == 0) {
+ MEM_freeN(data);
+ return NULL;
+ }
+
+ /* create area region */
+ ar= ui_add_temporary_region(CTX_wm_screen(C));
+
+ memset(&type, 0, sizeof(ARegionType));
+ type.draw= ui_tooltip_region_draw;
+ type.free= ui_tooltip_region_free;
+ ar->type= &type;
/* set font, get bb */
data->fstyle= style->widget; /* copy struct */
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_style.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_style.c 2009-07-23 20:40:51 UTC (rev 21823)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_style.c 2009-07-23 20:50:24 UTC (rev 21824)
@@ -122,10 +122,10 @@
style->widget.kerning= 1;
style->widget.shadowalpha= 0.25f;
- style->columnspace= 5;
+ style->columnspace= 8;
style->templatespace= 5;
style->boxspace= 5;
- style->buttonspacex= 5;
+ style->buttonspacex= 8;
style->buttonspacey= 2;
style->panelspace= 8;
style->panelouter= 4;
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c 2009-07-23 20:40:51 UTC (rev 21823)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c 2009-07-23 20:50:24 UTC (rev 21824)
@@ -972,8 +972,15 @@
break;
}
}
+
+ WM_event_add_notifier(C, NC_TEXTURE, NULL);
}
+static void colorband_cb(bContext *C, void *coba_v, void *unused_v)
+{
+ WM_event_add_notifier(C, NC_TEXTURE, NULL);
+}
+
static void colorband_add_cb(bContext *C, void *coba_v, void *unused_v)
{
ColorBand *coba= coba_v;
@@ -983,6 +990,7 @@
colorband_pos_cb(C, coba, NULL);
ED_undo_push(C, "Add colorband");
+ WM_event_add_notifier(C, NC_TEXTURE, NULL);
}
static void colorband_del_cb(bContext *C, void *coba_v, void *unused_v)
@@ -1000,6 +1008,7 @@
ED_undo_push(C, "Delete colorband");
// XXX BIF_preview_changed(ID_TE);
+ WM_event_add_notifier(C, NC_TEXTURE, NULL);
}
@@ -1018,18 +1027,22 @@
uiButSetFunc(bt, colorband_del_cb, coba, NULL);
- uiDefButS(block, MENU, redraw, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
+ bt= uiDefButS(block, MENU, redraw, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
210+xoffs, 100+yoffs, 90, 20, &coba->ipotype, 0.0, 0.0, 0, 0, "Set interpolation between color stops");
+ uiButSetFunc(bt, colorband_cb, coba, NULL);
uiBlockEndAlign(block);
- uiDefBut(block, BUT_COLORBAND, redraw, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
+ bt= uiDefBut(block, BUT_COLORBAND, redraw, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
+ uiButSetFunc(bt, colorband_cb, coba, NULL);
cbd= coba->data + coba->cur;
bt= uiDefButF(block, NUM, redraw, "Pos:", 0+xoffs,40+yoffs,100, 20, &cbd->pos, 0.0, 1.0, 10, 0, "The position of the active color stop");
uiButSetFunc(bt, colorband_pos_cb, coba, NULL);
- uiDefButF(block, COL, redraw, "", 110+xoffs,40+yoffs,80,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "The color value for the active color stop");
- uiDefButF(block, NUMSLI, redraw, "A ", 200+xoffs,40+yoffs,100,20, &cbd->a, 0.0, 1.0, 10, 0, "The alpha value of the active color stop");
+ bt= uiDefButF(block, COL, redraw, "", 110+xoffs,40+yoffs,80,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "The color value for the active color stop");
+ uiButSetFunc(bt, colorband_cb, coba, NULL);
+ bt= uiDefButF(block, NUMSLI, redraw, "A ", 200+xoffs,40+yoffs,100,20, &cbd->a, 0.0, 1.0, 10, 0, "The alpha value of the active color stop");
+ uiButSetFunc(bt, colorband_cb, coba, NULL);
}
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c 2009-07-23 20:40:51 UTC (rev 21823)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c 2009-07-23 20:50:24 UTC (rev 21824)
@@ -1114,13 +1114,13 @@
{50, 50, 50, 180},
{80, 80, 80, 180},
{100, 100, 100, 180},
- {180, 180, 180, 255},
+ {128, 128, 128, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
1,
- 10, -20
+ 5, -5
};
static struct uiWidgetColors wcol_list_item= {
@@ -1707,8 +1707,11 @@
wcol->shadetop+= 20; /* XXX violates themes... */
else wcol->shadedown+= 20;
- if(state & UI_SCROLL_PRESSED)
- SWAP(short, wcol->shadetop, wcol->shadedown);
+ if(state & UI_SCROLL_PRESSED) {
+ wcol->inner[0]= wcol->inner[0]>=250? 255 : wcol->inner[0]+5;
+ wcol->inner[1]= wcol->inner[1]>=250? 255 : wcol->inner[1]+5;
+ wcol->inner[2]= wcol->inner[2]>=250? 255 : wcol->inner[2]+5;
+ }
/* draw */
wtb.emboss= 0; /* only emboss once */
Modified: branches/blender2.5/blender/source/blender/editors/screen/area.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/area.c 2009-07-23 20:40:51 UTC (rev 21823)
+++ branches/blender2.5/blender/source/blender/editors/screen/area.c 2009-07-23 20:50:24 UTC (rev 21824)
@@ -1251,13 +1251,14 @@
else {
v2d->keepofs &= ~V2D_LOCKOFS_X;
v2d->keepofs |= V2D_LOCKOFS_Y;
-
+
// don't jump back when panels close or hide
x= MAX2(x, v2d->cur.xmax);
y= -y;
}
- UI_view2d_totRect_set(v2d, x, y);
+ // +V2D_SCROLL_HEIGHT is workaround to set the actual height
+ UI_view2d_totRect_set(v2d, x, y+V2D_SCROLL_HEIGHT);
/* set the view */
UI_view2d_view_ortho(C, v2d);
More information about the Bf-blender-cvs
mailing list