Add qlo10k1

Added qlo10k1 by Peter Zubaj.
This commit is contained in:
Takashi Iwai 2005-03-18 16:42:48 +00:00
parent 83b4a93e03
commit ab3e05d1da
73 changed files with 12923 additions and 1 deletions

137
qlo10k1/src/Makefile.am Normal file
View file

@ -0,0 +1,137 @@
#SUBDIRS = dlgs icons
# this is the program that gets installed. it's name is used for all
# of the other Makefile.am variables
bin_PROGRAMS = qlo10k1
# the libraries to link against.
qlo10k1_LDADD = $(LDADD) $(QT_LDADD)
EXTRA_DIST = dlgs/connectionwizardbase.ui dlgs/filecontroldialogbase.ui dlgs/filecontrolsdialogbase.ui \
dlgs/loadpatchdialogbase.ui dlgs/mainwndbase.ui dlgs/patchdialogbase.ui dlgs/preferencesbase.ui \
dlgs/newiodialogbase.ui dlgs/aboutdialogbase.ui dlgs/transformpatchbase.ui\
icons/routing_fx.xpm \
icons/routing_in.xpm \
icons/routing_out.xpm \
icons/routing_route.xpm \
icons/routing_effect.xpm \
icons/routing_effect_stack.xpm \
icons/routing_zoom_plus.xpm \
icons/routing_zoom_minus.xpm \
icons/routing_normal.xpm
# these are the headers for your project
noinst_HEADERS =
%.moc.cpp: %.h
$(MOC) -o $@ $<
%.h: %.ui
$(UIC) -o $@ $<
%.cpp: %.ui
$(UIC) -o $@ -impl $*.h $<
qlo10k1_UI = dlgs/connectionwizardbase.h \
dlgs/connectionwizardbase.cpp \
\
dlgs/filecontroldialogbase.h \
dlgs/filecontroldialogbase.cpp \
\
dlgs/filecontrolsdialogbase.h \
dlgs/filecontrolsdialogbase.cpp \
\
dlgs/loadpatchdialogbase.h \
dlgs/loadpatchdialogbase.cpp \
\
dlgs/transformpatchbase.h \
dlgs/transformpatchbase.cpp \
\
dlgs/mainwndbase.h \
dlgs/mainwndbase.cpp \
\
dlgs/patchdialogbase.h \
dlgs/patchdialogbase.cpp \
\
dlgs/preferencesbase.h \
dlgs/preferencesbase.cpp \
\
dlgs/newiodialogbase.h \
dlgs/newiodialogbase.cpp \
\
dlgs/aboutdialogbase.h \
dlgs/aboutdialogbase.cpp
qlo10k1_MOC = dlgs/connectionwizardbase.moc.cpp \
dlgs/filecontroldialogbase.moc.cpp \
dlgs/filecontrolsdialogbase.moc.cpp \
dlgs/loadpatchdialogbase.moc.cpp \
dlgs/mainwndbase.moc.cpp \
dlgs/patchdialogbase.moc.cpp \
dlgs/preferencesbase.moc.cpp \
dlgs/newiodialogbase.moc.cpp \
dlgs/aboutdialogbase.moc.cpp \
dlgs/transformpatchbase.moc.cpp \
\
connectionwizard.moc.cpp \
filecontroldialog.moc.cpp \
loadpatchdialog.moc.cpp \
mainwnd.moc.cpp \
patchdialog.moc.cpp \
preferences.moc.cpp \
routingwidget.moc.cpp \
newiodialog.moc.cpp \
aboutdialog.moc.cpp \
transformpatchdialog.moc.cpp
BUILT_SOURCES = $(qlo10k1_MOC) $(qlo10k1_UI)
CLEANFILES = $(BUILT_SOURCES)
# which sources should be compiled for qlo10k1
# emu10k1file.cpp emu10k1file.h
qlo10k1_SOURCES = app_global.h connectionwizard.cpp connectionwizard.h \
filecontroldialog.cpp filecontroldialog.h ld10k1file.cpp ld10k1file.h \
loadpatchdialog.cpp loadpatchdialog.h main.cpp \
mainwnd.cpp mainwnd.h patchdialog.cpp patchdialog.h preferences.cpp preferences.h \
routingwidget.h routingwidget.cpp structure.cpp structure.h structure_patch.cpp structure_patch.h \
structure_io.cpp structure_io.h structure_link.cpp structure_link.h\
structure_aa.cpp strglobal.h strglobal.cpp routingwidget_new.cpp routingwidget_menu.cpp \
newiodialog.h newiodialog.cpp strparam.h strparam.cpp \
aboutdialog.h aboutdialog.cpp transformpatchdialog.h transformpatchdialog.cpp \
custom_colors.h
# \
# $(qlo10k1_UI) \
# $(qlo10k1_MOC)
nodist_qlo10k1_SOURCES = $(qlo10k1_UI) \
$(qlo10k1_MOC)
dlgs/connectionwizardbase.h : dlgs/connectionwizardbase.ui
dlgs/connectionwizardbase.cpp : dlgs/connectionwizardbase.h dlgs/connectionwizardbase.ui
dlgs/filecontroldialogbase.h : dlgs/filecontroldialogbase.ui
dlgs/filecontroldialogbase.cpp : dlgs/filecontroldialogbase.h dlgs/filecontroldialogbase.ui
dlgs/filecontrolsdialogbase.h : dlgs/filecontrolsdialogbase.ui
dlgs/filecontrolsdialogbase.cpp : dlgs/filecontrolsdialogbase.h dlgs/filecontrolsdialogbase.ui
dlgs/loadpatchdialogbase.h : dlgs/loadpatchdialogbase.ui
dlgs/loadpatchdialogbase.cpp : dlgs/loadpatchdialogbase.h dlgs/loadpatchdialogbase.ui
dlgs/transformpatchbase.h : dlgs/transformpatchbase.ui
dlgs/transformpatchbase.cpp : dlgs/transformpatchbase.h dlgs/transformpatchbase.ui
dlgs/mainwndbase.h : dlgs/mainwndbase.ui
dlgs/mainwndbase.cpp : dlgs/mainwndbase.h dlgs/mainwndbase.ui
dlgs/patchdialogbase.h : dlgs/patchdialogbase.ui
dlgs/patchdialogbase.cpp : dlgs/patchdialogbase.h dlgs/patchdialogbase.ui
dlgs/preferencesbase.h : dlgs/preferencesbase.ui
dlgs/preferencesbase.cpp : dlgs/preferencesbase.h dlgs/preferencesbase.ui
dlgs/newiodialogbase.h : dlgs/newiodialogbase.ui
dlgs/newiodialogbase.cpp : dlgs/newiodialogbase.h dlgs/newiodialogbase.ui
dlgs/aboutdialogbase.h : dlgs/aboutdialogbase.ui
dlgs/aboutdialogbase.cpp : dlgs/aboutdialogbase.h dlgs/aboutdialogbase.ui

View file

@ -0,0 +1,34 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qpushbutton.h>
#include "aboutdialog.h"
AboutDlg::AboutDlg()
{
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
}
void AboutDlg::okClicked()
{
done(Accepted);
}

36
qlo10k1/src/aboutdialog.h Normal file
View file

@ -0,0 +1,36 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include "dlgs/aboutdialogbase.h"
class AboutDlg : public AboutDialogBase
{
Q_OBJECT
public:
AboutDlg();
public slots:
void okClicked();
};
#endif // ABOUTDIALOG_H

6
qlo10k1/src/app_global.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef __APP_GLOBAL_H
#define __APP_GLOBAL_H
#define APP_NAME "qlo10k1 - emu10k1 patch loader"
#endif /* __APP_GLOBAL_H */

View file

@ -0,0 +1,324 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qlistbox.h>
#include "structure_patch.h"
#include "structure_io.h"
#include "connectionwizard.h"
ConnectionWizard::ConnectionWizard(bool o, StrGlobal *g, RouteInfo *r)
: ConnectionWizardBase()
{
out = o;
global = g;
route = *r;
rptr = r;
rtype = None;
pto = NULL;
RSItemIO *io = r->getToIO();
if (io)
{
RSItemBaseWithType *owner = (RSItemBaseWithType *)io->getOwner();
switch (owner->type())
{
case RSItemBaseWithType::In:
rtype = In;
break;
case RSItemBaseWithType::Out:
rtype = Out;
break;
case RSItemBaseWithType::FX:
rtype = FX;
break;
case RSItemBaseWithType::Patch:
if (io->isOutput())
rtype = POut;
else
rtype = PIn;
pto = (StrPatch *)owner;
break;
default:
break;
}
}
if (!out)
{
rbOutput->hide();
}
else
{
rbFX->hide();
rbInput->hide();
}
StrPatch *patch;
lbPatch->clear();
for(patch = global->Patches.first(); patch; patch = global->Patches.next() )
{
lbPatch->insertItem(patch->name());
patchList.append(patch);
}
connect(rbNone, SIGNAL(clicked()), this, SLOT(noneClicked()));
connect(rbFX, SIGNAL(clicked()), this, SLOT(fxClicked()));
connect(rbInput, SIGNAL(clicked()), this, SLOT(inClicked()));
connect(rbOutput, SIGNAL(clicked()), this, SLOT(outClicked()));
connect(rbPatch, SIGNAL(clicked()), this, SLOT(patchClicked()));
connect(lbPatch, SIGNAL(clicked(QListBoxItem *)), this, SLOT(patchListClicked(QListBoxItem *)));
connect(lbEnd, SIGNAL(clicked(QListBoxItem *)), this, SLOT(endListClicked(QListBoxItem *)));
connect(finishButton(), SIGNAL(clicked()), this, SLOT(finishClicked()));
connect(this, SIGNAL(selected(const QString &)), this, SLOT(selected(const QString &)));
helpButton()->hide();
setFinishEnabled(pageType, true);
setNextEnabled(pageType, true);
setFinishEnabled(pagePatch, true);
setNextEnabled(pagePatch, true);
setFinishEnabled(pageEnd, true);
setNextEnabled(pageEnd, true);
}
void ConnectionWizard::setState(bool patch, bool end, bool back, bool next, bool finish)
{
setAppropriate(pagePatch, patch ? true : false);
setAppropriate(pageEnd, end ? true : false);
backButton()->setEnabled(back ? true : false);
nextButton()->setEnabled(next ? true : false);
finishButton()->setEnabled(finish ? true : false);
}
void ConnectionWizard::loadEnd(IOType iotype)
{
lbEnd->clear();
ios.clear();
if (iotype == In)
{
for (int i = 0; i < (int)global->Inputs.count(); i++)
{
StrInput *io = global->Inputs.at(i);
ios.append(io->getIO(false, 0));
lbEnd->insertItem(io->name());
}
}
else if (iotype == Out)
{
for (int i = 0; i < (int)global->Outputs.count(); i++)
{
StrOutput *io = global->Outputs.at(i);
ios.append(io->getIO(true, 0));
lbEnd->insertItem(io->name());
}
}
else if (iotype == FX)
{
for (int i = 0; i < (int)global->FXs.count(); i++)
{
StrFX *io = global->FXs.at(i);
ios.append(io->getIO(false, 0));
lbEnd->insertItem(io->name());
}
}
}
void ConnectionWizard::noneClicked()
{
setState(false, false, false, false, true);
if (rtype != ConnectionWizard::None)
{
rtype = ConnectionWizard::None;
pto = NULL;
}
}
void ConnectionWizard::fxClicked()
{
setState(false, true, false, true, false);
if (rtype != ConnectionWizard::FX)
{
rtype = ConnectionWizard::FX;
pto = NULL;
}
}
void ConnectionWizard::inClicked()
{
setState(false, true, false, true, false);
if (rtype != ConnectionWizard::In)
{
rtype = ConnectionWizard::In;
pto = NULL;
}
}
void ConnectionWizard::outClicked()
{
setState(false, true, false, true, false);
if (rtype != ConnectionWizard::Out)
{
rtype = ConnectionWizard::Out;
pto = NULL;
}
}
void ConnectionWizard::patchClicked()
{
setState(true, true, false, true, false);
if (rtype != ConnectionWizard::PIn && rtype != ConnectionWizard::POut)
{
if (out)
rtype = ConnectionWizard::PIn;
else
rtype = ConnectionWizard::POut;
pto = NULL;
}
}
void ConnectionWizard::selected(const QString &page)
{
if (page == "Connection target")
{
switch (rtype)
{
case None:
rbNone->setChecked(true);
setState(false, false, false, false, true);
break;
case FX:
rbFX->setChecked(true);
setState(false, true, false, true, false);
break;
case In:
rbInput->setChecked(true);
setState(false, true, false, true, false);
break;
case Out:
rbOutput->setChecked(true);
setState(false, true, false, true, false);
break;
case PIn:
case POut:
rbPatch->setChecked(true);
setState(true, true, false, true, false);
break;
}
}
else if (page == "Patch")
{
finishButton()->setEnabled(false);
if (pto)
{
// find patch
lbPatch->setCurrentItem(patchList.find(pto));
nextButton()->setEnabled(true);
}
else
{
QListBoxItem *si = lbPatch->selectedItem();
if (si)
lbPatch->setSelected(si, false);
lbPatch->setCurrentItem(-1);
nextButton()->setEnabled(false);
}
cbMulti->setChecked(route.getMulti());
cbSimple->setChecked(route.getSimple());
}
else if (page == "End")
{
nextButton()->setEnabled(false);
switch (rtype)
{
case None:
break;
case FX:
case In:
case Out:
loadEnd(rtype);
break;
case PIn:
case POut:
// load patch in or out
ios.clear();
lbEnd->clear();
for (int i = 0; i < (int)pto->getMaxIOIdx(out); i++)
{
RSItemIO *io = pto->getIO(out, i);
if (io)
{
ios.append(io);
lbEnd->insertItem(io->getDesc());
}
}
route.setMulti(cbMulti->isChecked());
route.setSimple(cbSimple->isChecked());
break;
}
if (route.getToIO())
{
lbEnd->setCurrentItem(ios.find(route.getToIO()));
finishButton()->setEnabled(true);
}
else
{
QListBoxItem *si = lbEnd->selectedItem();
if (si)
lbEnd->setSelected(si, false);
lbEnd->setCurrentItem(-1);
finishButton()->setEnabled(false);
}
}
}
void ConnectionWizard::patchListClicked(QListBoxItem *item)
{
pto = patchList.at(lbPatch->index(item));
route.setToIO(NULL);
nextButton()->setEnabled(true);
}
void ConnectionWizard::endListClicked(QListBoxItem *item)
{
route.setToIO(ios.at(lbEnd->index(item)));
finishButton()->setEnabled(true);
}
void ConnectionWizard::finishClicked()
{
*rptr = route;
}

View file

@ -0,0 +1,128 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef CONNECTIONWIZARD_H
#define CONNECTIONWIZARD_H
#include <qvaluelist.h>
#include "strglobal.h"
#include "structure.h"
#include "dlgs/connectionwizardbase.h"
class RouteInfo
{
private:
RSItemIO *toIO;
bool Multi;
bool Simple;
public:
RouteInfo(bool multi, bool simple, RSItemIO *t)
{
toIO = t;
Multi = multi;
Simple = simple;
}
RouteInfo(const RouteInfo &from)
{
toIO = from.toIO;
Multi = from.Multi;
Simple = from.Simple;
}
RouteInfo()
{
toIO = NULL;
Multi = false;
Simple = false;
}
RSItemIO *getToIO()
{
return toIO;
}
void setToIO(RSItemIO *tio)
{
toIO = tio;
}
bool getMulti()
{
return Multi;
}
bool getSimple()
{
return Simple;
}
void setMulti(bool multi)
{
Multi = multi;
}
void setSimple(bool simple)
{
Simple = simple;
}
bool isValid()
{
return toIO != NULL;
}
};
class ConnectionWizard : public ConnectionWizardBase
{
Q_OBJECT
enum IOType {None, In, Out, FX, PIn, POut} rtype;
RouteInfo route;
StrPatch *pto;
RouteInfo *rptr;
StrGlobal *global;
bool out;
QPtrList <RSItemIO> ios;
QPtrList <StrPatch> patchList;
StrPatch *selPatch;
public:
ConnectionWizard(bool o, StrGlobal *g, RouteInfo *r);
void loadEnd(IOType iotype);
void setState(bool patch, bool end, bool back, bool next, bool finish);
public slots:
void noneClicked();
void fxClicked();
void inClicked();
void outClicked();
void patchClicked();
void finishClicked();
void selected(const QString &page);
void patchListClicked(QListBoxItem *item);
void endListClicked(QListBoxItem *item);
};
#endif // CONNECTIONWIZARD_H

View file

@ -0,0 +1,39 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Eduardo García-Mádico Portabella
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
// Common colors
#define DEF_PAINTING_COLOR QColor(0,0,0)
#define LINE_COLOR QColor(125,125,125)
#define BOX_COLOR QColor(0,0,255)
#define BOX_SELECTED_COLOR QColor(255,0,0)
#define POINT_COLOR QColor(0,255,0)
#define TEXT_COLOR QColor(0,0,0)
// IO colors
#define IO_BOX_COLOR QColor(0,255,0)
#define IO_TEXT_PEN QColor(0,0,0)
// Pens
#define DEF_PAINTING_PEN QPen(DEF_PAINTING_COLOR)
#define LINE_PEN QPen(LINE_COLOR)
#define BOX_PEN QPen(BOX_COLOR)
#define POINT_PEN QPen(POINT_COLOR)
#define TEXT_PEN QPen(TEXT_COLOR)

View file

