Subversion Repositories Scribus

Rev

Rev 17301 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
3 paul 7
/***************************************************************************
8
                          texttoolb.cpp  -  description
9
                             -------------------
10
    begin                : Sun Mar 10 2002
11
    copyright            : (C) 2002 by Franz Schmid
12
    email                : Franz.Schmid@altmuehlnet.de
13
 ***************************************************************************/
14
 
15
/***************************************************************************
16
 *                                                                         *
17
 *   This program is free software; you can redistribute it and/or modify  *
18
 *   it under the terms of the GNU General Public License as published by  *
19
 *   the Free Software Foundation; either version 2 of the License, or     *
20
 *   (at your option) any later version.                                   *
21
 *                                                                         *
22
 ***************************************************************************/
23
 
9800 cbradney 24
#include <QToolTip>
10859 cbradney 25
#include <QEvent>
9768 cbradney 26
#include <QMenu>
9800 cbradney 27
#include <QPixmap>
3699 cbradney 28
 
10863 cbradney 29
#include "modetoolbar.h"
3699 cbradney 30
 
1770 cbradney 31
#include "autoformbuttongroup.h"
32
#include "menumanager.h"
3699 cbradney 33
#include "polyprops.h"
3251 craig 34
#include "scraction.h"
3699 cbradney 35
#include "scribus.h"
36
#include "scribusdoc.h"
10200 cbradney 37
#include "util.h"
3 paul 38
 
8501 cbradney 39
ModeToolBar::ModeToolBar(ScribusMainWindow* parent) : ScToolBar( tr("Tools"), "Tools", parent, Qt::Vertical)
3 paul 40
{
123 Franz 41
        SubMode = 0;
42
        ValCount = 32;
17301 craig 43
        static qreal 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,
167 Franz 44
                                                                        100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 0.0, 100.0, 0.0, 100.0,
45
                                                                        0.0, 100.0, 0.0, 100.0, 0.0, 0.0, 0.0, 0.0};
123 Franz 46
        ShapeVals = AutoShapes0;
5781 cbradney 47
        m_ScMW=parent;
9800 cbradney 48
        this->addAction(m_ScMW->scrActions["toolsSelect"]);
49
        this->addAction(m_ScMW->scrActions["toolsInsertTextFrame"]);
50
        this->addAction(m_ScMW->scrActions["toolsInsertImageFrame"]);
12616 cbradney 51
        this->addAction(m_ScMW->scrActions["toolsInsertRenderFrame"]);
9800 cbradney 52
        this->addAction(m_ScMW->scrActions["toolsInsertTableFrame"]);
1770 cbradney 53
 
9800 cbradney 54
        this->addAction(m_ScMW->scrActions["toolsInsertShape"]);
12024 fschmid 55
//      insertShapeButtonMenu = new QMenu();
1770 cbradney 56
        Rechteck = new AutoformButtonGroup( NULL );
12024 fschmid 57
//      insertShapeButtonAct = new QWidgetAction( this );
58
//      insertShapeButtonAct->setDefaultWidget(Rechteck);
59
//      insertShapeButtonMenu->addAction(insertShapeButtonAct);
60
//      m_ScMW->scrActions["toolsInsertShape"]->setMenu(insertShapeButtonMenu);
61
        m_ScMW->scrActions["toolsInsertShape"]->setMenu(Rechteck);
10653 fschmid 62
        QToolButton* tb = dynamic_cast<QToolButton*>(this->widgetForAction(m_ScMW->scrActions["toolsInsertShape"]));
63
        tb->setPopupMode(QToolButton::MenuButtonPopup);
8643 cbradney 64
        m_ScMW->scrActions["toolsInsertShape"]->setIcon(QIcon(Rechteck->getIconPixmap(0,16)));
1770 cbradney 65
 
9800 cbradney 66
        this->addAction(m_ScMW->scrActions["toolsInsertPolygon"]);
9842 fschmid 67
        insertPolygonButtonMenu = new QMenu();
10592 fschmid 68
        idInsertPolygonButtonMenu = insertPolygonButtonMenu->addAction( "Properties...", this, SLOT(GetPolyProps()));
9842 fschmid 69
        m_ScMW->scrActions["toolsInsertPolygon"]->setMenu(insertPolygonButtonMenu);
10653 fschmid 70
        QToolButton* tb2 = dynamic_cast<QToolButton*>(this->widgetForAction(m_ScMW->scrActions["toolsInsertPolygon"]));
71
        tb2->setPopupMode(QToolButton::MenuButtonPopup);
9800 cbradney 72
 
73
        this->addAction(m_ScMW->scrActions["toolsInsertLine"]);
74
        this->addAction(m_ScMW->scrActions["toolsInsertBezier"]);
75
        this->addAction(m_ScMW->scrActions["toolsInsertFreehandLine"]);
76
        this->addAction(m_ScMW->scrActions["toolsRotate"]);
77
        this->addAction(m_ScMW->scrActions["toolsZoom"]);
78
        this->addAction(m_ScMW->scrActions["toolsEditContents"]);
79
        this->addAction(m_ScMW->scrActions["toolsEditWithStoryEditor"]);
80
        this->addAction(m_ScMW->scrActions["toolsLinkTextFrame"]);
81
        this->addAction(m_ScMW->scrActions["toolsUnlinkTextFrame"]);
82
        this->addAction(m_ScMW->scrActions["toolsMeasurements"]);
83
        this->addAction(m_ScMW->scrActions["toolsCopyProperties"]);
84
        this->addAction(m_ScMW->scrActions["toolsEyeDropper"]);
1770 cbradney 85
 
2227 cbradney 86
        languageChange();
13165 fschmid 87
        connect(Rechteck, SIGNAL(FormSel(int, int, qreal *)), this, SLOT(SelShape(int, int, qreal *)));
3 paul 88
}
89
 
5279 cbradney 90
void ModeToolBar::GetPolyProps()
3 paul 91
{
12885 fschmid 92
        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, m_ScMW->doc->toolSettings.polyCurvature);
167 Franz 93
        if (dia->exec())
17518 craig 94
        {
12885 fschmid 95
                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, &m_ScMW->doc->toolSettings.polyCurvature);
17518 craig 96
                m_ScMW->scrActions["toolsInsertPolygon"]->trigger();
97
        }
3 paul 98
        delete dia;
99
}
100
 
13165 fschmid 101
void ModeToolBar::SelShape(int s, int c, qreal *vals)
123 Franz 102
{
8643 cbradney 103
        m_ScMW->scrActions["toolsInsertShape"]->setIcon(QIcon(Rechteck->getIconPixmap(s,16)));
12024 fschmid 104
//      insertShapeButtonMenu->hide();
123 Franz 105
        SubMode = s;
106
        ValCount = c;
17301 craig 107
        ShapeVals = vals;
10430 cbradney 108
        m_ScMW->scrActions["toolsInsertShape"]->setChecked(false);
109
        m_ScMW->scrActions["toolsInsertShape"]->setChecked(true);
123 Franz 110
}
111
 
10859 cbradney 112
void ModeToolBar::changeEvent(QEvent *e)
113
{
114
        if (e->type() == QEvent::LanguageChange)
115
        {
116
                languageChange();
117
        }
10903 cbradney 118
        else
119
                QWidget::changeEvent(e);
10859 cbradney 120
}
121
 
5279 cbradney 122
void ModeToolBar::languageChange()
2227 cbradney 123
{
10592 fschmid 124
        idInsertPolygonButtonMenu->setText( tr("Properties..."));
4567 tsoots 125
        ScToolBar::languageChange();
2227 cbradney 126
}