mORMot and Open Source friends
Check-in [186436fe21]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:
  • fixed issue in TSQLRestServerStats.DebugMessage
  • introducing LogView sample application
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 186436fe21feba7d1f56577e6798f28cc484312a
User & Date: ab 2011-04-20 16:03:31
Context
2011-04-20
19:07
TMS compatibility enhanced check-in: 416981ca8e user: ab tags: trunk
16:03
  • fixed issue in TSQLRestServerStats.DebugMessage
  • introducing LogView sample application
check-in: 186436fe21 user: ab tags: trunk
2011-04-19
20:36
  • fixed compilation issue with Delphi 2009/2010/XE
  • enhanced mime detection from file name
check-in: cd47cf4439 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite3/SQLite3Commons.pas.

12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
end;

resourcestring
  sRestServerStatsDebugMessage =
    'Clients now=%d max=%d'#13+
    'Data in=%s out=%s'#13+
    'Requests=%d Updates=%d Invalid=%d'
{$ifdef MSWINDOWS}
    +#13'Time spent in requests = %s'
{$endif};

procedure TSQLRestServerStats.ClientDisconnect;
begin
  if ClientsCurrent>0 then
    dec(ClientsCurrent);






|







12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
end;

resourcestring
  sRestServerStatsDebugMessage =
    'Clients now=%d max=%d'#13+
    'Data in=%s out=%s'#13+
    'Requests=%d Updates=%d Invalid=%d'
{$ifdef WITHSTATPROCESS}
    +#13'Time spent in requests = %s'
{$endif};

procedure TSQLRestServerStats.ClientDisconnect;
begin
  if ClientsCurrent>0 then
    dec(ClientsCurrent);

Changes to SQLite3/SQLite3ToolBar.pas.

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
...
205
206
207
208
209
210
211





212
213
214
215
216
217
218
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
...
435
436
437
438
439
440
441

442
443
444
445
446
447
448
449
450
451
452
453
....
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
....
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729






1730

1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
....
1919
1920
1921
1922
1923
1924
1925

1926
1927
1928
1929
1930
1931
1932
....
2007
2008
2009
2010
2011
2012
2013

2014
2015
2016
2017
2018
2019
2020


2021
2022
2023
2024
2025
2026
2027
....
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
....
2095
2096
2097
2098
2099
2100
2101
2102

2103



2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119

2120
2121

2122
2123
2124
2125
2126
2127
2128
....
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
    procedure Change; override;
    function GetSynPage(aIndex: integer): TSynPage; {$ifdef HASINLINE}inline;{$endif}
    procedure GroupLabelClick(Sender: TObject);
  public
    /// create the ribbon pager on a form
    // - reserve some above space for groups, caption and min/max/close buttons,
    // so that FormNoCaption method can be called later
    class function CreatePager(aOwner: TCustomForm): TSynPager;
    /// add a page instance
    function AddPage(aPage: TSynPage): integer; overload;
    /// create a new page with the specified caption
    function AddPage(const aCaption: string): integer; overload;
    /// create a group label starting for the given page indexes
    function TabGroupsAdd(TabIndexStart, TabIndexEnd: integer; const aCaption: string): TLabel;
    /// hide TSynForm caption bar and put caption and buttons at groups right
................................................................................

  /// body page used to display the list and the report on the client screen
  TSynBodyPage = TSynPage;

  
const
  bsCheck = tbsCheck;






{$else USETMSPACK}
type
  TSynToolButton = TAdvGlowButton;
  TSynPopupMenu = TAdvPopupMenu;
  TSynBodyPage = TAdvOfficePage;
  TSynBodyPager = TAdvOfficePager;
