ide: Optimized toolbar

git-svn-id: svn://ultimatepp.org/upp/trunk@7937 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-12-01 08:57:23 +00:00
parent 293c976f21
commit dfb80fe504
11 changed files with 52 additions and 25 deletions

View file

@ -407,7 +407,7 @@ void TopWindow::SerializePlacement(Stream& s, bool reminimize)
s.Pack(mn, mx, fs); // 12-05-23 Tom changed from: s.Pack(mn, mx);
else
s.Pack(mn, mx);
LLOG("TopWindow::SerializePlacement / " << (s.IsStoring() ? "write" : "read"));
LLOG(Name(this) << "::SerializePlacement / " << (s.IsStoring() ? "write" : "read"));
LLOG("minimized = " << mn << ", maximized = " << mx << ", fullscreen = " << fs); // 12-05-23 Tom extended with fullscreen
LLOG("rect = " << rect << ", overlapped = " << overlapped);
if(s.IsLoading()) {

View file

@ -119,4 +119,6 @@ void Ide::Json()
LoadFromGlobal(dlg, "JSONview");
dlg.OpenMain();
}
else
dlg.SetForeground();
}

View file

@ -158,7 +158,7 @@ void OutMode::Load()
void OutMode::Save()
{
ide.method = ~method;
ide.SetMethod(~method);
ide.targetmode = ~mode;
ide.export_dir = ~export_dir;
debug.Save(ide.debug);
@ -291,9 +291,15 @@ void Ide::DropMethodList()
methodlist.SetCursor(i);
}
void Ide::SetMethod(const String& m)
{
method = m;
current_builder = GetMethodVars(method).Get("BUILDER", "");
}
void Ide::SelectMethod()
{
method = methodlist.GetKey();
SetMethod(methodlist.GetKey());
int q = recent_buildmode.Find(~method);
if(q >= 0) {
StringStream ss(recent_buildmode[q]);
@ -318,12 +324,12 @@ void Ide::SelectMode()
void Ide::SetupDefaultMethod()
{
if(IsNull(method)) {
method = GetDefaultMethod();
SetMethod(GetDefaultMethod());
if(IsNull(method)) {
FindFile ff(ConfigFile("*.bm"));
if(!ff)
return;
method = GetFileTitle(ff.GetName());
SetMethod(GetFileTitle(ff.GetName()));
}
VectorMap<String, String> map = GetMethodVars(method);
debug.linkmode = atoi(map.Get("DEBUG_LINKMODE", "0"));

View file

@ -253,6 +253,7 @@ struct WorkspaceWork {
int actualfileindex;
Package actual;
bool editormode;
bool svn_dirs;
struct Sepfo : Moveable<Sepfo> {
String package;
@ -299,6 +300,8 @@ struct WorkspaceWork {
void RestoreBackup();
void SyncErrorPackages();
Vector<String> SvnDirs(bool actual = false);
void SerializeFileSetup(Stream& s) { s % filelist % package; }
Sepfo GetActiveSepfo();

View file

@ -296,6 +296,7 @@ void WorkspaceWork::PackageCursor()
InvalidatePackageCache();
filelist.WhenBar.Clear();
actualpackage = GetActivePackage();
svn_dirs = false;
if(actualpackage.IsEmpty()) return;
if(actualpackage == METAPACKAGE) {
actual.file.Clear();
@ -313,6 +314,19 @@ void WorkspaceWork::PackageCursor()
filelist.Enable();
if(actualpackage != METAPACKAGE)
filelist.WhenBar = THISBACK(FileMenu);
svn_dirs = SvnDirs(true).GetCount();
}
Vector<String> WorkspaceWork::SvnDirs(bool actual)
{
Vector<String> d = GetUppDirs();
if (actual && !IsAux())
d.Insert(0, GetFileFolder(PackagePath(actualpackage)));
Vector<String> r;
for(int i = 0; i < d.GetCount(); i++)
if(IsSvnDir(d[i]))
r.Add(d[i]);
return r;
}
void WorkspaceWork::FileCursor()
@ -1051,6 +1065,7 @@ WorkspaceWork::WorkspaceWork()
filelist.BackPaintHint();
showtime = false;
sort = true;
svn_dirs = false;
}
void WorkspaceWork::SerializeClosed(Stream& s)

View file

@ -142,4 +142,6 @@ void Ide::Xml()
LoadFromGlobal(dlg, "XMLview");
dlg.OpenMain();
}
else
dlg.SetForeground();
}

View file

@ -675,6 +675,8 @@ public:
String editfile;
FileTime edittime;
int editfile_line_endings;
bool editfile_svn;
bool editfile_isfolder;
String editfile2;
@ -855,6 +857,8 @@ public:
int issaving;
int isscanning;
String current_builder;
// ------------------------------------
@ -935,6 +939,7 @@ public:
void SyncBuildMode();
void SetupBuildMethods();
void DropMethodList();
void SetMethod(const String& m);
void SelectMethod();
void DropModeList();
void SelectMode();
@ -946,8 +951,6 @@ public:
void LoadAbbr();
void SaveAbbr();
Vector<String> SvnDirs(bool actual = false);
void File(Bar& menu);
void EditWorkspace();
void EditAnyFile();

View file

@ -398,7 +398,7 @@ void Ide::Project(Bar& menu) {
}
FilePropertiesMenu(menu);
if(!IsEditorMode()) {
if(SvnDirs(true).GetCount()) {
if(svn_dirs) {
if(menu.IsMenuBar())
menu.Add("SVN", THISBACK(ProjectSvn));
else
@ -413,12 +413,12 @@ void Ide::FilePropertiesMenu(Bar& menu)
.Help("File properties stored in package");
menu.Add(IsActiveFile() && !designer, AK_SAVEENCODING, THISBACK(ChangeCharset))
.Help("Convert actual file to different encoding");
menu.AddMenu(IsActiveFile() && !IsFolder(editfile) && !designer, AK_DIFF, IdeImg::Diff(), THISBACK(Diff))
menu.AddMenu(IsActiveFile() && !editfile_isfolder && !designer, AK_DIFF, IdeImg::Diff(), THISBACK(Diff))
.Help("Show differences between the project and arbitrary files");
menu.AddMenu(IsActiveFile() && !IsFolder(editfile) && !designer, AK_PATCH, IdeImg::Patch(), THISBACK(Patch))
menu.AddMenu(IsActiveFile() && !editfile_isfolder && !designer, AK_PATCH, IdeImg::Patch(), THISBACK(Patch))
.Help("Show differences with patch file applied");
if(IsSvnDir(GetFileFolder(editfile)))
menu.AddMenu(IsActiveFile() && !IsFolder(editfile) && !designer, AK_SVNDIFF, IdeImg::SvnDiff(), THISBACK(SvnHistory))
if(editfile_svn)
menu.AddMenu(IsActiveFile() && !editfile_isfolder && !designer, AK_SVNDIFF, IdeImg::SvnDiff(), THISBACK(SvnHistory))
.Help("Show svn history of file");
}
@ -431,7 +431,7 @@ void Ide::BuildFileMenu(Bar& menu)
menu.Add(b, "Preprocess " + GetFileName(editfile), IdeImg::Header(), THISBACK1(Preprocess, false))
.Key(AK_PREPROCESSFILE)
.Help("Preprocess current file into temporary file & open in editor");
if(GetMethodVars(method).Get("BUILDER", "") == "GCC")
if(findarg(current_builder, "GCC", "CLANG") >= 0)
menu.Add(b, "Show assembler code for " + GetFileName(editfile), THISBACK1(Preprocess, true))
.Key(AK_ASSEMBLERCODE)
.Help("Compile the file into assembler code");

View file

@ -395,6 +395,8 @@ void Ide::FlushFile() {
if(!editfile.IsEmpty())
Filedata(editfile).undodata = editor.PickUndoData();
editfile.Clear();
editfile_svn = editfile_isfolder = false;
svn_dirs = SvnDirs(true).GetCount(); // Perhaps not the best place, but should be ok
editor.Clear();
editor.Disable();
editorsplit.Ctrl::Remove();
@ -446,6 +448,9 @@ void Ide::EditFile0(const String& path, byte charset, bool astext, const String&
editfile = path;
editor.SetCharset(charset);
AddLru();
editfile_isfolder = IsFolder(editfile);
svn_dirs = SvnDirs(true).GetCount(); // Perhaps not the best place, but should be ok
if(!astext && !(debugger && (PathIsEqual(path, posfile[0]) || PathIsEqual(path, posfile[0])))
&& editastext.Find(path) < 0 && !IsNestReadOnly(editfile)) {
@ -545,6 +550,7 @@ void Ide::EditFile0(const String& path, byte charset, bool astext, const String&
editor.CheckEdited(true);
editor.Annotate(editfile);
editor.SyncNavigator();
editfile_svn = IsSvnDir(GetFileFolder(editfile));
}
void Ide::EditFileAssistSync()

View file

@ -360,18 +360,6 @@ void Ide::Times()
while(statdlg.Run() == IDRETRY);
}
Vector<String> Ide::SvnDirs(bool actual)
{
Vector<String> d = GetUppDirs();
if (actual && !IsAux())
d.Insert(0, GetFileFolder(PackagePath(actualpackage)));
Vector<String> r;
for(int i = 0; i < d.GetCount(); i++)
if(IsSvnDir(d[i]))
r.Add(d[i]);
return r;
}
INITBLOCK {
RegisterGlobalConfig("svn-msgs");
}

View file

@ -591,6 +591,8 @@ Ide::Ide()
warning_count = 0;
editor.WhenUpdate = THISBACK(TriggerAssistSync);
editfile_isfolder = editfile_svn = false;
}
Ide::~Ide()