484_uppsrc2.diff

The diff file to apply for uppsrc directory (second version) - Sender Ghost, 08/13/2013 11:34 PM

Download (1.99 KB)

View differences:

uppsrc/ide/LayDes/laydes.cpp 2013-08-14 01:19:07 +0400
1252 1252
	ReloadItems();
1253 1253
}
1254 1254

  
1255
bool RectLess(const Rect& a, const Rect& b)
1256
{
1257
	if(a.top < b.top)
1258
		return true;
1259
	if(a.top == b.top)
1260
		return a.left < b.left;
1261
	return false;
1262
}
1263

  
1264
void LayDes::SortItems()
1265
{
1266
	SaveState();
1267
	if(currentlayout < 0)
1268
		return;
1269
	LayoutData& l = CurrentLayout();
1270
	Vector<Rect> rect;
1271
	rect.SetCount(l.item.GetCount());
1272
	for(int i = 0, n = l.item.GetCount(); i < n; ++i)
1273
		rect[i] = CtrlRect(l.item[i].pos, l.size);
1274
	Vector<int> order = GetSortOrder(rect, &RectLess);
1275
	for(int i = 0, n = cursor.GetCount(); i < n; ++i) {
1276
		int index = FindIndex(order, cursor[i]);
1277
		if(index >= 0)
1278
			cursor[i] = index;
1279
	}
1280
	Array<LayoutItem> sitem;
1281
	sitem.SetCount(order.GetCount());
1282
	for(int i = 0, n = order.GetCount(); i < n; ++i)
1283
		sitem[i] = l.item[order[i]];
1284
	l.item = sitem;
1285
	ReloadItems();
1286
}
1287

  
1255 1288
void LayDes::Flush()
1256 1289
{
1257 1290
	currentlayout = -1;
uppsrc/ide/LayDes/LayDes.h 2013-08-14 01:22:04 +0400
384 384
	void        Duplicate();
385 385
	void        MoveUp();
386 386
	void        MoveDown();
387
	void        SortItems();
387 388
	void        SelectAll();
388 389

  
389 390
	void        Matrix();
uppsrc/ide/LayDes/laywin.cpp 2013-08-13 08:38:03 +0400
48 48
	bool iscursor = currentlayout >= 0 && cursor.GetCount();
49 49
	bar.Add(iscursor, AK_MOVEUP, LayImg::MoveUp(), THISBACK(MoveUp));
50 50
	bar.Add(iscursor, AK_MOVEDOWN, LayImg::MoveDown(), THISBACK(MoveDown));
51
	bar.Separator();
52
	bar.Add(item.GetCount(), "Sort by position", THISBACK(SortItems));
51 53
}
52 54

  
53 55
void LayDes::AlignBar(Bar& bar)