/[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 150 by capela, Sat Jun 26 17:40:38 2004 UTC revision 295 by capela, Tue Nov 16 15:26:18 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 483  bool qsamplerMainForm::closeSession ( bo Line 484  bool qsamplerMainForm::closeSession ( bo
484          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
485          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
486          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
487              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
488              if (bForce && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK)              if (pChannelStrip) {
489                  appendMessagesClient("lscp_remove_channel");                  qsamplerChannel *pChannel = pChannelStrip->channel();
490              delete pChannel;                  if (bForce && pChannel)
491                        pChannel->removeChannel();
492                    delete pChannelStrip;
493                }
494          }          }
495          m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
496          // We're now clean, for sure.          // We're now clean, for sure.
# Line 548  bool qsamplerMainForm::loadSessionFile ( Line 552  bool qsamplerMainForm::loadSessionFile (
552      // Try to (re)create each channel.      // Try to (re)create each channel.
553      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
554      for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {      for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {
555          createChannel(iChannelID, false);          createChannelStrip(iChannelID);
556          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
557      }      }
558      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 595  bool qsamplerMainForm::saveSessionFile ( Line 599  bool qsamplerMainForm::saveSessionFile (
599      ts << endl;      ts << endl;
600      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
601      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
602          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
603          int iChannelID = pChannel->channelID();          if (pChannelStrip) {
604          ts << "# " << pChannel->caption() << endl;              qsamplerChannel *pChannel = pChannelStrip->channel();
605          ts << "ADD CHANNEL" << endl;              if (pChannel) {
606          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;                  int iChannelID = pChannel->channelID();
607          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;                  ts << "# " << pChannelStrip->caption() << endl;
608      //  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;                  ts << "ADD CHANNEL" << endl;
609          ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " " << pChannel->midiChannel() << endl;                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;
610          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;
611          ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;
612          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
613          ts << endl;                  if (pChannel->midiChannel() > 0)
614                        ts << pChannel->midiChannel();
615                     else
616                        ts << "ALL";
617                    ts << endl;
618                    ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;
619                    ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;
620                    ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;
621                    ts << endl;
622                }
623            }
624          // Try to keep it snappy :)          // Try to keep it snappy :)
625          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
626      }      }
# Line 678  void qsamplerMainForm::fileSaveAs (void) Line 692  void qsamplerMainForm::fileSaveAs (void)
692  }  }
693    
694    
695    // Reset the sampler instance.
696    void qsamplerMainForm::fileReset (void)
697    {
698        if (m_pClient == NULL)
699            return;
700    
701        // Ask user whether he/she want's an internal sampler reset...
702        if (QMessageBox::warning(this, tr("Warning"),
703            tr("Resetting the sampler instance will close\n"
704               "all device and channel configurations.\n\n"
705               "Please note that this operation may cause\n"
706               "temporary MIDI and Audio disruption\n\n"
707               "Do you want to reset the sampler engine now?"),
708            tr("Reset"), tr("Cancel")) > 0)
709            return;
710    
711        // Just do the reset, after closing down current session...
712        if (closeSession(true) && ::lscp_reset_sampler(m_pClient) != LSCP_OK) {
713            appendMessagesClient("lscp_reset_sampler");
714            appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));
715            return;
716        }
717    
718        // Log this.
719        appendMessages(tr("Sampler reset."));
720    }
721    
722    
723  // Restart the client/server instance.  // Restart the client/server instance.
724  void qsamplerMainForm::fileRestart (void)  void qsamplerMainForm::fileRestart (void)
725  {  {
# Line 725  void qsamplerMainForm::editAddChannel (v Line 767  void qsamplerMainForm::editAddChannel (v
767      if (m_pClient == NULL)      if (m_pClient == NULL)
768          return;          return;
769    
770      // Create the new sampler channel.      // Just create the channel strip, given an invalid channel id.
771      int iChannelID = ::lscp_add_channel(m_pClient);      qsamplerChannelStrip *pChannelStrip = createChannelStrip(-1);
772      if (iChannelID < 0) {      if (pChannelStrip == NULL)
         appendMessagesClient("lscp_add_channel");  
         appendMessagesError(tr("Could not create the new channel.\n\nSorry."));  
773          return;          return;
774      }          
   
     // Log this happening.  
     appendMessages(tr("Channel %1 created.").arg(iChannelID));  
   
     // Just create the channel strip with given id.  
     createChannel(iChannelID, true);  
   
775      // We'll be dirty, for sure...      // We'll be dirty, for sure...
776      m_iDirtyCount++;      m_iDirtyCount++;
777      // Stabilize form anyway.      // Stabilize form anyway.
# Line 752  void qsamplerMainForm::editRemoveChannel Line 785  void qsamplerMainForm::editRemoveChannel
785      if (m_pClient == NULL)      if (m_pClient == NULL)
786          return;          return;
787    
788      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
789        if (pChannelStrip == NULL)
790            return;
791            
792        qsamplerChannel *pChannel = pChannelStrip->channel();
793      if (pChannel == NULL)      if (pChannel == NULL)
794          return;          return;
795    
# Line 762  void qsamplerMainForm::editRemoveChannel Line 799  void qsamplerMainForm::editRemoveChannel
799              tr("About to remove channel:\n\n"              tr("About to remove channel:\n\n"
800                 "%1\n\n"                 "%1\n\n"
801                 "Are you sure?")                 "Are you sure?")
802                 .arg(pChannel->caption()),                 .arg(pChannelStrip->caption()),
803              tr("OK"), tr("Cancel")) > 0)              tr("OK"), tr("Cancel")) > 0)
804              return;              return;
805      }      }
806    
807      // Remove the existing sampler channel.      // Remove the existing sampler channel.
808      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."));  
809          return;          return;
     }  