................................................................................
  protected
    function GetSynPage(aIndex: integer): TSynPage;
      {$ifdef HASINLINE}inline;{$endif}
    function GetSynPageCount: integer;
      {$ifdef HASINLINE}inline;{$endif}
  public
    /// create the ribbon pager on a form
    class function CreatePager(aOwner: TCustomForm): TSynPager;
    /// add page instance
    function AddPage(aPage: TSynPage): integer; overload;
    /// create a new page with the specified caption
    function AddPage(const aCaption: string): integer; overload;
    /// mimic TTabSheet.Pages property
    property Pages[aIndex: Integer]: TSynPage read GetSynPage;
    /// mimic TTabSheet.PageCount property
................................................................................
    ButtonClick: TNotifyEvent;
    ShortCutUsed: TFreeShortCut;
    ImageList: TImageList;
    Buttons: array of TSynToolButton;
    Toolbars: array of TSynToolBar;
    ImageListFirstIndex: integer;
    /// call this method first to initialize the ribbon

    // - if aToolbarOrPage is a TSynPager descendant, a new page is created
    // and added to this TSynPager, and used for toolbars adding
    // - if aToolbarOrPage is a TSynPage descendant, the toolbar is added to
    // this specified Page
    procedure Init(aToolbarOrPage: TCustomControl; aEnum: PTypeInfo;
      aButtonClick: TNotifyEvent; aImageList: TImageList; const aActionHints: string;
      aImageListFirstIndex: integer=0);
    /// call this method for every toobar, with appropriate bits set for its buttons
    function AddToolBar(const ToolBarName: string; ActionsBits: pointer=nil;
      ButtonWidth: integer=60): TSynToolBar;
    /// create a popup menu item for a button
    // - call with aCaption void to clear the menu first
................................................................................

function TSQLCustomToolBar.AddToolBar(const ToolBarName: string;
  ActionsBits: pointer=nil; ButtonWidth: integer=60): TSynToolBar;
var TypeName: PShortString;
    iAction: integer;
    ActionNames: TStringDynArray;
begin
  if ActionsEnum=nil then
    // no enum -> add a void toolbar
    result := Page.CreateToolBar else begin
    result := nil;
    if ActionsBits<>nil then
      for iAction := 0 to ActionsEnum^.MaxValue do
        if GetBit(ActionsBits^,iAction) then begin
          result := Page.CreateToolBar;
          break;
        end;
  end;
  SetLength(ToolBars,length(ToolBars)+1); // ToolBars[] index is OK
  if result=nil then
    exit; // only create the toolbar if any button to put inside ;)
  ToolBars[high(ToolBars)] := result;
  try
{$ifdef USETMSPACK}
................................................................................
        result.OnClick := aOnClick;
        result.Tag := aTag;
        DropDownMenu.Items.Add(result);
      end;
    end;
end;

procedure TSQLCustomToolBar.Init(aToolbarOrPage: TCustomControl; aEnum: PTypeInfo;
  aButtonClick: TNotifyEvent; aImageList: TImageList; const aActionHints: string;
  aImageListFirstIndex: integer);
var ToolBar: TSynPager absolute aToolbarOrPage;
begin






  if aToolbarOrPage.InheritsFrom(TSynPager) then begin

{$ifdef USETMSPACK}
    if ToolBar.Parent.InheritsFrom(TSynForm) then
      ToolBar.MinimizeApp := false; // so WMSyscommand method will be called below
{$endif}
    Page := TSQLLister.AddPage(ToolBar,nil,'',False);
  end else
  if aToolbarOrPage.InheritsFrom(TSynPage) then
    Page := pointer(aToolbarOrPage) else
    assert(false);
  if aEnum^.Kind=tkEnumeration then begin
    ActionsEnum := aEnum^.EnumBaseType;
    SetLength(Buttons,ActionsEnum^.MaxValue+1);
................................................................................

function TSynToolButton.Images: TCustomImageList;
begin
  if Owner.InheritsFrom(TToolBar) then
    result := TToolBar(Owner).Images else
    result := nil;
end;


{ TSynPage }

