wesnoth/data/gui/window/debug_clock.cfg
Steve Cotton 489d364cb6 Make the debug clock look right
This is the only widget in mainline using GUI2's [draw][circle] tag. I'm
currently working on a change to the C++ text_shape class, and want to
be able to regression-test the placement of [circle]s after that change.

I'd be okay with deprecating both [circle] and [round_rectangle] as neither
seems to be used elsewhere, but this close to feature-freeze I'd prefer to keep
them in 1.16 rather than suggest removing them now.

To see the widget, start the game with `wesnoth --clock`, and then click the
button underneath "Quit" on the main menu.
2021-04-05 12:59:10 +02:00

425 lines
7.4 KiB
INI

#textdomain wesnoth-lib
###
### Definition of the window to show the debug_clock for testing the drawing
### timer.
###
#define _GUI_TICK_MARK ANGLE TEXT
[text]
x = "(round(125 + (100.0 * sin({ANGLE})) - (text_width / 2)))"
y = "(round(125 - (100.0 * cos({ANGLE})) - (text_height / 2)))"
h = 20
w = 30
font_size = 10
color = "255,255,255,255"
text = "{TEXT}"
[/text]
#enddef
[window]
id = "debug_clock"
description = "Clock dialog to test the drawing timer."
[resolution]
definition = "default"
click_dismiss = true
automatic_placement = true
vertical_placement = "top"
horizontal_placement = "left"
[tooltip]
id = "tooltip"
[/tooltip]
[helptip]
id = "tooltip"
[/helptip]
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "title"
label = "Debug drawing clock"
[/label]
[/column]
[/row]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[progress_bar]
id = "hour_percentage"
tooltip = "Hours in percent"
help = "The full range of the bar is 24 hours."
[/progress_bar]
[/column]
[/row]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[progress_bar]
id = "minute_percentage"
[/progress_bar]
[/column]
[/row]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[progress_bar]
id = "second_percentage"
[/progress_bar]
[/column]
[/row]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[slider]
id = "hour"
definition = "clock"
minimum_value = 0
maximum_value = 86399
step_size = 1
[/slider]
[/column]
[/row]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[slider]
id = "minute"
definition = "clock"
minimum_value = 0
maximum_value = 3599
step_size = 1
label = 3599
[/slider]
[/column]
[/row]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[slider]
id = "second"
definition = "clock"
minimum_value = 0
maximum_value = 59
step_size = 1
label = 59
[/slider]
[/column]
[/row]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[matrix]
id = "matrix"
definition = "default"
vertical_scrollbar_mode = "auto"
horizontal_scrollbar_mode = "auto"
[main]
[pane]
id = "pane"
grow_direction = "vertical"
parallel_items = 1
[item_definition]
[row]
[column]
grow_factor = 1
horizontal_grow = true
[label]
id = "time"
definition = "default"
[/label]
[/column]
[/row]
[/item_definition]
[/pane]
[/main]
[/matrix]
[/column]
[/row]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "center"
vertical_alignment = "center"
[drawing]
id = "clock"
definition = "default"
width = 250
height = 280
[draw]
# Add hour ticks, positioned at radius 100 from the center. The leading spaces on 1-9 are
# because the gap between the text and the outer [circle]radius=115 is more obvious than the
# placement on the radius 100 circle itself - without the leading space, aligning the center
# of the single-digit texts correctly looks wrong.
{_GUI_TICK_MARK 15.0 ( 1)}
{_GUI_TICK_MARK 30.0 ( 2)}
{_GUI_TICK_MARK 45.0 ( 3)}
{_GUI_TICK_MARK 60.0 ( 4)}
{_GUI_TICK_MARK 75.0 ( 5)}
{_GUI_TICK_MARK 90.0 ( 6)}
{_GUI_TICK_MARK 105.0 ( 7)}
{_GUI_TICK_MARK 120.0 ( 8)}
{_GUI_TICK_MARK 135.0 ( 9)}
{_GUI_TICK_MARK 150.0 (10)}
{_GUI_TICK_MARK 165.0 (11)}
{_GUI_TICK_MARK 180.0 (12)}
{_GUI_TICK_MARK 195.0 (13)}
{_GUI_TICK_MARK 210.0 (14)}
{_GUI_TICK_MARK 225.0 (15)}
{_GUI_TICK_MARK 240.0 (16)}
{_GUI_TICK_MARK 255.0 (17)}
{_GUI_TICK_MARK 270.0 (18)}
{_GUI_TICK_MARK 285.0 (19)}
{_GUI_TICK_MARK 300.0 (20)}
{_GUI_TICK_MARK 315.0 (21)}
{_GUI_TICK_MARK 330.0 (22)}
{_GUI_TICK_MARK 345.0 (23)}
{_GUI_TICK_MARK 360.0 (24)}
# Add outer circle.
[circle]
x = 125
y = 125
radius = 115
border_color = "255,255,255,255"
border_thickness = 2
fill_color = "128,128,128,128"
[/circle]
# TODO
# Add the hands.
[line]
x1 = 125
y1 = 125
x2 = "(round(125 + (90.0 * sin(360.0 * second / 60.0))))"
y2 = "(round(125 - (90.0 * cos(360.0 * second / 60.0))))"
color = "255,255,255,255"
[/line]
[line]
x1 = 125
y1 = 125
x2 = "(round(125 + (70.0 * sin(360.0 * minute / (60.0 * 60.0)))))"
y2 = "(round(125 - (70.0 * cos(360.0 * minute / (60.0 * 60.0)))))"
color = "128,128,128,255"
[/line]
[line]
x1 = 125
y1 = 125
x2 = "(round(125 + (40.0 * sin(360.0 * hour / (60.0 * 60.0 * 24.0)))))"
y2 = "(round(125 - (40.0 * cos(360.0 * hour / (60.0 * 60.0 * 24.0)))))"
color = "64,64,64,255"
[/line]
# Show the time as string.
[text]
x = 0
y = 250
w = "(width)"
h = 30
font_size = 20
maximum_width = "(width)"
text_alignment = "center"
color = "128,128,128,255"
text = "(concatenate(
substring(concatenate(0, 0, (hour / (60 * 60))), -2)
, ':'
, substring(concatenate(0, 0, (minute / 60)), -2)
, ':'
, substring(concatenate(0, 0, second), -2)))"
[/text]
[/draw]
[/drawing]
[/column]
[/row]
[/grid]
[/resolution]
[/window]
[slider_definition]
id = "clock"
description = "Specialized slider to test the clock dialog."
[resolution]
min_width = 150
min_height = 22
default_width = 250
default_height = 22
max_width = 0
max_height = 22
minimum_positioner_length = 16
maximum_positioner_length = 16
left_offset = 0
right_offset = 0
text_font_size = 1
[state_enabled]
[draw]
[/draw]
[/state_enabled]
[state_disabled]
[draw]
#
# Groove
#
[line]
x1 = 0
y1 = "(height / 2)"
x2 = "(width - 1)"
y2 = "(height / 2)"
color = {GUI__FONT_COLOR_ENABLED__DEFAULT}
thickness = 1
[/line]
#
# Slider
#
[image]
x = "(positioner_offset)"
y = "(if (image_height < height, (height - image_height) / 2, 0))"
name = "buttons/sliders/slider.png"
[/image]
[/draw]
[/state_disabled]
[state_pressed]
[draw]
[/draw]
[/state_pressed]
[state_focused]
[draw]
[/draw]
[/state_focused]
[/resolution]
[/slider_definition]