Re: [RFC Riki!] Re: Boder of Frame inset not visible in dark mode
On 9/29/23 08:29, Jürgen Spitzmüller wrote: Am Sonntag, dem 24.09.2023 um 22:24 +0200 schrieb Dan: Hello, PROBLEM There is a frame whose outline is not visible in dark mode because it is black (Insert > Frame > Simple Frame). The box inset name is "Boxed" (https://www.lyx.org/trac/browser/lyxgit/lib/layouts/stdinsets.inc#L5 04). See the attached image for a showcase of all the frames showing the problem. EXPECTED BEHAVIOUR === Simple Frame Box should have the same outline colour as the other frames. The attached patch fixes it and also resolves a regression in master with non-default frame color and default background color. But it's a file format change, so Riki needs to decide on whether it qualifies as urgent enough. Go ahead, it looks important. Riki -- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel
[RFC Riki!] Re: Boder of Frame inset not visible in dark mode
Am Sonntag, dem 24.09.2023 um 22:24 +0200 schrieb Dan: > Hello, > > PROBLEM > > There is a frame whose outline is not visible in dark mode because it > is black (Insert > Frame > Simple Frame). > The box inset name is "Boxed" > (https://www.lyx.org/trac/browser/lyxgit/lib/layouts/stdinsets.inc#L5 > 04). > > See the attached image for a showcase of all the frames showing the > problem. > > EXPECTED BEHAVIOUR > === > Simple Frame Box should have the same outline colour as the other > frames. The attached patch fixes it and also resolves a regression in master with non-default frame color and default background color. But it's a file format change, so Riki needs to decide on whether it qualifies as urgent enough. > > > Daniel. > -- > Enviat amb Tutanota. -- Jürgen diff --git a/development/FORMAT b/development/FORMAT index 1711f88c78..29774522a4 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,10 @@ changes happened in particular if possible. A good example would be --- +2023-09-29 Jürgen Spitzmüller + * Format incremented to 620: InsetBox default framecolor is now "foreground" + rather than "black". This aligns better with dark mode. + 2023-09-06 Richard Kimberly Heck * Format incremented to 619: New document header \use_formatted_ref for workarea display purposes only. diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index 4cc5fe5bdf..cc350e1463 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -5554,6 +5554,21 @@ def revert_formatted_refs(document): del document.header[i] +def revert_box_fcolor(document): +i = 0 +while True: +i = find_token(document.body, '\\begin_inset Box Boxed', i+1) +if i == -1: +break +j = find_end_of_inset(document.body, i) +if j == -1: +document.warning("Malformed LyX document: Can't find end of framed box inset at line %d" % i) +continue +k = find_token(document.body, 'framecolor "foreground"', i, j) +if k != -1: +document.body[k] = 'framecolor "black"' + + ## # Conversion hub # @@ -5634,11 +5649,13 @@ convert = [ [616, [convert_empty_macro]], [617, [convert_cov_options]], [618, []], - [619, []] + [619, []], + [620, []] ] -revert = [[618, [revert_formatted_refs]], +revert = [[619, [revert_box_fcolor]], + [618, [revert_formatted_refs]], [617, [revert_hequotes]], [616, [revert_expreambles,revert_exarg2,revert_linggloss2,revert_cov_options]], [615, [revert_empty_macro]], diff --git a/src/frontends/qt/GuiBox.cpp b/src/frontends/qt/GuiBox.cpp index bda71a68ef..8cd634d27f 100644 --- a/src/frontends/qt/GuiBox.cpp +++ b/src/frontends/qt/GuiBox.cpp @@ -133,6 +133,8 @@ GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent) connect(shadowsizeED, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); connect(shadowsizeUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, SIGNAL(changed())); + connect(frameColorCO, SIGNAL(currentIndexChanged(int)), + this, SIGNAL(changed())); connect(backgroundColorCO, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); @@ -159,15 +161,18 @@ GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent) } -void GuiBox::fillComboColor(QComboBox * combo, bool const is_none) +void GuiBox::fillComboColor(QComboBox * combo, bool const is_background) { combo->clear(); QPixmap coloritem(32, 32); QColor color; - // frameColorCO cannot be uncolored - if (is_none) + // condition on the two possible types + if (is_background) combo->addItem(toqstr(translateIfPossible(lcolor.getGUIName(Color_none))), toqstr(lcolor.getLaTeXName(Color_none))); + else + combo->addItem(toqstr(translateIfPossible(lcolor.getGUIName(Color_foreground))), + toqstr(lcolor.getLaTeXName(Color_foreground))); QList::const_iterator cit = color_codes_.begin(); for (; cit != color_codes_.end(); ++cit) { QString const latexname = toqstr(lcolor.getLaTeXName(*cit)); @@ -215,32 +220,6 @@ void GuiBox::on_typeCO_activated(int index) widthCB->setChecked(itype != "none"); pagebreakCB->setChecked(false); } - // assure that the frame color is black for frameless boxes to - // provide the color "none" - int const b = frameColorCO->findData("black"); - if (frameless && frameColorCO->currentIndex() != b) - frameColorCO->setCurrentIndex(b); - changed(); -} - - -void GuiBox::on_frameColorCO_currentIndexChanged(int index) -{ - // if there is a non-black frame color the background cannot be uncolored - // therefore remove the entry "none" in this case - int const n = backgroundColorCO->findData("none"); - if (index != frameColorCO->findData("black")) { - if (n != -1) { - if (backgroundColorCO->currentIndex() == n) -backgroundColorCO->setCurrentIndex( - backgrou
Re: Boder of Frame inset not visible in dark mode
On 2023-09-26 04:26, Daniel wrote: On 2023-09-24 22:24, Dan wrote: Hello, PROBLEM There is a frame whose outline is not visible in dark mode because it is black (Insert > Frame > Simple Frame). The box inset name is "Boxed" (https://www.lyx.org/trac/browser/lyxgit/lib/layouts/stdinsets.inc#L504). See the attached image for a showcase of all the frames showing the problem. EXPECTED BEHAVIOUR === Simple Frame Box should have the same outline colour as the other frames. A bug here that wpuld solve the problem is that the frame setting misses the proper "Default" value for its frame color. When inserted, no special color is applied to the frame but the frame color is used. You can see this by changing the Main Text color (in Document Settings > Colors). If the default is changed to, say, red, the box gets that color in the output but still has "black" as frame color in the settings. Worse, once one changes the color in the frame settings to, say, blue, it is impossible to get the default behavior back since when switching back to "black", it is explicitly applied. Daniel Filed as #12921. (Hopefully with a better description than here.) Daniel -- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel
Re: Boder of Frame inset not visible in dark mode
On 2023-09-24 22:24, Dan wrote: Hello, PROBLEM There is a frame whose outline is not visible in dark mode because it is black (Insert > Frame > Simple Frame). The box inset name is "Boxed" (https://www.lyx.org/trac/browser/lyxgit/lib/layouts/stdinsets.inc#L504). See the attached image for a showcase of all the frames showing the problem. EXPECTED BEHAVIOUR === Simple Frame Box should have the same outline colour as the other frames. A bug here that wpuld solve the problem is that the frame setting misses the proper "Default" value for its frame color. When inserted, no special color is applied to the frame but the frame color is used. You can see this by changing the Main Text color (in Document Settings > Colors). If the default is changed to, say, red, the box gets that color in the output but still has "black" as frame color in the settings. Worse, once one changes the color in the frame settings to, say, blue, it is impossible to get the default behavior back since when switching back to "black", it is explicitly applied. Daniel -- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel
Re: Boder of Frame inset not visible in dark mode
On Sun, Sep 24, 2023 at 10:24:30PM +0200, Dan wrote: > Hello, > > PROBLEM > > There is a frame whose outline is not visible in dark mode because it is > black (Insert > Frame > Simple Frame). > The box inset name is "Boxed" > (https://www.lyx.org/trac/browser/lyxgit/lib/layouts/stdinsets.inc#L504). > > See the attached image for a showcase of all the frames showing the problem. > > EXPECTED BEHAVIOUR > === > Simple Frame Box should have the same outline colour as the other frames. I see the problem, though I do not see what's the proper solution here. We use the color which is actually selected as a frame decoration (see dialog of the box inset->color. That is black by default and can be selected to other colors in the dialog which we paint according to the color chosen. Perhaps we could check for black background and invert in the case of black color but it looks somewhat hackish solution. You can play with InsetBox.cpp, line ~170 if you like. Pavel -- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel