Commit 685fee11 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Create the popup palette in the canvas

parent e79a18fc
......@@ -85,7 +85,9 @@ public:
, currentCanvasIsOpenGL(false)
, toolProxy(new KisToolProxy(parent))
, favoriteResourceManager(0)
, vastScrolling(true) {
, vastScrolling(true)
, popupPalette(0)
{
}
~KisCanvas2Private() {
......@@ -119,6 +121,8 @@ public:
QRect savedUpdateRect;
QBitArray channelFlags;
KisPopupPalette *popupPalette;
};
KisCanvas2::KisCanvas2(KisCoordinatesConverter *coordConverter, KisView2 *view, KoShapeBasedDocumentBase *sc)
......@@ -794,6 +798,7 @@ QPoint KisCanvas2::documentOffset() const
void KisCanvas2::createFavoriteResourceManager(KisPaintopBox* paintopbox)
{
m_d->favoriteResourceManager = new KisFavoriteResourceManager(paintopbox);
connect(view()->resourceProvider(), SIGNAL(sigFGColorUsed(KoColor)), favoriteResourceManager(), SLOT(slotAddRecentColor(KoColor)));
......@@ -801,7 +806,9 @@ void KisCanvas2::createFavoriteResourceManager(KisPaintopBox* paintopbox)
connect(favoriteResourceManager(), SIGNAL(sigSetFGColor(KoColor)), view()->resourceProvider(), SLOT(slotSetFGColor(KoColor)));
connect(favoriteResourceManager(), SIGNAL(sigEnableChangeColor(bool)), view()->resourceProvider(), SLOT(slotResetEnableFGChange(bool)));
m_d->favoriteResourceManager->resetPopupPaletteParent(m_d->canvasWidget->widget());
m_d->popupPalette = new KisPopupPalette(m_d->favoriteResourceManager, m_d->canvasWidget->widget());
m_d->favoriteResourceManager->setPopupPalette(m_d->popupPalette);
}
KisFavoriteResourceManager* KisCanvas2::favoriteResourceManager()
......@@ -826,6 +833,15 @@ void KisCanvas2::slotSelectionChanged()
}
}
bool KisCanvas2::isPopupPaletteVisible()
{
if (!m_d->popupPalette) {
return false;
}
return m_d->popupPalette->isVisible();
}
void KisCanvas2::setWrapAroundViewingMode(bool value)
{
m_d->canvasWidget->setWrapAroundViewingMode(value);
......
......@@ -220,6 +220,8 @@ private slots:
public:
bool isPopupPaletteVisible();
// interafce for KisCanvasController only
void setWrapAroundViewingMode(bool value);
void initializeImage();
......
......@@ -385,7 +385,7 @@ Qt::Key KisInputManager::Private::workaroundShiftAltMetaHell(const QKeyEvent *ke
bool KisInputManager::Private::tryHidePopupPalette()
{
if (canvas->favoriteResourceManager()->isPopupPaletteVisible()) {
if (canvas->isPopupPaletteVisible()) {
canvas->favoriteResourceManager()->slotShowPopupPalette();
return true;
}
......
......@@ -50,8 +50,6 @@ KisFavoriteResourceManager::KisFavoriteResourceManager(KisPaintopBox *paintopBox
//take favorite brushes from a file then append to QList
KConfigGroup group(KGlobal::config(), "favoriteList");
m_favoritePresetsList = (group.readEntry("favoritePresets")).split(',', QString::SkipEmptyParts);
m_popupPalette = new KisPopupPalette(this);
//m_popupPalette->showPopupPalette(false);
m_colorList = new KisColorDataList();
......@@ -67,6 +65,12 @@ KisFavoriteResourceManager::~KisFavoriteResourceManager()
delete m_colorList;
}
void KisFavoriteResourceManager::setPopupPalette(QWidget *palette)
{
m_popupPalette = qobject_cast<KisPopupPalette*>(palette);
m_popupPalette->showPopupPalette(false);
}
void KisFavoriteResourceManager::unsetResourceServer()
{
// ...
......@@ -124,11 +128,6 @@ void KisFavoriteResourceManager::slotChangeActivePaintop(int pos)
}
}
bool KisFavoriteResourceManager::isPopupPaletteVisible()
{
if (!m_popupPalette) return false;
else return m_popupPalette->isVisible();
}
//Palette Manager
void KisFavoriteResourceManager::showPaletteManager()
......
......@@ -46,6 +46,8 @@ public:
KisFavoriteResourceManager(KisPaintopBox *paintopBox);
~KisFavoriteResourceManager();
void setPopupPalette(QWidget *palette);
virtual void unsetResourceServer();
static const int MAX_FAVORITE_PRESETS = 10;
......@@ -56,7 +58,7 @@ public:
void showPaletteManager();
void resetPopupPaletteParent(QWidget * = 0);
QList<QImage> favoritePresetImages();
bool isPopupPaletteVisible();
/**********************************Favorite Brushes***********************************/
......
Markdown is supported
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