macos: render into the titlebar
also remove fps indicator unless in profiling mode Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
51
src/app.rs
51
src/app.rs
@@ -650,7 +650,7 @@ fn render_note(ui: &mut egui::Ui, damus: &mut Damus, note_key: NoteKey) -> Resul
|
|||||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::TOP), |ui| {
|
ui.with_layout(egui::Layout::left_to_right(egui::Align::TOP), |ui| {
|
||||||
let profile = damus.ndb.get_profile_by_pubkey(&txn, note.pubkey());
|
let profile = damus.ndb.get_profile_by_pubkey(&txn, note.pubkey());
|
||||||
|
|
||||||
padding(5.0, ui, |ui| {
|
padding(6.0, ui, |ui| {
|
||||||
match profile
|
match profile
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok()
|
.ok()
|
||||||
@@ -692,7 +692,7 @@ fn render_notes(ui: &mut egui::Ui, damus: &mut Damus, timeline: usize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) {
|
fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) {
|
||||||
padding(10.0, ui, |ui| ui.heading("Timeline"));
|
padding(4.0, ui, |ui| ui.heading("Notifications"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
let font_id = egui::TextStyle::Body.resolve(ui.style());
|
let font_id = egui::TextStyle::Body.resolve(ui.style());
|
||||||
@@ -713,28 +713,28 @@ fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn top_panel(ctx: &egui::Context) -> egui::TopBottomPanel {
|
fn top_panel(ctx: &egui::Context) -> egui::TopBottomPanel {
|
||||||
// mobile needs padding, at least on android
|
let mut top_margin = Margin::default();
|
||||||
if is_mobile(ctx) {
|
top_margin.top = 4.0;
|
||||||
let mut top_margin = Margin::default();
|
top_margin.left = 8.0;
|
||||||
top_margin.top = 20.0;
|
top_margin.right = 8.0;
|
||||||
|
//top_margin.bottom = -20.0;
|
||||||
|
|
||||||
let frame = Frame {
|
let frame = Frame {
|
||||||
inner_margin: top_margin,
|
inner_margin: top_margin,
|
||||||
fill: ctx.style().visuals.panel_fill,
|
fill: ctx.style().visuals.panel_fill,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
return egui::TopBottomPanel::top("top_panel").frame(frame);
|
egui::TopBottomPanel::top("top_panel")
|
||||||
}
|
.frame(frame)
|
||||||
|
.show_separator_line(false)
|
||||||
egui::TopBottomPanel::top("top_panel").frame(Frame::none())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_panel<'a>(ctx: &egui::Context, app: &'a mut Damus, timeline_ind: usize) {
|
fn render_panel<'a>(ctx: &egui::Context, app: &'a mut Damus, timeline_ind: usize) {
|
||||||
top_panel(ctx).show(ctx, |ui| {
|
top_panel(ctx).show(ctx, |ui| {
|
||||||
set_app_style(ui);
|
set_app_style(ui);
|
||||||
|
|
||||||
ui.horizontal_wrapped(|ui| {
|
ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| {
|
||||||
ui.visuals_mut().button_frame = false;
|
ui.visuals_mut().button_frame = false;
|
||||||
egui::widgets::global_dark_light_mode_switch(ui);
|
egui::widgets::global_dark_light_mode_switch(ui);
|
||||||
|
|
||||||
@@ -755,14 +755,19 @@ fn render_panel<'a>(ctx: &egui::Context, app: &'a mut Damus, timeline_ind: usize
|
|||||||
app.n_panels -= 1;
|
app.n_panels -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.label(format!(
|
#[cfg(feature = "profiling")]
|
||||||
"FPS: {:.2}, {:10.1}ms",
|
{
|
||||||
app.frame_history.fps(),
|
ui.weak(format!(
|
||||||
app.frame_history.mean_frame_time() * 1e3
|
"FPS: {:.2}, {:10.1}ms",
|
||||||
));
|
app.frame_history.fps(),
|
||||||
|
app.frame_history.mean_frame_time() * 1e3
|
||||||
|
));
|
||||||
|
|
||||||
let timeline = &app.timelines[timeline_ind];
|
ui.weak(format!(
|
||||||
ui.label(format!("{} notes", timeline.notes.len()));
|
"{} notes",
|
||||||
|
&app.timelines[timeline_ind].notes.len()
|
||||||
|
));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![warn(clippy::all, rust_2018_idioms)]
|
#![warn(clippy::all, rust_2018_idioms)]
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||||
use damus::Damus;
|
use notedeck::Damus;
|
||||||
|
|
||||||
// Entry point for wasm
|
// Entry point for wasm
|
||||||
//#[cfg(target_arch = "wasm32")]
|
//#[cfg(target_arch = "wasm32")]
|
||||||
@@ -13,7 +13,13 @@ async fn main() {
|
|||||||
// Log to stdout (if you run with `RUST_LOG=debug`).
|
// Log to stdout (if you run with `RUST_LOG=debug`).
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
let native_options = eframe::NativeOptions::default();
|
let window_builder = Box::new(|builder: egui::ViewportBuilder| {
|
||||||
|
builder.with_fullsize_content_view(true)
|
||||||
|
.with_titlebar_shown(false)
|
||||||
|
.with_title_shown(false)
|
||||||
|
});
|
||||||
|
let mut native_options = eframe::NativeOptions::default();
|
||||||
|
native_options.window_builder = Some(window_builder);
|
||||||
|
|
||||||
let _res = eframe::run_native(
|
let _res = eframe::run_native(
|
||||||
"Damus NoteDeck",
|
"Damus NoteDeck",
|
||||||
|
|||||||
Reference in New Issue
Block a user