UI: add theming support to variable list
authorJan Vrany <jan.vrany@labware.com>
Fri, 18 Mar 2022 11:44:19 +0000
changeset 253 2442edfd18bd
parent 252 3b99f2b0fa86
child 254 74ee8df22ea7
UI: add theming support to variable list
VDBRegisterListApplication.st
VDBRegisterPresenter.st
VDBVariableObjectListApplication.st
styles/Adwaita_common.style
--- a/VDBRegisterListApplication.st	Thu Mar 17 21:54:57 2022 +0000
+++ b/VDBRegisterListApplication.st	Fri Mar 18 11:44:19 2022 +0000
@@ -116,7 +116,7 @@
 backgroundColorFor: aVDBRegisterPresenter
     <resource: #style (#'registerListApplication.changedRegisterBackgroundColor')>
 
-    aVDBRegisterPresenter register hasChanged ifTrue:[ 
+    aVDBRegisterPresenter hasChanged ifTrue:[ 
         ^ self styleSheet colorAt: 'registerListApplication.changedRegisterBackgroundColor' default:[ Color yellow lighter lighter ]
     ].
     ^ nil
@@ -127,7 +127,7 @@
 
     "Created: / 01-02-2018 / 09:08:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 27-09-2018 / 20:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (comment): / 18-11-2021 / 12:20:35 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified: / 18-03-2022 / 11:28:00 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 frameHolder: aValueModel
--- a/VDBRegisterPresenter.st	Thu Mar 17 21:54:57 2022 +0000
+++ b/VDBRegisterPresenter.st	Fri Mar 18 11:44:19 2022 +0000
@@ -1,7 +1,7 @@
 "
 jv:vdb - Visual / VM Debugger
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2021 LabWare
+Copyright (C) 2021-2022 LabWare
 
 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
 
@@ -24,7 +24,7 @@
 "
 jv:vdb - Visual / VM Debugger
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2021 LabWare
+Copyright (C) 2021-2022 LabWare
 
 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
 
@@ -127,6 +127,12 @@
 
 !VDBRegisterPresenter methodsFor:'protocol-queries'!
 
+hasChanged
+    ^ register hasChanged
+
+    "Created: / 18-03-2022 / 11:27:45 / Jan Vrany <jan.vrany@labware.com>"
+!
+
 hasChildren
     ^ false
 
--- a/VDBVariableObjectListApplication.st	Thu Mar 17 21:54:57 2022 +0000
+++ b/VDBVariableObjectListApplication.st	Fri Mar 18 11:44:19 2022 +0000
@@ -120,27 +120,36 @@
 !VDBVariableObjectListApplication methodsFor:'aspects'!
 
 backgroundColorFor: aVDBVariableOjectPresenter
+    <resource: #style (#'variableObjectListApplication.changedVariableObjectBackgroundColor')>
 
-    ^aVDBVariableOjectPresenter hasChanged
-        ifTrue:[ Color yellow lighter lighter ]
-        ifFalse:[ nil ]
+    aVDBVariableOjectPresenter hasChanged ifTrue:[ 
+        ^ self styleSheet colorAt: 'variableObjectListApplication.changedVariableObjectBackgroundColor' default:[ Color yellow lighter lighter ]
+    ].
+    ^ nil
+
+    "
+    VDBVariableObjectListApplication initializeDefaultStyleSheet; defaultStyleSheet.
+    "
 
     "Created: / 01-02-2018 / 09:08:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 25-09-2019 / 00:59:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 18-03-2022 / 11:24:48 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified (comment): / 18-03-2022 / 11:43:24 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 foregroundColorFor: aVDBVariableOjectPresenter
+    <resource: #style (#'variableObjectListApplication.invalidVariableObjectForegroundColor')>
+
     | value |
 
     value := aVDBVariableOjectPresenter valueString.
     (value notNil and:[((value includesSubString: 'invalid') or:[ value includesSubString: 'cannot'])]) ifTrue:[ 
-        ^ Color red
+        ^ self styleSheet colorAt: 'variableObjectListApplication.invalidVariableObjectForegroundColor' default:[ Color red ]
     ].
     ^ nil
 
     "Created: / 30-07-2018 / 11:14:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 06-10-2018 / 09:09:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 18-03-2022 / 11:30:18 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 frameHolder: aValueModel
--- a/styles/Adwaita_common.style	Thu Mar 17 21:54:57 2022 +0000
+++ b/styles/Adwaita_common.style	Fri Mar 18 11:44:19 2022 +0000
@@ -12,3 +12,9 @@
 ; class VDBRegisterListApplication
 ;
 registerListApplication.changedRegisterBackgroundColor		$yellow_bg_color darker
+
+;
+; class VDBVariableObjectListApplication
+;
+variableObjectListApplication.changedVariableObjectBackgroundColor 	$yellow_bg_color darker
+variableObjectListApplication.invalidVariableObjectForegroundColor  $red_bg_color lighter
\ No newline at end of file