/
UnitScreenZoom.cpp
69 lines (58 loc) · 2.96 KB
/
UnitScreenZoom.cpp
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
/*
╔══╦╗╔╗╔╦══╗╔══╗╔══╗ ╔══╦══╦════╦╗╔╗ ╔╗─╔══╦╗╔╦╗─╔╦══╦╗╔╦═══╦═══╗
║╔═╣║║║║║╔╗║║╔═╝╚╗╔╝ ║╔═╩╗╔╩═╗╔═╣║║║ ║║─║╔╗║║║║╚═╝║╔═╣║║║╔══╣╔═╗║
║╚═╣║║║║║╚╝╚╣╚═╗─║║ ║╚═╗║║──║║─║╚╝║ ║║─║╚╝║║║║╔╗─║║─║╚╝║╚══╣╚═╝║
╚═╗║║║║║║╔═╗║╔═╝─║║ ╚═╗║║║──║║─║╔╗║ ║║─║╔╗║║║║║╚╗║║─║╔╗║╔══╣╔╗╔╝
╔═╝║╚╝╚╝║╚═╝║║──╔╝╚╗ ╔═╝╠╝╚╗─║║─║║║║ ║╚═╣║║║╚╝║║─║║╚═╣║║║╚══╣║║║
╚══╩═╝╚═╩═══╩╝──╚══╝ ╚══╩══╝─╚╝─╚╝╚╝ ╚══╩╝╚╩══╩╝─╚╩══╩╝╚╩═══╩╝╚╝
Created by FOXente (Aradam)
License GPL-3.0
*/
#include <vcl.h>
#pragma hdrstop
#include "UnitScreenZoom.h"
#include "API.h"
#include "UnitAddonsControl.h"
#pragma package(smart_init)
#pragma link "acImage"
#pragma link "sBitBtn"
#pragma resource "*.dfm"
TFormScreenZoom *FormScreenZoom;
__fastcall TFormScreenZoom::TFormScreenZoom (TComponent* Owner) : TForm (Owner)
{
}
//Load image from file and change form size
void ShowImage ()
{
UnicodeString Path = GetAddOnScreensPath (LastObject -> Items -> Strings [LastObject -> ItemIndex]) + "scr_" + IntToStr (CurScreenIndex) + ".jpg";
FormScreenZoom -> sImageFullScreen -> AutoSize = true;
FormScreenZoom -> sImageFullScreen -> Picture -> LoadFromFile (Path);
FormScreenZoom -> sImageFullScreen -> AutoSize = false;
//Change image size if image over then screen size
if (FormScreenZoom -> sImageFullScreen -> Height > Screen -> Height) FormScreenZoom -> sImageFullScreen -> Height = Screen -> Height;
if (FormScreenZoom -> sImageFullScreen -> Width > Screen -> Width) FormScreenZoom -> sImageFullScreen -> Width = Screen -> Width;
//Change form sise like in image
FormScreenZoom -> Height = FormScreenZoom -> sImageFullScreen -> Height;
FormScreenZoom -> Width = FormScreenZoom -> sImageFullScreen -> Width;
}
//Previous screen
void __fastcall TFormScreenZoom::sBitBtnPreviousClick (TObject *Sender)
{
FormAddonsControl -> sBitBtnPreviousClick (NULL);
ShowImage ();
}
//Next screen
void __fastcall TFormScreenZoom::sBitBtnNextClick (TObject *Sender)
{
FormAddonsControl -> sBitBtnNextClick (NULL);
ShowImage ();
}
void __fastcall TFormScreenZoom::FormShow (TObject *Sender)
{
//Set form above the rest
SetWindowPos (Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE);
//Load image
ShowImage ();
//Set position to screen center
SetFormToScreenCenter (FormScreenZoom);
}