diff --git a/.gitignore b/.gitignore index 4ab71d5..867f741 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.o *.ppu *.exe -*.out \ No newline at end of file +*.out +*.pdf \ No newline at end of file diff --git a/build.bat b/build.bat index 7e8d469..fc8b8e2 100644 --- a/build.bat +++ b/build.bat @@ -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 \ No newline at end of file diff --git a/BMPImage.pas b/src/BMPImage.pas similarity index 100% rename from BMPImage.pas rename to src/BMPImage.pas diff --git a/gui/constants.pas b/src/gui/constants.pas similarity index 100% rename from gui/constants.pas rename to src/gui/constants.pas diff --git a/gui/gui.pas b/src/gui/gui.pas similarity index 83% rename from gui/gui.pas rename to src/gui/gui.pas index 4334fb9..25a5bfb 100644 --- a/gui/gui.pas +++ b/src/gui/gui.pas @@ -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(); diff --git a/gui/utils.pas b/src/gui/utils.pas similarity index 100% rename from gui/utils.pas rename to src/gui/utils.pas diff --git a/main.pas b/src/main.pas similarity index 100% rename from main.pas rename to src/main.pas diff --git a/ucomplex.pas b/src/ucomplex.pas similarity index 100% rename from ucomplex.pas rename to src/ucomplex.pas diff --git a/доклад.odt b/доклад.odt new file mode 100644 index 0000000..66b351b Binary files /dev/null and b/доклад.odt differ