Commit Graph

67 Commits

Author SHA1 Message Date
Vinzent Steinberg
fd3b0e2a14
Fix compilation failures and most clippy warnings (#642)
* abstutil: Fix compilation failure

* map_gui: Fix compilation

* traffic_signal_data: Fix compilation failure

* map_model: Fix compilation failure

* abstutil: Fix doctests

* abstio: Fix most clippy warnings

* abstutil: Fix most clippy warnings

* collisions: Fix clippy warning

* convert_osm: Fix clippy warnings

* sim: Fix most clippy warnings

* geom: Fix clippy warnings

* kml: Fix clippy warnings

* map_model: Fix most clippy warnings

* fifteen_min: Fix clippy warnings

* game: Fix many clippy warnings

* Disable some noisy clippy warnings

* headless: Fix clippy warnings

* importer: Fix clippy warnings

* map_editor: Fix clippy warnings

* map_gui: Fix clippy warnings

* osm_viewer: Fix clippy warnings

* parking_mapper: Fix most clippy warnings

* popdat: Fix clippy warnings

* santa: Fix clippy warnings

* sumo: Fix clippy warnings

* traffic_seitan: Fix clippy warning

* updater: Fix clippy warnings

* widgetry: Fix clippy warnings

* tests: Fix some clippy warnings

* Fix compilation on stable Rust

* Simplify unwrapping

* Make use of `Entry` more readable

* Fix formatting

* Fix code that was broken in the refactoring

* Apply cargo +stable fmt

* Fix code that was broken in the refactoring, second try

* Remove `Default` impls that are equivalent to `new`

* Remove obsolete clippy wrapper

* Avoid turbofish

* Prefer `unwrap_or_else` over allowing `clippy::or_fun_call`

* Remove redundant `into_iter`

* Fix typo

* Prefer `&& false` over commenting code out

* Fix some clippy warnings

Co-authored-by: Dustin Carlino <dabreegster@gmail.com>
2021-05-14 08:32:56 -07:00
Dustin Carlino
2c5e0dae03 Fix static trait object method warning that we're now hitting in Rust 1.52
The <dyn ...> syntax is gross, but I don't think there's a way to avoid
this without defining a differently named empty struct and putting the
static method on that
2021-05-11 12:31:58 -07:00
Dustin Carlino
c9be865966 Fix Santa 2021-05-06 14:12:45 -07:00
Dustin Carlino
bc591c1b5f Plumb back the widget name in Outcome::Changed 2021-04-22 13:09:32 -07:00
Dustin Carlino
2112736a1f Polish UI of new road editor 2021-04-22 07:57:23 -07:00
Dustin Carlino
ee78644089 Download files before starting a challenge mode or Santa level, if needed 2021-04-20 16:10:17 -07:00
Dustin Carlino
196af2a1f4 Refactor: store Direction for a Lane, simplifying Lane->DirectedRoadID. #555 2021-04-06 17:03:24 -07:00
Michael Kirk
4f81f186af
embed mode and reworked web build system (#592)
* root element id from Settings, respect element size

* Plumb assets root via settings

* adapt crates to new wasm api

* more FileLoader cleanup

* use tsc bin from node_modules

* avoid spurious unlink errors

GNU Make considers the src/*/wasm_pkg targets as intermediate build
files and attempted to `rm` them. We can stop that my marking them as
`.PRECIOUS`

https://www.gnu.org/software/make/manual/html_node/Special-Targets.html

* `open` doesn't work on Linux

We could do something with xdg-open, but meh, not worth having platform
dependent logic for this.

* fix typo, clarify instructions

* make server compatible with older python install on linux

* revert change - we dont want to include music on web

the leading "-" means exclude a subdir of an included dir.

* better wrap of comments

* fix misfire in copy/pasted comment

* update docs
2021-04-01 19:31:02 -07:00
Dustin Carlino
7f4f83d4e0 Refactor all of the places drawing start/goal markers on the map, and actually line up the tip of the icon with the position. 2021-03-31 14:23:16 -07:00
Michael Kirk
af079c24e6 rename txt.add -> txt.add_line 2021-03-19 17:48:30 -07:00
Michael Kirk
affd582093 more concise Text / tooltip() 2021-03-19 16:48:54 -07:00
Michael Kirk
546599e4f9 Replace ButtonImage with Image 2021-03-17 19:06:43 -07:00
Dustin Carlino
8be24bf007 Use AsRef<str> in more widgetry methods, getting rid of &format at many
call-sites. #253

To make some of these work, changed Label to store a String. Ultimately
it gets transformed into Text, so we need to allocate eventually.
2021-03-11 11:29:18 -08:00
Dustin Carlino
65d7bc5c8e Rename {Text,TextSpan}::draw to into_widget, for consistency. #253 2021-03-09 09:59:30 -08:00
Dustin Carlino
a4a20ce1e5 draw_text renamed to text_widget, for consistency. #253 2021-03-09 09:56:41 -08:00
Dustin Carlino
b0bcdb2115
Replace Widget::draw_batch with batch.into_widget, for consistency. #253 (#554) 2021-03-09 08:55:12 -08:00
Michael Kirk
86799e2832 Remove StyledButtons - instead implement everything on the individual
ButtonStyle
2021-02-27 21:08:26 -08:00
Michael Kirk
11a904a4da WIP: separate style for plain 2021-02-27 21:08:26 -08:00
Michael Kirk
c3985ffdd1 btn_solid -> btn_tab and replace inappropriate uses 2021-02-27 21:08:26 -08:00
Michael Kirk
cee0e5dbbd Use btn_primary.* methods instead of btn_primary_* 2021-02-27 21:08:26 -08:00
Michael Kirk
1e75352ce0 Theme section bg
`Widget::outline` takes OutlineStyle
2021-02-27 13:13:41 -08:00
Michael Kirk
4b2f3888ed replace btn_solid w/ primary/outline as appropriate 2021-02-26 14:05:19 -08:00
Michael Kirk
3019a6fff1
Introduce Image component to handle themed icons (#537) 2021-02-25 18:06:19 -08:00
Michael Kirk
d774aeae44 rename toggle/checkbox 2021-02-24 14:59:47 -08:00
Michael Kirk
3ab7fc4361
Fix tooltips and hotkey for day-theme (#528) 2021-02-24 10:52:57 -08:00
Michael Kirk
e6ed2e67de Collapse button styles to be theme specified (no visible changes).
Button colors are now determined by the color scheme, but for now all
schemes are hardcoded to use the same "night" button colors. Read on for
rationale...

Previously, which button colors to use (dark/light) was specified inline
while building the UI.

Eventually we want to live in a world where color scheme determines:
- panel colors
- button colors
- text colors

The theme could already choose panel colors easily enough, but because
the buttons and text were not determined by theme, choosing anything
other than a black or dark grey panel color makes the buttons and text
unreadable.

This PR tackled the themeable "button colors" portion, but all themes
continue to use the "night" colors for now, because using the actual
"day" colors would still make the text unreadable.

next up: themeable text!

The one intentional regression is within the pregame tutorial,
which has always been styled differently from the rest of the app. An
expeditious hack has caused the prev/next/continue buttons to lose their
visible hover state. I'll restore this upon completing the day theme
work.
2021-02-23 09:52:33 -08:00
Dustin Carlino
634dc4fad1 Remove the quit button from Santa too. Somehow missed this in ca07c522ea, noticed it on web. 2021-02-04 11:26:16 -08:00
Michael Kirk
38dc60fbea
Add method to GeomBatch to prefer cached flavor of loading svg. (#493)
It was my intention when introducing the cached vs uncached flavors that
we'd prefer the cached flavor for anything referencing bytes from a
file, like icons and UI glyphs, and that we'd only use the uncached
flavor for dynamic things like "face" generation.
2021-02-01 16:24:56 -08:00
Dustin Carlino
3e40686a6b Fix a bunch of links after the repository renaming. 2021-01-31 15:50:48 -08:00
Dustin Carlino
8f0c027bb0 Fix critical bug causing a crash only in the .zip releases, where widgetry icons aren't present relative to the data/ directory. 2021-01-30 14:20:28 -08:00
Michael Kirk
07738d2cef
popup and persistent split to spec (#480)
* introduce "pill" to be explicit about fully rounded, vs a "None" radius

* no-op transition to CornerRadii

* popup button to spec

* restore "fully rounded" layout behavior

* use plain light to better show highlight

* persistent split to spec (for day theme anyway)

* remove night-theme colors for speed panel

* fixup docs for pill

* CR: remove unnecessary `row`

* CR: remove outdated doc

* import order
2021-01-24 15:32:28 -08:00
Dustin Carlino
7d8c818eea Remove the last traces of the old orange hovering color. 2021-01-24 13:09:37 -08:00
Dustin Carlino
ee62d05f8d Attempt better colors for pedestrian plazas and the map background in night mode.
Also fix Santa, broken by the button SVG moving.
2021-01-23 17:47:10 -08:00
Michael Kirk
1990642dee More conventional button names
This was all done by search/replace, and should not affect
functionality.

Goals:

- be consistent with the figma terminology.
- consistently order:
  "btn_{solid|outline|plain}_{dark|light}_{text|image|dropdown|back|etc}"
2021-01-22 13:11:42 -06:00
Michael Kirk
2b8511251a fix scaling: replace remaining buttons with baked-in-text 2021-01-21 15:25:46 -08:00
Michael Kirk
4989887117 remove final references to Btn 2021-01-21 15:25:46 -08:00
Michael Kirk
542600da2f Replace Btn::fg_text.inactive 2021-01-21 15:25:46 -08:00
Michael Kirk
1f75145a8a introduce btn_next/btn_prev, parameterize disabled to simplify common usage 2021-01-21 15:25:46 -08:00
Michael Kirk
a2c5ce0fb3 regex upgrade Btn::text_fg: No hotkeys, inline &str
Btn\:\:text_fg\("([^"]*)"\).build_def\(ctx, None\)
ctx.style().btn_secondary_light_text("$1").build_def(ctx)
2021-01-21 15:25:46 -08:00
Michael Kirk
bfb190a730 manually update remaining Btn::text_bg2 2021-01-21 15:25:46 -08:00
Michael Kirk
a5b6dca62a replace Btn::text_bg2 w/ regex
In case I have to revisit, here's the regex I used:
    Btn::text_bg2\(([^)]*)\)*.build_def\(ctx, ([^()]*)\)
    ctx.style().btn_primary_dark_text($1).hotkey($2).build_def(ctx)

And something like this for the "no hotkey" case
    Btn::text_bg2\(([^)]*)\)*.build_def\(ctx, None\)
    ctx.style().btn_primary_dark_text($1).build_def(ctx)
2021-01-21 15:25:46 -08:00
Michael Kirk
54e937408a remove remaining Btn::plaintext 2021-01-21 15:25:46 -08:00
Michael Kirk
69e31029ac replace Btn::svg_def 2021-01-21 15:25:46 -08:00
Michael Kirk
0a612601ca icon buttons should be same height as text buttons 2021-01-21 09:08:41 -08:00
Michael Kirk
c013c8d342 replace remaining Btn::custom 2021-01-21 09:08:41 -08:00
Michael Kirk
52880c68d8 replace Btn::custom in switch and checkboxes
(also add SVG checkboxes!)
2021-01-21 09:08:41 -08:00
Michael Kirk
5b6c88d3b4
more button progress and fixups (#465)
* replace Btn::txt with new ButtonBuilder styles

* fixup! replace Btn::text_bg1 with ButtonBuilder (btn_primary_light)
2021-01-20 14:11:28 -08:00
Michael Kirk
743b74510d
replace Btn::close with new style (#463) 2021-01-19 16:17:11 -08:00
Dustin Carlino
a7f3e998b7 Start to generate two simple scenario from actdev desire lines. https://github.com/cyipt/actdev/issues/32 2021-01-14 10:31:21 -08:00
Dustin Carlino
e233012ee8 Use a full modal to select a scenario. During the button UI audit, we
realized a dropdown doesn't make sense. A larger panel gives room to
explain what the choices mean.
2021-01-14 09:05:44 -08:00