-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSetHelp.cpp
More file actions
193 lines (181 loc) · 6.47 KB
/
SetHelp.cpp
File metadata and controls
193 lines (181 loc) · 6.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
//Copyright+LGPL
//-----------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 2000-2013 Makoto Mori, Nobuyuki Oba
//-----------------------------------------------------------------------------------------------------------------------------------------------
// This file is part of MMTTY.
// MMTTY is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// MMTTY 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 Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public License along with MMTTY. If not, see
// <http://www.gnu.org/licenses/>.
//-----------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "SetHelp.h"
//---------------------------------------------------------------------
#pragma resource "*.dfm"
//TSetHelpBox *SetHelpBox;
//---------------------------------------------------------------------
__fastcall TSetHelpBox::TSetHelpBox(TComponent* AOwner)
: TForm(AOwner)
{
FormStyle = ((TForm *)AOwner)->FormStyle;
Font->Name = ((TForm *)AOwner)->Font->Name;
Font->Charset = ((TForm *)AOwner)->Font->Charset;
if( Font->Charset != SHIFTJIS_CHARSET ){
CancelBtn->Caption = "Cancel";
NotePad->Caption = "Use NotePad";
FontBtn->Caption = "Font";
}
}
//---------------------------------------------------------------------
int __fastcall TSetHelpBox::Execute(void)
{
m_HelpFontName = sys.m_HelpFontName;
m_HelpFontCharset = sys.m_HelpFontCharset;
m_HelpFontSize = sys.m_HelpFontSize;
EditHTML->Text = sys.m_HTMLHelp;
EditMMTTY->Text = sys.m_Help;
EditLog->Text = sys.m_HelpLog;
EditDigital->Text = sys.m_HelpDigital;
NotePad->Checked = sys.m_HelpNotePad;
if( ShowModal() == IDOK ){
sys.m_HelpFontName = m_HelpFontName;
sys.m_HelpFontCharset = m_HelpFontCharset;
sys.m_HelpFontSize = m_HelpFontSize;
sys.m_HTMLHelp = EditHTML->Text;
sys.m_Help = EditMMTTY->Text;
sys.m_HelpLog = EditLog->Text;
sys.m_HelpDigital = EditDigital->Text;
sys.m_HelpNotePad = NotePad->Checked;
return TRUE;
}
else {
return FALSE;
}
}
//---------------------------------------------------------------------
void __fastcall TSetHelpBox::JABtnClick(TObject *Sender)
{
EditHTML->Text = "";
EditMMTTY->Text = "Mmtty.txt";
EditLog->Text = "Mmttylog.txt";
EditDigital->Text = "Digital.txt";
m_HelpFontName = "MS ゴシック";
m_HelpFontCharset = SHIFTJIS_CHARSET;
m_HelpFontSize = 10;
}
//---------------------------------------------------------------------------
void __fastcall TSetHelpBox::EngBtnClick(TObject *Sender)
{
EditHTML->Text = "KB2EOQ.htm";
EditMMTTY->Text = "MmttyE.txt";
EditLog->Text = "LogE.txt";
EditDigital->Text = "DigitalE.txt";
m_HelpFontName = "Courier";//"Courier New";
m_HelpFontCharset = ANSI_CHARSET;
m_HelpFontSize = 10;
}
//---------------------------------------------------------------------------
void __fastcall TSetHelpBox::FontBtnClick(TObject *Sender)
{
FontDialog->Font->Name = m_HelpFontName;
FontDialog->Font->Charset = m_HelpFontCharset;
FontDialog->Font->Size = m_HelpFontSize;
NormalWindow(this);
if( FontDialog->Execute() == TRUE ){
m_HelpFontName = FontDialog->Font->Name;
m_HelpFontCharset = FontDialog->Font->Charset;
m_HelpFontSize = FontDialog->Font->Size;
}
TopWindow(this);
}
//---------------------------------------------------------------------------
int TSetHelpBox::SetFileName(AnsiString &as)
{
OpenDialog->Options >> ofCreatePrompt;
OpenDialog->Options << ofFileMustExist;
if(sys.m_WinFontCharset != SHIFTJIS_CHARSET){
OpenDialog->Title = "Choose help file";
OpenDialog->Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*|";
}
else {
OpenDialog->Title = "ヘルプファイルの選択";
OpenDialog->Filter = "テキストファイル(*.txt)|*.txt|すべてのファイル(*.*)|*.*|";
}
OpenDialog->FileName = as.c_str();
OpenDialog->DefaultExt = "txt";
OpenDialog->InitialDir = BgnDir;
NormalWindow(this);
if( OpenDialog->Execute() == TRUE ){
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char name[_MAX_FNAME];
char ext[_MAX_EXT];
::_splitpath(AnsiString(OpenDialog->FileName).c_str(), drive, dir, name, ext ); //JA7UDE 0428
as = name;
as += ext;
TopWindow(this);
return TRUE;
}
else {
TopWindow(this);
return FALSE;
}
}
//---------------------------------------------------------------------------
void __fastcall TSetHelpBox::RefMMTTYClick(TObject *Sender)
{
AnsiString as = EditMMTTY->Text.c_str();
if( SetFileName(as) == TRUE ){
EditMMTTY->Text = as.c_str();
}
}
//---------------------------------------------------------------------------
void __fastcall TSetHelpBox::RefLogClick(TObject *Sender)
{
AnsiString as = EditLog->Text.c_str();
if( SetFileName(as) == TRUE ){
EditLog->Text = as.c_str();
}
}
//---------------------------------------------------------------------------
void __fastcall TSetHelpBox::RefDigitalClick(TObject *Sender)
{
AnsiString as = EditDigital->Text.c_str();
if( SetFileName(as) == TRUE ){
EditDigital->Text = as.c_str();
}
}
//---------------------------------------------------------------------------
void __fastcall TSetHelpBox::RefHTMLClick(TObject *Sender)
{
OpenDialog->Options >> ofCreatePrompt;
OpenDialog->Options << ofFileMustExist;
if(sys.m_WinFontCharset != SHIFTJIS_CHARSET){
OpenDialog->Title = "Choose HTML/Windows help file";
}
else {
OpenDialog->Title = "HTML/Windowsヘルプファイルの選択";
}
OpenDialog->Filter = "HTML/Windows help files(*.chm;*.htm;*.html;*.hlp)|*.chm;*.htm;*.html;*.hlp";
OpenDialog->FileName = EditHTML->Text.c_str();
OpenDialog->DefaultExt = "chm";
OpenDialog->InitialDir = BgnDir;
NormalWindow(this);
if( OpenDialog->Execute() == TRUE ){
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char name[_MAX_FNAME];
char ext[_MAX_EXT];
::_splitpath(AnsiString(OpenDialog->FileName).c_str(), drive, dir, name, ext ); //JA7UDE 0428
AnsiString as;
as = name;
as += ext;
EditHTML->Text = as.c_str();
}
TopWindow(this);
}
//---------------------------------------------------------------------------