mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
combined_editor function, and improved dependency handling (removing duplicates), viewer refreshes on events from script manager
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@147 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -69,7 +69,7 @@ String TextValueAction::getName(bool to_undo) const { return name; }
|
||||
|
||||
void TextValueAction::perform(bool to_undo) {
|
||||
swap(value().value, new_value);
|
||||
// if (value().value.age < new_value.age) value().value.age = Age();
|
||||
value().last_update.update();
|
||||
swap(selection_end, new_selection_end);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ void mark_dependency_member(const CardP& card, const String& name, const Depende
|
||||
// Find field with that name
|
||||
IndexMap<FieldP,ValueP>::const_iterator it = card->data.find(name);
|
||||
if (it != card->data.end()) {
|
||||
(*it)->fieldP->dependent_scripts.push_back(dep);
|
||||
(*it)->fieldP->dependent_scripts.add(dep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ class Field {
|
||||
String card_list_name; ///< Alternate name to use in card list.
|
||||
Alignment card_list_align; ///< Alignment of the card list colummn.
|
||||
int tab_index; ///< Tab index in editor
|
||||
vector<Dependency> dependent_scripts; ///< Scripts that depend on values of this field
|
||||
Dependencies dependent_scripts; ///< Scripts that depend on values of this field
|
||||
|
||||
/// Creates a new Value corresponding to this Field
|
||||
/** thisP is a smart pointer to this */
|
||||
|
||||
@@ -95,8 +95,11 @@ String TextValue::toString() const {
|
||||
}
|
||||
bool TextValue::update(Context& ctx) {
|
||||
Value::update(ctx);
|
||||
return field().default_script.invokeOnDefault(ctx, value)
|
||||
| field(). script.invokeOn(ctx, value);
|
||||
WITH_DYNAMIC_ARG(last_update_age, last_update.get());
|
||||
bool change = field().default_script.invokeOnDefault(ctx, value)
|
||||
| field(). script.invokeOn(ctx, value);
|
||||
if (change) last_update.update();
|
||||
return change;
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_NAMELESS(TextValue) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <util/defaultable.hpp>
|
||||
#include <util/rotation.hpp>
|
||||
#include <util/age.hpp>
|
||||
#include <data/field.hpp>
|
||||
#include <data/font.hpp>
|
||||
#include <data/symbol_font.hpp>
|
||||
@@ -88,6 +89,7 @@ class TextValue : public Value {
|
||||
|
||||
typedef Defaultable<String> ValueType;
|
||||
ValueType value; ///< The text of this value
|
||||
Age last_update; ///< When was the text last changed?
|
||||
|
||||
virtual String toString() const;
|
||||
virtual bool update(Context&);
|
||||
|
||||
+3
-3
@@ -45,9 +45,9 @@ class Game : public Packaged {
|
||||
vector<KeywordModeP> keyword_modes; ///< Modes of keywords
|
||||
vector<KeywordP> keywords; ///< Keywords for use in text
|
||||
|
||||
vector<Dependency> dependent_scripts_cards; ///< scripts that depend on the card list
|
||||
vector<Dependency> dependent_scripts_keywords; ///< scripts that depend on the keywords
|
||||
bool dependencies_initialized; ///< are the script dependencies comming from this game all initialized?
|
||||
Dependencies dependent_scripts_cards; ///< scripts that depend on the card list
|
||||
Dependencies dependent_scripts_keywords; ///< scripts that depend on the keywords
|
||||
bool dependencies_initialized; ///< are the script dependencies comming from this game all initialized?
|
||||
|
||||
/// Loads the game with a particular name, for example "magic"
|
||||
static GameP byName(const String& name);
|
||||
|
||||
+3
-3
@@ -135,18 +135,18 @@ ScriptValueP make_iterator(const Set& set) {
|
||||
void mark_dependency_member(Set* value, const String& name, const Dependency& dep) {
|
||||
// is it the card list?
|
||||
if (name == _("cards")) {
|
||||
value->game->dependent_scripts_cards.push_back(dep);
|
||||
value->game->dependent_scripts_cards.add(dep);
|
||||
return;
|
||||
}
|
||||
// is it the keywords?
|
||||
if (name == _("keywords")) {
|
||||
value->game->dependent_scripts_keywords.push_back(dep);
|
||||
value->game->dependent_scripts_keywords.add(dep);
|
||||
return;
|
||||
}
|
||||
// is it in the set data?
|
||||
IndexMap<FieldP,ValueP>::const_iterator it = value->data.find(name);
|
||||
if (it != value->data.end()) {
|
||||
(*it)->fieldP->dependent_scripts.push_back(dep);
|
||||
(*it)->fieldP->dependent_scripts.add(dep);
|
||||
}
|
||||
}
|
||||
void mark_dependency_member(const SetP& value, const String& name, const Dependency& dep) {
|
||||
|
||||
Reference in New Issue
Block a user