Contributors:
Eduardo García-Mádico Portabella <informatica@eurogaran.com>
+Tim <terminator356@users.sourceforge.net>
\ No newline at end of file
+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
- ld10k1 0.1.8 required
- Colors and better object positioning - Eduardo García-Mádico Portabella
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_PROG_CXX
AC_PROG_LD
#include "structure_patch.h"
#include "strparam.h"
+QString gLastFileDir;
+
class PatchesListViewItem : public QListViewItem
{
public:
delete cardGlobal;
}
+void MainWnd::closeEvent(QCloseEvent* ce)
+{
+ saveSettings();
+ ce->accept();
+}
+
void MainWnd::tabMainCurrentChanged(QWidget *tab)
{
if (!CurrentCard)
void MainWnd::menuQuitActivated(int /*id*/)
{
+ saveSettings();
qApp->quit();
}
if (!CurrentCard)
return;
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
+ fd->setDir(gLastFileDir);
fd->setMode(QFileDialog::ExistingFile);
fd->setFilter("DSP config (*.ld10k1)");
fd->setCaption("Save DSP config");
int err = 0;
QString fileName;
- if (fd->exec() == QDialog::Accepted)
+ if (fd->exec() == QDialog::Accepted)
{
- fileName = fd->selectedFile();
+ fileName = fd->selectedFile();
+ gLastFileDir = fd->dirPath();
delete fd;
LD10k1DspFile *dc = NULL;
if (!CurrentCard)
return;
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
+ fd->setDir(gLastFileDir);
fd->setMode(QFileDialog::AnyFile);
fd->setFilter("DSP config (*.ld10k1)");
fd->setCaption("Save DSP config");
int err = 0;
QString fileName;
- if (fd->exec() == QDialog::Accepted)
+ if (fd->exec() == QDialog::Accepted)
{
fileName = fd->selectedFile();
+ gLastFileDir = fd->dirPath();
delete fd;
if (!fileName.endsWith(".ld10k1"))
{
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
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");
int err = 0;
QString fileName;
- if ( fd->exec() == QDialog::Accepted )
+ if ( fd->exec() == QDialog::Accepted )
{
fileName = fd->selectedFile();
+ gLastFileDir = fd->dirPath();
delete fd;
LD10k1File *ldfile = NULL;
- if (fileName.endsWith(".emu10k1"))
+ /* Try loading as an ld10k1 file first. */
+ if ((err = LD10k1File::LoadFromFile(fileName, &ldfile)) < 0)
{
EMU10k1File *emufile = NULL;
if ((err = EMU10k1File::LoadFromFile(fileName, &emufile)) < 0)
}
}
}
- 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);
settings.writeEntry("/Version", "0.0.1");
settings.writeEntry("/RepDirSystem", cardGlobal->RepDirSystem);
settings.writeEntry("/RepDirUser", cardGlobal->RepDirUser);
+ settings.writeEntry("/LastDir", gLastFileDir);
// first save cards
settings.beginGroup("/Cards");
// settings doesn't exists
cardGlobal->RepDirSystem = "";
cardGlobal->RepDirUser = "";
+ gLastFileDir = "./";
CardParam *card = new CardParam();
card->CardName = "Default card";
{
cardGlobal->RepDirSystem = settings.readEntry("/RepDirSystem", "");
cardGlobal->RepDirUser = settings.readEntry("/RepDirUser", "");
+ gLastFileDir = settings.readEntry("/LastDir", "./");
settings.beginGroup("/Cards");
void loadSettings();
void patchesUpdateText();
+
+protected:
+ void closeEvent(QCloseEvent*);
+
public slots:
// menu
void menuLoadDSPConfigActivated(int id);
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
+}
+
+int NewIODlg::init()
+{
+ int err;
QString title;
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)
{
case In:
}
IOListViewItem *after = NULL;
- int cnt;
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++)
{
QString ioname;
if (!used)
{
if (dt == In)
- global->Card->getInput(i, ioname);
+ err = global->Card->getInput(i, ioname);
else if (dt == Out)
- global->Card->getOutput(i, ioname);
+ err = global->Card->getOutput(i, ioname);
else
- global->Card->getFX(i, ioname);
+ err = global->Card->getFX(i, ioname);
+ if(err < 0)
+ goto Error;
if (after)
after = new IOListViewItem(i, ioname, lvIOs, after);
lvIOs->setColumnText(1, columnTitle);
connect(lvIOs, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(ioSelectionChanged(QListViewItem *)));
+
+ return 0;
+
+ Error:
+
+ return err;
}
-
void NewIODlg::okClicked()
{
done(Accepted);
QString name;
public:
NewIODlg(StrGlobal *glob, DlgType t);
+
+ int init();
StrIOBase *getNewIO();
public slots:
for (i = 0; i < cards.count(); i++)
global->Cards.append(new CardParam(cards.at(i)));
+ repDirSystem = leRepSystem->text();
+ repDirUser = leRepUser->text();
global->RepDirSystem = repDirSystem;
global->RepDirUser = repDirUser;
drawing->updateContents();
- modeNormalClicked();
+ //modeNormalClicked();
}
}
#include "strglobal.h"
#include "ld10k1file.h"
+extern QString gLastFileDir;
+
void RoutingWidget::openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int xp, int yp, int mxp, int myp)
{
QPopupMenu *contextMenu = new QPopupMenu();
enum Action {Refresh, ClearDSP, Delete, Rename, Disconnect, DelPoint, AddPoint, Connect, Save};
+ int rn = -1;
+
if (mm == MenuNone)
{
contextMenu->insertItem(tr("&Refresh"), Refresh);
else if (pn < 0)
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->insertItem(tr("&Delete"), Delete);
else if (id == Delete)
{
drawing->deleteAllSelected();
+ structure->loadFromLD();
}
else if (id == Connect)
{
}
else if (id == Disconnect)
{
- RSItemIO *io = NULL;
+ RSItemIO *io = NULL;
if (item->type() == RSItemBaseWithType::Patch)
{
int err;
l->updateContents(drawing, getZoomLevel());
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
{
StrOutput *out = (StrOutput *)item;
io = out->getIO(false, 0);
}
- if (item->type() == RSItemBaseWithType::FX)
+ else if (item->type() == RSItemBaseWithType::FX)
{
StrFX *fx = (StrFX *)item;
io = fx->getIO(true, 0);
}
- StrLink *l = io->getConnectedTo();
- structure->deleteOneLink(l);
- drawing->updateContents();
+ if(io)
+ {
+ 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)
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
fd->setMode(QFileDialog::AnyFile);
- fd->setFilter("Patch (*.ld10k1)");
+ fd->setFilter("ld10k1 Native effect files (*.ld10k1)");
fd->setCaption("Save patch");
+ fd->setDir(gLastFileDir);
QString fileName;
if (fd->exec() == QDialog::Accepted)
{
fileName = fd->selectedFile();
+ gLastFileDir = fd->dirPath();
delete fd;
if (!fileName.endsWith(".ld10k1"))
fileName += ".ld10k1";
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;
}
#include "loadpatchdialog.h"
#include "transformpatchdialog.h"
+extern QString gLastFileDir;
RSItemBaseWithType *RoutingWidget::createNewIO(EditMode em)
{
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)
return d.getNewIO();
else
{
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
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");
StrPatch *loaded = NULL;
int err;
QString fileName;
- if ( fd->exec() == QDialog::Accepted )
+ if ( fd->exec() == QDialog::Accepted )
{
fileName = fd->selectedFile();
+ gLastFileDir = fd->dirPath();
delete fd;
+
LD10k1File *ldfile = NULL;
- if (fileName.endsWith(".emu10k1"))
+ if ((err = LD10k1File::LoadFromFile(fileName, &ldfile)) < 0)
{
EMU10k1File *emufile = NULL;
if ((err = EMU10k1File::LoadFromFile(fileName, &emufile)) < 0)
}
}
}
- 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);
}
stopLinkDrag();
- parent->modeNormalClicked();
+ //parent->modeNormalClicked();
}
delete contextMenu;
fx->setName(ioname);
fx->setFlagChanged(true);
}
+ // Don't make unconnected IO/FX disappear.
+ fx->setFlagUsed(true);
}
else
{
in->setName(ioname);
in->setFlagChanged(true);
}
+ in->setFlagUsed(true);
}
else
{
out->setName(ioname);
out->setFlagChanged(true);
}
+ out->setFlagUsed(true);
}
else
{
}
}
+// Determines whether a point is close enough to a another point, within LINK_SELECT_WH.
bool StrLink::containsPointPoint(QPoint &p, int xp, int yp)
{
QRect r(p.x() - LINK_SELECT_WH / 2, p.y() - LINK_SELECT_WH / 2,
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)
{
QRect r(p1, p2);
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;
+}
+
RSItemIO *routes[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;
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);
+ // Determines whether a point is on a line segment.
bool containsPointSegment(QPoint &p1, QPoint &p2, int xp, int yp);
public:
StrLink(int id, LinkType t);
void setRoutePoint(int r, RSItemIO *ri);
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 draw(DrawingParams *dp);