@ -0,0 +1,53 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>AboutDialogBase</class>
<widget class="QDialog">
<property name="name">
<cstring>AboutDialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>359</height>
</rect>
</property>
<property name="caption">
<string>About</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QTextEdit" row="0" column="0">
<property name="name">
<cstring>textEdit1</cstring>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name="qrichtext" content="1" /&gt;&lt;/head&gt;&lt;body style="font-size:10pt;font-family:Sans"&gt;
&lt;p align="center"&gt;&lt;span style="font-size:12pt;font-weight:600"&gt;qlo10k1 - GUI for ld10k1&lt;/span&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;span style="font-size:12pt;font-weight:600"&gt;Copyright (C) 2004 by Peter Zubaj&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;span style="font-weight:600"&gt;This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:600"&gt;This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.&lt;/span&gt;&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;
</string>
</property>
<property name="wordWrap">
<enum>WidgetWidth</enum>
</property>
</widget>
<widget class="QPushButton" row="1" column="0">
<property name="name">
<cstring>pbOK</cstring>
</property>
<property name="text">
<string>&amp;Close</string>
</property>
<property name="accel">
<string>Alt+C</string>
</property>
</widget>
</grid>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,181 @@
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>ConnectionWizardBase</class>
<widget class="QWizard">
<property name="name">
<cstring>ConnectionWizardBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>282</width>
<height>229</height>
</rect>
</property>
<property name="caption">
<string>Connection</string>
</property>
<widget class="QWidget">
<property name="name">
<cstring>pageType</cstring>
</property>
<attribute name="title">
<string>Connection target</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QButtonGroup" row="0" column="0">
<property name="name">
<cstring>buttonGroup1</cstring>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<property name="title">
<string></string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>1</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout17</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QRadioButton">
<property name="name">
<cstring>rbNone</cstring>
</property>
<property name="text">
<string>None</string>
</property>
</widget>
<widget class="QRadioButton">
<property name="name">
<cstring>rbFX</cstring>
</property>
<property name="text">
<string>FX</string>
</property>
</widget>
<widget class="QRadioButton">
<property name="name">
<cstring>rbInput</cstring>
</property>
<property name="text">
<string>Input</string>
</property>
</widget>
<widget class="QRadioButton">
<property name="name">
<cstring>rbOutput</cstring>
</property>
<property name="text">
<string>Output</string>
</property>
</widget>
<widget class="QRadioButton">
<property name="name">
<cstring>rbPatch</cstring>
</property>
<property name="text">
<string>Patch</string>
</property>
</widget>
</vbox>
</widget>
</grid>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>pagePatch</cstring>
</property>
<attribute name="title">
<string>Patch</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout5</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QListBox">
<property name="name">
<cstring>lbPatch</cstring>
</property>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout4</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>cbMulti</cstring>
</property>
<property name="text">
<string>Multi</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>cbSimple</cstring>
</property>
<property name="text">
<string>Simple</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>pageEnd</cstring>
</property>
<attribute name="title">
<string>End</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QListBox" row="0" column="0">
<property name="name">
<cstring>lbEnd</cstring>
</property>
</widget>
</grid>
</widget>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,252 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>FileControlDialogBase</class>
<widget class="QDialog">
<property name="name">
<cstring>FileControlDialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>566</width>
<height>363</height>
</rect>
</property>
<property name="caption">
<string>File control</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QListBox" row="0" column="0">
<property name="name">
<cstring>lbControls</cstring>
</property>
</widget>
<widget class="QLayoutWidget" row="1" column="0">
<property name="name">
<cstring>layout14</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>211</width>
<height>21</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbUp</cstring>
</property>
<property name="text">
<string>&amp;Up</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbDown</cstring>
</property>
<property name="text">
<string>&amp;Down</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget" row="3" column="0">
<property name="name">
<cstring>layout34</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer12</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbOK</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbCancel</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget" row="2" column="0">
<property name="name">
<cstring>layout39</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel" row="0" column="3">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Index:</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>textLabel10</cstring>
</property>
<property name="text">
<string>Loaded name:</string>
</property>
</widget>
<spacer row="2" column="2" rowspan="1" colspan="3">
<property name="name">
<cstring>spacer11</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>346</width>
<height>21</height>
</size>
</property>
</spacer>
<widget class="QSpinBox" row="0" column="4">
<property name="name">
<cstring>sbIndex</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxValue">
<number>100000000</number>
</property>
<property name="minValue">
<number>-1</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
<widget class="QLineEdit" row="0" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>leLoadedName</cstring>
</property>
</widget>
<widget class="QSpinBox" row="2" column="1">
<property name="name">
<cstring>sbVisible</cstring>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>textLabel12</cstring>
</property>
<property name="text">
<string>Visible:</string>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>textLabel11</cstring>
</property>
<property name="text">
<string>Translation:</string>
</property>
</widget>
<widget class="QComboBox" row="1" column="1" rowspan="1" colspan="4">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Table100</string>
</property>
</item>
<item>
<property name="text">
<string>Bass</string>
</property>
</item>
<item>
<property name="text">
<string>Treble</string>
</property>
</item>
<item>
<property name="text">
<string>On/Off</string>
</property>
</item>
<property name="name">
<cstring>cbTranslation</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,21 @@
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>FileControlsDialogBase</class>
<widget class="QDialog">
<property name="name">
<cstring>FileControlsDialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>492</width>
<height>314</height>
</rect>
</property>
<property name="caption">
<string>File controls</string>
</property>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,375 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>LoadPatchDialogBase</class>
<widget class="QDialog">
<property name="name">
<cstring>LoadPatchDialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>608</width>
<height>454</height>
</rect>
</property>
<property name="caption">
<string>Load patch</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout26</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLineEdit" row="1" column="1">
<property name="name">
<cstring>lePatchName</cstring>
</property>
</widget>
<widget class="QLineEdit" row="0" column="1">
<property name="name">
<cstring>leFileName</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>textLabel6</cstring>
</property>
<property name="text">
<string>Patch name:</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>File:</string>
</property>
</widget>
</grid>
</widget>
<widget class="QTabWidget" row="2" column="0">
<property name="name">
<cstring>tabOptions</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tabControls</cstring>
</property>
<attribute name="title">
<string>Con&amp;trols</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QListBox" row="1" column="0">
<property name="name">
<cstring>lbFileCtrl</cstring>
</property>
<property name="selectionMode">
<enum>Single</enum>
</property>
</widget>
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>File controls:</string>
</property>
</widget>
<widget class="QLayoutWidget" row="1" column="1">
<property name="name">
<cstring>layout11</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout10</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>tlMax</cstring>
</property>
<property name="text">
<string>Max:</string>
</property>
</widget>
<widget class="QLineEdit" row="2" column="1">
<property name="name">
<cstring>leMax</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>tlTransl</cstring>
</property>
<property name="text">
<string>Transl:</string>
</property>
</widget>
<widget class="QLineEdit" row="0" column="1">
<property name="name">
<cstring>leTranslation</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>tlMin</cstring>
</property>
<property name="text">
<string>Min:</string>
</property>
</widget>
<widget class="QLineEdit" row="1" column="1">
<property name="name">
<cstring>leMin</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</grid>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout9</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>tlVal</cstring>
</property>
<property name="text">
<string>Values:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbValues</cstring>
</property>
</widget>
</vbox>
</widget>
</vbox>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tabNames</cstring>
</property>
<attribute name="title">
<string>&amp;Names</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout10</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>Inputs:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbInputs</cstring>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Outputs:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbOutputs</cstring>
</property>
</widget>
</vbox>
</widget>
</grid>
</widget>
</widget>
<widget class="QLayoutWidget" row="3" column="0">
<property name="name">
<cstring>layout17</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>211</width>
<height>31</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbOK</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbCancel</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget" row="1" column="0">
<property name="name">
<cstring>layout16</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel7</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Insert:</string>
</property>
</widget>
<widget class="QComboBox">
<item>
<property name="text">
<string>Before</string>
</property>
</item>
<item>
<property name="text">
<string>After</string>
</property>
</item>
<property name="name">
<cstring>cbBefAfter</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>textLabel8</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Patch:</string>
</property>
</widget>
<widget class="QComboBox">
<property name="name">
<cstring>cbWhere</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</hbox>
</widget>
</grid>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,179 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>MainWndBase</class>
<widget class="QMainWindow">
<property name="name">
<cstring>MainWndBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>494</width>
<height>360</height>
</rect>
</property>
<property name="caption">
<string>qlo10k1 - emu10k1 patch loader</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QTabWidget" row="0" column="0">
<property name="name">
<cstring>tabMain</cstring>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tabLoad</cstring>
</property>
<attribute name="title">
<string>&amp;Load</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout11</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QListView" row="1" column="0">
<column>
<property name="text">
<string>Order</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Num</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Patch name</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<property name="name">
<cstring>lvPatches</cstring>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
</widget>
<widget class="QLayoutWidget" row="1" column="1">
<property name="name">
<cstring>layout3</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QPushButton">
<property name="name">
<cstring>pbLoad</cstring>
</property>
<property name="text">
<string>Load</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>cbFromFile</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>From file</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbUnload</cstring>
</property>
<property name="text">
<string>Unload</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>31</width>
<height>71</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>tlPatches</cstring>
</property>
<property name="text">
<string>Patches:</string>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tabRouting</cstring>
</property>
<attribute name="title">
<string>&amp;Routing</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
</grid>
</widget>
</widget>
</grid>
</widget>
<menubar>
<property name="name">
<cstring>menubar</cstring>
</property>
</menubar>
<toolbars>
</toolbars>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,105 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>NewIODialogBase</class>
<widget class="QDialog">
<property name="name">
<cstring>NewIODialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>297</width>
<height>284</height>
</rect>
</property>
<property name="caption">
<string>Form2</string>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QListView">
<column>
<property name="text">
<string>Num</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>New Column</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<property name="name">
<cstring>lvIOs</cstring>
</property>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout1</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QPushButton">
<property name="name">
<cstring>pbOK</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="accel">
<string>Alt+O</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbCancel</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="accel">
<string>Alt+C</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>41</width>
<height>171</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</hbox>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,247 @@
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>PatchDialogBase</class>
<widget class="QDialog">
<property name="name">
<cstring>PatchDialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>480</height>
</rect>
</property>
<property name="caption">
<string>Patch info</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout35</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QTabWidget" row="1" column="0">
<property name="name">
<cstring>tabOptions</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tabControls</cstring>
</property>
<attribute name="title">
<string>Con&amp;trols</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout33</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel5</cstring>
</property>
<property name="text">
<string>Loaded controls:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbLoadedCtrl</cstring>
</property>
</widget>
</vbox>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tabNames</cstring>
</property>
<attribute name="title">
<string>&amp;Names</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout10</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>Inputs:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbInputs</cstring>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Outputs:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbOutputs</cstring>
</property>
</widget>
</vbox>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tabConnection</cstring>
</property>
<attribute name="title">
<string>Co&amp;nnection</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout11</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>lbInputs_2</cstring>
</property>
<property name="text">
<string>Inputs:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbConnInputs</cstring>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>lbInputs_2_2</cstring>
</property>
<property name="text">
<string>Outputs:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbConnOutputs</cstring>
</property>
</widget>
</vbox>
</widget>
</grid>
</widget>
</widget>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout34</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel6</cstring>
</property>
<property name="text">
<string>Patch name:</string>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>lePatchName</cstring>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget" row="2" column="0">
<property name="name">
<cstring>layout17_2</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>211</width>
<height>31</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbOK</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbCancel</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
</widget>
</hbox>
</widget>
</grid>
</widget>
</grid>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,394 @@
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>PreferencesBase</class>
<widget class="QDialog">
<property name="name">
<cstring>PreferencesBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>540</width>
<height>329</height>
</rect>
</property>
<property name="caption">
<string>Settings</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout10</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QTabWidget">
<property name="name">
<cstring>tabSet</cstring>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tabCard</cstring>
</property>
<attribute name="title">
<string>&amp;Card</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout8</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout7</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout6</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Cards:</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer4_2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>51</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbCards</cstring>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout4</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>251</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbCardAdd</cstring>
</property>
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbCardDel</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>gbCard</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Card info</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout3</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLineEdit" row="1" column="1">
<property name="name">
<cstring>leCardSocket</cstring>
</property>
</widget>
<widget class="QLineEdit" row="0" column="1">
<property name="name">
<cstring>leCardName</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>tlCardSocket</cstring>
</property>
<property name="text">
<string>Socket:</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>tlCardName</cstring>
</property>
<property name="text">
<string>Name:</string>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout7</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer4_3</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>381</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbUpdate</cstring>
</property>
<property name="text">
<string>&amp;Update</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tabRepository</cstring>
</property>
<attribute name="title">
<string>Repository</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout15</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout14</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QPushButton" row="2" column="2">
<property name="name">
<cstring>pbSelUser</cstring>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>32767</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QPushButton" row="0" column="2" rowspan="2" colspan="1">
<property name="name">
<cstring>pbSelSystem</cstring>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>32767</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QLabel" row="1" column="0" rowspan="2" colspan="1">
<property name="name">
<cstring>tlRepUserDir</cstring>
</property>
<property name="text">
<string>User dir:</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>tlRepSysDir</cstring>
</property>
<property name="text">
<string>System dir:</string>
</property>
</widget>
<widget class="QLineEdit" row="1" column="1" rowspan="2" colspan="1">
<property name="name">
<cstring>leRepUser</cstring>
</property>
</widget>
<widget class="QLineEdit" row="0" column="1">
<property name="name">
<cstring>leRepSystem</cstring>
</property>
</widget>
</grid>
</widget>
<spacer>
<property name="name">
<cstring>spacer6</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>169</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</grid>
</widget>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout9</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer4</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>16</width>
<height>21</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbOK</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbCancel</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
</grid>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,306 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>TransformPatchBase</class>
<widget class="QDialog">
<property name="name">
<cstring>TransformPatchBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>655</width>
<height>496</height>
</rect>
</property>
<property name="caption">
<string>Transform patch</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout26</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLineEdit" row="1" column="1">
<property name="name">
<cstring>lePatchName</cstring>
</property>
</widget>
<widget class="QLineEdit" row="0" column="1">
<property name="name">
<cstring>leFileName</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>textLabel6</cstring>
</property>
<property name="text">
<string>Patch name:</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>File:</string>
</property>
</widget>
</grid>
</widget>
<widget class="QTabWidget">
<property name="name">
<cstring>tabOptions</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tabControls</cstring>
</property>
<attribute name="title">
<string>Con&amp;trols</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout24</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout21</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>File controls:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbFileCtrl</cstring>
</property>
<property name="selectionMode">
<enum>Extended</enum>
</property>
</widget>
</vbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout23</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer9</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>41</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbCtrlAdd</cstring>
</property>
<property name="text">
<string>&gt;&gt;</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbCtrlDel</cstring>
</property>
<property name="text">
<string>&lt;&lt;</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer8</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>21</width>
<height>30</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout22</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel5</cstring>
</property>
<property name="text">
<string>Transformed controls:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbLoadedCtrl</cstring>
</property>
</widget>
</vbox>
</widget>
</hbox>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tabNames</cstring>
</property>
<attribute name="title">
<string>&amp;Names</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout10</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>Inputs:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbInputs</cstring>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Outputs:</string>
</property>
</widget>
<widget class="QListBox">
<property name="name">
<cstring>lbOutputs</cstring>
</property>
</widget>
</vbox>
</widget>
</grid>
</widget>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout17</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>211</width>
<height>31</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pbOK</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="accel">
<string>Alt+O</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>pbCancel</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="accel">
<string>Alt+C</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View file

@ -0,0 +1,199 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qlistbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include "filecontroldialog.h"
FileControlDlg::FileControlDlg(QValueList <int> *eselected, EMU10k1File *efile, TranslatedCtrl *etranslated)
{
file = efile;
translated = etranslated;
int ctrlIdx;
unsigned int i;
if (eselected)
{
selected = *eselected;
// insert file controls to listbox
for (i = 0; i < selected.count(); i++)
{
ctrlIdx = selected[i];
lbControls->insertItem(getName(ctrlIdx));
}
sbIndex->setValue(-1);
sbVisible->setMinValue(1);
sbVisible->setMaxValue(selected.count());
sbVisible->setValue(selected.count());
// set min, max
EMU10k1Ctrl ctrl;
file->getCtrl(selected[0], &ctrl);
min = ctrl.min;
max = ctrl.max;
values.append(ctrl.value);
for (i = 1; i < selected.count(); i++)
{
file->getCtrl(selected[i], &ctrl);
values.append(ctrl.value);
if (ctrl.max > max)
max = ctrl.max;
if (ctrl.min < min)
min = ctrl.min;
}
if (min == 0 && max == 100)
cbTranslation->setCurrentItem(1);
}
else
{
selected = translated->fileCtrlIdx;
for (i = 0; i < translated->fileCtrlIdx.count(); i++)
{
lbControls->insertItem(getName(translated->fileCtrlIdx[i]));
}
sbVisible->setMinValue(1);
sbVisible->setMaxValue(translated->fileCtrlIdx.count());
sbVisible->setValue(translated->visible);
leLoadedName->setText(translated->name);
sbIndex->setValue(translated->index);
switch(translated->translation)
{
case TranslatedCtrl::None:
cbTranslation->setCurrentItem(0);
break;
case TranslatedCtrl::Table100:
cbTranslation->setCurrentItem(1);
break;
case TranslatedCtrl::Bass:
cbTranslation->setCurrentItem(2);
break;
case TranslatedCtrl::Treble:
cbTranslation->setCurrentItem(3);
break;
case TranslatedCtrl::OnOff:
cbTranslation->setCurrentItem(4);
break;
}
for (unsigned int i = 0; i < translated->values.count(); i++)
values.append(translated->values[i]);
min = translated->min;
max = translated->max;
}
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
connect(pbUp, SIGNAL(clicked()), this, SLOT(upClicked()));
connect(pbDown, SIGNAL(clicked()), this, SLOT(downClicked()));
}
QString FileControlDlg::getName(int i)
{
EMU10k1Ctrl ctrl;
file->getCtrl(i, &ctrl);
QString name = QString(ctrl.name) + " - " + QString().setNum(ctrl.value) +
" (" + QString().setNum(ctrl.min) + "," + + QString().setNum(ctrl.max) + ")";
return name;
}
void FileControlDlg::okClicked()
{
translated->name = leLoadedName->text();
translated->index = sbIndex->value();
switch(cbTranslation->currentItem())
{
case 0:
translated->translation = TranslatedCtrl::None;
break;
case 1:
translated->translation = TranslatedCtrl::Table100;
break;
case 2:
translated->translation = TranslatedCtrl::Bass;
break;
case 3:
translated->translation = TranslatedCtrl::Treble;
break;
case 4:
translated->translation = TranslatedCtrl::OnOff;
break;
}
translated->fileCtrlIdx = selected;
translated->visible = sbVisible->value();
translated->values.clear();
for (unsigned int i = 0; i < values.count(); i++)
translated->values.append(values[i]);
translated->min = min;
translated->max = max;
done(Accepted);
}
void FileControlDlg::cancelClicked()
{
done(Rejected);
}
void FileControlDlg::upClicked()
{
int idx = lbControls->currentItem();
if (idx > 0)
{
int tmp = selected[idx - 1];
selected[idx - 1] = selected[idx];
selected[idx] = tmp;
// update labels
lbControls->changeItem(getName(selected[idx - 1]), idx - 1);
lbControls->changeItem(getName(selected[idx]), idx);
lbControls->setCurrentItem(idx - 1);
}
}
void FileControlDlg::downClicked()
{
int idx = lbControls->currentItem();
if (idx >= 0 && idx < (int)lbControls->count() - 1)
{
int tmp = selected[idx + 1];
selected[idx + 1] = selected[idx];
selected[idx] = tmp;
// update labels
lbControls->changeItem(getName(selected[idx]), idx);
lbControls->changeItem(getName(selected[idx + 1]), idx + 1);
lbControls->setCurrentItem(idx + 1);
}
}

View file

@ -0,0 +1,66 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef FILECONTROLDIALOG_H
#define FILECONTROLDIALOG_H
#include <qvaluelist.h>
#include "dlgs/filecontroldialogbase.h"
#include "ld10k1file.h"
class TranslatedCtrl
{
public:
QString name;
int index;
enum TranslationType {None, Table100, Bass, Treble, OnOff };
TranslationType translation;
int visible;
int min;
int max;
QValueList <int> fileCtrlIdx;
QValueList <int> values;
};
class FileControlDlg : public FileControlDialogBase
{
Q_OBJECT
QValueList <int> selected;
EMU10k1File *file;
TranslatedCtrl *translated;
unsigned int min;
unsigned int max;
QValueList <int> values;
public:
FileControlDlg(QValueList <int> *eselected, EMU10k1File *efile, TranslatedCtrl *etranslated);
QString getName(int i);
public slots:
void okClicked();
void cancelClicked();
void upClicked();
void downClicked();
};
#endif // FILECONTROLDIALOG_H

View file

@ -0,0 +1,50 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_effect[]={
"22 22 4 1",
". c None",
"# c #000000",
"b c #303030",
"a c #ffffff",
"......................",
"......................",
"......................",
"....##############....",
"....#aaaaaaaaaaaa#....",
"....#aaaaaaaaaaaa#....",
"....#aaabb####aaa#....",
"....#aaabaaaaaaaa#....",
"....#aaabaaaaaaaa#....",
"....#aaabaaaaaaaa#....",
"....#aaabbb#baaaa#....",
"....#aaabaaaaaaaa#....",
"....#aaabaaaaaaaa#....",
"....#aaabaaaaaaaa#....",
"....#aaabaaaaaaaa#....",
"....#aaa######aaa#....",
"....#aaaaaaaaaaaa#....",
"....#aaaaaaaaaaaa#....",
"....##############....",
"......................",
"......................",
"......................"};

View file

@ -0,0 +1,50 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_effect_stack[]={
"22 22 4 1",
"b c None",
". c None",
"# c #000000",
"a c #ffffff",
"......................",
".##############.......",
".#aaaaaaaaaaaa#bb.....",
".#aaaaaaaaaaaa###bb...",
".#aaa######aaa#a#bb...",
".#aaa#aaaaaaaa#a###...",
".#aaa#aaaaaaaa#a#a#...",
".#aaa#aaaaaaaa#a#a#...",
".#aaa#####aaaa#a#a#...",
".#aaa#aaaaaaaa#a#a#...",
".#aaa#aaaaaaaa#a#a#...",
".#aaa#aaaaaaaa#a#a#...",
".#aaa#aaaaaaaa#a#a#...",
".#aaa######aaa#a#a#...",
".#aaaaaaaaaaaa#a#a#...",
".#aaaaaaaaaaaa#a#a#...",
".##############a#a#...",
"..b#aaaaaaaaaaaa#a#...",
"..b##############a#...",
"...bb#aaaaaaaaaaaa#...",
"...bb##############...",
"......................"};

View file

@ -0,0 +1,50 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_fx[]={
"22 22 4 1",
". c None",
"# c #000000",
"b c #303030",
"a c #ffffff",
"......................",
"......................",
"........#####.........",
"......##aaaaa##.......",
".....#aaaaaaaaa#......",
"....#aaaaaaaaaaa#.....",
"...#aa####a#aa#aa#....",
"...#aa#aaaa#aa#aa#....",
"..#aaa#aaaa#aa#aaa#...",
"..#aaa#aaaaa##aaaa#...",
"..#aaa###.aabbaaaa#...",
"..#aaa#aaaaa##aaaa#...",
"..#aaa#aaaa#aa#aaa#...",
"...#aa#aaaa#aa#aa#....",
"...#aa#aaaa#aa#aa#....",
"....#aaaaaaaaaaa#.....",
".....#aaaaaaaaa#......",
"......##aaaaa##.......",
"........#####.........",
"......................",
"......................",
"......................"};

View file

@ -0,0 +1,50 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_in[]={
"22 22 4 1",
". c None",
"# c #000000",
"b c #303030",
"a c #ffffff",
"......................",
"......................",
"........#####.........",
"......##aaaaa##.......",
".....#aaaaaaaaa#......",
"....#aaaaaaaaaaa#.....",
"...#aabaabaaaabaa#....",
"...#aabaabbaaabaa#....",
"..#aaabaababaabaaa#...",
"..#aaabaababaabaaa#...",
"..#aaabaababbabaaa#...",
"..#aaabaabaababaaa#...",
"..#aaabaabaababaaa#...",
"...#aabaabaaabbaa#....",
"...#aabaabaaaabaa#....",
"....#aaaaaaaaaaa#.....",
".....#aaaaaaaaa#......",
"......##aaaaa##.......",
"........#####.........",
"......................",
"......................",
"......................"};

View file

@ -0,0 +1,51 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_normal[]={
"22 22 5 1",
"# c None",
". c None",
"a c #000000",
"b c #303030",
"c c #ffffff",
"......................",
"......................",
"...#..................",
"...###a#########......",
"...###ab########......",
"...###acb#######......",
"...###accb######......",
"...###acccb#####......",
"...###accccb####......",
"...###acccccb###......",
"...###accccccb##......",
"..####acccccabb#......",
"..####accccb#####.....",
"..####acbbccb###......",
"..###.bb#bccb###......",
"...#..b###bccb##......",
"......####bccb##......",
"......#####bccb#......",
"......#####bccb#......",
"......######bb##......",
"......................",
"......................"};

View file

@ -0,0 +1,50 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_out[]={
"22 22 4 1",
". c None",
"# c #000000",
"b c #303030",
"a c #ffffff",
"......................",
"......................",
"........#####.........",
"......##aaaaa##.......",
".....#aaaaaaaaa#......",
"....#aaaaaaaaaaa#.....",
"...#aaaaaaaaaaaaa#....",
"...#aabaabababbba#....",
"..#aababababaabaaa#...",
"..#aababababaabaaa#...",
"..#aababababaabaaa#...",
"..#aababababaabaaa#...",
"..#aababababaabaaa#...",
"...#aabaaabaaabaa#....",
"...#aaaaaaaaaaaaa#....",
"....#aaaaaaaaaaa#.....",
".....#aaaaaaaaa#......",
"......##aaaaa##.......",
"........#####.........",
"......................",
"......................",
"......................"};

View file

@ -0,0 +1,56 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_route[]={
"22 22 10 1",
"# c None",
". c None",
"e c #000000",
"g c #303030",
"a c #000000",
"h c #191919",
"d c #1a1a1a",
"b c #333333",
"f c #fefefe",
"c c #ffffff",
"......................",
"......................",
"......................",
"......................",
"......................",
"......................",
"............#.........",
"............a##.......",
"...........#abb##.....",
"...#########accdd##...",
"...eeeeeeeeeaccffeg...",
"............accaa##...",
"............ahh##.....",
"............a##.......",
"............##........",
"......................",
"......................",
"......................",
"......................",
"......................",
"......................",
"......................"};

View file

@ -0,0 +1,52 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_zoom_minus[]={
"22 22 6 1",
". c None",
"b c #000000",
"d c #303030",
"# c #a0a0a0",
"c c #a8dcff",
"a c #dcdcdc",
"......................",
".....#####............",
"....abbbbb#...........",
"...abcccccb#..........",
"..abcccccccb#.........",
".abcccccccccb#........",
".abcccccccccb#........",
".abccbbbbbccb#........",
".abcccccccccb#........",
".abcccccccccb#........",
"..abcccccccb#.........",
"...abcccccbbd#........",
"....abbbbbabbb#.......",
".....aaaaa.abbb#......",
"............abbb#.....",
".............abbb#....",
"..............abbb#...",
"...............add#...",
"................aa....",
"......................",
"......................",
"......................"};

View file

@ -0,0 +1,53 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* XPM */
static const char *routing_zoom_plus[]={
"22 22 7 1",
"d c None",
". c None",
"b c #000000",
"e c #303030",
"# c #a0a0a0",
"c c #a8dcff",
"a c #dcdcdc",
"......................",
".....#####............",
"....abbbbb#...........",
"...abcccccb#..........",
".dabcccccccb#.........",
".abccccbccccb#........",
".abccccbccccb#........",
".abccbbbbbccb#........",
".abccccbccccb#........",
".abccccbccccb#........",
"..abcccccccb#d........",
"...abcccccbbe#dd......",
"....abbbbbabbb#dd.....",
".....aaaaa.abbb#dd....",
"............abbb#dd...",
".............abbb#d...",
".............dabbb#...",
"...............aee#...",
"................aa....",
"......................",
"......................",
"......................"};

573
qlo10k1/src/ld10k1file.cpp Normal file
View file

