Fixed TextCtrl to work for keyword properties;

Added wrapping of <> around parameters to TextElement;
Added colors for keyword parameters;
Added menu & toolbar for keyword panel;
Fixed bug in package, save/save-as was the wrong way around;
Added third quality setting to RotatedDC: using SetUserScale, this gets you more precise positioning.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@250 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-04-12 17:35:00 +00:00
parent 1fc7e57b91
commit 42ab8c84c0
36 changed files with 468 additions and 116 deletions
+1 -6
View File
@@ -31,15 +31,10 @@ IMPLEMENT_REFLECTION(MultipleChoiceField) {
MultipleChoiceStyle::MultipleChoiceStyle(const MultipleChoiceFieldP& field)
: ChoiceStyle(field)
, direction(HORIZONTAL)
, direction(LEFT_TO_RIGHT)
, spacing(0)
{}
IMPLEMENT_REFLECTION_ENUM(Direction) {
VALUE_N("horizontal", HORIZONTAL);
VALUE_N("vertical", VERTICAL);
}
IMPLEMENT_REFLECTION(MultipleChoiceStyle) {
REFLECT_BASE(ChoiceStyle);
REFLECT(direction);
-4
View File
@@ -32,10 +32,6 @@ class MultipleChoiceField : public ChoiceField {
// ----------------------------------------------------------------------------- : MultipleChoiceStyle
enum Direction {
HORIZONTAL, VERTICAL
};
/// The Style for a MultipleChoiceField
class MultipleChoiceStyle : public ChoiceStyle {
public:
+15 -2
View File
@@ -86,6 +86,7 @@ IMPLEMENT_REFLECTION(TextStyle) {
REFLECT(line_height_hard);
REFLECT(line_height_line);
REFLECT_N("mask", mask_filename);
REFLECT(direction);
}
// ----------------------------------------------------------------------------- : TextValue
@@ -108,15 +109,27 @@ IMPLEMENT_REFLECTION_NAMELESS(TextValue) {
// ----------------------------------------------------------------------------- : FakeTextValue
FakeTextValue::FakeTextValue(const TextFieldP& field, String* underlying, bool untagged)
: TextValue(field), underlying(underlying)
, untagged(untagged)
{
if (underlying) {
value.assign(untagged ? escape(*underlying) : *underlying);
}
}
void FakeTextValue::onAction(Action& a, bool undone) {
*underlying = value;
if (underlying) {
*underlying = untagged ? untag(value) : value;
}
}
bool FakeTextValue::equals(const Value* that) {
if (this == that) return true;
if (!underlying) return false;
const FakeTextValue* thatT = dynamic_cast<const FakeTextValue*>(that);
if (!thatT || underlying != thatT->underlying) return false;
// update the value
value = *underlying;
value.assign(untagged ? escape(*underlying) : *underlying);
return true;
}
+7 -4
View File
@@ -65,7 +65,8 @@ class TextStyle : public Style {
double line_height_hard; ///< Line height for hard linebreaks
double line_height_line; ///< Line height for <line> tags
String mask_filename; ///< Filename of the mask
ContourMask mask; ///< Mask to fit the text to (may be null)
ContourMask mask; ///< Mask to fit the text to (may be null)
Direction direction; ///< In what direction is text layed out?
virtual bool update(Context&);
virtual void initDependencies(Context&, const Dependency&) const;
@@ -104,10 +105,12 @@ class TextValue : public Value {
/** Used by TextCtrl */
class FakeTextValue : public TextValue {
public:
inline FakeTextValue(const TextFieldP& field, String* underlying)
: TextValue(field), underlying(underlying) {}
/// Initialize the fake text value
/** underlying can be nullptr, in that case there is no underlying value */
FakeTextValue(const TextFieldP& field, String* underlying, bool untagged);
String* const underlying; ///< The underlying actual value
String* const underlying; ///< The underlying actual value, can be null
bool const untagged; ///< The underlying value is untagged
/// Update underlying data
virtual void onAction(Action& a, bool undone);
+4 -1
View File
@@ -27,7 +27,7 @@ void Font::initDependencies(Context& ctx, const Dependency& dep) const {
shadow_color.initDependencies(ctx, dep);
}
FontP Font::make(bool bold, bool italic, bool placeholder_color) const {
FontP Font::make(bool bold, bool italic, bool placeholder_color, Color* other_color) const {
FontP f(new Font(*this));
if (bold) f->font.SetWeight(wxBOLD);
if (italic) {
@@ -41,6 +41,9 @@ FontP Font::make(bool bold, bool italic, bool placeholder_color) const {
f->color = f->separator_color;
f->shadow_displacement = RealSize(0,0); // no shadow
}
if (other_color) {
f->color = *other_color;
}
return f;
}
+1 -1
View File
@@ -41,7 +41,7 @@ class Font {
inline bool hasShadow() { return shadow_displacement.width != 0 || shadow_displacement.height != 0; }
/// Make a bold/italic/placeholder version of this font
FontP make(bool bold, bool italic, bool placeholder_color) const;
FontP make(bool bold, bool italic, bool placeholder_color, Color* other_color) const;
private:
DECLARE_REFLECTION();
+2 -1
View File
@@ -34,6 +34,7 @@ IMPLEMENT_REFLECTION(KeywordParam) {
IMPLEMENT_REFLECTION(KeywordMode) {
REFLECT(name);
REFLECT(description);
REFLECT(is_default);
}
// backwards compatability
@@ -376,7 +377,7 @@ String KeywordDatabase::expand(const String& text,
String param = untagged.substr(start_u, len_u); // untagged version
if (param.empty()) {
// placeholder
param = _("<atom-kwpph>") + (kwp.placeholder.empty() ? kwp.name : kwp.placeholder) + _("</atom-kwpph>");
param = _("<atom-kwpph>") + (kwp.placeholder.empty() ? kwp.name : kwp.placeholder) + _("</atom-kwpph>");
part = part + param; // keep tags
} else if (kw->parameters[j/2-1]->script) {
// apply parameter script
+1
View File
@@ -41,6 +41,7 @@ class KeywordParam {
class KeywordMode {
String name; ///< Name of the mode
String description; ///< Description of the type
bool is_default; ///< This is the default mode for new keywords
DECLARE_REFLECTION();
};