/[svn]/qsampler/trunk/src/qsamplerMainForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.ui.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 263 by capela, Wed Sep 29 09:01:35 2004 UTC revision 301 by capela, Wed Nov 17 16:43:49 2004 UTC
# Line 36  Line 36 
36    
37  #include "qsamplerAbout.h"  #include "qsamplerAbout.h"
38  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
39    #include "qsamplerChannel.h"
40  #include "qsamplerMessages.h"  #include "qsamplerMessages.h"
41    
42  #include "qsamplerChannelStrip.h"  #include "qsamplerChannelStrip.h"
# Line 103  void qsamplerMainForm::init (void) Line 104  void qsamplerMainForm::init (void)
104      m_pMessages = NULL;      m_pMessages = NULL;
105    
106      // We'll start clean.      // We'll start clean.
107      m_iUntitled = 0;      m_iUntitled    = 0;
108      m_iDirtyCount = 0;      m_iDirtyCount  = 0;
109        m_iChangeCount = 0;
110    
111      m_pServer = NULL;      m_pServer = NULL;
112      m_pClient = NULL;      m_pClient = NULL;
# Line 483  bool qsamplerMainForm::closeSession ( bo Line 485  bool qsamplerMainForm::closeSession ( bo
485          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
486          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
487          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
488              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
489              if (bForce && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK)              if (pChannelStrip) {
490                  appendMessagesClient("lscp_remove_channel");                  qsamplerChannel *pChannel = pChannelStrip->channel();
491              delete pChannel;                  if (bForce && pChannel)
492                        pChannel->removeChannel();
493                    delete pChannelStrip;
494                }
495          }          }
496          m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
497          // We're now clean, for sure.          // We're now clean, for sure.
# Line 548  bool qsamplerMainForm::loadSessionFile ( Line 553  bool qsamplerMainForm::loadSessionFile (
553      // Try to (re)create each channel.      // Try to (re)create each channel.
554      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
555      for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {      for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {
556          createChannel(iChannelID, false);          createChannelStrip(iChannelID);
557          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
558      }      }
559      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 562  bool qsamplerMainForm::loadSessionFile ( Line 567  bool qsamplerMainForm::loadSessionFile (
567      m_sFilename = sFilename;      m_sFilename = sFilename;
568      updateRecentFiles(sFilename);      updateRecentFiles(sFilename);
569      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));
570        
571        // Make that an overall update.
572        m_iChangeCount++;
573      stabilizeForm();      stabilizeForm();
574      return true;      return true;
575  }  }
# Line 595  bool qsamplerMainForm::saveSessionFile ( Line 603  bool qsamplerMainForm::saveSessionFile (
603      ts << endl;      ts << endl;
604      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
605      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
606          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
607          int iChannelID = pChannel->channelID();          if (pChannelStrip) {
608          ts << "# " << pChannel->caption() << endl;              qsamplerChannel *pChannel = pChannelStrip->channel();
609          ts << "ADD CHANNEL" << endl;              if (pChannel) {
610          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;                  int iChannelID = pChannel->channelID();
611          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;                  ts << "# " << pChannelStrip->caption() << endl;
612          ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;                  ts << "ADD CHANNEL" << endl;
613          ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;
614          if (pChannel->midiChannel() > 0)                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;
615              ts << pChannel->midiChannel();                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;
616           else                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
617              ts << "ALL";                  if (pChannel->midiChannel() > 0)
618          ts << endl;                      ts << pChannel->midiChannel();
619          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;                   else
620          ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;                      ts << "ALL";
621          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;                  ts << endl;
622          ts << endl;                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;
623                    ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;
624                    ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;
625                    ts << endl;
626                }
627            }
628          // Try to keep it snappy :)          // Try to keep it snappy :)
629          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
630      }      }
# Line 758  void qsamplerMainForm::editAddChannel (v Line 771  void qsamplerMainForm::editAddChannel (v
771      if (m_pClient == NULL)      if (m_pClient == NULL)
772          return;          return;
773    
774      // Create the new sampler channel.      // Just create the channel strip,
775      int iChannelID = ::lscp_add_channel(m_pClient);      // by giving an invalid channel id.
776      if (iChannelID < 0) {      createChannelStrip(-1);
         appendMessagesClient("lscp_add_channel");  
         appendMessagesError(tr("Could not create the new channel.\n\nSorry."));  
         return;  
     }  
   
     // Log this happening.  
     appendMessages(tr("Channel %1 created.").arg(iChannelID));  
   
     // Just create the channel strip with given id.  
     createChannel(iChannelID, true);  
   
     // We'll be dirty, for sure...  
     m_iDirtyCount++;  
     // Stabilize form anyway.  
     stabilizeForm();  
