~ubuntu-branches/debian/lenny/ipe/lenny

« back to all changes in this revision

Viewing changes to src/ipe/dialogs.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2007-01-09 23:14:51 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20070109231451-3nd095g7ishc108l
Tags: 6.0pre27-3
* debian/gsfonts-fontmap.xml: New.  Fontmap for fonts from gsfonts package.
* debian/rules: Use gsfonts-fontmap.xml instead of tetex-fontmap.xml.
* debian/control: Add texlive-latex-base dependency as alternative to
  tetex-bin (for pdflatex) and replace tetex-extra by gsfonts (for font
  files).  Patch courtesy of Norbert Preining.  Closes: #378537.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
/*
5
5
 
6
6
    This file is part of the extensible drawing editor Ipe.
7
 
    Copyright (C) 1993-2004  Otfried Cheong
 
7
    Copyright (C) 1993-2005  Otfried Cheong
8
8
 
9
9
    Ipe is free software; you can redistribute it and/or modify it
10
10
    under the terms of the GNU General Public License as published by
28
28
 
29
29
*/
30
30
 
31
 
#include "dialogs.h"
32
31
#include "ipeq.h"
33
32
#include "ipestyle.h"
34
33
#include "ipeprefs.h"
 
34
#include "dialogs.h"
35
35
 
36
 
#include <qcheckbox.h>
37
 
#include <qlineedit.h>
38
 
#include <qmultilineedit.h>
39
 
#include <qlabel.h>
40
 
#include <qwhatsthis.h>
41
 
#include <qspinbox.h>
42
 
#include <qgroupbox.h>
43
 
#include <qtoolbutton.h>
44
 
#include <qlistbox.h>
45
 
#include <qfiledialog.h>
46
 
#include <qcombobox.h>
47
 
#include <qfontdialog.h>
 
36
#include <QtGui>
48
37
 
49
38
// --------------------------------------------------------------------
50
39
 
55
44
//! The argument \c data is only updated if the dialog is accepted.
56
45
DialogDocumentProperties::DialogDocumentProperties
57
46
(QWidget* parent, IpeDocument::SProperties &data, const IpeStyleSheet *sheet)
58
 
  : DlgDocumentProperties(parent, "dlgdocumentproperties", true),
59
 
    iData(data), iSheet(sheet)
 
47
  : QDialog(parent), iData(data), iSheet(sheet)
60
48
{
 
49
  setupUi(this);
 
50
  connect(iButtonHelp, SIGNAL(clicked()), SLOT(ShowHelp()));
 
51
  connect(iMediaButton, SIGNAL(clicked()), SLOT(SetDefaultMedia()));
 
52
  connect(iButtonOk, SIGNAL(clicked()), SLOT(UpdateData()));
61
53
  iAuthorEditor->setText(QIpe(iData.iAuthor));
62
54
  iTitleEditor->setText(QIpe(iData.iTitle));
63
55
  iSubjectEditor->setText(QIpe(iData.iSubject));
64
56
  iKeywordsEditor->setText(QIpe(iData.iKeywords));
65
 
  iLatexPreambleEditor->setText(QIpe(iData.iPreamble));
 
57
  iLatexPreambleEditor->setPlainText(QIpe(iData.iPreamble));
66
58
  iFullScreenBox->setChecked(iData.iFullScreen);
 
59
  iNumberPages->setChecked(iData.iNumberPages);
67
60
  iCropBox->setChecked(iData.iCropBox);
68
61
  iCreated->setText(QIpe(iData.iCreated));
69
62
  iModified->setText(QIpe(iData.iModified));
73
66
  iSheet->AllNames(IpeAttribute::EMedia, seq);
74
67
  int curMedia = -1;
75
68
  for (uint i = 0; i < seq.size(); ++i) {
76
 
    iMedia->insertItem(QIpe(iSheet->Repository()->String(seq[i])));
 
69
    iMedia->addItem(QIpe(iSheet->Repository()->String(seq[i])));
77
70
    IpeAttribute abs = iSheet->Find(seq[i]);
78
71
    IpeVector media = iSheet->Repository()->ToVector(abs);
79
72
    if ((media - size).SqLen() < 1.0)
80
73
      curMedia = i;
81
74
  }
82
75
  if (curMedia >= 0) {
83
 
    iMedia->setCurrentItem(curMedia);
 
76
    iMedia->setCurrentIndex(curMedia);
84
77
    iCustomMedia = false;
85
78
  } else {
86
79
    // need custom media
87
 
    QString s = QString("Custom (%1 x %2)")
 
80
    QString s = QString(QLatin1String("Custom (%1 x %2)"))
88
81
      .arg(int(size.iX + 0.5)).arg(int(size.iY + 0.5));
89
 
    iMedia->insertItem(s, 0);
90
 
    iMedia->setCurrentItem(0);
 
82
    iMedia->addItem(s, 0);
 
83
    iMedia->setCurrentIndex(0);
91
84
    iCustomMedia = true;
92
85
  }
93
86
}
98
91
  iData.iTitle = IpeQ(iTitleEditor->text());
