/[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 264 by capela, Wed Sep 29 13:12:45 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 && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK)
491                        appendMessagesClient("lscp_remove_channel");
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 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 << " ";                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;
610          if (pChannel->midiChannel() > 0)                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;
611              ts << pChannel->midiChannel();                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;
612           else                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
613              ts << "ALL";                  if (pChannel->midiChannel() > 0)
614          ts << endl;                      ts << pChannel->midiChannel();
615          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;                   else
616          ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;                      ts << "ALL";
617          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;                  ts << endl;
618          ts << endl;                  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 785  void qsamplerMainForm::editRemoveChannel Line 794  void qsamplerMainForm::editRemoveChannel
794      if (m_pClient == NULL)      if (m_pClient == NULL)
795          return;          return;
796    
797      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
798        if (pChannelStrip == NULL)
799            return;
800            
801        qsamplerChannel *pChannel = pChannelStrip->channel();
802      if (pChannel == NULL)      if (pChannel == NULL)
803          return;          return;
804    
# Line 795  void qsamplerMainForm::editRemoveChannel Line 808  void qsamplerMainForm::editRemoveChannel
808              tr("About to remove channel:\n\n"              tr("About to remove channel:\n\n"
809                 "%1\n\n"                 "%1\n\n"
810                 "Are you sure?")                 "Are you sure?")
811                 .arg(pChannel->caption()),                 .arg(pChannelStrip->caption()),
812              tr("OK"), tr("Cancel")) > 0)              tr("OK"), tr("Cancel")) > 0)
813              return;              return;
814      }      }
# Line 828  void qsamplerMainForm::editSetupChannel Line 841  void qsamplerMainForm::editSetupChannel
841      if (m_pClient == NULL)      if (m_pClient == NULL)
842          return;          return;
843    
844      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
845      if (pChannel == NULL)      if (pChannelStrip == NULL)
846          return;          return;
847    
848      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
849      pChannel->showChannelSetup(false);      pChannelStrip->showChannelSetup(false);
850  }  }
851    
852    
# Line 843  void qsamplerMainForm::editResetChannel Line 856  void qsamplerMainForm::editResetChannel
856      if (m_pClient == NULL)      if (m_pClient == NULL)
857          return;          return;
858    
859      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
860        if (pChannelStrip == NULL)
861            return;
862    
863        qsamplerChannel *pChannel = pChannelStrip->channel();
864      if (pChannel == NULL)      if (pChannel == NULL)
865          return;          return;
866    
# Line 858  void qsamplerMainForm::editResetChannel Line 875  void qsamplerMainForm::editResetChannel
875      appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));      appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));
876    
877      // Refresh channel strip info.      // Refresh channel strip info.
878      pChannel->updateChannelInfo();      pChannelStrip->updateChannelInfo();
879  }  }
880    
881    
# Line 919  void qsamplerMainForm::viewOptions (void Line 936  void qsamplerMainForm::viewOptions (void
936      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);
937      if (pOptionsForm) {      if (pOptionsForm) {
938          // Check out some initial nullities(tm)...          // Check out some initial nullities(tm)...
939          qsamplerChannelStrip *pChannel = activeChannel();          qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
940          if (m_pOptions->sDisplayFont.isEmpty() && pChannel)          if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)
941              m_pOptions->sDisplayFont = pChannel->displayFont().toString();              m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();
942          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
943              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
944          // To track down deferred or immediate changes.          // To track down deferred or immediate changes.
# Line 997  void qsamplerMainForm::channelsArrange ( Line 1014  void qsamplerMainForm::channelsArrange (
1014      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1015      int y = 0;      int y = 0;
1016      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1017          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1018      /*  if (pChannel->testWState(WState_Maximized | WState_Minimized)) {      /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {
1019              // Prevent flicker...              // Prevent flicker...
1020              pChannel->hide();              pChannelStrip->hide();
1021              pChannel->showNormal();              pChannelStrip->showNormal();
1022          }   */          }   */
1023          pChannel->adjustSize();          pChannelStrip->adjustSize();
1024          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1025          if (iWidth < pChannel->width())          if (iWidth < pChannelStrip->width())
1026              iWidth = pChannel->width();              iWidth = pChannelStrip->width();
1027      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1028          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1029          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1030          y += iHeight;          y += iHeight;
1031      }      }
1032      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 1095  void qsamplerMainForm::stabilizeForm (vo Line 1112  void qsamplerMainForm::stabilizeForm (vo
1112      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));
1113    
1114      // Update the main menu state...      // Update the main menu state...
1115      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
1116      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);
1117      bool bHasChannel = (bHasClient && pChannel != NULL);      bool bHasChannel = (bHasClient && pChannelStrip != NULL);
1118      fileNewAction->setEnabled(bHasClient);      fileNewAction->setEnabled(bHasClient);
1119      fileOpenAction->setEnabled(bHasClient);      fileOpenAction->setEnabled(bHasClient);
1120      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
# Line 1121  void qsamplerMainForm::stabilizeForm (vo Line 1138  void qsamplerMainForm::stabilizeForm (vo
1138      }      }
1139      // Channel status...      // Channel status...
1140      if (bHasChannel)      if (bHasChannel)
1141          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannel->caption());          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());
1142      else      else
1143          m_status[QSAMPLER_STATUS_CHANNEL]->clear();          m_status[QSAMPLER_STATUS_CHANNEL]->clear();
1144      // Session status...      // Session status...
# Line 1140  void qsamplerMainForm::stabilizeForm (vo Line 1157  void qsamplerMainForm::stabilizeForm (vo
1157    
1158    
1159  // Channel change receiver slot.  // Channel change receiver slot.
1160  void qsamplerMainForm::channelChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )
1161  {  {
1162      // Just mark the dirty form.      // Just mark the dirty form.
1163      m_iDirtyCount++;      m_iDirtyCount++;
# Line 1214  void qsamplerMainForm::updateDisplayFont Line 1231  void qsamplerMainForm::updateDisplayFont
1231    
1232      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1233      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1234          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1235          pChannel->setDisplayFont(font);          if (pChannelStrip)
1236                pChannelStrip->setDisplayFont(font);
1237      }      }
1238      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1239  }  }
# Line 1234  void qsamplerMainForm::updateMaxVolume ( Line 1252  void qsamplerMainForm::updateMaxVolume (
1252    
1253      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1254      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1255          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1256          pChannel->setMaxVolume(m_pOptions->iMaxVolume);          if (pChannelStrip)
1257                pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1258      }      }
1259      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1260  }  }
# Line 1340  void qsamplerMainForm::createChannel ( i Line 1359  void qsamplerMainForm::createChannel ( i
1359          return;          return;
1360    
1361      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1362      qsamplerChannelStrip *pChannel = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
1363      int y = 0;      int y = 0;
1364      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1365          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1366          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1367              pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1368          //  y += pChannel->height() + pChannel->parentWidget()->baseSize().height();          //  y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1369              y += pChannel->parentWidget()->frameGeometry().height();              y += pChannelStrip->parentWidget()->frameGeometry().height();
1370          }          }
1371      }      }
1372    
1373      // Add a new channel itema...      // Add a new channel itema...
1374      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;
1375      pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1376      pChannel->setMaxVolume(m_pOptions->iMaxVolume);      pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1377      pChannel->setup(this, iChannelID);      pChannelStrip->setup(this, iChannelID);
1378      // We'll need a display font.      // We'll need a display font.
1379      QFont font;      QFont font;
1380      if (m_pOptions && font.fromString(m_pOptions->sDisplayFont))      if (m_pOptions && font.fromString(m_pOptions->sDisplayFont))
1381          pChannel->setDisplayFont(font);          pChannelStrip->setDisplayFont(font);
1382      // Track channel setup changes.      // Track channel setup changes.
1383      QObject::connect(pChannel, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelChanged(qsamplerChannelStrip *)));      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(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 (bPrompt)
1387          pChannel->showChannelSetup(true);          pChannelStrip->showChannelSetup(true);
1388      // Now we show up us to the world.      // Now we show up us to the world.
1389      pChannel->show();      pChannelStrip->show();
1390      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
1391      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1392          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1393      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();
1394          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1395          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1396      }      }
1397  }  }
1398    
1399    
1400  // Retrieve the active channel strip.  // Retrieve the active channel strip.
1401  qsamplerChannelStrip *qsamplerMainForm::activeChannel (void)  qsamplerChannelStrip *qsamplerMainForm::activeChannelStrip (void)
1402  {  {
1403      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();
1404  }  }
1405    
1406    
1407  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
1408  qsamplerChannelStrip *qsamplerMainForm::channelAt ( int iChannel )  qsamplerChannelStrip *qsamplerMainForm::channelStripAt ( int iChannel )
1409  {  {
1410      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1411      if (wlist.isEmpty())      if (wlist.isEmpty())
# Line 1407  void qsamplerMainForm::channelsMenuAbout Line 1426  void qsamplerMainForm::channelsMenuAbout
1426      if (!wlist.isEmpty()) {      if (!wlist.isEmpty()) {
1427          channelsMenu->insertSeparator();          channelsMenu->insertSeparator();
1428          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1429              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1430              int iItemID = channelsMenu->insertItem(pChannel->caption(), this, SLOT(channelsMenuActivated(int)));              if (pChannelStrip) {
1431              channelsMenu->setItemParameter(iItemID, iChannel);                  int iItemID = channelsMenu->insertItem(pChannelStrip->caption(), this, SLOT(channelsMenuActivated(int)));
1432              channelsMenu->setItemChecked(iItemID, activeChannel() == pChannel);                  channelsMenu->setItemParameter(iItemID, iChannel);
1433                    channelsMenu->setItemChecked(iItemID, activeChannelStrip() == pChannelStrip);
1434                }
1435          }          }
1436      }      }
1437  }  }
# Line 1419  void qsamplerMainForm::channelsMenuAbout Line 1440  void qsamplerMainForm::channelsMenuAbout
1440  // Windows menu activation slot  // Windows menu activation slot
1441  void qsamplerMainForm::channelsMenuActivated ( int iChannel )  void qsamplerMainForm::channelsMenuActivated ( int iChannel )
1442  {  {
1443      qsamplerChannelStrip *pChannel = channelAt(iChannel);      qsamplerChannelStrip *pChannelStrip = channelStripAt(iChannel);
1444      if (pChannel)      if (pChannelStrip)
1445          pChannel->showNormal();          pChannelStrip->showNormal();
1446      pChannel->setFocus();      pChannelStrip->setFocus();
1447  }  }
1448    
1449    
# Line 1468  void qsamplerMainForm::timerSlot (void) Line 1489  void qsamplerMainForm::timerSlot (void)
1489              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1490              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1491              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1492                  qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1493                  if (pChannel->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible())
1494                      pChannel->updateChannelUsage();                      pChannelStrip->updateChannelUsage();
1495              }              }
1496          }          }
1497      }      }

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

  ViewVC Help
Powered by ViewVC