diff --git a/apps/Makefile b/apps/Makefile index d96bbbbb3..65af60ae4 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -38,8 +38,9 @@ snapshots_construction = $(foreach i,$(snapshots),,m_snapshot$(subst :,,$(i))()) snapshots_list = $(foreach i,$(snapshots),,&m_snapshot$(subst :,,$(i))) snapshots_count = $(words $(snapshots)) snapshot_includes = $(foreach i,$(snapshot_headers),-include $(i) ) +epsilon_app_names = '$(foreach i,${EPSILON_APPS},"$(i)", )' -apps/apps_container_storage.o apps/main.o: CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count) +apps/apps_container_storage.o apps/main.o: CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count) -DEPSILON_APPS_NAMES=$(epsilon_app_names) i18n_files += $(addprefix apps/language_,$(addsuffix .universal.i18n, $(EPSILON_I18N))) diff --git a/apps/code/app.cpp b/apps/code/app.cpp index f59b1b285..dcbd81afa 100644 --- a/apps/code/app.cpp +++ b/apps/code/app.cpp @@ -18,6 +18,14 @@ const Image * App::Descriptor::icon() { return ImageStore::CodeIcon; } +App::Snapshot::Snapshot() : +#if EPSILON_GETOPT + m_lockOnConsole(false), +#endif + m_scriptStore() +{ +} + App * App::Snapshot::unpack(Container * container) { return new App(container, this); } @@ -35,10 +43,40 @@ ScriptStore * App::Snapshot::scriptStore() { return &m_scriptStore; } +#if EPSILON_GETOPT +bool App::Snapshot::lockOnConsole() const { + return m_lockOnConsole; +} + +void App::Snapshot::setOpt(const char * name, char * value) { + if (strcmp(name, "script") == 0) { + m_scriptStore.deleteAllScripts(); + char * separator = strchr(value, ':'); + if (!separator) { + return; + } + *separator = 0; + const char * scriptName = value; + const char * scriptContent = separator+1; + Code::ScriptTemplate script(scriptName, scriptContent); + m_scriptStore.addScriptFromTemplate(&script); + return; + } + if (strcmp(name, "lock-on-console") == 0) { + m_lockOnConsole = true; + return; + } +} +#endif + App::App(Container * container, Snapshot * snapshot) : ::App(container, snapshot, &m_codeStackViewController, I18n::Message::Warning), m_listFooter(&m_codeStackViewController, &m_menuController, &m_menuController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGrey, ButtonRowController::Size::Large), - m_menuController(&m_listFooter, snapshot->scriptStore(), &m_listFooter), + m_menuController(&m_listFooter, snapshot->scriptStore(), &m_listFooter +#if EPSILON_GETOPT + , snapshot->lockOnConsole() +#endif + ), m_codeStackViewController(&m_modalViewController, &m_listFooter), m_toolboxActionForTextArea([](void * sender, const char * text) { TextArea * textArea = static_cast