Skip to content

Commit

Permalink
luamacro:
Browse files Browse the repository at this point in the history
1. уточнение 617.
  • Loading branch information
zg0 committed Sep 29, 2017
1 parent c0120c3 commit f668a2e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion plugins/luamacro/_globalinfo.lua
@@ -1,6 +1,6 @@
function export.GetGlobalInfo()
return {
Version = { 1, 0, 0, 617 },
Version = { 1, 0, 0, 618 },
MinFarVersion = { 3, 0, 0, 5047 },
Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"),
Title = "LuaMacro",
Expand Down
6 changes: 5 additions & 1 deletion plugins/luamacro/changelog
@@ -1,4 +1,8 @@
zg 28.09.2017 19:12:08 FLE Daylight Time - build 617
zg 29.09.2017 11:09:07 +0300 - build 618

1. уточнение 617.

zg 28.09.2017 19:12:08 FLE Daylight Time - build 617

1. поддержка немодальных диалогов.

Expand Down
28 changes: 16 additions & 12 deletions plugins/luamacro/luafar/service.c
Expand Up @@ -3622,11 +3622,9 @@ intptr_t ProcessDNResult(lua_State *L, intptr_t Msg, void *Param2)
return ret;
}

static intptr_t DoDlgProc(lua_State *L, HANDLE hDlg, intptr_t Msg, intptr_t Param1, void *Param2)
static intptr_t DoDlgProc(lua_State *L, PSInfo *Info, TDialogData *dd, HANDLE hDlg, intptr_t Msg, intptr_t Param1, void *Param2)
{
intptr_t ret;
PSInfo *Info = GetPluginData(L)->Info;
TDialogData *dd = (TDialogData*) Info->SendDlgMessage(hDlg,DM_GETDLGDATA,0,0);

if(!dd || dd->wasError)
return Info->DefDlgProc(hDlg, Msg, Param1, Param2);
Expand Down Expand Up @@ -3670,18 +3668,24 @@ static void RemoveDialogFromRegistry(lua_State *L, TDialogData *dd)
lua_rawset(L, LUA_REGISTRYINDEX);
}

static inline BOOL NonModal(TDialogData *dd)
{
return dd && !dd->isModal;
}

intptr_t LF_DlgProc(lua_State *L, HANDLE hDlg, intptr_t Msg, intptr_t Param1, void *Param2)
{
intptr_t ret=DoDlgProc(L, hDlg, Msg, Param1, Param2);
if (Msg == DN_CLOSE && ret)
PSInfo *Info = GetPluginData(L)->Info;
TDialogData *dd = (TDialogData*) Info->SendDlgMessage(hDlg,DM_GETDLGDATA,0,0);
if (Msg == DN_INITDIALOG && NonModal(dd))
{
PSInfo *Info = GetPluginData(L)->Info;
TDialogData *dd = (TDialogData*) Info->SendDlgMessage(hDlg,DM_GETDLGDATA,0,0);
if (dd && !dd->isModal)
{
Info->SendDlgMessage(hDlg, DM_SETDLGDATA, 0, 0);
RemoveDialogFromRegistry(L, dd);
}
dd->hDlg = hDlg;
}
intptr_t ret=DoDlgProc(L, Info, dd, hDlg, Msg, Param1, Param2);
if (Msg == DN_CLOSE && ret && NonModal(dd))
{
Info->SendDlgMessage(hDlg, DM_SETDLGDATA, 0, 0);
RemoveDialogFromRegistry(L, dd);
}
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luamacro.rc
@@ -1,6 +1,6 @@
#include <farversion.hpp>

#define PLUGIN_BUILD 617
#define PLUGIN_BUILD 618
#define PLUGIN_DESC "Lua Macros for Far Manager"
#define PLUGIN_NAME "LuaMacro"
#define PLUGIN_FILENAME "luamacro.dll"
Expand Down

0 comments on commit f668a2e

Please sign in to comment.