diff --git a/windows/src/texteditor/Editor.cpp b/windows/src/texteditor/Editor.cpp deleted file mode 100644 index 25b27bd890..0000000000 --- a/windows/src/texteditor/Editor.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// Editor.cpp : Defines the entry point for the application. -// - - -#include "framework.h" -#include "Editor.h" -#include "FontSelect.h" -#define MAX_LOADSTRING 100 - -// Global Variables: -HINSTANCE hInst; // current instance -HWND hWndEdit; -HWND hWnd; -WCHAR szTitle[MAX_LOADSTRING]; // The title bar text -WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name -font_select* font_select_control; - - -// 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 SizeEditWindow(); - -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_EDITOR, szWindowClass, MAX_LOADSTRING); - MyRegisterClass(hInstance); - - // Perform application initialization: - if (!InitInstance (hInstance, nCmdShow)) - { - return FALSE; - } - - HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_EDITOR)); - - 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_EDITOR)); - wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_EDITOR); - 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 = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); - - if (!hWnd) - { - return FALSE; - } - hWndEdit = CreateWindowW(L"EDIT", L"", WS_CHILDWINDOW | ES_MULTILINE | WS_VISIBLE, 0, 0, 10, 10, hWnd, nullptr, hInstance, nullptr); - SizeEditWindow(); - HFONT current_font = reinterpret_cast(SendMessage(hWndEdit, WM_GETFONT, 0, 0)); - font_select_control = new font_select(current_font); - if (font_select_control != NULL) - { - SendMessage(hWndEdit, WM_SETFONT, (LPARAM)font_select_control->get_font_handle(), TRUE); - } - - ShowWindow(hWnd, nCmdShow); - UpdateWindow(hWnd); - - return TRUE; -} - -void -SizeEditWindow() { - RECT rc; - GetClientRect(hWnd, &rc); - SetWindowPos(hWndEdit, 0, 0, 0, rc.right, rc.bottom, SWP_NOOWNERZORDER); -} - -// -// 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: - if (font_select_control != NULL) - { - delete font_select_control; - } - DestroyWindow(hWnd); - break; - case IDM_FONT: - if (font_select_control != NULL) - { - font_select_control->choose_font(); - SendMessage(hWndEdit, WM_SETFONT, (LPARAM)font_select_control->get_font_handle(), TRUE); - } - - break; - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - } - break; - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hdc = BeginPaint(hWnd, &ps); - // TODO: Add any drawing code that uses hdc here... - EndPaint(hWnd, &ps); - } - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - case WM_SETFOCUS: - SetFocus(hWndEdit); - 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/windows/src/texteditor/Editor.h b/windows/src/texteditor/Editor.h deleted file mode 100644 index 3ae61a01ed..0000000000 --- a/windows/src/texteditor/Editor.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once -#ifndef _EDITOR_H -#define _EDITOR_H - -#include "resource.h" - -#endif \ No newline at end of file diff --git a/windows/src/texteditor/Editor.ico b/windows/src/texteditor/Editor.ico deleted file mode 100644 index 886ed00594..0000000000 Binary files a/windows/src/texteditor/Editor.ico and /dev/null differ diff --git a/windows/src/texteditor/Editor.rc b/windows/src/texteditor/Editor.rc deleted file mode 100644 index 20b172c6b2..0000000000 Binary files a/windows/src/texteditor/Editor.rc and /dev/null differ diff --git a/windows/src/texteditor/Editor.sln b/windows/src/texteditor/Editor.sln deleted file mode 100644 index 779a4405f7..0000000000 --- a/windows/src/texteditor/Editor.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.33328.57 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Editor", "Editor.vcxproj", "{6804767E-857F-48CC-B843-22BF357A668C}" -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 - {6804767E-857F-48CC-B843-22BF357A668C}.Debug|x64.ActiveCfg = Debug|x64 - {6804767E-857F-48CC-B843-22BF357A668C}.Debug|x64.Build.0 = Debug|x64 - {6804767E-857F-48CC-B843-22BF357A668C}.Debug|x86.ActiveCfg = Debug|Win32 - {6804767E-857F-48CC-B843-22BF357A668C}.Debug|x86.Build.0 = Debug|Win32 - {6804767E-857F-48CC-B843-22BF357A668C}.Release|x64.ActiveCfg = Release|x64 - {6804767E-857F-48CC-B843-22BF357A668C}.Release|x64.Build.0 = Release|x64 - {6804767E-857F-48CC-B843-22BF357A668C}.Release|x86.ActiveCfg = Release|Win32 - {6804767E-857F-48CC-B843-22BF357A668C}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {31241FBB-6A16-499A-B348-3AE003BC2BF6} - EndGlobalSection -EndGlobal diff --git a/windows/src/texteditor/Editor.vcxproj b/windows/src/texteditor/Editor.vcxproj deleted file mode 100644 index 1dbdf64d4a..0000000000 --- a/windows/src/texteditor/Editor.vcxproj +++ /dev/null @@ -1,162 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {6804767e-857f-48cc-b843-22bf357a668c} - Editor - 10.0 - - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - Application - true - v142 - Unicode - - - Application - false - v142 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - false - - - true - - - false - - - - Level3 - true - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - Level3 - true - _DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - Level3 - true - true - true - NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/windows/src/texteditor/Editor.vcxproj.filters b/windows/src/texteditor/Editor.vcxproj.filters deleted file mode 100644 index 4720676a3d..0000000000 --- a/windows/src/texteditor/Editor.vcxproj.filters +++ /dev/null @@ -1,55 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Resource Files - - - Resource Files - - - \ No newline at end of file diff --git a/windows/src/texteditor/FontSelect.cpp b/windows/src/texteditor/FontSelect.cpp deleted file mode 100644 index a7d3905400..0000000000 --- a/windows/src/texteditor/FontSelect.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Keyman is copyright (C) SIL International. MIT License. - * Implementation of the FontSelect Class - */ - -#include "framework.h" -#include "FontSelect.h" -#include "commdlg.h" - -font_select::font_select() -{ - // set default values - default_font(); -} - -font_select::font_select(HFONT current_font) -{ - LOGFONT current_log_font; - - if (m_hfont != NULL) { - ::DeleteObject(m_hfont); - } - - // store the font current font for the calling application - m_hfont = current_font; - default_font(); // We still set the default value but can now drop back to the current font -} - -font_select::~font_select() -{ - if (m_hfont != NULL) { - ::DeleteObject(m_hfont); - } -} - -// set the logical font information as "Charsis SIL" size 14 -void font_select::default_font() -{ - // Define the default font for the editor - // Future enhancement could load default from a configuration file - LOGFONT log_font; - log_font.lfHeight = -19; // size 14 - log_font.lfWidth = 0; - log_font.lfEscapement = 0; - log_font.lfOrientation = 0; - log_font.lfWeight = FW_NORMAL; - log_font.lfItalic = 0; - log_font.lfUnderline = 0; - log_font.lfStrikeOut = 0; - log_font.lfCharSet = 0; - log_font.lfOutPrecision = OUT_STRING_PRECIS; - log_font.lfClipPrecision = CLIP_STROKE_PRECIS; - log_font.lfQuality = DEFAULT_QUALITY; - log_font.lfPitchAndFamily = FF_SWISS | VARIABLE_PITCH; - wcscpy_s(log_font.lfFaceName, L"Charsis SIL"); - // create the associated font - create_font(&log_font); -} - -BOOL font_select::choose_font() -{ - CHOOSEFONT choose_font; - LOGFONT log_font; - - if (m_hfont != NULL){ - GetObject(m_hfont, sizeof(log_font), &log_font); - } - // fill in the data needed for the Windows common font dialog - choose_font.lStructSize = sizeof(choose_font); - choose_font.hwndOwner = ::GetActiveWindow(); - choose_font.hDC = 0; - choose_font.lpLogFont = &log_font; - choose_font.iPointSize = 0; - choose_font.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT; - choose_font.rgbColors = 0; - choose_font.lCustData = 0; - choose_font.lpfnHook = 0; - choose_font.lpTemplateName = NULL; - choose_font.hInstance = 0; - choose_font.lpszStyle = 0; - choose_font.nFontType = SCREEN_FONTTYPE; - choose_font.nSizeMin = 0; - choose_font.nSizeMax = 0; - - // get new font selection from user - if (::ChooseFont(&choose_font) != FALSE){ - if (NULL != create_font(&log_font)){ - return TRUE; - } - } - // else - return FALSE; -} - -// create the associated font -HFONT font_select::create_font(LOGFONT* logfont) -{ - HFONT h_font = ::CreateFontIndirect(logfont); - if (h_font == NULL){ - MessageBox(NULL,L"Error",L"Failed to select font\n",MB_OK); - } - - if (m_hfont != NULL) { - ::DeleteObject(m_hfont); - } - // store the font (or NULL if failed) - m_hfont = h_font; - return h_font; -} - -// return the logical font description for the wrapped font -LOGFONT font_select::get_log_font() -{ - LOGFONT log_font; - - if (m_hfont != NULL) { - GetObject(m_hfont, sizeof(log_font), &log_font); - } - return log_font; -} - -// return the wrapped font -HFONT font_select::get_font_handle() -{ - return m_hfont; -} - -void font_select::save() -{ - -} - -void font_select::restore() -{ - -} diff --git a/windows/src/texteditor/FontSelect.h b/windows/src/texteditor/FontSelect.h deleted file mode 100644 index 5301f2bf1f..0000000000 --- a/windows/src/texteditor/FontSelect.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Keyman is copyright (C) SIL International. MIT License. - * Description: A light way wrapper class for selecting fonts - */ - -#pragma once -#ifndef _FONTSELECT_H -#define _FONTSELECT_H -#include "framework.h" - -/** - * This class exists as simple class for allowing a user to - * select a font making use of the common dialog box - * - */ -class font_select { - -private: - HFONT m_hfont; - -public: - font_select(); - /** - * Construct a new font select object the caller can - * set the current font to fallback. - * - * @param current_font Font used for fallback should configured default not be - * fond on the system. - */ - font_select(HFONT current_font); - ~font_select(); - - /** - * Set the default font for our editor. Currently hard coded to Charsis SIL - * but could be upgraded to read from a configuration file, when implementing - * save and restore methods. - */ - void default_font(); - /** - * Create the HFONT for the current logical font of the private member m_log_font - * - * @return HFONT - */ - HFONT create_font(LOGFONT* logfont); - - /** - * Load the Font dialog box - * - * @return BOOL - */ - BOOL choose_font(); - - /** - * Get the logical font object - * - * @param log_font - * @return LOGFONT - */ - LOGFONT get_log_font(); - - /** - * Get the font handle object - * - * @return HFONT - */ - HFONT get_font_handle(); - // TODO: Save font to disk for restoring upon editor restart - - /** - * persist the current font to disk - */ - void save(); - - /** - * restore font from to disk - */ - void restore(); -}; - - -#endif \ No newline at end of file diff --git a/windows/src/texteditor/Resource.h b/windows/src/texteditor/Resource.h deleted file mode 100644 index 7daeff78f2..0000000000 --- a/windows/src/texteditor/Resource.h +++ /dev/null @@ -1,31 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Editor.rc - -#define IDS_APP_TITLE 103 - -#define IDR_MAINFRAME 128 -#define IDD_EDITOR_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDI_EDITOR 107 -#define IDI_SMALL 108 -#define IDC_EDITOR 109 -#define IDM_FONT 110 -#define IDC_MYICON 2 -#ifndef IDC_STATIC -#define IDC_STATIC -1 -#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/windows/src/texteditor/framework.h b/windows/src/texteditor/framework.h deleted file mode 100644 index 33a6be646e..0000000000 --- a/windows/src/texteditor/framework.h +++ /dev/null @@ -1,15 +0,0 @@ -// 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 -// C RunTime Header Files -#include -#include -#include -#include diff --git a/windows/src/texteditor/small.ico b/windows/src/texteditor/small.ico deleted file mode 100644 index b3ec03bd61..0000000000 Binary files a/windows/src/texteditor/small.ico and /dev/null differ diff --git a/windows/src/texteditor/targetver.h b/windows/src/texteditor/targetver.h deleted file mode 100644 index bf75e0895e..0000000000 --- a/windows/src/texteditor/targetver.h +++ /dev/null @@ -1,6 +0,0 @@ -#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