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:
authorJacques Lucke <jacques@blender.org>2021-04-12 10:14:41 +0300
committerJacques Lucke <jacques@blender.org>2021-04-12 10:14:41 +0300
commit1a4d0fa72d83bf6c7413d70172766801976c1671 (patch)
tree7553d996d043712a69698e7c28384dd4fe21a0d9 /source/blender/makesdna
parent59f49072d06859f69e9f6e381f5f7f168ee74d24 (diff)
Spreadsheet: add spreadsheet width unit
This also fixes the issue that the width of the "Name" column when viewing instances does not resize correctly. Differential Revision: https://developer.blender.org/D10926
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_space_types.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index a90047b9daa..747e392b529 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1909,6 +1909,13 @@ typedef enum eSpaceSpreadsheet_ObjectEvalState {
SPREADSHEET_OBJECT_EVAL_STATE_NODE = 2,
} eSpaceSpreadsheet_Context;
+/**
+ * We can't just use UI_UNIT_X, because it does not take `widget.points` into account, which
+ * modifies the width of text as well.
+ */
+#define SPREADSHEET_WIDTH_UNIT \
+ (UI_UNIT_X * UI_style_get_dpi()->widget.points / (float)UI_DEFAULT_TEXT_POINTS)
+
/** \} */
/* -------------------------------------------------------------------- */