(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().
This commit is contained in:
Darkvater
2005-02-21 18:59:54 +00:00
parent 0d8dcacee2
commit d865c55007
14 changed files with 348 additions and 252 deletions

View File

@@ -222,13 +222,20 @@ enum {
WDP_CENTER = -2,
};
typedef struct Textbuf {
char *buf; /* buffer in which text is saved */
uint16 maxlength, maxwidth; /* the maximum size of the buffer. Maxwidth specifies screensize in pixels */
uint16 length, width; /* the current size of the buffer. Width specifies screensize in pixels */
bool caret; /* is the caret ("_") visible or not */
uint16 caretpos; /* the current position of the caret in the buffer */
uint16 caretxoffs; /* the current position of the caret in pixels */
} Textbuf;
typedef struct {
StringID caption;
bool caret;
WindowClass wnd_class;
WindowNumber wnd_num;
uint16 maxlen, maxwidth;
char *buf;
Textbuf text;
const char* orig;
} querystr_d;