diff --git a/components/virtualtreeview-unstable/VTConfig.inc b/components/virtualtreeview-unstable/VTConfig.inc index 73274edc0..5384f960d 100644 --- a/components/virtualtreeview-unstable/VTConfig.inc +++ b/components/virtualtreeview-unstable/VTConfig.inc @@ -36,3 +36,8 @@ {.$define EnableAccessible} {$define UseExternalDragManager} {$define UseDelphiCompat} + +//under linux the performance is poor with threading enabled +{$ifdef Windows} + {$define EnableThreadSupport} +{$endif} diff --git a/components/virtualtreeview-unstable/VirtualTrees.pas b/components/virtualtreeview-unstable/VirtualTrees.pas index 98483fdec..ecff02137 100644 --- a/components/virtualtreeview-unstable/VirtualTrees.pas +++ b/components/virtualtreeview-unstable/VirtualTrees.pas @@ -11730,8 +11730,9 @@ begin {$ifdef UseLocalMemoryManager} FNodeMemoryManager := TVTNodeMemoryManager.Create; {$endif UseLocalMemoryManager} - + {$ifdef EnableThreadSupport} AddThreadReference; + {$endif} end; //---------------------------------------------------------------------------------------------------------------------- @@ -11740,7 +11741,9 @@ destructor TBaseVirtualTree.Destroy; begin Exclude(FOptions.FMiscOptions, toReadOnly); + {$ifdef EnableThreadSupport} ReleaseThreadReference(Self); + {$endif} StopWheelPanning; CancelEditNode; @@ -13350,7 +13353,7 @@ var begin DoStateChange([tsStopValidation], [tsUseCache]); - + {$ifdef EnableThreadSupport} // Check the worker thread existance. It might already be gone (usually on destruction of the last tree). if Assigned(WorkerThread) then begin @@ -13377,6 +13380,7 @@ begin else // Remove any pending validation. WorkerThread.RemoveTree(Self); end; + {$endif} end; //---------------------------------------------------------------------------------------------------------------------- @@ -23800,12 +23804,14 @@ begin InterruptValidation; FStartIndex := 0; + {$ifdef EnableThreadSupport} if tsValidationNeeded in FStates then begin // Tell the thread this tree needs actually something to do. WorkerThread.AddTree(Self); WorkEvent.SetEvent; end; + {$endif} end; //---------------------------------------------------------------------------------------------------------------------- diff --git a/components/virtualtreeview-unstable/demos/mininal/Main.lfm b/components/virtualtreeview-unstable/demos/mininal/Main.lfm index c821e0910..8ebcf663d 100644 --- a/components/virtualtreeview-unstable/demos/mininal/Main.lfm +++ b/components/virtualtreeview-unstable/demos/mininal/Main.lfm @@ -1,7 +1,7 @@ object MainForm: TMainForm - Left = 353 + Left = 437 Height = 481 - Top = 172 + Top = 278 Width = 425 HorzScrollBar.Page = 424 VertScrollBar.Page = 480 @@ -14,7 +14,7 @@ object MainForm: TMainForm Left = 12 Height = 14 Top = 12 - Width = 117 + Width = 152 Caption = 'Last operation duration:' Color = clNone ParentColor = False diff --git a/components/virtualtreeview-unstable/demos/mininal/Main.lrs b/components/virtualtreeview-unstable/demos/mininal/Main.lrs index 79ba46ff3..196030928 100644 --- a/components/virtualtreeview-unstable/demos/mininal/Main.lrs +++ b/components/virtualtreeview-unstable/demos/mininal/Main.lrs @@ -1,15 +1,13 @@ -{ This is an automatically generated lazarus resource file } - LazarusResources.Add('TMainForm','FORMDATA',[ - 'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3'a'#1#6'Height'#3#225#1#3'Top'#3#172 - +#0#5'Width'#3#169#1#18'HorzScrollBar.Page'#3#168#1#18'VertScrollBar.Page'#3 + 'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#181#1#6'Height'#3#225#1#3'Top'#3#22 + +#1#5'Width'#3#169#1#18'HorzScrollBar.Page'#3#168#1#18'VertScrollBar.Page'#3 +#224#1#13'ActiveControl'#7#3'VST'#7'Caption'#6#28'Simple Virtual Treeview de' +'mo'#11'Font.Height'#2#245#9'Font.Name'#6#13'MS Sans Serif'#8'OnCreate'#7#10 +'FormCreate'#0#6'TLabel'#6'Label1'#4'Left'#2#12#6'Height'#2#14#3'Top'#2#12#5 - +'Width'#2'u'#7'Caption'#6#24'Last operation duration:'#5'Color'#7#6'clNone' - +#11'ParentColor'#8#0#0#18'TVirtualStringTree'#3'VST'#4'Left'#2#8#6'Height'#3 - +'>'#1#3'Top'#2'$'#5'Width'#3#141#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRigh' - +'t'#8'akBottom'#0#11'BorderStyle'#7#8'bsSingle'#18'Colors.BorderColor'#7#12 + +'Width'#3#152#0#7'Caption'#6#24'Last operation duration:'#5'Color'#7#6'clNon' + +'e'#11'ParentColor'#8#0#0#18'TVirtualStringTree'#3'VST'#4'Left'#2#8#6'Height' + +#3'>'#1#3'Top'#2'$'#5'Width'#3#141#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRi' + +'ght'#8'akBottom'#0#11'BorderStyle'#7#8'bsSingle'#18'Colors.BorderColor'#7#12 +'clWindowText'#15'Colors.HotColor'#7#7'clBlack'#5'Ctl3D'#9#20'Header.AutoSiz' +'eIndex'#2#255#18'Header.Font.Height'#2#245#16'Header.Font.Name'#6#13'MS San' +'s Serif'#17'Header.MainColumn'#2#255#14'Header.Options'#11#14'hoColumnResiz' diff --git a/components/virtualtreeview-unstable/demos/mininal/Main.pas b/components/virtualtreeview-unstable/demos/mininal/Main.pas index a0699274b..0d72352b9 100644 --- a/components/virtualtreeview-unstable/demos/mininal/Main.pas +++ b/components/virtualtreeview-unstable/demos/mininal/Main.pas @@ -1,7 +1,7 @@ unit Main; {$MODE Delphi} -{$define DEBUG} +{.$define DEBUG} // Demonstration project for TVirtualStringTree to generally show how to get started. // Written by Mike Lischke. diff --git a/components/virtualtreeview-unstable/demos/mininal/minimal_lcl.lpi b/components/virtualtreeview-unstable/demos/mininal/minimal_lcl.lpi index c4f7cf33d..6c8bdcb12 100644 --- a/components/virtualtreeview-unstable/demos/mininal/minimal_lcl.lpi +++ b/components/virtualtreeview-unstable/demos/mininal/minimal_lcl.lpi @@ -1,7 +1,7 @@ - + @@ -26,16 +26,13 @@ - + - - - - + @@ -59,7 +56,7 @@ - + @@ -67,7 +64,6 @@ - diff --git a/components/virtualtreeview-unstable/demos/mininal/minimal_lcl.lpr b/components/virtualtreeview-unstable/demos/mininal/minimal_lcl.lpr index 507099338..9b31f8c92 100644 --- a/components/virtualtreeview-unstable/demos/mininal/minimal_lcl.lpr +++ b/components/virtualtreeview-unstable/demos/mininal/minimal_lcl.lpr @@ -8,7 +8,7 @@ uses {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset Forms - { add your units here }, Main, miscutils_package, virtualtreeview_package, + { add your units here }, Main, virtualtreeview_package, mmsystem; begin diff --git a/components/virtualtreeview-unstable/demos/objects/mvcdemo.lpi b/components/virtualtreeview-unstable/demos/objects/mvcdemo.lpi index 3eac47e8b..f6ba1e087 100644 --- a/components/virtualtreeview-unstable/demos/objects/mvcdemo.lpi +++ b/components/virtualtreeview-unstable/demos/objects/mvcdemo.lpi @@ -1,7 +1,7 @@ - + @@ -65,7 +65,6 @@ -