Revert "Add mechanism to change icons in RTL mode"

This is really too clumsy. Revert in preparation for a better
mechanism.

This reverts commit 2898c335be.
This commit is contained in:
Jean-Marc Lasgouttes 2020-04-14 18:30:44 +02:00
parent dd154a5837
commit ce0538e372
49 changed files with 11 additions and 113 deletions

View File

@ -516,22 +516,6 @@ dist_images_DATA1X = \
images/all-changes-accept.svgz \
images/all-changes-reject.svgz \
images/banner.svgz \
images/bidi_ltr_depth-decrement.svgz \
images/bidi_ltr_depth-increment.svgz \
images/bidi_ltr_layout-toggle_Description.svgz \
images/bidi_ltr_layout-toggle_Enumerate.svgz \
images/bidi_ltr_layout-toggle_Itemize.svgz \
images/bidi_ltr_layout-toggle_Labeling.svgz \
images/bidi_ltr_layout-toggle_List.svgz \
images/bidi_ltr_layout-toggle_Section.svgz \
images/bidi_rtl_depth-decrement.svgz \
images/bidi_rtl_depth-increment.svgz \
images/bidi_rtl_layout-toggle_Description.svgz \
images/bidi_rtl_layout-toggle_Enumerate.svgz \
images/bidi_rtl_layout-toggle_Itemize.svgz \
images/bidi_rtl_layout-toggle_Labeling.svgz \
images/bidi_rtl_layout-toggle_List.svgz \
images/bidi_rtl_layout-toggle_Section.svgz \
images/bookmark-goto.svgz \
images/bookmark-goto_0.svgz \
images/bookmark-save.svgz \
@ -1819,22 +1803,6 @@ imagesoxygendir = $(imagesdir)/oxygen
dist_imagesoxygen_DATA1X = \
images/oxygen/all-changes-accept.svgz \
images/oxygen/all-changes-reject.svgz \
images/oxygen/bidi_ltr_depth-decrement.svgz \
images/oxygen/bidi_ltr_depth-increment.svgz \
images/oxygen/bidi_ltr_layout-toggle_Description.svgz \
images/oxygen/bidi_ltr_layout-toggle_Enumerate.svgz \
images/oxygen/bidi_ltr_layout-toggle_Itemize.svgz \
images/oxygen/bidi_ltr_layout-toggle_Labeling.svgz \
images/oxygen/bidi_ltr_layout-toggle_List.svgz \
images/oxygen/bidi_ltr_layout-toggle_Section.svgz \
images/oxygen/bidi_rtl_depth-decrement.svgz \
images/oxygen/bidi_rtl_depth-increment.svgz \
images/oxygen/bidi_rtl_layout-toggle_Description.svgz \
images/oxygen/bidi_rtl_layout-toggle_Enumerate.svgz \
images/oxygen/bidi_rtl_layout-toggle_Itemize.svgz \
images/oxygen/bidi_rtl_layout-toggle_Labeling.svgz \
images/oxygen/bidi_rtl_layout-toggle_List.svgz \
images/oxygen/bidi_rtl_layout-toggle_Section.svgz \
images/oxygen/bookmark-goto.svgz \
images/oxygen/bookmark-goto_0.svgz \
images/oxygen/bookmark-save.svgz \
@ -2039,22 +2007,6 @@ imagesclassicdir = $(imagesdir)/classic
dist_imagesclassic_DATA = \
images/classic/all-changes-accept.png \
images/classic/all-changes-reject.png \
images/classic/bidi_ltr_depth-decrement.png \
images/classic/bidi_ltr_depth-increment.png \
images/classic/bidi_ltr_layout-toggle_Description.png \
images/classic/bidi_ltr_layout-toggle_Enumerate.png \
images/classic/bidi_ltr_layout-toggle_Itemize.png \
images/classic/bidi_ltr_layout-toggle_Labeling.png \
images/classic/bidi_ltr_layout-toggle_List.png \
images/classic/bidi_ltr_layout-toggle_Section.png \
images/classic/bidi_rtl_depth-decrement.png \
images/classic/bidi_rtl_depth-increment.png \
images/classic/bidi_rtl_layout-toggle_Description.png \
images/classic/bidi_rtl_layout-toggle_Enumerate.png \
images/classic/bidi_rtl_layout-toggle_Itemize.png \
images/classic/bidi_rtl_layout-toggle_Labeling.png \
images/classic/bidi_rtl_layout-toggle_List.png \
images/classic/bidi_rtl_layout-toggle_Section.png \
images/classic/bookmark-goto.png \
images/classic/bookmark-goto_0.png \
images/classic/bookmark-save.png \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@ -113,20 +113,12 @@ ToolbarSet
Toolbar "extra" "Extra"
Item "Default" "layout"
# The bidi function is used here to select a different
# icon depending on the direction of the current text.
Item "Numbered list" "bidi ltr layout-toggle Enumerate"
Item "Numbered list" "bidi rtl layout-toggle Enumerate"
Item "Itemized list" "bidi ltr layout-toggle Itemize"
Item "Itemized list" "bidi rtl layout-toggle Itemize"
Item "Labeled List" "bidi ltr layout-toggle Labeling"
Item "Labeled List" "bidi rtl layout-toggle Labeling"
Item "Description" "bidi ltr layout-toggle Description"
Item "Description" "bidi rtl layout-toggle Description"
Item "Increase depth" "bidi ltr depth-increment"
Item "Increase depth" "bidi rtl depth-increment"
Item "Decrease depth" "bidi ltr depth-decrement"
Item "Decrease depth" "bidi rtl depth-decrement"
Item "Numbered list" "layout-toggle Enumerate"
Item "Itemized list" "layout-toggle Itemize"
Item "Labeled List" "layout-toggle Labeling"
Item "Description" "layout-toggle Description"
Item "Increase depth" "depth-increment"
Item "Decrease depth" "depth-decrement"
Separator
Item "Insert figure float" "float-insert figure"
Item "Insert table float" "float-insert table"

