You've already forked lazarus-ccr
spktoolbar: for test purposes bring back the timer removed in r3651 (now activated by define DELAYRUNTIMER) because I saw the black areas on a slow computer (having DELAYRUNTIMER activated, however, is not compatible with the previous commit of no background painting -> large black area!) THIS IS AN EXPERIMENTAL VERSION!
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3660 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,7 +1,9 @@
|
|||||||
unit SpkToolbar;
|
unit SpkToolbar;
|
||||||
|
|
||||||
{$mode delphi}
|
{$mode delphi}
|
||||||
{.$Define EnhancedRecordSupport}
|
|
||||||
|
{.$DEFINE EnhancedRecordSupport}
|
||||||
|
{.$DEFINE DELAYRUNTIMER}
|
||||||
|
|
||||||
(*******************************************************************************
|
(*******************************************************************************
|
||||||
* *
|
* *
|
||||||
@ -13,31 +15,6 @@ unit SpkToolbar;
|
|||||||
* *
|
* *
|
||||||
*******************************************************************************)
|
*******************************************************************************)
|
||||||
|
|
||||||
{
|
|
||||||
changes by Werner Pamler --> version 0.2 (c) 2012:
|
|
||||||
* add TSpkCheckbox and TSpkRadiobutton (unit spkt_Checkboxes.pas)
|
|
||||||
* apply ImageIndex when assigning an action
|
|
||||||
* add property editor for image index
|
|
||||||
- use specialized ImageIndexPropertyEditor to link to the imagelist
|
|
||||||
- assign default values to ImageIndex properties
|
|
||||||
- use types TImageIndex instead of integer
|
|
||||||
* make sure that properties (caption, imageindex etc) are updated when the
|
|
||||||
action changes
|
|
||||||
* Fixed button state to change immediately after mouse-up from pressed to hover
|
|
||||||
* Found bug in ComponentEditor form causing "Class not found" error: added tabs,
|
|
||||||
panes, or items were nameless. Assigning a name by FDesigner.UniqueName fixed
|
|
||||||
the issue.
|
|
||||||
* Duplicate components after Cut & Paste because missing destruction of
|
|
||||||
components after deletion from internal list
|
|
||||||
* Naming issue of components added by designer (counter starting at 2, not 1) fixed
|
|
||||||
* Change default color of the SpkToolbar to clSkyBlue
|
|
||||||
* add component icon
|
|
||||||
* Add events for OnClick (Tab), and OnTabChanging and OnTabChange (Toolbar)
|
|
||||||
|
|
||||||
- Still open: units of the added controls are not added to uses clause automatically
|
|
||||||
Note: add some other component to form and the missing units are added!
|
|
||||||
}
|
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -114,6 +91,9 @@ type
|
|||||||
/// <summary>Pomocnicza bitmapa przekazywana na ¿yczenie elementom
|
/// <summary>Pomocnicza bitmapa przekazywana na ¿yczenie elementom
|
||||||
/// toolbara</summary>
|
/// toolbara</summary>
|
||||||
FTemporary: TBitmap;
|
FTemporary: TBitmap;
|
||||||
|
{$IFDEF DELAYRUNTIMER}
|
||||||
|
FDelayRunTimer: TTimer;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
/// <summary>Tablica rectów "uchwytów" zak³adek</summary>
|
/// <summary>Tablica rectów "uchwytów" zak³adek</summary>
|
||||||
FTabRects: array of T2DIntRect;
|
FTabRects: array of T2DIntRect;
|
||||||
@ -151,6 +131,10 @@ type
|
|||||||
FOnTabChanging: TSpkTabChangingEvent;
|
FOnTabChanging: TSpkTabChangingEvent;
|
||||||
FOnTabChanged: TNotifyEvent;
|
FOnTabChanged: TNotifyEvent;
|
||||||
|
|
||||||
|
{$IFDEF DELAYRUNTIMER}
|
||||||
|
procedure DelayRunTimer(Sender: TObject);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
protected
|
protected
|
||||||
/// <summary>Instancja obiektu wygl¹du, przechowuj¹cego kolory i czcionki
|
/// <summary>Instancja obiektu wygl¹du, przechowuj¹cego kolory i czcionki
|
||||||
/// u¿ywane podczas renderowania komponentu</summary>
|
/// u¿ywane podczas renderowania komponentu</summary>
|
||||||
@ -377,7 +361,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
LCLIntf;
|
LCLIntf, Themes;
|
||||||
|
|
||||||
{ TSpkToolbarDispatch }
|
{ TSpkToolbarDispatch }
|
||||||
|
|
||||||
@ -512,8 +496,25 @@ begin
|
|||||||
|
|
||||||
FTabIndex := -1;
|
FTabIndex := -1;
|
||||||
Color := clSkyBlue;
|
Color := clSkyBlue;
|
||||||
|
|
||||||
|
{$IFDEF DELAYRUNTIMER}
|
||||||
|
FDelayRunTimer := TTimer.Create(nil);
|
||||||
|
FDelayRunTimer.Interval := 36;
|
||||||
|
FDelayRunTimer.Enabled := False;
|
||||||
|
FDelayRunTimer.OnTimer := DelayRunTimer
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF DELAYRUNTIMER}
|
||||||
|
procedure TSpkToolbar.DelayRunTimer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
SetMetricsInvalid;
|
||||||
|
SetBufferInvalid;
|
||||||
|
invalidate;
|
||||||
|
FDelayRunTimer.Enabled := False;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TSpkToolbar.DefineProperties(Filer: TFiler);
|
procedure TSpkToolbar.DefineProperties(Filer: TFiler);
|
||||||
begin
|
begin
|
||||||
inherited DefineProperties(Filer);
|
inherited DefineProperties(Filer);
|
||||||
@ -534,6 +535,10 @@ begin
|
|||||||
|
|
||||||
FToolbarDispatch.Free;
|
FToolbarDispatch.Free;
|
||||||
|
|
||||||
|
{$IFDEF DELAYRUNTIMER}
|
||||||
|
FDelayRunTimer.Free;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -969,7 +974,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkToolbar.Paint;
|
procedure TSpkToolbar.Paint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// Jeœli trwa proces przebudowy (wewnêtrznej lub u¿ytkownika), walidacja metryk
|
// Jeœli trwa proces przebudowy (wewnêtrznej lub u¿ytkownika), walidacja metryk
|
||||||
// i bufora nie jest przeprowadzana, jednak bufor jest rysowany w takiej
|
// i bufora nie jest przeprowadzana, jednak bufor jest rysowany w takiej
|
||||||
@ -988,8 +992,13 @@ procedure TSpkToolbar.DoOnResize;
|
|||||||
begin
|
begin
|
||||||
inherited Height := TOOLBAR_HEIGHT;
|
inherited Height := TOOLBAR_HEIGHT;
|
||||||
|
|
||||||
|
{$IFDEF DELAYRUNTIMER}
|
||||||
|
FDelayRunTimer.Enabled := False;
|
||||||
|
FDelayRunTimer.Enabled := True;
|
||||||
|
{$ELSE}
|
||||||
SetMetricsInvalid;
|
SetMetricsInvalid;
|
||||||
SetBufferInvalid;
|
SetBufferInvalid;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
if not (FInternalUpdating or FUpdating) then
|
if not (FInternalUpdating or FUpdating) then
|
||||||
invalidate;
|
invalidate;
|
||||||
@ -1000,9 +1009,10 @@ end;
|
|||||||
procedure TSpkToolbar.EraseBackground(DC: HDC);
|
procedure TSpkToolbar.EraseBackground(DC: HDC);
|
||||||
begin
|
begin
|
||||||
// The correct implementation is doing nothing
|
// The correct implementation is doing nothing
|
||||||
//inherited; // wp: this does call FillRect!
|
if ThemeServices.ThemesEnabled then
|
||||||
// "inherited" removed to fix issue #"0025047: spktoolbar blinking than using
|
inherited; // wp: this calls FillRect!
|
||||||
// standart windows theme or using manifest file is off"
|
// "inherited" removed in case of no themes to fix issue #0025047 (flickering
|
||||||
|
// when using standard windows theme or when manifest file is off)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkToolbar.SetBufferInvalid;
|
procedure TSpkToolbar.SetBufferInvalid;
|
||||||
|
Reference in New Issue
Block a user