Files
Upsilon/apps/code/editor_controller.cpp
Léa Saviot 35520fb3d4 [code] Scripts can be automatically imported when the console is opened.
Editing, renaming, deleting or changing the auto-importation of a script
triggers the reloading of the console (the history is cleared, Python
restarted and the scripts re-imported).

Change-Id: If8b933cc077ecd36cab09214b5e7a181aa3ae030
2017-11-17 11:59:50 +01:00

34 lines
794 B
C++

#include "editor_controller.h"
#include "script_parameter_controller.h"
namespace Code {
EditorController::EditorController(ScriptParameterController * scriptParameterController) :
ViewController(nullptr),
m_view(this),
m_scriptParameterController(scriptParameterController)
{
}
void EditorController::setScript(Script script){
m_view.setText(script.editableContent(), script.contentBufferSize());
}
bool EditorController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::OK) {
app()->dismissModalViewController();
return true;
}
return false;
}
void EditorController::didBecomeFirstResponder() {
app()->setFirstResponder(&m_view);
}
void EditorController::viewDidDisappear() {
m_scriptParameterController->scriptContentEditionDidFinish();
}
}