OSDN Git Service

Synchronized session colored
authornaru <bottle@mikage.to>
Fri, 20 Dec 2002 03:38:44 +0000 (03:38 +0000)
committernaru <bottle@mikage.to>
Fri, 20 Dec 2002 03:38:44 +0000 (03:38 +0000)
bottleclient/LogForm.pas
bottleclient/MainForm.pas

index a54d76c..b8d8b25 100755 (executable)
@@ -302,7 +302,7 @@ end;
 procedure TfrmLog.UpdateScriptConversationColor(const Script: String);
 var i: integer;
     scr: String;
-    UnyuTalking, Talked: boolean;
+    UnyuTalking, Talked, InSynchronized: boolean;
 begin
   scr := Script;
   frmSender.DoTrans(scr, [toConvertURL]);
@@ -314,6 +314,19 @@ begin
   edtScript.Text := '';
   edtScript.Color := Pref.BgColor;
   for i := 0 to SsParser.Count-1 do begin
+    if (SsParser[i] = '\_s') and not InSynchronized then begin
+      InSynchronized := true;
+      if Talked then begin
+        edtScript.SelText := #13#10;
+        Talked := false;
+      end;
+    end else if (SsParser[i] = '\_s') and InSynchronized then begin
+      InSynchronized := false;
+      if Talked then begin
+        edtScript.SelText := #13#10;
+        Talked := false;
+      end;
+    end;
     if (SsParser[i] = '\u') and not UnyuTalking then begin
       UnyuTalking := true;
       if Talked then begin
@@ -329,7 +342,9 @@ begin
       end;
     end;
     if SsParser.MarkUpType[i] = mtStr then begin
-      if UnyuTalking then
+      if InSynchronized then
+        edtScript.SelAttributes.Color := Pref.TalkColorS
+      else if UnyuTalking then
         edtScript.SelAttributes.Color := Pref.TalkColorU
       else
         edtScript.SelAttributes.Color := Pref.TalkColorH;
@@ -730,7 +745,7 @@ end;
 
 procedure TfrmLog.UpdateScriptScript(const Script: String);
 var
-  UnyuTalking: boolean;
+  UnyuTalking, InSynchronized: boolean;
   i: integer;
 begin
   if Pref.ColorScript then begin
@@ -745,11 +760,14 @@ begin
   edtScript.Text := '';
   edtScript.SelAttributes.Color := clWindowText;
   UnyuTalking := false;
+  InSynchronized := false;
   for i := 0 to SsParser.Count-1 do begin
     if Pref.ColorScript then begin
       case SsParser.MarkUpType[i] of
         mtStr: begin
-          if UnyuTalking then
+          if InSynchronized then
+            edtScript.SelAttributes.Color := Pref.TalkColorS
+          else if UnyuTalking then
             edtScript.SelAttributes.Color := Pref.TalkColorU
           else
             edtScript.SelAttributes.Color := Pref.TalkColorH;
@@ -759,7 +777,9 @@ begin
           if SsParser[i] = '\h' then
             UnyuTalking := false
           else if SsParser[i] = '\u' then
-            UnyuTalking := true;
+            UnyuTalking := true
+          else if SsParser[i] = '\_s' then
+            InSynchronized := not InSynchronized;
         end;
         mtMeta:   edtScript.SelAttributes.Color := Pref.MetaWordColor;
         mtTagErr: edtScript.SelAttributes.Color := Pref.MarkErrorColor;
index 1eae3ac..664f9f3 100755 (executable)
@@ -235,6 +235,7 @@ type
     //\83X\83N\83\8a\83v\83g\90F\95ª\82¯\97p\82Ì\95Ï\90\94
     FRequireColoring: boolean;
     FUnyuTalking: boolean;
+    FInSynchronized: boolean;
     FLastSurfaceH: integer;
     FLastSurfaceU: integer;
     FColoringPos: integer;     //\90F\95ª\82¯\8dÏ\82Ý\82Ì\83X\83N\83\8a\83v\83g\82Ì\83o\83C\83g\90\94
@@ -957,7 +958,8 @@ end;
 
 function TfrmSender.T2C: TColor;
 begin
-  if FUnyuTalking then Result := Pref.TalkColorU else Result := Pref.TalkColorH;
+  if FInSynchronized then Result := Pref.TalkColorS
+  else if FUnyuTalking then Result := Pref.TalkColorU else Result := Pref.TalkColorH;
 end;
 
 
@@ -985,6 +987,7 @@ begin
     if FColoredElements >= SsParser.Count then Break;
     if SsParser[FColoredElements] = '\u' then FUnyuTalking := true;
     if SsParser[FColoredElements] = '\h' then FUnyuTalking := false;
+    if SsParser[FColoredElements] = '\_s' then FInSynchronized := not FInSynchronized;
     case SsParser.MarkUpType[FColoredElements] of
       mtTag:    Col := Pref.MarkUpColor;
       mtTagErr: Col := Pref.MarkErrorColor;
@@ -1011,6 +1014,7 @@ begin
     FColoringPos := 0;
     FColoredElements := 0;
     FUnyuTalking := false;
+    FInSynchronized := false;
     FLastSurfaceH := 0;
     FLastSurfaceU := 10;
     FRequireColoring := true;