Commit 97dfe127 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Reinstate the control frame with the brush chooser etc. Pity qt4/kde4/whatever

doesn't actually show the buttons. Don't know what's wrong here, though.

svn path=/trunk/koffice/; revision=606161
parent 92346d9b
......@@ -150,17 +150,6 @@
</MenuBar>
<!--ToolBar name="edit_toolbar" position="top"><Text>Edit</Text>
<Action name="edit_undo"/>
<Action name="edit_redo"/>
<Separator/>
<Action name="cut"/>
<Action name="copy"/>
<Action name="remove"/>
<Action name="scrap_selection"/>
<Action name="paste_special"/>
</ToolBar-->
<ToolBar name="navigation" position="top"><Text>Navigation</Text>
<Action name="refresh_canvas"/>
<Action name="zoom"/>
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd" ><kpartgui name="Krita" version="1">
<MenuBar>
<Menu name="edit"><text>Edit</text>
<Separator/>
<Action name="copy"/>
<Separator/>
<Action name="select_all"/>
<Action name="select_none"/>
<Action name="flip_selection"/>
</Menu>
<Menu name="view"><text>View</text>
<Action name="zoom_in"/>
......
include_directories(${CMAKE_SOURCE_DIR}/krita/ui/obsolete/)
set(kritaui_LIB_SRCS
# kis_birdeye_box.cc
# kis_paintop_box.cc # Needs to know about the active input device a lot
kis_paintop_box.cc # Needs to know about the active input device a lot
kis_tool.cc
squeezedcombobox.cpp
kis_statusbar.cc
......
......@@ -28,7 +28,6 @@
class KoBirdEyePanel;
class KisDoubleWidget;
class KisView2;
class KisCanvasSubject;
class KoZoomAdapter;
class KoColorSpace;
......@@ -59,7 +58,6 @@ private:
KisDoubleWidget * m_exposureDoubleWidget;
QLabel *m_exposureLabel;
KisView2 * m_view;
KisCanvasSubject * m_subject;
bool m_draggingExposureSlider;
KoZoomAdapter * m_zoomAdapter;
KisImageSP m_image;
......
......@@ -4,6 +4,7 @@
* Copyright (c) 1999 Matthias Elter <elter@kde.org>
* Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -126,9 +127,9 @@ KisControlFrame::KisControlFrame( KMainWindow * /*window*/, KisView2 * view, con
action = new KAction( i18n("&Gradients"), view->actionCollection(), "gradients");
action->setDefaultWidget( m_gradientWidget );
//m_paintopBox = new KisPaintopBox( view, view, "paintopbox" );
m_paintopBox = new KisPaintopBox( view, view, "paintopbox" );
action = new KAction(i18n("&Painter's Tools"), view->actionCollection(), "paintops");
//action->setDefaultWidget( m_paintopBox );
action->setDefaultWidget( m_paintopBox );
/**** Temporary hack to test the KoDualColorButton ***/
KoDualColorButton * dual = new KoDualColorButton(view->resourceProvider()->fgColor(), view->resourceProvider()->fgColor(), view, view);
......@@ -238,7 +239,11 @@ void KisControlFrame::createBrushesChooser(KisView2 * view)
KisAutobrush * m_autobrush = new KisAutobrush(0, "autobrush", i18n("Autobrush"));
m_brushesTab->addTab( m_autobrush, i18n("Autobrush"));
connect(m_autobrush, SIGNAL(activatedResource(KisResource*)), m_view, SLOT(brushActivated( KisResource* )));
connect(m_autobrush,
SIGNAL(activatedResource(KisResource*)),
m_view->resourceProvider(),
SLOT(slotBrushActivated( KisResource* )));
KisBrushChooser * m_brushChooser = new KisBrushChooser(0, "brush_chooser");
m_brushesTab->addTab( m_brushChooser, i18n("Predefined Brushes"));
......@@ -246,20 +251,28 @@ void KisControlFrame::createBrushesChooser(KisView2 * view)
KisCustomBrush* customBrushes = new KisCustomBrush(0, "custombrush",
i18n("Custom Brush"), m_view);
m_brushesTab->addTab( customBrushes, i18n("Custom Brush"));
connect(customBrushes, SIGNAL(activatedResource(KisResource*)),
m_view, SLOT(brushActivated(KisResource*)));
connect(customBrushes,
SIGNAL(activatedResource(KisResource*)),
m_view->resourceProvider(),
SLOT(slotBrushActivated(KisResource*)));
#ifdef HAVE_TEXT_BRUSH
KisTextBrush* textBrushes = new KisTextBrush(0, "textbrush",
i18n("Text Brush")/*, m_view*/);
m_brushesTab->addTab( textBrushes, i18n("Text Brush"));
connect(textBrushes, SIGNAL(activatedResource(KisResource*)),
m_view, SLOT(brushActivated(KisResource*)));
connect(textBrushes,
SIGNAL(activatedResource(KisResource*)),
m_view->resourceProvider(),
SLOT(slotBrushActivated(KisResource*)));
#endif
m_brushChooserPopup->setLayout(l);
m_brushChooser->setFont(m_font);
m_brushMediator = new KisResourceMediator( m_brushChooser, this);
connect(m_brushMediator, SIGNAL(activatedResource(KisResource*)), m_view, SLOT(brushActivated(KisResource*)));
connect(m_brushMediator, SIGNAL(activatedResource(KisResource*)),
m_view->resourceProvider(), SLOT(slotBrushActivated(KisResource*)));
KisResourceServerBase* rServer;
rServer = KisResourceServerRegistry::instance()->get("ImagePipeBrushServer");
......@@ -267,7 +280,9 @@ void KisControlFrame::createBrushesChooser(KisView2 * view)
rServer = KisResourceServerRegistry::instance()->get("BrushServer");
m_brushMediator->connectServer(rServer);
KisControlFrame::connect(view, SIGNAL(brushChanged(KisBrush *)), this, SLOT(slotBrushChanged( KisBrush *)));
KisControlFrame::connect(view->resourceProvider(), SIGNAL(sigBrushChanged(KisBrush *)),
this, SLOT(slotBrushChanged( KisBrush *)));
m_brushChooser->setCurrent( 0 );
m_brushMediator->setActiveItem( m_brushChooser->currentItem() );
customBrushes->setResourceServer(rServer);
......@@ -303,15 +318,19 @@ void KisControlFrame::createPatternsChooser(KisView2 * view)
m_patternMediator = new KisResourceMediator( chooser, view);
connect( m_patternMediator, SIGNAL(activatedResource(KisResource*)), view, SLOT(patternActivated(KisResource*)));
connect( m_patternMediator, SIGNAL(activatedResource(KisResource*)),
view->resourceProvider(), SLOT(slotPatternActivated(KisResource*)));
connect(customPatterns, SIGNAL(activatedResource(KisResource*)),
view, SLOT(patternActivated(KisResource*)));
view->resourceProvider(), SLOT(slotPatternActivated(KisResource*)));
KisResourceServerBase* rServer;
rServer = KisResourceServerRegistry::instance()->get("PatternServer");
m_patternMediator->connectServer(rServer);
KisControlFrame::connect(view, SIGNAL(patternChanged(KisPattern *)), this, SLOT(slotPatternChanged( KisPattern *)));
KisControlFrame::connect(view->resourceProvider(), SIGNAL(sigPatternChanged(KisPattern *)),
this, SLOT(slotPatternChanged( KisPattern *)));
chooser->setCurrent( 0 );
m_patternMediator->setActiveItem( chooser->currentItem() );
......@@ -341,16 +360,17 @@ void KisControlFrame::createGradientsChooser(KisView2 * view)
m_gradientTab->addTab( m_gradientChooser, i18n("Gradients"));
m_gradientMediator = new KisResourceMediator( m_gradientChooser, view);
connect(m_gradientMediator, SIGNAL(activatedResource(KisResource*)), view, SLOT(gradientActivated(KisResource*)));
connect(m_gradientMediator, SIGNAL(activatedResource(KisResource*)),
view->resourceProvider(), SLOT(slotGradientActivated(KisResource*)));
KisResourceServerBase* rServer;
rServer = KisResourceServerRegistry::instance()->get("GradientServer");
m_gradientMediator->connectServer(rServer);
connect(m_gradientChooser, SIGNAL(selected(QTableWidgetItem*)), this, SLOT(slotGradientChanged( )));
connect(view->resourceProvider(), SIGNAL(sigGradientChanged(KisGradient *)),
this, SLOT(slotGradientChanged( KisGradient *)));
connect(view, SIGNAL(gradientChanged(KisGradient *)), this, SLOT(slotGradientChanged( KisGradient *)));
m_gradientChooser->setCurrent( 0 );
m_gradientMediator->setActiveItem( m_gradientChooser->currentItem() );
}
......
......@@ -37,6 +37,8 @@
#include <kstandarddirs.h>
#include <kinstance.h>
#include <KoToolManager.h>
#include <kis_paintop_registry.h>
#include <kis_resource_provider.h>
#include <kis_view2.h>
......@@ -50,12 +52,12 @@ KisPaintopBox::KisPaintopBox (KisView2 * view, QWidget *parent, const char * nam
: super (parent),
m_resourceProvider(view->resourceProvider())
{
Q_ASSERT(view != 0);
setObjectName(name);
KAcceleratorManager::setNoAccel(this);
Q_ASSERT(m_canvasController != 0);
setWindowTitle(i18n("Painter's Toolchest"));
m_optionWidget = 0;
......@@ -77,14 +79,19 @@ KisPaintopBox::KisPaintopBox (KisView2 * view, QWidget *parent, const char * nam
// add all paintops, and show/hide them afterwards
addItem(*it);
}
#if 0 // XXX: Port once the view (or resourceprovider) has regained these settings
#if 0 // XXX: Fix this when we have the layerbox and everything else
// that can change the current colorspace back (BSAR)
connect(view, SIGNAL(currentColorSpaceChanged(KoColorSpace*)),
this, SLOT(colorSpaceChanged(KoColorSpace*)));
connect(view, SIGNAL(sigInputDeviceChanged(const KoInputDevice&)),
this, SLOT(slotInputDeviceChanged(const KoInputDevice&)));
setCurrentPaintop(defaultPaintop(view->currentInputDevice()));
#endif
connect(KoToolManager::instance(),
SIGNAL(inputDeviceChanged(const KoInputDevice&)),
this,
SLOT(slotInputDeviceChanged(const KoInputDevice&)));
setCurrentPaintop(defaultPaintop(KoToolManager::instance()->currentInputDevice()));
}
KisPaintopBox::~KisPaintopBox()
......@@ -145,7 +152,7 @@ QPixmap KisPaintopBox::paintopPixmap(const KoID & paintop)
return QPixmap();
}
QString fname = KisFactory::instance()->dirs()->findResource("kis_images", pixmapName);
QString fname = KisFactory2::instance()->dirs()->findResource("kis_images", pixmapName);
return QPixmap(fname);
}
......@@ -182,7 +189,7 @@ void KisPaintopBox::updateOptionWidget()
m_layout->invalidate();
}
const KisPaintOpSettings *settings = paintopSettings(currentPaintop(), m_canvasController->currentInputDevice());
const KisPaintOpSettings *settings = paintopSettings(currentPaintop(), KoToolManager::instance()->currentInputDevice());
if (settings != 0) {
m_optionWidget = settings->widget();
......@@ -196,16 +203,16 @@ void KisPaintopBox::updateOptionWidget()
const KoID& KisPaintopBox::currentPaintop()
{
return m_currentID[m_canvasController->currentInputDevice()];
return m_currentID[KoToolManager::instance()->currentInputDevice()];
}
void KisPaintopBox::setCurrentPaintop(const KoID & paintop)
{
m_currentID[m_canvasController->currentInputDevice()] = paintop;
m_currentID[KoToolManager::instance()->currentInputDevice()] = paintop;
updateOptionWidget();
emit selected(paintop, paintopSettings(paintop, m_canvasController->currentInputDevice()));
emit selected(paintop, paintopSettings(paintop, KoToolManager::instance()->currentInputDevice()));
}
KoID KisPaintopBox::defaultPaintop(const KoInputDevice& inputDevice)
......
......@@ -28,16 +28,18 @@
#include <QList>
#include <QPixmap>
#include "KoInputDevice.h"
#include <KoInputDevice.h>
class QString;
class QHBoxLayout;
class KisView2;
class KisResourceProvider;
class KoID;
class KoColorSpace;
class KisView2;
class KisResourceProvider;
class KisPaintOpSettings;
/**
* This widget presents all paintops that a user can paint with.
* Paintops represent real-world tools or the well-known Shoup
......@@ -59,7 +61,6 @@ public:
~KisPaintopBox();
signals:
void selected(const KoID & id, const KisPaintOpSettings *settings);
......
......@@ -216,4 +216,35 @@ void KisResourceProvider::slotLayerActivated( const KisLayerSP l )
}
void KisResourceProvider::slotResourceChanged( KoCanvasResource::EnumCanvasResource key, const QVariant & res )
{
switch ( key ) {
case ( KoCanvasResource::ForegroundColor ):
emit sigFGColorChanged( res.value<KoColor>() );
break;
case ( KoCanvasResource::BackgroundColor ):
emit sigBGColorChanged( res.value<KoColor>() );
break;
case ( KoCanvasResource::CurrentBrush ):
emit sigBrushChanged( static_cast<KisBrush *>( res.value<void *>() ) );
break;
case ( KoCanvasResource::CurrentPattern ):
emit sigPatternChanged( static_cast<KisPattern *>( res.value<void *>() ) );
break;
case ( KoCanvasResource::CurrentGradient ):
emit sigGradientChanged( static_cast<KisGradient *>( res.value<void *>() ) );
break;
case ( KoCanvasResource::CurrentPaintop ):
emit sigPaintopChanged(res.value<KoID >(), currentPaintopSettings());
break;
case ( KoCanvasResource::CurrentPaintopSettings ):
emit sigPaintopChanged(currentPaintop(), currentPaintopSettings() );
break;
default:
;
// Do nothing
};
}
#include "kis_resource_provider.moc"
......@@ -84,6 +84,10 @@ public slots:
void slotPaintopActivated(const KoID & paintop, const KisPaintOpSettings *paintopSettings);
void slotLayerActivated( const KisLayerSP layer );
private slots:
void slotResourceChanged( KoCanvasResource::EnumCanvasResource key, const QVariant & res );
signals:
void sigFGColorChanged(const KoColor &);
......
......@@ -104,8 +104,6 @@ KisSelectionManager::~KisSelectionManager()
void KisSelectionManager::setup(KActionCollection * collection)
{
kDebug() << "Setup actions\n";
// XXX: setup shortcuts!
m_cut = KStdAction::cut(this,
......@@ -247,7 +245,6 @@ void KisSelectionManager::setup(KActionCollection * collection)
QClipboard *cb = QApplication::clipboard();
connect(cb, SIGNAL(dataChanged()), SLOT(clipboardDataChanged()));
kdDebug() << "end setup actions\n";
}
void KisSelectionManager::clipboardDataChanged()
......@@ -264,7 +261,6 @@ void KisSelectionManager::addSelectionAction(KAction * action)
void KisSelectionManager::updateGUI()
{
kDebug() << "###########################3 In updateGUI\n";
Q_ASSERT(m_parent);
Q_ASSERT(m_clipboard);
......@@ -321,7 +317,6 @@ void KisSelectionManager::updateGUI()
// m_save->setEnabled(enable);
kDebug() << "plugin actions: " << m_pluginActions.count() << endl;
if ( !m_pluginActions.isEmpty() ) {
QListIterator<KAction*> i( m_pluginActions );
......@@ -344,7 +339,6 @@ void KisSelectionManager::updateGUI()
updateStatusBar();
kDebug() << "#############################33 End update gui\n";
}
void KisSelectionManager::updateStatusBar()
......
......@@ -34,7 +34,6 @@
#include <KoCanvasController.h>
#include <KoZoomAction.h>
#include <KoZoomHandler.h>
#include <KoToolRegistry.h>
#include <KoShapeManager.h>
#include <KoShape.h>
#include <KoRuler.h>
......@@ -53,6 +52,7 @@
#include "kis_resource_provider.h"
#include "kis_resource_provider.h"
#include "kis_selection_manager.h"
#include "kis_controlframe.h"
class KisView2::KisView2Private {
......@@ -101,7 +101,7 @@ public:
KAction *actualSize;
KAction *fitToCanvas;
KisSelectionManager *selectionManager;
KisControlFrame * controlFrame;
};
......@@ -242,7 +242,7 @@ void KisView2::createGUI()
//m_geometryDocker = qobject_cast<KivioShapeGeometry*>(createDockWidget(&geometryFactory));
m_d->statusBar = new KisStatusBar( KoView::statusBar() );
m_d->controlFrame = new KisControlFrame( mainWindow(), this );
show();
}
......
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