mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Amend fix for #10428
- Allow using logical values for icon sizes as the standard sizes may differ among different icon sets - Do not allow setting sizes smaller than smallIconSize When the logical sizes differ and the icon set is changed, the correct sizes are established only after a restart.
This commit is contained in:
parent
38199c8bfe
commit
6c92075799
@ -665,11 +665,11 @@ Menuset
|
|||||||
Menu "context-toolbars"
|
Menu "context-toolbars"
|
||||||
Toolbars
|
Toolbars
|
||||||
Separator
|
Separator
|
||||||
Item "Small-sized Icons" "icon-size 16"
|
Item "Small-sized Icons" "icon-size small"
|
||||||
Item "Normal-sized Icons" "icon-size 20"
|
Item "Normal-sized Icons" "icon-size normal"
|
||||||
Item "Big-sized Icons" "icon-size 26"
|
Item "Big-sized Icons" "icon-size big"
|
||||||
Item "Huge-sized Icons" "icon-size 32"
|
Item "Huge-sized Icons" "icon-size huge"
|
||||||
Item "Giant-sized Icons" "icon-size 48"
|
Item "Giant-sized Icons" "icon-size giant"
|
||||||
End
|
End
|
||||||
|
|
||||||
End
|
End
|
||||||
|
@ -351,11 +351,11 @@ Menuset
|
|||||||
Menu "toolbars"
|
Menu "toolbars"
|
||||||
Toolbars
|
Toolbars
|
||||||
Separator
|
Separator
|
||||||
Item "Small-sized Icons" "icon-size 16"
|
Item "Small-sized Icons" "icon-size small"
|
||||||
Item "Normal-sized Icons" "icon-size 20"
|
Item "Normal-sized Icons" "icon-size normal"
|
||||||
Item "Big-sized Icons" "icon-size 26"
|
Item "Big-sized Icons" "icon-size big"
|
||||||
Item "Huge-sized Icons" "icon-size 32"
|
Item "Huge-sized Icons" "icon-size huge"
|
||||||
Item "Giant-sized Icons" "icon-size 48"
|
Item "Giant-sized Icons" "icon-size giant"
|
||||||
End
|
End
|
||||||
#
|
#
|
||||||
# INSERT MENU
|
# INSERT MENU
|
||||||
|
@ -2749,7 +2749,9 @@ void LyXAction::init()
|
|||||||
* \var lyx::FuncCode lyx::LFUN_ICON_SIZE
|
* \var lyx::FuncCode lyx::LFUN_ICON_SIZE
|
||||||
* \li Action: Sets icon size of toolbars.
|
* \li Action: Sets icon size of toolbars.
|
||||||
* \li Syntax: icon-size [<SIZE>]
|
* \li Syntax: icon-size [<SIZE>]
|
||||||
* \li Params: <SIZE> : the icon size in px, the default is 20 (normalIconSize).
|
* \li Params: <SIZE> : the icon size in px or one of the logical settings
|
||||||
|
small|normal|big|huge|giant, the default is normal
|
||||||
|
(whose size in px is icon set dependent).
|
||||||
* \li Origin: 11 July 2016
|
* \li Origin: 11 July 2016
|
||||||
* \endvar
|
* \endvar
|
||||||
*/
|
*/
|
||||||
|
@ -383,6 +383,60 @@ public:
|
|||||||
processing_thread_watcher_.setFuture(f);
|
processing_thread_watcher_.setFuture(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSize iconSize(docstring const & icon_size)
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
if (icon_size == "small")
|
||||||
|
size = smallIconSize;
|
||||||
|
else if (icon_size == "normal")
|
||||||
|
size = normalIconSize;
|
||||||
|
else if (icon_size == "big")
|
||||||
|
size = bigIconSize;
|
||||||
|
else if (icon_size == "huge")
|
||||||
|
size = hugeIconSize;
|
||||||
|
else if (icon_size == "giant")
|
||||||
|
size = giantIconSize;
|
||||||
|
else
|
||||||
|
size = icon_size.empty() ? normalIconSize : convert<int>(icon_size);
|
||||||
|
|
||||||
|
if (size < smallIconSize)
|
||||||
|
size = smallIconSize;
|
||||||
|
|
||||||
|
return QSize(size, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize iconSize(QString const & icon_size)
|
||||||
|
{
|
||||||
|
return iconSize(qstring_to_ucs4(icon_size));
|
||||||
|
}
|
||||||
|
|
||||||
|
string & iconSize(QSize const & qsize)
|
||||||
|
{
|
||||||
|
LATTEST(qsize.width() == qsize.height());
|
||||||
|
|
||||||
|
static string icon_size;
|
||||||
|
|
||||||
|
int size = qsize.width();
|
||||||
|
|
||||||
|
if (size < smallIconSize)
|
||||||
|
size = smallIconSize;
|
||||||
|
|
||||||
|
if (size == smallIconSize)
|
||||||
|
icon_size = "small";
|
||||||
|
else if (size == normalIconSize)
|
||||||
|
icon_size = "normal";
|
||||||
|
else if (size == bigIconSize)
|
||||||
|
icon_size = "big";
|
||||||
|
else if (size == hugeIconSize)
|
||||||
|
icon_size = "huge";
|
||||||
|
else if (size == giantIconSize)
|
||||||
|
icon_size = "giant";
|
||||||
|
else
|
||||||
|
icon_size = convert<string>(size);
|
||||||
|
|
||||||
|
return icon_size;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiView * gv_;
|
GuiView * gv_;
|
||||||
GuiWorkArea * current_work_area_;
|
GuiWorkArea * current_work_area_;
|
||||||
@ -668,7 +722,7 @@ void GuiView::saveLayout() const
|
|||||||
settings.setValue("geometry", saveGeometry());
|
settings.setValue("geometry", saveGeometry());
|
||||||
#endif
|
#endif
|
||||||
settings.setValue("layout", saveState(0));
|
settings.setValue("layout", saveState(0));
|
||||||
settings.setValue("icon_size", iconSize());
|
settings.setValue("icon_size", toqstr(d.iconSize(iconSize())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -695,9 +749,7 @@ bool GuiView::restoreLayout()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
//code below is skipped when when ~/.config/LyX is (re)created
|
//code below is skipped when when ~/.config/LyX is (re)created
|
||||||
QSize icon_size = settings.value(icon_key).toSize();
|
setIconSize(d.iconSize(settings.value(icon_key).toString()));
|
||||||
// Check whether session size changed.
|
|
||||||
setIconSize(icon_size);
|
|
||||||
|
|
||||||
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
#if defined(Q_WS_X11) || defined(QPA_XCB)
|
||||||
QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
|
QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
|
||||||
@ -1828,11 +1880,9 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_ICON_SIZE: {
|
case LFUN_ICON_SIZE:
|
||||||
int const size = cmd.argument().empty() ? d.normalIconSize : convert<int>(cmd.argument());
|
flag.setOnOff(d.iconSize(cmd.argument()) == iconSize());
|
||||||
flag.setOnOff(QSize(size, size) == iconSize());
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case LFUN_DROP_LAYOUTS_CHOICE:
|
case LFUN_DROP_LAYOUTS_CHOICE:
|
||||||
enable = buf != 0;
|
enable = buf != 0;
|
||||||
@ -3729,20 +3779,10 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_ICON_SIZE: {
|
case LFUN_ICON_SIZE: {
|
||||||
int const size = cmd.argument().empty() ? d.normalIconSize : convert<int>(cmd.argument());
|
QSize size = d.iconSize(cmd.argument());
|
||||||
setIconSize(QSize(size, size));
|
setIconSize(size);
|
||||||
if (size == d.smallIconSize)
|
dr.setMessage(bformat(_("Icon size set to %1$dx%2$d."),
|
||||||
dr.setMessage("Icon size set to small");
|
size.width(), size.height()));
|
||||||
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user