810    
     // Log this happening.  
     appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));  
       
811      // Just delete the channel strip.      // Just delete the channel strip.
812      delete pChannel;      delete pChannelStrip;
813        
814      // Do we auto-arrange?      // Do we auto-arrange?
815      if (m_pOptions && m_pOptions->bAutoArrange)      if (m_pOptions && m_pOptions->bAutoArrange)
816          channelsArrange();          channelsArrange();
# Line 795  void qsamplerMainForm::editSetupChannel Line 827  void qsamplerMainForm::editSetupChannel
827      if (m_pClient == NULL)      if (m_pClient == NULL)
828          return;          return;
829    
830      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
831      if (pChannel == NULL)      if (pChannelStrip == NULL)
832          return;          return;
833    
834      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
835      pChannel->channelSetup();      pChannelStrip->channelSetup();
836  }  }
837    
838    
# Line 810  void qsamplerMainForm::editResetChannel Line 842  void qsamplerMainForm::editResetChannel
842      if (m_pClient == NULL)      if (m_pClient == NULL)
843          return;          return;
844    
845      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
846      if (pChannel == NULL)      if (pChannelStrip == NULL)
847          return;          return;
848    
849      // Remove the existing sampler channel.      qsamplerChannel *pChannel = pChannelStrip->channel();
850      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."));  
851          return;          return;
     }  
