mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 12:59:53 +02:00
IDE, Options, remember fold state of main-tree
git-svn-id: trunk@25857 -
This commit is contained in:
parent
b4a1077e27
commit
8ce99dc2a6
@ -842,8 +842,9 @@ var XMLConfig: TXMLConfig;
|
||||
OldDebuggerType: TDebuggerType;
|
||||
Path: String;
|
||||
CurPath: String;
|
||||
i: Integer;
|
||||
i, j: Integer;
|
||||
name: String;
|
||||
Rec: PIDEOptionsGroupRec;
|
||||
|
||||
procedure LoadBackupInfo(var BackupInfo: TBackupInfo; const Path:string);
|
||||
var i:integer;
|
||||
@ -1159,7 +1160,19 @@ begin
|
||||
// object inspector
|
||||
FObjectInspectorOptions.Load;
|
||||
FObjectInspectorOptions.SaveBounds:=false;
|
||||
|
||||
|
||||
for i := 0 to IDEEditorGroups.Count - 1 do begin
|
||||
Rec := IDEEditorGroups[i];
|
||||
name := Rec^.GroupClass.ClassName;
|
||||
Rec^.Collapsed := XMLConfig.GetValue('OptionDialog/Tree/' + name + '/Value', False);
|
||||
if Rec^.Items <> nil then begin
|
||||
for j := 0 to Rec^.Items.Count - 1 do begin
|
||||
Rec^.Items[j]^.Collapsed := XMLConfig.GetValue('OptionDialog/Tree/' + name
|
||||
+ '/' + Rec^.Items[j]^.EditorClass.ClassName + '/Value', False);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
FileUpdated;
|
||||
except
|
||||
// ToDo
|
||||
@ -1171,6 +1184,9 @@ end;
|
||||
procedure TEnvironmentOptions.Save(OnlyDesktop: boolean);
|
||||
var XMLConfig: TXMLConfig;
|
||||
Path: String;
|
||||
i, j: Integer;
|
||||
name: String;
|
||||
Rec: PIDEOptionsGroupRec;
|
||||
|
||||
procedure SaveBackupInfo(var BackupInfo: TBackupInfo; Path:string);
|
||||
var i:integer;
|
||||
@ -1415,6 +1431,20 @@ begin
|
||||
FObjectInspectorOptions.SaveBounds:=false;
|
||||
FObjectInspectorOptions.Save;
|
||||
|
||||
for i := 0 to IDEEditorGroups.Count - 1 do begin
|
||||
Rec := IDEEditorGroups[i];
|
||||
name := Rec^.GroupClass.ClassName;
|
||||
XMLConfig.SetDeleteValue('OptionDialog/Tree/' + name + '/Value',
|
||||
Rec^.Collapsed, False);
|
||||
if Rec^.Items <> nil then begin
|
||||
for j := 0 to Rec^.Items.Count - 1 do begin
|
||||
XMLConfig.SetDeleteValue('OptionDialog/Tree/' + name
|
||||
+ '/' + Rec^.Items[j]^.EditorClass.ClassName + '/Value',
|
||||
Rec^.Items[j]^.Collapsed, False);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
XMLConfig.Flush;
|
||||
FileUpdated;
|
||||
except
|
||||
|
@ -107,6 +107,7 @@ type
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||
class function DefaultCollapseChildNodes: Boolean; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -393,6 +394,11 @@ begin
|
||||
Result := TEditorOptions;
|
||||
end;
|
||||
|
||||
class function TEditorMouseOptionsFrame.DefaultCollapseChildNodes: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterIDEOptionsEditor(GroupEditor, TEditorMouseOptionsFrame, EdtOptionsMouse);
|
||||
end.
|
||||
|
@ -3,7 +3,6 @@ object IDEOptionsDialog: TIDEOptionsDialog
|
||||
Height = 500
|
||||
Top = 304
|
||||
Width = 700
|
||||
ActiveControl = CategoryTree
|
||||
BorderIcons = [biSystemMenu]
|
||||
Caption = 'IDEOptionsDialog'
|
||||
ClientHeight = 500
|
||||
@ -45,6 +44,8 @@ object IDEOptionsDialog: TIDEOptionsDialog
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
OnChange = CategoryTreeChange
|
||||
OnCollapsed = CategoryTreeCollapsed
|
||||
OnExpanded = CategoryTreeExpanded
|
||||
OnKeyDown = CategoryTreeKeyDown
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||
end
|
||||
|
@ -41,8 +41,9 @@ type
|
||||
TIDEOptionsDialog = class(TAbstractOptionsEditorDialog)
|
||||
ButtonPanel: TButtonPanel;
|
||||
CategoryTree: TTreeView;
|
||||
|
||||
procedure CategoryTreeChange(Sender: TObject; Node: TTreeNode);
|
||||
procedure CategoryTreeCollapsed(Sender: TObject; Node: TTreeNode);
|
||||
procedure CategoryTreeExpanded(Sender: TObject; Node: TTreeNode);
|
||||
procedure CategoryTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure HelpButtonClick(Sender: TObject);
|
||||
@ -152,6 +153,26 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.CategoryTreeCollapsed(Sender: TObject; Node: TTreeNode);
|
||||
begin
|
||||
if node.Deleting then exit;
|
||||
if (Node.Data <> nil) then
|
||||
TAbstractIDEOptionsEditor(Node.Data).Rec^.Collapsed := True
|
||||
else
|
||||
if (Node.GetFirstChild <> nil) and (Node.GetFirstChild.Data <> nil) then
|
||||
TAbstractIDEOptionsEditor(Node.GetFirstChild.Data).GroupRec^.Collapsed := True;
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.CategoryTreeExpanded(Sender: TObject; Node: TTreeNode);
|
||||
begin
|
||||
if node.Deleting then exit;
|
||||
if (Node.Data <> nil) then
|
||||
TAbstractIDEOptionsEditor(Node.Data).Rec^.Collapsed := False
|
||||
else
|
||||
if (Node.GetFirstChild <> nil) and (Node.GetFirstChild.Data <> nil) then
|
||||
TAbstractIDEOptionsEditor(Node.GetFirstChild.Data).GroupRec^.Collapsed := False;
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.CategoryTreeKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
var
|
||||
@ -409,11 +430,17 @@ begin
|
||||
ItemNode := CategoryTree.Items.AddChild(ItemParent, Instance.GetTitle);
|
||||
ItemNode.Data := Instance;
|
||||
|
||||
ItemParent.Expanded := True;
|
||||
if ItemParent.Data <> nil then begin
|
||||
Instance := TAbstractIDEOptionsEditor(ItemParent.Data);
|
||||
ItemParent.Expanded := not Instance.Rec^.Collapsed;
|
||||
end;
|
||||
if IDEEditorGroups.LastSelected = Rec^.Items[j] then
|
||||
SelectNode := ItemNode;
|
||||
end;
|
||||
GroupNode.Expanded := True;
|
||||
if (GroupNode.GetFirstChild <> nil) and (GroupNode.GetFirstChild.Data <> nil) then
|
||||
TAbstractIDEOptionsEditor(GroupNode.GetFirstChild.Data).GroupRec := Rec;
|
||||
GroupNode.Expanded := not Rec^.Collapsed;
|
||||
//GroupNode.Data := Rec;
|
||||
end;
|
||||
end;
|
||||
if SelectNode <> nil then
|
||||
|
@ -70,6 +70,7 @@ type
|
||||
{ TAbstractIDEOptionsEditor }
|
||||
|
||||
PIDEOptionsEditorRec = ^TIDEOptionsEditorRec;
|
||||
PIDEOptionsGroupRec = ^TIDEOptionsGroupRec;
|
||||
|
||||
TAbstractIDEOptionsEditor = class(TFrame)
|
||||
private
|
||||
@ -77,6 +78,7 @@ type
|
||||
FOnLoadIDEOptions: TOnLoadIDEOptions;
|
||||
FOnSaveIDEOptions: TOnSaveIDEOptions;
|
||||
FRec: PIDEOptionsEditorRec;
|
||||
FGroupRec: PIDEOptionsGroupRec;
|
||||
protected
|
||||
procedure DoOnChange;
|
||||
public
|
||||
@ -86,11 +88,13 @@ type
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); virtual; abstract;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); virtual; abstract;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; virtual; abstract;
|
||||
class function DefaultCollapseChildNodes: Boolean; virtual;
|
||||
|
||||
property OnLoadIDEOptions: TOnLoadIDEOptions read FOnLoadIDEOptions write FOnLoadIDEOptions;
|
||||
property OnSaveIDEOptions: TOnSaveIDEOptions read FOnSaveIDEOptions write FOnSaveIDEOptions;
|
||||
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
||||
property Rec: PIDEOptionsEditorRec read FRec write FRec;
|
||||
property GroupRec: PIDEOptionsGroupRec read FGroupRec write FGroupRec;
|
||||
end;
|
||||
TAbstractIDEOptionsEditorClass = class of TAbstractIDEOptionsEditor;
|
||||
|
||||
@ -98,6 +102,7 @@ type
|
||||
Index: Integer;
|
||||
Parent: Integer;
|
||||
EditorClass: TAbstractIDEOptionsEditorClass;
|
||||
Collapsed: Boolean;
|
||||
end;
|
||||
|
||||
{ TIDEOptionsEditorList }
|
||||
@ -119,8 +124,8 @@ type
|
||||
Index: Integer;
|
||||
GroupClass: TAbstractIDEOptionsClass;
|
||||
Items: TIDEOptionsEditorList;
|
||||
Collapsed: Boolean;
|
||||
end;
|
||||
PIDEOptionsGroupRec = ^TIDEOptionsGroupRec;
|
||||
|
||||
{ TIDEOptionsGroupList }
|
||||
|
||||
@ -340,6 +345,11 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
class function TAbstractIDEOptionsEditor.DefaultCollapseChildNodes: Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{ TIDEOptionsEditorList }
|
||||
|
||||
function TIDEOptionsEditorList.GetItem(AIndex: Integer): PIDEOptionsEditorRec;
|
||||
@ -386,6 +396,7 @@ begin
|
||||
New(Result);
|
||||
Result^.Index := AIndex;
|
||||
Result^.Parent := AParent;
|
||||
Result^.Collapsed := AEditorClass.DefaultCollapseChildNodes;
|
||||
inherited Add(Result);
|
||||
end;
|
||||
|
||||
@ -481,6 +492,7 @@ begin
|
||||
New(Result);
|
||||
Result^.Index := AGroupIndex;
|
||||
Result^.Items := nil;
|
||||
Result^.Collapsed := False;
|
||||
inherited Add(Result);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user