Commit 1a47ae24 authored by Scott Petrovic's avatar Scott Petrovic
Browse files

BUG:389033 Fix pixel grid enabling not keeping in sync between multiple views

parent 757f7557
......@@ -460,8 +460,6 @@ void KisViewManager::setCurrentView(KisView *view)
doc->image()->compositeProgressProxy()->addProxy(d->persistentImageProgressUpdater);
d->viewConnections.addUniqueConnection(&d->statusBar, SIGNAL(sigCancellationRequested()), doc->image(), SLOT(requestStrokeCancellation()));
d->viewConnections.addUniqueConnection(d->showPixelGrid, SIGNAL(toggled(bool)), canvasController, SLOT(slotTogglePixelGrid(bool)));
imageView->zoomManager()->setShowRulers(d->showRulersAction->isChecked());
imageView->zoomManager()->setRulersTrackMouse(d->rulersTrackMouseAction->isChecked());
......@@ -727,9 +725,6 @@ void KisViewManager::createActions()
actionCollection()->addAction("settings_active_author", d->actionAuthor);
slotUpdateAuthorProfileActions();
d->showPixelGrid = actionManager()->createAction("view_pixel_grid");
d->showPixelGrid->setChecked(cfg.pixelGridEnabled());
}
void KisViewManager::setupManagers()
......
......@@ -276,22 +276,6 @@ bool KisCanvasController::wrapAroundMode() const
return kritaCanvas->wrapAroundViewingMode();
}
void KisCanvasController::slotTogglePixelGrid(bool value)
{
KisConfig cfg;
cfg.enablePixelGrid(value);
KisCanvas2 *kritaCanvas = dynamic_cast<KisCanvas2*>(canvas());
// pixel grid only works with openGL
if (kritaCanvas->canvasIsOpenGL() ) {
KisOpenGLCanvas2 *openGLWidget = dynamic_cast<KisOpenGLCanvas2*>(kritaCanvas->canvasWidget());
openGLWidget->slotConfigChanged();
}
}
void KisCanvasController::slotToggleLevelOfDetailMode(bool value)
{
KisCanvas2 *kritaCanvas = dynamic_cast<KisCanvas2*>(canvas());
......
......@@ -58,7 +58,6 @@ public Q_SLOTS:
qreal rotation() const;
void resetCanvasRotation();
void slotToggleWrapAroundMode(bool value);
void slotTogglePixelGrid(bool value);
void slotToggleLevelOfDetailMode(bool value);
Q_SIGNALS:
......
......@@ -398,6 +398,11 @@ KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *
m_toolOptionsPopup->switchDetached(false);
}
// pixel grid
m_showPixelGridAction = m_viewManager->actionManager()->createAction("view_pixel_grid");
m_showPixelGridAction->setChecked(cfg.pixelGridEnabled());
connect(m_showPixelGridAction, SIGNAL(toggled(bool)), this, SLOT(slotEnableShowPixelGrid(bool)));
m_savePresetWidget = new KisPresetSaveWidget(this);
......@@ -740,6 +745,12 @@ void KisPaintopBox::slotSetPaintop(const QString& paintOpId)
}
}
void KisPaintopBox::slotEnableShowPixelGrid(bool enabled)
{
KisConfig cfg;
cfg.enablePixelGrid(enabled);
}
void KisPaintopBox::slotInputDeviceChanged(const KoInputDevice& inputDevice)
{
TabletToolMap::iterator toolData = m_tabletToolMap.find(inputDevice);
......
......@@ -121,6 +121,7 @@ public Q_SLOTS:
void slotInputDeviceChanged(const KoInputDevice & inputDevice);
void slotCanvasResourceChanged(int key, const QVariant& v);
void resourceSelected(KoResource* resource);
void slotEnableShowPixelGrid(bool enabled);
/// This should take care of creating a new brush preset from scratch
/// It will either load the default brush preset for the engine,
......@@ -205,6 +206,8 @@ private:
KisAction* m_eraseAction;
KisAction* m_reloadAction;
KisAction* m_disablePressureAction;
KisAction* m_showPixelGridAction;
QString m_currCompositeOpID;
KisNodeWSP m_previousNode;
......
......@@ -107,7 +107,6 @@ public:
#endif
qreal pixelGridDrawingThreshold;
bool pixelGridEnabled;
QColor gridColor;
QColor cursorColor;
......@@ -785,7 +784,6 @@ void KisOpenGLCanvas2::slotConfigChanged()
d->filterMode = (KisOpenGL::FilterMode) cfg.openGLFilteringMode();
d->pixelGridDrawingThreshold = cfg.getPixelGridDrawingThreshold();
d->pixelGridEnabled = cfg.pixelGridEnabled();
d->gridColor = cfg.getPixelGridColor();
d->cursorColor = cfg.getCursorMainColor();
......@@ -825,7 +823,10 @@ void KisOpenGLCanvas2::renderCanvasGL()
drawCheckers();
drawImage();
if ((coordinatesConverter()->effectiveZoom() > d->pixelGridDrawingThreshold - 0.00001) && d->pixelGridEnabled) {
KisConfig cfg;
if ((coordinatesConverter()->effectiveZoom() > d->pixelGridDrawingThreshold - 0.00001) && cfg.pixelGridEnabled()) {
drawGrid();
}
if (KisOpenGL::hasOpenGL3()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment