1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
7 static boolean IsPort(long i);
8 static void LimitXY(int *X, int *Y);
9 static void SortData();
11 // --- VERSION 1.0 CLASS
13 // --- MultiUse = -1 'True // True
14 // --- Persistable = 0 'NotPersistable // NotPersistable
15 // --- DataBindingBehavior = 0 'vbNone // vbNone
16 // --- DataSourceBehavior = 0 'vbNone // vbNone
17 // --- MTSTransactionMode = 0 'NotAnMTSObject // NotAnMTSObject
20 static char *VB_Name = "MarkerObject";
21 static boolean VB_GlobalNameSpace = False;
22 static boolean VB_Creatable = True;
23 static boolean VB_PredeclaredId = False;
24 static boolean VB_Exposed = False;
25 // --- Option Explicit
27 long mIndex1, mIndex2;
34 int Marker_Get_Width()
38 Width = Abs(X2 - X1) + 1;
43 int Marker_Get_Height()
47 Height = Abs(Y2 - Y1) + 1;
72 static void LimitXY(int *X, int *Y)
87 void Marker_SetPoint1(int X, int Y)
96 void Marker_SetPoint2(int X, int Y)
103 T = CAT("(", Marker_Get_Width(), " x ", Marker_Get_Height(), ")");
104 MainForm.lblFrameCount = T;
107 static void SortData()
111 XMin = (X2 < X1 ? X2 : X2);
112 YMin = (Y2 < Y1 ? Y2 : Y2);
115 void Marker_ShowMarker(boolean ShowFlag)
121 void Marker_RefreshMarker()
132 L = DigitXPos(XMin) - 1;
133 T = DigitYPos(YMin) - 1;
134 R = L + StretchWidth * Marker_Get_Width() + 1;
135 B = T + StretchWidth * Marker_Get_Height() + 1;
136 MainForm.picPane.Line(L, T, R, B, 0xFFFFFF, B);
139 void Marker_MoveMarker()
151 Tmp = GetSI(XMin, YMin);
152 if (Marker_Get_Width() == 1 && Marker_Get_Height() == 1 && IsPort(Tmp))
155 MainForm.menSP.Enabled = True;
159 MainForm.menSP.Enabled = False;
163 static boolean IsPort(long i)
165 static boolean IsPort;
170 ax = DisPlayField[i];
171 if (fiOrangeDisk < ax && ax < fiSnikSnak)
179 int X, Y, MaxX, MaxY;
185 MaxX = Marker_Get_Width() - 1;
186 MaxY = Marker_Get_Height() - 1;
187 SelectionData = REDIM_2D(sizeof(byte), 0, MaxX + 1 - 1, 0, MaxY + 1 - 1);
188 for (Y = 0; Y <= MaxY; Y++)
190 for (X = 0; X <= MaxX; X++)
192 Tmp = FieldWidth * (YMin + Y) + XMin + X;
194 // --- On Error GoTo CopyEH
195 SelectionData[X, Y] = DisPlayField[Tmp];
196 // --- On Error GoTo 0
201 TPath = CAT(App.Path, "/Mpx.clp");
202 if (FileExists(TPath))
207 // --- On Error GoTo CopyEH
208 FNum = fopen(TPath, "wb");
209 FILE_PUT(FNum, -1, &MaxX, sizeof(MaxX));
210 FILE_PUT(FNum, -1, &MaxY, sizeof(MaxY));
211 FILE_PUT(FNum, -1, &SelectionData, sizeof(SelectionData));
213 SelectionData = REDIM_1D(sizeof(byte), 0, 1 - 1);
222 int X, Y, MaxX, MaxY;
227 TPath = CAT(App.Path, "/Mpx.clp");
228 if (! FileExists(TPath))
236 // --- On Error GoTo PasteEH
237 FNum = fopen(TPath, "rb");
238 FILE_GET(FNum, -1, &MaxX, sizeof(MaxX));
239 FILE_GET(FNum, -1, &MaxY, sizeof(MaxY));
240 SelectionData = REDIM_2D(sizeof(byte), 0, MaxX + 1 - 1, 0, MaxY + 1 - 1);
241 FILE_GET(FNum, -1, &SelectionData, sizeof(SelectionData));
243 // --- On Error GoTo 0
246 if (Marker_Get_Width() <= MaxX)
247 MaxX = Marker_Get_Width() - 1;
249 if (Marker_Get_Height() <= MaxY)
250 MaxY = Marker_Get_Height() - 1;
252 for (Y = 0; Y <= MaxY; Y++)
254 for (X = 0; X <= MaxX; X++)
256 Tmp = FieldWidth * (YMin + Y) + XMin + X;
258 // --- On Error GoTo PasteEH
259 DisPlayField[Tmp] = SelectionData[X, Y];
260 PlayField16[Tmp] = UnEdSprite(SelectionData[X, Y]);
261 // --- On Error GoTo 0
266 Let_ModifiedFlag(True);
271 static void Class_Initialize()