101 |
101 |
property[i].SetCharset(charset);
|
102 |
102 |
}
|
103 |
103 |
|
|
104 |
template <Ctrl::Logc Pos(int a, int size)>
|
|
105 |
inline void ReadPos(CParser& p, Ctrl::Logc& pos)
|
|
106 |
{
|
|
107 |
Point pt = ReadPoint(p);
|
|
108 |
pos = Pos(pt.x, pt.y);
|
|
109 |
}
|
|
110 |
|
104 |
111 |
void LayoutItem::ReadProperties(CParser& p, bool addunknown)
|
105 |
112 |
{
|
106 |
113 |
do {
|
107 |
|
if(p.Id("LeftPosZ") || p.Id("LeftPos")) {
|
108 |
|
Point pt = ReadPoint(p);
|
109 |
|
pos.x = Ctrl::PosLeft(pt.x, pt.y);
|
|
114 |
if(p.Id("LeftPosZ"))
|
|
115 |
ReadPos<Ctrl::PosLeft>(p, pos.x);
|
|
116 |
else
|
|
117 |
if(p.Id("LeftPos")) {
|
|
118 |
ReadPos<Ctrl::PosLeft>(p, pos.x);
|
|
119 |
zoom.NoZoomX();
|
110 |
120 |
}
|
111 |
121 |
else
|
112 |
|
if(p.Id("RightPosZ") || p.Id("RightPos")) {
|
113 |
|
Point pt = ReadPoint(p);
|
114 |
|
pos.x = Ctrl::PosRight(pt.x, pt.y);
|
|
122 |
if(p.Id("RightPosZ"))
|
|
123 |
ReadPos<Ctrl::PosRight>(p, pos.x);
|
|
124 |
else
|
|
125 |
if(p.Id("RightPos")) {
|
|
126 |
ReadPos<Ctrl::PosRight>(p, pos.x);
|
|
127 |
zoom.NoZoomX();
|
115 |
128 |
}
|
116 |
129 |
else
|
117 |
|
if(p.Id("HSizePosZ") || p.Id("HSizePos")) {
|
118 |
|
Point pt = ReadPoint(p);
|
119 |
|
pos.x = Ctrl::PosSize(pt.x, pt.y);
|
|
130 |
if(p.Id("HSizePosZ"))
|
|
131 |
ReadPos<Ctrl::PosSize>(p, pos.x);
|
|
132 |
else
|
|
133 |
if(p.Id("HSizePos")) {
|
|
134 |
ReadPos<Ctrl::PosSize>(p, pos.x);
|
|
135 |
zoom.NoZoomX();
|
120 |
136 |
}
|
121 |
137 |
else
|
122 |
|
if(p.Id("HCenterPosZ") || p.Id("HCenterPos")) {
|
123 |
|
Point pt = ReadPoint(p);
|
124 |
|
pos.x = Ctrl::PosCenter(pt.x, pt.y);
|
|
138 |
if(p.Id("HCenterPosZ"))
|
|
139 |
ReadPos<Ctrl::PosCenter>(p, pos.x);
|
|
140 |
else
|
|
141 |
if(p.Id("HCenterPos")) {
|
|
142 |
ReadPos<Ctrl::PosCenter>(p, pos.x);
|
|
143 |
zoom.NoZoomX();
|
125 |
144 |
}
|
126 |
145 |
else
|
127 |
|
if(p.Id("TopPosZ") || p.Id("TopPos")) {
|
128 |
|
Point pt = ReadPoint(p);
|
129 |
|
pos.y = Ctrl::PosLeft(pt.x, pt.y);
|
|
146 |
if(p.Id("TopPosZ"))
|
|
147 |
ReadPos<Ctrl::PosLeft>(p, pos.y);
|
|
148 |
else
|
|
149 |
if(p.Id("TopPos")) {
|
|
150 |
ReadPos<Ctrl::PosLeft>(p, pos.y);
|
|
151 |
zoom.NoZoomY();
|
130 |
152 |
}
|
131 |
153 |
else
|
132 |
|
if(p.Id("BottomPosZ") || p.Id("BottomPos")) {
|
133 |
|
Point pt = ReadPoint(p);
|
134 |
|
pos.y = Ctrl::PosRight(pt.x, pt.y);
|
|
154 |
if(p.Id("BottomPosZ"))
|
|
155 |
ReadPos<Ctrl::PosRight>(p, pos.y);
|
|
156 |
else
|
|
157 |
if(p.Id("BottomPos")) {
|
|
158 |
ReadPos<Ctrl::PosRight>(p, pos.y);
|
|
159 |
zoom.NoZoomY();
|
135 |
160 |
}
|
136 |
161 |
else
|
137 |
|
if(p.Id("VSizePosZ") || p.Id("VSizePos")) {
|
138 |
|
Point pt = ReadPoint(p);
|
139 |
|
pos.y = Ctrl::PosSize(pt.x, pt.y);
|
|
162 |
if(p.Id("VSizePosZ"))
|
|
163 |
ReadPos<Ctrl::PosSize>(p, pos.y);
|
|
164 |
else
|
|
165 |
if(p.Id("VSizePos")) {
|
|
166 |
ReadPos<Ctrl::PosSize>(p, pos.y);
|
|
167 |
zoom.NoZoomY();
|
140 |
168 |
}
|
141 |
169 |
else
|
142 |
|
if(p.Id("VCenterPosZ") || p.Id("VCenterPos")) {
|
143 |
|
Point pt = ReadPoint(p);
|
144 |
|
pos.y = Ctrl::PosCenter(pt.x, pt.y);
|
|
170 |
if(p.Id("VCenterPosZ"))
|
|
171 |
ReadPos<Ctrl::PosCenter>(p, pos.y);
|
|
172 |
else
|
|
173 |
if(p.Id("VCenterPos")) {
|
|
174 |
ReadPos<Ctrl::PosCenter>(p, pos.y);
|
|
175 |
zoom.NoZoomY();
|
145 |
176 |
}
|
146 |
177 |
else {
|
147 |
178 |
String name = p.ReadId();
|
... | ... | |
178 |
209 |
return -1;
|
179 |
210 |
}
|
180 |
211 |
|
|
212 |
inline const char *CharZoom(bool zoom)
|
|
213 |
{
|
|
214 |
return zoom ? "Z" : "";
|
|
215 |
}
|
|
216 |
|
181 |
217 |
String LayoutItem::SaveProperties(int y) const
|
182 |
218 |
{
|
183 |
219 |
String out;
|
... | ... | |
188 |
224 |
out << '.' << ip.name << '(' << ip.Save() << ')';
|
189 |
225 |
}
|
190 |
226 |
switch(pos.x.GetAlign()) {
|
191 |
|
case Ctrl::LEFT: out << Format(".LeftPosZ(%d, %d)", pos.x.GetA(), pos.x.GetB()); break;
|
192 |
|
case Ctrl::RIGHT: out << Format(".RightPosZ(%d, %d)", pos.x.GetA(), pos.x.GetB()); break;
|
193 |
|
case Ctrl::SIZE: out << Format(".HSizePosZ(%d, %d)", pos.x.GetA(), pos.x.GetB()); break;
|
194 |
|
case Ctrl::CENTER: out << Format(".HCenterPosZ(%d, %d)", pos.x.GetB(), pos.x.GetA()); break;
|
|
227 |
case Ctrl::LEFT: out << Format(".LeftPos%s(%d, %d)", CharZoom(zoom.x), pos.x.GetA(), pos.x.GetB()); break;
|
|
228 |
case Ctrl::RIGHT: out << Format(".RightPos%s(%d, %d)", CharZoom(zoom.x), pos.x.GetA(), pos.x.GetB()); break;
|
|
229 |
case Ctrl::SIZE: out << Format(".HSizePos%s(%d, %d)", CharZoom(zoom.x), pos.x.GetA(), pos.x.GetB()); break;
|
|
230 |
case Ctrl::CENTER: out << Format(".HCenterPos%s(%d, %d)", CharZoom(zoom.x), pos.x.GetB(), pos.x.GetA()); break;
|
195 |
231 |
}
|
196 |
232 |
switch(pos.y.GetAlign()) {
|
197 |
|
case Ctrl::TOP: out << Format(".TopPosZ(%d, %d)", pos.y.GetA() - y, pos.y.GetB()); break;
|
198 |
|
case Ctrl::BOTTOM: out << Format(".BottomPosZ(%d, %d)", pos.y.GetA(), pos.y.GetB()); break;
|
199 |
|
case Ctrl::SIZE: out << Format(".VSizePosZ(%d, %d)", pos.y.GetA(), pos.y.GetB()); break;
|
200 |
|
case Ctrl::CENTER: out << Format(".VCenterPosZ(%d, %d)", pos.y.GetB(), pos.y.GetA()); break;
|
|
233 |
case Ctrl::TOP: out << Format(".TopPos%s(%d, %d)", CharZoom(zoom.y), pos.y.GetA() - y, pos.y.GetB()); break;
|
|
234 |
case Ctrl::BOTTOM: out << Format(".BottomPos%s(%d, %d)", CharZoom(zoom.y), pos.y.GetA(), pos.y.GetB()); break;
|
|
235 |
case Ctrl::SIZE: out << Format(".VSizePos%s(%d, %d)", CharZoom(zoom.y), pos.y.GetA(), pos.y.GetB()); break;
|
|
236 |
case Ctrl::CENTER: out << Format(".VCenterPos%s(%d, %d)", CharZoom(zoom.y), pos.y.GetB(), pos.y.GetA()); break;
|
201 |
237 |
}
|
202 |
238 |
out.Remove(0);
|
203 |
239 |
return out;
|