Revision: 8494 https://osdn.net/projects/ttssh2/scm/svn/commits/8494 Author: zmatsuo Date: 2020-01-22 22:53:23 +0900 (Wed, 22 Jan 2020) Log Message: ----------- common_static プロジェクトを追加 - 各プロジェクトにスタティクにリンクされるソースをまとめたプロジェクト - layer_for_unicode などを利用しやすくする - layer_for_unicode.cpp に _AppendMenuW(), _HtmlHelpW() 追加 - comctl32.dll(lib)に依存する関数を別ソースに分離 - layer_for_unicode.cpp の一部を layer_for_unicode_comctl32.cpp に分離 - tmfc.cpp の一部を tmfc_property.cpp に分離 Modified Paths: -------------- trunk/teraterm/CMakeLists.txt trunk/teraterm/common/layer_for_unicode.cpp trunk/teraterm/common/layer_for_unicode.h trunk/teraterm/common/tmfc.cpp trunk/teraterm/ttermpro.sln trunk/teraterm/ttermpro.v16.sln Added Paths: ----------- trunk/teraterm/common/CMakeLists.txt trunk/teraterm/common/common_static.v16.vcxproj trunk/teraterm/common/common_static.v8.vcproj trunk/teraterm/common/layer_for_unicode_comctl32.cpp trunk/teraterm/common/tmfc_property.cpp -------------- next part -------------- Modified: trunk/teraterm/CMakeLists.txt =================================================================== --- trunk/teraterm/CMakeLists.txt 2020-01-21 00:38:12 UTC (rev 8493) +++ trunk/teraterm/CMakeLists.txt 2020-01-22 13:53:23 UTC (rev 8494) @@ -33,3 +33,9 @@ set_target_properties( keycode PROPERTIES FOLDER teraterm) + +add_subdirectory(common) +set_target_properties( + common_static + PROPERTIES FOLDER teraterm) + Added: trunk/teraterm/common/CMakeLists.txt =================================================================== --- trunk/teraterm/common/CMakeLists.txt (rev 0) +++ trunk/teraterm/common/CMakeLists.txt 2020-01-22 13:53:23 UTC (rev 8494) @@ -0,0 +1,27 @@ +project(teraterm) + +add_library( + common_static + STATIC + codeconv.cpp + codeconv.h + compat_win.cpp + compat_win.h + dllutil.cpp + dllutil.h + i18n.c + i18n.h + layer_for_unicode.cpp + layer_for_unicode.h + layer_for_unicode_comctl32.cpp + tmfc.cpp + tmfc.h + tmfc_frame.cpp + tmfc_property.cpp + ) + +target_include_directories( + common_static + PRIVATE + . + ) Added: trunk/teraterm/common/common_static.v16.vcxproj =================================================================== --- trunk/teraterm/common/common_static.v16.vcxproj (rev 0) +++ trunk/teraterm/common/common_static.v16.vcxproj 2020-01-22 13:53:23 UTC (rev 8494) @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" 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> + </ItemGroup> + <PropertyGroup Label="Globals"> + <RootNamespace>common_static</RootNamespace> + <ProjectName>common_static</ProjectName> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + <ProjectGuid>{AC42387D-23EC-45DB-81F9-8933C7EFA52A}</ProjectGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> + <IntDir>$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> + <IntDir>$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MkTypLibCompatible>true</MkTypLibCompatible> + <SuppressStartupBanner>true</SuppressStartupBanner> + <TargetEnvironment>Win32</TargetEnvironment> + <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <AdditionalOptions>/D"_CRT_SECURE_NO_DEPRECATE" %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <CompileAs>Default</CompileAs> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ResourceCompile> + <Link> + <AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <SuppressStartupBanner>true</SuppressStartupBanner> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ModuleDefinitionFile>$(ProjectName).def</ModuleDefinitionFile> + <DelayLoadDLLs>setupapi.dll;user32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(OutDir)$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MkTypLibCompatible>true</MkTypLibCompatible> + <SuppressStartupBanner>true</SuppressStartupBanner> + <TargetEnvironment>Win32</TargetEnvironment> + <TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <AdditionalOptions>/D"_CRT_SECURE_NO_DEPRECATE" %(AdditionalOptions)</AdditionalOptions> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>Default</CompileAs> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + <AdditionalIncludeDirectories>$(SolutionDir)common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ResourceCompile> + <Link> + <AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <SuppressStartupBanner>true</SuppressStartupBanner> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ModuleDefinitionFile>$(ProjectName).def</ModuleDefinitionFile> + <DelayLoadDLLs>setupapi.dll;user32.dll;%(DelayLoadDLLs)</DelayLoadDLLs> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(OutDir)$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\teraterm\teraterm\common\tmfc.cpp" /> + <ClCompile Include="..\..\..\teraterm\teraterm\common\tmfc_frame.cpp" /> + <ClCompile Include="..\..\..\teraterm\teraterm\common\tmfc_property.cpp" /> + <ClCompile Include="..\common\codeconv.cpp" /> + <ClCompile Include="..\common\compat_win.cpp" /> + <ClCompile Include="..\common\dllutil.cpp" /> + <ClCompile Include="..\common\i18n.c" /> + <ClCompile Include="layer_for_unicode.cpp" /> + <ClCompile Include="layer_for_unicode_comctl32.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\teraterm\teraterm\common\tmfc.h" /> + <ClInclude Include="..\common\compat_win.h" /> + <ClInclude Include="..\common\dllutil.h" /> + <ClInclude Include="..\common\i18n.h" /> + <ClInclude Include="codeconv.h" /> + <ClInclude Include="layer_for_unicode.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file Added: trunk/teraterm/common/common_static.v8.vcproj =================================================================== --- trunk/teraterm/common/common_static.v8.vcproj (rev 0) +++ trunk/teraterm/common/common_static.v8.vcproj 2020-01-22 13:53:23 UTC (rev 8494) @@ -0,0 +1,234 @@ +<?xml version="1.0" encoding="shift_jis"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="common_static" + ProjectGUID="{DF4E3C36-A743-4FB4-8EE9-49899E69ED32}" + RootNamespace="common_static" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName="$(OutDir)\$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/D"_CRT_SECURE_NO_DEPRECATE"" + Optimization="2" + InlineFunctionExpansion="1" + AdditionalIncludeDirectories="$(SolutionDir)common" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + WarningLevel="3" + SuppressStartupBanner="true" + CompileAs="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1033" + AdditionalIncludeDirectories="$(SolutionDir)common" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName="$(OutDir)\$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/D"_CRT_SECURE_NO_DEPRECATE"" + Optimization="0" + AdditionalIncludeDirectories="$(SolutionDir)common" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + RuntimeLibrary="1" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + CompileAs="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1033" + AdditionalIncludeDirectories="$(SolutionDir)common" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLibrarianTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="..\common\codeconv.cpp" + > + </File> + <File + RelativePath=".\codeconv.h" + > + </File> + <File + RelativePath="..\common\compat_win.cpp" + > + </File> + <File + RelativePath="..\common\compat_win.h" + > + </File> + <File + RelativePath=".\comportinfo.h" + > + </File> + <File + RelativePath="..\common\dllutil.cpp" + > + </File> + <File + RelativePath="..\common\dllutil.h" + > + </File> + <File + RelativePath="..\common\i18n.c" + > + </File> + <File + RelativePath="..\common\i18n.h" + > + </File> + <File + RelativePath=".\layer_for_unicode.cpp" + > + </File> + <File + RelativePath=".\layer_for_unicode.h" + > + </File> + <File + RelativePath=".\layer_for_unicode_comctl32.cpp" + > + </File> + <File + RelativePath=".\tmfc.cpp" + > + </File> + <File + RelativePath=".\tmfc.h" + > + </File> + <File + RelativePath=".\tmfc_frame.cpp" + > + </File> + <File + RelativePath=".\tmfc_property.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Modified: trunk/teraterm/common/layer_for_unicode.cpp =================================================================== --- trunk/teraterm/common/layer_for_unicode.cpp 2020-01-21 00:38:12 UTC (rev 8493) +++ trunk/teraterm/common/layer_for_unicode.cpp 2020-01-22 13:53:23 UTC (rev 8494) @@ -142,62 +142,6 @@ return retval; } -HPROPSHEETPAGE _CreatePropertySheetPageW(LPCPROPSHEETPAGEW_V1 psp) -{ - if (pCreatePropertySheetPageW != NULL) { - return pCreatePropertySheetPageW((LPCPROPSHEETPAGEW)psp); - } - - char *titleA = ToCharW(psp->pszTitle); - - PROPSHEETPAGEA_V1 pspA; - memset(&pspA, 0, sizeof(pspA)); - pspA.dwSize = sizeof(pspA); - pspA.dwFlags = psp->dwFlags; - pspA.hInstance = psp->hInstance; - pspA.pResource = psp->pResource; - pspA.pszTitle = titleA; - pspA.pfnDlgProc = psp->pfnDlgProc; - pspA.lParam = psp->lParam; - - HPROPSHEETPAGE retval = CreatePropertySheetPageA((LPCPROPSHEETPAGEA)&pspA); - - free(titleA); - return retval; -} - -// \x83\x8A\x83\x8A\x81[\x83X\x97pSDK\x82̃w\x83b\x83_\x82\xC9 -// PROPSHEETHEADERW_V1 \x82\xAA\x82Ȃ\xA2\x82\xBD\x82\xDF -// PROPSHEETHEADERW \x82\xF0\x8Eg\x97p -// SDK: Windows Server 2003 R2 Platform SDK -// (Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1) -//INT_PTR _PropertySheetW(PROPSHEETHEADERW_V1 *psh) -INT_PTR _PropertySheetW(PROPSHEETHEADERW *psh) -{ - if (pPropertySheetW != NULL) { - return pPropertySheetW((PROPSHEETHEADERW *)psh); - } - - char *captionA = ToCharW(psh->pszCaption); - -// PROPSHEETHEADERA_V1 pshA; - PROPSHEETHEADERA pshA; - memset(&pshA, 0, sizeof(pshA)); - pshA.dwSize = sizeof(pshA); - pshA.dwFlags = psh->dwFlags; - pshA.hwndParent = psh->hwndParent; - pshA.hInstance = psh->hInstance; - pshA.pszCaption = captionA; - pshA.nPages = psh->nPages; - pshA.phpage = psh->phpage; - pshA.pfnCallback = psh->pfnCallback; - - INT_PTR retval = PropertySheetA(&pshA); - - free(captionA); - return retval; -} - HWND _CreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) { @@ -329,3 +273,27 @@ return result; } +HWND _HtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData) +{ + if (pHtmlHelpW != NULL) { + return pHtmlHelpW(hwndCaller, pszFile, uCommand, dwData); + } + if (pHtmlHelpA != NULL) { + char *fileA = ToCharW(pszFile); + HWND result = pHtmlHelpA(hwndCaller, fileA, uCommand, dwData); + free(fileA); + return result; + } + return NULL; +} + +BOOL _AppendMenuW(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem) +{ + if (pAppendMenuW != NULL) { + return pAppendMenuW(hMenu, uFlags, uIDNewItem, lpNewItem); + } + char *itemA = ToCharW(lpNewItem); + BOOL result = AppendMenuA(hMenu, uFlags, uIDNewItem, itemA); + free(itemA); + return result; +} Modified: trunk/teraterm/common/layer_for_unicode.h =================================================================== --- trunk/teraterm/common/layer_for_unicode.h 2020-01-21 00:38:12 UTC (rev 8493) +++ trunk/teraterm/common/layer_for_unicode.h 2020-01-22 13:53:23 UTC (rev 8494) @@ -46,9 +46,6 @@ DWORD _GetFileAttributesW(LPCWSTR lpFileName); UINT _DragQueryFileW(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch); LRESULT _SendDlgItemMessageW(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam); -HPROPSHEETPAGE _CreatePropertySheetPageW(LPCPROPSHEETPAGEW_V1 constPropSheetPagePointer); -INT_PTR _PropertySheetW(PROPSHEETHEADERW *constPropSheetHeaderPointer); -//INT_PTR _PropertySheetW(PROPSHEETHEADERW_V1 *constPropSheetHeaderPointer); HWND _CreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam); @@ -56,7 +53,14 @@ int _DrawTextW(HDC hdc, LPCWSTR lpchText, int cchText, LPRECT lprc, UINT format); int _MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); BOOL _InsertMenuW(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); +BOOL _AppendMenuW(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); +HWND _HtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); +// Comctl32.lib +HPROPSHEETPAGE _CreatePropertySheetPageW(LPCPROPSHEETPAGEW_V1 constPropSheetPagePointer); +INT_PTR _PropertySheetW(PROPSHEETHEADERW *constPropSheetHeaderPointer); +//INT_PTR _PropertySheetW(PROPSHEETHEADERW_V1 *constPropSheetHeaderPointer); + #ifdef __cplusplus } #endif Added: trunk/teraterm/common/layer_for_unicode_comctl32.cpp =================================================================== --- trunk/teraterm/common/layer_for_unicode_comctl32.cpp (rev 0) +++ trunk/teraterm/common/layer_for_unicode_comctl32.cpp 2020-01-22 13:53:23 UTC (rev 8494) @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2019-2020 TeraTerm Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + /* + * W to A Wrapper + * + * API\x96\xBC\x82\xCDW\x94ł̓\xAA\x82\xC9 '_' \x82\xF0\x95t\x82\xAF\x82\xBD\x82\xE0\x82̂\xF0\x8Eg\x97p\x82\xB7\x82\xE9 + */ + +#include <windows.h> + +#include "codeconv.h" +#include "compat_win.h" + +#include "layer_for_unicode.h" + +HPROPSHEETPAGE _CreatePropertySheetPageW(LPCPROPSHEETPAGEW_V1 psp) +{ + if (pCreatePropertySheetPageW != NULL) { + return pCreatePropertySheetPageW((LPCPROPSHEETPAGEW)psp); + } + + char *titleA = ToCharW(psp->pszTitle); + + PROPSHEETPAGEA_V1 pspA; + memset(&pspA, 0, sizeof(pspA)); + pspA.dwSize = sizeof(pspA); + pspA.dwFlags = psp->dwFlags; + pspA.hInstance = psp->hInstance; + pspA.pResource = psp->pResource; + pspA.pszTitle = titleA; + pspA.pfnDlgProc = psp->pfnDlgProc; + pspA.lParam = psp->lParam; + + HPROPSHEETPAGE retval = CreatePropertySheetPageA((LPCPROPSHEETPAGEA)&pspA); + + free(titleA); + return retval; +} + +// \x83\x8A\x83\x8A\x81[\x83X\x97pSDK\x82̃w\x83b\x83_\x82\xC9 +// PROPSHEETHEADERW_V1 \x82\xAA\x82Ȃ\xA2\x82\xBD\x82\xDF +// PROPSHEETHEADERW \x82\xF0\x8Eg\x97p +// SDK: Windows Server 2003 R2 Platform SDK +// (Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1) +//INT_PTR _PropertySheetW(PROPSHEETHEADERW_V1 *psh) +INT_PTR _PropertySheetW(PROPSHEETHEADERW *psh) +{ + if (pPropertySheetW != NULL) { + return pPropertySheetW((PROPSHEETHEADERW *)psh); + } + + char *captionA = ToCharW(psh->pszCaption); + +// PROPSHEETHEADERA_V1 pshA; + PROPSHEETHEADERA pshA; + memset(&pshA, 0, sizeof(pshA)); + pshA.dwSize = sizeof(pshA); + pshA.dwFlags = psh->dwFlags; + pshA.hwndParent = psh->hwndParent; + pshA.hInstance = psh->hInstance; + pshA.pszCaption = captionA; + pshA.nPages = psh->nPages; + pshA.phpage = psh->phpage; + pshA.pfnCallback = psh->pfnCallback; + + INT_PTR retval = PropertySheetA(&pshA); + + free(captionA); + return retval; +} + Modified: trunk/teraterm/common/tmfc.cpp =================================================================== --- trunk/teraterm/common/tmfc.cpp 2020-01-21 00:38:12 UTC (rev 8493) +++ trunk/teraterm/common/tmfc.cpp 2020-01-22 13:53:23 UTC (rev 8494) @@ -590,6 +590,7 @@ } } +#if 0 //////////////////////////////////////// // quick hack :-( @@ -790,3 +791,4 @@ void TTCPropertySheet::OnInitDialog() { } +#endif Added: trunk/teraterm/common/tmfc_property.cpp =================================================================== --- trunk/teraterm/common/tmfc_property.cpp (rev 0) +++ trunk/teraterm/common/tmfc_property.cpp 2020-01-22 13:53:23 UTC (rev 8494) @@ -0,0 +1,243 @@ +/* + * Copyright (C) 2018-2020 TeraTerm Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Tera term Micro Framework class + * \x83v\x83\x8D\x83p\x83e\x83B\x83_\x83C\x83A\x83\x8D\x83O + */ +#include "tmfc.h" + +#include <windowsx.h> +#include <assert.h> +#include "dlglib.h" +#include "ttlib.h" +#include "layer_for_unicode.h" + +// \x83e\x83\x93\x83v\x83\x8C\x81[\x83g\x82̏\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xF0\x8Ds\x82\xA4 +#define REWRITE_TEMPLATE + +//////////////////////////////////////// + +// quick hack :-( +static HINSTANCE ghInstance; +static class TTCPropertySheet *gTTCPS; + +TTCPropertyPage::TTCPropertyPage(HINSTANCE inst, int id, TTCPropertySheet *sheet) +{ + memset(&m_psp, 0, sizeof(m_psp)); + m_psp.dwSize = sizeof(m_psp); + m_psp.dwFlags = PSP_DEFAULT; + m_psp.hInstance = inst; + m_psp.pszTemplate = MAKEINTRESOURCEW(id); +#if defined(REWRITE_TEMPLATE) + m_psp.dwFlags |= PSP_DLGINDIRECT; + m_psp.pResource = TTGetDlgTemplate(inst, MAKEINTRESOURCEA(id)); +#endif + m_psp.pfnDlgProc = Proc; + m_psp.lParam = (LPARAM)this; + + m_pSheet = sheet; +} + +TTCPropertyPage::~TTCPropertyPage() +{ + free((void *)m_psp.pResource); +} + +HPROPSHEETPAGE TTCPropertyPage::CreatePropertySheetPage() +{ + return ::_CreatePropertySheetPageW(&m_psp); +} + +void TTCPropertyPage::OnInitDialog() +{ +} + +void TTCPropertyPage::OnOK() +{ +} + +BOOL TTCPropertyPage::OnCommand(WPARAM wp, LPARAM lp) +{ + return TRUE; +} + +void TTCPropertyPage::OnHScroll(UINT nSBCode, UINT nPos, HWND pScrollBar) +{ +} + +HBRUSH TTCPropertyPage::OnCtlColor(HDC hDC, HWND hWnd) +{ + return (HBRUSH)::DefWindowProc(m_hWnd, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)hWnd); +} + +void TTCPropertyPage::OnHelp() +{ +} + +UINT CALLBACK TTCPropertyPage::PropSheetPageProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp) +{ + return 0; +} + +INT_PTR CALLBACK TTCPropertyPage::Proc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp) +{ + TTCPropertyPage *self = (TTCPropertyPage *)::GetWindowLongPtr(hDlgWnd, DWLP_USER); + switch (msg) + { + case WM_INITDIALOG: + self = (TTCPropertyPage *)(((PROPSHEETPAGE *)lp)->lParam); + ::SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)self); + self->m_hWnd = hDlgWnd; + self->OnInitDialog(); + break; + case WM_NOTIFY: + { + NMHDR * nmhdr = (NMHDR *)lp; + switch (nmhdr->code) + { + case PSN_APPLY: + self->OnOK(); + break; + case PSN_HELP: + self->OnHelp(); + break; + default: + break; + } + break; + } + case WM_COMMAND: + self->OnCommand(wp, lp); + break; + case WM_CTLCOLORSTATIC: + return (INT_PTR)self->OnCtlColor((HDC)wp, (HWND)lp); + case WM_HSCROLL: + self->OnHScroll(LOWORD(wp), HIWORD(wp), (HWND)lp); + break; + } + return FALSE; +} + +//////////////////////////////////////// + +TTCPropertySheet::TTCPropertySheet(HINSTANCE hInstance, HWND hParentWnd) +{ + m_hInst = hInstance; + m_hWnd = 0; + m_hParentWnd = hParentWnd; + memset(&m_psh, 0, sizeof(m_psh)); + m_psh.dwSize = sizeof(m_psh); + m_psh.dwFlags = PSH_DEFAULT | PSH_NOAPPLYNOW | PSH_USECALLBACK; // | PSH_MODELESS + //m_psh.dwFlags |= PSH_PROPTITLE; // \x81u\x82̃v\x83\x8D\x83p\x83e\x83B\x81[\x81v\x82\xAA\x92lj\xC1\x82\xB3\x82\xEA\x82\xE9? + m_psh.hwndParent = hParentWnd; + m_psh.hInstance = hInstance; + m_psh.pfnCallback = PropSheetProc; +} + +TTCPropertySheet::~TTCPropertySheet() +{ +} + +INT_PTR TTCPropertySheet::DoModal() +{ + ghInstance = m_hInst; + gTTCPS = this; + return _PropertySheetW(&m_psh); + + // \x83\x82\x81[\x83_\x83\x8C\x83X\x82ɂ\xB7\x82\xE9\x82ƃ^\x83u\x82̓\xAE\x82\xAB\x82\xAA\x82\xA8\x82\xA9\x82\xB5\x82\xA2 +#if 0 + // \x83\x82\x81[\x83h\x83\x8C\x83X\x83_\x83C\x83A\x83\x8D\x83O\x83{\x83b\x83N\x83X\x82̏ꍇ\x82̓E\x83B\x83\x93\x83h\x83E\x82̃n\x83\x93\x83h\x83\x8B + m_hWnd = (HWND)::PropertySheet(&m_psh); +// ShowWindow(m_hWnd, SW_SHOW); + +// ::ModifyStyle(m_hWnd, TCS_MULTILINE, TCS_SINGLELINE, 0); + + ModalResult = 0; + HWND hDlgWnd = m_hWnd; + for(;;) { + if (ModalResult != 0) { + break; + } + MSG Msg; + BOOL quit = !::GetMessage(&Msg, nullptr, nullptr, nullptr); + if (quit) { + // QM_QUIT + PostQuitMessage(0); + return IDCANCEL; + } + if ((hDlgWnd == Msg.hwnd) || + ::SendMessage(hDlgWnd, PSM_ISDIALOGMESSAGE, nullptr, (LPARAM)&Msg)) + { + // \x83_\x83C\x83A\x83\x8D\x83O\x88ȊO\x82̏\x88\x97\x9D + ::TranslateMessage(&Msg); + ::DispatchMessage(&Msg); + } + if (!SendMessage(hDlgWnd, PSM_GETCURRENTPAGEHWND, 0, 0)) { + // \x83v\x83\x8D\x83p\x83e\x83B\x81[\x83V\x81[\x83g\x8FI\x97\xB9 + break; + } + } + return ModalResult; +#endif +} + +int CALLBACK TTCPropertySheet::PropSheetProc(HWND hWnd, UINT msg, LPARAM lp) +{ + switch (msg) { + case PSCB_PRECREATE: + { +#if defined(REWRITE_TEMPLATE) + // \x83e\x83\x93\x83v\x83\x8C\x81[\x83g\x82̓\xE0\x97e\x82\xF0\x8F\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xE9 \x8A댯 + // http://home.att.ne.jp/banana/akatsuki/doc/atlwtl/atlwtl15-01/index.html + size_t PrevTemplSize; + size_t NewTemplSize; + DLGTEMPLATE *NewTempl = + TTGetNewDlgTemplate(ghInstance, (DLGTEMPLATE *)lp, + &PrevTemplSize, &NewTemplSize); + NewTempl->style &= ~DS_CONTEXTHELP; // check DLGTEMPLATEEX + memcpy((void *)lp, NewTempl, NewTemplSize); + free(NewTempl); +#endif + break; + } + case PSCB_INITIALIZED: + { + //TTCPropertySheet *self = (TTCPropertySheet *)lp; + TTCPropertySheet *self = gTTCPS; + self->m_hWnd = hWnd; + self->OnInitDialog(); + break; + } + } + return 0; +} + +void TTCPropertySheet::OnInitDialog() +{ +} Modified: trunk/teraterm/ttermpro.sln =================================================================== --- trunk/teraterm/ttermpro.sln 2020-01-21 00:38:12 UTC (rev 8493) +++ trunk/teraterm/ttermpro.sln 2020-01-22 13:53:23 UTC (rev 8494) @@ -36,6 +36,8 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "svnrev", "svnrev\svnrev.vcproj", "{80F1C3F0-A213-4D48-85C8-A265990D19A7}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_static", "common\common_static.v8.vcproj", "{DF4E3C36-A743-4FB4-8EE9-49899E69ED32}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -74,6 +76,10 @@ {80F1C3F0-A213-4D48-85C8-A265990D19A7}.Debug|Win32.Build.0 = Debug|Win32 {80F1C3F0-A213-4D48-85C8-A265990D19A7}.Release|Win32.ActiveCfg = Release|Win32 {80F1C3F0-A213-4D48-85C8-A265990D19A7}.Release|Win32.Build.0 = Release|Win32 + {DF4E3C36-A743-4FB4-8EE9-49899E69ED32}.Debug|Win32.ActiveCfg = Debug|Win32 + {DF4E3C36-A743-4FB4-8EE9-49899E69ED32}.Debug|Win32.Build.0 = Debug|Win32 + {DF4E3C36-A743-4FB4-8EE9-49899E69ED32}.Release|Win32.ActiveCfg = Release|Win32 + {DF4E3C36-A743-4FB4-8EE9-49899E69ED32}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/teraterm/ttermpro.v16.sln =================================================================== --- trunk/teraterm/ttermpro.v16.sln 2020-01-21 00:38:12 UTC (rev 8493) +++ trunk/teraterm/ttermpro.v16.sln 2020-01-22 13:53:23 UTC (rev 8494) @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 16 +# Visual Studio Version 16 VisualStudioVersion = 16.0.28803.156 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ttermpro", "teraterm\ttermpro.v16.vcxproj", "{BC4CDBE3-6269-47A8-BD74-EEB3A6160E06}" @@ -18,6 +18,8 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "svnrev", "svnrev\svnrev.v16.vcxproj", "{80F1C3F0-A213-4D48-85C8-A265990D19A7}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common_static", "common\common_static.v16.vcxproj", "{AC42387D-23EC-45DB-81F9-8933C7EFA52A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -56,6 +58,10 @@ {80F1C3F0-A213-4D48-85C8-A265990D19A7}.Debug|Win32.Build.0 = Debug|Win32 {80F1C3F0-A213-4D48-85C8-A265990D19A7}.Release|Win32.ActiveCfg = Release|Win32 {80F1C3F0-A213-4D48-85C8-A265990D19A7}.Release|Win32.Build.0 = Release|Win32 + {AC42387D-23EC-45DB-81F9-8933C7EFA52A}.Debug|Win32.ActiveCfg = Debug|Win32 + {AC42387D-23EC-45DB-81F9-8933C7EFA52A}.Debug|Win32.Build.0 = Debug|Win32 + {AC42387D-23EC-45DB-81F9-8933C7EFA52A}.Release|Win32.ActiveCfg = Release|Win32 + {AC42387D-23EC-45DB-81F9-8933C7EFA52A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE