mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-02 05:32:37 +02:00
localization, added context policy to make resource string dialog
git-svn-id: trunk@2984 -
This commit is contained in:
parent
d287573e68
commit
e611d2b577
63
ide/main.pp
63
ide/main.pp
@ -46,11 +46,11 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// fpc packages
|
// fpc packages
|
||||||
Classes, SysUtils, Process, TypInfo,
|
Classes, SysUtils, Process, TypInfo,
|
||||||
|
// codetools
|
||||||
|
CodeToolsStructs, CodeToolManager, CodeCache, DefineTemplates,
|
||||||
// lcl
|
// lcl
|
||||||
LCLType, LclLinux, LMessages, LResources, StdCtrls, Forms, Buttons, Menus,
|
LCLType, LclLinux, LMessages, LResources, StdCtrls, Forms, Buttons, Menus,
|
||||||
FileCtrl, Controls, Graphics, GraphType, ExtCtrls, Dialogs,
|
FileCtrl, Controls, Graphics, GraphType, ExtCtrls, Dialogs,
|
||||||
// codetools
|
|
||||||
CodeToolManager, CodeCache, DefineTemplates,
|
|
||||||
// synedit
|
// synedit
|
||||||
SynEditKeyCmds,
|
SynEditKeyCmds,
|
||||||
// compile
|
// compile
|
||||||
@ -5361,9 +5361,12 @@ begin
|
|||||||
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
|
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
|
||||||
ActiveUnitInfo.ReadUnitNameFromSource;
|
ActiveUnitInfo.ReadUnitNameFromSource;
|
||||||
ShortUnitName:=ActiveUnitInfo.UnitName;
|
ShortUnitName:=ActiveUnitInfo.UnitName;
|
||||||
if (ShortUnitName<>'') then
|
if (ShortUnitName<>'') then begin
|
||||||
CodeToolBoss.AddUnitToMainUsesSection(
|
if CodeToolBoss.AddUnitToMainUsesSection(
|
||||||
Project1.MainUnitInfo.Source,ShortUnitName,'');
|
Project1.MainUnitInfo.Source,ShortUnitName,'')
|
||||||
|
then
|
||||||
|
Project1.MainUnitInfo.Modified:=true;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
Project1.Modified:=true;
|
Project1.Modified:=true;
|
||||||
end;
|
end;
|
||||||
@ -5403,16 +5406,20 @@ Begin
|
|||||||
AnUnitInfo.IsPartOfProject:=false;
|
AnUnitInfo.IsPartOfProject:=false;
|
||||||
if (Project1.MainUnitID>=0)
|
if (Project1.MainUnitID>=0)
|
||||||
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
|
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
|
||||||
if (AnUnitInfo.UnitName<>'') then
|
if (AnUnitInfo.UnitName<>'') then begin
|
||||||
CodeToolBoss.RemoveUnitFromAllUsesSections(
|
if CodeToolBoss.RemoveUnitFromAllUsesSections(
|
||||||
Project1.MainUnitInfo.Source,AnUnitInfo.UnitName);
|
Project1.MainUnitInfo.Source,AnUnitInfo.UnitName)
|
||||||
if (AnUnitInfo.FormName<>'') then
|
then
|
||||||
|
Project1.MainUnitInfo.Modified:=true;
|
||||||
|
end;
|
||||||
|
if (AnUnitInfo.FormName<>'') then begin
|
||||||
Project1.RemoveCreateFormFromProjectFile(
|
Project1.RemoveCreateFormFromProjectFile(
|
||||||
'T'+AnUnitInfo.FormName,AnUnitInfo.FormName);
|
'T'+AnUnitInfo.FormName,AnUnitInfo.FormName);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
UnitList.Free;
|
UnitList.Free;
|
||||||
end;
|
end;
|
||||||
@ -6784,6 +6791,7 @@ begin
|
|||||||
// add needed unit to source
|
// add needed unit to source
|
||||||
CodeToolBoss.AddUnitToMainUsesSection(ActiveUnitInfo.Source,
|
CodeToolBoss.AddUnitToMainUsesSection(ActiveUnitInfo.Source,
|
||||||
AComponentClass.{$IFDEF EnablePkgs}GetUnitName{$ELSE}UnitName{$ENDIF},'');
|
AComponentClass.{$IFDEF EnablePkgs}GetUnitName{$ELSE}UnitName{$ENDIF},'');
|
||||||
|
ActiveUnitInfo.Modified:=true;
|
||||||
// add component definition to form source
|
// add component definition to form source
|
||||||
FormClassName:=TDesigner(Sender).Form.ClassName;
|
FormClassName:=TDesigner(Sender).Form.ClassName;
|
||||||
if not CodeToolBoss.PublishedVariableExists(ActiveUnitInfo.Source,
|
if not CodeToolBoss.PublishedVariableExists(ActiveUnitInfo.Source,
|
||||||
@ -7549,10 +7557,11 @@ var
|
|||||||
InsertPolicy: TResourcestringInsertPolicy;
|
InsertPolicy: TResourcestringInsertPolicy;
|
||||||
SectionCode: TCodeBuffer;
|
SectionCode: TCodeBuffer;
|
||||||
SectionCaretXY: TPoint;
|
SectionCaretXY: TPoint;
|
||||||
InsertAlphabetically: boolean;
|
|
||||||
DummyResult: Boolean;
|
DummyResult: Boolean;
|
||||||
SelectedStartPos: TPoint;
|
SelectedStartPos: TPoint;
|
||||||
SelectedEndPos: TPoint;
|
SelectedEndPos: TPoint;
|
||||||
|
CursorCode: TCodeBuffer;
|
||||||
|
CursorXY: TPoint;
|
||||||
begin
|
begin
|
||||||
FOpenEditorsOnCodeToolChange:=true;
|
FOpenEditorsOnCodeToolChange:=true;
|
||||||
try
|
try
|
||||||
@ -7563,9 +7572,10 @@ begin
|
|||||||
writeln('[TMainIDE.DoMakeResourceString] ************');
|
writeln('[TMainIDE.DoMakeResourceString] ************');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// calculate start and end of expression in source
|
// calculate start and end of expression in source
|
||||||
if CodeToolBoss.GetStringConstBounds(ActiveUnitInfo.Source,
|
CursorCode:=ActiveUnitInfo.Source;
|
||||||
ActiveSrcEdit.EditorComponent.CaretX,
|
CursorXY:=ActiveSrcEdit.EditorComponent.CaretXY;
|
||||||
ActiveSrcEdit.EditorComponent.CaretY,
|
if CodeToolBoss.GetStringConstBounds(
|
||||||
|
CursorCode,CursorXY.X,CursorXY.Y,
|
||||||
StartCode,StartPos.X,StartPos.Y,
|
StartCode,StartPos.X,StartPos.Y,
|
||||||
EndCode,EndPos.X,EndPos.Y,
|
EndCode,EndPos.X,EndPos.Y,
|
||||||
true) then
|
true) then
|
||||||
@ -7616,10 +7626,7 @@ begin
|
|||||||
|
|
||||||
// gather all reachable resourcestring sections
|
// gather all reachable resourcestring sections
|
||||||
if not CodeToolBoss.GatherResourceStringSections(
|
if not CodeToolBoss.GatherResourceStringSections(
|
||||||
ActiveUnitInfo.Source,
|
CursorCode,CursorXY.X,CursorXY.Y,nil)
|
||||||
ActiveSrcEdit.EditorComponent.CaretX,
|
|
||||||
ActiveSrcEdit.EditorComponent.CaretY,
|
|
||||||
nil)
|
|
||||||
then begin
|
then begin
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
exit;
|
exit;
|
||||||
@ -7637,19 +7644,18 @@ begin
|
|||||||
CodeToolBoss.Positions,
|
CodeToolBoss.Positions,
|
||||||
NewIdentifier,NewIdentValue,NewSourceLines,
|
NewIdentifier,NewIdentValue,NewSourceLines,
|
||||||
SectionCode,SectionCaretXY,InsertPolicy);
|
SectionCode,SectionCaretXY,InsertPolicy);
|
||||||
if Result<>mrOk then exit;
|
if (Result<>mrOk) then exit;
|
||||||
|
|
||||||
// replace source
|
// replace source
|
||||||
ActiveSrcEdit.ReplaceLines(StartPos.Y,EndPos.Y,NewSourceLines);
|
ActiveSrcEdit.ReplaceLines(StartPos.Y,EndPos.Y,NewSourceLines);
|
||||||
|
|
||||||
// add new resourcestring to resourcestring section
|
// add new resourcestring to resourcestring section
|
||||||
if InsertPolicy in [rsipAppend,rsipAlphabetically] then begin
|
if (InsertPolicy<>rsipNone) then
|
||||||
InsertAlphabetically:=(InsertPolicy=rsipAlphabetically);
|
|
||||||
DummyResult:=CodeToolBoss.AddResourcestring(
|
DummyResult:=CodeToolBoss.AddResourcestring(
|
||||||
|
CursorCode,CursorXY.X,CursorXY.Y,
|
||||||
SectionCode,SectionCaretXY.X,SectionCaretXY.Y,
|
SectionCode,SectionCaretXY.X,SectionCaretXY.Y,
|
||||||
NewIdentifier,''''+NewIdentValue+'''',
|
NewIdentifier,''''+NewIdentValue+'''',InsertPolicy)
|
||||||
InsertAlphabetically);
|
else
|
||||||
end else
|
|
||||||
DummyResult:=true;
|
DummyResult:=true;
|
||||||
ApplyCodeToolChanges;
|
ApplyCodeToolChanges;
|
||||||
if not DummyResult then begin
|
if not DummyResult then begin
|
||||||
@ -8084,7 +8090,9 @@ begin
|
|||||||
Dummy:=CodeToolBoss.AddUnitToMainUsesSection(
|
Dummy:=CodeToolBoss.AddUnitToMainUsesSection(
|
||||||
Project1.MainUnitInfo.Source,ShortUnitName,'');
|
Project1.MainUnitInfo.Source,ShortUnitName,'');
|
||||||
ApplyCodeToolChanges;
|
ApplyCodeToolChanges;
|
||||||
if not Dummy then begin
|
if Dummy then begin
|
||||||
|
Project1.MainUnitInfo.Modified:=true;
|
||||||
|
end else begin
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
end;
|
end;
|
||||||
@ -8110,7 +8118,9 @@ begin
|
|||||||
if (ShortUnitName<>'') then begin
|
if (ShortUnitName<>'') then begin
|
||||||
Dummy:=CodeToolBoss.RemoveUnitFromAllUsesSections(
|
Dummy:=CodeToolBoss.RemoveUnitFromAllUsesSections(
|
||||||
Project1.MainUnitInfo.Source,ShortUnitName);
|
Project1.MainUnitInfo.Source,ShortUnitName);
|
||||||
if not Dummy then begin
|
if Dummy then
|
||||||
|
Project1.MainUnitInfo.Modified:=true
|
||||||
|
else begin
|
||||||
ApplyCodeToolChanges;
|
ApplyCodeToolChanges;
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
@ -8648,6 +8658,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.551 2003/05/02 22:22:14 mattias
|
||||||
|
localization, added context policy to make resource string dialog
|
||||||
|
|
||||||
Revision 1.550 2003/05/02 10:28:59 mattias
|
Revision 1.550 2003/05/02 10:28:59 mattias
|
||||||
improved file checking
|
improved file checking
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user