From 8ad4f44fa747a32e0d476971beeaf2c0550f16e5 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 20 Jun 2007 19:00:52 +0000 Subject: Experimental mouse support for ncurses (enable with mouse_input=yes in .crawlrc). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1610 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/libutil.h | 142 +-------------------------------------------- 1 file changed, 1 insertion(+), 141 deletions(-) (limited to 'crawl-ref/source/libutil.h') diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h index e9d6d987b8..4eed5ab7a7 100644 --- a/crawl-ref/source/libutil.h +++ b/crawl-ref/source/libutil.h @@ -1,6 +1,6 @@ /* * File: libutil.h - * Summary: System indepentant functions + * Summary: System independent functions * * Modified for Crawl Reference by $Author$ on $Date$ * @@ -19,14 +19,6 @@ #include #include -void cursorxy(int x, int y); - -// Converts a key to a direction key, converting keypad and other sequences -// to vi key sequences (shifted/control key directions are also handled). Non -// direction keys (hopefully) pass through unmangled. -int unmangle_direction_keys(int keyin, int keymap = 0, - bool fake_ctrl = true, bool fake_shift = true); - std::string lowercase_string(std::string s); std::string &lowercase(std::string &s); std::string &uppercase(std::string &s); @@ -54,9 +46,6 @@ std::string replace_all_of(std::string s, int count_occurrences(const std::string &text, const std::string &searchfor); -// getch() that returns a consistent set of values for all platforms. -int c_getch(); - void play_sound(const char *file); // Pattern matching @@ -64,25 +53,6 @@ void *compile_pattern(const char *pattern, bool ignore_case = false); void free_compiled_pattern(void *cp); bool pattern_match(void *compiled_pattern, const char *text, int length); -void get_input_line( char *const buff, int len ); - -class input_history; - -// In view.cc, declared here for default argument to cancelable_get_line() -int get_number_of_cols(void); - -// Returns zero if user entered text and pressed Enter, otherwise returns the -// key pressed that caused the exit, usually Escape. -// -// If keyproc is provided, it must return 1 for normal processing, 0 to exit -// normally (pretend the user pressed Enter), or -1 to exit as if the user -// pressed Escape -int cancelable_get_line( char *buf, - int len, - int wrapcol = get_number_of_cols(), - input_history *mh = NULL, - int (*keyproc)(int &c) = NULL ); - std::string & trim_string( std::string &str ); std::string trimmed_string( std::string s ); @@ -135,60 +105,6 @@ void usleep( unsigned long time ); int snprintf( char *str, size_t size, const char *format, ... ); #endif -// Keys that getch() must return for keys Crawl is interested in. -enum KEYS -{ - CK_ENTER = '\r', - CK_BKSP = 8, - CK_ESCAPE = ESCAPE, - - // 128 is off-limits because it's the code that's used when running - CK_DELETE = 129, - - // This sequence of enums should not be rearranged. - CK_UP, - CK_DOWN, - CK_LEFT, - CK_RIGHT, - - CK_INSERT, - - CK_HOME, - CK_END, - CK_CLEAR, - - CK_PGUP, - CK_PGDN, - - CK_SHIFT_UP, - CK_SHIFT_DOWN, - CK_SHIFT_LEFT, - CK_SHIFT_RIGHT, - - CK_SHIFT_INSERT, - - CK_SHIFT_HOME, - CK_SHIFT_END, - CK_SHIFT_CLEAR, - - CK_SHIFT_PGUP, - CK_SHIFT_PGDN, - - CK_CTRL_UP, - CK_CTRL_DOWN, - CK_CTRL_LEFT, - CK_CTRL_RIGHT, - - CK_CTRL_INSERT, - - CK_CTRL_HOME, - CK_CTRL_END, - CK_CTRL_CLEAR, - - CK_CTRL_PGUP, - CK_CTRL_PGDN -}; - // Sets a boolean to a new value in the scope of the object instance. class unwind_bool { @@ -206,62 +122,6 @@ private: bool oldval; }; -class cursor_control -{ -public: - cursor_control(bool cursor_enabled) - : cstate(is_cursor_enabled()), smartcstate(is_smart_cursor_enabled()) - { - enable_smart_cursor(false); - set_cursor_enabled(cursor_enabled); - } - ~cursor_control() { - set_cursor_enabled(cstate); - enable_smart_cursor(smartcstate); - } -private: - bool cstate; - bool smartcstate; -}; - -// Reads lines of text; used internally by cancelable_get_line. -class line_reader -{ -public: - line_reader(char *buffer, size_t bufsz, - int wrap_col = get_number_of_cols()); - - typedef int (*keyproc)(int &key); - - int read_line(bool clear_previous = true); - - std::string get_text() const; - - void set_input_history(input_history *ih); - void set_keyproc(keyproc fn); - -protected: - void cursorto(int newcpos); - int process_key(int ch); - void backspace(); - void killword(); - - bool is_wordchar(int c); - -private: - char *buffer; - size_t bufsz; - input_history *history; - int start_x, start_y; - keyproc keyfn; - int wrapcol; - - // These are subject to change during editing. - char *cur; - int length; - int pos; -}; - class base_pattern { public: -- cgit v1.2.3-54-g00ecf