From b2159137db6a07ef4c52299604808bf4cb48c569 Mon Sep 17 00:00:00 2001
From: Sergey Kalinin <banzaj28@yandex.ru>
Date: Fri, 30 Aug 2019 16:03:07 +0300
Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?=
 =?UTF-8?q?=D0=BD=D1=8B=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=20?=
 =?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D1=82?=
 =?UTF-8?q?=D0=B5=D0=BC=D1=8B.=20=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7?=
 =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?=
 =?UTF-8?q?=D0=B0=20=D1=81=20=D1=82=D0=B5=D0=BC=D0=B0=D0=BC=D0=B8.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/gui.tcl            | 13 ++++++++++---
 lib/theme.tcl          |  8 ++++++++
 lib/ttk_theme_dark.tcl |  1 +
 rac_gui.cfg            | 10 ++++------
 rac_gui.tcl            |  1 -
 5 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/lib/gui.tcl b/lib/gui.tcl
index efcf68c..3aada00 100644
--- a/lib/gui.tcl
+++ b/lib/gui.tcl
@@ -31,7 +31,10 @@ bind . <Control-Q> Quit
 #ttk::style configure Custom.Treeview -foreground red
 #ttk::style configure Custom.Treeview -rowheight 20
 
-ttk::style theme use dark
+
+if [info exists default(theme)] {
+    ttk::style theme use $default(theme)
+}
 
 # Панель инсрументов
 set frm_tool [ttk::frame .frm_tool]
@@ -79,8 +82,11 @@ set tree_work [
     -yscrollcommand [list $frm_work.vsb set]
 ]
 # table rows background colors
-$tree_work tag configure dark -background $color(dark_table_bg)
-$tree_work tag configure light -background $color(light_table_bg)
+
+if {[info exists default(theme)] == 1} {
+    $tree_work tag configure dark -background $color(dark_table_bg)
+    $tree_work tag configure light -background $color(light_table_bg)
+}
 bind $tree_work <Double-ButtonPress-1> Edit
 
 $tree tag configure selected -background white  -foreground black
@@ -113,3 +119,4 @@ pack $frm_tree $frm_work -side left -expand true -fill both
 
 
 
+
diff --git a/lib/theme.tcl b/lib/theme.tcl
index 56f9387..5671a3f 100644
--- a/lib/theme.tcl
+++ b/lib/theme.tcl
@@ -30,3 +30,11 @@
 # option add *ScrollableFrame.Background $editor(bg) interactive
 # option add *ScrolledWindow.Background $editor(bg) interactive
 
+
+if {[info exists default(theme)] == 1  && $default(theme) eq "dark"} {
+    set color(dark_table_bg) "#6f6f6f"
+    set color(light_table_bg) "#424242"
+} else {
+    set color(dark_table_bg) "#e2e2e2"
+    set color(light_table_bg) "#ffffff"
+}
diff --git a/lib/ttk_theme_dark.tcl b/lib/ttk_theme_dark.tcl
index e4c06c3..13a256d 100644
--- a/lib/ttk_theme_dark.tcl
+++ b/lib/ttk_theme_dark.tcl
@@ -139,3 +139,4 @@ namespace eval ::tablelist:: {
 
 
 
+
diff --git a/rac_gui.cfg b/rac_gui.cfg
index 955c4aa..40d7a74 100644
--- a/rac_gui.cfg
+++ b/rac_gui.cfg
@@ -114,15 +114,13 @@ set default(auth) {
     os
 }
 
-
 ## Раскоментировать строки и прописать свои значения если
 ## для Информационных Баз используются эти параметры
 #set default(infobase_user) "ib_user"
 #set default(infobase_pwd) "ib_password"
 
-# цвета строк в таблице
-#set color(dark_table_bg) "#e2e2e2"
-#set color(light_table_bg) "#ffffff"
-set color(dark_table_bg) "#6f6f6f"
-set color(light_table_bg) "#424242"
+# Используемая тема
+# доступны: dark, clam, classic, default, alt
+set default(theme) dark
+
 
diff --git a/rac_gui.tcl b/rac_gui.tcl
index e78a029..5447115 100755
--- a/rac_gui.tcl
+++ b/rac_gui.tcl
@@ -110,4 +110,3 @@ if [file exists [file join $dir(work) 1c_srv_new.cfg]] {
     puts $servers_list
 }
 
-