@ -0,0 +1,573 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "ld10k1file.h"
class EMU10k1FilePrivate
{
liblo10k1_emu_patch_t *ep;
public:
EMU10k1FilePrivate()
{
ep = liblo10k1_emu_new_patch();
}
~EMU10k1FilePrivate()
{
if (ep)
liblo10k1_emu_free_patch(ep);
}
void setNativeStruct(liblo10k1_emu_patch_t *ns)
{
if (ep)
liblo10k1_emu_free_patch(ep);
ep = ns;
}
liblo10k1_emu_patch_t *getNativeStruct()
{
return ep;
}
};
EMU10k1File::EMU10k1File()
{
privData = new EMU10k1FilePrivate();
}
EMU10k1File::~EMU10k1File()
{
if (privData)
delete (privData);
}
int EMU10k1File::LoadFromFile(QString file, EMU10k1File **ef)
{
liblo10k1_emu_patch_t *nf;
char fn[1000]; // FIXME file name length
int err;
strncpy(fn, file.local8Bit(), 999);
fn[999] = '\0';
if ((err = liblo10k1_emu_load_patch(fn, &nf)) < 0)
return err;
EMU10k1File *efi = new EMU10k1File();
efi->privData->setNativeStruct(nf);
*ef = efi;
return 0;
}
void EMU10k1File::getCtrl(unsigned int i, EMU10k1Ctrl *ctrl)
{
liblo10k1_emu_patch_t *nf = privData->getNativeStruct();
liblo10k1_emu_ctl_t *ctl;
if (i >= nf->ctl_count)
return;
ctl = &(nf->ctls[i]);
ctrl->value = ctl->ctl_val;
ctrl->min = ctl->ctl_val_min;
ctrl->max = ctl->ctl_val_max;
ctrl->name = ctl->ctl_name;
}
void EMU10k1File::setCtrl(unsigned int i, EMU10k1Ctrl *ctrl)
{
liblo10k1_emu_patch_t *nf = privData->getNativeStruct();
liblo10k1_emu_ctl_t *ctl;
if (i >= nf->ctl_count)
return;
ctl = &(nf->ctls[i]);
ctl->ctl_val = ctrl->value;
ctl->ctl_val_min = ctrl->min;
ctl->ctl_val_max = ctrl->max;
strcpy(ctl->ctl_name, ctrl->name.local8Bit());
}
QString EMU10k1File::getPatchName()
{
liblo10k1_emu_patch_t *nf = privData->getNativeStruct();
return QString(nf->patch_name);
}
int EMU10k1File::getCtrlCount()
{
liblo10k1_emu_patch_t *nf = privData->getNativeStruct();
return nf->ctl_count;
}
int EMU10k1File::getInCount()
{
liblo10k1_emu_patch_t *nf = privData->getNativeStruct();
return nf->in_count;
}
int EMU10k1File::getOutCount()
{
liblo10k1_emu_patch_t *nf = privData->getNativeStruct();
return nf->out_count;
}
class LD10k1FilePrivate
{
liblo10k1_dsp_patch_t *lp;
public:
LD10k1FilePrivate()
{
lp = liblo10k1_patch_alloc(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
~LD10k1FilePrivate()
{
if (lp)
liblo10k1_patch_free(lp);
}
void setNativeStruct(liblo10k1_dsp_patch_t *ns)
{
if (lp)
liblo10k1_patch_free(lp);
lp = ns;
}
liblo10k1_dsp_patch_t *getNativeStruct()
{
return lp;
}
};
LD10k1File::LD10k1File()
{
privData = new LD10k1FilePrivate();
}
LD10k1File::~LD10k1File()
{
if (privData)
delete (privData);
}
liblo10k1_dsp_patch_t *LD10k1File::getLD10k1Format()
{
return privData->getNativeStruct();
}
void LD10k1File::setLD10k1Format(liblo10k1_dsp_patch_t *patch)
{
privData->setNativeStruct(patch);
}
int LD10k1File::transformFromEmuFile(EMU10k1File *ef, LD10k1FileTransfCtl *tc, int tc_count, LD10k1File **lf)
{
liblo10k1_ctl_transform_t *ntc = (liblo10k1_ctl_transform_t *)malloc(sizeof(liblo10k1_ctl_transform_t) * tc_count);
if (!ntc)
return LD10K1_ERR_NO_MEM;
// copy tc to ntc
int i, j, err;
liblo10k1_dsp_patch_t *np = NULL;
for (i = 0; i < tc_count; i++)
{
for (j = 0; j < tc[i].emu_ctl_count; j++)
ntc[i].emu_ctls[j] = tc[i].emu_ctls[j];
ntc[i].emu_ctl_count = tc[i].emu_ctl_count;
strncpy(ntc[i].ctl_name, tc[i].ctl_name.local8Bit(), 43);
ntc[i].ctl_name[43] = '\0';
}
if ((err = liblo10k1_emu_transform_patch(ef->privData->getNativeStruct(), ntc, tc_count, &np)) < 0)
{
free(ntc);
return err;
}
free(ntc);
LD10k1File *nlf = new LD10k1File();
nlf->privData->setNativeStruct(np);
*lf = nlf;
return 0;
}
int LD10k1File::getIOCount(bool out)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (out)
return nf->out_count;
else
return nf->in_count;
}
QString LD10k1File::getIOName(bool out, unsigned int i)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (out)
{
if (i >= nf->out_count)
return "";
return QString(nf->outs[i].name);
}
else
{
if (i >= nf->in_count)
return "";
return QString(nf->ins[i].name);
}
}
void LD10k1File::setIOName(bool out, unsigned int i, QString name)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (out)
{
if (i >= nf->out_count)
return;
strncpy(nf->outs[i].name, name.local8Bit(), MAX_NAME_LEN - 1);
nf->outs[i].name[MAX_NAME_LEN - 1] = '\0';
}
else
{
if (i >= nf->in_count)
return;
strncpy(nf->ins[i].name, name.local8Bit(), MAX_NAME_LEN - 1);
nf->ins[i].name[MAX_NAME_LEN - 1] = '\0';
}
}
int LD10k1File::getCtlCount()
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
return nf->ctl_count;
}
QString LD10k1File::getCtlName(unsigned int i)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return "";
return QString(nf->ctl[i].name);
}
void LD10k1File::setCtlName(unsigned int i, QString name)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return;
strncpy(nf->ctl[i].name, name.local8Bit(), 43);
nf->ctl[i].name[43] = '\0';
}
LD10k1File::TranslationType LD10k1File::getCtlTranslation(unsigned int i)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return None;
switch (nf->ctl[i].translation)
{
case EMU10K1_GPR_TRANSLATION_NONE:
return LD10k1File::None;
case EMU10K1_GPR_TRANSLATION_TABLE100:
return LD10k1File::Table100;
case EMU10K1_GPR_TRANSLATION_BASS:
return LD10k1File::Bass;
case EMU10K1_GPR_TRANSLATION_TREBLE:
return LD10k1File::Treble;
case EMU10K1_GPR_TRANSLATION_ONOFF:
return LD10k1File::OnOff;
default:
return LD10k1File::None;
}
}
void LD10k1File::setCtlTranslation(unsigned int i, LD10k1File::TranslationType t)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return;
switch (t)
{
case LD10k1File::None:
nf->ctl[i].translation = EMU10K1_GPR_TRANSLATION_NONE;
break;
case LD10k1File::Table100:
nf->ctl[i].translation = EMU10K1_GPR_TRANSLATION_TABLE100;
break;
case LD10k1File::Bass:
nf->ctl[i].translation = EMU10K1_GPR_TRANSLATION_BASS;
break;
case LD10k1File::Treble:
nf->ctl[i].translation = EMU10K1_GPR_TRANSLATION_TREBLE;
break;
case LD10k1File::OnOff:
nf->ctl[i].translation = EMU10K1_GPR_TRANSLATION_ONOFF;
break;
default:
break;
}
}
int LD10k1File::getCtlValCount(unsigned int i)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return 0;
return nf->ctl[i].count;
}
int LD10k1File::getCtlValVCount(unsigned int i)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return 0;
return nf->ctl[i].vcount;
}
void LD10k1File::setCtlValVCount(unsigned int i, unsigned int cnt)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return;
nf->ctl[i].vcount = cnt;
}
unsigned int LD10k1File::getCtlVal(unsigned int i, unsigned int vi)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return 0;
if (vi >= nf->ctl[i].vcount)
return 0;
return nf->ctl[i].value[vi];
}
void LD10k1File::setCtlVal(unsigned int i, unsigned int vi, unsigned int val)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return;
if (vi >= nf->ctl[i].vcount)
return;
nf->ctl[i].value[vi] = val;
}
QString LD10k1File::getPatchName()
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
return nf->patch_name;
}
void LD10k1File::setPatchName(QString name)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
strncpy(nf->patch_name, name.local8Bit(), MAX_NAME_LEN - 1);
nf->patch_name[MAX_NAME_LEN - 1] = '\0';
}
int LD10k1File::LoadFromFile(QString file, LD10k1File **lf)
{
liblo10k1_dsp_patch_t *nf = NULL;
liblo10k1_file_info_t *fi = NULL;
char fn[1000]; // FIXME file name length
int err;
strncpy(fn, file.local8Bit(), 999);
fn[999] = '\0';
if ((err = liblo10k1lf_load_dsp_patch(&nf, fn, &fi)) < 0)
return err;
LD10k1File *lfi = new LD10k1File();
lfi->privData->setNativeStruct(nf);
*lf = lfi;
lfi->fileName = fi->name;
lfi->fileDesc = fi->desc;
lfi->fileCreater = fi->creater;
lfi->fileAuthor = fi->author;
lfi->fileCopyright = fi->copyright;
lfi->fileLicense = fi->license;
liblo10k1lf_file_info_free(fi);
return 0;
}
int LD10k1File::SaveToFile(QString file)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
liblo10k1_file_info_t *fi = liblo10k1lf_file_info_alloc();
char fn[1000]; // FIXME file name length
int err;
strncpy(fn, file.local8Bit(), 999);
fn[999] = '\0';
fi->name = strdup(fileName.local8Bit());
fi->desc = strdup(fileDesc.local8Bit());
fi->creater = strdup(fileCreater.local8Bit());
fi->author = strdup(fileAuthor.local8Bit());
fi->copyright = strdup(fileCopyright.local8Bit());
fi->license = strdup(fileLicense.local8Bit());
if ((err = liblo10k1lf_save_dsp_patch(nf, fn, fi)) < 0)
{
liblo10k1lf_file_info_free(fi);
return err;
}
liblo10k1lf_file_info_free(fi);
return 0;
}
unsigned int LD10k1File::getCtlMin(unsigned int i)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return 0;
return nf->ctl[i].min;
}
unsigned int LD10k1File::getCtlMax(unsigned int i)
{
liblo10k1_dsp_patch_t *nf = privData->getNativeStruct();
if (i >= nf->ctl_count)
return 0;
return nf->ctl[i].max;
}
class LD10k1DspFilePrivate
{
liblo10k1_file_dsp_setup_t *ls;
public:
LD10k1DspFilePrivate()
{
ls = liblo10k1lf_dsp_config_alloc();
}
~LD10k1DspFilePrivate()
{
if (ls)
liblo10k1lf_dsp_config_free(ls);
}
void setNativeStruct(liblo10k1_file_dsp_setup_t *ns)
{
if (ls)
liblo10k1lf_dsp_config_free(ls);
ls = ns;
}
liblo10k1_file_dsp_setup_t *getNativeStruct()
{
return ls;
}
};
LD10k1DspFile::LD10k1DspFile()
{
privData = new LD10k1DspFilePrivate();
}
LD10k1DspFile::~LD10k1DspFile()
{
if (privData)
delete (privData);
}
liblo10k1_file_dsp_setup_t *LD10k1DspFile::getLD10k1DspFormat()
{
return privData->getNativeStruct();
}
void LD10k1DspFile::setLD10k1DspFormat(liblo10k1_file_dsp_setup_t *setup)
{
privData->setNativeStruct(setup);
}
int LD10k1DspFile::LoadFromFile(QString file, LD10k1DspFile **lf)
{
liblo10k1_file_dsp_setup_t *nf = NULL;
liblo10k1_file_info_t *fi = NULL;
char fn[1000]; // FIXME file name length
int err;
strncpy(fn, file.local8Bit(), 999);
fn[999] = '\0';
if ((err = liblo10k1lf_load_dsp_config(&nf, fn, &fi)) < 0)
return err;
LD10k1DspFile *lfi = new LD10k1DspFile();
lfi->privData->setNativeStruct(nf);
*lf = lfi;
lfi->fileName = fi->name;
lfi->fileDesc = fi->desc;
lfi->fileCreater = fi->creater;
lfi->fileAuthor = fi->author;
lfi->fileCopyright = fi->copyright;
lfi->fileLicense = fi->license;
liblo10k1lf_file_info_free(fi);
return 0;
}
int LD10k1DspFile::SaveToFile(QString file)
{
liblo10k1_file_dsp_setup_t *nf = privData->getNativeStruct();
liblo10k1_file_info_t *fi = liblo10k1lf_file_info_alloc();
char fn[1000]; // FIXME file name length
int err;
strncpy(fn, file.local8Bit(), 999);
fn[999] = '\0';
fi->name = strdup(fileName.local8Bit());
fi->desc = strdup(fileDesc.local8Bit());
fi->creater = strdup(fileCreater.local8Bit());
fi->author = strdup(fileAuthor.local8Bit());
fi->copyright = strdup(fileCopyright.local8Bit());
fi->license = strdup(fileLicense.local8Bit());
if ((err = liblo10k1lf_save_dsp_config(nf, fn, fi)) < 0)
{
liblo10k1lf_file_info_free(fi);
return err;
}
liblo10k1lf_file_info_free(fi);
return 0;
}

145
qlo10k1/src/ld10k1file.h Normal file
View file

@ -0,0 +1,145 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef LD10K1FILE_H
#define LD10K1FILE_H
#include <qstring.h>
#include <qvaluelist.h>
#include <lo10k1/lo10k1.h>
#include "structure.h"
class EMU10k1FilePrivate;
class LD10k1File;
struct EMU10k1Ctrl
{
unsigned int value;
unsigned int min;
unsigned int max;
QString name;
};
class EMU10k1File
{
EMU10k1FilePrivate *privData;
public:
EMU10k1File();
~EMU10k1File();
static int LoadFromFile(QString file, EMU10k1File **ef);
int getInCount();
int getOutCount();
int getCtrlCount();
void getCtrl(unsigned int i, EMU10k1Ctrl *ctrl);
void setCtrl(unsigned int i, EMU10k1Ctrl *ctrl);
QString getPatchName();
friend class LD10k1File;
};
class LD10k1FilePrivate;
class LD10k1FileTransfCtl
{
public:
int emu_ctls[32];
int emu_ctl_count;
QString ctl_name;
};
class LD10k1File
{
LD10k1FilePrivate *privData;
QString fileName;
QString fileDesc;
QString fileCreater;
QString fileAuthor;
QString fileCopyright;
QString fileLicense;
public:
enum TranslationType {None, Table100, Bass, Treble, OnOff};
LD10k1File();
~LD10k1File();
QString getPatchName();
void setPatchName(QString name);
int getIOCount(bool out);
QString getIOName(bool out, unsigned int i);
void setIOName(bool out, unsigned int i, QString name);
int getCtlCount();
QString getCtlName(unsigned int i);
void setCtlName(unsigned int i, QString name);
TranslationType getCtlTranslation(unsigned int i);
void setCtlTranslation(unsigned int i, TranslationType t);
int getCtlValCount(unsigned int i);
unsigned int getCtlMin(unsigned int i);
unsigned int getCtlMax(unsigned int i);
int getCtlValVCount(unsigned int i);
void setCtlValVCount(unsigned int i, unsigned int cnt);
unsigned int getCtlVal(unsigned int i, unsigned int vi);
void setCtlVal(unsigned int i, unsigned int vi, unsigned int val);
static int transformFromEmuFile(EMU10k1File *ef, LD10k1FileTransfCtl *tc, int tc_count, LD10k1File **lf);
liblo10k1_dsp_patch_t *getLD10k1Format();
void setLD10k1Format(liblo10k1_dsp_patch_t *patch);
static int LoadFromFile(QString file, LD10k1File **lf);
int SaveToFile(QString file);
};
class LD10k1DspFilePrivate;
class CardParam;
class LD10k1DspFile
{
LD10k1DspFilePrivate *privData;
QString fileName;
QString fileDesc;
QString fileCreater;
QString fileAuthor;
QString fileCopyright;
QString fileLicense;
public:
LD10k1DspFile();
~LD10k1DspFile();
liblo10k1_file_dsp_setup_t *getLD10k1DspFormat();
void setLD10k1DspFormat(liblo10k1_file_dsp_setup_t *setup);
static int LoadFromFile(QString file, LD10k1DspFile **lf);
int SaveToFile(QString file);
friend class CardParam;
};
#endif // LD10K1FILE_H

View file

@ -0,0 +1,235 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qlineedit.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qinputdialog.h>
#include <qvaluelist.h>
#include <qmessagebox.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qcombobox.h>
#include <qmap.h>
#include "app_global.h"
#include "loadpatchdialog.h"
#include "structure_patch.h"
#include "structure_io.h"
LoadPatchDlg::LoadPatchDlg(StrGlobal *glob, QString efileName, LD10k1File *efile)
: LoadPatchDialogBase()
{
global = glob;
fileName = efileName;
file = efile;
leFileName->setText(fileName);
lePatchName->setText(file->getPatchName());
// load controls list
int i;
for (i = 0; i < file->getCtlCount(); i++)
{
QString text = getName(i);
lbFileCtrl->insertItem(text);
ctrlFileList.append(i);
}
for (i = 0; i < file->getIOCount(false); i++)
inputNames.append(file->getIOName(false, i));
for (i = 0; i < file->getIOCount(true); i++)
outputNames.append(file->getIOName(true, i));
for (i = 0; i < file->getIOCount(false); i++)
lbInputs->insertItem(inputNames[i]);
for (i = 0; i < file->getIOCount(true); i++)
lbOutputs->insertItem(outputNames[i]);
// create sorted patch list
sortedPatches.clear();
for (StrPatch *onePatch = global->Patches.first(); onePatch; onePatch = global->Patches.next())
{
i = 0;
bool found = false;
for (StrPatch *secondPatch = sortedPatches.first(); secondPatch; secondPatch = sortedPatches.next())
{
if (onePatch->order() < secondPatch->order())
{
sortedPatches.insert(i, onePatch);
found = true;
break;
}
i++;
}
if (!found)
sortedPatches.append(onePatch);
}
// fill combobox
cbWhere->clear();
for (StrPatch *p = sortedPatches.first(); p; p = sortedPatches.next())
cbWhere->insertItem(QString().sprintf("%03d %03d ", p->order(), p->num()) + p->name());
cbWhere->setCurrentItem(sortedPatches.count() - 1);
cbBefAfter->setCurrentItem(1);
setBefore(1, sortedPatches.count() - 1);
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
connect(lbInputs, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(inputsDoubleClicked(QListBoxItem *)));
connect(lbOutputs, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(outputsDoubleClicked(QListBoxItem *)));
connect(lbFileCtrl, SIGNAL(selectionChanged()), this, SLOT(fileSelectionChanged()));
connect(cbBefAfter, SIGNAL(activated(int)), this, SLOT(befAfterActivated(int)));
connect(cbWhere, SIGNAL(activated(int)), this, SLOT(whereActivated(int)));
}
QString LoadPatchDlg::getName(int i)
{
return file->getCtlName(i);
}
void LoadPatchDlg::okClicked()
{
// load patch
done(Accepted);
}
void LoadPatchDlg::cancelClicked()
{
done(Rejected);
}
void LoadPatchDlg::inputsDoubleClicked(QListBoxItem *item)
{
bool ok;
int idx = lbInputs->index(item);
QString text = inputNames[idx];
text = QInputDialog::getText(
APP_NAME, "Input name:", QLineEdit::Normal,
text, &ok, this );
if (ok && !text.isEmpty())
{
inputNames[idx] = text;
lbInputs->changeItem(text, idx);
}
}
void LoadPatchDlg::outputsDoubleClicked(QListBoxItem *item)
{
bool ok;
int idx = lbOutputs->index(item);
QString text = outputNames[idx];
text = QInputDialog::getText(
APP_NAME, "Output name:", QLineEdit::Normal,
text, &ok, this );
if (ok && !text.isEmpty())
{
outputNames[idx] = text;
lbOutputs->changeItem(text, idx);
}
}
void LoadPatchDlg::fileSelectionChanged()
{
QListBoxItem *item = lbFileCtrl->selectedItem();
if (!item)
{
leTranslation->setText("");
leMin->setText("");
leMax->setText("");
lbValues->clear();
lbValues->setEnabled(false);
}
else
{
int iidx = lbFileCtrl->index(item);
int i;
QString transl;
switch (file->getCtlTranslation(iidx))
{
case LD10k1File::None:
transl = "None";
break;
case LD10k1File::Table100:
transl = "Table100";
break;
case LD10k1File::Bass:
transl = "Bass";
break;
case LD10k1File::Treble:
transl = "Treble";
break;
case LD10k1File::OnOff:
transl = "On/Off";
break;
}
leTranslation->setText(transl);
leMin->setText(QString().setNum(file->getCtlMin(iidx)));
leMax->setText(QString().setNum(file->getCtlMax(iidx)));
lbValues->clear();
for (i = 0; i < file->getCtlValVCount(iidx); i++)
lbValues->insertItem(QString("%1 : %2").arg(i).arg(file->getCtlVal(iidx, i)));
lbValues->setEnabled(false);
}
}
StrPatch *LoadPatchDlg::whereLoad()
{
return before;
}
void LoadPatchDlg::setBefore(int i1, int i2)
{
if (i1)
{
if (i2 < (int)sortedPatches.count() - 1)
before = sortedPatches.at(i2 + 1);
else
before = NULL;
}
else
before = sortedPatches.at(i2);
}
void LoadPatchDlg::whereActivated(int index)
{
setBefore(cbBefAfter->currentItem(), index);
}
void LoadPatchDlg::befAfterActivated(int index)
{
setBefore(index, cbWhere->currentItem());
}

View file

@ -0,0 +1,71 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef LOADPATCHDIALOG_H
#define LOADPATCHDIALOG_H
#include <qstringlist.h>
#include <qvaluelist.h>
#include <qptrlist.h>
#include "dlgs/loadpatchdialogbase.h"
#include "filecontroldialog.h"
#include "connectionwizard.h"
#include "structure.h"
#include "structure_patch.h"
#include "ld10k1file.h"
class LoadPatchDlg : public LoadPatchDialogBase
{
Q_OBJECT
StrGlobal *global;
LD10k1File *file;
QString fileName;
QStringList inputNames;
QStringList outputNames;
QValueList <int> ctrlFileList;
QValueList <TranslatedCtrl> translatedList;
QPtrList <StrPatch> sortedPatches;
StrPatch *before;
void setBefore(int i1, int i2);
public:
LoadPatchDlg(StrGlobal *glob, QString efileName, LD10k1File *efile);
QString getName(int i);
StrPatch *whereLoad();
public slots:
void okClicked();
void cancelClicked();
void inputsDoubleClicked(QListBoxItem *item);
void outputsDoubleClicked(QListBoxItem *item);
void fileSelectionChanged();
void whereActivated(int index);
void befAfterActivated(int index);
};
#endif // LOADPATCHDIALOG_H

32
qlo10k1/src/main.cpp Normal file
View file

@ -0,0 +1,32 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qapplication.h>
#include "mainwnd.h"
int main( int argc, char ** argv )
{
QApplication a( argc, argv );
MainWnd w;
w.show();
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
}

550
qlo10k1/src/mainwnd.cpp Normal file
View file

