First of all, I know you're on vacation and that it's meant to be enjoyed. It's not urgent at all :).
It's not working as expected... but let's go step by step:
1_
I think I didn't express myself correctly. The word wasn't maximize, but restore.
The idea is for it to work like an on/off button.
2_
Your answer made me realize that you could also add a maximize function that would expand/restore the track height to the maximum height of the workspace. This would be useful when using Qtractor as an audio editor (I know it isn't, but... for many tasks I prefer it to Audacity).
3_
I tried implementing the minimize function... but, as always, C++ is too finicky for me. It doesn't accept setProperty like that, outright, as I'd like. However, the desired logic is as follows:
// Minimize current track height.
void qtractorMainForm::trackHeightMinimize (void)
{
qtractorTrack *pTrack = nullptr;
if (m_pTracks)
pTrack = m_pTracks->currentTrack();
if (pTrack == nullptr)
return;
#ifdef CONFIG_DEBUG
qDebug("qtractorMainForm::trackHeightMinimize()");
#endif
const int iVerticalZoom = m_pSession->verticalZoom();
///////////////////// Changes
const int iZoomTrackHeightMin = (iVerticalZoom * qtractorTrack::HeightMin) / 100;
const int iZoomTrackHeightBase = (iVerticalZoom * qtractorTrack::HeightBase) / 100;
const int iZoomTrackHeightCurrent = (iVerticalZoom * pTrack->zoomHeight()) / 100;
if (iZoomTrackHeightCurrent > iZoomTrackHeightMin) {
pTrack->setProperty("RestoreHeightTo", iZoomTrackHeightCurrent);
const int iZoomHeight = iZoomTrackHeightMin;
}
if (iZoomTrackHeightCurrent <= iZoomTrackHeightMin ){
// To restore default to base, in case there is no previous height record
if (!ptrack->property("RestoreHeightTo").isValid()) {
pTrack->setProperty("RestoreHeightTo", iZoomTrackHeightBase);
}
const int iZoomHeight = pTrack->property("RestoreHeightTo");
}
m_pSession->execute(
new qtractorResizeTrackCommand(pTrack, iZoomHeight));
}
First of all, I know you're on vacation and that it's meant to be enjoyed. It's not urgent at all :).
It's not working as expected... but let's go step by step:
1_
I think I didn't express myself correctly. The word wasn't maximize, but restore.
The idea is for it to work like an on/off button.
2_
Your answer made me realize that you could also add a maximize function that would expand/restore the track height to the maximum height of the workspace. This would be useful when using Qtractor as an audio editor (I know it isn't, but... for many tasks I prefer it to Audacity).
3_
I tried implementing the minimize function... but, as always, C++ is too finicky for me. It doesn't accept setProperty like that, outright, as I'd like. However, the desired logic is as follows: