mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 23:43:25 +03:00
replace Btn::text_bg1 with ButtonBuilder (btn_primary_light)
This commit is contained in:
parent
e1ec69f9f7
commit
11ffef5716
@ -4,7 +4,7 @@ use geom::{Angle, Circle, Distance, Speed, Time};
|
||||
use map_gui::render::DrawPedestrian;
|
||||
use map_model::{BuildingID, LaneID, OffstreetParking, Traversable, SIDEWALK_THICKNESS};
|
||||
use sim::{DrawPedestrianInput, PedestrianID, PersonID, TripMode, TripResult};
|
||||
use widgetry::{Btn, Color, EventCtx, Line, Text, TextExt, Widget};
|
||||
use widgetry::{Color, EventCtx, Line, StyledButtons, Text, TextExt, Widget};
|
||||
|
||||
use crate::app::App;
|
||||
use crate::info::{header_btns, make_table, make_tabs, Details, Tab};
|
||||
@ -104,7 +104,11 @@ pub fn info(ctx: &mut EventCtx, app: &App, details: &mut Details, id: BuildingID
|
||||
}
|
||||
|
||||
if app.opts.dev {
|
||||
rows.push(Btn::text_bg1("Open OSM").build(ctx, format!("open {}", b.orig_id), None));
|
||||
rows.push(
|
||||
ctx.style()
|
||||
.btn_primary_light_text("Open OSM")
|
||||
.build_widget(ctx, &format!("open {}", b.orig_id)),
|
||||
);
|
||||
|
||||
if !b.osm_tags.is_empty() {
|
||||
rows.push("Raw OpenStreetMap data".draw_text(ctx));
|
||||
@ -150,7 +154,9 @@ pub fn people(ctx: &mut EventCtx, app: &App, details: &mut Details, id: Building
|
||||
.hyperlinks
|
||||
.insert(p.to_string(), Tab::PersonTrips(p, BTreeMap::new()));
|
||||
let widget = Widget::col(vec![
|
||||
Btn::text_bg1(p.to_string()).build_def(ctx, None),
|
||||
ctx.style()
|
||||
.btn_primary_light_text(&p.to_string())
|
||||
.build_def(ctx),
|
||||
if let Some((t, mode)) = next_trip {
|
||||
format!(
|
||||
"Leaving in {} to {}",
|
||||
|
@ -4,7 +4,9 @@ use map_gui::tools::ColorNetwork;
|
||||
use map_gui::ID;
|
||||
use map_model::{BusRoute, BusRouteID, BusStopID, PathStep};
|
||||
use sim::{AgentID, CarID};
|
||||
use widgetry::{Btn, Color, EventCtx, Key, Line, RewriteColor, Text, TextExt, Widget};
|
||||
use widgetry::{
|
||||
Btn, Color, EventCtx, Key, Line, RewriteColor, StyledButtons, Text, TextExt, Widget,
|
||||
};
|
||||
|
||||
use crate::app::App;
|
||||
use crate::info::{header_btns, make_tabs, Details, Tab};
|
||||
@ -174,11 +176,11 @@ pub fn route(ctx: &mut EventCtx, app: &App, details: &mut Details, id: BusRouteI
|
||||
);
|
||||
|
||||
if app.opts.dev {
|
||||
rows.push(Btn::text_bg1("Open OSM relation").build(
|
||||
ctx,
|
||||
format!("open {}", route.osm_rel_id),
|
||||
None,
|
||||
));
|
||||
rows.push(
|
||||
ctx.style()
|
||||
.btn_primary_light_text("Open OSM relation")
|
||||
.build_widget(ctx, &format!("open {}", route.osm_rel_id)),
|
||||
);
|
||||
}
|
||||
|
||||
let buses = app.primary.sim.status_of_buses(id, map);
|
||||
|
@ -1,5 +1,5 @@
|
||||
use map_model::AreaID;
|
||||
use widgetry::{Btn, EventCtx, Line, Widget};
|
||||
use widgetry::{EventCtx, Line, StyledButtons, Widget};
|
||||
|
||||
use crate::app::App;
|
||||
use crate::info::{header_btns, make_table, Details};
|
||||
@ -15,7 +15,11 @@ pub fn area(ctx: &EventCtx, app: &App, _: &mut Details, id: AreaID) -> Vec<Widge
|
||||
let area = app.primary.map.get_a(id);
|
||||
|
||||
if let Some(osm_id) = area.osm_id {
|
||||
rows.push(Btn::text_bg1("Open in OSM").build(ctx, format!("open {}", osm_id), None));
|
||||
rows.push(
|
||||
ctx.style()
|
||||
.btn_primary_light_text("Open in OSM")
|
||||
.build_widget(ctx, &format!("open {}", osm_id)),
|
||||
);
|
||||
}
|
||||
|
||||
rows.extend(make_table(
|
||||
|
@ -8,7 +8,7 @@ use map_model::{IntersectionID, IntersectionType, StageType};
|
||||
use sim::AgentType;
|
||||
use widgetry::{
|
||||
Btn, Checkbox, Color, DrawWithTooltips, EventCtx, FanChart, GeomBatch, Line, PlotOptions,
|
||||
ScatterPlot, Series, Text, Widget,
|
||||
ScatterPlot, Series, StyledButtons, Text, Widget,
|
||||
};
|
||||
|
||||
use crate::app::App;
|
||||
@ -35,7 +35,11 @@ pub fn info(ctx: &EventCtx, app: &App, details: &mut Details, id: IntersectionID
|
||||
rows.push(txt.draw(ctx));
|
||||
|
||||
if app.opts.dev {
|
||||
rows.push(Btn::text_bg1("Open OSM node").build(ctx, format!("open {}", i.orig_id), None));
|
||||
rows.push(
|
||||
ctx.style()
|
||||
.btn_primary_light_text("Open OSM node")
|
||||
.build_widget(ctx, &format!("open {}", i.orig_id)),
|
||||
);
|
||||
}
|
||||
|
||||
rows
|
||||
|
@ -2,7 +2,9 @@ use std::collections::HashSet;
|
||||
|
||||
use abstutil::prettyprint_usize;
|
||||
use map_model::{LaneID, PathConstraints};
|
||||
use widgetry::{Btn, EventCtx, Line, LinePlot, PlotOptions, Series, Text, TextExt, Widget};
|
||||
use widgetry::{
|
||||
EventCtx, Line, LinePlot, PlotOptions, Series, StyledButtons, Text, TextExt, Widget,
|
||||
};
|
||||
|
||||
use crate::app::App;
|
||||
use crate::info::{header_btns, make_table, make_tabs, throughput, DataOptions, Details, Tab};
|
||||
@ -163,11 +165,11 @@ pub fn debug(ctx: &EventCtx, app: &App, details: &mut Details, id: LaneID) -> Ve
|
||||
|
||||
rows.extend(make_table(ctx, kv));
|
||||
|
||||
rows.push(Btn::text_bg1("Open OSM way").build(
|
||||
ctx,
|
||||
format!("open {}", r.orig_id.osm_way_id),
|
||||
None,
|
||||
));
|
||||
rows.push(
|
||||
ctx.style()
|
||||
.btn_primary_light_text("Open OSM way")
|
||||
.build_widget(ctx, &format!("open {}", r.orig_id.osm_way_id)),
|
||||
);
|
||||
|
||||
let mut txt = Text::from(Line(""));
|
||||
txt.add(Line("Raw OpenStreetMap data"));
|
||||
|
@ -2,7 +2,7 @@ use std::collections::HashSet;
|
||||
|
||||
use abstutil::prettyprint_usize;
|
||||
use map_model::ParkingLotID;
|
||||
use widgetry::{Btn, EventCtx, Line, LinePlot, PlotOptions, Series, TextExt, Widget};
|
||||
use widgetry::{EventCtx, Line, LinePlot, PlotOptions, Series, StyledButtons, TextExt, Widget};
|
||||
|
||||
use crate::app::App;
|
||||
use crate::info::{header_btns, make_tabs, Details, Tab};
|
||||
@ -54,7 +54,11 @@ pub fn info(ctx: &mut EventCtx, app: &App, details: &mut Details, id: ParkingLot
|
||||
));
|
||||
|
||||
if app.opts.dev {
|
||||
rows.push(Btn::text_bg1("Open OSM").build(ctx, format!("open {}", pl.osm_id), None));
|
||||
rows.push(
|
||||
ctx.style()
|
||||
.btn_primary_light_text("Open OSM")
|
||||
.build_widget(ctx, &format!("open {}", pl.osm_id)),
|
||||
);
|
||||
}
|
||||
|
||||
rows
|
||||
|
@ -200,19 +200,6 @@ impl Btn {
|
||||
}
|
||||
}
|
||||
|
||||
// The info panel style with the lighter background color
|
||||
pub fn text_bg1<I: Into<String>>(action: I) -> BtnBuilder {
|
||||
let action = action.into();
|
||||
BtnBuilder::TextBG {
|
||||
action: action.clone(),
|
||||
maybe_tooltip: None,
|
||||
|
||||
text: Text::from(Line(action)),
|
||||
unselected_bg_color: Color::grey(0.5),
|
||||
selected_bg_color: Color::ORANGE,
|
||||
}
|
||||
}
|
||||
|
||||
// The white background.
|
||||
pub fn text_bg2<I: Into<String>>(action: I) -> BtnBuilder {
|
||||
let action = action.into();
|
||||
|
Loading…
Reference in New Issue
Block a user