localized gtk interface

git-svn-id: trunk@3906 -
This commit is contained in:
mattias 2003-03-09 21:13:32 +00:00
parent b25b6d4dc1
commit ccf7fe59e4
3 changed files with 127 additions and 34 deletions

View File

@ -1255,15 +1255,15 @@ begin
EndPos:=CursorPos;
Result:=true;
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);
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
exit;
// read til end of string constant
MoveCursorToCleanPos(SameArea.StartPos);
ReadNextAtom;
writeln('TStandardCodeTool.GetStringConstBounds read til end of string ',GetAtom);
//writeln('TStandardCodeTool.GetStringConstBounds read til end of string ',GetAtom);
CurrentToken:=GetCurrentTokenType;
if (CurrentToken=scatNone) then exit;
repeat
@ -1271,10 +1271,10 @@ begin
ReadNextAtom;
LastToken:=CurrentToken;
CurrentToken:=GetCurrentTokenType;
writeln('TStandardCodeTool.GetStringConstBounds Read Forward: ',GetAtom,' EndCleanPos=',EndCleanPos,
' LastToken=',StrConstTokenTypeName[LastToken],
' CurrentToken=',StrConstTokenTypeName[CurrentToken],
' ',StrConstTokenTypeName[GetCurrentTokenType]);
//writeln('TStandardCodeTool.GetStringConstBounds Read Forward: ',GetAtom,' EndCleanPos=',EndCleanPos,
//' LastToken=',StrConstTokenTypeName[LastToken],
//' CurrentToken=',StrConstTokenTypeName[CurrentToken],
//' ',StrConstTokenTypeName[GetCurrentTokenType]);
case CurrentToken of
scatNone, scatEdgedBracketClose, scatRoundBracketClose:
if not (LastToken in [scatStrConst,scatIdent,scatUp,
@ -1314,12 +1314,12 @@ begin
// read til start of string constant
MoveCursorToCleanPos(SameArea.StartPos);
ReadNextAtom;
writeln('TStandardCodeTool.GetStringConstBounds Read til start of string ',GetAtom);
//writeln('TStandardCodeTool.GetStringConstBounds Read til start of string ',GetAtom);
CurrentToken:=GetCurrentTokenType;
repeat
StartCleanPos:=CurPos.StartPos;
ReadPriorAtom;
writeln('TStandardCodeTool.GetStringConstBounds Read backward: ',GetAtom,' StartCleanPos=',StartCleanPos);
//writeln('TStandardCodeTool.GetStringConstBounds Read backward: ',GetAtom,' StartCleanPos=',StartCleanPos);
LastToken:=CurrentToken;
CurrentToken:=GetCurrentTokenType;
case CurrentToken of
@ -1358,7 +1358,7 @@ begin
until false;
// 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(EndCleanPos,EndPos) then exit;
@ -1398,7 +1398,7 @@ function TStandardCodeTool.GatherResourceStringSections(
if ANode.Desc=ctnResStrSection then begin
if not NewCodeTool.CleanPosToCaret(ANode.StartPos,NewCaret) then
break;
writeln('TStandardCodeTool.GatherResourceStringSections Found Other ',NewCodeTool.MainFilename,' Y=',NewCaret.Y);
//writeln('TStandardCodeTool.GatherResourceStringSections Found Other ',NewCodeTool.MainFilename,' Y=',NewCaret.Y);
PositionList.Add(NewCaret);
end;
ANode:=ANode.PriorBrother;
@ -1419,7 +1419,7 @@ var
ANode: TCodeTreeNode;
begin
Result:=false;
writeln('TStandardCodeTool.GatherResourceStringSections A ');
//writeln('TStandardCodeTool.GatherResourceStringSections A ');
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]);
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
PositionList.Clear;
@ -1430,7 +1430,7 @@ begin
ctnResStrSection:
begin
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);
end;

View File

@ -111,6 +111,10 @@ type
const NewStartPos, NewEndPos: TPoint);
function ResourceStringExists(const Identifier: string): boolean;
procedure GetNewSource(var NewSource, ResourceStringValue: string);
procedure Init;
procedure SaveHistories;
procedure SaveIdentPrefixes;
procedure SaveIdentLengths;
end;
function ShowMakeResStrDialog(
@ -142,34 +146,21 @@ var
ResourcestringSectionID: Integer;
begin
MakeResStrDialog:=TMakeResStrDialog.Create(Application);
MakeResStrDialog.Positions:=CodeToolBoss.Positions;
MakeResStrDialog.SetSource(Code,StartPos,EndPos);
// string constant
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;
MakeResStrDialog.Init;
// show dialog
Result:=MakeResStrDialog.ShowModal;
if Result=mrOk then begin
// return results
NewIdentifier:=MakeResStrDialog.GetIdentifier;
ResourcestringSectionID:=MakeResStrDialog.ResStrSectionComboBox.ItemIndex;
MakeResStrDialog.GetNewSource(NewSourceLines,NewIdentifierValue);
if MakeResStrDialog.InsertAlphabeticallyResStrRadioButton.Checked then
InsertPolicy:=rsipAlphabetically
else
InsertPolicy:=rsipAppend;
ResourcestringSectionID:=MakeResStrDialog.ResStrSectionComboBox.ItemIndex;
Section:=CodeToolBoss.Positions[ResourcestringSectionID];
ResStrSectionCode:=Section^.Code;
ResStrSectionXY:=Point(Section^.X,Section^.Y);
@ -177,6 +168,7 @@ begin
// save settings and clean up
IDEDialogLayoutList.SaveLayout(MakeResStrDialog);
MakeResStrDialog.Free;
end;
@ -320,6 +312,7 @@ begin
mtError,[mbCancel],0);
exit;
end;
SaveHistories;
ModalResult:=mrOk;
end;
@ -579,7 +572,12 @@ var
NewSource, NewValue: string;
begin
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;
function TMakeResStrDialog.GetIdentifier: string;
@ -657,6 +655,55 @@ begin
ResourceStringValue:=FormatStringConstant;
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.

View File

@ -34,7 +34,7 @@ unit LCLStrConsts;
interface
ResourceString
// message/input dialog buttons
rsMbYes = '&Yes';
rsMbNo = '&No';
rsMbOK = '&OK';
@ -54,7 +54,7 @@ ResourceString
rsMtConfirmation = 'Confirmation';
rsMtCustom = 'Custom';
//file dialog
// file dialog
rsfdOpenFile = 'Open existing file';
rsfdOverwriteFile = 'Overwrite file ?';
rsfdFileAlreadyExists = 'The file "%s" already exists.'#13'Overwrite ?';
@ -66,12 +66,58 @@ ResourceString
rsfdFileReadOnly = 'The file "%s" is not writable.';
rsfdFileSaveAs = 'Save file as';
//Select color dialog
// Select color dialog
rsSelectcolorTitle = 'Select color';
//Select font dialog
// Select font dialog
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