-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathamScript.IDE.Data.pas
More file actions
129 lines (105 loc) · 3.54 KB
/
amScript.IDE.Data.pas
File metadata and controls
129 lines (105 loc) · 3.54 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
unit amScript.IDE.Data;
interface
uses
System.SysUtils, System.Classes, System.ImageList,
Vcl.ImgList, Vcl.Controls, Vcl.Graphics,
cxImageList, cxGraphics, dxSmartImage, dxSkinsCore, dxCore, cxClasses, cxLookAndFeels,
dxSkinsForm, dxLayoutLookAndFeels;
type
TImageKind = (ikButton, ikMessage);
// TODO : Move to API unit
IImageService = interface
['{5ADBDC30-51A4-4E62-AB71-949252436646}']
procedure GetBitmap(Bitmap: TBitmap; Kind: TImageKind; ImageIndex: integer); overload;
procedure GetBitmap(Bitmap: TdxCustomSmartImage; Kind: TImageKind; ImageIndex: integer); overload;
function GetImages(Kind: TImageKind): TCustomImageList;
end;
type
TDataModuleDebuggerViewData = class(TDataModule, IImageService)
ImageListSymbols: TcxImageList;
ImagesLarge: TcxImageList;
SmallImages: TcxImageList;
ImageListMessage: TcxImageList;
SkinController: TdxSkinController;
LookAndFeelController: TcxLookAndFeelController;
LayoutLookAndFeelList: TdxLayoutLookAndFeelList;
LayoutLookAndFeel: TdxLayoutSkinLookAndFeel;
LayoutLookAndFeelNoOffsetNoDisabled: TdxLayoutSkinLookAndFeel;
private
class destructor Destroy;
private
// IImageService
procedure GetBitmap(Bitmap: TBitmap; Kind: TImageKind; ImageIndex: integer); overload;
procedure GetBitmap(Bitmap: TdxCustomSmartImage; Kind: TImageKind; ImageIndex: integer); overload;
function GetImages(Kind: TImageKind): TCustomImageList;
public
end;
function DataModuleDebuggerViewData: TDataModuleDebuggerViewData;
function ImageService: IImageService;
const
// Debugger gutter
ImageIndexExecutableLine = 13;
ImageIndexForwardArrow = 16;
ImageIndexCurrentLineBreakpoint = 15;
ImageIndexBreakpoint = 12;
ImageIndexBreakpointDisabled = 14;
// File types
ImageIndex_ProjectSourceFile = 28;
ImageIndexFileTypeScriptNew = 7;
ImageIndexFileTypeScript = 6;
ImageIndexFileTypeScriptMain = 69;
ImageIndexFileTypeFolder = 71;
ImageIndexFileTypeFolderOpen = 75;
ImageIndexFileTypeInclude = 29;
// Hint
ImageIndexHintInfo = 0;
ImageIndexHintWarning = 1;
ImageIndexHintError = 2;
ImageIndexHintDone = 3;
ImageIndexHintDeny = 4;
resourcestring
RStrFileAlreadyExistsOverwrite = 'File "%s" already exists.'#13#13'Overwrite it?';
RStrFileHasChanged = 'File "%s" has changed.'#13#13'Save it now?';
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
uses
dxSkinTheBezier,
dxGDIPlusClasses;
var
FDebuggerViewData: TDataModuleDebuggerViewData;
function DataModuleDebuggerViewData: TDataModuleDebuggerViewData;
begin
if (FDebuggerViewData = nil) then
FDebuggerViewData := TDataModuleDebuggerViewData.Create(nil);
Result := FDebuggerViewData;
end;
function ImageService: IImageService;
begin
Result := DataModuleDebuggerViewData as IImageService;
end;
{ TDataModuleDebuggerData }
class destructor TDataModuleDebuggerViewData.Destroy;
begin
FreeAndNil(FDebuggerViewData);
end;
procedure TDataModuleDebuggerViewData.GetBitmap(Bitmap: TBitmap; Kind: TImageKind; ImageIndex: integer);
begin
var ImageList := GetImages(Kind);
ImageList.GetBitmap(ImageIndex, Bitmap);
end;
procedure TDataModuleDebuggerViewData.GetBitmap(Bitmap: TdxCustomSmartImage; Kind: TImageKind; ImageIndex: integer);
begin
var ImageList := GetImages(Kind) as TcxImageList;
ImageList.GetImage(ImageIndex, Bitmap as TdxSmartImage);
end;
function TDataModuleDebuggerViewData.GetImages(Kind: TImageKind): TCustomImageList;
begin
case Kind of
ikButton:
Result := SmallImages;
ikMessage:
Result := ImageListMessage;
end;
end;
end.