diff options
Diffstat (limited to 'GUI')
| -rw-r--r-- | GUI/.gitignore | 2 | ||||
| -rw-r--r-- | GUI/GUI/.gitignore | 5 | ||||
| -rw-r--r-- | GUI/GUI/GUI.sln | 31 | ||||
| -rw-r--r-- | GUI/GUI/GUI/.gitignore | 3 | ||||
| -rw-r--r-- | GUI/GUI/GUI/GUI.vcxproj | 146 | ||||
| -rw-r--r-- | GUI/GUI/GUI/GUI.vcxproj.filters | 27 | ||||
| -rw-r--r-- | GUI/GUI/GUI/GUI.vcxproj.user | 4 | ||||
| -rw-r--r-- | GUI/GUI/GUI/ScopeGuard.h | 32 | ||||
| -rw-r--r-- | GUI/GUI/GUI/main.cpp | 82 | ||||
| -rw-r--r-- | GUI/Libraries/.gitignore | 3 | ||||
| -rw-r--r-- | GUI/Libraries/fetch.sh | 14 | ||||
| -rw-r--r-- | GUI/README.md | 11 | ||||
| -rw-r--r-- | GUI/package.ps1 | 11 |
13 files changed, 371 insertions, 0 deletions
diff --git a/GUI/.gitignore b/GUI/.gitignore new file mode 100644 index 0000000..f327245 --- /dev/null +++ b/GUI/.gitignore @@ -0,0 +1,2 @@ +# ignore generated package directory +TaSTT diff --git a/GUI/GUI/.gitignore b/GUI/GUI/.gitignore new file mode 100644 index 0000000..7082b1d --- /dev/null +++ b/GUI/GUI/.gitignore @@ -0,0 +1,5 @@ +# Don't check in build artifacts +x64 +x86 +# Ignore visual studio cruft +.vs diff --git a/GUI/GUI/GUI.sln b/GUI/GUI/GUI.sln new file mode 100644 index 0000000..5ef5534 --- /dev/null +++ b/GUI/GUI/GUI.sln @@ -0,0 +1,31 @@ +
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33122.133
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUI", "GUI\GUI.vcxproj", "{E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}.Debug|x64.ActiveCfg = Debug|x64
+ {E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}.Debug|x64.Build.0 = Debug|x64
+ {E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}.Debug|x86.ActiveCfg = Debug|Win32
+ {E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}.Debug|x86.Build.0 = Debug|Win32
+ {E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}.Release|x64.ActiveCfg = Release|x64
+ {E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}.Release|x64.Build.0 = Release|x64
+ {E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}.Release|x86.ActiveCfg = Release|Win32
+ {E17AD8B1-0565-459B-B8D0-2024CC6C5CD4}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {FA0FE5DA-8B30-47E0-9715-792C7CA1D5F8}
+ EndGlobalSection
+EndGlobal
diff --git a/GUI/GUI/GUI/.gitignore b/GUI/GUI/GUI/.gitignore new file mode 100644 index 0000000..86c78ae --- /dev/null +++ b/GUI/GUI/GUI/.gitignore @@ -0,0 +1,3 @@ +# Don't check in build artifacts +x64 +x86 diff --git a/GUI/GUI/GUI/GUI.vcxproj b/GUI/GUI/GUI/GUI.vcxproj new file mode 100644 index 0000000..e97523c --- /dev/null +++ b/GUI/GUI/GUI/GUI.vcxproj @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>16.0</VCProjectVersion>
+ <Keyword>Win32Proj</Keyword>
+ <ProjectGuid>{e17ad8b1-0565-459b-b8d0-2024cc6c5cd4}</ProjectGuid>
+ <RootNamespace>GUI</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\..\Libraries\wx\wxwidgets.props" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\..\Libraries\wx\wxwidgets.props" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\..\Libraries\wx\wxwidgets.props" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="..\..\Libraries\wx\wxwidgets.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpp20</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpp20</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpp20</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpp20</LanguageStandard>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="main.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="ScopeGuard.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/GUI/GUI/GUI/GUI.vcxproj.filters b/GUI/GUI/GUI/GUI.vcxproj.filters new file mode 100644 index 0000000..beb1941 --- /dev/null +++ b/GUI/GUI/GUI/GUI.vcxproj.filters @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="main.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="ScopeGuard.h">
+ <Filter>Source Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/GUI/GUI/GUI/GUI.vcxproj.user b/GUI/GUI/GUI/GUI.vcxproj.user new file mode 100644 index 0000000..0f14913 --- /dev/null +++ b/GUI/GUI/GUI/GUI.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup />
+</Project>
\ No newline at end of file diff --git a/GUI/GUI/GUI/ScopeGuard.h b/GUI/GUI/GUI/ScopeGuard.h new file mode 100644 index 0000000..601061c --- /dev/null +++ b/GUI/GUI/GUI/ScopeGuard.h @@ -0,0 +1,32 @@ +#pragma once
+
+#include <functional>
+#include <utility>
+
+class ScopeGuard {
+public:
+ ScopeGuard(std::function<void()>&& cb) : cb_(std::move(cb)), active_(true) {}
+ ~ScopeGuard() {
+ Invoke();
+ }
+
+ ScopeGuard() = delete;
+ ScopeGuard(ScopeGuard&) = delete;
+ ScopeGuard(const ScopeGuard&) = delete;
+ ScopeGuard(ScopeGuard&&) = delete;
+ ScopeGuard& operator=(ScopeGuard&) = delete;
+ ScopeGuard& operator=(const ScopeGuard&) = delete;
+
+ void Cancel() { active_ = false; }
+
+ void Invoke() {
+ if (active_) {
+ cb_();
+ active_ = false;
+ }
+ }
+
+private:
+ const std::function<void()> cb_;
+ bool active_;
+};
diff --git a/GUI/GUI/GUI/main.cpp b/GUI/GUI/GUI/main.cpp new file mode 100644 index 0000000..c2e0222 --- /dev/null +++ b/GUI/GUI/GUI/main.cpp @@ -0,0 +1,82 @@ +// wxWidgets "Hello World" Program
+
+#include <wx/wxprec.h>
+
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include "ScopeGuard.h"
+
+#include <filesystem>
+
+class MyApp : public wxApp
+{
+public:
+ virtual bool OnInit();
+};
+
+class MyFrame : public wxFrame
+{
+public:
+ MyFrame();
+
+private:
+ wxPNGHandler png_handler_;
+
+ void OnHello(wxCommandEvent& event);
+ void OnExit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+};
+
+enum
+{
+ ID_Hello = 1
+};
+
+wxIMPLEMENT_APP(MyApp);
+
+bool MyApp::OnInit()
+{
+ MyFrame* frame = new MyFrame();
+ frame->Show(true);
+
+ return true;
+}
+
+MyFrame::MyFrame()
+ : wxFrame(nullptr, wxID_ANY, "TaSTT")
+{
+ Bind(wxEVT_MENU, &MyFrame::OnHello, this, ID_Hello);
+ Bind(wxEVT_MENU, &MyFrame::OnAbout, this, wxID_ABOUT);
+ Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
+
+ // wx needs this to be able to load PNGs.
+ wxImage::AddHandler(&png_handler_);
+
+ const std::string logo_path = "Resources/logo.png";
+ if (!std::filesystem::exists(logo_path)) {
+ wxLogFatalError("Logo is missing from %s", logo_path.c_str());
+ }
+ wxBitmap icon_img("Resources/logo.png", wxBITMAP_TYPE_PNG);
+ wxIcon icon;
+ icon.CopyFromBitmap(icon_img);
+ SetIcon(icon);
+}
+
+void MyFrame::OnExit(wxCommandEvent& event)
+{
+ Close(true);
+}
+
+void MyFrame::OnAbout(wxCommandEvent& event)
+{
+ wxMessageBox("This is a wxWidgets Hello World example",
+ "About Hello World", wxOK | wxICON_INFORMATION);
+}
+
+void MyFrame::OnHello(wxCommandEvent& event)
+{
+ //wxLogMessage("Hello world from wxWidgets!");
+}
+
diff --git a/GUI/Libraries/.gitignore b/GUI/Libraries/.gitignore new file mode 100644 index 0000000..214bffb --- /dev/null +++ b/GUI/Libraries/.gitignore @@ -0,0 +1,3 @@ +# Don't check in anything we fetch +wx + diff --git a/GUI/Libraries/fetch.sh b/GUI/Libraries/fetch.sh new file mode 100644 index 0000000..dcf096c --- /dev/null +++ b/GUI/Libraries/fetch.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -o errexit +set -o xtrace + +WX_3_2_1_URL=https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.1/wxWidgets-3.2.1.zip +WX_URL=$WX_3_2_1_URL + +mkdir wx +pushd wx >/dev/null +wget $WX_URL +unzip $(basename $WX_URL) +popd >/dev/null + diff --git a/GUI/README.md b/GUI/README.md new file mode 100644 index 0000000..51440a0 --- /dev/null +++ b/GUI/README.md @@ -0,0 +1,11 @@ +## Build instructions + +0. Open WSL. +1. Execute Libraries/fetch.sh. +2. Install Visual Studio 2022. +3. Open Libraries/wx/build/msw/wx_vc17.sln with Visual Studio 2022. +4. Build x64/Release. +5. Open GUI/GUI.sln with Visual Studio 2022. +6. Build x64/Release. +7. Run package.ps1 from powershell. + diff --git a/GUI/package.ps1 b/GUI/package.ps1 new file mode 100644 index 0000000..639848d --- /dev/null +++ b/GUI/package.ps1 @@ -0,0 +1,11 @@ +$install_dir = "TaSTT"
+
+if (Test-Path $install_dir) {
+ rm -Recurse $install_dir
+}
+
+mkdir $install_dir > $null
+mkdir $install_dir/Resources > $null
+cp ../Images/logo.png TaSTT/Resources
+cp GUI/x64/Release/GUI.exe TaSTT/TaSTT.exe
+
|
