source: cprs/branches/tmg-cprs/CPRS-Chart/Templates/fTemplateView.pas@ 1400

Last change on this file since 1400 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

File size: 3.7 KB
RevLine 
[453]1//kt -- Modified with SourceScanner on 8/8/2007
2unit fTemplateView;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 StdCtrls, ComCtrls, ExtCtrls, Menus, ORFn, DKLang;
9
10type
11 TfrmTemplateView = class(TForm)
12 pnlBottom: TPanel;
13 reMain: TRichEdit;
14 btnClose: TButton;
15 cbStayOnTop: TCheckBox;
16 popView: TPopupMenu;
17 Copy1: TMenuItem;
18 N1: TMenuItem;
19 SelectAll1: TMenuItem;
20 btnPrint: TButton;
21 DKLanguageController1: TDKLanguageController;
22 procedure btnCloseClick(Sender: TObject);
23 procedure FormClose(Sender: TObject; var Action: TCloseAction);
24 procedure cbStayOnTopClick(Sender: TObject);
25 procedure FormDestroy(Sender: TObject);
26 procedure popViewPopup(Sender: TObject);
27 procedure Copy1Click(Sender: TObject);
28 procedure SelectAll1Click(Sender: TObject);
29 procedure btnPrintClick(Sender: TObject);
30 procedure FormCreate(Sender: TObject);
31 procedure FormShow(Sender: TObject);
32 private
33 end;
34
35procedure ShowTemplateData(Form: TForm; const Title, Text: string);
36
37var
38 frmTemplateView: TfrmTemplateView = nil;
39
40implementation
41
42uses fTemplateDialog, fRptBox, rMisc;
43
44{$R *.DFM}
45
46var
47 LastStayOnTop: boolean = FALSE;
48
49procedure ShowTemplateData(Form: TForm; const Title, Text: string);
50var
51 Cnt: integer;
52
53begin
54 if(not assigned(frmTemplateView)) then
55 frmTemplateView := TfrmTemplateView.Create(Application);
56 ResizeAnchoredFormToFont(frmTemplateView);
57 frmTemplateView.reMain.Lines.Clear;
58//frmTemplateView.Caption := 'Template: ' + Title; <-- original line. //kt 8/8/2007
59 frmTemplateView.Caption := DKLangConstW('fTemplateView_Templatex') + Title; //kt added 8/8/2007
60 frmTemplateView.reMain.Lines.Text := Text;
61 Cnt := frmTemplateView.reMain.Lines.Count;
62 CheckBoilerplate4Fields(frmTemplateView.reMain.Lines, frmTemplateView.Caption, TRUE);
63 if (Cnt > 0) and (frmTemplateView.reMain.Lines.Count = 0) then
64 frmTemplateView.Close
65 else
66 begin
67 frmTemplateView.cbStayOnTop.Checked := LastStayOnTop;
68 frmTemplateView.ActiveControl := frmTemplateView.btnClose;
69 frmTemplateView.Show;
70 Application.ProcessMessages;
71 SendMessage(frmTemplateView.reMain.Handle, EM_LINESCROLL, 0, -1 * frmTemplateView.reMain.Lines.Count);
72 end;
73end;
74
75procedure TfrmTemplateView.btnCloseClick(Sender: TObject);
76begin
77 Close;
78end;
79
80procedure TfrmTemplateView.FormClose(Sender: TObject;
81 var Action: TCloseAction);
82begin
83 SaveUserBounds(frmTemplateView);
84 Action := caFree;
85end;
86
87procedure TfrmTemplateView.cbStayOnTopClick(Sender: TObject);
88begin
89 if(cbStayOnTop.Checked) then
90 FormStyle := fsStayOnTop
91 else
92 FormStyle := fsNormal;
93 if(LastStayOnTop <> cbStayOnTop.Checked) then
94 LastStayOnTop := cbStayOnTop.Checked;
95end;
96
97procedure TfrmTemplateView.FormDestroy(Sender: TObject);
98begin
99 frmTemplateView := nil;
100end;
101
102procedure TfrmTemplateView.popViewPopup(Sender: TObject);
103begin
104 Copy1.Enabled := (reMain.SelLength > 0);
105 SelectAll1.Enabled := (reMain.Lines.Count > 0);
106end;
107
108procedure TfrmTemplateView.Copy1Click(Sender: TObject);
109begin
110 reMain.CopyToClipboard;
111end;
112
113procedure TfrmTemplateView.SelectAll1Click(Sender: TObject);
114begin
115 reMain.SelectAll;
116end;
117
118procedure TfrmTemplateView.btnPrintClick(Sender: TObject);
119begin
120//PrintStrings(Self, reMain.Lines, Caption, 'End of template'); <-- original line. //kt 8/8/2007
121 PrintStrings(Self, reMain.Lines, Caption, DKLangConstW('fTemplateView_End_of_template')); //kt added 8/8/2007
122end;
123
124procedure TfrmTemplateView.FormCreate(Sender: TObject);
125begin
126 reMain.Color := ReadOnlyColor;
127end;
128
129procedure TfrmTemplateView.FormShow(Sender: TObject);
130begin
131 SetFormPosition(frmTemplateView);
132end;
133
134end.
Note: See TracBrowser for help on using the repository browser.