1 #ifndef CODE_CONSOLE_CONTROLLER_H 2 #define CODE_CONSOLE_CONTROLLER_H 21 ,
bool m_lockOnConsole
39 View *
view()
override {
return &m_selectableTableView; }
67 void printText(
const char * text,
size_t length)
override;
68 const char *
inputText(
const char * prompt)
override;
76 static constexpr
const char * k_importCommand1 =
"from ";
77 static constexpr
const char * k_importCommand2 =
" import *";
79 bool inputRunLoopActive() {
return m_inputRunLoopActive; }
80 void askInputRunLoopTermination() { m_inputRunLoopActive =
false; }
81 static constexpr
int LineCellType = 0;
82 static constexpr
int EditCellType = 1;
83 static constexpr
int k_numberOfLineCells = 15;
84 static constexpr
int k_pythonHeapSize = 16384;
85 static constexpr
int k_outputAccumulationBufferSize = 100;
86 void flushOutputAccumulationBufferToStore();
87 void appendTextToOutputAccumulationBuffer(
const char * text,
size_t length);
88 void emptyOutputAccumulationBuffer();
89 size_t firstNewLineCharIndex(
const char * text,
size_t length);
91 bool copyCurrentLineToClipboard();
93 bool m_importScriptsWhenViewAppears;
94 ConsoleStore m_consoleStore;
96 ConsoleLineCell m_cells[k_numberOfLineCells];
97 ConsoleEditCell m_editCell;
99 char m_outputAccumulationBuffer[k_outputAccumulationBufferSize];
105 ScriptStore * m_scriptStore;
106 SandboxController m_sandboxController;
107 bool m_inputRunLoopActive;
void tableViewDidChangeSelection(SelectableTableView *t, int previousSelectedCellX, int previousSelectedCellY) override
void willDisplayCellAtLocation(HighlightCell *cell, int i, int j) override
void displaySandbox() override
bool textFieldDidReceiveEvent(TextField *textField, Ion::Events::Event event) override
HighlightCell * reusableCell(int index, int type) override
int typeAtLocation(int i, int j) override
bool pythonEnvironmentIsLoaded()
KDCoordinate cumulatedHeightFromIndex(int j) override
static constexpr int maxBufferSize()
Responder * parentResponder() const
void autoImportScript(Script script, bool force=false)
bool textFieldDidAbortEditing(TextField *textField, const char *text) override
const char * inputText(const char *prompt) override
Toolbox * toolboxForTextInput(TextInput *textInput) override
bool textFieldDidFinishEditing(TextField *textField, const char *text, Ion::Events::Event event) override
void printText(const char *text, size_t length) override
bool handleEvent(Ion::Events::Event event) override
ConsoleController(Responder *parentResponder, ScriptStore *scriptStore)
int numberOfRows() override
ViewController::DisplayParameter displayParameter() override
bool textFieldShouldFinishEditing(TextField *textField, Ion::Events::Event event) override
KDCoordinate rowHeight(int j) override
static constexpr KDText::FontSize k_fontSize
void runAndPrintForCommand(const char *command)
void unloadPythonEnvironment()
bool loadPythonEnvironment(bool autoImportScripts=true)
ConsoleController operator=(const ConsoleController &other)=delete
int reusableCellCount(int type) override
void viewWillAppear() override
void didBecomeFirstResponder() override
int indexFromCumulatedHeight(KDCoordinate offsetY) override