|
From: Kamil K. <kkr...@us...> - 2001-01-07 16:19:19
|
Update of /cvsroot/pythianproject/Prototypes/GUISystem
In directory usw-pr-cvs1:/tmp/cvs-serv23676
Modified Files:
StartupForm.pas vglClasses.pas vglStdCtrls.pas
Log Message:
kk - added caching for globaly all panel - like controls;
ScrollBar, ListBox, CheckBox - now it should be faster
Index: StartupForm.pas
===================================================================
RCS file: /cvsroot/pythianproject/Prototypes/GUISystem/StartupForm.pas,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** StartupForm.pas 2001/01/06 19:52:48 1.13
--- StartupForm.pas 2001/01/07 16:19:27 1.14
***************
*** 27,31 ****
CB: TvglCheckBox;
cc: TvglComponent;
- Edit1:TvglEdit;
SLE :TvglSingleLineEdit;
--- 27,30 ----
***************
*** 182,187 ****
Panel1.OnMouseEntry := Panel1OnMouseEntry;
Panel1.OnMouseExit := Panel1OnMouseExit;
! c := TvglPanel.Create('Panel2',Panel1);
TvglPanel(c).Color := clYellow;
TvglPanel(c).Textured := false;
--- 181,187 ----
Panel1.OnMouseEntry := Panel1OnMouseEntry;
Panel1.OnMouseExit := Panel1OnMouseExit;
+ Panel1.Cached := True;
! { c := TvglPanel.Create('Panel2',Panel1);
TvglPanel(c).Color := clYellow;
TvglPanel(c).Textured := false;
***************
*** 189,196 ****
--- 189,198 ----
c.Top := 5; c.Left := 30; // this shows a panel being clipped to its owner
c.Width := 50; c.Height := 50;
+ c.Cached := True; }
Image1 := TvglDraggableImage.Create('Image1',InterfaceManager.Desktop);
Image1.LoadImage('olog.png');
Image1.Bounds := Rect(500,20,0,0);
+ Image1.Cached := True;
CB := TvglCheckBox.Create('CheckBox1', InterfaceManager.Desktop);
***************
*** 203,206 ****
--- 205,209 ----
CB.OnChanged := CB1OnChange;
CB.Text.FontName := 'VinerHand ITC';
+ CB.Cached := True;
Button := TvglButton.Create('Button',Panel1);
***************
*** 230,238 ****
SB.PageSize := 50;
SB.OnScroll := SBOnChange;
LB := TvglSimpleListBox.Create('SimpleListBoxTest', InterfaceManager.Desktop);
LB.Items.BeginUpdate;
LB.Items.Clear;
! for i := 0 to 99 do
begin
LB.Items.Add('Item '+IntToStr(i));
--- 233,242 ----
SB.PageSize := 50;
SB.OnScroll := SBOnChange;
+ SB.Cached := True;
LB := TvglSimpleListBox.Create('SimpleListBoxTest', InterfaceManager.Desktop);
LB.Items.BeginUpdate;
LB.Items.Clear;
! for i := 0 to 25 do
begin
LB.Items.Add('Item '+IntToStr(i));
***************
*** 245,250 ****
LB.Textured := true;
LB.Text.SetColor(clBlack);
- LB.Cached := false; // EXPERIMENTAL!!
LB.ScrollBars := ssBoth;
{ Edit1 := TvglEdit.Create('Edit1',InterfaceManager.Desktop);
--- 249,254 ----
LB.Textured := true;
LB.Text.SetColor(clBlack);
LB.ScrollBars := ssBoth;
+ LB.Cached := True; // EXPERIMENTAL!!
{ Edit1 := TvglEdit.Create('Edit1',InterfaceManager.Desktop);
***************
*** 252,257 ****
Edit1.Lines.Add('Hello World 1');
Edit1.Lines.Add('Hello World 2'); }
! SLE := TvglSingleLineEdit.Create('SLE1',InterfaceManager.Desktop);
! SLE.Bounds := Rect(20,300,220,400);
DragBox := TvglDragBox.Create('DragBox1',InterfaceManager.Desktop);
--- 256,261 ----
Edit1.Lines.Add('Hello World 1');
Edit1.Lines.Add('Hello World 2'); }
! // SLE := TvglSingleLineEdit.Create('SLE1',InterfaceManager.Desktop);
! // SLE.Bounds := Rect(20,300,220,400);
DragBox := TvglDragBox.Create('DragBox1',InterfaceManager.Desktop);
***************
*** 259,262 ****
--- 263,267 ----
DragBox.OnDragOver := DragBoxOnDragOver;
DragBox.OnDragDrop := DragBoxOnDragDrop;
+ DragBox.Cached := True;
InterfaceManager.SetNewFocus(LB);
Index: vglClasses.pas
===================================================================
RCS file: /cvsroot/pythianproject/Prototypes/GUISystem/vglClasses.pas,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** vglClasses.pas 2001/01/06 19:52:48 1.11
--- vglClasses.pas 2001/01/07 16:19:27 1.12
***************
*** 231,234 ****
--- 231,235 ----
procedure CacheInit; dynamic;
procedure CacheFinalize; dynamic;
+ procedure CacheInvalidate; virtual;
procedure DrawSelf(where:TRect); virtual; // where is screen relative, bounds is parent relative
***************
*** 580,583 ****
--- 581,585 ----
Result := FChildren.Add(child);
if assigned(FOnChildAdd) then OnChildAdd(child);
+ CacheInvalidate;
end;
***************
*** 799,802 ****
--- 801,805 ----
if i = -1 then raise EVGLException.Create('TvglComponent.RemoveChild: Unknown child component ['+child.name+']');
FChildren.Delete(i);
+ CacheInvalidate;
end;
***************
*** 931,934 ****
--- 934,938 ----
procedure TvglComponent.DoDeFocus;
begin
+ CacheInvalidate;
if Assigned(FOnExit) then
FOnExit(Self, Manager.SwitchingTo);
***************
*** 937,940 ****
--- 941,945 ----
procedure TvglComponent.DoSetBounds;
begin
+ CacheInvalidate;
if assigned(FOnResize) then
OnResize(self);
***************
*** 943,946 ****
--- 948,952 ----
procedure TvglComponent.DoSetFocus;
begin
+ CacheInvalidate;
if Assigned(FOnEnter) then
FOnEnter(Self, Manager.LastFocused);
***************
*** 1143,1146 ****
--- 1149,1153 ----
FBounds.Top := y;
Width := w; Height := h;
+ DoSetBounds;
end;
***************
*** 1152,1155 ****
--- 1159,1163 ----
FBounds.Top := FBounds.Top + y;
Width := w; Height := h;
+ DoSetBounds;
end;
***************
*** 1170,1173 ****
--- 1178,1186 ----
begin
FReleased := true;
+ end;
+
+ procedure TvglComponent.CacheInvalidate;
+ begin
+ FCacheInvalid := True;
end;
Index: vglStdCtrls.pas
===================================================================
RCS file: /cvsroot/pythianproject/Prototypes/GUISystem/vglStdCtrls.pas,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** vglStdCtrls.pas 2001/01/06 19:52:48 1.10
--- vglStdCtrls.pas 2001/01/07 16:19:27 1.11
***************
*** 445,448 ****
--- 445,449 ----
procedure TvglScrollBar.DoChange;
begin
+ CacheInvalidate;
if Assigned(FOnChange) then
FOnChange(Self);
***************
*** 512,517 ****
if PointInRectInAcc(ScreenBounds, X, Y, XA, YA) then
HandleMousePositioning(X, Y)
! else
FScrollingPos := Position;
end
else begin
--- 513,520 ----
if PointInRectInAcc(ScreenBounds, X, Y, XA, YA) then
HandleMousePositioning(X, Y)
! else begin
FScrollingPos := Position;
+ DoScroll(scTrack, FScrollingPos);
+ end;
end
else begin
***************
*** 540,543 ****
--- 543,547 ----
FMousePositioning := False;
end;
+ CacheInvalidate;
end;
***************
*** 545,548 ****
--- 549,553 ----
var ScrollPos: Integer);
begin
+ CacheInvalidate;
if Assigned(FOnScroll) then
FOnScroll(Self, ScrollCode, ScrollPos);
***************
*** 776,779 ****
--- 781,785 ----
FPosition := APosition;
FScrollingPos := FPosition;
+ CacheInvalidate;
end;
***************
*** 893,896 ****
--- 899,903 ----
FScrollBar.Left := FBounds.Right - 13{FScrollBar.Width} - 2;
FScrollBar.Color := clAqua; // @@BUG - cannot set scrollbar to invisible.
+ FScrollBar.Cached := True;
FItems := TStringList.Create;
FItems.OnChange := ItemsChanged;
***************
*** 920,926 ****
if button = VGL_MOUSE_LEFT then
begin
! TimerReset;
FMouseDown := True;
ItemIndex := ItemIndexAt(X, Y, 0, 0, ScreenBounds);
end;
end;
--- 927,934 ----
if button = VGL_MOUSE_LEFT then
begin
! TimerReset;
FMouseDown := True;
ItemIndex := ItemIndexAt(X, Y, 0, 0, ScreenBounds);
+
end;
end;
***************
*** 1059,1063 ****
procedure TvglSimpleListBox.ScrollBarChanged(Sender: TObject);
begin
! //
end;
--- 1067,1071 ----
procedure TvglSimpleListBox.ScrollBarChanged(Sender: TObject);
begin
! CacheInvalidate;
end;
***************
*** 1065,1069 ****
ScrollCode: TvglScrollCode; var ScrollPos: Integer);
begin
! //
end;
--- 1073,1077 ----
ScrollCode: TvglScrollCode; var ScrollPos: Integer);
begin
! CacheInvalidate;
end;
***************
*** 1077,1080 ****
--- 1085,1089 ----
begin
FColor := Value;
+ CacheInvalidate;
end;
***************
*** 1088,1091 ****
--- 1097,1101 ----
begin
FItemHeight := Max(Value, 1);
+ CacheInvalidate;
end;
***************
*** 1093,1096 ****
--- 1103,1107 ----
begin
FItemIndex := Max(Min(Value, FItems.Count - 1), 0);
+ CacheInvalidate;
end;
***************
*** 1098,1101 ****
--- 1109,1113 ----
begin
FItems := Value;
+ CacheInvalidate;
end;
***************
*** 1118,1121 ****
--- 1130,1134 ----
FScrollBar.Visible := False;
end;
+ CacheInvalidate;
end;
***************
*** 1123,1126 ****
--- 1136,1140 ----
begin
FSelBgColor := Value;
+ CacheInvalidate;
end;
***************
*** 1128,1131 ****
--- 1142,1146 ----
begin
FSelBgTranslulency := Max(Min(Value, 1), 0);
+ CacheInvalidate;
end;
***************
*** 1133,1136 ****
--- 1148,1152 ----
begin
FSelFgColor := Value;
+ CacheInvalidate;
end;
***************
*** 1141,1144 ****
--- 1157,1161 ----
FItems.Sorted := Value;
FItems.EndUpdate;
+ CacheInvalidate;
end;
***************
*** 1167,1170 ****
--- 1184,1188 ----
FScrollBar.Max := FItems.Count - FScrollBar.PageSize;
FScrollBar.LargeChange := FScrollBar.PageSize;
+ CacheInvalidate;
end;
***************
*** 1176,1179 ****
--- 1194,1198 ----
FMouseDown := False;
FTimerScrolling := -1;
+ CacheInvalidate;
end;
end;
***************
*** 1237,1245 ****
0: begin
FScrollBar.Trigger(scLineUp);
! FItemIndex := FScrollBar.Position;
end;
1: begin
FScrollBar.Trigger(scLineDown);
! FItemIndex := (Height div FItemHeight) + FScrollBar.Position - 1;
end;
end;
--- 1256,1264 ----
0: begin
FScrollBar.Trigger(scLineUp);
! ItemIndex := FScrollBar.Position;
end;
1: begin
FScrollBar.Trigger(scLineDown);
! ItemIndex := (Height div FItemHeight) + FScrollBar.Position - 1;
end;
end;
***************
*** 1311,1315 ****
procedure TvglCheckBox.CheckMarkOver(X, Y: Integer);
begin
! FMouseMarkOver := PointInRect(GetCheckMarkBounds(ScreenBounds), X, Y);
end;
--- 1330,1338 ----
procedure TvglCheckBox.CheckMarkOver(X, Y: Integer);
begin
! if PointInRect(GetCheckMarkBounds(ScreenBounds), X, Y) <> FMouseMarkOver then
! begin
! FMouseMarkOver := not FMouseMarkOver;
! CacheInvalidate;
! end;
end;
***************
*** 1337,1340 ****
--- 1360,1364 ----
procedure TvglCheckBox.DoChanged;
begin
+ CacheInvalidate;
if Assigned(FOnChanged) then
FOnChanged(Self);
***************
*** 1355,1358 ****
--- 1379,1383 ----
if PointInRect(GetCheckMarkBounds(ScreenBounds), X, Y) then
FMouseMarkDown := True;
+ CacheInvalidate;
end;
***************
*** 1361,1364 ****
--- 1386,1390 ----
inherited DoOnMouseEntry;
FMouseOver := True;
+ CacheInvalidate;
end;
***************
*** 1368,1371 ****
--- 1394,1398 ----
FMouseOver := False;
FMouseMarkOver := False;
+ CacheInvalidate;
end;
***************
*** 1380,1383 ****
--- 1407,1411 ----
inherited DoOnMouseUp(mb, x, y);
FMouseMarkDown := False;
+ CacheInvalidate;
end;
***************
*** 1442,1445 ****
--- 1470,1474 ----
begin
FChecked := Value;
+ CacheInvalidate;
end;
***************
*** 1447,1450 ****
--- 1476,1480 ----
begin
FCaptionText.SetColor(Value);
+ CacheInvalidate;
end;
|