OSDN Git Service

1つのSsParserインスタンスで複数の処理が出来るように変更。
[winbottle/winbottle.git] / bottleclient / MainForm.pas
index 1803fb7..68a94cc 100755 (executable)
@@ -12,14 +12,15 @@ uses
   Menus, StdCtrls, ComCtrls, BRegExp, BottleDef, BottleSstp,
   DirectSstp, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
   IdSLPP20, SsParser, ImgList, AppEvnts, TaskTray, StdActns,
-  ActnList, MPlayer, MenuBar, ToolWin,
-  IniFiles, ExtCtrls, ShellAPI, Contnrs,      
+  ActnList, MPlayer, MenuBar, ToolWin, SsPlayTime, heClasses, heFountain,
+  SakuraScriptFountain, HEditor,
+  IniFiles, ShellAPI, Contnrs,
   ConstEditor, Buttons, Clipbrd, HeadValue, Logs, MultipleChoiceEditor,
   IdException, HttpThread, IdHTTP, LogDownload,
   ScriptConsts, DateUtils, BottleChainRule, BottleChainEvent,
-  SakuraSeekerInstance, HEditor, HTSearch, heClasses, heFountain,
-  SakuraScriptFountain, SppList, SurfacePreview, XDOM_2_3_J3, SsPlayTime,
-  RegexUtils, StrReplace, StrReplaceDialog, ReplacePresetEditor;
+  SakuraSeekerInstance, HTSearch,
+  SppList, SurfacePreview, XDOM_2_3_J3,
+  RegexUtils, StrReplace, StrReplaceDialog, ReplacePresetEditor, ExtCtrls;
 
 type
   TSurfacePreviewType = (spHint, spEditor);
@@ -677,7 +678,7 @@ begin
     actStart.Enabled := true;
     actStop.Enabled := true;
     actSend.Enabled := true;
-    frmLog.lvwLogChange(Self, nil, ctState);
+    frmLog.lvwLogClick(Self);
     mnGetNewId.Enabled := Pref.LUID = '';
     Screen.Cursor := crDefault;
   end;
@@ -837,7 +838,7 @@ begin
                      HeadValue['ExtraMessage']);
       end else begin
         Beep;
