Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003958 [JEDI VCL] 00 JVCL Components feature always 2006-10-16 05:37 2007-06-24 07:21
Reporter Kiriakos View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0003958: JvDocking - Improve SaveDockTreeToAppStorage
Description We can reduce the size of the the saved information and the speed of saving and loading docking layouts by introducing the following change in JvDockInfo.pas. (It does not store default integer and boolean values).

{$IFDEF USEJVCL}

procedure TJvDockInfoTree.ScanTreeZone(TreeZone: TJvDockBaseZone);
var
  I: Integer;
  OldPath: string;

  procedure WriteIntegerIfNonZero(const Path: string; Value: Integer);
  begin
    if Value <> 0 then
      fAppStorage.WriteInteger(Path, Value);
  end;

  procedure WriteBooleanIfFalse(const Path: string; Value: Boolean);
  begin
    if not Value then // True is the default in AppStorage.ReadBoolean
      fAppStorage.WriteBoolean(Path, Value);
  end;


begin
  if FJvDockInfoStyle = isJVCLReadInfo then { JVCL Mode persistance : READ }
  begin
    for I := 0 to TreeZone.GetChildCount - 1 do
      with TJvDockInfoZone(TreeZone.GetChildZone(I)) do
        DockControl := FindDockForm(DockFormName);
    SetDockControlInfo(TJvDockInfoZone(TreeZone));
  end
  else
  if FJvDockInfoStyle = isJVCLWriteInfo then { JVCL Mode persistance : WRITE }
  begin
    if TreeZone <> TopTreeZone then
      with TJvDockInfoZone(TreeZone), FAppStorage do
      begin
        OldPath := Path;
        try
          Path := ConcatPaths([Path, AppStoragePath, 'Forms']);
          WriteString('FormNames', ReadString('FormNames') + DockFormName + ';');
          Path := ConcatPaths([Path, DockFormName]);
          WriteString('ParentName', ParentName);
          WriteIntegerIfNonZero('DockLeft', DockRect.Left);
          WriteIntegerIfNonZero('DockTop', DockRect.Top);
          WriteIntegerIfNonZero('DockRight', DockRect.Right);
          WriteIntegerIfNonZero('DockBottom', DockRect.Bottom);
          WriteString('LastDockSiteName', LastDockSiteName);
          WriteIntegerIfNonZero('UnDockLeft', UnDockLeft);
          WriteIntegerIfNonZero('UnDockTop', UnDockTop);
          WriteIntegerIfNonZero('LRDockWidth', LRDockWidth);
          WriteIntegerIfNonZero('TBDockHeight', TBDockHeight);
          WriteIntegerIfNonZero('UnDockWidth', UnDockWidth);
          WriteIntegerIfNonZero('UnDockHeight', UnDockHeight);
          WriteIntegerIfNonZero('VSPaneWidth', VSPaneWidth);
          WriteBooleanIfFalse('Visible', Visible);
          WriteIntegerIfNonZero('BorderStyle', Integer(BorderStyle));
          WriteIntegerIfNonZero('FormStyle', Integer(FormStyle));
          WriteIntegerIfNonZero('WindowState', Integer(WindowState));
          WriteIntegerIfNonZero('DockFormStyle', Integer(DockFormStyle));
          WriteBooleanIfFalse('CanDocked', CanDocked);
          WriteBooleanIfFalse('EachOtherDocked', EachOtherDocked);
          WriteBooleanIfFalse('LeftDocked', LeftDocked);
          WriteBooleanIfFalse('TopDocked', TopDocked);
          WriteBooleanIfFalse('RightDocked', RightDocked);
          WriteBooleanIfFalse('BottomDocked', BottomDocked);
          WriteBooleanIfFalse('CustomDocked', CustomDocked); {NEW!}
          WriteString('DockClientData', DockClientData);
        finally
          FAppStorage.Path := OldPath;
        end;
      end;
  end;
  inherited ScanTreeZone(TreeZone);
end;

Additional Information
Tags No tags attached.
Attached Files ? file icon JvDockInfo.diff [^] (3,520 bytes) 2007-06-23 10:28

- Relationships

-  Notes
(0010528)
obones (administrator)
2007-01-04 04:24

Wouldn't it be better to use the same behaviour as the DFM streaming system that uses the default values for properties? And this default value is not always 0 or True.
(0011301)
Kiriakos (reporter)
2007-03-10 05:54

That would require using WritePersistent on a TreeZone (TJvDockInfoZone type). Currently TJvDockInfoZone inherits from TObject and not TPersistent. So a few more changes would be required.

The suggested change achieves huge reduction in storage space with minimal code changes.
(0011524)
remkobonte (developer)
2007-03-20 15:32

Sounds like a good idea, but the problem I see is the DefaultIfValueNotExists property of TJvAppStorageOptions. If for some reason the user chooses to set DefaultIfValueNotExists to False, then it is undefined how the code works..
(0011528)
Kiriakos (reporter)
2007-03-20 20:55

Absolutely right! Did not see that.

One painless solution is in TJvDockInfoTree.CreateZoneAndAddInfoFromAppStorage to set DefaultIfValueNotExists to True storing the old value and then restoring it at exit.
(0013460)
obones (administrator)
2007-06-19 08:30

Please provide patch files, it makes integration MUCH easier especially when other changes have been made in between. Use TortoiseSVN to create the patch files as it makes merging much easier for us. Thanks.
(0013519)
Kiriakos (reporter)
2007-06-23 10:28

Patch file attached.
(0013534)
AHUser (developer)
2007-06-24 07:21

Added to SVN

- Issue History
Date Modified Username Field Change
2006-10-16 05:37 Kiriakos New Issue
2007-01-04 04:24 obones Note Added: 0010528
2007-01-04 04:24 obones Status new => feedback
2007-03-10 05:54 Kiriakos Note Added: 0011301
2007-03-20 15:32 remkobonte Note Added: 0011524
2007-03-20 20:55 Kiriakos Note Added: 0011528
2007-06-19 08:30 obones Note Added: 0013460
2007-06-23 10:28 Kiriakos File Added: JvDockInfo.diff
2007-06-23 10:28 Kiriakos Note Added: 0013519
2007-06-24 07:21 AHUser Status feedback => resolved
2007-06-24 07:21 AHUser Fixed in Version => Daily / SVN
2007-06-24 07:21 AHUser Resolution open => fixed
2007-06-24 07:21 AHUser Assigned To => AHUser
2007-06-24 07:21 AHUser Note Added: 0013534


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker