diff options
Diffstat (limited to 'engines/gargoyle/windows.h')
-rw-r--r-- | engines/gargoyle/windows.h | 407 |
1 files changed, 2 insertions, 405 deletions
diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h index 9a09641ca8..a5bc2f43f9 100644 --- a/engines/gargoyle/windows.h +++ b/engines/gargoyle/windows.h @@ -31,7 +31,6 @@ #include "gargoyle/events.h" #include "gargoyle/glk_types.h" #include "gargoyle/fonts.h" -#include "gargoyle/picture.h" #include "gargoyle/streams.h" #include "gargoyle/window_mask.h" @@ -43,6 +42,8 @@ class PairWindow; #define HISTORYLEN 100 #define SCROLLBACK 512 #define TBLINELEN 300 +#define GLI_SUBPIX 8 + /** * Main windows manager @@ -256,7 +257,6 @@ struct Attributes { class Window : public Draw { public: Windows *_windows; - glui32 _magicnum; glui32 _rock; glui32 _type; @@ -393,409 +393,6 @@ public: BlankWindow(Windows *windows, uint32 rock); }; -/** - * Text Grid window - */ -class TextGridWindow : public Window { - /** - * Structure for a row within the grid window - */ - struct TextGridRow { - Common::Array<uint32> _chars; - Common::Array<Attributes> _attrs; - bool dirty; - - /** - * Constructor - */ - TextGridRow() : dirty(false) {} - - /** - * Resize the row - */ - void resize(size_t newSize); - }; - typedef Common::Array<TextGridRow> TextGridRows; -private: - /** - * Mark a given text row as modified - */ - void touch(int line); - - void acceptReadChar(glui32 arg); - - /** - * Return or enter, during line input. Ends line input. - */ - void acceptLine(glui32 keycode); - - /** - * Any regular key, during line input. - */ - void acceptReadLine(glui32 arg); -public: - int _width, _height; - TextGridRows _lines; - - int _curX, _curY; ///< the window cursor position - - ///< for line input - void *_inBuf; ///< unsigned char* for latin1, glui32* for unicode - int _inOrgX, _inOrgY; - int _inMax; - int _inCurs, _inLen; - Attributes _origAttr; - gidispatch_rock_t _inArrayRock; - glui32 *_lineTerminators; - - WindowStyle styles[style_NUMSTYLES]; ///< style hints and settings -public: - /** - * Constructor - */ - TextGridWindow(Windows *windows, uint32 rock); - - /** - * Destructor - */ - virtual ~TextGridWindow(); - - /** - * Rearranges the window - */ - virtual void rearrange(const Common::Rect &box) override; - - /** - * Get window split size within parent pair window - */ - virtual glui32 getSplit(glui32 size, bool vertical) const override; - - /** - * Write a character - */ - virtual void putChar(unsigned char ch) override; - - /** - * Write a unicode character - */ - virtual void putCharUni(uint32 ch) override; - - /** - * Unput a unicode character - */ - virtual bool unputCharUni(uint32 ch) override; - - /** - * Write a buffer - */ - virtual void putBuffer(const unsigned char *buf, size_t len) override; - - /** - * Write a unicode character - */ - virtual void putBufferUni(const uint32 *buf, size_t len) override; - - /** - * Move the cursor - */ - virtual void moveCursor(const Common::Point &newPos) override; - - /** - * Clear the window - */ - virtual void clear() override; - - /** - * Click the window - */ - virtual void click(const Common::Point &newPos) override; - - /** - * Prepare for inputing a line - */ - virtual void requestLineEvent(char *buf, glui32 maxlen, glui32 initlen) override; - - /** - * Prepare for inputing a line - */ - virtual void requestLineEventUni(glui32 *buf, glui32 maxlen, glui32 initlen) override; - - /** - * Cancel an input line event - */ - virtual void cancelLineEvent(Event *ev) override; - - /** - * Cancel a mouse event - */ - virtual void cancelMouseEvent() override { _mouseRequest = false; } - - /** - * Cancel a hyperlink event - */ - virtual void cancelHyperlinkEvent() override { _hyperRequest = false; } - - /** - * Redraw the window - */ - virtual void redraw() override; -}; - -/** - * Text Buffer window - */ -class TextBufferWindow : public Window { - /** - * Structure for a row within the window - */ - struct TextBufferRow { - Common::Array<uint32> chars; - Common::Array<Attributes> attr; - int len, newline; - bool dirty, repaint; - Picture *lpic, *rpic; - glui32 lhyper, rhyper; - int lm, rm; - - /** - * Constructor - */ - TextBufferRow(); - - /** - * Resize the row - */ - void resize(size_t newSize); - }; - typedef Common::Array<TextBufferRow> TextBufferRows; -private: - void reflow(); - void touchScroll(); - bool putPicture(Picture *pic, glui32 align, glui32 linkval); - void putTextUni(const glui32 *buf, int len, int pos, int oldlen); - void flowBreak(); - - /** - * Mark a given text row as modified - */ - void touch(int line); -public: - int _width, _height; - int _spaced; - int _dashed; - - TextBufferRows _lines; - int _scrollBack; - - int _numChars; ///< number of chars in last line: lines[0] - glui32 *_chars; ///< alias to lines[0].chars - Attributes *_attrs; ///< alias to lines[0].attrs - - ///< adjust margins temporarily for images - int _ladjw; - int _ladjn; - int _radjw; - int _radjn; - - /* Command history. */ - glui32 *_history[HISTORYLEN]; - int _historyPos; - int _historyFirst, _historyPresent; - - /* for paging */ - int _lastSeen; - int _scrollPos; - int _scrollMax; - - /* for line input */ - void *_inBuf; ///< unsigned char* for latin1, glui32* for unicode - int _inMax; - long _inFence; - long _inCurs; - Attributes _origAttr; - gidispatch_rock_t _inArrayRock; - - glui32 _echoLineInput; - glui32 *_lineTerminators; - - /* style hints and settings */ - WindowStyle styles[style_NUMSTYLES]; - - /* for copy selection */ - glui32 *_copyBuf; - int _copyPos; -public: - /** - * Constructor - */ - TextBufferWindow(Windows *windows, uint32 rock); - - /** - * Destructor - */ - virtual ~TextBufferWindow(); - - /** - * Rearranges the window - */ - virtual void rearrange(const Common::Rect &box) override; - - /** - * Get window split size within parent pair window - */ - virtual glui32 getSplit(glui32 size, bool vertical) const override; - - /** - * Write a character - */ - virtual void putChar(unsigned char ch) override; - - /** - * Write a unicode character - */ - virtual void putCharUni(uint32 ch) override; - - /** - * Unput a unicode character - */ - virtual bool unputCharUni(uint32 ch) override; - - /** - * Write a buffer - */ - virtual void putBuffer(const unsigned char *buf, size_t len) override; - - /** - * Write a unicode character - */ - virtual void putBufferUni(const uint32 *buf, size_t len) override; - - /** - * Move the cursor - */ - virtual void moveCursor(const Common::Point &newPos) override; - - /** - * Clear the window - */ - virtual void clear() override; - - /** - * Prepare for inputing a line - */ - virtual void requestLineEvent(char *buf, glui32 maxlen, glui32 initlen) override; - - /** - * Prepare for inputing a line - */ - virtual void requestLineEventUni(glui32 *buf, glui32 maxlen, glui32 initlen) override; - - /** - * Cancel an input line event - */ - virtual void cancelLineEvent(Event *ev) override; - - /** - * Cancel a hyperlink event - */ - virtual void cancelHyperlinkEvent() override { _hyperRequest = false; } - - /** - * Redraw the window - */ - virtual void redraw() override; -}; - -/** - * Graphics window - */ -class GraphicsWindow : public Window { -private: - void touch(); -public: - unsigned char _bgnd[3]; - bool _dirty; - glui32 _w, _h; - Graphics::ManagedSurface *_surface; -public: - /** - * Constructor - */ - GraphicsWindow(Windows *windows, uint32 rock); - - /** - * Destructor - */ - virtual ~GraphicsWindow(); - - /** - * Rearranges the window - */ - virtual void rearrange(const Common::Rect &box) override; - - /** - * Get window split size within parent pair window - */ - virtual glui32 getSplit(glui32 size, bool vertical) const override { - return size; - } - - /** - * Cancel a mouse event - */ - virtual void cancelMouseEvent() override { _mouseRequest = false; } - - /** - * Cancel a hyperlink event - */ - virtual void cancelHyperlinkEvent() override { _hyperRequest = false; } - - /** - * Redraw the window - */ - virtual void redraw() override; - - /** - * Get the window dimensions - */ - void getSize(glui32 *w, glui32 *h) { - *w = _w; - *h = _h; - } -}; - -/** - * Pair window - */ -class PairWindow : public Window { -public: - Window *_child1, *_child2; - - /* split info... */ - glui32 _dir; ///< winmethod_Left, Right, Above, or Below - bool _vertical, _backward; ///< flags - glui32 _division; ///< winmethod_Fixed or winmethod_Proportional - Window *_key; ///< NULL or a leaf-descendant (not a Pair) - int _keyDamage; ///< used as scratch space in window closing - glui32 _size; ///< size value - glui32 _wBorder; ///< winMethod_Border, NoBorder -public: - /** - * Constructor - */ - PairWindow(Windows *windows, glui32 method, Window *key, glui32 size); - - /** - * Rearranges the window - */ - virtual void rearrange(const Common::Rect &box) override; - - /** - * Redraw the window - */ - virtual void redraw() override; -}; - } // End of namespace Gargoyle #endif |