| 1 | // This file is part of SmallBASIC | 
| 2 | // | 
| 3 | // Copyright(C) 2001-2019 Chris Warren-Smith. | 
| 4 | // | 
| 5 | // This program is distributed under the terms of the GPL v2.0 or later | 
| 6 | // Download the GNU Public License (GPL) from www.gnu.org | 
| 7 | // | 
| 8 |  | 
| 9 | #ifndef BASIC_EDITOR_H | 
| 10 | #define BASIC_EDITOR_H | 
| 11 |  | 
| 12 | #include <FL/Fl_Text_Editor.H> | 
| 13 | #include "ui/strlib.h" | 
| 14 | #include <limits.h> | 
| 15 |  | 
| 16 | bool isvar(int c); | 
| 17 |  | 
| 18 | struct StatusBar { | 
| 19 |   virtual ~StatusBar() {} | 
| 20 |   virtual void setRowCol(int row, int col) = 0; | 
| 21 | }; | 
| 22 |  | 
| 23 | struct BasicEditor : public Fl_Text_Editor { | 
| 24 |   BasicEditor(int x, int y, int w, int h, StatusBar *status); | 
| 25 |   virtual ~BasicEditor(); | 
| 26 |  | 
| 27 |   bool findText(const char *find, bool forward, bool updatePos); | 
| 28 |   int handle(int e); | 
| 29 |   unsigned getIndent(char *indent, int len, int pos); | 
| 30 |   void draw(); | 
| 31 |   int getFontSize(); | 
| 32 |   Fl_Font getFont(); | 
| 33 |   void getKeywords(strlib::List<strlib::String *> &keywords); | 
| 34 |   void getRowCol(int *row, int *col); | 
| 35 |   void getSelEndRowCol(int *row, int *col); | 
| 36 |   void getSelStartRowCol(int *row, int *col); | 
| 37 |   char *getSelection(Fl_Rect *rc); | 
| 38 |   void gotoLine(int line); | 
| 39 |   void handleTab(); | 
| 40 |   void setFont(Fl_Font font); | 
| 41 |   void setFontSize(int size); | 
| 42 |   void showFindText(const char *text); | 
| 43 |   void showMatchingBrace(); | 
| 44 |   void showRowCol(); | 
| 45 |   void styleChanged(); | 
| 46 |   void styleParse(const char *text, char *style, int length); | 
| 47 |   int hor_offset() { return mHorizOffset; } | 
| 48 |   int maxSize() { return mMaxsize; } | 
| 49 |   int top_line() { return mTopLineNum; } | 
| 50 |  | 
| 51 |   bool _readonly; | 
| 52 |   int _indentLevel; | 
| 53 |   int _matchingBrace; | 
| 54 |   Fl_Text_Buffer *_stylebuf; | 
| 55 |   Fl_Text_Buffer *_textbuf; | 
| 56 |   char _search[PATH_MAX]; | 
| 57 |   StatusBar *_status; | 
| 58 | }; | 
| 59 |  | 
| 60 | #endif | 
| 61 |  |