mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-25 02:58:02 +02:00
Embedded console / terminal support
This commit is contained in:
parent
60817eec48
commit
20a8e3327c
28 changed files with 2317 additions and 690 deletions
File diff suppressed because it is too large
Load diff
|
@ -332,7 +332,7 @@ namespace IDE.ui
|
|||
var envBlock = scope List<char8>();
|
||||
Environment.EncodeEnvironmentVariables(envVars, envBlock);
|
||||
|
||||
if (!gApp.mDebugger.OpenFile(targetPath, targetPath, arguments, workingDir, envBlock, false, false))
|
||||
if (!gApp.mDebugger.OpenFile(targetPath, targetPath, arguments, workingDir, envBlock, false, false, .None))
|
||||
{
|
||||
gApp.Fail(scope String()..AppendF("Unable to open executable for debugging: {0}", targetPath));
|
||||
return;
|
||||
|
|
|
@ -2991,7 +2991,7 @@ namespace IDE.ui
|
|||
}
|
||||
});
|
||||
|
||||
item = folderItem.AddItem("Terminal");
|
||||
item = folderItem.AddItem("External Terminal");
|
||||
item.mOnMenuItemSelected.Add(new (menu) =>
|
||||
{
|
||||
let projectItem = GetSelectedProjectItem();
|
||||
|
@ -3023,6 +3023,34 @@ namespace IDE.ui
|
|||
process.Start(psi).IgnoreError();
|
||||
}
|
||||
});
|
||||
|
||||
item = folderItem.AddItem("Embedded Terminal");
|
||||
item.mOnMenuItemSelected.Add(new (menu) =>
|
||||
{
|
||||
let projectItem = GetSelectedProjectItem();
|
||||
String path = scope String();
|
||||
if (projectItem == null)
|
||||
{
|
||||
path.Set(gApp.mWorkspace.mDir);
|
||||
}
|
||||
else if (let projectFolder = projectItem as ProjectFolder)
|
||||
{
|
||||
if (projectFolder.mParentFolder == null)
|
||||
{
|
||||
path.Set(projectFolder.mProject.mProjectDir);
|
||||
}
|
||||
else
|
||||
projectFolder.GetFullImportPath(path);
|
||||
}
|
||||
else
|
||||
projectItem.mParentFolder.GetFullImportPath(path);
|
||||
|
||||
if (!path.IsWhiteSpace)
|
||||
{
|
||||
gApp.ShowTerminal();
|
||||
gApp.mTerminalPanel.OpenDirectory(path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (projectItem == null)
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace IDE.ui
|
|||
AddCategoryItem(root, "Compiler");
|
||||
AddCategoryItem(root, "Debugger");
|
||||
AddCategoryItem(root, "Visual Studio");
|
||||
AddCategoryItem(root, "Terminal");
|
||||
AddCategoryItem(root, "Console");
|
||||
AddCategoryItem(root, "Wasm");
|
||||
|
||||
if (!gApp.mSettings.mVSSettings.IsConfigured())
|
||||
|
@ -170,7 +170,7 @@ namespace IDE.ui
|
|||
category.Open(true, true);
|
||||
}
|
||||
|
||||
void PopulateTerminalOptions()
|
||||
void PopulateConsoleOptions()
|
||||
{
|
||||
mCurPropertiesTarget = gApp.mSettings;
|
||||
|
||||
|
@ -179,6 +179,8 @@ namespace IDE.ui
|
|||
category.mIsBold = true;
|
||||
category.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, cHeaderColor);
|
||||
AddPropertiesItem(category, "Windows Terminal", "mWindowsTerminal");
|
||||
AddPropertiesItem(category, "Debug Console", "mDebugConsoleKind");
|
||||
AddPropertiesItem(category, "Always Enable Console", "mAlwaysEnableConsole");
|
||||
category.Open(true, true);
|
||||
}
|
||||
|
||||
|
@ -438,7 +440,7 @@ namespace IDE.ui
|
|||
case .VisualStudio:
|
||||
PopulateVSOptions();
|
||||
case .Terminal:
|
||||
PopulateTerminalOptions();
|
||||
PopulateConsoleOptions();
|
||||
case .Wasm:
|
||||
PopulateWasmOptions();
|
||||
default:
|
||||
|
|
|
@ -10,15 +10,51 @@ using Beefy.widgets;
|
|||
using Beefy.events;
|
||||
using System.Diagnostics;
|
||||
using Beefy.utils;
|
||||
using IDE.util;
|
||||
|
||||
namespace IDE.ui;
|
||||
|
||||
class TerminalPanel : Panel
|
||||
class TerminalPanel : ConsolePanel
|
||||
{
|
||||
public override void Serialize(StructuredData data)
|
||||
{
|
||||
base.Serialize(data);
|
||||
|
||||
data.Add("Type", "TerminalPanel");
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
var consoleProvider = new BeefConConsoleProvider();
|
||||
consoleProvider.mBeefConExePath = new $"{gApp.mInstallDir}/BeefCon.exe";
|
||||
consoleProvider.mTerminalExe = new .(gApp.mSettings.mWindowsTerminal);
|
||||
|
||||
mConsoleProvider = consoleProvider;
|
||||
}
|
||||
|
||||
public override void AddedToParent()
|
||||
{
|
||||
var consoleProvider = (BeefConConsoleProvider)mConsoleProvider;
|
||||
consoleProvider.mTerminalExe.Set(gApp.mSettings.mWindowsTerminal);
|
||||
consoleProvider.mWorkingDir.Set(gApp.mWorkspace.mDir);
|
||||
mConsoleProvider.Attach();
|
||||
}
|
||||
|
||||
public override void RemovedFromParent(Widget previousParent, WidgetWindow window)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void OpenDirectory(StringView path)
|
||||
{
|
||||
var consoleProvider = (BeefConConsoleProvider)mConsoleProvider;
|
||||
consoleProvider.mWorkingDir.Set(path);
|
||||
consoleProvider.Detach();
|
||||
consoleProvider.Attach();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue