#textdomain wesnoth-test ### ### 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]