mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
made padding and line height scriptable
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1249 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+6
-6
@@ -87,19 +87,19 @@ The rest of the properties depend on the type of [[type:field]] this style is fo
|
||||
| ^^^ @allow formating@ [[type:boolean]] @true@ Is custom formating (bold, italic) allowed?
|
||||
| ^^^ @alignment@ [[type:scriptable]] [[type:alignment]] @top left@ Alignment of the text.
|
||||
| ^^^ @direction@ [[type:direction]] @"left to right"@ Direction in which the text flows. If set to @"vertical"@ it is as if a line break is inserted after each character.
|
||||
| ^^^ @padding left@ [[type:double]] @0@ Padding between the text and the border of the box, in pixels.
|
||||
| ^^^ @padding left@ [[type:scriptable]] [[type:double]] @0@ Padding between the text and the border of the box, in pixels.
|
||||
| ^^^ @padding right@ ^^^ ^^^ ^^^
|
||||
| ^^^ @padding top@ ^^^ ^^^ ^^^
|
||||
| ^^^ @padding bottom@ ^^^ ^^^ ^^^
|
||||
| ^^^ @padding left min@ [[type:double]] ∞ Minimal padding around the field.<br/> When the text is scalled down the padding is scalled as well, but it becomes no smaller than this.
|
||||
| ^^^ @padding left min@ [[type:scriptable]] [[type:double]] ∞ Minimal padding around the field.<br/> When the text is scalled down the padding is scalled as well, but it becomes no smaller than this.
|
||||
| ^^^ @padding right min@ ^^^ ^^^ ^^^
|
||||
| ^^^ @padding top min@ ^^^ ^^^ ^^^
|
||||
| ^^^ @padding bottom min@ ^^^ ^^^ ^^^
|
||||
| ^^^ @line height soft@ [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by wrapping around lines that are too long.<br/>
|
||||
| ^^^ @line height soft@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by wrapping around lines that are too long.<br/>
|
||||
A line height of @0@ means all lines are in the same position, @1@ is normal behaviour, @2@ skips a line, etc.
|
||||
| ^^^ @line height hard@ [[type:double]] @1@ Multiplier for the line height of 'hard' line breaks. These are breaks caused by the enter key.
|
||||
| ^^^ @line height line@ [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by @"<line>\n</line>"@ tags.
|
||||
| ^^^ @line height soft max@ [[type:double]] ''disabled'' When there is still vertical room in the text box, increase the line heights to at most these values to spread the text more evenly.
|
||||
| ^^^ @line height hard@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'hard' line breaks. These are breaks caused by the enter key.
|
||||
| ^^^ @line height line@ [[type:scriptable]] [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by @"<line>\n</line>"@ tags.
|
||||
| ^^^ @line height soft max@ [[type:scriptable]] [[type:double]] ''disabled'' When there is still vertical room in the text box, increase the line heights to at most these values to spread the text more evenly.
|
||||
| ^^^ @line height hard max@ ^^^ ^^^ ^^^
|
||||
| ^^^ @line height line max@ ^^^ ^^^ ^^^
|
||||
| ^^^ @paragraph height@ [[type:double]] ''flexible'' The height of paragraphs. If specified, each paragraph is given this much space, and aligned inside that space as specified by @alignment@.<br/>
|
||||
|
||||
+16
-1
@@ -70,7 +70,22 @@ int TextStyle::update(Context& ctx) {
|
||||
return Style ::update(ctx)
|
||||
| font .update(ctx) * CHANGE_OTHER
|
||||
| symbol_font.update(ctx) * CHANGE_OTHER
|
||||
| alignment .update(ctx) * CHANGE_OTHER;
|
||||
| alignment .update(ctx) * CHANGE_OTHER
|
||||
| ( padding_left .update(ctx)
|
||||
| padding_left_min .update(ctx)
|
||||
| padding_right .update(ctx)
|
||||
| padding_right_min .update(ctx)
|
||||
| padding_top .update(ctx)
|
||||
| padding_top_min .update(ctx)
|
||||
| padding_bottom .update(ctx)
|
||||
| padding_bottom_min .update(ctx)
|
||||
| line_height_soft .update(ctx)
|
||||
| line_height_hard .update(ctx)
|
||||
| line_height_line .update(ctx)
|
||||
| line_height_soft_max.update(ctx)
|
||||
| line_height_hard_max.update(ctx)
|
||||
| line_height_line_max.update(ctx)
|
||||
) * CHANGE_OTHER;
|
||||
}
|
||||
void TextStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
Style ::initDependencies(ctx, dep);
|
||||
|
||||
+22
-21
@@ -51,26 +51,27 @@ class TextStyle : public Style {
|
||||
TextStyle(const TextFieldP&);
|
||||
DECLARE_STYLE_TYPE(Text);
|
||||
|
||||
Font font; ///< Font to use for the text
|
||||
SymbolFontRef symbol_font; ///< Symbol font for symbols in the text
|
||||
bool always_symbol; ///< Should everything be drawn as symbols?
|
||||
bool allow_formating; ///< Is formating (bold/italic/..) allowed?
|
||||
Scriptable<Alignment> alignment; ///< Alignment inside the box
|
||||
double padding_left, padding_left_min; ///< Padding
|
||||
double padding_right, padding_right_min; ///< Padding
|
||||
double padding_top, padding_top_min; ///< Padding
|
||||
double padding_bottom, padding_bottom_min; ///< Padding
|
||||
double line_height_soft; ///< Line height for soft linebreaks
|
||||
double line_height_hard; ///< Line height for hard linebreaks
|
||||
double line_height_line; ///< Line height for <line> tags
|
||||
double line_height_soft_max; ///< Maximum line height
|
||||
double line_height_hard_max; ///< Maximum line height
|
||||
double line_height_line_max; ///< Maximum line height
|
||||
double paragraph_height; ///< Fixed height of paragraphs
|
||||
Direction direction; ///< In what direction is text layed out?
|
||||
Font font; ///< Font to use for the text
|
||||
SymbolFontRef symbol_font; ///< Symbol font for symbols in the text
|
||||
bool always_symbol; ///< Should everything be drawn as symbols?
|
||||
bool allow_formating; ///< Is formating (bold/italic/..) allowed?
|
||||
Scriptable<Alignment> alignment; ///< Alignment inside the box
|
||||
Scriptable<double>
|
||||
padding_left, padding_left_min, ///< Padding
|
||||
padding_right, padding_right_min, ///< Padding
|
||||
padding_top, padding_top_min, ///< Padding
|
||||
padding_bottom, padding_bottom_min, ///< Padding
|
||||
line_height_soft, ///< Line height for soft linebreaks
|
||||
line_height_hard, ///< Line height for hard linebreaks
|
||||
line_height_line, ///< Line height for <line> tags
|
||||
line_height_soft_max, ///< Maximum line height
|
||||
line_height_hard_max, ///< Maximum line height
|
||||
line_height_line_max, ///< Maximum line height
|
||||
paragraph_height; ///< Fixed height of paragraphs
|
||||
Direction direction; ///< In what direction is text layed out?
|
||||
// information from text rendering
|
||||
double content_width, content_height; ///< Size of the rendered text
|
||||
int content_lines; ///< Number of rendered lines
|
||||
double content_width, content_height; ///< Size of the rendered text
|
||||
int content_lines; ///< Number of rendered lines
|
||||
|
||||
virtual int update(Context&);
|
||||
virtual void initDependencies(Context&, const Dependency&) const;
|
||||
@@ -88,8 +89,8 @@ class TextValue : public Value {
|
||||
inline TextValue(const TextFieldP& field) : Value(field), last_update(1) {}
|
||||
DECLARE_VALUE_TYPE(Text, Defaultable<String>);
|
||||
|
||||
ValueType value; ///< The text of this value
|
||||
Age last_update; ///< When was the text last changed?
|
||||
ValueType value; ///< The text of this value
|
||||
Age last_update; ///< When was the text last changed?
|
||||
|
||||
virtual bool update(Context&);
|
||||
};
|
||||
|
||||
@@ -322,7 +322,7 @@ IMPLEMENT_VALUE_EDITOR(Text)
|
||||
{
|
||||
if (viewer.nativeLook() && field().multi_line) {
|
||||
scrollbar = new TextValueEditorScrollBar(*this);
|
||||
style->padding_right = max(style->padding_right, (double)scrollbar->GetSize().x);
|
||||
style->padding_right = max(style->padding_right(), (double)scrollbar->GetSize().x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user