483_uppsrc.diff

The diff file to apply for uppsrc directory - Sender Ghost, 05/31/2013 09:52 AM

Download (7.17 KB)

View differences:

uppsrc/ide/LayDes/item.cpp 2013-05-31 11:47:40 +0400
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;
uppsrc/ide/LayDes/laydes.cpp 2013-05-31 10:59:19 +0400
1388 1388
	}
1389 1389
}
1390 1390

  
1391
void LayDes::ZoomLayout(bool zoom)
1392
{
1393
	if(currentlayout < 0)
1394
		return;
1395
	LayoutData& c = CurrentLayout();
1396
	for(int i = 0, n = c.item.GetCount(); i < n; ++i)
1397
		c.item[i].zoom.ZoomBoth(zoom);
1398
}
1399

  
1400
void LayDes::LayoutMakeBar(Bar& bar)
1401
{
1402
	bar.Add("Zoomable layout items (default)", THISBACK1(ZoomLayout, true));
1403
	bar.Add("Not zoomable layout items", THISBACK1(ZoomLayout, false));
1404
}
1405

  
1391 1406
void LayDes::LayoutMenu(Bar& bar)
1392 1407
{
1393 1408
	bool iscursor = layoutlist.IsCursor();
......
1395 1410
	bar.Add(iscursor, "Duplicate layout..", THISBACK(DuplicateLayout));
1396 1411
	bar.Add(iscursor, "Rename layout..", THISBACK(RenameLayout));
1397 1412
	bar.Add(iscursor, "Remove layout..", THISBACK(RemoveLayout));
1413
	bar.Add(iscursor, "Make", THISBACK(LayoutMakeBar));
1398 1414
	bar.Separator();
1399 1415
	bar.Add(iscursor && layoutlist.GetCursor() > 0,
1400 1416
	        AK_MOVELAYOUTUP, LayImg::MoveUp(), THISBACK(MoveLayoutUp));
uppsrc/ide/LayDes/LayDes.h 2013-05-31 11:46:34 +0400
164 164
	PropertyPane();
165 165
};
166 166

  
167
struct ZoomPos {
168
	bool x, y;
169

  
170
	ZoomPos(bool x, bool y) : x(x), y(y) {}
171
	ZoomPos() : x(true), y(true)         {}
172
	ZoomPos& ZoomX(bool zoom = true)     { x = zoom; return *this; }
173
	ZoomPos& ZoomY(bool zoom = true)     { y = zoom; return *this; }
174
	ZoomPos& ZoomBoth(bool zoom = true)  { x = y = zoom; return *this; }
175
	ZoomPos& NoZoomX()                   { return ZoomX(false); }
176
	ZoomPos& NoZoomY()                   { return ZoomY(false); }
177
	ZoomPos& NoZoomBoth()                { return ZoomBoth(false); }
178
};
179

  
167 180
struct LayoutItem {
168 181
	String              type;
169 182
	String              variable;
170 183
	Ctrl::LogPos        pos;
184
	ZoomPos             zoom;
171 185
	Array<ItemProperty> property;
172 186
	bool                hide;
173 187
	byte                charset;
......
414 428
	void        NextLayout();
415 429
	void        MoveLayoutUp();
416 430
	void        MoveLayoutDown();
431
	void        ZoomLayout(bool zoom);
432
	void        LayoutMakeBar(Bar& bar);
417 433
	void        LayoutMenu(Bar& bar);
418 434

  
419 435
	void        EditBar(Bar& bar);