-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormMain.h
96 lines (88 loc) · 3.12 KB
/
FormMain.h
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
//---------------------------------------------------------------------------
#ifndef FormMainH
#define FormMainH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ComCtrls.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <System.Actions.hpp>
#include <Vcl.ActnCtrls.hpp>
#include <Vcl.ActnList.hpp>
#include <Vcl.ActnMan.hpp>
#include <Vcl.ActnMenus.hpp>
#include <Vcl.PlatformDefaultStyleActnCtrls.hpp>
#include <Vcl.StdActns.hpp>
#include <Vcl.ToolWin.hpp>
#include <Vcl.Dialogs.hpp>
#include <memory>
//---------------------------------------------------------------------------
namespace Alt {
//---------------------------------------------------------------------------
class TScrollBox : public Vcl::Forms::TScrollBox {
private:
using inherited = Vcl::Forms::TScrollBox;
TNotifyEvent onScroll_ { nullptr };
protected:
virtual void __fastcall WndProc(Winapi::Messages::TMessage &Message) override {
inherited::WndProc( Message );
switch ( Message.Msg ) {
case WM_HSCROLL:
case WM_VSCROLL:
if ( onScroll_ ) {
onScroll_( this );
}
break;
default:
break;
}
}
public:
__fastcall virtual TScrollBox(System::Classes::TComponent* AOwner) override
: inherited( AOwner ) {}
__property TNotifyEvent OnScroll = { read = onScroll_, write = onScroll_ };
};
//---------------------------------------------------------------------------
} // End of namespace Alt
//---------------------------------------------------------------------------
class TfrmMain : public TForm
{
__published: // IDE-managed Components
TPageControl *PageControl1;
TTabSheet *tbshtOriginal;
TPaintBox *paintboxOriginal;
TTabSheet *tbshtPseudoGrey;
TImage *imgPseudoGrey;
TTabSheet *tbshtGrey;
TImage *imgGrey;
TActionManager *ActionManager1;
TFileExit *actFileExit;
TActionMainMenuBar *ActionMainMenuBar1;
TAction *actFileOpen;
TPanel *Panel1;
TLabel *lblGreyImageInfo;
TFileOpenDialog *FileOpenDialog1;
Alt::TScrollBox *ScrollBox1;
Alt::TScrollBox *ScrollBox2;
Alt::TScrollBox *ScrollBox3;
void __fastcall actFileOpenExecute(TObject *Sender);
void __fastcall paintboxOriginalPaint(TObject *Sender);
void __fastcall ImgMouseLeave(TObject *Sender);
void __fastcall ImgMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
void __fastcall tbshtOriginalResize(TObject *Sender);
private: // User declarations
std::unique_ptr<TWICImage> img_;
std::unique_ptr<TWICImage> scaledImg_;
float scaleFactor_ { 1.0 };
void LoadImage( String FileName );
void PrepareScaledWICImage();
void __fastcall PictureScrolled( TObject *Sender );
public: // User declarations
__fastcall TfrmMain(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TfrmMain *frmMain;
//---------------------------------------------------------------------------
#endif