~ubuntu-branches/ubuntu/maverick/scribus-ng/maverick-backports

« back to all changes in this revision

Viewing changes to scribus/margindialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2007-08-11 17:41:51 UTC
  • mfrom: (0.1.1 upstream) (4.1.2 feisty)
  • Revision ID: james.westby@ubuntu.com-20070811174151-tmkgjvjuc0mtk8ul
Tags: 1.3.4.dfsg+svn20071115-1
* Upstream svn update (Closes: #447480, #448949).
* debian/NEWS: Added a note for users wanting stable Scribus to switch to
  the "scribus" package (Closes: #427638).
* debian/watch: Updated the watch regex to properly track sourceforge
  releases for this branch (Closes: #449700).

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        dsGroupBox7Layout->setMargin( 10 );
44
44
        TextLabel1 = new QLabel( tr( "&Size:" ), dsGroupBox7, "TextLabel1" );
45
45
        dsGroupBox7Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
46
 
        PageSize *ps=new PageSize(doc->currentPage->PageSize);
 
46
        PageSize *ps=new PageSize(doc->currentPage()->m_pageSize);
47
47
        sizeQComboBox = new QComboBox( true, dsGroupBox7, "ComboBox1" );
48
48
        sizeQComboBox->setEditable(false);
49
 
        QStringList pageSizes=ps->getPageSizeList();
50
 
        sizeQComboBox->insertStringList(ps->getTrPageSizeList());
51
 
        sizeQComboBox->insertItem( tr( "Custom" ) );
52
 
        prefsPageSizeName=ps->getPageName();
53
 
        int sizeIndex = pageSizes.findIndex(ps->getPageText());
 
49
        QStringList pageSizes=ps->sizeList();
 
50
        sizeQComboBox->insertStringList(ps->sizeTRList());
 
51
        sizeQComboBox->insertItem( CommonStrings::trCustomPageSize );
 
52
        prefsPageSizeName=ps->name();
 
53
        int sizeIndex = pageSizes.findIndex(ps->nameTR());
54
54
        if (sizeIndex != -1)
55
55
                sizeQComboBox->setCurrentItem(sizeIndex);
56
56
        else
63
63
        orientationQComboBox->insertItem( tr( "Portrait" ) );
64
64
        orientationQComboBox->insertItem( tr( "Landscape" ) );
65
65
        orientationQComboBox->setEditable(false);
66
 
        orientationQComboBox->setCurrentItem(doc->currentPage->PageOri );
67
 
        oldOri = doc->currentPage->PageOri;
 
66
        orientationQComboBox->setCurrentItem(doc->currentPage()->PageOri );
 
67
        oldOri = doc->currentPage()->PageOri;
68
68
        TextLabel2->setBuddy(orientationQComboBox);
69
69
        dsGroupBox7Layout->addMultiCellWidget( orientationQComboBox, 1, 1, 2, 3 );
70
70
        widthMSpinBox = new MSpinBox( 1, 100000, dsGroupBox7, unitGetDecimalsFromIndex(doc->unitIndex()) );
71
71
        widthQLabel = new QLabel( tr( "&Width:" ), dsGroupBox7, "widthLabel" );
72
72
        widthMSpinBox->setSuffix(unitGetSuffixFromIndex(doc->unitIndex()));
73
 
        widthMSpinBox->setValue(doc->currentPage->width() * doc->unitRatio());
 
73
        widthMSpinBox->setValue(doc->currentPage()->width() * doc->unitRatio());
74
74
        widthQLabel->setBuddy(widthMSpinBox);
75
75
        dsGroupBox7Layout->addWidget( widthQLabel, 2, 0 );
76
76
        dsGroupBox7Layout->addWidget( widthMSpinBox, 2, 1 );
77
77
        heightMSpinBox = new MSpinBox( 1, 100000, dsGroupBox7, unitGetDecimalsFromIndex(doc->unitIndex()) );
78
78
        heightMSpinBox->setSuffix(unitGetSuffixFromIndex(doc->unitIndex()));
79
 
        heightMSpinBox->setValue(doc->currentPage->height() * doc->unitRatio());
 
79
        heightMSpinBox->setValue(doc->currentPage()->height() * doc->unitRatio());
80
80
        heightQLabel = new QLabel(heightMSpinBox,  tr( "&Height:" ), dsGroupBox7, "heightLabel" );
81
81
        dsGroupBox7Layout->addWidget( heightQLabel, 2, 2 );
82
82
        dsGroupBox7Layout->addWidget( heightMSpinBox, 2, 3 );
98
98
                }
99
99
                Links->setEditable(false);
100
100
                dsGroupBox7Layout->addMultiCellWidget( Links, 4, 4, 2, 3 );
101
 
                if (doc->currentPage->LeftPg == 0)
 
101
                if (doc->currentPage()->LeftPg == 0)
102
102
                        Links->setCurrentItem(Links->count()-1);
103
 
                else if (doc->currentPage->LeftPg == 1)
 
103
                else if (doc->currentPage()->LeftPg == 1)
104
104
                        Links->setCurrentItem(0);
105
105
                else
106
 
                        Links->setCurrentItem(doc->currentPage->LeftPg-1);
 
106
                        Links->setCurrentItem(doc->currentPage()->LeftPg-1);
107
107
        }
108
108
        dialogLayout->addWidget( dsGroupBox7 );
109
109
        
110
 
        //GroupRand = new MarginWidget(this,  tr( "Margin Guides" ), &doc->currentPage->initialMargins, doc->unitIndex());
111
 
        GroupRand = new MarginWidget(this,  tr( "Margin Guides" ), &doc->currentPage->Margins, doc->unitIndex());
112
 
        GroupRand->setPageWidthHeight(doc->currentPage->width(), doc->currentPage->height());
113
 
        GroupRand->setFacingPages(!(doc->currentPageLayout == singlePage));
 
110
        GroupRand = new MarginWidget(this,  tr( "Margin Guides" ), &doc->currentPage()->initialMargins, doc->unitIndex(), false, false);
 
111
        GroupRand->setPageWidthHeight(doc->currentPage()->width(), doc->currentPage()->height());
 
112
        GroupRand->setFacingPages(!(doc->currentPageLayout == singlePage), doc->locationOfPage(doc->currentPage()->pageNr()));
114
113
        dialogLayout->addWidget( GroupRand );
115
114
 
 
115
        groupMaster = new QGroupBox( this, "groupMaster" );
 
116
        groupMaster->setTitle( tr( "Other Settings" ) );
 
117
        groupMaster->setColumnLayout(0, Qt::Vertical );
 
118
        groupMaster->layout()->setSpacing( 0 );
 
119
        groupMaster->layout()->setMargin( 0 );
 
120
        masterLayout = new QHBoxLayout( groupMaster->layout() );
 
121
        masterLayout->setAlignment( Qt::AlignTop );
 
122
        masterLayout->setSpacing( 5 );
 
123
        masterLayout->setMargin( 10 );
 
124
        masterPageLabel = new QLabel( groupMaster, "masterPageLabel" );
 
125
        masterPageLabel->setText( tr( "Master Page:" ) );
 
126
        masterLayout->addWidget( masterPageLabel );
 
127
        masterPageComboBox = new QComboBox( false, groupMaster, "masterPageComboBox" );
 
128
        QString Nam = doc->currentPage()->MPageNam;
 
129
        QString na = Nam == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : Nam, in;
 
130
        int cc = 0;
 
131
        for (QMap<QString,int>::Iterator it = doc->MasterNames.begin(); it != doc->MasterNames.end(); ++it)
 
132
        {
 
133
                in = it.key() == CommonStrings::masterPageNormal ? CommonStrings::trMasterPageNormal : it.key();
 
134
                masterPageComboBox->insertItem(in);
 
135
                if (in == na)
 
136
                        masterPageComboBox->setCurrentItem(cc);
 
137
                ++cc;
 
138
        }
 
139
        masterLayout->addWidget( masterPageComboBox );
 
140
        dialogLayout->addWidget( groupMaster );
 
141
        if (doc->masterPageMode())
 
142
                groupMaster->hide();
 
143
 
116
144
        okCancelLayout = new QHBoxLayout;
117
145
        okCancelLayout->setSpacing( 6 );
118
146
        okCancelLayout->setMargin( 0 );
128
156
        setMaximumSize(sizeHint());
129
157
        pageWidth = widthMSpinBox->value() / unitRatio;
130
158
        pageHeight = heightMSpinBox->value() / unitRatio;
131
 
        if (sizeQComboBox->currentText() == tr("Custom"))
 
159
        if (sizeQComboBox->currentText() == CommonStrings::trCustomPageSize)
132
160
        {
133
161
                heightMSpinBox->setEnabled( true );
134
162
                widthMSpinBox->setEnabled( true );
146
174
        connect(sizeQComboBox, SIGNAL(activated(const QString &)), this, SLOT(setPageSize()));
147
175
        connect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
148
176
        connect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
 
177
        
 
178
        setPageSize();
149
179
        setMinimumSize(minimumSizeHint());
150
180
        setMaximumSize(minimumSizeHint());
151
181
        resize(minimumSizeHint());
165
195
 
166
196
void MarginDialog::setPageSize()
167
197
{
 
198
        if (sizeQComboBox->currentText() != CommonStrings::trCustomPageSize)
 
199
                oldOri++;
168
200
        setOrien(orientationQComboBox->currentItem());
169
201
}
170
202
 
175
207
        widthMSpinBox->setEnabled(false);
176
208
        heightMSpinBox->setEnabled(false);
177
209
        PageSize *ps2 = new PageSize(gr);
178
 
        prefsPageSizeName = ps2->getPageName();
179
 
        if (gr == tr("Custom"))
 
210
        prefsPageSizeName = ps2->name();
 
211
        if (gr == CommonStrings::trCustomPageSize)
180
212
        {
181
213
                widthMSpinBox->setEnabled(true);
182
214
                heightMSpinBox->setEnabled(true);
 
215
                prefsPageSizeName = CommonStrings::customPageSize;
183
216
        }
184
217
        else
185
218
        {
186
 
                pageWidth = ps2->getPageWidth();
187
 
                pageHeight = ps2->getPageHeight();
 
219
                pageWidth = ps2->width();
 
220
                pageHeight = ps2->height();
188
221
        }
189
222
        disconnect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
190
223
        disconnect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
192
225
        heightMSpinBox->setValue(pageHeight * unitRatio);
193
226
        GroupRand->setPageHeight(pageHeight);
194
227
        GroupRand->setPageWidth(pageWidth);
 
228
        GroupRand->setPageSize(gr);
195
229
        connect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
196
230
        connect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
197
231
        delete ps2;
203
237
        setSize(sizeQComboBox->currentText());
204
238
        disconnect(widthMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
205
239
        disconnect(heightMSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
206
 
        if ((sizeQComboBox->currentText() == tr("Custom")) && (ori != oldOri))
 
240
        if ((sizeQComboBox->currentText() == CommonStrings::trCustomPageSize) && (ori != oldOri))
207
241
        {
208
242
                br = widthMSpinBox->value();
209
243
                widthMSpinBox->setValue(heightMSpinBox->value());
211
245
        }
212
246
        else
213
247
        {
214
 
                if (ori != 0)
 
248
                if ((ori != 0) && (ori != oldOri))
215
249
                {
216
250
                        br = widthMSpinBox->value();
217
251
                        widthMSpinBox->setValue(heightMSpinBox->value());
283
317
{
284
318
        return GroupRand->right();
285
319
}
 
320
 
 
321
QString MarginDialog::masterPage()
 
322
{
 
323
        return masterPageComboBox->currentText();
 
324
}