mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
ParseQTF removed scolors option - fixed problem with bad colors in X11
git-svn-id: svn://ultimatepp.org/upp/trunk@814 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
4200943fba
commit
edda78a585
5 changed files with 13 additions and 33 deletions
|
|
@ -97,7 +97,7 @@ int GetSmartTextHeight(const char *s, int cx, Font font) {
|
|||
void DrawSmartText(Draw& draw, int x, int y, int cx, const char *text, Font font, Color ink, int accesskey) {
|
||||
if(*text == '\1') {
|
||||
Size sz;
|
||||
RichText txt = ParseQTF(text + 1, false, accesskey);
|
||||
RichText txt = ParseQTF(text + 1, accesskey);
|
||||
txt.ApplyZoom(GetRichTextStdScreenZoom());
|
||||
txt.Paint(Zoom(1, 1), draw, x, y, cx);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
void Clear();
|
||||
void Pick(pick_ RichText& t);
|
||||
void Pick(pick_ RichText& txt, Zoom z);
|
||||
void SetQTF(const char *qtf, Zoom z = Zoom(1, 1), bool scolors = false);
|
||||
void SetQTF(const char *qtf, Zoom z = Zoom(1, 1));
|
||||
const RichText& Get() const { return text; }
|
||||
String GetQTF(byte cs = CHARSET_UTF8) const { return AsQTF(text, cs); }
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ public:
|
|||
virtual void SetData(const Value& v);
|
||||
|
||||
public:
|
||||
void SetQTF(const char *qtf, Zoom z = GetRichTextStdScreenZoom()) { RichTextView::SetQTF(qtf, z, true); }
|
||||
void SetQTF(const char *qtf, Zoom z = GetRichTextStdScreenZoom()) { RichTextView::SetQTF(qtf, z); }
|
||||
void operator=(const char *qtf) { SetQTF(qtf); }
|
||||
RichTextCtrl();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -308,9 +308,9 @@ void RichTextView::Pick(pick_ RichText& txt, Zoom z) {
|
|||
sb.SetLine(z * 100);
|
||||
}
|
||||
|
||||
void RichTextView::SetQTF(const char *qtf, Zoom z, bool scolors)
|
||||
void RichTextView::SetQTF(const char *qtf, Zoom z)
|
||||
{
|
||||
Pick(ParseQTF(qtf, scolors), z);
|
||||
Pick(ParseQTF(qtf), z);
|
||||
}
|
||||
|
||||
RichTextView& RichTextView::PageWidth(int _cx)
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ Color (*QTFColor[])() = {
|
|||
Black, LtGray, White, Red, Green, Blue, LtRed, WhiteGray, LtCyan, Yellow
|
||||
};
|
||||
|
||||
Color (*QTFSColor[])()= {
|
||||
SColorText, SColorFace, SColorPaper, Red, Green, Blue, LtRed, WhiteGray, LtCyan, Yellow
|
||||
};
|
||||
|
||||
Color NullColorF()
|
||||
{
|
||||
return Null;
|
||||
|
|
@ -29,27 +25,12 @@ static Color (*QTFColorL[])() = {
|
|||
/*Y*/LtYellow, /*Z*/White
|
||||
};
|
||||
|
||||
static Color (*QTFSColorl[])() = { //TODO
|
||||
/*a*/SColorPaper, /*b*/SColorHighlight, /*c*/Cyan, /*d*/SColorPaper, /*e*/SColorPaper, /*f*/SColorPaper, /*g*/ Green, /*h*/SColorPaper,
|
||||
/*i*/SColorPaper, /*j*/SColorPaper, /*k*/SColorText, /*l*/SColorFace, /*m*/Magenta, /*n*/NullColorF, /*o*/Brown, /*p*/SColorPaper,
|
||||
/*q*/SColorPaper, /*r*/Red, /*s*/SColorPaper, /*t*/SColorPaper, /*u*/SColorPaper, /*v*/SColorPaper, /*w*/WhiteGray, /*x*/SColorPaper,
|
||||
/*y*/Yellow, /*z*/ White
|
||||
};
|
||||
|
||||
static Color (*QTFSColorL[])() = { //TODO
|
||||
/*A*/SColorPaper, /*B*/LtBlue, /*C*/LtCyan, /*D*/SColorPaper, /*E*/SColorPaper, /*F*/SColorPaper, /*G*/LtGreen, /*H*/SColorPaper,
|
||||
/*I*/SColorPaper, /*J*/SColorPaper, /*K*/SColorShadow, /*L*/WhiteGray, /*M*/LtMagenta, /*N*/NullColorF, /*O*/Brown, /*P*/SColorPaper,
|
||||
/*Q*/SColorPaper, /*R*/LtRed, /*S*/SColorPaper, /*T*/SColorPaper, /*U*/SColorPaper, /*V*/SColorPaper, /*W*/SColorPaper, /*X*/SColorPaper,
|
||||
/*Y*/LtYellow, /*Z*/White
|
||||
};
|
||||
|
||||
int QTFFontHeight[] = {
|
||||
50, 67, 84, 100, 134, 167, 200, 234, 300, 400
|
||||
};
|
||||
|
||||
class RichQtfParser {
|
||||
const char *term;
|
||||
bool scolors;
|
||||
WString text;
|
||||
RichPara paragraph;
|
||||
RichTable tablepart;
|
||||
|
|
@ -115,12 +96,12 @@ public:
|
|||
|
||||
void Parse(const char *qtf, byte accesskey);
|
||||
|
||||
RichQtfParser(bool scolors);
|
||||
RichQtfParser();
|
||||
};
|
||||
|
||||
void init_s_nodeqtf();
|
||||
|
||||
RichQtfParser::RichQtfParser(bool _scolors)
|
||||
RichQtfParser::RichQtfParser()
|
||||
{
|
||||
format.Face(Font::ARIAL);
|
||||
format.Height(100);
|
||||
|
|
@ -130,7 +111,6 @@ RichQtfParser::RichQtfParser(bool _scolors)
|
|||
istable = false;
|
||||
oldtab = false;
|
||||
init_s_nodeqtf();
|
||||
scolors = _scolors;
|
||||
}
|
||||
|
||||
bool RichQtfParser::Key2(int c, int d)
|
||||
|
|
@ -211,13 +191,13 @@ Color RichQtfParser::GetColor()
|
|||
}
|
||||
else
|
||||
if(c >= '0' && c <= '9')
|
||||
return (*((scolors ? QTFSColor : QTFColor)[c - '0']))();
|
||||
return QTFColor[c - '0']();
|
||||
else
|
||||
if(c >= 'a' && c <= 'z')
|
||||
return (*((scolors ? QTFSColorl : QTFColorl)[c - 'a']))();
|
||||
return QTFColorl[c - 'a']();
|
||||
else
|
||||
if(c >= 'A' && c <= 'Z')
|
||||
return (*((scolors ? QTFSColorL : QTFColorL)[c - 'A']))();
|
||||
return QTFColorL[c - 'A']();
|
||||
else
|
||||
return Red;
|
||||
}
|
||||
|
|
@ -945,9 +925,9 @@ void RichQtfParser::Parse(const char *qtf, byte _accesskey)
|
|||
FlushStyles();
|
||||
}
|
||||
|
||||
RichText ParseQTF(const char *qtf, bool scolors, byte accesskey)
|
||||
RichText ParseQTF(const char *qtf, byte accesskey)
|
||||
{
|
||||
RichQtfParser p(scolors);
|
||||
RichQtfParser p;
|
||||
try {
|
||||
p.Parse(qtf, accesskey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ public:
|
|||
|
||||
String AsQTF(const RichObject& obj);
|
||||
|
||||
RichText ParseQTF(const char *qtf, bool scolors = false, byte accesskey = 0);
|
||||
RichText ParseQTF(const char *qtf, byte accesskey = 0);
|
||||
|
||||
RichText AsRichText(const wchar *s, const RichPara::Format& f = RichPara::Format());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue