mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
aesthetic cleanup; change default font for all modals
I decided to go back on the idea of not changing the modals and now all modals use the new larger font as well. This creates issue #396, which I will deal with later once I have the time to do some more testing. I'm pretty sure some other dialog boxes are broken now too.
This commit is contained in:
parent
d19020a9ad
commit
b2c64eb61a
8 changed files with 23 additions and 10 deletions
|
|
@ -30,7 +30,7 @@ impl ChatLayout {
|
|||
let screensize = gfx.screen_size().expect("Couldn't get screen size");
|
||||
// get the height of various text regions to compute the layout
|
||||
let small_height: i16 = gfx.glyph_height_hint(GlyphStyle::Small).expect("couldn't get glyph height") as i16;
|
||||
let regular_height: i16 = gfx.glyph_height_hint(GlyphStyle::Regular).expect("couldn't get glyph height") as i16;
|
||||
let regular_height: i16 = gfx.glyph_height_hint(gam::SYSTEM_STYLE).expect("couldn't get glyph height") as i16;
|
||||
let margin = 4;
|
||||
|
||||
// allocate canvases in structures, and record their GID for future reference
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::{Canvas, GlyphStyle};
|
||||
use crate::Canvas;
|
||||
|
||||
use graphics_server::*;
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ impl MenuLayout {
|
|||
pub fn init(gfx: &graphics_server::Gfx, trng: &trng::Trng, canvases: &mut HashMap<Gid, Canvas>) -> Result<MenuLayout, xous::Error> {
|
||||
let screensize = gfx.screen_size().expect("Couldn't get screen size");
|
||||
// get the height of various text regions to compute the layout
|
||||
let height: i16 = gfx.glyph_height_hint(GlyphStyle::Regular).expect("couldn't get glyph height") as i16;
|
||||
let height: i16 = gfx.glyph_height_hint(gam::SYSTEM_STYLE).expect("couldn't get glyph height") as i16;
|
||||
|
||||
const MENU_Y_PAD: i16 = 100;
|
||||
const MENU_X_PAD: i16 = 35;
|
||||
|
|
|
|||
|
|
@ -416,6 +416,10 @@ impl ActionApi for TextEntry {
|
|||
}
|
||||
}
|
||||
if self.is_password {
|
||||
let aesthetic_margin = match crate::SYSTEM_STYLE {
|
||||
GlyphStyle::Tall => 4,
|
||||
_ => 0,
|
||||
};
|
||||
let select_index = match self.visibility {
|
||||
TextEntryVisibility::Visible => 0,
|
||||
TextEntryVisibility::LastChars => 1,
|
||||
|
|
@ -428,7 +432,9 @@ impl ActionApi for TextEntry {
|
|||
let mut tv = TextView::new(
|
||||
modal.canvas,
|
||||
TextBounds::GrowableFromTl(
|
||||
Point::new(modal.margin, at_height + glyph_to_height_hint(GlyphStyle::Monospace) as i16 + modal.margin),
|
||||
Point::new(modal.margin, at_height + glyph_to_height_hint(GlyphStyle::Monospace) as i16 + modal.margin
|
||||
+ aesthetic_margin
|
||||
),
|
||||
lr_margin as u16
|
||||
));
|
||||
tv.style = GlyphStyle::Large;
|
||||
|
|
@ -443,7 +449,10 @@ impl ActionApi for TextEntry {
|
|||
let mut tv = TextView::new(
|
||||
modal.canvas,
|
||||
TextBounds::GrowableFromTl(
|
||||
Point::new(left_edge + i * prompt_width, at_height + glyph_to_height_hint(GlyphStyle::Monospace) as i16 + modal.margin),
|
||||
Point::new(left_edge + i * prompt_width, at_height
|
||||
+ glyph_to_height_hint(GlyphStyle::Monospace) as i16 + modal.margin
|
||||
+ aesthetic_margin
|
||||
),
|
||||
prompt_width as u16)
|
||||
);
|
||||
tv.style = GlyphStyle::Monospace;
|
||||
|
|
@ -469,7 +478,9 @@ impl ActionApi for TextEntry {
|
|||
let mut tv = TextView::new(
|
||||
modal.canvas,
|
||||
TextBounds::GrowableFromTr(
|
||||
Point::new(modal.canvas_width - modal.margin, at_height + glyph_to_height_hint(GlyphStyle::Monospace) as i16 + modal.margin),
|
||||
Point::new(modal.canvas_width - modal.margin, at_height + glyph_to_height_hint(GlyphStyle::Monospace) as i16 + modal.margin
|
||||
+ aesthetic_margin
|
||||
),
|
||||
lr_margin as u16
|
||||
));
|
||||
tv.style = GlyphStyle::Large;
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ impl Typesetter {
|
|||
// going out of scope at the end of the call.
|
||||
let mut composition = Vec::<TypesetWord>::new();
|
||||
|
||||
if self.bb.max.x - self.bb.min.y < glyph_to_height_hint(GlyphStyle::Regular) as i16 {
|
||||
if self.bb.max.y - self.bb.min.y < glyph_to_height_hint(GlyphStyle::Regular) as i16 {
|
||||
// we flag this because the typesetter algorithm may never converge if it can't set any characters
|
||||
// because the region is just too narrow.
|
||||
log::error!("Words cannot be typset because the width of the typset region is too narrow.");
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ enum RendererState {
|
|||
RunImage(ManagedImage),
|
||||
}
|
||||
|
||||
const DEFAULT_STYLE: GlyphStyle = GlyphStyle::Regular;
|
||||
const DEFAULT_STYLE: GlyphStyle = gam::SYSTEM_STYLE;
|
||||
|
||||
fn main () -> ! {
|
||||
#[cfg(not(feature="ditherpunk"))]
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ pub(crate) fn password_ux_manager(
|
|||
ActionType::TextEntry(password_action.clone()),
|
||||
Some(t!("pddb.password", locales::LANG)),
|
||||
None,
|
||||
GlyphStyle::Regular,
|
||||
gam::SYSTEM_STYLE,
|
||||
8
|
||||
);
|
||||
pddb_modal.spawn_helper(ux_sid, pddb_modal.sid,
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ fn main() -> ! {
|
|||
ActionType::TextEntry(password_action.clone()),
|
||||
Some(t!("rootkeys.updatefirstpass", locales::LANG)),
|
||||
None,
|
||||
GlyphStyle::Regular,
|
||||
gam::SYSTEM_STYLE,
|
||||
8
|
||||
);
|
||||
rootkeys_modal.spawn_helper(keys_sid, rootkeys_modal.sid,
|
||||
|
|
|
|||
|
|
@ -266,6 +266,8 @@ impl WLANMan {
|
|||
self.modals.dynamic_notification_close().ok();
|
||||
}
|
||||
let mut networks: Vec<&str> = networks.iter().map(|s| s.as_str()).collect();
|
||||
// TODO: we may need to add code here to truncate the list if it is too long, with the larger
|
||||
// font, the dialog box could run off the screen.
|
||||
|
||||
if networks.is_empty() {
|
||||
self.modals
|
||||
|
|
|
|||
Loading…
Reference in a new issue