]> git.alsa-project.org Git - alsa-tools.git/commitdiff
Various fixes to qlo10k1
authorTakashi Iwai <tiwai@suse.de>
Fri, 3 Jun 2005 12:31:54 +0000 (12:31 +0000)
committerTakashi Iwai <tiwai@suse.de>
Fri, 3 Jun 2005 12:31:54 +0000 (12:31 +0000)
Various fixes by Tim <terminator356@users.sourceforge.net>:

- ld10k1 0.1.8p1 recommended for best operation.
- Fixed link disconnect bug.
- Now remembers last file open/save dir.
- Now unused IO/FX do not disappear upon refresh.
- Refresh/redraw fixups.

14 files changed:
qlo10k1/AUTHORS
qlo10k1/NEWS
qlo10k1/configure.in
qlo10k1/src/mainwnd.cpp
qlo10k1/src/mainwnd.h
qlo10k1/src/newiodialog.cpp
qlo10k1/src/newiodialog.h
qlo10k1/src/preferences.cpp
qlo10k1/src/routingwidget.cpp
qlo10k1/src/routingwidget_menu.cpp
qlo10k1/src/routingwidget_new.cpp
qlo10k1/src/strglobal.cpp
qlo10k1/src/structure_link.cpp
qlo10k1/src/structure_link.h

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