99
92
  iData.iSubject = IpeQ(iSubjectEditor->text());
100
93
  iData.iKeywords = IpeQ(iKeywordsEditor->text());
101
 
  iData.iPreamble = IpeQ(iLatexPreambleEditor->text());
 
94
  iData.iPreamble = IpeQ(iLatexPreambleEditor->toPlainText());
102
95
  iData.iFullScreen = iFullScreenBox->isChecked();
 
96
  iData.iNumberPages = iNumberPages->isChecked();
103
97
  iData.iCropBox = iCropBox->isChecked();
104
98
  IpeVector media = GetMedia();
105
99
  iData.iMedia = IpeRect(iData.iMedia.Min(), iData.iMedia.Min() + media);
107
101
 
108
102
IpeVector DialogDocumentProperties::GetMedia()
109
103
{
110
 
  int curMedia = iMedia->currentItem();
 
104
  int curMedia = iMedia->currentIndex();
111
105
  if (iCustomMedia)
112
106
    --curMedia;
113
107
  if (curMedia >= 0) {
142
136
//! Create dialog. \c data is only updated if dialog is accepted.
143
137
DialogDirPreferences::DialogDirPreferences(QWidget* parent,
144
138
                                           IpePreferences &data)
145
 
  : DlgDirectories(parent, "dialogdirpreferences", true), iData(data)
 
139
  : QDialog(parent), iData(data)
146
140
{
 
141
  setupUi(this);
 
142
  connect(iButtonHelp, SIGNAL(clicked()), SLOT(ShowHelp()));
147
143
  // copy data
148
144
  iPreferencesEditor->setText(iData.iPrefsFileName);
149
145
  iPreferencesEditor->setReadOnly(true);
155
151
  iDocDirEditor->setReadOnly(true);
156
152
  iFontmapEditor->setText(iData.iFontmap);
157
153
  iFontmapEditor->setReadOnly(true);
 
154
  iStdKeysEditor->setText(iData.iStdKeysFileName);
 
155
  iStdKeysEditor->setReadOnly(true);
 
156
  iKeysEditor->setText(iData.iKeysFileName);
 
157
  iKeysEditor->setReadOnly(true);
158
158
  iIpeletListBox->clear();
159
 
  iIpeletListBox->insertStringList(iData.iIpeletPath);
 
159
  iIpeletListBox->addItems(iData.iIpeletPath);
160
160
}
161
161
 
162
162
void DialogDirPreferences::ShowHelp()
173
173
//! Create dialog. \c data is only updated if dialog is accepted.
174
174
DialogPreferences::DialogPreferences(QWidget* parent, IpePreferences &data,
175
175
                                     int gridSize)
176
 
  : DlgPreferences(parent, "dialogpreferences", true),
177
 
    iData(data), iGridSize(gridSize)
 
176
  : QDialog(parent), iData(data), iGridSize(gridSize)
178
177
{
 
178
  setupUi(this);
 
179
  connect(iButtonHelp, SIGNAL(clicked()), SLOT(ShowHelp()));
 
180
  connect(iButtonOk, SIGNAL(clicked()), SLOT(UpdateData()));
 
181
  connect(iButtonDirectory, SIGNAL(clicked()), SLOT(ShowDirectories()));
 
182
  connect(iTextFontButton, SIGNAL(clicked()), SLOT(SetFont()));
 
183
  connect(iGridButton, SIGNAL(clicked()), SLOT(SetDefaultGrid()));
 
184
  connect(iStyleSheetBrowseButton, SIGNAL(clicked()), SLOT(SetStyleSheet()));
 
185
  connect(iClearStyleSheetButton, SIGNAL(clicked()), SLOT(ClearStyleSheet()));
179
186
  // copy data
180
187
  iCompress->setChecked(iData.iCompressLevel > 0);
181
188
  iSelectDistance->setValue(iData.iSelectDistance);
182
189
  iSnapDistance->setValue(iData.iSnapDistance);
183
190
  iWhitePaper->setChecked(iData.iWhitePaper);
184
 
  iBigToolButtons->setChecked(iData.iBigToolButtons);
185
191
  iTransformable->setChecked(iData.iTransformable);
186
192
  iAntiAlias->setChecked(iData.iAntiAlias);
 
193
  iDoubleBuffer->setChecked(iData.iDoubleBuffer);
187
194
  iGridVisible->setChecked(iData.iGridVisible);
188
195
  iMaximize->setChecked(iData.iMaximize);
 
196
  iBitmapSize->setValue(iData.iBitmapSize);
189
197
 
190
198
  iStyleSheet->setReadOnly(true);
191
199
  iStyleSheetPath = iData.iStyleSheet;
194
202
  // find all languages
195
203
  QDir dir(iData.iLangDir);
196
204
  dir.setFilter(QDir::Files);
197
 
  dir.setNameFilter("ipe-*.qm");
 
205
  dir.setNameFilters(QStringList(QLatin1String("ipe-*.qm")));
198
206
  QStringList langs = dir.entryList();
199
 
  iLanguage->insertItem("English (US)");
200
 
  iLanguage->setCurrentItem(0);
201
 
  for (uint j = 0; j < langs.count(); ++j) {
 
207
  iLanguage->addItem(QLatin1String("English (US)"));
 
208
  iLanguage->setCurrentIndex(0);
 
209
  for (int j = 0; j < langs.count(); ++j) {
202
210
    QString fn = dir.filePath(langs[j]);
203
211
    QFileInfo finfo(fn);
204
 
    iLanguage->insertItem(finfo.baseName().mid(4));
 
212
    iLanguage->addItem(finfo.baseName().mid(4));
205
213
    if (finfo.baseName().mid(4) == iData.iLanguage)
206
 
      iLanguage->setCurrentItem(iLanguage->count() - 1);
 
214
      iLanguage->setCurrentIndex(iLanguage->count() - 1);
207
215
  }
 
216
  iExport->addItem(tr("No auto-export"));
 
217
  iExport->addItem(tr("XML -> EPS"));
 
218
  iExport->addItem(tr("XML -> PDF"));
 
219
  iExport->addItem(tr("XML -> EPS & PDF"));
 
220
  iExport->addItem(tr("EPS -> PDF"));
 
221
  iExport->addItem(tr("PDF -> EPS"));
 
222
  iExport->setCurrentIndex(iData.iAutoExport);
 
223
  iExportExists->setChecked(iData.iExportExist);
208
224
}
209
225
 
210
226
void DialogPreferences::ShowHelp()
224
240
  if (startIn.isNull())
225
241
    startIn = IpePreferences::Static()->iDialogDir;
226
242
  QString fn = QFileDialog::getOpenFileName
227
 
    (startIn, tr("Ipe style sheets (*.isy *.xml)"), this, 0,
228
 
     tr("Select default style sheet"));
 
243
    (this, tr("Select default style sheet"), startIn,
 
244
     tr("Ipe style sheets (*.isy *.xml)"));
229
245
  if (!fn.isEmpty()) {
230
246
    iStyleSheetPath = fn;
231
247
    iStyleSheet->setText(fn);
242
258
void DialogPreferences::ClearStyleSheet()
243
259
{
244
260
  iStyleSheetPath = QString::null;
245
 
  iStyleSheet->setText("");
 
261
  iStyleSheet->clear();
246
262
}
247
263
 
248
264
void DialogPreferences::SetFont()
249
265
{
250
 
  iData.iFont = QFontDialog::getFont(0, iData.iFont);
251
 
}
252
 
 
253
 
void DialogPreferences::SetTextFont()
254
 
{
255
 
  iData.iTextFont = QFontDialog::getFont(0, iData.iTextFont);
 
266
  QFont font;
 
267
  font.fromString(iData.iFont);
 
268
  font = QFontDialog::getFont(0, font);
 
269
  iData.iFont = font.toString();
256
270
}
257
271
 
258
272
void DialogPreferences::UpdateData()
262
276
  iData.iSelectDistance = iSelectDistance->value();
263
277
  iData.iSnapDistance = iSnapDistance->value();
264
278
  iData.iWhitePaper = iWhitePaper->isChecked();
265
 
  iData.iBigToolButtons = iBigToolButtons->isChecked();
266
279
  iData.iTransformable = iTransformable->isChecked();
267
280
  iData.iAntiAlias = iAntiAlias->isChecked();
 
281
  iData.iDoubleBuffer = iDoubleBuffer->isChecked();
268
282
  iData.iGridVisible = iGridVisible->isChecked();
 
283
  iData.iAutoExport = IpePreferences::TExportMode(iExport->currentIndex());
 
284
  iData.iExportExist = iExportExists->isChecked();
269
285
  iData.iMaximize = iMaximize->isChecked();
 
286
  iData.iBitmapSize = iBitmapSize->value();
270
287
  iData.iStyleSheet = iStyleSheetPath;
271
 
  if (iLanguage->currentItem() == 0)
 
288
  if (iLanguage->currentIndex() == 0)
272
289
    iData.iLanguage = QString::null;
273
290
  else
274
291
    iData.iLanguage = iLanguage->currentText();
276
293
 
277
294
// --------------------------------------------------------------------
278
295
 
279
 
/*! \class DialogPageViews
280
 
  \brief Dialog to edit page presentation
 
296
/*! \class DialogEffects
 
297
  \brief Dialog to edit transition effect of a page view
281
298
*/
282
299
 
283
 
/*! Create dialog, given layer names (read-only), and an IpeViewSeq
284
 
  object.  Note that \c data is updated during the execution of the
285
 
  dialog, and must be discarded if the return value of exec() is not
286
 
  QDialog::Accepted. */
287
 
DialogPageViews::DialogPageViews(QWidget* parent, QStringList layers,
288
 
                                 IpeViewSeq &data, QStringList &sections)
289
 
  : DlgPagePresentation(parent, "dialogpageviews", true),
290
 
    iLayers(layers), iData(data), iSections(sections)
 
300
/*! Create dialog, given an IpeView object.  */
 
301
DialogEffects::DialogEffects(QWidget* parent, IpeView &data)
 
302
  : QDialog(parent), iData(data)
291
303
{
 
304
  setupUi(this);
 
305
  connect(iButtonHelp, SIGNAL(clicked()), SLOT(ShowHelp()));
 
306
  connect(iButtonOk, SIGNAL(clicked()), SLOT(UpdateData()));
 
307
 
292
308
  // init effects combo box
293
 
  iEffectComboBox->insertItem(tr("No effect"));
294
 
  iEffectComboBox->insertItem(tr("Split horizontally inwards"));
295
 
  iEffectComboBox->insertItem(tr("Split horizontally outwards"));
296
 
  iEffectComboBox->insertItem(tr("Split vertically inwards"));
297
 
  iEffectComboBox->insertItem(tr("Split vertically outwards"));
298
 
  iEffectComboBox->insertItem(tr("Blinds horizontally"));
299
 
  iEffectComboBox->insertItem(tr("Blinds vertically"));
300
 
  iEffectComboBox->insertItem(tr("Box inwards"));
301
 
  iEffectComboBox->insertItem(tr("Box outwards"));
302
 
  iEffectComboBox->insertItem(tr("Wipe left-to-right"));
303
 
  iEffectComboBox->insertItem(tr("Wipe bottom-to-top"));
304
 
  iEffectComboBox->insertItem(tr("Wipe right-to-left"));
305
 
  iEffectComboBox->insertItem(tr("Wipe top-to-bottom"));
306
 
  iEffectComboBox->insertItem(tr("Dissolve"));
307
 
  iEffectComboBox->insertItem(tr("Glitter left-to-right"));
308
 
  iEffectComboBox->insertItem(tr("Glitter top-to-bottom"));
309
 
  iEffectComboBox->insertItem(tr("Glitter diagonally"));
310
 
  // set layers
311
 
  iLayerListBox->clear();
312
 
  iLayerListBox->insertStringList(layers);
313
 
  // dialog state
314
 
  iCurView = 0;
315
 
  iInternal = true;
316
 
  // init views list
317
 
  iViewsListBox->clear();
318
 
  for (uint i = 0; i < iData.size(); i++) {
319
 
    iViewsListBox->insertItem("");
320
 
    UpdateViewLine(i);
 
309
  iEffectComboBox->addItem(tr("No effect"));
 
310
  iEffectComboBox->addItem(tr("Split horizontally inwards"));
 
311
  iEffectComboBox->addItem(tr("Split horizontally outwards"));
 
312
  iEffectComboBox->addItem(tr("Split vertically inwards"));
 
313
  iEffectComboBox->addItem(tr("Split vertically outwards"));
 
314
  iEffectComboBox->addItem(tr("Blinds horizontally"));
 
315
  iEffectComboBox->addItem(tr("Blinds vertically"));
 
316
  iEffectComboBox->addItem(tr("Box inwards"));
 
317
  iEffectComboBox->addItem(tr("Box outwards"));
 
318
  iEffectComboBox->addItem(tr("Wipe left-to-right"));
 
319
  iEffectComboBox->addItem(tr("Wipe bottom-to-top"));
 
320
  iEffectComboBox->addItem(tr("Wipe right-to-left"));
 
321
  iEffectComboBox->addItem(tr("Wipe top-to-bottom"));
 
322
  iEffectComboBox->addItem(tr("Dissolve"));
 
323
  iEffectComboBox->addItem(tr("Glitter left-to-right"));
 
324
  iEffectComboBox->addItem(tr("Glitter top-to-bottom"));
 
325
  iEffectComboBox->addItem(tr("Glitter diagonally"));
 
326
 
 
327
  iDurationSpinBox->setValue(iData.Duration());
 
328
  iTransitionSpinBox->setValue(iData.TransitionTime());
 
329
  iEffectComboBox->setCurrentIndex(int(iData.Effect()));
 
330
 
 
331
  iTransitionSpinBox->setEnabled(iData.Effect() != IpeView::ENormal);
 
332
  connect(iEffectComboBox, SIGNAL(highlighted(int)), SLOT(UpdateFields(int)));
 
333
}
 
334
 
 
335
// --------------------------------------------------------------------
 
336
 
 
337
//! Update the transition field when the effect has changed.
 
338
void DialogEffects::UpdateFields(int effect)
 
339
{
 
340
  iTransitionSpinBox->setEnabled(effect != 0);
 
341
}
 
342
 
 
343
void DialogEffects::UpdateData()
 
344
{
 
345
  iData.SetEffect(IpeView::TEffect(iEffectComboBox->currentIndex()));
 
346
  iData.SetTransitionTime(iTransitionSpinBox->value());
 
347
  iData.SetDuration(iDurationSpinBox->value());
 
348
}
 
349
 
 
350
void DialogEffects::ShowHelp()
 
351
{
 
352
  QWhatsThis::enterWhatsThisMode();
 
353
}
 
354
 
 
355
// --------------------------------------------------------------------
 
356
 
 
357
DialogLatexError::DialogLatexError(QWidget* parent, const QString &log)
 
358
  : QDialog(parent)
 
359
{
 
360
  setupUi(this);
 
361
  iLogEditor->setReadOnly(true);
 
362
  iLogEditor->setFocus();
 
363
  QTextDocument *doc = new QTextDocument(iLogEditor);
 
364
  doc->setPlainText(log);
 
365
  QTextCursor cursor(doc);
 
366
  int curPos = 0;
 
367
  int errNo = 0;
 
368
  for (;;) {
 
369
    int nextErr = log.indexOf(QLatin1String("\n!"), curPos);
 
370
    if (nextErr < 0)
 
371
      break;
 
372
 
 
373
    int lines = 0;
 
374
    while (curPos < nextErr + 1) {
 
375
      if (log[curPos++] == QLatin1Char('\n'))
 
376
        ++lines;
 
377
    }
 
378
    cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, lines);
 
379
    int pos = cursor.position();
 
380
    cursor.movePosition(QTextCursor::Down);
 
381
    cursor.setPosition(pos, QTextCursor::KeepAnchor);
 
382
    ++errNo;
 
383
    QString s;
 
384
    s.sprintf("err%d", errNo);
 
385
    QTextCharFormat format;
 
386
    format.setBackground(Qt::yellow);
 
387
    format.setAnchorName(s);
 
388
    format.setAnchor(true);
 
389
    cursor.setCharFormat(format);
321
390
  }
322
 
  UpdateViewState();
323
 
  UpdateFields();
 
391
  iLogEditor->setDocument(doc);
 
392
  iLogEditor->scrollToAnchor(QLatin1String("err1"));
 
393
}
 
394
 
 
395
// --------------------------------------------------------------------
 
396
 
 
397
DialogPage::DialogPage(QWidget* parent, QStringList &sections)
 
398
  : QDialog(parent), iSections(sections)
 
399
{
 
400
  setupUi(this);
 
401
  connect(iButtonHelp, SIGNAL(clicked()), SLOT(ShowHelp()));
 
402
  connect(iButtonOk, SIGNAL(clicked()), SLOT(UpdateData()));
324
403
  iSectionEditor->setText(iSections[0]);
325
404
  iSubsectionEditor->setText(iSections[1]);
326
405
}
327
406
 
328
 
//! Update the enabled state of the view buttons and the current line
329
 
void DialogPageViews::UpdateViewState()
330
 
{
331
 
  iViewsListBox->setCurrentItem(iCurView);
332
 
  iViewsDelButton->setEnabled(iData.size() > 1);
333
 
  iViewsUpButton->setEnabled(iCurView > 0);
334
 
  iViewsDownButton->setEnabled(iCurView < int(iData.size() - 1));
335
 
}
336
 
 
337
 
//! Update the view description lines
338
 
void DialogPageViews::UpdateViewLine(int itemno)
339
 
{
340
 
  IpeView &p = iData[itemno];
341
 
  QString s;
342
 
  s.sprintf("View #%d: ", itemno + 1);
343
 
  for (int i = 0; i < p.CountLayers(); ++i) {
344
 
    if (i > 0)
345
 
      s.append(", ");
346
 
    if (p.Layer(i) == p.Active())
347
 
      s.append("<" + QIpe(p.Layer(i)) + ">");
348
 
    else
349
 
      s.append(QIpe(p.Layer(i)));
350
 
  }
351
 
  if (p.Duration() > 0)
352
 
    s.append("  (" + QString::number(p.Duration()) + " sec.)");
353
 
  iViewsListBox->changeItem(s, itemno);
354
 
}
355
 
 
356
 
void DialogPageViews::AddNewView()
357
 
{
358
 
  iInternal = true;
359
 
  IpeView pres = iData[iCurView];
360
 
  ++iCurView;
361
 
  IpeViewSeq::iterator it = iData.begin() + iCurView;
362
 
  iData.insert(it, pres);
363
 
  iViewsListBox->insertItem("", iCurView);
364
 
  UpdateViewLine(iCurView);
365
 
  UpdateViewState();
366
 
  UpdateFields();
367
 
}
368
 
 
369
 
void DialogPageViews::RemoveView()
370
 
{
371
 
  if (iData.size() == 0) return;
372
 
  iInternal = true;
373
 
  iData.erase(iData.begin() + iCurView);
374
 
  iViewsListBox->removeItem(iCurView);
375
 
  if (iCurView == int(iData.size()))
376
 
    --iCurView;
377
 
  UpdateViewState();
378
 
  UpdateFields();
379
 
}
380
 
 
381
 
void DialogPageViews::MoveViewUp()
382
 
{
383
 
  if (iCurView == 0) return;
384
 
  iInternal = true;
385
 
  IpeViewSeq::iterator it = iData.begin() + iCurView;
386
 
  IpeView p = *it;
387
 
  it = iData.erase(it);
388
 
  --iCurView; --it; // previous line
389
 
  iData.insert(it, p);
390
 
  UpdateViewLine(iCurView);
391
 
  UpdateViewLine(iCurView + 1);
392
 
  UpdateViewState();
393
 
  iInternal = false;
394
 
}
395
 
 
396
 
void DialogPageViews::MoveViewDown()
397
 
{
398
 
  if (iCurView == int(iViewsListBox->count() - 1)) return;
399
 
  iInternal = true;
400
 
  IpeViewSeq::iterator it = iData.begin() + iCurView;
401
 
  IpeView p = *it;
402
 
  it = iData.erase(it);
403
 
  ++iCurView; ++it; // next line
404
 
  iData.insert(it, p);
405
 
  UpdateViewLine(iCurView);
406
 
  UpdateViewLine(iCurView - 1);
407
 
  UpdateViewState();
408
 
  iInternal = false;
409
 
}
410
 
 
411
 
void DialogPageViews::CurrentViewChanged(QListBoxItem *)
412
 
{
413
 
  if (iInternal) return;
414
 
  int itemno = iViewsListBox->currentItem();
415
 
  if (itemno >= 0)
416
 
    iCurView = itemno;
417
 
  UpdateFields();
418
 
  UpdateViewState();
419
 
}
420
 
 
421
 
// --------------------------------------------------------------------
422
 
 
423
 
//! Update the view fields when the current view has changed.
424
 
void DialogPageViews::UpdateFields()
425
 
{
426
 
  iInternal = true;
427
 
  IpeView &p = iData[iCurView];
428
 
  iDurationSpinBox->setValue(p.Duration());
429
 
  iTransitionSpinBox->setValue(p.TransitionTime());
430
 
  iEffectComboBox->setCurrentItem(int(p.Effect()));
431
 
  for (uint i = 0; i < iLayerListBox->count(); ++i) {
432
 
    iLayerListBox->setSelected(i, p.HasLayer(IpeQ(iLayerListBox->text(i))));
433
 
  }
434
 
  iTransitionSpinBox->setEnabled(p.Effect() != IpeView::ENormal);
435
 
  iInternal = false;
436
 
}
437
 
 
438
 
void DialogPageViews::LayerHighlighted()
439
 
{
440
 
  if (!iInternal) {
441
 
    iData[iCurView].ClearLayers();
442
 
    for (uint i = 0; i < iLayerListBox->count(); ++i) {
443
 
      if (iLayerListBox->isSelected(i)) {
444
 
        iData[iCurView].AddLayer(IpeQ(iLayerListBox->text(i)));
445
 
      }
446
 
    }
447
 
    UpdateViewLine(iCurView);
448
 
  }
449
 
}
450
 
 
451
 
void DialogPageViews::EffectChanged(int effectNo)
452
 
{
453
 
  iTransitionSpinBox->setEnabled(effectNo != 0);
454
 
  if (!iInternal)
455
 
    iData[iCurView].SetEffect(IpeView::TEffect(effectNo));
456
 
}
457
 
 
458
 
void DialogPageViews::TransitionChanged(int val)
459
 
{
460
 
  if (!iInternal)
461
 
    iData[iCurView].SetTransitionTime(val);
462
 
}
463
 
 
464
 
void DialogPageViews::DurationChanged(int val)
465
 
{
466
 
  if (!iInternal) {
467
 
    iData[iCurView].SetDuration(val);
468
 
    UpdateViewLine(iCurView);
469
 
  }
470
 
}
471
 
 
472
 
void DialogPageViews::UpdateData()
 
407
void DialogPage::UpdateData()
473
408
{
474
409
  iSections[0] = iSectionEditor->text();
475
410
  iSections[1] = iSubsectionEditor->text();
476
411
}
477
412
 
478
 
void DialogPageViews::ShowHelp()
 
413
void DialogPage::ShowHelp()
479
414
{
480
415
  QWhatsThis::enterWhatsThisMode();
481
416
}
482
417
 
483
418
// --------------------------------------------------------------------
484
 
 
485
 
DialogLatexError::DialogLatexError(QWidget* parent, QString log)
486
 
  : DlgLatexErr(parent, "dlglatexerr", false)
487
 
{
488
 
  iLogEditor->setText(log);
489
 
  iLogEditor->setFocus();
490
 
}
491
 
 
492
 
// --------------------------------------------------------------------
493