uppsrc.diff
uppsrc/Draw/Display.cpp 2011-10-12 01:13:07 +0600 | ||
---|---|---|
23 | 23 |
ink = Null; |
24 | 24 |
normalink = Null; |
25 | 25 |
paper = Null; |
26 |
font = Null;
|
|
26 |
font = StdFont();
|
|
27 | 27 |
align = Null; |
28 | 28 |
imgspc = 0; |
29 | 29 |
} |
30 | 30 |
|
31 |
AttrText::AttrText(const char *_text)
|
|
31 |
AttrText::AttrText(const char *text) : text(text)
|
|
32 | 32 |
{ |
33 |
text = _text; |
|
34 | 33 |
Init(); |
35 | 34 |
} |
36 | 35 |
|
37 |
AttrText::AttrText(const wchar *_text)
|
|
36 |
AttrText::AttrText(const wchar *text) : text(text)
|
|
38 | 37 |
{ |
39 |
text = _text; |
|
40 | 38 |
Init(); |
41 | 39 |
} |
42 | 40 |
|
43 |
AttrText::AttrText(const WString& _text)
|
|
41 |
AttrText::AttrText(const WString& text) : text(text)
|
|
44 | 42 |
{ |
45 |
text = _text; |
|
46 | 43 |
Init(); |
47 | 44 |
} |
48 | 45 |
|
49 |
AttrText::AttrText(const String& _text)
|
|
46 |
AttrText::AttrText(const String& text) : text(text.ToWString())
|
|
50 | 47 |
{ |
51 |
text = _text.ToWString(); |
|
52 | 48 |
Init(); |
53 | 49 |
} |
54 | 50 |
|
... | ... | |
102 | 98 |
if(IsType<AttrText>(q)) { |
103 | 99 |
const AttrText& t = ValueTo<AttrText>(q); |
104 | 100 |
txt = t.text; |
101 |
font = t.font; |
|
105 | 102 |
if(!IsNull(t.paper)) |
106 | 103 |
paper = t.paper; |
107 | 104 |
if(!IsNull(t.ink)) |
108 | 105 |
ink = t.ink; |
109 | 106 |
if(!IsNull(t.normalink) && !(s & (CURSOR|SELECT|READONLY))) |
110 | 107 |
ink = t.normalink; |
111 |
if(!IsNull(t.font)) |
|
112 |
font = t.font; |
|
113 | 108 |
if(!IsNull(t.align)) |
114 | 109 |
a = t.align; |
115 | 110 |
if(!IsNull(t.img)) { |
... | ... | |
154 | 149 |
if(IsType<AttrText>(q)) { |
155 | 150 |
const AttrText& t = ValueTo<AttrText>(q); |
156 | 151 |
txt = t.text; |
157 |
if(!IsNull(t.font)) |
|
158 |
font = t.font; |
|
152 |
font = t.font; |
|
159 | 153 |
if(!IsNull(t.img)) { |
160 | 154 |
isz = t.img.GetSize(); |
161 | 155 |
isz.cx += t.imgspc; |
uppsrc/Draw/Display.h 2011-10-11 23:29:25 +0600 | ||
---|---|---|
40 | 40 |
AttrText& NormalInk(Color c) { normalink = c; return *this; } |
41 | 41 |
AttrText& Paper(Color c) { paper = c; return *this; } |
42 | 42 |
AttrText& SetFont(Font f) { font = f; return *this; } |
43 |
Font GetFont() const { return font; } |
|
44 |
|
|
45 |
bool IsBold() const { return font.IsBold(); } |
|
46 |
bool IsItalic() const { return font.IsItalic(); } |
|
47 |
bool IsUnderline() const { return font.IsUnderline(); } |
|
48 |
bool IsStrikeout() const { return font.IsStrikeout(); } |
|
49 |
bool IsNonAntiAliased() const { return font.IsNonAntiAliased(); } |
|
50 |
bool IsTrueTypeOnly() const { return font.IsTrueTypeOnly(); } |
|
51 |
|
|
52 |
AttrText& Bold() { font.Bold(); return *this; } |
|
53 |
AttrText& NoBold() { font.NoBold(); return *this; } |
|
54 |
AttrText& Bold(bool b) { return b ? Bold() : NoBold(); } |
|
55 |
AttrText& Italic() { font.Italic(); return *this; } |
|
56 |
AttrText& NoItalic() { font.NoItalic(); return *this; } |
|
57 |
AttrText& Italic(bool b) { return b ? Italic() : NoItalic(); } |
|
58 |
AttrText& Underline() { font.Underline(); return *this; } |
|
59 |
AttrText& NoUnderline() { font.NoUnderline(); return *this; } |
|
60 |
AttrText& Underline(bool b) { return b ? Underline() : NoUnderline(); } |
|
61 |
AttrText& Strikeout() { font.Strikeout(); return *this; } |
|
62 |
AttrText& NoStrikeout() { font.NoStrikeout(); return *this; } |
|
63 |
AttrText& Strikeout(bool b) { return b ? Strikeout() : NoStrikeout(); } |
|
64 |
AttrText& NonAntiAliased() { font.NonAntiAliased(); return *this; } |
|
65 |
AttrText& NoNonAntiAliased() { font.NoNonAntiAliased(); return *this; } |
|
66 |
AttrText& NonAntiAliased(bool b) { return b ? NonAntiAliased() : NoNonAntiAliased(); } |
|
67 |
AttrText& TrueTypeOnly() { font.TrueTypeOnly(); return *this; } |
|
68 |
AttrText& NoTrueTypeOnly() { font.NoTrueTypeOnly(); return *this; } |
|
69 |
AttrText& TrueTypeOnly(bool b) { return b ? TrueTypeOnly() : NoTrueTypeOnly(); } |
|
70 |
|
|
43 | 71 |
AttrText& Align(int a) { align = a; return *this; } |
44 | 72 |
AttrText& Left() { return Align(ALIGN_LEFT); } |
45 | 73 |
AttrText& Center() { return Align(ALIGN_CENTER); } |
uppsrc/Draw/Draw.h 2011-10-11 23:02:17 +0600 | ||
---|---|---|
101 | 101 |
SCREEN_SANS = SANSSERIF, |
102 | 102 |
SCREEN_FIXED = MONOSPACE, |
103 | 103 |
}; |
104 |
|
|
105 |
enum { |
|
106 |
FONT_BOLD = 0x8000, |
|
107 |
FONT_ITALIC = 0x4000, |
|
108 |
FONT_UNDERLINE = 0x2000, |
|
109 |
FONT_STRIKEOUT = 0x1000, |
|
110 |
FONT_NON_ANTI_ALIASED = 0x800, |
|
111 |
FONT_TRUE_TYPE_ONLY = 0x400 |
|
112 |
}; |
|
104 | 113 |
|
105 | 114 |
int GetFace() const { return v.face; } |
106 | 115 |
int GetHeight() const; |
107 | 116 |
int GetWidth() const { return v.width; } |
108 |
bool IsBold() const { return v.flags & 0x8000; } |
|
109 |
bool IsItalic() const { return v.flags & 0x4000; } |
|
110 |
bool IsUnderline() const { return v.flags & 0x2000; } |
|
111 |
bool IsStrikeout() const { return v.flags & 0x1000; } |
|
112 |
bool IsNonAntiAliased() const { return v.flags & 0x800; } |
|
113 |
bool IsTrueTypeOnly() const { return v.flags & 0x400; } |
|
117 |
bool IsBold() const { return v.flags & FONT_BOLD; } |
|
118 |
bool IsItalic() const { return v.flags & FONT_ITALIC; } |
|
119 |
bool IsUnderline() const { return v.flags & FONT_UNDERLINE; } |
|
120 |
bool IsStrikeout() const { return v.flags & FONT_STRIKEOUT; } |
|
121 |
bool IsNonAntiAliased() const { return v.flags & FONT_NON_ANTI_ALIASED; } |
|
122 |
bool IsTrueTypeOnly() const { return v.flags & FONT_TRUE_TYPE_ONLY; } |
|
123 |
dword GetFlags() const { return v.flags; } |
|
124 |
Font& SetFlags(dword flags) { v.flags = flags; return *this; } |
|
114 | 125 |
String GetFaceName() const; |
115 | 126 |
dword GetFaceInfo() const; |
116 | 127 |
int64 AsInt64() const { return data; } |
... | ... | |
118 | 129 |
Font& Face(int n) { v.face = n; return *this; } |
119 | 130 |
Font& Height(int n) { v.height = n; return *this; } |
120 | 131 |
Font& Width(int n) { v.width = n; return *this; } |
121 |
Font& Bold() { v.flags |= 0x8000; return *this; }
|
|
122 |
Font& NoBold() { v.flags &= ~0x8000; return *this; }
|
|
132 |
Font& Bold() { v.flags |= FONT_BOLD; return *this; }
|
|
133 |
Font& NoBold() { v.flags &= ~FONT_BOLD; return *this; }
|
|
123 | 134 |
Font& Bold(bool b) { return b ? Bold() : NoBold(); } |
124 |
Font& Italic() { v.flags |= 0x4000; return *this; }
|
|
125 |
Font& NoItalic() { v.flags &= ~0x4000; return *this; }
|
|
135 |
Font& Italic() { v.flags |= FONT_ITALIC; return *this; }
|
|
136 |
Font& NoItalic() { v.flags &= ~FONT_ITALIC; return *this; }
|
|
126 | 137 |
Font& Italic(bool b) { return b ? Italic() : NoItalic(); } |
127 |
Font& Underline() { v.flags |= 0x2000; return *this; }
|
|
128 |
Font& NoUnderline() { v.flags &= ~0x2000; return *this; }
|
|
138 |
Font& Underline() { v.flags |= FONT_UNDERLINE; return *this; }
|
|
139 |
Font& NoUnderline() { v.flags &= ~FONT_UNDERLINE; return *this; }
|
|
129 | 140 |
Font& Underline(bool b) { return b ? Underline() : NoUnderline(); } |
130 |
Font& Strikeout() { v.flags |= 0x1000; return *this; }
|
|
131 |
Font& NoStrikeout() { v.flags &= ~0x1000; return *this; }
|
|
141 |
Font& Strikeout() { v.flags |= FONT_STRIKEOUT; return *this; }
|
|
142 |
Font& NoStrikeout() { v.flags &= ~FONT_STRIKEOUT; return *this; }
|
|
132 | 143 |
Font& Strikeout(bool b) { return b ? Strikeout() : NoStrikeout(); } |
133 |
Font& NonAntiAliased() { v.flags |= 0x800; return *this; }
|
|
134 |
Font& NoNonAntiAliased() { v.flags &= ~0x800; return *this; }
|
|
144 |
Font& NonAntiAliased() { v.flags |= FONT_NON_ANTI_ALIASED; return *this; }
|
|
145 |
Font& NoNonAntiAliased() { v.flags &= ~FONT_NON_ANTI_ALIASED; return *this; }
|
|
135 | 146 |
Font& NonAntiAliased(bool b) { return b ? NonAntiAliased() : NoNonAntiAliased(); } |
136 |
Font& TrueTypeOnly() { v.flags |= 0x400; return *this; }
|
|
137 |
Font& NoTrueTypeOnly() { v.flags &= ~0x400; return *this; }
|
|
147 |
Font& TrueTypeOnly() { v.flags |= FONT_TRUE_TYPE_ONLY; return *this; }
|
|
148 |
Font& NoTrueTypeOnly() { v.flags &= ~FONT_TRUE_TYPE_ONLY; return *this; }
|
|
138 | 149 |
Font& TrueTypeOnly(bool b) { return b ? TrueTypeOnly() : NoTrueTypeOnly(); } |
150 |
|
|
139 | 151 |
Font& FaceName(const String& name); |
140 | 152 |
|
141 | 153 |
Font operator()() const { return *this; } |