diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc --- a/libs/ui/dialogs/kis_dlg_preferences.cc +++ b/libs/ui/dialogs/kis_dlg_preferences.cc @@ -143,6 +143,10 @@ m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport()); m_chkCacheAnimatioInBackground->setChecked(cfg.calculateAnimationCacheInBackground()); + KoColor cursorColor(KoColorSpaceRegistry::instance()->rgb8()); + cursorColor.fromQColor(cfg.getCursorMainColor()); + cursorColorBtutton->setColor(cursorColor); + connect(m_bnFileName, SIGNAL(clicked()), SLOT(getBackgroundImage())); connect(clearBgImageButton, SIGNAL(clicked()), SLOT(clearBackgroundImage())); } @@ -183,6 +187,9 @@ m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport(true)); m_chkCacheAnimatioInBackground->setChecked(cfg.calculateAnimationCacheInBackground(true)); + KoColor cursorColor(KoColorSpaceRegistry::instance()->rgb8()); + cursorColor.fromQColor(cfg.getCursorMainColor(true)); + cursorColorBtutton->setColor(cursorColor); } CursorStyle GeneralTab::cursorStyle() @@ -781,6 +788,13 @@ chkHidePopups->setChecked(cfg.hidePopups()); connect(grpOpenGL, SIGNAL(toggled(bool)), SLOT(slotUseOpenGLToggled(bool))); + + KoColor gridColor(KoColorSpaceRegistry::instance()->rgb8()); + gridColor.fromQColor(cfg.getPixelGridColor()); + pixelGridColorButton->setColor(gridColor); + pixelGridDrawingThresholdBox->setValue(cfg.getPixelGridDrawingThreshold() * 100); + grpPixelGrid->setEnabled(true); + grpPixelGrid->setChecked(cfg.pixelGridEnabled()); } void DisplaySettingsTab::setDefault() @@ -821,6 +835,12 @@ chkChannelsAsColor->setChecked(cfg.showSingleChannelAsColor(true)); chkHidePopups->setChecked(cfg.hidePopups(true)); + KoColor gridColor(KoColorSpaceRegistry::instance()->rgb8()); + gridColor.fromQColor(cfg.getPixelGridColor(true)); + pixelGridColorButton->setColor(gridColor); + pixelGridDrawingThresholdBox->setValue(cfg.getPixelGridDrawingThreshold(true) * 100); + grpPixelGrid->setEnabled(true); + grpPixelGrid->setChecked(cfg.pixelGridEnabled(true)); } void DisplaySettingsTab::slotUseOpenGLToggled(bool isChecked) @@ -1117,6 +1137,11 @@ cfg.setHideTitlebarFullscreen(dialog->m_fullscreenSettings->chkTitlebar->checkState()); cfg.setHideToolbarFullscreen(dialog->m_fullscreenSettings->chkToolbar->checkState()); + cfg.setCursorMainColor(dialog->m_general->cursorColorBtutton->color().toQColor()); + cfg.setPixelGridColor(dialog->m_displaySettings->pixelGridColorButton->color().toQColor()); + cfg.setPixelGridDrawingThreshold(dialog->m_displaySettings->pixelGridDrawingThresholdBox->value() / 100); + cfg.enablePixelGrid(dialog->m_displaySettings->grpPixelGrid->isChecked()); + dialog->m_authorPage->apply(); } diff --git a/libs/ui/forms/wdgdisplaysettings.ui b/libs/ui/forms/wdgdisplaysettings.ui --- a/libs/ui/forms/wdgdisplaysettings.ui +++ b/libs/ui/forms/wdgdisplaysettings.ui @@ -6,7 +6,7 @@ 0 0 - 504 + 619 685 @@ -153,7 +153,7 @@ - + Qt::Vertical @@ -337,6 +337,75 @@ + + + + Pixel Grid + + + true + + + + + + Color: + + + + + + + % + + + 6400.000000000000000 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Start showing at: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/libs/ui/forms/wdggeneralsettings.ui b/libs/ui/forms/wdggeneralsettings.ui --- a/libs/ui/forms/wdggeneralsettings.ui +++ b/libs/ui/forms/wdggeneralsettings.ui @@ -113,6 +113,26 @@ + + + + Cursor Color: + + + + + + + + 48 + 25 + + + + + + + diff --git a/libs/ui/kis_config.h b/libs/ui/kis_config.h --- a/libs/ui/kis_config.h +++ b/libs/ui/kis_config.h @@ -192,11 +192,14 @@ QColor getGridSubdivisionColor(bool defaultValue = false) const; void setGridSubdivisionColor(const QColor & v) const; - QColor getOpenGLGridColor(bool defaultValue = false) const; - void setOpenGLGridColor(const QColor & v) const; + QColor getPixelGridColor(bool defaultValue = false) const; + void setPixelGridColor(const QColor & v) const; - qreal getOpenGLGridDrawingThreshold(bool defaultValue = false) const; - void setOpenGLGridDrawingThreshold(qreal v) const; + qreal getPixelGridDrawingThreshold(bool defaultValue = false) const; + void setPixelGridDrawingThreshold(qreal v) const; + + bool pixelGridEnabled(bool defaultValue = false) const; + void enablePixelGrid(bool v) const; quint32 guidesLineStyle(bool defaultValue = false) const; void setGuidesLineStyle(quint32 v) const; diff --git a/libs/ui/kis_config.cc b/libs/ui/kis_config.cc --- a/libs/ui/kis_config.cc +++ b/libs/ui/kis_config.cc @@ -283,12 +283,12 @@ { QColor col; col.setRgbF(0.501961, 1.0, 0.501961); - return (defaultValue ? col : m_cfg.readEntry("cursormaincolor", col)); + return (defaultValue ? col : m_cfg.readEntry("cursorMaincColor", col)); } void KisConfig::setCursorMainColor(const QColor &v) const { - m_cfg.writeEntry("cursormaincolor", v); + m_cfg.writeEntry("cursorMaincColor", v); } OutlineStyle KisConfig::newOutlineStyle(bool defaultValue) const @@ -733,26 +733,37 @@ m_cfg.writeEntry("gridsubdivisioncolor", v); } -QColor KisConfig::getOpenGLGridColor(bool defaultValue) const +QColor KisConfig::getPixelGridColor(bool defaultValue) const { QColor col(255, 255, 255); - return (defaultValue ? col : m_cfg.readEntry("openglgridcolor", col)); + return (defaultValue ? col : m_cfg.readEntry("pixelGridColor", col)); } -void KisConfig::setOpenGLGridColor(const QColor & v) const +void KisConfig::setPixelGridColor(const QColor & v) const { - m_cfg.writeEntry("openglgridcolor", v); + m_cfg.writeEntry("pixelGridColor", v); } -qreal KisConfig::getOpenGLGridDrawingThreshold(bool defaultValue) const +qreal KisConfig::getPixelGridDrawingThreshold(bool defaultValue) const { qreal border = 8.0f; - return (defaultValue ? border : m_cfg.readEntry("griddrawingborder", border)); + return (defaultValue ? border : m_cfg.readEntry("pixelGridDrawingThreshold", border)); } -void KisConfig::setOpenGLGridDrawingThreshold(qreal v) const +void KisConfig::setPixelGridDrawingThreshold(qreal v) const { - m_cfg.writeEntry("griddrawingborder", v); + m_cfg.writeEntry("pixelGridDrawingThreshold", v); +} + +bool KisConfig::pixelGridEnabled(bool defaultValue) const +{ + bool enabled = true; + return (defaultValue ? enabled : m_cfg.readEntry("pixelGridEnabled", enabled)); +} + +void KisConfig::enablePixelGrid(bool v) const +{ + m_cfg.writeEntry("pixelGridEnabled", v); } quint32 KisConfig::guidesLineStyle(bool defaultValue) const diff --git a/libs/ui/opengl/kis_opengl_canvas2.cpp b/libs/ui/opengl/kis_opengl_canvas2.cpp --- a/libs/ui/opengl/kis_opengl_canvas2.cpp +++ b/libs/ui/opengl/kis_opengl_canvas2.cpp @@ -524,7 +524,7 @@ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); KisConfig cfg; - QColor gridColor = cfg.getOpenGLGridColor(); + QColor gridColor = cfg.getPixelGridColor(); d->solidColorShader->setUniformValue( d->solidColorShader->location(Uniform::FragmentColor), QVector4D(gridColor.redF(), gridColor.greenF(), gridColor.blueF(), 0.5f)); @@ -781,7 +781,7 @@ drawCheckers(); drawImage(); KisConfig cfg; - if (coordinatesConverter()->effectiveZoom() > cfg.getOpenGLGridDrawingThreshold() - 0.00001) { + if ((coordinatesConverter()->effectiveZoom() > cfg.getPixelGridDrawingThreshold() - 0.00001) && cfg.pixelGridEnabled()) { drawGrid(); } if (KisOpenGL::hasOpenGL3()) {