X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=bottleclient%2FSettingForm.pas;h=883a0bad17b49b6ffdfa8902e489a1711db585bd;hb=afa74286e4b975f278cb3f95c8725d98095f38c9;hp=7efabf95456c80c5206f77a51b2cb98fe540b239;hpb=62d33a7d793a5013fee27f8b59607510f4b844d3;p=winbottle%2Fwinbottle.git diff --git a/bottleclient/SettingForm.pas b/bottleclient/SettingForm.pas index 7efabf9..883a0ba 100755 --- a/bottleclient/SettingForm.pas +++ b/bottleclient/SettingForm.pas @@ -1,102 +1,144 @@ unit SettingForm; +{ + Ý’è‰æ–ʁB‚»‚ê–¢–ž‚Å‚à‚»‚êˆÈã‚Å‚à‚È‚¢B + PrefƒIƒuƒWƒFƒNƒg‚ðŽÀÛ‚É‘€ì‚·‚éB +} + interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - ComCtrls, StdCtrls, ExtCtrls, ColorCBX, BottleDef, EllipsEd, Spin, - CPCConfigTreeView; + ComCtrls, StdCtrls, ExtCtrls, BottleDef, Spin, + CPCConfigTreeView, ColorSettingFrame, BottleChainListFrame, SakuraSeekerInstance, + ImgList, StrListEditor, SppList, Plugins, Clipbrd, SsPlayTime, StrUtils, + SpecialCharEditor; type TfrmSetting = class(TForm) PageControl: TPageControl; btnClose: TButton; tstGeneral: TTabSheet; - tstColor: TTabSheet; + tstDisplay: TTabSheet; tstKeys: TTabSheet; rgpWhenReturn: TRadioGroup; rgpWhenShiftReturn: TRadioGroup; rgpWhenCtrlReturn: TRadioGroup; memDefaultScript: TMemo; lblDefaultScript: TLabel; - grpLocalConfirm: TGroupBox; - ColorDialog: TColorDialog; - cbxColorScript: TCheckBox; - trkColorTimeLag: TTrackBar; - trkColorSpeed: TTrackBar; - grpColor: TGroupBox; - colTalkColorU: TColorCBox; - colMetaWordColor: TColorCBox; - Label4: TLabel; - Label2: TLabel; - Label1: TLabel; - colTalkColorH: TColorCBox; - Label3: TLabel; - colMarkUpColor: TColorCBox; - Label5: TLabel; - colMarkErrorColor: TColorCBox; - cbxIgnoreTimeCritical: TCheckBox; - lblColorTimeLag: TLabel; - lblColorSpeed: TLabel; - colBgColor: TColorCBox; - Label8: TLabel; tstReceive: TTabSheet; - cbxPort: TComboBox; - Label9: TLabel; - cbxAutoStart: TCheckBox; - tstChannel: TTabSheet; - tvwChannels: TTreeView; - rgpUseChannelPrefs: TRadioGroup; - pnlChannelOpt: TPanel; - edtSoundFile: TEllipsesEdit; - cbxSoundArrived: TCheckBox; - rgpTargetGhost: TGroupBox; - cbxIgnoreIfGhost: TCheckBox; - cbxTargetGhost: TComboBox; - cbxUsePort: TCheckBox; - rgpTabPosition: TRadioGroup; - cbxCanAutoAdd: TCheckBox; OpenDialog: TOpenDialog; spnWaitScriptEnd: TSpinEdit; lblWaitScriptEnd: TLabel; - cbxNoSendGhostList: TCheckBox; - tstProxy: TTabSheet; - grpProxy: TGroupBox; - cbxUseHttpProxy: TCheckBox; - edtProxyAddress: TEdit; - edtProxyPort: TEdit; - lblProxyAddress: TLabel; - lblProxyPort: TLabel; - Label6: TLabel; - cbxWarnPost: TCheckBox; cbxConfirmOnExit: TCheckBox; ctvBottle: TCPCConfigTreeView; + gbxColor: TGroupBox; + frmColorSetting: TfrmColorSetting; + tstRule: TTabSheet; + frmRuleList: TfrmBottleChainList; + tstDetailed: TTabSheet; + lblFMOName: TLabel; + memFMOName: TMemo; + tstChannel: TTabSheet; + lblAutoJoinChannels: TLabel; + memAutoJoinChannels: TMemo; + cbxAutoStart: TCheckBox; + btnUseCurrentJoinChannels: TButton; + ImageList: TImageList; + tstSurfacePreview: TTabSheet; + lblSurfacePreview: TLabel; + lvwPluginList: TListView; + lblPluginList: TLabel; + ctvSurfacePreview: TCPCConfigTreeView; + btnVisibleGhosts: TButton; + cbxHideGhosts: TCheckBox; + cbxNoExtraSSTPHeaders: TCheckBox; + lblLUID: TLabel; + edtLUID: TEdit; + cbxShowRuler: TCheckBox; + rgpTabPosition: TRadioGroup; lblGhostDropDownCount: TLabel; spnGhostDropDownCount: TSpinEdit; - procedure ColorPick(Sender: TObject; var Col: TColor); + cbxIgnoreTimeCritical: TCheckBox; + cbxAutoClip: TCheckBox; + btnCopyLUID: TButton; + tvwCategory: TTreeView; + Label1: TLabel; + pnlHeading: TPanel; + cbxConfirmOnTabClose: TCheckBox; + tstConnection: TTabSheet; + grpProxy: TGroupBox; + lblProxyAddress: TLabel; + lblProxyPort: TLabel; + Label6: TLabel; + edtProxyAddress: TEdit; + edtProxyPort: TEdit; + cbxUseHttpProxy: TCheckBox; + spnReconnectWait: TSpinEdit; + lblReconnectWait: TLabel; + lblPartialConfirmFormat: TLabel; + edtPartialConfirmFormat: TEdit; + cbxAutoPartialConfirm: TCheckBox; + tstPlayTime: TTabSheet; + grpPlayTimeParams: TGroupBox; + lblPlayTimeProfile: TLabel; + cbxPlayTimeProfile: TComboBox; + spnCostDBChar: TSpinEdit; + spnCostWait: TSpinEdit; + spnCostSurface: TSpinEdit; + spnCostChar: TSpinEdit; + spnCostQuickChar: TSpinEdit; + lblCostWait: TLabel; + lblCostSurface: TLabel; + lblCostChar: TLabel; + lblCostDBChar: TLabel; + lblCostQuickChar: TLabel; + btnSavePlayTimeProfile: TButton; + lvwCostSpecials: TListView; + lblCostSpecials: TLabel; + btnPlaySpecialAdd: TButton; + btnPlaySpecialDelete: TButton; + gbxTabWidth: TGroupBox; + cbxAutoTabWidth: TCheckBox; + spnTabWidth: TSpinEdit; + lblBrowser: TLabel; + edtBrowserName: TEdit; + BrowserLocateOpenDialog: TOpenDialog; + btnBrowserLocate: TButton; procedure FormClose(Sender: TObject; var Action: TCloseAction); - procedure cbxPortChange(Sender: TObject); - procedure edtSoundFileButtonClick(Sender: TObject); - procedure tvwChannelsCompare(Sender: TObject; Node1, Node2: TTreeNode; - Data: Integer; var Compare: Integer); - procedure tvwChannelsChange(Sender: TObject; Node: TTreeNode); - procedure rgpUseChannelPrefsClick(Sender: TObject); - procedure cbxSoundArrivedClick(Sender: TObject); - procedure edtSoundFileChange(Sender: TObject); - procedure cbxTargetGhostChange(Sender: TObject); - procedure cbxIgnoreIfGhostClick(Sender: TObject); - procedure cbxUsePortClick(Sender: TObject); - procedure cbxCanAutoAddClick(Sender: TObject); procedure edtProxyPortKeyPress(Sender: TObject; var Key: Char); - procedure cbxWarnPostClick(Sender: TObject); procedure ctvBottleNodeChecked(Sender: TObject; Node: TCPCConfigItemNode); procedure ctvBottleNodeChecking(Sender: TObject; Node: TCPCConfigItemNode; var Allow: Boolean); + procedure tstRuleShow(Sender: TObject); + procedure btnUseCurrentJoinChannelsClick(Sender: TObject); + procedure btnVisibleGhostsClick(Sender: TObject); + procedure lvwPluginListDblClick(Sender: TObject); + procedure edtLUIDEnter(Sender: TObject); + procedure edtLUIDExit(Sender: TObject); + procedure btnCopyLUIDClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure tvwCategoryChange(Sender: TObject; Node: TTreeNode); + procedure tvwCategoryMouseMove(Sender: TObject; Shift: TShiftState; X, + Y: Integer); + procedure cbxPlayTimeProfileChange(Sender: TObject); + procedure btnSavePlayTimeProfileClick(Sender: TObject); + procedure spnCostWaitChange(Sender: TObject); + procedure btnPlaySpecialAddClick(Sender: TObject); + procedure btnPlaySpecialDeleteClick(Sender: TObject); + procedure lvwCostSpecialsDblClick(Sender: TObject); + procedure spnTabWidthChange(Sender: TObject); + procedure cbxAutoTabWidthClick(Sender: TObject); + procedure btnBrowserLocateClick(Sender: TObject); private { Private éŒ¾ } - function SelChPref: TChannelPrefs; - function BottleImage(ChPref: TChannelPrefs): integer; + FOldLUID: String; + FSpinUpdateFlag: boolean; + procedure LoadPlayTimeProfiles; + procedure PlayTimeParamsToSpinControl(Params: TSsPlayTimeParams); + procedure SpinControlToPlayTimeParams(Params: TSsPlayTimeParams); + procedure UpdateSpecialChars; public { Public éŒ¾ } procedure Execute; @@ -115,45 +157,48 @@ implementation {$R *.DFM} -uses MainForm; - -procedure TfrmSetting.ColorPick(Sender: TObject; var Col: TColor); -begin - ColorDialog.Color := Col; - if ColorDialog.Execute then begin - Col := ColorDialog.Color; - end; -end; +const + SettingIcon = 4; procedure TfrmSetting.Execute; var i: integer; - Node: TTreeNode; + Node: TCPCGroupNode; begin PageControl.ActivePage := tstGeneral; memDefaultScript.Text := Pref.DefaultScript; + 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; // - cbxColorScript.Checked := Pref.ColorScript; - colTalkColorH.SelColor := Pref.TalkColorH; - colTalkColorU.SelColor := Pref.TalkColorU; - colMarkUpColor.SelColor := Pref.MarkUpColor; - colMetaWordColor.SelColor := Pref.MetaWordColor; - colMarkErrorColor.SelColor := Pref.MarkErrorColor; - colBgColor.SelColor := Pref.BgColor; - trkColorTimeLag.Position := Pref.ColorTimeLagValue; - trkColorSpeed.Position := Pref.ColorSpeed; + with frmColorSetting do begin + Color['H'] := Pref.TalkColorH; + Color['U'] := Pref.TalkColorU; + Color['Synchro'] := Pref.TalkColorS; + Color['Tag'] := Pref.MarkUpColor; + Color['Meta'] := Pref.MetaWordColor; + Color['Error'] := Pref.MarkErrorColor; + Color['Text'] := Pref.TextColor; + Color['Background'] := Pref.BgColor; + end; + // + cbxPlayTimeProfile.Items.Clear; + cbxPlayTimeProfile.Items.Add(Pref.PlayTimeParams.ProfileName); + cbxPlayTimeProfile.ItemIndex := 0; + LoadPlayTimeProfiles; + PlayTimeParamsToSpinControl(Pref.PlayTimeParams); + UpdateSpecialChars; // cbxAutoStart.Checked := Pref.AutoStart; rgpTabPosition.ItemIndex := Ord(Pref.TabPosition); + spnTabWidth.Value := Pref.TabWidth; + if Pref.TabWidth <= 0 then + spnTabWidth.Value := 0; + cbxAutoTabWidth.Checked := Pref.TabWidth <= 0; spnGhostDropDownCount.Value := Pref.GhostDropDownCount; - { - cbxNoTranslate.Checked := Pref.NoTranslate; - cbxNoDescript.Checked := Pref.NoDescript; - cbxNoTransUrl.Checked := Pref.NoTransUrl; - cbxSilentWhenHidden.Checked := Pref.SilentWhenHidden; - } try with ctvBottle do begin (GetNodeFromKeyPath('Arrive\NoTranslate') as TCPCCheckBoxNode).Checked := Pref.NoTranslate; @@ -164,7 +209,13 @@ begin (GetNodeFromKeyPath('Arrive\UrlTag\WithSelection') as TCPCRadioNode).Check; (GetNodeFromKeyPath('Arrive\SilentWhenHidden') as TCPCCheckBoxNode).Checked := Pref.SilentWhenHidden; (GetNodeFromKeyPath('Arrive\FixMessySurface') as TCPCCheckBoxNode).Checked := Pref.FixMessySurface; + (GetNodeFromKeyPath('Arrive\HUTagTo01Tag') as TCPCCheckBoxNode).Checked := Pref.HUTagTo01Tag; (GetNodeFromKeyPath('Out\ResetIfGhostAfterSend') as TCPCCheckBoxNode).Checked := Pref.ResetIfGhostAfterSend; + (GetNodeFromKeyPath('Out\ClearAfterSend') as TCPCCheckBoxNode).Checked := Pref.ClearAfterSend; + (GetNodeFromKeyPath('Out\NeedConfirmBeforeSend') as TCPCCheckBoxNode).Checked := Pref.NeedConfirmBeforeSend; + (GetNodeFromKeyPath('Out\Confirm') as TCPCCheckBoxNode).Checked := not Pref.NoConfirm; + (GetNodeFromKeyPath('Out\Warn\ScopeChangeInSynchronize') as TCPCCheckBoxNode).Checked := Pref.WarnScopeChangeInSynchronize; + (GetNodeFromKeyPath('Out\Warn\YenTNotExist') as TCPCCheckBoxNode).Checked := Pref.WarnYenTNotExist; end; except on E: Exception do ShowMessage(E.Message); @@ -176,61 +227,72 @@ begin rgpWhenShiftReturn.ItemIndex := Ord(Pref.WhenShiftReturn); rgpWhenCtrlReturn.ItemIndex := Ord(Pref.WhenCtrlReturn); // - cbxPort.ItemIndex := cbxPort.Items.Count-1; //u‚»‚Ì‘¼v - for i := 0 to cbxPort.Items.Count-2 do begin - if StrToIntDef(cbxPort.Items[i], 0) = Pref.ServerPort then - cbxPort.ItemIndex := i; - end; - cbxUsePort.Checked := Pref.UsePort; - cbxPort.Enabled := cbxUsePort.Checked; - cbxUsePort.OnClick := cbxUsePortClick; //DialogŠJ‚¢‚½uŠÔ‚ÉŒx‚³‚ê‚È‚¢‚悤 + cbxUseHttpProxy.Checked := Pref.UseHttpProxy; + edtProxyAddress.Text := Pref.ProxyAddress; + edtProxyPort.Text := IntToStr(Pref.ProxyPort); + // + spnReconnectWait.Value := Pref.ReconnectWait; + // + edtLUID.Text := Pref.LUID; + // + memFMOName.Lines := Pref.FMOName; + cbxHideGhosts.Checked := Pref.HideGhosts; + memAutoJoinChannels.Lines := Pref.AutoJoinChannels; + cbxNoExtraSSTPHeaders.Checked := Pref.NoExtraSSTPHeaders; // - //Channels - tvwChannels.Items.Clear; - Node := tvwChannels.Items.Add(nil, 'ƒfƒtƒHƒ‹ƒg'); - Node.ImageIndex := 1; - Node.SelectedIndex := 1; - Node.Data := pointer(DefaultNode); - for i := 0 to Pref.ChannelPrefCount-1 do begin - Node := tvwChannels.Items.Add(nil, Pref.ChannelPrefIndex[i].ChannelName); - Node.Data := pointer(i); //–{“–‚Í‚â‚Á‚¿‚á‚¢‚¯‚È‚¢Int>PointerƒLƒƒƒXƒg - Node.ImageIndex := BottleImage(Pref.ChannelPrefIndex[i]); - Node.SelectedIndex := BottleImage(Pref.ChannelPrefIndex[i]); + with ctvSurfacePreview do + begin + (GetNodeFromKeyPath('OnHint\DoPreview') as TCPCCheckBoxNode).Checked := Pref.SurfacePreviewOnHint; + (GetNodeFromKeyPath('OnScriptPoint\DoPreview') as TCPCCheckBoxNode).Checked := Pref.SurfacePreviewOnScriptPoint; + Node := GetNodeFromKeyPath('OnScriptPoint\Position') as TCPCGroupNode; + (Node.Item[Ord(Pref.SurfacePreviewOnScriptPointPosition)] as TCPCRadioNode).Check; end; - cbxTargetGhost.Items.Clear; - cbxTargetGhost.Items.Add(ChannelDefaultGhost); - frmSender.SakuraSeeker.BeginDetect; - for i := 0 to frmSender.SakuraSeeker.Count-1 do begin - cbxTargetGhost.Items.Add(frmSender.SakuraSeeker[i].Name); + for i := 0 to Spps.Count-1 do + begin + with lvwPluginList.Items.Add do + begin + Caption := ExtractFileName(Spps.SppItem[i].ModuleName); + SubItems.Add(Spps.SppItem[i].PluginName); + end; end; - rgpUseChannelPrefs.Enabled := false; - rgpUseChannelPrefsClick(Self); + edtBrowserName.Text := Pref.BrowserExeName; + // - cbxUseHttpProxy.Checked := Pref.UseHttpProxy; - edtProxyAddress.Text := Pref.ProxyAddress; - edtProxyPort.Text := IntToStr(Pref.ProxyPort); ShowModal; end; procedure TfrmSetting.FormClose(Sender: TObject; var Action: TCloseAction); +var i: integer; + Node: TCPCGroupNode; begin Pref.DefaultScript := memDefaultScript.Text; + 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; + // + with frmColorSetting do begin + Pref.TalkColorH := Color['H']; + Pref.TalkColorU := Color['U']; + Pref.TalkColorS := Color['Synchro']; + Pref.MarkUpColor := Color['Tag']; + Pref.MetaWordColor := Color['Meta']; + Pref.MarkErrorColor := Color['Error']; + Pref.TextColor := Color['Text']; + Pref.BgColor := Color['Background']; + end; // - Pref.ColorScript := cbxColorScript.Checked; - Pref.TalkColorH := colTalkColorH.SelColor; - Pref.TalkColorU := colTalkColorU.SelColor; - Pref.MarkUpColor := colMarkUpColor.SelColor; - Pref.MetaWordColor := colMetaWordColor.SelColor; - Pref.MarkErrorColor := colMarkErrorColor.SelColor; - Pref.BgColor := colBgColor.SelColor; - Pref.ColorTimeLagValue := trkColorTimeLag.Position; - Pref.ColorSpeed := trkColorSpeed.Position; + Pref.PlayTimeParams.ProfileName := cbxPlayTimeProfile.Text; + SpinControlToPlayTimeParams(Pref.PlayTimeParams); // Pref.AutoStart := cbxAutoStart.Checked; Pref.TabPosition := TTabPosition(rgpTabPosition.ItemIndex); + Pref.TabWidth := spnTabWidth.Value; + if cbxAutoTabWidth.Checked then + Pref.TabWidth := 0; Pref.GhostDropDownCount := spnGhostDropDownCount.Value; try with ctvBottle do begin @@ -239,7 +301,13 @@ begin Pref.NoTransUrl := (GetNodeFromKeyPath('Arrive\UrlTag\NoSelection') as TCPCRadioNode).Checked; Pref.SilentWhenHidden := (GetNodeFromKeyPath('Arrive\SilentWhenHidden') as TCPCCheckBoxNode).Checked; Pref.FixMessySurface := (GetNodeFromKeyPath('Arrive\FixMessySurface') as TCPCCheckBoxNode).Checked; + Pref.HUTagTo01Tag := (GetNodeFromKeyPath('Arrive\HUTagTo01Tag') as TCPCCheckBoxNode).Checked; Pref.ResetIfGhostAfterSend := (GetNodeFromKeyPath('Out\ResetIfGhostAfterSend') as TCPCCheckBoxNode).Checked; + Pref.ClearAfterSend := (GetNodeFromKeyPath('Out\ClearAfterSend') as TCPCCheckBoxNode).Checked; + Pref.NeedConfirmBeforeSend := (GetNodeFromKeyPath('Out\NeedConfirmBeforeSend') as TCPCCheckBoxNode).Checked; + Pref.NoConfirm := not (GetNodeFromKeyPath('Out\Confirm') as TCPCCheckBoxNode).Checked; + Pref.WarnYenTNotExist := (GetNodeFromKeyPath('Out\Warn\YenTNotExist') as TCPCCheckBoxNode).Checked; + Pref.WarnScopeChangeInSynchronize := (GetNodeFromKeyPath('Out\Warn\ScopeChangeInSynchronize') as TCPCCheckBoxNode).Checked; end; except on E: Exception do ShowMessage(E.Message); @@ -251,177 +319,440 @@ begin Pref.WhenShiftReturn := TReturnKeyFunction(rgpWhenShiftReturn.ItemIndex); Pref.WhenCtrlReturn := TReturnKeyFunction(rgpWhenCtrlReturn.ItemIndex); // - Pref.UsePort := cbxUsePort.Checked; - // Pref.UseHttpProxy := cbxUseHttpProxy.Checked; Pref.ProxyAddress := edtProxyAddress.Text; Pref.ProxyPort := StrToInt(edtProxyPort.Text); + // + Pref.ReconnectWait := spnReconnectWait.Value; + // + Pref.LUID := edtLUID.Text; + // + Pref.FMOName := memFMOName.Lines; + SakuraSeeker.FileMappingTarget := Pref.FMOName; + Pref.HideGhosts := cbxHideGhosts.Checked; + Pref.NoExtraSSTPHeaders := cbxNoExtraSSTPHeaders.Checked; + // + Pref.AutoJoinChannels := memAutoJoinChannels.Lines; + // + with ctvSurfacePreview do + begin + Pref.SurfacePreviewOnHint := (GetNodeFromKeyPath('OnHint\DoPreview') as TCPCCheckBoxNode).Checked; + Pref.SurfacePreviewOnScriptPoint := (GetNodeFromKeyPath('OnScriptPoint\DoPreview') as TCPCCheckBoxNode).Checked; + Node := GetNodeFromKeyPath('OnScriptPoint\Position') as TCPCGroupNode; + for i := 0 to Node.Count-1 do + if (Node.Item[i] as TCPCRadioNode).Checked then + Pref.SurfacePreviewOnScriptPointPosition := TSurfacePreviewOnScriptPointPosition(i); + end; + // + Pref.BrowserExeName := edtBrowserName.Text; + end; -procedure TfrmSetting.cbxPortChange(Sender: TObject); -var Str: String; - i: integer; +procedure TfrmSetting.edtProxyPortKeyPress(Sender: TObject; var Key: Char); begin - with cbxPort do begin - if ItemIndex = Items.Count-1 then begin - //‚»‚Ì‘¼ - Str := IntToStr(Pref.ServerPort); - if InputQuery('ƒ|[ƒg”ԍ†‚ÌŽw’è', 'ƒ|[ƒg”ԍ†', Str) then begin - Pref.ServerPort := StrToIntDef(Str, Pref.ServerPort); - end; - end else begin - Pref.ServerPort := StrToIntDef(Items[ItemIndex], Pref.ServerPort); - end; - for i := 0 to Items.Count-2 do begin - if Pref.ServerPort = StrToInt(Items[i]) then ItemIndex := i; - end; + if not(Key in ['0'..'9']) then Key := Char(0); +end; + +procedure TfrmSetting.ctvBottleNodeChecked(Sender: TObject; + Node: TCPCConfigItemNode); +begin + //ShowMessage(ctvBottle.GetFullKeyPath(Node)); +end; + +procedure TfrmSetting.ctvBottleNodeChecking(Sender: TObject; + Node: TCPCConfigItemNode; var Allow: Boolean); +begin + if Node.KeyName = 'IgnoreBottle' then begin + MessageDlg('‚±‚Ì‹@”\‚ÍŽÀ‘•‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ', mtError, [mbOk], 0); + Allow := false; end; end; -procedure TfrmSetting.edtSoundFileButtonClick(Sender: TObject); +procedure TfrmSetting.tstRuleShow(Sender: TObject); +begin + frmRuleList.UpdateDisplay; +end; + +procedure TfrmSetting.btnUseCurrentJoinChannelsClick(Sender: TObject); +begin + memAutoJoinChannels.Lines := JoinChannels; +end; + +procedure TfrmSetting.btnVisibleGhostsClick(Sender: TObject); +var i: integer; + FullGhosts: TStringList; begin - if OpenDialog.Execute then begin - edtSoundFile.Text := OpenDialog.FileName; + FullGhosts := TStringList.Create; + SakuraSeeker.BeginDetect; + try + for i := 0 to SakuraSeeker.Count-1 do + FullGhosts.Add(SakuraSeeker[i].Name); + StrListEdit(Pref.VisibleGhostsList, 'ƒS[ƒXƒg‚ðŽw’è', true, FullGhosts); + finally + FullGhosts.Free; end; end; -procedure TfrmSetting.tvwChannelsCompare(Sender: TObject; Node1, - Node2: TTreeNode; Data: Integer; var Compare: Integer); +procedure TfrmSetting.lvwPluginListDblClick(Sender: TObject); +var Index: integer; begin - if Node1.Text = 'ƒfƒtƒHƒ‹ƒg' then - Compare := -1 - else if Node2.Text = 'ƒfƒtƒHƒ‹ƒg' then - Compare := 1 + if lvwPluginList.Selected = nil then + Exit; + Index := lvwPluginList.Selected.Index; + if pfConfigure in Spps.SppItem[Index].PluginFunctions then + Spps.SppItem[Index].Configure else - Compare := AnsiCompareStr(Node1.Text, Node2.Text); + ShowMessage('’ljÁ‚̐ݒ荀–Ú‚Í‚ ‚è‚Ü‚¹‚ñB'); +end; + +procedure TfrmSetting.edtLUIDEnter(Sender: TObject); +begin + FOldLUID := edtLUID.Text; end; -procedure TfrmSetting.tvwChannelsChange(Sender: TObject; Node: TTreeNode); -var ChPref: TChannelPrefs; +procedure TfrmSetting.edtLUIDExit(Sender: TObject); +var TmpLUID: String; + i: integer; + Err: boolean; begin - rgpUseChannelPrefs.Enabled := true; - if integer(Node.Data) = DefaultNode then begin - ChPref := Pref.DefChannelPref; - cbxCanAutoAdd.Enabled := false; - cbxWarnPost.Enabled := false; - rgpUseChannelPrefs.Enabled := false; - cbxSoundArrived.AllowGrayed := false; - end else begin - ChPref := Pref.ChannelPrefIndex[integer(Node.Data)]; - cbxCanAutoAdd.Enabled := true; - cbxWarnPost.Enabled := true; - rgpUseChannelPrefs.Enabled := true; - cbxSoundArrived.AllowGrayed := true; + TmpLUID := edtLUID.Text; + i := 1; + Err := false; + if Length(TmpLUID) <> 82 then + Err := true + else + while i <= Length(TmpLUID) do + begin + if not (TmpLUID[i] in ['0'..'9', 'a'..'z', 'A'..'Z', '.', ',']) then + begin + Err := true; + Break; + end; + Inc(i); + end; + if Err then + begin + ShowMessage('LUID‚Ì“à—e‚ª•s³‚Å‚·'); + edtLUID.Text := FOldLUID; end; - cbxCanAutoAdd.Checked := ChPref.CanAutoAdd; - cbxWarnPost.Checked := ChPref.WarnPost; - if ChPref.UseChannelPrefs then begin - rgpUseChannelPrefs.ItemIndex := 0; - end else begin - rgpUseChannelPrefs.ItemIndex := 1; +end; + +procedure TfrmSetting.btnCopyLUIDClick(Sender: TObject); +begin + Clipboard.SetTextBuf(PChar(edtLUID.Text)); +end; + +procedure TfrmSetting.FormCreate(Sender: TObject); +var + i: integer; + Cap: String; + Node: TTreeNode; +begin + for i := 0 to PageControl.PageCount-1 do + begin + Cap := PageControl.Pages[i].Caption; + if Pos(':', Cap) > 0 then + Cap := Copy(Cap, 1, Pos(':', Cap)-1); + Node := tvwCategory.Items.Add(nil, Cap); + Node.ImageIndex := -1; + Node.SelectedIndex := SettingIcon; end; - cbxSoundArrived.State := TCheckBoxState(ChPref.SoundArrived); - edtSoundFile.Text := ChPref.SoundFile; - cbxIgnoreIfGhost.Checked := ChPref.IgnoreIfGhost; - if ChPref.TargetGhost <> '' then - cbxTargetGhost.Text := ChPref.TargetGhost - else - cbxTargetGhost.Text := ChannelDefaultGhost; + tvwCategoryChange(Self, tvwCategory.Items[0]); + tvwCategory.Items[0].Selected := true; +end; + +procedure TfrmSetting.tvwCategoryChange(Sender: TObject; Node: TTreeNode); +begin + PageControl.ActivePageIndex := Node.Index; + pnlHeading.Caption := PageControl.ActivePage.Caption; end; -procedure TfrmSetting.rgpUseChannelPrefsClick(Sender: TObject); +procedure TfrmSetting.tvwCategoryMouseMove(Sender: TObject; + Shift: TShiftState; X, Y: Integer); +var + Node: TTreeNode; + NewHint: String; + CPos: TPoint; begin - pnlChannelOpt.Visible := ((rgpUseChannelPrefs.ItemIndex = 0) and - (tvwChannels.Selected <> nil)); - if SelChPref <> nil then begin - SelChPref.UseChannelPrefs := (rgpUseChannelPrefs.ItemIndex = 0); - tvwChannels.Selected.ImageIndex := BottleImage(SelChPref); - tvwChannels.Selected.SelectedIndex := BottleImage(SelChPref); + Node := tvwCategory.GetNodeAt(X, Y); + if Node <> nil then + begin + NewHint := PageControl.Pages[Node.Index].Caption; + if tvwCategory.Hint <> NewHint then + begin + tvwCategory.Hint := NewHint; + GetCursorPos(CPos); + Application.ActivateHint(CPos); + end; + end else + begin + tvwCategory.Hint := ''; + Application.HideHint; end; end; -function TfrmSetting.BottleImage(ChPref: TChannelPrefs): integer; +procedure TfrmSetting.PlayTimeParamsToSpinControl(Params: TSsPlayTimeParams); begin - if ChPref = Pref.DefChannelPref then Result := 1 - else if ChPref.UseChannelPrefs then Result := CheckedBottle - else Result := UnCheckedBottle; + FSpinUpdateFlag := true; + with Params do + begin + spnCostWait.Value := CostWait; + spnCostSurface.Value := CostSurface; + spnCostChar.Value := CostChar; + spnCostDBChar.Value := CostDBChar; + spnCostQuickChar.Value := CostQuickChar; + lvwCostSpecials.Items.Clear; + end; + FSpinUpdateFlag := false; end; -function TfrmSetting.SelChPref: TChannelPrefs; +procedure TfrmSetting.SpinControlToPlayTimeParams(Params: TSsPlayTimeParams); begin - if tvwChannels.Selected = nil then begin - Result := nil; - Exit; - end else if integer(tvwChannels.Selected.Data) = DefaultNode then begin - Result := Pref.DefChannelPref; - end else begin - Result := Pref.ChannelPrefIndex[integer(tvwChannels.Selected.Data)]; + with Params do + begin + CostWait := spnCostWait.Value; + CostSurface := spnCostSurface.Value; + CostChar := spnCostChar.Value; + CostDBChar := spnCostDBChar.Value; + CostQuickChar := spnCostQuickChar.Value; end; end; -procedure TfrmSetting.cbxSoundArrivedClick(Sender: TObject); + +procedure TfrmSetting.LoadPlayTimeProfiles; +var i: integer; + F: TSearchRec; + Path, Item: String; begin - SelChPref.SoundArrived := TSoundArrived(cbxSoundArrived.State); + Path := ExtractFilePath(Application.ExeName); + i := FindFirst(Path + 'playtime\*.txt', 0, F); + if i = 0 then begin + repeat + Item := ChangeFileExt(F.Name, ''); + if cbxPlayTimeProfile.Items.IndexOf(Item) < 0 then + cbxPlayTimeProfile.Items.Add(ChangeFileExt(F.Name, '')); + i := FindNext(F); + until i <> 0; + end; + FindClose(F); end; -procedure TfrmSetting.edtSoundFileChange(Sender: TObject); +procedure TfrmSetting.cbxPlayTimeProfileChange(Sender: TObject); +var + Params: TSsPlayTimeParams; + Strs: TStringList; + Path, ProName: String; begin - SelChPref.SoundFile := edtSoundFile.Text; + try + Strs := TStringList.Create; + ProName := cbxPlayTimeProfile.Text; + try + Path := ExtractFilePath(Application.ExeName) + 'playtime\'; + Strs.LoadFromFile(Path + ProName + '.txt'); + Params := StringToComponent(Strs.Text) as TSsPlayTimeParams; + try + PlayTimeParamsToSpinControl(Params); + Pref.PlayTimeParams.Assign(Params); + UpdateSpecialChars; + finally + Params.Free; + end; + finally + Strs.Free; + end; + with cbxPlayTimeProfile do + begin + Items.Clear; + LoadPlayTimeProfiles; + ItemIndex := Items.IndexOf(ProName); + end; + except + ; // Do nothing + end; end; -procedure TfrmSetting.cbxTargetGhostChange(Sender: TObject); +procedure TfrmSetting.btnSavePlayTimeProfileClick(Sender: TObject); +var + ProfileName, Path, FileName: String; + Strs: TStringList; begin - if cbxTargetGhost.ItemIndex = 0 then - SelChPref.TargetGhost := '' - else - SelChPref.TargetGhost := cbxTargetGhost.Text; + ProfileName := cbxPlayTimeProfile.Text; + if InputQuery('ƒvƒƒtƒ@ƒCƒ‹–¼', '•Û‘¶‚·‚éƒvƒƒtƒ@ƒCƒ‹–¼', ProfileName) then + begin + try + Path := ExtractFilePath(Application.ExeName) + 'playtime\'; + FileName := Path + ProfileName + '.txt'; + if FileExists(FileName) then + if MessageDlg(Format('ƒvƒƒtƒ@ƒCƒ‹"%s"‚ðã‘‚«‚µ‚Ü‚·', [ProfileName]), + mtConfirmation, mbOkCancel, 0) = mrCancel then + Exit; + Strs := TStringList.Create; + try + SpinControlToPlayTimeParams(Pref.PlayTimeParams); + Pref.PlayTimeParams.ProfileName := ProfileName; + Strs.Text := ComponentToString(Pref.PlayTimeParams); + Strs.SaveToFile(FileName); + finally + Strs.Free; + end; + with cbxPlayTimeProfile do + begin + Items.Clear; + Items.Add(ProfileName); + ItemIndex := 0; + LoadPlayTimeProfiles; + end; + except + on E: Exception do + ShowMessage('•Û‘¶‚ÉŽ¸”s‚µ‚Ü‚µ‚½B' + E.Message); + end; + end; end; -procedure TfrmSetting.cbxIgnoreIfGhostClick(Sender: TObject); +procedure TfrmSetting.spnCostWaitChange(Sender: TObject); +var + ProName: String; +const + Modified = '(•ÏXÏ‚Ý)'; begin - SelChPref.IgnoreIfGhost := cbxIgnoreIfGhost.Checked; + if FSpinUpdateFlag then + Exit; + ProName := cbxPlayTimeProfile.Text; + if Copy(ProName, Length(ProName)-Length(Modified)+1, Length(Modified)) <> Modified then + begin + ProName := Format('%s%s', [ProName, Modified]); + with cbxPlayTimeProfile do + begin + Items.Clear; + Items.Add(ProName); + ItemIndex := 0; + LoadPlayTimeProfiles; + end; + end; end; -procedure TfrmSetting.cbxUsePortClick(Sender: TObject); -var Re: integer; -const Mes = ']—ˆ‚Ì•û–@‚ð‘I‘ð‚µ‚½ê‡ASSTP‚ðŽóM‚Å‚«‚éƒS[ƒXƒg‚Í'+ - 'ƒ‰ƒ“ƒ_ƒ€‚Ȉê‘Ì‚¾‚¯‚Æ‚È‚èAIfGhost‚ªˆêØŽg—p‚Å‚«‚È‚­‚È‚è‚Ü‚·B'; +procedure TfrmSetting.btnPlaySpecialAddClick(Sender: TObject); +var + Item: TListItem; + SPChar: TSsPlayTimeSpecialChar; begin - if cbxUsePort.Checked then begin - Re := MessageDlg(Mes, mtWarning, mbOkCancel, 0); - if Re = mrCancel then cbxUsePort.Checked := false; + Application.CreateForm(TfrmSpecialCharEditor, frmSpecialCharEditor); + try + with frmSpecialCharEditor do + begin + SpecialChar := ''; + Cost := 50; + if Execute then + begin + SPChar := Pref.PlayTimeParams.SpecialChars.Add as TSsPlayTimeSpecialChar; + SPChar.Char := SpecialChar; + SPChar.Wait := Cost; + Item := lvwCostSpecials.Items.Add; + Item.Caption := SPChar.DisplayChar; + Item.SubItems.Add(IntToStr(Cost)); + spnCostWaitChange(Self); + end; + end; + finally + frmSpecialCharEditor.Release; end; - cbxPort.Enabled := cbxUsePort.Checked; - Pref.UsePort := cbxUsePort.Checked; end; -procedure TfrmSetting.cbxCanAutoAddClick(Sender: TObject); +procedure TfrmSetting.btnPlaySpecialDeleteClick(Sender: TObject); begin - SelChPref.CanAutoAdd := cbxCanAutoAdd.Checked; + with lvwCostSpecials do + if Selected <> nil then + begin + Pref.PlayTimeParams.SpecialChars.Delete(Selected.Index); + Selected.Delete; + spnCostWaitChange(Self); + end; end; -procedure TfrmSetting.edtProxyPortKeyPress(Sender: TObject; var Key: Char); +procedure TfrmSetting.lvwCostSpecialsDblClick(Sender: TObject); +var + Item: TListItem; + SPChar: TSsPlayTimeSpecialChar; begin - if not(Key in ['0'..'9']) then Key := Char(0); + with lvwCostSpecials do + begin + Item := Selected; + if Item <> nil then + begin + Application.CreateForm(TfrmSpecialCharEditor, frmSpecialCharEditor); + try + with frmSpecialCharEditor do + begin + SPChar := Pref.PlayTimeParams.SpecialChars.Items[Item.Index] as TSsPlayTimeSpecialChar; + SpecialChar := SPChar.Char; + Cost := SPChar.Wait; + if Execute then + begin + SPChar.Char := SpecialChar; + SPChar.Wait := Cost; + Item.Caption := SPChar.DisplayChar; + Item.SubItems[0] := IntToStr(Cost); + spnCostWaitChange(Self); + end; + end; + finally + frmSpecialCharEditor.Release; + end; + end; + end; end; -procedure TfrmSetting.cbxWarnPostClick(Sender: TObject); +procedure TfrmSetting.UpdateSpecialChars; +var + i: integer; + Item: TListItem; + SPChar: TSsPlayTimeSpecialChar; begin - SelChPref.WarnPost := cbxWarnPost.Checked; + with lvwCostSpecials do + begin + Items.Clear; + for i := 0 to Pref.PlayTimeParams.SpecialChars.Count-1 do + begin + SPChar := Pref.PlayTimeParams.SpecialChars.Items[i] as TSsPlayTimeSpecialChar; + Item := Items.Add; + Item.Caption := SPChar.DisplayChar; + Item.SubItems.Add(IntToStr(SPChar.Wait)); + end; + end; end; -procedure TfrmSetting.ctvBottleNodeChecked(Sender: TObject; - Node: TCPCConfigItemNode); +procedure TfrmSetting.spnTabWidthChange(Sender: TObject); begin - //ShowMessage(ctvBottle.GetFullKeyPath(Node)); + with cbxAutoTabWidth do + begin + OnClick := nil; + cbxAutoTabWidth.Checked := false; + OnClick := cbxAutoTabWidthClick; + end; end; -procedure TfrmSetting.ctvBottleNodeChecking(Sender: TObject; - Node: TCPCConfigItemNode; var Allow: Boolean); +procedure TfrmSetting.cbxAutoTabWidthClick(Sender: TObject); begin - if Node.KeyName = 'IgnoreBottle' then begin - MessageDlg('‚±‚Ì‹@”\‚ÍŽÀ‘•‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ', mtError, [mbOk], 0); - Allow := false; + with spnTabWidth do + begin + OnChange := nil; + try + if not cbxAutoTabWidth.Checked then + if Value = 0 then + Value := 80; + finally + OnChange := spnTabWidthChange; + end; + end; +end; + +procedure TfrmSetting.btnBrowserLocateClick(Sender: TObject); +begin + with BrowserLocateOpenDialog do + begin + FileName := edtBrowserName.Text; + if Execute then + edtBrowserName.Text := FileName; end; end;