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;
26 // --- Option Explicit
28 long mIndex1, mIndex2;
35 int Marker_Get_Width()
39 Width = Abs(X2 - X1) + 1;
44 int Marker_Get_Height()
48 Height = Abs(Y2 - Y1) + 1;
73 static void LimitXY(int *X, int *Y)
88 void Marker_SetPoint1(int X, int Y)
97 void Marker_SetPoint2(int X, int Y)
104 T = CAT("(", Marker_Get_Width(), " x ", Marker_Get_Height(), ")");
105 MainForm.lblFrameCount = T;
108 static void SortData()
112 XMin = (X2 < X1 ? X2 : X1);
113 YMin = (Y2 < Y1 ? Y2 : Y1);
118 void Marker_ShowMarker(boolean ShowFlag)
124 void Marker_RefreshMarker()
135 L = DigitXPos(XMin) - 1;
136 T = DigitYPos(YMin) - 1;
137 R = L + StretchWidth * Marker_Get_Width() + 1;
138 B = T + StretchWidth * Marker_Get_Height() + 1;
139 MainForm.picPane.Line(L, T, R, B, 0xFFFFFF, B);
142 void Marker_MoveMarker()
154 Tmp = GetSI(XMin, YMin);
155 if (Marker_Get_Width() == 1 && Marker_Get_Height() == 1 && IsPort(Tmp))
158 MainForm.menSP.Enabled = True;
162 MainForm.menSP.Enabled = False;
166 static boolean IsPort(long i)
168 static boolean IsPort;
173 ax = DisPlayField[i];
174 if (fiOrangeDisk < ax && ax < fiSnikSnak)
182 int X, Y, MaxX, MaxY;
188 MaxX = Marker_Get_Width() - 1;
189 MaxY = Marker_Get_Height() - 1;
190 SelectionData = REDIM_2D(sizeof(byte), 0, MaxX + 1 - 1, 0, MaxY + 1 - 1);
191 for (Y = 0; Y <= MaxY; Y++)
193 for (X = 0; X <= MaxX; X++)
195 Tmp = FieldWidth * (YMin + Y) + XMin + X;
197 // --- On Error GoTo CopyEH
198 SelectionData[X, Y] = DisPlayField[Tmp];
199 // --- On Error GoTo 0
204 TPath = CAT(App.Path, "/Mpx.clp");
205 if (FileExists(TPath))
210 // --- On Error GoTo CopyEH
211 FNum = fopen(TPath, "wb");
212 FILE_PUT(FNum, -1, &MaxX, sizeof(MaxX));
213 FILE_PUT(FNum, -1, &MaxY, sizeof(MaxY));
214 FILE_PUT(FNum, -1, &SelectionData, sizeof(SelectionData));
216 SelectionData = REDIM_1D(sizeof(byte), 0, 1 - 1);
225 int X, Y, MaxX, MaxY;
230 TPath = CAT(App.Path, "/Mpx.clp");
231 if (! FileExists(TPath))
239 // --- On Error GoTo PasteEH
240 FNum = fopen(TPath, "rb");
241 FILE_GET(FNum, -1, &MaxX, sizeof(MaxX));
242 FILE_GET(FNum, -1, &MaxY, sizeof(MaxY));
243 SelectionData = REDIM_2D(sizeof(byte), 0, MaxX + 1 - 1, 0, MaxY + 1 - 1);
244 FILE_GET(FNum, -1, &SelectionData, sizeof(SelectionData));
246 // --- On Error GoTo 0
249 if (Marker_Get_Width() <= MaxX)
250 MaxX = Marker_Get_Width() - 1;
252 if (Marker_Get_Height() <= MaxY)
253 MaxY = Marker_Get_Height() - 1;
255 for (Y = 0; Y <= MaxY; Y++)
257 for (X = 0; X <= MaxX; X++)
259 Tmp = FieldWidth * (YMin + Y) + XMin + X;
261 // --- On Error GoTo PasteEH
262 DisPlayField[Tmp] = SelectionData[X][Y];
263 PlayField16[Tmp] = UnEdSprite(SelectionData[X][Y]);
264 // --- On Error GoTo 0
269 Let_ModifiedFlag(True);
274 static void Class_Initialize()