commit bb0117d182cae7da31228a03ac848f95fd77841a
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Thu Apr 16 19:21:54 2020 +0200
Simplify code for bidi icons
Most of the RtL icons that we provide are simply mirrors of the LtR ones.
Therefore let the code do that by default if no +rtl icon is found.
The only RtL icon left for now is for "layout Enumerate" (notice the
numbers in it).
Also remove useless getPixmap wrapper and several old bidi_xxx icons
that were forgotten in previous patch.
---
lib/Makefile.am | 18 ------------
lib/RELEASE-NOTES | 17 +++++++----
lib/images/bidi_ltr_layout-toggle_Labeling.svgz | Bin 1568 -> 0 bytes
lib/images/bidi_rtl_layout-toggle_Labeling.svgz | Bin 1857 -> 0 bytes
.../classic/bidi_ltr_layout-toggle_Labeling.png | Bin 199 -> 0 bytes
.../classic/bidi_rtl_layout-toggle_Labeling.png | Bin 158 -> 0 bytes
lib/images/classic/depth-decrement+rtl.png | Bin 202 -> 0 bytes
lib/images/classic/depth-increment+rtl.png | Bin 205 -> 0 bytes
.../classic/layout-toggle_Description+rtl.png | Bin 192 -> 0 bytes
lib/images/classic/layout-toggle_Itemize+rtl.png | Bin 183 -> 0 bytes
lib/images/classic/layout-toggle_Labeling+rtl.png | Bin 158 -> 0 bytes
lib/images/classic/layout-toggle_List+rtl.png | Bin 158 -> 0 bytes
lib/images/classic/layout-toggle_Section+rtl.png | Bin 238 -> 0 bytes
lib/images/depth-decrement+rtl.svgz | Bin 2339 -> 0 bytes
lib/images/depth-increment+rtl.svgz | Bin 2378 -> 0 bytes
lib/images/layout-toggle_Description+rtl.svgz | Bin 1848 -> 0 bytes
lib/images/layout-toggle_Itemize+rtl.svgz | Bin 1745 -> 0 bytes
lib/images/layout-toggle_Labeling+rtl.svgz | Bin 1857 -> 0 bytes
lib/images/layout-toggle_List+rtl.svgz | Bin 1857 -> 0 bytes
lib/images/layout-toggle_Section+rtl.svgz | Bin 3565 -> 0 bytes
.../oxygen/bidi_ltr_layout-toggle_Labeling.svgz | Bin 1677 -> 0 bytes
.../oxygen/bidi_rtl_layout-toggle_Labeling.svgz | Bin 1937 -> 0 bytes
lib/images/oxygen/depth-decrement+rtl.svgz | Bin 2245 -> 0 bytes
lib/images/oxygen/depth-increment+rtl.svgz | Bin 2331 -> 0 bytes
.../oxygen/layout-toggle_Description+rtl.svgz | Bin 1979 -> 0 bytes
lib/images/oxygen/layout-toggle_Itemize+rtl.svgz | Bin 2122 -> 0 bytes
lib/images/oxygen/layout-toggle_Labeling+rtl.svgz | Bin 1937 -> 0 bytes
lib/images/oxygen/layout-toggle_List+rtl.svgz | Bin 1937 -> 0 bytes
lib/images/oxygen/layout-toggle_Section+rtl.svgz | Bin 2712 -> 0 bytes
lib/ui/stdtoolbars.inc | 4 ++-
src/frontends/qt/GuiApplication.cpp | 30 ++++++++++++--------
src/frontends/qt/GuiApplication.h | 7 +----
src/frontends/qt/GuiToolbar.cpp | 2 +-
33 files changed, 34 insertions(+), 44 deletions(-)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index bdd28b3..1d420f5 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -568,9 +568,7 @@ dist_images_DATA1X = \
images/tab-group-close.svgz \
images/copy.svgz \
images/cut.svgz \
- images/depth-decrement+rtl.svgz \
images/depth-decrement.svgz \
- images/depth-increment+rtl.svgz \
images/depth-increment.svgz \
images/dialog-preferences.svgz \
images/dialog-show-new-inset_citation.svgz \
@@ -612,17 +610,13 @@ dist_images_DATA1X = \
images/layout-document.svgz \
images/layout-paragraph.svgz \
images/layout-toggle_Chunk.svgz \
- images/layout-toggle_Description+rtl.svgz \
images/layout-toggle_Description.svgz \
images/layout-toggle_Enumerate+rtl.svgz \
images/layout-toggle_Enumerate.svgz \
- images/layout-toggle_Itemize+rtl.svgz \
images/layout-toggle_Itemize.svgz \
- images/layout-toggle_Labeling+rtl.svgz \
images/layout-toggle_Labeling.svgz \
images/layout-toggle_List.svgz \
images/layout-toggle_LyX-Code.svgz \
- images/layout-toggle_Section+rtl.svgz \
images/layout-toggle_Section.svgz \
images/lyxfiles-system.svgz \
images/lyxfiles-user.svgz \
@@ -1860,9 +1854,7 @@ dist_imagesoxygen_DATA1X = \
images/oxygen/closetab.svgz \
images/oxygen/copy.svgz \
images/oxygen/cut.svgz \
- images/oxygen/depth-decrement+rtl.svgz \
images/oxygen/depth-decrement.svgz \
- images/oxygen/depth-increment+rtl.svgz \
images/oxygen/depth-increment.svgz \
images/oxygen/dialog-preferences.svgz \
images/oxygen/dialog-show-new-inset_citation.svgz \
@@ -1901,17 +1893,13 @@ dist_imagesoxygen_DATA1X = \
images/oxygen/layout-paragraph.svgz \
images/oxygen/layout.svgz \
images/oxygen/layout-toggle_Chunk.svgz \
- images/oxygen/layout-toggle_Description+rtl.svgz \
images/oxygen/layout-toggle_Description.svgz \
images/oxygen/layout-toggle_Enumerate+rtl.svgz \
images/oxygen/layout-toggle_Enumerate.svgz \
- images/oxygen/layout-toggle_Itemize+rtl.svgz \
images/oxygen/layout-toggle_Itemize.svgz \
- images/oxygen/layout-toggle_Labeling+rtl.svgz \
images/oxygen/layout-toggle_Labeling.svgz \
images/oxygen/layout-toggle_List.svgz \
images/oxygen/layout-toggle_LyX-Code.svgz \
- images/oxygen/layout-toggle_Section+rtl.svgz \
images/oxygen/layout-toggle_Section.svgz \
images/oxygen/lyx-quit.svgz \
images/oxygen/marginalnote-insert.svgz \
@@ -2071,9 +2059,7 @@ dist_imagesclassic_DATA = \
images/classic/tab-group-close.png \
images/classic/copy.png \
images/classic/cut.png \
- images/classic/depth-decrement+rtl.png \
images/classic/depth-decrement.png \
- images/classic/depth-increment+rtl.png \
images/classic/depth-increment.png \
images/classic/dialog-preferences.png \
images/classic/dialog-show_mathdelimiter.png \
@@ -2109,17 +2095,13 @@ dist_imagesclassic_DATA = \
images/classic/layout-paragraph.png \
images/classic/layout.png \
images/classic/layout-toggle_Chunk.png \
- images/classic/layout-toggle_Description+rtl.png \
images/classic/layout-toggle_Description.png \
images/classic/layout-toggle_Enumerate+rtl.png \
images/classic/layout-toggle_Enumerate.png \
- images/classic/layout-toggle_Itemize+rtl.png \
images/classic/layout-toggle_Itemize.png \
- images/classic/layout-toggle_Labeling+rtl.png \
images/classic/layout-toggle_Labeling.png \
images/classic/layout-toggle_List.png \
images/classic/layout-toggle_LyX-Code.png \
- images/classic/layout-toggle_Section+rtl.png \
images/classic/layout-toggle_Section.png \
images/classic/marginalnote-insert.png \
images/classic/master-buffer-update.png \
diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index 421ec9a..7584497 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -17,12 +17,13 @@
!!Documents compilation process and images conversion
-* LyX now uses utf8 encoding per default for all languages. This does not
affect
- existing documents. Note that LyX also does not touch personal defaults and
templates.
- That is to say, if you still see traditional encoding preset for new
documents,
- you can change that by selecting "Unicode (utf8) [default]" and hitting "Save
- as Documents Defaults" afterwards. Your personal templates need to be
changed manually
- if desired.
+* LyX now uses utf8 encoding per default for all languages. This does
+ not affect existing documents. Note that LyX also does not touch
+ personal defaults and templates. That is to say, if you still see
+ traditional encoding preset for new documents, you can change that
+ by selecting "Unicode (utf8) [default]" and hitting "Save as
+ Documents Defaults" afterwards. Your personal templates need to be
+ changed manually if desired.
* LyX defaults to the "HE8" LaTeX font encoding with Hebrew if the
"Culmus" LaTeX fonts are installed.
@@ -97,6 +98,10 @@
* date-insert: obsoleted by info-insert date.
+!!!The following LyX function has been added and then removed in 2.4
development cycle.
+
+* bidi: used as a first solution to provide icons that change
+ direction with language.
!!!The following LyX documents have been moved in 2.4:
diff --git a/lib/images/bidi_ltr_layout-toggle_Labeling.svgz
b/lib/images/bidi_ltr_layout-toggle_Labeling.svgz
deleted file mode 100644
index 5266ad5..0000000
Binary files a/lib/images/bidi_ltr_layout-toggle_Labeling.svgz and /dev/null
differ
diff --git a/lib/images/bidi_rtl_layout-toggle_Labeling.svgz
b/lib/images/bidi_rtl_layout-toggle_Labeling.svgz
deleted file mode 100644
index b24502f..0000000
Binary files a/lib/images/bidi_rtl_layout-toggle_Labeling.svgz and /dev/null
differ
diff --git a/lib/images/classic/bidi_ltr_layout-toggle_Labeling.png
b/lib/images/classic/bidi_ltr_layout-toggle_Labeling.png
deleted file mode 100644
index 6875511..0000000
Binary files a/lib/images/classic/bidi_ltr_layout-toggle_Labeling.png and
/dev/null differ
diff --git a/lib/images/classic/bidi_rtl_layout-toggle_Labeling.png
b/lib/images/classic/bidi_rtl_layout-toggle_Labeling.png
deleted file mode 100644
index 5f0c84e..0000000
Binary files a/lib/images/classic/bidi_rtl_layout-toggle_Labeling.png and
/dev/null differ
diff --git a/lib/images/classic/depth-decrement+rtl.png
b/lib/images/classic/depth-decrement+rtl.png
deleted file mode 100644
index c5c10d0..0000000
Binary files a/lib/images/classic/depth-decrement+rtl.png and /dev/null differ
diff --git a/lib/images/classic/depth-increment+rtl.png
b/lib/images/classic/depth-increment+rtl.png
deleted file mode 100644
index 82517d8..0000000
Binary files a/lib/images/classic/depth-increment+rtl.png and /dev/null differ
diff --git a/lib/images/classic/layout-toggle_Description+rtl.png
b/lib/images/classic/layout-toggle_Description+rtl.png
deleted file mode 100644
index 9725c96..0000000
Binary files a/lib/images/classic/layout-toggle_Description+rtl.png and
/dev/null differ
diff --git a/lib/images/classic/layout-toggle_Itemize+rtl.png
b/lib/images/classic/layout-toggle_Itemize+rtl.png
deleted file mode 100644
index 2e86102..0000000
Binary files a/lib/images/classic/layout-toggle_Itemize+rtl.png and /dev/null
differ
diff --git a/lib/images/classic/layout-toggle_Labeling+rtl.png
b/lib/images/classic/layout-toggle_Labeling+rtl.png
deleted file mode 100644
index 5f0c84e..0000000
Binary files a/lib/images/classic/layout-toggle_Labeling+rtl.png and /dev/null
differ
diff --git a/lib/images/classic/layout-toggle_List+rtl.png
b/lib/images/classic/layout-toggle_List+rtl.png
deleted file mode 100644
index 5f0c84e..0000000
Binary files a/lib/images/classic/layout-toggle_List+rtl.png and /dev/null
differ
diff --git a/lib/images/classic/layout-toggle_Section+rtl.png
b/lib/images/classic/layout-toggle_Section+rtl.png
deleted file mode 100644
index e17c0dd..0000000
Binary files a/lib/images/classic/layout-toggle_Section+rtl.png and /dev/null
differ
diff --git a/lib/images/depth-decrement+rtl.svgz
b/lib/images/depth-decrement+rtl.svgz
deleted file mode 100644
index cd87995..0000000
Binary files a/lib/images/depth-decrement+rtl.svgz and /dev/null differ
diff --git a/lib/images/depth-increment+rtl.svgz
b/lib/images/depth-increment+rtl.svgz
deleted file mode 100644
index 7a77e62..0000000
Binary files a/lib/images/depth-increment+rtl.svgz and /dev/null differ
diff --git a/lib/images/layout-toggle_Description+rtl.svgz
b/lib/images/layout-toggle_Description+rtl.svgz
deleted file mode 100644
index 8a421ea..0000000
Binary files a/lib/images/layout-toggle_Description+rtl.svgz and /dev/null
differ
diff --git a/lib/images/layout-toggle_Itemize+rtl.svgz
b/lib/images/layout-toggle_Itemize+rtl.svgz
deleted file mode 100644
index dc8b357..0000000
Binary files a/lib/images/layout-toggle_Itemize+rtl.svgz and /dev/null differ
diff --git a/lib/images/layout-toggle_Labeling+rtl.svgz
b/lib/images/layout-toggle_Labeling+rtl.svgz
deleted file mode 100644
index b24502f..0000000
Binary files a/lib/images/layout-toggle_Labeling+rtl.svgz and /dev/null differ
diff --git a/lib/images/layout-toggle_List+rtl.svgz
b/lib/images/layout-toggle_List+rtl.svgz
deleted file mode 100644
index b24502f..0000000
Binary files a/lib/images/layout-toggle_List+rtl.svgz and /dev/null differ
diff --git a/lib/images/layout-toggle_Section+rtl.svgz
b/lib/images/layout-toggle_Section+rtl.svgz
deleted file mode 100644
index 8d9e340..0000000
Binary files a/lib/images/layout-toggle_Section+rtl.svgz and /dev/null differ
diff --git a/lib/images/oxygen/bidi_ltr_layout-toggle_Labeling.svgz
b/lib/images/oxygen/bidi_ltr_layout-toggle_Labeling.svgz
deleted file mode 100644
index 036a6f9..0000000
Binary files a/lib/images/oxygen/bidi_ltr_layout-toggle_Labeling.svgz and
/dev/null differ
diff --git a/lib/images/oxygen/bidi_rtl_layout-toggle_Labeling.svgz
b/lib/images/oxygen/bidi_rtl_layout-toggle_Labeling.svgz
deleted file mode 100644
index ca26ee0..0000000
Binary files a/lib/images/oxygen/bidi_rtl_layout-toggle_Labeling.svgz and
/dev/null differ
diff --git a/lib/images/oxygen/depth-decrement+rtl.svgz
b/lib/images/oxygen/depth-decrement+rtl.svgz
deleted file mode 100644
index ceb1a7d..0000000
Binary files a/lib/images/oxygen/depth-decrement+rtl.svgz and /dev/null differ
diff --git a/lib/images/oxygen/depth-increment+rtl.svgz
b/lib/images/oxygen/depth-increment+rtl.svgz
deleted file mode 100644
index b2890f4..0000000
Binary files a/lib/images/oxygen/depth-increment+rtl.svgz and /dev/null differ
diff --git a/lib/images/oxygen/layout-toggle_Description+rtl.svgz
b/lib/images/oxygen/layout-toggle_Description+rtl.svgz
deleted file mode 100644
index 4c906b1..0000000
Binary files a/lib/images/oxygen/layout-toggle_Description+rtl.svgz and
/dev/null differ
diff --git a/lib/images/oxygen/layout-toggle_Itemize+rtl.svgz
b/lib/images/oxygen/layout-toggle_Itemize+rtl.svgz
deleted file mode 100644
index 1f71c41..0000000
Binary files a/lib/images/oxygen/layout-toggle_Itemize+rtl.svgz and /dev/null
differ
diff --git a/lib/images/oxygen/layout-toggle_Labeling+rtl.svgz
b/lib/images/oxygen/layout-toggle_Labeling+rtl.svgz
deleted file mode 100644
index ca26ee0..0000000
Binary files a/lib/images/oxygen/layout-toggle_Labeling+rtl.svgz and /dev/null
differ
diff --git a/lib/images/oxygen/layout-toggle_List+rtl.svgz
b/lib/images/oxygen/layout-toggle_List+rtl.svgz
deleted file mode 100644
index ca26ee0..0000000
Binary files a/lib/images/oxygen/layout-toggle_List+rtl.svgz and /dev/null
differ
diff --git a/lib/images/oxygen/layout-toggle_Section+rtl.svgz
b/lib/images/oxygen/layout-toggle_Section+rtl.svgz
deleted file mode 100644
index ba5dfa5..0000000
Binary files a/lib/images/oxygen/layout-toggle_Section+rtl.svgz and /dev/null
differ
diff --git a/lib/ui/stdtoolbars.inc b/lib/ui/stdtoolbars.inc
index 7b6c129..481aa86 100644
--- a/lib/ui/stdtoolbars.inc
+++ b/lib/ui/stdtoolbars.inc
@@ -38,7 +38,8 @@
#
# BidiItem is like Item, but an alternative icon (with name ending
# with "+rtl") will be used <hen the paragraph has a right-to-left
-# layout.
+# layout. If this alternative icon does not exist, the LtR icon will
+# be mirrored instead.
#
# Layouts adds the layouts combo-box to the toolbar
#
@@ -122,6 +123,7 @@ ToolbarSet
BidiItem "Itemized list" "layout-toggle Itemize"
BidiItem "Labeled List" "layout-toggle Labeling"
BidiItem "Description" "layout-toggle Description"
+ BidiItem "Section" "layout-toggle Section"
BidiItem "Increase depth" "depth-increment"
BidiItem "Decrease depth" "depth-decrement"
Separator
diff --git a/src/frontends/qt/GuiApplication.cpp
b/src/frontends/qt/GuiApplication.cpp
index ddc06bd..5c5c2a6 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -529,6 +529,7 @@ QString iconName(FuncRequest const & f, bool unknown,
QString const & suffix)
// maybe a suffix?
name1 += suffix;
+ name2 += suffix;
QStringList imagedirs;
imagedirs << "images/" << "images/ipa/";
@@ -580,12 +581,6 @@ QString iconName(FuncRequest const & f, bool unknown,
QString const & suffix)
}
-bool getPixmap(QPixmap & pixmap, QString const & path)
-{
- return pixmap.load(path);
-}
-
-
QPixmap getPixmap(QString const & path, QString const & name, QString const &
ext)
{
QString imagedir = path;
@@ -593,14 +588,14 @@ QPixmap getPixmap(QString const & path, QString const &
name, QString const & ex
QString fpath = toqstr(fname.absFileName());
QPixmap pixmap = QPixmap();
- if (getPixmap(pixmap, fpath)) {
+ if (pixmap.load(fpath)) {
return pixmap;
}
QStringList exts = ext.split(",");
fpath = ":/" + path + name + ".";
for (int i = 0; i < exts.size(); ++i) {
- if (getPixmap(pixmap, fpath + exts.at(i))) {
+ if (pixmap.load(fpath + exts.at(i))) {
return pixmap;
}
}
@@ -614,7 +609,7 @@ QPixmap getPixmap(QString const & path, QString const &
name, QString const & ex
}
-QIcon getIcon(FuncRequest const & f, bool unknown, QString const & suffix)
+QIcon getIcon(FuncRequest const & f, bool unknown, bool rtl)
{
#if (QT_VERSION >= 0x040600)
if (lyxrc.use_system_theme_icons) {
@@ -631,18 +626,29 @@ QIcon getIcon(FuncRequest const & f, bool unknown,
QString const & suffix)
}
#endif
- QString icon = iconName(f, unknown, suffix);
+ bool flip = false;
+ QString icon;
+ if (rtl) {
+ icon = iconName(f, unknown, "+rtl");
+ // No RTL icon, we'll make it ourselves
+ flip = icon.isEmpty();
+ }
+ if (icon.isEmpty())
+ icon = iconName(f, unknown);
if (icon.isEmpty())
return QIcon();
//LYXERR(Debug::GUI, "Found icon: " << icon);
QPixmap pixmap = QPixmap();
- if (!getPixmap(pixmap,icon)) {
+ if (!pixmap.load(icon)) {
LYXERR0("Cannot load icon " << icon << " please verify resource
system!");
return QIcon();
}
- return QIcon(pixmap);
+ if (flip)
+ return QIcon(pixmap.transformed(QTransform().scale(-1, 1)));
+ else
+ return QIcon(pixmap);
}
diff --git a/src/frontends/qt/GuiApplication.h
b/src/frontends/qt/GuiApplication.h
index ba603d6..4e0983b 100644
--- a/src/frontends/qt/GuiApplication.h
+++ b/src/frontends/qt/GuiApplication.h
@@ -264,14 +264,9 @@ QString iconName(FuncRequest const & f, bool unknown,
/// \return the pixmap for the given path, name and extension.
/// in case of errors a warning is produced and an empty pixmap is returned.
QPixmap getPixmap(QString const & path, QString const & name, QString const &
ext);
-/// Load the file at \param path and convert it to a pixmap.
-/// \return true on success otherwise invalidate the pixmap and return false.
-/// The caller is responsible for error reporting.
-bool getPixmap(QPixmap & pixmap, QString const & path);
/// \return an icon for the given action.
-QIcon getIcon(FuncRequest const & f, bool unknown,
- QString const & suffix = QString());
+QIcon getIcon(FuncRequest const & f, bool unknown, bool rtl = false);
///
GuiApplication * theGuiApp();
diff --git a/src/frontends/qt/GuiToolbar.cpp b/src/frontends/qt/GuiToolbar.cpp
index 11cb1e3..6f64419 100644
--- a/src/frontends/qt/GuiToolbar.cpp
+++ b/src/frontends/qt/GuiToolbar.cpp
@@ -131,7 +131,7 @@ Action * GuiToolbar::addItem(ToolbarItem const & item)
Action * act = new Action(item.func_, getIcon(*item.func_, false), text,
text, this);
if (item.type_ == ToolbarItem::BIDICOMMAND)
- act->setRtlIcon(getIcon(*item.func_, false, "+rtl"));
+ act->setRtlIcon(getIcon(*item.func_, false, true));
actions_.append(act);
return act;
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs