/[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 296 by capela, Wed Nov 17 11:51: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 595  bool qsamplerMainForm::saveSessionFile ( Line 600  bool qsamplerMainForm::saveSessionFile (
600      ts << endl;      ts << endl;
601      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
602      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
603          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
604          int iChannelID = pChannel->channelID();          if (pChannelStrip) {
605          ts << "# " << pChannel->caption() << endl;              qsamplerChannel *pChannel = pChannelStrip->channel();
606          ts << "ADD CHANNEL" << endl;              if (pChannel) {
607          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;                  int iChannelID = pChannel->channelID();
608          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;                  ts << "# " << pChannelStrip->caption() << endl;
609          ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;                  ts << "ADD CHANNEL" << endl;
610          ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;
611          if (pChannel->midiChannel() > 0)                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;
612              ts << pChannel->midiChannel();                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;
613           else                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
614              ts << "ALL";                  if (pChannel->midiChannel() > 0)
615          ts << endl;                      ts << pChannel->midiChannel();
616          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;                   else
617          ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;                      ts << "ALL";
618          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;                  ts << endl;
619          ts << endl;                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;
620                    ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;
621                    ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;
622                    ts << endl;
623                }
624            }
625          // Try to keep it snappy :)          // Try to keep it snappy :)
626          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
627      }      }
# Line 758  void qsamplerMainForm::editAddChannel (v Line 768  void qsamplerMainForm::editAddChannel (v
768      if (m_pClient == NULL)      if (m_pClient == NULL)
769          return;          return;
770    
771      // Create the new sampler channel.      // Just create the channel strip,
772      int iChannelID = ::lscp_add_channel(m_pClient);      // by giving an invalid channel id.
773      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();  
774  }  }
775    
776    
# Line 785  void qsamplerMainForm::editRemoveChannel Line 780  void qsamplerMainForm::editRemoveChannel
780      if (m_pClient == NULL)      if (m_pClient == NULL)
781          return;          return;
782    
783      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
784        if (pChannelStrip == NULL)
785            return;
786            
787        qsamplerChannel *pChannel = pChannelStrip->channel();
788      if (pChannel == NULL)      if (pChannel == NULL)
789          return;          return;
790    
# Line 795  void qsamplerMainForm::editRemoveChannel Line 794  void qsamplerMainForm::editRemoveChannel
794              tr("About to remove channel:\n\n"              tr("About to remove channel:\n\n"
795                 "%1\n\n"                 "%1\n\n"
796                 "Are you sure?")                 "Are you sure?")
797                 .arg(pChannel->caption()),                 .arg(pChannelStrip->caption()),
798              tr("OK"), tr("Cancel")) > 0)              tr("OK"), tr("Cancel")) > 0)
799              return;              return;
800      }      }
801    
802      // Remove the existing sampler channel.      // Remove the existing sampler channel.
803      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."));  
804          return;          return;
     }  
805    
     // Log this happening.  
     appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));  
       
806      // Just delete the channel strip.      // Just delete the channel strip.
807      delete pChannel;      delete pChannelStrip;
808        
809      // Do we auto-arrange?      // Do we auto-arrange?
810      if (m_pOptions && m_pOptions->bAutoArrange)      if (m_pOptions && m_pOptions->bAutoArrange)
811          channelsArrange();          channelsArrange();
# Line 828  void qsamplerMainForm::editSetupChannel Line 822  void qsamplerMainForm::editSetupChannel
822      if (m_pClient == NULL)      if (m_pClient == NULL)
823          return;          return;
824    
825      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
826      if (pChannel == NULL)      if (pChannelStrip == NULL)
827          return;          return;
828    
829      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
830      pChannel->showChannelSetup(false);      pChannelStrip->channelSetup();
831  }  }
832    
833    
# Line 843  void qsamplerMainForm::editResetChannel Line 837  void qsamplerMainForm::editResetChannel
837      if (m_pClient == NULL)      if (m_pClient == NULL)
838          return;          return;
839    
840      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
841      if (pChannel == NULL)      if (pChannelStrip == NULL)
842          return;          return;
843    
844      // Remove the existing sampler channel.      qsamplerChannel *pChannel = pChannelStrip->channel();
845      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."));  
846          return;          return;
     }  
