mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Display test signal
This commit is contained in:
+27
-1
@@ -37,6 +37,14 @@ Shape* DestinationGLCanvas::getShapeFromMappingId(uid mappingId)
|
||||
|
||||
void DestinationGLCanvas::doDraw(QPainter* painter)
|
||||
{
|
||||
if (this->displayTestSignal())
|
||||
{
|
||||
glPushMatrix();
|
||||
this->_drawTestSignal(painter);
|
||||
glPopMatrix();
|
||||
return;
|
||||
}
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
// Draw the mappings.
|
||||
@@ -61,7 +69,9 @@ void DestinationGLCanvas::doDraw(QPainter* painter)
|
||||
mapper->drawControls(painter, &selectedVertices);
|
||||
}
|
||||
else
|
||||
{
|
||||
mapper->drawControls(painter);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
@@ -79,6 +89,22 @@ void DestinationGLCanvas::doDraw(QPainter* painter)
|
||||
painter->drawLine(0, cursorPosition.y(), geo.width(), cursorPosition.y());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DestinationGLCanvas::_drawTestSignal(QPainter* painter)
|
||||
{
|
||||
const QRect& geo = geometry();
|
||||
painter->setPen(MM::CONTROL_COLOR);
|
||||
int height = geo.height();
|
||||
int width = geo.width();
|
||||
|
||||
for (int x = 0; x < width; x += 10)
|
||||
{
|
||||
painter->drawLine(x, 0, x, height);
|
||||
}
|
||||
for (int y = 0; y < height; y += 10)
|
||||
{
|
||||
painter->drawLine(0, y, width, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual void doDraw(QPainter* painter);
|
||||
void _drawTestSignal(QPainter* painter);
|
||||
|
||||
bool _displayCrosshair;
|
||||
};
|
||||
|
||||
@@ -1274,6 +1274,19 @@ void MainWindow::createActions()
|
||||
connect(stickyVertices, SIGNAL(toggled(bool)), sourceCanvas, SLOT(enableStickyVertices(bool)));
|
||||
connect(stickyVertices, SIGNAL(toggled(bool)), destinationCanvas, SLOT(enableStickyVertices(bool)));
|
||||
connect(stickyVertices, SIGNAL(toggled(bool)), outputWindow->getCanvas(), SLOT(enableStickyVertices(bool)));
|
||||
|
||||
|
||||
displayTestSignal = new QAction(tr("&Display test signal"), this);
|
||||
// displayTestSignal->setShortcut(tr("Ctrl+T"));
|
||||
displayTestSignal->setIcon(QIcon(":/control-points"));
|
||||
displayTestSignal->setStatusTip(tr("Display test signal"));
|
||||
displayTestSignal->setIconVisibleInMenu(false);
|
||||
displayTestSignal->setCheckable(true);
|
||||
displayTestSignal->setChecked(false);
|
||||
// Manage show/hide of test signal
|
||||
connect(displayTestSignal, SIGNAL(toggled(bool)), sourceCanvas, SLOT(enableTestSignal(bool)));
|
||||
connect(displayTestSignal, SIGNAL(toggled(bool)), destinationCanvas, SLOT(enableTestSignal(bool)));
|
||||
connect(displayTestSignal, SIGNAL(toggled(bool)), outputWindow->getCanvas(), SLOT(enableTestSignal(bool)));
|
||||
}
|
||||
|
||||
void MainWindow::startFullScreen()
|
||||
@@ -1338,6 +1351,7 @@ void MainWindow::createMenus()
|
||||
viewMenu->addAction(outputWindowFullScreen);
|
||||
viewMenu->addAction(displayCanvasControls);
|
||||
viewMenu->addAction(stickyVertices);
|
||||
viewMenu->addAction(displayTestSignal);
|
||||
//viewMenu->addAction(outputWindowHasCursor);
|
||||
|
||||
// Run.
|
||||
@@ -1401,6 +1415,7 @@ void MainWindow::createToolBars()
|
||||
mainToolBar->addAction(outputWindowFullScreen);
|
||||
mainToolBar->addAction(displayCanvasControls);
|
||||
mainToolBar->addAction(stickyVertices);
|
||||
mainToolBar->addAction(displayTestSignal);
|
||||
|
||||
runToolBar = addToolBar(tr("&Run"));
|
||||
runToolBar->setIconSize(QSize(MM::TOP_TOOLBAR_ICON_SIZE, MM::TOP_TOOLBAR_ICON_SIZE));
|
||||
@@ -1448,6 +1463,8 @@ void MainWindow::createStatusBar()
|
||||
|
||||
void MainWindow::readSettings()
|
||||
{
|
||||
// FIXME: for each setting that is new since the first release in the major version number branch,
|
||||
// make sure it exists before reading its value.
|
||||
QSettings settings("MapMap", "MapMap");
|
||||
|
||||
restoreGeometry(settings.value("geometry").toByteArray());
|
||||
@@ -1458,6 +1475,11 @@ void MainWindow::readSettings()
|
||||
outputWindow->restoreGeometry(settings.value("outputWindow").toByteArray());
|
||||
displayOutputWindow->setChecked(settings.value("displayOutputWindow").toBool());
|
||||
outputWindowFullScreen->setChecked(settings.value("outputWindowFullScreen").toBool());
|
||||
if (settings.contains("displayTestSignal"))
|
||||
{
|
||||
displayOutputWindow->setChecked(settings.value("displayTestSignal").toBool());
|
||||
}
|
||||
displayOutputWindow->setChecked(settings.value("displayOutputWindow").toBool());
|
||||
config_osc_receive_port = 12345; // settings.value("osc_receive_port", 12345).toInt();
|
||||
updateRecentFileActions();
|
||||
updateRecentVideoActions();
|
||||
@@ -1475,6 +1497,7 @@ void MainWindow::writeSettings()
|
||||
settings.setValue("outputWindow", outputWindow->saveGeometry());
|
||||
settings.setValue("displayOutputWindow", displayOutputWindow->isChecked());
|
||||
settings.setValue("outputWindowFullScreen", outputWindowFullScreen->isChecked());
|
||||
settings.setValue("displayTestSignal", displayTestSignal->isChecked());
|
||||
settings.setValue("osc_receive_port", config_osc_receive_port);
|
||||
}
|
||||
|
||||
|
||||
@@ -278,6 +278,7 @@ private:
|
||||
//QAction *outputWindowHasCursor;
|
||||
QAction *outputWindowFullScreen;
|
||||
QAction *displayCanvasControls;
|
||||
QAction *displayTestSignal;
|
||||
QAction *stickyVertices;
|
||||
|
||||
enum { MaxRecentFiles = 10 };
|
||||
|
||||
@@ -343,6 +343,12 @@ void MapperGLCanvas::enableDisplayControls(bool display)
|
||||
updateCanvas();
|
||||
}
|
||||
|
||||
void MapperGLCanvas::enableTestSignal(bool enable)
|
||||
{
|
||||
_displayTestSignal = enable;
|
||||
updateCanvas();
|
||||
}
|
||||
|
||||
void MapperGLCanvas::enableStickyVertices(bool value)
|
||||
{
|
||||
_stickyVertices = value;
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
/// Returns true iff we should display the controls.
|
||||
bool displayControls() const { return _displayControls; }
|
||||
|
||||
/// Returns true iff we should display the test signal
|
||||
bool displayTestSignal() const { return _displayTestSignal; }
|
||||
|
||||
/// Returns true iff we want vertices to stick to each other.
|
||||
bool stickyVertices() const { return _stickyVertices; }
|
||||
|
||||
@@ -129,6 +132,9 @@ private:
|
||||
// True iff we are displaying the controls.
|
||||
bool _displayControls;
|
||||
|
||||
// True iff we are displaying the test signal (grid)
|
||||
bool _displayTestSignal;
|
||||
|
||||
// True iff we want vertices to stick to each other.
|
||||
bool _stickyVertices;
|
||||
|
||||
@@ -140,6 +146,7 @@ public slots:
|
||||
void updateCanvas();
|
||||
void enableDisplayControls(bool display);
|
||||
void enableStickyVertices(bool display);
|
||||
void enableTestSignal(bool enable);
|
||||
void deselectVertices();
|
||||
void deselectAll();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user