From 9dc00ddbc9efdf885a73f54eaff3e6155c8d3217 Mon Sep 17 00:00:00 2001 From: klugier Date: Tue, 7 Nov 2017 23:51:01 +0000 Subject: [PATCH] Ide: Ide now synchronized navigator in editor mode on startup. #1806 git-svn-id: svn://ultimatepp.org/upp/trunk@11441 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Config.cpp | 8 ++++++-- uppsrc/ide/EditorTabBar.cpp | 18 ++++++++++-------- uppsrc/ide/idewin.cpp | 37 +++++++++++++++++++++++-------------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/uppsrc/ide/Config.cpp b/uppsrc/ide/Config.cpp index 69a18c279..d5f4814e5 100644 --- a/uppsrc/ide/Config.cpp +++ b/uppsrc/ide/Config.cpp @@ -137,8 +137,12 @@ void Ide::EditorMode() // in editor mode :(. This should be investigated with // appropriate test case. toolbar.Clear(); - SetMenuBar(); - SetToolBar(); + SetBar(); + + // NOTE: For some reasons navigator is not synchronized while opening + // editor file. This is the chepest place to do that synchronization. + // More information in ticket #1806. + editor.SyncNavigator(); } bool Ide::IsEditorMode() const diff --git a/uppsrc/ide/EditorTabBar.cpp b/uppsrc/ide/EditorTabBar.cpp index 2a3d1fcea..bea992630 100644 --- a/uppsrc/ide/EditorTabBar.cpp +++ b/uppsrc/ide/EditorTabBar.cpp @@ -116,10 +116,10 @@ void Ide::TabsLR(int jd) TabBar::JumpStack js; int tc = tabs.GetCount(); - int n = tabs.GetTabLR( jd ); - if ( n >= 0 && n < tc ) { + int n = tabs.GetTabLR(jd); + if(n >= 0 && n < tc) { js = tabs.jump_stack; - EditFile( tabs.GetFile( n ) ); + EditFile(tabs.GetFile(n)); tabs.jump_stack = js; } } @@ -128,13 +128,15 @@ void Ide::TabsStackLR(int jd) { int tc = tabs.GetCount(); - int n = tabs.GetTabStackLR( jd ); - if ( n >= 0 && n < tc ) - EditFile( tabs.GetFile( n ) ); + int n = tabs.GetTabStackLR(jd); + if(n >= 0 && n < tc) + EditFile(tabs.GetFile(n)); } void Ide::FileSelected() { - if(!IsNull(editfile)) - tabs.SetAddFile(editfile); + if(IsNull(editfile)) + return; + + tabs.SetAddFile(editfile); } diff --git a/uppsrc/ide/idewin.cpp b/uppsrc/ide/idewin.cpp index 3de37e00b..ab459c03c 100644 --- a/uppsrc/ide/idewin.cpp +++ b/uppsrc/ide/idewin.cpp @@ -727,6 +727,26 @@ bool IsAssembly(const String& s) return false; } +void PreperEditorMode(const Vector& args, Ide& ide, bool& clset) +{ + if(args.IsEmpty() || clset) { + return; + } + + Vector dir = Split(LoadFile(GetHomeDirFile("usc.path")), ';'); + for(int i = 0; i < dir.GetCount(); i++) + ide.UscProcessDirDeep(dir[i]); + for(int i = 0; i < args.GetCount(); i++) { + if(args[i] != "-f") { + ide.EditFile(NormalizePath(args[i])); + ide.FileSelected(); + } + } + + clset = true; + ide.EditorMode(); +} + #ifdef flagMAIN GUI_APP_MAIN #else @@ -1035,24 +1055,13 @@ void AppMain___() clset=true; } } + ide.LoadAbbr(); - ide.SyncCh(); DelTemps(); - if(arg.GetCount() && !clset) { - Vector 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])); - ide.FileSelected(); - } - clset = true; - ide.EditorMode(); - } + PreperEditorMode(arg, ide, clset); if(splash_screen && !ide.IsEditorMode()) { ShowSplash(); @@ -1069,7 +1078,7 @@ void AppMain___() ide.SetTimeCallback(max(0, next),callback1(&ide,&Ide::SetUpdateTimer,abs(p))); } #endif - + ide.editor_bottom.Zoom(0); ide.right_split.Zoom(0); if(FileExists(ConfigFile("developide"))) {