From 6440b720d7e55069ae59d8c4340981b594c4499b Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Thu, 25 May 2023 16:00:44 +0300 Subject: [PATCH] gui: redesign menu --- src/editor/Editor.lpi | 9 +- src/editor/f_main.lfm | 393 ++++++++++++++++++++++---------------- src/editor/f_main.pas | 293 ++++++++++++++++++++++------ src/editor/g_language.pas | 87 ++++----- 4 files changed, 508 insertions(+), 274 deletions(-) diff --git a/src/editor/Editor.lpi b/src/editor/Editor.lpi index ad2ecd7..1354cd3 100644 --- a/src/editor/Editor.lpi +++ b/src/editor/Editor.lpi @@ -1,15 +1,15 @@ - + + - <ResourceType Value="res"/> <UseXPManifest Value="True"/> @@ -55,10 +55,7 @@ </CodeGeneration> <Linking> <Debugging> - <GenerateDebugInfo Value="True"/> <DebugInfoType Value="dsDwarf2Set"/> - <UseValgrind Value="False"/> - <StripSymbols Value="False"/> </Debugging> <LinkSmart Value="True"/> <Options> @@ -342,8 +339,6 @@ <Linking> <Debugging> <UseHeaptrc Value="True"/> - <TrashVariables Value="False"/> - <UseValgrind Value="False"/> </Debugging> <Options> <Win32> diff --git a/src/editor/f_main.lfm b/src/editor/f_main.lfm index 9598f10..238c112 100644 --- a/src/editor/f_main.lfm +++ b/src/editor/f_main.lfm @@ -1,11 +1,11 @@ object MainForm: TMainForm - Left = 432 + Left = 221 Height = 480 - Top = 732 + Top = 232 Width = 672 AllowDropFiles = True Caption = '2' - ClientHeight = 453 + ClientHeight = 480 ClientWidth = 672 Color = clBtnFace Constraints.MinHeight = 480 @@ -23,10 +23,11 @@ object MainForm: TMainForm OnKeyDown = FormKeyDown OnKeyUp = FormKeyUp OnResize = FormResize + OnWindowStateChange = FormWindowStateChange LCLVersion = '2.2.4.0' object Splitter1: TSplitter Left = 518 - Height = 284 + Height = 317 Top = 34 Width = 5 Align = alRight @@ -40,7 +41,7 @@ object MainForm: TMainForm Cursor = crVSplit Left = 0 Height = 3 - Top = 318 + Top = 351 Width = 672 Align = alBottom MinSize = 64 @@ -50,18 +51,18 @@ object MainForm: TMainForm end object PanelProps: TPanel Left = 523 - Height = 284 + Height = 317 Top = 34 Width = 149 Align = alRight BevelInner = bvRaised BevelOuter = bvLowered - ClientHeight = 284 + ClientHeight = 317 ClientWidth = 149 TabOrder = 0 object vleObjectProperty: TValueListEditor Left = 2 - Height = 250 + Height = 283 Top = 2 Width = 145 Align = alClient @@ -102,7 +103,7 @@ object MainForm: TMainForm object PanelPropApply: TPanel Left = 2 Height = 30 - Top = 252 + Top = 285 Width = 145 Align = alBottom BevelOuter = bvNone @@ -122,18 +123,18 @@ object MainForm: TMainForm end object PanelMap: TPanel Left = 0 - Height = 284 + Height = 317 Top = 34 Width = 518 Align = alClient BevelOuter = bvNone - ClientHeight = 284 + ClientHeight = 317 ClientWidth = 518 TabOrder = 1 object sbHorizontal: TScrollBar Left = 0 Height = 16 - Top = 268 + Top = 301 Width = 518 Align = alBottom LargeChange = 256 @@ -146,7 +147,7 @@ object MainForm: TMainForm end object sbVertical: TScrollBar Left = 502 - Height = 268 + Height = 301 Top = 0 Width = 16 Align = alRight @@ -161,7 +162,7 @@ object MainForm: TMainForm end object RenderPanel: TOpenGLControl Left = 0 - Height = 268 + Height = 301 Top = 0 Width = 502 Align = alClient @@ -201,8 +202,8 @@ object MainForm: TMainForm end object StatusBar: TStatusBar Left = 0 - Height = 21 - Top = 432 + Height = 15 + Top = 465 Width = 672 AutoHint = True Panels = < @@ -218,7 +219,7 @@ object MainForm: TMainForm object PanelObjs: TPanel Left = 0 Height = 111 - Top = 321 + Top = 354 Width = 672 Align = alBottom BevelInner = bvRaised @@ -239,48 +240,48 @@ object MainForm: TMainForm TabOrder = 0 object tsPanels: TTabSheet Caption = 'Панели' - ClientHeight = 77 - ClientWidth = 664 + ClientHeight = 68 + ClientWidth = 662 ImageIndex = 12 object lbTextureList: TListBox Left = 206 - Height = 77 + Height = 70 Hint = 'Список текстур' Top = 0 - Width = 246 + Width = 244 Align = alClient Constraints.MaxHeight = 600 Constraints.MinHeight = 70 ItemHeight = 13 OnClick = lbTextureListClick OnDrawItem = lbTextureListDrawItem + Options = [lboDrawFocusRect] Style = lbOwnerDrawFixed TabOrder = 0 - TopIndex = -1 end object PanelTextures: TPanel - Left = 452 - Height = 77 + Left = 450 + Height = 68 Top = 0 Width = 212 Align = alRight BevelOuter = bvNone - ClientHeight = 77 + ClientHeight = 68 ClientWidth = 212 TabOrder = 1 object LabelTxH: TLabel Left = 33 - Height = 14 + Height = 13 Top = 22 - Width = 105 + Width = 95 Caption = 'Высота текстуры:' ParentColor = False end object LabelTxW: TLabel Left = 33 - Height = 14 + Height = 13 Top = 0 - Width = 109 + Width = 101 Caption = 'Ширина текстуры:' ParentColor = False end @@ -302,9 +303,9 @@ object MainForm: TMainForm end object cbPreview: TCheckBox Left = 35 - Height = 21 + Height = 18 Top = 54 - Width = 187 + Width = 205 Caption = 'Предварительный просмотр' TabOrder = 0 end @@ -340,17 +341,17 @@ object MainForm: TMainForm end object PanelPanelType: TPanel Left = 0 - Height = 77 + Height = 68 Top = 0 Width = 206 Align = alLeft BevelOuter = bvNone - ClientHeight = 77 + ClientHeight = 68 ClientWidth = 206 TabOrder = 2 object lbPanelType: TListBox Left = 0 - Height = 77 + Height = 68 Hint = 'Тип панели' Top = 0 Width = 201 @@ -370,18 +371,19 @@ object MainForm: TMainForm 'Блокиратор монстров' ) ItemHeight = 20 + Options = [lboDrawFocusRect] TabOrder = 0 end end end object tsItems: TTabSheet Caption = 'Предметы' - ClientHeight = 77 - ClientWidth = 664 + ClientHeight = 68 + ClientWidth = 662 ImageIndex = 4 object lbItemList: TListBox Left = 0 - Height = 77 + Height = 68 Hint = 'Список предметов' Top = 0 Width = 201 @@ -420,35 +422,35 @@ object MainForm: TMainForm 'Бутылек здоровья' 'Часть брони' ) - ItemHeight = 0 + ItemHeight = 20 + Options = [lboDrawFocusRect] TabOrder = 0 - TopIndex = -1 end object cbOnlyDM: TCheckBox Left = 208 - Height = 21 + Height = 18 Top = 0 - Width = 110 + Width = 102 Caption = 'Только в DM' TabOrder = 1 end object cbFall: TCheckBox Left = 208 - Height = 21 + Height = 18 Top = 16 - Width = 74 + Width = 67 Caption = 'Падает' TabOrder = 2 end end object tsMonsters: TTabSheet Caption = 'Монстры' - ClientHeight = 77 - ClientWidth = 664 + ClientHeight = 68 + ClientWidth = 662 ImageIndex = 15 object lbMonsterList: TListBox Left = 0 - Height = 77 + Height = 68 Hint = 'Список монстров' Top = 0 Width = 201 @@ -475,15 +477,15 @@ object MainForm: TMainForm 'Робот' 'Приколист' ) - ItemHeight = 0 + ItemHeight = 20 + Options = [lboDrawFocusRect] TabOrder = 0 - TopIndex = -1 end object rbMonsterLeft: TRadioButton Left = 208 - Height = 21 + Height = 18 Top = 0 - Width = 65 + Width = 58 Caption = 'Влево' Checked = True TabOrder = 1 @@ -491,21 +493,21 @@ object MainForm: TMainForm end object rbMonsterRight: TRadioButton Left = 208 - Height = 21 + Height = 18 Top = 16 - Width = 73 + Width = 66 Caption = 'Вправо' TabOrder = 2 end end object tsAreas: TTabSheet Caption = 'Области' - ClientHeight = 77 - ClientWidth = 664 + ClientHeight = 68 + ClientWidth = 662 ImageIndex = 3 object lbAreasList: TListBox Left = 0 - Height = 77 + Height = 68 Hint = 'Список областей' Top = 0 Width = 201 @@ -520,15 +522,15 @@ object MainForm: TMainForm 'Красная команда' 'Синяя команда' ) - ItemHeight = 0 + ItemHeight = 20 + Options = [lboDrawFocusRect] TabOrder = 0 - TopIndex = -1 end object rbAreaLeft: TRadioButton Left = 208 - Height = 21 + Height = 18 Top = 0 - Width = 65 + Width = 58 Caption = 'Влево' Checked = True TabOrder = 1 @@ -536,21 +538,21 @@ object MainForm: TMainForm end object rbAreaRight: TRadioButton Left = 208 - Height = 21 + Height = 18 Top = 16 - Width = 73 + Width = 66 Caption = 'Вправо' TabOrder = 2 end end object tsTriggers: TTabSheet Caption = 'Триггеры' - ClientHeight = 77 - ClientWidth = 664 + ClientHeight = 68 + ClientWidth = 662 ImageIndex = 6 object lbTriggersList: TListBox Left = 0 - Height = 77 + Height = 68 Hint = 'Список триггеров' Top = 0 Width = 201 @@ -578,13 +580,13 @@ object MainForm: TMainForm 'Создать предмет' 'Музыка' ) - ItemHeight = 0 + ItemHeight = 20 + Options = [lboDrawFocusRect] TabOrder = 0 - TopIndex = -1 end object clbActivationType: TCheckListBox Left = 201 - Height = 77 + Height = 68 Hint = 'Тип активации триггера' Top = 0 Width = 128 @@ -597,16 +599,15 @@ object MainForm: TMainForm 'Выстрел' 'Монстров нет' ) - ItemHeight = 0 + ItemHeight = 20 TabOrder = 1 - TopIndex = -1 Data = { 06000000000000000000 } end object clbKeys: TCheckListBox Left = 329 - Height = 77 + Height = 68 Hint = 'Ключи для активации' Top = 0 Width = 128 @@ -618,9 +619,8 @@ object MainForm: TMainForm 'Красная команда' 'Синяя команда' ) - ItemHeight = 0 + ItemHeight = 20 TabOrder = 2 - TopIndex = -1 Data = { 050000000000000000 } @@ -749,12 +749,12 @@ object MainForm: TMainForm DefaultExt = '.dfz' Filter = 'Карты Doom 2D: Forever (*.dfz, *.dfzip, *.zip, *.wad)|*.dfz;*.dfzip;*.zip;*.wad|Старые карты Doom 2D: Forever 0.30 (*.ini)|*.ini|Все файлы (*.*)|*.*' Options = [ofHideReadOnly, ofNoChangeDir, ofPathMustExist, ofFileMustExist, ofEnableSizing, ofDontAddToRecent] - left = 32 - top = 64 + Left = 32 + Top = 64 end object ImageList: TImageList - left = 32 - top = 101 + Left = 32 + Top = 101 Bitmap = { 4C7A1E00000010000000100000003A1000000000000078DAED5D4DAC234711F6 D1471FDFD512A018118209903884102C72F101212B512483E06090001F22300A @@ -893,81 +893,130 @@ object MainForm: TMainForm DefaultExt = '.dfz' Filter = 'Карты Doom 2D: Forever (*.dfz)|*.dfz|Карты Doom 2D: Forever (*.dfzip)|*.dfzip|Карты Doom 2D: Forever (*.zip)|*.zip|Карты Doom 2D: Forever (*.wad)|*.wad|Все файлы (*.*)|*.*' Options = [ofHideReadOnly, ofNoChangeDir, ofPathMustExist, ofNoReadOnlyReturn, ofEnableSizing, ofDontAddToRecent] - left = 64 - top = 64 + Left = 64 + Top = 64 end object MainMenu: TMainMenu Images = ImageList - left = 96 - top = 64 + Left = 96 + Top = 64 + object miApple: TMenuItem + Caption = '' + Enabled = False + Visible = False + object miAppleAbout: TMenuItem + Caption = 'About Editor' + OnClick = aAboutExecute + end + object miAppleLine0: TMenuItem + Caption = '-' + end + object miApplePref: TMenuItem + Caption = 'Preferences...' + ShortCut = 4284 + OnClick = aEditorOptionsExecute + end + object miAppleLine1: TMenuItem + Caption = '-' + end + end object miMenuFile: TMenuItem - Caption = 'Файл' + Caption = 'File' object miNewMap: TMenuItem - Caption = 'Новая карта' + Caption = 'New' ImageIndex = 0 ShortCut = 16462 OnClick = aNewMapExecute end object miOpenMap: TMenuItem - Caption = 'Открыть карту' + Caption = 'Open...' ImageIndex = 1 ShortCut = 16463 OnClick = aOpenMapExecute end + object miMacRecentSubMenu: TMenuItem + Caption = 'Open Recent' + Enabled = False + Visible = False + object miMacRecentEnd: TMenuItem + Caption = '-' + end + object miMacRecentClear: TMenuItem + Caption = 'Clear Recent' + OnClick = miMacRecentClearClick + end + end + object Separator1: TMenuItem + Caption = '-' + end object miSaveMap: TMenuItem - Caption = 'Сохранить карту' + Caption = 'Save' ImageIndex = 2 ShortCut = 16467 OnClick = aSaveMapExecute end object miSaveMapAs: TMenuItem - Caption = 'Сохранить карту как...' + Caption = 'Save As...' ImageIndex = 21 OnClick = aSaveMapAsExecute end object miOpenWadMap: TMenuItem - Caption = 'Выбрать карту' + Caption = 'Select Map...' ImageIndex = 28 OnClick = miOpenWadMapClick end - object miLine1: TMenuItem - Caption = '-' - end object miReopenMap: TMenuItem - Caption = 'Открыть заново' + Caption = 'Revert to Saved' ImageIndex = 1 ShortCut = 116 OnClick = miReopenMapClick end + object miLine1: TMenuItem + Caption = '-' + end object miSaveMiniMap: TMenuItem - Caption = 'Сохранить мини-карту' + Caption = 'Export Minimap...' ImageIndex = 22 OnClick = miSaveMiniMapClick end object miDeleteMap: TMenuItem - Caption = 'Удалить карту из WAD...' + Caption = 'Delete from WAD...' ImageIndex = 11 OnClick = aDeleteMap end object miPackMap: TMenuItem - Caption = 'Упаковать карту' + Caption = 'Pack to WAD...' ImageIndex = 26 OnClick = miPackMapClick end + object miWinRecentStart: TMenuItem + Caption = '-' + Enabled = False + Visible = False + end + object miWinRecent: TMenuItem + Caption = 'Recent Files' + Enabled = False + Visible = False + end object miLine2: TMenuItem Caption = '-' + Enabled = False + Visible = False end object miExit: TMenuItem - Caption = 'Выход' + Caption = 'Exit' + Enabled = False ImageIndex = 10 ShortCut = 121 + Visible = False OnClick = aExitExecute end end object miMenuEdit: TMenuItem - Caption = 'Правка' + Caption = 'Edit' object miUndo: TMenuItem - Caption = 'Отменить' + Caption = 'Undo' Enabled = False ImageIndex = 5 ShortCut = 16474 @@ -977,21 +1026,21 @@ object MainForm: TMainForm Caption = '-' end object miCopy: TMenuItem - Caption = 'Копировать объект' + Caption = 'Copy' Enabled = False ImageIndex = 8 ShortCut = 16451 OnClick = aCopyObjectExecute end object miCut: TMenuItem - Caption = 'Вырезать объект' + Caption = 'Cut' Enabled = False ImageIndex = 7 ShortCut = 16472 OnClick = aCutObjectExecute end object miPaste: TMenuItem - Caption = 'Вставить объект' + Caption = 'Paste' ImageIndex = 9 ShortCut = 16470 OnClick = aPasteObjectExecute @@ -1000,7 +1049,7 @@ object MainForm: TMainForm Caption = '-' end object miSelectAll: TMenuItem - Caption = 'Выделить все объекты' + Caption = 'Select All' ImageIndex = 24 ShortCut = 16449 OnClick = aSelectAllExecute @@ -1008,48 +1057,56 @@ object MainForm: TMainForm object miLine5: TMenuItem Caption = '-' end + object miSnapToGrid: TMenuItem + Caption = 'Snap to Grid' + ImageIndex = 20 + ShortCut = 16465 + OnClick = miSnapToGridClick + end + object miSwitchGrid: TMenuItem + Caption = 'Switch Grid Granularity' + ImageIndex = 19 + ShortCut = 16453 + OnClick = miSwitchGridClick + end + object Separator2: TMenuItem + Caption = '-' + end object miToFore: TMenuItem - Caption = 'Передвинуть вперед' + Caption = 'Bring to Front' Enabled = False ImageIndex = 25 ShortCut = 16605 OnClick = aMoveToFore end object miToBack: TMenuItem - Caption = 'Передвинуть назад' + Caption = 'Send to Back' Enabled = False ImageIndex = 13 ShortCut = 16603 OnClick = aMoveToBack end - end - object miMenuTools: TMenuItem - Caption = 'Инструменты' - object miSnapToGrid: TMenuItem - Caption = 'Привязка к сетке' - ImageIndex = 20 - ShortCut = 16465 - OnClick = miSnapToGridClick + object miLine6: TMenuItem + Caption = '-' end - object miMiniMap: TMenuItem - Caption = 'Мини-карта' + object miMapOptions: TMenuItem + Caption = 'Map Properties...' ImageIndex = 14 - ShortCut = 16471 - OnClick = miMiniMapClick - end - object miSwitchGrid: TMenuItem - Caption = 'Переключить сетку' - ImageIndex = 19 - ShortCut = 16453 - OnClick = miSwitchGridClick + ShortCut = 16461 + OnClick = aMapOptionsExecute end - object miShowEdges: TMenuItem - Caption = 'Границы карты' - ImageIndex = 29 - OnClick = miShowEdgesClick + object miOptions: TMenuItem + Caption = 'Preferences...' + Enabled = False + ImageIndex = 16 + Visible = False + OnClick = aEditorOptionsExecute end + end + object miMenuView: TMenuItem + Caption = 'View' object miLayers: TMenuItem - Caption = 'Слои' + Caption = 'Show Layers' ImageIndex = 25 object miLayer1: TMenuItem Caption = 'Фон' @@ -1098,57 +1155,73 @@ object MainForm: TMainForm OnClick = miLayer9Click end end + object miViewLine1: TMenuItem + Caption = '-' + end + object miMiniMap: TMenuItem + Caption = 'Show Minimap' + ImageIndex = 14 + ShortCut = 16471 + OnClick = miMiniMapClick + end + object miShowEdges: TMenuItem + Caption = 'Show Map Bounds' + ImageIndex = 29 + OnClick = miShowEdgesClick + end + object miViewLine2: TMenuItem + Caption = '-' + end + object miMapPreview: TMenuItem + Caption = 'Preview Mode' + ImageIndex = 23 + ShortCut = 9 + OnClick = miMapPreviewClick + end end object miMenuService: TMenuItem - Caption = 'Сервис' + Caption = 'Service' object miCheckMap: TMenuItem - Caption = 'Проверка карты' + Caption = 'Analyse Map...' ImageIndex = 17 OnClick = aCheckMapExecute end object miOptimmization: TMenuItem - Caption = 'Оптимизация карты' + Caption = 'Optimize Map...' ImageIndex = 18 OnClick = aOptimizeExecute end - object miMapPreview: TMenuItem - Caption = 'Предварительный просмотр' - ImageIndex = 23 - ShortCut = 9 - OnClick = miMapPreviewClick - end object miTestMap: TMenuItem - Caption = 'Тест карты в игре' + Caption = 'Run Test' ImageIndex = 27 OnClick = miTestMapClick end end - object miMenuSettings: TMenuItem - Caption = 'Настройка' - object miMapOptions: TMenuItem - Caption = 'Карта' - ImageIndex = 14 - ShortCut = 16461 - OnClick = aMapOptionsExecute - end - object miLine6: TMenuItem - Caption = '-' + object miMenuWindow: TMenuItem + Caption = 'Window' + Enabled = False + Visible = False + object miMacMinimize: TMenuItem + Caption = 'Minimize' + ShortCut = 4173 + OnClick = miMacMinimizeClick end - object miOptions: TMenuItem - Caption = 'Редактор' - ImageIndex = 16 - OnClick = aEditorOptionsExecute + object miMacZoom: TMenuItem + Caption = 'Zoom' + OnClick = miMacZoomClick end end object miMenuHelp: TMenuItem - Caption = 'Справка' + Caption = 'Help' object miAbout: TMenuItem - Caption = 'О программе' + Caption = 'About Editor' + Enabled = False ImageIndex = 16 + Visible = False OnClick = aAboutExecute end end - object miHidden1: TMenuItem + object miMenuHidden: TMenuItem Caption = 'hidden' Visible = False object minexttab: TMenuItem @@ -1165,8 +1238,8 @@ object MainForm: TMainForm end object pmShow: TPopupMenu Images = ImageList - left = 128 - top = 64 + Left = 128 + Top = 64 object miLayerP1: TMenuItem Caption = 'Фон' Checked = True @@ -1216,8 +1289,8 @@ object MainForm: TMainForm object ilToolbar: TImageList Height = 24 Width = 24 - left = 64 - top = 101 + Left = 64 + Top = 101 Bitmap = { 4C7A090000001800000018000000810800000000000078DAED9C4D6C13471886 73E4C021C71C9020200E415C0C17A2860A0511513797BAD046A610D1084465A4 @@ -1314,12 +1387,12 @@ object MainForm: TMainForm 'ColorS=F0FBFF' 'ColorT=A4A0A0' ) - left = 64 - top = 146 + Left = 64 + Top = 146 end object MapTestTimer: TTimer OnTimer = MapTestCheck - left = 192 - top = 64 + Left = 192 + Top = 64 end end diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 5fbd360..790a646 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -18,18 +18,27 @@ type lLoad: TLabel; // Главное меню: MainMenu: TMainMenu; + // Apple menu: + miApple: TMenuItem; + miAppleAbout: TMenuItem; + miAppleLine0: TMenuItem; + miApplePref: TMenuItem; + miAppleLine1: TMenuItem; // "Файл": miMenuFile: TMenuItem; miNewMap: TMenuItem; miOpenMap: TMenuItem; miSaveMap: TMenuItem; miSaveMapAs: TMenuItem; + miMacRecentSubMenu: TMenuItem; + miMacRecentClear: TMenuItem; miOpenWadMap: TMenuItem; miLine1: TMenuItem; miReopenMap: TMenuItem; miSaveMiniMap: TMenuItem; miDeleteMap: TMenuItem; miPackMap: TMenuItem; + miWinRecent: TMenuItem; miLine2: TMenuItem; miExit: TMenuItem; // "Правка": @@ -44,11 +53,8 @@ type miLine5: TMenuItem; miToFore: TMenuItem; miToBack: TMenuItem; - // "Инструменты": - miMenuTools: TMenuItem; - miSnapToGrid: TMenuItem; - miMiniMap: TMenuItem; - miSwitchGrid: TMenuItem; + // View menu: + miMenuView: TMenuItem; miShowEdges: TMenuItem; miLayers: TMenuItem; miLayer1: TMenuItem; @@ -60,22 +66,29 @@ type miLayer7: TMenuItem; miLayer8: TMenuItem; miLayer9: TMenuItem; + miViewLine1: TMenuItem; + miMiniMap: TMenuItem; + miViewLine2: TMenuItem; + miMapPreview: TMenuItem; + miSnapToGrid: TMenuItem; + miSwitchGrid: TMenuItem; + miLine6: TMenuItem; + miOptions: TMenuItem; + miMapOptions: TMenuItem; // "Сервис": miMenuService: TMenuItem; miCheckMap: TMenuItem; miOptimmization: TMenuItem; - miMapPreview: TMenuItem; miTestMap: TMenuItem; - // "Настройка": - miMenuSettings: TMenuItem; - miMapOptions: TMenuItem; - miLine6: TMenuItem; - miOptions: TMenuItem; + // Window menu: + miMenuWindow: TMenuItem; + miMacMinimize: TMenuItem; + miMacZoom: TMenuItem; // "Справка": miMenuHelp: TMenuItem; miAbout: TMenuItem; // Скрытый пункт меню для Ctrl+Tab: - miHidden1: TMenuItem; + miMenuHidden: TMenuItem; minexttab: TMenuItem; // Панель инструментов: @@ -83,6 +96,10 @@ type pbLoad: TProgressBar; pLoadProgress: TPanel; RenderPanel: TOpenGLControl; + Separator1: TMenuItem; + miMacRecentEnd: TMenuItem; + miWinRecentStart: TMenuItem; + Separator2: TMenuItem; tbNewMap: TToolButton; tbOpenMap: TToolButton; tbSaveMap: TToolButton; @@ -204,9 +221,13 @@ type procedure FormDropFiles(Sender: TObject; const FileNames: array of String); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure FormResize(Sender: TObject); + procedure FormWindowStateChange(Sender: TObject); + procedure miMacRecentClearClick(Sender: TObject); + procedure miMacZoomClick(Sender: TObject); procedure lbTextureListClick(Sender: TObject); procedure lbTextureListDrawItem(Control: TWinControl; Index: Integer; ARect: TRect; State: TOwnerDrawState); + procedure miMacMinimizeClick(Sender: TObject); procedure miReopenMapClick(Sender: TObject); procedure RenderPanelMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure RenderPanelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); @@ -240,7 +261,6 @@ type procedure miSaveMiniMapClick(Sender: TObject); procedure bClearTextureClick(Sender: TObject); procedure miPackMapClick(Sender: TObject); - procedure aRecentFileExecute(Sender: TObject); procedure miTestMapClick(Sender: TObject); procedure sbVerticalScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); @@ -259,6 +279,7 @@ type private procedure Draw(); procedure OnIdle(Sender: TObject; var Done: Boolean); + procedure RefillRecentMenu (menu: TMenuItem; start: Integer; fmt: AnsiString); public procedure RefreshRecentMenu(); procedure OpenMapFile(FileName: String); @@ -2238,6 +2259,7 @@ procedure SwitchMap(); begin ShowMap := not ShowMap; MainForm.tbShowMap.Down := ShowMap; + MainForm.miMiniMap.Checked := ShowMap; end; procedure ShowEdges(); @@ -2246,6 +2268,7 @@ begin drEdge[3] := 255 else drEdge[3] := gAlphaEdge; + MainForm.miShowEdges.Checked := drEdge[3] <> 255; end; function SelectedTexture(): String; @@ -2543,60 +2566,105 @@ end; //Закончились вспомогательные процедуры //---------------------------------------- -procedure TMainForm.RefreshRecentMenu(); -var - i: Integer; - MI: TMenuItem; +type + TRecentHandler = class + private + FForm: TMainForm; + FPath: String; + public + constructor Create (form: TMainForm; path: String); + procedure Execute (Sender: TObject); + end; + +constructor TRecentHandler.Create (form: TMainForm; path: String); begin -// Лишние запомненные карты: - while RecentFiles.Count > RecentCount do - RecentFiles.Delete(RecentFiles.Count-1); + Assert(form <> nil); + FForm := form; + FPath := path; +end; + +procedure TRecentHandler.Execute (Sender: TObject); + var fn: AnsiString; +begin + fn := g_ExtractWadName(FPath); + if FileExists(fn) then + OpenMap(fn, g_ExtractFilePathName(FPath)) + else + Application.MessageBox('', 'File not available anymore', MB_OK); +// if Application.MessageBox(PChar(_lc[I_MSG_DEL_RECENT_PROMT]), PChar(_lc[I_MSG_DEL_RECENT]), MB_ICONQUESTION or MB_YESNO) = idYes then +// begin +// RecentFiles.Delete(n); +// RefreshRecentMenu(); +// end; +end; -// Лишние строки меню: - while MainMenu.Items[0].Count > RECENT_FILES_MENU_START do - MainMenu.Items[0].Delete(MainMenu.Items[0].Count-1); +procedure TMainForm.RefillRecentMenu (menu: TMenuItem; start: Integer; fmt: AnsiString); + var i: Integer; MI: TMenuItem; cb: TMethod; h: TRecentHandler; s: AnsiString; +begin + Assert(menu <> nil); + Assert(start >= 0); + Assert(start <= menu.Count); -// Отделение списка карт от строки "Выход": - if RecentFiles.Count > 0 then + // clear all recent entries from menu + i := start; + while i < menu.Count do begin - MI := TMenuItem.Create(MainMenu.Items[0]); - MI.Caption := '-'; - MainMenu.Items[0].Add(MI); + MI := menu.Items[i]; + cb := TMethod(MI.OnClick); + if cb.Code = @TRecentHandler.Execute then + begin + // this is recent menu entry + // remove it and free callback handler + h := TRecentHandler(cb.Data); + menu.Delete(i); + MI.Free(); + h.Free(); + end + else + Inc(i); end; -// Добавление в меню списка запомненных карт: - for i := 0 to RecentFiles.Count-1 do + // fill with a new ones + for i := 0 to RecentFiles.Count - 1 do begin - MI := TMenuItem.Create(MainMenu.Items[0]); - MI.Caption := IntToStr(i+1) + ' ' + RecentFiles[i]; - MI.OnClick := aRecentFileExecute; - MainMenu.Items[0].Add(MI); + s := RecentFiles[i]; + h := TRecentHandler.Create(self, s); + MI := TMenuItem.Create(menu); + MI.Caption := Format(fmt, [i + 1, g_ExtractWadNameNoPath(s), g_ExtractFilePathName(s)]); + MI.OnClick := h.Execute; + menu.Insert(start + i, MI); end; end; -procedure TMainForm.aRecentFileExecute(Sender: TObject); -var - n: Integer; - fn, s: String; -begin - s := LowerCase((Sender as TMenuItem).Caption); - Delete(s, Pos('&', s), 1); - s := Trim(Copy(s, 1, 2)); - n := StrToIntDef(s, 0) - 1; - if (n >= 0) and (n <= RecentFiles.Count) then +procedure TMainForm.RefreshRecentMenu(); + var start: Integer; +begin + while RecentFiles.Count > RecentCount do + RecentFiles.Delete(RecentFiles.Count - 1); + + if miMacRecentSubMenu.Visible then begin - fn := g_ExtractWadName(RecentFiles[n]); - if FileExists(fn) then - begin - s := g_ExtractFilePathName(RecentFiles[n]); - OpenMap(fn, s) - end - else if Application.MessageBox(PChar(_lc[I_MSG_DEL_RECENT_PROMT]), PChar(_lc[I_MSG_DEL_RECENT]), MB_ICONQUESTION or MB_YESNO) = idYes then - begin - RecentFiles.Delete(n); - RefreshRecentMenu(); - end - end + // Reconstruct OSX-like recent list + RefillRecentMenu(miMacRecentSubMenu, 0, '%1:s - %2:s'); + miMacRecentEnd.Enabled := RecentFiles.Count <> 0; + miMacRecentEnd.Visible := RecentFiles.Count <> 0; + end; + + if miWinRecentStart.Visible then + begin + // Reconstruct Windows-like recent list + start := miMenuFile.IndexOf(miWinRecent); + if start < 0 then start := miMenuFile.Count else start := start + 1; + RefillRecentMenu(miMenuFile, start, '%0:d %1:s:%2:s'); + miWinRecent.Enabled := False; + miWinRecent.Visible := RecentFiles.Count = 0; + end; +end; + +procedure TMainForm.miMacRecentClearClick(Sender: TObject); +begin + RecentFiles.Clear(); + RefreshRecentMenu(); end; procedure TMainForm.aEditorOptionsExecute(Sender: TObject); @@ -2645,6 +2713,65 @@ var begin Randomize(); + {$IFDEF DARWIN} + miApple.Enabled := True; + miApple.Visible := True; + miMacRecentSubMenu.Enabled := True; + miMacRecentSubMenu.Visible := True; + miWinRecentStart.Enabled := False; + miWinRecentStart.Visible := False; + miWinRecent.Enabled := False; + miWinRecent.Visible := False; + miLine2.Enabled := False; + miLine2.Visible := False; + miExit.Enabled := False; + miExit.Visible := False; + miOptions.Enabled := False; + miOptions.Visible := False; + miMenuWindow.Enabled := True; + miMenuWindow.Visible := True; + miAbout.Enabled := False; + miAbout.Visible := False; + {$ELSE} + miApple.Enabled := False; + miApple.Visible := False; + miMacRecentSubMenu.Enabled := False; + miMacRecentSubMenu.Visible := False; + miWinRecentStart.Enabled := True; + miWinRecentStart.Visible := True; + miWinRecent.Enabled := True; + miWinRecent.Visible := True; + miLine2.Enabled := True; + miLine2.Visible := True; + miExit.Enabled := True; + miExit.Visible := True; + miOptions.Enabled := True; + miOptions.Visible := True; + miMenuWindow.Enabled := False; + miMenuWindow.Visible := False; + miAbout.Enabled := True; + miAbout.Visible := True; + {$ENDIF} + + miNewMap.ShortCut := ShortCut(VK_N, [ssModifier]); + miOpenMap.ShortCut := ShortCut(VK_O, [ssModifier]); + miSaveMap.ShortCut := ShortCut(VK_S, [ssModifier]); + {$IFDEF DARWIN} + miSaveMapAs.ShortCut := ShortCut(VK_S, [ssModifier, ssShift]); + miReopenMap.ShortCut := ShortCut(VK_F5, [ssModifier]); + {$ENDIF} + miUndo.ShortCut := ShortCut(VK_Z, [ssModifier]); + miCopy.ShortCut := ShortCut(VK_C, [ssModifier]); + miCut.ShortCut := ShortCut(VK_X, [ssModifier]); + miPaste.ShortCut := ShortCut(VK_V, [ssModifier]); + miSelectAll.ShortCut := ShortCut(VK_A, [ssModifier]); + miToFore.ShortCut := ShortCut(VK_LCL_CLOSE_BRACKET, [ssModifier]); + miToBack.ShortCut := ShortCut(VK_LCL_OPEN_BRACKET, [ssModifier]); + {$IFDEF DARWIN} + miMapOptions.Shortcut := ShortCut(VK_P, [ssModifier, ssAlt]); + selectall1.Shortcut := ShortCut(VK_A, [ssModifier, ssAlt]); + {$ENDIF} + e_WriteLog('Doom 2D: Forever Editor version ' + EDITOR_VERSION, MSG_NOTIFY); e_WriteLog('Build date: ' + EDITOR_BUILDDATE + ' ' + EDITOR_BUILDTIME, MSG_NOTIFY); e_WriteLog('Build hash: ' + g_GetBuildHash(), MSG_NOTIFY); @@ -2759,7 +2886,11 @@ begin RecentFiles := TStringList.Create(); for i := 0 to RecentCount-1 do begin - s := config.ReadStr('RecentFiles', IntToStr(i+1), ''); + {$IFDEF WINDOWS} + s := config.ReadStr('RecentFilesWin', IntToStr(i), ''); + {$ELSE} + s := config.ReadStr('RecentFilesUnix', IntToStr(i), ''); + {$ENDIF} if s <> '' then RecentFiles.Add(s); end; @@ -3122,6 +3253,24 @@ begin MapOffset.Y := -sbVertical.Position; end; +procedure TMainForm.FormWindowStateChange(Sender: TObject); + {$IFDEF DARWIN} + var e: Boolean; + {$ENDIF} +begin + {$IFDEF DARWIN} + // deactivate all menus when main window minimized + e := self.WindowState <> wsMinimized; + miMenuFile.Enabled := e; + miMenuEdit.Enabled := e; + miMenuView.Enabled := e; + miMenuService.Enabled := e; + miMenuWindow.Enabled := e; + miMenuHelp.Enabled := e; + miMenuHidden.Enabled := e; + {$ENDIF} +end; + procedure SelectNextObject(X, Y: Integer; ObjectType: Byte; ID: DWORD); var j, j_max: Integer; @@ -4249,6 +4398,7 @@ end; procedure TMainForm.FormDestroy(Sender: TObject); var config: TConfig; + s: AnsiString; i: Integer; begin config := TConfig.CreateFile(CfgFileName); @@ -4283,11 +4433,15 @@ begin config.WriteInt('Editor', 'MonsterRectAlpha', gAlphaMonsterRect); config.WriteInt('Editor', 'AreaRectAlpha', gAlphaAreaRect); - for i := 0 to RecentCount-1 do - if i < RecentFiles.Count then - config.WriteStr('RecentFiles', IntToStr(i+1), RecentFiles[i]) - else - config.WriteStr('RecentFiles', IntToStr(i+1), ''); + for i := 0 to RecentCount - 1 do + begin + if i < RecentFiles.Count then s := RecentFiles[i] else s := ''; + {$IFDEF WINDOWS} + config.WriteStr('RecentFilesWin', IntToStr(i), s); + {$ELSE} + config.WriteStr('RecentFilesUnix', IntToStr(i), s); + {$ENDIF} + end; RecentFiles.Free(); config.SaveFile(CfgFileName); @@ -4746,6 +4900,21 @@ begin end; end; +procedure TMainForm.miMacMinimizeClick(Sender: TObject); +begin + self.WindowState := wsMinimized; + self.FormWindowStateChange(Sender); +end; + +procedure TMainForm.miMacZoomClick(Sender: TObject); +begin + if self.WindowState = wsMaximized then + self.WindowState := wsNormal + else + self.WindowState := wsMaximized; + self.FormWindowStateChange(Sender); +end; + procedure TMainForm.miReopenMapClick(Sender: TObject); var FileName, Resource: String; diff --git a/src/editor/g_language.pas b/src/editor/g_language.pas index 029ef18..4d3ae7e 100644 --- a/src/editor/g_language.pas +++ b/src/editor/g_language.pas @@ -1313,24 +1313,24 @@ Const ('MENU FILE', 'File', 'Файл'), - ('MENU FILE NEW', 'New Map', - 'Новая карта'), - ('MENU FILE OPEN', 'Open Map', - 'Открыть карту'), - ('MENU FILE SAVE', 'Save Map', - 'Сохранить карту'), - ('MENU FILE SAVE AS', 'Save Map As...', - 'Сохранить карту как...'), - ('MENU FILE OPEN WAD', 'Select Map', - 'Выбрать карту'), - ('MENU FILE REOPEN', 'Reopen Map', + ('MENU FILE NEW', 'New', + 'Создать'), + ('MENU FILE OPEN', 'Open...', + 'Открыть...'), + ('MENU FILE SAVE', 'Save', + 'Сохранить'), + ('MENU FILE SAVE AS', 'Save As...', + 'Сохранить как...'), + ('MENU FILE OPEN WAD', 'Select Map...', + 'Выбрать карту...'), + ('MENU FILE REOPEN', 'Revert to Saved', 'Открыть заново'), - ('MENU FILE SAVE MINI', 'Save Mini-map', - 'Сохранить мини-карту'), - ('MENU FILE DELETE', 'Delete Map from WAD...', - 'Удалить карту из WAD...'), - ('MENU FILE PACK MAP', 'Pack Map', - 'Упаковать карту'), + ('MENU FILE SAVE MINI', 'Save Minimap...', + 'Сохранить мини-карту...'), + ('MENU FILE DELETE', 'Delete from WAD...', + 'Удалить из WAD...'), + ('MENU FILE PACK MAP', 'Pack to WAD...', + 'Упаковать в WAD...'), ('MENU FILE EXIT', 'Exit', 'Выход'), @@ -1355,32 +1355,32 @@ Const 'Инструменты'), ('MENU TOOLS SNAP GRID', 'Snap to Grid', 'Привязка к сетке'), - ('MENU TOOLS MINIMAP', 'Show Mini-map', - 'Мини-карта'), - ('MENU TOOLS STEP GRID', 'Switch Grid step', - 'Сменить шаг сетки'), - ('MENU TOOLS SHOW EDGES', 'Switch Map edges', - 'Границы карты'), + ('MENU TOOLS MINIMAP', 'Show Minimap', + 'Показать Мини-карту'), + ('MENU TOOLS STEP GRID', 'Switch Grid Granularity', + 'Переключить шаг сетки'), + ('MENU TOOLS SHOW EDGES', 'Show Map Bounds', + 'Показывать границы карты'), ('MENU TOOLS LAYERS', 'Layers', 'Слои'), ('MENU SERV', 'Service', 'Сервис'), - ('MENU SERV TEST', 'Check the Map', - 'Проверка карты'), - ('MENU SERV OPT', 'Optimize the Map', - 'Оптимизация карты'), - ('MENU SERV PREVIEW', 'Map Preview', + ('MENU SERV TEST', 'Analyse Map...', + 'Проверка карты...'), + ('MENU SERV OPT', 'Optimize Map...', + 'Оптимизация карты...'), + ('MENU SERV PREVIEW', 'Preview Mode', 'Предварительный просмотр'), - ('MENU SERV LAUNCH', 'In-game test', + ('MENU SERV LAUNCH', 'Run Test', 'Тест карты в игре'), ('MENU SETS', 'Settings', 'Настройка'), - ('MENU SETS MAP', 'Map parameters', - 'Параметры карты'), - ('MENU SETS EDITOR', 'Editor settings', - 'Настройки редактора'), + ('MENU SETS MAP', 'Map Properties...', + 'Свойства карты...'), + ('MENU SETS EDITOR', 'Preferences...', + 'Настройки...'), ('MENU SETS LAUNCH', 'In-game test settings', 'Настройки теста в игре'), @@ -1424,7 +1424,7 @@ Const 'Включить/Отключить отображение сетки'), ('MENU TB GRID STEP', 'Switch Grid step', 'Изменить шаг сетки'), - ('MENU TB LAUNCH', 'In-game test', + ('MENU TB LAUNCH', 'Run Test', 'Тест карты в игре'), ('MENU LAUNCH SETS', 'Settings...', @@ -1448,21 +1448,21 @@ Const 'Выберите текстуру'), ('CAP KEYS', 'Keys', 'Ключи'), - ('CAP TEST', 'Map Checking', + ('CAP TEST', 'Analyse Map', 'Проверка карты'), - ('CAP OPT', 'Map Optimization', + ('CAP OPT', 'Optimize Map', 'Оптимизация карты'), - ('CAP SETS', 'Map Parameters', - 'Параметры карты'), + ('CAP SETS', 'Map Properties', + 'Свойства карты'), ('CAP LAUNCH', 'In-game test Settings', 'Настройки теста в игре'), - ('CAP ES', 'Editor Settings', + ('CAP ES', 'Editor Preferences', 'Настройки редактора'), ('CAP PACK', 'Pack Map', 'Упаковать карту'), ('CAP SAVE', 'Save Map', 'Сохранить карту'), - ('CAP MINI', 'Save Mini-map', + ('CAP MINI', 'Save Minimap', 'Сохранить мини-карту'), ('CAP SELECT', 'Select Map', 'Выберите карту'), @@ -2096,7 +2096,6 @@ begin miToFore.Caption := _lc[I_MENU_EDIT_TO_FORE]; miToBack.Caption := _lc[I_MENU_EDIT_TO_BACK]; // "Инструменты": - miMenuTools.Caption := _lc[I_MENU_TOOLS]; miSnapToGrid.Caption := _lc[I_MENU_TOOLS_SNAP_GRID]; miMiniMap.Caption := _lc[I_MENU_TOOLS_MINIMAP]; miSwitchGrid.Caption := _lc[I_MENU_TOOLS_STEP_GRID]; @@ -2111,16 +2110,14 @@ begin miLayer7.Caption := _lc[I_MENU_LAYER_MONSTER]; miLayer8.Caption := _lc[I_MENU_LAYER_AREA]; miLayer9.Caption := _lc[I_MENU_LAYER_TRIGGER]; + miMapOptions.Caption := _lc[I_MENU_SETS_MAP]; + miOptions.Caption := _lc[I_MENU_SETS_EDITOR]; // "Сервис": miMenuService.Caption := _lc[I_MENU_SERV]; miCheckMap.Caption := _lc[I_MENU_SERV_TEST]; miOptimmization.Caption := _lc[I_MENU_SERV_OPT]; miMapPreview.Caption := _lc[I_MENU_SERV_PREVIEW]; miTestMap.Caption := _lc[I_MENU_SERV_LAUNCH]; - // "Настройка": - miMenuSettings.Caption := _lc[I_MENU_SETS]; - miMapOptions.Caption := _lc[I_MENU_SETS_MAP]; - miOptions.Caption := _lc[I_MENU_SETS_EDITOR]; // "Справка": miMenuHelp.Caption := _lc[I_MENU_HELP]; miAbout.Caption := _lc[I_MENU_HELP_ABOUT]; -- 2.29.2