]> git.lyx.org Git - features.git/blob - src/frontends/qt2/QDocumentDialog.C
7c6a649f4a6bb19a81efde8cc238fbcf5248818e
[features.git] / src / frontends / qt2 / QDocumentDialog.C
1 /**
2  * \file QDocumentDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "bufferparams.h"
14 #include "debug.h"
15 #include "lyxrc.h"
16
17 #include "controllers/ControlDocument.h"
18
19 #include "support/lstrings.h"
20
21 #include "QDocument.h"
22 #include "QDocumentDialog.h"
23
24 #include "floatplacement.h"
25 #include "lengthcombo.h"
26 #include "panelstack.h"
27 #include "qt_helpers.h"
28
29 #include <qlabel.h>
30 #include <qmultilineedit.h>
31 #include <qlineedit.h>
32 #include <qlistview.h>
33 #include <qpushbutton.h>
34 #include <qradiobutton.h>
35 #include <qcheckbox.h>
36 #include <qslider.h>
37 #include <qpixmap.h>
38 #include <qcolor.h>
39 #include <qcolordialog.h>
40
41 using lyx::support::token;
42
43 using std::string;
44
45
46 QDocumentDialog::QDocumentDialog(QDocument * form)
47         : QDocumentDialogBase(0, 0, false, 0), form_(form)
48 {
49         connect(okPB, SIGNAL(clicked()),
50                 form, SLOT(slotOK()));
51         connect(applyPB, SIGNAL(clicked()),
52                 form, SLOT(slotApply()));
53         connect(closePB, SIGNAL(clicked()),
54                 form, SLOT(slotClose()));
55         connect(restorePB, SIGNAL(clicked()),
56                 form, SLOT(slotRestore()));
57
58         textLayoutModule = new TextLayoutModuleBase(this);
59         pageLayoutModule = new PageLayoutModuleBase(this);
60         marginsModule = new MarginsModuleBase(this);
61         langModule = new LanguageModuleBase(this);
62         bulletsModule = new BulletsModule(this);
63         numberingModule = new NumberingModuleBase(this);
64         biblioModule = new BiblioModuleBase(this);
65         mathsModule = new MathsModuleBase(this);
66         floatModule = new FloatPlacement(this, "floatplacement");
67         latexModule = new LaTeXModuleBase(this);
68         branchesModule = new BranchesModuleBase(this);
69         preambleModule = new PreambleModuleBase(this);
70
71         docPS->addPanel(latexModule, _("Document Class"));
72         docPS->addPanel(textLayoutModule, _("Text Layout"));
73         docPS->addPanel(pageLayoutModule, _("Page Layout"));
74         docPS->addPanel(marginsModule, _("Page Margins"));
75         docPS->addPanel(langModule, _("Language"));
76         docPS->addPanel(numberingModule, _("Numbering & TOC"));
77         docPS->addPanel(biblioModule, _("Bibliography"));
78         docPS->addPanel(mathsModule, _("Math options"));
79         docPS->addPanel(floatModule, _("Float Placement"));
80         docPS->addPanel(bulletsModule, _("Bullets"));
81         docPS->addPanel(branchesModule, _("Branches"));
82         docPS->addPanel(preambleModule, _("LaTeX Preamble"));
83         docPS->setCurrentPanel(_("Document Class"));
84
85         // preamble
86         connect(preambleModule->preambleMLE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
87         // biblio
88         connect(biblioModule->citeDefaultRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
89         connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
90         connect(biblioModule->citeStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
91         connect(biblioModule->citeJurabibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
92         // language & quote
93         connect(langModule->languageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
94         connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
95         connect(langModule->encodingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
96         connect(langModule->quoteStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
97         // numbering
98         connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
99         connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
100         connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
101         connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
102         numberingModule->tocLV->setSorting(-1);
103         // maths
104         connect(mathsModule->amsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
105         connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
106         // float
107         connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
108         // latex class
109         connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
110         connect(latexModule->optionsLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
111         connect(latexModule->psdriverCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
112         connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(classChanged()));
113         // text layout
114         connect(textLayoutModule->fontsCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
115         connect(textLayoutModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
116         connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
117         connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(setLSpacing(int)));
118         connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
119         connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
120         connect(textLayoutModule->indentRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
121         connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
122         connect(textLayoutModule->skipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
123         connect(textLayoutModule->skipLengthCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
124         connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(setSkip(int)));
125         connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(enableSkip(bool)));
126         connect(textLayoutModule->twoColumnCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
127
128         // margins
129         connect(marginsModule->marginCO, SIGNAL(activated(int)), this, SLOT(setCustomMargins(int)));
130         connect(marginsModule->marginCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
131         connect(marginsModule->topLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
132         connect(marginsModule->topUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
133         connect(marginsModule->bottomLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
134         connect(marginsModule->bottomUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
135         connect(marginsModule->innerLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
136         connect(marginsModule->innerUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
137         connect(marginsModule->outerLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
138         connect(marginsModule->outerUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
139         connect(marginsModule->headheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
140         connect(marginsModule->headheightUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
141         connect(marginsModule->headsepLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
142         connect(marginsModule->headsepUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
143         connect(marginsModule->footskipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
144         connect(marginsModule->footskipUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
145
146         // page layout
147         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setMargins(int)));
148         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
149         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
150         connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(portraitChanged()));
151         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
152         connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
153         connect(pageLayoutModule->paperwidthLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
154         connect(pageLayoutModule->paperwidthUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
155         connect(pageLayoutModule->paperheightUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
156         connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
157         connect(pageLayoutModule->landscapeRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
158         connect(pageLayoutModule->facingPagesCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
159         connect(pageLayoutModule->pagestyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
160
161         // bullets
162         connect(bulletsModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
163
164         // branches
165         connect(branchesModule->addBranchPB, SIGNAL(pressed()), this, SLOT(addBranchPressed()));
166         connect(branchesModule->removePB, SIGNAL(pressed()), this, SLOT(deleteBranchPressed()));
167         connect(branchesModule->activatePB, SIGNAL(pressed()), this, SLOT(toggleBranchPressed()));
168         connect(branchesModule->branchesLV, SIGNAL(doubleClicked(QListViewItem *)), this,
169                 SLOT(branchDoubleClicked(QListViewItem *)));
170         connect(branchesModule->colorPB, SIGNAL(clicked()), this, SLOT(toggleBranchColor()));
171         branchesModule->branchesLV->setSorting(0);
172 }
173
174
175 QDocumentDialog::~QDocumentDialog()
176 {
177 }
178
179
180 void QDocumentDialog::showPreamble()
181 {
182         docPS->setCurrentPanel(_("LaTeX Preamble"));
183 }
184
185
186 void QDocumentDialog::saveDefaultClicked()
187 {
188         form_->saveDocDefault();
189 }
190
191
192 void QDocumentDialog::useDefaultsClicked()
193 {
194     form_->useClassDefaults();
195 }
196
197
198 void QDocumentDialog::change_adaptor()
199 {
200         form_->changed();
201 }
202
203
204 void QDocumentDialog::closeEvent(QCloseEvent * e)
205 {
206         form_->slotWMHide();
207         e->accept();
208 }
209
210
211 void QDocumentDialog::setLSpacing(int item)
212 {
213         textLayoutModule->lspacingLE->setEnabled(item == 3);
214 }
215
216
217 void QDocumentDialog::setSkip(int item)
218 {
219         bool const enable = (item == 3);
220         textLayoutModule->skipLE->setEnabled(enable);
221         textLayoutModule->skipLengthCO->setEnabled(enable);
222 }
223
224
225 void QDocumentDialog::enableSkip(bool skip)
226 {
227         textLayoutModule->skipCO->setEnabled(skip);
228         textLayoutModule->skipLE->setEnabled(skip);
229         textLayoutModule->skipLengthCO->setEnabled(skip);
230         if (skip)
231                 setSkip(textLayoutModule->skipCO->currentItem());
232 }
233
234 void QDocumentDialog::portraitChanged()
235 {
236         setMargins(pageLayoutModule->papersizeCO->currentItem());
237 }
238
239 void QDocumentDialog::setMargins(int papersize)
240 {
241         int olditem = marginsModule->marginCO->currentItem();
242         marginsModule->marginCO->clear();
243         marginsModule->marginCO->insertItem(qt_("Default"));
244         marginsModule->marginCO->insertItem(qt_("Custom"));
245         bool a4size = (papersize == 6 || papersize == 0
246                         && lyxrc.default_papersize == PAPER_A4PAPER);
247         if (a4size && pageLayoutModule->portraitRB->isChecked()) {
248                 marginsModule->marginCO->insertItem(qt_("Small margins"));
249                 marginsModule->marginCO->insertItem(qt_("Very small margins"));
250                 marginsModule->marginCO->insertItem(qt_("Very wide margins"));
251         } else if (olditem > 1) {
252                 olditem = 0;
253         }
254         marginsModule->marginCO->setCurrentItem(olditem);
255         setCustomMargins(olditem);
256 }
257
258
259 void QDocumentDialog::setCustomPapersize(int papersize)
260 {
261         bool const custom = (papersize == 1);
262
263         pageLayoutModule->paperwidthL->setEnabled(custom);
264         pageLayoutModule->paperwidthLE->setEnabled(custom);
265         pageLayoutModule->paperwidthUnitCO->setEnabled(custom);
266         pageLayoutModule->paperheightL->setEnabled(custom);
267         pageLayoutModule->paperheightLE->setEnabled(custom);
268         pageLayoutModule->paperheightLE->setFocus();
269         pageLayoutModule->paperheightUnitCO->setEnabled(custom);
270 }
271
272
273 void QDocumentDialog::setCustomMargins(int margin)
274 {
275         bool const custom = (margin == 1);
276
277         marginsModule->topL->setEnabled(custom);
278         marginsModule->topLE->setEnabled(custom);
279         marginsModule->topUnit->setEnabled(custom);
280
281         marginsModule->bottomL->setEnabled(custom);
282         marginsModule->bottomLE->setEnabled(custom);
283         marginsModule->bottomUnit->setEnabled(custom);
284
285         marginsModule->innerL->setEnabled(custom);
286         marginsModule->innerLE->setEnabled(custom);
287         marginsModule->innerUnit->setEnabled(custom);
288
289         marginsModule->outerL->setEnabled(custom);
290         marginsModule->outerLE->setEnabled(custom);
291         marginsModule->outerUnit->setEnabled(custom);
292
293         marginsModule->headheightL->setEnabled(custom);
294         marginsModule->headheightLE->setEnabled(custom);
295         marginsModule->headheightUnit->setEnabled(custom);
296
297         marginsModule->headsepL->setEnabled(custom);
298         marginsModule->headsepLE->setEnabled(custom);
299         marginsModule->headsepUnit->setEnabled(custom);
300
301         marginsModule->footskipL->setEnabled(custom);
302         marginsModule->footskipLE->setEnabled(custom);
303         marginsModule->footskipUnit->setEnabled(custom);
304 }
305
306
307 void QDocumentDialog::updateFontsize(string const & items, string const & sel)
308 {
309         textLayoutModule->fontsizeCO->clear();
310         textLayoutModule->fontsizeCO->insertItem("default");
311
312         for (int n = 0; !token(items,'|',n).empty(); ++n)
313                 textLayoutModule->fontsizeCO->
314                         insertItem(toqstr(token(items,'|',n)));
315
316         for (int n = 0; n<textLayoutModule->fontsizeCO->count(); ++n) {
317                 if (fromqstr(textLayoutModule->fontsizeCO->text(n)) == sel) {
318                         textLayoutModule->fontsizeCO->setCurrentItem(n);
319                         break;
320                 }
321         }
322 }
323
324
325 void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
326 {
327         pageLayoutModule->pagestyleCO->clear();
328         pageLayoutModule->pagestyleCO->insertItem("default");
329
330         for (int n=0; !token(items,'|',n).empty(); ++n)
331                 pageLayoutModule->pagestyleCO->
332                         insertItem(toqstr(token(items,'|',n)));
333
334         for (int n = 0; n<pageLayoutModule->pagestyleCO->count(); ++n) {
335                 if (fromqstr(pageLayoutModule->pagestyleCO->text(n))==sel) {
336                         pageLayoutModule->pagestyleCO->setCurrentItem(n);
337                         break;
338                 }
339         }
340 }
341
342
343 void QDocumentDialog::classChanged()
344 {
345         ControlDocument & cntrl = form_->controller();
346         BufferParams & params = cntrl.params();
347
348         lyx::textclass_type const tc = latexModule->classCO->currentItem();
349
350         if (form_->controller().loadTextclass(tc)) {
351                 params.textclass = tc;
352
353                 if (lyxrc.auto_reset_options) {
354                         params.useClassDefaults();
355                         form_->update_contents();
356                 } else {
357                         updateFontsize(cntrl.textClass().opt_fontsize(),
358                                        params.fontsize);
359
360                         updatePagestyle(cntrl.textClass().opt_pagestyle(),
361                                         params.pagestyle);
362                 }
363         } else {
364                 latexModule->classCO->setCurrentItem(params.textclass);
365         }
366 }
367
368
369 void QDocumentDialog::updateNumbering()
370 {
371         int const depth = numberingModule->depthSL->value();
372         int const toc = numberingModule->tocSL->value();
373         QListViewItem * partitem = numberingModule->tocLV->firstChild();
374         QListViewItem * chapteritem = partitem->nextSibling();
375         QListViewItem * sectionitem = chapteritem->nextSibling();
376         QListViewItem * subsectionitem = sectionitem->nextSibling();
377         QListViewItem * subsubsectionitem = subsectionitem->nextSibling();
378         QListViewItem * paragraphitem = subsubsectionitem->nextSibling();
379         QListViewItem * subparagraphitem = paragraphitem->nextSibling();
380
381         QString const no = qt_("No");
382         QString const yes = qt_("Yes");
383
384         //numberingModule->tocLV->setUpdatesEnabled(false);
385
386         partitem->setText(1, yes);
387         chapteritem->setText(1, yes);
388         sectionitem->setText(1, yes);
389         subsectionitem->setText(1, yes);
390         subsubsectionitem->setText(1, yes);
391         paragraphitem->setText(1, yes);
392         subparagraphitem->setText(1, yes);
393         partitem->setText(2, yes);
394         chapteritem->setText(2, yes);
395         sectionitem->setText(2, yes);
396         subsectionitem->setText(2, yes);
397         subsubsectionitem->setText(2, yes);
398         paragraphitem->setText(2, yes);
399         subparagraphitem->setText(2, yes);
400
401         // numbering
402         if (depth < -1) partitem->setText(1, no);
403         if (depth < 0) chapteritem->setText(1, no);
404         if (depth < 1) sectionitem->setText(1, no);
405         if (depth < 2) subsectionitem->setText(1, no);
406         if (depth < 3) subsubsectionitem->setText(1, no);
407         if (depth < 4) paragraphitem->setText(1, no);
408         if (depth < 5) subparagraphitem->setText(1, no);
409
410         // in toc
411         if (toc < 0) chapteritem->setText(2, no);
412         if (toc < 1) sectionitem->setText(2, no);
413         if (toc < 2) subsectionitem->setText(2, no);
414         if (toc < 3) subsubsectionitem->setText(2, no);
415         if (toc < 4) paragraphitem->setText(2, no);
416         if (toc < 5) subparagraphitem->setText(2, no);
417
418         //numberingModule->tocLV->setUpdatesEnabled(true);
419         //numberingModule->tocLV->update();
420 }
421
422
423 void QDocumentDialog::updateBranchView()
424 {
425         // store the selected branch
426         QListViewItem * selItem =
427                 branchesModule->branchesLV->selectedItem();
428         QString sel_branch;
429         if (selItem != 0)
430                 sel_branch = selItem->text(0);
431
432         branchesModule->branchesLV->clear();
433
434         BranchList::const_iterator it = form_->branchlist_.begin();
435         BranchList::const_iterator const end = form_->branchlist_.end();
436         for (; it != end; ++it) {
437                 QString const bname = toqstr(it->getBranch());
438                 QString const sel = it->getSelected() ? qt_("Yes") : qt_("No");
439                 QListViewItem * newItem =
440                         new QListViewItem(branchesModule->branchesLV, bname, sel);
441                 string const x11hexname = it->getColor();
442                 QColor itemcolor;
443                 if (x11hexname[0] == '#')
444                         itemcolor.setNamedColor(toqstr(x11hexname));
445                 if (itemcolor.isValid()) {
446                         QPixmap coloritem(30, 10);
447                         coloritem.fill(itemcolor);
448                         newItem->setPixmap(2, coloritem);
449                 }
450                 // restore selected branch
451                 if (bname == sel_branch)
452                         branchesModule->branchesLV->setSelected(newItem, true);
453         }
454         form_->changed();
455 }
456
457
458 void QDocumentDialog::addBranchPressed()
459 {
460         QString const new_branch = branchesModule->newBranchLE->text();
461         if (!new_branch.isEmpty()) {
462                 form_->branchlist_.add(fromqstr(new_branch));
463                 branchesModule->newBranchLE->clear();
464                 updateBranchView();
465         }
466 }
467
468
469 void QDocumentDialog::deleteBranchPressed()
470 {
471         QListViewItem * selItem =
472                 branchesModule->branchesLV->selectedItem();
473         QString sel_branch;
474         if (selItem != 0)
475                 sel_branch = selItem->text(0);
476         if (sel_branch) {
477                 form_->branchlist_.remove(fromqstr(sel_branch));
478                 branchesModule->newBranchLE->clear();
479                 updateBranchView();
480         }
481 }
482
483
484 void QDocumentDialog::toggleBranchPressed()
485 {
486         QListViewItem * selItem =
487                 branchesModule->branchesLV->selectedItem();
488         toggleBranch(selItem);
489 }
490
491
492 void QDocumentDialog::branchDoubleClicked(QListViewItem * selItem)
493 {
494         toggleBranch(selItem);
495 }
496
497
498 void QDocumentDialog::toggleBranch(QListViewItem * selItem)
499 {
500         if (selItem == 0)
501                 return;
502
503         QString sel_branch = selItem->text(0);
504         if (sel_branch) {
505                 bool const selected = selItem->text(1) == qt_("Yes");
506                 Branch * branch = form_->branchlist_.find(fromqstr(sel_branch));
507                 if (branch && branch->setSelected(!selected)) {
508                         branchesModule->newBranchLE->clear();
509                         updateBranchView();
510                 }
511         }
512 }
513
514
515 void QDocumentDialog::toggleBranchColor()
516 {
517         QListViewItem * selItem =
518                 branchesModule->branchesLV->selectedItem();
519         QString sel_branch;
520         if (selItem != 0)
521                 sel_branch = selItem->text(0);
522         if (sel_branch) {
523                 QColor initial;
524                 string current_branch = fromqstr(sel_branch);
525                 Branch * branch =
526                         form_->branchlist_.find(current_branch);
527                 if (!branch)
528                         return;
529
530                 string x11hexname = branch->getColor();
531                 if (x11hexname[0] == '#')
532                         initial.setNamedColor(toqstr(x11hexname));
533                 QColor ncol(QColorDialog::getColor(initial));
534                 if (ncol.isValid()){
535                         // add the color to the branchlist
536                         branch->setColor(fromqstr(ncol.name()));
537                         branchesModule->newBranchLE->clear();
538                         updateBranchView();
539                 }
540         }
541 }