777  }  }
778    
779    
# Line 785  void qsamplerMainForm::editRemoveChannel Line 783  void qsamplerMainForm::editRemoveChannel
783      if (m_pClient == NULL)      if (m_pClient == NULL)
784          return;          return;
785    
786      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
787        if (pChannelStrip == NULL)
788            return;
789            
790        qsamplerChannel *pChannel = pChannelStrip->channel();
791      if (pChannel == NULL)      if (pChannel == NULL)
792          return;          return;
793    
# Line 795  void qsamplerMainForm::editRemoveChannel Line 797  void qsamplerMainForm::editRemoveChannel
797              tr("About to remove channel:\n\n"              tr("About to remove channel:\n\n"
798                 "%1\n\n"                 "%1\n\n"
799                 "Are you sure?")                 "Are you sure?")
800                 .arg(pChannel->caption()),                 .arg(pChannelStrip->caption()),
801              tr("OK"), tr("Cancel")) > 0)              tr("OK"), tr("Cancel")) > 0)
802              return;              return;
803      }      }
804    
805      // Remove the existing sampler channel.      // Remove the existing sampler channel.
806      if (::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) {      if (!pChannel->removeChannel())
         appendMessagesClient("lscp_remove_channel");  
         appendMessagesError(tr("Could not remove channel.\n\nSorry."));  
807          return;          return;
     }  
808    
     // Log this happening.  
     appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));  
       
809      // Just delete the channel strip.      // Just delete the channel strip.
810      delete pChannel;      delete pChannelStrip;
811        
812      // Do we auto-arrange?      // Do we auto-arrange?
813      if (m_pOptions && m_pOptions->bAutoArrange)      if (m_pOptions && m_pOptions->bAutoArrange)
814          channelsArrange();          channelsArrange();
# Line 828  void qsamplerMainForm::editSetupChannel Line 825  void qsamplerMainForm::editSetupChannel
825      if (m_pClient == NULL)      if (m_pClient == NULL)
826          return;          return;
827    
828      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
829      if (pChannel == NULL)      if (pChannelStrip == NULL)
830          return;          return;
831    
832      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
833      pChannel->showChannelSetup(false);      pChannelStrip->channelSetup();
834  }  }
835    
836    
# Line 843  void qsamplerMainForm::editResetChannel Line 840  void qsamplerMainForm::editResetChannel
840      if (m_pClient == NULL)      if (m_pClient == NULL)
841          return;          return;
842    
843      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
844      if (pChannel == NULL)      if (pChannelStrip == NULL)
845          return;          return;
846    
847      // Remove the existing sampler channel.      qsamplerChannel *pChannel = pChannelStrip->channel();
848      if (::lscp_reset_channel(m_pClient, pChannel->channelID()) != LSCP_OK) {      if (pChannel == NULL)
         appendMessagesClient("lscp_reset_channel");  
         appendMessagesError(tr("Could not reset channel.\n\nSorry."));  
849          return;          return;
     }  
