diff options
author | Alexey Kulakov <panda75@bk.ru> | 2014-01-22 14:15:42 +0000 |
---|---|---|
committer | Alexey Kulakov <panda75@bk.ru> | 2014-01-22 14:15:42 +0000 |
commit | 3ed7d45f598746e4ab0495a9caff96fe4b2127d9 (patch) | |
tree | 3fba042c213dd94c13b61cfd3b39e3d5fa5e0510 /plugins | |
parent | 8963ae9891a77ecffc482d059d22e03a2a1b7961 (diff) |
QuickSearch: crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@7826 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/QuickSearch/sr_optdialog.pas | 66 | ||||
-rw-r--r-- | plugins/QuickSearch/sr_window.pas | 24 |
2 files changed, 30 insertions, 60 deletions
diff --git a/plugins/QuickSearch/sr_optdialog.pas b/plugins/QuickSearch/sr_optdialog.pas index 6c658f6ec4..68ad05a322 100644 --- a/plugins/QuickSearch/sr_optdialog.pas +++ b/plugins/QuickSearch/sr_optdialog.pas @@ -718,6 +718,7 @@ var i,idx:integer;
itemsel:integer;
listhwnd:hwnd;
+ tmpbool:bool;
begin
result:=0;
@@ -785,23 +786,6 @@ begin PSN_APPLY: begin
// checkboxes
- listhwnd:=GetDlgItem(Dialog,IDC_LIST);
-
- clear_columns(qsopt.columns);
- qsopt.numcolumns:=SendMessage(listhwnd,LVM_GETITEMCOUNT,0,0);
- for i:=0 to qsopt.numcolumns-1 do
- begin
- idx:=LV_GetLParam(listhwnd,i);
- with editcolumns[idx] do
- begin
- if ListView_GetCheckSTate(listhwnd,i)=0 then
- flags:=flags and not COL_ON
- else
- flags:=flags or COL_ON or COL_FILTER;
- end;
- CloneColumn(qsopt.columns[i],editcolumns[idx]);
- end;
-
qsopt.flags:=qsopt.flags and not QSO_MAINOPTIONS;
if IsDlgButtonChecked(Dialog,IDC_CH_SORTSTATUS)<>BST_UNCHECKED then
@@ -821,40 +805,28 @@ begin if IsDlgButtonChecked(Dialog,IDC_CH_SAVEPATTERN)<>BST_UNCHECKED then
qsopt.flags:=qsopt.flags or QSO_SAVEPATTERN;
-{
- if IsDlgButtonChecked(Dialog,IDC_CH_SORTSTATUS)<>BST_UNCHECKED then
- qsopt.flags:=qsopt.flags or QSO_SORTBYSTATUS
- else
- qsopt.flags:=qsopt.flags and not QSO_SORTBYSTATUS;
-
- if IsDlgButtonChecked(Dialog,IDC_CH_AUTOCLOSE)<>BST_UNCHECKED then
- qsopt.flags:=qsopt.flags or QSO_AUTOCLOSE
- else
- qsopt.flags:=qsopt.flags and not QSO_AUTOCLOSE;
- if IsDlgButtonChecked(Dialog,IDC_CH_USETOOLSTYLE)<>BST_UNCHECKED then
- qsopt.flags:=qsopt.flags or QSO_TOOLSTYLE
- else
- qsopt.flags:=qsopt.flags and not QSO_TOOLSTYLE;
+ tmpbool:=CloseSrWindow(false);
- if IsDlgButtonChecked(Dialog,IDC_CH_DRAWGRID)<>BST_UNCHECKED then
- qsopt.flags:=qsopt.flags or QSO_DRAWGRID
- else
- qsopt.flags:=qsopt.flags and not QSO_DRAWGRID;
-
- if IsDlgButtonChecked(Dialog,IDC_CH_CLIENTICONS)<>BST_UNCHECKED then
- qsopt.flags:=qsopt.flags or QSO_CLIENTICONS
- else
- qsopt.flags:=qsopt.flags and not QSO_CLIENTICONS;
+ listhwnd:=GetDlgItem(Dialog,IDC_LIST);
+ clear_columns(qsopt.columns);
+ qsopt.numcolumns:=SendMessage(listhwnd,LVM_GETITEMCOUNT,0,0);
+ for i:=0 to qsopt.numcolumns-1 do
+ begin
+ idx:=LV_GetLParam(listhwnd,i);
+ with editcolumns[idx] do
+ begin
+ if ListView_GetCheckSTate(listhwnd,i)=0 then
+ flags:=flags and not COL_ON
+ else
+ flags:=flags or COL_ON or COL_FILTER;
+ end;
+ CloneColumn(qsopt.columns[i],editcolumns[idx]);
+ end;
- if IsDlgButtonChecked(Dialog,IDC_CH_SAVEPATTERN)<>BST_UNCHECKED then
- qsopt.flags:=qsopt.flags or QSO_SAVEPATTERN
- else
- qsopt.flags:=qsopt.flags and not QSO_SAVEPATTERN;
-}
saveopt_db;
- //?? refresh QS window if it was opened
- if CloseSrWindow then
+
+ if tmpbool then
OpenSrWindow(nil,qsopt.flags);
result:=1;
end;
diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas index 47a1e7bf8a..64aef6a95d 100644 --- a/plugins/QuickSearch/sr_window.pas +++ b/plugins/QuickSearch/sr_window.pas @@ -5,7 +5,7 @@ interface uses windows,m_api;
function OpenSrWindow(apattern:PWideChar;flags:LPARAM):boolean;
-function CloseSrWindow:boolean;
+function CloseSrWindow(save:boolean=true):boolean;
procedure RegisterColors;
@@ -1906,7 +1906,7 @@ begin WM_DESTROY: begin
if srvhandle<>0 then DestroyServiceFunction(srvhandle);
if mnuhandle<>0 then CallService(MO_REMOVEMENUITEM,mnuhandle,0);
-
+
UnhookEvent(hAdd);
UnhookEvent(hDelete);
UnhookEvent(hChange);
@@ -1922,20 +1922,15 @@ begin CopyRect(qsopt.grrect,rc);
// save column width/order
- SaveColumnOrder;
+ if grid<>0 then
+ SaveColumnOrder
+ else
+ grid:=0;
saveopt_wnd;
ListView_SetImageList(grid,0,LVSIL_SMALL);
- tmp:=GetDC(grid);
- h:=GetCurrentObject(tmp,OBJ_FONT);
- SendMessage(grid,WM_SETFONT,0,1);
- DeleteObject(h);
- ReleaseDC(grid,tmp);
-
- grid:=0;
-
if (qsopt.flags and QSO_SAVEPATTERN)<>0 then
begin
DBWriteUnicode(0,qs_module,'pattern',pattern);
@@ -2237,14 +2232,17 @@ end; //----- base QS window functions -----
-function CloseSrWindow:boolean;
+function CloseSrWindow(save:boolean=true):boolean;
begin
if mainwnd<>0 then
begin
result:=true;
+ //!! cheat
+ if not save then
+ grid:=0;
+
DestroyWindow(mainwnd);
- mainwnd:=0;
FreeProtoList;
end
else
|