1# Copyright 2004-2021 Tom Rothamel <pytom@bishoujo.us>
2#
3# Permission is hereby granted, free of charge, to any person
4# obtaining a copy of this software and associated documentation files
5# (the "Software"), to deal in the Software without restriction,
6# including without limitation the rights to use, copy, modify, merge,
7# publish, distribute, sublicense, and/or sell copies of the Software,
8# and to permit persons to whom the Software is furnished to do so,
9# subject to the following conditions:
10#
11# The above copyright notice and this permission notice shall be
12# included in all copies or substantial portions of the Software.
13#
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22# This file is responsible for creating and defining the default styles
23# used by the system.
24
25init -1800 python:
26
27    # The style hierarchy root has to be initialized through Python
28    # code.
29    style.default = Style(None)
30    style.empty = Style(None)
31
32    # Fix up some styles originally defined in _errorhandling.rpym.
33    style.image = Style(style.default)
34    style.fixed = Style(style.default)
35
36init -1800:
37
38    # Declare styles and inheritance.
39
40    style text is default
41    style fixed is default
42    style hbox is default
43    style vbox is default
44    style grid is default
45    style side is default
46    style window is default
47    style image_placement is default
48    style image is default
49    style animation is default
50
51    style say_label is default
52    style say_dialogue is default
53    style say_thought is default
54    style say_window is window
55    style say_who_window is window
56    style say_two_window_vbox is vbox
57    style say_vbox is vbox
58
59    style menu is default
60    style menu_caption is default
61    style menu_choice is default
62    style menu_choice_button is default
63    style menu_choice_chosen is menu_choice
64    style menu_choice_chosen_button is menu_choice_button
65    style menu_window is window
66
67    style input is default
68    style input_text is input
69    style input_prompt is default
70    style input_window is window
71
72    style centered_window is default
73    style centered_text is default
74    style centered_vtext is default
75
76    style imagemap is image_placement
77    style hotspot is default
78    style imagemap_button is hotspot
79    style hotbar is default
80
81    style image_button is default
82    style image_button_image is default
83
84    style hyperlink is default
85    style hyperlink_text is default
86    style ruby_text is default
87
88    style viewport is default
89    style vpgrid is viewport
90    style drag is default
91
92    style motion is default
93    style transform is motion
94
95    style tile is default
96
97    # Not used - kept for compatibility.
98    style error_root is default
99
100    style frame is default
101    style menu_frame is frame
102
103    style button is default
104    style button_text is default
105
106    style small_button is button
107    style small_button_text is button_text
108
109    style radio_button is button
110    style radio_button_text is button_text
111
112    style check_button is button
113    style check_button_text is button_text
114
115    style large_button is default
116    style large_button_text is default
117
118    style label is default
119    style label_text is default
120
121    style prompt is default
122    style prompt_text is default
123
124    style bar is default
125    style vbar is default
126    style slider is default
127    style vslider is default
128    style scrollbar is default
129    style vscrollbar is default
130
131    style mm_root is default
132    style gm_root is default
133
134    # Default style.
135
136    style default:
137
138        # Text properties
139        font "DejaVuSans.ttf"
140        language "unicode"
141        antialias True
142        size 22
143        color (255, 255, 255, 255)
144        black_color (0, 0, 0, 255)
145        bold False
146        italic False
147        underline False
148        strikethrough False
149        kerning 0.0
150        drop_shadow None
151        drop_shadow_color (0, 0, 0, 255)
152        outlines [ ]
153        outline_scaling "step"
154        minwidth 0
155        text_align 0
156        justify False
157        text_y_fudge 0
158        first_indent 0
159        rest_indent 0
160        line_spacing 0
161        line_leading 0
162        line_overlap_split 0
163        layout "tex"
164        subtitle_width 0.9
165        slow_cps None
166        slow_cps_multiplier 1.0
167        slow_abortable False
168        ruby_style style.ruby_text
169        altruby_style style.altruby_text
170        # hyperlink_functions is set in 00defaults.rpy
171        hinting "auto"
172        adjust_spacing True
173
174        # Window properties
175        background None
176        xpadding 0
177        ypadding 0
178        xmargin 0
179        ymargin 0
180        xfill False
181        yfill False
182        modal False
183
184        # Size properties
185        xminimum 0
186        yminimum 0
187        xmaximum None
188        ymaximum None
189
190        # Position properties
191        xpos None
192        ypos None
193        xanchor None
194        yanchor None
195        xoffset 0
196        yoffset 0
197        subpixel False
198        mipmap None
199
200        # Sound properties
201        activate_sound None
202        hover_sound None
203
204        # Box properties
205        spacing 0
206        first_spacing None
207        box_layout None
208        box_wrap False
209        box_wrap_spacing 0
210        box_reverse False
211        order_reverse False
212        xfit False
213        yfit False
214
215        # Button properties
216        focus_mask None
217        focus_rect None
218        keyboard_focus True
219        key_events False
220        hover_key_events True
221
222        # Bar properties
223        fore_bar Null()
224        aft_bar Null()
225        thumb None
226        thumb_shadow None
227        left_gutter 0
228        right_gutter 0
229        thumb_offset 0
230        unscrollable None
231        bar_invert False
232        bar_resizing False
233        bar_vertical False
234
235        # Viewport properties
236        clipping False
237
238        # Grid properties
239        xspacing None
240        yspacing None
241
242    style empty:
243        take default
244
245    # Boxes
246
247    style hbox:
248        box_layout 'horizontal'
249
250    style vbox:
251        box_layout 'vertical'
252
253    # Motions, zooms, rotozooms, and transforms
254
255    style motion:
256        xanchor 0
257        yanchor 0
258        xpos 0
259        ypos 0
260
261    style transform:
262        subpixel True
263
264    # Windows
265
266    style window:
267        background Solid((0, 0, 0, 192))
268        xpadding 6
269        ypadding 6
270        xmargin 0
271        ymargin 0
272        xfill True
273        yfill False
274        yminimum 150
275        xalign 0.5
276        yalign 1.0
277
278    # Dialogue
279    style say_label:
280        bold True
281
282    style say_vbox:
283        spacing 8
284
285    style say_who_window:
286        xminimum 200
287        yminimum 34
288        xfill False
289        xalign 0
290
291    style say_two_window_vbox:
292        yalign 1.0
293
294    # Menus
295
296    style menu_choice:
297        idle_color "#0ff"
298        hover_color "#ff0"
299
300    # Input
301
302    style input:
303        color "#ff0"
304        adjust_spacing False
305
306    # Centered text and dialogue
307
308    style centered_window:
309        xalign 0.5
310        xfill False
311        yalign 0.5
312        yfill False
313        xpadding 10
314
315    style centered_text:
316        textalign 0.5
317        xalign 0.5
318        yalign 0.5
319        layout "subtitle"
320
321    style centered_vtext:
322        textalign 0.5
323        xalign 0.5
324        yalign 0.5
325        vertical True
326
327    # Hyperlinks
328
329    style hyperlink_text:
330        underline True
331        hover_color "#0ff"
332        idle_color "#08f"
333
334    # Ruby text (Furigana)
335
336    style ruby_text:
337        size 22
338        xoffset 0
339
340    style altruby_text:
341        size 22
342        xoffset 0
343
344    # Bars
345
346    style vbar:
347        bar_vertical True
348
349    style vslider:
350        bar_vertical True
351
352    style vscrollbar:
353        bar_vertical True
354        bar_invert True
355
356    style viewport:
357        xfill True
358        yfill True
359
360    style vpgrid:
361        xfill False
362        yfill False
363
364    style drag:
365        focus_mask True
366
367    # Out-of-game menu root windows
368
369    style mm_root:
370        background "#000"
371        xfill True
372        yfill True
373
374    style gm_root:
375        background "#000"
376        xfill True
377        yfill True
378
379    # Tiles
380
381    style tile:
382        clipping True
383
384    # Labels
385    style pref_label:
386        alt "" # We expect the labelled buttons/bars to read themselves out.
387
388
389################################################################################
390# Style reset.
391#
392# Resets styles that are changed above to their defaults.
393
394init label _style_reset:
395
396    style say_label:
397        clear
398
399    style window:
400        clear
401
402    style say_vbox:
403        clear
404
405    style say_who_window:
406        clear
407
408    style say_two_window_vbox:
409        clear
410
411    style menu_choice:
412        clear
413
414    style input:
415        clear
416
417    style hyperlink_text:
418        clear
419
420    style button:
421        clear
422
423    style button_text:
424        clear
425
426    style nvl_window:
427        clear
428
429    style nvl_entry:
430        clear
431
432    style nvl_label:
433        clear
434
435    style nvl_dialogue:
436        clear
437
438    style nvl_menu_button:
439        clear
440
441    style nvl_menu_button_text:
442        clear
443
444    return
445
446# Older init code doesn't necessarily like defer styles.
447init 1001 python:
448    config.defer_styles = False
449