delete stack_widget_;
}
- QMenu * toolBarPopup(GuiView * parent)
- {
- // FIXME: translation
- QMenu * menu = new QMenu(parent);
- QActionGroup * iconSizeGroup = new QActionGroup(parent);
-
- QAction * smallIcons = new QAction(iconSizeGroup);
- smallIcons->setText(qt_("Small-sized icons"));
- smallIcons->setCheckable(true);
- QObject::connect(smallIcons, SIGNAL(triggered()),
- parent, SLOT(smallSizedIcons()));
- menu->addAction(smallIcons);
-
- QAction * normalIcons = new QAction(iconSizeGroup);
- normalIcons->setText(qt_("Normal-sized icons"));
- normalIcons->setCheckable(true);
- QObject::connect(normalIcons, SIGNAL(triggered()),
- parent, SLOT(normalSizedIcons()));
- menu->addAction(normalIcons);
-
- QAction * bigIcons = new QAction(iconSizeGroup);
- bigIcons->setText(qt_("Big-sized icons"));
- bigIcons->setCheckable(true);
- QObject::connect(bigIcons, SIGNAL(triggered()),
- parent, SLOT(bigSizedIcons()));
- menu->addAction(bigIcons);
-
- QAction * hugeIcons = new QAction(iconSizeGroup);
- hugeIcons->setText(qt_("Huge-sized icons"));
- hugeIcons->setCheckable(true);
- QObject::connect(hugeIcons, SIGNAL(triggered()),
- parent, SLOT(hugeSizedIcons()));
- menu->addAction(hugeIcons);
-
- QAction * giantIcons = new QAction(iconSizeGroup);
- giantIcons->setText(qt_("Giant-sized icons"));
- giantIcons->setCheckable(true);
- QObject::connect(giantIcons, SIGNAL(triggered()),
- parent, SLOT(giantSizedIcons()));
- menu->addAction(giantIcons);
-
- unsigned int cur = parent->iconSize().width();
- if ( cur == parent->d.smallIconSize)
- smallIcons->setChecked(true);
- else if (cur == parent->d.normalIconSize)
- normalIcons->setChecked(true);
- else if (cur == parent->d.bigIconSize)
- bigIcons->setChecked(true);
- else if (cur == parent->d.hugeIconSize)
- hugeIcons->setChecked(true);
- else if (cur == parent->d.giantIconSize)
- giantIcons->setChecked(true);
-
- return menu;
- }
-
void setBackground()
{
stack_widget_->setCurrentWidget(bg_widget_);
this, SLOT(onBufferViewChanged()));
// GuiToolbars *must* be initialised before the menu bar.
- normalSizedIcons(); // at least on Mac the default is 32 otherwise, which is huge
+ setIconSize(QSize(d.normalIconSize, d.normalIconSize)); // at least on Mac the default is 32 otherwise, which is huge
constructToolbars();
// set ourself as the current view. This is needed for the menu bar
connect(this, SIGNAL(triggerShowDialog(QString const &, QString const &, Inset *)),
SLOT(doShowDialog(QString const &, QString const &, Inset *)));
+ // set custom application bars context menu, e.g. tool bar and menu bar
+ setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
+ SLOT(toolBarPopup(const QPoint &)));
+
// Forbid too small unresizable window because it can happen
// with some window manager under X11.
setMinimumSize(300, 200);
//code below is skipped when when ~/.config/LyX is (re)created
QSize icon_size = settings.value(icon_key).toSize();
// Check whether session size changed.
- if (icon_size.width() != int(d.smallIconSize) &&
- icon_size.width() != int(d.normalIconSize) &&
- icon_size.width() != int(d.bigIconSize) &&
- icon_size.width() != int(d.hugeIconSize) &&
- icon_size.width() != int(d.giantIconSize)) {
- icon_size.setWidth(d.normalIconSize);
- icon_size.setHeight(d.normalIconSize);
- }
setIconSize(icon_size);
#if defined(Q_WS_X11) || defined(QPA_XCB)
}
-QMenu * GuiView::createPopupMenu()
-{
- return d.toolBarPopup(this);
-}
-
-
void GuiView::showEvent(QShowEvent * e)
{
LYXERR(Debug::GUI, "Passed Geometry "
}
-void GuiView::smallSizedIcons()
-{
- setIconSize(QSize(d.smallIconSize, d.smallIconSize));
-}
-
-
-void GuiView::normalSizedIcons()
-{
- setIconSize(QSize(d.normalIconSize, d.normalIconSize));
-}
-
-
-void GuiView::bigSizedIcons()
-{
- setIconSize(QSize(d.bigIconSize, d.bigIconSize));
-}
-
-
-void GuiView::hugeSizedIcons()
-{
- setIconSize(QSize(d.hugeIconSize, d.hugeIconSize));
-}
-
-
-void GuiView::giantSizedIcons()
-{
- setIconSize(QSize(d.giantIconSize, d.giantIconSize));
-}
-
-
void GuiView::clearMessage()
{
// FIXME: This code was introduced in r19643 to fix bug #4123. However,
break;
}
+ case LFUN_ICON_SIZE: {
+ int const size = cmd.argument().empty() ? d.normalIconSize : convert<int>(cmd.argument());
+ flag.setOnOff(QSize(size, size) == iconSize());
+ break;
+ }
+
case LFUN_DROP_LAYOUTS_CHOICE:
enable = buf != 0;
break;
}
+void GuiView::toolBarPopup(const QPoint & pos)
+{
+ QMenu * menu = new QMenu;
+ menu = guiApp->menus().menu(toqstr("context-toolbars"), * this);
+ menu->exec(QCursor::pos());
+}
+
+
template<class T>
Buffer::ExportStatus GuiView::GuiViewPrivate::runAndDestroy(const T& func, Buffer const * orig, Buffer * clone, string const & format)
{
break;
}
+ case LFUN_ICON_SIZE: {
+ int const size = cmd.argument().empty() ? d.normalIconSize : convert<int>(cmd.argument());
+ setIconSize(QSize(size, size));
+ if (size == d.smallIconSize)
+ dr.setMessage("Icon size set to small");
+ else if (size == d.normalIconSize)
+ dr.setMessage("Icon size set to normal");
+ else if (size == d.bigIconSize)
+ dr.setMessage("Icon size set to big");
+ else if (size == d.hugeIconSize)
+ dr.setMessage("Icon size set to huge");
+ else if (size == d.giantIconSize)
+ dr.setMessage("Icon size set to giant");
+ else
+ dr.setMessage(bformat(_("Icon size set to %1$d"), size));
+ break;
+ }
+
case LFUN_DIALOG_UPDATE: {
string const name = to_utf8(cmd.argument());
if (name == "prefs" || name == "document")