cupol light with dayttime
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
[/Script/EngineSettings.GeneralProjectSettings]
|
||||
ProjectID=9EB99AEB4C933EABEE9C4787EE46C5E6
|
||||
ProjectName=Masharov
|
||||
ProjectVersion=1.875
|
||||
ProjectVersion=1.878
|
||||
CompanyName=GraffInteractive
|
||||
Homepage=Graff.tech
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,455 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 1064
|
||||
Top = 470
|
||||
Width = 527
|
||||
Height = 485
|
||||
Caption = 'Test Building'
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object lbl: TLabel
|
||||
Left = 44
|
||||
Top = 28
|
||||
Width = 23
|
||||
Height = 13
|
||||
Caption = 'state'
|
||||
end
|
||||
object TLabel
|
||||
Left = 32
|
||||
Top = 56
|
||||
Width = 36
|
||||
Height = 13
|
||||
Caption = 'building'
|
||||
end
|
||||
object TLabel
|
||||
Left = 32
|
||||
Top = 84
|
||||
Width = 20
|
||||
Height = 13
|
||||
Caption = 'floor'
|
||||
end
|
||||
object TLabel
|
||||
Left = 32
|
||||
Top = 112
|
||||
Width = 19
|
||||
Height = 13
|
||||
Caption = 'strip'
|
||||
end
|
||||
object DomeColor: TShape
|
||||
Left = 304
|
||||
Top = 80
|
||||
Width = 37
|
||||
Height = 21
|
||||
Brush.Color = 4227327
|
||||
OnMouseDown = DomeColorMouseDown
|
||||
end
|
||||
object RoomColor2: TShape
|
||||
Left = 304
|
||||
Top = 52
|
||||
Width = 37
|
||||
Height = 21
|
||||
Brush.Color = 8454016
|
||||
OnMouseDown = RoomColor2MouseDown
|
||||
end
|
||||
object RoomColor1: TShape
|
||||
Left = 304
|
||||
Top = 24
|
||||
Width = 37
|
||||
Height = 21
|
||||
Brush.Color = 16744448
|
||||
OnMouseDown = RoomColor1MouseDown
|
||||
end
|
||||
object RoomLabel1: TLabel
|
||||
Left = 264
|
||||
Top = 28
|
||||
Width = 32
|
||||
Height = 13
|
||||
Caption = 'color 1'
|
||||
end
|
||||
object RoomLabel2: TLabel
|
||||
Left = 264
|
||||
Top = 56
|
||||
Width = 32
|
||||
Height = 13
|
||||
Caption = 'color 2'
|
||||
end
|
||||
object DomeLabel: TLabel
|
||||
Left = 264
|
||||
Top = 84
|
||||
Width = 26
|
||||
Height = 13
|
||||
Caption = 'dome'
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 292
|
||||
Top = 348
|
||||
Width = 45
|
||||
Height = 13
|
||||
Caption = 'IP Adress'
|
||||
end
|
||||
object Port: TLabel
|
||||
Left = 320
|
||||
Top = 372
|
||||
Width = 19
|
||||
Height = 13
|
||||
Caption = 'Port'
|
||||
end
|
||||
object SetBuilding: TButton
|
||||
Left = 164
|
||||
Top = 52
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'Set building'
|
||||
TabOrder = 5
|
||||
OnClick = SetBuildingClick
|
||||
end
|
||||
object ExitButton: TButton
|
||||
Left = 16
|
||||
Top = 400
|
||||
Width = 75
|
||||
Height = 25
|
||||
Cancel = True
|
||||
Caption = 'E&xit'
|
||||
TabOrder = 34
|
||||
OnClick = ExitButtonClick
|
||||
end
|
||||
object State: TUpDown
|
||||
Left = 133
|
||||
Top = 24
|
||||
Width = 16
|
||||
Height = 21
|
||||
Associate = Edit1
|
||||
Max = 10
|
||||
Position = 1
|
||||
TabOrder = 1
|
||||
end
|
||||
object Edit1: TEdit
|
||||
Left = 76
|
||||
Top = 24
|
||||
Width = 57
|
||||
Height = 21
|
||||
TabOrder = 0
|
||||
Text = '1'
|
||||
end
|
||||
object Building: TUpDown
|
||||
Left = 133
|
||||
Top = 52
|
||||
Width = 16
|
||||
Height = 21
|
||||
Associate = Edit2
|
||||
Max = 10
|
||||
TabOrder = 4
|
||||
end
|
||||
object Edit2: TEdit
|
||||
Left = 76
|
||||
Top = 52
|
||||
Width = 57
|
||||
Height = 21
|
||||
TabOrder = 3
|
||||
Text = '0'
|
||||
end
|
||||
object SetFloor: TButton
|
||||
Left = 164
|
||||
Top = 80
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'Set floor'
|
||||
TabOrder = 8
|
||||
OnClick = SetFloorClick
|
||||
end
|
||||
object Floor: TUpDown
|
||||
Left = 133
|
||||
Top = 80
|
||||
Width = 16
|
||||
Height = 21
|
||||
Associate = Edit3
|
||||
Max = 30
|
||||
TabOrder = 7
|
||||
end
|
||||
object Edit3: TEdit
|
||||
Left = 76
|
||||
Top = 80
|
||||
Width = 57
|
||||
Height = 21
|
||||
TabOrder = 6
|
||||
Text = '0'
|
||||
end
|
||||
object SetRoom: TButton
|
||||
Left = 164
|
||||
Top = 108
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'Set room'
|
||||
TabOrder = 11
|
||||
OnClick = SetRoomClick
|
||||
end
|
||||
object Strip: TUpDown
|
||||
Left = 133
|
||||
Top = 108
|
||||
Width = 16
|
||||
Height = 21
|
||||
Associate = Edit4
|
||||
Max = 10
|
||||
TabOrder = 10
|
||||
end
|
||||
object Edit4: TEdit
|
||||
Left = 76
|
||||
Top = 108
|
||||
Width = 57
|
||||
Height = 21
|
||||
TabOrder = 9
|
||||
Text = '0'
|
||||
end
|
||||
object DomeOn: TButton
|
||||
Left = 164
|
||||
Top = 148
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'DomeOn'
|
||||
TabOrder = 15
|
||||
OnClick = DomeOnClick
|
||||
end
|
||||
object DomeOff: TButton
|
||||
Left = 244
|
||||
Top = 148
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'DomeOff'
|
||||
TabOrder = 16
|
||||
OnClick = DomeOffClick
|
||||
end
|
||||
object BuildingsOn: TButton
|
||||
Left = 164
|
||||
Top = 176
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'BuildingsOn'
|
||||
TabOrder = 18
|
||||
OnClick = BuildingsOnClick
|
||||
end
|
||||
object BuildingsOff: TButton
|
||||
Left = 244
|
||||
Top = 176
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'BuildingsOff'
|
||||
TabOrder = 19
|
||||
OnClick = BuildingsOffClick
|
||||
end
|
||||
object StreetOn: TButton
|
||||
Left = 164
|
||||
Top = 204
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'StreetOn'
|
||||
TabOrder = 21
|
||||
OnClick = StreetOnClick
|
||||
end
|
||||
object StreetOff: TButton
|
||||
Left = 244
|
||||
Top = 204
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'StreetOff'
|
||||
TabOrder = 22
|
||||
OnClick = StreetOffClick
|
||||
end
|
||||
object OfficeOn: TButton
|
||||
Left = 164
|
||||
Top = 232
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'OfficeOn'
|
||||
TabOrder = 24
|
||||
OnClick = OfficeOnClick
|
||||
end
|
||||
object OfficeOff: TButton
|
||||
Left = 244
|
||||
Top = 232
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'OfficeOff'
|
||||
TabOrder = 25
|
||||
OnClick = OfficeOffClick
|
||||
end
|
||||
object AutoMode: TButton
|
||||
Left = 164
|
||||
Top = 280
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'Auto mode'
|
||||
TabOrder = 31
|
||||
OnClick = AutoModeClick
|
||||
end
|
||||
object SetAll: TButton
|
||||
Left = 164
|
||||
Top = 24
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'Set all'
|
||||
TabOrder = 2
|
||||
OnClick = SetAllClick
|
||||
end
|
||||
object StaticMode: TButton
|
||||
Left = 244
|
||||
Top = 280
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'Static mode'
|
||||
TabOrder = 32
|
||||
OnClick = StaticModeClick
|
||||
end
|
||||
object Dome: TCheckBox
|
||||
Left = 60
|
||||
Top = 280
|
||||
Width = 97
|
||||
Height = 17
|
||||
Caption = 'Dome'
|
||||
TabOrder = 27
|
||||
end
|
||||
object Buildings: TCheckBox
|
||||
Left = 60
|
||||
Top = 300
|
||||
Width = 97
|
||||
Height = 17
|
||||
Caption = 'Buildings'
|
||||
TabOrder = 28
|
||||
end
|
||||
object Street: TCheckBox
|
||||
Left = 60
|
||||
Top = 320
|
||||
Width = 97
|
||||
Height = 17
|
||||
Caption = 'Street'
|
||||
TabOrder = 29
|
||||
end
|
||||
object Office: TCheckBox
|
||||
Left = 60
|
||||
Top = 340
|
||||
Width = 97
|
||||
Height = 17
|
||||
Caption = 'Office'
|
||||
TabOrder = 30
|
||||
end
|
||||
object Auto: TButton
|
||||
Left = 204
|
||||
Top = 316
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'Auto'
|
||||
TabOrder = 33
|
||||
OnClick = AutoClick
|
||||
end
|
||||
object DomeAuto: TButton
|
||||
Left = 324
|
||||
Top = 148
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'DomeAuto'
|
||||
TabOrder = 17
|
||||
OnClick = DomeAutoClick
|
||||
end
|
||||
object BuildingsAuto: TButton
|
||||
Left = 324
|
||||
Top = 176
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'BuildingsAuto'
|
||||
TabOrder = 20
|
||||
OnClick = BuildingsAutoClick
|
||||
end
|
||||
object StreetAuto: TButton
|
||||
Left = 324
|
||||
Top = 204
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'StreetAuto'
|
||||
TabOrder = 23
|
||||
OnClick = StreetAutoClick
|
||||
end
|
||||
object OfficeAuto: TButton
|
||||
Left = 324
|
||||
Top = 232
|
||||
Width = 75
|
||||
Height = 21
|
||||
Caption = 'OfficeAuto'
|
||||
TabOrder = 26
|
||||
OnClick = OfficeAutoClick
|
||||
end
|
||||
object RoomEdit1: TEdit
|
||||
Left = 348
|
||||
Top = 24
|
||||
Width = 121
|
||||
Height = 21
|
||||
TabOrder = 12
|
||||
OnContextPopup = EditCopy
|
||||
end
|
||||
object RoomEdit2: TEdit
|
||||
Left = 348
|
||||
Top = 52
|
||||
Width = 121
|
||||
Height = 21
|
||||
TabOrder = 13
|
||||
OnContextPopup = EditCopy
|
||||
end
|
||||
object DomeEdit: TEdit
|
||||
Left = 348
|
||||
Top = 80
|
||||
Width = 121
|
||||
Height = 21
|
||||
TabOrder = 14
|
||||
OnContextPopup = EditCopy
|
||||
end
|
||||
object IP: TEdit
|
||||
Left = 348
|
||||
Top = 344
|
||||
Width = 121
|
||||
Height = 21
|
||||
TabOrder = 35
|
||||
Text = '192.168.30.177'
|
||||
end
|
||||
object MyPort: TEdit
|
||||
Left = 348
|
||||
Top = 368
|
||||
Width = 121
|
||||
Height = 21
|
||||
TabOrder = 36
|
||||
Text = '1201'
|
||||
end
|
||||
object Clear: TButton
|
||||
Left = 248
|
||||
Top = 108
|
||||
Width = 37
|
||||
Height = 21
|
||||
Caption = 'Clear'
|
||||
TabOrder = 37
|
||||
OnClick = ClearClick
|
||||
end
|
||||
object Reconnect: TButton
|
||||
Left = 348
|
||||
Top = 400
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = 'Reconnect'
|
||||
TabOrder = 38
|
||||
OnClick = ReconnectClick
|
||||
end
|
||||
object Timer: TTimer
|
||||
Interval = 15000
|
||||
OnTimer = TimerTimer
|
||||
Left = 136
|
||||
Top = 400
|
||||
end
|
||||
object Socket: TTcpClient
|
||||
Left = 244
|
||||
Top = 352
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,431 @@
|
||||
unit Main;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, Sockets, ScktComp, StdCtrls, ComCtrls, ExtCtrls, Clipbrd, HTTPApp;
|
||||
|
||||
type
|
||||
TMainForm = class(TForm)
|
||||
SetBuilding: TButton;
|
||||
ExitButton: TButton;
|
||||
State: TUpDown;
|
||||
Edit1: TEdit;
|
||||
Building: TUpDown;
|
||||
Edit2: TEdit;
|
||||
lbl: TLabel;
|
||||
SetFloor: TButton;
|
||||
Floor: TUpDown;
|
||||
Edit3: TEdit;
|
||||
SetRoom: TButton;
|
||||
Strip: TUpDown;
|
||||
Edit4: TEdit;
|
||||
DomeOn: TButton;
|
||||
DomeOff: TButton;
|
||||
BuildingsOn: TButton;
|
||||
BuildingsOff: TButton;
|
||||
StreetOn: TButton;
|
||||
StreetOff: TButton;
|
||||
OfficeOn: TButton;
|
||||
OfficeOff: TButton;
|
||||
AutoMode: TButton;
|
||||
SetAll: TButton;
|
||||
StaticMode: TButton;
|
||||
Dome: TCheckBox;
|
||||
Buildings: TCheckBox;
|
||||
Street: TCheckBox;
|
||||
Office: TCheckBox;
|
||||
Auto: TButton;
|
||||
DomeAuto: TButton;
|
||||
BuildingsAuto: TButton;
|
||||
StreetAuto: TButton;
|
||||
OfficeAuto: TButton;
|
||||
DomeColor: TShape;
|
||||
RoomColor2: TShape;
|
||||
RoomColor1: TShape;
|
||||
RoomLabel1: TLabel;
|
||||
RoomLabel2: TLabel;
|
||||
DomeLabel: TLabel;
|
||||
RoomEdit1: TEdit;
|
||||
RoomEdit2: TEdit;
|
||||
DomeEdit: TEdit;
|
||||
Timer: TTimer;
|
||||
IP: TEdit;
|
||||
Label1: TLabel;
|
||||
MyPort: TEdit;
|
||||
Port: TLabel;
|
||||
Clear: TButton;
|
||||
Reconnect: TButton;
|
||||
Socket: TTcpClient;
|
||||
procedure ExitButtonClick(Sender: TObject);
|
||||
procedure SetBuildingClick(Sender: TObject);
|
||||
procedure SetFloorClick(Sender: TObject);
|
||||
procedure SetRoomClick(Sender: TObject);
|
||||
procedure DomeOnClick(Sender: TObject);
|
||||
procedure DomeOffClick(Sender: TObject);
|
||||
procedure AutoModeClick(Sender: TObject);
|
||||
procedure BuildingsOnClick(Sender: TObject);
|
||||
procedure BuildingsOffClick(Sender: TObject);
|
||||
procedure StreetOnClick(Sender: TObject);
|
||||
procedure StreetOffClick(Sender: TObject);
|
||||
procedure OfficeOnClick(Sender: TObject);
|
||||
procedure OfficeOffClick(Sender: TObject);
|
||||
procedure SetAllClick(Sender: TObject);
|
||||
procedure StaticModeClick(Sender: TObject);
|
||||
procedure AutoClick(Sender: TObject);
|
||||
procedure DomeAutoClick(Sender: TObject);
|
||||
procedure BuildingsAutoClick(Sender: TObject);
|
||||
procedure StreetAutoClick(Sender: TObject);
|
||||
procedure OfficeAutoClick(Sender: TObject);
|
||||
procedure DomeColorMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure RoomColor1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure RoomColor2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure EditCopy(Sender: TObject; MousePos: TPoint;
|
||||
var Handled: Boolean);
|
||||
procedure TimerTimer(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ClearClick(Sender: TObject);
|
||||
procedure ReconnectClick(Sender: TObject);
|
||||
private
|
||||
function Connect: Boolean;
|
||||
function Parts: Byte;
|
||||
procedure SetPartMode(Mode, Part: Byte);
|
||||
procedure SetAllPartMode(Mode, Part: Byte);
|
||||
function SelectColor(Brush: TBrush; Edit: TEdit): Boolean;
|
||||
procedure GetColor(Code: Byte; Brush: TBrush);
|
||||
procedure SetColor(Code: Byte; Brush: TBrush);
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
implementation
|
||||
|
||||
uses commands_model;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
//IP.Text := '192.168.30.105';
|
||||
// Íàôèã íå íàäî òåïåðü
|
||||
//Socket.RemoteHost := IP.Text;
|
||||
//Socket.RemotePort := MyPort.Text;
|
||||
end;
|
||||
|
||||
function TMainForm.Connect: Boolean;
|
||||
begin
|
||||
if not Socket.Connected then
|
||||
begin
|
||||
Caption := 'Connection to ' + IP.Text;
|
||||
Socket.RemoteHost := IP.Text;
|
||||
Socket.RemotePort := MyPort.Text;
|
||||
Socket.Active := True;
|
||||
if Socket.Connected then
|
||||
begin
|
||||
Caption := 'Connected';
|
||||
GetColor(colorDome, DomeColor.Brush);
|
||||
GetColor(colorRoom1, RoomColor1.Brush);
|
||||
GetColor(colorRoom2, RoomColor2.Brush);
|
||||
end
|
||||
else
|
||||
Caption := 'Connection error';
|
||||
end;
|
||||
|
||||
Result := Socket.Connected;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ExitButtonClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TMainForm.TimerTimer(Sender: TObject);
|
||||
var
|
||||
Cmd: TCommandNOP;
|
||||
begin
|
||||
if not Socket.Connected then Exit;
|
||||
Cmd.Size := SizeOf(Cmd);
|
||||
Cmd.Command := cmdNOP;
|
||||
Socket.SendBuf(Cmd, Cmd.Size);
|
||||
end;
|
||||
|
||||
function read(Socket: TBaseSocket; var Buffer; Size: Integer):Boolean;
|
||||
var
|
||||
Pos:PByte;
|
||||
n:Integer;
|
||||
begin
|
||||
Pos:=@Buffer;
|
||||
while Size>0 do
|
||||
begin
|
||||
if not Socket.WaitForData(100) then
|
||||
begin
|
||||
Result:=False;
|
||||
Exit;
|
||||
end;
|
||||
n:=Socket.ReceiveBuf(Pos^,Size);
|
||||
Inc(Pos,n);
|
||||
Dec(Size,n);
|
||||
end;
|
||||
Result:=True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.GetColor(Code: Byte; Brush: TBrush);
|
||||
var
|
||||
Cmd: TCommandGetColor;
|
||||
Color: TColor;
|
||||
RGB: TRGB absolute Color;
|
||||
begin
|
||||
if not Connect then Exit;
|
||||
Cmd.Size := SizeOf(Cmd);
|
||||
Cmd.Command := cmdGetColor;
|
||||
Cmd.Code := Code;
|
||||
Socket.SendBuf(Cmd, Cmd.Size);
|
||||
|
||||
Color := clBlack;
|
||||
read(Socket,RGB,sizeof(RGB));
|
||||
Brush.Color := Color;
|
||||
end;
|
||||
|
||||
procedure TMainForm.SetColor(Code: Byte; Brush: TBrush);
|
||||
var
|
||||
Cmd: TCommandSetColor;
|
||||
Color: TColor;
|
||||
RGB: TRGB absolute Color;
|
||||
begin
|
||||
if not Connect then Exit;
|
||||
Cmd.Size := SizeOf(Cmd);
|
||||
Cmd.Command := cmdSetColor;
|
||||
Cmd.Code := Code;
|
||||
Color := Brush.Color;
|
||||
Cmd.RGB := RGB;
|
||||
Socket.SendBuf(Cmd, Cmd.Size);
|
||||
end;
|
||||
|
||||
function TMainForm.SelectColor(Brush: TBrush; Edit: TEdit): Boolean;
|
||||
var
|
||||
Dialog: TColorDialog;
|
||||
Color: TColor;
|
||||
RGB: TRGB absolute Color;
|
||||
|
||||
function frm(n: Integer): string;
|
||||
begin
|
||||
Result:=
|
||||
StringReplace(
|
||||
StringReplace(
|
||||
FloatToStrF(n/255.0,ffGeneral,3,15)
|
||||
,',','.',[])
|
||||
,'0.','.',[]);
|
||||
end;
|
||||
|
||||
begin
|
||||
Dialog := TColorDialog.Create(Self);
|
||||
Dialog.Color := Brush.Color;
|
||||
Result := Dialog.Execute;
|
||||
if Result then
|
||||
Brush.Color := Dialog.Color;
|
||||
Color := Brush.Color;
|
||||
Edit.Text := frm(RGB.R) + ', ' + frm(RGB.G) + ', ' + frm(RGB.B);
|
||||
Dialog.Free;
|
||||
end;
|
||||
|
||||
procedure TMainForm.SetAllClick(Sender: TObject);
|
||||
var
|
||||
Cmd: TCommandSetAllState;
|
||||
begin
|
||||
if not Connect then Exit;
|
||||
Cmd.Size := SizeOf(Cmd);
|
||||
Cmd.Command := cmdSetAllState;
|
||||
Cmd.State := State.Position;
|
||||
Socket.SendBuf(Cmd, Cmd.Size);
|
||||
end;
|
||||
|
||||
procedure TMainForm.SetBuildingClick(Sender: TObject);
|
||||
var
|
||||
Cmd: TCommandSetBuildingState;
|
||||
begin
|
||||
if not Connect then Exit;
|
||||
Cmd.Size := SizeOf(Cmd);
|
||||
Cmd.Command := cmdSetBuildingState;
|
||||
Cmd.Building := Building.Position;
|
||||
Cmd.State := State.Position;
|
||||
Socket.SendBuf(Cmd, Cmd.Size);
|
||||
end;
|
||||
|
||||
procedure TMainForm.SetFloorClick(Sender: TObject);
|
||||
var
|
||||
Cmd: TCommandSetFloorState;
|
||||
begin
|
||||
if not Connect then Exit;
|
||||
Cmd.Size := SizeOf(Cmd);
|
||||
Cmd.Command := cmdSetFloorState;
|
||||
Cmd.Building := Building.Position;
|
||||
Cmd.Floor := Floor.Position;
|
||||
Cmd.State := State.Position;
|
||||
Socket.SendBuf(Cmd, Cmd.Size);
|
||||
end;
|
||||
|
||||
procedure TMainForm.SetRoomClick(Sender: TObject);
|
||||
var
|
||||
Cmd: TCommandSetRoomState;
|
||||
begin
|
||||
if not Connect then Exit;
|
||||
Cmd.Size := SizeOf(Cmd);
|
||||
Cmd.Command := cmdSetRoomState;
|
||||
Cmd.Building := Building.Position;
|
||||
Cmd.Strip := Strip.Position;
|
||||
Cmd.Floor := Floor.Position;
|
||||
Cmd.State := State.Position;
|
||||
Socket.SendBuf(Cmd, Cmd.Size);
|
||||
Floor.Position := Floor.Position+1;
|
||||
end;
|
||||
|
||||
procedure TMainForm.SetPartMode(Mode, Part: Byte);
|
||||
var
|
||||
Cmd: TCommandSetPartMode;
|
||||
begin
|
||||
if not Connect then Exit;
|
||||
Cmd.Size := SizeOf(Cmd);
|
||||
Cmd.Command := cmdSetPartMode;
|
||||
Cmd.Mode := Mode;
|
||||
Cmd.Part := Part;
|
||||
Socket.SendBuf(Cmd, Cmd.Size);
|
||||
end;
|
||||
|
||||
procedure TMainForm.SetAllPartMode(Mode, Part: Byte);
|
||||
begin
|
||||
SetPartMode(Mode, Part);
|
||||
SetPartMode(modeOff, not Part);
|
||||
end;
|
||||
|
||||
procedure TMainForm.DomeOnClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeOn, partDome);
|
||||
end;
|
||||
|
||||
procedure TMainForm.DomeOffClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeOff, partDome);
|
||||
end;
|
||||
|
||||
procedure TMainForm.DomeAutoClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeAuto, partDome);
|
||||
end;
|
||||
|
||||
procedure TMainForm.BuildingsOnClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeOn, partBuildings);
|
||||
end;
|
||||
|
||||
procedure TMainForm.BuildingsOffClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeOff, partBuildings);
|
||||
end;
|
||||
|
||||
procedure TMainForm.BuildingsAutoClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeAuto, partBuildings);
|
||||
end;
|
||||
|
||||
procedure TMainForm.StreetOnClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeOn, partStreetLight);
|
||||
end;
|
||||
|
||||
procedure TMainForm.StreetOffClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeOff, partStreetLight);
|
||||
end;
|
||||
|
||||
procedure TMainForm.StreetAutoClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeAuto, partStreetLight);
|
||||
end;
|
||||
|
||||
procedure TMainForm.OfficeOnClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeOn, partOfficeLight);
|
||||
end;
|
||||
|
||||
procedure TMainForm.OfficeOffClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeOff, partOfficeLight);
|
||||
end;
|
||||
|
||||
procedure TMainForm.OfficeAutoClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeAuto, partOfficeLight);
|
||||
end;
|
||||
|
||||
function TMainForm.Parts: Byte;
|
||||
begin
|
||||
Result:=0;
|
||||
if Dome.Checked then Result := Result or partDome;
|
||||
if Buildings.Checked then Result := Result or partBuildings;
|
||||
if Street.Checked then Result := Result or partStreetLight;
|
||||
if Office.Checked then Result := Result or partOfficeLight;
|
||||
end;
|
||||
|
||||
procedure TMainForm.AutoModeClick(Sender: TObject);
|
||||
begin
|
||||
SetAllPartMode(modeAuto, Parts);
|
||||
end;
|
||||
|
||||
procedure TMainForm.StaticModeClick(Sender: TObject);
|
||||
begin
|
||||
SetAllPartMode(modeOn, Parts);
|
||||
end;
|
||||
|
||||
procedure TMainForm.AutoClick(Sender: TObject);
|
||||
begin
|
||||
SetPartMode(modeAuto, partAll);
|
||||
end;
|
||||
|
||||
procedure TMainForm.DomeColorMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if SelectColor(DomeColor.Brush, DomeEdit) then
|
||||
begin
|
||||
SetColor(colorDome, DomeColor.Brush);
|
||||
SetPartMode(modeOn, partDome);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.RoomColor1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if SelectColor(RoomColor1.Brush, RoomEdit1) then
|
||||
SetColor(colorRoom1, RoomColor1.Brush);
|
||||
end;
|
||||
|
||||
procedure TMainForm.RoomColor2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if SelectColor(RoomColor2.Brush, RoomEdit2) then
|
||||
SetColor(colorRoom2, RoomColor2.Brush);
|
||||
end;
|
||||
|
||||
procedure TMainForm.EditCopy(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
|
||||
begin
|
||||
Handled := True;
|
||||
with TEdit(Sender) do
|
||||
begin
|
||||
SelectAll;
|
||||
CopyToClipboard;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ClearClick(Sender: TObject);
|
||||
begin
|
||||
Floor.Position := 0;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ReconnectClick(Sender: TObject);
|
||||
begin
|
||||
Socket.Active := False;
|
||||
Connect;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,38 @@
|
||||
-$A8
|
||||
-$B-
|
||||
-$C+
|
||||
-$D+
|
||||
-$E-
|
||||
-$F-
|
||||
-$G+
|
||||
-$H+
|
||||
-$I+
|
||||
-$J-
|
||||
-$K-
|
||||
-$L+
|
||||
-$M-
|
||||
-$N+
|
||||
-$O+
|
||||
-$P+
|
||||
-$Q-
|
||||
-$R-
|
||||
-$S-
|
||||
-$T-
|
||||
-$U-
|
||||
-$V+
|
||||
-$W-
|
||||
-$X+
|
||||
-$YD
|
||||
-$Z1
|
||||
-cg
|
||||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
-H+
|
||||
-W+
|
||||
-M
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl"
|
||||
-LN"c:\program files (x86)\borland\delphi7\Projects\Bpl"
|
||||
-w-UNSAFE_TYPE
|
||||
-w-UNSAFE_CODE
|
||||
-w-UNSAFE_CAST
|
||||
@@ -0,0 +1,136 @@
|
||||
[FileVersion]
|
||||
Version=7.0
|
||||
[Compiler]
|
||||
A=8
|
||||
B=0
|
||||
C=1
|
||||
D=1
|
||||
E=0
|
||||
F=0
|
||||
G=1
|
||||
H=1
|
||||
I=1
|
||||
J=0
|
||||
K=0
|
||||
L=1
|
||||
M=0
|
||||
N=1
|
||||
O=1
|
||||
P=1
|
||||
Q=0
|
||||
R=0
|
||||
S=0
|
||||
T=0
|
||||
U=0
|
||||
V=1
|
||||
W=0
|
||||
X=1
|
||||
Y=1
|
||||
Z=1
|
||||
ShowHints=1
|
||||
ShowWarnings=1
|
||||
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
NamespacePrefix=
|
||||
SymbolDeprecated=1
|
||||
SymbolLibrary=1
|
||||
SymbolPlatform=1
|
||||
UnitLibrary=1
|
||||
UnitPlatform=1
|
||||
UnitDeprecated=1
|
||||
HResultCompat=1
|
||||
HidingMember=1
|
||||
HiddenVirtual=1
|
||||
Garbage=1
|
||||
BoundsError=1
|
||||
ZeroNilCompat=1
|
||||
StringConstTruncated=1
|
||||
ForLoopVarVarPar=1
|
||||
TypedConstVarPar=1
|
||||
AsgToTypedConst=1
|
||||
CaseLabelRange=1
|
||||
ForVariable=1
|
||||
ConstructingAbstract=1
|
||||
ComparisonFalse=1
|
||||
ComparisonTrue=1
|
||||
ComparingSignedUnsigned=1
|
||||
CombiningSignedUnsigned=1
|
||||
UnsupportedConstruct=1
|
||||
FileOpen=1
|
||||
FileOpenUnitSrc=1
|
||||
BadGlobalSymbol=1
|
||||
DuplicateConstructorDestructor=1
|
||||
InvalidDirective=1
|
||||
PackageNoLink=1
|
||||
PackageThreadVar=1
|
||||
ImplicitImport=1
|
||||
HPPEMITIgnored=1
|
||||
NoRetVal=1
|
||||
UseBeforeDef=1
|
||||
ForLoopVarUndef=1
|
||||
UnitNameMismatch=1
|
||||
NoCFGFileFound=1
|
||||
MessageDirective=1
|
||||
ImplicitVariants=1
|
||||
UnicodeToLocale=1
|
||||
LocaleToUnicode=1
|
||||
ImagebaseMultiple=1
|
||||
SuspiciousTypecast=1
|
||||
PrivatePropAccessor=1
|
||||
UnsafeType=0
|
||||
UnsafeCode=0
|
||||
UnsafeCast=0
|
||||
[Linker]
|
||||
MapFile=0
|
||||
OutputObjs=0
|
||||
ConsoleApp=1
|
||||
DebugInfo=0
|
||||
RemoteSymbols=0
|
||||
MinStackSize=16384
|
||||
MaxStackSize=1048576
|
||||
ImageBase=4194304
|
||||
ExeDescription=
|
||||
[Directories]
|
||||
OutputDir=
|
||||
UnitOutputDir=
|
||||
PackageDLLOutputDir=
|
||||
PackageDCPOutputDir=
|
||||
SearchPath=
|
||||
Packages=
|
||||
Conditionals=
|
||||
DebugSourceDirs=
|
||||
UsePackages=0
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
Launcher=
|
||||
UseLauncher=0
|
||||
DebugCWD=
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
[Version Info]
|
||||
IncludeVerInfo=0
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=1049
|
||||
CodePage=1251
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
@@ -0,0 +1,15 @@
|
||||
program building_model;
|
||||
|
||||
uses
|
||||
Forms,
|
||||
Main in 'Main.pas' {MainForm},
|
||||
commands in '..\model\src\commands.pas',
|
||||
commands_model in '..\model\src\commands_model.pas';
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end.
|
||||
@@ -0,0 +1,189 @@
|
||||
[Closed Files]
|
||||
File_0=SourceModule,'D:\Prj_work\Masharov\model\src\commands_model.pas',0,1,49,13,5,0,0
|
||||
File_1=SourceModule,'D:\!pascal\building_model\Main.pas',0,1,102,39,117,1,0
|
||||
File_2=SourceModule,'D:\!arduino\model\commands.pas',0,1,1,1,6,0,0
|
||||
File_3=SourceModule,'D:\!arduino\model\commands_model.pas',0,1,6,1,33,0,0
|
||||
|
||||
[Modules]
|
||||
Module0=D:\Prj_work\Masharov\model_test_app\Main.pas
|
||||
Module1=D:\Prj_work\Masharov\model_test_app\building_model.dpr
|
||||
Count=2
|
||||
EditWindowCount=1
|
||||
|
||||
[D:\Prj_work\Masharov\model_test_app\Main.pas]
|
||||
ModuleType=SourceModule
|
||||
FormState=1
|
||||
FormOnTop=0
|
||||
|
||||
[D:\Prj_work\Masharov\model_test_app\building_model.dpr]
|
||||
ModuleType=SourceModule
|
||||
FormState=0
|
||||
FormOnTop=0
|
||||
|
||||
[C:\Program Files (x86)\Borland\Delphi7\Projects\ProjectGroup1.bpg]
|
||||
FormState=0
|
||||
FormOnTop=0
|
||||
|
||||
[EditWindow0]
|
||||
ViewCount=2
|
||||
CurrentView=1
|
||||
View0=0
|
||||
View1=1
|
||||
CodeExplorer=CodeExplorer@EditWindow0
|
||||
MessageView=MessageView@EditWindow0
|
||||
Create=1
|
||||
Visible=1
|
||||
State=0
|
||||
Left=118
|
||||
Top=231
|
||||
Width=1302
|
||||
Height=682
|
||||
MaxLeft=-1
|
||||
MaxTop=-1
|
||||
ClientWidth=1286
|
||||
ClientHeight=643
|
||||
LeftPanelSize=140
|
||||
LeftPanelClients=CodeExplorer@EditWindow0
|
||||
LeftPanelData=000004000000000000000000000000000000000000000000000100000000000000000C000000436F64654578706C6F726572FFFFFFFF
|
||||
RightPanelSize=0
|
||||
BottomPanelSize=0
|
||||
BottomPanelClients=MessageView@EditWindow0
|
||||
BottomPanelData=00000400010000000B0000004D6573736167655669657706050000000000000255000000000000000100000000000000000000000001000000000605000000000000FFFFFFFF
|
||||
|
||||
[View0]
|
||||
Module=D:\Prj_work\Masharov\model_test_app\building_model.dpr
|
||||
CursorX=1
|
||||
CursorY=1
|
||||
TopLine=1
|
||||
LeftCol=1
|
||||
|
||||
[View1]
|
||||
Module=D:\Prj_work\Masharov\model_test_app\Main.pas
|
||||
CursorX=23
|
||||
CursorY=401
|
||||
TopLine=390
|
||||
LeftCol=1
|
||||
|
||||
[Watches]
|
||||
Count=0
|
||||
|
||||
[Breakpoints]
|
||||
Count=0
|
||||
|
||||
[AddressBreakpoints]
|
||||
Count=0
|
||||
|
||||
[Main Window]
|
||||
Create=1
|
||||
Visible=1
|
||||
State=0
|
||||
Left=0
|
||||
Top=0
|
||||
Width=1920
|
||||
Height=123
|
||||
MaxLeft=-1
|
||||
MaxTop=-1
|
||||
ClientWidth=1904
|
||||
ClientHeight=84
|
||||
|
||||
[ProjectManager]
|
||||
Create=1
|
||||
Visible=0
|
||||
State=0
|
||||
Left=369
|
||||
Top=372
|
||||
Width=446
|
||||
Height=318
|
||||
MaxLeft=-1
|
||||
MaxTop=-1
|
||||
ClientWidth=430
|
||||
ClientHeight=279
|
||||
TBDockHeight=318
|
||||
LRDockWidth=446
|
||||
Dockable=1
|
||||
|
||||
[AlignmentPalette]
|
||||
Create=1
|
||||
Visible=0
|
||||
State=0
|
||||
Left=200
|
||||
Top=125
|
||||
Width=156
|
||||
Height=89
|
||||
MaxLeft=-1
|
||||
MaxTop=-1
|
||||
ClientWidth=150
|
||||
ClientHeight=60
|
||||
|
||||
[PropertyInspector]
|
||||
Create=1
|
||||
Visible=1
|
||||
State=0
|
||||
Left=0
|
||||
Top=491
|
||||
Width=190
|
||||
Height=556
|
||||
MaxLeft=-1
|
||||
MaxTop=-1
|
||||
ClientWidth=174
|
||||
ClientHeight=517
|
||||
TBDockHeight=556
|
||||
LRDockWidth=190
|
||||
Dockable=1
|
||||
SplitPos=85
|
||||
ArrangeBy=Name
|
||||
SelectedItem=Caption
|
||||
ExpandedItems=
|
||||
HiddenCategories=
|
||||
|
||||
[ObjectTree]
|
||||
Create=1
|
||||
Visible=1
|
||||
State=0
|
||||
Left=0
|
||||
Top=123
|
||||
Width=190
|
||||
Height=366
|
||||
MaxLeft=-1
|
||||
MaxTop=-1
|
||||
ClientWidth=174
|
||||
ClientHeight=327
|
||||
TBDockHeight=366
|
||||
LRDockWidth=190
|
||||
Dockable=1
|
||||
|
||||
[CodeExplorer@EditWindow0]
|
||||
Create=1
|
||||
Visible=1
|
||||
State=0
|
||||
Left=0
|
||||
Top=12
|
||||
Width=140
|
||||
Height=631
|
||||
MaxLeft=-1
|
||||
MaxTop=-1
|
||||
ClientWidth=140
|
||||
ClientHeight=631
|
||||
TBDockHeight=305
|
||||
LRDockWidth=140
|
||||
Dockable=1
|
||||
|
||||
[MessageView@EditWindow0]
|
||||
Create=1
|
||||
Visible=0
|
||||
State=0
|
||||
Left=12
|
||||
Top=0
|
||||
Width=1274
|
||||
Height=85
|
||||
MaxLeft=-1
|
||||
MaxTop=-1
|
||||
ClientWidth=1274
|
||||
ClientHeight=85
|
||||
TBDockHeight=85
|
||||
LRDockWidth=443
|
||||
Dockable=1
|
||||
|
||||
[DockHosts]
|
||||
DockHostCount=0
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
Reference in New Issue
Block a user