View File

@ -485,9 +485,8 @@ enum FuncCode
LFUN_BUFFER_WRITE_AS_TEMPLATE, // spitz, 20190323
LFUN_TABULAR_STYLE_INSERT, // spitz, 20190325
LFUN_PARAGRAPH_SELECT, // Kornel, 20190416
LFUN_BIDI,
// 380
LFUN_BUFFER_RESET_EXPORT, // spitz 20191226
// 380
LFUN_MASTER_BUFFER_FORALL, // spitz 20191231
LFUN_IF_RELATIVES, // spitz 20200102
LFUN_LASTACTION // end of the table

View File

@ -332,20 +332,6 @@ void LyXAction::init()
{ LFUN_BIBTEX_DATABASE_DEL, "bibtex-database-del", Noop, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_BIDI
* \li Action: Helper function for bidirectional toolbar icons
* \li Notion: In a text, the function is marked as `unknown' when the
current direction does not correspond to DIRECTION (ltr
or rtl). Otherwise the function behaves exactly as
ACTION. The result is that ACTION will be associated to
a different icon depending on text direction.
* \li Syntax: bidi <DIRECTION> <ACTION>
* \li Origin: JMarc, 21 July 2019
* \endvar
*/
{ LFUN_BIDI, "bidi", Noop, System },
/*!
* \var lyx::FuncCode lyx::LFUN_BOOKMARK_CLEAR
* \li Action: Clears the list of saved bookmarks.

View File

@ -76,7 +76,6 @@ void Action::update()
setCheckable(false);
}
setVisible(!status.unknown());
setEnabled(status.enabled());
}

View File

@ -70,11 +70,11 @@
#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h" // sorted
#include "support/textutils.h"
#include "support/Messages.h"
#include "support/os.h"
#include "support/Package.h"
#include "support/TempFile.h"
#include "support/textutils.h"
#ifdef Q_OS_MAC
#include "support/AppleScript.h"
@ -928,7 +928,7 @@ public:
struct GuiApplication::Private
{
Private(): language_model_(0), meta_fake_bit(NoModifier),
global_menubar_(0)
global_menubar_(0)
{
#if (QT_VERSION < 0x050000) || (QT_VERSION >= 0x050400)
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
@ -1292,24 +1292,6 @@ bool GuiApplication::getStatus(FuncRequest const & cmd, FuncStatus & flag) const
break;
}
case LFUN_BIDI: {
string const dir = cmd.getArg(0);
string const lfun = cmd.getLongArg(1);
BufferView const * bv =
current_view_ ? current_view_->currentBufferView() : nullptr;
bool rtl = bv ? bv->cursor().innerParagraph().isRTL(bv->buffer().params())
: layoutDirection() == Qt::RightToLeft;
if (((rtl && dir != "rtl") || (!rtl && dir != "ltr"))) {
flag.setUnknown(true);
flag.setEnabled(false);
} else {
FuncRequest func(lyxaction.lookupFunc(lfun));
func.setOrigin(cmd.origin());
flag = getStatus(func);
}
break;
}
case LFUN_IF_RELATIVES: {
string const lfun = to_utf8(cmd.argument());
BufferView const * bv =
@ -1898,7 +1880,6 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
break;
// --- syntax commands ----------------------------
case LFUN_REPEAT: {
// repeat command
string countstr;
@ -2050,18 +2031,6 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
break;
}
case LFUN_BIDI: {
string const lfun = cmd.getLongArg(1);
FuncRequest func(lyxaction.lookupFunc(cmd.getLongArg(1)));
func.setOrigin(cmd.origin());
FuncStatus const stat = getStatus(func);
if (stat.enabled()) {
dispatch(func);
break;
}
break;
}
case LFUN_IF_RELATIVES: {
string const lfun = to_utf8(cmd.argument());
FuncRequest func(lyxaction.lookupFunc(lfun));

View File

@ -519,7 +519,8 @@ void GuiToolbar::add(ToolbarItem const & item)
break;
}
case ToolbarItem::COMMAND: {
addAction(addItem(item));
if (!getStatus(*item.func_).unknown())
addAction(addItem(item));
break;
}
default: