Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #469

Merged
merged 46 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
52b0cea
Wordpress: Enabled terminal output rendering
webmaster442 Jun 5, 2024
01052a6
GUI: Exception when using check for updates
webmaster442 Jun 12, 2024
dd68e98
Exception during shell init, when terminal profile is not installed
webmaster442 Jun 12, 2024
033ab5f
Reworked CDG command
webmaster442 Jun 12, 2024
612d142
Reworked CDG command
webmaster442 Jun 12, 2024
9b9a879
Reworked CDG command
webmaster442 Jun 12, 2024
4c90df7
CDG selector update
webmaster442 Jun 15, 2024
7548c62
WIP: Scripting support
webmaster442 Jun 16, 2024
9346eb4
Scripting extension
webmaster442 Jun 17, 2024
fb34a83
Scripting extension
webmaster442 Jun 17, 2024
004af93
Scripting extension
webmaster442 Jun 17, 2024
73a61dc
Remove shortcodes folder
webmaster442 Jun 18, 2024
0d16303
Preparation work for new command
webmaster442 Jun 18, 2024
ca8e51f
Basic implementation of new command
webmaster442 Jun 18, 2024
0cedc82
New command documentation
webmaster442 Jun 18, 2024
fb757c8
Updated dependencies
webmaster442 Jun 18, 2024
bf11a45
Issue fix in git autocomplete
webmaster442 Jun 19, 2024
781cbf2
Bugfix in math2svg
webmaster442 Jun 24, 2024
66ec17e
Work on formula editor
webmaster442 Jun 24, 2024
2a470a2
Basic editor logic
webmaster442 Jun 24, 2024
1a56812
Command bindings
webmaster442 Jun 24, 2024
dfdc309
Renderer
webmaster442 Jun 24, 2024
592e8d8
Error display and Some layout change
webmaster442 Jun 24, 2024
a7a67b4
Document state management and rendering
webmaster442 Jun 25, 2024
0f766d6
Render command
webmaster442 Jun 25, 2024
06c4b14
Async dialogs
webmaster442 Jun 25, 2024
2085874
Export all function
webmaster442 Jun 25, 2024
a0531d9
Linux build script adjustment
webmaster442 Jun 25, 2024
219f809
Added headers for code in Formula editor
webmaster442 Jun 25, 2024
c878885
Formula edit: Save before exit
webmaster442 Jun 25, 2024
8f8ef2a
XML based formula file
webmaster442 Jun 26, 2024
4cbf77e
Usability improvements in formula edit
webmaster442 Jun 26, 2024
3279897
Fixes SVG size when rendering
webmaster442 Jun 26, 2024
396201c
Rendering count starts from one
webmaster442 Jun 26, 2024
b14de7c
Branding: Remove old
webmaster442 Jun 26, 2024
d28c5ed
New icons
webmaster442 Jun 26, 2024
a7e082c
Branding: new icons usage
webmaster442 Jun 26, 2024
c74d24d
Setup branding update
webmaster442 Jun 26, 2024
6ee351c
Windows publish script update
webmaster442 Jun 26, 2024
211da72
Windows publish script fixes
webmaster442 Jun 26, 2024
fbe541e
Web setup: removed, only ISO will be built for windows
webmaster442 Jul 7, 2024
113dbde
Publish script: bundle nodejs
webmaster442 Jul 7, 2024
e41fb9b
BookGenShell?: NodeJs integration
webmaster442 Jul 7, 2024
1c28d32
Node.js integration fixes
webmaster442 Jul 7, 2024
6368df7
Shell: Changed git output
webmaster442 Jul 21, 2024
e057ead
Updated dependencies
webmaster442 Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_prefer_primary_constructors = true:suggestion

#### Naming styles ####
[*.{cs,vb}]
Expand Down Expand Up @@ -373,4 +374,5 @@ tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion

