mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Layout designer and Icon designer now have 'search' field #772
git-svn-id: svn://ultimatepp.org/upp/trunk@7406 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
00d55e83b7
commit
e4286f57c9
15 changed files with 277 additions and 167 deletions
|
|
@ -68,6 +68,16 @@ int CharFilterAlpha(int c)
|
|||
return IsAlpha(c) ? c : 0;
|
||||
}
|
||||
|
||||
int CharFilterToUpper(int c)
|
||||
{
|
||||
return ToUpper(c);
|
||||
}
|
||||
|
||||
int CharFilterToLower(int c)
|
||||
{
|
||||
return ToLower(c);
|
||||
}
|
||||
|
||||
int CharFilterAlphaToUpper(int c)
|
||||
{
|
||||
return IsAlpha(c) ? IsUpper(c) ? c : ToUpper(c) : 0;
|
||||
|
|
|
|||
|
|
@ -833,6 +833,8 @@ int CharFilterDigit(int c);
|
|||
int CharFilterWhitespace(int c);
|
||||
int CharFilterNotWhitespace(int c);
|
||||
int CharFilterAlpha(int c);
|
||||
int CharFilterToUpper(int c);
|
||||
int CharFilterToLower(int c);
|
||||
int CharFilterAlphaToUpper(int c);
|
||||
int CharFilterAlphaToLower(int c);
|
||||
int CharFilterInt(int c);
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ struct DnDLoop : LocalLoop {
|
|||
|
||||
void Request(XSelectionRequestEvent *se);
|
||||
void Sync();
|
||||
Value GetData() const { return LocalLoop::GetData(); } // Silence CLANG warning
|
||||
String GetData(const String& f);
|
||||
void Leave();
|
||||
virtual void LeftUp(Point, dword);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "Draw/init"
|
||||
#include "plugin\bmp/init"
|
||||
#include "RichText/init"
|
||||
#define BLITZ_INDEX__ F656a4ea94e4f808b1ec63034b0e6c5ac
|
||||
#define BLITZ_INDEX__ Fe2ff541f9bb9f4ad3f5bcc23a34e1b73
|
||||
#include "CtrlCore.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -270,16 +270,29 @@ IconDes::IconDes()
|
|||
AddFrame(ViewFrame());
|
||||
|
||||
leftpane.Left(rgbactrl, 256);
|
||||
rgbactrl.SubCtrl(&list);
|
||||
rgbactrl.SubCtrl(&imgs);
|
||||
|
||||
rgbactrl <<= THISBACK(ColorChanged);
|
||||
|
||||
list.AddColumn("", 4);
|
||||
list.AddColumn("").SetDisplay(Single<CachedIconImage>());
|
||||
list.NoHeader().NoVertGrid();
|
||||
list.WhenBar = THISBACK(ListMenu);
|
||||
list.WhenCursor = THISBACK(ListCursor);
|
||||
list.WhenLeftDouble = THISBACK(EditImage);
|
||||
list.NoWantFocus();
|
||||
search.NullText("Search");
|
||||
search <<= THISBACK(Search);
|
||||
search.SetFilter(CharFilterToUpper);
|
||||
|
||||
int cy = EditString::GetStdHeight();
|
||||
imgs.Add(search.HSizePos().TopPos(0, cy));
|
||||
imgs.Add(ilist.HSizePos().VSizePos(cy, 0));
|
||||
|
||||
ilist.AddKey();
|
||||
ilist.AddColumn("", 4);
|
||||
ilist.AddColumn("").SetDisplay(Single<CachedIconImage>());
|
||||
ilist.NoHeader().NoVertGrid();
|
||||
ilist.WhenBar = THISBACK(ListMenu);
|
||||
ilist.WhenCursor = THISBACK(ListCursor);
|
||||
ilist.WhenLeftDouble = THISBACK(EditImage);
|
||||
ilist.NoWantFocus();
|
||||
|
||||
search <<= THISBACK(Search);
|
||||
search.SetFilter(CharFilterToUpper);
|
||||
|
||||
bottompane.Bottom(iconshow, 64);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ bool IsSelection(const Image& m) {
|
|||
IconDes::EditPos IconDes::GetEditPos()
|
||||
{
|
||||
EditPos e;
|
||||
e.cursor = list.GetCursor();
|
||||
e.sc = list.GetScroll();
|
||||
e.cursor = ilist.GetKey();
|
||||
e.sc = ilist.GetScroll();
|
||||
e.slot.Clear();
|
||||
e.slot.SetCount(slot.GetCount());
|
||||
for(int i = 0; i < slot.GetCount(); i++) {
|
||||
|
|
@ -51,9 +51,9 @@ void IconDes::SetEditPos(const EditPos& e)
|
|||
c.undo = es.undo;
|
||||
c.redo = es.redo;
|
||||
}
|
||||
if(e.cursor >= 0 && e.cursor < list.GetCount()) {
|
||||
list.SetCursor(e.cursor);
|
||||
list.ScrollTo(e.sc);
|
||||
if(e.cursor >= 0 && e.cursor < slot.GetCount()) {
|
||||
ilist.ScrollTo(e.sc);
|
||||
GoTo(e.cursor);
|
||||
}
|
||||
}
|
||||
SyncImage();
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ IconDes::Slot::Slot()
|
|||
|
||||
IconDes::Slot& IconDes::Current()
|
||||
{
|
||||
if(list.IsCursor())
|
||||
return slot[list.GetCursor()];
|
||||
if(ilist.IsCursor())
|
||||
return slot[ilist.GetKey()];
|
||||
NEVER();
|
||||
return dummy;
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ void IconDes::SyncShow()
|
|||
image = IconDesImg::LargeImage();
|
||||
}
|
||||
iconshow.image = image;
|
||||
list.Set(1, image);
|
||||
ilist.Set(2, image);
|
||||
}
|
||||
iconshow.Refresh();
|
||||
}
|
||||
|
|
@ -583,7 +583,7 @@ void IconDes::ResizeDown()
|
|||
void IconDes::SingleMode()
|
||||
{
|
||||
single_mode = true;
|
||||
list.Ctrl::Remove();
|
||||
ilist.Ctrl::Remove();
|
||||
rgbactrl.SubCtrl(&single);
|
||||
Size fsz = GetTextSize("Resize", StdFont());
|
||||
single.Add(info.HSizePos().TopPos(0, fsz.cy));
|
||||
|
|
|
|||
|
|
@ -169,7 +169,11 @@ private:
|
|||
|
||||
SplitterFrame leftpane;
|
||||
SplitterFrame bottompane;
|
||||
ArrayCtrl list;
|
||||
|
||||
ParentCtrl imgs;
|
||||
ArrayCtrl ilist;
|
||||
EditString search;
|
||||
|
||||
RGBACtrl rgbactrl;
|
||||
IconShow iconshow;
|
||||
Image cursor_image;
|
||||
|
|
@ -211,7 +215,7 @@ private:
|
|||
void PasteText();
|
||||
void CloseText();
|
||||
|
||||
bool IsCurrent() { return list.IsCursor(); }
|
||||
bool IsCurrent() { return !IsNull(ilist.GetKey()); }
|
||||
Slot& Current();
|
||||
|
||||
Image& CurrentImage();
|
||||
|
|
@ -310,6 +314,8 @@ private:
|
|||
void Colors();
|
||||
void Smoothen();
|
||||
|
||||
void Search();
|
||||
void GoTo(int q);
|
||||
void SyncList();
|
||||
void ListCursor();
|
||||
void PrepareImageDlg(WithImageLayout<TopWindow>& dlg);
|
||||
|
|
|
|||
|
|
@ -14,17 +14,32 @@ static String sFormatImageName(const String& name, const Image& img, bool exp)
|
|||
|
||||
void IconDes::SyncList()
|
||||
{
|
||||
int a = list.GetCursorSc();
|
||||
int ii = list.GetCursor();
|
||||
list.Clear();
|
||||
int sc = ilist.GetScroll();
|
||||
int q = ilist.GetKey();
|
||||
ilist.Clear();
|
||||
String s = ToUpper((String)~search);
|
||||
for(int i = 0; i < slot.GetCount(); i++) {
|
||||
Slot& c = slot[i];
|
||||
list.Add(sFormatImageName(c.name, c.image, c.exp), c.image);
|
||||
}
|
||||
if(ii >= 0) {
|
||||
list.SetCursor(ii);
|
||||
list.ScCursor(a);
|
||||
if(ToUpper(c.name).Find(s) >= 0)
|
||||
ilist.Add(i, sFormatImageName(c.name, c.image, c.exp), c.image);
|
||||
}
|
||||
ilist.ScrollTo(sc);
|
||||
ilist.FindSetCursor(q);
|
||||
}
|
||||
|
||||
void IconDes::Search()
|
||||
{
|
||||
SyncList();
|
||||
}
|
||||
|
||||
void IconDes::GoTo(int q)
|
||||
{
|
||||
ilist.FindSetCursor(q);
|
||||
if(ilist.IsCursor())
|
||||
return;
|
||||
search <<= Null;
|
||||
SyncList();
|
||||
ilist.FindSetCursor(q);
|
||||
}
|
||||
|
||||
static int sCharFilterCid(int c)
|
||||
|
|
@ -34,7 +49,7 @@ static int sCharFilterCid(int c)
|
|||
|
||||
void IconDes::PlaceDlg(TopWindow& dlg)
|
||||
{
|
||||
Rect r = list.GetScreenRect();
|
||||
Rect r = ilist.GetScreenRect();
|
||||
Size sz = dlg.GetSize();
|
||||
dlg.NoCenter().SetRect(max(0, r.left + (r.Width() - sz.cx) / 2), r.bottom + 32, sz.cx, sz.cy);
|
||||
}
|
||||
|
|
@ -76,25 +91,25 @@ bool CheckName(WithImageLayout<TopWindow>& dlg)
|
|||
void IconDes::InsertRemoved(int q)
|
||||
{
|
||||
if(q >= 0 && q < removed.GetCount()) {
|
||||
int ii = list.IsCursor() ? list.GetCursor() : 0;
|
||||
int ii = ilist.IsCursor() ? (int)ilist.GetKey() : 0;
|
||||
slot.Insert(ii) = removed[q];
|
||||
removed.Remove(q);
|
||||
SyncList();
|
||||
list.SetCursor(ii);
|
||||
GoTo(ii);
|
||||
}
|
||||
}
|
||||
|
||||
void IconDes::ImageInsert(const String& name, const Image& m, bool exp)
|
||||
{
|
||||
int ii = list.IsCursor() ? list.GetCursor() : 0;
|
||||
if(ii == list.GetCount() - 1)
|
||||
ii = list.GetCount();
|
||||
int ii = ilist.IsCursor() ? (int)ilist.GetKey() : 0;
|
||||
if(ii == slot.GetCount() - 1)
|
||||
ii = slot.GetCount();
|
||||
Slot& c = slot.Insert(ii);
|
||||
c.name = name;
|
||||
c.image = m;
|
||||
c.exp = exp;
|
||||
SyncList();
|
||||
list.SetCursor(ii);
|
||||
GoTo(ii);
|
||||
}
|
||||
|
||||
void IconDes::InsertImage()
|
||||
|
|
@ -211,7 +226,7 @@ void IconDes::InsertIml()
|
|||
if(LoadIml(SelectLoadFile("Iml files\t*.iml"), m, f))
|
||||
for(int i = 0; i < m.GetCount(); i++) {
|
||||
ImageInsert(m[i].name, m[i].image, m[i].exp);
|
||||
list.SetCursor(list.GetCursor() + 1);
|
||||
GoTo((int)ilist.GetKey() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -274,8 +289,11 @@ void IconDes::EditImage()
|
|||
if(!CheckName(dlg)) break;
|
||||
c.name = ~dlg.name;
|
||||
c.exp = ~dlg.exp;
|
||||
list.Set(0, sFormatImageName(c.name, c.image, c.exp));
|
||||
ilist.Set(1, sFormatImageName(c.name, c.image, c.exp));
|
||||
int q = ilist.GetKey();
|
||||
Reset();
|
||||
SyncList();
|
||||
GoTo(q);
|
||||
return;
|
||||
}
|
||||
c.image = CreateImage(Size(minmax((int)~dlg.cx, 1, 8192), minmax((int)~dlg.cy, 1, 8192)), Null);
|
||||
|
|
@ -288,7 +306,7 @@ void IconDes::RemoveImage()
|
|||
{
|
||||
if(!IsCurrent() || !PromptYesNo("Remove current image?"))
|
||||
return;
|
||||
int ii = list.GetCursor();
|
||||
int ii = ilist.GetKey();
|
||||
while(removed.GetCount() > 12)
|
||||
removed.Remove(0);
|
||||
Slot& r = removed.Add();
|
||||
|
|
@ -298,24 +316,25 @@ void IconDes::RemoveImage()
|
|||
else
|
||||
r.base_image = IconDesImg::LargeImage();
|
||||
slot.Remove(ii);
|
||||
list.KillCursor();
|
||||
ilist.KillCursor();
|
||||
SyncList();
|
||||
if(ii < slot.GetCount())
|
||||
list.SetCursor(ii);
|
||||
GoTo(ii);
|
||||
else
|
||||
list.GoEnd();
|
||||
ilist.GoEnd();
|
||||
}
|
||||
|
||||
void IconDes::MoveSlot(int d)
|
||||
{
|
||||
if(!IsCurrent())
|
||||
return;
|
||||
int c = list.GetCursor();
|
||||
int c = ilist.GetKey();
|
||||
d = c + d;
|
||||
if(d >= 0 && d < slot.GetCount()) {
|
||||
slot.Swap(c, d);
|
||||
search <<= Null;
|
||||
SyncList();
|
||||
list.SetCursor(d);
|
||||
GoTo(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -323,10 +342,10 @@ void IconDes::ChangeSlot(int d)
|
|||
{
|
||||
if(!IsCurrent())
|
||||
return;
|
||||
int c = list.GetCursor();
|
||||
int c = ilist.GetCursor();
|
||||
d = c + d;
|
||||
if(d >= 0 && d < slot.GetCount())
|
||||
list.SetCursor(d);
|
||||
if(d >= 0 && d < ilist.GetCount())
|
||||
ilist.SetCursor(d);
|
||||
}
|
||||
|
||||
void IconDes::ListMenu(Bar& bar)
|
||||
|
|
@ -344,9 +363,10 @@ void IconDes::ListMenu(Bar& bar)
|
|||
bar.Add(AK_INSERT_IML, IconDesImg::InsertIml(), THISBACK(InsertIml));
|
||||
bar.Add(AK_EXPORT_PNGS, IconDesImg::ExportPngs(), THISBACK(ExportPngs));
|
||||
bar.Separator();
|
||||
bar.Add(IsCurrent() && list.GetCursor() > 0, AK_MOVE_UP, IconDesImg::MoveUp(),
|
||||
int q = ilist.GetKey();
|
||||
bar.Add(IsCurrent() && q > 0, AK_MOVE_UP, IconDesImg::MoveUp(),
|
||||
THISBACK1(MoveSlot, -1));
|
||||
bar.Add(IsCurrent() && list.GetCursor() < slot.GetCount() - 1, AK_MOVE_DOWN, IconDesImg::MoveDown(),
|
||||
bar.Add(IsCurrent() && q < slot.GetCount() - 1, AK_MOVE_DOWN, IconDesImg::MoveDown(),
|
||||
THISBACK1(MoveSlot, 1));
|
||||
if(removed.GetCount()) {
|
||||
bar.Separator();
|
||||
|
|
@ -367,19 +387,20 @@ void IconDes::ListMenuEx(Bar& bar) {}
|
|||
|
||||
void IconDes::Clear()
|
||||
{
|
||||
list.Clear();
|
||||
ilist.Clear();
|
||||
slot.Clear();
|
||||
Reset();
|
||||
}
|
||||
|
||||
void IconDes::AddImage(const String& name, const Image& image, bool exp)
|
||||
{
|
||||
int q = slot.GetCount();
|
||||
Slot& c = slot.Add();
|
||||
c.name = name;
|
||||
c.image = image;
|
||||
c.exp = exp;
|
||||
list.Add(sFormatImageName(c.name, c.image, c.exp), c.image);
|
||||
list.GoBegin();
|
||||
ilist.Add(q, sFormatImageName(c.name, c.image, c.exp), c.image);
|
||||
ilist.GoBegin();
|
||||
}
|
||||
|
||||
int IconDes::GetCount() const
|
||||
|
|
@ -401,8 +422,8 @@ String IconDes::GetName(int ii) const
|
|||
|
||||
String IconDes::GetCurrentName() const
|
||||
{
|
||||
if(list.IsCursor())
|
||||
return slot[list.GetCursor()].name;
|
||||
if(ilist.IsCursor())
|
||||
return GetName(ilist.GetKey());
|
||||
return String();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,13 @@ LAYOUT(ParaLayout, 488, 352)
|
|||
UNTYPED(n[7], LeftPosZ(408, 54).TopPosZ(320, 19))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(SetStyleLayout, 216, 280)
|
||||
ITEM(ArrayCtrl, style, AutoHideSb(true).LeftPosZ(8, 200).TopPosZ(8, 232))
|
||||
ITEM(Button, newstyle, SetLabel(t_("New")).LeftPosZ(8, 64).TopPosZ(248, 24))
|
||||
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(76, 64).TopPosZ(248, 24))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(144, 64).TopPosZ(248, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(UnitLayout, 244, 140)
|
||||
ITEM(LabelBox, dv___0, SetLabel(t_("Units")).LeftPosZ(8, 228).TopPosZ(4, 40))
|
||||
ITEM(Switch, unit, SetLabel(t_("dot\npoint\ninch\nmm\ncm")).LeftPosZ(16, 216).TopPosZ(20, 16))
|
||||
|
|
@ -61,13 +68,6 @@ LAYOUT(UnitLayout, 244, 140)
|
|||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(172, 64).TopPosZ(108, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(SetStyleLayout, 216, 280)
|
||||
ITEM(ArrayCtrl, style, AutoHideSb(true).LeftPosZ(8, 200).TopPosZ(8, 232))
|
||||
ITEM(Button, newstyle, SetLabel(t_("New")).LeftPosZ(8, 64).TopPosZ(248, 24))
|
||||
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(76, 64).TopPosZ(248, 24))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(144, 64).TopPosZ(248, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(ObjectSizeLayout, 290, 102)
|
||||
ITEM(Label, dv___0, SetLabel(t_("Wi&dth:")).LeftPosZ(4, 54).TopPosZ(4, 19))
|
||||
ITEM(UnitEdit, width, LeftPosZ(58, 80).TopPosZ(4, 19))
|
||||
|
|
|
|||
|
|
@ -294,7 +294,11 @@ private:
|
|||
LayDesigner *frame;
|
||||
ToolBar toolbar;
|
||||
MenuBar menubar;
|
||||
ArrayCtrl layoutlist;
|
||||
|
||||
ParentCtrl layouts;
|
||||
ArrayCtrl list;
|
||||
EditString search;
|
||||
|
||||
ArrayCtrl item;
|
||||
PropertyPane property;
|
||||
|
||||
|
|
@ -352,6 +356,7 @@ private:
|
|||
void SyncItem(int item, int style);
|
||||
void SyncProperties(bool sync);
|
||||
void SyncLayoutList();
|
||||
void Search();
|
||||
void CreateCtrl(const String& type);
|
||||
void Group(Bar& bar, const String& group);
|
||||
void Templates(Bar& bar);
|
||||
|
|
@ -414,7 +419,8 @@ private:
|
|||
void SetSprings(dword s);
|
||||
void ShowSelection(bool s);
|
||||
|
||||
void AddLayout();
|
||||
void GoTo(int key);
|
||||
void AddLayout(bool insert);
|
||||
void DuplicateLayout();
|
||||
void RenameLayout();
|
||||
void RemoveLayout();
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ Point LayDes::ZPoint(Point p)
|
|||
void LayDes::SetSb()
|
||||
{
|
||||
Size sz = Size(0, 0);
|
||||
if(currentlayout >= 0) {
|
||||
if(!IsNull(currentlayout)) {
|
||||
LayoutData& l = CurrentLayout();
|
||||
sz = l.size;
|
||||
for(int i = 0; i < l.item.GetCount(); i++)
|
||||
|
|
@ -98,12 +98,12 @@ void LayDes::Scroll()
|
|||
void LayDes::Layout()
|
||||
{
|
||||
SetSb();
|
||||
layoutlist.ScrollIntoCursor();
|
||||
list.ScrollIntoCursor();
|
||||
}
|
||||
|
||||
void LayDes::GetSprings(Rect& l, Rect& t, Rect& r, Rect& b)
|
||||
{
|
||||
if(currentlayout < 0 || !cursor.GetCount()) {
|
||||
if(IsNull(currentlayout) || !cursor.GetCount()) {
|
||||
l = t = r = b = Null;
|
||||
return;
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ void LayDes::Paint(Draw& w)
|
|||
w.DrawRect(sz, SColorPaper);
|
||||
if(!IsNull(fileerror))
|
||||
w.DrawText(16, 16, "FILE ERROR: " + fileerror, Arial(14).Bold(), Red);
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
w.Offset(-sb.Get());
|
||||
LayoutData& l = CurrentLayout();
|
||||
|
|
@ -259,7 +259,7 @@ void LayDes::Paint(Draw& w)
|
|||
|
||||
void LayDes::SaveState()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
CurrentLayout().SaveState();
|
||||
SetBar();
|
||||
|
|
@ -268,7 +268,7 @@ void LayDes::SaveState()
|
|||
void LayDes::SetStatus(bool down)
|
||||
{
|
||||
String s;
|
||||
if(currentlayout >= 0) {
|
||||
if(!IsNull(currentlayout)) {
|
||||
Size sz = CurrentLayout().size;
|
||||
s << sz;
|
||||
if(cursor.GetCount()) {
|
||||
|
|
@ -294,7 +294,7 @@ int LayDes::FindHandle(Point p)
|
|||
|
||||
int LayDes::FindItem(Point p)
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return -1;
|
||||
LayoutData& l = CurrentLayout();
|
||||
int ii = -1;
|
||||
|
|
@ -415,7 +415,7 @@ struct TDisplayH : public Display {
|
|||
void LayDes::SyncItems()
|
||||
{
|
||||
LTIMING("SyncItems");
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
int i;
|
||||
for(i = 0; i < item.GetCount(); i++)
|
||||
|
|
@ -524,7 +524,7 @@ void LayDes::SelectOne(int ii, dword flags)
|
|||
|
||||
void LayDes::StoreItemRects()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
itemrect.SetCount(cursor.GetCount());
|
||||
|
|
@ -534,7 +534,7 @@ void LayDes::StoreItemRects()
|
|||
|
||||
void LayDes::LeftDown(Point p, dword keyflags)
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
SaveState();
|
||||
SetFocus();
|
||||
|
|
@ -601,7 +601,7 @@ void LayDes::LeftRepeat(Point p, dword keyflags)
|
|||
|
||||
void LayDes::MouseMove(Point p, dword keyflags)
|
||||
{
|
||||
if(!HasCapture() || currentlayout < 0)
|
||||
if(!HasCapture() || IsNull(currentlayout))
|
||||
return;
|
||||
Point pz = Normalize(p);
|
||||
p = ZPoint(pz);
|
||||
|
|
@ -717,7 +717,7 @@ void LayDes::LeftUp(Point p, dword keyflags)
|
|||
|
||||
void LayDes::CreateCtrl(const String& _type)
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
LOG("CreateCtrl");
|
||||
LayoutData& l = CurrentLayout();
|
||||
|
|
@ -742,17 +742,18 @@ void LayDes::CreateCtrl(const String& _type)
|
|||
cursor.Clear();
|
||||
cursor.Add(c);
|
||||
ReloadItems();
|
||||
if(IsNull(_type))
|
||||
type.SetFocus();
|
||||
else {
|
||||
int q = m.FindProperty("SetLabel");
|
||||
if(q >= 0)
|
||||
m.property[q].SetFocus();
|
||||
else
|
||||
variable.SetFocus();
|
||||
if(!search.HasFocus()) {
|
||||
if(IsNull(_type))
|
||||
type.SetFocus();
|
||||
else {
|
||||
int q = m.FindProperty("SetLabel");
|
||||
if(q >= 0)
|
||||
m.property[q].SetFocus();
|
||||
else
|
||||
variable.SetFocus();
|
||||
}
|
||||
}
|
||||
LOG("Create " << ::Name(GetFocusCtrl()));
|
||||
|
||||
}
|
||||
|
||||
void LayDes::Group(Bar& bar, const String& group)
|
||||
|
|
@ -854,7 +855,7 @@ void LayDes::Templates(Bar& bar)
|
|||
|
||||
void LayDes::RightDown(Point p, dword keyflags)
|
||||
{
|
||||
if(currentlayout < 0 || HasCapture()) return;
|
||||
if(IsNull(currentlayout) || HasCapture()) return;
|
||||
dragbase = Normalize(p);
|
||||
MenuBar menu;
|
||||
menu.MaxIconSize(Size(64, 64));
|
||||
|
|
@ -938,7 +939,7 @@ void LayDes::ReloadItems()
|
|||
|
||||
void LayDes::Undo()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
if(CurrentLayout().IsUndo()) {
|
||||
CurrentLayout().Undo();
|
||||
|
|
@ -949,7 +950,7 @@ void LayDes::Undo()
|
|||
|
||||
void LayDes::Redo()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
if(CurrentLayout().IsRedo()) {
|
||||
CurrentLayout().Redo();
|
||||
|
|
@ -960,7 +961,7 @@ void LayDes::Redo()
|
|||
|
||||
void LayDes::Cut()
|
||||
{
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
Copy();
|
||||
Delete();
|
||||
|
|
@ -996,14 +997,14 @@ LayoutData LayDes::LoadLayoutData(const String& s)
|
|||
|
||||
void LayDes::Copy()
|
||||
{
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
WriteClipboardUnicodeText(ToUnicode(SaveSelection(), charset));
|
||||
}
|
||||
|
||||
void LayDes::SelectAll()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
int q = cursor.GetCount() ? cursor.Top() : -1;
|
||||
|
|
@ -1018,7 +1019,7 @@ void LayDes::SelectAll()
|
|||
|
||||
void LayDes::Duplicate()
|
||||
{
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
SaveState();
|
||||
LayoutData& l = CurrentLayout();
|
||||
|
|
@ -1036,7 +1037,7 @@ void LayDes::Duplicate()
|
|||
|
||||
void LayDes::Matrix()
|
||||
{
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
SaveState();
|
||||
if(matrix.Execute() != IDOK)
|
||||
|
|
@ -1068,7 +1069,7 @@ void LayDes::Matrix()
|
|||
|
||||
void LayDes::Paste()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
SaveState();
|
||||
try {
|
||||
|
|
@ -1091,7 +1092,7 @@ void LayDes::Paste()
|
|||
|
||||
void LayDes::Align(int type)
|
||||
{
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
SaveState();
|
||||
LayoutData& l = CurrentLayout();
|
||||
|
|
@ -1171,7 +1172,7 @@ void LayDes::Align(int type)
|
|||
|
||||
void LayDes::SetSprings(dword s)
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
SaveState();
|
||||
|
|
@ -1198,7 +1199,7 @@ void LayDes::SetSprings(dword s)
|
|||
|
||||
void LayDes::ShowSelection(bool s)
|
||||
{
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
for(int i = 0; i < cursor.GetCount(); i++)
|
||||
|
|
@ -1210,7 +1211,7 @@ void LayDes::ShowSelection(bool s)
|
|||
void LayDes::MoveUp()
|
||||
{
|
||||
SaveState();
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
Vector<int> sc(cursor, 1);
|
||||
|
|
@ -1232,7 +1233,7 @@ void LayDes::MoveUp()
|
|||
void LayDes::MoveDown()
|
||||
{
|
||||
SaveState();
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
Vector<int> sc(cursor, 1);
|
||||
|
|
@ -1262,7 +1263,7 @@ bool RectLess(const Rect& a, const Rect& b)
|
|||
void LayDes::SortItems()
|
||||
{
|
||||
SaveState();
|
||||
if(currentlayout < 0 || cursor.GetCount() < 2)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() < 2)
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
|
||||
|
|
@ -1301,7 +1302,7 @@ void LayDes::SortItems()
|
|||
|
||||
void LayDes::Flush()
|
||||
{
|
||||
currentlayout = -1;
|
||||
currentlayout = Null;
|
||||
}
|
||||
|
||||
LayoutData& LayDes::CurrentLayout()
|
||||
|
|
@ -1313,39 +1314,62 @@ void LayDes::LayoutCursor()
|
|||
{
|
||||
Flush();
|
||||
draghandle = -1;
|
||||
currentlayout = layoutlist.GetCursor();
|
||||
currentlayout = list.GetKey();
|
||||
cursor.Clear();
|
||||
type.Disable();
|
||||
variable.Disable();
|
||||
property.Clear();
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
LoadItems();
|
||||
SyncItems();
|
||||
SetSb();
|
||||
SetFocus();
|
||||
if(!search.HasFocus())
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
void LayDes::PrevLayout()
|
||||
{
|
||||
layoutlist.Key(K_UP, 0);
|
||||
list.Key(K_UP, 0);
|
||||
}
|
||||
|
||||
void LayDes::NextLayout()
|
||||
{
|
||||
layoutlist.Key(K_DOWN, 0);
|
||||
list.Key(K_DOWN, 0);
|
||||
}
|
||||
|
||||
void LayDes::SyncLayoutList()
|
||||
{
|
||||
layoutlist.Clear();
|
||||
int i;
|
||||
for(i = 0; i < layout.GetCount(); i++)
|
||||
layoutlist.Add(layout[i].name);
|
||||
int sc = list.GetScroll();
|
||||
int c = list.GetKey();
|
||||
list.Clear();
|
||||
String s = ToUpper((String)~search);
|
||||
for(int i = 0; i < layout.GetCount(); i++)
|
||||
if(ToUpper(layout[i].name).Find(s) >= 0)
|
||||
list.Add(i, layout[i].name);
|
||||
list.ScrollTo(sc);
|
||||
if(!IsNull(c))
|
||||
list.FindSetCursor(c);
|
||||
LayoutCursor();
|
||||
}
|
||||
|
||||
void LayDes::AddLayout()
|
||||
void LayDes::Search()
|
||||
{
|
||||
SyncLayoutList();
|
||||
if(!list.IsCursor())
|
||||
list.GoBegin();
|
||||
}
|
||||
|
||||
void LayDes::GoTo(int key)
|
||||
{
|
||||
if(list.FindSetCursor(key))
|
||||
return;
|
||||
search <<= Null;
|
||||
SyncLayoutList();
|
||||
list.FindSetCursor(key);
|
||||
}
|
||||
|
||||
void LayDes::AddLayout(bool insert)
|
||||
{
|
||||
String name;
|
||||
for(;;) {
|
||||
|
|
@ -1356,16 +1380,18 @@ void LayDes::AddLayout()
|
|||
break;
|
||||
Exclamation("Invalid name!");
|
||||
}
|
||||
int q = layout.GetCount();
|
||||
layout.Add().name = name;
|
||||
int q = list.GetKey();
|
||||
if(!insert || IsNull(q) || !(q >= 0 && q < layout.GetCount()))
|
||||
q = layout.GetCount();
|
||||
layout.Insert(q).name = name;
|
||||
SyncLayoutList();
|
||||
layoutlist.SetCursor(q);
|
||||
GoTo(q);
|
||||
LayoutCursor();
|
||||
}
|
||||
|
||||
void LayDes::DuplicateLayout()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
LayoutData& c = CurrentLayout();
|
||||
String name = c.name;
|
||||
|
|
@ -1384,68 +1410,80 @@ void LayDes::DuplicateLayout()
|
|||
d.Read(p);
|
||||
d.name = name;
|
||||
SyncLayoutList();
|
||||
layoutlist.SetCursor(next);
|
||||
GoTo(next);
|
||||
LayoutCursor();
|
||||
}
|
||||
|
||||
void LayDes::RenameLayout()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
String name = layout[currentlayout].name;
|
||||
if(!EditText(name, "Rename layout", "Layout", CharFilterCid))
|
||||
return;
|
||||
int q = layoutlist.GetCursor();
|
||||
layout[currentlayout].name = name;;
|
||||
int q = list.GetKey();
|
||||
layout[currentlayout].name = name;
|
||||
SyncLayoutList();
|
||||
layoutlist.SetCursor(q);
|
||||
GoTo(q);
|
||||
LayoutCursor();
|
||||
}
|
||||
|
||||
void LayDes::RemoveLayout()
|
||||
{
|
||||
if(currentlayout < 0 || !PromptYesNo("Remove [* " + DeQtf(layout[currentlayout].name) + "] ?"))
|
||||
if(IsNull(currentlayout) || !PromptYesNo("Remove [* " + DeQtf(layout[currentlayout].name) + "] ?"))
|
||||
return;
|
||||
int q = layoutlist.GetCursor();
|
||||
int q = list.GetKey();
|
||||
layout.Remove(currentlayout);
|
||||
SyncLayoutList();
|
||||
if(q < layoutlist.GetCount())
|
||||
layoutlist.SetCursor(q);
|
||||
else
|
||||
if(layoutlist.GetCount())
|
||||
layoutlist.SetCursor(layoutlist.GetCount() - 1);
|
||||
if(!IsNull(q)) {
|
||||
GoTo(q + 1);
|
||||
if(!list.IsCursor())
|
||||
list.GoEnd();
|
||||
}
|
||||
LayoutCursor();
|
||||
}
|
||||
|
||||
void LayDes::MoveLayoutUp()
|
||||
{
|
||||
int q = layoutlist.GetCursor();
|
||||
if(layoutlist.GetCursor() > 0) {
|
||||
if(!IsNull(search)) {
|
||||
search <<= Null;
|
||||
SyncLayoutList();
|
||||
}
|
||||
int q = list.GetKey();
|
||||
if(q > 0) {
|
||||
layout.Swap(q, q - 1);
|
||||
layoutlist.SwapUp();
|
||||
SyncLayoutList();
|
||||
GoTo(q - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void LayDes::MoveLayoutDown()
|
||||
{
|
||||
int q = layoutlist.GetCursor();
|
||||
if(q >= 0 && q < layoutlist.GetCount() - 1) {
|
||||
if(!IsNull(search)) {
|
||||
search <<= Null;
|
||||
SyncLayoutList();
|
||||
}
|
||||
int q = list.GetKey();
|
||||
if(q >= 0 && q < layout.GetCount() - 1) {
|
||||
layout.Swap(q, q + 1);
|
||||
layoutlist.SwapDown();
|
||||
SyncLayoutList();
|
||||
GoTo(q + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void LayDes::LayoutMenu(Bar& bar)
|
||||
{
|
||||
bool iscursor = layoutlist.IsCursor();
|
||||
bar.Add("Add new layout..", THISBACK(AddLayout));
|
||||
bool iscursor = list.IsCursor();
|
||||
bar.Add("Add new layout..", THISBACK1(AddLayout, false));
|
||||
bar.Add("Insert new layout..", THISBACK1(AddLayout, true));
|
||||
bar.Add(iscursor, "Duplicate layout..", THISBACK(DuplicateLayout));
|
||||
bar.Add(iscursor, "Rename layout..", THISBACK(RenameLayout));
|
||||
bar.Add(iscursor, "Remove layout..", THISBACK(RemoveLayout));
|
||||
bar.Separator();
|
||||
bar.Add(iscursor && layoutlist.GetCursor() > 0,
|
||||
int q = list.GetKey();
|
||||
bar.Add(iscursor && q > 0,
|
||||
AK_MOVELAYOUTUP, LayImg::MoveUp(), THISBACK(MoveLayoutUp));
|
||||
bar.Add(iscursor && layoutlist.GetCursor() < layoutlist.GetCount() - 1,
|
||||
bar.Add(iscursor && q < layout.GetCount() - 1,
|
||||
AK_MOVELAYOUTDOWN, LayImg::MoveDown(), THISBACK(MoveLayoutDown));
|
||||
}
|
||||
|
||||
|
|
@ -1477,7 +1515,7 @@ void LayDes::FrameFocus()
|
|||
|
||||
void LayDes::ItemClick()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
SaveState();
|
||||
if(GetShift()) {
|
||||
|
|
@ -1510,7 +1548,7 @@ void LayDes::SyncUsc()
|
|||
for(int i = 0; i < LayoutTypes().GetCount(); i++)
|
||||
if(LayoutTypes()[i].kind != LAYOUT_SUBCTRL)
|
||||
type.AddList(LayoutTypes().GetKey(i));
|
||||
if(currentlayout >= 0) {
|
||||
if(!IsNull(currentlayout)) {
|
||||
LayoutData& d = CurrentLayout();
|
||||
for(int i = 0; i < d.item.GetCount(); i++)
|
||||
d.item[i].Invalidate();
|
||||
|
|
@ -1520,7 +1558,7 @@ void LayDes::SyncUsc()
|
|||
|
||||
void LayDes::TypeEdit()
|
||||
{
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
for(int i = 0; i < cursor.GetCount(); i++) {
|
||||
|
|
@ -1541,7 +1579,7 @@ void LayDes::TypeEdit()
|
|||
|
||||
void LayDes::VariableEdit()
|
||||
{
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return;
|
||||
LayoutData& l = CurrentLayout();
|
||||
LayoutItem& m = l.item[cursor.Top()];
|
||||
|
|
@ -1562,7 +1600,7 @@ bool LayDes::DoKey(dword key, int count)
|
|||
{
|
||||
SaveState();
|
||||
Point move(0, 0);
|
||||
if(currentlayout >= 0 && !cursor.IsEmpty()) {
|
||||
if(!IsNull(currentlayout) && !cursor.IsEmpty()) {
|
||||
switch(key & ~K_CTRL) {
|
||||
case K_SHIFT_LEFT: move.x = -1; break;
|
||||
case K_SHIFT_RIGHT: move.x = +1; break;
|
||||
|
|
@ -1618,7 +1656,7 @@ bool LayDes::DoKey(dword key, int count)
|
|||
return true;
|
||||
default:
|
||||
if(key >= ' ' && key < 65536) {
|
||||
if(currentlayout < 0 || cursor.GetCount() == 0)
|
||||
if(IsNull(currentlayout) || cursor.GetCount() == 0)
|
||||
return false;
|
||||
LayoutItem& m = CurrentItem();
|
||||
for(int i = 0; i < m.property.GetCount(); i++)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ void LayDes::SaveEditPos()
|
|||
p.undo[i] = pick(layout[i].undo);
|
||||
p.redo[i] = pick(layout[i].redo);
|
||||
}
|
||||
p.layouti = layoutlist.GetCursor();
|
||||
p.layouti = list.GetKey();
|
||||
p.cursor = pick(cursor);
|
||||
}
|
||||
|
||||
|
|
@ -73,8 +73,8 @@ void LayDes::RestoreEditPos()
|
|||
layout[i].redo = pick(p.redo[i]);
|
||||
}
|
||||
}
|
||||
if(p.layouti >= 0 && p.layouti < layoutlist.GetCount()) {
|
||||
layoutlist.SetCursor(p.layouti);
|
||||
if(p.layouti >= 0 && p.layouti < layout.GetCount()) {
|
||||
GoTo(p.layouti);
|
||||
LayoutCursor();
|
||||
}
|
||||
cursor = pick(p.cursor);
|
||||
|
|
@ -83,11 +83,15 @@ void LayDes::RestoreEditPos()
|
|||
|
||||
void LayDes::FindLayout(const String& name, const String& item_name)
|
||||
{
|
||||
if(layoutlist.FindSetCursor(name) && !IsNull(item_name)) {
|
||||
int q = item.Find(item_name, 1);
|
||||
if(q >= 0)
|
||||
SelectOne(q, 0);
|
||||
}
|
||||
for(int i = 0; i < layout.GetCount(); i++)
|
||||
if(layout[i].name == name) {
|
||||
GoTo(i);
|
||||
if(!IsNull(item_name)) {
|
||||
int q = item.Find(item_name, 1);
|
||||
if(q >= 0)
|
||||
SelectOne(q, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool LayDes::Load(const char *file, byte _charset)
|
||||
|
|
@ -126,9 +130,10 @@ bool LayDes::Load(const char *file, byte _charset)
|
|||
newfile = true;
|
||||
filetime = Null;
|
||||
}
|
||||
search <<= Null;
|
||||
SyncLayoutList();
|
||||
if(layout.GetCount()) {
|
||||
layoutlist.SetCursor(0);
|
||||
if(list.GetCount()) {
|
||||
list.SetCursor(0);
|
||||
LayoutCursor();
|
||||
}
|
||||
RestoreEditPos();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using namespace LayoutKeys;
|
|||
|
||||
void LayDes::EditBar(Bar& bar)
|
||||
{
|
||||
bool islayout = currentlayout >= 0;
|
||||
bool islayout = !IsNull(currentlayout);
|
||||
bool iscursor = islayout && cursor.GetCount();
|
||||
bar.Add(iscursor, "Cut", CtrlImg::cut(), THISBACK(Cut))
|
||||
.Key(K_SHIFT_DELETE)
|
||||
|
|
@ -45,7 +45,7 @@ void LayDes::EditBar(Bar& bar)
|
|||
|
||||
void LayDes::MoveBar(Bar& bar)
|
||||
{
|
||||
bool iscursor = currentlayout >= 0 && cursor.GetCount();
|
||||
bool iscursor = !IsNull(currentlayout) && cursor.GetCount();
|
||||
bar.Add(iscursor, AK_MOVEUP, LayImg::MoveUp(), THISBACK(MoveUp));
|
||||
bar.Add(iscursor, AK_MOVEDOWN, LayImg::MoveDown(), THISBACK(MoveDown));
|
||||
bar.Add(cursor.GetCount() >= 2, AK_SORTITEMS, LayImg::SortItems(), THISBACK(SortItems));
|
||||
|
|
@ -53,7 +53,7 @@ void LayDes::MoveBar(Bar& bar)
|
|||
|
||||
void LayDes::AlignBar(Bar& bar)
|
||||
{
|
||||
bool islayout = currentlayout >= 0;
|
||||
bool islayout = !IsNull(currentlayout);
|
||||
bool iscursor = islayout && cursor.GetCount();
|
||||
bool group = islayout && cursor.GetCount() > 1;
|
||||
bar.Add(iscursor, AK_HCENTERLAY, LayImg::HorzCenter(), THISBACK1(Align, A_HORZCENTER));
|
||||
|
|
@ -71,7 +71,7 @@ void LayDes::AlignBar(Bar& bar)
|
|||
|
||||
void LayDes::SizeBar(Bar& bar)
|
||||
{
|
||||
bool islayout = currentlayout >= 0;
|
||||
bool islayout = !IsNull(currentlayout);
|
||||
bool iscursor = islayout && cursor.GetCount();
|
||||
bool group = islayout && cursor.GetCount() > 1;
|
||||
bar.Add(group, AK_SAMEWIDTH, LayImg::SameWidth(), THISBACK1(Align, A_SAMEWIDTH));
|
||||
|
|
@ -84,11 +84,11 @@ void LayDes::SizeBar(Bar& bar)
|
|||
|
||||
void LayDes::SpringBar(Bar& bar)
|
||||
{
|
||||
bool islayout = currentlayout >= 0;
|
||||
bool islayout = !IsNull(currentlayout);
|
||||
bool iscursor = islayout && cursor.GetCount();
|
||||
int va = -1;
|
||||
int ha = -1;
|
||||
if(currentlayout >= 0 && cursor.GetCount()) {
|
||||
if(!IsNull(currentlayout) && cursor.GetCount()) {
|
||||
LayoutData& l = CurrentLayout();
|
||||
Ctrl::LogPos p = l.item[cursor.Top()].pos;
|
||||
ha = p.x.GetAlign();
|
||||
|
|
@ -248,7 +248,7 @@ int VariableFilter(int c)
|
|||
|
||||
bool LayDes::HotKey(dword key)
|
||||
{
|
||||
return MenuBar::Scan(layoutlist.WhenBar, key) ||
|
||||
return MenuBar::Scan(list.WhenBar, key) ||
|
||||
MenuBar::Scan(item.WhenBar, key) ||
|
||||
StaticRect::HotKey(key);
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ LayDes::LayDes()
|
|||
{
|
||||
charset = CHARSET_UTF8;
|
||||
|
||||
currentlayout = -1;
|
||||
currentlayout = Null;
|
||||
draghandle = -1;
|
||||
|
||||
usegrid = true;
|
||||
|
|
@ -272,7 +272,10 @@ LayDes::LayDes()
|
|||
km.d = this;
|
||||
km.Add(lsplit.SizePos());
|
||||
lsplit.Horz(rsplit, *this).SetPos(2000);
|
||||
rsplit.Vert(layoutlist, isplit);
|
||||
rsplit.Vert(layouts, isplit);
|
||||
int cy = EditString::GetStdHeight();
|
||||
layouts.Add(search.HSizePos().TopPos(0, cy));
|
||||
layouts.Add(list.HSizePos().VSizePos(cy, 0));
|
||||
rsplit.SetPos(1000);
|
||||
isplit.Vert(item, property);
|
||||
twsplit.Height(EditField::GetStdHeight() + 4);
|
||||
|
|
@ -300,12 +303,17 @@ LayDes::LayDes()
|
|||
|
||||
sb.WhenScroll = THISBACK(Scroll);
|
||||
|
||||
layoutlist.NoHeader().NoGrid();
|
||||
layoutlist.AddColumn();
|
||||
layoutlist.WhenCursor = THISBACK(LayoutCursor);
|
||||
layoutlist.WhenBar = THISBACK(LayoutMenu);
|
||||
layoutlist.WhenLeftDouble = THISBACK(RenameLayout);
|
||||
layoutlist.NoWantFocus();
|
||||
list.NoHeader().NoGrid();
|
||||
list.AddKey();
|
||||
list.AddColumn();
|
||||
list.WhenCursor = THISBACK(LayoutCursor);
|
||||
list.WhenBar = THISBACK(LayoutMenu);
|
||||
list.WhenLeftDouble = THISBACK(RenameLayout);
|
||||
list.NoWantFocus();
|
||||
|
||||
search.NullText("Search");
|
||||
search <<= THISBACK(Search);
|
||||
search.SetFilter(CharFilterToUpper);
|
||||
|
||||
NoWantFocus();
|
||||
item.NoWantFocus();
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ VisGenDlg::VisGenDlg(LayoutData& layout, const Vector<int>& cursor)
|
|||
|
||||
void LayDes::VisGen()
|
||||
{
|
||||
if(currentlayout < 0)
|
||||
if(IsNull(currentlayout))
|
||||
return;
|
||||
VisGenDlg dlg(CurrentLayout(), cursor);
|
||||
if(dlg.Run() == IDOK)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue