diff --git a/2.10/Source/FormRender.pas b/2.10/Source/FormRender.pas index 8648a44..0a1797f 100644 --- a/2.10/Source/FormRender.pas +++ b/2.10/Source/FormRender.pas @@ -612,6 +612,10 @@ begin btnPause.caption := 'Pause'; end; + if ConfirmStopRender then begin + if Application.MessageBox('Do you want to stop the current render?', 'Apophysis', 36) = ID_NO then exit; + end; + if SaveIncompleteRenders and not ChkLimitMem.Checked then begin Renderer.BreakRender; Renderer.WaitFor; //? diff --git a/2.10/Source/Global.pas b/2.10/Source/Global.pas index d2fb608..5eb17e9 100644 --- a/2.10/Source/Global.pas +++ b/2.10/Source/Global.pas @@ -128,6 +128,8 @@ var ConfirmDelete: boolean; // Flag confirmation of entry deletion OldPaletteFormat: boolean; + ConfirmExit: boolean; + ConfirmStopRender: boolean; SavePath, SmoothPalettePath: string; RandomPrefix, RandomDate: string; RandomIndex: integer; diff --git a/2.10/Source/Main.dfm b/2.10/Source/Main.dfm index 816df9e..ec86bea 100644 --- a/2.10/Source/Main.dfm +++ b/2.10/Source/Main.dfm @@ -328,6 +328,7 @@ object MainForm: TMainForm TabOrder = 1 ViewStyle = vsReport OnChange = ListViewChange + OnChanging = ListViewChanging OnEdited = ListViewEdited end object BackPanel: TPanel @@ -377,7 +378,7 @@ object MainForm: TMainForm Left = 8 Top = 56 Bitmap = { - 494C010136003B00040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600 + 494C010136003B00040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 000000000000360000002800000040000000F0000000010020000000000000F0 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -2361,7 +2362,8 @@ object MainForm: TMainForm C003000F80018000C003000780018000C003000380018000C003000180018000 C003000180018000C003001F80018000C003001F80018001C003001F80018001 C0038FF180018001C007FFF980018001C00FFF7580018001C01FFF8F80018001 - C03FFFFF80018001FFFFFFFFFFFFFFFF} + C03FFFFF80018001FFFFFFFFFFFFFFFF00000000000000000000000000000000 + 000000000000} end object SmallImages: TImageList Left = 40 diff --git a/2.10/Source/Main.pas b/2.10/Source/Main.pas index 619b086..ba64f9b 100644 --- a/2.10/Source/Main.pas +++ b/2.10/Source/Main.pas @@ -282,6 +282,8 @@ type procedure tbShowAlphaClick(Sender: TObject); procedure tbShowTraceClick(Sender: TObject); procedure XmlScannerContent(Sender: TObject; Content: String); + procedure ListViewChanging(Sender: TObject; Item: TListItem; + Change: TItemChange; var AllowChange: Boolean); private Renderer: TRenderThread; @@ -1453,20 +1455,39 @@ var Tag: string; IFile: TextFile; FileList: TStringList; + i, p: integer; + bakname: string; begin Tag := RemoveExt(filename); Result := True; try if FileExists(filename) then begin - if XMLEntryExists(title, filename) then - begin - DeleteXMLEntry(title, filename); - end; + bakname := ChangeFileExt(filename, '.bak'); + if FileExists(bakname) then DeleteFile(bakname); + RenameFile(filename, bakname); FileList := TStringList.create; try - FileList.LoadFromFile(filename); + FileList.LoadFromFile(bakname); + + if Pos(title, FileList.Text) <> 0 then + begin + i := 0; + while Pos('name="' + title + '"', Trim(FileList[i])) = 0 do + inc(i); + + p := 0; + while p = 0 do + begin + p := Pos('', FileList[i]); + FileList.Delete(i); + end; + end; + +// FileList := TStringList.create; +// try +// FileList.LoadFromFile(filename); // fix first line if (FileList.Count > 0) then begin @@ -1580,6 +1601,7 @@ function RenameXML(OldIdent: string; var NewIdent: string): boolean; var Strings: TStringList; i: integer; + bakname: string; begin Result := True; Strings := TStringList.Create; @@ -1594,6 +1616,11 @@ begin inc(i); end; Strings[i] := StringReplace(Strings[i], OldIdent, NewIdent, []); + + bakname := ChangeFileExt(OpenFile, '.bak'); + if FileExists(bakname) then DeleteFile(bakname); + RenameFile(OpenFile, bakname); + Strings.SaveToFile(OpenFile); end else @@ -2600,6 +2627,14 @@ procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction); var Registry: TRegistry; begin + if ConfirmExit and (UndoIndex <> 0) then + if Application.MessageBox('Do you really want to exit?' + #13#10 + + 'All unsaved data will be lost!', 'Apophysis', MB_ICONWARNING or MB_YESNO) <> IDYES then + begin + Action := caNone; + exit; + end; + ScriptEditor.Stopped := True; HtmlHelp(0, nil, HH_CLOSE_ALL, 0); { To capture secondary window positions } @@ -4828,4 +4863,19 @@ begin end; end; +procedure TMainForm.ListViewChanging(Sender: TObject; Item: TListItem; + Change: TItemChange; var AllowChange: Boolean); +begin +{ + if (Trim(Item.Caption) = Trim(maincp.name)) and + (Item.Selected) and (Change = ctState) then + if UndoIndex <> 0 then + if Application.MessageBox('Are you sure?', 'Apophysis', MB_ICONWARNING or MB_YESNO) <> IDYES then + begin + AllowChange := false; + exit; + end; +} +end; + end. diff --git a/2.10/Source/Options.dfm b/2.10/Source/Options.dfm index db46665..616dadd 100644 --- a/2.10/Source/Options.dfm +++ b/2.10/Source/Options.dfm @@ -250,6 +250,23 @@ object OptionsForm: TOptionsForm TabOrder = 5 WordWrap = True end + object chkConfirmExit: TCheckBox + Left = 136 + Top = 183 + Width = 81 + Height = 17 + HelpContext = 1005 + Caption = 'Confirm exit' + TabOrder = 6 + end + object chkConfirmStopRender: TCheckBox + Left = 136 + Top = 210 + Width = 121 + Height = 17 + Caption = 'Confirm stop render' + TabOrder = 7 + end end object EditorPage: TTabSheet Caption = 'Editor' diff --git a/2.10/Source/Options.pas b/2.10/Source/Options.pas index 6a06e02..1e7af29 100644 --- a/2.10/Source/Options.pas +++ b/2.10/Source/Options.pas @@ -219,6 +219,8 @@ type chkShowAllXforms: TCheckBox; txtGradientsFile: TEdit; btnGradientsFile: TSpeedButton; + chkConfirmExit: TCheckBox; + chkConfirmStopRender: TCheckBox; procedure btnCancelClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure btnOKClick(Sender: TObject); @@ -308,6 +310,8 @@ begin chkConfirmDel.Checked := ConfirmDelete; chkOldPaletteFormat.Checked := OldPaletteFormat; + chkConfirmExit.Checked := ConfirmExit; + chkConfirmStopRender.Checked := ConfirmStopRender; rgRotationMode.ItemIndex := MainForm_RotationMode; if PreserveQuality then @@ -448,6 +452,8 @@ begin NrTreads := StrToIntDef(cbNrTheads.text, 0); ConfirmDelete := chkConfirmDel.Checked; OldPaletteFormat := chkOldPaletteFormat.Checked; + ConfirmExit := chkConfirmExit.Checked; + ConfirmStopRender := chkConfirmStopRender.Checked; MainForm_RotationMode := rgRotationMode.ItemIndex; PreserveQuality := (rgZoomingMode.ItemIndex = 0); diff --git a/2.10/Source/Regstry.pas b/2.10/Source/Regstry.pas index 6971989..4f55933 100644 --- a/2.10/Source/Regstry.pas +++ b/2.10/Source/Regstry.pas @@ -94,21 +94,18 @@ begin RenderCompleteSoundFile := ''; if Registry.ValueExists('ConfirmDelete') then - begin - ConfirmDelete := Registry.ReadBool('ConfirmDelete'); - end + ConfirmDelete := Registry.ReadBool('ConfirmDelete') else - begin ConfirmDelete := True; - end; if Registry.ValueExists('OldPaletteFormat') then - begin - OldPaletteFormat := Registry.ReadBool('OldPaletteFormat'); - end + OldPaletteFormat := Registry.ReadBool('OldPaletteFormat') else - begin OldPaletteFormat := false; - end; + if Registry.ValueExists('ConfirmExit') then + ConfirmExit := Registry.ReadBool('ConfirmExit') + else + ConfirmExit := True; + if Registry.ValueExists('PreserveQuality') then begin PreserveQuality := Registry.ReadBool('PreserveQuality'); @@ -598,6 +595,7 @@ begin SavePath := DefaultPath + 'Parameters\My Flames.flame'; defSmoothPaletteFile := DefaultPath + 'smooth.ugr'; ConfirmDelete := True; + ConfirmExit := True; OldPaletteFormat := false; NumTries := 10; TryLength := 100000; @@ -1011,6 +1009,7 @@ begin Registry.WriteBool('ConfirmDelete', ConfirmDelete); Registry.WriteBool('OldPaletteFormat', OldPaletteFormat); + Registry.WriteBool('ConfirmExit', ConfirmExit); Registry.WriteInteger('NumTries', NumTries); Registry.WriteInteger('TryLength', TryLength); Registry.WriteInteger('MinTransforms', randMinTransforms);