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

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
*.ppu *.ppu
*.exe *.exe
*.out *.out
*.pdf

View File

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

View File

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

BIN
доклад.odt Normal file

Binary file not shown.