Index: uppsrc/ide/BaseDlg.cpp =================================================================== --- uppsrc/ide/BaseDlg.cpp (revision 11996) +++ uppsrc/ide/BaseDlg.cpp (working copy) @@ -41,9 +41,15 @@ CtrlLayoutOKCancel(*this, "Assembly setup"); browse_upp.SetImage(CtrlImg::right_arrow()); browse_upp <<= THISBACK(OnBrowseUpp); + browse_nests.SetImage(CtrlImg::Dir()); + browse_nests <<= THISBACK(OnBrowseNests); upp.AddFrame(browse_upp); + upp.AddFrame(browse_nests); upp <<= THISBACK(OnUpp); browse_out.Attach(output); + CtrlLayoutOKCancel(nests, "Package nests"); + nests.list.NoAskRemove(); + nests.list.SetTitle("Nest").RowName("nest"); } bool BaseSetupDlg::Run(String& vars) @@ -111,3 +117,24 @@ base <<= GetFileTitle(s); } } + +void BaseSetupDlg::OnBrowseNests() +{ + String s = ~upp; + Vector d = Split(s, ";"); + nests.list.Clear(); + + for(int i = 0, n = d.GetCount(); i < n; ++i) + nests.list.Add(d[i]); + + if(nests.Run() == IDOK) { + d.Clear(); + + for(int i = 0, n = nests.list.GetCount(); i < n; ++i) + d.Add(nests.list.Get(i, 0)); + + upp = Join(d, ";"); + } + + nests.Close(); +} Index: uppsrc/ide/MethodsCtrls.cpp =================================================================== --- uppsrc/ide/MethodsCtrls.cpp (revision 11996) +++ uppsrc/ide/MethodsCtrls.cpp (working copy) @@ -1,5 +1,7 @@ #include "ide.h" +namespace Upp { + void TextOption::SetData(const Value& data) { String s = data; @@ -21,3 +23,103 @@ { return AsString(Switch::GetData()); } + +EditDir::EditDir() +{ + btn.SetImage(CtrlImg::right_arrow()); + AddFrame(btn); + WhenBar = THISBACK(OnBar); +} + +void EditDir::OnBar(Bar& menu) +{ + StdBar(menu); + menu.Add(t_("Select directory"), CtrlImg::Dir(), btn.WhenAction) + .Help(t_("Select directory")) + .Key(K_CTRL_ENTER); +} + +ArrayCtrlDirs::ArrayCtrlDirs() +{ + AutoHideSb().Inserting().Removing().Moving(); + AddColumn("").Margin(0).With(THISBACK(OnEdit)); + WhenBar = THISBACK(OnBar); + EditDir e; e.SetFrame(NullFrame()); + SetLineCy(e.GetStdSize().cy); +} + +void ArrayCtrlDirs::DoRemoveRow() +{ + DoRemove(); + + if(GetCount() == 0) + SetFocus(); +} + +void ArrayCtrlDirs::DoRemoveRows() +{ + if(IsAskRemove() && !PromptOKCancel(RowFormat(t_("Do you really want to delete all %ss ?")))) + return; + + Clear(); + SetFocus(); +} + +void ArrayCtrlDirs::OnBar(Bar& menu) +{ + bool e = IsEditable(); + bool c = !IsEdit() && e; + bool d = c && IsCursor(); + + if(!menu.IsEmpty()) + menu.Separator(); + + if(IsInserting()) + menu.Add(e, RowFormat(t_("Insert %s")), CtrlImg::Add(), THISBACK(DoInsertAfter)) + .Help(RowFormat(t_("Insert a new %s into the table."))) + .Key(K_INSERT); + + if(IsRemoving()) { + menu.Add(d, RowFormat(t_("Delete %s")), CtrlImg::remove(), THISBACK(DoRemoveRow)) + .Help(RowFormat(t_("Delete active %s."))) + .Key(K_ALT_DELETE); + menu.Add(GetCount() > 0, RowFormat(t_("Delete all %ss")), CtrlImg::remove(), THISBACK(DoRemoveRows)) + .Help(t_("Delete all table rows.")) + .Key(K_CTRL_D); + } + + if(IsMoving()) { + menu.Add(GetCursor() > 0, RowFormat(t_("Move %s up")), CtrlImg::up_arrow(), THISBACK(SwapUp)) + .Help(RowFormat(t_("Swap %s with previous thus moving it up."))) + .Key(K_CTRL_UP); + menu.Add(GetCursor() >= 0 && GetCursor() < GetCount() - 1, + RowFormat(t_("Move %s down")), CtrlImg::down_arrow(), THISBACK(SwapDown)) + .Help(RowFormat(t_("Swap %s with next thus moving it down."))) + .Key(K_CTRL_DOWN); + } +} + +void ArrayCtrlDirs::OnEdit(One& ctrl) +{ + EditDir& e = ctrl.Create(); + e.SetFrame(NullFrame()); + e.btn.NoWantFocus(); + e.btn <<= THISBACK1(OnSelectDir, &e); + e.WhenBar << THISBACK(OnBar); +} + +void ArrayCtrlDirs::OnSelectDir(EditDir *e) +{ + if(!e) + return; + + e->SetFocus(); + + FileSel fs; + fs.ActiveDir(~*e); + + if(fs.ExecuteSelectDir()) + e->SetData(~fs); +} + +} Index: uppsrc/ide/MethodsCtrls.h =================================================================== --- uppsrc/ide/MethodsCtrls.h (revision 11996) +++ uppsrc/ide/MethodsCtrls.h (working copy) @@ -17,6 +17,30 @@ virtual Value GetData() const; }; +class EditDir : public EditString { +public: + typedef EditDir CLASSNAME; + EditDir(); + + FrameRight