From: DeaDDooMER Date: Tue, 23 May 2023 17:41:00 +0000 (+0300) Subject: gui: replace MessageBox with Application.MessageBox (which i correctly works on osx) X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-editor.git;a=commitdiff_plain;h=2789c629b21057292614b015b9a03595bab89c2f gui: replace MessageBox with Application.MessageBox (which i correctly works on osx) --- diff --git a/src/editor/f_addresource.pas b/src/editor/f_addresource.pas index d67765e..f738384 100644 --- a/src/editor/f_addresource.pas +++ b/src/editor/f_addresource.pas @@ -87,7 +87,7 @@ procedure TAddResourceForm.bOKClick(Sender: TObject); begin if FResourceName = '' then begin - MessageBox(0, PChar(_lc[I_MSG_CHOOSE_RES]), + Application.MessageBox(PChar(_lc[I_MSG_CHOOSE_RES]), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR); Exit; end; diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 2175824..2bf10e6 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -1843,7 +1843,7 @@ end; procedure ErrorMessageBox(str: String); begin - MessageBox(0, PChar(str), PChar(_lc[I_MSG_ERROR]), + Application.MessageBox(PChar(str), PChar(_lc[I_MSG_ERROR]), MB_ICONINFORMATION or MB_OK or MB_DEFBUTTON1); end; @@ -2597,7 +2597,7 @@ begin s := g_ExtractFilePathName(RecentFiles[n]); OpenMap(fn, s) end - else if MessageBox(0, PChar(_lc[I_MSG_DEL_RECENT_PROMT]), PChar(_lc[I_MSG_DEL_RECENT]), MB_ICONQUESTION or MB_YESNO) = idYes then + 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(); @@ -4223,7 +4223,7 @@ end; procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin - CanClose := MessageBox(0, PChar(_lc[I_MSG_EXIT_PROMT]), + CanClose := Application.MessageBox(PChar(_lc[I_MSG_EXIT_PROMT]), PChar(_lc[I_MSG_EXIT]), MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON1) = idYes; @@ -4741,7 +4741,7 @@ begin if OpenedMap = '' then Exit; - if MessageBox(0, PChar(_lc[I_MSG_REOPEN_MAP_PROMT]), + if Application.MessageBox(PChar(_lc[I_MSG_REOPEN_MAP_PROMT]), PChar(_lc[I_MENU_FILE_REOPEN]), MB_ICONQUESTION or MB_YESNO) <> idYes then Exit; @@ -5371,7 +5371,7 @@ begin if i = -1 then Exit; - if MessageBox(0, PChar(Format(_lc[I_MSG_DEL_TEXTURE_PROMT], + if Application.MessageBox(PChar(Format(_lc[I_MSG_DEL_TEXTURE_PROMT], [SelectedTexture()])), PChar(_lc[I_MSG_DEL_TEXTURE]), MB_ICONQUESTION or MB_YESNO or @@ -5397,10 +5397,7 @@ end; procedure TMainForm.aNewMapExecute(Sender: TObject); begin - if (MessageBox(0, PChar(_lc[I_MSG_CLEAR_MAP_PROMT]), - PChar(_lc[I_MSG_CLEAR_MAP]), - MB_ICONQUESTION or MB_YESNO or - MB_DEFBUTTON1) = mrYes) then + if Application.MessageBox(PChar(_lc[I_MSG_CLEAR_MAP_PROMT]), PChar(_lc[I_MSG_CLEAR_MAP]), MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON1) = mrYes then FullClear(); end; @@ -6284,18 +6281,17 @@ begin Exit; MapName := SelectMapForm.lbMapList.Items[SelectMapForm.lbMapList.ItemIndex]; - if MessageBox(0, PChar(Format(_lc[I_MSG_DELETE_MAP_PROMT], [MapName, OpenDialog.FileName])), PChar(_lc[I_MSG_DELETE_MAP]), MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON2) <> mrYes then + if Application.MessageBox(PChar(Format(_lc[I_MSG_DELETE_MAP_PROMT], [MapName, OpenDialog.FileName])), PChar(_lc[I_MSG_DELETE_MAP]), MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON2) <> mrYes then Exit; g_DeleteResource(FileName, '', MapName, res); if res <> 0 then begin - MessageBox(0, PChar('Cant delete map res=' + IntToStr(res)), PChar('Map not deleted!'), MB_ICONINFORMATION or MB_OK or MB_DEFBUTTON1); + Application.MessageBox(PChar('Cant delete map res=' + IntToStr(res)), PChar('Map not deleted!'), MB_ICONINFORMATION or MB_OK or MB_DEFBUTTON1); Exit end; - MessageBox( - 0, + Application.MessageBox( PChar(Format(_lc[I_MSG_MAP_DELETED_PROMT], [MapName])), PChar(_lc[I_MSG_MAP_DELETED]), MB_ICONINFORMATION or MB_OK or MB_DEFBUTTON1 diff --git a/src/editor/f_packmap.pas b/src/editor/f_packmap.pas index 1259898..a8ad07a 100644 --- a/src/editor/f_packmap.pas +++ b/src/editor/f_packmap.pas @@ -99,8 +99,8 @@ begin end else begin - //MessageBox(0, PChar(Format(_lc[I_MSG_WAD_ERROR], [ExtractFileName(filename)])), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR); - MessageBox(0, PChar(Format(_lc[I_MSG_RES_ERROR], [filename, section, resource])), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR); + //Application.MessageBox(PChar(Format(_lc[I_MSG_WAD_ERROR], [ExtractFileName(filename)])), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR); + Application.MessageBox(PChar(Format(_lc[I_MSG_RES_ERROR], [filename, section, resource])), PChar(_lc[I_MSG_ERROR]), MB_OK + MB_ICONERROR); Result := False end end; diff --git a/src/editor/f_savemap.pas b/src/editor/f_savemap.pas index 6d9b947..c9fff9e 100644 --- a/src/editor/f_savemap.pas +++ b/src/editor/f_savemap.pas @@ -69,7 +69,7 @@ begin for a := 0 to lbMapList.Count-1 do if eMapName.Text = lbMapList.Items[a] then begin - ok := MessageBox(0, PChar(Format(_lc[I_MSG_MAP_EXISTS], + ok := Application.MessageBox(PChar(Format(_lc[I_MSG_MAP_EXISTS], [eMapName.Text])), PChar(_lc[I_MSG_SAVE_MAP]), MB_ICONQUESTION or MB_YESNO or MB_DEFBUTTON1) = mrYes;