void Drawboard::updateTool(const QPoint& pos) { if (pos != lastToolPos) { updateTool(); lastToolPos = pos; updateTool(); } }
void Drawboard::setTool(tool::Tool tool) { if (tool == currentTool) { return; } updateTool(); currentTool = tool; updateTool(); emit changedTool(currentTool); }
EditorUI::EditorUI() : mFile(0) { setupUi(this); actNew->setIcon(style()->standardIcon(QStyle::SP_FileIcon)); actOpen->setIcon(style()->standardIcon(QStyle::SP_DirOpenIcon)); actSave->setIcon(style()->standardIcon(QStyle::SP_DriveFDIcon)); CommWindow *comm = new CommWindow(CommDock); CommDock->setWidget(comm); CommDock->setVisible(false); mGame = new EditorGame(comm); mBp = new EditorBlueprint(mGame, this); setCentralWidget(mBp); connect(mBp, SIGNAL(zoomChanged(float)), this, SLOT(zoomChanged(float))); connect(mBp, SIGNAL(dropEntity(Math::Point)), this, SLOT(dropEntity(Math::Point))); connect(mGame, SIGNAL(worldUpdated()), mBp, SLOT(repaint())); toolSelect = new QButtonGroup(this); toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actPanTool), EditorBlueprint::pan); toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actMoveTool), EditorBlueprint::move); toolSelect->addButton((QAbstractButton*)toolBar->widgetForAction(actBuildTool), EditorBlueprint::build); connect(actMoveTool, SIGNAL(triggered()), this, SLOT(updateTool())); connect(actPanTool, SIGNAL(triggered()), this, SLOT(updateTool())); connect(actBuildTool, SIGNAL(triggered()), this, SLOT(updateTool())); entityBox = new QComboBox(this); entityBox->addItem(""); entityBox->addItems(FactoryManager::instance()->types()); toolBar->addSeparator(); toolBar->addWidget(entityBox); zoomLabel = new QLabel; statusbar->addPermanentWidget(zoomLabel); zoomChanged(mBp->zoom()); connect(actNew, SIGNAL(triggered()), this, SLOT(New())); connect(actOpen, SIGNAL(triggered()), this, SLOT(open())); connect(actSave, SIGNAL(triggered()), this, SLOT(save())); connect(actSaveAs, SIGNAL(triggered()), this, SLOT(saveAs())); connect(actShowNavmesh, SIGNAL(triggered(bool)), mBp, SLOT(setShowNavmesh(bool))); connect(actPopulate, SIGNAL(triggered()), this, SLOT(populate())); connect(actReset, SIGNAL(triggered()), this, SLOT(reset())); connect(actStartStop, SIGNAL(triggered()), this, SLOT(startStop())); connect(actGenNavmesh, SIGNAL(triggered()), this, SLOT(generateNavmesh())); New(); }
void Drawboard::showTool(bool show) { if (toolVisible != show) { if (show) { toolVisible = show; updateTool(); } else { updateTool(); toolVisible = show; } } }
void Drawboard::mouseMoveEvent(QMouseEvent* event) { if (rect().contains(event->pos())) { draw(lastDraw, event->pos()); lastDraw = event->pos(); updateTool(event->pos()); } }
void Drawboard::mousePressEvent(QMouseEvent* event) { showTool(true); if (rect().contains(event->pos())) { draw(event->pos(), event->pos()); lastDraw = event->pos(); updateTool(event->pos()); } }
void Tool::update(const PlayerController &event) { updateTool(event); if(event.pressed(SELECT) && isInside(event.mousePos())) { if(m_selected) m_player = (m_player+1)%m_players.size(); else { select(); } } }
void CompartmentMapWidget::loadAtlas() { //QString atlasfile(":/atlas/flybraincompartmentmap.v3ds"); // .qrc QString flybrainatlas("flybraincompartmentmap.v3ds"); QString atlasfile; if(QFile::exists(QDir::currentPath().append("/").append(flybrainatlas))) { atlasfile = QDir::currentPath().append("/").append(flybrainatlas); } else if(QFile::exists(QDir::homePath().append("/").append(flybrainatlas))) { atlasfile = QDir::homePath().append("/").append(flybrainatlas); } else if(QFile::exists(QDir::rootPath().append("/").append(flybrainatlas))) { atlasfile = QDir::rootPath().append("/").append(flybrainatlas); } else if(QFile::exists(QDir::tempPath().append("/").append(flybrainatlas))) { atlasfile = QDir::tempPath().append("/").append(flybrainatlas); } else if(QFile::exists(qApp->applicationDirPath().append("/").append(flybrainatlas))) { atlasfile = qApp->applicationDirPath().append("/").append(flybrainatlas); } else if(QFile::exists(qApp->applicationDirPath().append("/../../../").append(flybrainatlas))) { atlasfile = qApp->applicationDirPath().append("/../../../").append(flybrainatlas); } if(QFile::exists(atlasfile)) { ((Renderer_gl1 *)renderer)->loadV3DSFile(atlasfile); //((Renderer_gl1 *)renderer)->loadObjectFromFile(atlasfile.toStdString().c_str()); updateTool(); //renderer->paint(); //POST_updateGL(); //update(); } }