RxFPC: work om editor for RxTextHolder

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6714 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2018-11-06 13:59:28 +00:00
parent 5abe55ccdd
commit 83346b3a99
8 changed files with 53 additions and 16 deletions

View File

@ -12,7 +12,7 @@
</SearchPaths>
</CompilerOptions>
<License Value="LGPL 2"/>
<Version Release="1" Build="1"/>
<Version Release="1" Build="2"/>
<Files Count="2">
<Item1>
<Filename Value="dcl_rxtools/register_rxtools.pas"/>

View File

@ -42,9 +42,6 @@ implementation
uses LazarusPackageIntf, RxTextHolder, ComponentEditors, RxTextHolder_Editor,
rxconst;
const
sRxToolsPage = 'RX Tools';
type
{ TRxTextHolderEditor }

View File

@ -36,7 +36,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ButtonPanel, ExtCtrls,
StdCtrls, Menus, Buttons, ActnList, ListFilterEdit, RxTextHolder;
StdCtrls, Menus, Buttons, ActnList, RxTextHolder;
type
@ -74,7 +74,7 @@ type
procedure UpdateTextNames;
procedure Localize;
procedure UpdateCtrlState;
function MakeItemName:string;
function MakeItemName(ABaseName:string):string;
public
end;
@ -110,8 +110,14 @@ begin
end;
procedure TRxTextHolder_EditorForm.itemAddExecute(Sender: TObject);
var
S: String;
begin
FCurrentItem:=FTextHolder.Items.Add(MakeItemName);
if Assigned(FCurrentItem) then
S:=FCurrentItem.Caption
else
S:='';
FCurrentItem:=FTextHolder.Items.Add(MakeItemName(S));
ListBox1.Items.Add(FCurrentItem.Caption);
ListBox1.ItemIndex:=ListBox1.Items.Count-1;
ListBox1Click(nil);
@ -216,14 +222,31 @@ begin
Memo1.Enabled:=Assigned(FCurrentItem);
end;
function TRxTextHolder_EditorForm.MakeItemName: string;
function TRxTextHolder_EditorForm.MakeItemName(ABaseName: string): string;
var
i: Integer;
FBaseName, S: String;
begin
FBaseName:=sRxTextFolderItem;
i:=0;
if ABaseName <> '' then
begin
S:='';
for i:=Length(ABaseName) downto 1 do
if ABaseName[i] in ['0'..'9'] then
S:=ABaseName[i] + S
else
Break;
if S<>'' then
begin
i:=StrToIntDef(S, 0);
FBaseName:=Copy(ABaseName, 1, Length(ABaseName) - Length(S));
end;
end;
repeat
Inc(i);
Result:='Item '+IntToStr(i);
Result:=FBaseName+IntToStr(i);
until (FTextHolder.IndexByName(Result) = -1);
end;

View File

@ -179,6 +179,10 @@ msgstr "Anterior A?o|"
msgid "Error. Expected value for field %s."
msgstr ""
#: rxconst.srxtextfolderitem
msgid "Item "
msgstr ""
#: rxconst.srxtextholderadd
msgid "Add"
msgstr ""

View File

@ -177,6 +177,10 @@ msgstr ""
msgid "Error. Expected value for field %s."
msgstr ""
#: rxconst.srxtextfolderitem
msgid "Item "
msgstr ""
#: rxconst.srxtextholderadd
msgid "Add"
msgstr ""

View File

@ -55,7 +55,7 @@ msgstr "Закрыть все окна"
#: rxconst.sclosemessagehint
msgid "Close message"
msgstr ""
msgstr "Закрыть сообщение"
#: rxconst.sclosevaliderror
msgid "Error. Expected values..."
@ -91,7 +91,7 @@ msgstr "Источник"
#: rxconst.serrorlinkedtaskpanel
msgid "Not assigned task panel"
msgstr ""
msgstr "Не указана панель задач"
#: rxconst.sexptcontrolnotfound
msgid "Control not found in validate %s."
@ -177,6 +177,10 @@ msgstr "Превыдущий год|"
msgid "Error. Expected value for field %s."
msgstr "Поле %s. Требуется значение"
#: rxconst.srxtextfolderitem
msgid "Item "
msgstr "Строка "
#: rxconst.srxtextholderadd
msgid "Add"
msgstr "Добавить"
@ -255,23 +259,23 @@ msgstr "Прозрачно"
#: rxconst.svariableisnotboolean
msgid "Variable %s is not boolean"
msgstr ""
msgstr "Переменная %s не логического типа"
#: rxconst.svariableisnotdt
msgid "Variable %s is not date/time"
msgstr ""
msgstr "Переменная %s не дата/время"
#: rxconst.svariableisnotfloat
msgid "Variable %s is not float"
msgstr ""
msgstr "Переменная %s не число"
#: rxconst.svariableisnotinteger
msgid "Variable %s is not integer"
msgstr ""
msgstr "Переменная %s не целое число"
#: rxconst.svariableisnotstring
msgid "Variable %s is not string"
msgstr ""
msgstr "Переменная %s не строка"
#: rxconst.svisiblebuttons
msgid "Visible buttons"

View File

@ -192,6 +192,10 @@ msgstr "Попередній місяць|"
msgid "Error. Expected value for field %s."
msgstr "Поле %s. Вимагається значення"
#: rxconst.srxtextfolderitem
msgid "Item "
msgstr ""
#: rxconst.srxtextholderadd
msgid "Add"
msgstr ""

View File

@ -140,6 +140,7 @@ resourcestring
sRxTextHolderTextCaption = 'Caption';
sRxTextHolderAdd = 'Add';
sRxTextHolderRemove = 'Remove';
sRxTextFolderItem = 'Item ';
implementation