484_uppsrc3.diff
| uppsrc/ide/LayDes/laydes.cpp 2013-08-20 02:14:36 +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 |
int count = l.item.GetCount(); |
|
| 1271 |
Vector<Rect> rect; |
|
| 1272 |
rect.SetCount(count); |
|
| 1273 |
for(int i = 0; i < count; ++i) |
|
| 1274 |
rect[i] = CtrlRect(l.item[i].pos, l.size); |
|
| 1275 |
Vector<int> order; |
|
| 1276 |
order.SetCount(count); |
|
| 1277 |
for(int i = count; --i >= 0; order[i] = i); |
|
| 1278 |
IndexSort2(rect, order, l.item, &RectLess); |
|
| 1279 |
for(int i = 0, n = cursor.GetCount(); i < n; ++i) {
|
|
| 1280 |
int index = FindIndex(order, cursor[i]); |
|
| 1281 |
if(index >= 0) |
|
| 1282 |
cursor[i] = index; |
|
| 1283 |
} |
|
| 1284 |
ReloadItems(); |
|
| 1285 |
} |
|
| 1286 |
|
|
| 1255 | 1287 |
void LayDes::Flush() |
| 1256 | 1288 |
{
|
| 1257 | 1289 |
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-20 02:14:41 +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() >= 2, "Sort by position", THISBACK(SortItems)); |
|
| 51 | 53 |
} |
| 52 | 54 |
|
| 53 | 55 |
void LayDes::AlignBar(Bar& bar) |