2.5:
* Default panel zoom level user preference, when creating new button windows or pressing home-key to reset. Patch by Matt D., thanks!
This commit is contained in:
@@ -1615,7 +1615,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
|
||||
block= MEM_callocN(sizeof(uiBlock), "uiBlock");
|
||||
block->active= 1;
|
||||
block->dt= dt;
|
||||
block->evil_C= C; // XXX
|
||||
block->evil_C= (void*)C; // XXX
|
||||
BLI_strncpy(block->name, name, sizeof(block->name));
|
||||
|
||||
if(region)
|
||||
|
||||
@@ -89,6 +89,8 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
|
||||
BLI_addtail(styles, style);
|
||||
BLI_strncpy(style->name, name, MAX_STYLE_NAME);
|
||||
|
||||
style->panelzoom= 1.0;
|
||||
|
||||
style->paneltitle.uifont_id= UIFONT_DEFAULT;
|
||||
style->paneltitle.points= 13;
|
||||
style->paneltitle.shadow= 5;
|
||||
|
||||
@@ -155,7 +155,8 @@ static void view2d_masks(View2D *v2d)
|
||||
void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
|
||||
{
|
||||
short tot_changed= 0;
|
||||
|
||||
uiStyle *style= U.uistyles.first;
|
||||
|
||||
/* initialise data if there is a need for such */
|
||||
if ((v2d->flag & V2D_IS_INITIALISED) == 0) {
|
||||
/* set initialised flag so that View2D doesn't get reinitialised next time again */
|
||||
@@ -250,7 +251,11 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
|
||||
v2d->tot.ymax= 0.0f;
|
||||
v2d->tot.ymin= -winy;
|
||||
|
||||
v2d->cur= v2d->tot;
|
||||
v2d->cur.xmin= 0.0f;
|
||||
v2d->cur.xmax= winx*style->panelzoom;
|
||||
|
||||
v2d->cur.ymax= 0.0f;
|
||||
v2d->cur.ymin= -winy*style->panelzoom;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -1273,6 +1273,7 @@ void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
|
||||
|
||||
static int reset_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
uiStyle *style= U.uistyles.first;
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
View2D *v2d= &ar->v2d;
|
||||
int winx, winy;
|
||||
@@ -1283,26 +1284,26 @@ static int reset_exec(bContext *C, wmOperator *op)
|
||||
|
||||
v2d->cur.xmax= v2d->cur.xmin + winx;
|
||||
v2d->cur.ymax= v2d->cur.ymin + winy;
|
||||
|
||||
|
||||
/* align */
|
||||
if(v2d->align) {
|
||||
/* 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)) {
|
||||
v2d->cur.xmax= 0.0f;
|
||||
v2d->cur.xmin= v2d->winx;
|
||||
v2d->cur.xmin= v2d->winx*style->panelzoom;
|
||||
}
|
||||
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
|
||||
v2d->cur.xmax= v2d->cur.xmax - v2d->cur.xmin;
|
||||
v2d->cur.xmax= (v2d->cur.xmax - v2d->cur.xmin)*style->panelzoom;
|
||||
v2d->cur.xmin= 0.0f;
|
||||
}
|
||||
|
||||
/* - posx and negx flags are mutually exclusive, so watch out */
|
||||
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
|
||||
v2d->cur.ymax= 0.0f;
|
||||
v2d->cur.ymin= -v2d->winy;
|
||||
v2d->cur.ymin= -v2d->winy*style->panelzoom;
|
||||
}
|
||||
else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
|
||||
v2d->cur.ymax= v2d->cur.ymax - v2d->cur.ymin;
|
||||
v2d->cur.ymax= (v2d->cur.ymax - v2d->cur.ymin)*style->panelzoom;
|
||||
v2d->cur.ymin= 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,8 @@ typedef struct uiStyle {
|
||||
uiFontStyle widgetlabel;
|
||||
uiFontStyle widget;
|
||||
|
||||
float panelzoom;
|
||||
|
||||
short minlabelchars; /* in characters */
|
||||
short minwidgetchars; /* in characters */
|
||||
|
||||
@@ -103,7 +105,7 @@ typedef struct uiStyle {
|
||||
short panelspace;
|
||||
short panelouter;
|
||||
|
||||
short pad[3];
|
||||
short pad[1];
|
||||
} uiStyle;
|
||||
|
||||
typedef struct uiWidgetColors {
|
||||
|
||||
@@ -174,6 +174,10 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
|
||||
RNA_def_struct_sdna(srna, "uiStyle");
|
||||
RNA_def_struct_ui_text(srna, "Style", "Theme settings for style sets.");
|
||||
|
||||
prop= RNA_def_property(srna, "panelzoom", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.5, 2.0);
|
||||
RNA_def_property_ui_text(prop, "Panel Zoom", "Default zoom level for panel areas.");
|
||||
|
||||
prop= RNA_def_property(srna, "paneltitle", PROP_POINTER, PROP_NEVER_NULL);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "paneltitle");
|
||||
RNA_def_property_struct_type(prop, "ThemeFontStyle");
|
||||
|
||||
Reference in New Issue
Block a user