const
  TOOLBAR_SPACE = 20;

function TSynPage.GetToolBarNextLeft(var Last: TSynToolBar): integer;
................................................................................
       Bev.SetBounds(Left,Top+Height+1,Width,2);
       Lab.Caption := Caption;
     end;
     Bev.Shape := bsTopLine;
  end;
  fToolBarCaptionsCount := n;
end;


{ TSynPager }

function TSynPager.AddPage(aPage: TSynPage): integer;
begin
  aPage.PageControl := self;
  result := PageCount-1;


end;

function TSynPager.AddPage(const aCaption: string): integer;
var aPage: TSynPage;
begin
  aPage := TSynPage.Create(self);
  aPage.Parent := self;
................................................................................
  if fHelpToolBar<>nil then begin
    Pag := ActivePage as TSynPage;
    fHelpToolBar.Parent := Pag;
    fHelpToolBar.Left := Pag.GetToolBarNextLeft(Last);
  end;
end;

const
  TOOLBAR_HEIGHT = 114;
  TOOLBAR_GROUPS_HEIGHT = 20;

function TSynPager.TabGroupsAdd(TabIndexStart, TabIndexEnd: integer; const aCaption: string): TLabel;
begin
  assert(TopMostPanel<>nil,'expect TSynPager.CreatePager');
  result := TLabel.Create(TopMostPanel);
  result.Font := DefaultFont;
  result.Parent := TopMostPanel;
  result.Font.Color := clGrayText;
................................................................................

procedure TSynPager.GroupLabelClick(Sender: TObject);
begin
  if Sender.InheritsFrom(TLabel) then
    ActivePageIndex := TLabel(Sender).Tag;
end;

class function TSynPager.CreatePager(aOwner: TCustomForm): TSynPager;

begin



  result := TSynPager.Create(aOwner);
  result.fTopMostPanel := TPanel.Create(aOwner);
  with result.fTopMostPanel do begin
    Parent := aOwner;
    Height := TOOLBAR_HEIGHT+TOOLBAR_GROUPS_HEIGHT;
    Align := alTop;
  end;
  result.fTopPanel := TPanel.Create(aOwner);
  with result.fTopPanel do begin
    Parent := result.fTopMostPanel;
    Height := result.fTopMostPanel.ClientHeight-TOOLBAR_GROUPS_HEIGHT;
    Align := alBottom;
  end;
  result.Parent := result.fTopPanel;
  result.Height := TOOLBAR_HEIGHT;
  result.HotTrack := true;

  result.TabHeight := 22;
  result.TabWidth := 85;

  result.Font := DefaultFont;
  result.Align := alTop;
end;

function TSynPager.GetHelpButton: TSynToolButton;
var Pag: TSynPage;
begin
................................................................................
function TSynPage.ToolBarCount: integer;
begin
  result := AdvToolBarCount;
end;

{ TSynPager }

class function TSynPager.CreatePager(aOwner: TCustomForm): TSynPager;
begin
  result := TSynPager.Create(aOwner);
  result.Parent := aOwner;
  result.Height := 145;
  result.ToolBarStyler := TAdvToolBarOfficeStyler.Create(aOwner);
  TAdvToolBarOfficeStyler(result.ToolBarStyler).Style := bsOffice2007Luna;
end;






|







 







>
>
>
>
>







 







|







 







>




|







 







|



<
|
|
|
|
|







 







|




>
>
>
>
>
>

>




|







 







>







 







>







>
>







 







<
<
<
<







 







|
>

>
>
>




|









|

>
|
|
>







 







|







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
...
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
...
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
...
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
....
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665

1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
....
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
....
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
....
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
....
2070
2071
2072
2073
2074
2075
2076




