Back to index

scribus-ng  1.3.4.dfsg+svn20071115
werktoolb.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                           texttoolb.cpp  -  description
00009                              -------------------
00010     begin                : Sun Mar 10 2002
00011     copyright            : (C) 2002 by Franz Schmid
00012     email                : Franz.Schmid@altmuehlnet.de
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #include <qtooltip.h>
00025 #include <qpopupmenu.h>
00026 #include <qpixmap.h>
00027 
00028 #include "werktoolb.h"
00029 #include "werktoolb.moc"
00030 
00031 #include "autoformbuttongroup.h"
00032 #include "menumanager.h"
00033 #include "polyprops.h"
00034 #include "scraction.h"
00035 #include "scribus.h"
00036 #include "scribusdoc.h"
00037 
00038 extern QPixmap loadIcon(QString nam);
00039 
00040 
00041 ModeToolBar::ModeToolBar(ScribusMainWindow* parent) : ScToolBar( tr("Tools"), "Tools", parent, QDockWindow::Vertical)
00042 {
00043        SubMode = 0;
00044        ValCount = 32;
00045        static double AutoShapes0[] = {0.0, 0.0, 0.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0,
00046                                                                100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 0.0, 100.0, 0.0, 100.0,
00047                                                                0.0, 100.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0};
00048        ShapeVals = AutoShapes0;
00049        m_ScMW=parent;
00050        m_ScMW->scrActions["toolsSelect"]->addTo(this);
00051        m_ScMW->scrActions["toolsInsertTextFrame"]->addTo(this);
00052        m_ScMW->scrActions["toolsInsertImageFrame"]->addTo(this);
00053        m_ScMW->scrActions["toolsInsertTableFrame"]->addTo(this);
00054        
00055        m_ScMW->scrActions["toolsInsertShape"]->addTo(this);
00056        m_ScMW->scrMenuMgr->createMenu("insertShapeButtonMenu", "insertShapeButtonMenu");
00057        insertShapeButtonMenu=m_ScMW->scrMenuMgr->getLocalPopupMenu("insertShapeButtonMenu");
00058        m_ScMW->scrMenuMgr->addMenuToWidgetOfAction("insertShapeButtonMenu", m_ScMW->scrActions["toolsInsertShape"]);
00059        
00060        QToolButton *insertShapeButton = dynamic_cast<QToolButton*>(m_ScMW->scrActions["toolsInsertShape"]->getWidgetAddedTo());
00061        if (insertShapeButton)
00062               insertShapeButton->setPopupDelay(0);
00063        Rechteck = new AutoformButtonGroup( NULL );
00064        insertShapeButtonMenu->insertItem( Rechteck );
00065        //QImage newShapeIcon = Rechteck->getIconPixmap(0).convertToImage();
00066        //newShapeIcon.smoothScale(16,16);
00067        m_ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(Rechteck->getIconPixmap(0,16),Rechteck->getIconPixmap(0)));
00068 
00069        m_ScMW->scrActions["toolsInsertPolygon"]->addTo(this);
00070        m_ScMW->scrMenuMgr->createMenu("insertPolygonButtonMenu", "insertPolygonButtonMenu");
00071        insertPolygonButtonMenu=m_ScMW->scrMenuMgr->getLocalPopupMenu("insertPolygonButtonMenu");
00072        m_ScMW->scrMenuMgr->addMenuToWidgetOfAction("insertPolygonButtonMenu", m_ScMW->scrActions["toolsInsertPolygon"]);
00073        idInsertPolygonButtonMenu=insertPolygonButtonMenu->insertItem( "Properties...", this, SLOT(GetPolyProps()));
00074        
00075        QToolButton *insertPolygonButton = dynamic_cast<QToolButton*>(m_ScMW->scrActions["toolsInsertPolygon"]->getWidgetAddedTo());
00076        if (insertPolygonButton)
00077               insertPolygonButton->setPopupDelay(0);
00078        
00079        m_ScMW->scrActions["toolsInsertLine"]->addTo(this);
00080        m_ScMW->scrActions["toolsInsertBezier"]->addTo(this);
00081        m_ScMW->scrActions["toolsInsertFreehandLine"]->addTo(this);
00082        m_ScMW->scrActions["toolsRotate"]->addTo(this);
00083        m_ScMW->scrActions["toolsZoom"]->addTo(this);
00084        m_ScMW->scrActions["toolsEditContents"]->addTo(this);
00085        m_ScMW->scrActions["toolsEditWithStoryEditor"]->addTo(this);
00086        m_ScMW->scrActions["toolsLinkTextFrame"]->addTo(this);
00087        m_ScMW->scrActions["toolsUnlinkTextFrame"]->addTo(this);
00088        m_ScMW->scrActions["toolsMeasurements"]->addTo(this);
00089        m_ScMW->scrActions["toolsCopyProperties"]->addTo(this);
00090        m_ScMW->scrActions["toolsEyeDropper"]->addTo(this);
00091 
00092        languageChange();
00093        connect(Rechteck, SIGNAL(FormSel(int, int, double *)), this, SLOT(SelShape(int, int, double *)));
00094 }
00095 
00096 void ModeToolBar::GetPolyProps()
00097 {
00098        PolygonProps* dia = new PolygonProps(this, m_ScMW->doc->toolSettings.polyC, m_ScMW->doc->toolSettings.polyFd, m_ScMW->doc->toolSettings.polyF, m_ScMW->doc->toolSettings.polyS, m_ScMW->doc->toolSettings.polyR);
00099        if (dia->exec())
00100               dia->getValues(&m_ScMW->doc->toolSettings.polyC, &m_ScMW->doc->toolSettings.polyFd, &m_ScMW->doc->toolSettings.polyF, &m_ScMW->doc->toolSettings.polyS, &m_ScMW->doc->toolSettings.polyR);
00101        delete dia;
00102 }
00103 
00104 void ModeToolBar::SelShape(int s, int c, double *vals)
00105 {
00106        //const QPixmap* newIcon = Rechteck->find(s)->pixmap();
00107        //QImage newShapeIcon = Rechteck->find(s)->pixmap()->convertToImage();
00108        //newShapeIcon.smoothScale(16,16);
00109        //m_ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(newShapeIcon, *newIcon));
00110        m_ScMW->scrActions["toolsInsertShape"]->setIconSet(QIconSet(Rechteck->getIconPixmap(s,16),Rechteck->getIconPixmap(s)));
00111        insertShapeButtonMenu->hide();
00112        SubMode = s;
00113        ValCount = c;
00114        ShapeVals = vals;
00115        m_ScMW->scrActions["toolsInsertShape"]->setOn(false);
00116        m_ScMW->scrActions["toolsInsertShape"]->setOn(true);
00117 }
00118 
00119 void ModeToolBar::languageChange()
00120 {
00121        insertPolygonButtonMenu->changeItem(idInsertPolygonButtonMenu, tr("Properties..."));
00122        ScToolBar::languageChange();
00123 }
00124 
00125 
00126 PDFToolBar::PDFToolBar(ScribusMainWindow* parent) : ScToolBar( tr("PDF Tools"), "PDF_Tools", parent)
00127 {
00128        parent->scrActions["toolsPDFPushButton"]->addTo(this);
00129        parent->scrActions["toolsPDFTextField"]->addTo(this);
00130        parent->scrActions["toolsPDFCheckBox"]->addTo(this);
00131        parent->scrActions["toolsPDFComboBox"]->addTo(this);
00132        parent->scrActions["toolsPDFListBox"]->addTo(this);
00133        parent->scrActions["toolsPDFAnnotText"]->addTo(this);
00134        parent->scrActions["toolsPDFAnnotLink"]->addTo(this);
00135 }