2 changes: 1 addition & 1 deletion .github/releases.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
👁‍🗨 Change: Removed ZIP format release
👁‍🗨 Change: Folder locking is now process based
👁‍🗨 Change: Improved stat command
👁‍🗨 Change: HTTP server has favicons & last acces time is sent in header
👁‍🗨 Change: HTTP server has favicons & last acces time is sent in header
👁‍🗨 Change: Replaces File based folder locking wiht a process based one
👁‍🗨 Change: Auto updater removed, because of multiple platform issues
👁‍🗨 Change: Launcher file browser usability improvements
Expand Down
7 changes: 7 additions & 0 deletions BookGen.sln
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.Settings", "Libs\Bo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.RenderEngine", "Libs\BookGen.RenderEngine\BookGen.RenderEngine.csproj", "{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.FormulaEdit", "Prog\BookGen.FormulaEdit\BookGen.FormulaEdit.csproj", "{C03D39B0-697B-4A51-AEF8-BFE094A45F4F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -138,6 +140,10 @@ Global
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177}.Release|Any CPU.Build.0 = Release|Any CPU
{C03D39B0-697B-4A51-AEF8-BFE094A45F4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C03D39B0-697B-4A51-AEF8-BFE094A45F4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C03D39B0-697B-4A51-AEF8-BFE094A45F4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C03D39B0-697B-4A51-AEF8-BFE094A45F4F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -161,6 +167,7 @@ Global
{985728E4-6353-44A1-87BB-77BF366A5977} = {05B69A0E-343B-4E7C-B77B-24E84B57D5D2}
{B1905B26-0649-4911-BA5F-9781BBC3D3E2} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
{4E7C4D96-32DD-4E72-8B28-F4DCDB74E177} = {9C47BBFF-ACD8-40D8-9FB1-A3FA524B27C4}
{C03D39B0-697B-4A51-AEF8-BFE094A45F4F} = {05B69A0E-343B-4E7C-B77B-24E84B57D5D2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {772515BA-79D4-4C5D-AF16-29DE649EC13E}
Expand Down
146 changes: 140 additions & 6 deletions BookGenShell.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,112 @@
# -----------------------------------------------------------------------------
# BookGen PowerShell Registration script
# Version 2.9.0
# Last modified: 2024-05-20
# Version 3.0
# Last modified: 2024-07-21
# -----------------------------------------------------------------------------

# NodeJS install test
function Test-NodeJs
{
try
{
# Try to get the node version
$nodeVersion = node --version
if ($nodeVersion)
{
return $true
}
}
catch
{
return $false
}
}

# Node commands

function Get-NodePath
{
try
{
$nodePath = (Get-Command node.exe -ErrorAction Stop).Source
$nodeDir = Split-Path $nodePath
return $nodeDir
}
catch
{
Write-Error "node.exe not found in the system PATH."
}
}

function npm {
param (
[string[]]$Args
)

$scriptPath = Get-NodePath
$nodeExe = Join-Path $scriptPath "node.exe"

if (-Not (Test-Path $nodeExe))
{
$nodeExe = "node"
}

$npmPrefixJs = Join-Path $scriptPath "node_modules/npm/bin/npm-prefix.js"
$npmCliJs = Join-Path $scriptPath "node_modules/npm/bin/npm-cli.js"

$npmPrefixNpmCliJs = & $nodeExe $npmPrefixJs
$npmPrefixNpmCliJsPath = Join-Path $npmPrefixNpmCliJs "node_modules/npm/bin/npm-cli.js"

if (Test-Path $npmPrefixNpmCliJsPath)
{
$npmCliJs = $npmPrefixNpmCliJsPath
}

& $nodeExe $npmCliJs @Args
}

function npx {
param (
[string[]]$Args
)

$scriptPath = Get-NodePath
$nodeExe = Join-Path $scriptPath "node.exe"

if (-Not (Test-Path $nodeExe)) {
$nodeExe = "node"
}

$npmPrefixJs = Join-Path $scriptPath "node_modules/npm/bin/npm-prefix.js"
$npxCliJs = Join-Path $scriptPath "node_modules/npm/bin/npx-cli.js"

$npmPrefixNpxCliJsPath = & $nodeExe $npmPrefixJs
$npmPrefixNpxCliJs = Join-Path $npmPrefixNpxCliJsPath "node_modules/npm/bin/npx-cli.js"

if (Test-Path $npmPrefixNpxCliJs) {
$npxCliJs = $npmPrefixNpxCliJs
}

& $nodeExe $npxCliJs @Args
}

function corepack {
param (
[string[]]$Args
)

$scriptPath = Get-NodePath
$nodeExe = Join-Path $scriptPath "node.exe"
$corepackJs = Join-Path $scriptPath "node_modules/corepack/dist/corepack.js"

if (Test-Path $nodeExe) {
& $nodeExe $corepackJs @Args
} else {
$env:PATHEXT = $env:PATHEXT -replace ";.JS;", ";"
& node $corepackJs @Args
}
}

# cdg command
function cdg
{
Expand Down Expand Up @@ -80,14 +183,22 @@ function intro()
Write-Host " .( o )."

Bookgen.exe terminalinstall -t
if ($LastExitCode -eq 0) {
if ($LastExitCode -eq 0)
{
Bookgen.exe terminalinstall -c
if ($LastExitCode -ne 0) {
if ($LastExitCode -ne 0)
{
Write-Host ""
Write-Host "To install this shell as a windows terminal profile run:";
Write-Host "Bookgen terminalinstall"
}
}
}

if (Test-NodeJs)
{
$nodeVersion = node --version
Write-Host "Node version: $nodeVersion"
}
}

#Set UTF8 encoding
Expand All @@ -100,6 +211,24 @@ $env:BookGenPath = $PSScriptRoot
# register scripts folder to the path
$env:Path += ";$PSScriptRoot"

if (-not (Test-NodeJs)) {
#check if it's bundled
$nodeDirs = Get-ChildItem -Path $PSScriptRoot -Directory | Where-Object { $_.Name -like "node-*" }
foreach ($dir in $nodeDirs)
{
$nodePath = Join-Path -Path $dir.FullName -ChildPath "node.exe"
if (Test-Path -Path $nodePath)
{
$env:NodeJsDir = "$($dir.FullName)"
$env:NodeExe = $nodePath

$env:Path += ";$($dir.FullName)"
Write-Host "Added $($dir.FullName) to PATH."
break
}
}
}

# set colors
Set-PSReadLineOption -Colors @{
Parameter = 'Red'
Expand Down Expand Up @@ -141,7 +270,12 @@ Register-ArgumentCompleter -Native -CommandName git -ScriptBlock {
# set prompt
function prompt {
$git = $(BookGen.Shell.exe "prompt" $(Get-Location).Path)
'PS ' + $(Get-Location) + ' '+$git+ $(if ($NestedPromptLevel -ge 1) { '>>' }) + ' > '
if (-not [string]::IsNullOrWhiteSpace($git)) {
'PS ' + $(Get-Location) + "`n"+$git+ $(if ($NestedPromptLevel -ge 1) { '>>' }) + ' > '
}
else {
'PS ' + $(Get-Location) + $(if ($NestedPromptLevel -ge 1) { '>>' }) + ' > '
}
}


Expand Down
16 changes: 16 additions & 0 deletions Bootstrappers/BookGen.FormulaEdit/BookGen.FormulaEdit.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net4.8</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<OutputPath>..\..\bin\bootstaper\$(Configuration)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ApplicationIcon>..\..\Branding\icon-formulaedit.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Bookgen.Win\Bookgen.Win.csproj" />
</ItemGroup>

</Project>
34 changes: 34 additions & 0 deletions Bootstrappers/BookGen.FormulaEdit/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
//-----------------------------------------------------------------------------
// (c) 2023 Ruzsinszki Gábor
// This code is licensed under MIT license (see LICENSE for details)
//-----------------------------------------------------------------------------

using Bookgen.Win;

namespace BookGen.Launcher
{
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main(string[] args)
{
ExceptionHandler.Try(() =>
{
InstallVerify.ThrowIfNotExist();
using (var process =
new ProcessBuilder()
.SetProgram(AppDomain.CurrentDomain.BaseDirectory, Constants.DataFolder, Constants.BookGenFormulaEditor)
.SetWorkDir(AppDomain.CurrentDomain.BaseDirectory, Constants.DataFolder)
.SetArguments(args)
.Build())
{
process.Start();
}
});
}
}
}
2 changes: 1 addition & 1 deletion Bootstrappers/BookGen.Launcher/BookGen.Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWindowsForms>true</UseWindowsForms>
<OutputPath>..\..\bin\bootstaper\$(Configuration)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ApplicationIcon>..\..\Icon.ico</ApplicationIcon>
<ApplicationIcon>..\..\Branding\icon-laucher.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Bootstrappers/BookGen/BookGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWindowsForms>true</UseWindowsForms>
<OutputPath>..\..\bin\bootstaper\$(Configuration)\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ApplicationIcon>..\..\Icon.ico</ApplicationIcon>
<ApplicationIcon>..\..\Branding\icon-bookgen.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Bootstrappers/Bookgen.Win/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static class Constants
{
public const string BookGen = "BookGen.exe";
public const string BookGenLauncher = "BookGen.Launcher.exe";
public const string BookGenFormulaEditor = "BookGen.FormulaEdit.exe";
public const string DataFolder = "Data";
public const string WindowsTerminal = "wt.exe";
public const string PowershellCore = "pwsh.exe";
Expand Down
2 changes: 0 additions & 2 deletions Bootstrappers/Bookgen.Win/ProcessBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
using System.IO;
using System.Linq;

using Bookgen.Win.Properties;

namespace Bookgen.Win
{
public sealed class ProcessBuilder
Expand Down
2 changes: 1 addition & 1 deletion Bootstrappers/Bookgen.Win/Try.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void Try(Action action)
catch (Exception ex)
{
#if DEBUG
Debug.WriteLine(ex);
Trace.TraceError(ex.Message);
#endif
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Expand Down
6 changes: 6 additions & 0 deletions Bootstrappers/Bootstrappers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.Launcher", "BookGen
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bookgen.Win", "Bookgen.Win\Bookgen.Win.csproj", "{9832DC6D-3F44-4221-BB59-2FF64D650C56}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BookGen.FormulaEdit", "BookGen.FormulaEdit\BookGen.FormulaEdit.csproj", "{9C1A7AB7-8703-4CAD-8A7E-13A753F25778}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -27,6 +29,10 @@ Global
{9832DC6D-3F44-4221-BB59-2FF64D650C56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9832DC6D-3F44-4221-BB59-2FF64D650C56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9832DC6D-3F44-4221-BB59-2FF64D650C56}.Release|Any CPU.Build.0 = Release|Any CPU
{9C1A7AB7-8703-4CAD-8A7E-13A753F25778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C1A7AB7-8703-4CAD-8A7E-13A753F25778}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C1A7AB7-8703-4CAD-8A7E-13A753F25778}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C1A7AB7-8703-4CAD-8A7E-13A753F25778}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 8 additions & 0 deletions Branding/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
icon-laucher.ico filter=lfs diff=lfs merge=lfs -text
icon-shell.ico filter=lfs diff=lfs merge=lfs -text
icon-bookgen.ico filter=lfs diff=lfs merge=lfs -text
icon-formulaedit.ico filter=lfs diff=lfs merge=lfs -text
icon-bookgen.png filter=lfs diff=lfs merge=lfs -text
icon-formulaedit.png filter=lfs diff=lfs merge=lfs -text
icon-launcher.png filter=lfs diff=lfs merge=lfs -text
icon-shell.png filter=lfs diff=lfs merge=lfs -text
Binary file added Branding/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading