move keys related functions/classes to separate file

This commit is contained in:
Andrzej Rybczak
2012-09-05 13:03:42 +02:00
parent ec5f271f17
commit 95e2cfe6e1
9 changed files with 331 additions and 276 deletions

View File

@@ -45,43 +45,6 @@ struct Column
bool display_empty_tag;
};
struct Bind
{
typedef std::vector<Action *> ActionChain;
Bind(ActionType at) : isThisSingle(true), itsAction(Action::Get(at)) { }
Bind(ActionChain *chain) : isThisSingle(false), itsChain(chain) { }
bool isSingle() const { return isThisSingle; }
ActionChain *getChain() const { assert(!isThisSingle); return itsChain; }
Action *getAction() const { assert(isThisSingle); return itsAction; }
private:
bool isThisSingle;
union {
Action *itsAction;
ActionChain *itsChain;
};
};
struct KeyConfiguration
{
typedef std::pair<
std::multimap<Action::Key, Bind>::iterator
, std::multimap<Action::Key, Bind>::iterator
> Binding;
void GenerateBindings();
std::multimap<Action::Key, Bind> Bindings;
private:
template <typename T> void Bind_(wchar_t c, CharType ct, T t)
{
Bindings.insert(std::make_pair(Action::Key(c, ct), Bind(t)));
}
};
struct Configuration
{
Configuration();
@@ -234,7 +197,6 @@ struct Configuration
std::string config_file_path;
};
extern KeyConfiguration Keys;
extern Configuration Config;
void CreateDir(const std::string &dir);