mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-22 07:41:02 +02:00
Merge branch 'IDE/PropEdit/Strings/LoadFromFile' into 'main'
IDE: Ability to load text from file for the "TStrings" property editor See merge request freepascal.org/lazarus/lazarus!519
This commit is contained in:
commit
f826f69769
@ -795,6 +795,10 @@ msgstr "D'ac&ord"
|
||||
msgid "Ok"
|
||||
msgstr "D'Acord"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Opcions"
|
||||
|
@ -769,6 +769,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Nastavení"
|
||||
|
@ -765,6 +765,10 @@ msgstr "&Ok"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Optionen"
|
||||
|
@ -770,6 +770,10 @@ msgstr "&Aceptar"
|
||||
msgid "Ok"
|
||||
msgstr "Aceptar"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Opciones"
|
||||
|
@ -768,6 +768,10 @@ msgstr ""
|
||||
msgid "Ok"
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Valinnat"
|
||||
|
@ -765,6 +765,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Options"
|
||||
|
@ -795,6 +795,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "אפשרויות"
|
||||
|
@ -768,6 +768,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Beállítások"
|
||||
|
@ -797,6 +797,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Opsi"
|
||||
|
@ -771,6 +771,10 @@ msgstr "&Ok"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Opzioni"
|
||||
|
@ -774,6 +774,10 @@ msgstr "OK(&O)"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "オプション"
|
||||
|
@ -770,6 +770,10 @@ msgstr "&Tinka"
|
||||
msgid "Ok"
|
||||
msgstr "Tinka"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Parinktys"
|
||||
|
@ -791,6 +791,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Opties"
|
||||
|
@ -763,6 +763,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "OK"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Opcje"
|
||||
|
@ -755,6 +755,10 @@ msgstr ""
|
||||
msgid "Ok"
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr ""
|
||||
|
@ -764,6 +764,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Opções"
|
||||
|
@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2025-07-01 17:58+0300\n"
|
||||
"PO-Revision-Date: 2025-07-04 22:36+0300\n"
|
||||
"Last-Translator: Maxim Ganetsky <maxkill@mail.ru>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: ru\n"
|
||||
@ -764,6 +764,10 @@ msgstr "&ОК"
|
||||
msgid "Ok"
|
||||
msgstr "ОК"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr "Можно открыть только один файл."
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Параметры"
|
||||
|
@ -773,6 +773,10 @@ msgstr "&OK"
|
||||
msgid "Ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Možnosti"
|
||||
|
@ -768,6 +768,10 @@ msgstr "&TAMAM"
|
||||
msgid "Ok"
|
||||
msgstr "Tamam"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Seçenekler"
|
||||
|
@ -767,6 +767,10 @@ msgstr "&Гаразд"
|
||||
msgid "Ok"
|
||||
msgstr "Гаразд"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "Параметри"
|
||||
|
@ -765,6 +765,10 @@ msgstr "确定(&O)"
|
||||
msgid "Ok"
|
||||
msgstr "确定"
|
||||
|
||||
#: objinspstrconsts.oisonlyonefile
|
||||
msgid "Only one file can be opened."
|
||||
msgstr ""
|
||||
|
||||
#: objinspstrconsts.oisoptions
|
||||
msgid "Options"
|
||||
msgstr "选项"
|
||||
|
@ -396,6 +396,7 @@ resourcestring
|
||||
ois1LineDChars = '1 line, %d chars';
|
||||
oisStringsEditorDialog = 'Strings Editor Dialog';
|
||||
ois0Lines0Chars = '0 lines, 0 chars';
|
||||
oisOnlyOneFile = 'Only one file can be opened.';
|
||||
oisInvalidPropertyValue = 'Invalid property value';
|
||||
oisInfinityNotSupported = 'Setting a floating point property to positive or negative Infinity at design time is not supported';
|
||||
oisNaNNotSupported = 'Setting a floating point property to NaN at design time is not supported';
|
||||
|
@ -4,6 +4,7 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
|
||||
Top = 359
|
||||
Width = 400
|
||||
ActiveControl = Memo
|
||||
AllowDropFiles = True
|
||||
Caption = 'StringsPropEditorFrm'
|
||||
ClientHeight = 302
|
||||
ClientWidth = 400
|
||||
@ -13,6 +14,7 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnDropFiles = FormDropFiles
|
||||
OnKeyDown = FormKeyDown
|
||||
object TextGroupBox: TGroupBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
@ -97,15 +99,38 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 305
|
||||
Height = 32
|
||||
Hint = '[Ctrl+S]'
|
||||
Top = 82
|
||||
Width = 75
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Save'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 3
|
||||
OnClick = SaveButtonClick
|
||||
end
|
||||
object LoadButton: TButton
|
||||
AnchorSideLeft.Control = SortButton
|
||||
AnchorSideTop.Control = SaveButton
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = SortButton
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 303
|
||||
Height = 23
|
||||
Hint = '[Ctrl+O]'
|
||||
Top = 93
|
||||
Width = 75
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Load'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 4
|
||||
OnClick = LoadButtonClick
|
||||
end
|
||||
end
|
||||
object BtnPanel: TButtonPanel
|
||||
Left = 6
|
||||
@ -131,7 +156,12 @@ object StringsPropEditorFrm: TStringsPropEditorFrm
|
||||
object SaveDialog1: TSaveDialog
|
||||
DefaultExt = '.txt'
|
||||
Options = [ofOverwritePrompt, ofEnableSizing, ofViewDetail]
|
||||
Left = 183
|
||||
Top = 148
|
||||
Left = 224
|
||||
Top = 80
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
||||
Left = 224
|
||||
Top = 136
|
||||
end
|
||||
end
|
||||
|
@ -32,7 +32,9 @@ type
|
||||
BtnPanel: TButtonPanel;
|
||||
ClearButton: TButton;
|
||||
SaveButton: TButton;
|
||||
LoadButton: TButton;
|
||||
SaveDialog1: TSaveDialog;
|
||||
OpenDialog1: TOpenDialog;
|
||||
StatusLabel: TLabel;
|
||||
SortButton: TButton;
|
||||
TextGroupBox: TGroupBox;
|
||||
@ -40,9 +42,11 @@ type
|
||||
procedure ClearButtonClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
|
||||
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure MemoChange(Sender: TObject);
|
||||
procedure SaveButtonClick(Sender: TObject);
|
||||
procedure LoadButtonClick(Sender: TObject);
|
||||
procedure SortButtonClick(Sender: TObject);
|
||||
public
|
||||
procedure AddButtons; virtual;
|
||||
@ -62,16 +66,29 @@ begin
|
||||
SortButton.Caption := oisSort;
|
||||
ClearButton.Caption := oisClear;
|
||||
SaveButton.Caption := oisSave;
|
||||
LoadButton.Caption := oisLoad;
|
||||
AddButtons;
|
||||
IDEDialogLayoutList.ApplyLayout(Self);
|
||||
end;
|
||||
|
||||
procedure TStringsPropEditorFrm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
// dialog
|
||||
if (Key = VK_RETURN) and (Shift = [ssCtrl]) then
|
||||
begin
|
||||
ModalResult := mrOK;
|
||||
Key := 0;
|
||||
end
|
||||
// save and load
|
||||
else if (Key = VK_S) and (Shift = [ssCtrl]) then
|
||||
begin
|
||||
SaveButtonClick(Sender);
|
||||
Key := 0;
|
||||
end
|
||||
else if (Key = VK_O) and (Shift = [ssCtrl]) then
|
||||
begin
|
||||
LoadButtonClick(Sender);
|
||||
Key := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -107,6 +124,24 @@ begin
|
||||
Memo.Lines.SaveToFile(SaveDialog1.FileName);
|
||||
end;
|
||||
|
||||
procedure TStringsPropEditorFrm.LoadButtonClick(Sender: TObject);
|
||||
begin
|
||||
OpenDialog1.Title:=sccsSGEdtOpenDialog;
|
||||
if OpenDialog1.Execute then
|
||||
Memo.Lines.LoadFromFile(OpenDialog1.FileName);
|
||||
end;
|
||||
|
||||
procedure TStringsPropEditorFrm.FormDropFiles(Sender: TObject; const FileNames: array of string);
|
||||
begin
|
||||
if length(FileNames) <> 1 then
|
||||
begin
|
||||
MessageDlg(oisError, oisOnlyOneFile, mtError, [mbOK], 0);
|
||||
exit;
|
||||
end;
|
||||
|
||||
Memo.Lines.LoadFromFile(FileNames[0]);
|
||||
end;
|
||||
|
||||
procedure TStringsPropEditorFrm.SortButtonClick(Sender: TObject);
|
||||
var
|
||||
OldText, NewSortedText: String;
|
||||
|
Loading…
Reference in New Issue
Block a user