mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 23:59:10 +02:00
localized gtk interface
git-svn-id: trunk@3906 -
This commit is contained in:
parent
b25b6d4dc1
commit
ccf7fe59e4
@ -1255,15 +1255,15 @@ begin
|
|||||||
EndPos:=CursorPos;
|
EndPos:=CursorPos;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]);
|
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]);
|
||||||
writeln('TStandardCodeTool.GetStringConstBounds A ',CleanCursorPos,' "',copy(Src,CleanCursorPos-5,5),'" | "',copy(Src,CleanCursorPos,5),'"');
|
//writeln('TStandardCodeTool.GetStringConstBounds A ',CleanCursorPos,' "',copy(Src,CleanCursorPos-5,5),'" | "',copy(Src,CleanCursorPos,5),'"');
|
||||||
GetCleanPosInfo(-1,CleanCursorPos,ResolveComments,SameArea);
|
GetCleanPosInfo(-1,CleanCursorPos,ResolveComments,SameArea);
|
||||||
writeln('TStandardCodeTool.GetStringConstBounds B ',SameArea.StartPos,'-',SameArea.EndPos,' "',copy(Src,SameArea.StartPos,SameArea.EndPos-SameArea.StartPos),'"');
|
//writeln('TStandardCodeTool.GetStringConstBounds B ',SameArea.StartPos,'-',SameArea.EndPos,' "',copy(Src,SameArea.StartPos,SameArea.EndPos-SameArea.StartPos),'"');
|
||||||
if (SameArea.EndPos=SameArea.StartPos) or (SameArea.StartPos>SrcLen) then
|
if (SameArea.EndPos=SameArea.StartPos) or (SameArea.StartPos>SrcLen) then
|
||||||
exit;
|
exit;
|
||||||
// read til end of string constant
|
// read til end of string constant
|
||||||
MoveCursorToCleanPos(SameArea.StartPos);
|
MoveCursorToCleanPos(SameArea.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
writeln('TStandardCodeTool.GetStringConstBounds read til end of string ',GetAtom);
|
//writeln('TStandardCodeTool.GetStringConstBounds read til end of string ',GetAtom);
|
||||||
CurrentToken:=GetCurrentTokenType;
|
CurrentToken:=GetCurrentTokenType;
|
||||||
if (CurrentToken=scatNone) then exit;
|
if (CurrentToken=scatNone) then exit;
|
||||||
repeat
|
repeat
|
||||||
@ -1271,10 +1271,10 @@ begin
|
|||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
LastToken:=CurrentToken;
|
LastToken:=CurrentToken;
|
||||||
CurrentToken:=GetCurrentTokenType;
|
CurrentToken:=GetCurrentTokenType;
|
||||||
writeln('TStandardCodeTool.GetStringConstBounds Read Forward: ',GetAtom,' EndCleanPos=',EndCleanPos,
|
//writeln('TStandardCodeTool.GetStringConstBounds Read Forward: ',GetAtom,' EndCleanPos=',EndCleanPos,
|
||||||
' LastToken=',StrConstTokenTypeName[LastToken],
|
//' LastToken=',StrConstTokenTypeName[LastToken],
|
||||||
' CurrentToken=',StrConstTokenTypeName[CurrentToken],
|
//' CurrentToken=',StrConstTokenTypeName[CurrentToken],
|
||||||
' ',StrConstTokenTypeName[GetCurrentTokenType]);
|
//' ',StrConstTokenTypeName[GetCurrentTokenType]);
|
||||||
case CurrentToken of
|
case CurrentToken of
|
||||||
scatNone, scatEdgedBracketClose, scatRoundBracketClose:
|
scatNone, scatEdgedBracketClose, scatRoundBracketClose:
|
||||||
if not (LastToken in [scatStrConst,scatIdent,scatUp,
|
if not (LastToken in [scatStrConst,scatIdent,scatUp,
|
||||||
@ -1314,12 +1314,12 @@ begin
|
|||||||
// read til start of string constant
|
// read til start of string constant
|
||||||
MoveCursorToCleanPos(SameArea.StartPos);
|
MoveCursorToCleanPos(SameArea.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
writeln('TStandardCodeTool.GetStringConstBounds Read til start of string ',GetAtom);
|
//writeln('TStandardCodeTool.GetStringConstBounds Read til start of string ',GetAtom);
|
||||||
CurrentToken:=GetCurrentTokenType;
|
CurrentToken:=GetCurrentTokenType;
|
||||||
repeat
|
repeat
|
||||||
StartCleanPos:=CurPos.StartPos;
|
StartCleanPos:=CurPos.StartPos;
|
||||||
ReadPriorAtom;
|
ReadPriorAtom;
|
||||||
writeln('TStandardCodeTool.GetStringConstBounds Read backward: ',GetAtom,' StartCleanPos=',StartCleanPos);
|
//writeln('TStandardCodeTool.GetStringConstBounds Read backward: ',GetAtom,' StartCleanPos=',StartCleanPos);
|
||||||
LastToken:=CurrentToken;
|
LastToken:=CurrentToken;
|
||||||
CurrentToken:=GetCurrentTokenType;
|
CurrentToken:=GetCurrentTokenType;
|
||||||
case CurrentToken of
|
case CurrentToken of
|
||||||
@ -1358,7 +1358,7 @@ begin
|
|||||||
until false;
|
until false;
|
||||||
|
|
||||||
// convert start and end position
|
// convert start and end position
|
||||||
writeln('TStandardCodeTool.GetStringConstBounds END "',copy(Src,StartCleanPos,EndCleanPos-StartCleanPos),'"');
|
//writeln('TStandardCodeTool.GetStringConstBounds END "',copy(Src,StartCleanPos,EndCleanPos-StartCleanPos),'"');
|
||||||
if not CleanPosToCaret(StartCleanPos,StartPos) then exit;
|
if not CleanPosToCaret(StartCleanPos,StartPos) then exit;
|
||||||
if not CleanPosToCaret(EndCleanPos,EndPos) then exit;
|
if not CleanPosToCaret(EndCleanPos,EndPos) then exit;
|
||||||
|
|
||||||
@ -1398,7 +1398,7 @@ function TStandardCodeTool.GatherResourceStringSections(
|
|||||||
if ANode.Desc=ctnResStrSection then begin
|
if ANode.Desc=ctnResStrSection then begin
|
||||||
if not NewCodeTool.CleanPosToCaret(ANode.StartPos,NewCaret) then
|
if not NewCodeTool.CleanPosToCaret(ANode.StartPos,NewCaret) then
|
||||||
break;
|
break;
|
||||||
writeln('TStandardCodeTool.GatherResourceStringSections Found Other ',NewCodeTool.MainFilename,' Y=',NewCaret.Y);
|
//writeln('TStandardCodeTool.GatherResourceStringSections Found Other ',NewCodeTool.MainFilename,' Y=',NewCaret.Y);
|
||||||
PositionList.Add(NewCaret);
|
PositionList.Add(NewCaret);
|
||||||
end;
|
end;
|
||||||
ANode:=ANode.PriorBrother;
|
ANode:=ANode.PriorBrother;
|
||||||
@ -1419,7 +1419,7 @@ var
|
|||||||
ANode: TCodeTreeNode;
|
ANode: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
writeln('TStandardCodeTool.GatherResourceStringSections A ');
|
//writeln('TStandardCodeTool.GatherResourceStringSections A ');
|
||||||
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]);
|
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]);
|
||||||
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
|
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
|
||||||
PositionList.Clear;
|
PositionList.Clear;
|
||||||
@ -1430,7 +1430,7 @@ begin
|
|||||||
ctnResStrSection:
|
ctnResStrSection:
|
||||||
begin
|
begin
|
||||||
if not CleanPosToCaret(ANode.StartPos,NewCaret) then exit;
|
if not CleanPosToCaret(ANode.StartPos,NewCaret) then exit;
|
||||||
writeln('TStandardCodeTool.GatherResourceStringSections Found Same Y=',NewCaret.Y);
|
//writeln('TStandardCodeTool.GatherResourceStringSections Found Same Y=',NewCaret.Y);
|
||||||
PositionList.Add(NewCaret);
|
PositionList.Add(NewCaret);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -111,6 +111,10 @@ type
|
|||||||
const NewStartPos, NewEndPos: TPoint);
|
const NewStartPos, NewEndPos: TPoint);
|
||||||
function ResourceStringExists(const Identifier: string): boolean;
|
function ResourceStringExists(const Identifier: string): boolean;
|
||||||
procedure GetNewSource(var NewSource, ResourceStringValue: string);
|
procedure GetNewSource(var NewSource, ResourceStringValue: string);
|
||||||
|
procedure Init;
|
||||||
|
procedure SaveHistories;
|
||||||
|
procedure SaveIdentPrefixes;
|
||||||
|
procedure SaveIdentLengths;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ShowMakeResStrDialog(
|
function ShowMakeResStrDialog(
|
||||||
@ -142,34 +146,21 @@ var
|
|||||||
ResourcestringSectionID: Integer;
|
ResourcestringSectionID: Integer;
|
||||||
begin
|
begin
|
||||||
MakeResStrDialog:=TMakeResStrDialog.Create(Application);
|
MakeResStrDialog:=TMakeResStrDialog.Create(Application);
|
||||||
|
MakeResStrDialog.Positions:=CodeToolBoss.Positions;
|
||||||
MakeResStrDialog.SetSource(Code,StartPos,EndPos);
|
MakeResStrDialog.SetSource(Code,StartPos,EndPos);
|
||||||
// string constant
|
MakeResStrDialog.Init;
|
||||||
MakeResStrDialog.StringConstSynEdit.Text:=Code.GetLines(StartPos.Y,EndPos.Y);
|
|
||||||
// reachable resourcestring sections
|
|
||||||
MakeResStrDialog.FillResourceStringSections(Positions);
|
|
||||||
// identifier prefixes
|
|
||||||
MakeResStrDialog.FillIdentPrefixes;
|
|
||||||
// identifier lengths
|
|
||||||
MakeResStrDialog.FillIdentLengths;
|
|
||||||
// identifier
|
|
||||||
MakeResStrDialog.CustomIdentifierCheckBox.Checked:=false;
|
|
||||||
CodeToolBoss.CreateIdentifierFromStringConst(Code,StartPos.X,StartPos.Y,
|
|
||||||
Code,EndPos.X,EndPos.Y,MakeResStrDialog.DefaultIdentifier,50);
|
|
||||||
MakeResStrDialog.UpdateIdentifier;
|
|
||||||
// show new source
|
|
||||||
MakeResStrDialog.UpdateSourcePreview;
|
|
||||||
|
|
||||||
// show dialog
|
// show dialog
|
||||||
Result:=MakeResStrDialog.ShowModal;
|
Result:=MakeResStrDialog.ShowModal;
|
||||||
if Result=mrOk then begin
|
if Result=mrOk then begin
|
||||||
// return results
|
// return results
|
||||||
NewIdentifier:=MakeResStrDialog.GetIdentifier;
|
NewIdentifier:=MakeResStrDialog.GetIdentifier;
|
||||||
ResourcestringSectionID:=MakeResStrDialog.ResStrSectionComboBox.ItemIndex;
|
|
||||||
MakeResStrDialog.GetNewSource(NewSourceLines,NewIdentifierValue);
|
MakeResStrDialog.GetNewSource(NewSourceLines,NewIdentifierValue);
|
||||||
if MakeResStrDialog.InsertAlphabeticallyResStrRadioButton.Checked then
|
if MakeResStrDialog.InsertAlphabeticallyResStrRadioButton.Checked then
|
||||||
InsertPolicy:=rsipAlphabetically
|
InsertPolicy:=rsipAlphabetically
|
||||||
else
|
else
|
||||||
InsertPolicy:=rsipAppend;
|
InsertPolicy:=rsipAppend;
|
||||||
|
ResourcestringSectionID:=MakeResStrDialog.ResStrSectionComboBox.ItemIndex;
|
||||||
Section:=CodeToolBoss.Positions[ResourcestringSectionID];
|
Section:=CodeToolBoss.Positions[ResourcestringSectionID];
|
||||||
ResStrSectionCode:=Section^.Code;
|
ResStrSectionCode:=Section^.Code;
|
||||||
ResStrSectionXY:=Point(Section^.X,Section^.Y);
|
ResStrSectionXY:=Point(Section^.X,Section^.Y);
|
||||||
@ -177,6 +168,7 @@ begin
|
|||||||
|
|
||||||
// save settings and clean up
|
// save settings and clean up
|
||||||
IDEDialogLayoutList.SaveLayout(MakeResStrDialog);
|
IDEDialogLayoutList.SaveLayout(MakeResStrDialog);
|
||||||
|
|
||||||
MakeResStrDialog.Free;
|
MakeResStrDialog.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -320,6 +312,7 @@ begin
|
|||||||
mtError,[mbCancel],0);
|
mtError,[mbCancel],0);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
SaveHistories;
|
||||||
ModalResult:=mrOk;
|
ModalResult:=mrOk;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -579,7 +572,12 @@ var
|
|||||||
NewSource, NewValue: string;
|
NewSource, NewValue: string;
|
||||||
begin
|
begin
|
||||||
GetNewSource(NewSource,NewValue);
|
GetNewSource(NewSource,NewValue);
|
||||||
SrcPreviewSynEdit.Text:=NewSource;
|
SrcPreviewSynEdit.Text:=NewSource+#13#10
|
||||||
|
+StringOfChar('-',
|
||||||
|
CodeToolBoss.SourceChangeCache.BeautifyCodeOptions.LineLength)
|
||||||
|
+#13#10
|
||||||
|
+CodeToolBoss.SourceChangeCache.BeautifyCodeOptions.BeautifyStatement(
|
||||||
|
GetIdentifier+' = '''+NewValue+'''',0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMakeResStrDialog.GetIdentifier: string;
|
function TMakeResStrDialog.GetIdentifier: string;
|
||||||
@ -657,6 +655,55 @@ begin
|
|||||||
ResourceStringValue:=FormatStringConstant;
|
ResourceStringValue:=FormatStringConstant;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMakeResStrDialog.Init;
|
||||||
|
begin
|
||||||
|
// string constant
|
||||||
|
StringConstSynEdit.Text:=Code.GetLines(StartPos.Y,EndPos.Y);
|
||||||
|
// reachable resourcestring sections
|
||||||
|
FillResourceStringSections(Positions);
|
||||||
|
// identifier prefixes
|
||||||
|
FillIdentPrefixes;
|
||||||
|
// identifier lengths
|
||||||
|
FillIdentLengths;
|
||||||
|
// identifier
|
||||||
|
CustomIdentifierCheckBox.Checked:=false;
|
||||||
|
CodeToolBoss.CreateIdentifierFromStringConst(Code,StartPos.X,StartPos.Y,
|
||||||
|
Code,EndPos.X,EndPos.Y,DefaultIdentifier,50);
|
||||||
|
UpdateIdentifier;
|
||||||
|
// show new source
|
||||||
|
UpdateSourcePreview;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMakeResStrDialog.SaveHistories;
|
||||||
|
begin
|
||||||
|
SaveIdentPrefixes;
|
||||||
|
SaveIdentLengths;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMakeResStrDialog.SaveIdentPrefixes;
|
||||||
|
var
|
||||||
|
HistoryList: THistoryList;
|
||||||
|
begin
|
||||||
|
if (not CustomIdentifierCheckBox.Checked)
|
||||||
|
or (IdentPrefixComboBox.Text='') then
|
||||||
|
exit;
|
||||||
|
HistoryList:=
|
||||||
|
InputHistories.HistoryLists.GetList(hlMakeResourceStringPrefixes,true);
|
||||||
|
HistoryList.Push(IdentPrefixComboBox.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMakeResStrDialog.SaveIdentLengths;
|
||||||
|
var
|
||||||
|
HistoryList: THistoryList;
|
||||||
|
begin
|
||||||
|
if (not CustomIdentifierCheckBox.Checked)
|
||||||
|
or (IdentLengthComboBox.Text='') then
|
||||||
|
exit;
|
||||||
|
HistoryList:=
|
||||||
|
InputHistories.HistoryLists.GetList(hlMakeResourceStringLengths,true);
|
||||||
|
HistoryList.Push(IdentLengthComboBox.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ unit LCLStrConsts;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
ResourceString
|
ResourceString
|
||||||
|
// message/input dialog buttons
|
||||||
rsMbYes = '&Yes';
|
rsMbYes = '&Yes';
|
||||||
rsMbNo = '&No';
|
rsMbNo = '&No';
|
||||||
rsMbOK = '&OK';
|
rsMbOK = '&OK';
|
||||||
@ -54,7 +54,7 @@ ResourceString
|
|||||||
rsMtConfirmation = 'Confirmation';
|
rsMtConfirmation = 'Confirmation';
|
||||||
rsMtCustom = 'Custom';
|
rsMtCustom = 'Custom';
|
||||||
|
|
||||||
//file dialog
|
// file dialog
|
||||||
rsfdOpenFile = 'Open existing file';
|
rsfdOpenFile = 'Open existing file';
|
||||||
rsfdOverwriteFile = 'Overwrite file ?';
|
rsfdOverwriteFile = 'Overwrite file ?';
|
||||||
rsfdFileAlreadyExists = 'The file "%s" already exists.'#13'Overwrite ?';
|
rsfdFileAlreadyExists = 'The file "%s" already exists.'#13'Overwrite ?';
|
||||||
@ -66,12 +66,58 @@ ResourceString
|
|||||||
rsfdFileReadOnly = 'The file "%s" is not writable.';
|
rsfdFileReadOnly = 'The file "%s" is not writable.';
|
||||||
rsfdFileSaveAs = 'Save file as';
|
rsfdFileSaveAs = 'Save file as';
|
||||||
|
|
||||||
//Select color dialog
|
// Select color dialog
|
||||||
rsSelectcolorTitle = 'Select color';
|
rsSelectcolorTitle = 'Select color';
|
||||||
|
|
||||||
//Select font dialog
|
// Select font dialog
|
||||||
rsSelectFontTitle = 'Select a font';
|
rsSelectFontTitle = 'Select a font';
|
||||||
|
|
||||||
|
// gtk interface
|
||||||
|
rsWarningUnremovedPaintMessages = ' WARNING: There are %s unremoved LM_'
|
||||||
|
+'PAINT/LM_GtkPAINT message links left.';
|
||||||
|
rsWarningUnreleasedDCsDump = ' WARNING: There are %d unreleased DCs, a '
|
||||||
|
+'detailed dump follows:';
|
||||||
|
rsWarningUnreleasedGDIObjectsDump = ' WARNING: There are %d unreleased '
|
||||||
|
+'GDIObjects, a detailed dump follows:';
|
||||||
|
rsWarningUnreleasedMessagesInQueue = ' WARNING: There are %d messages left '
|
||||||
|
+'in the queue! I''ll free them';
|
||||||
|
rsWarningUnreleasedTimerInfos = ' WARNING: There are %d TimerInfo '
|
||||||
|
+'structures left, I''ll free them';
|
||||||
|
rsFileInformation = 'File information';
|
||||||
|
rsDefaultFileInfoValue = 'permissions user group size date time';
|
||||||
|
rsBlank = 'Blank';
|
||||||
|
rsUnableToLoadDefaultFont = 'Unable to load default font';
|
||||||
|
rsFileInfoFileNotFound = '(file not found: "%s")';
|
||||||
|
rsgtkOptionModule = '--gtk-module module Load the specified module at '
|
||||||
|
+'startup.';
|
||||||
|
rsgOptionFatalWarnings = '--g-fatal-warnings Warnings and errors '
|
||||||
|
+'generated by Gtk+/GDK willhalt the application.';
|
||||||
|
rsgtkOptionDebug = '--gtk-debug flags Turn on specific Gtk+ trace/'
|
||||||
|
+'debug messages.';
|
||||||
|
rsgtkOptionNoDebug = '--gtk-no-debug flags Turn off specific Gtk+ trace/'
|
||||||
|
+'debug messages.';
|
||||||
|
rsgdkOptionDebug = '--gdk-debug flags Turn on specific GDK trace/debug '
|
||||||
|
+'messages.';
|
||||||
|
rsgdkOptionNoDebug = '--gdk-no-debug flags Turn off specific GDK trace/'
|
||||||
|
+'debug messages.';
|
||||||
|
rsgtkOptionDisplay = '--display h:s:d Connect to the specified X '
|
||||||
|
+'server, where "h" isthe hostname, "s" is the server number (usually0), '
|
||||||
|
+'and "d" is the display number (typicallyomitted). If --display is not '
|
||||||
|
+'specified, theDISPLAY environment variable is used.';
|
||||||
|
rsgtkOptionSync = '--sync Call XSynchronize (display, True) '
|
||||||
|
+'after the Xserver connection has been established. Thismakes debugging '
|
||||||
|
+'X protocol erros easier,because X request buffering will be disabled '
|
||||||
|
+'andX errors will be received immediatey after theprotocol request that '
|
||||||
|
+'generated the error hasbeen processed by the X server.';
|
||||||
|
rsgtkOptionNoXshm = '--no-xshm Disable use of the X Shared '
|
||||||
|
+'Memory Extension.';
|
||||||
|
rsgtkOptionName = '--name programe Set program name to "progname". '
|
||||||
|
+'If notspecified, program name will be set toParamStr(0).';
|
||||||
|
rsgtkOptionClass = '--class classname Following Xt conventions, the '
|
||||||
|
+'class of aprogram is the program name with the initialcharacter '
|
||||||
|
+'capitalized. For example, the classname for gimp is "Gimp". If --class '
|
||||||
|
+'isspecified, the class of the program will beset to "classname".';
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user