summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorHeiko Tietze <tietze.heiko@gmail.com>2023-03-17 16:10:39 +0100
committerHeiko Tietze <heiko.tietze@documentfoundation.org>2023-03-29 10:34:27 +0000
commit5675937f7564fa5614f7be5aec0d7f20ba91d02c (patch)
treebc1a8265c73e6d0cd9c0967363322e89c7a30d61 /cui
parent6d4917db0ec647561c3c02765765491e9ae2d8eb (diff)
Resolves tdf#152184 - Application color should follow system color
This patch reverts the previously added "LibreOffice Dark" application color set and adds it to the automatic colors. Switching between light and dark changes the Automatic color accordingly instead switching to another color scheme. The added System Theme option makes Light/Dark follow the actual OS appearance. Reverts 6dfc49bb6a72bf6bb79167b12f0d2d0c5a155d06 (Introduce dark color set), 546ad5d17d3e363b75337c336cfb2b2f8acc55e3 (color scheme translatable), 9f0cf00d29298ed55737928ec4dddc50ac850cd8 (Update view options string based on theme) Change-Id: Ibf491f2e510fac5f1d27a7166560c4ec281d98d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149059 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'cui')
-rw-r--r--cui/inc/strings.hrc1
-rw-r--r--cui/source/options/optcolor.cxx36
-rw-r--r--cui/source/options/optcolor.hxx3
-rw-r--r--cui/uiconfig/ui/optappearancepage.ui220
4 files changed, 153 insertions, 107 deletions
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 0cd2d2cd4566..498e60e75bc2 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -408,6 +408,5 @@
// Translatable names of color schemes
#define RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC NC_("RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC", "Automatic")
-#define RID_COLOR_SCHEME_LIBREOFFICE_DARK NC_("RID_COLOR_SCHEME_LIBREOFFICE_DARK", "Dark")
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 4ad5d2b5e93f..15d3dadcf244 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -34,7 +34,8 @@
#include <dialmgr.hxx>
#include "optcolor.hxx"
#include <strings.hrc>
-
+#include <svtools/miscopt.hxx>
+#include <officecfg/Office/Common.hxx>
using namespace ::com::sun::star;
using namespace ::svtools;
@@ -165,7 +166,6 @@ const std::map<OUString, OUString> &getColorSchemes()
{
static std::map<OUString, OUString> const vColorSchemes = {
{"COLOR_SCHEME_LIBREOFFICE_AUTOMATIC", CuiResId(RID_COLOR_SCHEME_LIBREOFFICE_AUTOMATIC)},
- {"COLOR_SCHEME_LIBREOFFICE_DARK", CuiResId(RID_COLOR_SCHEME_LIBREOFFICE_DARK)}
};
return vColorSchemes;
};
@@ -204,6 +204,7 @@ public:
Link<weld::Widget&,void> const&,
weld::ScrolledWindow& rScroll);
void Update(EditableColorConfig const*, EditableExtendedColorConfig const*);
+ void UpdateEntries();
void ClickHdl(EditableColorConfig*, const weld::Toggleable&);
void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, const ColorListBox*);
@@ -528,6 +529,16 @@ void ColorConfigWindow_Impl::Update (
}
}
+void ColorConfigWindow_Impl::UpdateEntries()
+{
+ for (unsigned i = 0; i != ColorConfigEntryCount; ++i)
+ {
+ ColorConfigEntry const aEntry = static_cast<ColorConfigEntry>(i);
+ Color aColor = ColorConfig::GetDefaultColor(aEntry);
+ vEntries[i]->m_xColorList->SetAutoDisplayColor(aColor);
+ }
+}
+
// ClickHdl()
void ColorConfigWindow_Impl::ClickHdl(EditableColorConfig* pConfig, const weld::Toggleable& rBox)
{
@@ -627,6 +638,7 @@ public:
void SetConfig (EditableColorConfig& rConfig) { pColorConfig = &rConfig; }
void SetExtendedConfig (EditableExtendedColorConfig& rConfig) { pExtColorConfig = &rConfig; }
void Update();
+ void UpdateEntries();
tools::Long GetScrollPosition() const
{
return m_xVScroll->vadjustment_get_value();
@@ -670,6 +682,11 @@ void ColorConfigCtrl_Impl::Update ()
m_xScrollWindow->Update(pColorConfig, pExtColorConfig);
}
+void ColorConfigCtrl_Impl::UpdateEntries()
+{
+ m_xScrollWindow->UpdateEntries();
+}
+
IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, weld::Toggleable&, rBox, void)
{
DBG_ASSERT(pColorConfig, "Configuration not set");
@@ -726,6 +743,7 @@ SvxColorOptionsTabPage::SvxColorOptionsTabPage(weld::Container* pPage, weld::Dia
: SfxTabPage(pPage, pController, "cui/ui/optappearancepage.ui", "OptAppearancePage", &rCoreSet)
, bFillItemSetCalled(false)
, m_nSizeAllocEventId(nullptr)
+ , m_xAutoColorLB(m_xBuilder->weld_combo_box("autocolorlb"))
, m_xColorSchemeLB(m_xBuilder->weld_combo_box("colorschemelb"))
, m_xSaveSchemePB(m_xBuilder->weld_button("save"))
, m_xDeleteSchemePB(m_xBuilder->weld_button("delete"))
@@ -738,6 +756,7 @@ SvxColorOptionsTabPage::SvxColorOptionsTabPage(weld::Container* pPage, weld::Dia
{
m_xColorSchemeLB->make_sorted();
m_xColorSchemeLB->connect_changed(LINK(this, SvxColorOptionsTabPage, SchemeChangedHdl_Impl));
+ m_xAutoColorLB->connect_changed(LINK(this, SvxColorOptionsTabPage, onAutoColorChanged));
Link<weld::Button&,void> aLk = LINK(this, SvxColorOptionsTabPage, SaveDeleteHdl_Impl );
m_xSaveSchemePB->connect_clicked(aLk);
m_xDeleteSchemePB->connect_clicked(aLk);
@@ -812,6 +831,8 @@ void SvxColorOptionsTabPage::Reset( const SfxItemSet* )
pExtColorConfig.reset(new EditableExtendedColorConfig);
m_xColorConfigCT->SetExtendedConfig(*pExtColorConfig);
+ m_xAutoColorLB->set_active( MiscSettings::GetAppColorMode() );
+
OUString sUser = GetUserData();
//has to be called always to speed up accessibility tools
m_xColorConfigCT->SetScrollPosition(sUser.toInt32());
@@ -838,6 +859,17 @@ void SvxColorOptionsTabPage::UpdateColorConfig()
m_xColorConfigCT->Update();
}
+IMPL_LINK_NOARG(SvxColorOptionsTabPage, onAutoColorChanged, weld::ComboBox&, void)
+{
+ MiscSettings::SetAppColorMode( m_xAutoColorLB->get_active() );
+
+ m_xColorConfigCT->UpdateEntries();
+
+ pColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(m_xColorSchemeLB->get_active_text()));
+ pExtColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(m_xColorSchemeLB->get_active_text()));
+ UpdateColorConfig();
+}
+
IMPL_LINK(SvxColorOptionsTabPage, SchemeChangedHdl_Impl, weld::ComboBox&, rBox, void)
{
pColorConfig->LoadScheme(lcl_TranslatedNameToSchemeId(rBox.get_active_text()));
diff --git a/cui/source/options/optcolor.hxx b/cui/source/options/optcolor.hxx
index 0fa8cf2c46ea..096ed93b256d 100644
--- a/cui/source/options/optcolor.hxx
+++ b/cui/source/options/optcolor.hxx
@@ -31,6 +31,7 @@ class SvxColorOptionsTabPage : public SfxTabPage
ImplSVEvent* m_nSizeAllocEventId;
+ std::unique_ptr<weld::ComboBox> m_xAutoColorLB;
std::unique_ptr<weld::ComboBox> m_xColorSchemeLB;
std::unique_ptr<weld::Button> m_xSaveSchemePB;
std::unique_ptr<weld::Button> m_xDeleteSchemePB;
@@ -38,6 +39,7 @@ class SvxColorOptionsTabPage : public SfxTabPage
std::unique_ptr<weld::Widget> m_xTable;
std::unique_ptr<weld::Label> m_xOnFT;
std::unique_ptr<weld::Label> m_xColorFT;
+
weld::Widget& m_rWidget1;
weld::Widget& m_rWidget2;
@@ -45,6 +47,7 @@ class SvxColorOptionsTabPage : public SfxTabPage
std::unique_ptr<svtools::EditableExtendedColorConfig> pExtColorConfig;
DECL_LINK(SchemeChangedHdl_Impl, weld::ComboBox&, void);
+ DECL_LINK(onAutoColorChanged, weld::ComboBox&, void);
DECL_LINK(SaveDeleteHdl_Impl, weld::Button&, void);
DECL_LINK(CheckNameHdl_Impl, AbstractSvxNameDialog&, bool);
DECL_LINK(AdjustHeaderBar, const Size&, void);
diff --git a/cui/uiconfig/ui/optappearancepage.ui b/cui/uiconfig/ui/optappearancepage.ui
index 64c338ba978f..63916d36543f 100644
--- a/cui/uiconfig/ui/optappearancepage.ui
+++ b/cui/uiconfig/ui/optappearancepage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
<interface domain="cui">
<requires lib="gtk+" version="3.20"/>
<object class="GtkBox" id="OptAppearancePage">
@@ -11,106 +11,6 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="hexpand">True</property>
- <property name="label-xalign">0</property>
- <property name="shadow-type">none</property>
- <child>
- <!-- n-columns=4 n-rows=1 -->
- <object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="margin-start">12</property>
- <property name="margin-top">6</property>
- <property name="hexpand">True</property>
- <property name="column-spacing">12</property>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label" translatable="yes" context="optappearancepage|label3">_Scheme:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">colorschemelb</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="save">
- <property name="label" translatable="yes" context="optappearancepage|save">_Save</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="use-underline">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="save-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|save">Saves the current settings as a color scheme that you can reload later.</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left-attach">2</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="delete">
- <property name="label" translatable="yes" context="stock">_Delete</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="use-underline">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="delete-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|delete">Deletes the color scheme shown in the Scheme box. You cannot delete the Default scheme.</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left-attach">3</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="colorschemelb">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="hexpand">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="colorschemelb-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|colorschemelb">Selects the color scheme you want to use.</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label" translatable="yes" context="optappearancepage|label1">Color Scheme</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -119,9 +19,10 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
- <!-- n-columns=1 n-rows=2 -->
+ <!-- n-columns=1 n-rows=3 -->
<object class="GtkGrid" id="table">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can-focus">False</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
@@ -179,7 +80,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">1</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
@@ -187,6 +88,7 @@
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can-focus">False</property>
+ <property name="margin-top">6</property>
<property name="hexpand">True</property>
<property name="column-spacing">6</property>
<child>
@@ -230,6 +132,116 @@
</object>
<packing>
<property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <!-- n-columns=6 n-rows=1 -->
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-start">12</property>
+ <property name="margin-top">6</property>
+ <property name="hexpand">True</property>
+ <property name="column-spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="optappearancepage|label3">_Scheme:</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">colorschemelb</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="save">
+ <property name="label" translatable="yes" context="optappearancepage|save">_Save</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="save-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|save">Saves the current settings as a color scheme that you can reload later.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">2</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="delete">
+ <property name="label" translatable="yes" context="stock">_Delete</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="delete-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|delete">Deletes the color scheme shown in the Scheme box. You cannot delete the Default scheme.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">3</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="colorschemelb">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="colorschemelb-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|colorschemelb">Selects the color scheme you want to use.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="autocolor">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-start">12</property>
+ <property name="label" translatable="yes" context="optappearancepage|autocolor">_Automatic:</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">autocolorlb</property>
+ </object>
+ <packing>
+ <property name="left-attach">4</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="autocolorlb">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="active">1</property>
+ <items>
+ <item id="0" translatable="yes" context="optappearancepage|cbSchemeEntry1">System Theme</item>
+ <item id="1" translatable="yes" context="optappearancepage|cbSchemeEntry2">Light</item>
+ <item id="2" translatable="yes" context="optappearancepage|cbSchemeEntry3">Dark</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left-attach">5</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -249,7 +261,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child internal-child="accessible">