17 #include <QtGui/QAction>
18 #include <QtGui/QComboBox>
19 #include <QtGui/QFrame>
20 #include <QtGui/QLabel>
21 #include <QtGui/QLayout>
22 #include <QtGui/QMenuBar>
23 #include <QtGui/QMessageBox>
24 #include <QtGui/QMenu>
25 #include <QtGui/QPushButton>
26 #include <QtGui/QSplitter>
27 #include <QtGui/QVBoxLayout>
28 #include <QtGui/QToolBar>
29 #include <QtGui/QSlider>
30 #include <QtGui/QGridLayout>
31 #include <QtGui/QPixmap>
32 #include <QtGui/QCloseEvent>
56 #include <QtCore/QtDebug>
61 const char*
const CQLayoutMainWindow::ZOOM_FACTOR_STRINGS[] = {
"1%",
"2%",
"3%",
"4%",
"5%",
"10%",
"20%",
"25%",
"30%",
"40%",
"50%",
"75%",
"100%",
"150%",
"200%",
"300%",
"400%",
"500%",
"1000%"};
62 const double CQLayoutMainWindow::ZOOM_FACTORS[] = {0.01, 0.02, 0.03, 0.04, 0.05, 0.1, 0.2, 0.25, 0.3, 0.4, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 10.0};
67 , mpParaPanel(new CQParaPanel)
69 , mpMainBox(new QFrame(this))
70 , mpSplitter(new QSplitter(Qt::Horizontal, this->mpMainBox))
72 , mpTimeSlider(new QSlider(Qt::Horizontal))
74 , mpInfoBox(new QFrame)
77 , mCurrentPlace(QString::null)
78 , mpZoomActionGroup(new QActionGroup(this))
86 QVBoxLayout* mainLayout =
new QVBoxLayout(
mpMainBox);
87 QVBoxLayout* infoLayout =
new QVBoxLayout(
mpInfoBox);
123 this->
mpTimeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
126 QHBoxLayout* pGridLayout =
new QHBoxLayout(
mpFrame);
129 this->
mpFrame->setLayout(pGridLayout);
131 mainLayout->addWidget(this->
mpFrame);
135 this->QFrame::setLayout(
new QVBoxLayout);
136 this->layout()->addWidget(this->
mpMainBox);
284 if (pLayoutList != NULL)
288 if (pLayoutList->
size() > 0)
290 pLayout = (*pLayoutList)[0];
318 NodeSizePanel *panel =
new NodeSizePanel(
this);
325 FontChooser *fCh =
new FontChooser(
this);
370 std::string key, name;
390 std::string key, name;
445 "No data found: \nYou first have to create a time course.",
446 QMessageBox::Ok, QMessageBox::Ok);
458 assert(pPainter != NULL);
460 if (pPainter != NULL)
470 unsigned int imageWidth = pPainter->width();
471 unsigned int imageHeight = pPainter->height();
473 double width = (double)imageWidth / zoomFactor;
474 double height = (double)imageHeight / zoomFactor;
477 x, y, width, height, pPainter->width() , pPainter->height(), lastFrame,
this);
479 if (pDialog->exec() == QDialog::Accepted)
483 QString fileName =
CopasiFileDialog::getSaveFileName(
this,
"Save Image Dialog", QString(
"untitled.png"), QString(
"PNG (*.png);;All files (*)"), QString(
"Choose a filename to save the image(s) under"));
485 if (!fileName.isEmpty() && !fileName.isNull())
488 std::vector<size_t> v;
497 for (
size_t i = 1; i <= lastFrame; ++i)
515 "The frame selection was invalid.\nExporting current frame.",
516 QMessageBox::Ok, QMessageBox::Ok);
532 "The image could not be created.",
533 QMessageBox::Ok, QMessageBox::Ok);
652 QImage img = QImage(w, h, QImage::Format_Indexed8);
654 img.setColor(0, qRgb(0, 0, 200));
657 for (x = 0; x < w; x++)
659 for (y = 0; y < h; y++)
661 img.setPixel(x, y, 0);
666 img.setColor(1, qRgb(255, 0, 0));
668 for (x = 3; x < w - 3; x++)
670 for (y = 3 + delta; y < h - 3 - delta; y++)
672 img.setPixel(x, y, 1);
675 if (fmod((
double) x, 2.0) == 0)
679 QPixmap *pixmap =
new QPixmap();
680 pixmap->fromImage(img);
681 QIcon iconset = QIcon(*pixmap);
690 QImage img = QImage(w, h, QImage::Format_Indexed8);
692 img.setColor(0, qRgb(0, 0, 200));
695 for (x = 0; x < w; x++)
697 for (y = 0; y < h; y++)
699 img.setPixel(x, y, 0);
704 img.setColor(1, qRgb(255, 0, 0));
706 for (x = (delta - 1); x <= (w - delta); x++)
708 for (y = (delta - 1); y <= (h - delta); y++)
710 img.setPixel(x, y, 1);
714 QPixmap *pixmap =
new QPixmap();
715 pixmap->fromImage(img);
716 QIcon iconset = QIcon(*pixmap);
761 s.remove(s.size() - 1, 1);
763 double n = s.toDouble();
770 if (this->
mpLayout == pLayout)
return;
841 this->
showStep((
double)currentStep);
858 this->
showStep((
double)currentStep);
903 (checked ==
true) ? this->
mpFrame->show() : this->
mpFrame->hide();
void changeStepValue(int i)
std::string getKeyForRow(int row) const
void setFontSizeForLabels(C_INT32 size)
CQPlayerControlWidget * getControlWidget()
MAPPING_MODE mMappingMode
C_FLOAT64 getMinNodeSize()
void changeMinMaxNodeSizes()
CQParaPanel * mpParaPanel
void setMaxNodeSize(C_FLOAT64 minNdSize)
virtual size_t size() const
void setIndividualScaling()
SCALING_MODE mScalingMode
bool getValueForRow(int row) const
QAction * mpParameterTableAction
void slotParameterTableToggled(bool checked)
void setZoomFactor(double zoom)
void setValueOnSlider(C_INT32)
void setZoomFactor(QString s)
C_FLOAT64 getOrigValueForSpecies(std::string nodeKey)
void slotLoopActivated(bool checked)
bool getAnimationRunning()
CVisParameters * mpVisParameters
const CQGLNetworkPainter * getPainter() const
QAction * mpValueTableAction
CDataEntity * getDataSetAt(size_t stepNumber)
void removeItemInAnimation(std::string s)
void mapLabelsToCircles()
size_t getCurrentStep() const
unsigned int getImageWidth() const
static const double ZOOM_FACTORS[]
void insertValueTable(CDataEntity dataSet)
void setMinValue(C_INT32 minNdSize)
static const char *const ZOOM_FACTOR_STRINGS[]
static StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void mapLabelsToCircles()
void endOfAnimationReached()
void rescaleDataSets(CVisParameters::SCALING_MODE scaleMode)
void mapLabelsToRectangles()
void createGraph(CLayout *lP)
const C_FLOAT64 & getX() const
void setAnimationRunning(bool animationRunningP)
size_t getNumberOfSteps() const
static const QIcon & icon(const IconID &id)
CQGLViewport * mpGLViewport
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void setRowInTable(int row, std::string key, std::string s, C_FLOAT64 val)
CVisParameters::SCALING_MODE getScalingMode()
unsigned int getImageHeight() const
void setMinNodeSize(C_FLOAT64 minNdSize)
void setScaleMode(CVisParameters::SCALING_MODE scaleMode)
std::string getNameForNodeKey(std::string key)
C_INT32 getStepsPerSecond()
C_FLOAT64 getCurrentPositionY() const
void setLayout(CLayout *pLayout)
void stepBackwardAnimation()
const C_FLOAT64 & getY() const
void setMaxValue(C_INT32 maxNdSize)
void setFontSizeForLabels(unsigned int fs)
CQPlayerControlWidget * mpControlWidget
FRAME_OPTION getFrameOption() const
void slotPlayerControlToggled(bool checked)
void slotToolbarToggled(bool checked)
bool export_bitmap(double x, double y, double width, double height, unsigned int imageWidth, unsigned int imageHeight, const QString &filename, const std::vector< size_t > frames)
void rescaleDataSetsWithNewMinMax(C_FLOAT64 oldMin, C_FLOAT64 oldMax, C_FLOAT64 newMin, C_FLOAT64 newMax, CVisParameters::SCALING_MODE scaleMode)
void parameterTableValueChanged(int row)
const CLPoint & getGraphMax()
void updateValueTable(CDataEntity dataSet)
std::string getNodeNameEntry(int i)
C_FLOAT64 getCurrentPositionX() const
C_FLOAT64 getZoomFactor() const
void setStepsPerSecond(C_INT16 val)
size_t getNumberOfElements()
CQLayoutMainWindow(QWidget *pParent)
void setNumRows(int rows)
void addItemInAnimation(std::string s)
C_FLOAT64 getMaxNodeSize()
void mapLabelsToRectangles()
void setItemAnimated(std::string key, bool animatedP)
bool isCircleMode() const
CQCurrentValueTable * mpValTable
void setNumCols(int columns)
CVisParameters::MAPPING_MODE getMappingMode()
void updateRowInTable(int row, C_FLOAT64 val)
const CLPoint & getGraphMin()
void slotValueTableToggled(bool checked)
void setMinAndMaxValue(C_INT32 minNdSize, C_INT32 maxNdSize)
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void stepForwardAnimation()
const std::set< size_t > & getFrameSet() const