manual replace of remaining hotkey Btn::text_fg

This commit is contained in:
Michael Kirk 2021-01-21 09:39:49 -06:00 committed by Dustin Carlino
parent de527bc9d8
commit 2b8e77de9f
6 changed files with 39 additions and 15 deletions

View File

@ -198,7 +198,11 @@ impl ChallengesPicker {
if current == idx {
col.push(Btn::text_fg(&stage.title).inactive(ctx));
} else {
col.push(Btn::text_fg(&stage.title).build_def(ctx, None));
col.push(
ctx.style()
.btn_secondary_light_text(&stage.title)
.build_def(ctx),
);
links.insert(stage.title, (name.to_string(), idx));
}
}

View File

@ -11,8 +11,8 @@ use map_gui::ID;
use map_model::{osm, ControlTrafficSignal, IntersectionID, NORMAL_LANE_THICKNESS};
use sim::Sim;
use widgetry::{
lctrl, Btn, Cached, Checkbox, Choice, Color, DrawBaselayer, Drawable, EventCtx, GeomBatch,
GfxCtx, HorizontalAlignment, Key, Line, Outcome, Panel, ScreenDims, State, StyledButtons, Text,
lctrl, Cached, Checkbox, Choice, Color, DrawBaselayer, Drawable, EventCtx, GeomBatch, GfxCtx,
HorizontalAlignment, Key, Line, Outcome, Panel, ScreenDims, State, StyledButtons, Text,
UpdateType, VerticalAlignment, Widget,
};
@ -58,7 +58,10 @@ impl DebugMode {
Checkbox::switch(ctx, "show labels", Key::Num5, false),
Checkbox::switch(ctx, "show route for all agents", Key::R, false),
Widget::col(vec![
Btn::text_fg("unhide everything").build_def(ctx, lctrl(Key::H)),
ctx.style()
.btn_secondary_light_text("unhide everything")
.hotkey(lctrl(Key::H))
.build_def(ctx),
ctx.style()
.btn_secondary_light_text("screenshot everything (for leaflet)")
.build_def(ctx),
@ -69,7 +72,10 @@ impl DebugMode {
.btn_secondary_light_text("search OSM metadata")
.hotkey(Key::Slash)
.build_def(ctx),
Btn::text_fg("clear OSM search results").build_def(ctx, lctrl(Key::Slash)),
ctx.style()
.btn_secondary_light_text("clear OSM search results")
.hotkey(Key::Slash)
.build_def(ctx),
ctx.style()
.btn_secondary_light_text("save sim state")
.hotkey(Key::O)

View File

@ -11,8 +11,8 @@ use map_gui::colors::ColorScheme;
use map_gui::tools::{ChooseSomething, PopupMsg};
use map_model::BuildingID;
use widgetry::{
lctrl, Btn, Choice, Color, Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key,
Line, Outcome, Panel, State, StyledButtons, Text, TextExt, VerticalAlignment, Widget,
lctrl, Choice, Color, Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Key, Line,
Outcome, Panel, State, StyledButtons, Text, TextExt, VerticalAlignment, Widget,
};
use crate::app::{App, Transition};
@ -78,7 +78,10 @@ impl ViewKML {
prettyprint_usize(objects.len())
)
.draw_text(ctx),
Btn::text_fg("load KML file").build_def(ctx, lctrl(Key::L)),
ctx.style()
.btn_secondary_light_text("load KML file")
.hotkey(lctrl(Key::L))
.build_def(ctx),
Widget::row(vec![
"Query:".draw_text(ctx),
Widget::dropdown(ctx, "query", "None".to_string(), choices),

View File

@ -101,7 +101,11 @@ pub fn bus_status(ctx: &mut EventCtx, app: &App, details: &mut Details, id: CarI
.map
.get_br(app.primary.sim.bus_route_id(id).unwrap());
rows.push(Btn::text_fg(format!("Serves route {}", route.short_name)).build_def(ctx, None));
rows.push(
ctx.style()
.btn_secondary_light_text(&format!("Serves route {}", route.short_name))
.build_def(ctx),
);
details.hyperlinks.insert(
format!("Serves route {}", route.short_name),
Tab::BusRoute(route.id),
@ -187,7 +191,11 @@ pub fn route(ctx: &mut EventCtx, app: &App, details: &mut Details, id: BusRouteI
rows.push(format!("No {} running", route.plural_noun()).draw_text(ctx));
} else {
for (bus, _, _, pt) in buses {
rows.push(Btn::text_fg(bus.to_string()).build_def(ctx, None));
rows.push(
ctx.style()
.btn_secondary_light_text(&bus.to_string())
.build_def(ctx),
);
details
.hyperlinks
.insert(bus.to_string(), Tab::BusStatus(bus));

View File

@ -11,8 +11,8 @@ use sim::{
TripMode, TripResult, VehicleType,
};
use widgetry::{
Btn, Color, ControlState, EdgeInsets, EventCtx, GeomBatch, Key, Line, RewriteColor,
StyledButtons, Text, TextExt, TextSpan, Widget,
Color, ControlState, EdgeInsets, EventCtx, GeomBatch, Key, Line, RewriteColor, StyledButtons,
Text, TextExt, TextSpan, Widget,
};
use crate::app::App;
@ -449,7 +449,9 @@ pub fn crowd(
// TODO What other info is useful to summarize?
rows.push(Widget::row(vec![
format!("{})", idx + 1).draw_text(ctx).centered_vert(),
Btn::text_fg(person.to_string()).build_def(ctx, None),
ctx.style()
.btn_secondary_light_text(&person.to_string())
.build_def(ctx),
]));
details.hyperlinks.insert(
person.to_string(),

View File

@ -87,11 +87,12 @@ impl<A: AppLike + 'static> CityPicker<A> {
continue;
}
// If there's only one map in the city, make the button directly load it.
let button = ctx.style().btn_secondary_light_text(&city);
let maps = MapName::list_all_maps_in_city(&city);
if maps.len() == 1 {
other_cities.push(Btn::text_fg(city).build(ctx, maps[0].path(), None));
other_cities.push(button.build_widget(ctx, &maps[0].path()));
} else {
other_cities.push(Btn::text_fg(city).no_tooltip().build_def(ctx, None));
other_cities.push(button.no_tooltip().build_def(ctx));
}
}
other_cities.push(