Subversion Repositories Scribus

Rev

Rev 15060 | Rev 20185 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11919 fschmid 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
*   Copyright (C) 2008 by Franz Schmid                                    *
9
*   franz.schmid@altmuehlnet.de                                           *
10
*                                                                         *
11
*   This program is free software; you can redistribute it and/or modify  *
12
*   it under the terms of the GNU General Public License as published by  *
13
*   the Free Software Foundation; either version 2 of the License, or     *
14
*   (at your option) any later version.                                   *
15
*                                                                         *
16
*   This program is distributed in the hope that it will be useful,       *
17
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19
*   GNU General Public License for more details.                          *
20
*                                                                         *
21
*   You should have received a copy of the GNU General Public License     *
22
*   along with this program; if not, write to the                         *
23
*   Free Software Foundation, Inc.,                                       *
18122 mrdocs 24
*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
11919 fschmid 25
***************************************************************************/
26
 
27
#include "selectobjects.h"
28
#include "commonstrings.h"
29
#include "util_icon.h"
30
 
31
selectDialog::selectDialog(QWidget* parent, ColorList &availableColors, int unitIndex) : QDialog(parent)
32
{
33
        setupUi(this);
34
        setModal(true);
35
        setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
36
        backgroundCombo->addItem(CommonStrings::tr_NoneColor);
37
        backgroundCombo->insertItems(availableColors, ColorCombo::fancyPixmaps);
38
        lineCombo->addItem(CommonStrings::tr_NoneColor);
39
        lineCombo->insertItems(availableColors, ColorCombo::fancyPixmaps);
40
        lineWidthSpin->setNewUnit(unitIndex);
41
        lineWidthSpin->setMinimum(0);
42
        lineWidthSpin->setMaximum(1000);
43
}
44
 
45
int selectDialog::getSelectionRange()
46
{
47
        int retval = 0;
48
        if (buttonCurrentPage->isChecked())
49
                retval = 0;
50
        else if (buttonCurrentLayer->isChecked())
51
                retval = 1;
52
        else if (buttonWorkspace->isChecked())
53
                retval = 2;
54
        return retval;
55
}
56
 
57
bool selectDialog::useAttributes()
58
{
59
        return attributeGroup->isChecked();
60
}
61
 
62
void selectDialog::getUsedAttributes(bool &Type, bool &Fill, bool &Line, bool &LWidth, bool &Print, bool &Locked, bool &Resize)
63
{
64
        Type = useItemType->isChecked();
65
        Fill = useFillColor->isChecked();
66
        Line = useLineColor->isChecked();
67
        LWidth = useLineWidth->isChecked();
68
        Print = usePrintState->isChecked();
69
        Locked = useLockedState->isChecked();
70
        Resize = useResizeState->isChecked();
71
}
72
 
73
void selectDialog::getUsedAttributesValues(int &Type, QString &Fill, QString &Line, double &LWidth, bool &Print, bool &Locked, bool &Resize)
74
{
75
        if (useItemType->isChecked())
76
        {
77
                Type = itemTypeCombo->currentIndex();
78
                if (Type == 0)
79
                        Type = 4;
80
                else if (Type == 1)
81
                        Type = 2;
82
                else if (Type == 2)
83
                        Type = 6;
84
                else if (Type == 3)
85
                        Type = 7;
86
                else if (Type == 4)
87
                        Type = 5;
88
                else if (Type == 5)
89
                        Type = 8;
90
                else if (Type == 6)
91
                        Type = 9;
15060 fschmid 92
                else if (Type == 7)
93
                        Type = 11;
11919 fschmid 94
        }
95
        if (useFillColor->isChecked())
96
        {
97
                Fill = backgroundCombo->currentText();
98
                if (Fill == CommonStrings::tr_NoneColor)
99
                        Fill = CommonStrings::None;
100
        }
101
        if (useLineColor->isChecked())
102
        {
103
                Line = lineCombo->currentText();
104
                if (Line == CommonStrings::tr_NoneColor)
105
                        Line = CommonStrings::None;
106
        }
107
        if (useLineWidth->isChecked())
108
                LWidth = lineWidthSpin->value();
109
        if (usePrintState->isChecked())
110
        {
111
                if (printStateCombo->currentIndex() == 0)
112
                        Print = true;
113
                else
114
                        Print = false;
115
        }
116
        if (useLockedState->isChecked())
117
        {
118
                if (lockStateCombo->currentIndex() == 0)
119
                        Locked = true;
120
                else
121
                        Locked = false;
122
        }
123
        if (useResizeState->isChecked())
124
        {
125
                if (resizeStateCombo->currentIndex() == 0)
126
                        Resize = false;
127
                else
128
                        Resize = true;
129
        }
130
}