-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathedit_memo_unit.pas
More file actions
183 lines (133 loc) · 5.21 KB
/
edit_memo_unit.pas
File metadata and controls
183 lines (133 loc) · 5.21 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
(*
================================================================================
This file is part of OpenTemplot2024, a computer program for the design of model railway track.
Copyright (C) 2024 Martin Wynne. email: martin@85a.uk
This program is free software: you may redistribute it and/or modify
it under the terms of the GNU General Public Licence as published by
the Free Software Foundation, either version 3 of the Licence, or
(at your option) any later version.
This program 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 General Public Licence for more details.
You should have received a copy of the GNU General Public Licence
along with this program. See the file: licence.txt
Or if not, refer to the web site: https://www.gnu.org/licenses/
================================================================================
This file was saved from Delphi5
This file was derived from Templot2 version 244e
*)
unit edit_memo_unit;
{$MODE Delphi}
{$ALIGN OFF}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
Tedit_memo_form = class(TForm)
font_button: TButton;
ok_panel: TPanel;
ok_button: TButton;
Label1: TLabel;
vis_edit_memo: TMemo;
datestamp_label: TLabel;
cancel_button: TButton;
overwrite_label: TLabel;
procedure font_buttonClick(Sender: TObject);
procedure vis_edit_memoKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ok_panelClick(Sender: TObject);
procedure overwrite_labelClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
edit_memo_form: Tedit_memo_form;
implementation
{$BOOLEVAL ON}
uses
control_room, keep_select, colour_unit, math_unit, info_unit;
{$R *.lfm}
//______________________________________________________________________________
var
form_overwrite_mode:boolean=False; // 214a
procedure Tedit_memo_form.font_buttonClick(Sender: TObject);
begin
vis_edit_memo.Font.Assign(get_font('choose a new text font for this panel',vis_edit_memo.Font,True));
if vis_edit_memo.Showing=True then vis_edit_memo.SetFocus;
end;
//______________________________________________________________________________
procedure Tedit_memo_form.vis_edit_memoKeyPress(Sender:TObject; var Key:Char);
begin
if (Key=Chr(27)) and (Tag=0) then Close;
// 214a overwrite mode ...
if (Sender is TCustomEdit) and (form_overwrite_mode=True)
then begin
with TCustomEdit(Sender) do begin
if (SelLength=0) and (SelStart<Length(Text))
then begin
case Key of
' '..#126, #128..#255: SelLength:=1; // select next character
end;//case
end;
end;//with
end;
end;
//______________________________________________________________________________
procedure Tedit_memo_form.FormCreate(Sender: TObject);
begin
ClientWidth:=740;
ClientHeight:=380;
AutoScroll:=False;
end;
//______________________________________________________________________________
procedure Tedit_memo_form.FormShow(Sender: TObject);
begin
if vis_edit_memo.Visible=True then vis_edit_memo.SetFocus;
end;
//______________________________________________________________________________
procedure Tedit_memo_form.FormResize(Sender: TObject);
begin
ok_panel.Left:=ClientWidth-ok_panel.Width-8;
cancel_button.Left:=ok_panel.Left-cancel_button.Width-10;
vis_edit_memo.Height:=ClientHeight-vis_edit_memo.Top-datestamp_label.Height;
vis_edit_memo.Width:=ClientWidth-vis_edit_memo.Left*2;
end;
//______________________________________________________________________________
procedure Tedit_memo_form.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key=VK_F10
then begin
Key:=0; // otherwise selects the menus.
end;
if Key=VK_PAUSE then Application.Minimize; // hide TEMPLOT on PAUSE key.
if Key=VK_INSERT // 214a
then begin
form_overwrite_mode:= NOT form_overwrite_mode;
if form_overwrite_mode=True
then overwrite_label.Caption:='OVR'
else overwrite_label.Caption:='INS';
Key:=0;
end;
end;
//______________________________________________________________________________
procedure Tedit_memo_form.ok_panelClick(Sender: TObject);
begin
edit_memo_form.ModalResult:=mrOk;
end;
//______________________________________________________________________________
procedure Tedit_memo_form.overwrite_labelClick(Sender:TObject); // 214a
begin
form_overwrite_mode:= NOT form_overwrite_mode;
if form_overwrite_mode=True
then overwrite_label.Caption:='OVR'
else overwrite_label.Caption:='INS';
end;
//______________________________________________________________________________
end.