local ALT_HISTORY = "FF8FC1AE-0F35-4134-9BAB-56D71B1D47B9"

--local cfmCommandHistory         = 1
--local cfmViewHistory            = 2
--local cfmFolderHistory          = 3
--local cfmFilteredCommandHistory = 4
--local cfmPrevCommand            = 5
--local cfmNextCommand            = 6

--local cfmXLat                   = 255


local function plug_exist() return Plugin.Exist(ALT_HISTORY) end
local function plug_call(code) Plugin.Call(ALT_HISTORY, code) end

-- Macros for replace with AltHistory standard history

Macro {
  description = "Alternative commands history";
  area = "Shell Viewer Editor Info Qview Tree Dialog";
  key = "AltF8";
  condition = plug_exist;
  action = function() plug_call(1) end;
}

Macro {
  description = "Alternative file view history";
  area = "Shell Viewer Editor Info Qview Tree Dialog";
  key = "AltF11";
  condition = plug_exist;
  action = function() plug_call(2) end;
}

Macro {
  description = "Alternative folders history";
  area = "Shell Viewer Editor Info Qview Tree Dialog";
  key  ="AltF12";
  condition = plug_exist;
  action = function() plug_call(3) end;
}

Macro {
  description = "Alternative history: list of filtered commands";
  area = "Shell Info Qview Tree";
  key = "CtrlSpace";
  condition = plug_exist;
  action = function() plug_call(4) end;
}

Macro {
  description = "Alternative history: xlat filter";
  area = "Dialog";
  key = "CtrlShiftX";
  condition = function() return Dlg.Id == "86ED68B6-7C55-4B2D-AEEB-E354B5F04CA9" end;
  action = function() plug_call(255) end;
}


-- Macros for call standard history (or other actions)

Macro {
  description = "Go to or Standard commands history";
  area = "Shell Viewer Editor Info Qview Tree";
  key = "CtrlAltF8";
  condition = plug_exist;
  action = function() Keys("AltF8") end;
}

Macro {
  description = "Standard file view history";
  area  ="Shell Viewer Editor Info Qview Tree";
  key = "CtrlAltF11";
  condition = plug_exist;
  action = function() Keys("AltF11") end;
}

Macro {
  description = "Standard folders history";
  area = "Shell Info Qview Tree";
  key = "CtrlAltF12";
  condition = plug_exist;
  action = function() Keys("AltF12") end;
}