Changeset 725 for trunk/Start.pas
- Timestamp:
- Jan 13, 2026, 4:01:26 PM (3 hours ago)
- File:
-
- 1 edited
-
trunk/Start.pas (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Start.pas
r723 r725 545 545 546 546 procedure TStartDlg.ShowSettings; 547 var 548 SettingsDlg: TSettingsDlg; 547 549 begin 548 550 SettingsDlg := TSettingsDlg.Create(nil); 549 if SettingsDlg.ShowModal = mrOk then begin 550 LoadAssets; 551 SmartInvalidate(0, 0, ClientWidth, ClientHeight, Page = pgMain); 552 UpdateInterface; 553 Background.UpdateInterface; 554 UpdateMusic; 555 end; 556 FreeAndNil(SettingsDlg); 551 try 552 if SettingsDlg.ShowModal = mrOk then begin 553 LoadAssets; 554 SmartInvalidate(0, 0, ClientWidth, ClientHeight, Page = pgMain); 555 UpdateInterface; 556 Background.UpdateInterface; 557 UpdateMusic; 558 end; 559 finally 560 SettingsDlg.Free; 561 end; 557 562 end; 558 563 … … 1693 1698 Ok: Boolean; 1694 1699 MapPictureFileName: string; 1700 InputDlg: TInputDlg; 1695 1701 begin 1696 1702 if List.ItemIndex >= 0 then 1697 1703 begin 1698 if Page = pgLoad then 1699 InputDlg.Caption := Phrases.Lookup('TITLE_BOOKNAME') 1700 else 1701 InputDlg.Caption := Phrases.Lookup('TITLE_MAPNAME'); 1702 InputDlg.EditInput.Text := List.Items[List.ItemIndex]; 1703 InputDlg.CenterToRect(BoundsRect); 1704 InputDlg.ShowModal; 1705 NewName := InputDlg.EditInput.Text; 1706 while IsAutoSaveFileName(NewName) do 1707 Delete(NewName, 1, 1); 1708 if (InputDlg.ModalResult = mrOK) and (NewName <> '') and 1709 (NewName <> List.Items[List.ItemIndex]) then 1710 begin 1711 for I := 1 to Length(NewName) do 1712 if NewName[I] in ['\', '/', ':', '*', '?', '"', '<', '>', '|'] then 1713 begin 1714 SimpleMessage(Format(Phrases.Lookup('NOFILENAME'), [NewName[I]])); 1715 Exit; 1704 InputDlg := TInputDlg.Create(nil); 1705 try 1706 if Page = pgLoad then 1707 InputDlg.Caption := Phrases.Lookup('TITLE_BOOKNAME') 1708 else 1709 InputDlg.Caption := Phrases.Lookup('TITLE_MAPNAME'); 1710 InputDlg.EditInput.Text := List.Items[List.ItemIndex]; 1711 InputDlg.CenterToRect(BoundsRect); 1712 InputDlg.ShowModal; 1713 NewName := InputDlg.EditInput.Text; 1714 while IsAutoSaveFileName(NewName) do 1715 Delete(NewName, 1, 1); 1716 if (InputDlg.ModalResult = mrOK) and (NewName <> '') and 1717 (NewName <> List.Items[List.ItemIndex]) then 1718 begin 1719 for I := 1 to Length(NewName) do 1720 if NewName[I] in ['\', '/', ':', '*', '?', '"', '<', '>', '|'] then 1721 begin 1722 SimpleMessage(Format(Phrases.Lookup('NOFILENAME'), [NewName[I]])); 1723 Exit; 1724 end; 1725 if Page = pgLoad then 1726 AssignFile(F, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt) 1727 else 1728 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] + 1729 CevoMapExt); 1730 Ok := True; 1731 try 1732 if Page = pgLoad then 1733 Rename(F, GetSavedDir + DirectorySeparator + NewName + CevoExt) 1734 else 1735 Rename(F, GetMapsDir + DirectorySeparator + NewName + CevoMapExt); 1736 except 1737 // Play('INVALID'); 1738 Ok := False; 1716 1739 end; 1717 if Page = pgLoad then 1718 AssignFile(F, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt) 1719 else 1720 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] + 1721 CevoMapExt); 1722 Ok := True; 1723 try 1724 if Page = pgLoad then 1725 Rename(F, GetSavedDir + DirectorySeparator + NewName + CevoExt) 1726 else 1727 Rename(F, GetMapsDir + DirectorySeparator + NewName + CevoMapExt); 1728 except 1729 // Play('INVALID'); 1730 Ok := False; 1731 end; 1732 if Page <> pgLoad then begin 1733 // Rename map picture 1734 MapPictureFileName := GetMapsDir + DirectorySeparator + 1735 List.Items[List.ItemIndex] + CevoMapPictureExt; 1736 if FileExists(MapPictureFileName) then 1737 try 1738 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] 1739 + CevoMapPictureExt); 1740 Rename(F, GetMapsDir + DirectorySeparator + NewName + CevoMapPictureExt); 1741 except 1740 if Page <> pgLoad then begin 1741 // Rename map picture 1742 MapPictureFileName := GetMapsDir + DirectorySeparator + 1743 List.Items[List.ItemIndex] + CevoMapPictureExt; 1744 if FileExists(MapPictureFileName) then 1745 try 1746 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] 1747 + CevoMapPictureExt); 1748 Rename(F, GetMapsDir + DirectorySeparator + NewName + CevoMapPictureExt); 1749 except 1750 end; 1742 1751 end; 1743 end; 1744 if Ok then begin 1745 if Page = pgLoad then 1746 FormerGames[List.ItemIndex] := NewName 1747 else 1748 Maps[List.ItemIndex] := NewName; 1749 List.Items[List.ItemIndex] := NewName; 1750 if Page = pgEditMap then 1751 PaintInfo; 1752 List.Invalidate; 1753 end; 1752 if Ok then begin 1753 if Page = pgLoad then 1754 FormerGames[List.ItemIndex] := NewName 1755 else 1756 Maps[List.ItemIndex] := NewName; 1757 List.Items[List.ItemIndex] := NewName; 1758 if Page = pgEditMap then 1759 PaintInfo; 1760 List.Invalidate; 1761 end; 1762 end; 1763 finally 1764 InputDlg.Free; 1754 1765 end; 1755 1766 end; … … 1760 1771 iDel: Integer; 1761 1772 F: file; 1773 MessgDlg: TMessgDlg; 1762 1774 begin 1763 1775 if List.ItemIndex >= 0 then 1764 1776 begin 1765 if Page = pgLoad then 1766 MessgDlg.MessgText := Phrases.Lookup('DELETEQUERY') 1767 else 1768 MessgDlg.MessgText := Phrases.Lookup('MAPDELETEQUERY'); 1769 MessgDlg.Kind := mkOKCancel; 1770 MessgDlg.ShowModal; 1771 if MessgDlg.ModalResult = mrOK then 1772 begin 1777 MessgDlg := TMessgDlg.Create(nil); 1778 try 1773 1779 if Page = pgLoad then 1774 AssignFile(F, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)1780 MessgDlg.MessgText := Phrases.Lookup('DELETEQUERY') 1775 1781 else 1776 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] + 1777 CevoMapExt); 1778 Erase(F); 1779 iDel := List.ItemIndex; 1780 if Page = pgLoad then 1781 FormerGames.Delete(iDel) 1782 else 1783 Maps.Delete(iDel); 1784 List.Items.Delete(iDel); 1785 if List.Items.Count = 0 then 1786 ChangePage(pgNoLoad) 1787 else 1782 MessgDlg.MessgText := Phrases.Lookup('MAPDELETEQUERY'); 1783 MessgDlg.Kind := mkOKCancel; 1784 MessgDlg.ShowModal; 1785 if MessgDlg.ModalResult = mrOK then 1788 1786 begin 1789 if iDel = 0then1790 List.ItemIndex := 01787 if Page = pgLoad then 1788 AssignFile(F, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt) 1791 1789 else 1792 List.ItemIndex := iDel - 1; 1793 if (Page = pgEditMap) and (List.ItemIndex = 0) then 1794 ChangePage(pgEditRandom) 1790 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] + 1791 CevoMapExt); 1792 Erase(F); 1793 iDel := List.ItemIndex; 1794 if Page = pgLoad then 1795 FormerGames.Delete(iDel) 1796 else 1797 Maps.Delete(iDel); 1798 List.Items.Delete(iDel); 1799 if List.Items.Count = 0 then 1800 ChangePage(pgNoLoad) 1795 1801 else 1796 1802 begin 1797 List.Invalidate; 1798 if Page = pgLoad then 1799 TurnValid := False; 1800 PaintInfo; 1801 if Page = pgLoad then 1802 ReplayBtn.Visible := MiniMap.Mode <> mmMultiPlayer; 1803 if iDel = 0 then 1804 List.ItemIndex := 0 1805 else 1806 List.ItemIndex := iDel - 1; 1807 if (Page = pgEditMap) and (List.ItemIndex = 0) then 1808 ChangePage(pgEditRandom) 1809 else 1810 begin 1811 List.Invalidate; 1812 if Page = pgLoad then 1813 TurnValid := False; 1814 PaintInfo; 1815 if Page = pgLoad then 1816 ReplayBtn.Visible := MiniMap.Mode <> mmMultiPlayer; 1817 end; 1803 1818 end; 1804 1819 end; 1820 finally 1821 MessgDlg.Free; 1805 1822 end; 1806 1823 end;
Note:
See TracChangeset
for help on using the changeset viewer.
