From 17eaa970264b6381ab5554cade55bb0d389903bd Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 26 Jan 2015 13:37:13 +0300 Subject: [PATCH] show editor modified state with * prefix on tab --- src/dlangide/ui/frame.d | 11 +++++++++++ workspaces/sample1/sampleproject1/source/main.d | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index d1034dc..661855e 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -65,6 +65,16 @@ class IDEFrame : AppFrame { return openSourceFile(file.filename, file, activate); } + void onModifiedStateChange(Widget source, bool modified) { + // + Log.d("onModifiedStateChange ", source.id, " modified=", modified); + int index = _tabs.tabIndex(source.id); + if (index >= 0) { + dstring name = toUTF32((modified ? "* " : "") ~ baseName(source.id)); + _tabs.renameTab(index, name); + } + } + bool openSourceFile(string filename, ProjectSourceFile file = null, bool activate = true) { if (!file) file = _wsPanel.findSourceFileItem(filename); @@ -81,6 +91,7 @@ class IDEFrame : AppFrame { index = _tabs.tabIndex(filename); TabItem tab = _tabs.tab(filename); tab.objectParam = file; + editor.onModifiedStateChangeListener = &onModifiedStateChange; _tabs.selectTab(index, true); } else { destroy(editor); diff --git a/workspaces/sample1/sampleproject1/source/main.d b/workspaces/sample1/sampleproject1/source/main.d index e791fbe..f75b123 100644 --- a/workspaces/sample1/sampleproject1/source/main.d +++ b/workspaces/sample1/sampleproject1/source/main.d @@ -1,7 +1,7 @@ void main() { - +/// }