00001 /*************************************************************************** 00002 * SpikeStream Application * 00003 * Copyright (C) 2007 by David Gamez * 00004 * david@davidgamez.eu * 00005 * Version 0.1 * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 00023 #ifndef LAYERWIDGET_H 00024 #define LAYERWIDGET_H 00025 00026 //SpikeStream includes 00027 #include "DBInterface.h" 00028 #include "LayerManager.h" 00029 #include "ConnectionWidget.h" 00030 00031 //Qt includes 00032 #include <qpopupmenu.h> 00033 #include <qpoint.h> 00034 #include <qpixmap.h> 00035 #include <qwidget.h> 00036 #include <qtable.h> 00037 00038 //Other includes 00039 #include <string> 00040 00041 00042 //-------------------------- Layer Widget -------------------------------- 00043 /*! Displays layers in a table and allows control over visibility and 00044 zooming. Initialises the creation, editing and deletion of layers. */ 00045 //------------------------------------------------------------------------- 00046 00047 class LayerWidget : public QWidget { 00048 Q_OBJECT 00049 00050 public: 00051 LayerWidget(QWidget *parent, DBInterface* netDBInter, DBInterface* devDBInter); 00052 ~LayerWidget(); 00053 void reloadNeuronGroups(); 00054 void setConnectionWidget(ConnectionWidget*); 00055 void simulationDestroyed(); 00056 void simulationInitialised(); 00057 00058 00059 private slots: 00060 void deleteLayer(); 00061 void editLayerProperties(); 00062 void newLayer(); 00063 void tableClicked(int, int, int, const QPoint &); 00064 void tableHeaderClicked(int); 00065 00066 00067 private: 00068 //=========================== VARIABLES ======================================= 00069 //Database handling class 00070 DBInterface* networkDBInterface; 00071 DBInterface* deviceDBInterface; 00072 00073 //References to enable communication with other classes 00074 ConnectionWidget *connectionWidget; 00075 LayerManager* layerManager; 00076 00077 /*! Table holding all the information about the layers.*/ 00078 QTable *layerTable; 00079 00080 //Variables used to edit a layer 00081 QPopupMenu *layerPropertiesPopup; 00082 unsigned int activeRow; 00083 00084 //Buttons 00085 QPushButton *newLayerButt; 00086 QPushButton *deleteButt; 00087 00088 //Pixmaps used for zooming and showing and hiding layers 00089 QPixmap *showPixmap; 00090 QPixmap *hidePixmap; 00091 QPixmap *zoomToPixmap; 00092 QPixmap *zoomToPixmapHighlight; 00093 QPixmap *zoomAbovePixmapHighlight; 00094 00095 /*! Contains the layer IDs of the visible layers. Should match the list of 00096 layer IDs in the network viewer.*/ 00097 vector<unsigned int> viewVector; 00098 00099 //Variables to control zooming in and out of layers 00100 /*! Records which layer is highlighted.*/ 00101 int zoomLayerRow; 00102 00103 /*! Records how many clicks on a layer.*/ 00104 int zoomClickCount; 00105 00106 00107 //============================ METHODS ======================================== 00108 /*! Declare copy constructor private so it cannot be used inadvertently.*/ 00109 LayerWidget (const LayerWidget&); 00110 00111 /*! Declare assignment private so it cannot be used inadvertently.*/ 00112 LayerWidget operator = (const LayerWidget&); 00113 00114 void addAllLayersToTable(); 00115 void addLayerToTable(unsigned int); 00116 void clearTable(); 00117 string getNeuronTypeDescription(unsigned short); 00118 void removeLayerFromTable(unsigned int); 00119 00120 }; 00121 00122 00123 #endif//LAYERWIDGET_H
1.4.4