@@ -9,7 +9,7 @@ interface
99 LazFileUtils, SpinEx,rtcodegen;
1010
1111Const
12- ProgramName = ' RtBinSrc v1.1 By RetroNick - Released May 9 - 2023' ;
12+ ProgramName = ' RtBinSrc v1.2 By RetroNick - Released May 19 - 2023' ;
1313
1414type
1515
@@ -52,6 +52,7 @@ TForm1 = class(TForm)
5252 Lan : integer;
5353 Format : integer;
5454 NumType : integer;
55+ Processing : boolean;
5556
5657 procedure SetBasicTypes ;
5758 procedure SetGWBasicTypes ;
@@ -122,11 +123,17 @@ procedure TForm1.SaveAsClick(Sender: TObject);
122123procedure FMemoAppend (msg : string);
123124begin
124125 Form1.MemoWithCode.Append(msg);
126+ if (Form1.CG.LineCount Mod 50 ) = 0 then
127+ begin
128+ Form1.InfoLabel.Caption:=' Imported ' +IntToStr(Form1.CG.LineCount)+' Lines' ;
129+ Application.ProcessMessages;
130+ end ;
125131end ;
126132
127133procedure TForm1.FormCreate (Sender: TObject);
128134begin
129135 Caption:=ProgramName;
136+ Processing:=False;
130137 SetBasicTypes;
131138 CGInit(CG);
132139 CGSetLineNumber(CG,LineStartSpinEdit.Value ,LineStepsSpinEdit.Value );
@@ -137,12 +144,26 @@ procedure TForm1.ImportClick(Sender: TObject);
137144var
138145 error : word;
139146begin
147+ if Processing then
148+ begin
149+ // ShowMessage('Processing Previous Import');
150+ // InfoLabel.Caption:='Import Canceled';
151+ Import .Caption:=' Import' ; // rename cancel back to import
152+ CGSetImportStatus(CG,FALSE);
153+ Processing:=FALSE;
154+ exit;
155+ end ;
156+
140157 if EditArrayName.Text=' ' then
141158 begin
142159 ShowMessage(' Array Name Field Cannot be blank' );
143160 exit;
144161 end ;
162+
163+ Import .Caption:=' Cancel' ; // rename import button to cancel
164+ Processing:=True;
145165 CGReset(CG);
166+ // CGSetImportStatus(CG,TRUE);
146167 CGSetIndent(CG,indentSpinedit.Value );
147168 CGSetValuesPerLine(CG,ItemsPerLineSpinEdit.Value );
148169 InfoLabel.Caption:=' ' ;
@@ -156,14 +177,19 @@ procedure TForm1.ImportClick(Sender: TObject);
156177 if error<>0 then
157178 begin
158179 ShowMessage(' Error Importing File ' );
159- exit;
180+ end
181+ else
182+ begin
183+ if CG.ImportStatus then InfoLabel.Caption:=' File Imported Successfully' else InfoLabel.Caption:=' File Import Canceled' ;
160184 end ;
161-
162- InfoLabel .Caption:=' File Imported ' ;
185+ Processing:=False;
186+ Import .Caption:=' Import ' ; // rename cancel back to import
163187end ;
164188
165189procedure TForm1.InFileClick (Sender: TObject);
166190begin
191+ if Processing then exit;
192+
167193 // OpenDialog.Filter := 'Windows BMP|*.bmp|PNG|*.png|PC Paintbrush |*.pcx|DP-Amiga IFF LBM|*.lbm|DP-Amiga IFF BBM Brush|*.bbm|GIF|*.gif|RM RAW Files|*.raw|All Files|*.*';
168194 if OpenDialog.Execute then
169195 begin
@@ -176,6 +202,7 @@ procedure TForm1.InFileClick(Sender: TObject);
176202
177203procedure TForm1.LanRadioGroupClick (Sender: TObject);
178204begin
205+ if Processing then exit;
179206 case LanRadioGroup.ItemIndex of 0 :SetBasicTypes;
180207 1 :SetGWBasicTypes;
181208 2 :SetCTypes;
@@ -185,11 +212,11 @@ procedure TForm1.LanRadioGroupClick(Sender: TObject);
185212
186213procedure TForm1.CopyToClipboardClick (Sender: TObject);
187214begin
215+ if Processing then exit;
188216 MemoWithCode.SelectAll;
189217 MemoWithCode.CopyToClipboard;
190218 MemoWithCode.SelLength:=0 ;
191219 InfoLabel.Caption:=' Code Copied to Clipboard' ;
192-
193220end ;
194221
195222procedure TForm1.FormatRadioGroupClick (Sender: TObject);
@@ -223,7 +250,6 @@ procedure TForm1.SetGWBasicTypes;
223250 IndentSpinEdit.Enabled:=false;
224251 LineStartSpinEdit.Enabled:=true;
225252 LineStepsSpinEdit.Enabled:=true;
226-
227253end ;
228254
229255procedure TForm1.SetPascalTypes ;
0 commit comments