comparison framework/MainWindowBase.cpp @ 403:eb84b06301da

Restore the old prev/next layer commands (that were never enabled because they didn't work) using the new fixed order layer list (so they now do work)
author Chris Cannam
date Tue, 02 Sep 2014 16:06:41 +0100
parents 81e41a430b58
children 41242512d544
comparison
equal deleted inserted replaced
402:f7dddea0dbe0 403:eb84b06301da
507 if (i > 0) havePrevPane = true; 507 if (i > 0) havePrevPane = true;
508 if (i < m_paneStack->getPaneCount()-1) haveNextPane = true; 508 if (i < m_paneStack->getPaneCount()-1) haveNextPane = true;
509 break; 509 break;
510 } 510 }
511 } 511 }
512 if (currentLayer) { 512 // the prev/next layer commands actually include the pane
513 for (int i = 0; i < currentPane->getLayerCount(); ++i) { 513 // itself as one of the selectables -- so we always have a
514 if (currentPane->getLayer(i) == currentLayer) { 514 // prev and next layer, as long as we have a pane with at
515 if (i > 0) havePrevLayer = true; 515 // least one layer in it
516 if (i < currentPane->getLayerCount()-1) haveNextLayer = true; 516 if (currentPane->getLayerCount() > 0) {
517 break; 517 havePrevLayer = true;
518 } 518 haveNextLayer = true;
519 }
520 } 519 }
521 } 520 }
522 521
523 bool haveCurrentPane = 522 bool haveCurrentPane =
524 (currentPane != 0); 523 (currentPane != 0);
3050 } 3049 }
3051 3050
3052 void 3051 void
3053 MainWindowBase::previousLayer() 3052 MainWindowBase::previousLayer()
3054 { 3053 {
3055 //!!! Not right -- pane lists layers in stacking order
3056
3057 if (!m_paneStack) return; 3054 if (!m_paneStack) return;
3058 3055
3059 Pane *currentPane = m_paneStack->getCurrentPane(); 3056 Pane *currentPane = m_paneStack->getCurrentPane();
3060 if (!currentPane) return; 3057 if (!currentPane) return;
3061 3058
3059 int count = currentPane->getLayerCount();
3060 if (count == 0) return;
3061
3062 Layer *currentLayer = currentPane->getSelectedLayer(); 3062 Layer *currentLayer = currentPane->getSelectedLayer();
3063 if (!currentLayer) return; 3063
3064 3064 if (!currentLayer) {
3065 for (int i = 0; i < currentPane->getLayerCount(); ++i) { 3065 // The pane itself is current
3066 if (currentPane->getLayer(i) == currentLayer) { 3066 m_paneStack->setCurrentLayer
3067 if (i == 0) return; 3067 (currentPane, currentPane->getFixedOrderLayer(count-1));
3068 m_paneStack->setCurrentLayer(currentPane, 3068 } else {
3069 currentPane->getLayer(i-1)); 3069 for (int i = 0; i < count; ++i) {
3070 updateMenuStates(); 3070 if (currentPane->getFixedOrderLayer(i) == currentLayer) {
3071 return; 3071 if (i == 0) {
3072 } 3072 m_paneStack->setCurrentLayer
3073 } 3073 (currentPane, 0); // pane
3074 } else {
3075 m_paneStack->setCurrentLayer
3076 (currentPane, currentPane->getFixedOrderLayer(i-1));
3077 }
3078 break;
3079 }
3080 }
3081 }
3082
3083 updateMenuStates();
3074 } 3084 }
3075 3085
3076 void 3086 void
3077 MainWindowBase::nextLayer() 3087 MainWindowBase::nextLayer()
3078 { 3088 {
3079 //!!! Not right -- pane lists layers in stacking order
3080
3081 if (!m_paneStack) return; 3089 if (!m_paneStack) return;
3082 3090
3083 Pane *currentPane = m_paneStack->getCurrentPane(); 3091 Pane *currentPane = m_paneStack->getCurrentPane();
3084 if (!currentPane) return; 3092 if (!currentPane) return;
3085 3093
3094 int count = currentPane->getLayerCount();
3095 if (count == 0) return;
3096
3086 Layer *currentLayer = currentPane->getSelectedLayer(); 3097 Layer *currentLayer = currentPane->getSelectedLayer();
3087 if (!currentLayer) return; 3098
3088 3099 if (!currentLayer) {
3089 for (int i = 0; i < currentPane->getLayerCount(); ++i) { 3100 // The pane itself is current
3090 if (currentPane->getLayer(i) == currentLayer) { 3101 m_paneStack->setCurrentLayer
3091 if (i == currentPane->getLayerCount()-1) return; 3102 (currentPane, currentPane->getFixedOrderLayer(0));
3092 m_paneStack->setCurrentLayer(currentPane, 3103 } else {
3093 currentPane->getLayer(i+1)); 3104 for (int i = 0; i < count; ++i) {
3094 updateMenuStates(); 3105 if (currentPane->getFixedOrderLayer(i) == currentLayer) {
3095 return; 3106 if (i == currentPane->getLayerCount()-1) {
3096 } 3107 m_paneStack->setCurrentLayer
3097 } 3108 (currentPane, 0); // pane
3109 } else {
3110 m_paneStack->setCurrentLayer
3111 (currentPane, currentPane->getFixedOrderLayer(i+1));
3112 }
3113 break;
3114 }
3115 }
3116 }
3117
3118 updateMenuStates();
3098 } 3119 }
3099 3120
3100 void 3121 void
3101 MainWindowBase::playbackFrameChanged(int frame) 3122 MainWindowBase::playbackFrameChanged(int frame)
3102 { 3123 {