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

adding pattern editor subwindow horizontal scaling #7409

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

szeli1
Copy link
Contributor

@szeli1 szeli1 commented Jul 30, 2024

closes #7313

Made constants in TrackView static, replaced the configmanager "compacttrackbuttons" with static functions in TrackView.

Modified TrackContainerView::scrollArea to have the ability to scroll horizontally.

In the past if the user increased the pattern editor's step count, the midi clips became so small they were unusable:
pattern_editor_midi_clip

An other issue was if the user increased time sig to 32 (numerator) and 1 (denominator), midi clips would become invisible inside the pattern editor.

This Pull Request fixes these issues.

@YesImAsh
Copy link

YesImAsh commented Aug 5, 2024

You did an amazing job. Thank you

@Gabrielxd195
Copy link

This is great, now the BB editor will be better used. Do you think this can also be applied to File Explorer in the future? Because you need it.

@szeli1
Copy link
Contributor Author

szeli1 commented Aug 21, 2024

Do you think this can also be applied to File Explorer in the future?

You could make a feature request about it and see if somebody implements it.

@Gabrielxd195
Copy link

@szeli1 I proposed horizontal sliding in the file browser along with another improvement in #4599 but since I didn't know anything about Github at that time they closed the issue for me for having made two suggestions in the same issue and everything was left there, no one has talked about this, I think I should have suggested different matters.

@szeli1
Copy link
Contributor Author

szeli1 commented Aug 22, 2024

they closed the issue for me for having made two suggestions

The closed it because one suggestion was the same as an older one.
You are right about you shouldn't make an issue about 2 things. You definitely should open new issues if you have feature requests / know about bugs, but make sure nobody suggested your suggestion before.

@szeli1 szeli1 force-pushed the beat_baseline_editor_subwindow_horizontal_scaling branch from b77214c to 597b705 Compare December 23, 2024 08:00
@regulus79
Copy link
Contributor

To me it doesn't feel right that the TrackViews move as you scroll.
Also, when you have added a lot of steps, the minimum width of the squares makes them no longer square. And you can't zoom to change the view size like in the song editor.
Screenshot From 2024-12-30 11-26-00

Copy link
Contributor

@sakertooth sakertooth left a comment

Choose a reason for hiding this comment

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

Just a code review.

Comment on lines +644 to +653
// if this is in the pattern editor
if (m_trackView->trackContainerView()->fixedClips())
{
if (m_clipViews.size() > 0)
{
auto minWidth = static_cast<size_t>(m_clipViews[0]->getClip()->length().getTicks());
setMinimumWidth(minWidth);
//auto minWidth = static_cast<size_t>(m_clipViews[0]->getClip()->length().nextFullBar());
//setMinimumWidth(minWidth * m_trackView->trackContainerView()->pixelsPerBar());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would personally rewrite it like this and remove the commented out code.

Suggested change
// if this is in the pattern editor
if (m_trackView->trackContainerView()->fixedClips())
{
if (m_clipViews.size() > 0)
{
auto minWidth = static_cast<size_t>(m_clipViews[0]->getClip()->length().getTicks());
setMinimumWidth(minWidth);
//auto minWidth = static_cast<size_t>(m_clipViews[0]->getClip()->length().nextFullBar());
//setMinimumWidth(minWidth * m_trackView->trackContainerView()->pixelsPerBar());
}
if (!m_trackView->trackContainerView()->fixedClips()) { return; }
if (m_clipViews.empty()) { return; }
const auto minimumWidth = static_cast<size_t>(m_clipViews.first()->getClip()->length().getTicks());
setMinimumWidth(minimumWidth);

return getTrackFixedSettingsWidth() + getTrackFixedOperationsWidth();
}

const int TrackView::getTrackFixedSettingsWidth()
Copy link
Contributor

Choose a reason for hiding this comment

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

This function can be rewritten like this. The comments are also very unnecessary IMO: The code is clear enough that one can already tell what is happening.

const int TrackView::getTrackFixedSettingsWidth()
{
	const auto isCompact = ConfigManager::inst()->value("ui", "compacttrackbuttons").toInt();
	return isCompact ? DEFAULT_SETTINGS_WIDTH_COMPACT : DEFAULT_SETTINGS_WIDGET_WIDTH;
}

return DEFAULT_SETTINGS_WIDGET_WIDTH;
}

const int TrackView::getTrackFixedOperationsWidth()
Copy link
Contributor

Choose a reason for hiding this comment

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

The same with this one:

const int TrackView::getTrackFixedOperationsWidth()
{
	const auto isCompact = ConfigManager::inst()->value("ui", "compacttrackbuttons").toInt();
	return isCompact ? TRACK_OP_WIDTH_COMPACT : TRACK_OP_WIDTH;
}

Comment on lines +101 to +105
// returns getTrackFixedSettingsWidth() + getTrackFixedOperationsWidth()
static const int getTrackFixedWidth();
// returns the right compact or not compact width
static const int getTrackFixedSettingsWidth();
static const int getTrackFixedOperationsWidth();
Copy link
Contributor

Choose a reason for hiding this comment

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

You can make this documentation better.

Also, I removed the "Fixed" part since I don't think callers of these functions care about if its a fixed width or not. It is simply the width of the thing. If you go through with this change, you'll also have to of course update the function declarations and definitions to reflect the new name.

Suggested change
// returns getTrackFixedSettingsWidth() + getTrackFixedOperationsWidth()
static const int getTrackFixedWidth();
// returns the right compact or not compact width
static const int getTrackFixedSettingsWidth();
static const int getTrackFixedOperationsWidth();
//! Returns the width of a track.
static const int getTrackWidth();
//! Returns the width of the settings portion of a track, based on whether or not the track is compacted.
static const int getTrackSettingsWidth();
//! Returns the fixed width of the operations portion of a track, based on whether or not the track is compacted.
static const int getTrackOperationsWidth();

@sakertooth
Copy link
Contributor

Also, have you resolved @regulus79's concerns @szeli1?

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.

Add scrolling to the B + B editor to make it easier
5 participants