OSDN Git Service

Improved scroll speed
authornaru <bottle@mikage.to>
Tue, 13 Jan 2004 11:55:53 +0000 (11:55 +0000)
committernaru <bottle@mikage.to>
Tue, 13 Jan 2004 11:55:53 +0000 (11:55 +0000)
bottleclient/TalkShowFrame.pas

index 41901f1..6020a2e 100644 (file)
@@ -72,6 +72,14 @@ var i, y, sur, sur0, sur1: integer;
     Talk: String;
   procedure TalkEnd;
   begin
+    if FWholeHeight > 0 then // 2\93x\96Ú\88È\8d~\82Ì\95`\89æ\82Å\82Í
+      if (i < FSsParser.Count) and
+         (StrToInt(FSsParser.Extra[i]) < ScrollBar.Position) then
+      begin
+        y := StrToInt(FSsParser.Extra[i]) - ScrollBar.Position;
+        Talk := '';
+        Exit;
+      end;
     if Talk <> '' then
     begin
       if InSync then
@@ -121,7 +129,8 @@ begin
   UnyuTalking := false;
   InSync := false;
   //
-  for i := 0 to FSsParser.Count-1 do
+  i := 0;
+  while i < FSsParser.Count do
   begin
     case FSsParser.MarkUpType[i] of
       mtTag:
@@ -177,13 +186,28 @@ begin
       mtStr, mtMeta:
         Talk := Talk + FSsParser[i];
     end;
+    if FWholeHeight < 0 then // \8f\89\89ñ\82Ì\95`\89æ\82Å\82Í
+    begin
+      // \8e©\95ª\82ª\95`\89æ\82³\82ê\82½\8cã\82Ì\88Ê\92u\82ð\8bL\89¯\82µ\82Ä\82¨\82­\81B
+      // \8e\9f\89ñ\88È\8d~\82Ì\95`\89æ\82ª\8d\82\91¬\89»\82³\82ê\82é
+      FSsParser.Extra[i] := IntToStr(y);
+    end;
+    // \95`\89æ\97Ì\88æ\82ª\83E\83B\83\93\83h\83E\82Ì\89º\92[\82ð\89ß\82¬\82½\82ç
+    // \8fI\97¹\81A\82½\82¾\82µ\8f\89\89ñ\95`\89æ\82¾\82¯\82Í\91S\91Ì\82ð\91\96\8d¸
+    if (y > ScrollBar.Position + PaintBox.Height) and
+      (FWholeHeight > 0) then
+    begin
+      Break;
+    end;
+    Inc(i);
   end;
   TalkEnd;
   PaintBox.Canvas.Draw(0, 0, FBuffer);
 
   if FWholeHeight = -1 then
   begin
-    FWholeHeight := y;
+    if FScript <> '' then
+      FWholeHeight := y;
     ScrollBar.Position := 0;
     if FWholeHeight > PaintBox.Height then
     begin
@@ -294,6 +318,7 @@ constructor TfrmTalkShow.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
   FBuffer := TBitmap.Create;
+  FWholeHeight := -1;
 end;
 
 destructor TfrmTalkShow.Destroy;