aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordam <dam@gudinoff>2022-04-09 03:12:32 +0000
committerdam <dam@gudinoff>2022-04-09 03:12:32 +0000
commit125a893ad6afe1347ae36317566270e0f3582611 (patch)
tree7ab9cb3b9f822015c096d4617b6abc8fc61c787e
parente02b6d1e72deaf5f98bc7d78c7f0e6d269174d7b (diff)
downloadsurgery-log-125a893ad6afe1347ae36317566270e0f3582611.tar.zst
surgery-log-125a893ad6afe1347ae36317566270e0f3582611.zip
Added vertical separation to OptionSetList. Item selected on database gets highlighted.
-rw-r--r--option_set/option_set_list.gd34
-rw-r--r--readme.md14
-rw-r--r--themes/dark.tres2
3 files changed, 18 insertions, 32 deletions
diff --git a/option_set/option_set_list.gd b/option_set/option_set_list.gd
index 4a8841f..1ab753b 100644
--- a/option_set/option_set_list.gd
+++ b/option_set/option_set_list.gd
@@ -5,11 +5,11 @@ const POINTER_VELOCITY_DECAYING_FACTOR: float = PI
const POINTER_VELOCITY_BOOST_FACTOR: float = 1.25
const EXACT_SELECTION: bool = false
-export var clear_signals_on_hide := true
-
signal selection_changed # (idx: int, text: String)
+export var clear_signals_on_hide := true
export var autowrap := true
+export var separation := 25
var v_scroll_bar : VScrollBar
var sensor : PointerInputSensor
@@ -58,17 +58,7 @@ func _init():
sensor.anchor_bottom = 1.0
sensor.name = "sensor"
add_child(sensor)
-
- normal_style = StyleBoxFlat.new()
- normal_style.border_width_bottom = border_size
- normal_style.border_color = Color.white * 0.333
- normal_style.bg_color = Color.transparent
-
- selected_style = StyleBoxFlat.new()
- selected_style.border_width_bottom = border_size
- selected_style.border_color = Color.white * 0.333
- selected_style.bg_color = Color.dimgray
-
+
connect("resized", self, "mark_as_dirty")
sensor.connect("on_press", self, "pointer_input_on_press_handler")
@@ -78,9 +68,17 @@ func _init():
sensor.connect("on_scroll", self, "pointer_input_on_scroll_handler")
-#func _ready():
-# for idx in range(5):
-# add_item(">> %d" % idx)
+func _ready():
+ normal_style = StyleBoxFlat.new()
+ normal_style.border_width_bottom = border_size
+ normal_style.border_color = Color.white * 0.333
+ normal_style.bg_color = Color.transparent
+
+ selected_style = StyleBoxFlat.new()
+ var bg_color = get_stylebox("pressed", "Button").bg_color
+ selected_style.border_width_bottom = border_size
+ selected_style.border_color = bg_color.lightened(0.333)
+ selected_style.bg_color = bg_color
func mark_as_dirty():
@@ -143,7 +141,7 @@ func build_labels():
var label := Label.new()
label.autowrap = autowrap
label.anchor_right = 1.0
- label.valign = Label.VALIGN_TOP
+ label.valign = Label.VALIGN_CENTER
labels.add_child(label)
delta -= 1
@@ -166,7 +164,7 @@ func build_labels():
for it in items:
proto_label.text = it
var line_count := proto_label.get_line_count()
- var height := line_count * line_height + (line_count - 1) * line_spacing + border_size
+ var height := line_count * line_height + (line_count - 1) * line_spacing + border_size + separation
position += height
labels_end_positions.append(position)
diff --git a/readme.md b/readme.md
index 7e7d02b..c347666 100644
--- a/readme.md
+++ b/readme.md
@@ -67,21 +67,7 @@ Surgery Log
- on database screen, should deselect selected item, otherwise should quit the app;
- [x] db entry should be printed as "%9s | %4s | %yyyy-%MM";
- [ ] Adjust theme:
- - [ ] Buttons normal are too dark;
- - [ ] Dialog buttons and stage items have minimum vertical size set to 62; maybe do this on theme;
- - [ ] LineEdit: thinner lines on normal; bigger brighter lines on focus; more vertical content margin
- - [x] Smaller font
- - [x] Rounder buttons
- - [ ] Increase buttons height
- - [ ] Make database and stage buttons equal;
- - [ ] Apply theme on menubutton popup;
- - [ ] Make panels (popup background) rounder;
- - [ ] Make all buttons with same style;
- - [ ] Maybe include different font with better icons;
- - [ ] Make rounded corners
- - [ ] LineEdit without fill and only one line below (stage may increase left margin)
- [ ] Increase scrollbar width (in content margin property)
- - [ ] Improve appearance of database menu;
- [ ] Create light theme;
- [ ] Create theme entry in menu and save on settings file;
- [ ] Cleanup code:
diff --git a/themes/dark.tres b/themes/dark.tres
index 3e3fcc2..93028ed 100644
--- a/themes/dark.tres
+++ b/themes/dark.tres
@@ -79,6 +79,8 @@ Button/styles/normal = SubResource( 2 )
Button/styles/pressed = SubResource( 4 )
ItemList/fonts/font = ExtResource( 2 )
ItemList/styles/bg = SubResource( 5 )
+ItemList/styles/selected = SubResource( 4 )
+ItemList/styles/selected_focus = SubResource( 4 )
LineEdit/styles/focus = SubResource( 9 )
LineEdit/styles/normal = SubResource( 7 )
LineEdit/styles/read_only = null