847    
848      // Log this.      // Reset the existing sampler channel.
849      appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));      pChannel->resetChannel();
850    
851      // Refresh channel strip info.      // Refresh channel strip info.
852      pChannel->updateChannelInfo();      pChannelStrip->updateChannelInfo();
853  }  }
854    
855    
# Line 919  void qsamplerMainForm::viewOptions (void Line 910  void qsamplerMainForm::viewOptions (void
910      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);
911      if (pOptionsForm) {      if (pOptionsForm) {
912          // Check out some initial nullities(tm)...          // Check out some initial nullities(tm)...
913          qsamplerChannelStrip *pChannel = activeChannel();          qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
914          if (m_pOptions->sDisplayFont.isEmpty() && pChannel)          if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)
915              m_pOptions->sDisplayFont = pChannel->displayFont().toString();              m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();
916          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
917              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
918          // To track down deferred or immediate changes.          // To track down deferred or immediate changes.
# Line 931  void qsamplerMainForm::viewOptions (void Line 922  void qsamplerMainForm::viewOptions (void
922          bool    bOldServerStart     = m_pOptions->bServerStart;          bool    bOldServerStart     = m_pOptions->bServerStart;
923          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
924          QString sOldDisplayFont     = m_pOptions->sDisplayFont;          QString sOldDisplayFont     = m_pOptions->sDisplayFont;
925            bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
926          int     iOldMaxVolume       = m_pOptions->iMaxVolume;          int     iOldMaxVolume       = m_pOptions->iMaxVolume;
927          QString sOldMessagesFont    = m_pOptions->sMessagesFont;          QString sOldMessagesFont    = m_pOptions->sMessagesFont;
928          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
# Line 955  void qsamplerMainForm::viewOptions (void Line 947  void qsamplerMainForm::viewOptions (void
947                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
948                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
949                  updateRecentFilesMenu();                  updateRecentFilesMenu();
950                if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) ||
951                    (!bOldDisplayEffect &&  m_pOptions->bDisplayEffect))
952                    updateDisplayEffect();
953              if (sOldDisplayFont != m_pOptions->sDisplayFont)              if (sOldDisplayFont != m_pOptions->sDisplayFont)
954                  updateDisplayFont();                  updateDisplayFont();
955              if (iOldMaxVolume != m_pOptions->iMaxVolume)              if (iOldMaxVolume != m_pOptions->iMaxVolume)
# Line 997  void qsamplerMainForm::channelsArrange ( Line 992  void qsamplerMainForm::channelsArrange (
992      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
993      int y = 0;      int y = 0;
994      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
995          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
996      /*  if (pChannel->testWState(WState_Maximized | WState_Minimized)) {      /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {
997              // Prevent flicker...              // Prevent flicker...
998              pChannel->hide();              pChannelStrip->hide();
999              pChannel->showNormal();              pChannelStrip->showNormal();
1000          }   */          }   */
1001          pChannel->adjustSize();          pChannelStrip->adjustSize();
1002          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1003          if (iWidth < pChannel->width())          if (iWidth < pChannelStrip->width())
1004              iWidth = pChannel->width();              iWidth = pChannelStrip->width();
1005      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1006          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1007          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1008          y += iHeight;          y += iHeight;
1009      }      }
1010      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 1095  void qsamplerMainForm::stabilizeForm (vo Line 1090  void qsamplerMainForm::stabilizeForm (vo
1090      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));
1091    
1092      // Update the main menu state...      // Update the main menu state...
1093      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
1094      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);
1095      bool bHasChannel = (bHasClient && pChannel != NULL);      bool bHasChannel = (bHasClient && pChannelStrip != NULL);
1096      fileNewAction->setEnabled(bHasClient);      fileNewAction->setEnabled(bHasClient);
1097      fileOpenAction->setEnabled(bHasClient);      fileOpenAction->setEnabled(bHasClient);
1098      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
# Line 1121  void qsamplerMainForm::stabilizeForm (vo Line 1116  void qsamplerMainForm::stabilizeForm (vo
1116      }      }
1117      // Channel status...      // Channel status...
1118      if (bHasChannel)      if (bHasChannel)
1119          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannel->caption());          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());
1120      else      else
1121          m_status[QSAMPLER_STATUS_CHANNEL]->clear();          m_status[QSAMPLER_STATUS_CHANNEL]->clear();
1122      // Session status...      // Session status...
# Line 1140  void qsamplerMainForm::stabilizeForm (vo Line 1135  void qsamplerMainForm::stabilizeForm (vo
1135    
1136    
1137  // Channel change receiver slot.  // Channel change receiver slot.
1138  void qsamplerMainForm::channelChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )
1139  {  {
1140        // Flag that we're update those channel strips.
1141        m_iChangeCount++;
1142      // Just mark the dirty form.      // Just mark the dirty form.
1143      m_iDirtyCount++;      m_iDirtyCount++;
1144      // and update the form status...      // and update the form status...
# Line 1214  void qsamplerMainForm::updateDisplayFont Line 1211  void qsamplerMainForm::updateDisplayFont
1211    
1212      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1213      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1214          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1215          pChannel->setDisplayFont(font);          if (pChannelStrip)
1216                pChannelStrip->setDisplayFont(font);
1217        }
1218        m_pWorkspace->setUpdatesEnabled(true);
1219    }
1220    
1221    
1222    // Update channel strips background effect.
1223    void qsamplerMainForm::updateDisplayEffect (void)
1224    {
1225       QPixmap pm;
1226        if (m_pOptions->bDisplayEffect)
1227            pm = QPixmap::fromMimeSource("displaybg1.png");
1228    
1229        // Full channel list update...
1230        QWidgetList wlist = m_pWorkspace->windowList();
1231        if (wlist.isEmpty())
1232            return;
1233    
1234        m_pWorkspace->setUpdatesEnabled(false);
1235        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1236            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1237            if (pChannelStrip)
1238                pChannelStrip->setDisplayBackground(pm);
1239      }      }
1240      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1241  }  }
# Line 1234  void qsamplerMainForm::updateMaxVolume ( Line 1254  void qsamplerMainForm::updateMaxVolume (
1254    
1255      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1256      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1257          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1258          pChannel->setMaxVolume(m_pOptions->iMaxVolume);          if (pChannelStrip)
1259                pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1260      }      }
1261      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1262  }  }
# Line 1334  void qsamplerMainForm::updateMessagesCap Line 1355  void qsamplerMainForm::updateMessagesCap
1355  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
1356    
1357  // The channel strip creation executive.  // The channel strip creation executive.
1358  void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt )  qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID )
1359  {  {
1360      if (m_pClient == NULL)      if (m_pClient == NULL)
1361          return;          return NULL;
1362    
1363      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1364      qsamplerChannelStrip *pChannel = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
1365      int y = 0;      int y = 0;
1366      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1367          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1368          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1369              pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1370          //  y += pChannel->height() + pChannel->parentWidget()->baseSize().height();          //  y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1371              y += pChannel->parentWidget()->frameGeometry().height();              y += pChannelStrip->parentWidget()->frameGeometry().height();
1372          }          }
1373      }      }
1374    
1375      // Add a new channel itema...      // Add a new channel itema...
1376      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;
1377      pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1378      pChannel->setMaxVolume(m_pOptions->iMaxVolume);      // Actual channel setup.
1379      pChannel->setup(this, iChannelID);      pChannelStrip->setup(this, iChannelID);
1380      // 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 *)));  
1381      // Before we show it up, may be we'll      // Before we show it up, may be we'll
1382      // better ask for some initial values?      // better ask for some initial values?
1383      if (bPrompt)      if (iChannelID < 0 && !pChannelStrip->channelSetup()) {
1384          pChannel->showChannelSetup(true);          // No luck, bail out...
1385            delete pChannelStrip;
1386            return NULL;
1387        }
1388    
1389        // Set some initial aesthetic options...
1390        if (m_pOptions) {
1391            // Background display effect...
1392            pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
1393            // We'll need a display font.
1394            QFont font;
1395            if (font.fromString(m_pOptions->sDisplayFont))
1396                pChannelStrip->setDisplayFont(font);
1397            // Maximum allowed volume setting.
1398            pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1399        }
1400    
1401      // Now we show up us to the world.      // Now we show up us to the world.
1402      pChannel->show();      pChannelStrip->show();
1403      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
1404      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1405          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1406      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();
1407          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1408          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1409      }      }
1410        
1411        // Return our successful reference...
1412        return pChannelStrip;
1413  }  }
1414    
1415    
1416  // Retrieve the active channel strip.  // Retrieve the active channel strip.
1417  qsamplerChannelStrip *qsamplerMainForm::activeChannel (void)  qsamplerChannelStrip *qsamplerMainForm::activeChannelStrip (void)
1418  {  {
1419      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();
1420  }  }
1421    
1422    
1423  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
1424  qsamplerChannelStrip *qsamplerMainForm::channelAt ( int iChannel )  qsamplerChannelStrip *qsamplerMainForm::channelStripAt ( int iChannel )
1425  {  {
1426      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1427      if (wlist.isEmpty())      if (wlist.isEmpty())
# Line 1407  void qsamplerMainForm::channelsMenuAbout Line 1442  void qsamplerMainForm::channelsMenuAbout
1442      if (!wlist.isEmpty()) {      if (!wlist.isEmpty()) {
1443          channelsMenu->insertSeparator();          channelsMenu->insertSeparator();
1444          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1445              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1446              int iItemID = channelsMenu->insertItem(pChannel->caption(), this, SLOT(channelsMenuActivated(int)));              if (pChannelStrip) {
1447              channelsMenu->setItemParameter(iItemID, iChannel);                  int iItemID = channelsMenu->insertItem(pChannelStrip->caption(), this, SLOT(channelsMenuActivated(int)));
1448              channelsMenu->setItemChecked(iItemID, activeChannel() == pChannel);                  channelsMenu->setItemParameter(iItemID, iChannel);
1449                    channelsMenu->setItemChecked(iItemID, activeChannelStrip() == pChannelStrip);
1450                }
1451          }          }
1452      }      }
1453  }  }
# Line 1419  void qsamplerMainForm::channelsMenuAbout Line 1456  void qsamplerMainForm::channelsMenuAbout
1456  // Windows menu activation slot  // Windows menu activation slot
1457  void qsamplerMainForm::channelsMenuActivated ( int iChannel )  void qsamplerMainForm::channelsMenuActivated ( int iChannel )
1458  {  {
1459      qsamplerChannelStrip *pChannel = channelAt(iChannel);      qsamplerChannelStrip *pChannelStrip = channelStripAt(iChannel);
1460      if (pChannel)      if (pChannelStrip)
1461          pChannel->showNormal();          pChannelStrip->showNormal();
1462      pChannel->setFocus();      pChannelStrip->setFocus();
1463  }  }
1464    
1465    
# Line 1462  void qsamplerMainForm::timerSlot (void) Line 1499  void qsamplerMainForm::timerSlot (void)
1499      }      }
1500            
1501          // Refresh each channel usage, on each period...          // Refresh each channel usage, on each period...
1502      if (m_pClient && m_pOptions->bAutoRefresh && m_pWorkspace->isUpdatesEnabled()) {      if (m_pClient && (m_iChangeCount > 0 || m_pOptions->bAutoRefresh)) {
1503          m_iTimerSlot += QSAMPLER_TIMER_MSECS;          m_iTimerSlot += QSAMPLER_TIMER_MSECS;
1504          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {
1505              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1506                m_iChangeCount = 0;
1507              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1508              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1509                  qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1510                  if (pChannel->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible())
1511                      pChannel->updateChannelUsage();                      pChannelStrip->updateChannelUsage();
1512              }              }
1513          }          }
1514      }      }

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

  ViewVC Help
Powered by ViewVC