added native look editor and the set info panel

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@82 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-11-20 17:26:34 +00:00
parent 141400d8aa
commit 3cbf2577c1
32 changed files with 458 additions and 48 deletions
+2 -2
View File
@@ -14,13 +14,13 @@ DECLARE_TYPEOF_COLLECTION(TextElementP);
// ----------------------------------------------------------------------------- : TextElements
void TextElements::draw(RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const {
void TextElements::draw(RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const {
FOR_EACH_CONST(e, elements) {
size_t start_ = max(start, e->start);
size_t end_ = min(end, e->end);
if (start_ < end_) {
e->draw(dc, scale,
RealRect(rect.position.x + xs[start_-start], rect.position.y,
RealRect(rect.position.x + xs[start_-start] - xs[0], rect.position.y,
xs[end_-start] - xs[start_-start], rect.size.height),
xs + start_ - start, what, start_, end_);
}
+6 -6
View File
@@ -59,7 +59,7 @@ class TextElement {
/// Draw a subsection section of the text in the given rectangle
/** 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;
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const 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)
@@ -96,7 +96,7 @@ 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, double* xs, DrawWhat what, size_t start, size_t end) const;
void draw (RotatedDC& dc, double scale, const RealRect& rect, const 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
@@ -131,7 +131,7 @@ class FontTextElement : public SimpleTextElement {
, font(font)
{}
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const;
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const 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:
@@ -147,7 +147,7 @@ class SymbolTextElement : public SimpleTextElement {
, font(font), ctx(*ctx)
{}
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const;
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const 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:
@@ -172,7 +172,7 @@ 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, double* xs, DrawWhat what, size_t start, size_t end) const;
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const 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;
};
@@ -185,7 +185,7 @@ 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, double* xs, DrawWhat what, size_t start, size_t end) const;
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const;
virtual RealSize charSize(RotatedDC& dc, double scale, size_t index) const;
private:
+1 -1
View File
@@ -11,7 +11,7 @@
// ----------------------------------------------------------------------------- : FontTextElement
void FontTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const {
void FontTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const {
dc.SetFont(font->font, font->size * scale);
if (end != start && text.substr(end-1, 1) == _("\n")) end -= 1; // don't draw the newline character at the end
+1 -1
View File
@@ -10,7 +10,7 @@
// ----------------------------------------------------------------------------- : HorizontalLineTextElement
void HorizontalLineTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const {
void HorizontalLineTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const {
// handled by TextViewer
}
+1 -1
View File
@@ -11,7 +11,7 @@
// ----------------------------------------------------------------------------- : SymbolTextElement
void SymbolTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, double* xs, DrawWhat what, size_t start, size_t end) const {
void SymbolTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const {
if (font.font) {
font.font->draw(dc, ctx, rect, font.size * scale, font.alignment, text.substr(start, end-start));
}
+2 -2
View File
@@ -257,11 +257,11 @@ bool TextViewer::prepareLinesScale(RotatedDC& dc, const String& text, const Text
}
double TextViewer::lineLeft(RotatedDC& dc, const TextStyle& style, double y) {
return 0;
return 0 + style.padding_left;
// return style.mask.rowLeft(y, dc.getInternalSize()) + style.padding_left;
}
double TextViewer::lineRight(RotatedDC& dc, const TextStyle& style, double y) {
return style.width;
return style.width - style.padding_right;
// return style.mask.rowRight(y, dc.getInternalSize()) - style.padding_right;
}
ContourMask::ContourMask() {} // MOVEME //@@