Ide, Project session, allow customize (Fold, JumpHistory)

git-svn-id: trunk@36388 -
This commit is contained in:
martin 2012-03-28 00:56:19 +00:00
parent c041b8558c
commit 1e15e296e5
5 changed files with 86 additions and 19 deletions

View File

@ -1,43 +1,49 @@
inherited ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
object ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
Left = 0
Height = 240
Top = 0
Width = 320
ClientHeight = 240
ClientWidth = 320
TabOrder = 0
DesignLeft = 617
DesignTop = 390
object SaveClosedUnitInfoCheckBox: TCheckBox[0]
object SaveClosedUnitInfoCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
Left = 0
Height = 18
Height = 19
Top = 0
Width = 320
Align = alTop
Caption = 'SaveClosedUnitInfoCheckBox'
TabOrder = 0
end
object SaveOnlyProjectUnitInfoCheckBox: TCheckBox[1]
object SaveOnlyProjectUnitInfoCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = SaveClosedUnitInfoCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 18
Top = 24
Height = 19
Top = 25
Width = 320
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Caption = 'SaveOnlyProjectUnitInfoCheckBox'
TabOrder = 1
end
object SaveSessionLocationRadioGroup: TRadioGroup[2]
object SaveSessionLocationRadioGroup: TRadioGroup
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = SaveOnlyProjectUnitInfoCheckBox
AnchorSideTop.Control = SaveFoldState
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 21
Top = 48
Top = 100
Width = 320
Anchors = [akTop, akLeft, akRight]
AutoFill = True
@ -55,4 +61,34 @@ inherited ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
OnClick = SaveSessionLocationRadioGroupClick
TabOrder = 2
end
object SaveJumpHistory: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = SaveOnlyProjectUnitInfoCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 19
Top = 50
Width = 320
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Caption = 'SaveJumpHistory'
TabOrder = 3
end
object SaveFoldState: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = SaveJumpHistory
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 19
Top = 75
Width = 320
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Caption = 'SaveFoldState'
TabOrder = 4
end
end

View File

@ -14,6 +14,8 @@ type
{ TProjectSaveOptionsFrame }
TProjectSaveOptionsFrame = class(TAbstractIDEOptionsEditor)
SaveJumpHistory: TCheckBox;
SaveFoldState: TCheckBox;
SaveClosedUnitInfoCheckBox: TCheckBox;
SaveOnlyProjectUnitInfoCheckBox: TCheckBox;
SaveSessionLocationRadioGroup: TRadioGroup;
@ -87,6 +89,8 @@ begin
SaveClosedUnitInfoCheckBox.Caption := dlgSaveEditorInfo;
SaveOnlyProjectUnitInfoCheckBox.Caption := dlgSaveEditorInfoProject;
SaveSessionLocationRadioGroup.Caption := lisPOSaveSessionInformationIn;
SaveJumpHistory.Caption := lisPOSaveSessionJumpHistory;
SaveFoldState.Caption := lisPOSaveSessionFoldState;
for s := Low(TProjectSessionStorage) to High(TProjectSessionStorage) do
SaveSessionLocationRadioGroup.Items.Add(ProjectSessionStorageToLocalizedName(s));
end;
@ -100,6 +104,8 @@ begin
SaveClosedUnitInfoCheckBox.Checked := (pfSaveClosedUnits in Flags);
SaveOnlyProjectUnitInfoCheckBox.Checked := (pfSaveOnlyProjectUnits in Flags);
SaveSessionLocationRadioGroup.ItemIndex := ord(SessionStorage);
SaveJumpHistory.Checked := (pfSaveJumpHistory in Flags);
SaveFoldState.Checked := (pfSaveFoldState in Flags);
end;
end;
@ -119,6 +125,14 @@ begin
include(AFlags, pfSaveOnlyProjectUnits)
else
exclude(AFlags, pfSaveOnlyProjectUnits);
if SaveJumpHistory.Checked then
include(AFlags, pfSaveJumpHistory)
else
exclude(AFlags, pfSaveJumpHistory);
if SaveFoldState.Checked then
include(AFlags, pfSaveFoldState)
else
exclude(AFlags, pfSaveFoldState);
if SaveSessionLocationRadioGroup.ItemIndex >= 0 then
SessionStorage := Self.GetSessionLocation;
Flags := AFlags;

View File

@ -4488,6 +4488,8 @@ resourcestring
lisPOSaveInIDEConfigDirectory = 'Save in IDE config directory';
lisPODoNotSaveAnySessionInfo = 'Do not save any session info';
lisPOSaveSessionInformationIn = 'Save session information in';
lisPOSaveSessionJumpHistory = 'Save jump history';
lisPOSaveSessionFoldState = 'Save fold info';
lisMVSaveMessagesToFileTxt = 'Save messages to file (*.txt)';
lisTabOrderOf = 'Tab Order of %s';

