-
Notifications
You must be signed in to change notification settings - Fork 5
/
RMenuDlg.cpp
145 lines (133 loc) · 5.16 KB
/
RMenuDlg.cpp
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
//Copyright+LGPL
//-----------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 2000-2013 Makoto Mori, Nobuyuki Oba
//-----------------------------------------------------------------------------------------------------------------------------------------------
// This file is part of MMVARI.
// MMVARI 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.
// MMVARI 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 "RMenuDlg.h"
#include "Main.h"
//---------------------------------------------------------------------
#pragma resource "*.dfm"
//TRMenuDialog *RMenuDialog;
static LPCSTR g_help={
"コマンド\r\n"
"\r\n"
"\\$##... ##=00-FF, 送信する複数バイトを16進数で定義する\r\n"
" (例:\\$FE55AA -> FEh,55h,AAh)\r\n"
"\\x## ##=00-FF, 送信する1バイトを16進数で定義する\r\n"
" (例:\\xFE\\x55\\xAA -> FEh, 55h, AAh)\r\n"
"\\w## ##=00-99, ディレイ時間を10ms単位の10進数で定義する\r\n"
" (例:\\w05 -> wait 50ms)\r\n"
"\\r キャリッジリターンを送信する\r\n"
"\\n ラインフィードを送信する\r\n"
"\\c.... 以降はすべてコメント\r\n"
"\\\\ '\\'文字を送信する\r\n"
"その他 その文字列を送信する\r\n"
"\r\n"
"##の代わりにxxを記述すると、その部分はxx入力ボックスで定義した16進数に置き換わります。\r\n"
"この変換はICOMの機種アドレスを指定する場合に使用します。\r\n"
" 例:\\$FEFExxE01C0001FD (xxの部分が定義内容に置き換わる)"
};
static LPCSTR g_helpeng={
" This command sends a radio command to the rig. It will work for any rig. Use the following keyword to specify byte data in hexadecimal number.\r\n"
"\r\n"
"\\$##... ##=00-FF, Specify the byte data string in the hexadecimal format\r\n"
" (Example: \\$FE55AA -> $FE,$55,$AA)\r\n"
" ICOM CI-V address can be expressed by xx\r\n"
"\\x## ##=00-FF, Specify one byte in the hexadecimal format\r\n"
" (Example: \\xFE\\x55\\xAA -> $FE, $55, $AA)\r\n"
"\\w## ##=00-99, Specify the delay time\r\n"
" (Example: \\w05 -> wait 50ms)\r\n"
"\\r Send a carriage return\r\n"
"\\n Send a line feed\r\n"
"\\c.... Comment\r\n"
"\\\\ '\\' send character\r\n"
"Others Send the character as is"
};
//---------------------------------------------------------------------
__fastcall TRMenuDialog::TRMenuDialog(TComponent* AOwner)
: TForm(AOwner)
{
FormStyle = ((TForm *)AOwner)->FormStyle;
Font->Name = ((TForm *)AOwner)->Font->Name;
Font->Charset = ((TForm *)AOwner)->Font->Charset;
if( sys.m_MsgEng ){
LH->Font->Name = "Arial";
LH->Font->Charset = ((TForm *)AOwner)->Font->Charset;
L1->Caption = "Caption";
L2->Caption = "Command";
Caption = "Edit menu";
SBDel->Caption = "Delete this menu";
SBIns->Caption = "Insert this menu";
CancelBtn->Caption = "Cancel";
LH->Caption = g_helpeng;
}
else {
LH->Caption = g_help;
}
}
//---------------------------------------------------------------------
void __fastcall TRMenuDialog::UpdateUI(void)
{
if( SBIns->Visible ){
SBIns->Enabled = MainVARI->m_nRadioMenu < RADIOMENUMAX;
}
}
//---------------------------------------------------------------------
int __fastcall TRMenuDialog::Execute(AnsiString &strTTL, AnsiString &strCMD, int fAdd)
{
if( fAdd ){
Caption = sys.m_MsgEng ? "Add menu" : "メニューの追加";
SBDel->Visible = FALSE;
SBIns->Visible = FALSE;
}
ETTL->Text = strTTL;
ECMD->Text = strCMD;
UpdateUI();
int r = ShowModal();
strTTL = ETTL->Text;
strCMD = ECMD->Text;
return r;
}
//---------------------------------------------------------------------
void __fastcall TRMenuDialog::SBDelClick(TObject *Sender)
{
ModalResult = 1024;
}
//---------------------------------------------------------------------------
void __fastcall TRMenuDialog::SBInsClick(TObject *Sender)
{
ModalResult = 1025;
}
//---------------------------------------------------------------------------
void __fastcall TRMenuDialog::SBRefClick(TObject *Sender)
{
TOpenDialog *pBox = new TOpenDialog(this);
pBox->Options >> ofCreatePrompt;
pBox->Options << ofFileMustExist;
if( sys.m_MsgEng ){
pBox->Title = "Open command file";
pBox->Filter = "Command files(*.rcm)|*.rcm|";
}
else {
pBox->Title = "コマンド定義ファイルを開く";
pBox->Filter = "コマンド定義ファイル(*.rcm)|*.rcm|";
}
pBox->FileName = "";
pBox->DefaultExt = "rcm";
pBox->InitialDir = sys.m_BgnDir;
if( pBox->Execute() == TRUE ){
ECMD->Text = pBox->FileName.c_str();
}
delete pBox;
}
//---------------------------------------------------------------------------