/[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 145 by capela, Thu Jun 24 18:26:57 2004 UTC revision 265 by capela, Wed Sep 29 16:05:24 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 54  Line 55 
55  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.
56    
57    
58    // All winsock apps needs this.
59  #if defined(WIN32)  #if defined(WIN32)
60  static WSADATA _wsaData;  static WSADATA _wsaData;
61  #endif  #endif
62    
63    
64    //-------------------------------------------------------------------------
65    // qsamplerCustomEvent -- specialty for callback comunication.
66    
67    #define QSAMPLER_CUSTOM_EVENT   1000
68    
69    class qsamplerCustomEvent : public QCustomEvent
70    {
71    public:
72    
73        // Constructor.
74        qsamplerCustomEvent(lscp_event_t event, const char *pchData, int cchData)
75            : QCustomEvent(QSAMPLER_CUSTOM_EVENT)
76        {
77            m_event = event;
78            m_data.setLatin1(pchData, cchData);
79        }
80    
81        // Accessors.
82        lscp_event_t event() { return m_event; }
83        QString&     data()  { return m_data;  }
84    
85    private:
86    
87        // The proper event type.
88        lscp_event_t m_event;
89        // The event data as a string.
90        QString      m_data;
91    };
92    
93    
94  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
95  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
96    
# Line 277  void qsamplerMainForm::dropEvent ( QDrop Line 310  void qsamplerMainForm::dropEvent ( QDrop
310  }  }
311    
312    
313    // Custome event handler.
314    void qsamplerMainForm::customEvent ( QCustomEvent *pCustomEvent )
315    {
316        // For the time being, just pump it to messages.
317        if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {
318            qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent;
319            appendMessagesColor(tr("Notify event: %1 data: %2")
320                .arg(::lscp_event_to_text(pEvent->event()))
321                .arg(pEvent->data()), "#996699");
322        }
323    }
324    
325    
326  // Context menu event handler.  // Context menu event handler.
327  void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent )  void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent )
328  {  {
# Line 438  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 550  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 633  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 707  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 717  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 733  void qsamplerMainForm::editRemoveChannel Line 824  void qsamplerMainForm::editRemoveChannel
824      appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));      appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));
825            
826      // Just delete the channel strip.      // Just delete the channel strip.
827      delete pChannel;      delete pChannelStrip;
828        
829      // Do we auto-arrange?      // Do we auto-arrange?
830      if (m_pOptions && m_pOptions->bAutoArrange)      if (m_pOptions && m_pOptions->bAutoArrange)
831          channelsArrange();          channelsArrange();
# Line 750  void qsamplerMainForm::editSetupChannel Line 842  void qsamplerMainForm::editSetupChannel
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      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
850      pChannel->channelSetup();      pChannelStrip->showChannelSetup(false);
851  }  }
852    
853    
# Line 765  void qsamplerMainForm::editResetChannel Line 857  void qsamplerMainForm::editResetChannel
857      if (m_pClient == NULL)      if (m_pClient == NULL)
858          return;          return;
859    
860      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
861        if (pChannelStrip == NULL)
862            return;
863    
864        qsamplerChannel *pChannel = pChannelStrip->channel();
865      if (pChannel == NULL)      if (pChannel == NULL)
866          return;          return;
867    
# Line 780  void qsamplerMainForm::editResetChannel Line 876  void qsamplerMainForm::editResetChannel
876      appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));      appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));
877    
878      // Refresh channel strip info.      // Refresh channel strip info.
879      pChannel->updateChannelInfo();      pChannelStrip->updateChannelInfo();
880  }  }
881    
882    
# Line 841  void qsamplerMainForm::viewOptions (void Line 937  void qsamplerMainForm::viewOptions (void
937      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);
938      if (pOptionsForm) {      if (pOptionsForm) {
939          // Check out some initial nullities(tm)...          // Check out some initial nullities(tm)...
940          qsamplerChannelStrip *pChannel = activeChannel();          qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
941          if (m_pOptions->sDisplayFont.isEmpty() && pChannel)          if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)
942              m_pOptions->sDisplayFont = pChannel->displayFont().toString();              m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();
943          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
944              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
945          // To track down deferred or immediate changes.          // To track down deferred or immediate changes.
# Line 919  void qsamplerMainForm::channelsArrange ( Line 1015  void qsamplerMainForm::channelsArrange (
1015      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1016      int y = 0;      int y = 0;
1017      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1018          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1019      /*  if (pChannel->testWState(WState_Maximized | WState_Minimized)) {      /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {
1020              // Prevent flicker...              // Prevent flicker...
1021              pChannel->hide();              pChannelStrip->hide();
1022              pChannel->showNormal();              pChannelStrip->showNormal();
1023          }   */          }   */
1024          pChannel->adjustSize();          pChannelStrip->adjustSize();
1025          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1026          if (iWidth < pChannel->width())          if (iWidth < pChannelStrip->width())
1027              iWidth = pChannel->width();              iWidth = pChannelStrip->width();
1028      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1029          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1030          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1031          y += iHeight;          y += iHeight;
1032      }      }
1033      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 979  void qsamplerMainForm::helpAbout (void) Line 1075  void qsamplerMainForm::helpAbout (void)
1075      sText += tr("Debugging option enabled.");      sText += tr("Debugging option enabled.");
1076      sText += "</font></small><br />";      sText += "</font></small><br />";
1077  #endif  #endif
1078    #ifndef CONFIG_LIBGIG
1079        sText += "<small><font color=\"red\">";
1080        sText += tr("GIG (libgig) file support disabled.");
1081        sText += "</font></small><br />";
1082    #endif
1083      sText += "<br />\n";      sText += "<br />\n";
1084      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1085      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1012  void qsamplerMainForm::stabilizeForm (vo Line 1113  void qsamplerMainForm::stabilizeForm (vo
1113      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));
1114    
1115      // Update the main menu state...      // Update the main menu state...
1116      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
1117      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);
1118      bool bHasChannel = (bHasClient && pChannel != NULL);      bool bHasChannel = (bHasClient && pChannelStrip != NULL);
1119      fileNewAction->setEnabled(bHasClient);      fileNewAction->setEnabled(bHasClient);
1120      fileOpenAction->setEnabled(bHasClient);      fileOpenAction->setEnabled(bHasClient);
1121      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
1122      fileSaveAsAction->setEnabled(bHasClient);      fileSaveAsAction->setEnabled(bHasClient);
1123        fileResetAction->setEnabled(bHasClient);
1124      fileRestartAction->setEnabled(bHasClient || m_pServer == NULL);      fileRestartAction->setEnabled(bHasClient || m_pServer == NULL);
1125      editAddChannelAction->setEnabled(bHasClient);      editAddChannelAction->setEnabled(bHasClient);
1126      editRemoveChannelAction->setEnabled(bHasChannel);      editRemoveChannelAction->setEnabled(bHasChannel);
# Line 1037  void qsamplerMainForm::stabilizeForm (vo Line 1139  void qsamplerMainForm::stabilizeForm (vo
1139      }      }
1140      // Channel status...      // Channel status...
1141      if (bHasChannel)      if (bHasChannel)
1142          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannel->caption());          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());
1143      else      else
1144          m_status[QSAMPLER_STATUS_CHANNEL]->clear();          m_status[QSAMPLER_STATUS_CHANNEL]->clear();
1145      // Session status...      // Session status...
# Line 1056  void qsamplerMainForm::stabilizeForm (vo Line 1158  void qsamplerMainForm::stabilizeForm (vo
1158    
1159    
1160  // Channel change receiver slot.  // Channel change receiver slot.
1161  void qsamplerMainForm::channelChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )
1162  {  {
1163      // Just mark the dirty form.      // Just mark the dirty form.
1164      m_iDirtyCount++;      m_iDirtyCount++;
# Line 1130  void qsamplerMainForm::updateDisplayFont Line 1232  void qsamplerMainForm::updateDisplayFont
1232    
1233      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1234      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1235          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1236          pChannel->setDisplayFont(font);          if (pChannelStrip)
1237                pChannelStrip->setDisplayFont(font);
1238      }      }
1239      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1240  }  }
# Line 1150  void qsamplerMainForm::updateMaxVolume ( Line 1253  void qsamplerMainForm::updateMaxVolume (
1253    
1254      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1255      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1256          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1257          pChannel->setMaxVolume(m_pOptions->iMaxVolume);          if (pChannelStrip)
1258                pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1259      }      }
1260      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1261  }  }
# Line 1256  void qsamplerMainForm::createChannel ( i Line 1360  void qsamplerMainForm::createChannel ( i
1360          return;          return;
1361    
1362      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1363      qsamplerChannelStrip *pChannel = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
1364      int y = 0;      int y = 0;
1365      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1366          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1367          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1368              pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1369          //  y += pChannel->height() + pChannel->parentWidget()->baseSize().height();          //  y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1370              y += pChannel->parentWidget()->frameGeometry().height();              y += pChannelStrip->parentWidget()->frameGeometry().height();
1371          }          }
1372      }      }
1373    
1374      // Add a new channel itema...      // Add a new channel itema...
1375      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;
1376      pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1377      pChannel->setMaxVolume(m_pOptions->iMaxVolume);      pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1378      pChannel->setup(this, iChannelID);      pChannelStrip->setup(this, iChannelID);
1379      // We'll need a display font.      // We'll need a display font.
1380      QFont font;      QFont font;
1381      if (m_pOptions && font.fromString(m_pOptions->sDisplayFont))      if (m_pOptions && font.fromString(m_pOptions->sDisplayFont))
1382          pChannel->setDisplayFont(font);          pChannelStrip->setDisplayFont(font);
1383      // Track channel setup changes.      // Track channel setup changes.
1384      QObject::connect(pChannel, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelChanged(qsamplerChannelStrip *)));      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
1385      // Before we show it up, may be we'll      // Before we show it up, may be we'll
1386      // better ask for some initial values?      // better ask for some initial values?
1387      if (bPrompt)      if (bPrompt)
1388          pChannel->channelSetup();                pChannelStrip->showChannelSetup(true);
1389      // Now we show up us to the world.      // Now we show up us to the world.
1390      pChannel->show();      pChannelStrip->show();
1391      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
1392      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1393          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1394      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();
1395          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1396          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1397      }      }
1398  }  }
1399    
1400    
1401  // Retrieve the active channel strip.  // Retrieve the active channel strip.
1402  qsamplerChannelStrip *qsamplerMainForm::activeChannel (void)  qsamplerChannelStrip *qsamplerMainForm::activeChannelStrip (void)
1403  {  {
1404      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();
1405  }  }
1406    
1407    
1408  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
1409  qsamplerChannelStrip *qsamplerMainForm::channelAt ( int iChannel )  qsamplerChannelStrip *qsamplerMainForm::channelStripAt ( int iChannel )
1410  {  {
1411      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1412      if (wlist.isEmpty())      if (wlist.isEmpty())
# Line 1323  void qsamplerMainForm::channelsMenuAbout Line 1427  void qsamplerMainForm::channelsMenuAbout
1427      if (!wlist.isEmpty()) {      if (!wlist.isEmpty()) {
1428          channelsMenu->insertSeparator();          channelsMenu->insertSeparator();
1429          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1430              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1431              int iItemID = channelsMenu->insertItem(pChannel->caption(), this, SLOT(channelsMenuActivated(int)));              if (pChannelStrip) {
1432              channelsMenu->setItemParameter(iItemID, iChannel);                  int iItemID = channelsMenu->insertItem(pChannelStrip->caption(), this, SLOT(channelsMenuActivated(int)));
1433              channelsMenu->setItemChecked(iItemID, activeChannel() == pChannel);                  channelsMenu->setItemParameter(iItemID, iChannel);
1434                    channelsMenu->setItemChecked(iItemID, activeChannelStrip() == pChannelStrip);
1435                }
1436          }          }
1437      }      }
1438  }  }
# Line 1335  void qsamplerMainForm::channelsMenuAbout Line 1441  void qsamplerMainForm::channelsMenuAbout
1441  // Windows menu activation slot  // Windows menu activation slot
1442  void qsamplerMainForm::channelsMenuActivated ( int iChannel )  void qsamplerMainForm::channelsMenuActivated ( int iChannel )
1443  {  {
1444      qsamplerChannelStrip *pChannel = channelAt(iChannel);      qsamplerChannelStrip *pChannelStrip = channelStripAt(iChannel);
1445      if (pChannel)      if (pChannelStrip)
1446          pChannel->showNormal();          pChannelStrip->showNormal();
1447      pChannel->setFocus();      pChannelStrip->setFocus();
1448  }  }
1449    
1450    
# Line 1384  void qsamplerMainForm::timerSlot (void) Line 1490  void qsamplerMainForm::timerSlot (void)
1490              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1491              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1492              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1493                  qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1494                  if (pChannel->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible())
1495                      pChannel->updateChannelUsage();                      pChannelStrip->updateChannelUsage();
1496              }              }
1497          }          }
1498      }      }
# Line 1523  void qsamplerMainForm::processServerExit Line 1629  void qsamplerMainForm::processServerExit
1629  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1630  // qsamplerMainForm -- Client stuff.  // qsamplerMainForm -- Client stuff.
1631    
   
1632  // The LSCP client callback procedure.  // The LSCP client callback procedure.
1633  lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, lscp_event_t /*event*/, const char */*pchBuffer*/, int /*cchBuffer*/, void */*pvData*/ )  lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, lscp_event_t event, const char *pchData, int cchData, void *pvData )
1634  {  {
1635      // FIXME: DO NOT EVER call any GUI code here,      qsamplerMainForm *pMainForm = (qsamplerMainForm *) pvData;
1636        if (pMainForm == NULL)
1637            return LSCP_FAILED;
1638    
1639        // ATTN: DO NOT EVER call any GUI code here,
1640      // as this is run under some other thread context.      // as this is run under some other thread context.
1641      // A custom event must be posted here...      // A custom event must be posted here...
1642      //      QApplication::postEvent(pMainForm, new qsamplerCustomEvent(event, pchData, cchData));
     // QApplication::postEvent((qjackctlMainForm *) pvData, new QCustomEvent(...));  
1643    
1644      return LSCP_OK;      return LSCP_OK;
1645  }  }

Legend:
Removed from v.145  
changed lines
  Added in v.265

  ViewVC Help
Powered by ViewVC