-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
base: master
Are you sure you want to change the base?
Changes from all commits
43ba114
fe29e6e
69757b3
f272067
864938c
92190aa
0b24be0
f96310a
9b4688b
597b705
0d19828
19f6219
254b87d
30ab7a5
1d869e2
ec98c99
6ef0110
d36395c
39a2184
abfb31e
5718320
2f519c9
f3333dc
711a1d4
8af612e
8514e7a
4334631
382a711
122112c
034a660
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -31,16 +31,18 @@ | |||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
#include "AutomationClip.h" | ||||||||||||||||||||||||||||||||
#include "Clipboard.h" | ||||||||||||||||||||||||||||||||
#include "ClipView.h" | ||||||||||||||||||||||||||||||||
#include "DataFile.h" | ||||||||||||||||||||||||||||||||
#include "Engine.h" | ||||||||||||||||||||||||||||||||
#include "GuiApplication.h" | ||||||||||||||||||||||||||||||||
#include "MidiClip.h" | ||||||||||||||||||||||||||||||||
#include "MidiClipView.h" | ||||||||||||||||||||||||||||||||
#include "PatternEditor.h" | ||||||||||||||||||||||||||||||||
#include "PatternStore.h" | ||||||||||||||||||||||||||||||||
#include "Song.h" | ||||||||||||||||||||||||||||||||
#include "SongEditor.h" | ||||||||||||||||||||||||||||||||
#include "StringPairDrag.h" | ||||||||||||||||||||||||||||||||
#include "TrackContainerView.h" | ||||||||||||||||||||||||||||||||
#include "ClipView.h" | ||||||||||||||||||||||||||||||||
#include "TrackView.h" | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
namespace lmms::gui | ||||||||||||||||||||||||||||||||
|
@@ -211,6 +213,7 @@ void TrackContentWidget::removeClipView( ClipView * clipv ) | |||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||
void TrackContentWidget::update() | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
setMinimumWidthBasedOnClips(); | ||||||||||||||||||||||||||||||||
for (const auto& clipView : m_clipViews) | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
clipView->setFixedHeight(height() - 1); | ||||||||||||||||||||||||||||||||
|
@@ -636,13 +639,29 @@ void TrackContentWidget::paintEvent( QPaintEvent * pe ) | |||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
void TrackContentWidget::setMinimumWidthBasedOnClips() | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
// 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()); | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
Comment on lines
+644
to
+653
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
/*! \brief Updates the background tile pixmap on size changes. | ||||||||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||||||||
* \param resizeEvent the resize event to pass to base class | ||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||
void TrackContentWidget::resizeEvent( QResizeEvent * resizeEvent ) | ||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||
setMinimumWidthBasedOnClips(); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
// Update backgroud | ||||||||||||||||||||||||||||||||
updateBackground(); | ||||||||||||||||||||||||||||||||
// Force redraw | ||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,23 +130,40 @@ TrackView::TrackView( Track * track, TrackContainerView * tcv ) : | |
*/ | ||
void TrackView::resizeEvent( QResizeEvent * re ) | ||
{ | ||
if( ConfigManager::inst()->value( "ui", | ||
"compacttrackbuttons" ).toInt() ) | ||
m_trackOperationsWidget.setFixedSize(getTrackFixedOperationsWidth(), height() - 1); | ||
m_trackSettingsWidget.setFixedSize(getTrackFixedSettingsWidth(), height() - 1); | ||
m_trackContentWidget.setFixedHeight(height()); | ||
} | ||
|
||
|
||
const int TrackView::getTrackFixedWidth() | ||
{ | ||
return getTrackFixedSettingsWidth() + getTrackFixedOperationsWidth(); | ||
} | ||
|
||
const int TrackView::getTrackFixedSettingsWidth() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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;
} |
||
{ | ||
if(ConfigManager::inst()->value("ui", "compacttrackbuttons").toInt()) | ||
{ | ||
m_trackOperationsWidget.setFixedSize( TRACK_OP_WIDTH_COMPACT, height() - 1 ); | ||
m_trackSettingsWidget.setFixedSize( DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT, height() - 1 ); | ||
// if compact size | ||
return DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT; | ||
} | ||
else | ||
// if not compact | ||
return DEFAULT_SETTINGS_WIDGET_WIDTH; | ||
} | ||
|
||
const int TrackView::getTrackFixedOperationsWidth() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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;
} |
||
{ | ||
if(ConfigManager::inst()->value("ui", "compacttrackbuttons").toInt()) | ||
{ | ||
m_trackOperationsWidget.setFixedSize( TRACK_OP_WIDTH, height() - 1 ); | ||
m_trackSettingsWidget.setFixedSize( DEFAULT_SETTINGS_WIDGET_WIDTH, height() - 1 ); | ||
// if compact size | ||
return TRACK_OP_WIDTH_COMPACT; | ||
} | ||
m_trackContentWidget.setFixedHeight( height() ); | ||
// if not compact | ||
return TRACK_OP_WIDTH; | ||
} | ||
|
||
|
||
|
||
|
||
/*! \brief Update this track View and all its content objects. | ||
* | ||
*/ | ||
|
There was a problem hiding this comment.
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.