00001
00002
00003
00004
00005
00006
00007 #ifndef MACRO_H
00008 #define MACRO_H
00009
00010 #include <deque>
00011
00012 #include "enum.h"
00013
00014 class key_recorder;
00015 typedef std::deque<int> keyseq;
00016
00017 class key_recorder {
00018 public:
00019 bool paused;
00020 keyseq keys;
00021
00022 public:
00023 key_recorder();
00024
00025 void add_key(int key, bool reverse = false);
00026 void clear();
00027 };
00028
00029 class pause_all_key_recorders {
00030 public:
00031 pause_all_key_recorders();
00032 ~pause_all_key_recorders();
00033
00034 private:
00035 std::vector<bool> prev_pause_status;
00036 };
00037
00038 int getchm(int (*rgetch)() = NULL);
00039 int getchm(KeymapContext context, int (*rgetch)() = NULL);
00040
00041 int getch_with_command_macros(void);
00042
00043 void flush_input_buffer(int reason);
00044
00045 void macro_add_query();
00046 void macro_init();
00047 void macro_save();
00048
00049 void macro_clear_buffers();
00050
00051 void macro_userfn(const char *keys, const char *registryname);
00052
00053
00054 void macro_sendkeys_end_add_expanded(int key);
00055 void macro_sendkeys_start_add_expanded(int key);
00056
00057
00058
00059
00060
00061 void macro_buf_add(int key,
00062 bool reverse = false, bool expanded = true);
00063 void macro_buf_add(const keyseq &actions,
00064 bool reverse = false, bool expanded = true);
00065 int macro_buf_get();
00066
00067 void macro_buf_add_cmd(command_type cmd, bool reverse = false);
00068
00069 bool is_userfunction(int key);
00070 bool is_synthetic_key(int key);
00071
00072 std::string get_userfunction(int key);
00073
00074 void add_key_recorder(key_recorder* recorder);
00075 void remove_key_recorder(key_recorder* recorder);
00076
00077 bool is_processing_macro();
00078
00079 int get_macro_buf_size();
00080
00082
00083
00084 void init_keybindings();
00085
00086 command_type name_to_command(std::string name);
00087 std::string command_to_name(command_type cmd);
00088
00089 command_type key_to_command(int key, KeymapContext context);
00090 int command_to_key(command_type cmd);
00091 KeymapContext context_for_command(command_type cmd);
00092
00093 void bind_command_to_key(command_type cmd, int key);
00094
00095 std::string command_to_string(command_type cmd);
00096 void insert_commands(std::string &desc, std::vector<command_type> cmds,
00097 bool formatted = true);
00098 void insert_commands(std::string &desc, const int first, ...);
00099 #endif