diff options
author | Darkvater <Darkvater@openttd.org> | 2005-02-21 18:59:54 +0000 |
---|---|---|
committer | Darkvater <Darkvater@openttd.org> | 2005-02-21 18:59:54 +0000 |
commit | fb78ca8a62c69a51903416f5a4062a8972c1e98d (patch) | |
tree | ac473756965e88790f53e13ff4589035499ce9c1 /gui.h | |
parent | f13bfccc37237e612d1eb5194d41246072bbc20f (diff) | |
download | openttd-fb78ca8a62c69a51903416f5a4062a8972c1e98d.tar.xz |
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
- Codechange: Introduction of Textbuf struct which not only holds physical data as length but also pixel-constrains (width) and information about the caret
- Codechange: Move Clipboard function to OS specific file. Currently only Windows has clipboard actions
- Feature: Editboxes, console and exit screen also accept the numeric-enter as a yes
- Feature: Navigation through text with cursor keys is possible, as well as arbitrary insertion (also paste) and deletion; both backspace and del keys. Functions DeleteTextBufferChar, InsertTextBufferChar and InsertTextBufferClipboard handle input and deletion. Navigation is done through MoveTextBufferPos.
- Fix: OTTD crash when opening 'add server' editbox
- CodeChange: fix up some stringwidth calculations in gfx.c. You can get the width in pixels of a character by calling GetCharacterWidth().
Diffstat (limited to 'gui.h')
-rw-r--r-- | gui.h | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -64,6 +64,7 @@ void PlaceProc_LevelLand(uint tile); void ShowTerraformToolbar(void); /* misc_gui.c */ +VARDEF Window *_editbox_win; // pointer to querystringwindow to prevent scrolling when focussed void PlaceLandBlockInfo(void); void ShowAboutWindow(void); void ShowBuildTreesToolbar(void); @@ -86,13 +87,22 @@ void ShowExtraViewPortWindow(void); void SetVScrollCount(Window *w, int num); void SetVScroll2Count(Window *w, int num); void SetHScrollCount(Window *w, int num); -int HandleEditBoxKey(Window *w, int wid, WindowEvent *we); void ShowCheatWindow(void); void AskForNewGameToStart(void); void DrawEditBox(Window *w, int wid); void HandleEditBox(Window *w, int wid); +int HandleEditBoxKey(Window *w, int wid, WindowEvent *we); +bool HandleCaret(Textbuf *tb); + +bool DeleteTextBufferChar(Textbuf *tb, int delmode); +bool InsertTextBufferChar(Textbuf *tb, byte key); +bool InsertTextBufferClipboard(Textbuf *tb); +bool MoveTextBufferPos(Textbuf *tb, int navmode); +void UpdateTextBufferSize(Textbuf *tb); +/* IS_INT_INSIDE = filter for ascii-function codes like BELL and so on [we need an special filter here later] */ +static inline bool IsValidAsciiChar(byte key) {return IS_INT_INSIDE(key, ' ', 256);} void BuildFileList(void); void SetFiosType(const byte fiostype); |