Compare commits
2 Commits
36d3ce3a09
...
b716741578
Author | SHA1 | Date | |
---|---|---|---|
|
b716741578 | ||
|
753a9406e5 |
4
build.rs
4
build.rs
@ -1,9 +1,13 @@
|
|||||||
|
#[cfg(feature = "tracing")]
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
|
#[cfg(feature = "tracing")]
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
use lttng_ust_generate::{Provider, Generator, CTFType, CIntegerType};
|
use lttng_ust_generate::{Provider, Generator, CTFType, CIntegerType};
|
||||||
|
|
||||||
|
|
||||||
#[cfg(feature = "tracing")]
|
#[cfg(feature = "tracing")]
|
||||||
fn setup_tracepoints() {
|
fn setup_tracepoints() {
|
||||||
// the provider is called calendar
|
// the provider is called calendar
|
||||||
|
@ -24,6 +24,10 @@ impl Event {
|
|||||||
fn is_in_day(&self, day: NaiveDate) -> bool {
|
fn is_in_day(&self, day: NaiveDate) -> bool {
|
||||||
day >= self.begin && day <= self.end
|
day >= self.begin && day <= self.end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn span_days(&self) -> i64 {
|
||||||
|
(self.end - self.begin).num_days()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct EventsCollection {
|
pub struct EventsCollection {
|
||||||
|
@ -83,11 +83,12 @@ impl CalendarParams {
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
fn render_events_in_day(
|
fn render_events_in_row(
|
||||||
params: &CalendarParams,
|
params: &CalendarParams,
|
||||||
renderer: &mut impl text::Renderer,
|
renderer: &mut impl text::Renderer,
|
||||||
current_day: NaiveDate,
|
first_day: NaiveDate,
|
||||||
day_bounds: Rectangle,
|
num_days: i64,
|
||||||
|
row_bounds: Rectangle,
|
||||||
font_size: f32,
|
font_size: f32,
|
||||||
fg: Color,
|
fg: Color,
|
||||||
content: &str,
|
content: &str,
|
||||||
@ -103,7 +104,11 @@ fn render_events_in_day(
|
|||||||
Shaping::default());
|
Shaping::default());
|
||||||
let ev_height = params.ev_height;
|
let ev_height = params.ev_height;
|
||||||
let mut ev_y: f32 = 0.0;
|
let mut ev_y: f32 = 0.0;
|
||||||
let y = day_bounds.y + params.day_text_margin;
|
let y = row_bounds.y + params.day_text_margin;
|
||||||
|
|
||||||
|
let mut event_stack = Vec::new();
|
||||||
|
for i in 0..num_days {
|
||||||
|
let current_day = first_day + Duration::days(i);
|
||||||
for ev_day in events.for_day(current_day) {
|
for ev_day in events.for_day(current_day) {
|
||||||
if day_bounds.height - day_text_size.1 > ev_y + ev_height {
|
if day_bounds.height - day_text_size.1 > ev_y + ev_height {
|
||||||
let ev_bounds = Rectangle {
|
let ev_bounds = Rectangle {
|
||||||
@ -132,6 +137,7 @@ fn render_events_in_day(
|
|||||||
ev_y += ev_height
|
ev_y += ev_height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user