Index: uppsrc/ide/BaseDlg.cpp =================================================================== --- uppsrc/ide/BaseDlg.cpp (revision 15154) +++ uppsrc/ide/BaseDlg.cpp (working copy) @@ -72,65 +72,44 @@ } } -void NestEditorDlg::Set(const String& s) -{ - Vector l = Split(s, ';'); - nests.Clear(); - for(int i = 0; i < l.GetCount(); i++) - nests.Add(l[i]); -} +struct BoldDisplayClass : Display { + virtual void Paint(Draw& w, const Rect& r, const Value& q, + Color ink, Color paper, dword style) const { + w.DrawRect(r, paper); + DrawSmartText(w, r.left, r.top, r.Width(), (String)q, StdFont().Bold(), ink); + } +}; -String NestEditorDlg::Get() const +Display& BoldDisplay() { - String s; - for(int i = 0; i < nests.GetCount(); i++) - MergeWith(s, ";", ~nests.Get(i, 0)); - return s; + return Single(); } -NestEditorDlg::NestEditorDlg() +bool BaseSetup(String& vars) { return BaseSetupDlg().Run(vars); } + +BaseSetupDlg::BaseSetupDlg() +: browse_out("Output & intermediate files") { - static FileSel dir; + CtrlLayoutOKCancel(*this, "Assembly setup"); + Sizeable(); + browse_upp.SetImage(CtrlImg::right_arrow()).Tip("Select path"); + browse_upp <<= THISBACK(OnBrowseUpp); + upp.AddFrame(browse_upp); + nests.AutoHideSb().Moving() + .NoGrid().EvenRowColor().SetLineCy(nests.GetLineCy() + DPI(2)) + .NoHeader().AddColumn(); - CtrlLayoutOKCancel(*this, "Nests editor"); - Sizeable().Zoomable(); - - add.SetImage(IdeImg::add()) << [=] { - if(dir.ExecuteSelectDir("Insert nest directory")) { - int q = max(nests.GetCursor(), 0); - nests.Insert(q); - nests.Set(q, 0, ~dir); - nests.SetCursor(q); - Sync(); - } - }; - - nests.WhenLeftDouble = edit.SetImage(IdeImg::pencil()) ^= [=] { + nests.AddFrame(tb.ButtonKind(ToolButton::RIGHTLABEL)); + + nests.WhenLeftDouble = [this]() { if(nests.IsCursor()) { - String h = nests.Get(0); - if(EditText(h, "Nest directory", "Directory")) - nests.Set(0, h); + dir.ActiveDir(nests.Get(0)); + if(dir.ExecuteSelectDir("Insert nest directory")) { + nests.Set(0, ~dir); + } } }; - remove.SetImage(IdeImg::remove()) << [=] { - nests.DoRemove(); - Sync(); - }; - - up.SetImage(IdeImg::arrow_up()) << [=] { - nests.SwapUp(); - }; - - down.SetImage(IdeImg::arrow_down()) << [=] { - nests.SwapDown(); - }; - - nests.AutoHideSb().Moving() - .NoGrid().EvenRowColor().SetLineCy(nests.GetLineCy() + DPI(2)) - .NoHeader().AddColumn(); - nests.WhenSel = nests.WhenStartEdit = [=] { Sync(); }; - nests.WhenDrag = [=] { nests.DoDragAndDrop(InternalClip(nests, "nest-item"), nests.GetDragSample(), DND_MOVE); }; @@ -150,56 +129,47 @@ } } }; - + + auto SetToolbar = [this]() { + + tb.Set( + [this](Bar& b) { + b.Add("Add nest", IdeImg::add(), [this] { + if(dir.ExecuteSelectDir("Insert nest directory")) { + nests.Add(~dir); + nests.SetCursor(nests.GetCount() - 1); + } + }); + + b.Add(nests.IsCursor(), "Edit nest", IdeImg::pencil(), [this] { + if(nests.IsCursor()) { + String h = nests.Get(0); + if(EditText(h, "Nest directory", "Directory")) + nests.Set(0, h); + } + }); + + b.Add(nests.IsCursor(), "Remove nest", IdeImg::remove(), [this] { + nests.DoRemove(); + }); + + b.Add(nests.IsCursor() && nests.GetCursor() > 0, "Move up", IdeImg::arrow_up(), [this] { + nests.SwapUp(); + + }); + + b.Add(nests.IsCursor() && nests.GetCursor() < nests.GetCount() - 1, "Move down", IdeImg::arrow_down(), [this] { + nests.SwapDown(); + }); + } + ); + }; + AddAssemblyPaths(dir); + + SetToolbar(); + nests.WhenSel = [&] { SetToolbar();}; - Sync(); -} - -struct BoldDisplayClass : Display { - virtual void Paint(Draw& w, const Rect& r, const Value& q, - Color ink, Color paper, dword style) const { - w.DrawRect(r, paper); - DrawSmartText(w, r.left, r.top, r.Width(), (String)q, StdFont().Bold(), ink); - } -}; - -Display& BoldDisplay() -{ - return Single(); -} - -void NestEditorDlg::Sync() -{ - bool b = nests.GetCount(); - edit.Enable(b); - remove.Enable(b); - up.Enable(b); - down.Enable(b); - for(int i = 0; i < nests.GetCount(); i++) - nests.SetDisplay(i, 0, i == 0 ? BoldDisplay() : StdDisplay()); -} - -bool BaseSetup(String& vars) { return BaseSetupDlg().Run(vars); } - -BaseSetupDlg::BaseSetupDlg() -: browse_out("Output & intermediate files") -{ - CtrlLayoutOKCancel(*this, "Assembly setup"); - browse_upp.SetImage(CtrlImg::right_arrow()).Tip("Select path"); - browse_upp <<= THISBACK(OnBrowseUpp); - upp.AddFrame(browse_upp); - - setup_nest.Tip("Open nest editor"); - setup_nest << [=] { - NestEditorDlg ndlg; - ndlg.Set(~upp); - if(!ndlg.ExecuteOK()) - return; - upp <<= ndlg.Get(); - OnUpp(); - }; - upp <<= THISBACK(OnUpp); browse_out.Attach(output); } @@ -206,10 +176,15 @@ bool BaseSetupDlg::Run(String& vars) { - upp <<= GetVar("UPP"); + Vector paths = SplitDirs(GetVar("UPP")); + + upp = paths.GetCount() ? paths[0]: ""; output <<= GetVar("OUTPUT"); base <<= vars; new_base = IsNull(vars); + + for(int i = 1; i < paths.GetCount(); i++) + nests.Add(paths[i]); while(TopWindow::Run() == IDOK) { @@ -225,7 +200,12 @@ continue; } } - SetVar("UPP", ~upp); + + String supp = ~upp; + for(int i = 0; i < nests.GetCount(); i++) + supp << ";" << nests.Get(i, 0); + + SetVar("UPP", supp); SetVar("OUTPUT", ~output); Vector paths = SplitDirs(upp.GetText().ToString()); for(int i = 0; i < paths.GetCount(); i++) @@ -239,26 +219,14 @@ void BaseSetupDlg::OnBrowseUpp() { - String s = ~upp; - int b, e; - if(upp.HasFocus()) - upp.GetSelection(b, e); - else - e = s.GetLength(); - b = e; - while(b > 0 && s[b - 1] != ';') - b--; - while(e < s.GetLength() && s[e] != ';') - e++; SelectDirButton dirsel; - String pre = s.Left(b), post = s.Mid(e); - dirsel.ActiveDir(s.Mid(b, e - b)); + dirsel.ActiveDir(~upp); AddAssemblyPaths((FileSel&) dirsel); if(dirsel.ExecuteSelectDir()) { String newdir = ~dirsel; - upp <<= pre + newdir + Nvl(post, ";"); + upp <<= newdir; upp.SetWantFocus(); OnUpp(); } @@ -267,9 +235,6 @@ void BaseSetupDlg::OnUpp() { if(new_base) { - String s = ~upp; - int f = s.Find(';'); - if(f >= 0) s.Trim(f); - base <<= GetFileTitle(s); + base <<= GetFileTitle((String)~upp); } } Index: uppsrc/ide/UppDlg.h =================================================================== --- uppsrc/ide/UppDlg.h (revision 15154) +++ uppsrc/ide/UppDlg.h (working copy) @@ -124,6 +124,8 @@ private: FrameRight