Move duplicate AutoWrap, Overrun and VisibleChar behavior enums to the TextServer.
This commit is contained in:
parent
ef6511fbb4
commit
b5c96df277
45 changed files with 254 additions and 403 deletions
|
|
@ -98,12 +98,6 @@ void TextLine::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("draw_outline", "canvas", "pos", "outline_size", "color"), &TextLine::draw_outline, DEFVAL(1), DEFVAL(Color(1, 1, 1)));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("hit_test", "coords"), &TextLine::hit_test);
|
||||
|
||||
BIND_ENUM_CONSTANT(OVERRUN_NO_TRIMMING);
|
||||
BIND_ENUM_CONSTANT(OVERRUN_TRIM_CHAR);
|
||||
BIND_ENUM_CONSTANT(OVERRUN_TRIM_WORD);
|
||||
BIND_ENUM_CONSTANT(OVERRUN_TRIM_ELLIPSIS);
|
||||
BIND_ENUM_CONSTANT(OVERRUN_TRIM_WORD_ELLIPSIS);
|
||||
}
|
||||
|
||||
void TextLine::_shape() {
|
||||
|
|
@ -112,26 +106,26 @@ void TextLine::_shape() {
|
|||
TS->shaped_text_tab_align(rid, tab_stops);
|
||||
}
|
||||
|
||||
uint16_t overrun_flags = TextServer::OVERRUN_NO_TRIMMING;
|
||||
if (overrun_behavior != OVERRUN_NO_TRIMMING) {
|
||||
uint16_t overrun_flags = TextServer::OVERRUN_NO_TRIM;
|
||||
if (overrun_behavior != TextServer::OVERRUN_NO_TRIMMING) {
|
||||
switch (overrun_behavior) {
|
||||
case OVERRUN_TRIM_WORD_ELLIPSIS:
|
||||
case TextServer::OVERRUN_TRIM_WORD_ELLIPSIS:
|
||||
overrun_flags |= TextServer::OVERRUN_TRIM;
|
||||
overrun_flags |= TextServer::OVERRUN_TRIM_WORD_ONLY;
|
||||
overrun_flags |= TextServer::OVERRUN_ADD_ELLIPSIS;
|
||||
break;
|
||||
case OVERRUN_TRIM_ELLIPSIS:
|
||||
case TextServer::OVERRUN_TRIM_ELLIPSIS:
|
||||
overrun_flags |= TextServer::OVERRUN_TRIM;
|
||||
overrun_flags |= TextServer::OVERRUN_ADD_ELLIPSIS;
|
||||
break;
|
||||
case OVERRUN_TRIM_WORD:
|
||||
case TextServer::OVERRUN_TRIM_WORD:
|
||||
overrun_flags |= TextServer::OVERRUN_TRIM;
|
||||
overrun_flags |= TextServer::OVERRUN_TRIM_WORD_ONLY;
|
||||
break;
|
||||
case OVERRUN_TRIM_CHAR:
|
||||
case TextServer::OVERRUN_TRIM_CHAR:
|
||||
overrun_flags |= TextServer::OVERRUN_TRIM;
|
||||
break;
|
||||
case OVERRUN_NO_TRIMMING:
|
||||
case TextServer::OVERRUN_NO_TRIMMING:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -259,20 +253,20 @@ uint16_t TextLine::get_flags() const {
|
|||
return flags;
|
||||
}
|
||||
|
||||
void TextLine::set_text_overrun_behavior(TextLine::OverrunBehavior p_behavior) {
|
||||
void TextLine::set_text_overrun_behavior(TextServer::OverrunBehavior p_behavior) {
|
||||
if (overrun_behavior != p_behavior) {
|
||||
overrun_behavior = p_behavior;
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
TextLine::OverrunBehavior TextLine::get_text_overrun_behavior() const {
|
||||
TextServer::OverrunBehavior TextLine::get_text_overrun_behavior() const {
|
||||
return overrun_behavior;
|
||||
}
|
||||
|
||||
void TextLine::set_width(float p_width) {
|
||||
width = p_width;
|
||||
if (alignment == HORIZONTAL_ALIGNMENT_FILL || overrun_behavior != OVERRUN_NO_TRIMMING) {
|
||||
if (alignment == HORIZONTAL_ALIGNMENT_FILL || overrun_behavior != TextServer::OVERRUN_NO_TRIMMING) {
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue