OSDN Git Service

Added partial confirm
authornaru <bottle@mikage.to>
Wed, 27 Aug 2003 05:11:04 +0000 (05:11 +0000)
committernaru <bottle@mikage.to>
Wed, 27 Aug 2003 05:11:04 +0000 (05:11 +0000)
Show length of selected script

bottleclient/BottleDef.pas
bottleclient/MainForm.dfm
bottleclient/MainForm.pas
bottleclient/SettingForm.dfm
bottleclient/SettingForm.pas

index d6b96a2..3b9a6bd 100755 (executable)
@@ -88,6 +88,8 @@ type
     FAutoClip: boolean;
     FConfirmOnTabClose: boolean;
     FReconnectWait: integer;
+    FPartialConfirmFormat: String;
+    FAutoPartialConfirm: boolean;
     procedure SetDblClkInsert(const Value: boolean);
     procedure SetDefaultScript(const Value: String);
     procedure SetIgnoreTimeCritical(const Value: boolean);
@@ -149,10 +151,14 @@ type
     procedure SetAutoClip(const Value: boolean);
     procedure SetConfirmOnTabClose(const Value: boolean);
     procedure SetReconnectWait(const Value: integer);
+    procedure SetPartialConfirmFormat(const Value: String);
+    procedure SetAutoPartialConfirm(const Value: boolean);
   protected
     function InScreen(ARect: TRect): boolean;
   public
     property NoSendGhostList: boolean read FNoSendGhostList write SetNoSendGhostList;
+    property PartialConfirmFormat: String read FPartialConfirmFormat write SetPartialConfirmFormat;
+    property AutoPartialConfirm: boolean read FAutoPartialConfirm write SetAutoPartialConfirm;
     property ConfirmOnExit: boolean read FConfirmOnExit write SetConfirmOnExit;
     property ConfirmOnTabClose: boolean read FConfirmOnTabClose write SetConfirmOnTabClose;
     property AutoClip: boolean read FAutoClip write SetAutoClip;
@@ -414,6 +420,9 @@ begin
     FIni := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
     //
     NoSendGhostList := FIni.ReadBool('System', 'NoSendGhostList', false);
+    PartialConfirmFormat := FIni.ReadString('System', 'PartialConfirmFormat', '\t|\e');
+    AutoPartialConfirm := FIni.ReadBool('System', 'AutoPartialConfirm', false);
+    ConfirmOnExit := FIni.ReadBool('System', 'ConfirmOnExit', false);
     ConfirmOnExit := FIni.ReadBool('System', 'ConfirmOnExit', false);
     ConfirmOnTabClose := FIni.ReadBool('System', 'ConfirmOnTabClose', false);
     AutoClip := FIni.ReadBool('System', 'AutoClip', false);
@@ -773,6 +782,8 @@ end;
 procedure TBottlePrefs.SaveSettings;
 begin
   FIni.WriteBool('System', 'NoSendGhostList', NoSendGhostList);
+  FIni.WriteString('System', 'PartialConfirmFormat', PartialConfirmFormat);
+  FIni.WriteBool('System', 'AutoPartialConfirm', AutoPartialConfirm);
   FIni.WriteBool('System', 'ConfirmOnExit', ConfirmOnExit);
   FIni.WriteBool('System', 'ConfirmOnTabClose', ConfirmOnTabClose);
   FIni.WriteBool('System', 'AutoClip', AutoClip);
@@ -953,6 +964,16 @@ begin
     raise Exception.Create('Reconnect wait must be >=6');
 end;
 
+procedure TBottlePrefs.SetPartialConfirmFormat(const Value: String);
+begin
+  FPartialConfirmFormat := Value;
+end;
+
+procedure TBottlePrefs.SetAutoPartialConfirm(const Value: boolean);
+begin
+  FAutoPartialConfirm := Value;
+end;
+
 { TChannelListItem }
 
 procedure TChannelListItem.SetGhost(const Value: String);
index 2ab8534..54d19cb 100755 (executable)
@@ -333,6 +333,7 @@ object frmSender: TfrmSender
       OnKeyDown = memScriptKeyDown
       OnKeyPress = memScriptKeyPress
       OnMouseMove = memScriptMouseMove
+      OnSelectionChange = memScriptSelectionChange
     end
   end
   object pnlPanel: TPanel
index 1dc5758..834c00f 100755 (executable)
@@ -14,7 +14,7 @@ uses
   IdSLPP20, SsParser, ImgList, AppEvnts, TaskTray, StdActns,
   ActnList, MPlayer, MenuBar, ToolWin,
   IniFiles, ExtCtrls, ShellAPI, Contnrs,
-  ConstEditor, Buttons, Clipbrd, HeadValue, Logs,
+  ConstEditor, Buttons, Clipbrd, HeadValue, Logs, MultipleChoiceEditor,
   IdException, HttpThread, IdHTTP, LogDownload,
   ScriptConsts, DateUtils, BottleChainRule, BottleChainEvent,
   SakuraSeekerInstance, HEditor, HTSearch, heClasses, heFountain,
@@ -266,6 +266,7 @@ type
       State: TDragState; var Accept: Boolean);
     procedure memScriptDragDrop(Sender, Source: TObject; X, Y: Integer);
     procedure actDeleteLogItemExecute(Sender: TObject);
+    procedure memScriptSelectionChange(Sender: TObject; Selected: Boolean);
   private
     FSleeping: boolean;  // \94z\91\97\83X\83\8a\81[\83v\92\86\82©\82Ç\82¤\82©
     FStatusText: String;
@@ -463,10 +464,28 @@ end;
 {TfrmSender}
 
 procedure TfrmSender.actConfirmExecute(Sender: TObject);
-var AScript, Err, AGhost: String;
-    Item: TLogItem;
+var
+  AScript, Err, AGhost: String;
+  Item: TLogItem;
+  Choice: integer;
 begin
-  AScript := GetScriptText;
+  // Partial Confirmation
+  if memScript.SelText <> '' then
+  begin
+    Choice := 0;
+    if not Pref.AutoPartialConfirm then
+      if not MultipleChoiceEdit('\8am\94F', ['\91I\91ð\95\94\95ª\82Ì\82Ý', '\83X\83N\83\8a\83v\83g\91S\91Ì'], Choice) then
+        Exit;
+    if Choice = 0 then
+    begin
+      AScript := memScript.SelText;
+      AScript := StringReplace(Pref.PartialConfirmFormat, '|', AScript, []);
+    end else
+      AScript := GetScriptText;
+  end else
+    AScript := GetScriptText;
+  AScript := StringReplace(AScript, #13#10, '', [rfReplaceAll]);
+
   if Length(AScript) = 0 then Exit;
   YenETrans;
   AScript := ScriptTransForSSTP(AScript, Err);
@@ -3136,4 +3155,19 @@ begin
   end;
 end;
 
+procedure TfrmSender.memScriptSelectionChange(Sender: TObject;
+  Selected: Boolean);
+var
+  SelText: String;
+begin
+  SelText := memScript.SelText;
+  if SelText <> '' then
+  begin
+    StatusBar.Panels[PanelBytes].Text := Format('(%d\83o\83C\83g)', [Length(SelText)]);
+  end else
+  begin
+    memScriptChange(Self);
+  end; 
+end;
+
 end.
index 8811754..0146f41 100755 (executable)
@@ -36,7 +36,7 @@ object frmSetting: TfrmSetting
     Top = 32
     Width = 440
     Height = 291
-    ActivePage = tstConnection
+    ActivePage = tstGeneral
     Anchors = [akLeft, akTop, akRight, akBottom]
     MultiLine = True
     TabOrder = 0
@@ -46,11 +46,18 @@ object frmSetting: TfrmSetting
       object lblDefaultScript: TLabel
         Left = 8
         Top = 8
-        Width = 276
+        Width = 278
         Height = 12
-        Caption = #12463#12522#12450#26178#12398#21021#26399#12473#12463#12522#12503#12488'('#32294#26834'"|"'#12398#20301#32622#12395#12459#12540#12477#12523')(&I)'
+        Caption = #12463#12522#12450#26178#12398#21021#26399#12473#12463#12522#12503#12488'('#32294#26834'"|"'#12398#20301#32622#12395#12459#12540#12477#12523')(&I):'
         FocusControl = memDefaultScript
       end
+      object lblPartialConfirmFormat: TLabel
+        Left = 8
+        Top = 120
+        Width = 328
+        Height = 12
+        Caption = #12473#12463#12522#12503#12488#37096#20998#30906#35469#12501#12457#12540#12510#12483#12488'('#32294#26834'"|"'#12398#20301#32622#12395#36984#25246#25991#23383#21015')(&F):'
+      end
       object memDefaultScript: TMemo
         Left = 8
         Top = 24
@@ -68,7 +75,7 @@ object frmSetting: TfrmSetting
       end
       object cbxNoSendGhostList: TCheckBox
         Left = 8
-        Top = 160
+        Top = 216
         Width = 281
         Height = 17
         Hint = 'SSTP Bottle'#22269#21218#35519#26619#12398#12383#12417#12398#12468#12540#12473#12488#12522#12473#12488#12434#36865#20449#12375#12414#12379#12435
@@ -77,7 +84,7 @@ object frmSetting: TfrmSetting
       end
       object cbxConfirmOnExit: TCheckBox
         Left = 8
-        Top = 184
+        Top = 240
         Width = 281
         Height = 17
         Hint = 'Client'#12398#32066#20102#26178#12395#30906#35469#12513#12483#12475#12540#12472#12434#20986#12375#12414#12377
@@ -86,7 +93,7 @@ object frmSetting: TfrmSetting
       end
       object cbxIgnoreTimeCritical: TCheckBox
         Left = 8
-        Top = 129
+        Top = 201
         Width = 297
         Height = 17
         Hint = #12525#12540#12459#12523#30906#35469#26178#12395'\t'#12434#36865#20449#12375#12394#12356#12371#12392#12391#20182#12398'SSTP'#12364#34920#31034#12373#12428#12420#12377#12367#12377#12427
@@ -106,13 +113,30 @@ object frmSetting: TfrmSetting
       end
       object cbxConfirmOnTabClose: TCheckBox
         Left = 8
-        Top = 208
+        Top = 256
         Width = 257
         Height = 17
         Hint = #12525#12464#12454#12451#12531#12489#12454#12391#12479#12502#12434#38281#12376#12427#26178#12395#30906#35469#12480#12452#12450#12525#12464#12434#34920#31034#12375#12414#12377
         Caption = #12525#12464#12454#12451#12531#12489#12454#12398#12479#12502#12434#38281#12376#12427#26178#12395#30906#35469#12377#12427'(&C)'
         TabOrder = 5
       end
+      object edtPartialConfirmFormat: TEdit
+        Left = 8
+        Top = 136
+        Width = 409
+        Height = 20
+        Hint = #37096#20998#30906#35469#26178#12395#12473#12463#12522#12503#12488#12398#21069#12392#24460#12429#12395#20184#12369#12427#25552#25658#25991#23383#21015#12434#25351#23450
+        TabOrder = 6
+      end
+      object cbxAutoPartialConfirm: TCheckBox
+        Left = 8
+        Top = 160
+        Width = 145
+        Height = 17
+        Hint = #37096#20998#30906#35469#12398#12458#12503#12471#12519#12531#12480#12452#12450#12525#12464#12434#34920#31034#12379#12378#12289#12473#12463#12522#12503#12488#12364#36984#25246#12373#12428#12390#12356#12427#12392#12365#12399#37096#20998#30906#35469#12375#12414#12377
+        Caption = #33258#21205#12391#37096#20998#30906#35469#12377#12427'(&A)'
+        TabOrder = 7
+      end
     end
     object tstDisplay: TTabSheet
       Caption = #34920#31034': '#30011#38754#34920#31034#38306#20418#12398#35373#23450
index add3f5b..2cb4775 100755 (executable)
@@ -76,6 +76,9 @@ type
     cbxUseHttpProxy: TCheckBox;
     spnReconnectWait: TSpinEdit;
     lblReconnectWait: TLabel;
+    lblPartialConfirmFormat: TLabel;
+    edtPartialConfirmFormat: TEdit;
+    cbxAutoPartialConfirm: TCheckBox;
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
     procedure edtProxyPortKeyPress(Sender: TObject; var Key: Char);
     procedure ctvBottleNodeChecked(Sender: TObject;
@@ -126,6 +129,8 @@ begin
   cbxShowRuler.Checked := Pref.ShowRuler;
   cbxIgnoreTimeCritical.Checked := Pref.IgnoreTimeCritical;
   cbxNoSendGhostList.Checked := Pref.NoSendGhostList;
+  edtPartialConfirmFormat.Text := Pref.PartialConfirmFormat;
+  cbxAutoPartialConfirm.Checked := Pref.AutoPartialConfirm;
   cbxConfirmOnExit.Checked := Pref.ConfirmOnExit;
   cbxConfirmOnTabClose.Checked := Pref.ConfirmOnTabClose;
   cbxAutoClip.Checked := Pref.AutoClip;
@@ -211,6 +216,8 @@ begin
   Pref.ShowRuler := cbxShowRuler.Checked;
   Pref.IgnoreTimeCritical := cbxIgnoreTimeCritical.Checked;
   Pref.NoSendGhostList := cbxNoSendGhostList.Checked;
+  Pref.PartialConfirmFormat := edtPartialConfirmFormat.Text;
+  Pref.AutoPartialConfirm := cbxAutoPartialConfirm.Checked;
   Pref.ConfirmOnExit := cbxConfirmOnExit.Checked;
   Pref.ConfirmOnTabClose := cbxConfirmOnTabClose.Checked;
   Pref.AutoClip := cbxAutoClip.Checked;