Don't use last selected document as active document if UI is enabled

Related to bug found in #656. In this way, if the UI is enabled,
the active document is != null only if there is an active view for it.

Anyway, in batch mode we can potentially have a lot of bugs. There are
several UI commands that think that active view != null (and
current_editor != null) when the active document != null.
This commit is contained in:
David Capello 2015-05-04 16:24:56 -03:00
parent 4f33bef43c
commit ae03dd5461

View File

@ -199,11 +199,13 @@ void UIContext::onGetActiveSite(Site* site) const
view->getSite(site);
}
// Default/dummy site (maybe for batch/command line mode)
else if (Document* doc = m_lastSelectedDoc) {
site->document(doc);
site->sprite(doc->sprite());
site->layer(doc->sprite()->indexToLayer(LayerIndex(0)));
site->frame(0);
else if (!isUiAvailable()) {
if (Document* doc = m_lastSelectedDoc) {
site->document(doc);
site->sprite(doc->sprite());
site->layer(doc->sprite()->indexToLayer(LayerIndex(0)));
site->frame(0);
}
}
}