summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/macro.h
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-19 01:19:56 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-19 01:19:56 +0000
commit725cb5b4d5a3ade5c5e7b04a6210cedc839c2bdd (patch)
treed2644ce5f13e7ab649b27b49f7bdcde18802a6b1 /crawl-ref/source/macro.h
parent1a36197574afe860feff7208cd883770a5d28946 (diff)
downloadcrawl-ref-725cb5b4d5a3ade5c5e7b04a6210cedc839c2bdd.tar.gz
crawl-ref-725cb5b4d5a3ade5c5e7b04a6210cedc839c2bdd.zip
Added new commands "re-do previous command" (bound to `) and "repeat
next command" (bound to 0). Though this is just an interface change, it changes code in the core input processing function (input() in acr.cc), and also messes around with the input buffer, so it could probably do with more testing before merging it into the 0.3 branch. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2137 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/macro.h')
-rw-r--r--crawl-ref/source/macro.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/crawl-ref/source/macro.h b/crawl-ref/source/macro.h
index ff1c01b076..90d0557cda 100644
--- a/crawl-ref/source/macro.h
+++ b/crawl-ref/source/macro.h
@@ -14,6 +14,8 @@
#ifndef MACRO_H
#define MACRO_H
+#include <deque>
+
#ifndef MACRO_CC
#undef getch
@@ -30,6 +32,28 @@ enum KeymapContext {
KC_CONTEXT_COUNT // Must always be the last
};
+class key_recorder;
+typedef bool (*key_recorder_callback)(key_recorder *recorder,
+ int &ch, bool reverse);
+typedef std::deque<int> keyseq;
+
+class key_recorder {
+public:
+ bool paused;
+ keyseq keys;
+ keyseq macro_trigger_keys;
+ key_recorder_callback call_back;
+ void* call_back_data;
+
+public:
+ key_recorder(key_recorder_callback cb = NULL,
+ void* cb_data = NULL);
+
+ void add_key(int key, bool reverse = false);
+ void remove_trigger_keys(int num_keys);
+ void clear();
+};
+
int getchm(int (*rgetch)() = NULL); // keymaps applied (ie for prompts)
int getchm(KeymapContext context, int (*rgetch)() = NULL);
@@ -43,11 +67,21 @@ void macro_save(void);
void macro_userfn(const char *keys, const char *registryname);
-void macro_buf_add(int key);
+void macro_buf_add(int key, bool reverse = false);
+void macro_buf_add(const keyseq &actions, bool reverse = false );
bool is_userfunction(int key);
bool is_synthetic_key(int key);
const char *get_userfunction(int key);
+void add_key_recorder(key_recorder* recorder);
+void remove_key_recorder(key_recorder* recorder);
+
+bool is_processing_macro();
+
+void insert_macro_into_buff(const keyseq& keys);
+
+int get_macro_buf_size();
+
#endif