Moved tab_index to Style (instead of Field), it makes more sense there, since it pertains to the layout of stuff on the card.

Also don't precalculate list of fields sorted by tab order, just find the next/previous ones on the fly.
This commit is contained in:
Twan van Laarhoven
2020-04-26 02:16:39 +02:00
parent 54a3cbfde3
commit 4bebd48786
6 changed files with 115 additions and 74 deletions
+2 -2
View File
@@ -33,7 +33,6 @@ Field::Field()
, card_list_visible(false)
, card_list_allow (true)
, card_list_align (ALIGN_LEFT)
, tab_index (0)
{}
Field::~Field() {}
@@ -64,7 +63,6 @@ IMPLEMENT_REFLECTION(Field) {
REFLECT(card_list_name);
REFLECT(sort_script);
REFLECT_N("card_list_alignment", card_list_align);
REFLECT(tab_index);
REFLECT_IF_READING if(caption.empty()) caption = name_to_caption(name);
REFLECT_IF_READING if(card_list_name.empty()) card_list_name = capitalize(caption);
}
@@ -97,6 +95,7 @@ intrusive_ptr<Field> read_new<Field>(Reader& reader) {
Style::Style(const FieldP& field)
: fieldP(field)
, z_index(0)
, tab_index(0)
, left (1000000), top (1000000)
, width(0), height(0)
, right(1000000), bottom(1000000)
@@ -110,6 +109,7 @@ Style::~Style() {}
IMPLEMENT_REFLECTION(Style) {
REFLECT(z_index);
REFLECT(tab_index);
REFLECT(left);
REFLECT(width);
REFLECT(right);
+1 -1
View File
@@ -58,7 +58,6 @@ class Field : public IntrusivePtrVirtualBase {
String card_list_name; ///< Alternate name to use in card list.
Alignment card_list_align; ///< Alignment of the card list colummn.
OptionalScript sort_script; ///< The script to use when sorting this, if not the value.
int tab_index; ///< Tab index in editor
Dependencies dependent_scripts; ///< Scripts that depend on values of this field
/// Creates a new Value corresponding to this Field
@@ -98,6 +97,7 @@ class Style : public IntrusivePtrVirtualBase {
const FieldP fieldP; ///< Field this style is for, should have the right type!
int z_index; ///< Stacking of values of this field, higher = on top
int tab_index; ///< Tab index in editor
Scriptable<double> left, top; ///< Position of this field
Scriptable<double> width, height; ///< Position of this field
Scriptable<double> right, bottom; ///< Position of this field