Tera Termの色設定をセットで切り替えます。
Revisão | 2ee9ac8be4cbbadf36da69559816912964dc7f4b (tree) |
---|---|
Hora | 2022-04-17 23:36:55 |
Autor | IWAMOTO Kouichi <sue@iwmt...> |
Commiter | IWAMOTO Kouichi |
Tera Term 5 のソースに対応した
Tera Term 5 のソースでビルドする場合は VS2019 を使う必要がある。
@@ -4,4 +4,4 @@ | ||
4 | 4 | *.suo |
5 | 5 | *.aps |
6 | 6 | *.vcproj.*.user |
7 | - | |
7 | +*.vcxproj.user |
@@ -31,7 +31,16 @@ | ||
31 | 31 | #include <stdio.h> |
32 | 32 | #include <string.h> |
33 | 33 | |
34 | -#include "compat_w95.h" | |
34 | +#if TT_VERSION_MAJOR == 5 | |
35 | + #include "compat_win.h" | |
36 | + #include "inifile_com.h" | |
37 | + #pragma comment(lib, "common_static.lib") | |
38 | + typedef const wchar_t *TTXIniFile; | |
39 | +#else | |
40 | + #include "compat_w95.h" | |
41 | + #define GetPrivateProfileStringAFileW GetPrivateProfileString | |
42 | + typedef char *TTXIniFile; | |
43 | +#endif | |
35 | 44 | |
36 | 45 | #define ORDER 5900 |
37 | 46 | #define SECTION "Color Theme" |
@@ -182,12 +191,12 @@ static void PASCAL TTXGetUIHooks(TTXUIHooks *hooks) { | ||
182 | 191 | return; |
183 | 192 | } |
184 | 193 | |
185 | -void ReadANSIColorSetting(TAnsiColorSetting *color, int num, char *fn) { | |
194 | +void ReadANSIColorSetting(TAnsiColorSetting *color, int num, TTXIniFile fn) { | |
186 | 195 | char Key[32], Buff[512]; |
187 | 196 | int c, r, g, b; |
188 | 197 | |
189 | 198 | _snprintf_s(Key, sizeof(Key), _TRUNCATE, "ANSIColor_%d", num + 1); |
190 | - GetPrivateProfileString(SECTION, Key, "0", Buff, sizeof(Buff), fn); | |
199 | + GetPrivateProfileStringAFileW(SECTION, Key, "0", Buff, sizeof(Buff), fn); | |
191 | 200 | |
192 | 201 | GetNthNum(Buff, 1, &c); |
193 | 202 | color->change = c; |
@@ -205,12 +214,12 @@ void ReadANSIColorSetting(TAnsiColorSetting *color, int num, char *fn) { | ||
205 | 214 | return; |
206 | 215 | } |
207 | 216 | |
208 | -void ReadColorSetting(TColorSetting *color, char *ent, int num, char *fn) { | |
217 | +void ReadColorSetting(TColorSetting *color, char *ent, int num, TTXIniFile fn) { | |
209 | 218 | char Key[32], Buff[512]; |
210 | 219 | int c, r, g, b; |
211 | 220 | |
212 | 221 | _snprintf_s(Key, sizeof(Key), _TRUNCATE, "%s_%d", ent, num + 1); |
213 | - GetPrivateProfileString(SECTION, Key, "0", Buff, sizeof(Buff), fn); | |
222 | + GetPrivateProfileStringAFileW(SECTION, Key, "0", Buff, sizeof(Buff), fn); | |
214 | 223 | |
215 | 224 | GetNthNum(Buff, 1, &c); |
216 | 225 | color->change = c; |
@@ -243,7 +252,7 @@ void GetDefaultColor(TColorSetting *tc, COLORREF *color, int field, PTTSet ts) { | ||
243 | 252 | return; |
244 | 253 | } |
245 | 254 | |
246 | -static void PASCAL ColorThemeReadIniFile(PCHAR fn, PTTSet ts) { | |
255 | +static void PASCAL ColorThemeReadIniFile(TTXIniFile fn, PTTSet ts) { | |
247 | 256 | int i; |
248 | 257 | char Key[20]; |
249 | 258 |
@@ -263,7 +272,7 @@ static void PASCAL ColorThemeReadIniFile(PCHAR fn, PTTSet ts) { | ||
263 | 272 | |
264 | 273 | for (i=0; i<MAX_MENU_ITEMS; i++) { |
265 | 274 | _snprintf_s(Key, sizeof(Key), _TRUNCATE, "Theme_%d", i+1); |
266 | - GetPrivateProfileString(SECTION, Key, "", pvar->ThemeList[i].name, | |
275 | + GetPrivateProfileStringAFileW(SECTION, Key, "", pvar->ThemeList[i].name, | |
267 | 276 | sizeof(pvar->ThemeList[i].name), fn); |
268 | 277 | if (pvar->ThemeList[i].name[0] == '\0') |
269 | 278 | break; |
@@ -425,7 +434,9 @@ BOOL WINAPI DllMain(HANDLE hInstance, ULONG ul_reason, LPVOID lpReserved) | ||
425 | 434 | break; |
426 | 435 | case DLL_PROCESS_ATTACH: |
427 | 436 | /* do process initialization */ |
437 | +#if TT_VERSION_MAJOR != 5 | |
428 | 438 | DoCover_IsDebuggerPresent(); |
439 | +#endif | |
429 | 440 | hInst = hInstance; |
430 | 441 | pvar = &InstVar; |
431 | 442 | break; |
@@ -62,6 +62,7 @@ | ||
62 | 62 | <Tool |
63 | 63 | Name="VCLinkerTool" |
64 | 64 | AdditionalDependencies=""$(SolutionDir)..\teraterm\$(ConfigurationName)\ttpcmn.lib"" |
65 | + AdditionalLibraryDirectories=""$(SolutionDir)..\teraterm\$(Configuration)"" | |
65 | 66 | LinkIncremental="2" |
66 | 67 | GenerateDebugInformation="true" |
67 | 68 | SubSystem="2" |
@@ -137,6 +138,7 @@ | ||
137 | 138 | <Tool |
138 | 139 | Name="VCLinkerTool" |
139 | 140 | AdditionalDependencies=""$(SolutionDir)..\teraterm\$(ConfigurationName)\ttpcmn.lib"" |
141 | + AdditionalLibraryDirectories=""$(SolutionDir)..\teraterm\$(Configuration)"" | |
140 | 142 | LinkIncremental="1" |
141 | 143 | GenerateDebugInformation="true" |
142 | 144 | SubSystem="2" |
@@ -0,0 +1,104 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
3 | + <ItemGroup Label="ProjectConfigurations"> | |
4 | + <ProjectConfiguration Include="Debug|Win32"> | |
5 | + <Configuration>Debug</Configuration> | |
6 | + <Platform>Win32</Platform> | |
7 | + </ProjectConfiguration> | |
8 | + <ProjectConfiguration Include="Release|Win32"> | |
9 | + <Configuration>Release</Configuration> | |
10 | + <Platform>Win32</Platform> | |
11 | + </ProjectConfiguration> | |
12 | + </ItemGroup> | |
13 | + <PropertyGroup Label="Globals"> | |
14 | + <ProjectGuid>{35CA825D-EDF8-4E3B-B621-F576F10C72BE}</ProjectGuid> | |
15 | + <RootNamespace>TTXColorTheme</RootNamespace> | |
16 | + <Keyword>Win32Proj</Keyword> | |
17 | + </PropertyGroup> | |
18 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | |
19 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | |
20 | + <ConfigurationType>DynamicLibrary</ConfigurationType> | |
21 | + <PlatformToolset>v142</PlatformToolset> | |
22 | + <CharacterSet>NotSet</CharacterSet> | |
23 | + <WholeProgramOptimization>true</WholeProgramOptimization> | |
24 | + </PropertyGroup> | |
25 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | |
26 | + <ConfigurationType>DynamicLibrary</ConfigurationType> | |
27 | + <PlatformToolset>v142</PlatformToolset> | |
28 | + <CharacterSet>NotSet</CharacterSet> | |
29 | + </PropertyGroup> | |
30 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | |
31 | + <ImportGroup Label="ExtensionSettings"> | |
32 | + </ImportGroup> | |
33 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | |
34 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
35 | + </ImportGroup> | |
36 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | |
37 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
38 | + </ImportGroup> | |
39 | + <PropertyGroup Label="UserMacros" /> | |
40 | + <PropertyGroup> | |
41 | + <_ProjectFileVersion>16.0.30804.86</_ProjectFileVersion> | |
42 | + </PropertyGroup> | |
43 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
44 | + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> | |
45 | + <IntDir>$(Configuration)\</IntDir> | |
46 | + <LinkIncremental>true</LinkIncremental> | |
47 | + </PropertyGroup> | |
48 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
49 | + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> | |
50 | + <IntDir>$(Configuration)\</IntDir> | |
51 | + <LinkIncremental>false</LinkIncremental> | |
52 | + </PropertyGroup> | |
53 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
54 | + <ClCompile> | |
55 | + <Optimization>Disabled</Optimization> | |
56 | + <AdditionalIncludeDirectories>$(SolutionDir)..\teraterm\common;$(SolutionDir)..\teraterm\teraterm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
57 | + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
58 | + <MinimalRebuild>true</MinimalRebuild> | |
59 | + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | |
60 | + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | |
61 | + <PrecompiledHeader /> | |
62 | + <WarningLevel>Level3</WarningLevel> | |
63 | + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> | |
64 | + </ClCompile> | |
65 | + <Link> | |
66 | + <AdditionalDependencies>$(SolutionDir)..\teraterm\$(Configuration)\ttpcmn.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
67 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
68 | + <SubSystem>Windows</SubSystem> | |
69 | + <TargetMachine>MachineX86</TargetMachine> | |
70 | + <AdditionalLibraryDirectories>$(SolutionDir)..\teraterm\$(Configuration)</AdditionalLibraryDirectories> | |
71 | + </Link> | |
72 | + </ItemDefinitionGroup> | |
73 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
74 | + <ClCompile> | |
75 | + <AdditionalIncludeDirectories>$(SolutionDir)..\teraterm\common;$(SolutionDir)..\teraterm\teraterm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
76 | + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
77 | + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | |
78 | + <PrecompiledHeader /> | |
79 | + <WarningLevel>Level3</WarningLevel> | |
80 | + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | |
81 | + </ClCompile> | |
82 | + <Link> | |
83 | + <AdditionalDependencies>$(SolutionDir)..\teraterm\$(Configuration)\ttpcmn.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
84 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
85 | + <SubSystem>Windows</SubSystem> | |
86 | + <OptimizeReferences>true</OptimizeReferences> | |
87 | + <EnableCOMDATFolding>true</EnableCOMDATFolding> | |
88 | + <TargetMachine>MachineX86</TargetMachine> | |
89 | + <AdditionalLibraryDirectories>$(SolutionDir)..\teraterm\$(Configuration)</AdditionalLibraryDirectories> | |
90 | + </Link> | |
91 | + </ItemDefinitionGroup> | |
92 | + <ItemGroup> | |
93 | + <ClCompile Include="TTXColorTheme.c" /> | |
94 | + </ItemGroup> | |
95 | + <ItemGroup> | |
96 | + <None Include="LICENSE" /> | |
97 | + </ItemGroup> | |
98 | + <ItemGroup> | |
99 | + <Text Include="ReadMe.txt" /> | |
100 | + </ItemGroup> | |
101 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |
102 | + <ImportGroup Label="ExtensionTargets"> | |
103 | + </ImportGroup> | |
104 | +</Project> | |
\ No newline at end of file |
@@ -0,0 +1,27 @@ | ||
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
3 | + <ItemGroup> | |
4 | + <Filter Include="Source Files"> | |
5 | + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | |
6 | + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | |
7 | + </Filter> | |
8 | + <Filter Include="ReadMe"> | |
9 | + <UniqueIdentifier>{5a8b7529-cf5f-43a0-9613-39bc05580a57}</UniqueIdentifier> | |
10 | + </Filter> | |
11 | + </ItemGroup> | |
12 | + <ItemGroup> | |
13 | + <ClCompile Include="TTXColorTheme.c"> | |
14 | + <Filter>Source Files</Filter> | |
15 | + </ClCompile> | |
16 | + </ItemGroup> | |
17 | + <ItemGroup> | |
18 | + <None Include="LICENSE"> | |
19 | + <Filter>ReadMe</Filter> | |
20 | + </None> | |
21 | + </ItemGroup> | |
22 | + <ItemGroup> | |
23 | + <Text Include="ReadMe.txt"> | |
24 | + <Filter>ReadMe</Filter> | |
25 | + </Text> | |
26 | + </ItemGroup> | |
27 | +</Project> | |
\ No newline at end of file |