From 3c82d66d2cc9d0ea466a0129c1455b2fa194c810 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Mon, 29 May 2023 21:53:55 +0300 Subject: [PATCH] gui: improve prefereces dialog --- lang/editor.ru_RU.lng | 6 + src/editor/f_main.pas | 10 +- src/editor/f_options.lfm | 259 ++++++++++++-------------------------- src/editor/f_options.pas | 253 +++++++++++++------------------------ src/editor/g_language.pas | 10 +- 5 files changed, 182 insertions(+), 356 deletions(-) diff --git a/lang/editor.ru_RU.lng b/lang/editor.ru_RU.lng index 76d05ab..8f61b97 100644 --- a/lang/editor.ru_RU.lng +++ b/lang/editor.ru_RU.lng @@ -1224,6 +1224,12 @@ g_language.MsgFileFilterAll$ = "Doom 2D: Forever Maps (*.dfz, *.dfzip, *.zip, *. g_language.MsgFileFilterAll = "Карты Doom 2D: Forever (*.dfz, *.dfzip, *.zip, *.wad)|*.dfz;*.dfzip;*.zip;*.wad|Старые карты Doom 2D: Forever 0.30 (*.ini)|*.ini|Все файлы (*.*)|*.*" g_language.MsgFileFilterWad$ = "Doom 2D: Forever Maps (*.dfz)|*.dfz|Doom 2D: Forever Maps (*.dfzip)|*.dfzip|Doom 2D: Forever Maps (*.zip)|*.zip|Doom 2D: Forever Maps (*.wad)|*.wad|All Files (*.*)|*.*" g_language.MsgFileFilterWad = "Карты Doom 2D: Forever (*.dfz)|*.dfz|Карты Doom 2D: Forever (*.dfzip)|*.dfzip|Карты Doom 2D: Forever (*.zip)|*.zip|Карты Doom 2D: Forever (*.wad)|*.wad|Все файлы (*.*)|*.*" +g_language.MsgFileFilterExeMac$ = "Doom 2D Forever.app|*.app|Doom 2D Forever (Unix Executable)|Doom2DF;*" +g_language.MsgFileFilterExeMac = "Doom 2D Forever.app|*.app|Doom 2D Forever (Исполняемый файл)|Doom2DF;*" +g_language.MsgFileFilterExeWin$ = "Doom2DF.exe|Doom2DF.exe;*.exe" +g_language.MsgFileFilterExeWin = "Doom2DF.exe|Doom2DF.exe;*.exe" +g_language.MsgFileFilterExeUnix$ = "Doom2DF|Doom2DF;*" +g_language.MsgFileFilterExeUnix = "Doom2DF|Doom2DF;*" g_language.MsgEditorTitle$ = "Doom 2D: Forever Map Editor" g_language.MsgEditorTitle = "Редактор карт Doom 2D: Forever" diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 591b7e0..69f29d3 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -2835,14 +2835,8 @@ begin gAlphaTriggerArea := ALPHA_AREA; gAlphaMonsterRect := config.ReadInt('Editor', 'MonsterRectAlpha', 0); gAlphaAreaRect := config.ReadInt('Editor', 'AreaRectAlpha', 0); - if config.ReadInt('Editor', 'Scale', 0) = 1 then - Scale := 2 - else - Scale := 1; - if config.ReadInt('Editor', 'DotSize', 0) = 1 then - DotSize := 2 - else - DotSize := 1; + Scale := Max(config.ReadInt('Editor', 'Scale', 1), 1); + DotSize := Max(config.ReadInt('Editor', 'DotSize', 1), 1); OpenDialog.InitialDir := config.ReadStr('Editor', 'LastOpenDir', MapsDir); SaveDialog.InitialDir := config.ReadStr('Editor', 'LastSaveDir', MapsDir); diff --git a/src/editor/f_options.lfm b/src/editor/f_options.lfm index a2ff37d..0a3eca3 100644 --- a/src/editor/f_options.lfm +++ b/src/editor/f_options.lfm @@ -1,7 +1,7 @@ object OptionsForm: TOptionsForm - Left = 1164 + Left = 98 Height = 360 - Top = 677 + Top = 345 Width = 640 BorderIcons = [biSystemMenu] BorderStyle = bsSingle @@ -23,7 +23,8 @@ object OptionsForm: TOptionsForm Width = 624 ActivePage = TabGeneral TabIndex = 0 - TabOrder = 2 + TabOrder = 0 + Options = [nboKeyboardTabSwitch, nboDoChangeOnSetIndex] object TabGeneral: TTabSheet Caption = 'General' ClientHeight = 284 @@ -60,7 +61,7 @@ object OptionsForm: TOptionsForm Caption = 'Использовать шахматку' Checked = True State = cbChecked - TabOrder = 8 + TabOrder = 3 end object LabelGrid: TLabel Left = 8 @@ -70,43 +71,25 @@ object OptionsForm: TOptionsForm Caption = 'Шаги сетки:' ParentColor = False end - object eDotStepOne: TEdit + object SpinEdit1: TSpinEdit Left = 8 Height = 22 Top = 128 - Width = 57 - TabOrder = 3 - Text = '16' - end - object UpDown1: TUpDown - Left = 65 - Height = 22 - Top = 128 - Width = 12 - Associate = eDotStepOne - Max = 2048 - Min = 4 - Position = 16 + Width = 50 + MaxValue = 2048 + MinValue = 4 TabOrder = 4 + Value = 16 end - object eDotStepTwo: TEdit + object SpinEdit2: TSpinEdit Left = 8 Height = 22 Top = 152 - Width = 57 + Width = 50 + MaxValue = 2048 + MinValue = 4 TabOrder = 5 - Text = '8' - end - object UpDown2: TUpDown - Left = 65 - Height = 22 - Top = 152 - Width = 12 - Associate = eDotStepTwo - Max = 2048 - Min = 4 - Position = 8 - TabOrder = 6 + Value = 8 end object LabelGridSize: TLabel Left = 8 @@ -117,42 +100,33 @@ object OptionsForm: TOptionsForm ParentColor = False WordWrap = True end - object cbDotSize: TComboBox + object SpinEdit4: TSpinEdit Left = 8 - Height = 25 + Height = 22 Top = 200 - Width = 73 - ItemHeight = 0 - ItemIndex = 0 - Items.Strings = ( - '1' - '2' - ) - TabOrder = 7 - Text = '1' + Width = 50 + MaxValue = 2 + MinValue = 1 + TabOrder = 6 + Value = 1 end object LabelMinimap: TLabel Left = 8 Height = 14 - Top = 240 + Top = 232 Width = 128 Caption = 'Масштаб мини-карты:' ParentColor = False end - object cbScale: TComboBox + object SpinEdit5: TSpinEdit Left = 8 - Height = 23 - Top = 256 - Width = 70 - ItemHeight = 0 - ItemIndex = 0 - Items.Strings = ( - '1x' - '2x' - ) - Style = csDropDownList - TabOrder = 9 - Text = '1x' + Height = 22 + Top = 248 + Width = 50 + MaxValue = 10 + MinValue = 1 + TabOrder = 7 + Value = 1 end object LabelGridCol: TLabel Left = 304 @@ -162,20 +136,14 @@ object OptionsForm: TOptionsForm Caption = 'Цвет сетки:' ParentColor = False end - object sDotColor: TShape + object ColorButton1: TColorButton Left = 304 Height = 25 Top = 24 - Width = 56 - end - object bGrid: TButton - Left = 360 - Height = 25 - Top = 24 - Width = 11 - Caption = '..' - OnClick = bGridClick - TabOrder = 10 + Width = 75 + BorderWidth = 2 + ButtonColorSize = 16 + ButtonColor = clRed end object LabelBack: TLabel Left = 304 @@ -185,21 +153,14 @@ object OptionsForm: TOptionsForm Caption = 'Цвет фона:' ParentColor = False end - object sBackColor: TShape + object ColorButton2: TColorButton Left = 304 Height = 25 Top = 80 - Width = 56 - Brush.Color = clBlack - end - object bBack: TButton - Left = 360 - Height = 25 - Top = 80 - Width = 11 - Caption = '..' - OnClick = bBackClick - TabOrder = 11 + Width = 75 + BorderWidth = 2 + ButtonColorSize = 16 + ButtonColor = clLime end object LabelPreview: TLabel Left = 304 @@ -210,21 +171,14 @@ object OptionsForm: TOptionsForm ParentColor = False WordWrap = True end - object sPreviewColor: TShape + object ColorButton3: TColorButton Left = 304 Height = 25 Top = 136 - Width = 56 - Brush.Color = clBlack - end - object bPreview: TButton - Left = 360 - Height = 25 - Top = 136 - Width = 11 - Caption = '..' - OnClick = bPreviewClick - TabOrder = 12 + Width = 75 + BorderWidth = 2 + ButtonColorSize = 16 + ButtonColor = clBlue end object LabelLanguage: TLabel Left = 304 @@ -241,7 +195,7 @@ object OptionsForm: TOptionsForm Width = 120 ItemHeight = 0 Style = csDropDownList - TabOrder = 13 + TabOrder = 8 end end object TabFiles: TTabSheet @@ -254,7 +208,7 @@ object OptionsForm: TOptionsForm Top = 8 Width = 208 Caption = 'Сжимать архив при сохранении' - TabOrder = 2 + TabOrder = 0 end object cbBackup: TCheckBox Left = 8 @@ -262,7 +216,7 @@ object OptionsForm: TOptionsForm Top = 32 Width = 218 Caption = 'Резервная копия при сохранении' - TabOrder = 3 + TabOrder = 1 end object LabelRecent: TLabel Left = 8 @@ -273,24 +227,15 @@ object OptionsForm: TOptionsForm ParentColor = False WordWrap = True end - object eRecent: TEdit + object SpinEdit3: TSpinEdit Left = 8 Height = 22 Top = 80 - Width = 57 - TabOrder = 0 - Text = '5' - end - object UpDown3: TUpDown - Left = 65 - Height = 22 - Top = 80 - Width = 12 - Associate = eRecent - Max = 10 - Min = 2 - Position = 5 - TabOrder = 1 + Width = 50 + MaxValue = 10 + MinValue = 2 + TabOrder = 2 + Value = 2 end end object TabTesting: TTabSheet @@ -305,28 +250,21 @@ object OptionsForm: TOptionsForm Caption = 'Путь к Doom2DF.exe:' ParentColor = False end - object edD2dexe: TEdit + object ExeEdit: TFileNameEdit Left = 8 Height = 22 Top = 24 - Width = 296 - TabOrder = 12 + Width = 328 + FileName = 'Doom2DF.exe' + DialogOptions = [ofNoChangeDir, ofDontAddToRecent, ofViewDetail] + FilterIndex = 0 + HideDirectories = False + ButtonWidth = 23 + NumGlyphs = 1 + MaxLength = 0 + TabOrder = 0 Text = 'Doom2DF.exe' end - object bChooseD2d: TButton - Left = 304 - Height = 22 - Top = 24 - Width = 25 - Caption = '...' - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [fsBold] - OnClick = bChooseD2dClick - ParentFont = False - TabOrder = 13 - end object LabelArgs: TLabel Left = 8 Height = 14 @@ -339,8 +277,8 @@ object OptionsForm: TOptionsForm Left = 8 Height = 22 Top = 72 - Width = 296 - TabOrder = 14 + Width = 301 + TabOrder = 1 end object rbDM: TRadioButton Left = 8 @@ -349,7 +287,7 @@ object OptionsForm: TOptionsForm Width = 91 Caption = 'Deathmatch' Checked = True - TabOrder = 0 + TabOrder = 2 TabStop = True end object rbTDM: TRadioButton @@ -358,7 +296,7 @@ object OptionsForm: TOptionsForm Top = 120 Width = 124 Caption = 'Team Deathmatch' - TabOrder = 1 + TabOrder = 3 end object rbCTF: TRadioButton Left = 8 @@ -366,7 +304,7 @@ object OptionsForm: TOptionsForm Top = 136 Width = 114 Caption = 'Capture the Flag' - TabOrder = 2 + TabOrder = 4 end object rbCOOP: TRadioButton Left = 8 @@ -374,7 +312,7 @@ object OptionsForm: TOptionsForm Top = 152 Width = 92 Caption = 'Cooperative' - TabOrder = 3 + TabOrder = 5 end object cbTwoPlayers: TCheckBox Left = 168 @@ -382,7 +320,7 @@ object OptionsForm: TOptionsForm Top = 104 Width = 89 Caption = 'Два игрока' - TabOrder = 4 + TabOrder = 6 end object cbTeamDamage: TCheckBox Left = 168 @@ -390,7 +328,7 @@ object OptionsForm: TOptionsForm Top = 120 Width = 141 Caption = 'Урон своей команде' - TabOrder = 5 + TabOrder = 7 end object cbAllowExit: TCheckBox Left = 168 @@ -400,7 +338,7 @@ object OptionsForm: TOptionsForm Caption = 'Выход из уровня' Checked = True State = cbChecked - TabOrder = 6 + TabOrder = 8 end object cbWeaponStay: TCheckBox Left = 168 @@ -408,7 +346,7 @@ object OptionsForm: TOptionsForm Top = 152 Width = 125 Caption = 'Оружие остается' - TabOrder = 7 + TabOrder = 9 end object cbMonstersDM: TCheckBox Left = 168 @@ -416,7 +354,7 @@ object OptionsForm: TOptionsForm Top = 168 Width = 103 Caption = 'Монстры в DM' - TabOrder = 8 + TabOrder = 10 end object LabelTime: TLabel Left = 8 @@ -431,7 +369,7 @@ object OptionsForm: TOptionsForm Height = 22 Top = 200 Width = 49 - TabOrder = 9 + TabOrder = 11 Text = '0' end object LabelSecs: TLabel @@ -455,7 +393,7 @@ object OptionsForm: TOptionsForm Height = 22 Top = 223 Width = 49 - TabOrder = 10 + TabOrder = 12 Text = '0' end object cbMapOnce: TCheckBox @@ -464,7 +402,7 @@ object OptionsForm: TOptionsForm Top = 256 Width = 241 Caption = 'Закрыть игру после выхода из карты' - TabOrder = 11 + TabOrder = 13 end end end @@ -476,7 +414,7 @@ object OptionsForm: TOptionsForm Caption = 'ОК' Default = True OnClick = bOKClick - TabOrder = 0 + TabOrder = 1 end object bCancel: TButton Left = 557 @@ -486,41 +424,6 @@ object OptionsForm: TOptionsForm Cancel = True Caption = 'Отмена' OnClick = bCancelClick - TabOrder = 1 - end - object ColorDialog: TColorDialog - Color = clBlack - CustomColors.Strings = ( - 'ColorA=000000' - 'ColorB=000080' - 'ColorC=008000' - 'ColorD=008080' - 'ColorE=800000' - 'ColorF=800080' - 'ColorG=808000' - 'ColorH=808080' - 'ColorI=C0C0C0' - 'ColorJ=0000FF' - 'ColorK=00FF00' - 'ColorL=00FFFF' - 'ColorM=FF0000' - 'ColorN=FF00FF' - 'ColorO=FFFF00' - 'ColorP=FFFFFF' - 'ColorQ=C0DCC0' - 'ColorR=F0CAA6' - 'ColorS=F0FBFF' - 'ColorT=A4A0A0' - ) - left = 568 - top = 264 - end - object FindD2dDialog: TOpenDialog - Title = 'Выберите файл игры Doom 2D: Forever' - DefaultExt = '.exe' - Filter = 'Doom2DF.exe|Doom2DF.exe;Doom2DF' - Options = [ofHideReadOnly, ofNoChangeDir, ofEnableSizing] - left = 472 - top = 264 + TabOrder = 2 end end diff --git a/src/editor/f_options.pas b/src/editor/f_options.pas index aebf686..fe05e20 100644 --- a/src/editor/f_options.pas +++ b/src/editor/f_options.pas @@ -7,7 +7,7 @@ interface uses LCLIntf, LCLType, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, - ExtCtrls, ComCtrls, ActnList, Registry, Math, Types; + ExtCtrls, ComCtrls, ActnList, Spin, EditBtn, Registry, Math, Types; type @@ -16,84 +16,57 @@ type TOptionsForm = class (TForm) bOK: TButton; bCancel: TButton; + cbAllowExit: TCheckBox; + cbBackup: TCheckBox; cbCheckerboard: TCheckBox; cbCompress: TCheckBox; - cbBackup: TCheckBox; cbLanguage: TComboBox; - PageControl: TPageControl; - TabGeneral: TTabSheet; - TabFiles: TTabSheet; - TabTesting: TTabSheet; - ColorDialog: TColorDialog; - // Общие настройки: + cbMapOnce: TCheckBox; + cbMonstersDM: TCheckBox; cbShowDots: TCheckBox; - cbShowTexture: TCheckBox; cbShowSize: TCheckBox; - // Шаги сетки: + cbShowTexture: TCheckBox; + cbTeamDamage: TCheckBox; + cbTwoPlayers: TCheckBox; + cbWeaponStay: TCheckBox; + ColorButton1: TColorButton; + ColorButton2: TColorButton; + ColorButton3: TColorButton; + edD2DArgs: TEdit; + edScore: TEdit; + edTime: TEdit; + ExeEdit: TFileNameEdit; + LabelArgs: TLabel; + LabelBack: TLabel; LabelGrid: TLabel; - eDotStepOne: TEdit; - UpDown1: TUpDown; - eDotStepTwo: TEdit; - UpDown2: TUpDown; - // Цвет сетки: LabelGridCol: TLabel; - sDotColor: TShape; - bGrid: TButton; - // Цвет фона: - LabelBack: TLabel; - sBackColor: TShape; - bBack: TButton; - // Цвет превью: - LabelPreview: TLabel; - sPreviewColor: TShape; - bPreview: TButton; - // Масштаб миникарты: - LabelMinimap: TLabel; - cbScale: TComboBox; - // Количество недавно открытых: - LabelRecent: TLabel; - eRecent: TEdit; - UpDown3: TUpDown; - LabelLanguage: TLabel; LabelGridSize: TLabel; - cbDotSize: TComboBox; - // Map testing: + LabelLanguage: TLabel; + LabelMinimap: TLabel; LabelPath: TLabel; - edD2dexe: TEdit; - bChooseD2d: TButton; - FindD2dDialog: TOpenDialog; - LabelArgs: TLabel; - edD2DArgs: TEdit; + LabelPreview: TLabel; + LabelRecent: TLabel; + LabelScore: TLabel; + LabelSecs: TLabel; + LabelTime: TLabel; + PageControl: TPageControl; rbCOOP: TRadioButton; rbCTF: TRadioButton; rbDM: TRadioButton; rbTDM: TRadioButton; - cbAllowExit: TCheckBox; - cbMapOnce: TCheckBox; - cbMonstersDM: TCheckBox; - cbTeamDamage: TCheckBox; - cbTwoPlayers: TCheckBox; - cbWeaponStay: TCheckBox; - LabelScore: TLabel; - LabelSecs: TLabel; - edScore: TEdit; - LabelTime: TLabel; - edTime: TEdit; - + SpinEdit1: TSpinEdit; + SpinEdit2: TSpinEdit; + SpinEdit3: TSpinEdit; + SpinEdit4: TSpinEdit; + SpinEdit5: TSpinEdit; + TabFiles: TTabSheet; + TabGeneral: TTabSheet; + TabTesting: TTabSheet; - procedure bGridClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure bOKClick(Sender: TObject); procedure bCancelClick(Sender: TObject); - procedure bBackClick(Sender: TObject); - procedure bPreviewClick(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure bChooseD2dClick(Sender: TObject); - - private - { Private declarations } - public - { Public declarations } end; var @@ -132,41 +105,23 @@ begin end; end; -procedure TOptionsForm.bGridClick(Sender: TObject); -begin - if ColorDialog.Execute then - sDotColor.Brush.Color := ColorDialog.Color; -end; - -procedure TOptionsForm.bChooseD2dClick(Sender: TObject); -begin - if FindD2dDialog.Execute then - edD2dExe.Text := FindD2dDialog.FileName; -end; - procedure TOptionsForm.FormShow(Sender: TObject); var list: TStringList; begin - sDotColor.Brush.Color := DotColor; + // General Tab: + ColorButton1.ButtonColor := DotColor; + ColorButton2.ButtonColor := BackColor; + ColorButton3.ButtonColor := PreviewColor; + SpinEdit1.Value := DotStepOne; + SpinEdit2.Value := DotStepTwo; + cbShowDots.Checked := DotEnable; cbShowTexture.Checked := DrawTexturePanel; cbShowSize.Checked := DrawPanelSize; - eDotStepOne.Text := IntToStr(DotStepOne); - eDotStepTwo.Text := IntToStr(DotStepTwo); - sBackColor.Brush.Color := BackColor; - sPreviewColor.Brush.Color := PreviewColor; cbCheckerboard.Checked := UseCheckerboard; - cbCompress.Checked := Compress; - cbBackup.Checked := Backup; - if Scale = 2 then - cbScale.ItemIndex := 1 - else - cbScale.ItemIndex := 0; - if DotSize = 2 then - cbDotSize.ItemIndex := 1 - else - cbDotSize.ItemIndex := 0; - eRecent.Text := IntToStr(RecentCount); + + SpinEdit4.Value := DotSize; + SpinEdit5.Value := Scale; try cbLanguage.Items.BeginUpdate; @@ -180,14 +135,19 @@ begin cbLanguage.Items.EndUpdate; end; - if TestGameMode = 'TDM' then - rbTDM.Checked := True - else if TestGameMode = 'CTF' then - rbCTF.Checked := True - else if TestGameMode = 'COOP' then - rbCOOP.Checked := True - else - rbDM.Checked := True; + // Files Tab: + cbCompress.Checked := Compress; + cbBackup.Checked := Backup; + SpinEdit3.Value := RecentCount; + + // Testing Tab: + ExeEdit.Text := TestD2dExe; + edD2DArgs.Text := TestD2DArgs; + + rbDM.Checked := TestGameMode = 'DM'; + rbTDM.Checked := TestGameMode = 'TDM'; + rbCTF.Checked := TestGameMode = 'CTF'; + rbCOOP.Checked := TestGameMode = 'COOP'; edTime.Text := TestLimTime; edScore.Text := TestLimScore; @@ -197,20 +157,16 @@ begin cbWeaponStay.Checked := TestOptionsWeaponStay; cbMonstersDM.Checked := TestOptionsMonstersDM; cbMapOnce.Checked := TestMapOnce; - edD2dExe.Text := TestD2dExe; - edD2DArgs.Text := TestD2DArgs; end; procedure TOptionsForm.bOKClick(Sender: TObject); var config: TConfig; re, n: Integer; - d1: Boolean; str: String; begin - // General tab - + // General tab: if cbLanguage.ItemIndex >= 0 then begin if cbLanguage.ItemIndex = 0 then str := '' else str := cbLanguage.Items[cbLanguage.ItemIndex]; @@ -221,52 +177,35 @@ begin end; end; - DotColor := sDotColor.Brush.Color; - DotEnable := cbShowDots.Checked; + DotColor := ColorButton1.ButtonColor; + BackColor := ColorButton2.ButtonColor; + PreviewColor := ColorButton3.ButtonColor; - if DotStep = DotStepOne then - d1 := True - else - d1 := False; - DotStepOne := EnsureRange(StrToIntDef(eDotStepOne.Text, 16), 4, 2048); - DotStepTwo := EnsureRange(StrToIntDef(eDotStepTwo.Text, 8), 4, 2048); - if d1 then - DotStep := DotStepOne - else - DotStep := DotStepTwo; + DotEnable := cbShowDots.Checked; + DotStep := IfThen(DotStep = DotStepOne, SpinEdit1.Value, SpinEdit2.Value); + DotStepOne := SpinEdit1.Value; + DotStepTwo := SpinEdit2.Value; DrawTexturePanel := cbShowTexture.Checked; DrawPanelSize := cbShowSize.Checked; - BackColor := sBackColor.Brush.Color; - PreviewColor := sPreviewColor.Brush.Color; UseCheckerboard := cbCheckerboard.Checked; + DotSize := SpinEdit4.Value; + Scale := SpinEdit5.Value; - if cbScale.ItemIndex = 1 then - Scale := 2 - else - Scale := 1; - - if cbDotSize.ItemIndex = 1 then - DotSize := 2 - else - DotSize := 1; - - // Files tab - - re := Min(Max(StrToIntDef(eRecent.Text, 5), 2), 10); + // Files tab: + re := SpinEdit3.Value; Compress := cbCompress.Checked; Backup := cbBackup.Checked; - // Testing tab + // Testing tab: + TestD2DExe := ExeEdit.Text; + TestD2DArgs := edD2DArgs.Text; - if rbTDM.Checked then - TestGameMode := 'TDM' - else if rbCTF.Checked then - TestGameMode := 'CTF' - else if rbCOOP.Checked then - TestGameMode := 'COOP' - else - TestGameMode := 'DM'; + TestGameMode := 'DM'; + if rbTDM.Checked then TestGameMode := 'TDM'; + if rbCTF.Checked then TestGameMode := 'CTF'; + if rbCOOP.Checked then TestGameMode := 'COOP'; + if rbDM.Checked then TestGameMode := 'DM'; TestLimTime := edTime.Text; if (not TryStrToInt(TestLimTime, n)) then @@ -278,16 +217,12 @@ begin TestOptionsTwoPlayers := cbTwoPlayers.Checked; TestOptionsTeamDamage := cbTeamDamage.Checked; - TestOptionsAllowExit := cbAllowExit.Checked; + TestOptionsAllowExit := cbAllowExit.Checked; TestOptionsWeaponStay := cbWeaponStay.Checked; TestOptionsMonstersDM := cbMonstersDM.Checked; TestMapOnce := cbMapOnce.Checked; - TestD2dExe := edD2dExe.Text; - TestD2DArgs := edD2DArgs.Text; - // save into config - config := TConfig.CreateFile(CfgFileName); config.WriteInt('Editor', 'DotColor', DotColor); @@ -295,13 +230,13 @@ begin config.WriteInt('Editor', 'DotStepOne', DotStepOne); config.WriteInt('Editor', 'DotStepTwo', DotStepTwo); config.WriteInt('Editor', 'DotStep', DotStep); - config.WriteInt('Editor', 'DotSize', cbDotSize.ItemIndex); + config.WriteInt('Editor', 'DotSize', SpinEdit4.Value); config.WriteBool('Editor', 'DrawTexturePanel', DrawTexturePanel); config.WriteBool('Editor', 'DrawPanelSize', DrawPanelSize); config.WriteInt('Editor', 'BackColor', BackColor); config.WriteInt('Editor', 'PreviewColor', PreviewColor); config.WriteBool('Editor', 'UseCheckerboard', UseCheckerboard); - config.WriteInt('Editor', 'Scale', cbScale.ItemIndex); + config.WriteInt('Editor', 'Scale', SpinEdit5.Value); config.WriteStr('Editor', 'Language', gLanguage); config.WriteInt('Editor', 'RecentCount', re); @@ -342,35 +277,15 @@ begin Close(); end; -procedure TOptionsForm.bBackClick(Sender: TObject); -begin - if ColorDialog.Execute then - sBackColor.Brush.Color := ColorDialog.Color; -end; - -procedure TOptionsForm.bPreviewClick(Sender: TObject); -begin - if ColorDialog.Execute then - sPreviewColor.Brush.Color := ColorDialog.Color; -end; - procedure TOptionsForm.FormCreate(Sender: TObject); begin {$IF DEFINED(DARWIN)} - if LowerCase(ExtractFileExt(TestD2dExe)) = '.app' then - FindD2dDialog.InitialDir := ExtractFileDir(TestD2dExe) + if LowerCase(ExtractFileExt(TestD2DExe)) = '.app' then + ExeEdit.InitialDir := ExtractFileDir(TestD2DExe) else - FindD2dDialog.InitialDir := TestD2dExe; - FindD2dDialog.DefaultExt := '.app'; - FindD2dDialog.Filter := 'Doom 2D Forever.app|*.app|Doom 2D Forever (Unix Executable)|Doom2DF;*'; - {$ELSEIF DEFINED(WINDOWS)} - FindD2dDialog.InitialDir := TestD2dExe; - FindD2dDialog.DefaultExt := '.exe'; - FindD2dDialog.Filter := 'Doom2DF.exe|Doom2DF.exe;*.exe'; + ExeEdit.InitialDir := TestD2DExe; {$ELSE} - FindD2dDialog.InitialDir := TestD2dExe; - FindD2dDialog.DefaultExt := ''; - FindD2dDialog.Filter := 'Doom2DF|Doom2DF;*'; + ExeEdit.InitialDir := TestD2DExe; {$ENDIF} end; diff --git a/src/editor/g_language.pas b/src/editor/g_language.pas index 241660c..369176e 100644 --- a/src/editor/g_language.pas +++ b/src/editor/g_language.pas @@ -631,6 +631,9 @@ Interface MsgFileFilterAll = 'Doom 2D: Forever Maps (*.dfz, *.dfzip, *.zip, *.wad)|*.dfz;*.dfzip;*.zip;*.wad|Doom 2D: Forever 0.30 Maps (*.ini)|*.ini|All Files (*.*)|*.*'; MsgFileFilterWad = 'Doom 2D: Forever Maps (*.dfz)|*.dfz|Doom 2D: Forever Maps (*.dfzip)|*.dfzip|Doom 2D: Forever Maps (*.zip)|*.zip|Doom 2D: Forever Maps (*.wad)|*.wad|All Files (*.*)|*.*'; + MsgFileFilterExeMac = 'Doom 2D Forever.app|*.app|Doom 2D Forever (Unix Executable)|Doom2DF;*'; + MsgFileFilterExeWin = 'Doom2DF.exe|Doom2DF.exe;*.exe'; + MsgFileFilterExeUnix = 'Doom2DF|Doom2DF;*'; MsgEditorTitle = 'Doom 2D: Forever Map Editor'; @@ -1192,12 +1195,17 @@ begin LabelScore.Caption := MsgLabLaunchScore; {$IF DEFINED(DARWIN)} LabelPath.Caption := MsgLabLaunchPathMac; + ExeEdit.DialogTitle := MsgCtrlLaunchOpen; + ExeEdit.Filter := MsgFileFilterExeMac; {$ELSEIF DEFINED(WINDOWS)} LabelPath.Caption := MsgLabLaunchPathWin; + ExeEdit.DialogTitle := MsgCtrlLaunchOpen; + ExeEdit.Filter := MsgFileFilterExeWin; {$ELSE} LabelPath.Caption := MsgLabLaunchPathUnix; + ExeEdit.DialogTitle := MsgCtrlLaunchOpen; + ExeEdit.Filter := MsgFileFilterExeUnix; {$ENDIF} - FindD2dDialog.Title := MsgCtrlLaunchOpen; LabelArgs.Caption := MsgLabLaunchArgs; end; -- 2.29.2