summaryrefslogtreecommitdiff
path: root/plugins/QuickSearch
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/QuickSearch')
-rw-r--r--plugins/QuickSearch/qs.rc12
-rw-r--r--plugins/QuickSearch/qs.resbin13144 -> 13308 bytes
-rw-r--r--plugins/QuickSearch/quicksearch.dpr4
-rw-r--r--plugins/QuickSearch/resource.inc3
-rw-r--r--plugins/QuickSearch/sr_frame.pas226
-rw-r--r--plugins/QuickSearch/sr_global.pas2
-rw-r--r--plugins/QuickSearch/sr_window.pas2
7 files changed, 241 insertions, 8 deletions
diff --git a/plugins/QuickSearch/qs.rc b/plugins/QuickSearch/qs.rc
index 42944aa67d..450e4e31ac 100644
--- a/plugins/QuickSearch/qs.rc
+++ b/plugins/QuickSearch/qs.rc
@@ -1,18 +1,18 @@
#include "resource.inc"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-/*
+
IDD_FRAME DIALOGEX 0, 0, 114, 16, 0
STYLE DS_SETFONT | WS_CHILD | DS_FIXEDSYS | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0
{
- PUSHBUTTON "*", IDC_FRAME_OPEN, 2, 2, 12, 12
- EDITTEXT IDC_FRAME_EDIT, 16, 2, 62, 12
- PUSHBUTTON "<", IDC_FRAME_PREV, 80, 2, 15, 12
- PUSHBUTTON ">", IDC_FRAME_NEXT, 97, 2, 15, 12
+ PUSHBUTTON "*", IDC_FRAME_OPEN, 2, 2, 12, 12, BS_ICON
+ EDITTEXT IDC_FRAME_EDIT, 16, 2, 96, 12
+// PUSHBUTTON "<", IDC_FRAME_PREV, 80, 2, 15, 12
+// PUSHBUTTON ">", IDC_FRAME_NEXT, 97, 2, 15, 12
}
-*/
+
/*
IDD_SCRIPT DIALOGEX 0, 0, 256, 82, 0
STYLE DS_SETFONT | DS_FIXEDSYS | WS_VISIBLE | WS_THICKFRAME
diff --git a/plugins/QuickSearch/qs.res b/plugins/QuickSearch/qs.res
index 222402e284..d05f7b9615 100644
--- a/plugins/QuickSearch/qs.res
+++ b/plugins/QuickSearch/qs.res
Binary files differ
diff --git a/plugins/QuickSearch/quicksearch.dpr b/plugins/QuickSearch/quicksearch.dpr
index 9494665bc2..1deb4c5f3d 100644
--- a/plugins/QuickSearch/quicksearch.dpr
+++ b/plugins/QuickSearch/quicksearch.dpr
@@ -16,6 +16,7 @@ uses
sr_optdialog,
sr_global,
sr_window,
+ sr_frame,
mirutils,
common;
@@ -171,6 +172,8 @@ begin
HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded);
+ CreateFrame(0);
+
Result:=0;
end;
@@ -187,6 +190,7 @@ function Unload:integer;cdecl;
begin
result:=0;
removetoolbar; //??
+ DestroyFrame;
// unreghotkeys;
diff --git a/plugins/QuickSearch/resource.inc b/plugins/QuickSearch/resource.inc
index ed5b399e6b..8dfa7fd0fb 100644
--- a/plugins/QuickSearch/resource.inc
+++ b/plugins/QuickSearch/resource.inc
@@ -64,3 +64,6 @@ const
IDC_REFRESH = 1033;
IDC_STATUSBAR = 1034;
IDC_CB_PROTOCOLS = 1035;
+
+ IDC_FRAME_OPEN = 1050;
+ IDC_FRAME_EDIT = 1051;
diff --git a/plugins/QuickSearch/sr_frame.pas b/plugins/QuickSearch/sr_frame.pas
new file mode 100644
index 0000000000..4ff26b12b6
--- /dev/null
+++ b/plugins/QuickSearch/sr_frame.pas
@@ -0,0 +1,226 @@
+unit sr_frame;
+
+interface
+
+uses windows;
+
+procedure CreateFrame(parent:HWND);
+procedure DestroyFrame;
+
+implementation
+
+uses commctrl,Messages,m_api,common,wrapper,mirutils,sr_global;
+
+{$include resource.inc}
+
+const
+ frm_back:pAnsiChar = 'Frame background';
+const
+ FrameWnd:HWND = 0;
+ FrameId:integer = -1;
+ OldEditProc:pointer=nil;
+ pattern:pWideChar=nil;
+var
+ colorhook:THANDLE;
+ hbr:HBRUSH;
+ frm_bkg:TCOLORREF;
+
+function NewEditProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
+begin
+// result:=0;
+ case hMessage of
+ WM_CHAR: begin
+ if wParam=27 then
+ begin
+ // clear edit field
+ SendMessage(Dialog,WM_SETTEXT,0,0);
+ result:=0;
+ end
+ else if wParam=13 then
+ begin
+ CallService(QS_SHOWSERVICE,twparam(pattern),0);
+ result:=0;
+ end
+ else
+ result:=1;
+ if result=0 then
+ exit;
+ end;
+ end;
+ result:=CallWindowProc(OldEditProc,Dialog,hMessage,wParam,lParam);
+end;
+
+function QSDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl;
+begin
+ case urc^.wId of
+ IDC_FRAME_OPEN: result:=RD_ANCHORX_LEFT or RD_ANCHORY_CENTRE;
+ IDC_FRAME_EDIT: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_CENTRE;
+ else
+ result:=0;
+ end;
+end;
+
+function QSFrameProc(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
+var
+ urd:TUTILRESIZEDIALOG;
+ rc:TRECT;
+ ti:TTOOLINFOW;
+ hwndTooltip:HWND;
+begin
+ result:=0;
+ case hMessage of
+ WM_DESTROY: begin
+ DeleteObject(hbr);
+ hbr:=0;
+ end;
+
+ WM_INITDIALOG: begin
+ OldEditProc:=pointer(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_FRAME_EDIT),
+ GWL_WNDPROC,LONG_PTR(@NewEditProc)));
+
+ hwndTooltip:=CreateWindowW(TOOLTIPS_CLASS,nil,TTS_ALWAYSTIP,
+ integer(CW_USEDEFAULT),integer(CW_USEDEFAULT),
+ integer(CW_USEDEFAULT),integer(CW_USEDEFAULT),
+ Dialog,0,hInstance,nil);
+
+ FillChar(ti,SizeOf(ti),0);
+ ti.cbSize :=sizeof(TOOLINFO);
+ ti.uFlags :=TTF_IDISHWND or TTF_SUBCLASS;
+ ti.hwnd :=Dialog;
+ ti.hinst :=hInstance;
+ ti.uId :=GetDlgItem(Dialog,IDC_FRAME_OPEN);
+ ti.lpszText:=pWideChar(TranslateW('Open QS window'));
+ SendMessageW(hwndTooltip,TTM_ADDTOOLW,0,tlparam(@ti));
+
+ SetButtonIcon(GetDlgItem(Dialog,IDC_FRAME_OPEN),QS_QS);
+ end;
+
+ WM_SIZE: begin
+ FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0);
+ urd.cbSize :=SizeOf(urd);
+ urd.hwndDlg :=Dialog;
+ urd.hInstance :=hInstance;
+ urd.lpTemplate:=MAKEINTRESOURCEA(IDD_FRAME);
+ urd.lParam :=0;
+ urd.pfnResizer:=@QSDlgResizer;
+ CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd));
+ end;
+
+ WM_ERASEBKGND: begin
+ GetClientRect(Dialog,rc);
+ FillRect(wParam,rc,hbr);
+ result:=1;
+ end;
+
+ WM_COMMAND: begin
+ case wParam shr 16 of
+ EN_CHANGE: begin
+ mFreeMem(pattern);
+ pattern:=GetDlgText(Dialog,IDC_FRAME_EDIT);
+ if pattern<>nil then
+ CharLowerW(pattern);
+ end;
+
+ BN_CLICKED: begin
+ case loword(wParam) of
+ IDC_FRAME_OPEN: CallService(QS_SHOWSERVICE,twparam(pattern),0);
+ end;
+ end;
+ end;
+ end;
+
+ else
+ result:=DefWindowProc(Dialog,hMessage,wParam,lParam);
+ end;
+end;
+
+function ColorReload(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+var
+ cid:TColourID;
+begin
+ result:=0;
+ cid.cbSize:=SizeOf(cid);
+ StrCopy(cid.group,'QuickSearch');
+ StrCopy(cid.name ,frm_back);
+ frm_bkg:=CallService(MS_COLOUR_GETA,twparam(@cid),0);
+ DeleteObject(hbr);
+ hbr:=CreateSolidBrush(frm_bkg);
+
+ RedrawWindow(FrameWnd,nil,0,RDW_ERASE);
+end;
+
+procedure CreateFrame(parent:HWND);
+var
+ Frame:TCLISTFrame;
+ wnd:HWND;
+ tmp:cardinal;
+ tr:TRECT;
+ cid:TColourID;
+begin
+ if ServiceExists(MS_CLIST_FRAMES_ADDFRAME)=0 then
+ exit;
+
+ hbr:=0;
+
+ if parent=0 then
+ parent:=CallService(MS_CLUI_GETHWND,0,0);
+
+ if FrameWnd=0 then
+ FrameWnd:=CreateDialog(hInstance,MAKEINTRESOURCE(IDD_FRAME),parent,@QSFrameProc);
+
+ if FrameWnd<>0 then
+ begin
+ GetWindowRect(FrameWnd,tr);
+ FillChar(Frame,SizeOf(Frame),0);
+ with Frame do
+ begin
+ cbSize :=SizeOf(Frame);
+ hWnd :=FrameWnd;
+ hIcon :=CallService(MS_SKIN2_GETICON,0,tlparam(QS_QS));
+ align :=alTop;
+ height :=tr.bottom-tr.top+2;
+ Flags :=F_NOBORDER or F_UNICODE;
+ name.w :='Quick search';
+ TBName.w:='Quick search';
+ end;
+
+ FrameId:=CallService(MS_CLIST_FRAMES_ADDFRAME,wparam(@Frame),0);
+ if FrameId>=0 then
+ begin
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME,FrameId, FU_FMPOS);
+
+ wnd:=CallService(MS_CLUI_GETHWND{MS_CLUI_GETHWNDTREE},0,0);
+ tmp:=SendMessage(wnd,CLM_GETEXSTYLE,0,0);
+ SendMessage(wnd,CLM_SETEXSTYLE,tmp or CLS_EX_SHOWSELALWAYS,0);
+
+ cid.cbSize:=SizeOf(cid);
+ cid.flags :=0;
+ StrCopy(cid.group,'QuickSearch');
+ StrCopy(cid.dbSettingsGroup,qs_module);
+
+ StrCopy(cid.name ,frm_back);
+ StrCopy(cid.setting,'frame_back');
+ cid.defcolour:=GetSysColor(COLOR_3DFACE);
+ cid.order :=0;
+ ColourRegister(@cid);
+
+ colorhook:=HookEvent(ME_COLOUR_RELOAD,@ColorReload);
+ ColorReload(0,0);
+ end;
+ end;
+end;
+
+procedure DestroyFrame;
+begin
+ if FrameId>=0 then
+ begin
+ UnhookEvent(colorhook);
+ CallService(MS_CLIST_FRAMES_REMOVEFRAME,FrameId,0);
+ FrameId:=-1;
+ end;
+ DestroyWindow(FrameWnd);
+ FrameWnd:=0;
+ mFreeMem(pattern);
+end;
+
+end.
diff --git a/plugins/QuickSearch/sr_global.pas b/plugins/QuickSearch/sr_global.pas
index 955c18e692..7f2a6a85b3 100644
--- a/plugins/QuickSearch/sr_global.pas
+++ b/plugins/QuickSearch/sr_global.pas
@@ -743,7 +743,7 @@ var
begin
if DBGetSettingType(0,qs_module,so_flags)=DBVT_DELETED then
begin
- DBDeleteModule(qs_module);
+ DBDeleteModule(0,qs_module);
qsopt.flags:=
QSO_SORTBYSTATUS or QSO_DRAWGRID or
QSO_CLIENTICONS or QSO_COLORIZE or
diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas
index e16b17c168..838e38fb13 100644
--- a/plugins/QuickSearch/sr_window.pas
+++ b/plugins/QuickSearch/sr_window.pas
@@ -15,7 +15,7 @@ const
implementation
uses messages,commctrl,sr_global,common,dbsettings,mirutils,
- wrapper,protocols,sparam,srvblock,editwrapper;
+ wrapper,protocols,sparam,srvblock,editwrapper, mircontacts;
const
IDM_STAYONTOP = WM_USER+1;