View File

@ -193,7 +193,7 @@ type
property EditorComponent: TSourceEditorInterface
read FEditorComponent write SetEditorComponent;
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string; SaveFold: Boolean);
public
property IsVisibleTab: Boolean read FIsVisibleTab write SetIsVisibleTab;
property PageIndex: Integer read FPageIndex write SetPageIndex;
@ -1273,7 +1273,8 @@ begin
LazSyntaxHighlighterNames[UnitInfo.DefaultSyntaxHighlighter]));
end;
procedure TUnitEditorInfo.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string);
procedure TUnitEditorInfo.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
SaveFold: Boolean);
begin
XMLConfig.SetDeleteValue(Path+'IsVisibleTab/Value', FIsVisibleTab, False);
XMLConfig.SetDeleteValue(Path+'EditorIndex/Value', FPageIndex, -1);
@ -1282,7 +1283,10 @@ begin
XMLConfig.SetDeleteValue(Path+'CursorPos/X', FCursorPos.X, -1);
XMLConfig.SetDeleteValue(Path+'CursorPos/Y', FCursorPos.Y, -1);
XMLConfig.SetDeleteValue(Path+'IsLocked/Value', FIsLocked, False);
XMLConfig.SetDeleteValue(Path+'FoldState/Value', FoldState, '');
if SaveFold then
XMLConfig.SetDeleteValue(Path+'FoldState/Value', FoldState, '')
else
XMLConfig.DeletePath(Path+'FoldState');
XMLConfig.SetDeleteValue(Path+'SyntaxHighlighter/Value',
LazSyntaxHighlighterNames[fSyntaxHighlighter],
LazSyntaxHighlighterNames[UnitInfo.DefaultSyntaxHighlighter]);
@ -1704,10 +1708,11 @@ begin
// session data
if SaveSession then
begin
FEditorInfoList[0].SaveToXMLConfig(XMLConfig, Path);
FEditorInfoList[0].SaveToXMLConfig(XMLConfig, Path, pfSaveFoldState in Project.Flags);
XMLConfig.SetDeleteValue(Path+'ExtraEditorCount/Value', FEditorInfoList.Count-1, 0);
for i := 1 to FEditorInfoList.Count - 1 do
FEditorInfoList[i].SaveToXMLConfig(XMLConfig, Path + 'ExtraEditor'+IntToStr(i)+'/');
FEditorInfoList[i].SaveToXMLConfig(XMLConfig, Path + 'ExtraEditor'+IntToStr(i)+'/',
pfSaveFoldState in Project.Flags);
XMLConfig.SetDeleteValue(Path+'ComponentState/Value',Ord(FComponentState),0);
@ -2735,8 +2740,12 @@ function TProject.WriteProject(ProjectWriteFlags: TProjectWriteFlags;
if (not (pfSaveOnlyProjectUnits in Flags))
and (not (pwfSkipJumpPoints in ProjectWriteFlags)) then begin
FJumpHistory.DeleteInvalidPositions;
FJumpHistory.SaveToXMLConfig(aConfig,Path);
if (pfSaveJumpHistory in Flags) then begin
FJumpHistory.DeleteInvalidPositions;
FJumpHistory.SaveToXMLConfig(aConfig,Path);
end
else
aConfig.DeletePath(Path+'JumpHistory');
end;
// save custom session data

View File

@ -248,7 +248,9 @@ type
pfAlwaysBuild, // skip IDE's smart check if compilation is needed and always compile
pfUseDesignTimePackages, // compile design time packages to project
pfLRSFilesInOutputDirectory, // put .lrs files in output directory
pfUseDefaultCompilerOptions // load users default compiler options
pfUseDefaultCompilerOptions, // load users default compiler options
pfSaveJumpHistory,
pfSaveFoldState
);
TProjectFlags = set of TProjectFlag;
@ -512,7 +514,9 @@ const
pfMainUnitHasCreateFormStatements,
pfMainUnitHasTitleStatement,
pfRunnable,
pfLRSFilesInOutputDirectory];
pfLRSFilesInOutputDirectory,
pfSaveJumpHistory,
pfSaveFoldState];
ProjectFlagNames : array[TProjectFlag] of string = (
'SaveClosedFiles',
'SaveOnlyProjectUnits',
@ -524,7 +528,9 @@ const
'AlwaysBuild',
'UseDesignTimePackages',
'LRSInOutputDirectory',
'UseDefaultCompilerOptions'
'UseDefaultCompilerOptions',
'SaveJumpHistory',
'SaveFoldState'
);
ProjectSessionStorageNames: array[TProjectSessionStorage] of string = (