-        frmMessageBox.ShowMessage('SSTP Bottle\83T\81[\83o\82ª\89½\82ç\82©\82Ì\83G\83\89\81[\82ð\95Ô\82µ\82Ü\82µ\82½\81B');
+        frmMessageBox.ShowMessage('SSTP Bottle\83T\81[\83o\82ª\89½\82ç\82©\82Ì\83G\83\89\81[\82ð\95Ô\82µ\82Ü\82µ\82½\81B'#13#10 + '\81i\83R\83}\83\93\83h\81u' + Command + '\81v\82ð\8f\88\97\9d\92\86\81j');
       end;
     end;
     if (Command = 'sendBroadcast') and (ResStr = 'OK') then begin
@@ -1285,7 +1286,8 @@ begin
                 Url[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+2);
                 UrlName[UrlCount] := SsParser.GetParam(SsParser[i], UrlCount*2+3);
                 if UrlName[UrlCount] = '' then UrlName[UrlCount] := Url[UrlCount];
-                if Pos('http://', Url[UrlCount]) > 0 then Inc(UrlCount);
+                //https\82È\82Ç\82ª\92Ç\89Á\82³\82ê\82é\8e\9e\91Î\8dô\81c\81c://\82ð\8c\9f\8dõ\82·\82ê\82Î\82½\82Ô\82ñ\91å\8fä\95v
+                if Pos('://', Url[UrlCount]) > 0 then Inc(UrlCount);
               end;
             end;
             if UrlCount > 0 then UrlCancel := SsParser.GetParam(SsParser[i], 1);
@@ -1296,7 +1298,8 @@ begin
             Url[0] := SsParser.GetParam(SsParser[i], 1);
             UrlName[0] := '\8ds\82­\81@\81@\81@\81@\81@\81@';
             UrlCancel  := '\8ds\82©\82È\82¢\81@\81@\81@\81@';
-            if Pos('http://', Url[0]) > 0 then begin
+            //https\82È\82Ç\82ª\92Ç\89Á\82³\82ê\82é\8e\9e\91Î\8dô\81c\81c://\82ð\8c\9f\8dõ\82·\82ê\82Î\82½\82Ô\82ñ\91å\8fä\95v
+            if Pos('://', Url[0]) > 0 then begin
               UrlCount := 1;
               if not QuickSection then
                 Script := Script + '\_q' + Url[0] + '\_q'
@@ -1381,6 +1384,11 @@ begin
         Result := '"' + SsParser[i] + '"'#13#10 +
                   '\82Í\81ASSTP Bottle\82Å\94F\82ß\82ç\82ê\82È\82¢\82©\81A\94F\8e¯\82Å\82«\82È\82¢\83^\83O\82Å\82·\81B';
         Exit;
+      end else if SsParser.MarkUpType[i] = mtStr then begin
+        if Pos(#9,SsParser[i]) > 0 then begin
+          Result := '\83^\83u\95\8e\9a\82Í\81ASSTP Bottle\82Å\8eg\97p\82Å\82«\82Ü\82¹\82ñ\81B';
+          Exit;
+        end;
       end;
     end;
     if (SsParser[0] <> '\t') and Pref.WarnYenTNotExist then begin
@@ -1972,8 +1980,8 @@ end;
 procedure TfrmSender.actVoteMessageExecute(Sender: TObject);
 var Log: TLogItem;
 begin
-  if frmLog.lvwLog.Selected = nil then Exit;
-  Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
+  if frmLog.lvwLog.ItemIndex < 0 then Exit;
+  Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
   if Log = nil then Exit;
   if Log.LogType <> ltBottle then Exit;
   PostCommand([
@@ -1988,8 +1996,8 @@ end;
 procedure TfrmSender.actAgreeMessageExecute(Sender: TObject);
 var Log: TLogItem;
 begin
-  if frmLog.lvwLog.Selected = nil then Exit;
-  Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
+  if frmLog.lvwLog.ItemIndex < 0 then Exit;
+  Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
   if Log = nil then Exit;
   if Log.LogType <> ltBottle then Exit;
   PostCommand([
@@ -2586,12 +2594,12 @@ begin
   end;
   FBottleSstp.Clear;
   frmLog.AllBottleOpened;
-  if frmLog.lvwLog.Selected = nil then Exit;
+  if frmLog.lvwLog.ItemIndex < 0 then Exit;
   Log := frmLog.SelectedBottleLog;
   if Log = nil then Exit;
   FBottleSSTP.OnResendCountChange := nil;
   errCount := 0;
-  for i := frmLog.lvwLog.Selected.Index downto 0 do begin
+  for i := frmLog.lvwLog.ItemIndex downto 0 do begin
     if (Log[i] as TLogItem).LogType <> ltBottle then Continue;
     InsertItem := TLogItem.Create(Log[i] as TLogItem);
     try
@@ -2966,8 +2974,8 @@ end;
 procedure TfrmSender.actSendToEditorExecute(Sender: TObject);
 var Log: TLogItem;
 begin
-  if frmLog.lvwLog.Selected = nil then Exit;
-  Log := frmLog.SelectedBottleLog[frmLog.lvwLog.Selected.Index] as TLogItem;
+  if frmLog.lvwLog.ItemIndex < 0 then Exit;
+  Log := frmLog.SelectedBottleLog[frmLog.lvwLog.ItemIndex] as TLogItem;
   if Log = nil then Exit;
   CopyFromLogToEditor(Log);
 end;
@@ -3033,11 +3041,11 @@ begin
   // \83\8d\83O\83E\83B\83\93\83h\83E\82Ì\8cÂ\95Ê\83\8d\83O\82ð\8dí\8f\9c\82·\82é
   if frmLog.SelectedBottleLog = nil then
     Exit;
-  if frmLog.lvwLog.Selected = nil then
+  if frmLog.lvwLog.ItemIndex = -1 then
     Exit;
-  frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.Selected.Index);
+  frmLog.SelectedBottleLog.Delete(frmLog.lvwLog.ItemIndex);
   frmLog.UpdateWindow;
-  frmLog.lvwLogChange(Self, nil, ctState);
+  frmLog.lvwLogClick(Self);
 end;
 
 procedure TfrmSender.ClearEditor;