ide: .usc path for editor mode #789

git-svn-id: svn://ultimatepp.org/upp/trunk@7446 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-06-16 09:42:03 +00:00
parent 3315087296
commit 36bc66f95d
5 changed files with 37 additions and 3 deletions

View file

@ -303,6 +303,19 @@ void SetConsole(EditString *e, const char *text)
*e <<= text;
}
void AddPath(EditString *es)
{
String s = SelectDirectory();
if(IsNull(s))
return;
String h = ~*es;
if(h.GetCount() && *h.Last() != ';')
h << ';';
h << s;
*es <<= h;
es->SetWantFocus();
}
void Ide::SetupFormat() {
FormatDlg dlg;
dlg.Title("Format setup");
@ -463,8 +476,16 @@ void Ide::SetupFormat() {
ide.chstyle.Add(2, "Classic");
ide.chstyle.Add(3, "Host platform, blue bars");
ide.chstyle.Add(4, "Standard, blue bars");
FrameRight<Button> browse;
browse.SetImage(CtrlImg::right_arrow());
browse <<= callback1(AddPath, &ide.uscpath);
ide.uscpath.AddFrame(browse);
ide.uscpath <<= LoadFile(GetHomeDirFile("usc.path"));
for(;;) {
int c = dlg.Run();
Upp::SaveFile(GetHomeDirFile("usc.path"), ~ide.uscpath);
editorfont = ed.Get();
tfont = tf.Get();
veditorfont = vf.Get();
@ -477,8 +498,7 @@ void Ide::SetupFormat() {
hilite_scope = hs;
if(indent_spaces)
indent_amount = ~edt.indent_amount;
else
{
else {
indent_amount = editortabsize;
edt.indent_amount <<= editortabsize;
}

View file

@ -268,6 +268,14 @@ void Ide::UscProcessDir(const String& dir)
UscFile(AppendFileName(dir, ff.GetName()));
}
void Ide::UscProcessDirDeep(const String& dir)
{
UscProcessDir(dir);
for(FindFile ff(AppendFileName(dir, "*")); ff; ff.Next())
if(ff.IsFolder())
UscProcessDirDeep(ff.GetPath());
}
void Ide::SyncUsc()
{
CleanUsc();

View file

@ -789,6 +789,7 @@ public:
void UscFile(const String& file);
void UscProcessDir(const String& dir);
void UscProcessDirDeep(const String& dir);
void SyncUsc();
void RefreshBrowser();

View file

@ -525,6 +525,8 @@ LAYOUT(SetupIdeLayout, 512, 264)
ITEM(Option, output_per_assembly, SetLabel(t_("Use unique output directory per assembly (append assembly name to output directory)")).HSizePosZ(4, 4).TopPosZ(224, 16))
ITEM(Switch, gdbSelector, SetLabel(t_("Legacy\nGDB_MI2 (new)")).LeftPosZ(344, 176).TopPosZ(28, 20))
ITEM(Label, dv___20, SetLabel(t_("GDB Debugger interface")).LeftPosZ(212, 188).TopPosZ(28, 20))
ITEM(Label, dv___21, SetLabel(t_("In editor mode, path for .usc files")).LeftPosZ(4, 192).TopPosZ(244, 20))
ITEM(EditString, uscpath, LeftPosZ(172, 336).TopPosZ(244, 19))
END_LAYOUT
LAYOUT(SetupAstyleLayout, 544, 288)

View file

@ -908,8 +908,11 @@ void AppMain___()
ide.SyncCh();
DelTemps();
if(arg.GetCount() && !clset) {
Vector<String> dir = Split(LoadFile(GetHomeDirFile("usc.path")), ';');
for(int i = 0; i < dir.GetCount(); i++)
ide.UscProcessDirDeep(dir[i]);
for(int i = 0; i < arg.GetCount(); i++)
if(arg[i] != "-f") {
ide.EditFile(NormalizePath(arg[i]));