Rev 23681 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
19584 | jghali | 1 | #include <QMessageBox> |
2 | |||
3 | #include "notesstyleseditor.h" |
||
4 | #include "pageitem_noteframe.h" |
||
5 | #include "prefsmanager.h" |
||
6 | #include "prefsfile.h" |
||
7 | #include "scribusdoc.h" |
||
8 | |||
9 | #include "scribus.h" |
||
10 | #include "undomanager.h" |
||
11 | #include "util.h" |
||
12 | |||
13 | NotesStylesEditor::NotesStylesEditor(QWidget *parent, const char *name) |
||
22516 | craig | 14 | : ScrPaletteBase(parent, name), m_Doc(nullptr) |
19584 | jghali | 15 | { |
16 | setupUi(this); |
||
17 | QString pname(name); |
||
18 | if (pname.isEmpty()) |
||
19 | pname = "notesStylesEditor"; |
||
23060 | craig | 20 | m_prefs = PrefsManager::instance().prefsFile->getContext(pname); |
19584 | jghali | 21 | |
22 | setBlockSignals(true); |
||
23 | |||
24 | addNewNsMode = false; |
||
22603 | craig | 25 | setDoc(nullptr); |
19584 | jghali | 26 | NSlistBox->setInsertPolicy(QComboBox::InsertAlphabetically); |
27 | |||
23535 | jghali | 28 | RangeBox->addItem(tr("Document"), static_cast<int>(NSRdocument)); |
29 | RangeBox->addItem(tr("Story"), static_cast<int>(NSRstory)); |
||
19584 | jghali | 30 | |
20937 | jghali | 31 | languageChange(); |
32 | |||
19584 | jghali | 33 | StartSpinBox->setMinimum(1); |
34 | StartSpinBox->setMaximum(99999); |
||
35 | changesMap.clear(); |
||
36 | |||
37 | setBlockSignals(isVisible()); |
||
38 | } |
||
39 | |||
40 | NotesStylesEditor::~NotesStylesEditor() |
||
41 | { |
||
42 | storeVisibility(this->isVisible()); |
||
43 | storePosition(); |
||
44 | storeSize(); |
||
45 | } |
||
46 | |||
20490 | jghali | 47 | void NotesStylesEditor::changeEvent(QEvent *e) |
48 | { |
||
49 | if (e->type() == QEvent::LanguageChange) |
||
50 | { |
||
51 | languageChange(); |
||
52 | return; |
||
53 | } |
||
54 | ScrPaletteBase::changeEvent(e); |
||
55 | } |
||
56 | |||
19584 | jghali | 57 | void NotesStylesEditor::languageChange() |
58 | { |
||
59 | bool wasSignalsBlocked = signalsBlocked(); |
||
60 | setBlockSignals(true); |
||
61 | |||
20490 | jghali | 62 | retranslateUi(this); |
63 | |||
19584 | jghali | 64 | if (addNewNsMode) |
65 | { |
||
66 | OKButton->setText(tr("Cancel")); |
||
67 | OKButton->setToolTip(tr("Dialog is in adding new notes style mode. After pressing Cancel button dialog will be switched into normal notes styles edit mode.")); |
||
68 | ApplyButton->setText(tr("Add Style")); |
||
69 | } |
||
70 | else |
||
71 | { |
||
72 | OKButton->setText("OK"); |
||
73 | OKButton->setToolTip(""); |
||
74 | ApplyButton->setText(tr("Apply")); |
||
75 | } |
||
20490 | jghali | 76 | |
77 | bool paraStyleBlocked = paraStyleCombo->blockSignals(true); |
||
78 | int paraStyleIndex = paraStyleCombo->currentIndex(); |
||
79 | paraStyleCombo->setDoc(m_Doc); |
||
80 | if (paraStyleIndex >= 0) |
||
81 | paraStyleCombo->setCurrentIndex(paraStyleIndex); |
||
82 | paraStyleCombo->blockSignals(paraStyleBlocked); |
||
83 | |||
84 | bool charStyleBlocked = charStyleCombo->blockSignals(true); |
||
85 | int charStyleIndex = charStyleCombo->currentIndex(); |
||
86 | charStyleCombo->setDoc(m_Doc); |
||
87 | if (charStyleIndex >= 0) |
||
88 | charStyleCombo->setCurrentIndex(charStyleIndex); |
||
89 | charStyleCombo->blockSignals(charStyleBlocked); |
||
90 | |||
91 | bool rangeBlocked = RangeBox->blockSignals(true); |
||
92 | int rangeIndex = RangeBox->currentIndex(); |
||
23681 | jghali | 93 | RangeBox->clear(); |
23535 | jghali | 94 | RangeBox->addItem(tr("Document"), static_cast<int>(NSRdocument)); |
95 | RangeBox->addItem(tr("Story"), static_cast<int>(NSRstory)); |
||
20490 | jghali | 96 | if (rangeIndex >= 0) |
97 | RangeBox->setCurrentIndex(rangeIndex); |
||
98 | RangeBox->blockSignals(rangeBlocked); |
||
99 | |||
100 | setBlockSignals(wasSignalsBlocked); |
||
19584 | jghali | 101 | } |
102 | |||
103 | void NotesStylesEditor::setDoc(ScribusDoc *doc) |
||
104 | { |
||
105 | bool wasSignalsBlocked = signalsBlocked(); |
||
106 | setBlockSignals(true); |
||
22516 | craig | 107 | if (m_Doc != nullptr) |
19584 | jghali | 108 | disconnect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int))); |
109 | m_Doc = doc; |
||
110 | paraStyleCombo->setDoc(m_Doc); |
||
111 | charStyleCombo->setDoc(m_Doc); |
||
22516 | craig | 112 | if (m_Doc != nullptr) |
19584 | jghali | 113 | { |
114 | updateNSList(); |
||
115 | NSlistBox->setCurrentIndex(0); |
||
116 | readNotesStyle(NSlistBox->currentText()); |
||
117 | setEnabled(true); |
||
118 | ApplyButton->setEnabled(false); |
||
119 | connect(m_Doc->scMW(), SIGNAL(UpdateRequest(int)), this , SLOT(handleUpdateRequest(int))); |
||
120 | } |
||
121 | else |
||
122 | { |
||
123 | changesMap.clear(); |
||
124 | NewNameEdit->clear(); |
||
125 | setEnabled(false); |
||
126 | } |
||
127 | setBlockSignals(wasSignalsBlocked); |
||
128 | } |
||
129 | |||
130 | void NotesStylesEditor::handleUpdateRequest(int updateFlags) |
||
131 | { |
||
132 | bool wasSignalsBlocked = signalsBlocked(); |
||
133 | setBlockSignals(true); |
||
134 | if ((updateFlags & reqCharStylesUpdate) || (updateFlags & reqTextStylesUpdate)) |
||
23620 | jghali | 135 | charStyleCombo->updateStyleList(); |
19584 | jghali | 136 | if ((updateFlags & reqParaStylesUpdate) || (updateFlags & reqTextStylesUpdate)) |
23620 | jghali | 137 | paraStyleCombo->updateStyleList(); |
19584 | jghali | 138 | readNotesStyle(NSlistBox->currentText()); |
139 | setBlockSignals(wasSignalsBlocked); |
||
140 | } |
||
141 | |||
142 | void NotesStylesEditor::updateNSList() |
||
143 | { |
||
144 | bool wasSignalsBlocked = signalsBlocked(); |
||
145 | NSlistBox->blockSignals(true); |
||
22516 | craig | 146 | if (m_Doc == nullptr) |
19584 | jghali | 147 | NSlistBox->setEnabled(false); |
148 | else |
||
149 | { |
||
150 | NSlistBox->clear(); |
||
151 | changesMap.clear(); |
||
152 | for (int a = 0; a < m_Doc->m_docNotesStylesList.count(); ++a) |
||
153 | { |
||
154 | NSlistBox->addItem(m_Doc->m_docNotesStylesList.at(a)->name()); |
||
155 | changesMap.insert(m_Doc->m_docNotesStylesList.at(a)->name(), *(m_Doc->m_docNotesStylesList.at(a))); |
||
156 | } |
||
157 | if (!m_Doc->m_docNotesStylesList.isEmpty()) |
||
158 | NSlistBox->setEnabled(true); |
||
159 | if (NSlistBox->currentText() != tr("default")) |
||
160 | DeleteButton->setEnabled(true); |
||
161 | else |
||
162 | DeleteButton->setEnabled(false); |
||
163 | } |
||
164 | NSlistBox->blockSignals(wasSignalsBlocked); |
||
165 | |||
166 | DeleteButton->setEnabled(NSlistBox->currentText() != tr("default")); |
||
167 | } |
||
168 | |||
169 | void NotesStylesEditor::setBlockSignals(bool block) |
||
170 | { |
||
171 | foreach (QWidget* obj, findChildren<QWidget *>()) |
||
172 | { |
||
173 | obj->blockSignals(block); |
||
174 | } |
||
175 | paraStyleCombo->blockSignals(block); |
||
176 | charStyleCombo->blockSignals(block); |
||
177 | } |
||
178 | |||
179 | void NotesStylesEditor::setNotesStyle(NotesStyle * NS) |
||
180 | { |
||
22516 | craig | 181 | if (NS == nullptr) |
19584 | jghali | 182 | return; |
183 | bool wasSignalsBlocked = signalsBlocked(); |
||
184 | setBlockSignals(true); |
||
185 | NSlistBox->setCurrentIndex(NSlistBox->findText(NS->name())); |
||
186 | NewNameEdit->setText(NS->name()); |
||
187 | if (NS->name() == tr("default")) |
||
188 | NewNameEdit->setEnabled(false); |
||
189 | else |
||
190 | NewNameEdit->setEnabled(true); |
||
191 | FootRadio->setChecked(!NS->isEndNotes()); |
||
23535 | jghali | 192 | EndRadio->setEnabled(true); |
19584 | jghali | 193 | EndRadio->setChecked(NS->isEndNotes()); |
22971 | jghali | 194 | NumberingBox->setCurrentFormat(NS->getType()); |
23535 | jghali | 195 | int rangeIndex = RangeBox->findData((int) NS->range()); |
196 | RangeBox->setCurrentIndex((rangeIndex >= 0) ? rangeIndex : 0); |
||
19584 | jghali | 197 | StartSpinBox->setValue(NS->start()); |
198 | PrefixEdit->setText(NS->prefix()); |
||
199 | SuffixEdit->setText(NS->suffix()); |
||
200 | SuperMasterCheck->setChecked(NS->isSuperscriptInMaster()); |
||
201 | SuperNoteCheck->setChecked(NS->isSuperscriptInNote()); |
||
202 | if (!NS->notesParStyle().isEmpty() && (NS->notesParStyle() != tr("No Style"))) |
||
203 | paraStyleCombo->setCurrentIndex(paraStyleCombo->findText(NS->notesParStyle())); |
||
204 | if (!NS->marksChStyle().isEmpty() && (NS->marksChStyle() != tr("No Style"))) |
||
205 | charStyleCombo->setCurrentIndex(charStyleCombo->findText(NS->marksChStyle())); |
||
206 | AutoH->setChecked(NS->isAutoNotesHeight()); |
||
207 | AutoW->setChecked(NS->isAutoNotesWidth()); |
||
208 | AutoWeld->setChecked(NS->isAutoWeldNotesFrames()); |
||
23535 | jghali | 209 | //for endnotes disable autofixing size of notes frames |
19584 | jghali | 210 | if (NS->isEndNotes()) |
211 | { |
||
212 | AutoW->setEnabled(false); |
||
213 | AutoWeld->setEnabled(false); |
||
23535 | jghali | 214 | } |
19584 | jghali | 215 | else |
216 | { |
||
217 | AutoW->setEnabled(true); |
||
218 | AutoWeld->setEnabled(true); |
||
219 | } |
||
220 | AutoRemove->setChecked(NS->isAutoRemoveEmptyNotesFrames()); |
||
221 | |||
222 | ApplyButton->setEnabled(false); |
||
223 | setBlockSignals(wasSignalsBlocked); |
||
224 | } |
||
225 | |||
22635 | craig | 226 | void NotesStylesEditor::readNotesStyle(const QString& nsName) |
19584 | jghali | 227 | { |
228 | NotesStyle * NS = m_Doc->getNotesStyle(nsName); |
||
229 | setNotesStyle(NS); |
||
230 | } |
||
231 | |||
232 | void NotesStylesEditor::on_NSlistBox_currentIndexChanged(const QString &arg1) |
||
233 | { |
||
234 | if (arg1 != tr("default")) |
||
235 | DeleteButton->setEnabled(true); |
||
236 | else |
||
237 | DeleteButton->setEnabled(false); |
||
238 | readNotesStyle(arg1); |
||
239 | } |
||
240 | |||
241 | void NotesStylesEditor::on_ApplyButton_clicked() |
||
242 | { |
||
243 | if (addNewNsMode) |
||
244 | { |
||
245 | QString newName = NSlistBox->currentText(); |
||
246 | NotesStyle newNS = changesMap.value(newName); |
||
247 | if (m_Doc->validateNSet(newNS)) |
||
248 | { |
||
249 | addNewNsMode = false; |
||
250 | OKButton->setText(tr("OK")); |
||
251 | OKButton->setToolTip(""); |
||
252 | ApplyButton->setText(tr("Apply")); |
||
253 | m_Doc->newNotesStyle(newNS); |
||
254 | updateNSList(); |
||
255 | NSlistBox->setCurrentIndex(NSlistBox->findText(newNS.name())); |
||
256 | } |
||
257 | else |
||
258 | return; |
||
259 | } |
||
260 | else |
||
261 | { |
||
21026 | craig | 262 | //remember current NStyle |
19584 | jghali | 263 | QString currNS = NSlistBox->currentText(); |
22516 | craig | 264 | NotesStyle* NS = nullptr; |
19584 | jghali | 265 | |
266 | foreach (const QString &nsName, changesMap.keys()) |
||
267 | { |
||
268 | NotesStyle n = changesMap.value(nsName); |
||
269 | |||
270 | //validate settings |
||
271 | if (!m_Doc->validateNSet(n)) |
||
272 | { |
||
273 | NSlistBox->setCurrentIndex(NSlistBox->findText(n.name())); |
||
274 | break; |
||
275 | } |
||
276 | //rename |
||
277 | if (nsName != n.name()) |
||
278 | { |
||
279 | //new name for existing set |
||
280 | QString newName = n.name(); |
||
281 | getUniqueName(newName, changesMap.keys(),"="); |
||
282 | n.setName(newName); |
||
283 | NewNameEdit->setText(newName); |
||
284 | //current NSet name change |
||
285 | if (currNS == nsName) |
||
286 | currNS = newName; |
||
287 | NS = m_Doc->getNotesStyle(nsName); |
||
288 | m_Doc->renameNotesStyle(NS, newName); |
||
289 | m_Doc->setNotesChanged(true); |
||
290 | } |
||
291 | //change settings and update marks |
||
292 | NS = m_Doc->getNotesStyle(n.name()); |
||
22516 | craig | 293 | Q_ASSERT(NS != nullptr); |
19584 | jghali | 294 | if (*NS != n) |
295 | { |
||
22516 | craig | 296 | SimpleState* ss = nullptr; |
23932 | jghali | 297 | if (UndoManager::undoEnabled()) |
19584 | jghali | 298 | { |
299 | ss = new SimpleState(UndoManager::EditNotesStyle); |
||
300 | ss->set("NSTYLE", QString("edit")); |
||
301 | m_Doc->undoSetNotesStyle(ss, NS); |
||
302 | } |
||
303 | //converting foot <--> end notes or changing footnotes range |
||
304 | if ((NS->isEndNotes() != n.isEndNotes()) || (NS->isEndNotes() && n.isEndNotes() && NS->range() != n.range())) |
||
305 | { |
||
306 | foreach (PageItem_NoteFrame* nF, m_Doc->listNotesFrames(NS)) |
||
307 | m_Doc->delNoteFrame(nF, false); |
||
308 | if (n.isEndNotes()) |
||
309 | m_Doc->flag_updateEndNotes = true; |
||
310 | } |
||
311 | m_Doc->setNotesChanged(true); //notesframes width must be updated |
||
312 | *NS = n; |
||
313 | if (ss) |
||
314 | { |
||
315 | ss->set("NEWname", NS->name()); |
||
316 | ss->set("NEWstart", NS->start()); |
||
317 | ss->set("NEWendNotes", NS->isEndNotes()); |
||
318 | ss->set("NEWnumFormat", (int) NS->getType()); |
||
319 | ss->set("NEWrange", (int) NS->range()); |
||
320 | ss->set("NEWprefix", NS->prefix()); |
||
321 | ss->set("NEWsuffix", NS->suffix()); |
||
322 | ss->set("NEWautoH", NS->isAutoNotesHeight()); |
||
323 | ss->set("NEWautoW", NS->isAutoNotesWidth()); |
||
324 | ss->set("NEWautoWeld", NS->isAutoWeldNotesFrames()); |
||
325 | ss->set("NEWautoRemove", NS->isAutoRemoveEmptyNotesFrames()); |
||
326 | ss->set("NEWsuperMaster", NS->isSuperscriptInMaster()); |
||
327 | ss->set("NEWsuperNote", NS->isSuperscriptInNote()); |
||
328 | ss->set("NEWmarksChStyle", NS->marksChStyle()); |
||
329 | ss->set("NEWnotesParStyle", NS->notesParStyle()); |
||
330 | UndoManager::instance()->action(m_Doc, ss); |
||
331 | } |
||
332 | //invalidate all text frames with marks from current changed notes style |
||
333 | foreach (PageItem* item, m_Doc->DocItems) |
||
334 | { |
||
335 | if (item->isTextFrame() && !item->isNoteFrame() && item->asTextFrame()->hasNoteMark(NS)) |
||
336 | item->invalid = true; |
||
337 | } |
||
338 | m_Doc->updateNotesNums(NS); |
||
339 | m_Doc->updateNotesFramesSettings(NS); |
||
340 | if (m_Doc->flag_updateEndNotes) |
||
341 | m_Doc->updateEndnotesFrames(NS); |
||
342 | m_Doc->updateNotesFramesStyles(NS); |
||
343 | } |
||
344 | } |
||
345 | if (m_Doc->notesChanged()) |
||
346 | { |
||
347 | updateNSList(); |
||
348 | m_Doc->flag_updateMarksLabels = true; |
||
349 | m_Doc->changed(); |
||
350 | m_Doc->regionsChanged()->update(QRectF()); |
||
351 | } |
||
352 | //restore NStyle index |
||
353 | readNotesStyle(currNS); |
||
354 | } |
||
355 | |||
356 | ApplyButton->setEnabled(false); |
||
357 | NSlistBox->setEnabled(true); |
||
358 | NewButton->setEnabled(true); |
||
359 | } |
||
360 | |||
361 | void NotesStylesEditor::on_DeleteButton_clicked() |
||
362 | { |
||
363 | QString nsName = NSlistBox->currentText(); |
||
19605 | jghali | 364 | int t = ScMessageBox::warning(m_Doc->scMW(), tr("Warning! Deleting Notes Style"), "<qt>" + |
19584 | jghali | 365 | tr("You are going to delete notes style %1. All notes and marks using that style are also going to be deleted.").arg(nsName) + "</qt>", |
19605 | jghali | 366 | QMessageBox::Ok | QMessageBox::Abort, |
367 | QMessageBox::Abort, // GUI default |
||
368 | QMessageBox::Ok); // batch default |
||
19584 | jghali | 369 | if (t == QMessageBox::Ok) |
370 | { |
||
371 | m_Doc->deleteNotesStyle(nsName); |
||
372 | m_Doc->changed(); |
||
373 | m_Doc->regionsChanged()->update(QRectF()); |
||
374 | setDoc(m_Doc); |
||
375 | } |
||
376 | } |
||
377 | |||
378 | void NotesStylesEditor::on_NewButton_clicked() |
||
379 | { |
||
380 | QString oldName = NSlistBox->currentText(); |
||
381 | NotesStyle newNS = changesMap.value(oldName); |
||
382 | QString newName = oldName; |
||
383 | getUniqueName(newName, changesMap.keys(), "_"); |
||
384 | newNS.setName(newName); |
||
385 | changesMap.insert(newName, newNS); |
||
386 | setNotesStyle(&newNS); |
||
387 | |||
388 | NewNameEdit->setEnabled(true); |
||
389 | NSlistBox->addItem(newName); |
||
390 | NSlistBox->setCurrentIndex(NSlistBox->findText(newName)); |
||
391 | NSlistBox->setEnabled(false); |
||
392 | ApplyButton->setText(tr("Add Style")); |
||
393 | ApplyButton->setEnabled(true); |
||
394 | DeleteButton->setEnabled(false); |
||
395 | NewButton->setEnabled(false); |
||
396 | addNewNsMode = true; |
||
397 | OKButton->setText(tr("Cancel Adding")); |
||
398 | OKButton->setToolTip(tr("Notes Styles Editor is in adding new notes style mode. After pressing Cancel button Notes Styles Editor switch into normal notes styles edit mode.")); |
||
399 | } |
||
400 | |||
401 | void NotesStylesEditor::on_OKButton_clicked() |
||
402 | { |
||
403 | if (OKButton->text() != tr("OK")) |
||
404 | { |
||
405 | //in adding new style mode go back to normal editing mode |
||
406 | OKButton->setText(tr("OK")); |
||
407 | NewButton->setEnabled(true); |
||
408 | addNewNsMode = false; |
||
409 | QString newName = NSlistBox->currentText(); |
||
410 | changesMap.remove(newName); |
||
411 | int index = NSlistBox->findText(newName); |
||
412 | NSlistBox->removeItem(index); |
||
413 | NSlistBox->setCurrentIndex(index-1); |
||
414 | on_NSlistBox_currentIndexChanged(NSlistBox->currentText()); |
||
415 | } |
||
416 | else |
||
417 | { |
||
418 | if (ApplyButton->isEnabled()) |
||
419 | //apply changes |
||
420 | on_ApplyButton_clicked(); |
||
421 | |||
422 | //in normal mode close |
||
423 | close(); |
||
424 | } |
||
425 | } |
||
426 | |||
427 | void NotesStylesEditor::on_NewNameEdit_textChanged(const QString &arg1) |
||
428 | { |
||
429 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
430 | ns.setName(arg1); |
||
431 | changesMap.insert(NSlistBox->currentText(), ns); |
||
432 | ApplyButton->setEnabled(true); |
||
433 | } |
||
434 | |||
435 | void NotesStylesEditor::on_FootRadio_toggled(bool checked) |
||
436 | { |
||
437 | bool wasSignalsBlocked = signalsBlocked(); |
||
438 | setBlockSignals(true); |
||
439 | |||
440 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
441 | ns.setEndNotes(!checked); |
||
442 | changesMap.insert(NSlistBox->currentText(), ns); |
||
443 | EndRadio->setChecked(!checked); |
||
444 | if (checked) |
||
445 | { |
||
446 | ns.setAutoNotesWidth(true); |
||
447 | AutoW->setEnabled(true); |
||
448 | AutoW->setChecked(true); |
||
449 | ns.setAutoWeldNotesFrames(true); |
||
450 | AutoWeld->setEnabled(true); |
||
451 | AutoWeld->setChecked(true); |
||
452 | } |
||
453 | |||
454 | changesMap.insert(NSlistBox->currentText(), ns); |
||
455 | ApplyButton->setEnabled(true); |
||
456 | setBlockSignals(wasSignalsBlocked); |
||
457 | } |
||
458 | |||
459 | void NotesStylesEditor::on_EndRadio_toggled(bool checked) |
||
460 | { |
||
461 | bool wasSignalsBlocked = signalsBlocked(); |
||
462 | setBlockSignals(true); |
||
463 | |||
464 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
465 | ns.setEndNotes(checked); |
||
466 | FootRadio->setChecked(!checked); |
||
467 | if (checked) |
||
468 | { |
||
469 | ns.setAutoNotesWidth(false); |
||
470 | AutoW->setChecked(false); |
||
471 | AutoW->setEnabled(false); |
||
472 | ns.setAutoWeldNotesFrames(false); |
||
473 | AutoWeld->setChecked(false); |
||
474 | AutoWeld->setEnabled(false); |
||
475 | } |
||
476 | |||
477 | changesMap.insert(NSlistBox->currentText(), ns); |
||
478 | ApplyButton->setEnabled(true); |
||
479 | setBlockSignals(wasSignalsBlocked); |
||
480 | } |
||
481 | |||
22971 | jghali | 482 | void NotesStylesEditor::on_NumberingBox_currentIndexChanged(int /*index*/) |
19584 | jghali | 483 | { |
484 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
485 | |||
22971 | jghali | 486 | NumFormat formatType = NumberingBox->currentFormat(); |
487 | ns.setType(formatType); |
||
488 | |||
19584 | jghali | 489 | changesMap.insert(NSlistBox->currentText(), ns); |
490 | ApplyButton->setEnabled(true); |
||
491 | } |
||
492 | |||
493 | void NotesStylesEditor::on_RangeBox_currentIndexChanged(int index) |
||
494 | { |
||
495 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
23535 | jghali | 496 | ns.setRange((NumerationRange) RangeBox->itemData(index).toInt()); |
19584 | jghali | 497 | |
498 | changesMap.insert(NSlistBox->currentText(), ns); |
||
499 | ApplyButton->setEnabled(true); |
||
500 | } |
||
501 | |||
502 | void NotesStylesEditor::on_StartSpinBox_valueChanged(int arg1) |
||
503 | { |
||
504 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
505 | ns.setStart(arg1); |
||
506 | |||
507 | changesMap.insert(NSlistBox->currentText(), ns); |
||
508 | ApplyButton->setEnabled(true); |
||
509 | } |
||
510 | |||
511 | void NotesStylesEditor::on_PrefixEdit_textChanged(const QString &arg1) |
||
512 | { |
||
513 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
514 | ns.setPrefix(arg1); |
||
515 | |||
516 | changesMap.insert(NSlistBox->currentText(), ns); |
||
517 | ApplyButton->setEnabled(true); |
||
518 | } |
||
519 | |||
520 | void NotesStylesEditor::on_SuffixEdit_textChanged(const QString &arg1) |
||
521 | { |
||
522 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
523 | ns.setSuffix(arg1); |
||
524 | |||
525 | changesMap.insert(NSlistBox->currentText(), ns); |
||
526 | ApplyButton->setEnabled(true); |
||
527 | } |
||
528 | |||
529 | void NotesStylesEditor::on_SuperMasterCheck_toggled(bool checked) |
||
530 | { |
||
531 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
532 | ns.setSuperscriptInMaster(checked); |
||
533 | |||
534 | changesMap.insert(NSlistBox->currentText(), ns); |
||
535 | ApplyButton->setEnabled(true); |
||
536 | } |
||
537 | |||
538 | void NotesStylesEditor::on_SuperNoteCheck_toggled(bool checked) |
||
539 | { |
||
540 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
541 | ns.setSuperscriptInNote(checked); |
||
542 | |||
543 | changesMap.insert(NSlistBox->currentText(), ns); |
||
544 | ApplyButton->setEnabled(true); |
||
545 | } |
||
546 | |||
547 | void NotesStylesEditor::on_AutoH_toggled(bool checked) |
||
548 | { |
||
549 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
550 | ns.setAutoNotesHeight(checked); |
||
551 | |||
552 | changesMap.insert(NSlistBox->currentText(), ns); |
||
553 | ApplyButton->setEnabled(true); |
||
554 | } |
||
555 | |||
556 | void NotesStylesEditor::on_AutoW_toggled(bool checked) |
||
557 | { |
||
558 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
559 | ns.setAutoNotesWidth(checked); |
||
560 | |||
561 | changesMap.insert(NSlistBox->currentText(), ns); |
||
562 | ApplyButton->setEnabled(true); |
||
563 | } |
||
564 | |||
565 | void NotesStylesEditor::on_AutoWeld_toggled(bool checked) |
||
566 | { |
||
567 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
568 | ns.setAutoWeldNotesFrames(checked); |
||
569 | |||
570 | changesMap.insert(NSlistBox->currentText(), ns); |
||
571 | ApplyButton->setEnabled(true); |
||
572 | } |
||
573 | |||
574 | void NotesStylesEditor::on_AutoRemove_toggled(bool checked) |
||
575 | { |
||
576 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
577 | ns.setAutoRemoveEmptyNotesFrames(checked); |
||
578 | |||
579 | changesMap.insert(NSlistBox->currentText(), ns); |
||
580 | ApplyButton->setEnabled(true); |
||
581 | } |
||
582 | |||
583 | void NotesStylesEditor::on_paraStyleCombo_currentIndexChanged(const int &arg1) |
||
584 | { |
||
585 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
586 | if (arg1 == 0) |
||
587 | ns.setNotesParStyle(""); |
||
588 | else |
||
589 | ns.setNotesParStyle(paraStyleCombo->itemText(arg1)); |
||
590 | changesMap.insert(NSlistBox->currentText(), ns); |
||
591 | ApplyButton->setEnabled(true); |
||
592 | } |
||
593 | |||
594 | void NotesStylesEditor::on_charStyleCombo_currentIndexChanged(const int &arg1) |
||
595 | { |
||
596 | NotesStyle ns = changesMap.value(NSlistBox->currentText()); |
||
597 | if (arg1 == 0) |
||
598 | ns.setMarksCharStyle(""); |
||
599 | else |
||
600 | ns.setMarksCharStyle(charStyleCombo->itemText(arg1)); |
||
601 | changesMap.insert(NSlistBox->currentText(), ns); |
||
602 | ApplyButton->setEnabled(true); |
||
603 | } |