ComCtrls, ToolWin, StdCtrls, ExtCtrls, SsParser, BottleDef, Menus,
Clipbrd, Logs, ShellAPI, Commctrl, DirectSstp, Contnrs, StrUtils,
TalkShowFrame, SppList, HtmlOutputConfig, HtmlOutputProgress,
- SearchLog, IniFiles, BRegExp;
+ SearchLog, IniFiles, BRegExp, RegexUtils;
type
// \83\8d\83O\82Ì\95Û\91¶\95û\96@
mnTabSaveXMLLog: TMenuItem;
mnSaveHTML: TMenuItem;
mnPopupCopyGhost: TMenuItem;
+ PopupMenuAction: TPopupMenu;
+ mnTestAction: TMenuItem;
+ mnSelAction: TMenuItem;
procedure tbtnClearClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure lvwLogChange(Sender: TObject; Item: TListItem;
procedure mnTabSaveXMLLogClick(Sender: TObject);
procedure mnSaveHTMLClick(Sender: TObject);
procedure mnPopupCopyGhostClick(Sender: TObject);
+ procedure mnTestActionClick(Sender: TObject);
+ procedure mnSelActionClick(Sender: TObject);
private
{ Private \90é\8c¾ }
FLastScript: String; //\83X\83N\83\8a\83v\83g\8dÄ\95`\89æ\97}\90§\97p
Item: TListItem);
procedure PreviewStyleChange;
procedure DrawListViewDragBorder(const Rect: TRect);
- procedure DoSaveLogXML(Log: TBottleLogList);
+ function DoSaveLogXML(Log: TBottleLogList): integer;
procedure DoCloseTab(const Index: integer);
function DoSearchLog(Condition: TSearchCond): TBottleLogList;
procedure SearchLogIndivisual(Condition: TSearchCond;
LogList, Result: TBottleLogList; UntilIndex: integer = -1);
+ function CheckLogSave(const Index: integer): integer;
protected
procedure CreateParams(var Params: TCreateParams); override;
public
{ Public \90é\8c¾ }
function SelectedBottleLog: TBottleLogList;
property BottleLogList: TObjectList read FBottleLogList;
- procedure AddCurrentScriptLog(const LogName, Script, Channel, MID, Ghost: String);
+ procedure AddCurrentScriptLog(const LogName, Script, Channel, MID, Ghost: String;
+ const LogTime: TDateTime; const Vote, Agree: integer);
procedure AddCurrentSystemLog(const LogName, MessageString: String);
procedure VoteLog(const MID: String; const Vote: integer);
procedure AgreeLog(const MID: String; const Agree: integer);
procedure UpdateTab;
procedure UpdateWindow;
procedure SelAndFocusMessage(const MID: String);
+ function CheckLog(Sender: TObject): integer;
end;
TBottleLogDragObject = class(TDragControlObjectEx)
{ TfrmLog }
-procedure TfrmLog.AddCurrentScriptLog(const LogName, Script, Channel, MID, Ghost: String);
+procedure TfrmLog.AddCurrentScriptLog(const LogName, Script, Channel, MID, Ghost: String;
+ const LogTime: TDateTime; const Vote, Agree: integer);
var Sel: integer;
begin
- BottleLogTitled(LogName).AddScriptLog(Script, Channel, MID, Ghost);
+ BottleLogTitled(LogName).AddScriptLog(Script, Channel, MID, Ghost, LogTime, Vote, Agree);
+ BottleLogTitled(LogName).LogModified := true; // \82±\82Ì\83\8a\83X\83g\82Í\95Ï\8dX\82³\82ê\82½
if SelectedBottleLog <> BottleLogTitled(LogName) then Exit;
lvwLog.OnChange := nil; //\83C\83x\83\93\83g\94\90¶(\82¢\82ë\82¢\82ë\8dÄ\95`\89æ\82ª\8bN\82«\82é)\82Ì\97}\90§
if lvwLog.Selected <> nil then Sel := lvwLog.Selected.Index else Sel := -1;
TalkShowFrame.SetPreviewFont(edtScript.Font);
TalkShowFrame.PrevControl := lvwLog;
+ mnSelAction.Checked := Pref.LogAction; // \8f\89\8aú\89»
+
PreviewStyleChange;
UpdateWindow; // Reset window color and enabled status of some buttons
end;
StatusBar.Panels[0].Text := Format('%d/%d\8c\8f', [lvwLog.Selected.Index+1,
SelectedBottleLog.Count]);
Log := SelectedBottleLog.Bottles[lvwLog.Selected.Index];
- if (Log.LogType = ltBottle) and not frmSender.Connecting then begin
+// if (Log.LogType = ltBottle) and not frmSender.Connecting then begin
+ if Log.LogType = ltBottle then begin
IsNormalBottle := true;
Script := Log.Script;
Text := Format('%d\83o\83C\83g/%d\95b - \83_\83u\83\8b\83N\83\8a\83b\83N\82Å\8dÄ\90¶',
if Log = nil then Exit;
if Log.LogType <> ltBottle then
Exit;
- Script := frmSender.ScriptTransForSSTP(Log.Script, ErrorMes);
+ //\92P\91Ì\83A\83N\83V\83\87\83\93\82ª\97L\8cø\82Å\82 \82ê\82Î\83X\83N\83\8a\83v\83g\82Ì\95Ï\8a·\82µ\82È\82¢
+ if Pref.LogAction then
+ begin
+ Script := Log.Script;
+ ErrorMes := '';
+ end else
+ Script := frmSender.ScriptTransForSSTP(Log.Script, ErrorMes);
+
if ErrorMes <> '' then
begin
Res := MessageDlg('\96â\91è\82Ì\82 \82é\83X\83N\83\8a\83v\83g\82Å\82·\81B\8dÄ\90¶\82Å\82«\82Ü\82¹\82ñ\81B'#13#10+
CueItem := TLogItem.Create(Log);
try
- CueItem.Script := Script;
- frmSender.BottleSstp.Unshift(CueItem);
+ //\83A\83N\83V\83\87\83\93\82ª\97L\8cø\82Å\82 \82ê\82Î\92Ê\8fí\8f\88\97\9d\8fÈ\97ª
+ if Pref.LogAction then
+ //\8c^\95Ï\8a·\82Æ\8eó\90M
+ frmSender.BottleCnv(CueItem)
+ else
+ begin
+ //\83`\83\83\83\93\83l\83\8b\83S\81[\83X\83g\91Î\8dô
+ if CueItem.Ghost = '' then
+ if ChannelList.Channel[CueItem.Channel] <> nil then
+ CueItem.Ghost := ChannelList.Channel[CueItem.Channel].Ghost;
+ CueItem.Script := Script;
+ frmSender.BottleSstp.Unshift(CueItem);
+ end;
except
CueItem.Free;
end;
begin
if SelectedBottleLog = nil then Exit;
SaveDialog.FileName := GetDefaultFileName(SelectedBottleLog.Title, '.log');
- SaveDialog.InitialDir := ExtractFileDir(Application.ExeName);
+ SaveDialog.InitialDir := Pref.LogDir;
SaveDialog.DefaultExt := 'log';
SaveDialog.FilterIndex := 1;
if SaveDialog.Execute then
begin
if SelectedBottleLog = nil then Exit;
SaveDialog.FileName := GetDefaultFileName(SelectedBottleLog.Title, '.log');
- SaveDialog.InitialDir := ExtractFileDir(Application.ExeName);
+ SaveDialog.InitialDir := Pref.LogDir;
SaveDialog.DefaultExt := 'log';
SaveDialog.FilterIndex := 1;
if SaveDialog.Execute then
begin
if SelectedBottleLog = nil then Exit;
SaveDialog.FileName := GetDefaultFileName(SelectedBottleLog.Title, '.txt');
- SaveDialog.InitialDir := ExtractFileDir(Application.ExeName);
+ SaveDialog.InitialDir := Pref.LogDir;
SaveDialog.DefaultExt := 'txt';
SaveDialog.FilterIndex := 2;
if SaveDialog.Execute then
procedure TfrmLog.mnURLClick(Sender: TObject);
var LogItem: TLogItem;
- URL: String;
+ URL: string;
Urls: TStringList;
begin
if (lvwLog.Selected = nil) or (SelectedBottleLog = nil) then Exit;
try
ExtractURLs(LogItem.Script, Urls);
URL := Urls[(Sender as TMenuItem).Tag];
- ShellExecute(Handle, 'open', PChar(URL), nil, nil, SW_SHOW);
+ frmSender.OpenBrowser(URL);
finally
Urls.Free;
end;
i, Index: integer;
begin
Index := -1;
+ OpenDialog.InitialDir := Pref.LogDir;
if OpenDialog.Execute then begin
for i := 0 to OpenDialog.Files.Count-1 do begin
BottleLog := TBottleLogList.Create(ExtractFileName(OpenDialog.Files[i]));
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var Index: integer;
begin
- with tabBottleLog do begin
- Index := IndexOfTabAt(X, Y);
- if Index = -1 then Exit; //\83^\83u\82ª\82È\82¢\82Ì\82Å\83h\83\89\83b\83O\82Å\82«\82È\82¢
- if Button = mbLeft then begin
- FDragTabIndex := Index; //\83h\83\89\83b\83O\82·\82é\83^\83u\82Ì\83C\83\93\83f\83b\83N\83X\82ð\95Û\91¶
- BeginDrag(False);
- FDragTabDest := -1; //\83h\83\89\83b\83O\98g\90ü\95`\89æ\83t\83\89\83O\83N\83\8a\83A\82Ì\82½\82ß
+ if Button = mbMiddle then
+ begin
+ //\92\86\83{\83^\83\93\83N\83\8a\83b\83N\82Å\83^\83u\8dí\8f\9c
+ DoCloseTab(tabBottleLog.IndexOfTabAt(X, Y));
+ end else
+ begin
+ with tabBottleLog do begin
+ Index := IndexOfTabAt(X, Y);
+ if Index = -1 then Exit; //\83^\83u\82ª\82È\82¢\82Ì\82Å\83h\83\89\83b\83O\82Å\82«\82È\82¢
+ if Button = mbLeft then begin
+ FDragTabIndex := Index; //\83h\83\89\83b\83O\82·\82é\83^\83u\82Ì\83C\83\93\83f\83b\83N\83X\82ð\95Û\91¶
+ BeginDrag(False);
+ FDragTabDest := -1; //\83h\83\89\83b\83O\98g\90ü\95`\89æ\83t\83\89\83O\83N\83\8a\83A\82Ì\82½\82ß
+ end;
end;
end;
end;
Inc(DestRect.Top, 2);
Dec(DestRect.Right, 2);
DrawTextEx(lvwLog.Canvas.Handle, PChar(Item.Caption), -1, DestRect,
- DT_SINGLELINE or DT_END_ELLIPSIS, nil);
+ DT_SINGLELINE or DT_RIGHT, nil);
ListView_GetItemRect(lvwLog.Handle, Item.Index, DestRect, LVIR_ICON);
Ico := TIcon.Create;
try
if (GetAsyncKeyState(VK_CONTROL) and $8000) > 0 then
begin // \83R\83s\81[\88Ú\93®\82Ì\8fê\8d\87
SrcLog := TLogItem.Create(Src.LogItem);
+ SelectedBottleLog.LogModified := true; // \95Ï\8dX\88µ\82¢\82É\82·\82é
end else // \88Ú\93®\82¾\82¯\82·\82é\8fê\8d\87
begin
SrcLog := Src.BottleLogList.Extract(Src.LogItem);
+ // \88Ú\93®\8c³\82Æ\88Ú\93®\90æ\82ª\88á\82Á\82Ä\82¢\82ê\82Î\97¼\95û\82Ì\83t\83\89\83O\82ð\97§\82Ä\82é
+ if SelectedBottleLog.SelectedIndex <> Src.BottleLogList.SelectedIndex then
+ begin
+ Src.BottleLogList.LogModified := true; // \88Ú\93®\8c³
+ SelectedBottleLog.LogModified := true; // \88Ú\93®\90æ
+ end;
end;
if TargetItem >= 0 then
begin
end;
end;
-procedure TfrmLog.DoSaveLogXML(Log: TBottleLogList);
+function TfrmLog.DoSaveLogXML(Log: TBottleLogList): integer;
+var
+ Res: integer;
begin
+ Res := idYes;
SaveDialog.FileName := GetDefaultFileName(Log.Title, '.xml');
- SaveDialog.InitialDir := ExtractFileDir(Application.ExeName);
+ SaveDialog.InitialDir := Pref.LogDir;
SaveDialog.DefaultExt := 'xml';
SaveDialog.FilterIndex := 3;
if SaveDialog.Execute then
- Log.SaveToXmlFile(SaveDialog.FileName);
+ Log.SaveToXmlFile(SaveDialog.FileName)
+ else
+ Res := idCancel;
+ Result := Res;
end;
procedure TfrmLog.DoCloseTab(const Index: integer);
PrevSelection: TBottleLogList; // \95Â\82¶\82½\82Æ\82«\83^\83u\82ª\82¸\82ê\82È\82¢\82æ\82¤\82É\82·\82é\8f\88\97\9d\97p
i: integer;
begin
+ if CheckLogSave(Index) = idCancel then exit; // \83\8d\83O\82Ì\95Û\91¶\8am\94F
if Pref.ConfirmOnTabClose then
begin
Confirm := Format('\83^\83u"%s"\82ð\95Â\82¶\82Ü\82·\82©?', [(FBottleLogList[Index] as TBottleLogList).Title]);
Result);
end;
end;
+
+ if Result.Count = 0 then
+ Result.AddSystemLog('\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
end;
procedure TfrmLog.SearchLogIndivisual(Condition: TSearchCond; LogList,
Clip.SetTextBuf(PChar(Log.Ghost));
end;
+function TfrmLog.CheckLog(Sender: TObject): integer;
+var
+ i, Res: integer;
+begin
+ // \91S\82Ä\82Ì\83\8a\83X\83g\81i\83^\83u\81j\83`\83F\83b\83N\82·\82é
+ // frmSender\82©\82ç\8fI\97¹\8e\9e\82É\8cÄ\82Ñ\8fo\82³\82ê\82é
+ Res := idNo;
+ for i := 0 to BottleLogList.Count-1 do
+ begin
+ Res := CheckLogSave(i);
+ if Res = idCancel then break;
+ end;
+ Result := Res;
+end;
+
+function TfrmLog.CheckLogSave(const Index: integer): integer;
+var
+ Res: integer;
+ Confirm: string;
+begin
+ // \83\8a\83X\83g\82ð\83`\83F\83b\83N\82µ\81A\95Û\91¶\8f\88\97\9d\82ð\8cÄ\82Ñ\8fo\82·
+ Res := idNo;
+ if (BottleLogList[Index] as TBottleLogList).LogModified then
+ begin
+ Confirm := Format('\83^\83u %s \82Ì\93à\97e\82Í\95Ï\8dX\82³\82ê\82Ä\82¢\82Ü\82·\81B'#13#10#13#10 +
+ '\95Û\91¶\82µ\82Ü\82·\82©\81H', [(FBottleLogList[Index] as TBottleLogList).Title]);
+ Res := MessageDlg(Confirm, mtConfirmation, mbYesNoCancel, 0);
+ if Res = idYes then
+ Res := DoSaveLogXML(FBottleLogList[Index] as TBottleLogList);
+ end;
+ Result := Res;
+end;
+
+procedure TfrmLog.mnTestActionClick(Sender: TObject);
+begin
+ Screen.Cursor := crHourGlass;
+ frmSender.LogInsertCue(true); // \83A\83N\83V\83\87\83\93\83e\83X\83g\81i\98A\91±\8dÄ\90¶\81j\97L\8cø
+ Screen.Cursor := crDefault;
+end;
+
+procedure TfrmLog.mnSelActionClick(Sender: TObject);
+begin
+ // \92P\91Ì\83A\83N\83V\83\87\83\93\82Ì\97L\96³\82ð\90Ý\92è
+ if mnSelAction.Checked then
+ mnSelAction.Checked := false
+ else
+ mnSelAction.Checked := true;
+ Pref.LogAction := mnSelAction.Checked;
+end;
+
end.