-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheditormain.cpp
More file actions
88 lines (78 loc) · 2.73 KB
/
Copy pathheditormain.cpp
File metadata and controls
88 lines (78 loc) · 2.73 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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "heditormain.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tmain *main;
//---------------------------------------------------------------------------
__fastcall Tmain::Tmain(TComponent* Owner)
: TForm(Owner), filename("")
{
}
//---------------------------------------------------------------------------
void __fastcall Tmain::Exit1Click(TObject *Sender)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall Tmain::Font1Click(TObject *Sender)
{
text->Font->Name = InputBox("Change Font", "Font Name", "Courier New");
}
//---------------------------------------------------------------------------
void __fastcall Tmain::Open1Click(TObject *Sender)
{
if (dlgOpen->Execute(this->Handle)) {
text->Lines->LoadFromFile(dlgOpen->FileName);
filename = dlgOpen->FileName;
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain::Save1Click(TObject *Sender)
{
if (dlgSave->Execute(this->Handle)) {
text->Lines->SaveToFile(dlgSave->FileName);
filename = dlgSave->FileName;
}
}
//---------------------------------------------------------------------------
void __fastcall Tmain::transpChange(TObject *Sender)
{
main->AlphaBlendValue = transp->Position;
}
//---------------------------------------------------------------------------
void __fastcall Tmain::WndProc(Messages::TMessage& Message) {
TForm::WndProc(Message); // Inherited implementation
if (Message.Msg == WM_NCHITTEST) {
TWMNCHitTest& oMsg = reinterpret_cast<TWMNCHitTest&>(Message);
TPoint oPoint(oMsg.XPos, oMsg.YPos); // Screen coordinates
oPoint = ScreenToClient(oPoint); // Now in form-local coordinates
// It's in the title bar (caption) if it's in a rectangle at the top of the form
if ((oPoint.x > 0 && oPoint.x < ClientWidth) &&
(oPoint.y > 0 && oPoint.y < 100))
{
oMsg.Result = HTCAPTION;
}
}
}
void __fastcall Tmain::FontSize1Click(TObject *Sender)
{
text->Font->Size = StrToInt(InputBox("Change Font Size", "Size", "8"));
}
//---------------------------------------------------------------------------
void __fastcall Tmain::imgCloseClick(TObject *Sender)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall Tmain::AutosaveTimer(TObject *Sender)
{
try {
text->Lines->SaveToFile(filename);
} catch (...) {
;
}
}
//---------------------------------------------------------------------------