mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 13:17:00 -04:00
Added GraphControl; FilteredCardList; ValueEditor
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@74 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+23
-14
@@ -17,6 +17,7 @@ DECLARE_POINTER_TYPE(TextElement);
|
||||
DECLARE_POINTER_TYPE(Font);
|
||||
class TextStyle;
|
||||
class Context;
|
||||
class SymbolFontRef;
|
||||
|
||||
// ----------------------------------------------------------------------------- : TextElement
|
||||
|
||||
@@ -56,14 +57,13 @@ class TextElement {
|
||||
virtual ~TextElement() {}
|
||||
|
||||
/// Draw a subsection section of the text in the given rectangle
|
||||
/** this->start <= start < end <= this->end <= text.size() */
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, DrawWhat what, size_t start, size_t end) const = 0;
|
||||
// /// The size of a single character at position index
|
||||
// /** index is in the range [start..end) */
|
||||
// virtual RealSize charSize(const Rotation& rot, double scale, size_t index) const = 0;
|
||||
/** xs give the x coordinates for each character
|
||||
* this->start <= start < end <= this->end <= text.size() */
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const = 0;
|
||||
/// Get information on all characters in the range [start...end) and store them in out
|
||||
virtual void getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const = 0;
|
||||
|
||||
/// Return the minimum scale factor allowed (starts at 1)
|
||||
virtual double minScale() const = 0;
|
||||
/*
|
||||
// draw the section <start...end)
|
||||
// drawSeparators indicates what we should draw, separators or normal text
|
||||
@@ -96,10 +96,11 @@ class TextElement {
|
||||
class TextElements : public vector<TextElementP> {
|
||||
public:
|
||||
/// Draw all the elements (as need to show the range start..end)
|
||||
void draw (RotatedDC& dc, double scale, const RealRect& rect, DrawWhat what, size_t start, size_t end) const;
|
||||
// RealSize charSize(const Rotation& rot, double scale, size_t index) const;
|
||||
void draw (RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const;
|
||||
// Get information on all characters in the range [start...end) and store them in out
|
||||
void getCharInfo(RotatedDC& dc, double scale, size_t start, size_t end, vector<CharInfo>& out) const;
|
||||
/// Return the minimum scale factor allowed by all elements
|
||||
double minScale() const;
|
||||
|
||||
/// The actual elements
|
||||
/** They must be in order of positions and not overlap, i.e.
|
||||
@@ -130,8 +131,9 @@ class FontTextElement : public SimpleTextElement {
|
||||
, font(font)
|
||||
{}
|
||||
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, DrawWhat what, size_t start, size_t end) const;
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const;
|
||||
virtual void getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const;
|
||||
virtual double minScale() const;
|
||||
private:
|
||||
FontP font;
|
||||
DrawWhat draw_as;
|
||||
@@ -140,10 +142,16 @@ class FontTextElement : public SimpleTextElement {
|
||||
/// A text element that uses a symbol font
|
||||
class SymbolTextElement : public SimpleTextElement {
|
||||
public:
|
||||
SymbolTextElement(const String& text, size_t start ,size_t end) : SimpleTextElement(text, start, end) {}
|
||||
SymbolTextElement(const String& text, size_t start ,size_t end, const SymbolFontRef& font)
|
||||
: SimpleTextElement(text, start, end)
|
||||
, font(font)
|
||||
{}
|
||||
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, DrawWhat what, size_t start, size_t end) const;
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const;
|
||||
virtual void getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const;
|
||||
virtual double minScale() const;
|
||||
private:
|
||||
const SymbolFontRef& font; // owned by TextStyle
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : CompoundTextElement
|
||||
@@ -163,8 +171,9 @@ class HorizontalLineTextElement : public TextElement {
|
||||
public:
|
||||
HorizontalLineTextElement(const String& text, size_t start ,size_t end) : TextElement(text, start, end) {}
|
||||
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, DrawWhat what, size_t start, size_t end) const;
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const;
|
||||
virtual void getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const;
|
||||
virtual double minScale() const;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -175,8 +184,8 @@ class CompoundTextElement : public TextElement {
|
||||
public:
|
||||
CompoundTextElement(const String& text, size_t start ,size_t end) : TextElement(text, start, end) {}
|
||||
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, DrawWhat what, size_t start, size_t end) const;
|
||||
virtual RealSize charSize(RotatedDC& dc, double scale, size_t index) const;
|
||||
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const;
|
||||
virtual RealSize charSize(RotatedDC& dc, double scale, size_t index) const;
|
||||
|
||||
private:
|
||||
TextElements elements;
|
||||
|
||||
Reference in New Issue
Block a user