|
@@ -9,7 +9,8 @@ interface
|
|
uses
|
|
uses
|
|
Windows, Classes, SysUtils, FileUtil, SdpoSerial, Forms, Controls, Graphics, Dialogs,
|
|
Windows, Classes, SysUtils, FileUtil, SdpoSerial, Forms, Controls, Graphics, Dialogs,
|
|
Grids, ExtCtrls, Menus, ComCtrls, ActnList, StdActns, LCLProc, StdCtrls, Spin,
|
|
Grids, ExtCtrls, Menus, ComCtrls, ActnList, StdActns, LCLProc, StdCtrls, Spin,
|
|
- XMLPropStorage, uSPS, LCLType, Buttons, types, MCSWINAPI, Math, fpjson, jsonparser, Midi;
|
|
|
|
|
|
+ XMLPropStorage, uSPS, LCLType, Buttons, types, MCSWINAPI, Math,
|
|
|
|
+ fpjson, jsonparser, Midi;
|
|
|
|
|
|
type
|
|
type
|
|
|
|
|
|
@@ -29,10 +30,10 @@ type
|
|
acHelpAbout: TAction;
|
|
acHelpAbout: TAction;
|
|
acHexFile: TAction;
|
|
acHexFile: TAction;
|
|
acNextInsert: TAction;
|
|
acNextInsert: TAction;
|
|
|
|
+ acSaveAs: TAction;
|
|
acUpload: TAction;
|
|
acUpload: TAction;
|
|
ActionList1: TActionList;
|
|
ActionList1: TActionList;
|
|
acFileOpen: TFileOpen;
|
|
acFileOpen: TFileOpen;
|
|
- acFileSaveAs: TFileSaveAs;
|
|
|
|
btnTone: TBitBtn;
|
|
btnTone: TBitBtn;
|
|
cbTPSVersion: TComboBox;
|
|
cbTPSVersion: TComboBox;
|
|
cbAdrActual: TCheckBox;
|
|
cbAdrActual: TCheckBox;
|
|
@@ -44,11 +45,14 @@ type
|
|
acPresetSave: TFileSaveAs;
|
|
acPresetSave: TFileSaveAs;
|
|
GBControl: TGroupBox;
|
|
GBControl: TGroupBox;
|
|
ImageList2: TImageList;
|
|
ImageList2: TImageList;
|
|
|
|
+ ImageList3: TImageList;
|
|
Label3: TLabel;
|
|
Label3: TLabel;
|
|
Label4: TLabel;
|
|
Label4: TLabel;
|
|
Label5: TLabel;
|
|
Label5: TLabel;
|
|
lbStack: TListBox;
|
|
lbStack: TListBox;
|
|
MCSLabel: TLabel;
|
|
MCSLabel: TLabel;
|
|
|
|
+ MenuItem1: TMenuItem;
|
|
|
|
+ pmExamples: TPopupMenu;
|
|
RC1: TSpinEdit;
|
|
RC1: TSpinEdit;
|
|
RC2: TSpinEdit;
|
|
RC2: TSpinEdit;
|
|
cbCommand: TComboBox;
|
|
cbCommand: TComboBox;
|
|
@@ -60,7 +64,6 @@ type
|
|
GBOutput: TGroupBox;
|
|
GBOutput: TGroupBox;
|
|
GBInput: TGroupBox;
|
|
GBInput: TGroupBox;
|
|
GBInternal: TGroupBox;
|
|
GBInternal: TGroupBox;
|
|
- ImageList1: TImageList;
|
|
|
|
Label1: TLabel;
|
|
Label1: TLabel;
|
|
Label10: TLabel;
|
|
Label10: TLabel;
|
|
Label11: TLabel;
|
|
Label11: TLabel;
|
|
@@ -127,6 +130,8 @@ type
|
|
tbPreset6: TToolButton;
|
|
tbPreset6: TToolButton;
|
|
tbPreset7: TToolButton;
|
|
tbPreset7: TToolButton;
|
|
tbPreset8: TToolButton;
|
|
tbPreset8: TToolButton;
|
|
|
|
+ ToolButton20: TToolButton;
|
|
|
|
+ ToolButton21: TToolButton;
|
|
ToolButton3: TToolButton;
|
|
ToolButton3: TToolButton;
|
|
ToolButton4: TToolButton;
|
|
ToolButton4: TToolButton;
|
|
ToolButton5: TToolButton;
|
|
ToolButton5: TToolButton;
|
|
@@ -140,7 +145,6 @@ type
|
|
procedure acDeleteRowExecute(Sender: TObject);
|
|
procedure acDeleteRowExecute(Sender: TObject);
|
|
procedure acExitExecute(Sender: TObject);
|
|
procedure acExitExecute(Sender: TObject);
|
|
procedure acFileOpenAccept(Sender: TObject);
|
|
procedure acFileOpenAccept(Sender: TObject);
|
|
- procedure acFileSaveAsAccept(Sender: TObject);
|
|
|
|
procedure acDebugExecute(Sender: TObject);
|
|
procedure acDebugExecute(Sender: TObject);
|
|
procedure acHelpAboutExecute(Sender: TObject);
|
|
procedure acHelpAboutExecute(Sender: TObject);
|
|
procedure acHexFileExecute(Sender: TObject);
|
|
procedure acHexFileExecute(Sender: TObject);
|
|
@@ -150,6 +154,7 @@ type
|
|
procedure acNextStepExecute(Sender: TObject);
|
|
procedure acNextStepExecute(Sender: TObject);
|
|
procedure acPresetLoadAccept(Sender: TObject);
|
|
procedure acPresetLoadAccept(Sender: TObject);
|
|
procedure acPresetSaveAccept(Sender: TObject);
|
|
procedure acPresetSaveAccept(Sender: TObject);
|
|
|
|
+ procedure acSaveAsExecute(Sender: TObject);
|
|
procedure acShowHexFileExecute(Sender: TObject);
|
|
procedure acShowHexFileExecute(Sender: TObject);
|
|
procedure acStopExecute(Sender: TObject);
|
|
procedure acStopExecute(Sender: TObject);
|
|
procedure acThisStepExecute(Sender: TObject);
|
|
procedure acThisStepExecute(Sender: TObject);
|
|
@@ -163,14 +168,19 @@ type
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
|
|
procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
|
|
procedure MCSLabelClick(Sender: TObject);
|
|
procedure MCSLabelClick(Sender: TObject);
|
|
|
|
+ procedure MenuItem1Click(Sender: TObject);
|
|
procedure mnSaveClick(Sender: TObject);
|
|
procedure mnSaveClick(Sender: TObject);
|
|
|
|
+ procedure pmExamplesPopup(Sender: TObject);
|
|
procedure Shape1Paint(Sender: TObject);
|
|
procedure Shape1Paint(Sender: TObject);
|
|
procedure Shape2Paint(Sender: TObject);
|
|
procedure Shape2Paint(Sender: TObject);
|
|
procedure StringGrid1EditingDone(Sender: TObject);
|
|
procedure StringGrid1EditingDone(Sender: TObject);
|
|
procedure StringGrid1Selection(Sender: TObject; aCol, aRow: integer);
|
|
procedure StringGrid1Selection(Sender: TObject; aCol, aRow: integer);
|
|
procedure tbPreset1Click(Sender: TObject);
|
|
procedure tbPreset1Click(Sender: TObject);
|
|
- procedure tbPreset1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: boolean);
|
|
|
|
|
|
+ procedure tbPreset1ContextPopup(Sender: TObject; MousePos: TPoint;
|
|
|
|
+ var Handled: boolean);
|
|
|
|
+ procedure tbPrgChange(Sender: TObject);
|
|
procedure tbResetClick(Sender: TObject);
|
|
procedure tbResetClick(Sender: TObject);
|
|
|
|
+ procedure tbSelChange(Sender: TObject);
|
|
procedure Timer1Timer(Sender: TObject);
|
|
procedure Timer1Timer(Sender: TObject);
|
|
private
|
|
private
|
|
{ private declarations }
|
|
{ private declarations }
|
|
@@ -179,8 +189,10 @@ type
|
|
activeFile: string;
|
|
activeFile: string;
|
|
dirty: boolean;
|
|
dirty: boolean;
|
|
lastNote: byte;
|
|
lastNote: byte;
|
|
|
|
+ Examples: TStringList;
|
|
procedure initMidi;
|
|
procedure initMidi;
|
|
procedure playNote(note: byte);
|
|
procedure playNote(note: byte);
|
|
|
|
+ procedure loadFromList(Lines: TStringList; filename: string);
|
|
function readString(var line: string): boolean;
|
|
function readString(var line: string): boolean;
|
|
procedure saveSection(filename: string; key: string);
|
|
procedure saveSection(filename: string; key: string);
|
|
procedure loadSection(filename: string; key: string);
|
|
procedure loadSection(filename: string; key: string);
|
|
@@ -214,7 +226,7 @@ var
|
|
implementation
|
|
implementation
|
|
|
|
|
|
uses MCSAbout, uTextUi, uSelectCom, MCSTools, MCSStrings, synaser,
|
|
uses MCSAbout, uTextUi, uSelectCom, MCSTools, MCSStrings, synaser,
|
|
- MCSIO, mcsintelhex, MCSLSU, MCSIniFiles;
|
|
|
|
|
|
+ MCSIO, mcsintelhex, MCSLSU, MCSIniFiles, MCSWinHttp, luijsonutils;
|
|
|
|
|
|
{$R *.lfm}
|
|
{$R *.lfm}
|
|
|
|
|
|
@@ -238,11 +250,12 @@ begin
|
|
Infobox.Build := MCSGetVersion(Application.ExeName);
|
|
Infobox.Build := MCSGetVersion(Application.ExeName);
|
|
Infobox.AppID := 31;
|
|
Infobox.AppID := 31;
|
|
Infobox.AppURL :=
|
|
Infobox.AppURL :=
|
|
- 'http://www.wk-music.de/pages/mcs/microcontroller/tps-sps-emulator.php';
|
|
|
|
|
|
+ 'http://www.wk-music.de/willie/pages/mcs/microcontroller/tps-sps-emulator.php';
|
|
sps := TSPS.Create();
|
|
sps := TSPS.Create();
|
|
sps.setDelayCallback(@delayCallback);
|
|
sps.setDelayCallback(@delayCallback);
|
|
addHeaderText;
|
|
addHeaderText;
|
|
renumberGrid();
|
|
renumberGrid();
|
|
|
|
+ cbTPSVersion.ItemIndex := 0;
|
|
cbTPSVersionChange(Sender);
|
|
cbTPSVersionChange(Sender);
|
|
acStop.Enabled := False;
|
|
acStop.Enabled := False;
|
|
ToolButton18.Align := alRight;
|
|
ToolButton18.Align := alRight;
|
|
@@ -259,6 +272,7 @@ begin
|
|
Timer1.Enabled := True;
|
|
Timer1.Enabled := True;
|
|
MCSLSU.MakeForm('form1', 'ID_', form1);
|
|
MCSLSU.MakeForm('form1', 'ID_', form1);
|
|
initMidi;
|
|
initMidi;
|
|
|
|
+ Examples := TStringList.Create;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TForm1.initMidi;
|
|
procedure TForm1.initMidi;
|
|
@@ -290,6 +304,55 @@ begin
|
|
lastNote := note;
|
|
lastNote := note;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.loadFromList(Lines: TStringList; filename: string);
|
|
|
|
+var
|
|
|
|
+ i, x: integer;
|
|
|
|
+ line: string;
|
|
|
|
+ list: TStringList;
|
|
|
|
+begin
|
|
|
|
+ acNew.Execute;
|
|
|
|
+ list := TStringList.Create;
|
|
|
|
+ i := 1;
|
|
|
|
+ for x := 0 to Lines.Count - 1 do
|
|
|
|
+ begin
|
|
|
|
+ if (i + 1 > StringGrid1.RowCount) then
|
|
|
|
+ begin
|
|
|
|
+ StringGrid1.RowCount := StringGrid1.RowCount + 1;
|
|
|
|
+ end;
|
|
|
|
+ line := Lines[x];
|
|
|
|
+ if (Pos('#', line) = 1) then
|
|
|
|
+ begin
|
|
|
|
+ line := RightstrPos(line, 2);
|
|
|
|
+ if (Pos('TPS:', line) = 1) then
|
|
|
|
+ begin
|
|
|
|
+ line := RightstrPos(line, 5);
|
|
|
|
+ cbTPSVersion.Text := line;
|
|
|
|
+ cbTPSVersionChange(nil);
|
|
|
|
+ end;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ MCSStrings.DelimSepTextToStringlist(line, '"', ',', list);
|
|
|
|
+ if list.Count > 0 then
|
|
|
|
+ Stringgrid1.Cells[0, i] := list[0];
|
|
|
|
+ if list.Count > 1 then
|
|
|
|
+ Stringgrid1.Cells[1, i] := list[1];
|
|
|
|
+ if list.Count > 2 then
|
|
|
|
+ Stringgrid1.Cells[2, i] := list[2];
|
|
|
|
+ if list.Count > 3 then
|
|
|
|
+ Stringgrid1.Cells[4, i] := list[3];
|
|
|
|
+ list.Clear;
|
|
|
|
+ Inc(i);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ list.Free;
|
|
|
|
+ activeFile := filename;
|
|
|
|
+ renumberGrid();
|
|
|
|
+ addHeaderText;
|
|
|
|
+ setCaption();
|
|
|
|
+ setDirty(False);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of string);
|
|
procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of string);
|
|
var
|
|
var
|
|
line: string;
|
|
line: string;
|
|
@@ -306,11 +369,105 @@ begin
|
|
ShExec2(self.Handle, InfoBox.AppURL);
|
|
ShExec2(self.Handle, InfoBox.AppURL);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.MenuItem1Click(Sender: TObject);
|
|
|
|
+var
|
|
|
|
+ i: integer;
|
|
|
|
+ fileName, Data: string;
|
|
|
|
+ Lines: TStringList;
|
|
|
|
+begin
|
|
|
|
+ if (Sender is TMenuItem) then
|
|
|
|
+ begin
|
|
|
|
+ if (checkDirty()) then
|
|
|
|
+ begin
|
|
|
|
+ i := TMenuItem(Sender).Tag;
|
|
|
|
+ if (i >= 0) then
|
|
|
|
+ begin
|
|
|
|
+ filename := examples[i];
|
|
|
|
+ Data := DownloadFile('http://wkla.no-ip.biz/down/tps_examples/' + filename);
|
|
|
|
+ Lines := TStringList.Create;
|
|
|
|
+ Lines.Text := Data;
|
|
|
|
+ loadFromList(Lines, filename);
|
|
|
|
+ Lines.Free;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.mnSaveClick(Sender: TObject);
|
|
procedure TForm1.mnSaveClick(Sender: TObject);
|
|
begin
|
|
begin
|
|
Statusbar1.SimpleText := Sender.ClassName;
|
|
Statusbar1.SimpleText := Sender.ClassName;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.pmExamplesPopup(Sender: TObject);
|
|
|
|
+var
|
|
|
|
+ x, i, j, pos, index: integer;
|
|
|
|
+ myName: string;
|
|
|
|
+ myMenu, my2Menu: TMenuItem;
|
|
|
|
+ jsonString: string;
|
|
|
|
+ JsonObject: TJsonObject;
|
|
|
|
+ Data, JArray: TJSONData;
|
|
|
|
+ JItem: TJSONData;
|
|
|
|
+ subMenuName: string;
|
|
|
|
+ subMenu: TMenuItem;
|
|
|
|
+begin
|
|
|
|
+ for i := pmExamples.Items.Count - 1 downto 0 do
|
|
|
|
+ begin
|
|
|
|
+ myMenu := pmExamples.Items[i];
|
|
|
|
+ if (myMenu.Count > 0) then
|
|
|
|
+ begin
|
|
|
|
+ for j := myMenu.Count - 1 downto 0 do
|
|
|
|
+ begin
|
|
|
|
+ my2Menu := myMenu.Items[j];
|
|
|
|
+ my2Menu.Free;
|
|
|
|
+ end;
|
|
|
|
+ myMenu.Clear;
|
|
|
|
+ end;
|
|
|
|
+ myMenu.Free;
|
|
|
|
+ end;
|
|
|
|
+ pmExamples.Items.Clear;
|
|
|
|
+ Examples.Clear;
|
|
|
|
+
|
|
|
|
+ try
|
|
|
|
+ jsonString := DownloadFile('http://wkla.no-ip.biz/down/tps_examples/examples.json');
|
|
|
|
+ Data := StringToJSONData(jsonString);
|
|
|
|
+ JsonObject := TJSONObject(Data);
|
|
|
|
+
|
|
|
|
+ i := JsonObject.Count;
|
|
|
|
+ for x := 0 to JsonObject.Count - 1 do
|
|
|
|
+ begin
|
|
|
|
+ subMenuName := JsonObject.Names[x];
|
|
|
|
+ JArray := GetJSONProp(TJSONObject(Data), subMenuName);
|
|
|
|
+ if (JArray <> nil) then
|
|
|
|
+ begin
|
|
|
|
+ subMenu := TMenuItem.Create(pmExamples);
|
|
|
|
+ subMenu.Caption := subMenuName;
|
|
|
|
+ pmExamples.Items.Add(subMenu);
|
|
|
|
+ for i := 1 to TJSONArray(JArray).Count do
|
|
|
|
+ begin
|
|
|
|
+ JItem := TJSONArray(JArray).Items[i - 1];
|
|
|
|
+ myName := GetJsonProp(TJSONObject(JItem), 'name', '');
|
|
|
|
+ pos := -1;
|
|
|
|
+ index := GetJsonProp(TJSONObject(JItem), 'index', -1);
|
|
|
|
+ if (index > -1) then
|
|
|
|
+ begin
|
|
|
|
+ pos := Examples.Add(GetJsonProp(TJSONObject(JItem), 'file', ''));
|
|
|
|
+ myName := format('%.2d - %s', [index, myName]);
|
|
|
|
+ end;
|
|
|
|
+ myMenu := TMenuItem.Create(subMenu);
|
|
|
|
+ myMenu.Caption := myName;
|
|
|
|
+ myMenu.Tag := pos;
|
|
|
|
+ if (index > -1) then
|
|
|
|
+ begin
|
|
|
|
+ myMenu.OnClick := @MenuItem1Click;
|
|
|
|
+ end;
|
|
|
|
+ subMenu.Add(myMenu);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ except
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.Shape1Paint(Sender: TObject);
|
|
procedure TForm1.Shape1Paint(Sender: TObject);
|
|
var
|
|
var
|
|
radius: integer;
|
|
radius: integer;
|
|
@@ -419,12 +576,15 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TForm1.acFileSaveAsAccept(Sender: TObject);
|
|
|
|
|
|
+procedure TForm1.acSaveAsExecute(Sender: TObject);
|
|
var
|
|
var
|
|
filename: string;
|
|
filename: string;
|
|
begin
|
|
begin
|
|
- filename := (Sender as TFileSaveAs).Dialog.FileName;
|
|
|
|
- saveFile(filename);
|
|
|
|
|
|
+ if SaveDialog1.Execute() then
|
|
|
|
+ begin
|
|
|
|
+ filename := SaveDialog1.FileName;
|
|
|
|
+ saveFile(filename);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TForm1.saveFile(filename: string);
|
|
procedure TForm1.saveFile(filename: string);
|
|
@@ -451,8 +611,8 @@ begin
|
|
begin
|
|
begin
|
|
if (StringGrid1.Cells[1, x] <> '') then
|
|
if (StringGrid1.Cells[1, x] <> '') then
|
|
begin
|
|
begin
|
|
- line := StringGrid1.Cells[0, x] + ',' + StringGrid1.Cells[1, x] + ',' +
|
|
|
|
- StringGrid1.Cells[2, x] + ',"' + StringGrid1.Cells[4, x] + '"';
|
|
|
|
|
|
+ line := StringGrid1.Cells[0, x] + ',' + StringGrid1.Cells[1, x] +
|
|
|
|
+ ',' + StringGrid1.Cells[2, x] + ',"' + StringGrid1.Cells[4, x] + '"';
|
|
Writeln(f, line);
|
|
Writeln(f, line);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -473,7 +633,7 @@ begin
|
|
begin
|
|
begin
|
|
activateSps(True);
|
|
activateSps(True);
|
|
acDebug.Enabled := True;
|
|
acDebug.Enabled := True;
|
|
- acDebug.ImageIndex := 10;
|
|
|
|
|
|
+ acDebug.ImageIndex := 57;
|
|
cbAdrActual.Enabled := True;
|
|
cbAdrActual.Enabled := True;
|
|
acNextStep.Enabled := False;
|
|
acNextStep.Enabled := False;
|
|
// sps programmieren
|
|
// sps programmieren
|
|
@@ -720,7 +880,8 @@ begin
|
|
tmp := tmp + '0';
|
|
tmp := tmp + '0';
|
|
line := line + tmp;
|
|
line := line + tmp;
|
|
|
|
|
|
- line := line + ' ' + StringGrid1.Cells[3, x] + ' ,"' + StringGrid1.Cells[4, x] + '"';
|
|
|
|
|
|
+ line := line + ' ' + StringGrid1.Cells[3, x] + ' ,"' +
|
|
|
|
+ StringGrid1.Cells[4, x] + '"';
|
|
list.add(line);
|
|
list.add(line);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -736,7 +897,7 @@ begin
|
|
begin
|
|
begin
|
|
stopit := True;
|
|
stopit := True;
|
|
sps.break();
|
|
sps.break();
|
|
- acDebug.ImageIndex := 18;
|
|
|
|
|
|
+ acDebug.ImageIndex := 40;
|
|
// repeat
|
|
// repeat
|
|
// Application.ProcessMessages;
|
|
// Application.ProcessMessages;
|
|
// until (not sps.isDelayActive());
|
|
// until (not sps.isDelayActive());
|
|
@@ -785,6 +946,7 @@ end;
|
|
procedure TForm1.btnToneClick(Sender: TObject);
|
|
procedure TForm1.btnToneClick(Sender: TObject);
|
|
begin
|
|
begin
|
|
MidiOutput.SendAllSoundOff(0, 0);
|
|
MidiOutput.SendAllSoundOff(0, 0);
|
|
|
|
+ ImageList2.GetBitmap(22, btnTone.Glyph);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TForm1.serialUpload: string;
|
|
function TForm1.serialUpload: string;
|
|
@@ -873,9 +1035,10 @@ begin
|
|
|
|
|
|
if (error) then
|
|
if (error) then
|
|
begin
|
|
begin
|
|
- Application.MessageBox('Arduino antwortet nicht. Evtl. Arduino nicht angeschlossen oder falsche Firmware?',
|
|
|
|
- 'Keine Antwort',
|
|
|
|
- MB_OK + MB_ICONEXCLAMATION);
|
|
|
|
|
|
+ LSUAutoMsgBox('Messages', 'ID_NOT_READY', MB_OK + MB_ICONERROR);
|
|
|
|
+ end else
|
|
|
|
+ begin
|
|
|
|
+ LSUAutoMsgBox('Messages', 'ID_UPLOAD_OK', MB_OK + MB_ICONINFORMATION);
|
|
end;
|
|
end;
|
|
SdpoSerial1.Active := False;
|
|
SdpoSerial1.Active := False;
|
|
DeleteFile(hexFile);
|
|
DeleteFile(hexFile);
|
|
@@ -929,7 +1092,8 @@ var
|
|
begin
|
|
begin
|
|
if (dirty) then
|
|
if (dirty) then
|
|
begin
|
|
begin
|
|
- i := MCSLSU.LSUAutoMsgBox('Messages', 'SAVE_CHANGES', MB_ICONQUESTION or MB_YESNOCANCEL);
|
|
|
|
|
|
+ i := MCSLSU.LSUAutoMsgBox('Messages', 'SAVE_CHANGES', MB_ICONQUESTION or
|
|
|
|
+ MB_YESNOCANCEL);
|
|
if (i = mrYes) then
|
|
if (i = mrYes) then
|
|
begin
|
|
begin
|
|
saveFile(activeFile);
|
|
saveFile(activeFile);
|
|
@@ -1029,7 +1193,8 @@ begin
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- Caption := MCSLSU.GetLSUText('form1Captions', 'ID_CAPTION', lsuCode) + ':' + ExtractFileName(activeFile);
|
|
|
|
|
|
+ Caption := MCSLSU.GetLSUText('form1Captions', 'ID_CAPTION', lsuCode) +
|
|
|
|
+ ':' + ExtractFileName(activeFile);
|
|
end;
|
|
end;
|
|
|
|
|
|
end;
|
|
end;
|
|
@@ -1044,7 +1209,8 @@ begin
|
|
StringGrid1.Columns[i].Title.Caption :=
|
|
StringGrid1.Columns[i].Title.Caption :=
|
|
MCSLSU.GetLSUText('form1Captions', StringGrid1.Columns[i].Title.Caption, lsuCode);
|
|
MCSLSU.GetLSUText('form1Captions', StringGrid1.Columns[i].Title.Caption, lsuCode);
|
|
end;
|
|
end;
|
|
- StringGrid1.Cells[0, 0] := MCSLSU.GetLSUText('form1Captions', 'ID_GRID_STORAGE', lsuCode);
|
|
|
|
|
|
+ StringGrid1.Cells[0, 0] := MCSLSU.GetLSUText('form1Captions',
|
|
|
|
+ 'ID_GRID_STORAGE', lsuCode);
|
|
StringGrid1.Repaint;
|
|
StringGrid1.Repaint;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1096,6 +1262,10 @@ begin
|
|
acUpload.Enabled := False;
|
|
acUpload.Enabled := False;
|
|
Label5.Visible := False;
|
|
Label5.Visible := False;
|
|
btnTone.Visible := False;
|
|
btnTone.Visible := False;
|
|
|
|
+ ADC1.Value := 0;
|
|
|
|
+ ADC1.MaxValue := 15;
|
|
|
|
+ ADC2.Value := 0;
|
|
|
|
+ ADC2.MaxValue := 15;
|
|
end;
|
|
end;
|
|
if (cbTPSVersion.ItemIndex = 1) then
|
|
if (cbTPSVersion.ItemIndex = 1) then
|
|
begin
|
|
begin
|
|
@@ -1118,6 +1288,10 @@ begin
|
|
acUpload.Enabled := False;
|
|
acUpload.Enabled := False;
|
|
Label5.Visible := False;
|
|
Label5.Visible := False;
|
|
btnTone.Visible := False;
|
|
btnTone.Visible := False;
|
|
|
|
+ ADC1.Value := 0;
|
|
|
|
+ ADC1.MaxValue := 15;
|
|
|
|
+ ADC2.Value := 0;
|
|
|
|
+ ADC2.MaxValue := 15;
|
|
end;
|
|
end;
|
|
if ((cbTPSVersion.ItemIndex = 2) or (cbTPSVersion.ItemIndex = 3)) then
|
|
if ((cbTPSVersion.ItemIndex = 2) or (cbTPSVersion.ItemIndex = 3)) then
|
|
begin
|
|
begin
|
|
@@ -1152,6 +1326,10 @@ begin
|
|
|
|
|
|
EditE.Visible := True;
|
|
EditE.Visible := True;
|
|
EditF.Visible := True;
|
|
EditF.Visible := True;
|
|
|
|
+ ADC1.Value := 0;
|
|
|
|
+ ADC1.MaxValue := 255;
|
|
|
|
+ ADC2.Value := 0;
|
|
|
|
+ ADC2.MaxValue := 255;
|
|
end;
|
|
end;
|
|
cbCommand.Items.Clear;
|
|
cbCommand.Items.Clear;
|
|
sps.getCommands(cbCommand.Items);
|
|
sps.getCommands(cbCommand.Items);
|
|
@@ -1184,7 +1362,8 @@ begin
|
|
begin
|
|
begin
|
|
x := StringGrid1.Row;
|
|
x := StringGrid1.Row;
|
|
StringGrid1.Cells[3, x] :=
|
|
StringGrid1.Cells[3, x] :=
|
|
- sps.getCommandText(HexToInt(StringGrid1.Cells[1, x]), HexToInt(StringGrid1.Cells[2, x]));
|
|
|
|
|
|
+ sps.getCommandText(HexToInt(StringGrid1.Cells[1, x]),
|
|
|
|
+ HexToInt(StringGrid1.Cells[2, x]));
|
|
setDirty(True);
|
|
setDirty(True);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1237,10 +1416,14 @@ begin
|
|
WriteIniBool(key, 'set', XMLPropStorage1.ReadBoolean(key + '.set', False), filename);
|
|
WriteIniBool(key, 'set', XMLPropStorage1.ReadBoolean(key + '.set', False), filename);
|
|
WriteIniBool(key, 'prg', XMLPropStorage1.ReadBoolean(key + '.prg', False), filename);
|
|
WriteIniBool(key, 'prg', XMLPropStorage1.ReadBoolean(key + '.prg', False), filename);
|
|
WriteIniBool(key, 'sel', XMLPropStorage1.ReadBoolean(key + '.sel', False), filename);
|
|
WriteIniBool(key, 'sel', XMLPropStorage1.ReadBoolean(key + '.sel', False), filename);
|
|
- WriteIniBool(key, 'input1', XMLPropStorage1.ReadBoolean(key + '.input1', False), filename);
|
|
|
|
- WriteIniBool(key, 'input2', XMLPropStorage1.ReadBoolean(key + '.input2', False), filename);
|
|
|
|
- WriteIniBool(key, 'input3', XMLPropStorage1.ReadBoolean(key + '.input3', False), filename);
|
|
|
|
- WriteIniBool(key, 'input4', XMLPropStorage1.ReadBoolean(key + '.input4', False), filename);
|
|
|
|
|
|
+ WriteIniBool(key, 'input1', XMLPropStorage1.ReadBoolean(key + '.input1', False),
|
|
|
|
+ filename);
|
|
|
|
+ WriteIniBool(key, 'input2', XMLPropStorage1.ReadBoolean(key + '.input2', False),
|
|
|
|
+ filename);
|
|
|
|
+ WriteIniBool(key, 'input3', XMLPropStorage1.ReadBoolean(key + '.input3', False),
|
|
|
|
+ filename);
|
|
|
|
+ WriteIniBool(key, 'input4', XMLPropStorage1.ReadBoolean(key + '.input4', False),
|
|
|
|
+ filename);
|
|
WriteIniInteger(key, 'adc1', XMLPropStorage1.ReadInteger(key + '.adc1', 0), filename);
|
|
WriteIniInteger(key, 'adc1', XMLPropStorage1.ReadInteger(key + '.adc1', 0), filename);
|
|
WriteIniInteger(key, 'adc2', XMLPropStorage1.ReadInteger(key + '.adc2', 0), filename);
|
|
WriteIniInteger(key, 'adc2', XMLPropStorage1.ReadInteger(key + '.adc2', 0), filename);
|
|
WriteIniInteger(key, 'rc1', XMLPropStorage1.ReadInteger(key + '.rc1', 0), filename);
|
|
WriteIniInteger(key, 'rc1', XMLPropStorage1.ReadInteger(key + '.rc1', 0), filename);
|
|
@@ -1252,10 +1435,14 @@ begin
|
|
XMLPropStorage1.WriteBoolean(key + '.set', ReadIniBool(key, 'set', False, filename));
|
|
XMLPropStorage1.WriteBoolean(key + '.set', ReadIniBool(key, 'set', False, filename));
|
|
XMLPropStorage1.WriteBoolean(key + '.prg', ReadIniBool(key, 'prg', False, filename));
|
|
XMLPropStorage1.WriteBoolean(key + '.prg', ReadIniBool(key, 'prg', False, filename));
|
|
XMLPropStorage1.WriteBoolean(key + '.sel', ReadIniBool(key, 'sel', False, filename));
|
|
XMLPropStorage1.WriteBoolean(key + '.sel', ReadIniBool(key, 'sel', False, filename));
|
|
- XMLPropStorage1.WriteBoolean(key + '.input1', ReadIniBool(key, 'input1', False, filename));
|
|
|
|
- XMLPropStorage1.WriteBoolean(key + '.input2', ReadIniBool(key, 'input2', False, filename));
|
|
|
|
- XMLPropStorage1.WriteBoolean(key + '.input3', ReadIniBool(key, 'input3', False, filename));
|
|
|
|
- XMLPropStorage1.WriteBoolean(key + '.input4', ReadIniBool(key, 'input4', False, filename));
|
|
|
|
|
|
+ XMLPropStorage1.WriteBoolean(key + '.input1', ReadIniBool(key,
|
|
|
|
+ 'input1', False, filename));
|
|
|
|
+ XMLPropStorage1.WriteBoolean(key + '.input2', ReadIniBool(key,
|
|
|
|
+ 'input2', False, filename));
|
|
|
|
+ XMLPropStorage1.WriteBoolean(key + '.input3', ReadIniBool(key,
|
|
|
|
+ 'input3', False, filename));
|
|
|
|
+ XMLPropStorage1.WriteBoolean(key + '.input4', ReadIniBool(key,
|
|
|
|
+ 'input4', False, filename));
|
|
XMLPropStorage1.WriteInteger(key + '.adc1', ReadIniInteger(key, 'adc1', 0, filename));
|
|
XMLPropStorage1.WriteInteger(key + '.adc1', ReadIniInteger(key, 'adc1', 0, filename));
|
|
XMLPropStorage1.WriteInteger(key + '.adc2', ReadIniInteger(key, 'adc2', 0, filename));
|
|
XMLPropStorage1.WriteInteger(key + '.adc2', ReadIniInteger(key, 'adc2', 0, filename));
|
|
XMLPropStorage1.WriteInteger(key + '.rc1', ReadIniInteger(key, 'rc1', 0, filename));
|
|
XMLPropStorage1.WriteInteger(key + '.rc1', ReadIniInteger(key, 'rc1', 0, filename));
|
|
@@ -1302,7 +1489,8 @@ begin
|
|
RC2.Value := XMLPropStorage1.ReadInteger(key + '.rc2', RC2.Value);
|
|
RC2.Value := XMLPropStorage1.ReadInteger(key + '.rc2', RC2.Value);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TForm1.tbPreset1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: boolean);
|
|
|
|
|
|
+procedure TForm1.tbPreset1ContextPopup(Sender: TObject; MousePos: TPoint;
|
|
|
|
+ var Handled: boolean);
|
|
var
|
|
var
|
|
key: string;
|
|
key: string;
|
|
begin
|
|
begin
|
|
@@ -1344,10 +1532,24 @@ begin
|
|
checkPresets();
|
|
checkPresets();
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.tbPrgChange(Sender: TObject);
|
|
|
|
+begin
|
|
|
|
+ if tbPrg.Checked then
|
|
|
|
+ begin
|
|
|
|
+ tbPrg.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_PRG_SEL', lsuCode);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ tbPrg.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_PRG_NON', lsuCode);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.tbResetClick(Sender: TObject);
|
|
procedure TForm1.tbResetClick(Sender: TObject);
|
|
begin
|
|
begin
|
|
tbPrg.Checked := False;
|
|
tbPrg.Checked := False;
|
|
|
|
+ tbPrg.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_PRG_NON', lsuCode);
|
|
tbSel.Checked := False;
|
|
tbSel.Checked := False;
|
|
|
|
+ tbSel.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_SEL_NON', lsuCode);
|
|
Din1.Checked := False;
|
|
Din1.Checked := False;
|
|
Din2.Checked := False;
|
|
Din2.Checked := False;
|
|
Din3.Checked := False;
|
|
Din3.Checked := False;
|
|
@@ -1358,6 +1560,18 @@ begin
|
|
RC2.Value := 8;
|
|
RC2.Value := 8;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TForm1.tbSelChange(Sender: TObject);
|
|
|
|
+begin
|
|
|
|
+ if tbSel.Checked then
|
|
|
|
+ begin
|
|
|
|
+ tbSel.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_SEL_SEL', lsuCode);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ tbSel.Hint := MCSLSU.GetLSUText('form1Hints', 'ID_BTN_SEL_NON', lsuCode);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TForm1.Timer1Timer(Sender: TObject);
|
|
procedure TForm1.Timer1Timer(Sender: TObject);
|
|
var
|
|
var
|
|
jsonString: string;
|
|
jsonString: string;
|
|
@@ -1372,8 +1586,8 @@ begin
|
|
if (InfoBox.newVersion) then
|
|
if (InfoBox.newVersion) then
|
|
begin
|
|
begin
|
|
MCSLabel.Font.Color := clred;
|
|
MCSLabel.Font.Color := clred;
|
|
- MCSLabel.Hint := InfoBox.versionHint + chr($0a) + chr($0d) + MCSLSU.GetLSUText(
|
|
|
|
- 'form1Captions', 'ID_CLICK_HERE', lsuCode);
|
|
|
|
|
|
+ MCSLabel.Hint := InfoBox.versionHint + chr($0a) + chr($0d) +
|
|
|
|
+ MCSLSU.GetLSUText('form1Captions', 'ID_CLICK_HERE', lsuCode);
|
|
end;
|
|
end;
|
|
MCSLabel.Caption := InfoBox.versionText;
|
|
MCSLabel.Caption := InfoBox.versionText;
|
|
end;
|
|
end;
|
|
@@ -1392,7 +1606,8 @@ begin
|
|
if (StringGrid1.Cells[2, x] = '') then
|
|
if (StringGrid1.Cells[2, x] = '') then
|
|
StringGrid1.Cells[2, x] := '0';
|
|
StringGrid1.Cells[2, x] := '0';
|
|
StringGrid1.Cells[3, x] :=
|
|
StringGrid1.Cells[3, x] :=
|
|
- sps.getCommandText(HexToInt(StringGrid1.Cells[1, x]), HexToInt(StringGrid1.Cells[2, x]));
|
|
|
|
|
|
+ sps.getCommandText(HexToInt(StringGrid1.Cells[1, x]),
|
|
|
|
+ HexToInt(StringGrid1.Cells[2, x]));
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1476,7 +1691,7 @@ begin
|
|
begin
|
|
begin
|
|
playNote(0);
|
|
playNote(0);
|
|
end;
|
|
end;
|
|
- btntone.Enabled := False;
|
|
|
|
|
|
+ btntone.Enabled := True;
|
|
end;
|
|
end;
|
|
List := TStringList.Create;
|
|
List := TStringList.Create;
|
|
try
|
|
try
|