Subversion Repositories Scribus

Rev

Rev 16831 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
16546 jghali 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
*/
7
 
8
#include "propertywidget_pathtext.h"
9
 
10
#include "scribusdoc.h"
11
#include "units.h"
12
#include "util_icon.h"
13
 
14
PropertyWidget_PathText::PropertyWidget_PathText(QWidget* parent) : QFrame(parent)
15
{
16
        setupUi(this);
17
 
18
        setFrameStyle(QFrame::Box | QFrame::Plain);
19
        setLineWidth(1);
20
        layout()->setAlignment( Qt::AlignTop );
21
 
22
        startOffset->setValues(0, 30000, 2, 0);
23
        startOffset->setSingleStep(10);
24
 
25
        distFromCurve->setValues(-300, 300, 2, 0);
26
        distFromCurve->setSingleStep(10);
27
 
28
        languageChange();
29
}
30
 
31
void PropertyWidget_PathText::setDoc(ScribusDoc *d)
32
{
33
        if(d == (ScribusDoc*) m_doc)
34
                return;
35
 
36
        m_doc  = d;
37
 
38
        if (m_doc.isNull())
39
                return;
40
 
41
        m_unitRatio   = m_doc->unitRatio();
42
        m_unitIndex   = m_doc->unitIndex();
43
 
44
        startOffset->setMaximum( 30000 );
45
        startOffset->setMinimum( 0 );
46
        startOffset->setSingleStep(10);
47
        distFromCurve->setMaximum( 300 );
48
        distFromCurve->setMinimum( -300 );
49
        distFromCurve->setSingleStep(10);
50
}
51
 
52
void PropertyWidget_PathText::changeEvent(QEvent *e)
53
{
54
        if (e->type() == QEvent::LanguageChange)
55
        {
56
                languageChange();
57
                return;
58
        }
59
        QWidget::changeEvent(e);
60
}
61
 
62
void PropertyWidget_PathText::unitChange()
63
{
64
        if (!m_doc)
65
                return;
66
 
67
        double oldRatio = m_unitRatio;
68
        m_unitRatio = m_doc->unitRatio();
69
        m_unitIndex = m_doc->unitIndex();
70
 
71
        startOffset->setNewUnit( m_unitIndex );
72
        distFromCurve->setNewUnit( m_unitIndex );
73
}
74
 
75
void PropertyWidget_PathText::languageChange()
76
{
77
        int oldPathType = pathTextType->currentIndex();
78
        pathTextType->clear();
79
        pathTextType->addItem( tr("Default"));
80
        pathTextType->addItem( tr("Stair Step"));
81
        pathTextType->addItem( tr("Skew"));
82
        pathTextType->setCurrentIndex(oldPathType);
83
 
84
        flippedPathText->setText( tr("Flip Text"));
85
        showCurveCheckBox->setText( tr("Show Curve"));
86
        pathTextTypeLabel->setText( tr("Type:"));
87
        startOffsetLabel->setText( tr("Start Offset:"));
88
        distFromCurveLabel->setText( tr("Distance from Curve:"));
89
 
90
        QString ptSuffix = tr(" pt");
91
        startOffset->setSuffix(ptSuffix);
92
        distFromCurve->setSuffix(ptSuffix);
93
}