~ubuntu-branches/ubuntu/quantal/muse/quantal

« back to all changes in this revision

Viewing changes to muse/mixer/rack.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2010-11-17 21:43:38 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20101117214338-1hvfl7oo2dsqnvrb
Tags: 1.1-0ubuntu1
* New upstream release (LP: #668631)
* Switch to dpkg-source 3.0 (quilt) format
* Switch to dh7 short form
* debian/rules:
  - added --enable-dssi and --enable-osc to conf flags for dssi support
  - added -ljackserver to LDFLAGS to fix a FTBFS because of --as-needed
* debian/control:
  - added build build dependency on liblo-dev and dssi-dev for dssi support
  - bump Standards-version to 3.9.1. No changes required.
* debian/muse.desktop, debian/muse.xpm: dropped as desktop file and icon is
  now shipped upstream.
* fix-desktop-categories.patch: fix Categories tag in upstream desktop file
* 10_es_locale_fix.dpatch: refreshed and converted to quilt as
  fix_es_locale.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "gconfig.h"
25
25
#include "plugin.h"
26
26
#include "filedialog.h"
 
27
#include "config.h"
27
28
 
28
29
//---------------------------------------------------------
29
30
//   class RackSlot
149
150
            mute  = pipe->isOn(idx);
150
151
            }
151
152
 
152
 
      enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SAVE };
 
153
      //enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SAVE };
 
154
      enum { NEW, CHANGE, UP, DOWN, REMOVE, BYPASS, SHOW, SHOW_NATIVE, SAVE };
153
155
      QPopupMenu* menu = new QPopupMenu;
154
156
      menu->insertItem(QIconSet(*upIcon), tr("move up"),   UP, UP);
155
157
      menu->insertItem(QIconSet(*downIcon), tr("move down"), DOWN, DOWN);
156
158
      menu->insertItem(tr("remove"),    REMOVE, REMOVE);
157
159
      menu->insertItem(tr("bypass"),    BYPASS, BYPASS);
158
160
      menu->insertItem(tr("show gui"),  SHOW, SHOW);
 
161
      menu->insertItem(tr("show native gui"),  SHOW_NATIVE, SHOW_NATIVE);
159
162
 
160
163
      menu->setItemChecked(BYPASS, !pipe->isOn(idx));
161
164
      menu->setItemChecked(SHOW, pipe->guiVisible(idx));
 
165
      menu->setItemChecked(SHOW_NATIVE, pipe->nativeGuiVisible(idx));
162
166
 
163
167
      if (pipe->empty(idx)) {
164
168
            menu->insertItem(tr("new"), NEW, NEW);
167
171
            menu->setItemEnabled(REMOVE, false);
168
172
            menu->setItemEnabled(BYPASS, false);
169
173
            menu->setItemEnabled(SHOW, false);
 
174
            menu->setItemEnabled(SHOW_NATIVE, false);
170
175
            menu->setItemEnabled(SAVE, false);
171
176
            }
172
177
      else {
176
181
                  menu->setItemEnabled(UP, false);
177
182
            if (idx == (PipelineDepth-1))
178
183
                  menu->setItemEnabled(DOWN, false);
 
184
            if(!pipe->isDssiPlugin(idx))
 
185
                  menu->setItemEnabled(SHOW_NATIVE, false);
179
186
            }
180
187
 
 
188
      #ifndef OSC_SUPPORT
 
189
      menu->setItemEnabled(SHOW_NATIVE, false);
 
190
      #endif
 
191
      
181
192
      int sel = menu->exec(pt, 1);
182
193
      delete menu;
183
194
      if (sel == -1)
230
241
                  pipe->showGui(idx, flag);
231
242
                  break;
232
243
                  }
 
244
            case SHOW_NATIVE:
 
245
                  {
 
246
                  bool flag = !pipe->nativeGuiVisible(idx);
 
247
                  pipe->showNativeGui(idx, flag);
 
248
                  break;
 
249
                  }
233
250
            case UP:
234
251
                  if (idx > 0) {
235
252
                        setCurrentItem(idx-1);
269
286
 
270
287
void EffectRack::savePreset(int idx)
271
288
      {
272
 
      QString name = getSaveFileName(QString(""), plug_file_pattern, this,
 
289
      //QString name = getSaveFileName(QString(""), plug_file_pattern, this,
 
290
      QString name = getSaveFileName(QString(""), preset_file_save_pattern, this,
273
291
         tr("MusE: Save Preset"));
274
 
      FILE* presetFp = fopen(name.ascii(),"w+");
 
292
      
 
293
      if(name.isEmpty())
 
294
        return;
 
295
        
 
296
      //FILE* presetFp = fopen(name.ascii(),"w+");
 
297
      bool popenFlag;
 
298
      FILE* presetFp = fileOpen(this, name, QString(".pre"), "w", popenFlag, false, true);
275
299
      if (presetFp == 0) {
276
 
            fprintf(stderr, "EffectRack::savePreset() fopen failed: %s\n",
277
 
               strerror(errno));
 
300
            //fprintf(stderr, "EffectRack::savePreset() fopen failed: %s\n",
 
301
            //   strerror(errno));
278
302
            return;
279
303
            }
280
304
      Xml xml(presetFp);
288
312
                }
289
313
            else {
290
314
                printf("no plugin!\n");
 
315
                //fclose(presetFp);
 
316
                if (popenFlag)
 
317
                      pclose(presetFp);
 
318
                else
 
319
                      fclose(presetFp);
 
320
                return;
 
321
                }
 
322
            }
 
323
      else {
 
324
          printf("no pipe!\n");
 
325
          //fclose(presetFp);
 
326
          if (popenFlag)
 
327
                pclose(presetFp);
 
328
          else
291
329
                fclose(presetFp);
292
 
                return;
293
 
                }
294
 
            }
295
 
      else {
296
 
          printf("no pipe!\n");
297
 
          fclose(presetFp);
298
330
          return;
299
331
          }
300
 
      fclose(presetFp);
 
332
      //fclose(presetFp);
 
333
      if (popenFlag)
 
334
            pclose(presetFp);
 
335
      else
 
336
            fclose(presetFp);
301
337
      }
302
338
 
303
339
void EffectRack::startDrag(int idx)
377
413
            if(QTextDrag::decode(event, text))
378
414
                {
379
415
                text = text.stripWhiteSpace();
380
 
                if (text.endsWith(".pre", false))
 
416
                // Changed by T356.
 
417
                //if (text.endsWith(".pre", false))
 
418
                if (text.endsWith(".pre", false) || text.endsWith(".pre.gz", false) || text.endsWith(".pre.bz2", false))
381
419
                    {
382
420
                    QUrl url(text);
383
421
                    QString newPath = url.path();
384
422
      
385
 
                    bool popenFlag = false;
 
423
                    //bool popenFlag = false;
 
424
                    bool popenFlag;
386
425
                    FILE* fp = fileOpen(this, newPath, ".pre", "r", popenFlag, false, false);
387
426
              
388
427
                    if (fp) {
389
428
                        Xml xml(fp);
390
429
                        initPlugin(xml, idx);
 
430
                        
 
431
                        // Added by T356.
 
432
                        if (popenFlag)
 
433
                              pclose(fp);
 
434
                        else
 
435
                              fclose(fp);
391
436
                        }
392
437
                    }
393
438
                else if (event->provides("text/x-muse-plugin"))