mirror of
https://github.com/figsoda/mmtc
synced 2024-11-21 22:53:02 +00:00
replace free with max and min constraint
This commit is contained in:
parent
f6bf51fbf5
commit
62376aaf90
3 changed files with 10 additions and 6 deletions
2
mmtc.ron
2
mmtc.ron
|
@ -5,7 +5,7 @@ Config(
|
|||
Ratio(4, Textbox(Text("Artist"))),
|
||||
Ratio(4, Textbox(Text("Album"))),
|
||||
])),
|
||||
Free(Queue(
|
||||
Min(0, Queue(
|
||||
columns: [
|
||||
Ratio(5, QueueTitle),
|
||||
Ratio(4, QueueArtist),
|
||||
|
|
|
@ -36,7 +36,8 @@ pub enum Widget {
|
|||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum Constrained<T> {
|
||||
Free(T),
|
||||
Max(u16, T),
|
||||
Min(u16, T),
|
||||
Fixed(u16, T),
|
||||
Ratio(u32, T),
|
||||
}
|
||||
|
|
|
@ -34,8 +34,9 @@ pub fn render(
|
|||
|
||||
for x in xs {
|
||||
let (w, constraint) = match x {
|
||||
Constrained::Free(w) => (w, Constraint::Min(1)),
|
||||
Constrained::Fixed(n, w) => (w, Constraint::Length(*n)),
|
||||
Constrained::Max(n, w) => (w, Constraint::Max(*n)),
|
||||
Constrained::Min(n, w) => (w, Constraint::Min(*n)),
|
||||
Constrained::Ratio(n, w) => (w, Constraint::Ratio(*n, denom)),
|
||||
};
|
||||
ws.push(w);
|
||||
|
@ -68,8 +69,9 @@ pub fn render(
|
|||
|
||||
for x in xs {
|
||||
let (w, constraint) = match x {
|
||||
Constrained::Free(w) => (w, Constraint::Min(1)),
|
||||
Constrained::Fixed(n, w) => (w, Constraint::Length(*n)),
|
||||
Constrained::Max(n, w) => (w, Constraint::Max(*n)),
|
||||
Constrained::Min(n, w) => (w, Constraint::Min(*n)),
|
||||
Constrained::Ratio(n, w) => (w, Constraint::Ratio(*n, denom)),
|
||||
};
|
||||
ws.push(w);
|
||||
|
@ -118,8 +120,9 @@ pub fn render(
|
|||
|
||||
for column in columns {
|
||||
let (xs, constraint) = match column {
|
||||
Constrained::Free(xs) => (xs, Constraint::Min(1)),
|
||||
Constrained::Fixed(n, xs) => (xs, Constraint::Length(*n)),
|
||||
Constrained::Fixed(n, w) => (w, Constraint::Length(*n)),
|
||||
Constrained::Max(n, w) => (w, Constraint::Max(*n)),
|
||||
Constrained::Min(n, w) => (w, Constraint::Min(*n)),
|
||||
Constrained::Ratio(n, xs) => (xs, Constraint::Ratio(*n, denom)),
|
||||
};
|
||||
let mut items = Vec::with_capacity(len);
|
||||
|
|
Loading…
Reference in a new issue