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:
authorCampbell Barton <ideasman42@gmail.com>2018-05-23 11:50:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-23 11:51:11 +0300
commite92baab34893f5a5b3d6f59238fdb7855b72d7fe (patch)
tree457da9be1190b111803eb4a92e7b9384f243cfcd /source/blender/editors/interface/interface_style.c
parent37b5c52f111d4fe6e024c1cd66ba965b3b6bd83d (diff)
parentd886e32270edb8273ec48a41d1bdcef1fe802835 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r--source/blender/editors/interface/interface_style.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 01456e2e122..adc3a24d1a9 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -4,7 +4,7 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,7 @@
*
* The Original Code is Copyright (C) 2009 Blender Foundation.
* All rights reserved.
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -65,10 +65,10 @@
/* style + theme + layout-engine = UI */
/**
- * This is a complete set of layout rules, the 'state' of the Layout
- * Engine. Multiple styles are possible, defined via C or Python. Styles
- * get a name, and will typically get activated per region type, like
- * "Header", or "Listview" or "Toolbar". Properties of Style definitions
+ * This is a complete set of layout rules, the 'state' of the Layout
+ * Engine. Multiple styles are possible, defined via C or Python. Styles
+ * get a name, and will typically get activated per region type, like
+ * "Header", or "Listview" or "Toolbar". Properties of Style definitions
* are:
*
* - default column properties, internal spacing, aligning, min/max width
@@ -85,10 +85,10 @@
static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id)
{
uiStyle *style = MEM_callocN(sizeof(uiStyle), "new style");
-
+
BLI_addtail(styles, style);
BLI_strncpy(style->name, name, MAX_STYLE_NAME);
-
+
style->panelzoom = 1.0; /* unused */
style->paneltitle.uifont_id = uifont_id;
@@ -129,14 +129,14 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id
style->buttonspacey = 2;
style->panelspace = 8;
style->panelouter = 4;
-
+
return style;
}
static uiFont *uifont_to_blfont(int id)
{
uiFont *font = U.uifonts.first;
-
+
for (; font; font = font->next) {
if (font->uifont_id == id) {
return font;
@@ -154,7 +154,7 @@ void UI_fontstyle_draw_ex(
{
int xofs = 0, yofs;
int font_flag = BLF_CLIPPING;
-
+
UI_fontstyle_set(fs);
/* set the flag */
@@ -192,7 +192,7 @@ void UI_fontstyle_draw_ex(
else if (fs->align == UI_STYLE_TEXT_RIGHT) {
xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len) - 0.1f * U.widget_unit;
}
-
+
/* clip is very strict, so we give it some space */
BLF_clipping(fs->uifont_id, rect->xmin - 2, rect->ymin - 4, rect->xmax + 1, rect->ymax + 4);
BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f);
@@ -349,16 +349,16 @@ uiStyle *UI_style_get_dpi(void)
{
uiStyle *style = UI_style_get();
static uiStyle _style;
-
+
_style = *style;
-
+
_style.paneltitle.shadx = (short)(UI_DPI_FAC * _style.paneltitle.shadx);
_style.paneltitle.shady = (short)(UI_DPI_FAC * _style.paneltitle.shady);
_style.grouplabel.shadx = (short)(UI_DPI_FAC * _style.grouplabel.shadx);
_style.grouplabel.shady = (short)(UI_DPI_FAC * _style.grouplabel.shady);
_style.widgetlabel.shadx = (short)(UI_DPI_FAC * _style.widgetlabel.shadx);
_style.widgetlabel.shady = (short)(UI_DPI_FAC * _style.widgetlabel.shady);
-
+
_style.columnspace = (short)(UI_DPI_FAC * _style.columnspace);
_style.templatespace = (short)(UI_DPI_FAC * _style.templatespace);
_style.boxspace = (short)(UI_DPI_FAC * _style.boxspace);
@@ -366,23 +366,23 @@ uiStyle *UI_style_get_dpi(void)
_style.buttonspacey = (short)(UI_DPI_FAC * _style.buttonspacey);
_style.panelspace = (short)(UI_DPI_FAC * _style.panelspace);
_style.panelouter = (short)(UI_DPI_FAC * _style.panelouter);
-
+
return &_style;
}
int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str)
{
int width;
-
+
if (fs->kerning == 1) /* for BLF_width */
BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT);
-
+
UI_fontstyle_set(fs);
width = BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
-
+
if (fs->kerning == 1)
BLF_disable(fs->uifont_id, BLF_KERNING_DEFAULT);
-
+
return width;
}
@@ -403,12 +403,12 @@ void uiStyleInit(void)
uiStyle *style = U.uistyles.first;
int monofont_size = datatoc_bmonofont_ttf_size;
unsigned char *monofont_ttf = (unsigned char *)datatoc_bmonofont_ttf;
-
+
/* recover from uninitialized dpi */
if (U.dpi == 0)
U.dpi = 72;
CLAMP(U.dpi, 48, 144);
-
+
for (font = U.uifonts.first; font; font = font->next) {
BLF_unload_id(font->blf_id);
}
@@ -439,9 +439,9 @@ void uiStyleInit(void)
BLI_strncpy(font->filename, "default", sizeof(font->filename));
font->uifont_id = UIFONT_DEFAULT;
}
-
+
for (font = U.uifonts.first; font; font = font->next) {
-
+
if (font->uifont_id == UIFONT_DEFAULT) {
#ifdef WITH_INTERNATIONAL
int font_size = datatoc_bfont_ttf_size;
@@ -493,11 +493,11 @@ void uiStyleInit(void)
BLF_size(font->blf_id, 14 * U.pixelsize, U.dpi);
}
}
-
+
if (style == NULL) {
ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT);
}
-
+
#ifdef WITH_INTERNATIONAL
/* use unicode font for text editor and interactive console */
if (U.transopts & USER_DOTRANSLATE) {
@@ -521,7 +521,7 @@ void uiStyleInit(void)
}
BLF_size(blf_mono_font, 12 * U.pixelsize, 72);
-
+
/**
* Second for rendering else we get threading problems,
*
@@ -537,7 +537,7 @@ void uiStyleInit(void)
void UI_fontstyle_set(const uiFontStyle *fs)
{
uiFont *font = uifont_to_blfont(fs->uifont_id);
-
+
BLF_size(font->blf_id, fs->points * U.pixelsize, U.dpi);
}