mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2026-02-21 01:40:16 -05:00
Various fixes to qlo10k1
Various fixes by Tim <terminator356@users.sourceforge.net>: - ld10k1 0.1.8p1 recommended for best operation. - Fixed link disconnect bug. - Now remembers last file open/save dir. - Now unused IO/FX do not disappear upon refresh. - Refresh/redraw fixups.
This commit is contained in:
parent
700edf08b4
commit
8d95c04c7e
14 changed files with 221 additions and 48 deletions
|
|
@ -2,3 +2,4 @@ Peter Zubaj <pzad@pobox.sk>
|
||||||
|
|
||||||
Contributors:
|
Contributors:
|
||||||
Eduardo García-Mádico Portabella <informatica@eurogaran.com>
|
Eduardo García-Mádico Portabella <informatica@eurogaran.com>
|
||||||
|
Tim <terminator356@users.sourceforge.net>
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
0.1.2p1
|
||||||
|
- By Tim...
|
||||||
|
- ld10k1 0.1.8p1 recommended for best operation.
|
||||||
|
- Fixed link disconnect bug.
|
||||||
|
- Now remembers last file open/save dir.
|
||||||
|
- Now unused IO/FX do not disappear upon refresh.
|
||||||
|
- Refresh/redraw fixups.
|
||||||
0.1.2
|
0.1.2
|
||||||
- ld10k1 0.1.8 required
|
- ld10k1 0.1.8 required
|
||||||
- Colors and better object positioning - Eduardo García-Mádico Portabella
|
- Colors and better object positioning - Eduardo García-Mádico Portabella
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
AC_INIT(src/main.cpp)
|
AC_INIT(src/main.cpp)
|
||||||
AM_INIT_AUTOMAKE(qlo10k1, 0.1.2)
|
AM_INIT_AUTOMAKE(qlo10k1, 0.1.2p1)
|
||||||
AC_CONFIG_HEADERS(config.h)
|
AC_CONFIG_HEADERS(config.h)
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AC_PROG_LD
|
AC_PROG_LD
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@
|
||||||
#include "structure_patch.h"
|
#include "structure_patch.h"
|
||||||
#include "strparam.h"
|
#include "strparam.h"
|
||||||
|
|
||||||
|
QString gLastFileDir;
|
||||||
|
|
||||||
class PatchesListViewItem : public QListViewItem
|
class PatchesListViewItem : public QListViewItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -121,6 +123,12 @@ MainWnd::~MainWnd()
|
||||||
delete cardGlobal;
|
delete cardGlobal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWnd::closeEvent(QCloseEvent* ce)
|
||||||
|
{
|
||||||
|
saveSettings();
|
||||||
|
ce->accept();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWnd::tabMainCurrentChanged(QWidget *tab)
|
void MainWnd::tabMainCurrentChanged(QWidget *tab)
|
||||||
{
|
{
|
||||||
if (!CurrentCard)
|
if (!CurrentCard)
|
||||||
|
|
@ -163,6 +171,7 @@ void MainWnd::patchesUpdateText()
|
||||||
|
|
||||||
void MainWnd::menuQuitActivated(int /*id*/)
|
void MainWnd::menuQuitActivated(int /*id*/)
|
||||||
{
|
{
|
||||||
|
saveSettings();
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,15 +180,17 @@ void MainWnd::menuLoadDSPConfigActivated(int id)
|
||||||
if (!CurrentCard)
|
if (!CurrentCard)
|
||||||
return;
|
return;
|
||||||
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
||||||
|
fd->setDir(gLastFileDir);
|
||||||
fd->setMode(QFileDialog::ExistingFile);
|
fd->setMode(QFileDialog::ExistingFile);
|
||||||
fd->setFilter("DSP config (*.ld10k1)");
|
fd->setFilter("DSP config (*.ld10k1)");
|
||||||
fd->setCaption("Save DSP config");
|
fd->setCaption("Save DSP config");
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
if (fd->exec() == QDialog::Accepted)
|
if (fd->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
fileName = fd->selectedFile();
|
fileName = fd->selectedFile();
|
||||||
|
gLastFileDir = fd->dirPath();
|
||||||
delete fd;
|
delete fd;
|
||||||
|
|
||||||
LD10k1DspFile *dc = NULL;
|
LD10k1DspFile *dc = NULL;
|
||||||
|
|
@ -205,15 +216,17 @@ void MainWnd::menuSaveDSPConfigActivated(int id)
|
||||||
if (!CurrentCard)
|
if (!CurrentCard)
|
||||||
return;
|
return;
|
||||||
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
||||||
|
fd->setDir(gLastFileDir);
|
||||||
fd->setMode(QFileDialog::AnyFile);
|
fd->setMode(QFileDialog::AnyFile);
|
||||||
fd->setFilter("DSP config (*.ld10k1)");
|
fd->setFilter("DSP config (*.ld10k1)");
|
||||||
fd->setCaption("Save DSP config");
|
fd->setCaption("Save DSP config");
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
if (fd->exec() == QDialog::Accepted)
|
if (fd->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
fileName = fd->selectedFile();
|
fileName = fd->selectedFile();
|
||||||
|
gLastFileDir = fd->dirPath();
|
||||||
delete fd;
|
delete fd;
|
||||||
|
|
||||||
if (!fileName.endsWith(".ld10k1"))
|
if (!fileName.endsWith(".ld10k1"))
|
||||||
|
|
@ -379,17 +392,26 @@ void MainWnd::loadClicked()
|
||||||
{
|
{
|
||||||
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
||||||
fd->setMode(QFileDialog::ExistingFile);
|
fd->setMode(QFileDialog::ExistingFile);
|
||||||
fd->setFilter("Patches (*.emu10k1 *.ld10k1)");
|
QStringList filterlist;
|
||||||
|
filterlist << QString( "as10k1 Patch files (*.bin *.as10k1 *.emu10k1)" );
|
||||||
|
filterlist << QString( "ld10k1 Native effect files (*.ld10k1)" );
|
||||||
|
filterlist << QString( "All Files (*)" );
|
||||||
|
QString filters = filterlist.join( ";;" );
|
||||||
|
fd->setFilters( filters );
|
||||||
|
|
||||||
|
fd->setDir(gLastFileDir);
|
||||||
fd->setCaption("Load patch");
|
fd->setCaption("Load patch");
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
if ( fd->exec() == QDialog::Accepted )
|
if ( fd->exec() == QDialog::Accepted )
|
||||||
{
|
{
|
||||||
fileName = fd->selectedFile();
|
fileName = fd->selectedFile();
|
||||||
|
gLastFileDir = fd->dirPath();
|
||||||
delete fd;
|
delete fd;
|
||||||
LD10k1File *ldfile = NULL;
|
LD10k1File *ldfile = NULL;
|
||||||
if (fileName.endsWith(".emu10k1"))
|
/* Try loading as an ld10k1 file first. */
|
||||||
|
if ((err = LD10k1File::LoadFromFile(fileName, &ldfile)) < 0)
|
||||||
{
|
{
|
||||||
EMU10k1File *emufile = NULL;
|
EMU10k1File *emufile = NULL;
|
||||||
if ((err = EMU10k1File::LoadFromFile(fileName, &emufile)) < 0)
|
if ((err = EMU10k1File::LoadFromFile(fileName, &emufile)) < 0)
|
||||||
|
|
@ -417,13 +439,6 @@ void MainWnd::loadClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((err = LD10k1File::LoadFromFile(fileName, &ldfile)) < 0) {
|
|
||||||
QMessageBox::critical(0, APP_NAME, QString("Couldn't load patch\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadPatchDlg d(CurrentCard, fileName, ldfile);
|
LoadPatchDlg d(CurrentCard, fileName, ldfile);
|
||||||
|
|
||||||
|
|
@ -480,6 +495,7 @@ void MainWnd::saveSettings()
|
||||||
settings.writeEntry("/Version", "0.0.1");
|
settings.writeEntry("/Version", "0.0.1");
|
||||||
settings.writeEntry("/RepDirSystem", cardGlobal->RepDirSystem);
|
settings.writeEntry("/RepDirSystem", cardGlobal->RepDirSystem);
|
||||||
settings.writeEntry("/RepDirUser", cardGlobal->RepDirUser);
|
settings.writeEntry("/RepDirUser", cardGlobal->RepDirUser);
|
||||||
|
settings.writeEntry("/LastDir", gLastFileDir);
|
||||||
|
|
||||||
// first save cards
|
// first save cards
|
||||||
settings.beginGroup("/Cards");
|
settings.beginGroup("/Cards");
|
||||||
|
|
@ -510,6 +526,7 @@ void MainWnd::loadSettings()
|
||||||
// settings doesn't exists
|
// settings doesn't exists
|
||||||
cardGlobal->RepDirSystem = "";
|
cardGlobal->RepDirSystem = "";
|
||||||
cardGlobal->RepDirUser = "";
|
cardGlobal->RepDirUser = "";
|
||||||
|
gLastFileDir = "./";
|
||||||
|
|
||||||
CardParam *card = new CardParam();
|
CardParam *card = new CardParam();
|
||||||
card->CardName = "Default card";
|
card->CardName = "Default card";
|
||||||
|
|
@ -524,6 +541,7 @@ void MainWnd::loadSettings()
|
||||||
{
|
{
|
||||||
cardGlobal->RepDirSystem = settings.readEntry("/RepDirSystem", "");
|
cardGlobal->RepDirSystem = settings.readEntry("/RepDirSystem", "");
|
||||||
cardGlobal->RepDirUser = settings.readEntry("/RepDirUser", "");
|
cardGlobal->RepDirUser = settings.readEntry("/RepDirUser", "");
|
||||||
|
gLastFileDir = settings.readEntry("/LastDir", "./");
|
||||||
|
|
||||||
settings.beginGroup("/Cards");
|
settings.beginGroup("/Cards");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@ public:
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
|
||||||
void patchesUpdateText();
|
void patchesUpdateText();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent*);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// menu
|
// menu
|
||||||
void menuLoadDSPConfigActivated(int id);
|
void menuLoadDSPConfigActivated(int id);
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,26 @@ NewIODlg::NewIODlg(StrGlobal *glob, DlgType t)
|
||||||
|
|
||||||
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
|
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
|
||||||
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
|
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
|
||||||
|
}
|
||||||
|
|
||||||
|
int NewIODlg::init()
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
QString columnTitle;
|
QString columnTitle;
|
||||||
|
|
||||||
|
int cnt;
|
||||||
|
if (dt == In)
|
||||||
|
err = global->Card->getInputCount(&cnt);
|
||||||
|
else if (dt == Out)
|
||||||
|
err = global->Card->getOutputCount(&cnt);
|
||||||
|
else
|
||||||
|
err = global->Card->getFXCount(&cnt);
|
||||||
|
|
||||||
|
if(err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
switch (dt)
|
switch (dt)
|
||||||
{
|
{
|
||||||
case In:
|
case In:
|
||||||
|
|
@ -83,17 +99,9 @@ NewIODlg::NewIODlg(StrGlobal *glob, DlgType t)
|
||||||
}
|
}
|
||||||
|
|
||||||
IOListViewItem *after = NULL;
|
IOListViewItem *after = NULL;
|
||||||
int cnt;
|
|
||||||
|
|
||||||
lvIOs->clear();
|
lvIOs->clear();
|
||||||
|
|
||||||
if (dt == In)
|
|
||||||
global->Card->getInputCount(&cnt);
|
|
||||||
else if (dt == Out)
|
|
||||||
global->Card->getOutputCount(&cnt);
|
|
||||||
else
|
|
||||||
global->Card->getFXCount(&cnt);
|
|
||||||
|
|
||||||
for (int i = 0; i < cnt; i++)
|
for (int i = 0; i < cnt; i++)
|
||||||
{
|
{
|
||||||
QString ioname;
|
QString ioname;
|
||||||
|
|
@ -109,12 +117,14 @@ NewIODlg::NewIODlg(StrGlobal *glob, DlgType t)
|
||||||
if (!used)
|
if (!used)
|
||||||
{
|
{
|
||||||
if (dt == In)
|
if (dt == In)
|
||||||
global->Card->getInput(i, ioname);
|
err = global->Card->getInput(i, ioname);
|
||||||
else if (dt == Out)
|
else if (dt == Out)
|
||||||
global->Card->getOutput(i, ioname);
|
err = global->Card->getOutput(i, ioname);
|
||||||
else
|
else
|
||||||
global->Card->getFX(i, ioname);
|
err = global->Card->getFX(i, ioname);
|
||||||
|
|
||||||
|
if(err < 0)
|
||||||
|
goto Error;
|
||||||
|
|
||||||
if (after)
|
if (after)
|
||||||
after = new IOListViewItem(i, ioname, lvIOs, after);
|
after = new IOListViewItem(i, ioname, lvIOs, after);
|
||||||
|
|
@ -127,9 +137,14 @@ NewIODlg::NewIODlg(StrGlobal *glob, DlgType t)
|
||||||
lvIOs->setColumnText(1, columnTitle);
|
lvIOs->setColumnText(1, columnTitle);
|
||||||
|
|
||||||
connect(lvIOs, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(ioSelectionChanged(QListViewItem *)));
|
connect(lvIOs, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(ioSelectionChanged(QListViewItem *)));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
Error:
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NewIODlg::okClicked()
|
void NewIODlg::okClicked()
|
||||||
{
|
{
|
||||||
done(Accepted);
|
done(Accepted);
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ private:
|
||||||
QString name;
|
QString name;
|
||||||
public:
|
public:
|
||||||
NewIODlg(StrGlobal *glob, DlgType t);
|
NewIODlg(StrGlobal *glob, DlgType t);
|
||||||
|
|
||||||
|
int init();
|
||||||
|
|
||||||
StrIOBase *getNewIO();
|
StrIOBase *getNewIO();
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,8 @@ void PreferencesDlg::okClicked()
|
||||||
for (i = 0; i < cards.count(); i++)
|
for (i = 0; i < cards.count(); i++)
|
||||||
global->Cards.append(new CardParam(cards.at(i)));
|
global->Cards.append(new CardParam(cards.at(i)));
|
||||||
|
|
||||||
|
repDirSystem = leRepSystem->text();
|
||||||
|
repDirUser = leRepUser->text();
|
||||||
global->RepDirSystem = repDirSystem;
|
global->RepDirSystem = repDirSystem;
|
||||||
global->RepDirUser = repDirUser;
|
global->RepDirUser = repDirUser;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -888,7 +888,7 @@ void RoutingWidget::putNewObjectAt(int xp, int yp)
|
||||||
|
|
||||||
drawing->updateContents();
|
drawing->updateContents();
|
||||||
|
|
||||||
modeNormalClicked();
|
//modeNormalClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,16 @@
|
||||||
#include "strglobal.h"
|
#include "strglobal.h"
|
||||||
#include "ld10k1file.h"
|
#include "ld10k1file.h"
|
||||||
|
|
||||||
|
extern QString gLastFileDir;
|
||||||
|
|
||||||
void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int xp, int yp, int mxp, int myp)
|
void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int xp, int yp, int mxp, int myp)
|
||||||
{
|
{
|
||||||
QPopupMenu *contextMenu = new QPopupMenu();
|
QPopupMenu *contextMenu = new QPopupMenu();
|
||||||
|
|
||||||
enum Action {Refresh, ClearDSP, Delete, Rename, Disconnect, DelPoint, AddPoint, Connect, Save};
|
enum Action {Refresh, ClearDSP, Delete, Rename, Disconnect, DelPoint, AddPoint, Connect, Save};
|
||||||
|
|
||||||
|
int rn = -1;
|
||||||
|
|
||||||
if (mm == MenuNone)
|
if (mm == MenuNone)
|
||||||
{
|
{
|
||||||
contextMenu->insertItem(tr("&Refresh"), Refresh);
|
contextMenu->insertItem(tr("&Refresh"), Refresh);
|
||||||
|
|
@ -73,7 +77,24 @@ void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int
|
||||||
else if (pn < 0)
|
else if (pn < 0)
|
||||||
contextMenu->insertItem(tr("A&dd point"), AddPoint);
|
contextMenu->insertItem(tr("A&dd point"), AddPoint);
|
||||||
|
|
||||||
contextMenu->insertItem(tr("D&isconnect"), Disconnect);
|
if (item->type() == RSItemBaseWithType::Link)
|
||||||
|
{
|
||||||
|
StrLink *lnk = (StrLink *)item;
|
||||||
|
|
||||||
|
rn = lnk->getRouteNumFromPoint(xp, yp);
|
||||||
|
if(rn >= 0)
|
||||||
|
{
|
||||||
|
RSItemIO *io = NULL;
|
||||||
|
RSItemBaseWithType *own = NULL;
|
||||||
|
io = lnk->getRoutePoint(rn);
|
||||||
|
if(io)
|
||||||
|
{
|
||||||
|
own = (RSItemBaseWithType*)io->getOwner();
|
||||||
|
if(own && (own->type() == RSItemBaseWithType::Patch))
|
||||||
|
contextMenu->insertItem(tr("D&isconnect"), Disconnect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contextMenu->insertSeparator();
|
contextMenu->insertSeparator();
|
||||||
contextMenu->insertItem(tr("&Delete"), Delete);
|
contextMenu->insertItem(tr("&Delete"), Delete);
|
||||||
|
|
@ -128,6 +149,7 @@ void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int
|
||||||
else if (id == Delete)
|
else if (id == Delete)
|
||||||
{
|
{
|
||||||
drawing->deleteAllSelected();
|
drawing->deleteAllSelected();
|
||||||
|
structure->loadFromLD();
|
||||||
}
|
}
|
||||||
else if (id == Connect)
|
else if (id == Connect)
|
||||||
{
|
{
|
||||||
|
|
@ -138,7 +160,7 @@ void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int
|
||||||
}
|
}
|
||||||
else if (id == Disconnect)
|
else if (id == Disconnect)
|
||||||
{
|
{
|
||||||
RSItemIO *io = NULL;
|
RSItemIO *io = NULL;
|
||||||
if (item->type() == RSItemBaseWithType::Patch)
|
if (item->type() == RSItemBaseWithType::Patch)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -150,7 +172,7 @@ void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int
|
||||||
l->updateContents(drawing, getZoomLevel());
|
l->updateContents(drawing, getZoomLevel());
|
||||||
|
|
||||||
if ((err = structure->disconnectFromLink(io)) < 0)
|
if ((err = structure->disconnectFromLink(io)) < 0)
|
||||||
QMessageBox::critical(0, APP_NAME, QString("Couldn't disconnect !\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
|
QMessageBox::critical(0, APP_NAME, QString("Couldn't disconnect !\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -164,15 +186,41 @@ void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int
|
||||||
StrOutput *out = (StrOutput *)item;
|
StrOutput *out = (StrOutput *)item;
|
||||||
io = out->getIO(false, 0);
|
io = out->getIO(false, 0);
|
||||||
}
|
}
|
||||||
if (item->type() == RSItemBaseWithType::FX)
|
else if (item->type() == RSItemBaseWithType::FX)
|
||||||
{
|
{
|
||||||
StrFX *fx = (StrFX *)item;
|
StrFX *fx = (StrFX *)item;
|
||||||
io = fx->getIO(true, 0);
|
io = fx->getIO(true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
StrLink *l = io->getConnectedTo();
|
if(io)
|
||||||
structure->deleteOneLink(l);
|
{
|
||||||
drawing->updateContents();
|
StrLink *l = io->getConnectedTo();
|
||||||
|
structure->deleteOneLink(l);
|
||||||
|
structure->loadFromLD();
|
||||||
|
drawing->updateContents();
|
||||||
|
}
|
||||||
|
else if (item->type() == RSItemBaseWithType::Link)
|
||||||
|
{
|
||||||
|
StrLink *lnk = (StrLink *)item;
|
||||||
|
|
||||||
|
if(rn >= 0)
|
||||||
|
{
|
||||||
|
io = lnk->getRoutePoint(rn);
|
||||||
|
if(io)
|
||||||
|
{
|
||||||
|
RSItemBaseWithType *own = NULL;
|
||||||
|
own = (RSItemBaseWithType*)io->getOwner();
|
||||||
|
if(own && (own->type() == RSItemBaseWithType::Patch))
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
if ((err = structure->disconnectFromLink(io)) < 0)
|
||||||
|
QMessageBox::critical(0, APP_NAME, QString("Couldn't disconnect !\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
|
||||||
|
|
||||||
|
drawing->updateContents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (id == ClearDSP)
|
else if (id == ClearDSP)
|
||||||
|
|
@ -192,20 +240,22 @@ void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int
|
||||||
|
|
||||||
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
||||||
fd->setMode(QFileDialog::AnyFile);
|
fd->setMode(QFileDialog::AnyFile);
|
||||||
fd->setFilter("Patch (*.ld10k1)");
|
fd->setFilter("ld10k1 Native effect files (*.ld10k1)");
|
||||||
fd->setCaption("Save patch");
|
fd->setCaption("Save patch");
|
||||||
|
fd->setDir(gLastFileDir);
|
||||||
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
if (fd->exec() == QDialog::Accepted)
|
if (fd->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
fileName = fd->selectedFile();
|
fileName = fd->selectedFile();
|
||||||
|
gLastFileDir = fd->dirPath();
|
||||||
delete fd;
|
delete fd;
|
||||||
|
|
||||||
if (!fileName.endsWith(".ld10k1"))
|
if (!fileName.endsWith(".ld10k1"))
|
||||||
fileName += ".ld10k1";
|
fileName += ".ld10k1";
|
||||||
if (QFile::exists(fileName))
|
if (QFile::exists(fileName))
|
||||||
{
|
{
|
||||||
if (QMessageBox::question(0, APP_NAME, QString("File with name %1 exist. Overwite ?").arg(fileName), QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes)
|
if (QMessageBox::question(0, APP_NAME, QString("File with name %1 exists. Overwrite ?").arg(fileName), QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include "loadpatchdialog.h"
|
#include "loadpatchdialog.h"
|
||||||
#include "transformpatchdialog.h"
|
#include "transformpatchdialog.h"
|
||||||
|
|
||||||
|
extern QString gLastFileDir;
|
||||||
|
|
||||||
RSItemBaseWithType *RoutingWidget::createNewIO(EditMode em)
|
RSItemBaseWithType *RoutingWidget::createNewIO(EditMode em)
|
||||||
{
|
{
|
||||||
|
|
@ -54,6 +55,14 @@ RSItemBaseWithType *RoutingWidget::createNewIO(EditMode em)
|
||||||
|
|
||||||
NewIODlg d(structure, t);
|
NewIODlg d(structure, t);
|
||||||
|
|
||||||
|
int err;
|
||||||
|
err = d.init();
|
||||||
|
if(err < 0)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(0, APP_NAME, QString("Error creating new IO dialog\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (d.exec() == QDialog::Accepted)
|
if (d.exec() == QDialog::Accepted)
|
||||||
return d.getNewIO();
|
return d.getNewIO();
|
||||||
else
|
else
|
||||||
|
|
@ -64,19 +73,28 @@ RSItemBaseWithType *RoutingWidget::createNewPatch()
|
||||||
{
|
{
|
||||||
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
|
||||||
fd->setMode(QFileDialog::ExistingFile);
|
fd->setMode(QFileDialog::ExistingFile);
|
||||||
fd->setFilter("Patches (*.emu10k1 *.ld10k1)");
|
QStringList filterlist;
|
||||||
|
filterlist << QString( "as10k1 Patch files (*.bin *.as10k1 *.emu10k1)" );
|
||||||
|
filterlist << QString( "ld10k1 Native effect files (*.ld10k1)" );
|
||||||
|
filterlist << QString( "All Files (*)" );
|
||||||
|
QString filters = filterlist.join( ";;" );
|
||||||
|
fd->setFilters( filters );
|
||||||
|
fd->setDir(gLastFileDir);
|
||||||
|
|
||||||
fd->setCaption("Load patch");
|
fd->setCaption("Load patch");
|
||||||
|
|
||||||
StrPatch *loaded = NULL;
|
StrPatch *loaded = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
if ( fd->exec() == QDialog::Accepted )
|
if ( fd->exec() == QDialog::Accepted )
|
||||||
{
|
{
|
||||||
fileName = fd->selectedFile();
|
fileName = fd->selectedFile();
|
||||||
|
gLastFileDir = fd->dirPath();
|
||||||
delete fd;
|
delete fd;
|
||||||
|
|
||||||
LD10k1File *ldfile = NULL;
|
LD10k1File *ldfile = NULL;
|
||||||
if (fileName.endsWith(".emu10k1"))
|
if ((err = LD10k1File::LoadFromFile(fileName, &ldfile)) < 0)
|
||||||
{
|
{
|
||||||
EMU10k1File *emufile = NULL;
|
EMU10k1File *emufile = NULL;
|
||||||
if ((err = EMU10k1File::LoadFromFile(fileName, &emufile)) < 0)
|
if ((err = EMU10k1File::LoadFromFile(fileName, &emufile)) < 0)
|
||||||
|
|
@ -104,13 +122,6 @@ RSItemBaseWithType *RoutingWidget::createNewPatch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((err = LD10k1File::LoadFromFile(fileName, &ldfile)) < 0) {
|
|
||||||
QMessageBox::critical(0, APP_NAME, QString("Couldn't load patch\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadPatchDlg d(structure, fileName, ldfile);
|
LoadPatchDlg d(structure, fileName, ldfile);
|
||||||
|
|
||||||
|
|
@ -262,7 +273,7 @@ void RoutingDrawWidget::connectLinkDrag(int xp, int yp, int mxp, int myp)
|
||||||
}
|
}
|
||||||
|
|
||||||
stopLinkDrag();
|
stopLinkDrag();
|
||||||
parent->modeNormalClicked();
|
//parent->modeNormalClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete contextMenu;
|
delete contextMenu;
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,8 @@ int StrGlobal::loadFromLD(void)
|
||||||
fx->setName(ioname);
|
fx->setName(ioname);
|
||||||
fx->setFlagChanged(true);
|
fx->setFlagChanged(true);
|
||||||
}
|
}
|
||||||
|
// Don't make unconnected IO/FX disappear.
|
||||||
|
fx->setFlagUsed(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -154,6 +156,7 @@ int StrGlobal::loadFromLD(void)
|
||||||
in->setName(ioname);
|
in->setName(ioname);
|
||||||
in->setFlagChanged(true);
|
in->setFlagChanged(true);
|
||||||
}
|
}
|
||||||
|
in->setFlagUsed(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -179,6 +182,7 @@ int StrGlobal::loadFromLD(void)
|
||||||
out->setName(ioname);
|
out->setName(ioname);
|
||||||
out->setFlagChanged(true);
|
out->setFlagChanged(true);
|
||||||
}
|
}
|
||||||
|
out->setFlagUsed(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,7 @@ void StrLink::updateOneSegment(QScrollView *sv, int r, float zoom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determines whether a point is close enough to a another point, within LINK_SELECT_WH.
|
||||||
bool StrLink::containsPointPoint(QPoint &p, int xp, int yp)
|
bool StrLink::containsPointPoint(QPoint &p, int xp, int yp)
|
||||||
{
|
{
|
||||||
QRect r(p.x() - LINK_SELECT_WH / 2, p.y() - LINK_SELECT_WH / 2,
|
QRect r(p.x() - LINK_SELECT_WH / 2, p.y() - LINK_SELECT_WH / 2,
|
||||||
|
|
@ -399,6 +400,7 @@ bool StrLink::containsPointPoint(QPoint &p, int xp, int yp)
|
||||||
return r.contains(xp, yp);
|
return r.contains(xp, yp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determines whether a point is on a line segment.
|
||||||
bool StrLink::containsPointSegment(QPoint &p1, QPoint &p2, int xp, int yp)
|
bool StrLink::containsPointSegment(QPoint &p1, QPoint &p2, int xp, int yp)
|
||||||
{
|
{
|
||||||
QRect r(p1, p2);
|
QRect r(p1, p2);
|
||||||
|
|
@ -638,3 +640,55 @@ bool StrLink::delSegmentPoint(int num)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns route number which segment containing point leads to, else -1
|
||||||
|
int StrLink::getRouteNumFromPoint(int xp, int yp)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
unsigned j;
|
||||||
|
|
||||||
|
if (xp < x() || xp > x() + width() ||
|
||||||
|
yp < y() || yp > y() + height())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (useMixPoint)
|
||||||
|
{
|
||||||
|
if (containsPointPoint(mixPoint, xp, yp))
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
|
||||||
|
{
|
||||||
|
if (routes[i])
|
||||||
|
{
|
||||||
|
QPoint fp = routesEndPoints[i];
|
||||||
|
if (containsPointPoint(fp, xp, yp))
|
||||||
|
return i;
|
||||||
|
|
||||||
|
for (j = 0; j < routesPoints[i].count(); j++)
|
||||||
|
{
|
||||||
|
QPoint tmpp = routesPoints[i][j];
|
||||||
|
|
||||||
|
if (containsPointPoint(tmpp, xp, yp))
|
||||||
|
return i;
|
||||||
|
|
||||||
|
if (containsPointSegment(fp, tmpp, xp, yp))
|
||||||
|
return i;
|
||||||
|
fp = tmpp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useMixPoint)
|
||||||
|
{
|
||||||
|
if (containsPointSegment(fp, mixPoint, xp, yp))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (containsPointSegment(fp, routesEndPoints[0], xp, yp))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,13 @@ private:
|
||||||
RSItemIO *routes[POINTINFO_MAX_CONN_PER_POINT + 1];
|
RSItemIO *routes[POINTINFO_MAX_CONN_PER_POINT + 1];
|
||||||
|
|
||||||
QValueList <QPoint> routesPoints[POINTINFO_MAX_CONN_PER_POINT + 1];
|
QValueList <QPoint> routesPoints[POINTINFO_MAX_CONN_PER_POINT + 1];
|
||||||
QPoint routesEndPoints[POINTINFO_MAX_CONN_PER_POINT + 1];
|
QPoint routesEndPoints[POINTINFO_MAX_CONN_PER_POINT + 1];
|
||||||
|
|
||||||
bool useMixPoint;
|
bool useMixPoint;
|
||||||
QPoint mixPoint;
|
QPoint mixPoint;
|
||||||
|
// Determines whether a point is close enough to a another point, within LINK_SELECT_WH.
|
||||||
bool containsPointPoint(QPoint &p, int xp, int yp);
|
bool containsPointPoint(QPoint &p, int xp, int yp);
|
||||||
|
// Determines whether a point is on a line segment.
|
||||||
bool containsPointSegment(QPoint &p1, QPoint &p2, int xp, int yp);
|
bool containsPointSegment(QPoint &p1, QPoint &p2, int xp, int yp);
|
||||||
public:
|
public:
|
||||||
StrLink(int id, LinkType t);
|
StrLink(int id, LinkType t);
|
||||||
|
|
@ -73,6 +75,9 @@ public:
|
||||||
void setRoutePoint(int r, RSItemIO *ri);
|
void setRoutePoint(int r, RSItemIO *ri);
|
||||||
void clearRoutesPoints(int r);
|
void clearRoutesPoints(int r);
|
||||||
|
|
||||||
|
// Returns route number which segment containing point leads to, else -1
|
||||||
|
int getRouteNumFromPoint(int xp, int yp);
|
||||||
|
|
||||||
virtual void calcSize();
|
virtual void calcSize();
|
||||||
virtual void draw(DrawingParams *dp);
|
virtual void draw(DrawingParams *dp);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue