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

Create the popup palette in the canvas

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