Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draw time signature #22

Merged
merged 2 commits into from
Feb 23, 2025
Merged

draw time signature #22

merged 2 commits into from
Feb 23, 2025

Conversation

doreado
Copy link
Contributor

@doreado doreado commented Feb 22, 2025

Hello! This PR implements #20.

Key points:

  • The time signature is centered depending on the number of instrument strings.
  • When the time signature is drawn, the measure length is increased, the first measure beat is shifted to the right, and the focus rectangle becomes wider. This was mainly required to avoid overlapping between the widgets.

Sample of a song with many time changes.
image

Samples of 4, 5, 6, and 8 strings
image
image
image
image

Copy link
Owner

@agourlay agourlay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for tackling this 👏

I am leaving some minor comments about looks but it is good to go otherwise.

color: Color::WHITE,
size: 19.into(),
font: Font {
weight: iced::font::Weight::Semibold,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks a bit heavy for my taste, I'd prefer a Normal font weight

let tempo_text = Text {
content: format!("{numerator}\n{denominator}"),
color: Color::WHITE,
size: 19.into(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to make it a tad smaller. Like 17 maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@@ -43,8 +43,22 @@ impl Tablature {
let track = &self.song.tracks[self.track_id];
let measures = track.measures.len();
for i in 0..measures {
let measure_header = &self.song.measure_headers[i];
let previous_measure_header = if i > 0 {
Some(&self.song.measure_headers[i - 1])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Some(&self.song.measure_headers[i - 1])
&self.song.measure_headers.get(i - 1)

@agourlay
Copy link
Owner

You need to run cargo fmt to please CI :)

decrease time signature size

run cargo fmt

use getter method
@agourlay agourlay merged commit 9c60426 into agourlay:master Feb 23, 2025
3 checks passed
@agourlay agourlay mentioned this pull request Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants