]> git.lyx.org Git - features.git/blob - src/frontends/qt/GuiToolbar.cpp
Regenerate previews after zoom (#11919)
[features.git] / src / frontends / qt / GuiToolbar.cpp
1 /**
2  * \file qt/GuiToolbar.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author John Levon
8  * \author Jean-Marc Lasgouttes
9  * \author Angus Leeming
10  * \author Stefan Schimanski
11  * \author Abdelrazak Younes
12  *
13  * Full author contact details are available in file CREDITS.
14  */
15
16 #include <config.h>
17
18 #include "GuiToolbar.h"
19
20 #include "Action.h"
21 #include "Buffer.h"
22 #include "BufferParams.h"
23 #include "BufferView.h"
24 #include "Cursor.h"
25 #include "CutAndPaste.h"
26 #include "FuncRequest.h"
27 #include "FuncStatus.h"
28 #include "GuiApplication.h"
29 #include "GuiCommandBuffer.h"
30 #include "GuiView.h"
31 #include "IconPalette.h"
32 #include "InsertTableWidget.h"
33 #include "KeyMap.h"
34 #include "LayoutBox.h"
35 #include "LyX.h"
36 #include "LyXRC.h"
37 #include "qt_helpers.h"
38 #include "Session.h"
39 #include "Text.h"
40 #include "TextClass.h"
41 #include "Toolbars.h"
42
43 #include "insets/InsetText.h"
44
45 #include "support/convert.h"
46 #include "support/debug.h"
47 #include "support/docstring_list.h"
48 #include "support/gettext.h"
49 #include "support/lstrings.h"
50
51 #include <QSettings>
52 #include <QShowEvent>
53 #include <QString>
54 #include <QToolBar>
55 #include <QToolButton>
56
57 #include "support/lassert.h"
58
59 using namespace std;
60 using namespace lyx::support;
61
62 namespace lyx {
63 namespace frontend {
64
65 QIcon DynamicMenuButton::icon_textstyle_apply_;
66 QIcon DynamicMenuButton::icon_undo_;
67 QIcon DynamicMenuButton::icon_paste_;
68
69
70 GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiView & owner)
71         : QToolBar(toqstr(tbinfo.gui_name), &owner), visibility_(0),
72           owner_(owner), command_buffer_(nullptr), tbinfo_(tbinfo), filled_(false),
73           restored_(false)
74 {
75         setIconSize(owner.iconSize());
76         connect(&owner, SIGNAL(iconSizeChanged(QSize)), this,
77                 SLOT(setIconSize(QSize)));
78
79         // This is used by QMainWindow::restoreState for proper main window state
80         // restoration.
81         setObjectName(toqstr(tbinfo.name));
82         restoreSession();
83 }
84
85
86 void GuiToolbar::setVisible(bool visible)
87 {
88         // This is a hack to find out which toolbars have been restored by
89         // MainWindow::restoreState and which toolbars should be initialized
90         // by us (i.e., new toolbars)
91         restored_ = true;
92         // Record the actual visibility in toolbar state visibility_.
93         // This is useful to restore the visibility of toolbars when
94         // returning from full-screen. Therefore the recording is disabled
95         // while LyX is in full-screen state.
96         if (!owner_.isFullScreen()) {
97                 if (visible)
98                         visibility_ |= Toolbars::ON;
99                 else
100                         visibility_ &= ~Toolbars::ON;
101         }
102         QToolBar::setVisible(visible);
103 }
104
105
106 bool GuiToolbar::isRestored() const
107 {
108         return restored_;
109 }
110
111
112 void GuiToolbar::fill()
113 {
114         if (filled_)
115                 return;
116         ToolbarInfo::item_iterator it = tbinfo_.items.begin();
117         ToolbarInfo::item_iterator end = tbinfo_.items.end();
118         for (; it != end; ++it)
119                 add(*it);
120         filled_ = true;
121 }
122
123
124 void GuiToolbar::refill()
125 {
126         filled_ = false;
127         clear();
128         fill();
129 }
130
131
132 void GuiToolbar::showEvent(QShowEvent * ev)
133 {
134         fill();
135         ev->accept();
136 }
137
138
139 void GuiToolbar::setVisibility(int visibility)
140 {
141         visibility_ = visibility;
142 }
143
144
145 Action * GuiToolbar::addItem(ToolbarItem const & item, bool menu)
146 {
147         QString text = toqstr(item.label);
148         QString tooltip = text;
149         // Get the keys bound to this action, but keep only the
150         // first one later
151         KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(*item.func);
152         if (!bindings.empty()) {
153                 QString binding = toqstr(bindings.begin()->print(KeySequence::ForGui));
154                 if (menu)
155                         text += '\t' + binding;
156                 else
157                         tooltip += " [" + binding + "]";
158         }
159
160         Action * act = new Action(item.func, getIcon(*item.func, false), text,
161                                   tooltip, this);
162         if (item.type == ToolbarItem::BIDICOMMAND)
163                 act->setRtlIcon(getIcon(*item.func, false, true));
164
165         actions_.append(act);
166         return act;
167 }
168
169 namespace {
170
171 class PaletteButton : public QToolButton
172 {
173 private:
174         GuiToolbar * bar_;
175         ToolbarItem const & tbitem_;
176         bool initialized_;
177 public:
178         PaletteButton(GuiToolbar * bar, ToolbarItem const & item)
179                 : QToolButton(bar), bar_(bar), tbitem_(item), initialized_(false)
180         {
181                 QString const label = qt_(to_ascii(tbitem_.label));
182                 setToolTip(label);
183                 setStatusTip(label);
184                 setText(label);
185                 connect(bar_, SIGNAL(iconSizeChanged(QSize)),
186                         this, SLOT(setIconSize(QSize)));
187                 setCheckable(true);
188                 ToolbarInfo const * tbinfo = guiApp->toolbars().info(tbitem_.name);
189                 if (tbinfo)
190                         // use the icon of first action for the toolbar button
191                         setIcon(getIcon(*tbinfo->items.begin()->func, true));
192         }
193
194         void mousePressEvent(QMouseEvent * e) override
195         {
196                 if (initialized_) {
197                         QToolButton::mousePressEvent(e);
198                         return;
199                 }
200
201                 initialized_ = true;
202
203                 ToolbarInfo const * tbinfo = guiApp->toolbars().info(tbitem_.name);
204                 if (!tbinfo) {
205                         LYXERR0("Unknown toolbar " << tbitem_.name);
206                         return;
207                 }
208                 IconPalette * panel = new IconPalette(this);
209                 QString const label = qt_(to_ascii(tbitem_.label));
210                 panel->setWindowTitle(label);
211                 connect(this, SIGNAL(clicked(bool)), panel, SLOT(setVisible(bool)));
212                 connect(panel, SIGNAL(visible(bool)), this, SLOT(setChecked(bool)));
213                 ToolbarInfo::item_iterator it = tbinfo->items.begin();
214                 ToolbarInfo::item_iterator const end = tbinfo->items.end();
215                 for (; it != end; ++it)
216                         if (!getStatus(*it->func).unknown())
217                                 panel->addButton(bar_->addItem(*it));
218
219                 QToolButton::mousePressEvent(e);
220         }
221 };
222
223 } // namespace
224
225
226 MenuButtonBase::MenuButtonBase(GuiToolbar * bar, ToolbarItem const & item)
227         : QToolButton(bar), bar_(bar), tbitem_(item)
228 {
229         setPopupMode(QToolButton::InstantPopup);
230         QString const label = qt_(to_ascii(tbitem_.label));
231         setToolTip(label);
232         setStatusTip(label);
233         setText(label);
234         QString const name = toqstr(tbitem_.name);
235         QStringList imagedirs;
236         imagedirs << "images/math/" << "images/";
237         for (int i = 0; i < imagedirs.size(); ++i) {
238                 QString imagedir = imagedirs.at(i);
239                 FileName const fname = imageLibFileSearch(imagedir, name, "svgz,png",
240                         theGuiApp()->imageSearchMode());
241                 if (fname.exists()) {
242                         setIcon(QIcon(getPixmap(imagedir, name, "svgz,png")));
243                         break;
244                 }
245         }
246 }
247
248
249 void MenuButtonBase::actionTriggered(QAction * action)
250 {
251         QToolButton::setDefaultAction(action);
252         setPopupMode(QToolButton::DelayedPopup);
253 }
254
255
256 StaticMenuButton::StaticMenuButton(
257     GuiToolbar * bar, ToolbarItem const & item, bool const sticky)
258         : MenuButtonBase(bar, item)
259 {
260         if (sticky)
261                 connect(this, SIGNAL(triggered(QAction *)),
262                         this, SLOT(actionTriggered(QAction *)));
263         connect(bar, SIGNAL(iconSizeChanged(QSize)),
264                 this, SLOT(setIconSize(QSize)));
265         initialize();
266 }
267
268
269 void StaticMenuButton::initialize()
270 {
271         QString const label = qt_(to_ascii(tbitem_.label));
272         ButtonMenu * m = new ButtonMenu(label, this);
273         m->setWindowTitle(label);
274         m->setTearOffEnabled(true);
275         connect(bar_, SIGNAL(updated()), m, SLOT(updateParent()));
276         connect(bar_, SIGNAL(updated()), this, SLOT(updateTriggered()));
277         ToolbarInfo const * tbinfo = guiApp->toolbars().info(tbitem_.name);
278         if (!tbinfo) {
279                 LYXERR0("Unknown toolbar " << tbitem_.name);
280                 return;
281         }
282         ToolbarInfo::item_iterator it = tbinfo->items.begin();
283         ToolbarInfo::item_iterator const end = tbinfo->items.end();
284         for (; it != end; ++it)
285                 if (!getStatus(*it->func).unknown())
286                         m->add(bar_->addItem(*it, true));
287         setMenu(m);
288 }
289
290
291 void StaticMenuButton::updateTriggered()
292 {
293         if (!menu())
294                 return;
295
296         bool enabled = false;
297         QList<QAction *> acts = menu()->actions();
298         for (auto const & act : acts)
299                 if (act->isEnabled()) {
300                         enabled = true;
301                         break;
302                 }
303         // Enable the MenuButton if at least one menu item is enabled
304         setEnabled(enabled);
305         // If a disabled item is default, switch to InstantPopup
306         // (this can happen if a user selects e.g. DVI and then
307         // turns non-TeX fonts on)
308         if (defaultAction() && !defaultAction()->isEnabled())
309                 setPopupMode(QToolButton::InstantPopup);
310 }
311
312
313 class DynamicMenuButton::Private
314 {
315         /// noncopyable
316         Private(Private const &);
317         void operator=(Private const &);
318 public:
319         Private() : inset_(nullptr) {}
320         ///
321         DocumentClassConstPtr text_class_;
322         ///
323         InsetText const * inset_;
324 };
325
326
327 DynamicMenuButton::DynamicMenuButton(GuiToolbar * bar, ToolbarItem const & item)
328         : MenuButtonBase(bar, item), d(new Private())
329 {
330         initialize();
331 }
332
333
334 DynamicMenuButton::~DynamicMenuButton() 
335
336         delete d;
337 }
338
339
340 void DynamicMenuButton::initialize()
341 {
342         QString const label = qt_(to_ascii(tbitem_.label));
343         ButtonMenu * m = new ButtonMenu(label, this);
344         m->setWindowTitle(label);
345         m->setTearOffEnabled(true);
346         connect(bar_, SIGNAL(updated()), m, SLOT(updateParent()));
347         connect(bar_, SIGNAL(updated()), this, SLOT(updateTriggered()));
348         connect(bar_, SIGNAL(iconSizeChanged(QSize)),
349                 this, SLOT(setIconSize(QSize)));
350         setMenu(m);
351 }
352
353
354 bool DynamicMenuButton::isMenuType(string const & s)
355 {
356         return s == "dynamic-custom-insets"
357                 || s == "dynamic-char-styles"
358                 || s == "textstyle-apply"
359                 || s == "paste";
360 }
361
362
363 void DynamicMenuButton::resetIconCache()
364 {
365         icon_textstyle_apply_ = getIcon(FuncRequest(LFUN_TEXTSTYLE_APPLY), false);
366         icon_undo_ =  getIcon(FuncRequest(LFUN_UNDO), false);
367         icon_paste_ = getIcon(FuncRequest(LFUN_PASTE), false);
368 }
369
370
371 void DynamicMenuButton::updateTriggered()
372 {
373         QMenu * m = menu();
374         // the menu should exist by this point
375         // if not, we can at least avoid crashing in release mode
376         LASSERT(m, return);
377         GuiView const & owner = bar_->owner();
378         BufferView const * bv = owner.currentBufferView();
379
380         string const & menutype = tbitem_.name;
381         if (menutype == "dynamic-custom-insets" || menutype == "dynamic-char-styles") {
382                 if (!bv) {
383                         m->clear();
384                         setEnabled(false);
385                         setMinimumWidth(sizeHint().width());
386                         d->text_class_.reset();
387                         d->inset_ = nullptr;
388                         return;
389                 }
390                 DocumentClassConstPtr text_class =
391                                 bv->buffer().params().documentClassPtr();
392                 InsetText const * inset = &(bv->cursor().innerText()->inset());
393                 // if the text class has changed, then we need to reload the menu
394                 if (d->text_class_ != text_class) {
395                         d->text_class_ = text_class;
396                         // at the moment, we can just call loadFlexInsets, and it will
397                         // handle both types. if there were more types of menus, then we
398                         // might need to have other options.
399                         loadFlexInsets();
400                 }
401                 // remember where we are
402                 d->inset_ = inset;
403                 // note that enabling here might need to be more subtle if there
404                 // were other kinds of menus.
405                 setEnabled(!bv->buffer().isReadonly()
406                            && !m->isEmpty()
407                            && inset->insetAllowed(FLEX_CODE));
408         } else if (menutype == "textstyle-apply") {
409                 m->clear();
410                 setPopupMode(QToolButton::MenuButtonPopup);
411                 if (!bv) {
412                         QToolButton::setIcon(icon_textstyle_apply_);
413                         setEnabled(false);
414                         return;
415                 }
416                 vector<docstring> ffList = bv->cursor().innerText()->getFreeFonts();
417                 unsigned int i = 0;
418                 Action * default_act = nullptr;
419                 for (auto const & f : ffList) {
420                         FuncRequest func(LFUN_TEXTSTYLE_APPLY, convert<docstring>(i),
421                                          FuncRequest::TOOLBAR);
422                         docstring const lb = char_type('&') + convert<docstring>(i)
423                                 + from_ascii(". ") + f ;
424                         Action * act = new Action(func, QIcon(), toqstr(lb), toqstr(f), this);
425                         m->addAction(act);
426                         // The most recent one is the default
427                         if (i == 0)
428                                 default_act = act;
429                         ++i;
430                 }
431                 // Add item to reset to defaults
432                 Action * reset_act = new Action(FuncRequest(LFUN_FONT_DEFAULT, FuncRequest::TOOLBAR),
433                                                 icon_undo_,
434                                                 qt_("&Reset to default"),
435                                                 qt_("Reset all font settings to their defaults"), this);
436                 m->addAction(reset_act);
437                 if (default_act)
438                         QToolButton::setDefaultAction(default_act);
439                 QToolButton::setIcon(icon_textstyle_apply_);
440                 setEnabled(lyx::getStatus(FuncRequest(LFUN_TEXTSTYLE_APPLY)).enabled()
441                            || lyx::getStatus(FuncRequest(LFUN_FONT_DEFAULT)).enabled());
442         } else if (menutype == "paste") {
443                 m->clear();
444                 setPopupMode(QToolButton::MenuButtonPopup);
445                 Action * default_action = new Action(FuncRequest(LFUN_PASTE),
446                                                      icon_paste_,
447                                                      qt_("Paste"), qt_("Paste"), this);
448                 if (!bv) {
449                         setEnabled(false);
450                         QToolButton::setDefaultAction(default_action);
451                         return;
452                 }
453                 docstring_list const sel = cap::availableSelections(&bv->buffer());
454
455                 docstring_list::const_iterator cit = sel.begin();
456                 docstring_list::const_iterator end = sel.end();
457
458                 for (unsigned int index = 0; cit != end; ++cit, ++index) {
459                         docstring const s = *cit;
460                         FuncRequest func(LFUN_PASTE, convert<docstring>(index),
461                                          FuncRequest::TOOLBAR);
462                         docstring const lb = char_type('&') + convert<docstring>(index)
463                                 + from_ascii(". ") + s ;
464                         Action * act = new Action(func, QIcon(), toqstr(lb), toqstr(s), this);
465                         m->addAction(act);
466                 }
467                 QToolButton::setDefaultAction(default_action);
468                 setEnabled(lyx::getStatus(FuncRequest(LFUN_PASTE)).enabled());
469         }
470 }
471
472
473 void DynamicMenuButton::loadFlexInsets()
474 {
475         QMenu * m = menu();
476         m->clear();
477         string const & menutype = tbitem_.name;
478         InsetLyXType ftype;
479         if (menutype == "dynamic-custom-insets")
480                 ftype = InsetLyXType::CUSTOM;
481         else if (menutype == "dynamic-char-styles")
482                 ftype = InsetLyXType::CHARSTYLE;
483         else {
484                 // this should have been taken care of earlier
485                 LASSERT(false, return);
486         }
487
488         TextClass::InsetLayouts const & inset_layouts = 
489                         d->text_class_->insetLayouts();
490         for (auto const & iit : inset_layouts) {
491                 InsetLayout const & il = iit.second;
492                 if (il.lyxtype() != ftype)
493                         continue;
494                 docstring const name = iit.first;
495                 QString const loc_item = toqstr(translateIfPossible(
496                                 prefixIs(name, from_ascii("Flex:")) ? 
497                                 name.substr(5) : name));
498                 FuncRequest func(LFUN_FLEX_INSERT, 
499                                 from_ascii("\"") + name + from_ascii("\""), FuncRequest::TOOLBAR);
500                 Action * act = 
501                                 new Action(func, getIcon(func, false), loc_item, loc_item, this);
502                 m->addAction(act);
503         }
504 }
505
506
507 void GuiToolbar::add(ToolbarItem const & item)
508 {
509         switch (item.type) {
510         case ToolbarItem::SEPARATOR:
511                 addSeparator();
512                 break;
513         case ToolbarItem::LAYOUTS: {
514                 LayoutBox * layout = owner_.getLayoutDialog();
515                 QObject::connect(this, SIGNAL(iconSizeChanged(QSize)),
516                         layout, SLOT(setIconSize(QSize)));
517                 QAction * action = addWidget(layout);
518                 action->setVisible(true);
519                 break;
520         }
521         case ToolbarItem::MINIBUFFER:
522                 command_buffer_ = new GuiCommandBuffer(&owner_);
523                 addWidget(command_buffer_);
524                 /// \todo find a Qt4 equivalent to setHorizontalStretchable(true);
525                 //setHorizontalStretchable(true);
526                 break;
527         case ToolbarItem::TABLEINSERT: {
528                 QToolButton * tb = new QToolButton;
529                 tb->setCheckable(true);
530                 tb->setIcon(getIcon(FuncRequest(LFUN_TABULAR_INSERT), true));
531                 QString const label = qt_(to_ascii(item.label));
532                 tb->setToolTip(label);
533                 tb->setStatusTip(label);
534                 tb->setText(label);
535                 InsertTableWidget * iv = new InsertTableWidget(tb);
536                 connect(tb, SIGNAL(clicked(bool)), iv, SLOT(show(bool)));
537                 connect(iv, SIGNAL(visible(bool)), tb, SLOT(setChecked(bool)));
538                 connect(this, SIGNAL(updated()), iv, SLOT(updateParent()));
539                 addWidget(tb);
540                 break;
541                 }
542         case ToolbarItem::ICONPALETTE:
543                 addWidget(new PaletteButton(this, item));
544                 break;
545         case ToolbarItem::POPUPMENU: {
546                 addWidget(new StaticMenuButton(this, item, false));
547                 break;
548                 }
549         case ToolbarItem::STICKYPOPUPMENU: {
550                 addWidget(new StaticMenuButton(this, item, true));
551                 break;
552                 }
553         case ToolbarItem::DYNAMICMENU: {
554                 // we only handle certain things
555                 if (DynamicMenuButton::isMenuType(item.name))
556                         addWidget(new DynamicMenuButton(this, item));
557                 else
558                         LYXERR0("Unknown dynamic menu type: " << item.name);
559                 break;
560         }
561         case ToolbarItem::BIDICOMMAND: {
562                 if (!getStatus(*item.func).unknown())
563                         addAction(addItem(item));
564                 break;
565                 }
566         case ToolbarItem::COMMAND: {
567                 if (!getStatus(*item.func).unknown())
568                         addAction(addItem(item));
569                 break;
570                 }
571         default:
572                 break;
573         }
574 }
575
576
577 void GuiToolbar::update(int context)
578 {
579         if (visibility_ & Toolbars::AUTO) {
580                 setVisible(visibility_ & context & Toolbars::ALLOWAUTO);
581                 if (isVisible() && commandBuffer() && (context & Toolbars::MINIBUFFER_FOCUS))
582                         commandBuffer()->setFocus();
583         }
584
585         // update visible toolbars only
586         if (!isVisible())
587                 return;
588
589         // This is a speed bottleneck because this is called on every keypress
590         // and update calls getStatus, which copies the cursor at least two times
591         for (auto const & action : actions_)
592                 action->update();
593
594         LayoutBox * layout = owner_.getLayoutDialog();
595         if (layout)
596                 layout->setEnabled(lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled());
597
598         // emit signal
599         updated();
600 }
601
602
603 QString GuiToolbar::sessionKey() const
604 {
605         return "views/" + QString::number(owner_.id()) + "/" + objectName();
606 }
607
608
609 void GuiToolbar::saveSession(QSettings & settings) const
610 {
611         settings.setValue(sessionKey() + "/visibility", visibility_);
612         settings.setValue(sessionKey() + "/movability", isMovable());
613 }
614
615
616 void GuiToolbar::restoreSession()
617 {
618         QSettings settings;
619         int const error_val = -1;
620         int visibility =
621                 settings.value(sessionKey() + "/visibility", error_val).toInt();
622         if (visibility == error_val || visibility == 0) {
623                 // This should not happen, but in case we use the defaults
624                 LYXERR(Debug::GUI, "Session settings could not be found! Defaults are used instead.");
625                 visibility =
626                         guiApp->toolbars().defaultVisibility(fromqstr(objectName()));
627         }
628         setVisibility(visibility);
629
630         int movability = settings.value(sessionKey() + "/movability", true).toBool();
631         setMovable(movability);
632 }
633
634
635 bool GuiToolbar::isVisibilityOn() const
636 {
637         return visibility_ & Toolbars::ON;
638 }
639
640
641 void GuiToolbar::setState(string const state)
642 {
643         docstring newstate;
644         if (state == "auto") {
645                 if (visibility_ & Toolbars::ALLOWAUTO) {
646                         visibility_ |= Toolbars::AUTO;
647                         hide();
648                         newstate = _("auto");
649                 } else
650                         owner_.message(bformat(_("Toolbar \"%1$s\" does not support state \"auto\""),
651                                 qstring_to_ucs4(windowTitle())));
652         } else {
653                 if (visibility_ & Toolbars::AUTO)
654                         visibility_ &= ~Toolbars::AUTO;
655                 if (state == "off") {
656                         hide();
657                         newstate = _("off");
658                 } else if (state == "on") {
659                         show();
660                         newstate = _("on");
661                 }
662         }
663
664         owner_.message(bformat(_("Toolbar \"%1$s\" state set to %2$s"),
665                 qstring_to_ucs4(windowTitle()), newstate));
666 }
667
668
669 void GuiToolbar::toggle()
670 {
671         if (visibility_ & Toolbars::ALLOWAUTO) {
672                 if (!(visibility_ & Toolbars::AUTO) && !isVisibilityOn()) {
673                         setState("auto");
674                 } else {
675                         if (isVisibilityOn())
676                                 setState("off");
677                         else
678                                 setState("on");
679                 }
680         } else {
681                 if (isVisible())
682                         setState("off");
683                 else
684                         setState("on");
685         }
686 }
687
688 void GuiToolbar::movable(bool silent)
689 {
690         // toggle movability
691         setMovable(!isMovable());
692
693         // manual update avoids bug in qt that the drag handle is not removed
694         // properly, e.g. in Windows
695         Q_EMIT update();
696
697         // silence for toggling of many toolbars for performance
698         if (!silent) {
699                 docstring state;
700                 if (isMovable())
701                         state = _("movable");
702                 else
703                         state = _("immovable");
704                 owner_.message(bformat(_("Toolbar \"%1$s\" state set to %2$s"),
705                         qstring_to_ucs4(windowTitle()), state));
706         }
707 }
708
709 } // namespace frontend
710 } // namespace lyx
711
712 #include "moc_GuiToolbar.cpp"