Editing of keywords

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@255 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-04-13 23:59:42 +00:00
parent 1be1304c94
commit 7b45f6f69e
15 changed files with 326 additions and 79 deletions
+14 -7
View File
@@ -109,18 +109,25 @@ IMPLEMENT_REFLECTION_NAMELESS(TextValue) {
// ----------------------------------------------------------------------------- : FakeTextValue
FakeTextValue::FakeTextValue(const TextFieldP& field, String* underlying, bool untagged)
FakeTextValue::FakeTextValue(const TextFieldP& field, String* underlying, bool editable, bool untagged)
: TextValue(field), underlying(underlying)
, untagged(untagged)
{
if (underlying) {
value.assign(untagged ? escape(*underlying) : *underlying);
, editable(editable), untagged(untagged)
{}
void FakeTextValue::store() {
if (editable) {
*underlying = untagged ? untag(value) : value;
} else {
retrieve();
}
}
void FakeTextValue::retrieve() {
value.assign(untagged ? escape(*underlying) : *underlying);
}
void FakeTextValue::onAction(Action& a, bool undone) {
if (underlying) {
*underlying = untagged ? untag(value) : value;
store();
}
}
@@ -130,6 +137,6 @@ bool FakeTextValue::equals(const Value* that) {
const FakeTextValue* thatT = dynamic_cast<const FakeTextValue*>(that);
if (!thatT || underlying != thatT->underlying) return false;
// update the value
value.assign(untagged ? escape(*underlying) : *underlying);
retrieve();
return true;
}