Files moved, build.bat script, error message, info about generating in progress

This commit is contained in:
KoroLion 2020-05-10 15:25:51 +03:00
parent f2fb29308b
commit 88b94afb8e
9 changed files with 34 additions and 10 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.o
*.ppu
*.exe
*.out
*.out
*.pdf

View File

@ -1,5 +1,11 @@
rm generator.exe
rm gui.exe
cd src
fpc main.pas
mv main.exe ../generator.exe
cd gui
fpc gui.pas
mv gui.exe ../../gui.exe
pause

View File

@ -17,12 +17,13 @@ type
PGeneratorWindow = ^TGeneratorWindow;
TGeneratorWindow = object(TDialog)
pGeneratingBtn: PButton;
winRect: TRect;
curY: integer;
constructor Init;
procedure addField(caption: string; maxLength: integer);
procedure addButton(caption: string; command: integer);
function addButton(caption: string; command: integer): PButton;
end;
TMSApp = object(TApplication)
@ -51,8 +52,9 @@ begin
GeneratorWindow^.GetData(GenerateData);
startTime := getTimestamp();
GeneratorWindow^.pGeneratingBtn^.show();
with GenerateData do begin
success := RunCommand('../main', [
success := RunCommand('./generator', [
width,
height,
power,
@ -62,9 +64,17 @@ begin
path
], s);
end;
GeneratorWindow^.pGeneratingBtn^.hide();
if (success) then begin
ShowSuccess(s, (getTimestamp() - startTime) / 1000);
end else begin
MessageBox(
#3'Error'#13 +
#3'Unable to execute generator!'#13,
nil,
mfInformation or mfOkButton
);
end;
end;
@ -84,30 +94,34 @@ begin
curY := curY + 2;
end;
procedure TGeneratorWindow.addButton(caption: string; command: integer);
function TGeneratorWindow.addButton(caption: string; command: integer): PButton;
var
r: TRect;
pbtn: PButton;
begin
r.assign(3, curY, winRect.b.x - 1, curY + 1);
Insert(New(PButton, Init(r, caption, command, bfNormal)));
pbtn := New(PButton, Init(r, caption, command, bfNormal));
Insert(pbtn);
curY := curY + 2;
addButton := pbtn;
end;
constructor TGeneratorWindow.Init();
var
wr: TRect;
r: TRect;
begin
wr.assign(0, 0, 60, 19);
inherited Init(wr, 'Mandelbrot generator');
r.assign(0, 0, 60, 19);
inherited Init(r, 'Mandelbrot generator');
Options := Options or ofCentered;
HelpCtx := $F000;
winRect := wr;
winRect := r;
curY := 2;
with GenerateData do begin
path := '../generated_images';
path := './generated_images';
width := '512';
height := '512';
power := '2';
@ -125,6 +139,9 @@ begin
addField('Center Y:', 64);
addButton('Generate', cmGenerate);
curY := curY - 2;
pGeneratingBtn := addButton('Generating...', 0);
pGeneratingBtn^.hide();
end;
procedure TMSApp.NewWindow();

BIN
доклад.odt Normal file

Binary file not shown.