diff --git a/lazproj/dexed.lpi b/lazproj/dexed.lpi index e25e00d6..457db921 100644 --- a/lazproj/dexed.lpi +++ b/lazproj/dexed.lpi @@ -881,6 +881,10 @@ + + + + diff --git a/src/u_editor.pas b/src/u_editor.pas index 0369e903..00b8367c 100644 --- a/src/u_editor.pas +++ b/src/u_editor.pas @@ -435,6 +435,8 @@ begin EntitiesConnector.addObserver(self); EntitiesConnector.addSingleService(self); + timedUpdateKind := tukDelay; + fOptions:= TPagesOptions.construct(self); end; diff --git a/src/u_main.lfm b/src/u_main.lfm index 09c10f82..84116368 100644 --- a/src/u_main.lfm +++ b/src/u_main.lfm @@ -12,7 +12,6 @@ object MainForm: TMainForm OnResize = FormResize OnWindowStateChange = FormWindowStateChange ShowHint = True - LCLVersion = '2.0.0.4' object mainMenu: TMainMenu top = 1 object MenuItem1: TMenuItem diff --git a/src/u_messages.pas b/src/u_messages.pas index 94c4c638..a1850517 100644 --- a/src/u_messages.pas +++ b/src/u_messages.pas @@ -335,9 +335,9 @@ begin widg.fAutoDemangle:=fAutoDemangle; widg.fAlwaysFilter:=fAlwaysFilter; if fFastDisplay then - widg.updaterByLoopInterval:= 70 + widg.timedUpdateKind := tukLoop else - widg.updaterByLoopInterval:= 0; + widg.timedUpdateKind := tukNone; end else inherited; end; diff --git a/src/u_projinspect.pas b/src/u_projinspect.pas index ad3c0fc8..02c52d4b 100644 --- a/src/u_projinspect.pas +++ b/src/u_projinspect.pas @@ -178,6 +178,8 @@ begin end; end; + timedUpdateKind := tukDelay; + EntitiesConnector.addObserver(self); end; diff --git a/src/u_symlist.pas b/src/u_symlist.pas index d3ee8fe0..610da124 100644 --- a/src/u_symlist.pas +++ b/src/u_symlist.pas @@ -441,6 +441,8 @@ begin Tree.OnDblClick := @TreeDblClick; Tree.PopupMenu := contextMenu; + timedUpdateKind := tukDelay; + EntitiesConnector.addObserver(self); end; diff --git a/src/u_widget.lfm b/src/u_widget.lfm index 3e91ff70..9220c13c 100644 --- a/src/u_widget.lfm +++ b/src/u_widget.lfm @@ -9,7 +9,6 @@ object DexedWidget: TDexedWidget ClientWidth = 332 ShowHint = True ShowInTaskBar = stNever - LCLVersion = '2.0.0.3' object Back: TPanel Left = 0 Height = 121 diff --git a/src/u_widget.pas b/src/u_widget.pas index e5668dd3..37c87ec0 100644 --- a/src/u_widget.pas +++ b/src/u_widget.pas @@ -10,6 +10,15 @@ uses type + TTimedUpdateKind = ( + // update timer is diabled. + tukNone, + // update timer update only one time, if required, and after a delay + tukDelay, + // update tiemr update periodically + tukLoop + ); + (** * Base type for an UI module. *) @@ -37,15 +46,16 @@ type fUpdating: boolean; fDelayDur: Integer; fLoopInter: Integer; - fUpdaterAuto: TTimer; - fUpdaterDelay: TTimer; + fUpdateTimer: TTimer; fImperativeUpdateCount: Integer; fLoopUpdateCount: Integer; fOnDockingChanged: TWidgetDockingChangedEvent; + fTimerUpdateKind: TTimedUpdateKind; procedure setDelayDur(value: Integer); procedure setLoopInt(value: Integer); procedure updaterAutoProc(Sender: TObject); procedure updaterLatchProc(Sender: TObject); + procedure setTimerUpdateKind(value: TTimedUpdateKind); protected fIsDockable: boolean; fIsModal: boolean; @@ -99,6 +109,8 @@ type procedure showWidget; + // set if the update based on a timer is enabled. + property timedUpdateKind: TTimedUpdateKind read fTimerUpdateKind write setTimerUpdateKind; // returns true if one of the three updater is processing. property updating: boolean read fUpdating; // true by default, allow a widget to be docked. @@ -149,10 +161,6 @@ begin inherited; fToolBarVisible := true; fIsDockable := true; - fUpdaterAuto := TTimer.Create(self); - fUpdaterAuto.Interval := 0; - fUpdaterAuto.OnTimer := @updaterAutoProc; - fUpdaterDelay := TTimer.Create(self); updaterByLoopInterval := 70; updaterByDelayDuration := 500; @@ -170,6 +178,7 @@ end; destructor TDexedWidget.destroy; begin + fUpdateTimer.Free; EntitiesConnector.removeObserver(self); inherited; end; @@ -271,6 +280,35 @@ end; {$ENDREGION} {$REGION Updaters---------------------------------------------------------------} +procedure TDexedWidget.setTimerUpdateKind(value: TTimedUpdateKind); +begin + if fTimerUpdateKind = value then + exit; + fTimerUpdateKind := value; + if fTimerUpdateKind = tukNone then + begin + if fUpdateTimer.isNil then + exit; + FreeAndNil(fUpdateTimer); + end + else + begin + if fUpdateTimer.isNotNil then + exit; + fUpdateTimer := TTimer.Create(nil); + if fTimerUpdateKind = tukDelay then + begin + fUpdateTimer.Enabled := false; + fUpdateTimer.OnTimer := @updaterAutoProc; + fUpdateTimer.Interval:= fDelayDur; + end + else begin + fUpdateTimer.Enabled := true; + fUpdateTimer.Interval:= fLoopInter; + end; + end; +end; + procedure TDexedWidget.setDelayDur(value: Integer); begin if value < 100 then @@ -278,7 +316,8 @@ begin if fDelayDur = value then exit; fDelayDur := value; - fUpdaterDelay.Interval := fDelayDur; + if fUpdateTimer.isNotNil and (fTimerUpdateKind = tukDelay) then + fUpdateTimer.Interval := fDelayDur; end; procedure TDexedWidget.setLoopInt(value: Integer); @@ -286,13 +325,8 @@ begin if fLoopInter = value then exit; fLoopInter := value; - fUpdaterAuto.Interval := fLoopInter; - if value = 0 then - begin - fUpdaterAuto.Enabled:= false; - fLoopUpdateCount := 0; - end - else fUpdaterAuto.Enabled:= true; + if fUpdateTimer.isNotNil and (fTimerUpdateKind = tukLoop) then + fUpdateTimer.Interval := fLoopInter; end; procedure TDexedWidget.IncLoopUpdate; @@ -326,14 +360,14 @@ end; procedure TDexedWidget.beginDelayedUpdate; begin - fUpdaterDelay.Enabled := false; - fUpdaterDelay.Enabled := true; - fUpdaterDelay.OnTimer := @updaterLatchProc; + fUpdateTimer.OnTimer := @updaterLatchProc; + fUpdateTimer.Enabled := true; end; procedure TDexedWidget.stopDelayedUpdate; begin - fUpdaterDelay.OnTimer := nil; + fUpdateTimer.OnTimer := nil; + fUpdateTimer.Enabled := false; end; procedure TDexedWidget.forceDelayedUpdate; @@ -355,7 +389,8 @@ begin fUpdating := true; updateDelayed; fUpdating := false; - fUpdaterDelay.OnTimer := nil; + fUpdateTimer.OnTimer := nil; + fUpdateTimer.Enabled:=false; end; procedure TDexedWidget.updateLoop;