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