[chronojump] DB:1.98 colorBackgroundOsColor to manage better three bg color modes
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] DB:1.98 colorBackgroundOsColor to manage better three bg color modes
- Date: Wed, 2 Sep 2020 10:12:01 +0000 (UTC)
commit 40590b87ef6dd42356baf247eb00508beb1fd801
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Sep 2 11:10:47 2020 +0100
DB:1.98 colorBackgroundOsColor to manage better three bg color modes
src/gui/app1/chronojump.cs | 6 +++---
src/gui/preferences.cs | 26 ++++++++++++++++++++------
src/preferences.cs | 1 +
src/sqlite/main.cs | 9 ++++++++-
src/sqlite/preferences.cs | 4 ++++
5 files changed, 36 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 9540f876..bce89589 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -553,7 +553,7 @@ public partial class ChronoJumpWindow
//at initialization of chronojump and gives problems if this signals are raised while
preferences are loading
loadPreferencesAtStart ();
- Config.UseSystemColor = (preferences.colorBackgroundString == "");
+ Config.UseSystemColor = preferences.colorBackgroundOsColor;
Config.ColorBackground = preferences.colorBackground;
Config.ColorBackgroundIsDark = UtilGtk.ColorIsDark(preferences.colorBackground);
@@ -2859,8 +2859,8 @@ public partial class ChronoJumpWindow
//repaint labels that are on the background
//TODO: only if color changed or personWinHide
- Config.UseSystemColor = (preferences.colorBackgroundString == "");
- doLabelsContrast(configChronojump.PersonWinHide);
+ Config.UseSystemColor = preferences.colorBackgroundOsColor;
+ doLabelsContrast(configChronojump.PersonWinHide);
//TODO: only if personWinHide changed
initialize_menu_or_menu_tiny();
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 7357b5b2..01004c0a 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -712,9 +712,12 @@ public class PreferencesWindow
else //if(preferences.importerPythonVersion == Preferences.pythonVersionEnum.Python)
PreferencesWindowBox.radio_python_default.Active = true;
- if(preferences.colorBackgroundString == "") {
+ if(preferences.colorBackgroundOsColor) {
PreferencesWindowBox.radio_color_os.Active = true;
PreferencesWindowBox.button_color_choose.Sensitive = false;
+
+ //do not show the visible tag at open the window, only when user changes to this
option.
+ PreferencesWindowBox.label_radio_color_os_needs_restart.Visible = false;
}
else if((preferences.colorBackgroundString).ToLower() == "#0e1e46") {
PreferencesWindowBox.radio_color_chronojump_blue.Active = true;
@@ -786,8 +789,11 @@ public class PreferencesWindow
private void paintColorDrawingAreaAndBg (Gdk.Color color)
{
UtilGtk.PaintColorDrawingArea(drawingarea_background_color, color);
- UtilGtk.WindowColor(preferences_win, color);
- UtilGtk.ContrastLabelsLabel (preferences.colorBackgroundIsDark, label_view_more_tabs);
+ if(! preferences.colorBackgroundOsColor)
+ {
+ UtilGtk.WindowColor(preferences_win, color);
+ UtilGtk.ContrastLabelsLabel (preferences.colorBackgroundIsDark, label_view_more_tabs);
+ }
}
private void on_radio_color_custom_toggled (object o, EventArgs args)
@@ -1688,17 +1694,25 @@ public class PreferencesWindow
preferences.colorBackgroundString = Preferences.PreferencesChange(
SqlitePreferences.ColorBackground, preferences.colorBackgroundString,
"#0e1e46");
+ preferences.colorBackgroundOsColor = Preferences.PreferencesChange(
+ SqlitePreferences.ColorBackgroundOsColor,
preferences.colorBackgroundOsColor,
+ false);
preferences.colorBackgroundIsDark = true;
} else if(radio_color_os.Active)
{
- preferences.colorBackgroundString = Preferences.PreferencesChange(
- SqlitePreferences.ColorBackground, preferences.colorBackgroundString,
- "");
+ //radio_color_os does not change the colorBackgroundString, it changes the
Config.UseSystemColor
+ //but note that on showing cairo and execute graphs, primary color will be
colorBackground
+ preferences.colorBackgroundOsColor = Preferences.PreferencesChange(
+ SqlitePreferences.ColorBackgroundOsColor,
preferences.colorBackgroundOsColor,
+ true);
preferences.colorBackgroundIsDark = false; //is not important as it is not going to
be used
} else {
preferences.colorBackgroundString = Preferences.PreferencesChange(
SqlitePreferences.ColorBackground, preferences.colorBackgroundString,
UtilGtk.ColorToColorString(colorBackground)); //this does the reverse
of Gdk.Color.Parse on UtilGtk.ColorParse()
+ preferences.colorBackgroundOsColor = Preferences.PreferencesChange(
+ SqlitePreferences.ColorBackgroundOsColor,
preferences.colorBackgroundOsColor,
+ false);
preferences.colorBackgroundIsDark = UtilGtk.ColorIsDark(colorBackground);
}
diff --git a/src/preferences.cs b/src/preferences.cs
index dd1edbd6..c5cbea8c 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -38,6 +38,7 @@ public class Preferences
public MenuTypes menuType;
public string colorBackgroundString; //"" means system color (do not do nothing)
public bool colorBackgroundIsDark; //this is assigned when colorBackgroundString changes. And this is
used by the rest of the program. Not stored on SQL.
+ public bool colorBackgroundOsColor;
public bool logoAnimatedShow;
public bool loadLastSessionAtStart;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index ab4673d4..e4f7035f 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -129,7 +129,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
- static string lastChronojumpDatabaseVersion = "1.97";
+ static string lastChronojumpDatabaseVersion = "1.98";
public Sqlite()
{
@@ -2749,6 +2749,12 @@ class Sqlite
currentVersion = updateVersion("1.97");
}
+ if(currentVersion == "1.97")
+ {
+ LogB.SQL("Inserted into preferences: colorBackgroundOsColor");
+ SqlitePreferences.Insert (SqlitePreferences.ColorBackgroundOsColor, "False");
+ currentVersion = updateVersion("1.98");
+ }
/*
if(currentVersion == "1.79")
@@ -2964,6 +2970,7 @@ class Sqlite
//just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved
stiffnessString records there
+ //1.97 - 1.98 Converted DB to 1.98 Inserted into preferences: colorBackgroundOsColor
//1.96 - 1.97 Converted DB to 1.97 Inserted into preferences: loadLastSessionAtStart,
lastSessionID, loadLastModAtStart, lastMode
//1.95 - 1.96 Converted DB to 1.96 Inserted into preferences: jumpsFVProfileOnlyBestInWeight,
jumpsFVProfileShowFullGraph, jumpsEvolutionOnlyBestInSession
//1.94 - 1.95 Converted DB to 1.95 Inserted into preferences: importerPythonVersion
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 75bbf80c..7859b468 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -30,6 +30,7 @@ class SqlitePreferences : Sqlite
public const string UnitsStr = "units";
public const string MenuType = "menuType";
public const string ColorBackground = "colorBackground";
+ public const string ColorBackgroundOsColor = "colorBackgroundOsColor";
public const string LogoAnimatedShow = "logoAnimatedShow";
//contacts
@@ -132,6 +133,7 @@ class SqlitePreferences : Sqlite
Insert (MenuType, Preferences.MenuTypes.ALL.ToString(), dbcmdTr);
Insert (LogoAnimatedShow, "True", dbcmdTr);
Insert (ColorBackground, "#0e1e46", dbcmdTr);
+ Insert (ColorBackgroundOsColor, "False", dbcmdTr);
Insert (UnitsStr, Preferences.UnitsEnum.METRIC.ToString(), dbcmdTr);
Insert (EncoderCaptureInfinite, "False", dbcmdTr);
Insert ("encoderCaptureShowOnlyBars", "False", dbcmdTr);
@@ -413,6 +415,8 @@ class SqlitePreferences : Sqlite
preferences.colorBackgroundString = reader[1].ToString();
preferences.colorBackgroundIsDark = UtilGtk.ColorIsDark(reader[1].ToString());
}
+ else if(reader[0].ToString() == ColorBackgroundOsColor)
+ preferences.colorBackgroundOsColor = reader[1].ToString() == "True";
else if(reader[0].ToString() == LogoAnimatedShow)
preferences.logoAnimatedShow = reader[1].ToString() == "True";
else if(reader[0].ToString() == UnitsStr)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]