Index: plugins/luamacro/api.lua
===================================================================
--- plugins/luamacro/api.lua (revision 10656)
+++ plugins/luamacro/api.lua (working copy)
@@ -68,7 +68,7 @@
if Expr and Expr~="" then return res1 else return res2 end
end
-mf.usermenu = function(mode, filename)
+mf.usermenu = function(mode, filename, menutitle)
if mode and type(mode)~="number" then return 0 end
mode = mode or 0
local sync_call = band(mode,0x100) ~= 0
@@ -83,8 +83,8 @@
filename = win.GetEnv("farprofile").."\\Menus\\"..filename
end
end
- if sync_call then return MacroCallFar(0x80C67, filename)
- else return yieldcall(F.MPRT_USERMENU, filename)
+ if sync_call then return MacroCallFar(0x80C67, filename, menutitle)
+ else return yieldcall(F.MPRT_USERMENU, filename, menutitle)
end
end
return 0
Index: unicode_far/macro.cpp
===================================================================
--- unicode_far/macro.cpp (revision 10656)
+++ unicode_far/macro.cpp (working copy)
@@ -873,7 +873,10 @@
else if (Values[0].Type==FMVT_BOOLEAN)
UserMenu uMenu(Values[0].Boolean != 0);
else if (Values[0].Type==FMVT_STRING)
- UserMenu uMenu(string(Values[0].String));
+ if (Values[1].Type==FMVT_STRING)
+ UserMenu uMenu(string(Values[0].String),string(Values[1].String));
+ else
+ UserMenu uMenu(string(Values[0].String));
}
int KeyMacro::GetKey()
Index: unicode_far/usermenu.cpp
===================================================================
--- unicode_far/usermenu.cpp (revision 10656)
+++ unicode_far/usermenu.cpp (working copy)
@@ -215,7 +215,7 @@
MenuNeedRefresh(false),
ItemChanged(false)
{
- ProcessUserMenu(ChoiceMenuType, L"");
+ ProcessUserMenu(ChoiceMenuType, L"", false, L"");
}
UserMenu::UserMenu(const string& MenuFileName):
@@ -224,9 +224,18 @@
MenuNeedRefresh(false),
ItemChanged(false)
{
- ProcessUserMenu(false, MenuFileName);
+ ProcessUserMenu(false, MenuFileName, false, L"");
}
+UserMenu::UserMenu(const string& MenuFileName, const string& MenuTitle):
+ MenuMode(MM_LOCAL),
+ MenuModified(false),
+ MenuNeedRefresh(false),
+ ItemChanged(false)
+{
+ ProcessUserMenu(false, MenuFileName, true, MenuTitle);
+}
+
void UserMenu::SaveMenu(const string& MenuFileName)
{
if (MenuModified)
@@ -274,7 +283,7 @@
}
}
-void UserMenu::ProcessUserMenu(bool ChoiceMenuType,const string& MenuFileName)
+void UserMenu::ProcessUserMenu(bool ChoiceMenuType, const string& MenuFileName, const bool UseMenuTitle, const string& MenuTitle)
{
// Путь к текущему каталогу с файлом LocalMenuFileName
string strMenuFilePath;
@@ -362,7 +371,10 @@
int _CurrentFrame=FrameManager->GetCurrentFrame()->GetType();
Global->CtrlObject->Macro.SetMode(MACROAREA_USERMENU);
// вызываем меню
- ExitCode=ProcessSingleMenu(Menu, 0, Menu, strMenuFileFullPath);
+ if( UseMenuTitle )
+ ExitCode = ProcessSingleMenu(Menu, 0, Menu, strMenuFileFullPath, MenuTitle.data());
+ else
+ ExitCode = ProcessSingleMenu(Menu, 0, Menu, strMenuFileFullPath);
if (_CurrentFrame == FrameManager->GetCurrentFrame()->GetType()) //???
Global->CtrlObject->Macro.SetMode(PrevMacroMode);
Index: unicode_far/usermenu.hpp
===================================================================
--- unicode_far/usermenu.hpp (revision 10656)
+++ unicode_far/usermenu.hpp (working copy)
@@ -40,6 +40,7 @@
public:
UserMenu(bool ChoiceMenuType); // true - выбор типа меню (основное или локальное), false - зависит от наличия FarMenu.Ini в текущем каталоге
UserMenu(const string& MenuFileName);
+ UserMenu(const string& MenuFileName, const string& MenuTitle);
struct UserMenuItem
{
@@ -52,7 +53,7 @@
};
private:
- void ProcessUserMenu(bool ChoiceMenuType,const string& MenuFileName);
+ void ProcessUserMenu(bool ChoiceMenuType,const string& MenuFileName, const bool UseMenuTitle, const string& MenuTitle);
bool DeleteMenuRecord(std::list<UserMenuItem>& Menu, const std::list<UserMenuItem>::iterator& MenuItem);
bool EditMenu(std::list<UserMenuItem>& Menu, std::list<UserMenuItem>::iterator* MenuItem, bool Create);
int ProcessSingleMenu(std::list<UserMenuItem>& Menu, int MenuPos, std::list<UserMenuItem>& MenuRoot, const string& MenuFileName, const wchar_t *Title=nullptr);