IDE: messages: started load/save options

git-svn-id: trunk@45320 -
This commit is contained in:
mattias 2014-06-03 15:46:20 +00:00
parent 9ad149a4c9
commit 5dc16e0b9f
3 changed files with 75 additions and 11 deletions

View File

@ -35,13 +35,12 @@ interface
uses
Math, strutils, Classes, SysUtils, UTF8Process, FileProcs, LazFileCache,
LazUTF8Classes, LazFileUtils, LazUTF8, AvgLvlTree, SynEdit, SynEditMarks,
LResources, Forms, Buttons, ExtCtrls, Controls, LMessages, LCLType, Graphics,
LCLIntf, Themes, ImgList, GraphType, Menus, Clipbrd, Dialogs, StdCtrls,
IDEExternToolIntf, IDEImagesIntf, MenuIntf, PackageIntf, IDECommands,
SrcEditorIntf,
LazarusIDEStrConsts, EnvironmentOpts, HelpFPCMessages,
etSrcEditMarks, etQuickFixes, ExtTools;
LazUTF8Classes, LazFileUtils, LazUTF8, AvgLvlTree, LazConfigStorage, SynEdit,
SynEditMarks, LResources, Forms, Buttons, ExtCtrls, Controls, LMessages,
LCLType, Graphics, LCLIntf, Themes, ImgList, GraphType, Menus, Clipbrd,
Dialogs, StdCtrls, IDEExternToolIntf, IDEImagesIntf, MenuIntf, PackageIntf,
IDECommands, SrcEditorIntf, LazarusIDEStrConsts, EnvironmentOpts,
HelpFPCMessages, etSrcEditMarks, etQuickFixes, ExtTools;
const
CustomViewCaption = '------------------------------';
@ -70,7 +69,10 @@ type
property Index: integer read FIndex;
end;
{ TLMsgViewFilter - read/write by main thread, read by worker thread }
{ TLMsgViewFilter
Note: The View.Filter is protected by View.Enter/LeaveCriticalSection,
read/write by main thread, read by worker thread.
}
TLMsgViewFilter = class
private
@ -282,6 +284,8 @@ type
procedure EndUpdate;
procedure EraseBackground({%H-}DC: HDC); override;
procedure ApplyEnvironmentOptions;
procedure LoadFromConfig(Cfg: TConfigStorage; FileVersion: integer);
procedure SaveToConfig(Cfg: TConfigStorage);
// views
function ViewCount: integer; inline;
@ -420,6 +424,8 @@ type
destructor Destroy; override;
procedure ApplyIDEOptions;
procedure LoadFromConfig(Cfg: TConfigStorage; FileVersion: integer);
procedure SaveToConfig(Cfg: TConfigStorage);
// Views
function ViewCount: integer;
@ -2804,6 +2810,17 @@ begin
FilenameStyle:=EnvironmentOptions.MsgViewFilenameStyle;
end;
procedure TMessagesCtrl.LoadFromConfig(Cfg: TConfigStorage; FileVersion: integer
);
begin
end;
procedure TMessagesCtrl.SaveToConfig(Cfg: TConfigStorage);
begin
end;
function TMessagesCtrl.IndexOfView(View: TLMsgWndView): integer;
begin
Result:=FViews.IndexOf(View);
@ -3677,6 +3694,17 @@ begin
MessagesCtrl.ApplyEnvironmentOptions;
end;
procedure TMessagesFrame.LoadFromConfig(Cfg: TConfigStorage;
FileVersion: integer);
begin
MessagesCtrl.LoadFromConfig(Cfg,FileVersion);
end;
procedure TMessagesFrame.SaveToConfig(Cfg: TConfigStorage);
begin
MessagesCtrl.SaveToConfig(Cfg);
end;
function TMessagesFrame.ViewCount: integer;
begin
Result:=MessagesCtrl.ViewCount;

View File

@ -3,6 +3,7 @@ object MessagesView: TMessagesView
Height = 128
Top = 586
Width = 639
BorderStyle = bsSizeToolWin
Caption = 'MessagesView'
ClientHeight = 128
ClientWidth = 639

View File

@ -32,10 +32,14 @@ unit etMessagesWnd;
interface
uses
Classes, SysUtils, FileUtil, IDEMsgIntf, IDEImagesIntf, IDEExternToolIntf,
LazIDEIntf, SrcEditorIntf, SynEditMarks, Forms, Controls, Graphics, Dialogs,
LCLProc, etMessageFrame, etSrcEditMarks, etQuickFixes;
Classes, SysUtils, FileUtil, LazConfigStorage, IDEMsgIntf, IDEImagesIntf,
IDEExternToolIntf, LazIDEIntf, SrcEditorIntf, BaseIDEIntf, SynEditMarks,
Forms, Controls, Graphics, Dialogs, LCLProc, etMessageFrame, etSrcEditMarks,
etQuickFixes;
const
MsgWndOptionsFileVersion = 1;
MsgWndOptionsFilename = 'messagesoptions.xml';
type
{ TMessagesView }
@ -79,6 +83,8 @@ type
procedure SourceEditorPopup(MarkLine: TSynEditMarkLine);
// options
procedure LoadOptions;
procedure SaveOptions;
procedure ApplyIDEOptions;
property DblClickJumps: boolean read GetDblClickJumps write SetDblClickJumps;
property HideMessagesIcons: boolean read GetHideMessagesIcons write SetHideMessagesIcons;
@ -101,6 +107,8 @@ begin
MessagesFrame1.MessagesCtrl.OnOpenMessage:=@OnOpenMessage;
ActiveControl:=MessagesFrame1.MessagesCtrl;
LoadOptions;
end;
procedure TMessagesView.FormDestroy(Sender: TObject);
@ -161,6 +169,33 @@ begin
MessagesFrame1.SourceEditorPopup(MarkLine);
end;
procedure TMessagesView.LoadOptions;
var
Cfg: TConfigStorage;
FileVersion: Integer;
begin
Cfg:=GetIDEConfigStorage(MsgWndOptionsFilename,true);
try
FileVersion:=Cfg.GetValue('Version',0);
MessagesFrame1.LoadFromConfig(Cfg,FileVersion);
finally
Cfg.Free;
end;
end;
procedure TMessagesView.SaveOptions;
var
Cfg: TConfigStorage;
begin
Cfg:=GetIDEConfigStorage(MsgWndOptionsFilename,false);
try
MessagesFrame1.SaveToConfig(Cfg);
Cfg.SetValue('Version',MsgWndOptionsFileVersion);
finally
Cfg.Free;
end;
end;
procedure TMessagesView.Clear;
begin
MessagesFrame1.ClearViews(true);