850    
851      // Log this.      // Reset the existing sampler channel.
852      appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));      pChannel->resetChannel();
853    
854      // Refresh channel strip info.      // Refresh channel strip info.
855      pChannel->updateChannelInfo();      pChannelStrip->updateChannelInfo();
856        // And force a deferred update.
857        m_iChangeCount++;
858  }  }
859    
860    
# Line 919  void qsamplerMainForm::viewOptions (void Line 915  void qsamplerMainForm::viewOptions (void
915      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);
916      if (pOptionsForm) {      if (pOptionsForm) {
917          // Check out some initial nullities(tm)...          // Check out some initial nullities(tm)...
918          qsamplerChannelStrip *pChannel = activeChannel();          qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
919          if (m_pOptions->sDisplayFont.isEmpty() && pChannel)          if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)
920              m_pOptions->sDisplayFont = pChannel->displayFont().toString();              m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();
921          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
922              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
923          // To track down deferred or immediate changes.          // To track down deferred or immediate changes.
# Line 931  void qsamplerMainForm::viewOptions (void Line 927  void qsamplerMainForm::viewOptions (void
927          bool    bOldServerStart     = m_pOptions->bServerStart;          bool    bOldServerStart     = m_pOptions->bServerStart;
928          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
929          QString sOldDisplayFont     = m_pOptions->sDisplayFont;          QString sOldDisplayFont     = m_pOptions->sDisplayFont;
930            bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
931          int     iOldMaxVolume       = m_pOptions->iMaxVolume;          int     iOldMaxVolume       = m_pOptions->iMaxVolume;
932          QString sOldMessagesFont    = m_pOptions->sMessagesFont;          QString sOldMessagesFont    = m_pOptions->sMessagesFont;
933          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
# Line 955  void qsamplerMainForm::viewOptions (void Line 952  void qsamplerMainForm::viewOptions (void
952                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
953                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
954                  updateRecentFilesMenu();                  updateRecentFilesMenu();
955                if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) ||
956                    (!bOldDisplayEffect &&  m_pOptions->bDisplayEffect))
957                    updateDisplayEffect();
958              if (sOldDisplayFont != m_pOptions->sDisplayFont)              if (sOldDisplayFont != m_pOptions->sDisplayFont)
959                  updateDisplayFont();                  updateDisplayFont();
960              if (iOldMaxVolume != m_pOptions->iMaxVolume)              if (iOldMaxVolume != m_pOptions->iMaxVolume)
# Line 997  void qsamplerMainForm::channelsArrange ( Line 997  void qsamplerMainForm::channelsArrange (
997      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
998      int y = 0;      int y = 0;
999      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1000          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1001      /*  if (pChannel->testWState(WState_Maximized | WState_Minimized)) {      /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {
1002              // Prevent flicker...              // Prevent flicker...
1003              pChannel->hide();              pChannelStrip->hide();
1004              pChannel->showNormal();              pChannelStrip->showNormal();
1005          }   */          }   */
1006          pChannel->adjustSize();          pChannelStrip->adjustSize();
1007          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1008          if (iWidth < pChannel->width())          if (iWidth < pChannelStrip->width())
1009              iWidth = pChannel->width();              iWidth = pChannelStrip->width();
1010      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1011          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1012          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1013          y += iHeight;          y += iHeight;
1014      }      }
1015      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 1095  void qsamplerMainForm::stabilizeForm (vo Line 1095  void qsamplerMainForm::stabilizeForm (vo
1095      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));
1096    
1097      // Update the main menu state...      // Update the main menu state...
1098      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
1099      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);
1100      bool bHasChannel = (bHasClient && pChannel != NULL);      bool bHasChannel = (bHasClient && pChannelStrip != NULL);
1101      fileNewAction->setEnabled(bHasClient);      fileNewAction->setEnabled(bHasClient);
1102      fileOpenAction->setEnabled(bHasClient);      fileOpenAction->setEnabled(bHasClient);
1103      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
# Line 1121  void qsamplerMainForm::stabilizeForm (vo Line 1121  void qsamplerMainForm::stabilizeForm (vo
1121      }      }
1122      // Channel status...      // Channel status...
1123      if (bHasChannel)      if (bHasChannel)
1124          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannel->caption());          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());
1125      else      else
1126          m_status[QSAMPLER_STATUS_CHANNEL]->clear();          m_status[QSAMPLER_STATUS_CHANNEL]->clear();
1127      // Session status...      // Session status...
# Line 1140  void qsamplerMainForm::stabilizeForm (vo Line 1140  void qsamplerMainForm::stabilizeForm (vo
1140    
1141    
1142  // Channel change receiver slot.  // Channel change receiver slot.
1143  void qsamplerMainForm::channelChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )
1144  {  {
1145        // Flag that we're update those channel strips.
1146        m_iChangeCount++;
1147      // Just mark the dirty form.      // Just mark the dirty form.
1148      m_iDirtyCount++;      m_iDirtyCount++;
1149      // and update the form status...      // and update the form status...
# Line 1214  void qsamplerMainForm::updateDisplayFont Line 1216  void qsamplerMainForm::updateDisplayFont
1216    
1217      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1218      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1219          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1220          pChannel->setDisplayFont(font);          if (pChannelStrip)
1221                pChannelStrip->setDisplayFont(font);
1222        }
1223        m_pWorkspace->setUpdatesEnabled(true);
1224    }
1225    
1226    
1227    // Update channel strips background effect.
1228    void qsamplerMainForm::updateDisplayEffect (void)
1229    {
1230       QPixmap pm;
1231        if (m_pOptions->bDisplayEffect)
1232            pm = QPixmap::fromMimeSource("displaybg1.png");
1233    
1234        // Full channel list update...
1235        QWidgetList wlist = m_pWorkspace->windowList();
1236        if (wlist.isEmpty())
1237            return;
1238    
1239        m_pWorkspace->setUpdatesEnabled(false);
1240        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1241            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1242            if (pChannelStrip)
1243                pChannelStrip->setDisplayBackground(pm);
1244      }      }
1245      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1246  }  }
# Line 1234  void qsamplerMainForm::updateMaxVolume ( Line 1259  void qsamplerMainForm::updateMaxVolume (
1259    
1260      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1261      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1262          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1263          pChannel->setMaxVolume(m_pOptions->iMaxVolume);          if (pChannelStrip)
1264                pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1265      }      }
1266      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1267  }  }
# Line 1334  void qsamplerMainForm::updateMessagesCap Line 1360  void qsamplerMainForm::updateMessagesCap
1360  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
1361    
1362  // The channel strip creation executive.  // The channel strip creation executive.
1363  void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt )  qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID )
1364  {  {
1365      if (m_pClient == NULL)      if (m_pClient == NULL)
1366          return;          return NULL;
1367    
1368      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1369      qsamplerChannelStrip *pChannel = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
1370      int y = 0;      int y = 0;
1371      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1372          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1373          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1374              pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1375          //  y += pChannel->height() + pChannel->parentWidget()->baseSize().height();          //  y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1376              y += pChannel->parentWidget()->frameGeometry().height();              y += pChannelStrip->parentWidget()->frameGeometry().height();
1377          }          }
1378      }      }
1379    
1380      // Add a new channel itema...      // Add a new channel itema...
1381      WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder;      WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder;
1382      pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1383      pChannel->setMaxVolume(m_pOptions->iMaxVolume);      // Actual channel setup.
1384      pChannel->setup(this, iChannelID);      pChannelStrip->setup(this, iChannelID);
1385      // We'll need a display font.      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
     QFont font;  
     if (m_pOptions && font.fromString(m_pOptions->sDisplayFont))  
         pChannel->setDisplayFont(font);  
     // Track channel setup changes.  
     QObject::connect(pChannel, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelChanged(qsamplerChannelStrip *)));  
