|
|
unit ExmplForm;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, SysUtils, System.UITypes, CallExec, plugin, pluginutil, Types, mmSystem, Signal, IniFiles,
|
|
|
System.Classes, Vcl.Forms, Vcl.Controls, Vcl.Graphics, Vcl.ComCtrls, Vcl.StdCtrls, Vcl.ImgList, Vcl.Menus,
|
|
|
Vcl.ToolWin, Vcl.ExtCtrls;
|
|
|
|
|
|
{$I NoRTTI.inc}
|
|
|
|
|
|
type
|
|
|
{$IFNDEF RX_D4}
|
|
|
TSysCharSet = set of AnsiChar;
|
|
|
{$ENDIF}
|
|
|
TCharSet = TSysCharSet;
|
|
|
|
|
|
type
|
|
|
TExmplFrm = class(TForm)
|
|
|
ListBox: TListBox;
|
|
|
PM: TPopupMenu;
|
|
|
N1: TMenuItem;
|
|
|
N2: TMenuItem;
|
|
|
N3: TMenuItem;
|
|
|
ImgList: TImageList;
|
|
|
N7: TMenuItem;
|
|
|
ImageList1: TImageList;
|
|
|
UIN1: TMenuItem;
|
|
|
Splitter1: TSplitter;
|
|
|
CLview: TListView;
|
|
|
N4: TMenuItem;
|
|
|
popwait: TPopupMenu;
|
|
|
N5: TMenuItem;
|
|
|
ToolbarPanel: TPanel;
|
|
|
ToolBar1: TToolBar;
|
|
|
ToolButton1: TToolButton;
|
|
|
Label3: TLabel;
|
|
|
tbWrieLog: TToolButton;
|
|
|
Label2: TLabel;
|
|
|
tbUnnamedOnly: TToolButton;
|
|
|
Label4: TLabel;
|
|
|
tbAni: TToolButton;
|
|
|
Label5: TLabel;
|
|
|
tbOnOff: TToolButton;
|
|
|
Label6: TLabel;
|
|
|
tbWriteStatus: TToolButton;
|
|
|
Label9: TLabel;
|
|
|
ToolButton2: TToolButton;
|
|
|
Panel1: TPanel;
|
|
|
tbTipPos: TToolButton;
|
|
|
Label8: TLabel;
|
|
|
tbTipDir: TToolButton;
|
|
|
Label10: TLabel;
|
|
|
Panel2: TPanel;
|
|
|
Label1: TLabel;
|
|
|
UpDown1: TUpDown;
|
|
|
Edit1: TEdit;
|
|
|
procedure ListBoxMeasureItem(Control: TWinControl; Index: Integer; var Height: Integer);
|
|
|
procedure ListBoxDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
|
|
function IsUnnamedUin(s: string): boolean;
|
|
|
function ParsingUIN(s: string): string;
|
|
|
procedure N1Click(Sender: TObject);
|
|
|
procedure ListBoxContextPopup(Sender: TObject; MousePos: TPoint; var Handled: boolean);
|
|
|
procedure N7Click(Sender: TObject);
|
|
|
procedure ToolButton2Click(Sender: TObject);
|
|
|
procedure ToolButton1Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure tbUnnamedOnlyClick(Sender: TObject);
|
|
|
procedure tbWrieLogClick(Sender: TObject);
|
|
|
procedure UIN1Click(Sender: TObject);
|
|
|
procedure LoadICONDefault;
|
|
|
procedure tbAniClick(Sender: TObject);
|
|
|
procedure N2Click(Sender: TObject);
|
|
|
procedure ListBoxDblClick(Sender: TObject);
|
|
|
procedure ListBoxKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
|
procedure tbOnOffClick(Sender: TObject);
|
|
|
procedure tbWriteStatusClick(Sender: TObject);
|
|
|
procedure tbWriteStatusMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
procedure tbWrieLogMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
procedure CLviewClick(Sender: TObject);
|
|
|
procedure CLviewColumnClick(Sender: TObject; Column: TListColumn);
|
|
|
procedure CLviewCompare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
|
|
|
procedure Splitter1Paint(Sender: TObject);
|
|
|
procedure N4Click(Sender: TObject);
|
|
|
procedure ListBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
|
procedure CLviewResize(Sender: TObject);
|
|
|
procedure CLviewMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
procedure N5Click(Sender: TObject);
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
procedure tbTipPosClick(Sender: TObject);
|
|
|
procedure Edit1Change(Sender: TObject);
|
|
|
procedure tbTipDirClick(Sender: TObject);
|
|
|
procedure CLviewCustomDrawItem(Sender: TCustomListView; Item: TListItem;
|
|
|
State: TCustomDrawState; var DefaultDraw: Boolean);
|
|
|
public
|
|
|
procedure ShowWait(uin: Integer);
|
|
|
function ExtractWord(N: Integer; const s: string; const WordDelims: TCharSet): string;
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
ExmplFrm: TExmplFrm;
|
|
|
XSForm: TSForm;
|
|
|
uin: Integer = -1;
|
|
|
picindex: byte;
|
|
|
PicIndexMass: array of Integer;
|
|
|
writelog: boolean;
|
|
|
TipDir, TipPos, EventsFromUnnamedOnly, AniEvents, LogOnOff, selectedtb, opentb, WriteStatus, ClearOnStart: boolean;
|
|
|
ShowEvent_PE_AUTOMSG_REQ_GOT, ShowEvent_PE_XSTATUS_REQ_GOT, ShowEvent_PE_ADDEDYOU_GOT, ShowEvent_PE_AUTHREQ_GOT,
|
|
|
ShowEvent_PE_AUTH_GOT, ShowEvent_PE_AUTHDENIED_GOT, ShowEvent_PE_CONTACTS_GOT, ShowEvent_PE_GCARD_GOT,
|
|
|
ShowEvent_PE_WEBPAGER_GOT, ShowEvent_CL_STATUS_CHANGED: boolean;
|
|
|
iconnum: byte = 1;
|
|
|
wait, lst, lis: TStringList;
|
|
|
koeff: real;
|
|
|
saved: string;
|
|
|
poswait, ba, posindex, TotalSort: Integer;
|
|
|
ListOfForms: TStringList;
|
|
|
|
|
|
procedure StrToClipbrd(strVal: string);
|
|
|
function BoolToIntStr(b: boolean): string;
|
|
|
procedure SaveBoolToINI;
|
|
|
function ISCL(uin: string): boolean;
|
|
|
function ISINVISIBLE(str: string): boolean;
|
|
|
|
|
|
const
|
|
|
pluginversion = '1.45';
|
|
|
PluginName = 'R&Q Eye ' + pluginversion;
|
|
|
ininame = '\RnQEye.ini';
|
|
|
logname = '\RnQEye.log';
|
|
|
uinsname = '\RnQEyeUINs.ini';
|
|
|
waitname = '\RnQEyeWait.ini';
|
|
|
logstatus = '\RnQEyeStatus.log';
|
|
|
AboutText = ' R&Q Eye Plugin' + #13 + '===================' + #13 + ' <20><>: ' + pluginversion + #13#13 +
|
|
|
' <20><> <20><>:' + #13 + ' OverQuantum <20><> <20><> <20> <20><> <20><>,' + #13 + ' Rapid D <20><> R&Q <20> TabExample plugin,' + #13 +
|
|
|
' CodeGear <20><> Delphi 2007, ego1st <20><> <20><> <20><>,' + #13 + ' Jayrome <20><> <20><> <20><> <20><>,' + #13 +
|
|
|
' bass <20> dek <20><> <20><>,' + #13 + ' <20> <20><>, <20><> <20><> <20><> <20><>, <20><> <20><> <20><>.' + #13 + '' + #13 +
|
|
|
' <20><>: Sweetie BasePack, Author: Joseph North ' + '' + #13 + ' Mika''el <20> 2007' + #13#13 +
|
|
|
' <20><> <20><> <20><>, <20><> <20> <20><> <20> <20><>, 64-<2D><>' + #13 + ' Mikanoshi <20> 2008-2014';
|
|
|
|
|
|
var
|
|
|
info: contactinfo;
|
|
|
list: TintegerDynArray;
|
|
|
isOff: boolean = false;
|
|
|
MyTimer: Cardinal; // <20><> <20><> <20><> <20><> TTimer
|
|
|
MyTimerEnabled: boolean = false;
|
|
|
|
|
|
// <20><> <20><>
|
|
|
procedure FNTimeCallBack(uTimerID, uMessage: UINT; dwUser, dw1, dw2: DWORD); stdcall;
|
|
|
procedure StartMyTimer;
|
|
|
procedure StopMyTimer;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
// 18.12.2007 08:10:00, Loki
|
|
|
// MegaTimer: Cardinal;
|
|
|
/// / <20><> <20><> <20> <20><> <20><> <20><> <20> Taskbar'a.
|
|
|
// procedure TMainForm.FormShow(Sender: TObject);
|
|
|
// begin
|
|
|
// MegaTimer:=TimeSetEvent(500,10000,@FNTimeCallBack,100,TIME_PERIODIC);
|
|
|
// ShowWindow(Application.Handle, sw_Hide);
|
|
|
// end;
|
|
|
//
|
|
|
/// / <20><> <20><> <20><> <20><> <20><>.
|
|
|
/// / <20><> <20><> <20><> <20> <20><> <20><> <20><> <20><>.
|
|
|
// procedure FNTimeCallBack(uTimerID, uMessage: UINT; dwUser, dw1, dw2: DWORD); stdcall;
|
|
|
// begin
|
|
|
// GetLocalTime(st);
|
|
|
// Hour:=st.wHour;
|
|
|
// Minute:=st.wMinute;
|
|
|
// Second:=st.wSecond;
|
|
|
//
|
|
|
// Background.LoadFromFile(ExtractFilePath(ParamStr(0))+'BK.bmp');
|
|
|
//
|
|
|
// MainForm.DrawArrow(Second,1);
|
|
|
// MainForm.DrawArrow(Minute,2);
|
|
|
// MainForm.DrawArrow(Hour,3);
|
|
|
// MainForm.Canvas.Draw(0,0,Background);
|
|
|
// end;
|
|
|
//
|
|
|
// TimeKillEvent(MegaTimer); - <20> <20><> <20><> <20><> <20><> <20><> :)
|
|
|
//
|
|
|
// <20><> <20> <20><> <20><> DrawArrow - <20><> <20><> <20><> <20><> <20><> <20><> <20><>. <20> <20><>, <20><> <20><> <20><> <20><>.
|
|
|
//
|
|
|
|
|
|
procedure TExmplFrm.ShowWait(uin: Integer);
|
|
|
var
|
|
|
XSForm: TSForm;
|
|
|
i: Integer;
|
|
|
begin
|
|
|
while XTimerOn = true do
|
|
|
application.ProcessMessages;
|
|
|
try
|
|
|
XSForm := TSForm.Create(application);
|
|
|
XSForm.Label2.caption := RQ_GetDisplayedName(uin);
|
|
|
XSForm.Label1.caption := '<27><> <20><> <20> <20><> <20> ' + FormatDateTime('hh:mm:ss dd.mm', now);
|
|
|
XSForm.caption := '<27><>: ' + XSForm.Label2.caption;
|
|
|
|
|
|
poswait := ListOfForms.count;
|
|
|
for i := 0 to ListOfForms.count - 1 do
|
|
|
if ListOfForms[i] = '' then
|
|
|
begin
|
|
|
poswait := i;
|
|
|
break;
|
|
|
end;
|
|
|
|
|
|
if poswait = ListOfForms.count then
|
|
|
ListOfForms.Add('-')
|
|
|
else
|
|
|
ListOfForms[poswait] := '-';
|
|
|
|
|
|
XSForm.Tag := poswait;
|
|
|
if TipDir then
|
|
|
XSForm.Top := screen.Height - XSForm.Height - UpDown1.Position + poswait * 65
|
|
|
else
|
|
|
XSForm.Top := screen.Height - XSForm.Height - UpDown1.Position - poswait * 65;
|
|
|
|
|
|
XSForm.show;
|
|
|
|
|
|
X := 0;
|
|
|
StartXTimer;
|
|
|
finally
|
|
|
// ms.Free
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function WordPosition(const N: Integer; const s: string; const WordDelims: TCharSet): Integer;
|
|
|
var
|
|
|
count, i: Integer;
|
|
|
begin
|
|
|
count := 0;
|
|
|
i := 1;
|
|
|
Result := 0;
|
|
|
while (i <= Length(s)) and (count <> N) do
|
|
|
begin
|
|
|
{ skip over delimiters }
|
|
|
while (i <= Length(s)) and (s[i] in WordDelims) do
|
|
|
Inc(i);
|
|
|
{ if we're not beyond end of S, we're at the start of a word }
|
|
|
if i <= Length(s) then
|
|
|
Inc(count);
|
|
|
{ if not finished, find the end of the current word }
|
|
|
if count <> N then
|
|
|
while (i <= Length(s)) and not(s[i] in WordDelims) do
|
|
|
Inc(i)
|
|
|
else
|
|
|
Result := i;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function TExmplFrm.ExtractWord(N: Integer; const s: string; const WordDelims: TCharSet): string;
|
|
|
var
|
|
|
i: Integer;
|
|
|
Len: Integer;
|
|
|
begin
|
|
|
Len := 0;
|
|
|
i := WordPosition(N, s, WordDelims);
|
|
|
if i <> 0 then
|
|
|
{ find the end of the current word }
|
|
|
while (i <= Length(s)) and not(s[i] in WordDelims) do
|
|
|
begin
|
|
|
{ add the I'th character to result }
|
|
|
Inc(Len);
|
|
|
SetLength(Result, Len);
|
|
|
Result[Len] := s[i];
|
|
|
Inc(i);
|
|
|
end;
|
|
|
SetLength(Result, Len);
|
|
|
end;
|
|
|
|
|
|
function ISCL(uin: string): boolean;
|
|
|
var
|
|
|
uini, i: Integer;
|
|
|
begin
|
|
|
TryStrToInt(uin, uini);
|
|
|
list := RQ_GetList(PL_ROASTER);
|
|
|
Result := false;
|
|
|
for i := 0 to HIGH(list) do
|
|
|
begin
|
|
|
if list[i] = uini then
|
|
|
begin
|
|
|
Result := true;
|
|
|
break;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function ISINVISIBLE(str: string): boolean;
|
|
|
begin
|
|
|
Result := false;
|
|
|
if pos('<27><>', str) <> 0 then
|
|
|
Result := true;
|
|
|
end;
|
|
|
|
|
|
procedure SaveBoolToINI;
|
|
|
var
|
|
|
path: widestring;
|
|
|
i: Integer;
|
|
|
ini: TIniFile;
|
|
|
begin
|
|
|
path := RQ_GetUserPath + ininame;
|
|
|
ini := TIniFile.Create(path);
|
|
|
ini.WriteString('Main', 'WriteLog', BoolToIntStr(writelog));
|
|
|
ini.WriteString('Main', 'UnnamedOnly', BoolToIntStr(EventsFromUnnamedOnly));
|
|
|
ini.WriteString('Main', 'Ani', BoolToIntStr(AniEvents));
|
|
|
ini.WriteString('Main', 'LogOnOff', BoolToIntStr(LogOnOff));
|
|
|
ini.WriteString('Main', 'WriteStatus', BoolToIntStr(WriteStatus));
|
|
|
ini.WriteString('Main', 'CLviewWidth', IntToStr(ExmplFrm.CLview.width));
|
|
|
ini.WriteString('Main', 'CLviewColumnWidth', IntToStr(ExmplFrm.CLview.Column[0].width));
|
|
|
ini.WriteString('Main', 'Sort', IntToStr(TotalSort));
|
|
|
ini.WriteString('Main', 'TipPosition', IntToStr(ExmplFrm.UpDown1.Position));
|
|
|
ini.WriteString('Main', 'TipPos', BoolToIntStr(TipPos));
|
|
|
ini.WriteString('Main', 'TipDir', BoolToIntStr(TipDir));
|
|
|
ini.WriteString('Main', 'ClearOnStart', BoolToIntStr(ClearOnStart));
|
|
|
ini.WriteString('Main', 'ShowEvent_PE_AUTOMSG_REQ_GOT', BoolToIntStr(ShowEvent_PE_AUTOMSG_REQ_GOT));
|
|
|
ini.WriteString('Main', 'ShowEvent_PE_XSTATUS_REQ_GOT', BoolToIntStr(ShowEvent_PE_XSTATUS_REQ_GOT));
|
|
|
ini.WriteString('Main', 'ShowEvent_PE_ADDEDYOU_GOT', BoolToIntStr(ShowEvent_PE_ADDEDYOU_GOT));
|
|
|
ini.WriteString('Main', 'ShowEvent_PE_AUTH_GOT', BoolToIntStr(ShowEvent_PE_AUTH_GOT));
|
|
|
ini.WriteString('Main', 'ShowEvent_PE_AUTHDENIED_GOT', BoolToIntStr(ShowEvent_PE_AUTHDENIED_GOT));
|
|
|
ini.WriteString('Main', 'ShowEvent_PE_CONTACTS_GOT', BoolToIntStr(ShowEvent_PE_CONTACTS_GOT));
|
|
|
ini.WriteString('Main', 'ShowEvent_PE_GCARD_GOT', BoolToIntStr(ShowEvent_PE_GCARD_GOT));
|
|
|
ini.WriteString('Main', 'ShowEvent_PE_WEBPAGER_GOT', BoolToIntStr(ShowEvent_PE_WEBPAGER_GOT));
|
|
|
ini.WriteString('Main', 'ShowEvent_CL_STATUS_CHANGED', BoolToIntStr(ShowEvent_CL_STATUS_CHANGED));
|
|
|
|
|
|
ini.EraseSection('Events');
|
|
|
if ExmplFrm <> nil then
|
|
|
with ExmplFrm do
|
|
|
for i := 0 to ListBox.count - 1 do
|
|
|
ini.WriteString('Events', IntToStr(i), IntToStr(PicIndexMass[i]) + '|' + ListBox.items[i]);
|
|
|
|
|
|
ini.Free;
|
|
|
end;
|
|
|
|
|
|
function BoolToIntStr(b: boolean): string;
|
|
|
begin
|
|
|
if b then
|
|
|
Result := '1'
|
|
|
else
|
|
|
Result := '0'
|
|
|
end;
|
|
|
|
|
|
procedure StrToClipbrd(strVal: string);
|
|
|
var
|
|
|
Size: Integer;
|
|
|
gMem: THandle;
|
|
|
pMem: Pointer;
|
|
|
begin
|
|
|
Size := ByteLength(strVal) + SizeOf(Char);
|
|
|
if (OpenClipboard(application.Handle)) then
|
|
|
try
|
|
|
gMem := GlobalAlloc(GMEM_MOVEABLE + GMEM_DDESHARE, Size);
|
|
|
try
|
|
|
pMem := GlobalLock(gMem);
|
|
|
try
|
|
|
Move(PChar(strVal)^, pMem^, Size);
|
|
|
EmptyClipboard;
|
|
|
SetClipboardData(CF_UNICODETEXT, gMem);
|
|
|
finally
|
|
|
GlobalUnlock(gMem);
|
|
|
end;
|
|
|
except
|
|
|
GlobalFree(gMem);
|
|
|
end;
|
|
|
finally
|
|
|
CloseClipboard;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.FormShow(Sender: TObject);
|
|
|
var
|
|
|
i: Integer;
|
|
|
li: TListItem;
|
|
|
begin
|
|
|
if writelog then
|
|
|
tbWrieLog.Down := true
|
|
|
else
|
|
|
tbWrieLog.Down := false;
|
|
|
|
|
|
if EventsFromUnnamedOnly then
|
|
|
tbUnnamedOnly.Down := true
|
|
|
else
|
|
|
tbUnnamedOnly.Down := false;
|
|
|
|
|
|
if AniEvents then
|
|
|
tbAni.Down := true
|
|
|
else
|
|
|
tbAni.Down := false;
|
|
|
|
|
|
if LogOnOff then
|
|
|
begin
|
|
|
tbOnOff.Down := true;
|
|
|
tbWriteStatus.Enabled := true;
|
|
|
CLview.show;
|
|
|
Splitter1.show;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
tbOnOff.Down := false;
|
|
|
tbWriteStatus.Enabled := false;
|
|
|
CLview.Hide;
|
|
|
Splitter1.Hide;
|
|
|
end;
|
|
|
|
|
|
if WriteStatus then
|
|
|
tbWriteStatus.Down := true
|
|
|
else
|
|
|
tbWriteStatus.Down := false;
|
|
|
|
|
|
if TipPos then
|
|
|
begin
|
|
|
tbTipPos.Down := true;
|
|
|
tbTipPos.ImageIndex := 8;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
tbTipPos.Down := false;
|
|
|
tbTipPos.ImageIndex := 7;
|
|
|
end;
|
|
|
|
|
|
if TipDir then
|
|
|
begin
|
|
|
tbTipDir.Down := true;
|
|
|
tbTipDir.ImageIndex := 9;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
tbTipDir.Down := false;
|
|
|
tbTipDir.ImageIndex := 10;
|
|
|
end;
|
|
|
|
|
|
list := RQ_GetList(PL_ROASTER);
|
|
|
ExmplFrm.CLview.items.Clear;
|
|
|
for i := 0 to HIGH(list) do
|
|
|
begin
|
|
|
li := ExmplFrm.CLview.items.Add;
|
|
|
li.caption := RQ_GetDisplayedName(list[i]);
|
|
|
li.SubItems.Add(IntToStr(list[i]));
|
|
|
if lst.count > 0 then
|
|
|
if lst.IndexOf(IntToStr(list[i])) >= 0 then
|
|
|
ExmplFrm.CLview.items[i].Checked := true;
|
|
|
end;
|
|
|
|
|
|
if CLview.items[0].caption = '0' then
|
|
|
CLview.items[0].Delete;
|
|
|
CLview.ControlStyle := CLview.ControlStyle + [csOpaque];
|
|
|
// SaveBoolToINI;
|
|
|
end;
|
|
|
|
|
|
function TExmplFrm.IsUnnamedUin(s: string): boolean;
|
|
|
begin
|
|
|
if pos('(uin', s) <> 0 then
|
|
|
Result := false
|
|
|
else
|
|
|
Result := true
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.ListBoxDblClick(Sender: TObject);
|
|
|
begin
|
|
|
if ListBox.ItemIndex <> -1 then
|
|
|
TryStrToInt(ParsingUIN(ListBox.items[(ListBox.ItemIndex)]), uin)
|
|
|
else
|
|
|
uin := -1;
|
|
|
|
|
|
if uin <> -1 then
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_OPENCHAT) + _istring(IntToStr(uin)));
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.ListBoxDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
|
|
var
|
|
|
cnv: Tcanvas;
|
|
|
uinn: string;
|
|
|
selected: boolean;
|
|
|
OldRect: TRect;
|
|
|
FrameRect: TRect;
|
|
|
begin
|
|
|
selected := odSelected in State;
|
|
|
cnv := ListBox.Canvas;
|
|
|
OldRect := Rect;
|
|
|
FrameRect := Rect;
|
|
|
|
|
|
uinn := ParsingUIN(ListBox.items[index]);
|
|
|
if ISCL(uinn) then
|
|
|
begin
|
|
|
if ISINVISIBLE(ListBox.items[index]) then
|
|
|
cnv.Brush.Color := $00F7EEF4
|
|
|
else if selected then
|
|
|
cnv.Brush.Color := $00FCF7F3
|
|
|
else
|
|
|
cnv.Brush.Color := clWindow;
|
|
|
end
|
|
|
else
|
|
|
cnv.Brush.Color := $00EAF3FB;
|
|
|
|
|
|
dec(Rect.Top);
|
|
|
cnv.fillrect(Rect);
|
|
|
Inc(Rect.Top);
|
|
|
if selected then
|
|
|
begin
|
|
|
cnv.Pen.Color := $00E7BA96;
|
|
|
cnv.MoveTo(0, Rect.Top - 1);
|
|
|
cnv.LineTo(Rect.width, Rect.Top - 1);
|
|
|
cnv.MoveTo(0, Rect.Top + Rect.Height - 2);
|
|
|
cnv.LineTo(Rect.width, Rect.Top + Rect.Height - 2);
|
|
|
end;
|
|
|
|
|
|
Inc(Rect.left, 3);
|
|
|
dec(Rect.Right, 3);
|
|
|
Inc(Rect.Top, 7);
|
|
|
|
|
|
ImgList.Draw(cnv, Rect.left + 1, Rect.Top, PicIndexMass[Index], true);
|
|
|
Inc(Rect.left, 20);
|
|
|
dec(Rect.Right, 10);
|
|
|
dec(Rect.Top, 7);
|
|
|
|
|
|
cnv.Font.Color := clWindowText;
|
|
|
SetBKMode(cnv.Handle, TRANSPARENT);
|
|
|
DrawText(cnv.Handle, PChar((Control as TListBox).items[Index]), -1, Rect, DT_SINGLELINE or DT_VCENTER);
|
|
|
|
|
|
if odFocused in State then
|
|
|
cnv.DrawFocusRect(OldRect);
|
|
|
|
|
|
Panel1.caption := ' <20><>: ' + IntToStr(ListBox.items.count);
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.ListBoxKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
|
begin
|
|
|
if Key = VK_UP then
|
|
|
begin
|
|
|
if ListBox.ItemIndex <> 0 then
|
|
|
ListBox.selected[ListBox.ItemIndex - 1] := true;
|
|
|
end;
|
|
|
if Key = VK_DOWN then
|
|
|
begin
|
|
|
if ListBox.ItemIndex <> ListBox.items.count - 1 then
|
|
|
ListBox.selected[ListBox.ItemIndex + 1] := true;
|
|
|
end;
|
|
|
if (Key = VK_RETURN) or (Key = VK_SPACE) then
|
|
|
ListBoxDblClick(Sender);
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.ListBoxMeasureItem(Control: TWinControl; Index: Integer; var Height: Integer);
|
|
|
begin
|
|
|
Height := 30;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.LoadICONDefault;
|
|
|
var
|
|
|
h1: HICON;
|
|
|
begin
|
|
|
h1 := LoadIcon(HInstance, 'ICON_1');
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_TAB_MODIFY) + _int(Integer(ExmplFrm.Handle)) + _int(h1) + _istring('R&Q Eye'));
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_MODIFY_BUTTON) + _int(Integer(ba)) + _int(h1) + _istring(PluginName));
|
|
|
DestroyIcon(h1);
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.ListBoxContextPopup(Sender: TObject; MousePos: TPoint; var Handled: boolean);
|
|
|
begin
|
|
|
|
|
|
PM.items[1].Enabled := true;
|
|
|
PM.items[2].Enabled := true;
|
|
|
PM.items[4].Enabled := true;
|
|
|
PM.items[5].Enabled := true;
|
|
|
if ListBox.ItemAtPos(MousePos, true) <> -1 then
|
|
|
begin
|
|
|
PM.items[0].Enabled := true;
|
|
|
posindex := ListBox.ItemAtPos(MousePos, true);
|
|
|
ListBox.ItemIndex := posindex;
|
|
|
TryStrToInt(ParsingUIN(ListBox.items[posindex]), uin);
|
|
|
end
|
|
|
else
|
|
|
uin := -1;
|
|
|
|
|
|
if uin = -1 then
|
|
|
begin
|
|
|
PM.items[0].Enabled := false;
|
|
|
PM.items[1].Enabled := false;
|
|
|
PM.items[2].Enabled := false;
|
|
|
PM.items[4].Enabled := false;
|
|
|
PM.items[5].Enabled := false;
|
|
|
end
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.N1Click(Sender: TObject);
|
|
|
begin
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_SHOWINFO) + _istring(IntToStr(uin)));
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.N2Click(Sender: TObject);
|
|
|
begin
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_OPENCHAT) + _istring(IntToStr(uin)));
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.N7Click(Sender: TObject);
|
|
|
begin
|
|
|
StrToClipbrd(ListBox.items[posindex]);
|
|
|
end;
|
|
|
|
|
|
function TExmplFrm.ParsingUIN(s: string): string;
|
|
|
var
|
|
|
buf: string;
|
|
|
i: Integer;
|
|
|
begin
|
|
|
if pos('uin ', s) > 0 then
|
|
|
buf := Copy(s, pos('uin ', s) + 4, Length(s));
|
|
|
s := '';
|
|
|
for i := 1 to Length(buf) do
|
|
|
begin
|
|
|
if buf[i] in ['0' .. '9'] then
|
|
|
s := s + buf[i]
|
|
|
else
|
|
|
break;
|
|
|
end;
|
|
|
Result := s;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbUnnamedOnlyClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbUnnamedOnly.Down then
|
|
|
EventsFromUnnamedOnly := true
|
|
|
else
|
|
|
EventsFromUnnamedOnly := false;
|
|
|
SaveBoolToINI
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbWrieLogClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbWrieLog.Down then
|
|
|
writelog := true
|
|
|
else
|
|
|
writelog := false;
|
|
|
SaveBoolToINI
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.ToolButton1Click(Sender: TObject);
|
|
|
begin
|
|
|
ListBox.Clear;
|
|
|
SetLength(PicIndexMass, 0);
|
|
|
SetLength(PicIndexMass, Length(PicIndexMass) + 1);
|
|
|
Panel1.caption := ' <20><>: ' + IntToStr(ListBox.items.count);
|
|
|
SaveBoolToINI;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.ToolButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
MessageBox(Handle, AboutText, PluginName, 0);
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbAniClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbAni.Down then
|
|
|
AniEvents := true
|
|
|
else
|
|
|
AniEvents := false;
|
|
|
SaveBoolToINI
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.UIN1Click(Sender: TObject);
|
|
|
begin
|
|
|
StrToClipbrd(ParsingUIN(ListBox.items[posindex]));
|
|
|
end;
|
|
|
|
|
|
procedure FNTimeCallBack(uTimerID, uMessage: UINT; dwUser, dw1, dw2: DWORD); stdcall;
|
|
|
var
|
|
|
h1, h2: HICON;
|
|
|
begin
|
|
|
h2 := LoadIcon(HInstance, 'ICON_2');
|
|
|
h1 := LoadIcon(HInstance, 'ICON_1');
|
|
|
if opentb then // <20><> <20><> <20><> <20><>
|
|
|
begin
|
|
|
if iconnum = 1 then
|
|
|
begin
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_TAB_MODIFY) + _int(Integer(ExmplFrm.Handle)) + _int(h2) + _istring('R&Q Eye'));
|
|
|
iconnum := 2;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_TAB_MODIFY) + _int(Integer(ExmplFrm.Handle)) + _int(h1) + _istring('R&Q Eye'));
|
|
|
iconnum := 1;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if iconnum = 1 then
|
|
|
begin
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_MODIFY_BUTTON) + _int(Integer(ba)) + _int(h2) + _istring(PluginName));
|
|
|
iconnum := 2;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
callStr(AnsiChar(PM_CMD) + AnsiChar(PC_MODIFY_BUTTON) + _int(Integer(ba)) + _int(h1) + _istring(PluginName));
|
|
|
iconnum := 1;
|
|
|
end;
|
|
|
end;
|
|
|
DestroyIcon(h1);
|
|
|
DestroyIcon(h2);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure StartMyTimer;
|
|
|
begin
|
|
|
MyTimer := TimeSetEvent(750, 10000, @FNTimeCallBack, 100, TIME_PERIODIC);
|
|
|
MyTimerEnabled := true;
|
|
|
end;
|
|
|
|
|
|
procedure StopMyTimer;
|
|
|
begin
|
|
|
MyTimerEnabled := false;
|
|
|
timeKillEvent(MyTimer)
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbOnOffClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbOnOff.Down then
|
|
|
begin
|
|
|
LogOnOff := true;
|
|
|
tbWriteStatus.Enabled := true;
|
|
|
CLview.show;
|
|
|
Splitter1.show;
|
|
|
Splitter1.left := CLview.width + 10;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
LogOnOff := false;
|
|
|
tbWriteStatus.Enabled := false;
|
|
|
|
|
|
Splitter1.Hide;
|
|
|
CLview.Hide;
|
|
|
end;
|
|
|
ListBox.Refresh;
|
|
|
SaveBoolToINI;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbWriteStatusClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbWriteStatus.Down then
|
|
|
WriteStatus := true
|
|
|
else
|
|
|
WriteStatus := false;
|
|
|
SaveBoolToINI
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbWriteStatusMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
begin
|
|
|
if Button = mbRight then
|
|
|
if FileExists(RQ_GetUserPath + logstatus) then
|
|
|
WinExec(PAnsiChar('notepad.exe ' + RQ_GetUserPath + logstatus), SW_SHOW)
|
|
|
else
|
|
|
MessageBox(Handle, '<27><> <20><>', PluginName, 0);
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbWrieLogMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
begin
|
|
|
if Button = mbRight then
|
|
|
if FileExists(RQ_GetUserPath + logname) then
|
|
|
WinExec(PAnsiChar('notepad.exe ' + RQ_GetUserPath + logname), SW_SHOW)
|
|
|
else
|
|
|
MessageBox(Handle, '<27><> <20><>', PluginName, 0);
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.CLviewClick(Sender: TObject);
|
|
|
var
|
|
|
i: Integer; ls: TStringList;
|
|
|
begin
|
|
|
ls := TStringList.Create;
|
|
|
for i := 0 to CLview.items.count - 1 do
|
|
|
if CLview.items[i].Checked = true then
|
|
|
ls.Add(CLview.items[i].SubItems[0]);
|
|
|
ls.SaveToFile(RQ_GetUserPath + uinsname);
|
|
|
lst.Clear;
|
|
|
lst.Text := ls.Text;
|
|
|
ls.Free;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.CLviewColumnClick(Sender: TObject; Column: TListColumn);
|
|
|
begin
|
|
|
Case Column.Index of
|
|
|
0:
|
|
|
TotalSort := 1;
|
|
|
1:
|
|
|
TotalSort := 2;
|
|
|
end;
|
|
|
|
|
|
CLview.CustomSort(nil, 0);
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.CLviewCompare(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
|
|
|
var
|
|
|
N1, N2: Integer;
|
|
|
t1, t2: string;
|
|
|
begin
|
|
|
if TotalSort = 1 then
|
|
|
begin
|
|
|
t1 := Item1.caption;
|
|
|
t2 := Item2.caption;
|
|
|
if t1 < t2 then
|
|
|
Compare := -1
|
|
|
else if t1 > t2 then
|
|
|
Compare := 1
|
|
|
else
|
|
|
Compare := 0;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
TryStrToInt(Item1.SubItems[0], N1);
|
|
|
TryStrToInt(Item2.SubItems[0], N2);
|
|
|
|
|
|
if N1 < N2 then
|
|
|
Compare := -1
|
|
|
else if N1 > N2 then
|
|
|
Compare := 1
|
|
|
else
|
|
|
Compare := 0;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.CLviewCustomDrawItem(Sender: TCustomListView; Item: TListItem;
|
|
|
State: TCustomDrawState; var DefaultDraw: Boolean);
|
|
|
var cnv: Tcanvas;
|
|
|
begin
|
|
|
cnv := CLview.Canvas;
|
|
|
|
|
|
if wait.IndexOf(Item.SubItems[0]) >= 0 then
|
|
|
cnv.Brush.Color := $00FAEFE4
|
|
|
else
|
|
|
cnv.Brush.Color := clWindow;
|
|
|
|
|
|
if Item.Checked = true then
|
|
|
if cnv.Brush.Color = $00FAEFE4 then
|
|
|
cnv.Brush.Color := $00FFDFEF
|
|
|
else
|
|
|
cnv.Brush.Color := $00E8F0DD;
|
|
|
|
|
|
DefaultDraw := true;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.Splitter1Paint(Sender: TObject);
|
|
|
begin
|
|
|
ListBox.Refresh;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.N4Click(Sender: TObject);
|
|
|
var i: Integer;
|
|
|
begin
|
|
|
posindex := ListBox.ItemIndex;
|
|
|
ListBox.items.Delete(posindex);
|
|
|
for i := posindex to ListBox.items.count - 1 do
|
|
|
if ListBox.items.count > 0 then
|
|
|
PicIndexMass[i] := PicIndexMass[i + 1];
|
|
|
SetLength(PicIndexMass, Length(PicIndexMass) - 1);
|
|
|
|
|
|
if ListBox.items.count = 0 then
|
|
|
begin
|
|
|
SetLength(PicIndexMass, 0);
|
|
|
SetLength(PicIndexMass, Length(PicIndexMass) + 1);
|
|
|
end
|
|
|
else if posindex < ListBox.items.count then
|
|
|
begin
|
|
|
ListBox.ItemIndex := posindex;
|
|
|
ListBox.selected[posindex] := true;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
ListBox.ItemIndex := ListBox.items.count - 1;
|
|
|
ListBox.selected[ListBox.items.count - 1] := true;
|
|
|
end;
|
|
|
Panel1.caption := ' <20><>: ' + IntToStr(ListBox.items.count);
|
|
|
SaveBoolToINI;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.ListBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
|
var i: Integer;
|
|
|
begin
|
|
|
if (Key = VK_DELETE) and (ListBox.ItemIndex >= 0) then
|
|
|
begin
|
|
|
posindex := ListBox.ItemIndex;
|
|
|
ListBox.items.Delete(posindex);
|
|
|
for i := posindex to ListBox.items.count - 1 do
|
|
|
if ListBox.items.count > 0 then
|
|
|
PicIndexMass[i] := PicIndexMass[i + 1];
|
|
|
SetLength(PicIndexMass, Length(PicIndexMass) - 1);
|
|
|
|
|
|
if ListBox.items.count = 0 then
|
|
|
begin
|
|
|
SetLength(PicIndexMass, 0);
|
|
|
SetLength(PicIndexMass, Length(PicIndexMass) + 1);
|
|
|
end
|
|
|
else if posindex < ListBox.items.count then
|
|
|
begin
|
|
|
ListBox.ItemIndex := posindex;
|
|
|
ListBox.selected[posindex] := true;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
ListBox.ItemIndex := ListBox.items.count - 1;
|
|
|
ListBox.selected[ListBox.items.count - 1] := true;
|
|
|
end;
|
|
|
|
|
|
Panel1.caption := ' <20><>: ' + IntToStr(ListBox.items.count);
|
|
|
SaveBoolToINI;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.CLviewResize(Sender: TObject);
|
|
|
begin
|
|
|
CLview.Repaint
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.CLviewMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|
|
var list: TStringList; i: Integer;
|
|
|
begin
|
|
|
if Button = mbRight then
|
|
|
begin
|
|
|
if FileExists(RQ_GetUserPath + waitname) then
|
|
|
begin
|
|
|
N5.Checked := false;
|
|
|
list := TStringList.Create;
|
|
|
list.LoadFromFile(RQ_GetUserPath + waitname);
|
|
|
for i := 0 to list.count - 1 do
|
|
|
if list[i] = CLview.selected.SubItems[0] then
|
|
|
N5.Checked := true;
|
|
|
list.Free;
|
|
|
end;
|
|
|
|
|
|
popwait.Popup(mouse.CursorPos.X, mouse.CursorPos.Y - 30);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.N5Click(Sender: TObject);
|
|
|
begin
|
|
|
if N5.Checked = false then
|
|
|
begin
|
|
|
wait.Add(CLview.selected.SubItems[0]);
|
|
|
wait.SaveToFile(RQ_GetUserPath + waitname);
|
|
|
end
|
|
|
else if N5.Checked = true then
|
|
|
begin
|
|
|
wait.Delete(wait.IndexOf(CLview.selected.SubItems[0]));
|
|
|
wait.SaveToFile(RQ_GetUserPath + waitname);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.FormCreate(Sender: TObject);
|
|
|
begin
|
|
|
if Win32MajorVersion >= 6 then
|
|
|
begin
|
|
|
DoubleBuffered := true;
|
|
|
toolbarpanel.DoubleBuffered := true;
|
|
|
end;
|
|
|
UpDown1.Max := screen.Height - 65;
|
|
|
Application.HintPause := 200;
|
|
|
Application.HintHidePause := 10000;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbTipPosClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbTipPos.Down then
|
|
|
begin
|
|
|
TipPos := true;
|
|
|
tbTipPos.ImageIndex := 8;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
TipPos := false;
|
|
|
tbTipPos.ImageIndex := 7;
|
|
|
end;
|
|
|
SaveBoolToINI
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.Edit1Change(Sender: TObject);
|
|
|
begin
|
|
|
SaveBoolToINI;
|
|
|
end;
|
|
|
|
|
|
procedure TExmplFrm.tbTipDirClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbTipDir.Down then
|
|
|
begin
|
|
|
TipDir := true;
|
|
|
tbTipDir.ImageIndex := 9;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
TipDir := false;
|
|
|
tbTipDir.ImageIndex := 10;
|
|
|
end;
|
|
|
SaveBoolToINI
|
|
|
end;
|
|
|
|
|
|
end.
|