1 #ifndef CSV_WORLD_SCRIPTSUBVIEW_H 2 #define CSV_WORLD_SCRIPTSUBVIEW_H 3 4 #include <QVBoxLayout> 5 6 #include "../../model/world/commanddispatcher.hpp" 7 8 #include "../doc/subview.hpp" 9 10 class QModelIndex; 11 class QLabel; 12 class QVBoxLayout; 13 class QSplitter; 14 class QTime; 15 16 namespace CSMDoc 17 { 18 class Document; 19 } 20 21 namespace CSMWorld 22 { 23 class IdTable; 24 } 25 26 namespace CSMPrefs 27 { 28 class Setting; 29 } 30 31 namespace CSVWorld 32 { 33 class ScriptEdit; 34 class RecordButtonBar; 35 class TableBottomBox; 36 class ScriptErrorTable; 37 38 class ScriptSubView : public CSVDoc::SubView 39 { 40 Q_OBJECT 41 42 ScriptEdit *mEditor; 43 CSMDoc::Document& mDocument; 44 CSMWorld::IdTable *mModel; 45 int mColumn; 46 int mIdColumn; 47 int mStateColumn; 48 TableBottomBox *mBottom; 49 RecordButtonBar *mButtons; 50 CSMWorld::CommandDispatcher mCommandDispatcher; 51 QVBoxLayout mLayout; 52 QSplitter *mMain; 53 ScriptErrorTable *mErrors; 54 QTimer *mCompileDelay; 55 int mErrorHeight; 56 57 private: 58 59 void addButtonBar(); 60 61 void recompile(); 62 63 bool isDeleted() const; 64 65 void updateDeletedState(); 66 67 void adjustSplitter(); 68 69 public: 70 71 ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document); 72 73 void setEditLock (bool locked) override; 74 75 void useHint (const std::string& hint) override; 76 77 void setStatusBar (bool show) override; 78 79 public slots: 80 81 void textChanged(); 82 83 void dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight); 84 85 void rowsAboutToBeRemoved (const QModelIndex& parent, int start, int end); 86 87 private slots: 88 89 void settingChanged (const CSMPrefs::Setting *setting); 90 91 void updateStatusBar(); 92 93 void switchToRow (int row); 94 95 void switchToId (const std::string& id); 96 97 void highlightError (int line, int column); 98 99 void updateRequest(); 100 }; 101 } 102 103 #endif 104