1386      // Before we show it up, may be we'll      // Before we show it up, may be we'll
1387      // better ask for some initial values?      // better ask for some initial values?
1388      if (bPrompt)      if (iChannelID < 0 && !pChannelStrip->channelSetup()) {
1389          pChannel->showChannelSetup(true);          // No luck, bail out...
1390            delete pChannelStrip;
1391            return NULL;
1392        }
1393    
1394        // Set some initial aesthetic options...
1395        if (m_pOptions) {
1396            // Background display effect...
1397            pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
1398            // We'll need a display font.
1399            QFont font;
1400            if (font.fromString(m_pOptions->sDisplayFont))
1401                pChannelStrip->setDisplayFont(font);
1402            // Maximum allowed volume setting.
1403            pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1404        }
1405    
1406      // Now we show up us to the world.      // Now we show up us to the world.
1407      pChannel->show();      pChannelStrip->show();
1408      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
1409      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1410          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1411      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();
1412          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1413          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1414      }      }
1415        
1416        // Return our successful reference...
1417        return pChannelStrip;
1418  }  }
1419    
1420    
1421  // Retrieve the active channel strip.  // Retrieve the active channel strip.
1422  qsamplerChannelStrip *qsamplerMainForm::activeChannel (void)  qsamplerChannelStrip *qsamplerMainForm::activeChannelStrip (void)
1423  {  {
1424      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();
1425  }  }
1426    
1427    
1428  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
1429  qsamplerChannelStrip *qsamplerMainForm::channelAt ( int iChannel )  qsamplerChannelStrip *qsamplerMainForm::channelStripAt ( int iChannel )
1430  {  {
1431      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1432      if (wlist.isEmpty())      if (wlist.isEmpty())
# Line 1407  void qsamplerMainForm::channelsMenuAbout Line 1447  void qsamplerMainForm::channelsMenuAbout
1447      if (!wlist.isEmpty()) {      if (!wlist.isEmpty()) {
1448          channelsMenu->insertSeparator();          channelsMenu->insertSeparator();
1449          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1450              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1451              int iItemID = channelsMenu->insertItem(pChannel->caption(), this, SLOT(channelsMenuActivated(int)));              if (pChannelStrip) {
1452              channelsMenu->setItemParameter(iItemID, iChannel);                  int iItemID = channelsMenu->insertItem(pChannelStrip->caption(), this, SLOT(channelsMenuActivated(int)));
1453              channelsMenu->setItemChecked(iItemID, activeChannel() == pChannel);                  channelsMenu->setItemParameter(iItemID, iChannel);
1454                    channelsMenu->setItemChecked(iItemID, activeChannelStrip() == pChannelStrip);
1455                }
1456          }          }
1457      }      }
1458  }  }
# Line 1419  void qsamplerMainForm::channelsMenuAbout Line 1461  void qsamplerMainForm::channelsMenuAbout
1461  // Windows menu activation slot  // Windows menu activation slot
1462  void qsamplerMainForm::channelsMenuActivated ( int iChannel )  void qsamplerMainForm::channelsMenuActivated ( int iChannel )
1463  {  {
1464      qsamplerChannelStrip *pChannel = channelAt(iChannel);      qsamplerChannelStrip *pChannelStrip = channelStripAt(iChannel);
1465      if (pChannel)      if (pChannelStrip)
1466          pChannel->showNormal();          pChannelStrip->showNormal();
1467      pChannel->setFocus();      pChannelStrip->setFocus();
1468  }  }
1469    
1470    
# Line 1462  void qsamplerMainForm::timerSlot (void) Line 1504  void qsamplerMainForm::timerSlot (void)
1504      }      }
1505            
1506          // Refresh each channel usage, on each period...          // Refresh each channel usage, on each period...
1507      if (m_pClient && m_pOptions->bAutoRefresh && m_pWorkspace->isUpdatesEnabled()) {      if (m_pClient && (m_iChangeCount > 0 || m_pOptions->bAutoRefresh)) {
1508          m_iTimerSlot += QSAMPLER_TIMER_MSECS;          m_iTimerSlot += QSAMPLER_TIMER_MSECS;
1509          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {
1510              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1511                m_iChangeCount = 0;
1512              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1513              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1514                  qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1515                  if (pChannel->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible()) {
1516                      pChannel->updateChannelUsage();                      // If we can't make it clean, try next time.
1517                        if (!pChannelStrip->updateChannelUsage())
1518                            m_iChangeCount++;
1519                    }
1520              }              }
1521          }          }
1522      }      }

Legend:
Removed from v.263  
changed lines
  Added in v.301

  ViewVC Help
Powered by ViewVC