852    
853      // Log this.      // Reset the existing sampler channel.
854      appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));      pChannel->resetChannel();
855    
856      // Refresh channel strip info.      // Refresh channel strip info.
857      pChannel->updateChannelInfo();      pChannelStrip->updateChannelInfo();
858  }  }
859    
860    
# Line 886  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 898  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 922  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 964  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 1024  void qsamplerMainForm::helpAbout (void) Line 1057  void qsamplerMainForm::helpAbout (void)
1057      sText += tr("Debugging option enabled.");      sText += tr("Debugging option enabled.");
1058      sText += "</font></small><br />";      sText += "</font></small><br />";
1059  #endif  #endif
1060    #ifndef CONFIG_LIBGIG
1061        sText += "<small><font color=\"red\">";
1062        sText += tr("GIG (libgig) file support disabled.");
1063        sText += "</font></small><br />";
1064    #endif
1065      sText += "<br />\n";      sText += "<br />\n";
1066      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1067      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1057  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);
1104      fileSaveAsAction->setEnabled(bHasClient);      fileSaveAsAction->setEnabled(bHasClient);
1105        fileResetAction->setEnabled(bHasClient);
1106      fileRestartAction->setEnabled(bHasClient || m_pServer == NULL);      fileRestartAction->setEnabled(bHasClient || m_pServer == NULL);
1107      editAddChannelAction->setEnabled(bHasClient);      editAddChannelAction->setEnabled(bHasClient);
1108      editRemoveChannelAction->setEnabled(bHasChannel);      editRemoveChannelAction->setEnabled(bHasChannel);
# Line 1082  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 1101  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      // Just mark the dirty form.      // Just mark the dirty form.
1146      m_iDirtyCount++;      m_iDirtyCount++;
# Line 1175  void qsamplerMainForm::updateDisplayFont Line 1214  void qsamplerMainForm::updateDisplayFont
1214    
1215      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1216      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1217          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1218          pChannel->setDisplayFont(font);          if (pChannelStrip)
1219                pChannelStrip->setDisplayFont(font);
1220        }
1221        m_pWorkspace->setUpdatesEnabled(true);
1222    }
1223    
1224    
1225    // Update channel strips background effect.
1226    void qsamplerMainForm::updateDisplayEffect (void)
1227    {
1228       QPixmap pm;
1229        if (m_pOptions->bDisplayEffect)
1230            pm = QPixmap::fromMimeSource("displaybg1.png");
1231    
1232        // Full channel list update...
1233        QWidgetList wlist = m_pWorkspace->windowList();
1234        if (wlist.isEmpty())
1235            return;
1236    
1237        m_pWorkspace->setUpdatesEnabled(false);
1238        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1239            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1240            if (pChannelStrip)
1241                pChannelStrip->setDisplayBackground(pm);
1242      }      }
1243      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1244  }  }
# Line 1195  void qsamplerMainForm::updateMaxVolume ( Line 1257  void qsamplerMainForm::updateMaxVolume (
1257    
1258      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1259      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1260          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1261          pChannel->setMaxVolume(m_pOptions->iMaxVolume);          if (pChannelStrip)
1262                pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1263      }      }
1264      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1265  }  }
# Line 1295  void qsamplerMainForm::updateMessagesCap Line 1358  void qsamplerMainForm::updateMessagesCap
1358  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
1359    
1360  // The channel strip creation executive.  // The channel strip creation executive.
1361  void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt )  qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID )
1362  {  {
1363      if (m_pClient == NULL)      if (m_pClient == NULL)
1364          return;          return NULL;
1365    
1366      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1367      qsamplerChannelStrip *pChannel = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
1368      int y = 0;      int y = 0;
1369      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1370          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1371          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1372              pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1373          //  y += pChannel->height() + pChannel->parentWidget()->baseSize().height();          //  y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1374              y += pChannel->parentWidget()->frameGeometry().height();              y += pChannelStrip->parentWidget()->frameGeometry().height();
1375          }          }
1376      }      }
1377    
1378      // Add a new channel itema...      // Add a new channel itema...
1379      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;
1380      pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1381      pChannel->setMaxVolume(m_pOptions->iMaxVolume);      // Actual channel setup.
1382      pChannel->setup(this, iChannelID);      pChannelStrip->setup(this, iChannelID);
1383      // 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 *)));  
1384      // Before we show it up, may be we'll      // Before we show it up, may be we'll
1385      // better ask for some initial values?      // better ask for some initial values?
1386      if (bPrompt)      if (iChannelID < 0 && !pChannelStrip->channelSetup()) {
1387          pChannel->channelSetup();                // No luck, bail out...
1388            delete pChannelStrip;
1389            return NULL;
1390        }
1391    
1392        // Set some initial aesthetic options...
1393        if (m_pOptions) {
1394            // Background display effect...
1395            pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
1396            // We'll need a display font.
1397            QFont font;
1398            if (font.fromString(m_pOptions->sDisplayFont))
1399                pChannelStrip->setDisplayFont(font);
1400            // Maximum allowed volume setting.
1401            pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1402        }
1403    
1404      // Now we show up us to the world.      // Now we show up us to the world.
1405      pChannel->show();      pChannelStrip->show();
1406      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
1407      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1408          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1409      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();
1410          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1411          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1412      }      }
1413        
1414        // Return our successful reference...
1415        return pChannelStrip;
1416  }  }
1417    
1418    
1419  // Retrieve the active channel strip.  // Retrieve the active channel strip.
1420  qsamplerChannelStrip *qsamplerMainForm::activeChannel (void)  qsamplerChannelStrip *qsamplerMainForm::activeChannelStrip (void)
1421  {  {
1422      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();
1423  }  }
1424    
1425    
1426  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
1427  qsamplerChannelStrip *qsamplerMainForm::channelAt ( int iChannel )  qsamplerChannelStrip *qsamplerMainForm::channelStripAt ( int iChannel )
1428  {  {
1429      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1430      if (wlist.isEmpty())      if (wlist.isEmpty())
# Line 1368  void qsamplerMainForm::channelsMenuAbout Line 1445  void qsamplerMainForm::channelsMenuAbout
1445      if (!wlist.isEmpty()) {      if (!wlist.isEmpty()) {
1446          channelsMenu->insertSeparator();          channelsMenu->insertSeparator();
1447          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1448              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1449              int iItemID = channelsMenu->insertItem(pChannel->caption(), this, SLOT(channelsMenuActivated(int)));              if (pChannelStrip) {
1450              channelsMenu->setItemParameter(iItemID, iChannel);                  int iItemID = channelsMenu->insertItem(pChannelStrip->caption(), this, SLOT(channelsMenuActivated(int)));
1451              channelsMenu->setItemChecked(iItemID, activeChannel() == pChannel);                  channelsMenu->setItemParameter(iItemID, iChannel);
1452                    channelsMenu->setItemChecked(iItemID, activeChannelStrip() == pChannelStrip);
1453                }
1454          }          }
1455      }      }
1456  }  }
# Line 1380  void qsamplerMainForm::channelsMenuAbout Line 1459  void qsamplerMainForm::channelsMenuAbout
1459  // Windows menu activation slot  // Windows menu activation slot
1460  void qsamplerMainForm::channelsMenuActivated ( int iChannel )  void qsamplerMainForm::channelsMenuActivated ( int iChannel )
1461  {  {
1462      qsamplerChannelStrip *pChannel = channelAt(iChannel);      qsamplerChannelStrip *pChannelStrip = channelStripAt(iChannel);
1463      if (pChannel)      if (pChannelStrip)
1464          pChannel->showNormal();          pChannelStrip->showNormal();
1465      pChannel->setFocus();      pChannelStrip->setFocus();
1466  }  }
1467    
1468    
# Line 1429  void qsamplerMainForm::timerSlot (void) Line 1508  void qsamplerMainForm::timerSlot (void)
1508              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1509              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1510              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1511                  qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1512                  if (pChannel->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible())
1513                      pChannel->updateChannelUsage();                      pChannelStrip->updateChannelUsage();
1514              }              }
1515          }          }
1516      }      }

Legend:
Removed from v.150  
changed lines
  Added in v.295

  ViewVC Help
Powered by ViewVC