diff options
author | Norbert Preining <norbert@preining.info> | 2020-10-17 03:01:01 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-10-17 03:01:01 +0000 |
commit | 683b627ec089f4ddb05f06b1e93ee368189f78a4 (patch) | |
tree | 7a6ef1c8a2545a0d181cb890cc8611610263b8f5 /dviware/dvivue/DVIVue | |
parent | d8395db550c4f6044f0f3586bbc5263f06444598 (diff) |
CTAN sync 202010170301
Diffstat (limited to 'dviware/dvivue/DVIVue')
-rw-r--r-- | dviware/dvivue/DVIVue/DVIVue.cpp | 643 | ||||
-rw-r--r-- | dviware/dvivue/DVIVue/DVIVue.h | 3 | ||||
-rw-r--r-- | dviware/dvivue/DVIVue/DVIVue.ico | bin | 0 -> 46227 bytes | |||
-rw-r--r-- | dviware/dvivue/DVIVue/DVIVue.rc | bin | 0 -> 8192 bytes | |||
-rw-r--r-- | dviware/dvivue/DVIVue/DVIVue.vcxproj | 172 | ||||
-rw-r--r-- | dviware/dvivue/DVIVue/DVIVue.vcxproj.filters | 52 | ||||
-rw-r--r-- | dviware/dvivue/DVIVue/DVIVue.vcxproj.user | 23 | ||||
-rw-r--r-- | dviware/dvivue/DVIVue/framework.h | 26 | ||||
-rw-r--r-- | dviware/dvivue/DVIVue/packages.config | 5 | ||||
-rw-r--r-- | dviware/dvivue/DVIVue/resource.h | 35 | ||||
-rw-r--r-- | dviware/dvivue/DVIVue/small.ico | bin | 0 -> 46227 bytes | |||
-rw-r--r-- | dviware/dvivue/DVIVue/targetver.h | 6 |
12 files changed, 965 insertions, 0 deletions
diff --git a/dviware/dvivue/DVIVue/DVIVue.cpp b/dviware/dvivue/DVIVue/DVIVue.cpp new file mode 100644 index 0000000000..6da6b14112 --- /dev/null +++ b/dviware/dvivue/DVIVue/DVIVue.cpp @@ -0,0 +1,643 @@ +// DVIVue.cpp : Defines the entry point for the application. +// + +/* + + DVIVue: A viewer for DVI files and frontend for dvipdfmx. + Copyright (c) 2020 by Peter Frane Jr. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + + + + The author may be contacted via the e-mail address pfranejr@hotmail.com + + Please refer to the following URL for further instructions on how to download + the packages required by WebView2: + +*/ + + +#include "framework.h" +#include "DVIVue.h" +#include <wchar.h> +#include <shlwapi.h> + +using namespace std; + +#pragma comment(lib, "Shlwapi.lib") + +#define MAX_LOADSTRING 100 + +using namespace Microsoft::WRL; +//using namespace std; + +// Global Variables: +HINSTANCE hInst; // current instance +WCHAR szTitle[MAX_LOADSTRING]; // The title bar text +WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name + +// Pointer to WebViewController +static wil::com_ptr<ICoreWebView2Controller> webviewController; + +// Pointer to WebView window +static wil::com_ptr<ICoreWebView2> webviewWindow; +static wil::com_ptr <ICoreWebView2Environment> webEnvironment; +char log_file[MAX_PATH + 1]{ 0 }; + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE hInstance); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); +void resize_window(HWND hWnd); +void process_command_line(HWND hWnd); +int on_create(HWND hWnd); +bool create_environment(HWND hWnd); +bool file_exists(const char* filename); + +int APIENTRY wWinMain(_In_ HINSTANCE hInstance, + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPWSTR lpCmdLine, + _In_ int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // TODO: Place code here. + + // Initialize global strings + LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadStringW(hInstance, IDC_DVIVUE, szWindowClass, MAX_LOADSTRING); + MyRegisterClass(hInstance); + + // Perform application initialization: + if (!InitInstance (hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_DVIVUE)); + + MSG msg; + + // Main message loop: + while (GetMessage(&msg, nullptr, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return (int) msg.wParam; +} + + + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASSEXW wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DVIVUE)); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_DVIVUE); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + return RegisterClassExW(&wcex); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + hInst = hInstance; // Store instance handle in our global variable + + HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + if (!create_environment(hWnd)) + { + DestroyWindow(hWnd); + + return FALSE; + } + return TRUE; +} + + +bool create_environment(HWND hWnd) +{ + HRESULT hr; + wchar_t temp_path[MAX_PATH + 1]{ 0 }; + + if (GetTempPath(MAX_PATH, temp_path) == 0) + { + MessageBox(hWnd, L"Unable to obtain the TEMP path", L"Internal Error", MB_OK); + + return false; + } + + // To use a fixed version of WebView2, + // pass the folder name of the WebView2 runtime as the first parameter of CreateCoreWebView2EnvironmentWithOptions; + // otherwise, use nullptr to use an installed version of the runtime. + // For more info see the following link: https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-0.9.622#createcorewebview2environmentwithoptions + + hr = CreateCoreWebView2EnvironmentWithOptions(nullptr, temp_path, nullptr, + Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>( + [hWnd](HRESULT result, ICoreWebView2Environment* env) -> HRESULT { + + // Create a CoreWebView2Controller and get the associated CoreWebView2 whose parent is the main window hWnd + env->CreateCoreWebView2Controller(hWnd, Callback<ICoreWebView2CreateCoreWebView2ControllerCompletedHandler>( + [hWnd](HRESULT result, ICoreWebView2Controller* controller) -> HRESULT { + if (controller != nullptr) { + webviewController = controller; + if (webviewController->get_CoreWebView2(&webviewWindow) == S_OK) + { + // Resize WebView to fit the bounds of the parent window + resize_window(hWnd); + + process_command_line(hWnd); + } + } + + return S_OK; + }).Get()); + return S_OK; + }).Get()); + + return (S_OK == hr); +} +// read the messages of dvipdfx + +void read_pipe(HWND hWnd, HANDLE child_stdout_read) +{ + HANDLE hlog; + + hlog = CreateFileA(log_file, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + + if (INVALID_HANDLE_VALUE == hlog) + { + MessageBox(hWnd, L"Unable to create the log file", L"Internal Error", MB_OK); + + return; + } + else + { + const size_t BUFSIZE = 4096; + + DWORD dw_read, dw_written; + char buf[BUFSIZE]; + BOOL success = FALSE; + + while (true) + { + success = ReadFile(child_stdout_read, buf, BUFSIZE, &dw_read, NULL); + + if (!success || dw_read == 0) + break; + + success = WriteFile(hlog, buf, dw_read, &dw_written, NULL); + + if (!success) + break; + } + CloseHandle(hlog); + } +} + +struct handle +{ + HANDLE m_handle{ INVALID_HANDLE_VALUE }; + void close() + { + if (m_handle != INVALID_HANDLE_VALUE) + { + CloseHandle(m_handle); + + m_handle = INVALID_HANDLE_VALUE; + } + } + ~handle() + { + close(); + } +}; + +void show_pdf_file(HWND hWnd, const char *filename, const char *title) +{ + wchar_t pdf_file[MAX_PATH + 1]{ 0 }; + + MultiByteToWideChar(CP_UTF8, 0, filename, lstrlenA(filename), pdf_file, MAX_PATH); + + if (webviewWindow->Navigate(pdf_file) == S_OK) + { + SetWindowTextA(hWnd, title); + } +} + +bool file_exists(const char* filename) +{ + WIN32_FILE_ATTRIBUTE_DATA attrib{ 0 }; + + GetFileAttributesExA(filename, GetFileExInfoStandard, &attrib); + + if (attrib.nFileSizeLow > 0 || attrib.nFileSizeHigh > 0) + { + return true; + } + return false; +} + +void create_pdf(HWND hWnd, const char* dvi_file) +{ + PROCESS_INFORMATION pi{ 0 }; + STARTUPINFOA si{ 0 }; + char param[MAX_PATH * 2 + 1]{ "dvipdfmx.exe -o " }; + char fname[_MAX_FNAME + 1]{ 0 }; + char temp_pdf_path[MAX_PATH + 1]{ 0 }; + handle child_stdout_read; + handle child_stdout_write; + SECURITY_ATTRIBUTES sa{ 0 }; + + sa.nLength = sizeof(sa); + sa.bInheritHandle = TRUE; + + if (!CreatePipe(&child_stdout_read.m_handle, &child_stdout_write.m_handle, &sa, 0)) + { + MessageBox(hWnd, L"Unable to create a pipe", L"Internal Error", MB_OK); + + return; + } + else + { + SetHandleInformation(child_stdout_read.m_handle, HANDLE_FLAG_INHERIT, 0); + } + + if (_splitpath_s(dvi_file, 0, 0, 0, 0, fname, _MAX_FNAME, nullptr, 0) != 0) + { + MessageBox(hWnd, L"Unable to split the path", L"Internal Error", MB_OK); + + return; + } + + if (GetTempPathA(MAX_PATH, temp_pdf_path) == 0) + { + MessageBox(hWnd, L"Unable to obtain the TEMP path", L"Internal Error", MB_OK); + + return; + } + else if (!PathFileExistsA(temp_pdf_path)) + { + MessageBox(hWnd, L"The TEMP path folder is not available", L"Internal Error", MB_OK); + + return; + } + + lstrcatA(log_file, temp_pdf_path); + + lstrcatA(log_file, fname); + + lstrcatA(log_file, ".log"); + + lstrcatA(temp_pdf_path, fname); + + lstrcatA(temp_pdf_path, ".pdf"); + + // enclose the parameters in quotes + + lstrcatA(param, "\""); + + lstrcatA(param, temp_pdf_path); + + // enclose the parameters in quotes + + lstrcatA(param, "\" \""); + + lstrcatA(param, dvi_file); + + // close the quote + + lstrcatA(param, "\""); + + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + //si.hStdInput = child_stdin_read.m_handle; + si.hStdOutput = child_stdout_write.m_handle; + si.hStdError = child_stdout_write.m_handle; + si.wShowWindow = SW_HIDE; + + if (!CreateProcessA(nullptr, param, nullptr, nullptr, TRUE, CREATE_NO_WINDOW, nullptr, nullptr, &si, &pi)) + { + MessageBox(hWnd, L"Unable to execute 'dvipdfmx.exe", L"Error", MB_OK); + + return; + } + else + { + DWORD exit_code = 0; + + WaitForSingleObject(pi.hProcess, INFINITE); + + GetExitCodeProcess(pi.hProcess, &exit_code); + + CloseHandle(pi.hProcess); + + CloseHandle(pi.hThread); + + child_stdout_write.close(); + + read_pipe(hWnd, child_stdout_read.m_handle); + + child_stdout_read.close(); + + if (exit_code != 0) + { + MessageBox(hWnd, L"'dvipdfmx.exe returned an error.\nPlease see the log file in the File menu", L"Error", MB_OK); + + return; + } + else + { + if (file_exists(temp_pdf_path)) + { + const char* ext = strrchr(dvi_file, '.'); + + // can't fail, but check anyway + if (ext) + { + lstrcatA(fname, ext); + } + show_pdf_file(hWnd, temp_pdf_path, fname); + } + } + } + return; +} + +void clear_log_file() +{ + log_file[0] = 0; +} + +void open_file(HWND hWnd) +{ + OPENFILENAMEA ofn = { 0 }; + char filename[MAX_PATH + 1] = { 0 }; + + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = hWnd; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; + ofn.lpstrFilter = "DVI\0*.dvi\0\0"; + ofn.lpstrFile = filename; + ofn.nMaxFile = MAX_PATH; + + if (GetOpenFileNameA(&ofn) == TRUE) + { + create_pdf(hWnd, ofn.lpstrFile); + } +} + +void resize_window(HWND hWnd) +{ + if (webviewController != nullptr) + { + RECT bounds; + GetClientRect(hWnd, &bounds); + webviewController->put_Bounds(bounds); + } +} + +void process_command_line(HWND hWnd) +{ + LPWSTR* arg_list; + int argc; + + arg_list = CommandLineToArgvW(GetCommandLineW(), &argc); + + if (nullptr == arg_list) + { + MessageBox(hWnd, L"CommandLineToArgvW failed", L"Error", MB_OK); + + return; + } + else if (argc > 1) + { + char dvi_file[MAX_PATH + 1]{ 0 }; + int result; + + result = WideCharToMultiByte(CP_UTF8, 0, arg_list[1], -1, dvi_file, (int)MAX_PATH, 0, FALSE); + + LocalFree(arg_list); + + if (result > 0) + { + if (!file_exists(dvi_file)) + { + lstrcatA(dvi_file, ".dvi"); + + if (!file_exists(dvi_file)) + { + MessageBoxA(hWnd, dvi_file, "File not found", MB_OK); + + return; + } + } + create_pdf(hWnd, dvi_file); + } + else + { + MessageBox(hWnd, L"Unable to convert a string from wide char to multibyte", L"Internal Error", MB_OK); + + return; + } + } +} + +void run_application(HWND hWnd, const wchar_t *app_name, const wchar_t *input_filename) +{ + PROCESS_INFORMATION pi{ 0 }; + STARTUPINFOW si{ 0 }; + wchar_t param[MAX_PATH *2 + 1]{0}; + + si.cb = sizeof(si); + + lstrcpyW(param, app_name); + lstrcatW(param, L" "); + + if (input_filename) + { + lstrcatW(param, input_filename); + } + + if (!CreateProcessW(nullptr, param, nullptr, nullptr, false, 0, nullptr, nullptr, &si, &pi)) + { + wchar_t msg[MAX_PATH + 1]{ L"Unable to execute " }; + + lstrcatW(msg, app_name); + + MessageBoxW(hWnd, msg, L"Error", MB_OK); + + return; + } + + CloseHandle(pi.hProcess); + + CloseHandle(pi.hThread); +} + +void view_log_file(HWND hWnd) +{ + wchar_t input_filename[MAX_PATH + 1]{ 0 }; + + MultiByteToWideChar(CP_UTF8, 0, log_file, -1, input_filename, MAX_PATH); + + run_application(hWnd, L"notepad.exe", input_filename); +} + + +void new_instance(HWND hWnd, const wchar_t* input_filename) +{ + wchar_t app_name[MAX_PATH + 1]{ 0 }; + + GetModuleFileNameW(nullptr, app_name, MAX_PATH); + + run_application(hWnd, app_name, input_filename); +} + +void close_file(HWND hWnd) +{ + webviewWindow->Navigate(L"about:blank"); + clear_log_file(); + SetWindowText(hWnd, L"DVIVue"); +} +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +// WM_COMMAND - process the application menu +// WM_PAINT - Paint the main window +// WM_DESTROY - post a quit message and return +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_COMMAND: + { + int wmId = LOWORD(wParam); + // Parse the menu selections: + switch (wmId) + { + case IDM_ABOUT: + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); + break; + case IDM_EXIT: + DestroyWindow(hWnd); + break; + case IDM_FILE_NEW: + new_instance(hWnd, nullptr); + break; + case IDM_FILE_OPEN: + open_file(hWnd); + break; + case IDM_FILE_CLOSE: + close_file(hWnd); + break; + case IDM_FILE_VIEW_LOG: + view_log_file(hWnd); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + } + break; + case WM_INITMENU: + { + HMENU hmenu = (HMENU)wParam; + + if (log_file[0] != 0) + { + EnableMenuItem(hmenu, IDM_FILE_VIEW_LOG, MF_ENABLED); + } + else + { + EnableMenuItem(hmenu, IDM_FILE_VIEW_LOG, MF_DISABLED | MF_GRAYED); + } + } + break; + case WM_SIZE: + resize_window(hWnd); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + switch (message) + { + case WM_INITDIALOG: + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, LOWORD(wParam)); + return (INT_PTR)TRUE; + } + break; + } + return (INT_PTR)FALSE; +} diff --git a/dviware/dvivue/DVIVue/DVIVue.h b/dviware/dvivue/DVIVue/DVIVue.h new file mode 100644 index 0000000000..d00d47e788 --- /dev/null +++ b/dviware/dvivue/DVIVue/DVIVue.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/dviware/dvivue/DVIVue/DVIVue.ico b/dviware/dvivue/DVIVue/DVIVue.ico Binary files differnew file mode 100644 index 0000000000..b3ec03bd61 --- /dev/null +++ b/dviware/dvivue/DVIVue/DVIVue.ico diff --git a/dviware/dvivue/DVIVue/DVIVue.rc b/dviware/dvivue/DVIVue/DVIVue.rc Binary files differnew file mode 100644 index 0000000000..9245ba3f42 --- /dev/null +++ b/dviware/dvivue/DVIVue/DVIVue.rc diff --git a/dviware/dvivue/DVIVue/DVIVue.vcxproj b/dviware/dvivue/DVIVue/DVIVue.vcxproj new file mode 100644 index 0000000000..7d5cc483d0 --- /dev/null +++ b/dviware/dvivue/DVIVue/DVIVue.vcxproj @@ -0,0 +1,172 @@ +<?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>{de4ab823-2855-4701-acd7-2c627fcad14a}</ProjectGuid> + <RootNamespace>DVIVue</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>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v142</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" /> + </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" /> + </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" /> + </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" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + </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;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + </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;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + </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;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="DVIVue.h" /> + <ClInclude Include="framework.h" /> + <ClInclude Include="Resource.h" /> + <ClInclude Include="targetver.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="DVIVue.cpp" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="DVIVue.rc" /> + </ItemGroup> + <ItemGroup> + <Image Include="DVIVue.ico" /> + <Image Include="small.ico" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + <Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200902.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200902.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" /> + <Import Project="..\packages\Microsoft.Web.WebView2.0.9.622.11\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.0.9.622.11\build\native\Microsoft.Web.WebView2.targets')" /> + </ImportGroup> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200902.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200902.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" /> + <Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.0.9.622.11\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.0.9.622.11\build\native\Microsoft.Web.WebView2.targets'))" /> + </Target> +</Project>
\ No newline at end of file diff --git a/dviware/dvivue/DVIVue/DVIVue.vcxproj.filters b/dviware/dvivue/DVIVue/DVIVue.vcxproj.filters new file mode 100644 index 0000000000..07260aea14 --- /dev/null +++ b/dviware/dvivue/DVIVue/DVIVue.vcxproj.filters @@ -0,0 +1,52 @@ +<?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> + <ClInclude Include="framework.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="targetver.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Resource.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="DVIVue.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="DVIVue.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="DVIVue.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> + <ItemGroup> + <Image Include="small.ico"> + <Filter>Resource Files</Filter> + </Image> + <Image Include="DVIVue.ico"> + <Filter>Resource Files</Filter> + </Image> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/dviware/dvivue/DVIVue/DVIVue.vcxproj.user b/dviware/dvivue/DVIVue/DVIVue.vcxproj.user new file mode 100644 index 0000000000..025581fb1e --- /dev/null +++ b/dviware/dvivue/DVIVue/DVIVue.vcxproj.user @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LocalDebuggerCommandArguments> + </LocalDebuggerCommandArguments> + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LocalDebuggerCommandArguments> + </LocalDebuggerCommandArguments> + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LocalDebuggerCommandArguments> + </LocalDebuggerCommandArguments> + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LocalDebuggerCommandArguments> + </LocalDebuggerCommandArguments> + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/dviware/dvivue/DVIVue/framework.h b/dviware/dvivue/DVIVue/framework.h new file mode 100644 index 0000000000..1019da0d03 --- /dev/null +++ b/dviware/dvivue/DVIVue/framework.h @@ -0,0 +1,26 @@ +// header.h : include file for standard system include files, +// or project specific include files +// + +#pragma once + +#include "targetver.h" +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files +#include <windows.h> +// C RunTime Header Files +#include <stdlib.h> +#include <malloc.h> +#include <memory.h> +#include <tchar.h> +#include <wchar.h> +#include <shlwapi.h> +#include <wrl.h> +#include <wil/com.h> +// include WebView2 header +#include "WebView2.h" + +using namespace std; +using namespace Microsoft::WRL; + +#pragma comment(lib, "Shlwapi.lib") diff --git a/dviware/dvivue/DVIVue/packages.config b/dviware/dvivue/DVIVue/packages.config new file mode 100644 index 0000000000..6bc92dd57d --- /dev/null +++ b/dviware/dvivue/DVIVue/packages.config @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Microsoft.Web.WebView2" version="0.9.622.11" targetFramework="native" /> + <package id="Microsoft.Windows.ImplementationLibrary" version="1.0.200902.2" targetFramework="native" /> +</packages>
\ No newline at end of file diff --git a/dviware/dvivue/DVIVue/resource.h b/dviware/dvivue/DVIVue/resource.h new file mode 100644 index 0000000000..990422a418 --- /dev/null +++ b/dviware/dvivue/DVIVue/resource.h @@ -0,0 +1,35 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by DVIVue.rc + +#define IDS_APP_TITLE 103 + +#define IDR_MAINFRAME 128 +#define IDD_DVIVUE_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_DVIVUE 107 +#define IDI_SMALL 108 +#define IDC_DVIVUE 109 +#define IDC_MYICON 2 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#define IDM_FILE_NEW 114 +#define IDM_FILE_OPEN 115 +#define IDM_FILE_CLOSE 116 +#define IDM_FILE_VIEW_LOG 117 + +#endif +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/dviware/dvivue/DVIVue/small.ico b/dviware/dvivue/DVIVue/small.ico Binary files differnew file mode 100644 index 0000000000..b3ec03bd61 --- /dev/null +++ b/dviware/dvivue/DVIVue/small.ico diff --git a/dviware/dvivue/DVIVue/targetver.h b/dviware/dvivue/DVIVue/targetver.h new file mode 100644 index 0000000000..bf75e0895e --- /dev/null +++ b/dviware/dvivue/DVIVue/targetver.h @@ -0,0 +1,6 @@ +#pragma once + +// // Including SDKDDKVer.h defines the highest available Windows platform. +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. +#include <SDKDDKVer.h> |