Commit 62fe174e authored by Boudewijn Rempt's avatar Boudewijn Rempt

Start rearranging the paintop toolbar following Deevad's suggestions

Still wip, though.

svn path=/trunk/koffice/; revision=1174710
parent 0aadd23e
......@@ -680,6 +680,7 @@ bool KisCanvas2::handlePopupPaletteIsVisible(KoPointerEvent* e)
//TODO: port favoriteResourceManager to KisCanvas2, then enable this function.
if (e->button() && (Qt::LeftButton || Qt::MidButton || Qt::RightButton)
&& favoriteResourceManager()
&& favoriteResourceManager()->isPopupPaletteVisible()) {
favoriteResourceManager()->slotShowPopupPalette();
return true;
......
......@@ -58,7 +58,6 @@
#include "kis_paintop_box.h"
#include "kis_custom_pattern.h"
#include "widgets/kis_pattern_chooser.h"
#include "kis_popup_palette.h"
#include "ko_favorite_resource_manager.h"
#include <kis_canvas2.h>
......@@ -91,7 +90,7 @@ KisControlFrame::KisControlFrame(KisView2 * view, const char* name)
action = new KAction(i18n("&Gradients"), this);
view->actionCollection()->addAction("gradients", action);
action->setDefaultWidget(m_gradientWidget);
KoResourceServer<KoAbstractGradient> * rserver = KoResourceServerProvider::instance()->gradientServer();
KoAbstractResourceServerAdapter* adapter = new KoResourceServerAdapter<KoAbstractGradient>(rserver);
m_gradientWidget->setResourceAdapter(adapter);
......@@ -119,16 +118,6 @@ KisControlFrame::KisControlFrame(KisView2 * view, const char* name)
action = new KAction(i18n("&Painter's Tools"), this);
view->actionCollection()->addAction("paintops", action);
action->setDefaultWidget(m_paintopBox);
/***TESTING***/
m_view->canvasBase()->createFavoriteResourceManager(m_paintopBox);
m_paletteButton = new QPushButton(i18n("Save to Palette"));
connect(m_paletteButton, SIGNAL(clicked()), this, SLOT(slotSaveToFavouriteBrushes()));
action = new KAction(i18n("&Palette"), this);
view->actionCollection()->addAction("palette_manager", action);
action->setDefaultWidget(m_paletteButton);
}
......@@ -182,17 +171,6 @@ void KisControlFrame::createPatternsChooser(KisView2 * view)
}
void KisControlFrame::slotSaveToFavouriteBrushes()
{
if(! m_view->canvasBase()->favoriteResourceManager())
{
m_view->canvasBase()->createFavoriteResourceManager(m_paintopBox);
}
else {
m_view->canvasBase()->favoriteResourceManager()->showPaletteManager();
}
}
void KisControlFrame::createGradientsChooser(KisView2 * view)
{
m_gradientChooserPopup = new QWidget(m_gradientWidget);
......
......@@ -66,7 +66,6 @@ public slots:
void slotSetPattern(KisPattern * pattern);
void slotSetGradient(KoAbstractGradient * gradient);
void slotSaveToFavouriteBrushes();
private:
......@@ -90,7 +89,7 @@ private:
KisGradientChooser * m_gradientChooser;
KisPaintopBox * m_paintopBox;
QPushButton* m_paletteButton;
};
#endif
......
......@@ -55,6 +55,7 @@
#include <kis_image.h>
#include <kis_node.h>
#include "kis_canvas2.h"
#include "kis_node_manager.h"
#include "kis_layer_manager.h"
#include "kis_view2.h"
......@@ -103,22 +104,19 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
m_settingsWidget = new KisPopupButton(this);
m_settingsWidget->setIcon(KIcon("paintop_settings_02"));
m_settingsWidget->setToolTip(i18n("Edit brush settings"));
m_settingsWidget->setFixedSize(32, 32);
//m_settingsWidget->setText(i18n("Create Brush"));
//m_settingsWidget->setFixedSize(32, 32);
m_presetWidget = new KisPopupButton(this);
m_presetWidget->setIcon(KIcon("paintop_settings_01"));
m_presetWidget->setToolTip(i18n("Choose brush preset"));
m_presetWidget->setFixedSize(32, 32);
m_brushChooser = new KisPopupButton(this);
m_brushChooser->setIcon(KIcon("paintop_settings_01"));
m_brushChooser->setToolTip(i18n("Choose and edit brush"));
m_brushChooser->setFixedSize(32, 32);
//m_presetWidget->setText(i18n("Select Brush"));
//m_presetWidget->setFixedSize(32, 32);
m_eraseModeButton = new QPushButton(this);
m_eraseModeButton->setIcon(KIcon("draw-eraser"));
m_eraseModeButton->setToolTip(i18n("Set eraser mode"));
m_eraseModeButton->setFixedSize(32, 32);
//m_eraseModeButton->setFixedSize(32, 32);
m_eraseModeButton->setCheckable(true);
m_eraseModeButton->setShortcut(Qt::Key_E);
......@@ -130,15 +128,27 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
nodeChanged(view->activeNode());
connect(m_cmbComposite, SIGNAL(activated(const QString&)), this, SLOT(slotSetCompositeMode(const QString&)));
m_brushChooser = new KisPopupButton(this);
//m_brushChooser->setIcon(KIcon("paintop_settings_01"));
m_brushChooser->setText(i18n("Brush Editor"));
m_brushChooser->setToolTip(i18n("Choose and edit brush"));
m_paletteButton = new QPushButton(i18n("Save to Palette"));
connect(m_paletteButton, SIGNAL(clicked()), this, SLOT(slotSaveToFavouriteBrushes()));
//KAction *action = new KAction(i18n("&Palette"), this);
//view->actionCollection()->addAction("palette_manager", action);
//action->setDefaultWidget(m_paletteButton);
m_layout = new QHBoxLayout(this);
m_layout->addWidget(m_cmbPaintops);
m_layout->addWidget(m_settingsWidget);
m_layout->addWidget(m_presetWidget);
m_layout->addWidget(m_brushChooser);
m_layout->addWidget(labelMode);
m_layout->addWidget(m_cmbComposite);
m_layout->addWidget(m_eraseModeButton);
//m_layout->addSpacerItem(new QSpacerItem(10, 1, QSizePolicy::Expanding, QSizePolicy::Minimum));
m_layout->addWidget(m_paletteButton);
m_layout->addSpacerItem(new QSpacerItem(10, 1, QSizePolicy::Expanding, QSizePolicy::Minimum));
m_layout->addWidget(m_brushChooser);
m_presetsPopup = new KisPaintOpPresetsPopup(m_resourceProvider);
m_settingsWidget->setPopupWidget(m_presetsPopup);
......@@ -559,4 +569,16 @@ void KisPaintopBox::slotSetCompositeMode(const QString& compositeOp)
m_resourceProvider->setCurrentCompositeOp(compositeOp);
}
void KisPaintopBox::slotSaveToFavouriteBrushes()
{
if(! m_view->canvasBase()->favoriteResourceManager())
{
m_view->canvasBase()->createFavoriteResourceManager(this);
}
else {
m_view->canvasBase()->favoriteResourceManager()->showPaletteManager();
}
}
#include "kis_paintop_box.moc"
......@@ -111,6 +111,7 @@ private slots:
void eraseModeToggled(bool checked);
void updateCompositeOpComboBox();
void slotSetCompositeMode(const QString& compositeOp);
void slotSaveToFavouriteBrushes();
private:
......@@ -130,6 +131,7 @@ private:
KisPaintOpPresetsChooserPopup* m_presetsChooserPopup;
KisBrushEngineSelector* m_brushEngineSelector;
KisView2* m_view;
QPushButton* m_paletteButton;
QMap<KoID, KisPaintOpSettingsWidget*> m_paintopOptionWidgets;
QList<KoID> m_paintops;
......
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