mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-24 08:37:42 +00:00
feat(windows): move location of editor project
This commit is contained in:
parent
a11f2f9c31
commit
f16d9c3ffc
13 changed files with 0 additions and 740 deletions
|
|
@ -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<HFONT>(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;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#pragma once
|
||||
#ifndef _EDITOR_H
|
||||
#define _EDITOR_H
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#endif
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB |
Binary file not shown.
|
|
@ -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
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
<?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>{6804767e-857f-48cc-b843-22bf357a668c}</ProjectGuid>
|
||||
<RootNamespace>Editor</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="Editor.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="FontSelect.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Editor.cpp" />
|
||||
<ClCompile Include="FontSelect.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Editor.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Editor.ico" />
|
||||
<Image Include="small.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?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="Editor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FontSelect.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Editor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FontSelect.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Editor.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="small.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="Editor.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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 <windows.h>
|
||||
// C RunTime Header Files
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB |
|
|
@ -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 <SDKDDKVer.h>
|
||||
Loading…
Add table
Reference in a new issue