From a7bf256d15baa8bbd800cda41dd0c2721e82b0e2 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 28 Aug 2017 13:23:51 +0300 Subject: [PATCH 01/31] fix theme update --- dub.json | 2 +- src/dlangide/ui/frame.d | 4 +++- src/dlangide/ui/settings.d | 8 ++++---- views/VERSION | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dub.json b/dub.json index 026d787..046cbf6 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.99", + "dlangui": "==0.9.101", "dcd": "~>0.9.1" }, diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 3d0a640..6c2ac1c 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -1370,8 +1370,10 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL currentTheme.fontSize = settings.uiFontSize; needUpdateTheme = true; } - if (needUpdateTheme) + if (needUpdateTheme) { + Log.d("updating theme after UI font change"); Platform.instance.onThemeChanged(); + } requestLayout(); } diff --git a/src/dlangide/ui/settings.d b/src/dlangide/ui/settings.d index ee7aa42..6abacc5 100644 --- a/src/dlangide/ui/settings.d +++ b/src/dlangide/ui/settings.d @@ -65,10 +65,6 @@ SettingsPage createSettingsPages() { // Root page SettingsPage res = new SettingsPage("", UIString.fromRaw(""d)); - // Common page - SettingsPage common = res.addChild("common", UIString.fromId("OPTION_COMMON"c)); - common.addCheckbox("common/autoOpenLastProject", UIString.fromId("OPTION_AUTO_OPEN_LAST_PROJECT"c)); - // UI settings page SettingsPage ui = res.addChild("interface", UIString.fromId("OPTION_INTERFACE"c)); ui.addStringComboBox("interface/theme", UIString.fromId("OPTION_THEME"c), [ @@ -134,6 +130,10 @@ SettingsPage createSettingsPages() { texted.addCheckbox("editors/textEditor/showWhiteSpaceMarks", UIString.fromId("OPTION_SHOW_SPACES"c)); texted.addCheckbox("editors/textEditor/showTabPositionMarks", UIString.fromId("OPTION_SHOW_TABS"c)); + // Common page + SettingsPage common = res.addChild("common", UIString.fromId("OPTION_COMMON"c)); + common.addCheckbox("common/autoOpenLastProject", UIString.fromId("OPTION_AUTO_OPEN_LAST_PROJECT"c)); + SettingsPage dlang = res.addChild("dlang", UIString.fromRaw("D"d)); SettingsPage dub = dlang.addChild("dlang/dub", UIString.fromRaw("DUB"d)); diff --git a/views/VERSION b/views/VERSION index 7114f72..fff8e6b 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.52 \ No newline at end of file +v0.7.53 \ No newline at end of file From 1fa7a06d9ec5fcc1711eae8e167fec1b768aa67a Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 28 Aug 2017 16:42:28 +0300 Subject: [PATCH 02/31] update readme with existing project import instructions --- README.md | 8 ++++++++ views/VERSION | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3fb4e4b..7a6c7bd 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,14 @@ Keywan Ghadami improved it to use DCD as a library. Now DCD is embedded into DlangIDE, and no separate executables are needed. +Importing of existing project +============================= + +DlangIDE supports only DUB project format. + +To import existing DUB project, use menu item "File" / "Open project or workspace" and select dub.json or dub.sdl of your project to import. + + Debugger support ================ diff --git a/views/VERSION b/views/VERSION index fff8e6b..35d3fa0 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.53 \ No newline at end of file +v0.7.54 \ No newline at end of file From 4dc88393de7d1f6de34e228b99d01a6f2f00f5d5 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 10:39:43 +0300 Subject: [PATCH 03/31] fix #238 --- src/dlangide/ui/frame.d | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 6c2ac1c..2a88f96 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -1416,6 +1416,11 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL const auto msg = UIString.fromId("MSG_TRY_OPEN_PROJECT"c).value; _logPanel.logLine(msg ~ toUTF32(" " ~ filename)); Project project = new Project(currentWorkspace, filename); + if (!project.load()) { + window.showMessageBox(UIString.fromId("MSG_OPEN_PROJECT"c), UIString.fromId("ERROR_INVALID_WS_OR_PROJECT_FILE"c)); + _logPanel.logLine("File is not recognized as DlangIDE project or workspace file"); + return; + } string defWsFile = project.defWorkspaceFile; if (currentWorkspace) { Project existing = currentWorkspace.findProject(project.filename); From e52d812401fd6d33c8dbf1a5c8085bc4629de72f Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 10:47:11 +0300 Subject: [PATCH 04/31] add Menu / Show Home Screen command --- src/dlangide/ui/commands.d | 2 ++ src/dlangide/ui/frame.d | 7 +++++-- views/res/i18n/en.ini | 1 + views/res/i18n/ru.ini | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index 0d438d6..b0c3344 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -48,6 +48,7 @@ enum IDEActions : int { HelpViewHelp, WindowCloseDocument, WindowCloseAllDocuments, + WindowShowHomeScreen, CreateNewWorkspace, AddToCurrentWorkspace, //ProjectFolderAddItem, @@ -131,6 +132,7 @@ const Action ACTION_HELP_ABOUT = new Action(IDEActions.HelpAbout, "MENU_HELP_ABO const Action ACTION_HELP_VIEW_HELP = new Action(IDEActions.HelpViewHelp, "MENU_HELP_VIEW_HELP"c); const Action ACTION_WINDOW_CLOSE_DOCUMENT = new Action(IDEActions.WindowCloseDocument, "MENU_WINDOW_CLOSE_DOCUMENT"c, null, KeyCode.KEY_W, KeyFlag.Control); const Action ACTION_WINDOW_CLOSE_ALL_DOCUMENTS = new Action(IDEActions.WindowCloseAllDocuments, "MENU_WINDOW_CLOSE_ALL_DOCUMENTS"c); +const Action ACTION_WINDOW_SHOW_HOME_SCREEN = new Action(IDEActions.WindowShowHomeScreen, "MENU_WINDOW_SHOW_HOME_SCREEN"c); const Action ACTION_CREATE_NEW_WORKSPACE = new Action(IDEActions.CreateNewWorkspace, "OPTION_CREATE_NEW_WORKSPACE"c); const Action ACTION_ADD_TO_CURRENT_WORKSPACE = new Action(IDEActions.AddToCurrentWorkspace, "OPTION_ADD_TO_CURRENT_WORKSPACE"c); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 2a88f96..afb6be1 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -731,8 +731,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL MenuItem windowItem = new MenuItem(new Action(3, "MENU_WINDOW"c)); //windowItem.add(new Action(30, "MENU_WINDOW_PREFERENCES")); - windowItem.add(ACTION_WINDOW_CLOSE_DOCUMENT); - windowItem.add(ACTION_WINDOW_CLOSE_ALL_DOCUMENTS); + windowItem.add(ACTION_WINDOW_CLOSE_DOCUMENT, ACTION_WINDOW_CLOSE_ALL_DOCUMENTS, ACTION_WINDOW_SHOW_HOME_SCREEN); MenuItem helpItem = new MenuItem(new Action(4, "MENU_HELP"c)); helpItem.add(ACTION_HELP_VIEW_HELP); helpItem.add(ACTION_HELP_ABOUT); @@ -831,6 +830,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL case IDEActions.FileOpen: case IDEActions.WindowCloseDocument: case IDEActions.WindowCloseAllDocuments: + case IDEActions.WindowShowHomeScreen: case IDEActions.FileOpenWorkspace: // disable when background operation in progress if (!_currentBackgroundOperation) @@ -1033,6 +1033,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL closeAllDocuments(); }); return true; + case IDEActions.WindowShowHomeScreen: + showHomeScreen(); + return true; case IDEActions.FileOpenWorkspace: // Already specified workspace if (!a.stringParam.empty) { diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 1f22da7..30ffe6f 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -86,6 +86,7 @@ MENU_WINDOW=&Window MENU_WINDOW_PREFERENCES=&Preferences MENU_WINDOW_CLOSE_DOCUMENT=Close document MENU_WINDOW_CLOSE_ALL_DOCUMENTS=Close all documents +MENU_WINDOW_SHOW_HOME_SCREEN=Show home screen MENU_HELP=&Help MENU_HELP_VIEW_HELP=&View help diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index 408d04e..f46d17a 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -86,6 +86,7 @@ MENU_WINDOW=&Окно MENU_WINDOW_PREFERENCES=&Настройки MENU_WINDOW_CLOSE_DOCUMENT=Закрыть документ MENU_WINDOW_CLOSE_ALL_DOCUMENTS=Закрыть все документы +MENU_WINDOW_SHOW_HOME_SCREEN=Домашняя страница MENU_HELP=&Справка MENU_HELP_VIEW_HELP=&Просмотр справки From ad5aafea8ee463098344196062bf9f63fd009c1a Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 10:54:28 +0300 Subject: [PATCH 05/31] dlang tour link in home screen --- src/dlangide/ui/homescreen.d | 2 ++ views/VERSION | 2 +- views/res/i18n/en.ini | 3 ++- views/res/i18n/ru.ini | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dlangide/ui/homescreen.d b/src/dlangide/ui/homescreen.d index 6e185aa..4fcc6ee 100644 --- a/src/dlangide/ui/homescreen.d +++ b/src/dlangide/ui/homescreen.d @@ -66,6 +66,8 @@ class HomeScreen : ScrollWidget { _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DUB_REP"c).value, "http://code.dlang.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_UI"c).value, "https://github.com/buggins/dlangui")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE"c).value, "https://github.com/buggins/dlangide")); + _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_TOUR"c).value, "https://tour.dlang.org/")); + _column2.addChild(new VSpacer()); contentWidget = _content; } diff --git a/views/VERSION b/views/VERSION index 35d3fa0..0bd044c 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.54 \ No newline at end of file +v0.7.56 \ No newline at end of file diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 30ffe6f..82a8207 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -1,7 +1,7 @@ ABOUT=About DlangIDE HOME=DlangIDE Home DESCRIPTION=D language IDE written in D -COPYRIGHT=(c) Vadim Lopatin 2015 +COPYRIGHT=(c) Vadim Lopatin 2017 START_WITH=Start with: RECENT=Recent: NO_RECENT=No recent items @@ -10,6 +10,7 @@ D_LANG=D Programming Language DUB_REP=DUB repository DLANG_UI=DLangUI on GitHub DLANG_IDE=DLangIDE on GitHub +DLANG_TOUR=DLang Tour EXIT=Exit ALL_FILES=All files diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index f46d17a..95eee7c 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -1,7 +1,7 @@ ABOUT=О DlangIDE HOME=Домашняя страница DlangIDE DESCRIPTION=IDE для языка D написанная на D -COPYRIGHT=(c) Вадим Лопатин 2015 +COPYRIGHT=(c) Вадим Лопатин 2017 START_WITH=Начать с: RECENT=Недавнее: NO_RECENT=Нет недавно открытых файлов/проектов @@ -10,6 +10,7 @@ D_LANG=Язык программирования D DUB_REP=Хранилище DUB DLANG_UI=DLangUI на GitHub DLANG_IDE=DLangIDE на GitHub +DLANG_TOUR=Интерактивный тур D EXIT=Выход ALL_FILES=Все файлы From 98f53d6560e0c0b59aac8cbcd418c315c826f7dc Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 10:58:47 +0300 Subject: [PATCH 06/31] add vibe-d and D forum links to home screen --- src/dlangide/ui/homescreen.d | 4 +++- views/res/i18n/en.ini | 2 ++ views/res/i18n/ru.ini | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dlangide/ui/homescreen.d b/src/dlangide/ui/homescreen.d index 4fcc6ee..3a542a2 100644 --- a/src/dlangide/ui/homescreen.d +++ b/src/dlangide/ui/homescreen.d @@ -67,7 +67,9 @@ class HomeScreen : ScrollWidget { _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_UI"c).value, "https://github.com/buggins/dlangui")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE"c).value, "https://github.com/buggins/dlangide")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_TOUR"c).value, "https://tour.dlang.org/")); - + _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_VIBED"c).value, "http://vibed.org/")); + _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_FORUM"c).value, "http://forum.dlang.org/")); + _column2.addChild(new VSpacer()); contentWidget = _content; } diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 82a8207..a939423 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -11,6 +11,8 @@ DUB_REP=DUB repository DLANG_UI=DLangUI on GitHub DLANG_IDE=DLangIDE on GitHub DLANG_TOUR=DLang Tour +DLANG_VIBED=Vibe-D +DLANG_FORUM=Dlang Forum EXIT=Exit ALL_FILES=All files diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index 95eee7c..e375437 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -11,6 +11,8 @@ DUB_REP=Хранилище DUB DLANG_UI=DLangUI на GitHub DLANG_IDE=DLangIDE на GitHub DLANG_TOUR=Интерактивный тур D +DLANG_VIBED=Vibe-D +DLANG_FORUM=Форум D EXIT=Выход ALL_FILES=Все файлы From ac2f87dc12055bd02708d362bdf1324d9901801d Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 15:31:55 +0300 Subject: [PATCH 07/31] update dlangui version to get screen DPI detection under SDL/Linux fixed - #217 --- dub.json | 2 +- views/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index 046cbf6..ad4cc73 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.101", + "dlangui": "==0.9.102", "dcd": "~>0.9.1" }, diff --git a/views/VERSION b/views/VERSION index 0bd044c..66a1110 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.56 \ No newline at end of file +v0.7.57 \ No newline at end of file From fec824d00a7f83b49aeba9a949cddd3fb5f00074 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 15:46:03 +0300 Subject: [PATCH 08/31] donation link in home screen --- src/dlangide/ui/homescreen.d | 3 +++ views/res/i18n/en.ini | 2 ++ views/res/i18n/ru.ini | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/dlangide/ui/homescreen.d b/src/dlangide/ui/homescreen.d index 3a542a2..4013ac3 100644 --- a/src/dlangide/ui/homescreen.d +++ b/src/dlangide/ui/homescreen.d @@ -69,6 +69,9 @@ class HomeScreen : ScrollWidget { _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_TOUR"c).value, "https://tour.dlang.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_VIBED"c).value, "http://vibed.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_FORUM"c).value, "http://forum.dlang.org/")); + _column1.addChild(new VSpacer()); + _column2.addChild((new TextWidget(null, UIString.fromId("DLANG_IDE_DONATE"c))).fontSize(20).textColor(linkColor)); + _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE_DONATE_PAYPAL"c).value, "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H2ADZV8S6TDHQ")); _column2.addChild(new VSpacer()); contentWidget = _content; diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index a939423..01867cc 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -13,6 +13,8 @@ DLANG_IDE=DLangIDE on GitHub DLANG_TOUR=DLang Tour DLANG_VIBED=Vibe-D DLANG_FORUM=Dlang Forum +DLANG_IDE_DONATE=Donate DlangIDE +DLANG_IDE_DONATE_PAYPAL=PayPal EXIT=Exit ALL_FILES=All files diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index e375437..4b499bf 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -13,6 +13,8 @@ DLANG_IDE=DLangIDE на GitHub DLANG_TOUR=Интерактивный тур D DLANG_VIBED=Vibe-D DLANG_FORUM=Форум D +DLANG_IDE_DONATE=Поддержать DlangIDE +DLANG_IDE_DONATE_PAYPAL=PayPal EXIT=Выход ALL_FILES=Все файлы From 2f2a1e5351f4729c2d70e0e9f402806ad2ca7acc Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 15:56:01 +0300 Subject: [PATCH 09/31] add donate link to Help menu - #186 --- src/dlangide/ui/commands.d | 2 ++ src/dlangide/ui/frame.d | 7 ++++--- src/dlangide/ui/homescreen.d | 7 ++++++- views/res/i18n/en.ini | 6 ++++-- views/res/i18n/ru.ini | 2 ++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index b0c3344..dd11b17 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -46,6 +46,7 @@ enum IDEActions : int { HelpAbout, HelpViewHelp, + HelpDonate, WindowCloseDocument, WindowCloseAllDocuments, WindowShowHomeScreen, @@ -130,6 +131,7 @@ const Action ACTION_EDIT_TOGGLE_BLOCK_COMMENT = (new Action(EditorActions.Toggle const Action ACTION_EDIT_PREFERENCES = (new Action(IDEActions.EditPreferences, "MENU_EDIT_PREFERENCES"c, null)).disableByDefault(); const Action ACTION_HELP_ABOUT = new Action(IDEActions.HelpAbout, "MENU_HELP_ABOUT"c); const Action ACTION_HELP_VIEW_HELP = new Action(IDEActions.HelpViewHelp, "MENU_HELP_VIEW_HELP"c); +const Action ACTION_HELP_DONATE = new Action(IDEActions.HelpDonate, "MENU_HELP_DONATE"c); const Action ACTION_WINDOW_CLOSE_DOCUMENT = new Action(IDEActions.WindowCloseDocument, "MENU_WINDOW_CLOSE_DOCUMENT"c, null, KeyCode.KEY_W, KeyFlag.Control); const Action ACTION_WINDOW_CLOSE_ALL_DOCUMENTS = new Action(IDEActions.WindowCloseAllDocuments, "MENU_WINDOW_CLOSE_ALL_DOCUMENTS"c); const Action ACTION_WINDOW_SHOW_HOME_SCREEN = new Action(IDEActions.WindowShowHomeScreen, "MENU_WINDOW_SHOW_HOME_SCREEN"c); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index afb6be1..5f1a8d1 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -44,7 +44,6 @@ import std.array : empty; import std.string : split; import std.path; -immutable string HELP_PAGE_URL = "https://github.com/buggins/dlangide/wiki"; // TODO: get version from GIT commit //version is now stored in file views/VERSION immutable dstring DLANGIDE_VERSION = toUTF32(import("VERSION")); @@ -733,8 +732,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL //windowItem.add(new Action(30, "MENU_WINDOW_PREFERENCES")); windowItem.add(ACTION_WINDOW_CLOSE_DOCUMENT, ACTION_WINDOW_CLOSE_ALL_DOCUMENTS, ACTION_WINDOW_SHOW_HOME_SCREEN); MenuItem helpItem = new MenuItem(new Action(4, "MENU_HELP"c)); - helpItem.add(ACTION_HELP_VIEW_HELP); - helpItem.add(ACTION_HELP_ABOUT); + helpItem.add(ACTION_HELP_VIEW_HELP, ACTION_HELP_ABOUT, ACTION_HELP_DONATE); mainMenuItems.add(fileItem); mainMenuItems.add(editItem); mainMenuItems.add(projectItem); @@ -914,6 +912,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL case IDEActions.HelpViewHelp: Platform.instance.openURL(HELP_PAGE_URL); return true; + case IDEActions.HelpDonate: + Platform.instance.openURL(HELP_DONATION_URL); + return true; case IDEActions.HelpAbout: //debug { // testDCDFailAfterThreadCreation(); diff --git a/src/dlangide/ui/homescreen.d b/src/dlangide/ui/homescreen.d index 4013ac3..7c476fa 100644 --- a/src/dlangide/ui/homescreen.d +++ b/src/dlangide/ui/homescreen.d @@ -11,6 +11,10 @@ import dlangui.core.i18n; import std.path; import std.utf : toUTF32; +immutable string HELP_PAGE_URL = "https://github.com/buggins/dlangide/wiki"; +immutable string HELP_DONATION_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H2ADZV8S6TDHQ"; + + class HomeScreen : ScrollWidget { protected IDEFrame _frame; protected HorizontalLayout _content; @@ -66,12 +70,13 @@ class HomeScreen : ScrollWidget { _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DUB_REP"c).value, "http://code.dlang.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_UI"c).value, "https://github.com/buggins/dlangui")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE"c).value, "https://github.com/buggins/dlangide")); + _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE_HELP"c).value, HELP_PAGE_URL)); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_TOUR"c).value, "https://tour.dlang.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_VIBED"c).value, "http://vibed.org/")); _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_FORUM"c).value, "http://forum.dlang.org/")); _column1.addChild(new VSpacer()); _column2.addChild((new TextWidget(null, UIString.fromId("DLANG_IDE_DONATE"c))).fontSize(20).textColor(linkColor)); - _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE_DONATE_PAYPAL"c).value, "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H2ADZV8S6TDHQ")); + _column2.addChild(new UrlImageTextButton(null, UIString.fromId("DLANG_IDE_DONATE_PAYPAL"c).value, HELP_DONATION_URL)); _column2.addChild(new VSpacer()); contentWidget = _content; diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index 01867cc..ea8f55e 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -10,11 +10,12 @@ D_LANG=D Programming Language DUB_REP=DUB repository DLANG_UI=DLangUI on GitHub DLANG_IDE=DLangIDE on GitHub +DLANG_IDE_HELP=DLangIDE documentation DLANG_TOUR=DLang Tour DLANG_VIBED=Vibe-D DLANG_FORUM=Dlang Forum -DLANG_IDE_DONATE=Donate DlangIDE -DLANG_IDE_DONATE_PAYPAL=PayPal +DLANG_IDE_DONATE=Support DlangIDE +DLANG_IDE_DONATE_PAYPAL=Donate via PayPal EXIT=Exit ALL_FILES=All files @@ -96,6 +97,7 @@ MENU_WINDOW_SHOW_HOME_SCREEN=Show home screen MENU_HELP=&Help MENU_HELP_VIEW_HELP=&View help MENU_HELP_ABOUT=&About +MENU_HELP_DONATE=Donate via PayPal MENU_VIEW=&View MENU_VIEW_LANGUAGE=Interface &Language diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index 4b499bf..82d05cd 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -10,6 +10,7 @@ D_LANG=Язык программирования D DUB_REP=Хранилище DUB DLANG_UI=DLangUI на GitHub DLANG_IDE=DLangIDE на GitHub +DLANG_IDE_HELP=DLangIDE документация DLANG_TOUR=Интерактивный тур D DLANG_VIBED=Vibe-D DLANG_FORUM=Форум D @@ -96,6 +97,7 @@ MENU_WINDOW_SHOW_HOME_SCREEN=Домашняя страница MENU_HELP=&Справка MENU_HELP_VIEW_HELP=&Просмотр справки MENU_HELP_ABOUT=&О программе +MENU_HELP_DONATE=Поддержать проект через PayPal MENU_VIEW=&Вид MENU_VIEW_LANGUAGE=&Язык интерфейса From 01fbc67b0554502a4a2a09a825fd9c538255b2d5 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 16:03:28 +0300 Subject: [PATCH 10/31] update translations --- views/res/i18n/en.ini | 4 ++-- views/res/i18n/ru.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index ea8f55e..278f1ed 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -10,7 +10,7 @@ D_LANG=D Programming Language DUB_REP=DUB repository DLANG_UI=DLangUI on GitHub DLANG_IDE=DLangIDE on GitHub -DLANG_IDE_HELP=DLangIDE documentation +DLANG_IDE_HELP=DLangIDE online documentation DLANG_TOUR=DLang Tour DLANG_VIBED=Vibe-D DLANG_FORUM=Dlang Forum @@ -95,7 +95,7 @@ MENU_WINDOW_CLOSE_ALL_DOCUMENTS=Close all documents MENU_WINDOW_SHOW_HOME_SCREEN=Show home screen MENU_HELP=&Help -MENU_HELP_VIEW_HELP=&View help +MENU_HELP_VIEW_HELP=Online help MENU_HELP_ABOUT=&About MENU_HELP_DONATE=Donate via PayPal diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index 82d05cd..3f32da5 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -95,7 +95,7 @@ MENU_WINDOW_CLOSE_ALL_DOCUMENTS=Закрыть все документы MENU_WINDOW_SHOW_HOME_SCREEN=Домашняя страница MENU_HELP=&Справка -MENU_HELP_VIEW_HELP=&Просмотр справки +MENU_HELP_VIEW_HELP=Онлайн справка MENU_HELP_ABOUT=&О программе MENU_HELP_DONATE=Поддержать проект через PayPal From bed6b6a709d4f2d0df1d8984285d73463a81b2cc Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 16:03:54 +0300 Subject: [PATCH 11/31] hide workspace tree when no workspace is opened --- src/dlangide/ui/frame.d | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 5f1a8d1..ca65b90 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -666,6 +666,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL _wsPanel.workspaceActionListener = &handleAction; _wsPanel.dockAlignment = DockAlignment.Left; _dockHost.addDockedWindow(_wsPanel); + _wsPanel.visibility = Visibility.Gone; _logPanel = new OutputPanel("output"); _logPanel.compilerLogIssueClickHandler = &onCompilerLogIssueClick; @@ -1504,8 +1505,11 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL _tabs.setFocus(); } if (ws) { + _wsPanel.visibility = Visibility.Visible; _settings.updateRecentWorkspace(ws.filename); _settings.setRecentPath(ws.dir, "FILE_OPEN_WORKSPACE_PATH"); + } else { + _wsPanel.visibility = Visibility.Gone; } } From 49cb61b4c3b7130b3753e51f4ac8e6c55ad1b8d8 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 16:06:59 +0300 Subject: [PATCH 12/31] fix readme --- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7a6c7bd..8de7a00 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,5 @@ [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/buggins/dlangide?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/buggins/dlangide.svg?branch=master)](https://travis-ci.org/buggins/dlangide) [![PayPayl donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H2ADZV8S6TDHQ "Donate once-off to this project using Paypal") -WTF?! (What The Fork) -====================== -Now you can set dmd includes paths (for correct work with DCD) in workspace settings file (newworkspace.dlangidews) -
-example:
-{
-        "name" : "newworkspace",
-        "description" : null,
-        "projects" : {
-                "newproject" : "newproject/dub.json"
- }, - "includePath" : [ - "/usr/include/dlang/dmd/" - ] -} -
-PS. - Sorry about bad code. Please correct me. - Dlang IDE ========= @@ -201,3 +182,22 @@ OSX: open solution file with Mono-D Choose dlangide as startup project. Coding style: [https://github.com/buggins/dlangui/blob/master/CODING_STYLE.md](https://github.com/buggins/dlangui/blob/master/CODING_STYLE.md) + + +Workspace include path setting +============================== + +Now you can set dmd includes paths (for correct work with DCD) in workspace settings file (newworkspace.dlangidews) +
+example:
+{
+        "name" : "newworkspace",
+        "description" : null,
+        "projects" : {
+                "newproject" : "newproject/dub.json"
+ }, + "includePath" : [ + "/usr/include/dlang/dmd/" + ] +} +
From cfcf70c1ea83c5565484fd9cb9e5737c438ed843 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 16:07:35 +0300 Subject: [PATCH 13/31] update version --- views/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/VERSION b/views/VERSION index 66a1110..751f30f 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.57 \ No newline at end of file +v0.7.58 \ No newline at end of file From 23213147d29e895f37747123380128c0cd522408 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 16:44:57 +0300 Subject: [PATCH 14/31] fix #245, partial change for #235 --- src/dlangide/tools/d/dcdinterface.d | 28 +++++++++++++++++++++++++++- src/dlangide/tools/d/deditortool.d | 4 ++++ src/dlangide/ui/frame.d | 18 ++++++++++++++---- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/src/dlangide/tools/d/dcdinterface.d b/src/dlangide/tools/d/dcdinterface.d index c465825..4392bb4 100644 --- a/src/dlangide/tools/d/dcdinterface.d +++ b/src/dlangide/tools/d/dcdinterface.d @@ -72,11 +72,14 @@ class DCDTask { if (_cancelled) return; createRequest(); + if (_cancelled) + return; performRequest(); synchronized(this) { if (_cancelled) return; - _guiExecutor.executeInUiThread(&postResults); + if (_guiExecutor) + _guiExecutor.executeInUiThread(&postResults); } } } @@ -183,6 +186,29 @@ class DCDInterface : Thread { return ""; } + /// DCD doc comments task + class ModuleCacheWarmupTask : DCDTask { + + this(CustomEventTarget guiExecutor, string[] importPaths) { + super(guiExecutor, importPaths, null, null, 0); + } + + override void performRequest() { + debug(DCD) Log.d("DCD - warm up module cache with import paths ", _importPaths); + getModuleCache(_importPaths); + debug(DCD) Log.d("DCD - module cache warm up finished"); + } + override void postResults() { + } + } + + DCDTask warmUp(string[] importPaths) { + debug(DCD) Log.d("DCD warmUp: ", importPaths); + ModuleCacheWarmupTask task = new ModuleCacheWarmupTask(null, importPaths); + _queue.put(task); + return task; + } + /// DCD doc comments task class DocCommentsTask : DCDTask { diff --git a/src/dlangide/tools/d/deditortool.d b/src/dlangide/tools/d/deditortool.d index bde0927..c3bfbeb 100644 --- a/src/dlangide/tools/d/deditortool.d +++ b/src/dlangide/tools/d/deditortool.d @@ -63,6 +63,7 @@ class DEditorTool : EditorTool override void cancelGetDocComments() { if (_getDocCommentsTask) { + Log.d("Cancelling getDocComments()"); _getDocCommentsTask.cancel(); _getDocCommentsTask = null; } @@ -70,6 +71,7 @@ class DEditorTool : EditorTool override void cancelGoToDefinition() { if (_goToDefinitionTask) { + Log.d("Cancelling goToDefinition()"); _goToDefinitionTask.cancel(); _goToDefinitionTask = null; } @@ -77,6 +79,7 @@ class DEditorTool : EditorTool override void cancelGetCompletions() { if (_getCompletionsTask) { + Log.d("Cancelling getCompletions()"); _getCompletionsTask.cancel(); _getCompletionsTask = null; } @@ -125,6 +128,7 @@ class DEditorTool : EditorTool DCDTask _getCompletionsTask; override void getCompletions(DSourceEdit editor, TextPosition caretPosition, void delegate(dstring[] completions, string[] icons) callback) { + cancelGetCompletions(); string[] importPaths = editor.importPaths(); string content = toUTF8(editor.text); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index ca65b90..66efa96 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -1325,6 +1325,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL if (!project) return; currentWorkspace.startupProject = project; + warmUpImportPaths(project); if (_wsPanel) _wsPanel.updateDefault(); } @@ -1394,15 +1395,21 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL } const auto msg = UIString.fromId("MSG_OPENED_PROJECT"c); _logPanel.logLine(toUTF32("Project file " ~ project.filename ~ " is opened ok")); + + warmUpImportPaths(project); return true; } + public void warmUpImportPaths(Project project) { + dcdInterface.warmUp(project.importPaths); + } + void openFileOrWorkspace(string filename) { // Open DlangIDE workspace file if (filename.isWorkspaceFile) { Workspace ws = new Workspace(this); if (ws.load(filename)) { - askForUnsavedEdits(delegate() { + askForUnsavedEdits(delegate() { setWorkspace(ws); hideHomeScreen(); // Write workspace to recent workspaces list @@ -1421,9 +1428,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL const auto msg = UIString.fromId("MSG_TRY_OPEN_PROJECT"c).value; _logPanel.logLine(msg ~ toUTF32(" " ~ filename)); Project project = new Project(currentWorkspace, filename); - if (!project.load()) { - window.showMessageBox(UIString.fromId("MSG_OPEN_PROJECT"c), UIString.fromId("ERROR_INVALID_WS_OR_PROJECT_FILE"c)); - _logPanel.logLine("File is not recognized as DlangIDE project or workspace file"); + if (!loadProject(project)) { + //window.showMessageBox(UIString.fromId("MSG_OPEN_PROJECT"c), UIString.fromId("ERROR_INVALID_WS_OR_PROJECT_FILE"c)); + //_logPanel.logLine("File is not recognized as DlangIDE project or workspace file"); return; } string defWsFile = project.defWorkspaceFile; @@ -1508,6 +1515,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL _wsPanel.visibility = Visibility.Visible; _settings.updateRecentWorkspace(ws.filename); _settings.setRecentPath(ws.dir, "FILE_OPEN_WORKSPACE_PATH"); + if (ws.startupProject) { + warmUpImportPaths(ws.startupProject); + } } else { _wsPanel.visibility = Visibility.Gone; } From 0f2fc02157ea121e5a2a8c7aedd3a69abb978f97 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 16:50:02 +0300 Subject: [PATCH 15/31] update version --- views/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/VERSION b/views/VERSION index 751f30f..d5409c4 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.58 \ No newline at end of file +v0.7.59 \ No newline at end of file From 9a6619cd33f344cd5b73be76bd01d22e10cc6928 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 29 Aug 2017 17:54:59 +0300 Subject: [PATCH 16/31] completion filtering and sorting - #235 --- src/dlangide/tools/d/dcdinterface.d | 97 +++++++++++++++++++++++++++-- src/dlangide/tools/d/deditortool.d | 7 +-- 2 files changed, 95 insertions(+), 9 deletions(-) diff --git a/src/dlangide/tools/d/dcdinterface.d b/src/dlangide/tools/d/dcdinterface.d index 4392bb4..a8b1a21 100644 --- a/src/dlangide/tools/d/dcdinterface.d +++ b/src/dlangide/tools/d/dcdinterface.d @@ -30,9 +30,14 @@ enum DCDResult : int { FAIL, } +struct CompletionSymbol { + dstring name; + char kind; +} + alias DocCommentsResultSet = Tuple!(DCDResult, "result", string[], "docComments"); alias FindDeclarationResultSet = Tuple!(DCDResult, "result", string, "fileName", ulong, "offset"); -alias CompletionResultSet = Tuple!(DCDResult, "result", dstring[], "output", char[], "completionKinds"); +alias CompletionResultSet = Tuple!(DCDResult, "result", CompletionSymbol[], "output"); class DCDTask { @@ -301,16 +306,17 @@ class DCDInterface : Thread { result.result = DCDResult.SUCCESS; result.output.length = response.completions.length; - result.completionKinds.length = response.completions.length; int i=0; foreach(s;response.completions) { char type = 0; if (i < response.completionKinds.length) type = response.completionKinds[i]; - result.completionKinds[i] = type; - result.output[i++] = to!dstring(s); + result.output[i].kind = type; + result.output[i].name = to!dstring(s); + i++; } - debug(DCD) Log.d("DCD output:\n", response.completions); + postProcessCompletions(result.output); + debug(DCD) Log.d("DCD response:\n", response, "\nCompletion result:\n", result.output); } override void postResults() { _callback(result); @@ -327,6 +333,87 @@ class DCDInterface : Thread { } +int completionTypePriority(char t) { + switch(t) { + case 'c': // - class name + return 10; + case 'i': // - interface name + return 10; + case 's': // - struct name + return 10; + case 'u': // - union name + return 10; + case 'v': // - variable name + return 5; + case 'm': // - member variable name + return 3; + case 'k': // - keyword, built-in version, scope statement + return 20; + case 'f': // - function or method + return 2; + case 'g': // - enum name + return 9; + case 'e': // - enum member + return 8; + case 'P': // - package name + return 30; + case 'M': // - module name + return 20; + case 'a': // - array + return 15; + case 'A': // - associative array + return 15; + case 'l': // - alias name + return 15; + case 't': // - template name + return 14; + case 'T': // - mixin template name + return 14; + default: + return 50; + } +} + +int compareCompletionSymbol(ref CompletionSymbol v1, ref CompletionSymbol v2) { + import std.algorithm : cmp; + int p1 = v1.kind.completionTypePriority; + int p2 = v2.kind.completionTypePriority; + if (p1 < p2) + return -1; + if (p1 > p2) + return 1; + return v1.name.cmp(v2.name); +} + +bool lessCompletionSymbol(ref CompletionSymbol v1, ref CompletionSymbol v2) { + return compareCompletionSymbol(v1, v2) < 0; +} + +void postProcessCompletions(ref CompletionSymbol[] completions) { + import std.algorithm.sorting : sort; + completions.sort!(lessCompletionSymbol); + CompletionSymbol[] res; + bool hasKeywords = false; + bool hasNonKeywords = false; + bool[dstring] found; + foreach(s; completions) { + if (s.kind == 'k') + hasKeywords = true; + else + hasNonKeywords = true; + } + // remove duplicates; remove keywords if non-keyword items are found + foreach(s; completions) { + if (!(s.name in found)) { + found[s.name] = true; + if (s.kind != 'k' || !hasNonKeywords) { + res ~= s; + } + } + } + completions = res; +} + /// to test broken DCD after DUB invocation /// run it after DCD ModuleCache is instantiated diff --git a/src/dlangide/tools/d/deditortool.d b/src/dlangide/tools/d/deditortool.d index c3bfbeb..29fe92d 100644 --- a/src/dlangide/tools/d/deditortool.d +++ b/src/dlangide/tools/d/deditortool.d @@ -138,7 +138,7 @@ class DEditorTool : EditorTool dstring[] labels; foreach(index, label; output.output) { string iconId; - char ch = index < output.completionKinds.length ? output.completionKinds[index] : 0; + char ch = label.kind; switch(ch) { case 'c': // - class name iconId = "symbol-class"; @@ -192,12 +192,11 @@ class DEditorTool : EditorTool iconId = "symbol-mixintemplate"; break; default: + iconId = "symbol-other"; break; } - if (!iconId) - iconId = "symbol-other"; icons ~= iconId; - labels ~= label; + labels ~= label.name; } callback(labels, icons); _getCompletionsTask = null; From 4e321789b19612634a5145a3783192555425529f Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 30 Aug 2017 09:31:32 +0300 Subject: [PATCH 17/31] documentation popup size fix #233 --- dub.json | 2 +- src/dlangide/ui/dsourceedit.d | 16 ++++++++++++---- views/VERSION | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dub.json b/dub.json index ad4cc73..22e1d92 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.102", + "dlangui": "==0.9.103", "dcd": "~>0.9.1" }, diff --git a/src/dlangide/ui/dsourceedit.d b/src/dlangide/ui/dsourceedit.d index fbdeb66..86530dd 100644 --- a/src/dlangide/ui/dsourceedit.d +++ b/src/dlangide/ui/dsourceedit.d @@ -504,17 +504,25 @@ class DSourceEdit : SourceEdit, EditableContentMarksChangeListener { lineCount = 1; // TODO EditBox widget = new EditBox("docComments"); + widget.styleId = "POPUP_MENU"; widget.readOnly = true; //TextWidget widget = new TextWidget("docComments"); //widget.maxLines = lineCount * 2; //widget.text = "Test popup"d; //text.dup; widget.text = text.dup; + + Point bestSize = widget.fullContentSizeWithBorders(); //widget.layoutHeight = lineCount * widget.fontSize; - widget.minHeight = (lineCount + 1) * widget.fontSize; - widget.maxWidth = width * 3 / 4; - widget.minWidth = width / 8; + if (bestSize.y > height / 3) + bestSize.y = height / 3; + if (bestSize.x > width * 3 / 4) + bestSize.x = width * 3 / 4; + widget.minHeight = bestSize.y; //max((lineCount + 1) * widget.fontSize, bestSize.y); + widget.maxHeight = bestSize.y; + + widget.maxWidth = bestSize.x; //width * 3 / 4; + widget.minWidth = bestSize.x; //width / 8; // widget.layoutWidth = width / 3; - widget.styleId = "POPUP_MENU"; widget.hscrollbarMode = ScrollBarMode.Auto; widget.vscrollbarMode = ScrollBarMode.Auto; uint pos = PopupAlign.Above; diff --git a/views/VERSION b/views/VERSION index d5409c4..4f3713f 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.59 \ No newline at end of file +v0.7.60 \ No newline at end of file From 5183d59682895b7ef97224d0d0ca6993823c1446 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 4 Sep 2017 13:23:11 +0300 Subject: [PATCH 18/31] update dlangui version for #193 --- dub.json | 2 +- views/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index 22e1d92..7519421 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.103", + "dlangui": "==0.9.107", "dcd": "~>0.9.1" }, diff --git a/views/VERSION b/views/VERSION index 4f3713f..7d89f1b 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.60 \ No newline at end of file +v0.7.61 \ No newline at end of file From 77adfc73c190edb0a34d353c46aae84a2ba8f10a Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 4 Sep 2017 14:13:57 +0300 Subject: [PATCH 19/31] fix #246 - autoindent issues --- dub.json | 2 +- src/dlangide/tools/d/dsyntax.d | 17 +++++++++++++++-- views/VERSION | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/dub.json b/dub.json index 7519421..d649616 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.107", + "dlangui": "==0.9.108", "dcd": "~>0.9.1" }, diff --git a/src/dlangide/tools/d/dsyntax.d b/src/dlangide/tools/d/dsyntax.d index bdcad07..b2d91ed 100644 --- a/src/dlangide/tools/d/dsyntax.d +++ b/src/dlangide/tools/d/dsyntax.d @@ -653,11 +653,15 @@ class SimpleDSyntaxSupport : SyntaxSupport { dstring lineText = _content.line(line); TextLineMeasure lineMeasurement = _content.measureLine(line); TextLineMeasure prevLineMeasurement = _content.measureLine(prevLine); + bool prevLineSpaceOnly = false; + if (prevLineMeasurement.empty && prevLineMeasurement.len) { + prevLineSpaceOnly = true; + } while (prevLineMeasurement.empty && prevLine > 0) { prevLine--; prevLineMeasurement = _content.measureLine(prevLine); } - if (lineMeasurement.firstNonSpaceX >= 0 && lineMeasurement.firstNonSpaceX < prevLineMeasurement.firstNonSpaceX) { + if (lineMeasurement.firstNonSpaceX >= 0 && lineMeasurement.firstNonSpaceX <= prevLineMeasurement.firstNonSpaceX) { dstring prevLineText = _content.line(prevLine); TokenPropString prevLineTokenProps = _content.lineTokenProps(prevLine); dchar lastOpChar = 0; @@ -674,7 +678,16 @@ class SimpleDSyntaxSupport : SyntaxSupport { if (lastOpChar == '{') spacex = _content.nextTab(spacex); dstring txt = _content.fillSpace(spacex); - EditOperation op2 = new EditOperation(EditAction.Replace, TextRange(TextPosition(line, 0), TextPosition(line, lineMeasurement.firstNonSpace >= 0 ? lineMeasurement.firstNonSpace : 0)), [txt]); + dstring[] newContent; + auto startPos = TextPosition(line, 0); + auto endPos = TextPosition(line, lineMeasurement.firstNonSpace >= 0 ? lineMeasurement.firstNonSpace : 0); + if (prevLineSpaceOnly) { + // clear spaces from previous line + startPos.line--; + newContent ~= ""d; + } + newContent ~= txt; + EditOperation op2 = new EditOperation(EditAction.Replace, TextRange(startPos, endPos), newContent); _opInProgress = true; _content.performOperation(op2, source); _opInProgress = false; diff --git a/views/VERSION b/views/VERSION index 7d89f1b..6c68d7c 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.61 \ No newline at end of file +v0.7.62 \ No newline at end of file From 55007a6abebf308ac7a10c42190b58f890a27a22 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 4 Sep 2017 14:53:47 +0300 Subject: [PATCH 20/31] fix #202 --- dub.json | 2 +- views/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index d649616..a6b28f7 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.108", + "dlangui": "==0.9.111", "dcd": "~>0.9.1" }, diff --git a/views/VERSION b/views/VERSION index 6c68d7c..f05385b 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.62 \ No newline at end of file +v0.7.64 \ No newline at end of file From bdebc90cc17c4d04eee4a55649d26022c8970133 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 4 Sep 2017 18:12:21 +0300 Subject: [PATCH 21/31] editors - search support Ctrl+F, initial version; #109 --- dub.json | 2 +- src/dlangide/ui/searchPanel.d | 8 ++------ views/VERSION | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dub.json b/dub.json index a6b28f7..ed274b2 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.111", + "dlangui": "==0.9.112", "dcd": "~>0.9.1" }, diff --git a/src/dlangide/ui/searchPanel.d b/src/dlangide/ui/searchPanel.d index de53897..d0ad15d 100644 --- a/src/dlangide/ui/searchPanel.d +++ b/src/dlangide/ui/searchPanel.d @@ -30,10 +30,6 @@ class SearchLogWidget : LogWidget { onThemeChanged(); } - protected dstring _textToHighlight; - @property dstring textToHighlight() { return _textToHighlight; } - @property void textToHighlight(dstring s) { _textToHighlight = s; } - protected uint _filenameColor = 0x0000C0; protected uint _errorColor = 0xFF0000; protected uint _warningColor = 0x606000; @@ -245,7 +241,7 @@ class SearchWidget : TabWidget { bool findText(dstring source) { Log.d("Finding " ~ source); - _resultLog.textToHighlight = ""d; + _resultLog.setTextToHighlight(""d, false); _resultLog.text = ""d; _matchedList = []; _resultLogMatchIndex = 0; @@ -289,7 +285,7 @@ class SearchWidget : TabWidget { default: assert(0); } - _resultLog.textToHighlight = source; + _resultLog.setTextToHighlight(source, true); return true; } diff --git a/views/VERSION b/views/VERSION index f05385b..4fe00bc 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.64 \ No newline at end of file +v0.7.65 \ No newline at end of file From 8e118cd5aed484bb342f2146cf16f03d25db6fbd Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 5 Sep 2017 12:06:54 +0300 Subject: [PATCH 22/31] find/replace in current file #107 --- dub.json | 2 +- views/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index ed274b2..d0d30e8 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.112", + "dlangui": "==0.9.113", "dcd": "~>0.9.1" }, diff --git a/views/VERSION b/views/VERSION index 4fe00bc..54e2ad8 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.65 \ No newline at end of file +v0.7.66 \ No newline at end of file From 1f34e7dc6c2a86b461ee2d56c3d69e6167d65b3b Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 6 Sep 2017 18:09:13 +0300 Subject: [PATCH 23/31] fix #251 - new package creation --- src/dlangide/ui/newfile.d | 44 ++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/src/dlangide/ui/newfile.d b/src/dlangide/ui/newfile.d index 047297d..1ecfbaa 100644 --- a/src/dlangide/ui/newfile.d +++ b/src/dlangide/ui/newfile.d @@ -216,7 +216,7 @@ class NewFileDlg : Dialog { if (!exists(_location) || !isDir(_location)) return setError("Location directory does not exist"); - if (_currentTemplate.isModule) { + if (_currentTemplate.kind == FileKind.MODULE || _currentTemplate.kind == FileKind.PACKAGE) { string sourcePath, relativePath; if (!findSource(_location, sourcePath, relativePath)) return setError("Location is outside of source path"); @@ -231,7 +231,12 @@ class NewFileDlg : Dialog { buf ~= ch; } _packageName = buf.dup; - string m = !_packageName.empty ? _packageName ~ '.' ~ _moduleName : _moduleName; + string m; + if (_currentTemplate.kind == FileKind.MODULE) { + m = !_packageName.empty ? _packageName ~ '.' ~ _moduleName : _moduleName; + } else { + m = _packageName; + } _edModuleName.text = toUTF32(m); _packageName = m; } else { @@ -248,9 +253,12 @@ class NewFileDlg : Dialog { private FileCreationResult _result; bool createItem() { try { - if (_currentTemplate.isModule) { + if (_currentTemplate.kind == FileKind.MODULE) { string txt = "module " ~ _packageName ~ ";\n\n" ~ _currentTemplate.srccode; write(_fullPathName, txt); + } else if (_currentTemplate.kind == FileKind.PACKAGE) { + string txt = "package " ~ _packageName ~ ";\n\n" ~ _currentTemplate.srccode; + write(_fullPathName, txt); } else { write(_fullPathName, _currentTemplate.srccode); } @@ -284,17 +292,27 @@ class NewFileDlg : Dialog { _currentTemplateIndex = index; _currentTemplate = _templates[index]; _templateDescription.text = _currentTemplate.description; + if (_currentTemplate.kind == FileKind.PACKAGE) { + _edFileName.enabled = false; + _edFileName.text = "package"d; + } else { + if (_edFileName.text == "package") + _edFileName.text = "newfile"; + _edFileName.enabled = true; + } //updateDirLayout(); validate(); } void initTemplates() { _templates ~= new ProjectTemplate("Empty module"d, "Empty D module file."d, ".d", - "\n", true); + "\n", FileKind.MODULE); + _templates ~= new ProjectTemplate("Package"d, "D package."d, ".d", + "\n", FileKind.PACKAGE); _templates ~= new ProjectTemplate("Text file"d, "Empty text file."d, ".txt", - "\n", true); + "\n", FileKind.TEXT); _templates ~= new ProjectTemplate("JSON file"d, "Empty json file."d, ".json", - "{\n}\n", true); + "{\n}\n", FileKind.TEXT); _templates ~= new ProjectTemplate("Vibe-D Diet Template file"d, "Empty Vibe-D Diet Template."d, ".dt", q{ doctype html @@ -303,22 +321,28 @@ html title Hello, World body h1 Hello World -}, true); +}, FileKind.TEXT); } } +enum FileKind { + MODULE, + PACKAGE, + TEXT, +} + class ProjectTemplate { dstring name; dstring description; string fileExtension; string srccode; - bool isModule; - this(dstring name, dstring description, string fileExtension, string srccode, bool isModule) { + FileKind kind; + this(dstring name, dstring description, string fileExtension, string srccode, FileKind kind) { this.name = name; this.description = description; this.fileExtension = fileExtension; this.srccode = srccode; - this.isModule = isModule; + this.kind = kind; } } From 9f63bb060320d9546503e91909d70a7ec841f2f1 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 7 Sep 2017 10:56:01 +0300 Subject: [PATCH 24/31] sort workspace items - folders first - close #250 --- dub.json | 2 +- src/dlangide/ui/newfile.d | 3 ++- src/dlangide/workspace/project.d | 12 ++++++++++++ views/VERSION | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dub.json b/dub.json index d0d30e8..d46361f 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.113", + "dlangui": "==0.9.114", "dcd": "~>0.9.1" }, diff --git a/src/dlangide/ui/newfile.d b/src/dlangide/ui/newfile.d index 1ecfbaa..a9fce75 100644 --- a/src/dlangide/ui/newfile.d +++ b/src/dlangide/ui/newfile.d @@ -239,6 +239,8 @@ class NewFileDlg : Dialog { } _edModuleName.text = toUTF32(m); _packageName = m; + if (_currentTemplate.kind == FileKind.PACKAGE && _packageName.length == 0) + return setError("Package should be located in subdirectory"); } else { string projectPath = _project.dir; if (!isSubdirOf(_location, projectPath)) @@ -345,4 +347,3 @@ class ProjectTemplate { this.kind = kind; } } - diff --git a/src/dlangide/workspace/project.d b/src/dlangide/workspace/project.d index fc2db3b..9e1f71b 100644 --- a/src/dlangide/workspace/project.d +++ b/src/dlangide/workspace/project.d @@ -202,6 +202,17 @@ class ProjectFolder : ProjectItem { _children.remove(i); } } + sortItems(); + } + + /// predicate for sorting project items + static bool compareProjectItemsLess(ProjectItem item1, ProjectItem item2) { + return ((item1.isFolder && !item2.isFolder) || ((item1.isFolder == item2.isFolder) && (item1.name < item2.name))); + } + + void sortItems() { + import std.algorithm.sorting : sort; + sort!compareProjectItemsLess(_children.asArray); } string relativeToAbsolutePath(string path) { @@ -218,6 +229,7 @@ class ProjectFolder : ProjectItem { } } + /// Project source file class ProjectSourceFile : ProjectItem { this(string filename) { diff --git a/views/VERSION b/views/VERSION index 54e2ad8..c5441ad 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.66 \ No newline at end of file +v0.7.67 \ No newline at end of file From 8ba1d31b98f612f55cbf65ea757692ac7f264895 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 7 Sep 2017 11:37:30 +0300 Subject: [PATCH 25/31] setting for editor font size - close #249 --- src/dlangide/ui/dsourceedit.d | 7 +++++++ src/dlangide/ui/settings.d | 2 ++ src/dlangide/workspace/idesettings.d | 7 ++++--- views/VERSION | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/dlangide/ui/dsourceedit.d b/src/dlangide/ui/dsourceedit.d index 86530dd..046dd16 100644 --- a/src/dlangide/ui/dsourceedit.d +++ b/src/dlangide/ui/dsourceedit.d @@ -95,6 +95,7 @@ class DSourceEdit : SourceEdit, EditableContentMarksChangeListener { @property IDESettings settings() { return _settings; } + protected int _previousFontSizeSetting; void applySettings() { if (!_settings) return; @@ -111,6 +112,12 @@ class DSourceEdit : SourceEdit, EditableContentMarksChangeListener { face ~= ","; face ~= DEFAULT_SOURCE_EDIT_FONT_FACES; fontFace = face; + int newFontSizeSetting = _settings.editorFontSize; + bool needChangeFontSize = _previousFontSizeSetting == 0 || (_previousFontSizeSetting != newFontSizeSetting && _previousFontSizeSetting.pointsToPixels == fontSize); + if (needChangeFontSize) { + fontSize = newFontSizeSetting.pointsToPixels; + _previousFontSizeSetting = newFontSizeSetting; + } } protected EditorTool _editorTool; diff --git a/src/dlangide/ui/settings.d b/src/dlangide/ui/settings.d index 6abacc5..384c094 100644 --- a/src/dlangide/ui/settings.d +++ b/src/dlangide/ui/settings.d @@ -122,6 +122,8 @@ SettingsPage createSettingsPages() { // editor font faces texted.addStringComboBox("editors/textEditor/fontFace", UIString.fromId("OPTION_FONT_FACE"c), createFaceList(true)); + texted.addIntComboBox("editors/textEditor/fontSize", UIString.fromId("OPTION_FONT_SIZE"c), + createIntValueList([6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,30,32])); texted.addNumberEdit("editors/textEditor/tabSize", UIString.fromId("OPTION_TAB"c), 1, 16, 4); texted.addCheckbox("editors/textEditor/useSpacesForTabs", UIString.fromId("OPTION_USE_SPACES"c)); diff --git a/src/dlangide/workspace/idesettings.d b/src/dlangide/workspace/idesettings.d index f70e6a8..2e4f4f1 100644 --- a/src/dlangide/workspace/idesettings.d +++ b/src/dlangide/workspace/idesettings.d @@ -24,6 +24,7 @@ class IDESettings : SettingsFile { ed.setBooleanDef("showWhiteSpaceMarks", true); ed.setBooleanDef("showTabPositionMarks", true); ed.setStringDef("fontFace", "Default"); + ed.setIntegerDef("fontSize", 11); Setting ui = uiSettings(); ui.setStringDef("theme", "ide_theme_default"); ui.setStringDef("language", "en"); @@ -170,10 +171,10 @@ class IDESettings : SettingsFile { @property bool showTabPositionMarks() { return editorSettings.getBoolean("showTabPositionMarks", true); } /// set tab position marks enabled flag @property IDESettings showTabPositionMarks(bool enabled) { editorSettings.setBoolean("showTabPositionMarks", enabled); return this; } - /// string value of font face + /// string value of font face in text editors @property string editorFontFace() { return editorSettings.getString("fontFace", "Default"); } - - + /// int value of font size in text editors + @property int editorFontSize() { return cast(int)editorSettings.getInteger("fontSize", 11); } /// true if smart indents are enabled @property bool smartIndentsAfterPaste() { return editorSettings.getBoolean("smartIndentsAfterPaste", true); } diff --git a/views/VERSION b/views/VERSION index c5441ad..fa3421c 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.67 \ No newline at end of file +v0.7.68 \ No newline at end of file From ad6d0b495e8e63ea2b4b5ff6a65055b4c82786b3 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 7 Sep 2017 17:24:08 +0300 Subject: [PATCH 26/31] catch latest dlangui - for enabling of file dialog items sorting --- dub.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dub.json b/dub.json index d46361f..b61f458 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.114", + "dlangui": "==0.9.115", "dcd": "~>0.9.1" }, From 4a7a6d0b07fb73ed803a2c877631585188551fb0 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 8 Sep 2017 13:24:22 +0300 Subject: [PATCH 27/31] search and highlight improvements - catch recent dlangui version --- dub.json | 2 +- src/dlangide/ui/searchPanel.d | 4 ++-- views/VERSION | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dub.json b/dub.json index b61f458..dcc4675 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.115", + "dlangui": "==0.9.119", "dcd": "~>0.9.1" }, diff --git a/src/dlangide/ui/searchPanel.d b/src/dlangide/ui/searchPanel.d index d0ad15d..447baff 100644 --- a/src/dlangide/ui/searchPanel.d +++ b/src/dlangide/ui/searchPanel.d @@ -241,7 +241,7 @@ class SearchWidget : TabWidget { bool findText(dstring source) { Log.d("Finding " ~ source); - _resultLog.setTextToHighlight(""d, false); + _resultLog.setTextToHighlight(""d, 0); _resultLog.text = ""d; _matchedList = []; _resultLogMatchIndex = 0; @@ -285,7 +285,7 @@ class SearchWidget : TabWidget { default: assert(0); } - _resultLog.setTextToHighlight(source, true); + _resultLog.setTextToHighlight(source, TextSearchFlag.CaseSensitive); return true; } diff --git a/views/VERSION b/views/VERSION index fa3421c..f7c7422 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.68 \ No newline at end of file +v0.7.70 \ No newline at end of file From 09d5470ddacf501a4c12c8dbf8fa4414b4dff807 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 8 Sep 2017 15:08:50 +0300 Subject: [PATCH 28/31] new file dialog enhancements #258 --- dub.json | 2 +- src/dlangide/ui/newfile.d | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dub.json b/dub.json index dcc4675..220ab31 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views", "views/res", "views/res/i18n", "views/res/mdpi", "views/res/hdpi"], "dependencies": { - "dlangui": "==0.9.119", + "dlangui": "==0.9.120", "dcd": "~>0.9.1" }, diff --git a/src/dlangide/ui/newfile.d b/src/dlangide/ui/newfile.d index a9fce75..ab47509 100644 --- a/src/dlangide/ui/newfile.d +++ b/src/dlangide/ui/newfile.d @@ -122,6 +122,11 @@ class NewFileDlg : Dialog { _edLocation.addFilter(FileFilterEntry(UIString.fromRaw("DlangIDE files"d), "*.dlangidews;*.d;*.dd;*.di;*.ddoc;*.dh;*.json;*.xml;*.ini;*.dt")); _edLocation.caption = "Select directory"d; + _edFileName.editorAction.connect(&onEditorAction); + _edFilePath.editorAction.connect(&onEditorAction); + _edModuleName.editorAction.connect(&onEditorAction); + _edLocation.editorAction.connect(&onEditorAction); + // fill templates dstring[] names; foreach(t; _templates) @@ -156,6 +161,23 @@ class NewFileDlg : Dialog { } + /// called after window with dialog is shown + override void onShow() { + super.onShow(); + _edFileName.selectAll(); + _edFileName.setFocus(); + } + + protected bool onEditorAction(const Action action) { + if (action.id == EditorActions.InsertNewLine) { + if (!validate()) + return false; + close(_buttonActions[0]); + return true; + } + return false; + } + StringListWidget _projectTemplateList; EditBox _templateDescription; DirEditLine _edLocation; From c66ae7521e1381c30ddd2f2a98ab5049e79ff241 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 8 Sep 2017 15:22:07 +0300 Subject: [PATCH 29/31] fix #257 - new file from menu --- src/dlangide/ui/frame.d | 7 +++++-- src/dlangide/ui/wspanel.d | 11 +++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 66efa96..6ae9f7c 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -1119,7 +1119,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL createNewProject(false); return true; case IDEActions.FileNew: - addProjectItem(a.objectParam); + addProjectItem(cast(Object)a.objectParam); return true; case IDEActions.ProjectFolderRemoveItem: removeProjectItem(a.objectParam); @@ -1233,9 +1233,12 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL } - void addProjectItem(const Object obj) { + void addProjectItem(Object obj) { if (currentWorkspace is null) return; + if (obj is null && _wsPanel !is null) { + obj = _wsPanel.selectedProjectItem; + } Project project; ProjectFolder folder; if (cast(Project)obj) { diff --git a/src/dlangide/ui/wspanel.d b/src/dlangide/ui/wspanel.d index 958daea..5c5e59e 100644 --- a/src/dlangide/ui/wspanel.d +++ b/src/dlangide/ui/wspanel.d @@ -149,6 +149,17 @@ class WorkspacePanel : DockWindow { return _workspace; } + /// returns currently selected project item + @property ProjectItem selectedProjectItem() { + TreeItem ti = _tree.items.selectedItem; + if (!ti) + return null; + Object obj = ti.objectParam; + if (!obj) + return null; + return cast(ProjectItem)obj; + } + ProjectSourceFile findSourceFileItem(string filename, bool fullFileName=true) { if (_workspace) return _workspace.findSourceFileItem(filename, fullFileName); From 5c72e879c14981ebaee76cbff401dd2b83f28bee Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 8 Sep 2017 15:29:07 +0300 Subject: [PATCH 30/31] additional fix for #257 --- src/dlangide/ui/frame.d | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 6ae9f7c..6dac2b8 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -1233,11 +1233,14 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL } + /// add new file to project void addProjectItem(Object obj) { if (currentWorkspace is null) return; - if (obj is null && _wsPanel !is null) { + if (obj is null && _wsPanel !is null && !currentEditorSourceFile) { obj = _wsPanel.selectedProjectItem; + if (!obj) + obj = currentWorkspace.startupProject; } Project project; ProjectFolder folder; From 52c0818b492719706ae2e8267c2007ccc617e8f5 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 8 Sep 2017 15:56:09 +0300 Subject: [PATCH 31/31] fix #256 - crash on FindInFiles when there is no opened editor --- src/dlangide/ui/frame.d | 5 +++- src/dlangide/ui/searchPanel.d | 52 +++++++++++++++++++++++++++++------ views/VERSION | 2 +- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 6dac2b8..7f50928 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -1108,8 +1108,11 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL _logPanel.getTabs.selectTab("search"); if(searchPanel !is null) { searchPanel.focus(); - dstring selectedText = currentEditor.getSelectedText(); + dstring selectedText; + if (currentEditor) + selectedText = currentEditor.getSelectedText(); searchPanel.setSearchText(selectedText); + searchPanel.checkSearchMode(); } return true; case IDEActions.FileNewWorkspace: diff --git a/src/dlangide/ui/searchPanel.d b/src/dlangide/ui/searchPanel.d index 447baff..2d0d533 100644 --- a/src/dlangide/ui/searchPanel.d +++ b/src/dlangide/ui/searchPanel.d @@ -152,6 +152,8 @@ class SearchWidget : TabWidget { SearchLogWidget _resultLog; int _resultLogMatchIndex; ComboBox _searchScope; + ImageCheckButton _cbCaseSensitive; + ImageCheckButton _cbWholeWords; protected IDEFrame _frame; protected SearchMatchList[] _matchedList; @@ -206,6 +208,18 @@ class SearchWidget : TabWidget { _searchScope = new ComboBox("searchScope", ["File"d, "Project"d, "Dependencies"d, "Everywhere"d]); _searchScope.selectedItemIndex = 0; _layout.addChild(_searchScope); + + _cbCaseSensitive = new ImageCheckButton("cbCaseSensitive", "find_case_sensitive"); + _cbCaseSensitive.tooltipText = "EDIT_FIND_CASE_SENSITIVE"; + _cbCaseSensitive.styleId = "TOOLBAR_BUTTON"; + _cbCaseSensitive.checked = true; + _layout.addChild(_cbCaseSensitive); + + _cbWholeWords = new ImageCheckButton("cbWholeWords", "find_whole_words"); + _cbWholeWords.tooltipText = "EDIT_FIND_WHOLE_WORDS"; + _cbWholeWords.styleId = "TOOLBAR_BUTTON"; + _layout.addChild(_cbWholeWords); + addChild(_layout); _resultLog = new SearchLogWidget("SearchLogWidget"); @@ -250,9 +264,11 @@ class SearchWidget : TabWidget { switch (_searchScope.text) { case "File": - SearchMatchList match = findMatches(_frame.currentEditor.filename, source); - if(match.matches.length > 0) - _matchedList ~= match; + if (_frame.currentEditor) { + SearchMatchList match = findMatches(_frame.currentEditor.filename, source); + if(match.matches.length > 0) + _matchedList ~= match; + } break; case "Project": foreach(Project project; _frame._wsPanel.workspace.projects) { @@ -302,23 +318,41 @@ class SearchWidget : TabWidget { } super.onDraw(buf); } - + + void checkSearchMode() { + if (!_frame.currentEditor && _searchScope.selectedItemIndex == 0) + _searchScope.selectedItemIndex = 1; + } + + uint makeSearchFlags() { + uint res = 0; + if (_cbCaseSensitive.checked) + res |= TextSearchFlag.CaseSensitive; + if (_cbWholeWords.checked) + res |= TextSearchFlag.WholeWords; + return res; + } + //Find the match/matchList that corrosponds to the line in _resultLog bool onMatchClick(int line) { line++; foreach(matchList; _matchedList){ line--; if (line == 0) { - _frame.openSourceFile(matchList.filename); - _frame.currentEditor.setFocus(); + if (_frame.openSourceFile(matchList.filename)) { + _frame.currentEditor.setTextToHighlight(_findText.text, makeSearchFlags); + _frame.currentEditor.setFocus(); + } return true; } foreach(match; matchList.matches) { line--; if (line == 0) { - _frame.openSourceFile(matchList.filename); - _frame.currentEditor.setCaretPos(match.line, to!int(match.col)); - _frame.currentEditor.setFocus(); + if (_frame.openSourceFile(matchList.filename)) { + _frame.currentEditor.setCaretPos(match.line, to!int(match.col)); + _frame.currentEditor.setTextToHighlight(_findText.text, makeSearchFlags); + _frame.currentEditor.setFocus(); + } return true; } } diff --git a/views/VERSION b/views/VERSION index f7c7422..758f9c1 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.70 \ No newline at end of file +v0.7.71 \ No newline at end of file