mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-29 03:23:41 +02:00
IDE: make resource string from selection, using BlockBegin
git-svn-id: trunk@10403 -
This commit is contained in:
parent
d94c0106dc
commit
ce40da1b9d
@ -192,6 +192,7 @@ type
|
||||
var Caret:TCodeXYPosition): boolean; // true=ok, false=invalid CleanPos
|
||||
function CleanPosToCaretAndTopLine(CleanPos: integer;
|
||||
var Caret:TCodeXYPosition; var NewTopLine: integer): boolean; // true=ok, false=invalid CleanPos
|
||||
function CleanPosToStr(CleanPos: integer): string;
|
||||
procedure GetCleanPosInfo(CodePosInFront, CleanPos: integer;
|
||||
ResolveComments: boolean; var SameArea: TAtomPosition);
|
||||
procedure GetLineInfo(ACleanPos: integer;
|
||||
@ -2100,6 +2101,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCustomCodeTool.CleanPosToStr(CleanPos: integer): string;
|
||||
var
|
||||
CodePos: TCodeXYPosition;
|
||||
begin
|
||||
if CleanPosToCaret(CleanPos,CodePos) then
|
||||
Result:='y='+IntToStr(CodePos.Y)+',x='+IntToStr(CodePos.X)
|
||||
else
|
||||
Result:='y=?,x=?';
|
||||
end;
|
||||
|
||||
procedure TCustomCodeTool.GetCleanPosInfo(CodePosInFront, CleanPos: integer;
|
||||
ResolveComments: boolean; var SameArea: TAtomPosition);
|
||||
var
|
||||
@ -2112,7 +2123,7 @@ begin
|
||||
MoveCursorToCleanPos(CodePosInFront);
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
//DebugLn('TCustomCodeTool.GetCleanPosInfo A Atom=',GetAtom,' CleanPos=',CleanPos,' CurPos.StartPos=',CurPos.StartPos);
|
||||
//DebugLn(['TCustomCodeTool.GetCleanPosInfo A Atom=',GetAtom,' CleanPos=',CleanPos,' CurPos.StartPos=',CurPos.StartPos]);
|
||||
if (CleanPos>=CurPos.StartPos) and (CleanPos<CurPos.EndPos) then begin
|
||||
// clean pos on token
|
||||
SameArea:=CurPos;
|
||||
@ -2129,7 +2140,7 @@ begin
|
||||
end;
|
||||
SameArea.EndPos:=SameArea.StartPos;
|
||||
repeat
|
||||
//DebugLn('TCustomCodeTool.GetCleanPosInfo B CleanPos=',CleanPos,' SameArea.StartPos=',SameArea.StartPos,' SameArea.EndPos=',SameArea.EndPos);
|
||||
//DebugLn(['TCustomCodeTool.GetCleanPosInfo B CleanPos=',CleanPos,' SameArea.StartPos=',SameArea.StartPos,' SameArea.EndPos=',SameArea.EndPos]);
|
||||
while (SameArea.EndPos<=SrcLen)
|
||||
and (IsSpaceChar[Src[SameArea.EndPos]]) do
|
||||
inc(SameArea.EndPos);
|
||||
|
@ -6,6 +6,7 @@
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=""/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
@ -13,7 +14,6 @@
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
|
@ -2672,11 +2672,11 @@ begin
|
||||
Result:=true;
|
||||
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]);
|
||||
{$IFDEF VerboseGetStringConstBounds}
|
||||
DebugLn('TStandardCodeTool.GetStringConstBounds A Start at ',dbgs(CleanCursorPos),' "',copy(Src,CleanCursorPos-5,5),'" | "',copy(Src,CleanCursorPos,5),'"');
|
||||
DebugLn('TStandardCodeTool.GetStringConstBounds A Start at ',CleanPosToStr(CleanCursorPos),' "',copy(Src,CleanCursorPos-5,5),'" | "',copy(Src,CleanCursorPos,5),'"');
|
||||
{$ENDIF}
|
||||
GetCleanPosInfo(-1,CleanCursorPos,ResolveComments,SameArea);
|
||||
{$IFDEF VerboseGetStringConstBounds}
|
||||
DebugLn('TStandardCodeTool.GetStringConstBounds B Same Area: ',dbgs(SameArea.StartPos),'-',dbgs(SameArea.EndPos),' "',copy(Src,SameArea.StartPos,SameArea.EndPos-SameArea.StartPos),'"');
|
||||
DebugLn('TStandardCodeTool.GetStringConstBounds B Same Area: ',CleanPosToStr(SameArea.StartPos),'-',CleanPosToStr(SameArea.EndPos),' "',copy(Src,SameArea.StartPos,SameArea.EndPos-SameArea.StartPos),'"');
|
||||
{$ENDIF}
|
||||
if (SameArea.EndPos=SameArea.StartPos) or (SameArea.StartPos>SrcLen) then
|
||||
exit;
|
||||
|
@ -336,8 +336,6 @@ type
|
||||
read FCFDividerDrawLevel write FCFDividerDrawLevel default 3;
|
||||
end;
|
||||
|
||||
{ Editor Options form }
|
||||
|
||||
{ TEditorOptionsForm }
|
||||
|
||||
TEditorOptionsForm = class(TForm)
|
||||
@ -3486,7 +3484,7 @@ begin
|
||||
s := '';
|
||||
Result := Result + s;
|
||||
if (ShortcutA.Key1 = VK_UNKNOWN) and (ShortcutB.Key1 = VK_UNKNOWN) then
|
||||
Result := Result + 'none'
|
||||
Result := Result + lisNone2
|
||||
else
|
||||
if (ShortcutA.Key1 = VK_UNKNOWN) then
|
||||
Result := Result + KeyAndShiftStateToEditorKeyString(ShortcutB)
|
||||
@ -3495,7 +3493,7 @@ begin
|
||||
Result := Result + KeyAndShiftStateToEditorKeyString(ShortcutA)
|
||||
else
|
||||
Result := Result + KeyAndShiftStateToEditorKeyString(
|
||||
ShortcutA) + ' or ' +
|
||||
ShortcutA) + ' '+lisOr+' ' +
|
||||
KeyAndShiftStateToEditorKeyString(ShortcutB);
|
||||
end;
|
||||
end;
|
||||
|
@ -186,6 +186,9 @@ resourcestring
|
||||
lisMenuInsertText = 'Insert text';
|
||||
lisMenuInsertCVSKeyword = 'CVS keyword';
|
||||
lisMenuInsertGeneral = 'General';
|
||||
lisNone2 = 'none';
|
||||
lisOr = 'or';
|
||||
lisNone = '%snone';
|
||||
lisUnitPaths = 'Unit paths';
|
||||
lisIncludePaths = 'Include paths';
|
||||
lisSourcePaths = 'Source paths';
|
||||
|
@ -11107,7 +11107,10 @@ begin
|
||||
{$ENDIF}
|
||||
// calculate start and end of expression in source
|
||||
CursorCode:=ActiveUnitInfo.Source;
|
||||
CursorXY:=ActiveSrcEdit.EditorComponent.LogicalCaretXY;
|
||||
if ActiveSrcEdit.EditorComponent.SelAvail then
|
||||
CursorXY:=ActiveSrcEdit.EditorComponent.BlockBegin
|
||||
else
|
||||
CursorXY:=ActiveSrcEdit.EditorComponent.LogicalCaretXY;
|
||||
if not CodeToolBoss.GetStringConstBounds(
|
||||
CursorCode,CursorXY.X,CursorXY.Y,
|
||||
StartCode,StartPos.X,StartPos.Y,
|
||||
|
Loading…
Reference in New Issue
Block a user