@ -0,0 +1,550 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <qapplication.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <qfiledialog.h>
#include <qmessagebox.h>
#include <qlayout.h>
#include <qsettings.h>
#include "app_global.h"
#include "mainwnd.h"
#include "preferences.h"
#include "loadpatchdialog.h"
#include "transformpatchdialog.h"
#include "aboutdialog.h"
#include "routingwidget.h"
#include "structure_patch.h"
#include "strparam.h"
class PatchesListViewItem : public QListViewItem
{
public:
StrPatch *patch;
PatchesListViewItem(StrPatch *p, QListView *parent) : QListViewItem(parent)
{
patch = p;
updateText();
}
PatchesListViewItem(StrPatch *p, QListView *parent, PatchesListViewItem *after) : QListViewItem(parent, after)
{
patch = p;
updateText();
}
void updateText()
{
setText(0,QString().sprintf("%03d", patch->order()));
setText(1,QString().sprintf("%03d", patch->num()));
setText(2,patch->name());
}
};
MainWnd::MainWnd() : MainWndBase()
{
cardGlobal = new StrCardGlobal();
CurrentCard = NULL;
// try to load settings
loadSettings();
// main menu
QPopupMenu *fileMenu = new QPopupMenu();
fileMenu->insertItem(tr("&Load DSP config"), this, SLOT(menuLoadDSPConfigActivated(int)));
fileMenu->insertItem(tr("&Save DSP config"), this, SLOT(menuSaveDSPConfigActivated(int)));
fileMenu->insertSeparator();
fileMenu->insertItem(tr("&Quit"), this, SLOT(menuQuitActivated(int)));
menubar->insertItem(tr("&File"), fileMenu);
cardMenu = new QPopupMenu();
menubar->insertItem(tr("&Card"), cardMenu);
cardMenu->setCheckable(true);
QPopupMenu *settingMenu = new QPopupMenu();
settingMenu->insertItem(tr("&Main settings"), this, SLOT(menuSettingsActivated(int)));
menubar->insertItem(tr("&Settings"), settingMenu);
QPopupMenu *helpMenu = new QPopupMenu();
helpMenu->insertItem(tr("&About"), this, SLOT(menuHelpAboutActivated(int)));
menubar->insertItem(tr("&Help"), helpMenu);
// connect signals
connect((QObject *)tabMain, SIGNAL(currentChanged(QWidget *)), this, SLOT(tabMainCurrentChanged(QWidget *)));
createCardMenu();
enableTabs(false);
setCaption(tr(APP_NAME));
connect(pbLoad, SIGNAL(clicked()), this, SLOT(loadClicked()));
connect(pbUnload, SIGNAL(clicked()), this, SLOT(unloadClicked()));
connect(lvPatches, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(patchDoubleClicked(QListViewItem *)));
routing = new RoutingWidget(tabRouting);
tabRoutingLayout->addWidget(routing, 0, 0);
routing->show();
}
MainWnd::~MainWnd()
{
CurrentCard = NULL;
delete cardGlobal;
}
void MainWnd::tabMainCurrentChanged(QWidget *tab)
{
if (!CurrentCard)
return;
if (tab == tabLoad)
{
loadPatchesList(lvPatches);
}
else if (tab == tabRouting)
{
routing->refreshDrawing(CurrentCard);
}
}
void MainWnd::loadPatchesList(QListView *lv)
{
StrPatch *patch;
lv->clear();
PatchesListViewItem *after = NULL;
for(patch = CurrentCard->Patches.first(); patch; patch = CurrentCard->Patches.next() )
{
if (after)
after = new PatchesListViewItem(patch, lv, after);
else
after = new PatchesListViewItem(patch, lv);
}
}
void MainWnd::patchesUpdateText()
{
QListViewItemIterator it(lvPatches);
while (it.current())
{
PatchesListViewItem *i = (PatchesListViewItem *)it.current();
i->updateText();
++it;
}
}
void MainWnd::menuQuitActivated(int /*id*/)
{
qApp->quit();
}
void MainWnd::menuLoadDSPConfigActivated(int id)
{
if (!CurrentCard)
return;
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
fd->setMode(QFileDialog::ExistingFile);
fd->setFilter("DSP config (*.ld10k1)");
fd->setCaption("Save DSP config");
int err = 0;
QString fileName;
if (fd->exec() == QDialog::Accepted)
{
fileName = fd->selectedFile();
delete fd;
LD10k1DspFile *dc = NULL;
if ((err = dc->LoadFromFile(fileName, &dc)) < 0)
{
QMessageBox::critical(0, APP_NAME, QString("Couldn't load DSP config\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
return;
}
if ((err = CurrentCard->putDspConfig(dc)) < 0)
QMessageBox::critical(0, APP_NAME, QString("Couldn't put DSP config\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
delete dc;
CurrentCard->clear();
CurrentCard->loadFromLD();
refreshState();
}
else
delete fd;
}
void MainWnd::menuSaveDSPConfigActivated(int id)
{
if (!CurrentCard)
return;
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
fd->setMode(QFileDialog::AnyFile);
fd->setFilter("DSP config (*.ld10k1)");
fd->setCaption("Save DSP config");
int err = 0;
QString fileName;
if (fd->exec() == QDialog::Accepted)
{
fileName = fd->selectedFile();
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)
return;
}
LD10k1DspFile *dc = NULL;
if ((err = CurrentCard->getDspConfig(&dc)) < 0)
{
QMessageBox::critical(0, APP_NAME, QString("Couldn't get DSP config\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
return;
}
if ((err = dc->SaveToFile(fileName)) < 0)
QMessageBox::critical(0, APP_NAME, QString("Couldn't save DSP config\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
delete dc;
}
else
delete fd;
}
void MainWnd::refreshState()
{
tabMainCurrentChanged(tabMain->currentPage());
}
void MainWnd::menuCardActivated(int id)
{
CardParam *card;
CardParam *old_card, *new_card;
int item_id = 0, old_item_id = 0;
new_card = NULL;
if (CurrentCard && CurrentCard->Card->isConnected())
old_card = CurrentCard->Card;
else
old_card = NULL;
for (unsigned int i = 0; i < cardMenuItems.count(); i++)
{
item_id = cardMenuItems[i];
card = cardGlobal->Cards.at(i);
if (cardMenu->isItemChecked(item_id))
old_item_id = item_id;
if (id == item_id)
new_card = card;
}
if (new_card && new_card != old_card)
{
if (!new_card->connect())
{
cardMenu->setItemChecked(id, true);
enableTabs(true);
CurrentCard = new_card->getStructure();
// FIXME - refresh data
CurrentCard->loadFromLD();
refreshState();
if (old_card)
{
old_card->disconnect();
cardMenu->setItemChecked(old_item_id, false);
}
}
}
}
void MainWnd::menuSettingsActivated(int /*id*/)
{
PreferencesDlg d(cardGlobal);
int item_id;
if (CurrentCard && CurrentCard->Card->isConnected())
{
CurrentCard->Card->disconnect();
CurrentCard = NULL;
enableTabs(false);
for (unsigned int i = 0; i < cardMenuItems.count(); i++)
{
item_id = cardMenuItems[i];
cardMenu->setItemChecked(item_id, false);
}
}
if (d.exec() == QDialog::Accepted)
{
saveSettings();
createCardMenu();
}
}
void MainWnd::menuHelpAboutActivated(int /* id */)
{
AboutDlg d;
d.exec();
}
void MainWnd::menuCardClearDSPActivated(int /* id */)
{
if (CurrentCard)
{
CurrentCard->clearDSP();
refreshState();
}
}
void MainWnd::menuCardRefreshActivated(int /* id */)
{
if (CurrentCard)
CurrentCard->loadFromLD();
refreshState();
}
void MainWnd::enableTabs(bool en)
{
if (en)
{
tabLoad->setEnabled(true);
tabRouting->setEnabled(true);
}
else
{
tabLoad->setEnabled(false);
tabRouting->setEnabled(false);
}
}
void MainWnd::createCardMenu(void)
{
CardParam *card;
int id;
for (unsigned int i = 0; i < cardMenuItems.count() ;i++)
{
cardMenu->disconnectItem(cardMenuItems[i], this, SLOT(menuCardActivated(int)));
}
cardMenuItems.clear();
cardMenu->clear();
for (unsigned int i = 0; i < cardGlobal->Cards.count() ;i++)
{
card = cardGlobal->Cards.at(i);
id = cardMenu->insertItem(card->CardName);
cardMenuItems.append(id);
cardMenu->connectItem(id, this, SLOT(menuCardActivated(int)));
}
// special items
cardMenu->insertSeparator();
cardMenu->insertItem(tr("&Refresh"), this, SLOT(menuCardRefreshActivated(int)));
cardMenu->insertItem(tr("&Clear DSP"), this, SLOT(menuCardClearDSPActivated(int)));
}
void MainWnd::loadClicked()
{
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
fd->setMode(QFileDialog::ExistingFile);
fd->setFilter("Patches (*.emu10k1 *.ld10k1)");
fd->setCaption("Load patch");
int err = 0;
QString fileName;
if ( fd->exec() == QDialog::Accepted )
{
fileName = fd->selectedFile();
delete fd;
LD10k1File *ldfile = NULL;
if (fileName.endsWith(".emu10k1"))
{
EMU10k1File *emufile = NULL;
if ((err = EMU10k1File::LoadFromFile(fileName, &emufile)) < 0)
{
QMessageBox::critical(0, APP_NAME, QString("Couldn't load patch\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
return;
}
else
{
TransformPatchDlg d(fileName, emufile);
if (d.exec() == QDialog::Accepted)
{
if ((err = d.transformFile(&ldfile)) < 0)
{
QMessageBox::critical(0, APP_NAME, QString("Couldn't transform patch\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
delete emufile;
return;
}
delete emufile;
}
else
{
delete emufile;
return;
}
}
}
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);
if (d.exec() == QDialog::Accepted)
{
// and now convert to loader
StrPatch *loaded = NULL;
if ((err = CurrentCard->load(ldfile, d.whereLoad(), &loaded)) < 0)
QMessageBox::critical(0, APP_NAME, QString("Couldn't load patch\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
else
refreshState();
}
delete ldfile;
}
else
delete fd;
}
void MainWnd::unloadClicked()
{
PatchesListViewItem *current = (PatchesListViewItem *)lvPatches->currentItem();
int err;
if (current)
{
// find patch index
StrPatch *p = current->patch;
if ((err = CurrentCard->unload(p)))
QMessageBox::critical(0, APP_NAME, QString("Couldn't unload patch\n(ld10k1 error:%1)").arg(CurrentCard->errorStr(err)));
else
refreshState();
}
}
void MainWnd::patchDoubleClicked(QListViewItem *item)
{
/*int patch_num = item->text(0).toInt();
int err;
liblo10k1_dsp_patch_t *patch = NULL;
if ((err = global->CurrentCard->get(patch_num, &patch)))
{
QMessageBox::critical(0, APP_NAME, QString("Couldn't get patch\n(ld10k1 error:%1)").arg(global->CurrentCard->error_str(err)));
return;
}*/
}
void MainWnd::saveSettings()
{
QSettings settings(QSettings::Ini);
settings.setPath("pzad", "qlo10k1", QSettings::User);
settings.beginGroup("/qlo10k1");
settings.writeEntry("/Version", "0.0.1");
settings.writeEntry("/RepDirSystem", cardGlobal->RepDirSystem);
settings.writeEntry("/RepDirUser", cardGlobal->RepDirUser);
// first save cards
settings.beginGroup("/Cards");
settings.writeEntry("/CardCount", (int)cardGlobal->Cards.count());
for (unsigned int i = 0; i < cardGlobal->Cards.count(); i++)
{
settings.beginGroup(QString("/Card_%1").arg(i));
CardParam *card = cardGlobal->Cards.at(i);
settings.writeEntry("/Name", card->CardName);
settings.writeEntry("/Socket", card->CardSocket);
settings.endGroup();
}
// write current card
settings.endGroup();
}
void MainWnd::loadSettings()
{
QSettings settings(QSettings::Ini);
settings.setPath("pzad", "qlo10k1", QSettings::User);
settings.beginGroup("/qlo10k1");
QString version = settings.readEntry("/Version", "");
if (version == "")
{
// settings doesn't exists
cardGlobal->RepDirSystem = "";
cardGlobal->RepDirUser = "";
CardParam *card = new CardParam();
card->CardName = "Default card";
card->CardSocket = "/tmp/.ld10k1_port";
if (!card->testConnection())
{
cardGlobal->Cards.append(card);
}
}
else
{
cardGlobal->RepDirSystem = settings.readEntry("/RepDirSystem", "");
cardGlobal->RepDirUser = settings.readEntry("/RepDirUser", "");
settings.beginGroup("/Cards");
unsigned int cardCount = settings.readNumEntry("/CardCount", 0);
for (unsigned int i = 0; i < cardCount; i++)
{
settings.beginGroup(QString("/Card_%1").arg(i));
CardParam *card = new CardParam();
card->CardName = settings.readEntry("/Name", "");
card->CardSocket = settings.readEntry("/Socket", "");
if (!card->testConnection())
{
cardGlobal->Cards.append(card);
}
settings.endGroup();
}
settings.endGroup();
}
}

77
qlo10k1/src/mainwnd.h Normal file
View file

@ -0,0 +1,77 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef MAINWND_H
#define MAINWND_H
#include "dlgs/mainwndbase.h"
#include "structure.h"
#include "strglobal.h"
class QPopupMenu;
class RoutingWidget;
class MainWnd : public MainWndBase
{
Q_OBJECT
StrCardGlobal *cardGlobal;
StrGlobal *CurrentCard;
QPopupMenu *cardMenu;
QValueList <int> cardMenuItems;
RoutingWidget *routing;
public:
MainWnd(void);
~MainWnd(void);
void enableTabs(bool en);
void createCardMenu(void);
void loadPatchesList(QListView *lv);
void refreshState();
void saveSettings();
void loadSettings();
void patchesUpdateText();
public slots:
// menu
void menuLoadDSPConfigActivated(int id);
void menuSaveDSPConfigActivated(int id);
void menuQuitActivated(int id);
void menuCardActivated(int id);
void menuSettingsActivated(int id);
void menuHelpAboutActivated(int id);
void menuCardClearDSPActivated(int id);
void menuCardRefreshActivated(int id);
void tabMainCurrentChanged(QWidget *tab);
void loadClicked();
void unloadClicked();
void patchDoubleClicked(QListViewItem *item);
};
#endif // MAINWND_H

160
qlo10k1/src/newiodialog.cpp Normal file
View file

@ -0,0 +1,160 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qpushbutton.h>
#include <qlistview.h>
#include "newiodialog.h"
#include "routingwidget.h"
#include "structure_io.h"
#include "strparam.h"
class IOListViewItem : public QListViewItem
{
public:
int num;
QString name;
IOListViewItem(int n, QString na, QListView *parent) : QListViewItem(parent)
{
num = n;
name = na;
updateText();
}
IOListViewItem(int n, QString na, QListView *parent, IOListViewItem *after) : QListViewItem(parent, after)
{
num = n;
name = na;
updateText();
}
void updateText()
{
setText(0, QString().sprintf("%03d", num));
setText(1, name);
}
};
NewIODlg::NewIODlg(StrGlobal *glob, DlgType t)
: NewIODialogBase()
{
global = glob;
dt = t;
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
QString title;
QString columnTitle;
switch (dt)
{
case In:
title = "New input";
columnTitle = "Input";
break;
case Out:
title = "New output";
columnTitle = "Output";
break;
case FX:
title = "New FX bus";
columnTitle = "FX bus";
break;
}
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;
bool used = false;
if (dt == In)
used = global->findInputByNum(i) != NULL;
else if (dt == Out)
used = global->findOutputByNum(i) != NULL;
else
used = global->findFXByNum(i) != NULL;
if (!used)
{
if (dt == In)
global->Card->getInput(i, ioname);
else if (dt == Out)
global->Card->getOutput(i, ioname);
else
global->Card->getFX(i, ioname);
if (after)
after = new IOListViewItem(i, ioname, lvIOs, after);
else
after = new IOListViewItem(i, ioname, lvIOs);
}
}
setCaption(title);
lvIOs->setColumnText(1, columnTitle);
connect(lvIOs, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(ioSelectionChanged(QListViewItem *)));
}
void NewIODlg::okClicked()
{
done(Accepted);
}
void NewIODlg::cancelClicked()
{
done(Rejected);
}
void NewIODlg::ioSelectionChanged(QListViewItem *item)
{
IOListViewItem *ioitem = (IOListViewItem *)item;
num = ioitem->num;
name = ioitem->name;
pbOK->setEnabled(true);
}
StrIOBase *NewIODlg::getNewIO()
{
if (dt == In)
return new StrInput(num, name);
else if (dt == Out)
return new StrOutput(num, name);
else
return new StrFX(num, name);
}

53
qlo10k1/src/newiodialog.h Normal file
View file

@ -0,0 +1,53 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef NEWIODIALOG_H
#define NEWIODIALOG_H
#include "dlgs/newiodialogbase.h"
#include "strglobal.h"
class StrIOBase;
class NewIODlg : public NewIODialogBase
{
Q_OBJECT
public:
enum DlgType {In, Out, FX};
private:
StrGlobal *global;
DlgType dt;
int num;
QString name;
public:
NewIODlg(StrGlobal *glob, DlgType t);
StrIOBase *getNewIO();
public slots:
void okClicked();
void cancelClicked();
void ioSelectionChanged(QListViewItem *item);
};
#endif // NEWIODIALOG_H

312
qlo10k1/src/patchdialog.cpp Normal file
View file

@ -0,0 +1,312 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qlineedit.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qinputdialog.h>
#include "patchdialog.h"
#include "structure_patch.h"
PatchDlg::PatchDlg(StrGlobal *glob, StrPatch *p)
: PatchDialogBase()
{
global = glob;
patch = p;
lePatchName->setText(p->name());
// load controls list
/*
FIXME
int i;
for (i = 0; i < file->ctrl_count; i++)
{
QString text = getName(i);
lbFileCtrl->insertItem(text);
ctrlFileList.append(i);
}*/
// set default in names
/* FIXME
switch (file->in_count)
{
case 1:
inputNames.append("I");
break;
case 2:
inputNames.append("IL");
inputNames.append("IR");
break;
case 4:
inputNames.append("IL");
inputNames.append("IR");
inputNames.append("IRL");
inputNames.append("IRR");
break;
case 6:
inputNames.append("IL");
inputNames.append("IR");
inputNames.append("IRL");
inputNames.append("IRR");
inputNames.append("IC");
inputNames.append("ILFE");
break;
default:
for (i = 0; i < file->in_count; i++)
inputNames.append("");
break;
}
// set default out names
switch (file->out_count)
{
case 1:
outputNames.append("O");
break;
case 2:
outputNames.append("OL");
outputNames.append("OR");
break;
case 4:
outputNames.append("OL");
outputNames.append("OR");
outputNames.append("ORL");
outputNames.append("ORR");
break;
case 6:
outputNames.append("OL");
outputNames.append("OR");
outputNames.append("ORL");
outputNames.append("ORR");
outputNames.append("OC");
outputNames.append("OLFE");
break;
default:
for (i = 0; i < file->out_count; i++)
outputNames.append("");
break;
}
for (i = 0; i < file->in_count; i++)
{
lbInputs->insertItem(inputNames[i]);
RouteInfo r;
inRoutes.append(r);
lbConnInputs->insertItem(getRouteName(false, i));
}
for (i = 0; i < file->out_count; i++)
{
lbOutputs->insertItem(outputNames[i]);
RouteInfo r;
outRoutes.append(r);
lbConnOutputs->insertItem(getRouteName(true, i));
}
*/
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
connect(lbInputs, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(inputsDoubleClicked(QListBoxItem *)));
connect(lbOutputs, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(outputsDoubleClicked(QListBoxItem *)));
/*connect(pbCtrlAdd, SIGNAL(clicked()), this, SLOT(ctrlAddClicked()));
connect(pbCtrlDel, SIGNAL(clicked()), this, SLOT(ctrlDelClicked()));
connect(lbLoadedCtrl, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(loadedDoubleClicked(QListBoxItem *)));
connect(lbFileCtrl, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(fileDoubleClicked(QListBoxItem *)));
*/
connect(lbConnInputs, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(connInputsDoubleClicked(QListBoxItem *)));
connect(lbConnOutputs, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(connOutputsDoubleClicked(QListBoxItem *)));
/*
connect(cbInsertInRep, SIGNAL(stateChanged(int)), this, SLOT(insertInRepStateChanged(int)));
connect(rbArchBoth, SIGNAL(clicked()), this, SLOT(archBothClicked()));
connect(rbArchEmu10k1, SIGNAL(clicked()), this, SLOT(archEmu10k1Clicked()));
connect(rbArchEmu10k2, SIGNAL(clicked()), this, SLOT(archEmu10k2Clicked()));
tabRepository2->setEnabled(false);*/
}
/*QString LoadPatchDlg::getName(int i)
{
EMU10k1CtrlReg *ctrl;
ctrl = &(file->ctrls[i]);
QString name = QString(ctrl->name) + " - " + QString().setNum(ctrl->value) +
" (" + QString().setNum(ctrl->min) + "," + + QString().setNum(ctrl->max) + ")";
return name;
}*/
/*QString LoadPatchDlg::getRouteName(bool output, int i)
{
QString name;
RouteInfo ri;
if (output)
{
name = outputNames[i];
ri = outRoutes[i];
}
else
{
name = inputNames[i];
ri = inRoutes[i];
}
switch (ri.io)
{
case RouteInfo::None:
break;
case RouteInfo::FX:
name += QString(" -> FX:") + global->Registers.at(ri.reg)->name();
break;
case RouteInfo::In:
name += QString(" -> In:") + global->Registers.at(ri.reg)->name();
break;
case RouteInfo::Out:
name += QString(" -> Out:") + global->Registers.at(ri.reg)->name();
break;
case RouteInfo::PatchIn:
case RouteInfo::PatchOut:
StrPatch *patch = global->Patches.at(ri.patch);
if (ri.io == RouteInfo::PatchIn)
name += QString(" -> In:") + patch->name() + "-" + patch->Registers.at(ri.reg)->name();
else
name += QString(" -> Out:") + patch->name() + "-" + patch->Registers.at(ri.reg)->name();
break;
}
return name;
}*/
void PatchDlg::okClicked()
{
// update routing and rename patch
done(Accepted);
}
void PatchDlg::cancelClicked()
{
done(Rejected);
}
void PatchDlg::inputsDoubleClicked(QListBoxItem *item)
{
/*bool ok;
int idx = lbInputs->index(item);
QString text = inputNames[idx];
text = QInputDialog::getText(
APP_NAME, "Input name:", QLineEdit::Normal,
text, &ok, this );
if (ok && !text.isEmpty())
{
inputNames[idx] = text;
lbInputs->changeItem(text, idx);
lbConnInputs->changeItem(getRouteName(false, idx), idx);
}*/
}
void PatchDlg::outputsDoubleClicked(QListBoxItem *item)
{
/*bool ok;
int idx = lbOutputs->index(item);
QString text = outputNames[idx];
text = QInputDialog::getText(
APP_NAME, "Output name:", QLineEdit::Normal,
text, &ok, this );
if (ok && !text.isEmpty())
{
outputNames[idx] = text;
lbOutputs->changeItem(text, idx);
lbConnOutputs->changeItem(getRouteName(false, idx), idx);
}*/
}
void PatchDlg::connInputsDoubleClicked(QListBoxItem *item)
{
/*int idx = lbConnInputs->index(item);
RouteInfo ri = inRoutes[idx];
ConnectionWizard d(false, global, &ri);
if (d.exec() == QDialog::Accepted)
{
inRoutes[idx] = ri;
lbConnInputs->changeItem(getRouteName(false, idx), idx);
}
*/
}
void PatchDlg::connOutputsDoubleClicked(QListBoxItem *item)
{
/*int idx = lbConnOutputs->index(item);
RouteInfo ri = outRoutes[idx];
ConnectionWizard d(true, global, &ri);
if (d.exec() == QDialog::Accepted)
{
outRoutes[idx] = ri;
lbConnOutputs->changeItem(getRouteName(true, idx), idx);
}*/
}
/*LD10k1Route LoadPatchDlg::getRoute(bool out, int idx)
{
RouteInfo *route;
if (out)
route = &(outRoutes[idx]);
else
route = &(inRoutes[idx]);
LD10k1Route nroute;
nroute.PatchTo = route->patch;
nroute.Multi = route->multi;
if (route->patch >= 0 && route->reg >= 0)
{
StrPatch *patch = global->Patches.at(route->patch);
StrRegister *reg = patch->Registers.at(route->reg);
nroute.RegTo = reg->idx();
}
else if (route->reg >= 0)
{
StrRegister *reg = global->Registers.at(route->reg);
nroute.RegTo = reg->phIdx();
}
else
{
nroute.RegTo = -1;
}
return nroute;
}
*/

79
qlo10k1/src/patchdialog.h Normal file
View file

@ -0,0 +1,79 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef PATCHDIALOG_H
#define PATCHDIALOG_H
#include "dlgs/patchdialogbase.h"
#include "strglobal.h"
class PatchDlg : public PatchDialogBase
{
Q_OBJECT
StrGlobal *global;
/*EMU10k1File *file;
QString fileName;*/
QStringList inputNames;
QStringList outputNames;
/*QValueList <int> ctrlFileList;
QValueList <TranslatedCtrl> translatedList;
QValueList <RouteInfo> inRoutes;
QValueList <RouteInfo> outRoutes;*/
//LD10k1Route getRoute(bool out, int idx);
StrPatch *patch;
public:
PatchDlg(StrGlobal *glob, StrPatch *p);
QString getName(int i);
QString getRouteName(bool output, int i);
/*void enableSBLive(bool en);
void enableAudigy(bool en);
void transformFile(LD10k1File **outFile, QValueList <LD10k1Route> *routes);*/
public slots:
void okClicked();
void cancelClicked();
void inputsDoubleClicked(QListBoxItem *item);
void outputsDoubleClicked(QListBoxItem *item);
/*void ctrlAddClicked();
void ctrlDelClicked();
void loadedDoubleClicked(QListBoxItem *item);
void fileDoubleClicked(QListBoxItem *item);*/
void connInputsDoubleClicked(QListBoxItem *item);
void connOutputsDoubleClicked(QListBoxItem *item);
/*void insertInRepStateChanged(int state);
void archBothClicked();
void archEmu10k1Clicked();
void archEmu10k2Clicked();*/
};
#endif // PATCHDIALOG_H

175
qlo10k1/src/preferences.cpp Normal file
View file

@ -0,0 +1,175 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qgroupbox.h>
#include <qmessagebox.h>
#include <qinputdialog.h>
#include <qlineedit.h>
#include "preferences.h"
#include "app_global.h"
#include "strparam.h"
PreferencesDlg::PreferencesDlg(StrCardGlobal *glob)
{
global = glob;
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
connect(lbCards, SIGNAL(highlighted(int)), this, SLOT(cardHighlighted(int)));
connect(pbUpdate, SIGNAL(clicked()), this, SLOT(updateClicked()));
connect(pbCardAdd, SIGNAL(clicked()), this, SLOT(cardAddClicked()));
connect(pbCardDel, SIGNAL(clicked()), this, SLOT(cardDelClicked()));
// copy card list
for (unsigned int i = 0; i < global->Cards.count(); i++)
cards.append(new CardParam(global->Cards.at(i)));
refreshListBox();
if (cards.count() > 1)
pbCardDel->setEnabled(true);
repDirSystem = global->RepDirSystem;
repDirUser = global->RepDirUser;
leRepSystem->setText(repDirSystem);
leRepUser->setText(repDirUser);
}
void PreferencesDlg::okClicked()
{
unsigned int i;
CardParam *card;
for (i = 0; i < cards.count(); i++)
{
// test connection
card = cards.at(i);
if (card->testConnection())
{
// error
QMessageBox::critical( 0, APP_NAME,
QString("Couldn't connect to socket %1 for card %2").arg(card->CardSocket).arg(card->CardName));
return;
}
}
// copy values to global
global->Cards.clear();
for (i = 0; i < cards.count(); i++)
global->Cards.append(new CardParam(cards.at(i)));
global->RepDirSystem = repDirSystem;
global->RepDirUser = repDirUser;
done(Accepted);
}
void PreferencesDlg::cancelClicked()
{
done(Rejected);
}
void PreferencesDlg::refreshListBox(void)
{
lbCards->clear();
CardParam *card;
QString desc;
for (unsigned int i = 0; i < cards.count() ;i++)
{
card = cards.at(i);
desc = card->CardName + " - " + card->CardSocket;
lbCards->insertItem(desc);
}
}
void PreferencesDlg::refreshListBox(int idx)
{
CardParam *card;
QString desc;
card = cards.at(idx);
desc = card->CardName + " - " + card->CardSocket;
lbCards->changeItem(desc, idx);
}
void PreferencesDlg::cardHighlighted(int index)
{
CardParam *card;
if (index >= 0 && (unsigned int)index < cards.count())
{
card = cards.at(index);
leCardName->setText(card->CardName);
leCardSocket->setText(card->CardSocket);
gbCard->setEnabled(true);
}
else
{
leCardName->setText("");
leCardSocket->setText("");
gbCard->setEnabled(false);
}
}
void PreferencesDlg::updateClicked()
{
int idx = lbCards->currentItem();
if (idx >=0 && (unsigned int)idx < cards.count())
{
CardParam *card;
card = cards.at(idx);
card->CardName = leCardName->text();
card->CardSocket = leCardSocket->text();
refreshListBox(idx);
}
}
void PreferencesDlg::cardAddClicked()
{
CardParam *card = new CardParam();
card->CardName = "Default card";
card->CardSocket = "/tmp/.ld10k1_port";
cards.append(card);
refreshListBox();
}
void PreferencesDlg::cardDelClicked()
{
int idx = lbCards->currentItem();
if (idx >= 0)
{
cards.remove(idx);
if (cards.count() <= 1)
pbCardDel->setEnabled(false);
refreshListBox();
}
}

56
qlo10k1/src/preferences.h Normal file
View file

@ -0,0 +1,56 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef PREFERENCES_H
#define PREFERENCES_H
#include <qptrlist.h>
#include "dlgs/preferencesbase.h"
#include "strglobal.h"
class PreferencesDlg : public PreferencesBase
{
Q_OBJECT
StrCardGlobal *global;
QPtrList <CardParam> cards;
QString repDirSystem;
QString repDirUser;
public:
PreferencesDlg(StrCardGlobal *glob);
void refreshListBox(void);
void refreshListBox(int idx);
void refreshRepListBox(void);
void refreshRepListBox(int idx);
public slots:
void cardHighlighted(int index);
void okClicked();
void cancelClicked();
void updateClicked();
void cardAddClicked();
void cardDelClicked();
};
#endif // PREFERENCES_H

File diff suppressed because it is too large Load diff

170
qlo10k1/src/routingwidget.h Normal file
View file

@ -0,0 +1,170 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef ROUTINGWIDGET_H
#define ROUTINGWIDGET_H
#include <qwidget.h>
#include <qlayout.h>
#include <qscrollview.h>
#include "custom_colors.h"
class RoutingWidget;
class QPushButton;
class QSpinBox;
class StrGlobal;
class RSItemBaseWithType;
class RSItemIO;
class RoutingDrawWidget : public QScrollView
{
Q_OBJECT
enum EditMode {None, Select, ResizeTopLeft, ResizeTopRight, ResizeBottomLeft, ResizeBottomRight, HandleMove, Move, DragLink};
EditMode mode;
// for select
QPoint selectStartPoint;
QPoint selectEndPoint;
RSItemBaseWithType *resizeItem;
int linkHandle;
RSItemIO *linkStart;
QFont titleFont;
public:
RoutingDrawWidget(RoutingWidget *parent = 0, const char *name = 0, WFlags f = 0);
~RoutingDrawWidget();
void startLinkDrag(RSItemIO *si, int xp, int yp);
void updateDragLink();
void stopLinkDrag();
void connectLinkDrag(int xp, int yp, int mxp, int myp);
bool isDragLink()
{
return mode == DragLink;
}
void deleteAllSelected();
void deleteOneSelected(RSItemBaseWithType *item);
QFont &createFont(float zoom);
protected:
void drawContents(QPainter* p, int cx, int cy, int cw, int ch);
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
};
class RoutingWidget : public QWidget
{
Q_OBJECT
public:
enum EditMode {Normal, FX, In, Out, Route, Effect, EffectStack};
enum MenuMode {MenuNone, MenuObjects, MenuIO, MenuPatch, MenuLink};
private:
RoutingDrawWidget *drawing;
QVBoxLayout *RoutingWidgetLayout;
EditMode widgetMode;
void untoggleMode(EditMode m);
void toggleMode(EditMode m);
QPushButton *pbRoutingNormal;
QPushButton *pbRoutingFX;
QPushButton *pbRoutingIn;
QPushButton *pbRoutingOut;
QPushButton *pbRoutingRoute;
QPushButton *pbRoutingEffect;
QPushButton *pbRoutingEffectStack;
QSpinBox *sbRoutingZoom;
float zoomLevel;
StrGlobal *structure;
RSItemBaseWithType *itemOn;
int posXOn;
int posYOn;
public:
RoutingWidget(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
~RoutingWidget();
void createButtons();
StrGlobal *getStructure()
{
return structure;
}
RoutingDrawWidget *getDrawing()
{
return drawing;
}
void refreshDrawing(StrGlobal *str);
void setZoomLevel(float level);
float getZoomLevel();
int zoomVal(int val)
{
return (int)(getZoomLevel() * (float)val);
};
int deZoomVal(int val)
{
return (int)((float)val / getZoomLevel());
};
void updateZoomLevelCtrl(int level);
EditMode getWidgetMode();
void putNewObjectAt(int xp, int yp);
RSItemBaseWithType *createNewIO(EditMode em);
RSItemBaseWithType *createNewPatch();
void startLinkDrag(int xp, int yp);
void openObjectMenuAt(RSItemBaseWithType *item, MenuMode mm, int xp, int yp, int mxp, int myp);
friend class RoutingDrawWidget;
public slots:
void modeNormalClicked();
void modeFxClicked();
void modeInClicked();
void modeOutClicked();
void modeRouteClicked();
void modeEffectClicked();
void modeEffectStackClicked();
void zoomValueChanged(int value);
void zoomInClicked();
void zoomOutClicked();
};
#endif // ROUTINGWIDGET_H

View file

@ -0,0 +1,226 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <qfiledialog.h>
#include "app_global.h"
#include "routingwidget.h"
#include "structure.h"
#include "structure_io.h"
#include "structure_link.h"
#include "structure_patch.h"
#include "strglobal.h"
#include "ld10k1file.h"
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};
if (mm == MenuNone)
{
contextMenu->insertItem(tr("&Refresh"), Refresh);
//contextMenu->insertItem(tr("&AutoArange")/*, this, SLOT(menuQuitActivated(int))*/);
contextMenu->insertItem(tr("&Clear DSP"), ClearDSP);
}
else if (mm == MenuObjects)
{
contextMenu->insertItem(tr("&Delete (Unload)"), Delete);
}
else if (mm == MenuIO)
{
//contextMenu->insertItem(tr("&Rename"), Rename);
bool isConnected = false;
if (item->type() == RSItemBaseWithType::Out)
isConnected = item->getIO(false, 0)->getConnectedTo() != NULL;
else
isConnected = item->getIO(true, 0)->getConnectedTo() != NULL;
if (isConnected)
contextMenu->insertItem(tr("D&isconnect"), Disconnect);
contextMenu->insertSeparator();
contextMenu->insertItem(tr("&Delete"), Delete);
}
else if (mm == MenuLink)
{
int pn = item->getHandlePointNum(xp, yp);
if (pn > 0)
contextMenu->insertItem(tr("D&elete point"), DelPoint);
else if (pn < 0)
contextMenu->insertItem(tr("A&dd point"), AddPoint);
contextMenu->insertItem(tr("D&isconnect"), Disconnect);
contextMenu->insertSeparator();
contextMenu->insertItem(tr("&Delete"), Delete);
}
else if (mm == MenuPatch)
{
//contextMenu->insertItem(tr("&Rename"), Rename);
RSItemIO *io = item->getIOAtPoint(xp, yp);
if (io)
{
//contextMenu->insertItem(tr("&IO Rename"), Rename);
if (io->getConnectedTo())
contextMenu->insertItem(tr("D&isconnect"), Disconnect);
else
contextMenu->insertItem(tr("&Connect"), Connect);
}
else
contextMenu->insertItem(tr("&Save"), Save);
contextMenu->insertSeparator();
contextMenu->insertItem(tr("&Unload"), Delete);
}
int id = contextMenu->exec(QPoint(mxp, myp));
delete contextMenu;
if (id < 0)
return;
if (id == AddPoint)
{
StrLink *l = (StrLink *)item;
if (l->addSegmentPoint(xp, yp))
{
l->updateContents(drawing, getZoomLevel());
}
}
else if (id == DelPoint)
{
StrLink *l = (StrLink *)item;
// FIXME - update before del
l->updateContents(drawing, getZoomLevel());
l->delSegmentPoint(l->getHandlePointNum(xp, yp));
l->calcSize();
}
else if (id == Delete)
{
drawing->deleteAllSelected();
}
else if (id == Connect)
{
StrPatch *p = (StrPatch *)item;
RSItemIO *pio = p->getIOAtPoint(xp, yp);
if (pio)
drawing->startLinkDrag(pio, xp, yp);
}
else if (id == Disconnect)
{
RSItemIO *io = NULL;
if (item->type() == RSItemBaseWithType::Patch)
{
int err;
StrPatch *p = (StrPatch *)item;
io = p->getIOAtPoint(xp, yp);
StrLink *l = io->getConnectedTo();
// FIXME - update before disconnect
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)));
}
else
{
if (item->type() == RSItemBaseWithType::In)
{
StrInput *in = (StrInput *)item;
io = in->getIO(true, 0);
}
else if (item->type() == RSItemBaseWithType::Out)
{
StrOutput *out = (StrOutput *)item;
io = out->getIO(false, 0);
}
if (item->type() == RSItemBaseWithType::FX)
{
StrFX *fx = (StrFX *)item;
io = fx->getIO(true, 0);
}
StrLink *l = io->getConnectedTo();
structure->deleteOneLink(l);
drawing->updateContents();
}
}
else if (id == ClearDSP)
{
structure->clearDSP();
drawing->updateContents();
}
else if (id == Refresh)
{
structure->loadFromLD();
drawing->updateContents();
}
else if (id == Save)
{
StrPatch *p = (StrPatch *)item;
int err;
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
fd->setMode(QFileDialog::AnyFile);
fd->setFilter("Patch (*.ld10k1)");
fd->setCaption("Save patch");
QString fileName;
if (fd->exec() == QDialog::Accepted)
{
fileName = fd->selectedFile();
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)
return;
}
LD10k1File *pf = NULL;
if ((err = structure->get(p->num(), &pf)) < 0)
{
QMessageBox::critical(0, APP_NAME, QString("Couldn't get patch !\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
return;
}
if ((err = pf->SaveToFile(fileName)) < 0)
QMessageBox::critical(0, APP_NAME, QString("Couldn't save patch\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
delete pf;
}
else
delete fd;
}
}

View file

@ -0,0 +1,293 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qfiledialog.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include "app_global.h"
#include "routingwidget.h"
#include "structure_io.h"
#include "structure_link.h"
#include "newiodialog.h"
#include "loadpatchdialog.h"
#include "transformpatchdialog.h"
RSItemBaseWithType *RoutingWidget::createNewIO(EditMode em)
{
// show io dialog
NewIODlg::DlgType t = NewIODlg::FX;
switch (em)
{
case FX:
t = NewIODlg::FX;
break;
case In:
t = NewIODlg::In;
break;
case Out:
t = NewIODlg::Out;
break;
default:
break;
}
NewIODlg d(structure, t);
if (d.exec() == QDialog::Accepted)
return d.getNewIO();
else
return NULL;
}
RSItemBaseWithType *RoutingWidget::createNewPatch()
{
QFileDialog *fd = new QFileDialog(this, "file dialog", TRUE);
fd->setMode(QFileDialog::ExistingFile);
fd->setFilter("Patches (*.emu10k1 *.ld10k1)");
fd->setCaption("Load patch");
StrPatch *loaded = NULL;
int err;
QString fileName;
if ( fd->exec() == QDialog::Accepted )
{
fileName = fd->selectedFile();
delete fd;
LD10k1File *ldfile = NULL;
if (fileName.endsWith(".emu10k1"))
{
EMU10k1File *emufile = NULL;
if ((err = EMU10k1File::LoadFromFile(fileName, &emufile)) < 0)
{
QMessageBox::critical(0, APP_NAME, QString("Couldn't load patch\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
return NULL;
}
else
{
TransformPatchDlg d(fileName, emufile);
if (d.exec() == QDialog::Accepted)
{
if ((err = d.transformFile(&ldfile)) < 0)
{
QMessageBox::critical(0, APP_NAME, QString("Couldn't transform patch\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
delete emufile;
return NULL;
}
delete emufile;
}
else
{
delete emufile;
return NULL;
}
}
}
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);
if (d.exec() == QDialog::Accepted)
{
// and now convert to loader
StrPatch *loaded = NULL;
if ((err = structure->load(ldfile, d.whereLoad(), &loaded)) < 0) {
QMessageBox::critical(0, APP_NAME, QString("Couldn't load patch\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
delete ldfile;
return NULL;
}
else
{
loaded->calcSize();
loaded->updateContents(this->drawing, getZoomLevel());
}
}
delete ldfile;
}
return loaded;
}
void RoutingWidget::startLinkDrag(int xp, int yp)
{
// find patch under - only on patch can start drag
RSItemBaseWithType *item = NULL;
for(item = structure->UsedItems.first(); item; item = structure->UsedItems.next())
{
if (item->containsPoint(xp, yp) && item->type() == RSItemBaseWithType::Patch)
{
// I have patch - find io
RSItemIO *pio = ((StrPatch *)item)->getIOAtPoint(xp, yp);
if (pio)
{
drawing->startLinkDrag(pio, xp, yp);
return;
}
}
}
}
void RoutingDrawWidget::connectLinkDrag(int xp, int yp, int mxp, int myp)
{
RoutingWidget *parent = (RoutingWidget *)parentWidget();
StrGlobal *structure = parent->getStructure();
if (!structure)
return;
RSItemBaseWithType *item = NULL;
for(item = structure->UsedItems.first(); item; item = structure->UsedItems.next())
{
if (item->containsPoint(xp, yp))
{
// I have patch - find io
RSItemIO *pio = NULL;
if (item->type() == RSItemBaseWithType::Patch)
pio = ((StrPatch *)item)->getIOAtPoint(xp, yp);
else if (item->type() == RSItemBaseWithType::In)
pio = ((StrInput *)item)->getIO(true, 0);
else if (item->type() == RSItemBaseWithType::Out)
pio = ((StrInput *)item)->getIO(false, 0);
else if (item->type() == RSItemBaseWithType::FX)
pio = ((StrFX *)item)->getIO(true, 0);
if (pio)
{
// check if connecting in to out or out to in
if (pio->isOutput() != linkStart->isOutput())
{
if (pio->getConnectedTo() == linkStart->getConnectedTo() && pio->getConnectedTo() && linkStart->getConnectedTo())
return;
if (pio->getOwner() == linkStart->getOwner())
return;
QPopupMenu *contextMenu = new QPopupMenu();
enum Action {Normal, SimpleMulti, Simple, Multi};
contextMenu->insertItem(tr("&Normal"), Normal);
contextMenu->insertItem(tr("&Multi"), Multi);
if (((RSItemBaseWithType *)pio->getOwner())->type() == RSItemBaseWithType::Patch)
contextMenu->insertItem(tr("S&imple"), Simple);
contextMenu->insertItem(tr("&Simple + Multi"), SimpleMulti);
int id = contextMenu->exec(QPoint(mxp, myp));
if (id < 0)
return;
int conn_id;
int err;
QValueList <int> actIds;
actIds.clear();
StrLink *linkTo = pio->getConnectedTo();
if (linkTo && actIds.findIndex(linkTo->id()) < 0)
actIds.append(linkTo->id());
StrLink *linkFrom = linkStart->getConnectedTo();
if (linkFrom && actIds.findIndex(linkFrom->id()) < 0)
actIds.append(linkFrom->id());
if (id == Normal && linkTo && ((RSItemBaseWithType *)pio->getOwner())->type() != RSItemBaseWithType::Patch)
{
if ((err = structure->deleteOneLink(linkTo)) < 0)
QMessageBox::critical(0, APP_NAME, QString("Couldn't disconnect !\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
}
if ((err = structure->conAdd(id != Simple && id != Normal,
id != Multi && id != Normal,
linkStart, pio, &conn_id)) < 0)
QMessageBox::critical(0, APP_NAME, QString("Couldn't connect !\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
else
{
if (actIds.findIndex(conn_id) < 0)
actIds.append(conn_id);
if (linkFrom)
linkFrom->updateContents(this, parent->getZoomLevel());
if (linkTo)
linkTo->updateContents(this, parent->getZoomLevel());
for (unsigned int i = 0; i < actIds.count(); i++)
{
StrLink *link = NULL;
int aid = actIds[i];
if ((err = structure->actualizeLink(aid, &link)) < 0 && aid == conn_id)
QMessageBox::critical(0, APP_NAME, QString("Couldn't actualize link !\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
if (link)
{
if (!link->isValid())
structure->destroyLink(link);
else
{
//wasn't error
link->calcSize();
link->updateContents(this, parent->getZoomLevel());
}
}
}
stopLinkDrag();
parent->modeNormalClicked();
}
delete contextMenu;
return;
}
return;
}
}
}
}
void RoutingDrawWidget::deleteAllSelected()
{
// through all selected
RoutingWidget *parent = (RoutingWidget *)parentWidget();
StrGlobal *structure = parent->getStructure();
int err;
if (!structure)
return;
if ((err = structure->deleteAllSelected()) < 0)
QMessageBox::critical(0, APP_NAME, QString("Couldn't delete selected items !\n(ld10k1 error:%1)").arg(structure->errorStr(err)));
this->updateContents();
}

1038
qlo10k1/src/strglobal.cpp Normal file

File diff suppressed because it is too large Load diff

112
qlo10k1/src/strglobal.h Normal file
View file

@ -0,0 +1,112 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef STRGLOBAL_H
#define STRGLOBAL_H
#include <qstring.h>
#include <qptrlist.h>
class StrGlobal;
class StrInput;
class StrOutput;
class StrFX;
class StrLink;
class StrPatch;
class RSItemBaseWithType;
class RSItemIO;
class CardParam;
class LD10k1File;
class LD10k1DspFile;
class StrGlobal
{
public:
CardParam *Card;
QPtrList <StrInput> Inputs;
QPtrList <StrOutput> Outputs;
QPtrList <StrFX> FXs;
QPtrList <StrLink> Links;
QPtrList <StrPatch> Patches;
StrGlobal(CardParam *card);
~StrGlobal(void);
void clear(void);
void clearFlags(void);
int loadFromLD(void);
StrPatch *findPatchByNum(int num);
StrPatch *findPatchById(int id);
StrFX *findFXByNum(int num);
StrInput *findInputByNum(int num);
StrOutput *findOutputByNum(int num);
StrLink *findLinkById(int id);
int load(LD10k1File *ld10k1file, StrPatch *before, StrPatch **loaded);
int get(int patch_num, LD10k1File **dc);
int unload(StrPatch *p);
int conAdd(bool multi, bool simple, RSItemIO *from_io, RSItemIO *to_io, int *id);
int conDel(RSItemIO *from_io, int *id);
QString errorStr(int err);
QPtrList <RSItemBaseWithType> UsedItems;
int getPio(int pnum, bool out, int idx, QString &name);
int actualizeLink(int id, StrLink **out);
int actualizePatch(int pid, int pnum, QString pname, StrPatch **out);
void destroyLink(StrLink *l);
int disconnectFromLink(RSItemIO *io);
RSItemIO *findPatchIO(bool out, int pid, int ionum);
int clearDSP(void);
static void AutoArange(QPtrList <RSItemBaseWithType> *items);
void updatePatchesOrder(void);
int deleteOneLink(StrLink *l);
int deleteOneFX(StrFX *fx);
int deleteOneIn(StrInput *in);
int deleteOneOut(StrOutput *out);
int deleteOnePatch(StrPatch *p);
int deleteOneItem(RSItemBaseWithType *item);
int deleteAllSelected();
int getDspConfig(LD10k1DspFile **dc);
int putDspConfig(LD10k1DspFile *dc);
};
class StrCardGlobal
{
public:
QPtrList <CardParam> Cards;
QString RepDirSystem;
QString RepDirUser;
StrCardGlobal();
};
#endif // STRGLOBAL_H

314
qlo10k1/src/strparam.cpp Normal file
View file

@ -0,0 +1,314 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <lo10k1/lo10k1.h>
#include "strglobal.h"
#include "strparam.h"
#include "ld10k1file.h"
class CardParamPrivate
{
public:
liblo10k1_connection_t card_conn;
liblo10k1_connection_t *conn()
{
return &card_conn;
}
};
CardParam::CardParam(void)
{
prv = new CardParamPrivate();
liblo10k1_connection_init(prv->conn());
Structure = NULL;
}
CardParam::~CardParam(void)
{
disconnect();
if (Structure)
delete Structure;
delete prv;
}
StrGlobal *CardParam::getStructure()
{
Structure = new StrGlobal(this);
return Structure;
}
int CardParam::disconnect(void)
{
if (liblo10k1_is_open(prv->conn()))
return liblo10k1_disconnect(prv->conn());
return 0;
}
int CardParam::isConnected(void)
{
return liblo10k1_is_open(prv->conn());
}
int CardParam::clearDSP(void)
{
return liblo10k1_dsp_init(prv->conn());
}
int CardParam::testConnection(void)
{
int err = connect();
if (err < 0)
return err;
disconnect();
return 0;
}
int CardParam::connect(void)
{
int err;
if (liblo10k1_is_open(prv->conn()))
disconnect();
liblo10k1_param params;
const char *tmp = NULL;
tmp = CardSocket;
params.wfc = 500; // FIXME - user selectable
params.type = COMM_TYPE_LOCAL; // FIXME
params.server = 0;
params.name = (char *)tmp;
params.port = 0;
if ((err = liblo10k1_connect(&params, prv->conn())) < 0)
return err;
return liblo10k1_check_version(prv->conn());
}
int CardParam::load(LD10k1File *ld10k1file, int before, int *loaded, int *loaded_id)
{
int err;
liblo10k1_dsp_patch_t *patch = ld10k1file->getLD10k1Format();
err = liblo10k1_patch_load(prv->conn(), patch, before, loaded, loaded_id);
return err;
}
int CardParam::unload(int num)
{
return liblo10k1_patch_unload(prv->conn(), num);
}
int CardParam::get(int patch_num, LD10k1File **ld10k1file)
{
liblo10k1_dsp_patch_t *patch;
int err;
if ((err = liblo10k1_patch_get(prv->conn(), patch_num, &patch)) < 0)
return err;
LD10k1File *tmp = new LD10k1File();
tmp->setLD10k1Format(patch);
*ld10k1file = tmp;
return 0;
}
int CardParam::conAdd(bool multi, bool simple, int from_type, int from_patch, int from_io, int to_type,int to_patch, int to_io, int *id)
{
return liblo10k1_con_add(prv->conn(), multi, simple, from_type, from_patch, from_io, to_type, to_patch, to_io, id);
}
int CardParam::conDel(int from_type, int from_patch, int from_io, int *id)
{
return liblo10k1_con_del(prv->conn(), from_type, from_patch, from_io, id);
}
int CardParam::getPointsInfo(int **out, int *count)
{
return liblo10k1_get_points_info(prv->conn(), out, count);
}
int CardParam::getPointInfo(int point_id, CardParamPointInfo *out)
{
int err;
liblo10k1_point_info_t pi;
if ((err = liblo10k1_get_point_info(prv->conn(), point_id, &pi)) < 0)
return err;
out->id = pi.id;
out->type = pi.type;
out->io_idx = pi.io_idx;
out->simple = pi.simple;
out->multi = pi.multi;
out->conn_count = pi.conn_count;
for (int i = 0; i < POINTINFO_MAX_CONN_PER_POINT; i++)
{
out->io_type[i] = pi.io_type[i];
out->patch[i] = pi.patch[i];
out->io[i] = pi.io[i];
}
return 0;
}
QString CardParam::errorStr(int err)
{
return QString(liblo10k1_error_str(err));
}
CardParam::CardParam(CardParam *from)
{
prv = new CardParamPrivate();
liblo10k1_connection_init(prv->conn());
CardName = from->CardName;
CardSocket = from->CardSocket;
};
int CardParam::getFXCount(int *cnt)
{
return liblo10k1_get_fx_count(prv->conn(), cnt);
}
int CardParam::getInputCount(int *cnt)
{
return liblo10k1_get_in_count(prv->conn(), cnt);
}
int CardParam::getOutputCount(int *cnt)
{
return liblo10k1_get_out_count(prv->conn(), cnt);
}
int CardParam::getFX(int i, QString &name)
{
liblo10k1_get_io_t ld_tmp;
int err = 0;
if ((err = liblo10k1_get_fx(prv->conn(), i, &ld_tmp)) < 0)
return err;
name = ld_tmp.name;
return 0;
}
int CardParam::getInput(int i, QString &name)
{
liblo10k1_get_io_t ld_tmp;
int err = 0;
if ((err = liblo10k1_get_in(prv->conn(), i, &ld_tmp)) < 0)
return err;
name = ld_tmp.name;
return 0;
}
int CardParam::getOutput(int i, QString &name)
{
liblo10k1_get_io_t ld_tmp;
int err = 0;
if ((err = liblo10k1_get_out(prv->conn(), i, &ld_tmp)) < 0)
return err;
name = ld_tmp.name;
return 0;
}
int CardParam::getPInputCount(int pnum, int *cnt)
{
return liblo10k1_get_pin_count(prv->conn(), pnum, cnt);
}
int CardParam::getPOutputCount(int pnum, int *cnt)
{
return liblo10k1_get_pout_count(prv->conn(), pnum, cnt);
}
int CardParam::getPInput(int pnum, int i, QString &name)
{
liblo10k1_get_io_t ld_tmp;
int err = 0;
if ((err = liblo10k1_get_pin(prv->conn(), pnum, i, &ld_tmp)) < 0)
return err;
name = ld_tmp.name;
return 0;
}
int CardParam::getPOutput(int pnum, int i, QString &name)
{
liblo10k1_get_io_t ld_tmp;
int err = 0;
if ((err = liblo10k1_get_pout(prv->conn(), pnum, i, &ld_tmp)) < 0)
return err;
name = ld_tmp.name;
return 0;
}
int CardParam::getPatchesInfo(CardParamPatchInfo ***pi, int *cnt)
{
liblo10k1_patches_info_t *ld_patches;
int err;
CardParamPatchInfo **tmppi = NULL;
*pi = NULL;
if ((err = liblo10k1_get_patches_info(prv->conn(), &ld_patches, cnt)) < 0)
return err;
tmppi = new CardParamPatchInfo *[*cnt];
for (int i = 0; i < *cnt; i++)
{
tmppi[i] = new CardParamPatchInfo();
tmppi[i]->patch_num = ld_patches[i].patch_num;
tmppi[i]->id = ld_patches[i].id;
tmppi[i]->patch_name = ld_patches[i].patch_name;
}
free(ld_patches);
*pi = tmppi;
return 0;
}
int CardParam::getDspConfig(LD10k1DspFile **dc)
{
liblo10k1_file_dsp_setup_t *ds = NULL;
int err;
if ((err = liblo10k1lf_get_dsp_config(prv->conn(), &ds)) < 0)
return err;
LD10k1DspFile *ldc = new LD10k1DspFile();
ldc->setLD10k1DspFormat(ds);
*dc = ldc;
return 0;
}
int CardParam::putDspConfig(LD10k1DspFile *dc)
{
return liblo10k1lf_put_dsp_config(prv->conn(), dc->getLD10k1DspFormat());
}

104
qlo10k1/src/strparam.h Normal file
View file

@ -0,0 +1,104 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef STRPARAM_H
#define STRPARAM_H
#include <qstring.h>
class StrGlobal;
class LD10k1File;
class LD10k1DspFile;
class CardParamPrivate;
#define POINTINFO_MAX_CONN_PER_POINT 15
class CardParamPointInfo
{
public:
int id;
int type;
int io_idx;
int simple;
int multi;
unsigned int conn_count;
int io_type[POINTINFO_MAX_CONN_PER_POINT];
int patch[POINTINFO_MAX_CONN_PER_POINT];
int io[POINTINFO_MAX_CONN_PER_POINT];
};
class CardParamPatchInfo
{
public:
int patch_num;
int id;
QString patch_name;
};
class CardParam
{
CardParamPrivate *prv;
public:
QString CardName;
QString CardSocket;
StrGlobal *Structure;
CardParam(void);
CardParam(CardParam *from);
~CardParam(void);
StrGlobal *getStructure();
int connect(void);
int disconnect(void);
int isConnected(void);
int testConnection(void);
int clearDSP(void);
int load(LD10k1File *ld10k1file, int before, int *loaded, int *loaded_id);
int unload(int num);
int get(int patch_num, LD10k1File **ld10k1file);
int getPointsInfo(int **out, int *count);
int getPointInfo(int point_id, CardParamPointInfo *out);
int conAdd(bool multi, bool simple, int from_type, int from_patch, int from_io, int to_type, int to_patch, int to_io, int *id);
int conDel(int from_type, int from_patch, int from_io, int *id);
QString errorStr(int err);
int getFXCount(int *cnt);
int getInputCount(int *cnt);
int getOutputCount(int *cnt);
int getFX(int i, QString &name);
int getInput(int i, QString &name);
int getOutput(int i, QString &name);
int getPInputCount(int pnum, int *cnt);
int getPOutputCount(int pnum, int *cnt);
int getPInput(int pnum, int i, QString &name);
int getPOutput(int pnum, int i, QString &name);
int getPatchesInfo(CardParamPatchInfo ***pi, int *cnt);
int getDspConfig(LD10k1DspFile **dc);
int putDspConfig(LD10k1DspFile *dc);
};
#endif // STRPARAM_H

291
qlo10k1/src/structure.cpp Normal file
View file

@ -0,0 +1,291 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "structure.h"
#include "structure_patch.h"
#include "structure_io.h"
#include "structure_link.h"
#include "ld10k1file.h"
RSItemIO::RSItemIO(RSItemBase *o, bool out, int i, QString d)
{
output = out;
idx = i;
desc = d;
owner = o;
connectedTo = NULL;
}
RSItemIO::~RSItemIO()
{
if (connectedTo)
{
int r = connectedTo->findRoute(this);
if (r >= 0)
connectedTo->setRoutePoint(r, NULL);
}
}
bool RSItemIO::isOutput()
{
return output;
}
void RSItemIO::setOutput(bool o)
{
output = o;
}
int RSItemIO::getIdx()
{
return idx;
}
void RSItemIO::setIdx(int i)
{
idx = i;
}
QString RSItemIO::getDesc()
{
return desc;
}
void RSItemIO::setDesc(QString d)
{
desc = d;
}
RSItemBase *RSItemIO::getOwner()
{
return owner;
}
void RSItemIO::connectTo(StrLink *to)
{
if (connectedTo)
{
int r = connectedTo->findRoute(this);
if (r >= 0)
connectedTo->setRoutePoint(r, NULL);
}
connectedTo = to;
}
StrLink *RSItemIO::getConnectedTo()
{
return connectedTo;
}
DrawingParams::DrawingParams(float zoom, QWidget *dt, QPaintEvent *pe, QPainter *p)
{
zoomKoef = (float)zoom;
drawTo = dt;
paintEvent = pe;
painter = p;
}
RSItemBase::RSItemBase()
{
fNew = false;
fUsed = false;
fChanged = false;
fSelected = false;
}
int RSItemBase::x()
{
return position.x();
}
int RSItemBase::y()
{
return position.y();
}
void RSItemBase::setPosition(int x, int y)
{
if (x < 0)
x = 0;
if (y < 0)
y = 0;
position.setX(x);
position.setY(y);
}
int RSItemBase::width()
{
return size.width();
}
int RSItemBase::height()
{
return size.height();
}
int RSItemBase::minWidth()
{
return minSize.width();
}
int RSItemBase::minHeight()
{
return minSize.height();
}
void RSItemBase::setSize(int w, int h)
{
if (w > minSize.width())
size.setWidth(w);
if (h > minSize.height())
size.setHeight(h);
}
void RSItemBase::moveRel(int dx, int dy)
{
setPosition(x() + dx, y() + dy);
}
void RSItemBase::moveHandleRel(int num, int dx, int dy)
{
}
void RSItemBase::updateContents(QScrollView *sv, float zoom)
{
sv->updateContents((int)(x() * zoom),
(int)(y() * zoom),
(int)(width() * zoom),
(int)(height() * zoom));
}
bool RSItemBase::containsPoint(int xp, int yp)
{
return false;
}
RSItemIO *RSItemBase::getIOAtPoint(int xp, int yp)
{
return NULL;
}
bool RSItemBase::containsHandlePoint(int xp, int yp)
{
return false;
}
RSItemBase::RSItemHandle RSItemBase::getHandlePoint(int xp, int yp)
{
return RSItemBase::None;
}
int RSItemBase::getHandlePointNum(int xp, int yp)
{
return -1;
}
bool RSItemBase::flagUsed()
{
return fUsed;
}
void RSItemBase::setFlagUsed(bool u)
{
fUsed = u;
}
bool RSItemBase::flagNew()
{
return fNew;
}
void RSItemBase::setFlagNew(bool n)
{
fNew = n;
}
bool RSItemBase::flagChanged()
{
return fNew;
}
void RSItemBase::setFlagChanged(bool c)
{
fChanged = c;
}
bool RSItemBase::flagSelected()
{
return fSelected;
}
void RSItemBase::setFlagSelected(bool s)
{
fSelected = s;
}
QString RSItemBase::getDesc()
{
return "";
}
void RSItemBase::draw(DrawingParams *dp)
{
}
void RSItemBase::calcSize()
{
minSize = size;
}
RSItemBaseWithType::RSItemBaseWithType(ItemType type)
{
iType = type;
}
RSItemBaseWithType::ItemType RSItemBaseWithType::type()
{
return iType;
}
int RSItemBaseWithType::getMaxIOIdx(bool out)
{
return 0;
}
RSItemIO *RSItemBaseWithType::getIO(bool out, int idx)
{
return NULL;
}
void RSItemBaseWithType::getIOPoint(RSItemIO *item, int *xp, int *yp)
{
}
RSItemBaseWithType::~RSItemBaseWithType()
{
}

138
qlo10k1/src/structure.h Normal file
View file

@ -0,0 +1,138 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef STRUCTURE_H
#define STRUCTURE_H
#include <qstring.h>
#include <qstringlist.h>
#include <qptrlist.h>
#include <qwidget.h>
#include <qscrollview.h>
class RSItemBase;
class StrPatch;
class StrInput;
class StrOutput;
class StrFX;
class StrLink;
class RSItemIO
{
bool output;
int idx;
QString desc;
RSItemBase *owner;
StrLink *connectedTo;
public:
RSItemIO(RSItemBase *o, bool out, int i, QString d);
~RSItemIO();
bool isOutput();
void setOutput(bool o);
int getIdx();
void setIdx(int i);
QString getDesc();
void setDesc(QString d);
RSItemBase *getOwner();
void connectTo(StrLink *to);
StrLink *getConnectedTo();
};
class QWidget;
class QPainter;
class DrawingParams
{
public:
float zoomKoef;
DrawingParams(float zoom, QWidget *dt, QPaintEvent *pe, QPainter *p);
QWidget *drawTo;
QPaintEvent *paintEvent;
QPainter *painter;
};
class RSItemBase
{
public:
enum RSItemHandle {TopLeft, TopRight, BottomLeft, BottomRight, Other, None};
private:
QPoint position;
QSize size;
QSize minSize;
bool fNew;
bool fUsed;
bool fChanged;
bool fSelected;
public:
RSItemBase();
// position
int x();
int y();
void setPosition(int x, int y);
// size
int width();
int height();
// size
int minWidth();
int minHeight();
void setSize(int w, int h);
virtual void moveRel(int dx, int dy);
virtual void moveHandleRel(int num, int dx, int dy);
virtual void updateContents(QScrollView *sv, float zoom);
QString getTooltipDecsription();
virtual bool containsPoint(int xp, int yp);
virtual RSItemIO *getIOAtPoint(int xp, int yp);
virtual bool containsHandlePoint(int xp, int yp);
virtual RSItemHandle getHandlePoint(int xp, int yp);
virtual int getHandlePointNum(int xp, int yp);
bool flagUsed();
void setFlagUsed(bool u);
bool flagNew();
void setFlagNew(bool n);
bool flagChanged();
void setFlagChanged(bool c);
bool flagSelected();
void setFlagSelected(bool s);
virtual QString getDesc();
virtual void draw(DrawingParams *dp);
virtual void calcSize();
};
class RSItemBaseWithType : public RSItemBase
{
public:
enum ItemType {In, Out, FX, Patch, Link};
private:
ItemType iType;
public:
RSItemBaseWithType(ItemType type);
ItemType type();
virtual int getMaxIOIdx(bool out);
virtual RSItemIO *getIO(bool out, int idx);
virtual void getIOPoint(RSItemIO *item, int *xp, int *yp);
virtual ~RSItemBaseWithType();
};
#endif // STRUCTURE_H

View file

@ -0,0 +1,120 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <math.h>
#include "structure.h"
#include "strglobal.h"
// simple, but very far from perfect
void StrGlobal::AutoArange(QPtrList <RSItemBaseWithType> *items)
{
int maxx = 0;
int maxy = 0;
int inc = 0;
int pc = 0;
int outc = 0;
// iterate through all
RSItemBaseWithType *item;
for(item = items->first(); item; item = items->next() )
{
if (item->flagNew())
{
switch (item->type())
{
case RSItemBaseWithType::In:
case RSItemBaseWithType::FX:
inc++;
break;
case RSItemBaseWithType::Out:
outc++;
break;
case RSItemBaseWithType::Patch:
pc++;
break;
default:
break;
}
}
else
{
int tmpx = item->x() + item->width();
int tmpy = item->y() + item->height();
if (tmpx > maxx)
maxx = tmpx;
if (tmpy > maxy)
maxy = tmpy;
}
}
int ini = 0;
int pi = 0;
int outi = 0;
int sizex = (int)(sqrt(pc) + 1);
//int sizey = (int)((float)pc / sizex + 1);
int offiny = maxy + 20;
int offinx = 0 + 20;
int offpy = maxy + 20;
int offpx = 0 + 20 + 90;
int offouty = maxy + 20;
int offoutx = sizex * 90 + 20 + 70 + 70;
int offheight = 0;
int maxoffheight = 0;
int heightaccum = 0;
for(item = items->first(); item; item = items->next() )
{
if (item->flagNew())
{
switch (item->type())
{
case RSItemBaseWithType::In:
case RSItemBaseWithType::FX:
item->setPosition(offinx, offiny + ini * 40);
ini++;
break;
case RSItemBaseWithType::Out:
item->setPosition(offoutx, offouty + outi * 40);
outi++;
break;
case RSItemBaseWithType::Patch:
item->setPosition(offpx + (pi % sizex) * 90, offpy + (pi / sizex) * 90 + heightaccum);
item->calcSize();
offheight = item->height() - sizex * 10;
if ( offheight > maxoffheight )
maxoffheight = offheight;
pi++;
break;
default:
break;
}
if(offpx + (pi % sizex) * 90 == offpx) {
heightaccum += maxoffheight;
maxoffheight = 0;
}
}
}
}

View file

@ -0,0 +1,151 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qpainter.h>
#include "structure_io.h"
#include "structure_link.h"
#define IO_WIDTH 70
#define IO_HEIGHT 20
StrIOBase::StrIOBase(RSItemBaseWithType::ItemType it) : RSItemBaseWithType(it)
{
}
void StrIOBase::calcSize()
{
setSize(IO_WIDTH, IO_HEIGHT);
RSItemBase::calcSize();
}
#define IO_SELECT_WH 7
#define IO_INNER_SPACE_X 7
#define IO_INNER_SPACE_Y 2
void StrIOBase::draw(DrawingParams *dp)
{
int xp, yp, wp, hp;
xp = (int)(x() * dp->zoomKoef);
yp = (int)(y() * dp->zoomKoef);
wp = (int)(width() * dp->zoomKoef);
hp = (int)(height() * dp->zoomKoef);
dp->painter->setPen(QPen(IO_BOX_COLOR, 1));
dp->painter->drawRoundRect(xp, yp, wp, hp, 20, 50);
if (flagSelected())
{
// top left
dp->painter->fillRect(
xp,
yp,
(int)(IO_SELECT_WH * dp->zoomKoef),
(int)(IO_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
// top right
dp->painter->fillRect(
(int)(xp + wp - IO_SELECT_WH * dp->zoomKoef),
yp,
(int)(IO_SELECT_WH * dp->zoomKoef),
(int)(IO_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
// bottom left
dp->painter->fillRect(
xp,
(int)(yp + hp - IO_SELECT_WH * dp->zoomKoef),
(int)(IO_SELECT_WH * dp->zoomKoef),
(int)(IO_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
// bottom right
dp->painter->fillRect(
(int)(xp + wp - IO_SELECT_WH * dp->zoomKoef),
(int)(yp + hp - IO_SELECT_WH * dp->zoomKoef),
(int)(IO_SELECT_WH * dp->zoomKoef),
(int)(IO_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
}
dp->painter->setPen(IO_TEXT_PEN);
dp->painter->drawText(
(int)((x() + 2 * IO_INNER_SPACE_X + (width() / 100) * 10) * dp->zoomKoef),
(int)((y() + IO_INNER_SPACE_Y + (height() / 100) * 10) * dp->zoomKoef),
(int)((width() - 4 * IO_INNER_SPACE_X) * dp->zoomKoef),
(int)((height() - 2 * IO_INNER_SPACE_Y) * dp->zoomKoef),
Qt::AlignLeft | Qt::WordBreak,
getIOName());
dp->painter->setPen(DEF_PAINTING_PEN);
}
bool StrIOBase::containsPoint(int xp, int yp)
{
// FIXME - round shape
return QRect(x(), y(), width(), height()).contains(xp, yp);
}
bool StrIOBase::containsHandlePoint(int xp, int yp)
{
return getHandlePoint(xp, yp) != RSItemBase::None;
}
RSItemBase::RSItemHandle StrIOBase::getHandlePoint(int xp, int yp)
{
// top left
if (QRect(x(), y(), IO_SELECT_WH, IO_SELECT_WH).contains(xp, yp))
return RSItemBase::TopLeft;
// top right
if (QRect(x() + width() - IO_SELECT_WH, y(), IO_SELECT_WH, IO_SELECT_WH).contains(xp, yp))
return RSItemBase::TopRight;
// bottom left
if (QRect(x(), y() + height() - IO_SELECT_WH, IO_SELECT_WH, IO_SELECT_WH).contains(xp, yp))
return RSItemBase::BottomLeft;
// bottom right
if (QRect(x() + width() - IO_SELECT_WH, y() + height() - IO_SELECT_WH, IO_SELECT_WH, IO_SELECT_WH).contains(xp, yp))
return RSItemBase::BottomRight;
return RSItemBase::None;
}
void StrIOBase::getIOPoint(RSItemIO *item, int *xp, int *yp)
{
// for io it is in center
*xp = x() + width() / 2;
*yp = y() + height() / 2;
}
void StrIOBase::updateContents(QScrollView *sv, float zoom)
{
int i;
for (i = 0; i < 2; i++)
{
RSItemIO *io = getIO(i, 0);
if (io)
{
StrLink *l = io->getConnectedTo();
if (l)
l->updateOneSegment(sv, l->findRoute(io), zoom);
}
}
RSItemBaseWithType::updateContents(sv, zoom);
}

245
qlo10k1/src/structure_io.h Normal file
View file

@ -0,0 +1,245 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef STRUCTURE_IO_H
#define STRUCTURE_IO_H
#include "structure.h"
#include "custom_colors.h"
class StrIOBase : public RSItemBaseWithType
{
public:
StrIOBase(RSItemBaseWithType::ItemType it);
virtual void calcSize();
virtual void draw(DrawingParams *dp);
virtual bool containsPoint(int xp, int yp);
virtual bool containsHandlePoint(int xp, int yp);
virtual RSItemHandle getHandlePoint(int xp, int yp);
virtual QString getIOName()
{
return "";
}
virtual void getIOPoint(RSItemIO *item, int *xp, int *yp);
virtual void updateContents(QScrollView *sv, float zoom);
};
class StrInput : public StrIOBase
{
QString inputName;
int inputNum;
RSItemIO *io;
public:
QString name(void)
{
return inputName;
}
virtual QString getIOName()
{
return "I " + QString().setNum(inputNum) + "\n" + inputName;
}
void setName(QString nn)
{
inputName = nn;
io->setDesc(nn);
}
StrInput(int in, QString name) :
StrIOBase(RSItemBaseWithType::In)
{
inputName = name;
inputNum = in;
io = new RSItemIO(this, true, 0, name);
calcSize();
}
int num(void)
{
return inputNum;
}
virtual int getMaxIOIdx(bool out)
{
if (out)
return 1;
else
return 0;
}
virtual RSItemIO *getIO(bool out, int idx)
{
if (!out)
return NULL;
else if (idx == 0)
return io;
else
return NULL;
}
virtual ~StrInput()
{
RSItemIO *tmp = io;
delete io;
io = NULL;
tmp->connectTo(NULL);
}
};
class StrOutput : public StrIOBase
{
QString outputName;
int outputNum;
RSItemIO *io;
public:
QString name(void)
{
return outputName;
}
virtual QString getIOName()
{
return "O " + QString().setNum(outputNum) + "\n" + outputName;
}
void setName(QString nn)
{
outputName = nn;
io->setDesc(nn);
}
StrOutput(int on, QString name) :
StrIOBase(RSItemBaseWithType::Out)
{
outputName = name;
outputNum = on;
io = new RSItemIO(this, false, 0, name);
calcSize();
}
int num(void)
{
return outputNum;
}
virtual int getMaxIOIdx(bool out)
{
if (out)
return 0;
else
return 1;
}
virtual RSItemIO *getIO(bool out, int idx)
{
if (out)
return NULL;
else if (idx == 0)
return io;
else
return NULL;
}
virtual ~StrOutput()
{
RSItemIO *tmp = io;
delete io;
io = NULL;
tmp->connectTo(NULL);
}
};
class StrFX : public StrIOBase
{
QString fxName;
int fxNum;
RSItemIO *io;
public:
QString name(void)
{
return fxName;
}
virtual QString getIOName()
{
return "F " + QString().setNum(fxNum) + "\n" + fxName;
}
void setName(QString nn)
{
fxName = nn;
io->setDesc(nn);
}
StrFX(int fn, QString name) :
StrIOBase(RSItemBaseWithType::FX)
{
fxName = name;
fxNum = fn;
io = new RSItemIO(this, true, 0, name);
calcSize();
}
int num(void)
{
return fxNum;
}
virtual int getMaxIOIdx(bool out)
{
if (out)
return 1;
else
return 0;
}
virtual RSItemIO *getIO(bool out, int idx)
{
if (!out)
return NULL;
else if (idx == 0)
return io;
else
return NULL;
}
virtual ~StrFX()
{
RSItemIO *tmp = io;
delete io;
io = NULL;
tmp->connectTo(NULL);
}
};
#endif // STRUCTURE_IO_H

View file

@ -0,0 +1,640 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <math.h>
#include <qpainter.h>
#include "structure_link.h"
#include "custom_colors.h"
StrLink::StrLink(int id, LinkType t)
: RSItemBaseWithType(RSItemBaseWithType::Link)
{
linkId = id;
type = t;
for (int i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
routes[i] = NULL;
useMixPoint = false;
setSize(0, 0);
RSItemBaseWithType::calcSize();
}
StrLink::~StrLink()
{
disconnectAll();
}
void StrLink::setId(int id)
{
linkId = id;
}
int StrLink::id()
{
return linkId;
}
void StrLink::setType(LinkType t)
{
type = t;
}
StrLink::LinkType StrLink::getType()
{
return type;
}
bool StrLink::isSimple()
{
return simple;
}
void StrLink::setSimple(bool s)
{
simple = s;
}
bool StrLink::isMulti()
{
return multi;
}
void StrLink::setMulti(bool m)
{
multi = m;
}
int StrLink::findRoute(RSItemIO *r)
{
for (int i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i] == r)
return i;
}
return -1;
}
RSItemIO *StrLink::getRoutePoint(int r)
{
if (r >= POINTINFO_MAX_CONN_PER_POINT)
return NULL;
return routes[r];
}
void StrLink::setRoutePoint(int r, RSItemIO *ri)
{
if (r >= POINTINFO_MAX_CONN_PER_POINT + 1)
return;
RSItemIO *tmp = routes[r];
routes[r] = NULL;
if (tmp)
tmp->connectTo(NULL);
routes[r] = ri;
if (!ri)
routesPoints[r].clear();
if (ri)
ri->connectTo(this);
}
void StrLink::clearRoutesPoints(int r)
{
if (r >= POINTINFO_MAX_CONN_PER_POINT + 1)
return;
routesPoints[r].clear();
}
#define LINK_SELECT_WH 7
void StrLink::setMinMaxPoint(QPoint p, int *minx, int *maxx, int *miny, int *maxy)
{
if (p.x() - LINK_SELECT_WH / 2 < *minx)
*minx = p.x() - LINK_SELECT_WH / 2;
if (p.x() + LINK_SELECT_WH > *maxx)
*maxx = p.x() + LINK_SELECT_WH;
if (p.y() - LINK_SELECT_WH / 2 < *miny)
*miny = p.y() - LINK_SELECT_WH / 2;
if (p.y() + LINK_SELECT_WH > *maxy)
*maxy = p.y() + LINK_SELECT_WH;
}
void StrLink::setMinMax()
{
int minx = 1000000;
int maxx = -1;
int miny = 1000000;
int maxy = -1;
int i, j;
if (useMixPoint)
setMinMaxPoint(mixPoint, &minx, &maxx, &miny, &maxy);
for (i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
setMinMaxPoint(routesEndPoints[i], &minx, &maxx, &miny, &maxy);
for (j = 0; j < (int)routesPoints[i].count(); j++)
{
QPoint tmpp = routesPoints[i][j];
setMinMaxPoint(tmpp, &minx, &maxx, &miny, &maxy);
}
}
}
setPosition(minx, miny);
setSize(maxx - minx, maxy - miny);
}
void StrLink::calcSize()
{
int i;
int cnt = 0;
int ioxp, ioyp;
for (i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
cnt++;
((RSItemBaseWithType *)routes[i]->getOwner())->getIOPoint(routes[i], &ioxp, &ioyp);
routesEndPoints[i].setX(ioxp);
routesEndPoints[i].setY(ioyp);
}
}
setMinMax();
if (cnt <= 2)
{
// not use mixpoint
useMixPoint = false;
}
else
{
// use mixpoint
if (!useMixPoint)
{
mixPoint.setX(x() + width() / 2);
mixPoint.setY(y() + height() / 2);
useMixPoint = true;
}
}
}
void StrLink::draw(DrawingParams *dp)
{
int i, j;
for (i = useMixPoint ? 0 : 1; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
QPoint fp = routesEndPoints[i];
if (flagSelected())
dp->painter->fillRect(
(int)((fp.x() - LINK_SELECT_WH / 2) * dp->zoomKoef),
(int)((fp.y() - LINK_SELECT_WH / 2) * dp->zoomKoef),
(int)(LINK_SELECT_WH * dp->zoomKoef),
(int)(LINK_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
for (j = 0; j < (int)routesPoints[i].count(); j++)
{
QPoint tmpp = routesPoints[i][j];
if (flagSelected())
dp->painter->fillRect(
(int)((tmpp.x() - LINK_SELECT_WH / 2) * dp->zoomKoef),
(int)((tmpp.y() - LINK_SELECT_WH / 2) * dp->zoomKoef),
(int)(LINK_SELECT_WH * dp->zoomKoef),
(int)(LINK_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
dp->painter->setPen(LINE_PEN);
dp->painter->drawLine((int)(fp.x() * dp->zoomKoef),
(int)(fp.y() * dp->zoomKoef),
(int)(tmpp.x() * dp->zoomKoef),
(int)(tmpp.y() * dp->zoomKoef));
dp->painter->setPen(DEF_PAINTING_PEN);
fp = tmpp;
}
if (useMixPoint)
{
dp->painter->setPen(LINE_PEN);
dp->painter->drawLine((int)(fp.x() * dp->zoomKoef),
(int)(fp.y() * dp->zoomKoef),
(int)(mixPoint.x() * dp->zoomKoef),
(int)(mixPoint.y() * dp->zoomKoef));
dp->painter->setPen(DEF_PAINTING_PEN);
if (flagSelected())
dp->painter->fillRect(
(int)((mixPoint.x() - LINK_SELECT_WH / 2) * dp->zoomKoef),
(int)((mixPoint.y() - LINK_SELECT_WH / 2) * dp->zoomKoef),
(int)(LINK_SELECT_WH * dp->zoomKoef),
(int)(LINK_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
}
else
{
dp->painter->setPen(LINE_PEN);
dp->painter->drawLine((int)(fp.x() * dp->zoomKoef),
(int)(fp.y() * dp->zoomKoef),
(int)(routesEndPoints[0].x() * dp->zoomKoef),
(int)(routesEndPoints[0].y() * dp->zoomKoef));
dp->painter->setPen(DEF_PAINTING_PEN);
if (flagSelected())
dp->painter->fillRect(
(int)((routesEndPoints[0].x() - LINK_SELECT_WH / 2) * dp->zoomKoef),
(int)((routesEndPoints[0].y() - LINK_SELECT_WH / 2) * dp->zoomKoef),
(int)(LINK_SELECT_WH * dp->zoomKoef),
(int)(LINK_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
}
}
}
if (useMixPoint)
{
dp->painter->drawEllipse((int)((mixPoint.x() - 1) * dp->zoomKoef),
(int)((mixPoint.y() - 1) * dp->zoomKoef),
(int)(3 * dp->zoomKoef),
(int)(3 * dp->zoomKoef));
dp->painter->drawEllipse((int)((mixPoint.x() - 2) * dp->zoomKoef),
(int)((mixPoint.y() - 2) * dp->zoomKoef),
(int)(5 * dp->zoomKoef),
(int)(5 * dp->zoomKoef));
dp->painter->drawEllipse((int)((mixPoint.x() - 3) * dp->zoomKoef),
(int)((mixPoint.y() - 3) * dp->zoomKoef),
(int)(7 * dp->zoomKoef),
(int)(7 * dp->zoomKoef));
}
}
void StrLink::moveRel(int dx, int dy)
{
int i;
unsigned int j;
if (useMixPoint)
moveRelPoint(&mixPoint, dx, dy);
for (i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
for (j = 0; j < routesPoints[i].count(); j++)
{
QPoint tmpp = routesPoints[i][j];
moveRelPoint(&tmpp, dx, dy);
routesPoints[i][j] = tmpp;
}
}
}
calcSize();
}
void StrLink::moveRelPoint(QPoint *p, int dx, int dy)
{
p->setX(p->x() + dx);
p->setY(p->y() + dy);
if (p->x() < 0)
p->setX(0);
if (p->y() < 0)
p->setY(0);
}
void StrLink::updateOneSegment(QScrollView *sv, int r, float zoom)
{
int ioxp;
int ioyp;
if (r < 0 || r >= POINTINFO_MAX_CONN_PER_POINT + 1)
return;
if (routes[r])
{
((RSItemBaseWithType *)routes[r]->getOwner())->getIOPoint(routes[r], &ioxp, &ioyp);
routesEndPoints[r].setX(ioxp);
routesEndPoints[r].setY(ioyp);
setMinMax();
if (routesPoints[r].count())
{
QPoint rep = routesEndPoints[r];
QPoint rp = routesPoints[r][0];
QRect rect(QPoint(rep.x(), rep.y()), QPoint(rp.x(), rp.y()));
rect = rect.normalize();
rect.setX(rect.x() - LINK_SELECT_WH);
rect.setY(rect.y() - LINK_SELECT_WH);
rect.setWidth(rect.width() + 2 * LINK_SELECT_WH);
rect.setHeight(rect.height() + 2 * LINK_SELECT_WH);
sv->updateContents((int)(rect.x() * zoom),
(int)(rect.y() * zoom),
(int)(rect.width() * zoom),
(int)(rect.height() * zoom));
}
else
{
if (useMixPoint)
{
QPoint rep = routesEndPoints[r];
QRect rect(QPoint(rep.x(), rep.y()), QPoint(mixPoint.x(), mixPoint.y()));
rect = rect.normalize();
rect.setX(rect.x() - LINK_SELECT_WH);
rect.setY(rect.y() - LINK_SELECT_WH);
rect.setWidth(rect.width() + 2 * LINK_SELECT_WH);
rect.setHeight(rect.height() + 2 * LINK_SELECT_WH);
sv->updateContents((int)(rect.x() * zoom),
(int)(rect.y() * zoom),
(int)(rect.width() * zoom),
(int)(rect.height() * zoom));
}
else
sv->updateContents((int)((x() - LINK_SELECT_WH) * zoom),
(int)((y() - LINK_SELECT_WH) * zoom),
(int)((width() + 2 * LINK_SELECT_WH) * zoom),
(int)((height() + 2 * LINK_SELECT_WH) * zoom));
}
}
}
bool StrLink::containsPointPoint(QPoint &p, int xp, int yp)
{
QRect r(p.x() - LINK_SELECT_WH / 2, p.y() - LINK_SELECT_WH / 2,
LINK_SELECT_WH + 1, LINK_SELECT_WH + 1);
return r.contains(xp, yp);
}
bool StrLink::containsPointSegment(QPoint &p1, QPoint &p2, int xp, int yp)
{
QRect r(p1, p2);
if (!r.normalize().contains(xp, yp))
return false;
float v1 = p2.x() - p1.x();
float v2 = p2.y() - p1.y();
float a = v2;
float b = -v1;
float c = v1 * p1.y() - v2 * p1.x();
if (fabs(a * xp + b * yp + c) / sqrt(a * a + b * b) < 4.0)
return true;
else
return false;
}
bool StrLink::containsPoint(int xp, int yp)
{
int i;
unsigned j;
if (xp < x() || xp > x() + width() ||
yp < y() || yp > y() + height())
return false;
if (useMixPoint)
{
if (containsPointPoint(mixPoint, xp, yp))
return true;
}
for (i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
QPoint fp = routesEndPoints[i];
if (containsPointPoint(fp, xp, yp))
return true;
for (j = 0; j < routesPoints[i].count(); j++)
{
QPoint tmpp = routesPoints[i][j];
if (containsPointPoint(tmpp, xp, yp))
return true;
if (containsPointSegment(fp, tmpp, xp, yp))
return true;
fp = tmpp;
}
if (useMixPoint)
{
if (containsPointSegment(fp, mixPoint, xp, yp))
return true;
}
else
{
if (containsPointSegment(fp, routesEndPoints[0], xp, yp))
return true;
}
}
}
return false;
}
bool StrLink::containsHandlePoint(int xp, int yp)
{
return getHandlePointNum(xp, yp) >= 0;
}
int StrLink::getHandlePointNum(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 0;
}
for (i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
for (j = 0; j < routesPoints[i].count(); j++)
{
QPoint tmpp = routesPoints[i][j];
if (containsPointPoint(tmpp, xp, yp))
return (i + 1) * 256 + j + 1;
}
}
}
return -1;
}
void StrLink::moveHandleRel(int num, int dx, int dy)
{
int i;
int j;
if (useMixPoint && num == 0)
{
moveRelPoint(&mixPoint, dx, dy);
setMinMax();
return;
}
for (i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
for (j = 0; j < (int)routesPoints[i].count(); j++)
{
if (num == (i + 1) * 256 + j + 1)
{
QPoint tmpp = routesPoints[i][j];
moveRelPoint(&tmpp, dx, dy);
routesPoints[i][j] = tmpp;
setMinMax();
return;
}
}
}
}
}
void StrLink::disconnectAll()
{
for (int i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
RSItemIO *tmp = routes[i];
routes[i] = NULL;
tmp->connectTo(NULL);
}
}
}
bool StrLink::isValid()
{
int cnti = 0;
int cnto = 0;
for (int i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
if (routes[i]->isOutput())
cnto++;
else
cnti++;
}
}
if (getType() == LinkNormal)
return cnti + cnto > 1 && (cnti > 0 && cnto > 0);
else
return cnti + cnto > 1;
}
bool StrLink::addSegmentPoint(int xp, int yp)
{
int i;
unsigned j;
if (xp < x() || xp > x() + width() ||
yp < y() || yp > y() + height())
return false;
for (i = 0; i < POINTINFO_MAX_CONN_PER_POINT + 1; i++)
{
if (routes[i])
{
QPoint fp = routesEndPoints[i];
for (j = 0; j < routesPoints[i].count(); j++)
{
QPoint tmpp = routesPoints[i][j];
if (containsPointSegment(fp, tmpp, xp, yp))
{
// add new point
routesPoints[i].insert(routesPoints[i].at(j), QPoint(xp,yp));
return true;
}
fp = tmpp;
}
if (useMixPoint)
{
if (containsPointSegment(fp, mixPoint, xp, yp))
{
routesPoints[i].append(QPoint(xp,yp));
return true;
}
}
else
{
if (containsPointSegment(fp, routesEndPoints[0], xp, yp))
{
routesPoints[i].append(QPoint(xp,yp));
return true;
}
}
}
}
return false;
}
bool StrLink::delSegmentPoint(int num)
{
if (num <= 0)
return false;
int r = ((num - 1) / 256) - 1;
int i = ((num - 1) % 256);
if (routes[r])
{
if (i < (int)routesPoints[r].count())
{
routesPoints[r].remove(routesPoints[r].at(i));
return true;
}
}
return false;
}

View file

@ -0,0 +1,106 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef STRUCTURE_LINK_H
#define STRUCTURE_LINK_H
#include "structure.h"
#include "strparam.h"
class StrLink : public RSItemBaseWithType
{
public:
enum LinkType {LinkFX, LinkIn, LinkOut, LinkNormal};
enum IOType {IOIn, IOOut};
private:
int linkId;
LinkType type;
bool simple;
bool multi;
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];
bool useMixPoint;
QPoint mixPoint;
bool containsPointPoint(QPoint &p, int xp, int yp);
bool containsPointSegment(QPoint &p1, QPoint &p2, int xp, int yp);
public:
StrLink(int id, LinkType t);
virtual ~StrLink();
void setId(int id);
int id();
void setType(LinkType t);
LinkType getType();
bool isSimple();
void setSimple(bool s);
bool isMulti();
void setMulti(bool m);
int getMaxRoute()
{
return POINTINFO_MAX_CONN_PER_POINT;
}
void disconnectAll();
int findRoute(RSItemIO *r);
RSItemIO *getRoutePoint(int r);
void setRoutePoint(int r, RSItemIO *ri);
void clearRoutesPoints(int r);
virtual void calcSize();
virtual void draw(DrawingParams *dp);
virtual void moveRel(int dx, int dy);
void setMinMaxPoint(QPoint p, int *minx, int *maxx, int *miny, int *maxy);
void setMinMax();
void moveRelPoint(QPoint *p, int dx, int dy);
void updateOneSegment(QScrollView *sv, int r, float zoom);
virtual bool containsPoint(int xp, int yp);
virtual bool containsHandlePoint(int xp, int yp);
virtual int getHandlePointNum(int xp, int yp);
virtual RSItemHandle getHandlePoint(int xp, int yp)
{
if (getHandlePointNum(xp, yp) >= 0)
return RSItemBase::Other;
else
return RSItemBase::None;
}
virtual void moveHandleRel(int num, int dx, int dy);
bool isValid();
bool addSegmentPoint(int xp, int yp);
bool delSegmentPoint(int num);
};
#endif // STRUCTURE_LINK_H

View file

@ -0,0 +1,365 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qpainter.h>
#include "structure_patch.h"
#include "structure_link.h"
QString StrPatch::name(void)
{
return patchName;
}
void StrPatch::setName(QString pn)
{
patchName = pn;
}
StrPatch::StrPatch(int pn, int id, QString name) :
RSItemBaseWithType(RSItemBaseWithType::Patch)
{
patchName = name;
patchNum = pn;
patchId = id;
patchOrder = 0;
count[0] = 0;
count[1] = 0;
int i, j;
for (i = 0; i < 2; i++)
for (j = 0; j < 32; j++)
ios[i][j] = NULL;
}
int StrPatch::num(void)
{
return patchNum;
}
int StrPatch::id(void)
{
return patchId;
}
int StrPatch::order(void)
{
return patchOrder;
}
void StrPatch::setOrder(int o)
{
patchOrder = o;
}
int StrPatch::getMaxIOIdx(bool out)
{
return 32;
}
RSItemIO *StrPatch::getIO(bool out, int idx)
{
if (idx >= 32)
return NULL;
else
return ios[out][idx];
}
void StrPatch::setIO(bool out, int idx, RSItemIO *io)
{
if (idx >= 32)
return;
else
{
if (ios[out][idx])
delete ios[out][idx];
ios[out][idx] = io;
}
getIOCount(&(count[0]), &(count[1]));
}
StrPatch::~StrPatch()
{
int i, j;
for (i = 0; i < 2; i++)
for (j = 0; j < 32; j++)
if (ios[i][j])
{
RSItemIO *tmp = ios[i][j];
delete ios[i][j];
ios[i][j] = NULL;
tmp->connectTo(NULL);
}
}
void StrPatch::getIOCount(int *in, int *out)
{
// get count of inputs and outputs
int i, j;
int count[2];
for (i = 0; i < 2; i++)
{
count[i] = 0;
for (j = 0; j < 32; j++)
if (ios[i][j])
count[i]++;
}
*in = count[0];
*out = count[1];
}
#define PATCH_IO_WIDTH 8
#define PATCH_IO_HEIGHT 8
#define PATCH_WIDTH 70
#define PATCH_SELECT_WH 7
void StrPatch::calcSize()
{
// get count of inputs and outputs
int max_count;
if (count[0] > count[1])
max_count = count[0];
else
max_count = count[1];
setSize(PATCH_WIDTH, (max_count * 2 + 2) * PATCH_IO_HEIGHT + PATCH_SELECT_WH * 2);
RSItemBase::calcSize();
}
void StrPatch::draw(DrawingParams *dp)
{
int xp, yp, wp, hp;
xp = (int)(x() * dp->zoomKoef);
yp = (int)(y() * dp->zoomKoef);
wp = (int)(width() * dp->zoomKoef);
hp = (int)(height() * dp->zoomKoef);
dp->painter->setPen(QPen(BOX_COLOR, 1));
dp->painter->drawRect(xp, yp, wp, hp);
if (flagSelected())
{
// top left
dp->painter->fillRect(
xp,
yp,
(int)(PATCH_SELECT_WH * dp->zoomKoef),
(int)(PATCH_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
// top right
dp->painter->fillRect(
xp + wp - (int)(PATCH_SELECT_WH * dp->zoomKoef),
yp,
(int)(PATCH_SELECT_WH * dp->zoomKoef),
(int)(PATCH_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
// bottom left
dp->painter->fillRect(
xp,
yp + hp - (int)(PATCH_SELECT_WH * dp->zoomKoef),
(int)(PATCH_SELECT_WH * dp->zoomKoef),
(int)(PATCH_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
// bottom right
dp->painter->fillRect(
xp + wp - (int)(PATCH_SELECT_WH * dp->zoomKoef),
yp + hp - (int)(PATCH_SELECT_WH * dp->zoomKoef),
(int)(PATCH_SELECT_WH * dp->zoomKoef),
(int)(PATCH_SELECT_WH * dp->zoomKoef),
QBrush(BOX_SELECTED_COLOR));
}
int i;
float tmpy = PATCH_IO_HEIGHT + PATCH_SELECT_WH;
float stepy = height() - 2 * (PATCH_IO_HEIGHT + PATCH_SELECT_WH) - PATCH_IO_HEIGHT * count[0];
if (count[0] > 1)
stepy = stepy / (count[0] - 1);
for (i = 0; i < count[0]; i++)
{
dp->painter->setPen(QPen(BOX_COLOR, 1));
dp->painter->drawRect(
(int)(x() * dp->zoomKoef),
(int)((y() + tmpy ) * dp->zoomKoef),
(int)(PATCH_IO_WIDTH * dp->zoomKoef),
(int)(PATCH_IO_HEIGHT * dp->zoomKoef)
);
tmpy += stepy + PATCH_IO_HEIGHT;
}
tmpy = PATCH_IO_HEIGHT + PATCH_SELECT_WH;
stepy = height() - 2 * (PATCH_IO_HEIGHT + PATCH_SELECT_WH) - PATCH_IO_HEIGHT * count[1];
if (count[1] > 1)
stepy = stepy / (count[1] - 1);
for (i = 0; i < count[1]; i++)
{
dp->painter->setPen(QPen(BOX_COLOR, 1));
dp->painter->drawRect(
(int)((x() + width() - PATCH_IO_WIDTH) * dp->zoomKoef),
(int)((y() + tmpy) * dp->zoomKoef),
(int)(PATCH_IO_WIDTH * dp->zoomKoef),
(int)(PATCH_IO_HEIGHT * dp->zoomKoef));
tmpy += stepy + PATCH_IO_HEIGHT;
}
QString pname = QString("%1\n%2").arg(num()).arg(name());
dp->painter->setPen(QPen(TEXT_COLOR, 1));
dp->painter->drawText(
(int)((x() + 2 * PATCH_IO_WIDTH) * dp->zoomKoef),
(int)((y() + PATCH_IO_HEIGHT) * dp->zoomKoef),
(int)((width() - 4 * PATCH_IO_WIDTH) * dp->zoomKoef),
(int)((height() - 2 * PATCH_IO_HEIGHT) * dp->zoomKoef),
Qt::AlignLeft | Qt::WordBreak,
pname);
}
bool StrPatch::containsPoint(int xp, int yp)
{
return QRect(x(), y(), width(), height()).contains(xp, yp);
}
RSItemIO *StrPatch::getIOAtPoint(int xp, int yp)
{
QRect r;
for (int j = 0; j < 2; j++)
for (int i = 0; i < count[j]; i++)
{
if (ios[j][i])
{
getIORect(j, i, r);
if (r.contains(xp, yp))
return ios[j][i];
}
}
return NULL;
}
void StrPatch::getIORect(bool out, int idx, QRect &r)
{
float tmpy = PATCH_IO_HEIGHT + PATCH_SELECT_WH;
if (!out)
{
float stepy = height() - 2 * (PATCH_IO_HEIGHT + PATCH_SELECT_WH) - PATCH_IO_HEIGHT * count[0];
if (count[0] > 1)
stepy = stepy / (count[0] - 1);
r.setRect(x(), (int)(y() + tmpy + idx * (stepy + PATCH_IO_HEIGHT)),
PATCH_IO_WIDTH, PATCH_IO_HEIGHT);
}
else
{
float stepy = height() - 2 * (PATCH_IO_HEIGHT + PATCH_SELECT_WH) - PATCH_IO_HEIGHT * count[1];
if (count[1] > 1)
stepy = stepy / (count[1] - 1);
r.setRect(x() + width() - PATCH_IO_WIDTH, (int)(y() + tmpy + idx * (stepy + PATCH_IO_HEIGHT)),
PATCH_IO_WIDTH, PATCH_IO_HEIGHT);
}
}
bool StrPatch::containsHandlePoint(int xp, int yp)
{
return getHandlePoint(xp, yp) != RSItemBase::None;
}
RSItemBase::RSItemHandle StrPatch::getHandlePoint(int xp, int yp)
{
// top left
if (QRect(x(), y(), PATCH_SELECT_WH, PATCH_SELECT_WH).contains(xp, yp))
return RSItemBase::TopLeft;
// top right
if (QRect(x() + width() - PATCH_SELECT_WH, y(), PATCH_SELECT_WH, PATCH_SELECT_WH).contains(xp, yp))
return RSItemBase::TopRight;
// bottom left
if (QRect(x(), y() + height() - PATCH_SELECT_WH, PATCH_SELECT_WH, PATCH_SELECT_WH).contains(xp, yp))
return RSItemBase::BottomLeft;
// bottom right
if (QRect(x() + width() - PATCH_SELECT_WH, y() + height() - PATCH_SELECT_WH, PATCH_SELECT_WH, PATCH_SELECT_WH).contains(xp, yp))
return RSItemBase::BottomRight;
return RSItemBase::None;
}
void StrPatch::getIOPoint(RSItemIO *item, int *xp, int *yp)
{
// for io it is in center
if (item->isOutput())
{
float tmpy = PATCH_IO_HEIGHT + PATCH_SELECT_WH;
float stepy = height() - 2 * (PATCH_IO_HEIGHT + PATCH_SELECT_WH) - PATCH_IO_HEIGHT * count[1];
if (count[1] > 1)
stepy = stepy / (count[1] - 1);
*xp = x() + width() - PATCH_IO_WIDTH + PATCH_IO_WIDTH / 2;
*yp = (int)(y() + tmpy + (stepy + PATCH_IO_HEIGHT) * item->getIdx() + PATCH_IO_HEIGHT / 2);
return;
}
else
{
float tmpy = PATCH_IO_HEIGHT + PATCH_SELECT_WH;
float stepy = height() - 2 * (PATCH_IO_HEIGHT + PATCH_SELECT_WH) - PATCH_IO_HEIGHT * count[0];
if (count[0] > 1)
stepy = stepy / (count[0] - 1);
*xp = x() + PATCH_IO_WIDTH / 2;
*yp = (int)(y() + tmpy + (stepy + PATCH_IO_HEIGHT)* item->getIdx() + PATCH_IO_HEIGHT / 2);
return;
}
}
void StrPatch::updateContents(QScrollView *sv, float zoom)
{
int i;
int j;
for (i = 0; i < 2; i++)
{
for (j = 0; j < 32; j++)
if (ios[i][j])
{
StrLink *l = ios[i][j]->getConnectedTo();
if (l)
l->updateOneSegment(sv, l->findRoute(ios[i][j]), zoom);
}
}
RSItemBaseWithType::updateContents(sv, zoom);
}

View file

@ -0,0 +1,69 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef STRUCTURE_PATCH_H
#define STRUCTURE_PATCH_H
#include "structure.h"
#include "custom_colors.h"
class StrPatch : public RSItemBaseWithType
{
QString patchName;
int patchNum;
int patchId;
int patchOrder;
RSItemIO *ios[2][32];
int count[2];
void getIOCount(int *in, int *out);
public:
QString name(void);
void setName(QString pn);
StrPatch(int pn, int id, QString name);
int num(void);
int id(void);
int order(void);
void setOrder(int o);
void getIORect(bool out, int idx, QRect &r);
virtual int getMaxIOIdx(bool out);
virtual RSItemIO *getIO(bool out, int idx);
virtual void setIO(bool out, int idx, RSItemIO *io);
virtual ~StrPatch();
virtual void calcSize();
virtual void draw(DrawingParams *dp);
virtual bool containsPoint(int xp, int yp);
virtual RSItemIO *getIOAtPoint(int xp, int yp);
virtual bool containsHandlePoint(int xp, int yp);
virtual RSItemHandle getHandlePoint(int xp, int yp);
virtual void getIOPoint(RSItemIO *item, int *xp, int *yp);
virtual void updateContents(QScrollView *sv, float zoom);
};
#endif // STRUCTURE_PATCH_H

View file

@ -0,0 +1,462 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <qlineedit.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qinputdialog.h>
#include <qvaluelist.h>
#include <qmessagebox.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qcombobox.h>
#include <qmap.h>
#include "app_global.h"
#include "transformpatchdialog.h"
#include "structure_patch.h"
#include "structure_io.h"
TransformPatchDlg::TransformPatchDlg(QString efileName, EMU10k1File *efile)
: TransformPatchBase()
{
fileName = efileName;
file = efile;
leFileName->setText(fileName);
lePatchName->setText(file->getPatchName());
// load controls list
int i;
for (i = 0; i < file->getCtrlCount(); i++)
{
QString text = getName(i);
lbFileCtrl->insertItem(text);
ctrlFileList.append(i);
}
// set default in names
switch (file->getInCount())
{
case 1:
inputNames.append("I");
break;
case 2:
inputNames.append("IL");
inputNames.append("IR");
break;
case 4:
inputNames.append("IL");
inputNames.append("IR");
inputNames.append("IRL");
inputNames.append("IRR");
break;
case 6:
inputNames.append("IL");
inputNames.append("IR");
inputNames.append("IRL");
inputNames.append("IRR");
inputNames.append("IC");
inputNames.append("ILFE");
break;
default:
for (i = 0; i < file->getInCount(); i++)
inputNames.append("");
break;
}
// set default out names
switch (file->getOutCount())
{
case 1:
outputNames.append("O");
break;
case 2:
outputNames.append("OL");
outputNames.append("OR");
break;
case 4:
outputNames.append("OL");
outputNames.append("OR");
outputNames.append("ORL");
outputNames.append("ORR");
break;
case 6:
outputNames.append("OL");
outputNames.append("OR");
outputNames.append("ORL");
outputNames.append("ORR");
outputNames.append("OC");
outputNames.append("OLFE");
break;
default:
for (i = 0; i < file->getOutCount(); i++)
outputNames.append("");
break;
}
for (i = 0; i < file->getInCount(); i++)
lbInputs->insertItem(inputNames[i]);
for (i = 0; i < file->getOutCount(); i++)
lbOutputs->insertItem(outputNames[i]);
connect(pbOK, SIGNAL(clicked()), this, SLOT(okClicked()));
connect(pbCancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
connect(lbInputs, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(inputsDoubleClicked(QListBoxItem *)));
connect(lbOutputs, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(outputsDoubleClicked(QListBoxItem *)));
connect(pbCtrlAdd, SIGNAL(clicked()), this, SLOT(ctrlAddClicked()));
connect(pbCtrlDel, SIGNAL(clicked()), this, SLOT(ctrlDelClicked()));
connect(lbLoadedCtrl, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(loadedDoubleClicked(QListBoxItem *)));
connect(lbFileCtrl, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(fileDoubleClicked(QListBoxItem *)));
}
QString TransformPatchDlg::getName(int i)
{
EMU10k1Ctrl ctrl;
file->getCtrl(i, &ctrl);
QString name = QString(ctrl.name) + " - " + QString().setNum(ctrl.value) +
" (" + QString().setNum(ctrl.min) + "," + + QString().setNum(ctrl.max) + ")";
return name;
}
void TransformPatchDlg::okClicked()
{
// load patch
done(Accepted);
}
void TransformPatchDlg::cancelClicked()
{
done(Rejected);
}
void TransformPatchDlg::inputsDoubleClicked(QListBoxItem *item)
{
bool ok;
int idx = lbInputs->index(item);
QString text = inputNames[idx];
text = QInputDialog::getText(
APP_NAME, "Input name:", QLineEdit::Normal,
text, &ok, this );
if (ok && !text.isEmpty())
{
inputNames[idx] = text;
lbInputs->changeItem(text, idx);
}
}
void TransformPatchDlg::outputsDoubleClicked(QListBoxItem *item)
{
bool ok;
int idx = lbOutputs->index(item);
QString text = outputNames[idx];
text = QInputDialog::getText(
APP_NAME, "Output name:", QLineEdit::Normal,
text, &ok, this );
if (ok && !text.isEmpty())
{
outputNames[idx] = text;
lbOutputs->changeItem(text, idx);
}
}
void TransformPatchDlg::ctrlAddClicked()
{
QValueList <int> selectedCtrl, *tmpList;
int i;
unsigned int min = 0;
unsigned int max = 0;
bool first = true;
for (i = 0; i < (int)lbFileCtrl->count(); i++)
{
if (lbFileCtrl->isSelected(i))
{
selectedCtrl.append(ctrlFileList[i]);
EMU10k1Ctrl ctrl;
file->getCtrl(ctrlFileList[i], &ctrl);
if (first)
{
min = ctrl.min;
max = ctrl.max;
}
else
{
if (min != ctrl.min ||
max != ctrl.max)
{
QMessageBox::critical(0, APP_NAME,
QString("Wrong range for control %1").arg(ctrl.name));
return;
}
}
first = false;
}
}
if (selectedCtrl.count() > 0)
{
TranslatedCtrl ctrl;
tmpList = &selectedCtrl;
for (;;)
{
FileControlDlg d(tmpList, file, &ctrl);
if (d.exec() == QDialog::Accepted)
{
bool found = false;
// check name - in translated
for (i = 0; i < (int)translatedList.count(); i++)
{
if (translatedList[i].name == ctrl.name)
{
found = true;
break;
}
}
// check in other
for (i = 0; i < (int)ctrlFileList.count(); i++)
{
EMU10k1Ctrl ctrl1;
file->getCtrl(ctrlFileList[i], &ctrl1);
if (selectedCtrl.findIndex(ctrlFileList[i]) < 0 && ctrl1.name == ctrl.name)
{
found = true;
break;
}
}
if (found)
{
QMessageBox::critical( 0, APP_NAME,
QString("There already is control with this name %1").arg(ctrl.name));
tmpList = NULL;
continue;
}
else
{
// add to translated
translatedList.append(ctrl);
// remove selected controls from ctrlList
for (i = 0; i < (int)selectedCtrl.count(); i++)
{
int fidx = ctrlFileList.findIndex(selectedCtrl[i]);
if (fidx >= 0)
{
ctrlFileList.remove(selectedCtrl[i]);
lbFileCtrl->removeItem(fidx);
}
}
lbLoadedCtrl->insertItem(ctrl.name);
break;
}
}
else
break;
}
}
}
void TransformPatchDlg::ctrlDelClicked()
{
QValueList <int> selectedCtrl;
int i, j;
for (i = 0; i < (int)lbLoadedCtrl->count(); i++)
{
if (lbLoadedCtrl->isSelected(i))
{
selectedCtrl.append(i);
}
}
if (selectedCtrl.count() > 0)
{
// add controls to FileList
for (i = 0; i < (int)selectedCtrl.count(); i++)
{
TranslatedCtrl ctrl = translatedList[selectedCtrl[i]];
for (j = 0; j < (int)ctrl.fileCtrlIdx.count(); j++)
{
lbFileCtrl->insertItem(getName(ctrl.fileCtrlIdx[j]));
ctrlFileList.append(ctrl.fileCtrlIdx[j]);
}
}
// delete selected
for (i = 0; i < (int)selectedCtrl.count(); i++)
{
translatedList.remove(translatedList.at(selectedCtrl[i]));
lbLoadedCtrl->removeItem(selectedCtrl[i]);
}
}
}
void TransformPatchDlg::loadedDoubleClicked(QListBoxItem *item)
{
int idx = lbLoadedCtrl->index(item);
int i;
TranslatedCtrl ctrl = translatedList[idx];
for (;;)
{
FileControlDlg d(NULL, file, &ctrl);
if (d.exec() == QDialog::Accepted)
{
bool found = false;
// check name - in translated
for (i = 0; i < (int)translatedList.count(); i++)
{
if (i != idx && translatedList[i].name == ctrl.name)
{
found = true;
break;
}
}
// check in other
for (i = 0; i < (int)ctrlFileList.count(); i++)
{
EMU10k1Ctrl ctrl1;
file->getCtrl(ctrlFileList[i], &ctrl1);
if (ctrl.name == ctrl.name)
{
found = true;
break;
}
}
if (found)
{
QMessageBox::critical( 0, APP_NAME,
QString("There already is control with this name %1").arg(ctrl.name));
continue;
}
else
{
// update name
lbLoadedCtrl->changeItem(ctrl.name, idx);
translatedList[idx] = ctrl;
break;
}
}
else
break;
}
}
void TransformPatchDlg::fileDoubleClicked(QListBoxItem *item)
{
bool ok;
int idx = lbFileCtrl->index(item);
EMU10k1Ctrl ctrl;
file->getCtrl(ctrlFileList[idx], &ctrl);
QString text = ctrl.name;
text = QInputDialog::getText(
APP_NAME, "Control name:", QLineEdit::Normal,
text, &ok, this );
if (ok && !text.isEmpty())
{
ctrl.name= text;
file->setCtrl(ctrlFileList[idx], &ctrl);
lbFileCtrl->changeItem(getName(idx), idx);
}
}
int TransformPatchDlg::transformFile(LD10k1File **outFile)
{
// controls - translated
int i, j, err;
LD10k1File *of = NULL;
LD10k1FileTransfCtl translCtls[32];
for (i = 0; i < (int)translatedList.count(); i++)
{
TranslatedCtrl tctrl = translatedList[i];
translCtls[i].emu_ctl_count = (int)tctrl.fileCtrlIdx.count();
for (j = 0; j < translCtls[i].emu_ctl_count; j++)
translCtls[i].emu_ctls[j] = tctrl.fileCtrlIdx[j];
translCtls[i].ctl_name = tctrl.name;
}
if ((err = LD10k1File::transformFromEmuFile(file, translCtls, (int)translatedList.count(), outFile)) < 0)
return err;
of = *outFile;
// rename inputs
for (i = 0; i < of->getIOCount(false); i++)
of->setIOName(false, i, inputNames[i]);
// rename output
for (i = 0; i < of->getIOCount(true); i++)
of->setIOName(true, i, outputNames[i]);
// set others parameters for patch controls
for (i = 0; i < (int)translatedList.count(); i++)
{
TranslatedCtrl tctrl = translatedList[i];
switch (tctrl.translation)
{
case TranslatedCtrl::None:
of->setCtlTranslation(i, LD10k1File::None);
break;
case TranslatedCtrl::Table100:
of->setCtlTranslation(i, LD10k1File::Table100);
break;
case TranslatedCtrl::Bass:
of->setCtlTranslation(i, LD10k1File::Bass);
break;
case TranslatedCtrl::Treble:
of->setCtlTranslation(i, LD10k1File::Treble);
break;
case TranslatedCtrl::OnOff:
of->setCtlTranslation(i, LD10k1File::OnOff);
break;
}
of->setCtlValVCount(i, tctrl.visible);
for (j = 0; j < (int)tctrl.values.count(); j++)
of->setCtlVal(i, j, tctrl.values[j]);
}
return 0;
}

View file

@ -0,0 +1,65 @@
/*
* qlo10k1 - GUI frontend for ld10k1
*
* Copyright (c) 2004 by Peter Zubaj
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef TRANSFORMPATCHDIALOG_H
#define TRANSFORMPATCHDIALOG_H
#include <qstringlist.h>
#include <qvaluelist.h>
#include <qptrlist.h>
#include "dlgs/transformpatchbase.h"
#include "filecontroldialog.h"
#include "connectionwizard.h"
#include "structure.h"
#include "structure_patch.h"
#include "ld10k1file.h"
class TransformPatchDlg : public TransformPatchBase
{
Q_OBJECT
EMU10k1File *file;
QString fileName;
QStringList inputNames;
QStringList outputNames;
QValueList <int> ctrlFileList;
QValueList <TranslatedCtrl> translatedList;
public:
TransformPatchDlg(QString efileName, EMU10k1File *efile);
QString getName(int i);
int transformFile(LD10k1File **outFile);
public slots:
void okClicked();
void cancelClicked();
void inputsDoubleClicked(QListBoxItem *item);
void outputsDoubleClicked(QListBoxItem *item);
void ctrlAddClicked();
void ctrlDelClicked();
void loadedDoubleClicked(QListBoxItem *item);
void fileDoubleClicked(QListBoxItem *item);
};
#endif // TRANSFORMPATCHDIALOG_H