mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Purge assemblies; CtrlLib: Option value fix
This commit is contained in:
parent
88def97efa
commit
d0e4dff4d3
4 changed files with 56 additions and 1 deletions
|
|
@ -692,7 +692,7 @@ void Option::PerformAction() {
|
|||
Option& Option::Set(int b)
|
||||
{
|
||||
if(b != option) {
|
||||
option = b;
|
||||
option = IsNull(b) ? Null : (bool)b;
|
||||
Update();
|
||||
RefreshPush();
|
||||
AutoSync();
|
||||
|
|
|
|||
|
|
@ -477,6 +477,7 @@ void SelectPackageDlg::ToolBase(Bar& bar)
|
|||
.Key(K_CTRL_ENTER);
|
||||
bar.Add(base.IsCursor(), "Remove assembly..", THISBACK(OnBaseRemove))
|
||||
.Key(K_CTRL_DELETE);
|
||||
bar.Add("Purge assemblies..", [=] { RemoveInvalid(); });
|
||||
Vector<String> d = GetSvnDirs();
|
||||
if(HasGit()) {
|
||||
bar.Separator();
|
||||
|
|
@ -534,6 +535,53 @@ void SelectPackageDlg::OnBaseRemove()
|
|||
}
|
||||
}
|
||||
|
||||
void SelectPackageDlg::RemoveInvalid()
|
||||
{
|
||||
String vars = base.GetKey();
|
||||
WithRemoveInvalidAssembliesLayout<TopWindow> dlg;
|
||||
CtrlLayoutOKCancel(dlg, "Remove assemblies");
|
||||
dlg.list.AddColumn("Remove")
|
||||
.Ctrls([=](int, One<Ctrl> &c) { c.Create<Option>().NoWantFocus(); });
|
||||
dlg.list.AddColumn("Assembly");
|
||||
dlg.list.AddColumn("Error", 7);
|
||||
dlg.list.ColumnWidths("53 125 499");
|
||||
Vector<String> oks;
|
||||
for(int i = 0; i < base.GetCount(); i++) {
|
||||
String vars = base.Get(i, 0);
|
||||
VectorMap<String, String> var;
|
||||
LoadVarFile(VarFilePath(vars), var);
|
||||
Vector<String> dirs = Split(var.Get("UPP", ""), ';');
|
||||
String missing;
|
||||
for(String d : dirs)
|
||||
if(!DirectoryExists(d)) {
|
||||
MergeWith(missing, ", ", d);
|
||||
break;
|
||||
}
|
||||
if(dirs.GetCount() == 0)
|
||||
missing = "Empty";
|
||||
if(missing.GetCount())
|
||||
dlg.list.Add(true, vars, missing);
|
||||
else
|
||||
oks.Add(vars);
|
||||
}
|
||||
for(String s : oks)
|
||||
dlg.list.Add(false, s);
|
||||
again:
|
||||
if(dlg.Run() != IDOK)
|
||||
return;
|
||||
int n = 0;
|
||||
for(int i = 0; i < dlg.list.GetCount(); i++)
|
||||
if((bool)dlg.list.Get(i, 0))
|
||||
n++;
|
||||
if(n)
|
||||
if(!PromptYesNo("Remove " + AsString(n) + " assemblies?"))
|
||||
goto again;
|
||||
for(int i = 0; i < dlg.list.GetCount(); i++)
|
||||
if((bool)dlg.list.Get(i, 0))
|
||||
DeleteFile(VarFilePath(~dlg.list.Get(i, 1)));
|
||||
SyncBase(vars);
|
||||
}
|
||||
|
||||
int DirSep(int c)
|
||||
{
|
||||
return c == '\\' || c == '/' ? c : 0;
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ struct SelectPackageDlg : public WithSelectPackageLayout<TopWindow> {
|
|||
void OnBaseAdd();
|
||||
void OnBaseEdit();
|
||||
void OnBaseRemove();
|
||||
void RemoveInvalid();
|
||||
|
||||
void OnOK();
|
||||
void OnCancel();
|
||||
|
|
|
|||
|
|
@ -931,3 +931,9 @@ LAYOUT(InsertImageLayout, 1016, 480)
|
|||
ITEM(Upp::Label, warning_lbl, SetLabel(t_("Indexer is running - the list can be incomplete")).SetFont(Upp::StdFont().Bold().Italic()).SetInk(Upp::SRed).LeftPosZ(600, 268).TopPosZ(448, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(RemoveInvalidAssembliesLayout, 704, 708)
|
||||
ITEM(Upp::ArrayCtrl, list, LeftPosZ(4, 696).TopPosZ(4, 664))
|
||||
ITEM(Upp::Button, ok, SetLabel(t_("OK")).RightPosZ(72, 64).BottomPosZ(8, 24))
|
||||
ITEM(Upp::Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 64).BottomPosZ(8, 24))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue