예제 #1
0
void LibraryView::showBook(shared_ptr<Book> book) {
	makeUpToDate();
	ZLBlockTreeNode::List bookNodes;
	std::queue<ZLBlockTreeNode*> nodesQueue;
	nodesQueue.push(&rootNode());
	while (!nodesQueue.empty()) {
		const ZLBlockTreeNode::List &children = nodesQueue.front()->children();
		nodesQueue.pop();
		for (ZLBlockTreeNode::List::const_iterator it = children.begin(); it != children.end(); ++it) {
			if ((*it)->isInstanceOf(BookNode::TYPE_ID)) {
				// TODO: replace with == for shared_ptr<Book>
				//if (((BookNode*)*it)->book() == book) {
				if (((BookNode*)*it)->book()->file() == book->file()) {
					bookNodes.push_back(*it);
				}
			} else {
				nodesQueue.push(*it);
			}
		}
	}
	if (bookNodes.empty()) {
		return;
	}
	ZLBlockTreeNode *nodeToShow = bookNodes[0];
	VisibilityMode mode = INVISIBLE;
	for (ZLBlockTreeNode::List::iterator it = bookNodes.begin(); it != bookNodes.end(); ++it) {
		VisibilityMode nodeMode = visibilityMode(*it);
		if ((nodeMode == VISIBLE && mode != VISIBLE) ||
				(nodeMode != INVISIBLE && mode == INVISIBLE)) {
			nodeToShow = *it;
			mode = nodeMode;
		}
	}
	ensureVisible(nodeToShow);
}
예제 #2
0
void NetworkView::paint() {
	if (myUpdateChildren) {
		myUpdateChildren = false;
		makeUpToDate();
	}
	if (myUpdateAccountDependents) {
		myUpdateAccountDependents = false;
		updateAccountDependents();
	}
	myNodesToPaintCovers.clear();
	ZLBlockTreeView::paint();
	std::map<FBReaderNode*,int> nodes;
	nodes.swap(myNodesToPaintCovers);
	shared_ptr<CoverUpdater> updater = CoverUpdater::create();
	if (!updater.isNull()) {
		for (std::map<FBReaderNode*,int>::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
			shared_ptr<ZLImage> coverImage = it->first->coverImage();
			if (!coverImage.isNull()) {
				updater->addTask(coverImage->synchronizationData());
			}
		}
		if (updater->hasTasks()) {
			ZLTimeManager::Instance().addAutoRemovableTask(new CoverUpdaterRunner(updater));
		}
	}
	for (std::map<FBReaderNode*,int>::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
		it->first->drawCoverReal(context(), it->second);
	}
	myNodesToPaintCovers.clear();
}
예제 #3
0
void LibraryView::paint() {
	const std::size_t revision = Library::Instance().revision();
	if (myCollectionRevision < revision) {
		myCollectionRevision = revision;
		makeUpToDate();
	}

	ZLBlockTreeView::paint();
}
예제 #4
0
void LibraryView::paint() {
	AppLog("LibraryView::paint()");
	const size_t revision = Library::Instance().revision();
	if (myCollectionRevision < revision) {
		myCollectionRevision = revision;
		makeUpToDate();
	}
	AppLog("ZLBlockTreeView::paint();");
	ZLBlockTreeView::paint();
}
예제 #5
0
ShaderCompiler::ShaderCompiler(Lumix::WorldEditor& editor, LogUI& log_ui)
	: m_editor(editor)
	, m_log_ui(log_ui)
	, m_dependencies(editor.getAllocator())
	, m_to_reload(editor.getAllocator())
	, m_processes(editor.getAllocator())
	, m_changed_files(editor.getAllocator())
	, m_mutex(false)
{
	m_notifications_id = -1;
	m_is_compiling = false;
	
	m_watcher = FileSystemWatcher::create("shaders", m_editor.getAllocator());
	m_watcher->getCallback()
		.bind<ShaderCompiler, &ShaderCompiler::onFileChanged>(this);
	parseDependencies();
	makeUpToDate();
}