Back to index

scribus-ng  1.3.4.dfsg+svn20071115
colorwheel.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 
00008 #include "colorwheel.h"
00009 #include "colorwheel.moc"
00010 #include "cwdialog.h"
00011 #include <qcursor.h>
00012 #include <qlistview.h>
00013 #include "scribuscore.h"
00014 
00015 int colorwheel_getPluginAPIVersion()
00016 {
00017        return PLUGIN_API_VERSION;
00018 }
00019 
00020 ScPlugin* colorwheel_getPlugin()
00021 {
00022        ColorWheelPlugin* plug = new ColorWheelPlugin();
00023        Q_CHECK_PTR(plug);
00024        return plug;
00025 }
00026 
00027 void colorwheel_freePlugin(ScPlugin* plugin)
00028 {
00029        ColorWheelPlugin* plug = dynamic_cast<ColorWheelPlugin*>(plugin);
00030        Q_ASSERT(plug);
00031        delete plug;
00032 }
00033 
00034 ColorWheelPlugin::ColorWheelPlugin() : ScActionPlugin()
00035 {
00036        // Set action info in languageChange, so we only have to do
00037        // it in one place.
00038        languageChange();
00039 }
00040 
00041 ColorWheelPlugin::~ColorWheelPlugin() {};
00042 
00043 void ColorWheelPlugin::languageChange()
00044 {
00045        // Note that we leave the unused members unset. They'll be initialised
00046        // with their default ctors during construction.
00047        // Action name
00048        m_actionInfo.name = "ColorWheel";
00049        // Action text for menu, including accel
00050        m_actionInfo.text = tr("&Color Wheel...");
00051        // Menu
00052        m_actionInfo.menu = "Extras";
00053        m_actionInfo.enabledOnStartup = true;
00054 }
00055 
00056 const QString ColorWheelPlugin::fullTrName() const
00057 {
00058        return QObject::tr("Color Wheel");
00059 }
00060 
00061 const ScActionPlugin::AboutData* ColorWheelPlugin::getAboutData() const
00062 {
00063        AboutData* about = new AboutData;
00064        Q_CHECK_PTR(about);
00065        about->authors = QString::fromUtf8("Petr Van\xc4\x9bk <petr@scribus.info>");
00066        about->shortDescription = tr("Color setting helper");
00067        about->description = tr("Color selector with color theory included.");
00068        // about->version
00069        // about->releaseDate
00070        // about->copyright
00071        about->license = "GPL";
00072        return about;
00073 }
00074 
00075 void ColorWheelPlugin::deleteAboutData(const AboutData* about) const
00076 {
00077        Q_ASSERT(about);
00078        delete about;
00079 }
00080 
00082 bool ColorWheelPlugin::run(ScribusDoc* doc, QString target)
00083 {
00084        Q_ASSERT(target.isNull());
00085        ScribusDoc* currDoc=doc;
00086        if (currDoc==0)
00087               currDoc=ScCore->primaryMainWindow()->doc;
00088        CWDialog *dlg = new CWDialog(currDoc->scMW(), currDoc, "dlg", true, 0);
00089        if (dlg)
00090        {
00091               dlg->exec();
00092               delete dlg;
00093               return true;
00094        }
00095        else
00096               return false;
00097 }