From ecfafab3bc51647aceaa3ff031d89ee0da52ed4b Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 19 Jan 2015 13:47:54 +0300 Subject: [PATCH] source files navigation --- dlangide.visualdproj | 2 +- src/dlangide/ui/frame.d | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dlangide.visualdproj b/dlangide.visualdproj index 7e31b86..5933e03 100644 --- a/dlangide.visualdproj +++ b/dlangide.visualdproj @@ -66,7 +66,7 @@ 0 0 - Unicode USE_OPENGL + Unicode 0 3 0 diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index f36c084..59f4ef9 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -64,6 +64,15 @@ class IDEFrame : AppFrame { super.init(); } + /// move focus to editor in currently selected tab + void focusEditor(string id) { + Widget w = _tabs.tabBody(id); + if (w) { + if (w.visible) + w.setFocus(); + } + } + /// source file selected in workspace tree bool onSourceFileSelected(ProjectSourceFile file, bool activate) { Log.d("onSourceFileSelected ", file.filename); @@ -87,8 +96,9 @@ class IDEFrame : AppFrame { return false; } } - if (activate) - _tabs.setFocus(); + if (activate) { + focusEditor(file.filename); + } requestLayout(); return true; } @@ -101,6 +111,7 @@ class IDEFrame : AppFrame { if (file) { // tab is source file editor _wsPanel.selectItem(file); + focusEditor(file.filename); } } }