2077
2078
2079
2080
2081
2082
2083
....
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
....
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
    procedure Change; override;
    function GetSynPage(aIndex: integer): TSynPage; {$ifdef HASINLINE}inline;{$endif}
    procedure GroupLabelClick(Sender: TObject);
  public
    /// create the ribbon pager on a form
    // - reserve some above space for groups, caption and min/max/close buttons,
    // so that FormNoCaption method can be called later
    class function CreatePager(aOwner: TCustomForm; NoTabVisible: boolean=false): TSynPager;
    /// add a page instance
    function AddPage(aPage: TSynPage): integer; overload;
    /// create a new page with the specified caption
    function AddPage(const aCaption: string): integer; overload;
    /// create a group label starting for the given page indexes
    function TabGroupsAdd(TabIndexStart, TabIndexEnd: integer; const aCaption: string): TLabel;
    /// hide TSynForm caption bar and put caption and buttons at groups right
................................................................................

  /// body page used to display the list and the report on the client screen
  TSynBodyPage = TSynPage;

  
const
  bsCheck = tbsCheck;

  TOOLBAR_HEIGHT = 114;
  TOOLBAR_GROUPS_HEIGHT = 20;
  TOOLBAR_TAB_HEIGHT = 22;


{$else USETMSPACK}
type
  TSynToolButton = TAdvGlowButton;
  TSynPopupMenu = TAdvPopupMenu;
  TSynBodyPage = TAdvOfficePage;
  TSynBodyPager = TAdvOfficePager;
................................................................................
  protected
    function GetSynPage(aIndex: integer): TSynPage;
      {$ifdef HASINLINE}inline;{$endif}
    function GetSynPageCount: integer;
      {$ifdef HASINLINE}inline;{$endif}
  public
    /// create the ribbon pager on a form
    class function CreatePager(aOwner: TCustomForm; NoTabVisible: boolean=false): TSynPager;
    /// add page instance
    function AddPage(aPage: TSynPage): integer; overload;
    /// create a new page with the specified caption
    function AddPage(const aCaption: string): integer; overload;
    /// mimic TTabSheet.Pages property
    property Pages[aIndex: Integer]: TSynPage read GetSynPage;
    /// mimic TTabSheet.PageCount property
................................................................................
    ButtonClick: TNotifyEvent;
    ShortCutUsed: TFreeShortCut;
    ImageList: TImageList;
    Buttons: array of TSynToolButton;
    Toolbars: array of TSynToolBar;
    ImageListFirstIndex: integer;
    /// call this method first to initialize the ribbon
    // - if aToolbarOrPage is a TCustomForm, this form will became a  
    // - if aToolbarOrPage is a TSynPager descendant, a new page is created
    // and added to this TSynPager, and used for toolbars adding
    // - if aToolbarOrPage is a TSynPage descendant, the toolbar is added to
    // this specified Page
    procedure Init(aToolbarOrPage: TControl; aEnum: PTypeInfo;
      aButtonClick: TNotifyEvent; aImageList: TImageList; const aActionHints: string;
      aImageListFirstIndex: integer=0);
    /// call this method for every toobar, with appropriate bits set for its buttons
    function AddToolBar(const ToolBarName: string; ActionsBits: pointer=nil;
      ButtonWidth: integer=60): TSynToolBar;
    /// create a popup menu item for a button
    // - call with aCaption void to clear the menu first
................................................................................

function TSQLCustomToolBar.AddToolBar(const ToolBarName: string;
  ActionsBits: pointer=nil; ButtonWidth: integer=60): TSynToolBar;
var TypeName: PShortString;
    iAction: integer;
    ActionNames: TStringDynArray;
begin
  if (ActionsEnum=nil) or (ActionsBits=nil) then
    // no enum -> add a void toolbar
    result := Page.CreateToolBar else begin
    result := nil;

    for iAction := 0 to ActionsEnum^.MaxValue do
      if GetBit(ActionsBits^,iAction) then begin
        result := Page.CreateToolBar;
        break;
      end;
  end;
  SetLength(ToolBars,length(ToolBars)+1); // ToolBars[] index is OK
  if result=nil then
    exit; // only create the toolbar if any button to put inside ;)
  ToolBars[high(ToolBars)] := result;
  try
{$ifdef USETMSPACK}
................................................................................
        result.OnClick := aOnClick;
        result.Tag := aTag;
        DropDownMenu.Items.Add(result);
      end;
    end;
