View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003958 | JEDI VCL | 00 JVCL Components | public | 2006-10-16 05:37 | 2007-06-24 07:21 |
Reporter | Kiriakos | Assigned To | AHUser | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | 3.34 | |||
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; | ||||
Tags | No tags attached. | ||||
|
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. |
|
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. |
|
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.. |
|
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. |
|
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. |
2007-06-23 10:28
|
JvDockInfo.diff (3,520 bytes)
411a412 > OldDefaultIfValueNotExists : Boolean; 474a476,477 > OldDefaultIfValueNotExists := FAppStorage.StorageOptions.DefaultIfValueNotExists; > FAppStorage.StorageOptions.DefaultIfValueNotExists := True; 499a503 > FAppStorage.StorageOptions.DefaultIfValueNotExists := OldDefaultIfValueNotExists; 780a785,798 > > 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 > fAppStorage.WriteBoolean(Path, Value); > end; > > 801,804c819,822 < WriteInteger('DockLeft', DockRect.Left); < WriteInteger('DockTop', DockRect.Top); < WriteInteger('DockRight', DockRect.Right); < WriteInteger('DockBottom', DockRect.Bottom); --- > WriteIntegerIfNonZero('DockLeft', DockRect.Left); > WriteIntegerIfNonZero('DockTop', DockRect.Top); > WriteIntegerIfNonZero('DockRight', DockRect.Right); > WriteIntegerIfNonZero('DockBottom', DockRect.Bottom); 806,824c824,842 < WriteInteger('UnDockLeft', UnDockLeft); < WriteInteger('UnDockTop', UnDockTop); < WriteInteger('LRDockWidth', LRDockWidth); < WriteInteger('TBDockHeight', TBDockHeight); < WriteInteger('UnDockWidth', UnDockWidth); < WriteInteger('UnDockHeight', UnDockHeight); < WriteInteger('VSPaneWidth', VSPaneWidth); < WriteBoolean('Visible', Visible); < WriteInteger('BorderStyle', Integer(BorderStyle)); < WriteInteger('FormStyle', Integer(FormStyle)); < WriteInteger('WindowState', Integer(WindowState)); < WriteInteger('DockFormStyle', Integer(DockFormStyle)); < WriteBoolean('CanDocked', CanDocked); < WriteBoolean('EachOtherDocked', EachOtherDocked); < WriteBoolean('LeftDocked', LeftDocked); < WriteBoolean('TopDocked', TopDocked); < WriteBoolean('RightDocked', RightDocked); < WriteBoolean('BottomDocked', BottomDocked); < WriteBoolean('CustomDocked', CustomDocked); {NEW!} --- > 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!} |
|
Patch file attached. |
|
Added to SVN |
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 |