end;

procedure TSQLCustomToolBar.Init(aToolbarOrPage: TControl; aEnum: PTypeInfo;
  aButtonClick: TNotifyEvent; aImageList: TImageList; const aActionHints: string;
  aImageListFirstIndex: integer);
var ToolBar: TSynPager absolute aToolbarOrPage;
begin
  if aToolbarOrPage.InheritsFrom(TCustomForm) then begin
    ToolBar := TSynPager.CreatePager(TCustomForm(aToolbarOrPage),true);
{$ifndef USETMSPACK}
    ToolBar.FormNoCaption;
{$endif}
  end;
  if aToolbarOrPage.InheritsFrom(TSynPager) then begin
    Page := TSQLLister.AddPage(ToolBar,nil,'',False);
{$ifdef USETMSPACK}
    if ToolBar.Parent.InheritsFrom(TSynForm) then
      ToolBar.MinimizeApp := false; // so WMSyscommand method will be called below
{$endif}
    ToolBar.ActivePageIndex := 0;
  end else
  if aToolbarOrPage.InheritsFrom(TSynPage) then
    Page := pointer(aToolbarOrPage) else
    assert(false);
  if aEnum^.Kind=tkEnumeration then begin
    ActionsEnum := aEnum^.EnumBaseType;
    SetLength(Buttons,ActionsEnum^.MaxValue+1);
................................................................................

function TSynToolButton.Images: TCustomImageList;
begin
  if Owner.InheritsFrom(TToolBar) then
    result := TToolBar(Owner).Images else
    result := nil;
end;


{ TSynPage }

const
  TOOLBAR_SPACE = 20;

function TSynPage.GetToolBarNextLeft(var Last: TSynToolBar): integer;
................................................................................
       Bev.SetBounds(Left,Top+Height+1,Width,2);
       Lab.Caption := Caption;
     end;
     Bev.Shape := bsTopLine;
  end;
  fToolBarCaptionsCount := n;
end;


{ TSynPager }

function TSynPager.AddPage(aPage: TSynPage): integer;
begin
  aPage.PageControl := self;
  result := PageCount-1;
  if TabHeight=0 then
    aPage.TabVisible := false;
end;

function TSynPager.AddPage(const aCaption: string): integer;
var aPage: TSynPage;
begin
  aPage := TSynPage.Create(self);
  aPage.Parent := self;
................................................................................
  if fHelpToolBar<>nil then begin
    Pag := ActivePage as TSynPage;
    fHelpToolBar.Parent := Pag;
    fHelpToolBar.Left := Pag.GetToolBarNextLeft(Last);
  end;
end;





function TSynPager.TabGroupsAdd(TabIndexStart, TabIndexEnd: integer; const aCaption: string): TLabel;
begin
  assert(TopMostPanel<>nil,'expect TSynPager.CreatePager');
  result := TLabel.Create(TopMostPanel);
  result.Font := DefaultFont;
  result.Parent := TopMostPanel;
  result.Font.Color := clGrayText;
................................................................................

procedure TSynPager.GroupLabelClick(Sender: TObject);
begin
  if Sender.InheritsFrom(TLabel) then
    ActivePageIndex := TLabel(Sender).Tag;
end;

class function TSynPager.CreatePager(aOwner: TCustomForm; NoTabVisible: boolean=false): TSynPager;
var H: integer;
begin
  if NoTabVisible then
    H := TOOLBAR_HEIGHT-TOOLBAR_TAB_HEIGHT else
    H := TOOLBAR_HEIGHT;
  result := TSynPager.Create(aOwner);
  result.fTopMostPanel := TPanel.Create(aOwner);
  with result.fTopMostPanel do begin
    Parent := aOwner;
    Height := H+TOOLBAR_GROUPS_HEIGHT;
    Align := alTop;
  end;
  result.fTopPanel := TPanel.Create(aOwner);
  with result.fTopPanel do begin
    Parent := result.fTopMostPanel;
    Height := result.fTopMostPanel.ClientHeight-TOOLBAR_GROUPS_HEIGHT;
    Align := alBottom;
  end;
  result.Parent := result.fTopPanel;
  result.Height := H;
  result.HotTrack := true;
  if not NoTabVisible then begin
    result.TabHeight := TOOLBAR_TAB_HEIGHT;
    result.TabWidth := 85;
  end;
  result.Font := DefaultFont;
  result.Align := alTop;
end;

function TSynPager.GetHelpButton: TSynToolButton;
var Pag: TSynPage;
begin
................................................................................
function TSynPage.ToolBarCount: integer;
begin
  result := AdvToolBarCount;
end;

{ TSynPager }

class function TSynPager.CreatePager(aOwner: TCustomForm; NoTabVisible: boolean=false): TSynPager;
begin
  result := TSynPager.Create(aOwner);
  result.Parent := aOwner;
  result.Height := 145;
  result.ToolBarStyler := TAdvToolBarOfficeStyler.Create(aOwner);
  TAdvToolBarOfficeStyler(result.ToolBarStyler).Style := bsOffice2007Luna;
end;

Added SQLite3/Samples/11 - Exception logging/LogView.dpr.


































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// sample program able to visualize .log files as created by TSynLog
program LogView;

//   first line of uses clause must be   {$I SynDprUses.inc}
uses
  {$I SynDprUses.inc}
  Forms,
  LogViewMain in 'LogViewMain.pas' {MainLogView};

{$R *.res}
{$R Vista.res}

begin
  Application.Initialize;
  Application.CreateForm(TMainLogView, MainLogView);
  Application.Run;
end.

Added SQLite3/Samples/11 - Exception logging/LogViewMain.dfm.












































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
object MainLogView: TMainLogView
  Left = 198
  Top = 114
  Width = 580
  Height = 433
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object ImageList: TImageList
    Height = 32
    Width = 32
    Left = 48
    Top = 120
  end
end

Added SQLite3/Samples/11 - Exception logging/LogViewMain.pas.
































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
unit LogViewMain;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  SynCommons, SQLite3UI, SQLite3ToolBar, ImgList;

type
  TLogViewAction =
    (lvNone);
  TLogViewActions = set of TLogViewAction;

  TMainLogView = class(TSynForm)
    ImageList: TImageList;
    procedure FormCreate(Sender: TObject);
  protected
    FLog: TSynLogFile;
    FPager: TSynPager;
    FToolBar: TSQLCustomToolBar;
    function GetLogFileName: TFileName;
    procedure SetLogFileName(const Value: TFileName);
    procedure ActionClick(Sender: TObject);
  public
    property LogFileName: TFileName read GetLogFileName write SetLogFileName;
  end;


var
  MainLogView: TMainLogView;


implementation

{$R *.dfm}

{ TMainLogView }

function TMainLogView.GetLogFileName: TFileName;
begin
  if FLog=nil then
    result := '' else
    result := FLog.FileName;
end;

procedure TMainLogView.SetLogFileName(const Value: TFileName);
begin
  FreeAndNil(FLog);
  FLog := TSynLogFile.Create(Value);

end;

procedure TMainLogView.FormCreate(Sender: TObject);
begin
  FToolBar.Init(self,TypeInfo(TLogViewAction),ActionClick,ImageList,'');
  FToolBar.AddToolBar('Test')
end;

procedure TMainLogView.ActionClick(Sender: TObject);
begin

end;

end.