COPASI API  4.16.103
Classes | Public Types | Public Slots | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CQNewMainWindow Class Reference

#include <CQNewMainWindow.h>

Inheritance diagram for CQNewMainWindow:
Inheritance graph
[legend]
Collaboration diagram for CQNewMainWindow:
Collaboration graph
[legend]

Classes

struct  REACTION_SELECTION_ITEM
 

Public Types

enum  DISPLAY_MODE { GRAPH_MODE, ANIMATION_MODE }
 
enum  REACTION_SELECTION_BITS {
  ROLE_UNSPECIFIED = 1, ROLE_SUBSTRATE = 2, ROLE_SIDESUBSTRATE = 4, ROLE_PRODUCT = 8,
  ROLE_SIDEPRODUCT = 16, ROLE_MODIFIER = 32, ROLE_ACTIVATOR = 64, ROLE_INHIBITOR = 128,
  REACTION_GLYPH = 256, ASSOCIATED_SPECIES_GLYPHS = 512
}
 

Public Slots

void changeColorSlot (bool)
 
void checkForElementaryModesSlot ()
 
virtual void closeEvent (QCloseEvent *event)
 
void elementaryModeTriggeredSlot (QAction *pAction)
 
void export_bitmap (const QString &filename, double scale=4.0)
 
void export_bitmap (const QString &filename, double x, double y, double width, double height, unsigned int imageWidth, unsigned int imageHeight, bool drawSelection)
 
void fogDensitySlot (bool)
 
void selectMetabolite (const CMetab *pMetab, std::set< const CLGraphicalObject * > &s)
 
void selectReaction (const CReaction *pReaction, unsigned int selectionMask, std::set< const CLGraphicalObject * > &s)
 
void setStatusMessage (const QString &message, int timeout)
 
void slotFitToScreen ()
 
void slotLayoutChanged (int index)
 
void slotLayoutFinished ()
 
void slotLayoutStateChanged (QSharedPointer< CLayoutState > state)
 
void slotRenderInfoChanged (int index)
 
void slotResetView ()
 
void slotRunSpringLayout ()
 
void slotScreenshot ()
 
void slotSingleCurveSelected (bool selected)
 
void slotZoomChanged (int index)
 
void slotZoomMenuItemActivated (QAction *)
 
void switchMode ()
 
void toggleHighlightSlot (bool checked)
 
void updateLayoutList ()
 

Public Member Functions

 CQNewMainWindow (CCopasiDataModel *pDatamodel)
 
void createSpringLayout (int numIterations, int updateInterval)
 
virtual QMenu * getWindowMenu () const
 
void randomizeLayout ()
 
void redrawNow ()
 
void setMode (DISPLAY_MODE mode=GRAPH_MODE)
 
void updateRenderer ()
 
virtual ~CQNewMainWindow ()
 
- Public Member Functions inherited from CWindowInterface
void addToMainWindow (CopasiUI3Window *window=NULL)
 
 CWindowInterface (QWidget *parent=NULL, Qt::WindowFlags flags=NULL)
 
void removeFromMainWindow (CopasiUI3Window *window=NULL)
 
virtual void saveToFile (const QString &fileName) const
 
virtual ~CWindowInterface ()
 

Protected Slots

void slotCalculateDimensions ()
 
void slotRunRandomizeLayout ()
 
void slotStopClicked ()
 

Protected Member Functions

void addDefaultRenderInfoItemsToList ()
 
void addGlobalRenderInfoItemsToList ()
 
void change_style (bool defaultStyle=false)
 
void resetView ()
 
void updateRenderInformationList ()
 

Protected Attributes

CLayoutmpCopy
 
CQLayoutThreadmpLayoutThread
 

Private Member Functions

void createActions ()
 
void createMenus ()
 
void createStatusBar ()
 
void createToolBars ()
 
void setAnimationMenu ()
 
void setAnimationToolbar ()
 
void setGraphMenu ()
 
void setGraphToolbar ()
 

Private Attributes

QIcon mAnimationIcon
 
std::string mCurDir
 
bool mDocumentChanged
 
std::vector< const CFluxMode * > mFluxModes
 
QIcon mGraphIcon
 
std::set< std::string > mHighlightedMetabolites
 
std::set< REACTION_SELECTION_ITEMmHighlightedReactions
 
DISPLAY_MODE mMode
 
CQLayoutMainWindowmpAnimationWindow
 
QAction * mpCalculateDimensions
 
QAction * mpChangeColorAction
 
QAction * mpCircularShape
 
QAction * mpCloseAct
 
CLayoutmpCurrentLayout
 
CLRenderInformationBasempCurrentRenderInformation
 
CCopasiDataModelmpDataModel
 
QMenu * mpElementaryModesMenu
 
QMenu * mpFileMenu
 
QToolBar * mpFileToolBar
 
QPixmap * mpFogColorPixmap
 
QAction * mpFogDensityAction
 
QPixmap * mpHighlightColorPixmap
 
QAction * mpHighlightModeAction
 
QComboBox * mpLayoutDropdown
 
QMenu * mpLayoutMenu
 
CQGLLayoutViewermpLayoutViewer
 
QAction * mpLoadDataAct
 
QAction * mpLoopItemAction
 
QAction * mpMimaNodeSizes
 
QMenu * mpOptionsMenu
 
QMenu * mpPlayMenu
 
QAction * mpRandomizeLayout
 
QAction * mpRectangularShape
 
QComboBox * mpRenderDropdown
 
QLabel * mpRenderLabel
 
QAction * mpRevertCurveAct
 
QAction * mpScreenshotAct
 
QToolBar * mpSelectionToolBar
 
QAction * mpSFontSize
 
QAction * mpStopLayoutAction
 
QAction * mpSwitchModeAct
 
QMenu * mpViewMenu
 
QStackedWidget * mpWidgetStack
 
QMenu * mpWindowMenu
 
QActionGroup * mpZoomActionGroup
 
QComboBox * mpZoomDropdown
 
QMenu * mpZoomMenu
 

Static Private Attributes

static const char *const ZOOM_FACTOR_STRINGS [] = {"1%", "2%", "3%", "4%", "5%", "10%", "20%", "25%", "30%", "40%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "500%", "1000%"}
 
static const double 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}
 

Detailed Description

Definition at line 49 of file CQNewMainWindow.h.

Member Enumeration Documentation

Enumerator
GRAPH_MODE 
ANIMATION_MODE 

Definition at line 55 of file CQNewMainWindow.h.

Enumerator
ROLE_UNSPECIFIED 
ROLE_SUBSTRATE 
ROLE_SIDESUBSTRATE 
ROLE_PRODUCT 
ROLE_SIDEPRODUCT 
ROLE_MODIFIER 
ROLE_ACTIVATOR 
ROLE_INHIBITOR 
REACTION_GLYPH 
ASSOCIATED_SPECIES_GLYPHS 

Definition at line 63 of file CQNewMainWindow.h.

Constructor & Destructor Documentation

CQNewMainWindow::CQNewMainWindow ( CCopasiDataModel pDatamodel)

Definition at line 100 of file CQNewMainWindow.cpp.

References addDefaultRenderInfoItemsToList(), addGlobalRenderInfoItemsToList(), CQIconResource::copasi, createActions(), createMenus(), createStatusBar(), createToolBars(), DEFAULT_STYLES, CQGLLayoutPainter::getFogColor(), CQGLLayoutPainter::getHighlightColor(), CQGLLayoutViewer::getPainter(), CQLayoutThread::getParameterWindow(), CCopasiDataModel::getReferenceDirectory(), CQIconResource::icon(), loadDefaultStyles(), mCurDir, mpAnimationWindow, mpChangeColorAction, mpFogColorPixmap, mpHighlightColorPixmap, mpLayoutThread, mpLayoutViewer, mpViewMenu, mpWidgetStack, setStatusMessage(), slotLayoutFinished(), slotLayoutStateChanged(), slotSingleCurveSelected(), and updateLayoutList().

100  :
103  mpWidgetStack(NULL),
104  mpLayoutViewer(NULL),
105  mpAnimationWindow(NULL),
106  mpDataModel(pDatamodel),
107  mpCurrentLayout(NULL),
109  mDocumentChanged(false),
110  mCurDir(""),
111  mGraphIcon(QPixmap(graph_xpm)),
112  mAnimationIcon(QPixmap(film_strip_xpm))
113  , mpFogColorPixmap(new QPixmap(32, 32))
114  , mpHighlightColorPixmap(new QPixmap(32, 32))
115  , mpHighlightModeAction(NULL)
116  , mpChangeColorAction(NULL)
117  , mpStopLayoutAction(NULL)
118  , mpRandomizeLayout(NULL)
119  , mpCalculateDimensions(NULL)
120  , mpLayoutThread(NULL)
121  , mpCopy(NULL)
122 {
123 
124 #ifndef Darwin
126 #endif // not Darwin
127 
128  // first we load the default styles if they don't already exist
129  if (DEFAULT_STYLES == NULL)
130  {
132  }
133 
134  this->mCurDir = pDatamodel->getReferenceDirectory();
135  this->mpWidgetStack = new QStackedWidget(this);
136  this->mpLayoutViewer = new CQGLLayoutViewer(this->mpWidgetStack);
137  // add the first page
138  this->mpWidgetStack->addWidget(this->mpLayoutViewer);
140  this->mpWidgetStack->addWidget(this->mpAnimationWindow);
141  connect(this->mpLayoutViewer, SIGNAL(singleCurveSelected(bool)), this, SLOT(slotSingleCurveSelected(bool)));
142  connect(this->mpLayoutViewer->getPainter(), SIGNAL(status_message(const QString&, int)), this, SLOT(setStatusMessage(const QString&, int)));
143  createActions();
144  createMenus();
145  createToolBars();
146  createStatusBar();
147 
148  this->setCentralWidget(this->mpWidgetStack);
149  setUnifiedTitleAndToolBarOnMac(true);
152  this->updateLayoutList();
153  // fill the two pixmaps with the current fog and highlight color
154  // We have to do that after the call to updateLayoutList because before that call
155  // the rnederer does not exist yet.
156  const GLfloat* c = this->mpLayoutViewer->getPainter()->getFogColor();
157  this->mpFogColorPixmap->fill(QColor((int)(c[0] * 255.0), (int)(c[1] * 255.0), (int)(c[2] * 255.0), (int)(c[3] * 255.0)));
159  this->mpHighlightColorPixmap->fill(QColor((int)(c[0] * 255.0), (int)(c[1] * 255.0), (int)(c[2] * 255.0), (int)(c[3] * 255.0)));
160  this->mpChangeColorAction->setIcon(QIcon(*this->mpHighlightColorPixmap));
161 
162  mpLayoutThread = new CQLayoutThread(this);
163  connect(mpLayoutThread, SIGNAL(layoutFinished()), this, SLOT(slotLayoutFinished()));
164  connect(mpLayoutThread, SIGNAL(layoutStateChanged(QSharedPointer<CLayoutState>)),
165  this, SLOT(slotLayoutStateChanged(QSharedPointer<CLayoutState>)));
166 
167  QDockWidget* pParameterWindow = mpLayoutThread->getParameterWindow();
168 
169  addDockWidget(Qt::LeftDockWidgetArea, pParameterWindow);
170  mpViewMenu->addSeparator();
171  mpViewMenu->addAction(pParameterWindow->toggleViewAction());
172 }
CWindowInterface(QWidget *parent=NULL, Qt::WindowFlags flags=NULL)
QAction * mpChangeColorAction
void setStatusMessage(const QString &message, int timeout)
QPixmap * mpFogColorPixmap
const GLfloat * getHighlightColor() const
CQGLLayoutPainter * getPainter()
QAction * mpStopLayoutAction
void slotLayoutStateChanged(QSharedPointer< CLayoutState > state)
CLayout * mpCurrentLayout
CQLayoutThread * mpLayoutThread
CCopasiVector< CLGlobalRenderInformation > * DEFAULT_STYLES
CCopasiDataModel * mpDataModel
CLRenderInformationBase * mpCurrentRenderInformation
const std::string & getReferenceDirectory() const
CCopasiVector< CLGlobalRenderInformation > * loadDefaultStyles()
QPixmap * mpHighlightColorPixmap
void slotSingleCurveSelected(bool selected)
CQLayoutMainWindow * mpAnimationWindow
static const QIcon & icon(const IconID &id)
void addGlobalRenderInfoItemsToList()
QAction * mpHighlightModeAction
DISPLAY_MODE mMode
const GLfloat * getFogColor() const
void addDefaultRenderInfoItemsToList()
std::string mCurDir
QAction * mpRandomizeLayout
QDockWidget * getParameterWindow()
QAction * mpCalculateDimensions
CQGLLayoutViewer * mpLayoutViewer
QStackedWidget * mpWidgetStack
CQNewMainWindow::~CQNewMainWindow ( )
virtual

Definition at line 84 of file CQNewMainWindow.cpp.

References mpCopy, mpLayoutThread, CWindowInterface::removeFromMainWindow(), and CQLayoutThread::terminateLayout().

85 {
86  // ensure layout is terminated
88 
89  // delete layout copy
90  if (mpCopy != NULL)
91  {
92  delete mpCopy;
93  mpCopy = NULL;
94  }
95 
96  // remove from window menu
98 }
void removeFromMainWindow(CopasiUI3Window *window=NULL)
CQLayoutThread * mpLayoutThread

Member Function Documentation

void CQNewMainWindow::addDefaultRenderInfoItemsToList ( )
protected

Definition at line 748 of file CQNewMainWindow.cpp.

References getDefaultStyle(), CLRenderInformationBase::getKey(), CLRenderInformationBase::getName(), getNumDefaultStyles(), mpRenderDropdown, and slotRenderInfoChanged().

Referenced by CQNewMainWindow().

749 {
750  // disconnect the slot
751  disconnect(this->mpRenderDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotRenderInfoChanged(int)));
752  size_t i, iMax = getNumDefaultStyles();
753  CLRenderInformationBase* pTmpRenderInfo = NULL;
754 
755  for (i = 0; i < iMax; ++i)
756  {
757  pTmpRenderInfo = getDefaultStyle(i);
758  std::string text = pTmpRenderInfo->getKey();
759 
760  if (!pTmpRenderInfo->getName().empty())
761  {
762  text = pTmpRenderInfo->getName();
763  //text += " (";
764  //text += pTmpRenderInfo->getName();
765  //text += ")";
766  }
767 
768  this->mpRenderDropdown->addItem(QString(text.c_str()));
769  }
770 
771  // reconnect the slot
772  connect(this->mpRenderDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotRenderInfoChanged(int)));
773 }
QComboBox * mpRenderDropdown
CLGlobalRenderInformation * getDefaultStyle(size_t index)
size_t getNumDefaultStyles()
const std::string & getKey() const
const std::string & getName() const
void slotRenderInfoChanged(int index)
void CQNewMainWindow::addGlobalRenderInfoItemsToList ( )
protected

Definition at line 720 of file CQNewMainWindow.cpp.

References CLRenderInformationBase::getKey(), CListOfLayouts::getListOfGlobalRenderInformationObjects(), CCopasiDataModel::getListOfLayouts(), CLRenderInformationBase::getName(), CListOfLayouts::getRenderInformation(), mpDataModel, mpRenderDropdown, CCopasiVector< T >::size(), and slotRenderInfoChanged().

Referenced by CQNewMainWindow().

721 {
722  // disconnect the slot
723  disconnect(this->mpRenderDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotRenderInfoChanged(int)));
724  this->mpRenderDropdown->clear();
726  CLRenderInformationBase* pTmpRenderInfo = NULL;
727 
728  for (i = 0; i < iMax; ++i)
729  {
730  pTmpRenderInfo = this->mpDataModel->getListOfLayouts()->getRenderInformation(i);
731  std::string text = pTmpRenderInfo->getKey();
732 
733  if (!pTmpRenderInfo->getName().empty())
734  {
735  text = pTmpRenderInfo->getName();
736  //text += " (";
737  //text += pTmpRenderInfo->getName();
738  //text += ")";
739  }
740 
741  this->mpRenderDropdown->addItem(QString(text.c_str()));
742  }
743 
744  // reconnect the slot
745  connect(this->mpRenderDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotRenderInfoChanged(int)));
746 }
QComboBox * mpRenderDropdown
virtual size_t size() const
CCopasiDataModel * mpDataModel
CListOfLayouts * getListOfLayouts()
CLGlobalRenderInformation * getRenderInformation(size_t index)
const std::string & getKey() const
const std::string & getName() const
void slotRenderInfoChanged(int index)
const CCopasiVector< CLGlobalRenderInformation > & getListOfGlobalRenderInformationObjects() const
void CQNewMainWindow::change_style ( bool  defaultStyle = false)
protected

Definition at line 836 of file CQNewMainWindow.cpp.

References CQGLLayoutViewer::change_style(), mpCurrentRenderInformation, and mpLayoutViewer.

Referenced by slotRenderInfoChanged().

837 {
838  this->mpLayoutViewer->change_style(this->mpCurrentRenderInformation, defaultStyle);
839 }
CLRenderInformationBase * mpCurrentRenderInformation
void change_style(const CLRenderInformationBase *pRenderInfo, bool defaultStyle=false)
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::changeColorSlot ( bool  )
slot

This slot is triggered when the user wants to change the fog or the highlighting color, depending on the current highlighting mode.

Definition at line 1589 of file CQNewMainWindow.cpp.

References CQGLLayoutPainter::getFogColor(), CQGLLayoutPainter::getHighlightColor(), CQGLLayoutViewer::getPainter(), GRAPH_MODE, mMode, mpChangeColorAction, mpFogColorPixmap, mpHighlightColorPixmap, mpHighlightModeAction, mpLayoutViewer, CQGLLayoutPainter::setFogColor(), CQGLLayoutPainter::setHighlightColor(), and CQGLLayoutPainter::update().

Referenced by createMenus().

1590 {
1591  // find the correct color for the current mode
1592  const GLfloat* c = NULL;
1593 
1594  if (this->mpHighlightModeAction->isChecked())
1595  {
1597  }
1598  else
1599  {
1600  c = this->mpLayoutViewer->getPainter()->getFogColor();
1601  }
1602 
1603  // open a color selection dialog
1604  QColorDialog* pDialog = new QColorDialog(QColor((int)(c[0] * 255.0), (int)(c[1] * 255.0), (int)(c[2] * 255.0), (int)(c[3] * 255.0)), this);
1605 
1606  if (pDialog->exec() == QDialog::Accepted)
1607  {
1608  // the dialog has been closed with the OK button
1609  // so we need to get the new color
1610  QColor color = pDialog->selectedColor();
1611  GLfloat newColor[4] = {static_cast<GLfloat>(color.red()) / 255.0f, static_cast<GLfloat>(color.green()) / 255.0f, static_cast<GLfloat>(color.blue()) / 255.0f, static_cast<GLfloat>(color.alpha()) / 255.0f};
1612 
1613  // update the pixmap and the icon for the mpHighlightModeAction
1614  if (this->mpHighlightModeAction->isChecked())
1615  {
1616  this->mpLayoutViewer->getPainter()->setHighlightColor(newColor);
1617  this->mpHighlightColorPixmap->fill(color);
1618  this->mpChangeColorAction->setIcon(QIcon(*this->mpHighlightColorPixmap));
1619  }
1620  else
1621  {
1622  this->mpLayoutViewer->getPainter()->setFogColor(newColor);
1623  this->mpFogColorPixmap->fill(color);
1624  this->mpChangeColorAction->setIcon(QIcon(*this->mpFogColorPixmap));
1625  }
1626 
1627  // redraw the GL window
1628  if (this->mMode == GRAPH_MODE)
1629  {
1630  this->mpLayoutViewer->getPainter()->update();
1631  }
1632  }
1633 }
QAction * mpChangeColorAction
QPixmap * mpFogColorPixmap
const GLfloat * getHighlightColor() const
CQGLLayoutPainter * getPainter()
void setHighlightColor(const GLfloat c[4])
QPixmap * mpHighlightColorPixmap
void setFogColor(const GLfloat c[4])
QAction * mpHighlightModeAction
DISPLAY_MODE mMode
const GLfloat * getFogColor() const
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::checkForElementaryModesSlot ( )
slot

Checks for calculated elementary modes.

Definition at line 1127 of file CQNewMainWindow.cpp.

References elementaryModeTriggeredSlot(), CEFMTask::getFluxModeDescription(), CEFMProblem::getFluxModes(), CCopasiTask::getProblem(), CCopasiDataModel::getTaskList(), mFluxModes, mpDataModel, mpElementaryModesMenu, and pTask.

Referenced by createMenus().

1128 {
1129  bool fluxModesChanged = false;
1130 
1131  if (this->mpDataModel != NULL)
1132  {
1133  const CCopasiVectorN< CCopasiTask >* pTaskList = this->mpDataModel->getTaskList();
1134  assert(pTaskList != NULL);
1135 
1136  if (pTaskList != NULL)
1137  {
1138  // get the metabolic control analysis task object
1139  const CEFMTask* pTask = dynamic_cast<const CEFMTask*>((*pTaskList)["Elementary Flux Modes"]);
1140 
1141  if (pTask != NULL)
1142  {
1143  const CEFMProblem* pProblem = dynamic_cast<const CEFMProblem*>(pTask->getProblem());
1144 
1145  if (pProblem != NULL && !pProblem->getFluxModes().empty())
1146  {
1147  const std::vector< CFluxMode >& fluxModes = pProblem->getFluxModes();
1148  size_t iMax = fluxModes.size();
1149 
1150  if (this->mFluxModes.size() != iMax)
1151  {
1152  fluxModesChanged = true;
1153  }
1154  else
1155  {
1156  unsigned int i = 0;
1157 
1158  while (i < iMax && fluxModesChanged == false)
1159  {
1160  if (&(fluxModes[i]) != this->mFluxModes[i])
1161  {
1162  fluxModesChanged = true;
1163  }
1164 
1165  ++i;
1166  }
1167  }
1168 
1169  if (fluxModesChanged)
1170  {
1171  this->mpElementaryModesMenu->clear();
1172  this->mFluxModes.clear();
1173 
1174  if (fluxModes.empty())
1175  {
1176  this->mpElementaryModesMenu->addAction("None");
1177  disconnect(this->mpElementaryModesMenu, SIGNAL(triggered(QAction*)), this, SLOT(elementaryModeTriggeredSlot(QAction*)));
1178  }
1179  else
1180  {
1181  unsigned int i = 0;
1182  const CFluxMode* pFluxMode = NULL;
1183 
1184  while (i < iMax)
1185  {
1186  pFluxMode = &(fluxModes[i]);
1187  this->mFluxModes.push_back(pFluxMode);
1188  std::string desc = pTask->getFluxModeDescription(*pFluxMode);
1189  QAction* pAction = this->mpElementaryModesMenu->addAction(QString(desc.c_str()));
1190  pAction->setCheckable(true);
1191  ++i;
1192  }
1193 
1194  connect(this->mpElementaryModesMenu, SIGNAL(triggered(QAction*)), this, SLOT(elementaryModeTriggeredSlot(QAction*)));
1195  }
1196  }
1197  }
1198  }
1199  }
1200  }
1201 }
void elementaryModeTriggeredSlot(QAction *pAction)
CCopasiProblem * getProblem()
std::string getFluxModeDescription(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:132
std::vector< const CFluxMode * > mFluxModes
CCopasiDataModel * mpDataModel
CTSSATask * pTask
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMProblem.cpp:80
CCopasiVectorN< CCopasiTask > * getTaskList()
QMenu * mpElementaryModesMenu
void CQNewMainWindow::closeEvent ( QCloseEvent *  event)
virtualslot

Definition at line 1853 of file CQNewMainWindow.cpp.

References CWindowInterface::removeFromMainWindow(), and slotStopClicked().

1854 {
1855  this->slotStopClicked();
1857  this->QMainWindow::closeEvent(event);
1858 }
void removeFromMainWindow(CopasiUI3Window *window=NULL)
void CQNewMainWindow::createActions ( )
private

Definition at line 179 of file CQNewMainWindow.cpp.

References CQIconResource::icon(), mAnimationIcon, mpAnimationWindow, mpCalculateDimensions, mpCircularShape, mpCloseAct, mpLayoutViewer, mpLoadDataAct, mpMimaNodeSizes, mpRandomizeLayout, mpRectangularShape, mpRevertCurveAct, mpScreenshotAct, mpSFontSize, mpStopLayoutAction, mpSwitchModeAct, CQIconResource::roll, slotCalculateDimensions(), slotRunRandomizeLayout(), slotRunSpringLayout(), slotScreenshot(), and switchMode().

Referenced by CQNewMainWindow().

180 {
181 
182  mpSwitchModeAct = new QAction(mAnimationIcon, tr("Animation Mode"), this);
183  mpSwitchModeAct->setStatusTip(tr("Switch to animation mode."));
184  mpSwitchModeAct->setShortcut(Qt::CTRL + Qt::Key_M);
185  mpSwitchModeAct->setEnabled(true);
186  connect(mpSwitchModeAct, SIGNAL(triggered()), this, SLOT(switchMode()));
187  mpRevertCurveAct = new QAction(QPixmap(revert_curve_xpm), tr("Revert curve"), this);
188  mpRevertCurveAct->setStatusTip(tr("Reverts the currently selected curve."));
189  mpRevertCurveAct->setEnabled(false);
190  connect(mpRevertCurveAct, SIGNAL(triggered()), this->mpLayoutViewer, SLOT(slotRevertCurve()));
191 
192  mpScreenshotAct = new QAction(QPixmap(photo), tr("Export bitmap..."), this);
193  mpScreenshotAct->setStatusTip(tr("Export diagram as bitmap."));
194  mpScreenshotAct->setShortcut(Qt::CTRL + Qt::Key_E);
195  mpScreenshotAct->setEnabled(true);
196  connect(mpScreenshotAct, SIGNAL(triggered()), this, SLOT(slotScreenshot()));
197 
198  mpCloseAct = new QAction(tr("Close"), this);
199  mpCloseAct->setShortcut(tr("Ctrl+W"));
200  mpCloseAct->setStatusTip(tr("Close Diagram"));
201  connect(mpCloseAct, SIGNAL(triggered()), this, SLOT(close()));
202 
203  mpLoadDataAct = new QAction(QPixmap(load_data_xpm), tr("Update Trajectory Data"), this);
204  mpLoadDataAct->setStatusTip(tr("Update time course data"));
205  mpLoadDataAct->setEnabled(true);
206  connect(this->mpLoadDataAct, SIGNAL(activated()), this->mpAnimationWindow, SLOT(loadData()));
207 
208  mpRectangularShape = new QAction("Rectangle", this);
209  //mpRectangularShape->setShortcut(Qt::CTRL + Qt::Key_R);
210  mpRectangularShape->setStatusTip("Show labels as rectangles");
211  connect(mpRectangularShape, SIGNAL(activated()), this->mpAnimationWindow, SLOT(mapLabelsToRectangles()));
212 
213  mpCircularShape = new QAction("Circle", this);
214  //mpCircularShape->setShortcut(Qt::CTRL + Qt::Key_C);
215  mpCircularShape->setStatusTip("Show labels as circles");
216  connect(mpCircularShape, SIGNAL(activated()), this->mpAnimationWindow, SLOT(mapLabelsToCircles()));
217 
218  mpMimaNodeSizes = new QAction("Set Min/Max Node Sizes", this);
219  //mpMimaNodeSizes->setShortcut(Qt::CTRL + Qt::Key_M);
220  mpMimaNodeSizes->setToolTip("Change Min/Max for node sizes within animation");
221  connect(mpMimaNodeSizes, SIGNAL(activated()), this->mpAnimationWindow, SLOT(changeMinMaxNodeSizes()));
222 
223  mpSFontSize = new QAction("Set Font Size", this);
224  //mpSFontSize->setShortcut(Qt::CTRL + Qt::Key_F);
225  mpSFontSize->setToolTip("Change the font size of the node labels in the graph view");
226  connect(mpSFontSize, SIGNAL(activated()), this->mpAnimationWindow, SLOT(changeFontSize()));
227 
228  this->mpStopLayoutAction = new QAction(QPixmap(layout_start_xpm), tr("Stop"), this);
229  this->mpStopLayoutAction->setEnabled(true);
230  this->mpStopLayoutAction->setToolTip("Run Spring Layout Algorithm");
231  connect(this->mpStopLayoutAction, SIGNAL(triggered()), this, SLOT(slotRunSpringLayout()));
232 
233  mpRandomizeLayout = new QAction(CQIconResource::icon(CQIconResource::roll), tr("Randomize Layout"), this);
234  mpRandomizeLayout->setToolTip("Randomize current Layout");
235  mpRandomizeLayout->setShortcut(Qt::CTRL + Qt::Key_F5);
236  connect(this->mpRandomizeLayout, SIGNAL(triggered()), this, SLOT(slotRunRandomizeLayout()));
237 
238  mpCalculateDimensions = new QAction(tr("&Calculate Dimensions"), this);
239  mpCalculateDimensions->setToolTip("Calculates Dimensions of this Layout.");
240  connect(this->mpCalculateDimensions, SIGNAL(triggered()), this, SLOT(slotCalculateDimensions()));
241 }
QAction * mpCloseAct
QAction * mpRevertCurveAct
QAction * mpStopLayoutAction
QAction * mpRectangularShape
QAction * mpScreenshotAct
QAction * mpLoadDataAct
QAction * mpCircularShape
CQLayoutMainWindow * mpAnimationWindow
static const QIcon & icon(const IconID &id)
QAction * mpSFontSize
QAction * mpRandomizeLayout
QAction * mpCalculateDimensions
QAction * mpMimaNodeSizes
CQGLLayoutViewer * mpLayoutViewer
QAction * mpSwitchModeAct
void CQNewMainWindow::createMenus ( )
private

Definition at line 243 of file CQNewMainWindow.cpp.

References changeColorSlot(), checkForElementaryModesSlot(), fogDensitySlot(), CQPlayerControlWidget::getBackwardAction(), CQLayoutMainWindow::getControlWidget(), CQPlayerControlWidget::getForwardAction(), CQPlayerControlWidget::getPauseAction(), CQPlayerControlWidget::getPlayAction(), CQPlayerControlWidget::getStepBackwardAction(), CQPlayerControlWidget::getStepForwardAction(), CQPlayerControlWidget::getStopAction(), mpAnimationWindow, mpCalculateDimensions, mpChangeColorAction, mpCircularShape, mpCloseAct, mpElementaryModesMenu, mpFileMenu, mpFogDensityAction, mpHighlightModeAction, mpLayoutMenu, mpLoadDataAct, mpLoopItemAction, mpMimaNodeSizes, mpOptionsMenu, mpPlayMenu, mpRandomizeLayout, mpRectangularShape, mpScreenshotAct, mpSFontSize, mpStopLayoutAction, mpSwitchModeAct, mpViewMenu, mpWindowMenu, mpZoomActionGroup, mpZoomMenu, slotFitToScreen(), slotResetView(), slotZoomMenuItemActivated(), and toggleHighlightSlot().

Referenced by CQNewMainWindow().

244 {
245  mpFileMenu = menuBar()->addMenu(tr("&File"));
246  mpFileMenu->addAction(mpSwitchModeAct);
247  mpFileMenu->addSeparator();
248  mpFileMenu->addAction(this->mpScreenshotAct);
249  mpFileMenu->addSeparator();
250  mpFileMenu->addAction(mpCloseAct);
251 
252  mpLayoutMenu = menuBar()->addMenu(tr("&Layout"));
253  mpLayoutMenu->addAction(mpStopLayoutAction);
254  mpLayoutMenu->addAction(mpRandomizeLayout);
255  mpLayoutMenu->addSeparator();
257 
258  // play menu
259  mpPlayMenu = menuBar()->addMenu(tr("&Play"));
260  mpPlayMenu->setVisible(false);
261  this->mpPlayMenu->addAction(this->mpAnimationWindow->getControlWidget()->getPlayAction());
262  this->mpPlayMenu->addAction(this->mpAnimationWindow->getControlWidget()->getPauseAction());
263  this->mpPlayMenu->addAction(this->mpAnimationWindow->getControlWidget()->getStopAction());
264  this->mpPlayMenu->addAction(this->mpAnimationWindow->getControlWidget()->getForwardAction());
265  this->mpPlayMenu->addAction(this->mpAnimationWindow->getControlWidget()->getBackwardAction());
268  this->mpPlayMenu->addSeparator();
269  this->mpLoopItemAction = this->mpPlayMenu->addAction(tr("Loop Animation"));
270  this->mpLoopItemAction->setCheckable(true);
271  this->mpLoopItemAction->setChecked(false);
272  connect(this->mpLoopItemAction, SIGNAL(toggled(bool)) , this->mpAnimationWindow, SLOT(slotLoopActivated(bool)));
273  this->mpPlayMenu->addSeparator();
274  this->mpPlayMenu->addAction(this->mpLoadDataAct);
275 
276  // view menu
277  mpViewMenu = menuBar()->addMenu(tr("&View"));
278  mpViewMenu->addAction(tr("&Reset View"), this, SLOT(slotResetView()));
279  mpViewMenu->addAction(tr("&Fit to Screen"), this, SLOT(slotFitToScreen()));
280  this->mpZoomMenu = this->mpViewMenu->addMenu(tr("&Zoom"));
281  this->mpZoomActionGroup = new QActionGroup(this);
282  QAction* pAction = this->mpZoomActionGroup->addAction("1%");
283  pAction->setCheckable(true);
284  pAction = this->mpZoomActionGroup->addAction("2%");
285  pAction->setCheckable(true);
286  pAction = this->mpZoomActionGroup->addAction("3%");
287  pAction->setCheckable(true);
288  pAction = this->mpZoomActionGroup->addAction("4%");
289  pAction->setCheckable(true);
290  pAction = this->mpZoomActionGroup->addAction("5%");
291  pAction->setCheckable(true);
292  pAction = this->mpZoomActionGroup->addAction("10%");
293  pAction->setCheckable(true);
294  pAction = this->mpZoomActionGroup->addAction("20%");
295  pAction->setCheckable(true);
296  pAction = this->mpZoomActionGroup->addAction("30%");
297  pAction->setCheckable(true);
298  pAction = this->mpZoomActionGroup->addAction("40%");
299  pAction->setCheckable(true);
300  pAction = this->mpZoomActionGroup->addAction("50%");
301  pAction->setCheckable(true);
302  pAction = this->mpZoomActionGroup->addAction("100%");
303  pAction->setCheckable(true);
304  pAction->setChecked(true);
305  pAction = this->mpZoomActionGroup->addAction("150%");
306  pAction->setCheckable(true);
307  pAction = this->mpZoomActionGroup->addAction("200%");
308  pAction->setCheckable(true);
309  pAction = this->mpZoomActionGroup->addAction("300%");
310  pAction->setCheckable(true);
311  pAction = this->mpZoomActionGroup->addAction("400%");
312  pAction->setCheckable(true);
313  pAction = this->mpZoomActionGroup->addAction("500%");
314  pAction->setCheckable(true);
315  pAction = this->mpZoomActionGroup->addAction("1000%");
316  pAction->setCheckable(true);
317  connect(this->mpZoomActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotZoomMenuItemActivated(QAction*)));
318  this->mpZoomMenu->addActions(this->mpZoomActionGroup->actions());
319  this->mpViewMenu->addSeparator();
320  this->mpHighlightModeAction = this->mpViewMenu->addAction(tr("Highlight"));
321  this->mpHighlightModeAction->setCheckable(true);
322  this->mpHighlightModeAction->setChecked(true);
323  this->mpHighlightModeAction->setToolTip(tr("Toggle whether selected elements are highlighted or unselected items toned down."));
324  connect(this->mpHighlightModeAction, SIGNAL(toggled(bool)), this, SLOT(toggleHighlightSlot(bool)));
325  this->mpFogDensityAction = this->mpViewMenu->addAction(tr("Fog Density ..."));
326  connect(this->mpFogDensityAction, SIGNAL(triggered(bool)), this, SLOT(fogDensitySlot(bool)));
327  this->mpChangeColorAction = this->mpViewMenu->addAction(tr("Highlight Color ..."));
328  connect(this->mpChangeColorAction, SIGNAL(triggered(bool)), this, SLOT(changeColorSlot(bool)));
329  this->mpChangeColorAction->setToolTip(tr("When higlighted, sets the highlight color, or the toned down one otherwise."));
330  this->mpElementaryModesMenu = this->mpViewMenu->addMenu("Elementary Modes");
331  this->mpElementaryModesMenu->setToolTip(tr("Displays a list of elementary modes when they have been calculated and lets you select one or more that are emphasized in the layout displayed."));
332  this->mpElementaryModesMenu->addAction(tr("None"));
333  connect(this->mpElementaryModesMenu, SIGNAL(aboutToShow()), this, SLOT(checkForElementaryModesSlot()));
334 
335  // options menu
336  mpOptionsMenu = menuBar()->addMenu(tr("Options"));
337  mpOptionsMenu->setVisible(false);
338  QMenu* pM = this->mpOptionsMenu->addMenu(tr("Shape of Label"));
339  pM->addAction(this->mpRectangularShape);
340  pM->addAction(this->mpCircularShape);
341  this->mpOptionsMenu->addAction(this->mpMimaNodeSizes);
342  this->mpOptionsMenu->addAction(this->mpSFontSize);
343 
344  menuBar()->addSeparator();
345 
346  mpWindowMenu = menuBar()->addMenu(tr("&Window"));
347 }
QAction * mpChangeColorAction
CQPlayerControlWidget * getControlWidget()
QAction * mpCloseAct
void fogDensitySlot(bool)
QAction * mpStopLayoutAction
QAction * mpRectangularShape
QAction * mpScreenshotAct
QAction * mpLoadDataAct
QActionGroup * mpZoomActionGroup
QAction * mpLoopItemAction
QAction * mpCircularShape
CQLayoutMainWindow * mpAnimationWindow
void changeColorSlot(bool)
QAction * mpHighlightModeAction
void toggleHighlightSlot(bool checked)
QAction * mpSFontSize
QMenu * mpElementaryModesMenu
QAction * mpRandomizeLayout
QAction * mpFogDensityAction
QAction * mpCalculateDimensions
void slotZoomMenuItemActivated(QAction *)
QAction * mpMimaNodeSizes
void checkForElementaryModesSlot()
QAction * mpSwitchModeAct
void CQNewMainWindow::createSpringLayout ( int  numIterations,
int  updateInterval 
)

Creates a spring layout. The method takes the number of iterations for the layout algorithm and an update interval which tells the algorithm how often to update the display. A value of -1 means that the update of the display is only done once at the end.

Definition at line 1722 of file CQNewMainWindow.cpp.

References CQLayoutThread::createSpringLayout(), mpCopy, mpCurrentLayout, mpLayoutThread, mpStopLayoutAction, slotRunSpringLayout(), slotStopClicked(), and CLayoutState::tagLayout().

Referenced by slotRunSpringLayout().

1723 {
1724  if (mpCurrentLayout == NULL)
1725  return;
1726 
1727  // reset the stop flag
1728  disconnect(this->mpStopLayoutAction, SIGNAL(triggered()), this, SLOT(slotRunSpringLayout()));
1729  this->mpStopLayoutAction->setToolTip("stop spring layout algorithm");
1730  connect(this->mpStopLayoutAction, SIGNAL(triggered()), this, SLOT(slotStopClicked()));
1731  // enable the stop button
1732  this->mpStopLayoutAction->setEnabled(true);
1733  this->mpStopLayoutAction->setIcon(QPixmap(layout_stop_xpm));
1734 
1736 
1737  if (mpCopy != NULL)
1738  {
1739  delete mpCopy;
1740  mpCopy = NULL;
1741  }
1742 
1743  mpCopy = new CLayout(*mpCurrentLayout);
1744 
1745  mpLayoutThread->createSpringLayout(mpCopy, numIterations);
1746 }
void createSpringLayout(CLayout *layout, int numIntervals=1000, int updateWait=100)
static void tagLayout(CLayout *layout)
QAction * mpStopLayoutAction
CLayout * mpCurrentLayout
CQLayoutThread * mpLayoutThread
void CQNewMainWindow::createStatusBar ( )
private

Definition at line 419 of file CQNewMainWindow.cpp.

Referenced by CQNewMainWindow().

420 {
421  statusBar()->showMessage(tr("Ready"));
422 }
void CQNewMainWindow::createToolBars ( )
private

Definition at line 349 of file CQNewMainWindow.cpp.

References mpFileToolBar, mpLayoutDropdown, mpLoadDataAct, mpRandomizeLayout, mpRenderDropdown, mpRenderLabel, mpRevertCurveAct, mpScreenshotAct, mpSelectionToolBar, mpStopLayoutAction, mpSwitchModeAct, mpZoomDropdown, slotLayoutChanged(), slotRenderInfoChanged(), slotZoomChanged(), and ZOOM_FACTOR_STRINGS.

Referenced by CQNewMainWindow().

350 {
351  this->mpFileToolBar = addToolBar(tr("File"));
352  this->mpFileToolBar->addAction(this->mpSwitchModeAct);
353  this->mpFileToolBar->addAction(this->mpRevertCurveAct);
354  this->mpFileToolBar->addAction(this->mpLoadDataAct);
355  this->mpLoadDataAct->setVisible(false);
356  this->mpFileToolBar->addAction(this->mpScreenshotAct);
357  this->mpFileToolBar->addSeparator();
358  this->mpFileToolBar->addAction(this->mpStopLayoutAction);
359  this->mpFileToolBar->addAction(this->mpRandomizeLayout);
360 
361  // add a toolbar for the selection widgets
362  mpSelectionToolBar = addToolBar(tr("Select"));
363  QFrame* pFrame1 = new QFrame;
364  QHBoxLayout* pLayout = new QHBoxLayout;
365  pLayout->setSpacing(3);
366  QLabel* pLabel = new QLabel(tr("Layout:"));
367  pLayout->addWidget(pLabel);
368  this->mpLayoutDropdown = new QComboBox;
369  this->mpLayoutDropdown->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
370  pFrame1->setLayout(pLayout);
371  pLayout->addWidget(this->mpLayoutDropdown);
372 
373  QFrame* pFrame2 = new QFrame;
374  pLayout = new QHBoxLayout;
375  pLayout->setSpacing(3);
376  pFrame2->setLayout(pLayout);
377  this->mpRenderLabel = new QLabel(tr("Render Information:"));
378  pLayout->addWidget(this->mpRenderLabel);
379  this->mpRenderDropdown = new QComboBox;
380  this->mpRenderDropdown->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
381  pLayout->addWidget(this->mpRenderDropdown);
382 
383  QFrame* pFrame3 = new QFrame;
384  pLayout = new QHBoxLayout;
385  pLayout->setSpacing(3);
386  pFrame3->setLayout(pLayout);
387  pLabel = new QLabel(tr("Zoom Factor:"));
388  pLayout->addWidget(pLabel);
389  this->mpZoomDropdown = new QComboBox;
390  pLayout->addWidget(this->mpZoomDropdown);
391  // fill the zoom factor box
392  unsigned int i, iMax = sizeof(CQNewMainWindow::ZOOM_FACTOR_STRINGS) / sizeof(char*);
393  int defaultIndex = -1;
394 
395  for (i = 0; i < iMax; ++i)
396  {
397  this->mpZoomDropdown->addItem(QString(CQNewMainWindow::ZOOM_FACTOR_STRINGS[i]));
398 
399  if (std::string(CQNewMainWindow::ZOOM_FACTOR_STRINGS[i]) == std::string("100%"))
400  {
401  defaultIndex = i;
402  }
403  }
404 
405  this->mpZoomDropdown->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
406 
407  // set 100% as the default zoom factor
408  assert(defaultIndex != -1);
409  this->mpZoomDropdown->setCurrentIndex(defaultIndex);
410  this->mpSelectionToolBar->addWidget(pFrame1);
411  this->mpSelectionToolBar->addWidget(pFrame2);
412  this->mpSelectionToolBar->addWidget(pFrame3);
413  // connect the combobox signals
414  connect(this->mpLayoutDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLayoutChanged(int)));
415  connect(this->mpRenderDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotRenderInfoChanged(int)));
416  connect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
417 }
QAction * mpRevertCurveAct
void slotLayoutChanged(int index)
QLabel * mpRenderLabel
QComboBox * mpRenderDropdown
QAction * mpStopLayoutAction
QAction * mpScreenshotAct
QAction * mpLoadDataAct
QComboBox * mpZoomDropdown
QToolBar * mpSelectionToolBar
QComboBox * mpLayoutDropdown
void slotZoomChanged(int index)
QToolBar * mpFileToolBar
QAction * mpRandomizeLayout
void slotRenderInfoChanged(int index)
static const char *const ZOOM_FACTOR_STRINGS[]
QAction * mpSwitchModeAct
void CQNewMainWindow::elementaryModeTriggeredSlot ( QAction *  pAction)
slot

Checks which elementary mode has been toggled and updates the highlighted objects list.

Definition at line 1207 of file CQNewMainWindow.cpp.

References ASSOCIATED_SPECIES_GLYPHS, CFluxMode::begin(), CFluxMode::end(), CQGLLayoutPainter::getHighlightedObjects(), CCopasiDataModel::getModel(), CQGLLayoutViewer::getPainter(), CCopasiTask::getProblem(), CModel::getReactions(), CCopasiDataModel::getTaskList(), GRAPH_MODE, mFluxModes, mHighlightedReactions, mMode, mpDataModel, mpElementaryModesMenu, mpLayoutViewer, pTask, REACTION_GLYPH, ROLE_PRODUCT, ROLE_SIDEPRODUCT, ROLE_SIDESUBSTRATE, ROLE_SUBSTRATE, selectReaction(), CCopasiVector< T >::size(), and CQGLLayoutPainter::update().

Referenced by checkForElementaryModesSlot().

1208 {
1209  CQGLLayoutPainter* pPainter = this->mpLayoutViewer->getPainter();
1210 
1211  if (pPainter == NULL) return;
1212 
1213  // determine the index of the flux mode
1214  unsigned int index = this->mpElementaryModesMenu->actions().indexOf(pAction);
1215  // if the action is checked, we need to add all the reactions of the flux mode
1216  // to the highlighted objects
1218 
1219  if (pAction->isChecked())
1220  {
1221  const CFluxMode* pFlux = this->mFluxModes[index];
1222  CFluxMode::const_iterator it = pFlux->begin(), endit = pFlux->end();
1223  const CReaction* pReaction = NULL;
1224  assert(this->mpDataModel != NULL && this->mpDataModel->getModel() != NULL);
1225  const CEFMProblem* pProblem = NULL;
1226  const CCopasiVectorN< CCopasiTask >* pTaskList = this->mpDataModel->getTaskList();
1227  assert(pTaskList != NULL);
1228 
1229  if (pTaskList != NULL)
1230  {
1231  // get the metabolic control analysis task object
1232  const CEFMTask* pTask = dynamic_cast<const CEFMTask*>((*pTaskList)["Elementary Flux Modes"]);
1233 
1234  if (pTask != NULL)
1235  {
1236  pProblem = dynamic_cast<const CEFMProblem*>(pTask->getProblem());
1237  }
1238  }
1239 
1240  while (it != endit && pProblem != NULL)
1241  {
1242  assert(this->mpDataModel->getModel()->getReactions().size() > it->first);
1243 
1244  // the index is the index of the reordered fluxes from the problem, so in order
1245  // to find the correct reaction, we need to get the reaction from the problem
1246  if (pProblem != NULL)
1247  {
1248  pReaction = pProblem->getReorderedReactions()[it->first];
1249  assert(pReaction != NULL);
1250  this->selectReaction(pReaction, mask, pPainter->getHighlightedObjects());
1251  }
1252 
1253  ++it;
1254  }
1255  }
1256  // if the node is unchecked, we need to remove all the reactions from the
1257  // highlighted objects, but only those that are not part of another selected flux mode
1258  else
1259  {
1260  // we first need to find all objects that belong to other flux modes
1261  const QList<QAction*>& actions = this->mpElementaryModesMenu->actions();
1262  QList<QAction*>::const_iterator ait = actions.begin(), aendit = actions.end();
1263  unsigned int i;
1264  const CFluxMode* pFlux = NULL;
1265 
1266  // we remove all highlighted objects
1267  std::set<const CLGraphicalObject*>& s = pPainter->getHighlightedObjects();
1268  s.clear();
1269  this->mHighlightedReactions.clear();
1270 
1271  // and readd the ones that remain
1272  while (ait != aendit)
1273  {
1274  if ((*ait)->isChecked())
1275  {
1276  i = actions.indexOf(*ait);
1277  assert(i < this->mFluxModes.size());
1278  pFlux = this->mFluxModes[i];
1279  CFluxMode::const_iterator it = pFlux->begin(), endit = pFlux->end();
1280  const CReaction* pReaction = NULL;
1281  assert(this->mpDataModel != NULL && this->mpDataModel->getModel() != NULL);
1282  //const CModel* pModel = this->mpDataModel->getModel();
1283 
1284  while (it != endit)
1285  {
1286  assert(this->mpDataModel->getModel()->getReactions().size() > it->first);
1287  pReaction = this->mpDataModel->getModel()->getReactions()[it->first];
1288  assert(pReaction != NULL);
1289  this->selectReaction(pReaction, mask, s);
1290  ++it;
1291  }
1292  }
1293 
1294  ++ait;
1295  }
1296  }
1297 
1298  // redraw the GL window
1299  if (this->mMode == GRAPH_MODE)
1300  {
1301  this->mpLayoutViewer->getPainter()->update();
1302  }
1303 }
CQGLLayoutPainter * getPainter()
CCopasiProblem * getProblem()
virtual size_t size() const
const std::set< const CLGraphicalObject * > & getHighlightedObjects() const
std::vector< const CFluxMode * > mFluxModes
void selectReaction(const CReaction *pReaction, unsigned int selectionMask, std::set< const CLGraphicalObject * > &s)
CCopasiDataModel * mpDataModel
CTSSATask * pTask
std::set< REACTION_SELECTION_ITEM > mHighlightedReactions
CCopasiVectorN< CCopasiTask > * getTaskList()
const_iterator begin() const
Definition: CFluxMode.cpp:69
DISPLAY_MODE mMode
QMenu * mpElementaryModesMenu
std::map< size_t, C_FLOAT64 >::const_iterator const_iterator
Definition: CFluxMode.h:43
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
CQGLLayoutViewer * mpLayoutViewer
const_iterator end() const
Definition: CFluxMode.cpp:74
void CQNewMainWindow::export_bitmap ( const QString &  filename,
double  scale = 4.0 
)
slot

exports a bit map of the currently displayed image with the given scale.

Definition at line 908 of file CQNewMainWindow.cpp.

References CQGLLayoutViewer::getPainter(), CQGLLayoutPainter::maxX(), CQGLLayoutPainter::maxY(), CQGLLayoutPainter::minX(), CQGLLayoutPainter::minY(), and mpLayoutViewer.

Referenced by slotScreenshot().

909 {
910  CQGLLayoutPainter* pPainter = this->mpLayoutViewer->getPainter();
911 
912  if (pPainter == NULL)
913  return;
914 
915  double layoutX = pPainter->minX();
916  double layoutY = pPainter->minY();
917  double layoutWidth = pPainter->maxX() - layoutX;
918  double layoutHeight = pPainter->maxY() - layoutY;
919 
920  export_bitmap(filename, layoutX, layoutY, layoutWidth, layoutHeight, layoutWidth * scale, layoutHeight * scale, false);
921 }
void export_bitmap(const QString &filename, double scale=4.0)
double minX() const
CQGLLayoutPainter * getPainter()
double maxY() const
double maxX() const
double minY() const
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::export_bitmap ( const QString &  filename,
double  x,
double  y,
double  width,
double  height,
unsigned int  imageWidth,
unsigned int  imageHeight,
bool  drawSelection 
)
slot

Exports a bitmap of the given size to the file with the given name.

Definition at line 927 of file CQNewMainWindow.cpp.

References CQMessageBox::critical(), CQGLLayoutPainter::export_bitmap(), CQGLLayoutViewer::getPainter(), and mpLayoutViewer.

928 {
929  // check if the size of the final image is ok.
930  double size = imageWidth * imageHeight * 4;
931 
932  // TODO: not sure we really need to restrict this, if the user *needs* a higher resolution image
933  // TODO: what speeks against it? (Though in praxis resolutions above 4320p are unlikely)
934  // I don't think we should write images that are larger than 500MB
935  if (size > 5e8)
936  {
937  // give an error message that the image is to large
938  CQMessageBox::critical(this, tr("Image too large"),
939  tr("Sorry, refusing to create images that are larger than 500MB."));
940  }
941 
942  //
943  // before we even start, we check if the file can be written to at all
944  // if not, we don't have to do anything
945  QFileInfo info(filename);
946 
947  if (info.exists())
948  {
949  if (!info.isFile())
950  {
951  // create an error message and cancel saving
952  CQMessageBox::critical(this, tr("Not a file"),
953  tr("Path exists, but it is not a file."));
954  return;
955  }
956  else
957  {
958  if (!info.isWritable())
959  {
960  // create an error message and cancel saving
961  CQMessageBox::critical(this, tr("Not writable"),
962  tr("Can't write to file."));
963  return;
964  }
965  }
966  }
967 
968  // now we try to create the image
969  CQGLLayoutPainter* pPainter = this->mpLayoutViewer->getPainter();
970 
971  if (pPainter == NULL)
972  return;
973 
974  GLubyte* pImageData = pPainter->export_bitmap(x, y, width, height, imageWidth, imageHeight, drawSelection);
975 
976  if (pImageData == NULL)
977  return;
978 
979  // create QImage for buffer
980  QImage* pImage = new QImage(pImageData, imageWidth, imageHeight, 4 * imageWidth, QImage::Format_ARGB32);
981  bool result = pImage->save(filename, "PNG");
982 
983  if (result == false)
984  {
985  CQMessageBox::critical(this, tr("Save error"),
986  tr("An error occured while saving the file.\nThe file might be invalid."));
987  }
988 
989  delete pImage;
990  delete[] pImageData;
991 }
CQGLLayoutPainter * getPainter()
GLubyte * export_bitmap(double x, double y, double width, double height, unsigned int imageWidth, unsigned int imageHeight, bool drawSelection)
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::fogDensitySlot ( bool  )
slot

Lets the user change the percentage of fog that is added to the color.

Definition at line 1549 of file CQNewMainWindow.cpp.

References CQGLLayoutPainter::getFogDensity(), CQGLLayoutViewer::getPainter(), GRAPH_MODE, mMode, mpLayoutViewer, CQGLLayoutPainter::setFogDensity(), and CQGLLayoutPainter::update().

Referenced by createMenus().

1550 {
1551  // show a dialog with a spin box that goes from 0 to 1.0
1552  // it is filled with the fog density value from the renderer
1553  GLfloat c = this->mpLayoutViewer->getPainter()->getFogDensity();
1554 
1555  QDialog* pDialog = new QDialog;
1556  pDialog->setLayout(new QVBoxLayout(pDialog));
1557  pDialog->layout()->addWidget(new QLabel("Set the fog density:", pDialog));
1558  QDoubleSpinBox* pSpinBox = new QDoubleSpinBox(pDialog);
1559  pSpinBox->setRange(0.0, 1.0);
1560  pSpinBox->setSingleStep(0.01);
1561  pSpinBox->setValue(c);
1562  pDialog->layout()->addWidget(pSpinBox);
1563  QDialogButtonBox* pBBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, pDialog);
1564  pDialog->layout()->addWidget(pBBox);
1565  // connect the buttons
1566  connect(pBBox, SIGNAL(accepted()), pDialog, SLOT(accept()));
1567  connect(pBBox, SIGNAL(rejected()), pDialog, SLOT(reject()));
1568 
1569  if (pDialog->exec() == QDialog::Accepted)
1570  {
1571  c = pSpinBox->value();
1573 
1574  // redraw the GL window
1575  if (this->mMode == GRAPH_MODE)
1576  {
1577  this->mpLayoutViewer->getPainter()->update();
1578  }
1579  }
1580 
1581  delete pDialog;
1582 }
CQGLLayoutPainter * getPainter()
GLfloat getFogDensity() const
void setFogDensity(GLfloat dens)
DISPLAY_MODE mMode
CQGLLayoutViewer * mpLayoutViewer
QMenu * CQNewMainWindow::getWindowMenu ( ) const
virtual

Implements CWindowInterface.

Definition at line 174 of file CQNewMainWindow.cpp.

References mpWindowMenu.

175 {
176  return mpWindowMenu;
177 }
void CQNewMainWindow::randomizeLayout ( )

Definition at line 1707 of file CQNewMainWindow.cpp.

References mpCurrentLayout, mpLayoutThread, CQLayoutThread::randomizeLayout(), and CQLayoutThread::stopLayout().

Referenced by slotRunRandomizeLayout().

1708 {
1710  mpLayoutThread->wait();
1712 }
CLayout * mpCurrentLayout
CQLayoutThread * mpLayoutThread
void randomizeLayout(CLayout *layout)
void CQNewMainWindow::redrawNow ( )

Definition at line 1635 of file CQNewMainWindow.cpp.

References CQGLLayoutViewer::getPainter(), mpLayoutViewer, and CQGLLayoutPainter::update().

Referenced by slotCalculateDimensions(), slotLayoutFinished(), and slotLayoutStateChanged().

1636 {
1637  this->mpLayoutViewer->getPainter()->update();
1638 }
CQGLLayoutPainter * getPainter()
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::resetView ( )
protected

Definition at line 449 of file CQNewMainWindow.cpp.

References mpZoomDropdown, slotZoomChanged(), and ZOOM_FACTOR_STRINGS.

Referenced by slotResetView(), and updateRenderer().

450 {
451  unsigned int i, iMax = sizeof(CQNewMainWindow::ZOOM_FACTOR_STRINGS) / sizeof(char*);
452  int defaultIndex = -1;
453 
454  for (i = 0; i < iMax; ++i)
455  {
456  if (std::string(CQNewMainWindow::ZOOM_FACTOR_STRINGS[i]) == std::string("100%"))
457  {
458  defaultIndex = i;
459  }
460  }
461 
462  // set 100% as the default zoom factor
463  assert(defaultIndex != -1);
464  disconnect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
465  this->mpZoomDropdown->setCurrentIndex(defaultIndex);
466  connect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
467 }
QComboBox * mpZoomDropdown
void slotZoomChanged(int index)
static const char *const ZOOM_FACTOR_STRINGS[]
void CQNewMainWindow::selectMetabolite ( const CMetab pMetab,
std::set< const CLGraphicalObject * > &  s 
)
slot

Selected the given metabolite object by selecting all corresponding CLMetabGlyph objects in the current layout. The graphical objects selected by this method are inserted into the set given as the third element.

Definition at line 1496 of file CQNewMainWindow.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CModelEntity::getKey(), CLayout::getListOfMetaboliteGlyphs(), mHighlightedMetabolites, and mpCurrentLayout.

1497 {
1498  if (pMetab != NULL && this->mpCurrentLayout != NULL)
1499  {
1500  this->mHighlightedMetabolites.insert(pMetab->getKey());
1501  // go through the metabolite glyphs and select
1502  // all metabolite glyphs that are associated
1505 
1506  while (it != endit)
1507  {
1508  if ((*it)->getModelObject() == pMetab)
1509  {
1510  s.insert((*it));
1511  }
1512 
1513  ++it;
1514  }
1515  }
1516 }
std::set< std::string > mHighlightedMetabolites
CLayout * mpCurrentLayout
iterator begin()
iterator end()
virtual const std::string & getKey() const
const CCopasiVector< CLMetabGlyph > & getListOfMetaboliteGlyphs() const
Definition: CLayout.h:94
void CQNewMainWindow::selectReaction ( const CReaction pReaction,
unsigned int  selectionMask,
std::set< const CLGraphicalObject * > &  s 
)
slot

Selects the given reaction object by selecting all corresponding CLReactionGlyph objects in the current layout. The mask determines which parts of the reaction are selected. With this, it can be specified that only the reaction glyph itself or the reaction glyph plus several of the associated metab reference glyphs are selected. The graphical objects selected by this method are inserted into the set given as the third element.

Definition at line 1315 of file CQNewMainWindow.cpp.

References CLMetabReferenceGlyph::ACTIVATOR, ASSOCIATED_SPECIES_GLYPHS, CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CKeyFactory::get(), CReaction::getKey(), CCopasiRootContainer::getKeyFactory(), CLayout::getListOfReactionGlyphs(), CLMetabReferenceGlyph::INHIBITOR, mHighlightedReactions, CLMetabReferenceGlyph::MODIFIER, mpCurrentLayout, CQNewMainWindow::REACTION_SELECTION_ITEM::mReactionKey, CQNewMainWindow::REACTION_SELECTION_ITEM::mSelectionMask, CLMetabReferenceGlyph::PRODUCT, REACTION_GLYPH, ROLE_ACTIVATOR, ROLE_INHIBITOR, ROLE_MODIFIER, ROLE_PRODUCT, ROLE_SIDEPRODUCT, ROLE_SIDESUBSTRATE, ROLE_SUBSTRATE, ROLE_UNSPECIFIED, CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, CLMetabReferenceGlyph::SUBSTRATE, and CLMetabReferenceGlyph::UNDEFINED.

Referenced by elementaryModeTriggeredSlot().

1316 {
1317  // we need a reaction and something to select in that
1318  // reaction
1319  if (pReaction != NULL && selectionMask != 0 && this->mpCurrentLayout != NULL)
1320  {
1322  item.mReactionKey = pReaction->getKey();
1323  item.mSelectionMask = selectionMask;
1324  this->mHighlightedReactions.insert(item);
1325  // go through the metabolite glyphs and select
1326  // all metabolite glyphs that are associated
1329 
1330  while (it != endit)
1331  {
1332  if ((*it)->getModelObject() == pReaction)
1333  {
1334  if (selectionMask & CQNewMainWindow::REACTION_GLYPH)
1335  {
1336  s.insert((*it));
1337  }
1338 
1339  const CCopasiVector<CLMetabReferenceGlyph>& mrgv = (*it)->getListOfMetabReferenceGlyphs();
1340 
1341  CCopasiVector<CLMetabReferenceGlyph>::const_iterator it2 = mrgv.begin(), endit2 = mrgv.end();
1342 
1343  std::string key;
1344 
1345  const CCopasiObject* pObject = NULL;
1346 
1347  while (it2 != endit2)
1348  {
1349  // check the role
1350  switch ((*it2)->getRole())
1351  {
1353 
1354  if (selectionMask & CQNewMainWindow::ROLE_UNSPECIFIED)
1355  {
1356  s.insert(*it2);
1357  key = (*it2)->getMetabGlyphKey();
1358  pObject = CCopasiRootContainer::getKeyFactory()->get(key);
1359 
1360  if (pObject != NULL && dynamic_cast<const CLMetabGlyph*>(pObject) != NULL && (selectionMask & CQNewMainWindow::ASSOCIATED_SPECIES_GLYPHS))
1361  {
1362  s.insert(static_cast<const CLMetabGlyph*>(pObject));
1363  }
1364  }
1365 
1366  break;
1367 
1369 
1370  if (selectionMask & CQNewMainWindow::ROLE_SUBSTRATE)
1371  {
1372  s.insert(*it2);
1373  key = (*it2)->getMetabGlyphKey();
1374  pObject = CCopasiRootContainer::getKeyFactory()->get(key);
1375 
1376  if (pObject != NULL && dynamic_cast<const CLMetabGlyph*>(pObject) != NULL && (selectionMask & CQNewMainWindow::ASSOCIATED_SPECIES_GLYPHS))
1377  {
1378  s.insert(static_cast<const CLMetabGlyph*>(pObject));
1379  }
1380  }
1381 
1382  break;
1383 
1385 
1386  if (selectionMask & CQNewMainWindow::ROLE_PRODUCT)
1387  {
1388  s.insert(*it2);
1389  key = (*it2)->getMetabGlyphKey();
1390  pObject = CCopasiRootContainer::getKeyFactory()->get(key);
1391 
1392  if (pObject != NULL && dynamic_cast<const CLMetabGlyph*>(pObject) != NULL && (selectionMask & CQNewMainWindow::ASSOCIATED_SPECIES_GLYPHS))
1393  {
1394  s.insert(static_cast<const CLMetabGlyph*>(pObject));
1395  }
1396  }
1397 
1398  break;
1399 
1401 
1402  if (selectionMask & CQNewMainWindow::ROLE_SIDESUBSTRATE)
1403  {
1404  s.insert(*it2);
1405  key = (*it2)->getMetabGlyphKey();
1406  pObject = CCopasiRootContainer::getKeyFactory()->get(key);
1407 
1408  if (pObject != NULL && dynamic_cast<const CLMetabGlyph*>(pObject) != NULL && (selectionMask & CQNewMainWindow::ASSOCIATED_SPECIES_GLYPHS))
1409  {
1410  s.insert(static_cast<const CLMetabGlyph*>(pObject));
1411  }
1412  }
1413 
1414  break;
1415 
1417 
1418  if (selectionMask & CQNewMainWindow::ROLE_SIDEPRODUCT)
1419  {
1420  s.insert(*it2);
1421  key = (*it2)->getMetabGlyphKey();
1422  pObject = CCopasiRootContainer::getKeyFactory()->get(key);
1423 
1424  if (pObject != NULL && dynamic_cast<const CLMetabGlyph*>(pObject) != NULL && (selectionMask & CQNewMainWindow::ASSOCIATED_SPECIES_GLYPHS))
1425  {
1426  s.insert(static_cast<const CLMetabGlyph*>(pObject));
1427  }
1428  }
1429 
1430  break;
1431 
1433 
1434  if (selectionMask & CQNewMainWindow::ROLE_MODIFIER)
1435  {
1436  s.insert(*it2);
1437  key = (*it2)->getMetabGlyphKey();
1438  pObject = CCopasiRootContainer::getKeyFactory()->get(key);
1439 
1440  if (pObject != NULL && dynamic_cast<const CLMetabGlyph*>(pObject) != NULL && (selectionMask & CQNewMainWindow::ASSOCIATED_SPECIES_GLYPHS))
1441  {
1442  s.insert(static_cast<const CLMetabGlyph*>(pObject));
1443  }
1444  }
1445 
1446  break;
1447 
1449 
1450  if (selectionMask & CQNewMainWindow::ROLE_ACTIVATOR)
1451  {
1452  s.insert(*it2);
1453  key = (*it2)->getMetabGlyphKey();
1454  pObject = CCopasiRootContainer::getKeyFactory()->get(key);
1455 
1456  if (pObject != NULL && dynamic_cast<const CLMetabGlyph*>(pObject) != NULL && (selectionMask & CQNewMainWindow::ASSOCIATED_SPECIES_GLYPHS))
1457  {
1458  s.insert(static_cast<const CLMetabGlyph*>(pObject));
1459  }
1460  }
1461 
1462  break;
1463 
1465 
1466  if (selectionMask & CQNewMainWindow::ROLE_INHIBITOR)
1467  {
1468  s.insert(*it2);
1469  key = (*it2)->getMetabGlyphKey();
1470  pObject = CCopasiRootContainer::getKeyFactory()->get(key);
1471 
1472  if (pObject != NULL && dynamic_cast<const CLMetabGlyph*>(pObject) != NULL && (selectionMask & CQNewMainWindow::ASSOCIATED_SPECIES_GLYPHS))
1473  {
1474  s.insert(static_cast<const CLMetabGlyph*>(pObject));
1475  }
1476  }
1477 
1478  break;
1479  }
1480 
1481  ++it2;
1482  }
1483  }
1484 
1485  ++it;
1486  }
1487  }
1488 }
CLayout * mpCurrentLayout
CCopasiObject * get(const std::string &key)
virtual const std::string & getKey() const
Definition: CReaction.cpp:190
iterator begin()
iterator end()
std::set< REACTION_SELECTION_ITEM > mHighlightedReactions
static CKeyFactory * getKeyFactory()
const CCopasiVector< CLReactionGlyph > & getListOfReactionGlyphs() const
Definition: CLayout.h:107
void CQNewMainWindow::setAnimationMenu ( )
private

Definition at line 1105 of file CQNewMainWindow.cpp.

References mpLayoutMenu, mpOptionsMenu, and mpPlayMenu.

Referenced by switchMode().

1106 {
1107  this->mpPlayMenu->menuAction()->setVisible(true);
1108  this->mpLayoutMenu->menuAction()->setVisible(false);
1109  this->mpOptionsMenu->menuAction()->setVisible(true);
1110 }
void CQNewMainWindow::setAnimationToolbar ( )
private

Definition at line 1081 of file CQNewMainWindow.cpp.

References mpLoadDataAct, mpRenderDropdown, mpRenderLabel, and mpRevertCurveAct.

Referenced by switchMode().

1082 {
1083  // remove revert curve action
1084  this->mpRevertCurveAct->setVisible(false);
1085  // add load data action
1086  this->mpLoadDataAct->setVisible(true);
1087  // hide the render information box
1088  this->mpRenderLabel->hide();
1089  this->mpRevertCurveAct->setVisible(false);
1090  this->mpRenderDropdown->hide();
1091 }
QAction * mpRevertCurveAct
QLabel * mpRenderLabel
QComboBox * mpRenderDropdown
QAction * mpLoadDataAct
void CQNewMainWindow::setGraphMenu ( )
private

Definition at line 1112 of file CQNewMainWindow.cpp.

References mpLayoutMenu, mpOptionsMenu, and mpPlayMenu.

Referenced by switchMode().

1113 {
1114  this->mpPlayMenu->menuAction()->setVisible(false);
1115  this->mpLayoutMenu->menuAction()->setVisible(true);
1116  this->mpOptionsMenu->menuAction()->setVisible(false);
1117 }
void CQNewMainWindow::setGraphToolbar ( )
private

Definition at line 1093 of file CQNewMainWindow.cpp.

References mpLoadDataAct, mpRenderDropdown, mpRenderLabel, and mpRevertCurveAct.

Referenced by switchMode().

1094 {
1095  // remove load data action
1096  this->mpLoadDataAct->setVisible(false);
1097  // add revert curve action
1098  this->mpRevertCurveAct->setVisible(true);
1099  // show the render information box
1100  this->mpRenderLabel->show();
1101  this->mpRevertCurveAct->setVisible(false);
1102  this->mpRenderDropdown->show();
1103 }
QAction * mpRevertCurveAct
QLabel * mpRenderLabel
QComboBox * mpRenderDropdown
QAction * mpLoadDataAct
void CQNewMainWindow::setMode ( DISPLAY_MODE  mode = GRAPH_MODE)

Definition at line 423 of file CQNewMainWindow.cpp.

References ANIMATION_MODE, GRAPH_MODE, mMode, mpAnimationWindow, mpScreenshotAct, slotScreenshot(), and switchMode().

Referenced by CQLayoutsWidget::slotShowLayout().

424 {
425  // be sure to disconnect screenshot action
426  if (mMode == GRAPH_MODE)
427  disconnect(mpScreenshotAct, SIGNAL(triggered()), this, SLOT(slotScreenshot()));
428  else
429  disconnect(this->mpScreenshotAct, SIGNAL(triggered()), this->mpAnimationWindow, SLOT(saveImage()));
430 
431  // need to invert to have the toggle work
433  switchMode();
434 }
QAction * mpScreenshotAct
CQLayoutMainWindow * mpAnimationWindow
DISPLAY_MODE mMode
void CQNewMainWindow::setStatusMessage ( const QString &  message,
int  timeout 
)
slot

Change the status message.

Definition at line 1119 of file CQNewMainWindow.cpp.

Referenced by CQNewMainWindow().

1120 {
1121  this->statusBar()->showMessage(message, timeout);
1122 }
void CQNewMainWindow::slotCalculateDimensions ( )
protectedslot

Definition at line 1825 of file CQNewMainWindow.cpp.

References CQGLLayoutPainter::calculateAndAssignBounds(), CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CQGLLayoutViewer::getPainter(), mpCurrentLayout, mpLayoutViewer, redrawNow(), and CCopasiVector< T >::size().

Referenced by createActions(), and slotRunRandomizeLayout().

1826 {
1827  if (this->mpCurrentLayout == NULL ||
1829  return;
1830 
1832  // redraw
1833  this->redrawNow();
1834 }
CQGLLayoutPainter * getPainter()
CLayout * mpCurrentLayout
virtual size_t size() const
void calculateAndAssignBounds(CLayout *pLayout)
const CCopasiVector< CLCompartmentGlyph > & getListOfCompartmentGlyphs() const
Definition: CLayout.h:81
const CCopasiVector< CLMetabGlyph > & getListOfMetaboliteGlyphs() const
Definition: CLayout.h:94
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::slotFitToScreen ( )
slot

This slot is called when the "Fit To Screen" menu item is activated.

Definition at line 481 of file CQNewMainWindow.cpp.

References ANIMATION_MODE, CQGLLayoutViewer::fitToScreen(), mMode, mpAnimationWindow, mpLayoutViewer, mpZoomActionGroup, mpZoomDropdown, CQGLLayoutViewer::setZoomFactor(), CQLayoutMainWindow::setZoomFactor(), CQLayoutMainWindow::slotFitToScreen(), slotZoomChanged(), and ZOOM_FACTOR_STRINGS.

Referenced by createMenus(), and switchMode().

482 {
483  double zoom = 1.0;
484 
486  {
487  zoom = this->mpAnimationWindow->slotFitToScreen();
488  // set the zoom factor on the other GL window
489  this->mpLayoutViewer->setZoomFactor(zoom);
490  }
491  else
492  {
493  zoom = this->mpLayoutViewer->fitToScreen();
494  // set the zoom factor on the other GL window
495  this->mpAnimationWindow->setZoomFactor(zoom);
496  }
497 
498  // uncheck the zoom entry in the menu
499  QList<QAction*> actions = this->mpZoomActionGroup->actions();
500  QList<QAction*>::iterator it = actions.begin(), endit = actions.end();
501 
502  while (it != endit)
503  {
504  if ((*it)->isChecked())
505  {
506  (*it)->setChecked(false);
507  // only one can be checked
508  break;
509  }
510 
511  ++it;
512  }
513 
514  // add a new entry for the current zoom factor to the zoom dropdown list
515  disconnect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
516  // add a new entry for the zoom factor
517  QString s = QString("%1").arg(zoom * 100);
518  s.append("%");
519  const size_t n = sizeof(CQNewMainWindow::ZOOM_FACTOR_STRINGS) / sizeof(char*);
520 
521  if ((size_t)this->mpZoomDropdown->count() > n)
522  {
523  this->mpZoomDropdown->setItemText(0, s);
524  }
525  else
526  {
527  this->mpZoomDropdown->insertItem(0, s);
528  }
529 
530  this->mpZoomDropdown->setCurrentIndex(0);
531  connect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
532 }
void setZoomFactor(double zoom)
void setZoomFactor(QString s)
QActionGroup * mpZoomActionGroup
QComboBox * mpZoomDropdown
CQLayoutMainWindow * mpAnimationWindow
void slotZoomChanged(int index)
DISPLAY_MODE mMode
CQGLLayoutViewer * mpLayoutViewer
static const char *const ZOOM_FACTOR_STRINGS[]
void CQNewMainWindow::slotLayoutChanged ( int  index)
slot

Definition at line 534 of file CQNewMainWindow.cpp.

References CCopasiDataModel::getListOfLayouts(), mpCurrentLayout, mpDataModel, updateRenderer(), and updateRenderInformationList().

Referenced by createToolBars(), CQLayoutsWidget::slotShowLayout(), and updateLayoutList().

535 {
536  //std::cout << "new layout " << index << std::endl;
537  CLayout* pTmpLayout = (*this->mpDataModel->getListOfLayouts())[index];
538 
539  if (pTmpLayout != this->mpCurrentLayout)
540  {
541  this->mpCurrentLayout = pTmpLayout;
542  // update the corresponding render information list
544  this->updateRenderer();
545  }
546 }
CLayout * mpCurrentLayout
CCopasiDataModel * mpDataModel
CListOfLayouts * getListOfLayouts()
void updateRenderInformationList()
void CQNewMainWindow::slotLayoutFinished ( )
slot

Definition at line 1748 of file CQNewMainWindow.cpp.

References mpCopy, mpStopLayoutAction, redrawNow(), slotRunSpringLayout(), and slotStopClicked().

Referenced by CQNewMainWindow().

1749 {
1750  disconnect(this->mpStopLayoutAction, SIGNAL(triggered()), this, SLOT(slotStopClicked()));
1751  connect(this->mpStopLayoutAction, SIGNAL(triggered()), this, SLOT(slotRunSpringLayout()));
1752  this->mpStopLayoutAction->setIcon(QPixmap(layout_start_xpm));
1753  this->mpStopLayoutAction->setToolTip("Run Spring Layout Algorithm");
1754 
1755  if (mpCopy != NULL)
1756  {
1757  delete mpCopy;
1758  mpCopy = NULL;
1759  }
1760 
1761  redrawNow();
1762 }
QAction * mpStopLayoutAction
void CQNewMainWindow::slotLayoutStateChanged ( QSharedPointer< CLayoutState state)
slot

Definition at line 1847 of file CQNewMainWindow.cpp.

References mpCurrentLayout, and redrawNow().

Referenced by CQNewMainWindow().

1848 {
1849  state->applyTo(mpCurrentLayout);
1850  redrawNow();
1851 }
CLayout * mpCurrentLayout
void CQNewMainWindow::slotRenderInfoChanged ( int  index)
slot

Definition at line 548 of file CQNewMainWindow.cpp.

References change_style(), getDefaultStyle(), CListOfLayouts::getListOfGlobalRenderInformationObjects(), CCopasiDataModel::getListOfLayouts(), CLayout::getListOfLocalRenderInformationObjects(), CListOfLayouts::getRenderInformation(), CLayout::getRenderInformation(), mpCurrentLayout, mpCurrentRenderInformation, mpDataModel, and CCopasiVector< T >::size().

Referenced by addDefaultRenderInfoItemsToList(), addGlobalRenderInfoItemsToList(), createToolBars(), and updateRenderInformationList().

549 {
550  // check if a local or a global render information has been selected
551  CLRenderInformationBase* pRenderInfo = NULL;
552 
553  // the local render information is first in the list
554  if (index == -1)
555  {
556  //std::cout << "index is -1" << std::endl;
557  return;
558  }
559 
560  size_t Index = (size_t) index;
561 
562  size_t numLocalRenderInfo = this->mpCurrentLayout->getListOfLocalRenderInformationObjects().size();
563  size_t numFileRenderInfo = numLocalRenderInfo + this->mpDataModel->getListOfLayouts()->getListOfGlobalRenderInformationObjects().size();
564 
565  if (Index >= numLocalRenderInfo)
566  {
567  // it is a global render information or a default render info
568  if (Index >= numFileRenderInfo)
569  {
570  // it must be a default render information
571  pRenderInfo = getDefaultStyle(Index - numFileRenderInfo);
572 
573  if (pRenderInfo != this->mpCurrentRenderInformation)
574  {
575  this->mpCurrentRenderInformation = pRenderInfo;
576  this->change_style(true);
577  }
578  }
579  else
580  {
581  pRenderInfo = this->mpDataModel->getListOfLayouts()->getRenderInformation(Index - numLocalRenderInfo);
582 
583  if (pRenderInfo != this->mpCurrentRenderInformation)
584  {
585  this->mpCurrentRenderInformation = pRenderInfo;
586  this->change_style();
587  }
588  }
589  }
590  else
591  {
592  // it is a local render information
593  pRenderInfo = this->mpCurrentLayout->getRenderInformation(Index);
594 
595  if (pRenderInfo != this->mpCurrentRenderInformation)
596  {
597  this->mpCurrentRenderInformation = pRenderInfo;
598  this->change_style();
599  }
600  }
601 }
const CCopasiVector< CLLocalRenderInformation > & getListOfLocalRenderInformationObjects() const
Definition: CLayout.h:149
CLayout * mpCurrentLayout
virtual size_t size() const
const CLLocalRenderInformation * getRenderInformation(size_t index) const
Definition: CLayout.cpp:658
CCopasiDataModel * mpDataModel
CLRenderInformationBase * mpCurrentRenderInformation
CLGlobalRenderInformation * getDefaultStyle(size_t index)
void change_style(bool defaultStyle=false)
CListOfLayouts * getListOfLayouts()
CLGlobalRenderInformation * getRenderInformation(size_t index)
const CCopasiVector< CLGlobalRenderInformation > & getListOfGlobalRenderInformationObjects() const
void CQNewMainWindow::slotResetView ( )
slot

Definition at line 469 of file CQNewMainWindow.cpp.

References mpAnimationWindow, mpLayoutViewer, resetView(), CQGLLayoutViewer::setZoomFactor(), and CQLayoutMainWindow::slotResetView().

Referenced by createMenus().

470 {
471  this->resetView();
472  // if we are not in animation mode, we have to repaint
473  this->mpLayoutViewer->setZoomFactor(1.0);
475 }
void setZoomFactor(double zoom)
CQLayoutMainWindow * mpAnimationWindow
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::slotRunRandomizeLayout ( )
protectedslot

Definition at line 1836 of file CQNewMainWindow.cpp.

References CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfMetaboliteGlyphs(), mpCurrentLayout, randomizeLayout(), CCopasiVector< T >::size(), and slotCalculateDimensions().

Referenced by createActions().

1837 {
1838  if (this->mpCurrentLayout == NULL ||
1840  return;
1841 
1842  randomizeLayout();
1843 
1845 }
CLayout * mpCurrentLayout
virtual size_t size() const
const CCopasiVector< CLCompartmentGlyph > & getListOfCompartmentGlyphs() const
Definition: CLayout.h:81
const CCopasiVector< CLMetabGlyph > & getListOfMetaboliteGlyphs() const
Definition: CLayout.h:94
void CQNewMainWindow::slotRunSpringLayout ( )
slot

Definition at line 1773 of file CQNewMainWindow.cpp.

References createSpringLayout().

Referenced by createActions(), createSpringLayout(), and slotLayoutFinished().

1774 {
1775  this->createSpringLayout(1000, 1);
1776 }
void createSpringLayout(int numIterations, int updateInterval)
void CQNewMainWindow::slotScreenshot ( )
slot

This slot initiates the export of the layout as a bitmap. The user gets to choose which part of the layout is to be exported and how large the resulting bitmap is supposed to be.

Definition at line 864 of file CQNewMainWindow.cpp.

References export_bitmap(), CQGLLayoutPainter::getCurrentHeight(), CQGLLayoutPainter::getCurrentPositionX(), CQGLLayoutPainter::getCurrentPositionY(), CQGLLayoutPainter::getCurrentWidth(), CQScreenshotOptionsDialog::getHeight(), CQScreenshotOptionsDialog::getImageHeight(), CQScreenshotOptionsDialog::getImageWidth(), CQGLLayoutViewer::getPainter(), CopasiFileDialog::getSaveFileName(), CQScreenshotOptionsDialog::getWidth(), CQScreenshotOptionsDialog::getX(), CQScreenshotOptionsDialog::getY(), CQScreenshotOptionsDialog::isSetDrawSelectionDecoration(), CQGLLayoutPainter::maxX(), CQGLLayoutPainter::maxY(), CQGLLayoutPainter::minX(), CQGLLayoutPainter::minY(), and mpLayoutViewer.

Referenced by createActions(), setMode(), and switchMode().

865 {
866  CQGLLayoutPainter* pPainter = this->mpLayoutViewer->getPainter();
867 
868  if (pPainter == NULL)
869  return;
870 
871 #ifndef USE_SCREENSHOT_OPTIONS
872 
873  QString fileName = CopasiFileDialog::getSaveFileName(this, "Export to", "", QString("PNG (*.png);;All files (*)"));
874 
875  if (!fileName.isEmpty())
876  export_bitmap(fileName, 2.0);
877 
878 #else
879 
880  double layoutX = pPainter->minX();
881  double layoutY = pPainter->minY();
882  double layoutWidth = pPainter->maxX() - layoutX;
883  double layoutHeight = pPainter->maxY() - layoutY;
884  double x = pPainter->getCurrentPositionX();
885  double y = pPainter->getCurrentPositionY();
886  double width = pPainter->getCurrentWidth();
887  double height = pPainter->getCurrentHeight();
888 
889  CQScreenshotOptionsDialog* pDialog = new CQScreenshotOptionsDialog(layoutX, layoutY, layoutWidth, layoutHeight,
890  x, y, width, height, pPainter->width() , pPainter->height(), -1, this);
891 
892  if (pDialog->exec() == QDialog::Accepted)
893  {
894 
895  // ask for the filename
896  QString fileName = CopasiFileDialog::getSaveFileName(this, QString("Export to"), "", QString("PNG (*.png);;All files (*)"));
897 
898  if (!fileName.isEmpty())
899  {
900  export_bitmap(fileName, pDialog->getX(), pDialog->getY(), pDialog->getWidth(), pDialog->getHeight(), pDialog->getImageWidth(), pDialog->getImageHeight(), pDialog->isSetDrawSelectionDecoration());
901  }
902  }
903 
904  delete pDialog;
905 #endif
906 }
void export_bitmap(const QString &filename, double scale=4.0)
double minX() const
double getCurrentHeight() const
double getCurrentPositionY() const
CQGLLayoutPainter * getPainter()
double maxY() const
double getCurrentPositionX() const
double getCurrentWidth() const
double maxX() const
double minY() const
CQGLLayoutViewer * mpLayoutViewer
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 CQNewMainWindow::slotSingleCurveSelected ( bool  selected)
slot

This slot is called when the selection is changed and only a single curve is selected.

This slot is called when something in the document changes.

Definition at line 844 of file CQNewMainWindow.cpp.

References mpRevertCurveAct.

Referenced by CQNewMainWindow().

845 {
846  // check if a single curve is selected
847  if (selected)
848  {
849  this->mpRevertCurveAct->setEnabled(true);
850  }
851  else
852  {
853  this->mpRevertCurveAct->setEnabled(false);
854  }
855 }
QAction * mpRevertCurveAct
void CQNewMainWindow::slotStopClicked ( )
protectedslot

This slot is called when the stop button is presed. It notifies the layout method to stop the spring layout iterations.

Definition at line 1768 of file CQNewMainWindow.cpp.

References mpLayoutThread, and CQLayoutThread::stopLayout().

Referenced by closeEvent(), createSpringLayout(), and slotLayoutFinished().

1769 {
1770  this->mpLayoutThread->stopLayout();
1771 }
CQLayoutThread * mpLayoutThread
void CQNewMainWindow::slotZoomChanged ( int  index)
slot

Definition at line 775 of file CQNewMainWindow.cpp.

References mpAnimationWindow, mpLayoutViewer, mpZoomActionGroup, mpZoomDropdown, CQGLLayoutViewer::setZoomFactor(), CQLayoutMainWindow::setZoomFactor(), ZOOM_FACTOR_STRINGS, and ZOOM_FACTORS.

Referenced by createToolBars(), resetView(), slotFitToScreen(), and slotZoomMenuItemActivated().

776 {
777  // check if the number of zoom factors in the combobox is greater than
778  // the numbers of items in the zoom combo box
779  //
780  // if so, delete the first entry from the list and reduce the index by 1 because the first entry must be
781  // the item that has been added by fitToScreen.
782  const size_t n = sizeof(CQNewMainWindow::ZOOM_FACTOR_STRINGS) / sizeof(char*);
783 
784  if ((size_t)this->mpZoomDropdown->count() > n && index != 0)
785  {
786  --index;
787  disconnect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
788  this->mpZoomDropdown->removeItem(0);
789  this->mpZoomDropdown->setCurrentIndex(index);
790  connect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
791  }
792 
794  // also change the zoom factor for the animation window
795  this->mpAnimationWindow->setZoomFactor(this->mpZoomDropdown->currentText());
796 
797  // also set the zoom factor in the menu
798  if ((int) index < this->mpZoomActionGroup->actions().size())
799  {
800  this->mpZoomActionGroup->actions().at(index)->setChecked(true);
801  }
802 }
void setZoomFactor(double zoom)
void setZoomFactor(QString s)
QActionGroup * mpZoomActionGroup
QComboBox * mpZoomDropdown
CQLayoutMainWindow * mpAnimationWindow
void slotZoomChanged(int index)
CQGLLayoutViewer * mpLayoutViewer
static const double ZOOM_FACTORS[]
static const char *const ZOOM_FACTOR_STRINGS[]
void CQNewMainWindow::slotZoomMenuItemActivated ( QAction *  pAction)
slot

Definition at line 804 of file CQNewMainWindow.cpp.

References mpAnimationWindow, mpLayoutViewer, mpZoomActionGroup, mpZoomDropdown, CQGLLayoutViewer::setZoomFactor(), CQLayoutMainWindow::setZoomFactor(), slotZoomChanged(), ZOOM_FACTOR_STRINGS, and ZOOM_FACTORS.

Referenced by createMenus().

805 {
806  int index = this->mpZoomActionGroup->actions().indexOf(pAction);
807  // check if the number of zoom factors in the combobox is greater than
808  // the number of items in the combobox
809  //
810  // if so, delete the first entry from the list because this
811  // item that has been added by fitToScreen.
812  const size_t n = sizeof(CQNewMainWindow::ZOOM_FACTOR_STRINGS) / sizeof(char*);
813 
814  if ((size_t)this->mpZoomDropdown->count() > n)
815  {
816  disconnect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
817  this->mpZoomDropdown->removeItem(0);
818  connect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
819  }
820 
822  // also set the zoom factor in the combobox
823  disconnect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
824 
825  if (index < this->mpZoomDropdown->count())
826  {
827  this->mpZoomDropdown->setCurrentIndex(index);
828  }
829 
830  connect(this->mpZoomDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotZoomChanged(int)));
831 
832  // also change the zoom factor for the animation window
833  this->mpAnimationWindow->setZoomFactor(this->mpZoomDropdown->currentText());
834 }
void setZoomFactor(double zoom)
void setZoomFactor(QString s)
QActionGroup * mpZoomActionGroup
QComboBox * mpZoomDropdown
CQLayoutMainWindow * mpAnimationWindow
void slotZoomChanged(int index)
CQGLLayoutViewer * mpLayoutViewer
static const double ZOOM_FACTORS[]
static const char *const ZOOM_FACTOR_STRINGS[]
void CQNewMainWindow::switchMode ( )
slot

switches the display mode between animation mode and graph mode.

Definition at line 1037 of file CQNewMainWindow.cpp.

References ANIMATION_MODE, GRAPH_MODE, mAnimationIcon, mGraphIcon, mMode, mpAnimationWindow, mpChangeColorAction, mpCurrentLayout, mpElementaryModesMenu, mpHighlightModeAction, mpScreenshotAct, mpSwitchModeAct, mpWidgetStack, setAnimationMenu(), setAnimationToolbar(), setGraphMenu(), setGraphToolbar(), CQLayoutMainWindow::setLayout(), slotFitToScreen(), slotScreenshot(), and updateLayoutList().

Referenced by createActions(), and setMode().

1038 {
1039  switch (this->mMode)
1040  {
1042  disconnect(mpScreenshotAct, SIGNAL(triggered()), this, SLOT(slotScreenshot()));
1043  connect(this->mpScreenshotAct, SIGNAL(triggered()), this->mpAnimationWindow, SLOT(saveImage()));
1044  this->mpSwitchModeAct->setIcon(mGraphIcon);
1045  this->mpSwitchModeAct->setStatusTip(tr("Switch to graph mode."));
1046  this->mpSwitchModeAct->setText(tr("Graph Mode"));
1048  this->setAnimationToolbar();
1049  this->setAnimationMenu();
1050  this->mpWidgetStack->setCurrentIndex(1);
1051  this->mpElementaryModesMenu->setEnabled(false);
1052  this->mpHighlightModeAction->setEnabled(false);
1053  this->mpChangeColorAction->setEnabled(false);
1054 
1055  updateLayoutList();
1056  // reset current displayed layout, so we can get the updates displayed
1057  this->mpAnimationWindow->setLayout(NULL);
1058  // update with the new layout
1060  // and fit it too screen
1061  slotFitToScreen();
1062  break;
1063 
1065  disconnect(this->mpScreenshotAct, SIGNAL(triggered()), this->mpAnimationWindow, SLOT(saveImage()));
1066  connect(mpScreenshotAct, SIGNAL(triggered()), this, SLOT(slotScreenshot()));
1067  this->mpSwitchModeAct->setIcon(mAnimationIcon);
1068  this->mpSwitchModeAct->setStatusTip(tr("Switch to animation mode."));
1069  this->mpSwitchModeAct->setText(tr("Animation Mode"));
1071  this->setGraphToolbar();
1072  this->setGraphMenu();
1073  this->mpWidgetStack->setCurrentIndex(0);
1074  this->mpElementaryModesMenu->setEnabled(true);
1075  this->mpHighlightModeAction->setEnabled(true);
1076  this->mpChangeColorAction->setEnabled(true);
1077  break;
1078  }
1079 }
QAction * mpChangeColorAction
CLayout * mpCurrentLayout
QAction * mpScreenshotAct
CQLayoutMainWindow * mpAnimationWindow
QAction * mpHighlightModeAction
DISPLAY_MODE mMode
void setLayout(CLayout *pLayout)
QMenu * mpElementaryModesMenu
QStackedWidget * mpWidgetStack
QAction * mpSwitchModeAct
void CQNewMainWindow::toggleHighlightSlot ( bool  checked)
slot

Is called when the menu entry for toggling highlighting of elementary modes is toggled.

Definition at line 1522 of file CQNewMainWindow.cpp.

References CQGLLayoutViewer::getPainter(), GRAPH_MODE, mMode, mpChangeColorAction, mpFogColorPixmap, mpHighlightColorPixmap, mpLayoutViewer, CQGLLayoutPainter::setHighlightFlag(), and CQGLLayoutPainter::update().

Referenced by createMenus().

1523 {
1524  this->mpLayoutViewer->getPainter()->setHighlightFlag(checked);
1525 
1526  // update the icon and the text
1527  if (checked)
1528  {
1529  this->mpChangeColorAction->setText(tr("highlight color ..."));
1530  this->mpChangeColorAction->setIcon(QIcon(*this->mpHighlightColorPixmap));
1531  }
1532  else
1533  {
1534  this->mpChangeColorAction->setText(tr("fog color ..."));
1535  this->mpChangeColorAction->setIcon(QIcon(*this->mpFogColorPixmap));
1536  }
1537 
1538  // we need to redraw the gl window
1539  if (this->mMode == GRAPH_MODE)
1540  {
1541  this->mpLayoutViewer->getPainter()->update();
1542  }
1543 }
QAction * mpChangeColorAction
QPixmap * mpFogColorPixmap
CQGLLayoutPainter * getPainter()
QPixmap * mpHighlightColorPixmap
DISPLAY_MODE mMode
void setHighlightFlag(bool flag)
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::updateLayoutList ( )
slot

Fills the layout dropdown list.

Definition at line 993 of file CQNewMainWindow.cpp.

References CLayout::getKey(), CCopasiDataModel::getListOfLayouts(), CCopasiObject::getObjectName(), mpCurrentLayout, mpCurrentRenderInformation, mpDataModel, mpLayoutDropdown, CCopasiVector< T >::size(), slotLayoutChanged(), updateRenderer(), and updateRenderInformationList().

Referenced by CQNewMainWindow(), and switchMode().

994 {
995  if (this->mpDataModel == NULL) return;
996 
997  disconnect(this->mpLayoutDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLayoutChanged(int)));
998  this->mpLayoutDropdown->clear();
999  const CLayout* pTmpLayout = NULL;
1000  size_t i, iMax = this->mpDataModel->getListOfLayouts()->size();
1001 
1002  for (i = 0; i < iMax; ++i)
1003  {
1004  pTmpLayout = (*this->mpDataModel->getListOfLayouts())[i];
1005  std::string text = pTmpLayout->getKey();
1006 
1007  if (!pTmpLayout->getObjectName().empty())
1008  {
1009  text = pTmpLayout->getObjectName();
1010  //text += "(";
1011  //text += pTmpLayout->getObjectName();
1012  //text += ")";
1013  }
1014 
1015  this->mpLayoutDropdown->addItem(text.c_str());
1016  }
1017 
1018  if (iMax > 0)
1019  {
1020  this->mpCurrentLayout = (*this->mpDataModel->getListOfLayouts())[0];
1021  }
1022 
1024 
1025  if (this->mpCurrentLayout && this->mpCurrentRenderInformation)
1026  {
1027  this->updateRenderer();
1028  }
1029 
1030  connect(this->mpLayoutDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLayoutChanged(int)));
1031 }
void slotLayoutChanged(int index)
const std::string & getObjectName() const
CLayout * mpCurrentLayout
virtual size_t size() const
CCopasiDataModel * mpDataModel
CLRenderInformationBase * mpCurrentRenderInformation
QComboBox * mpLayoutDropdown
CListOfLayouts * getListOfLayouts()
virtual const std::string & getKey() const
Definition: CLayout.h:71
void updateRenderInformationList()
void CQNewMainWindow::updateRenderer ( )

Definition at line 435 of file CQNewMainWindow.cpp.

References CQGLLayoutViewer::change_style(), getDefaultStyle(), mCurDir, mpAnimationWindow, mpCurrentLayout, mpCurrentRenderInformation, mpDataModel, mpLayoutViewer, resetView(), CQLayoutMainWindow::setLayout(), and CQGLLayoutViewer::update().

Referenced by slotLayoutChanged(), and updateLayoutList().

436 {
437  // pass the datamodel, the layout and the render info to the
438  // LayoutViewer
439  this->resetView();
440  this->mpLayoutViewer->update(this->mpDataModel, this->mpCurrentLayout, this->mpCurrentRenderInformation, QString(this->mCurDir.c_str()));
442 
444  {
446  }
447 }
void update(const CCopasiDataModel *pDataModel, CLayout *pLayout, const CLRenderInformationBase *pRenderInfo, const QString &baseDir)
CLayout * mpCurrentLayout
CCopasiDataModel * mpDataModel
CLRenderInformationBase * mpCurrentRenderInformation
CLGlobalRenderInformation * getDefaultStyle(size_t index)
CQLayoutMainWindow * mpAnimationWindow
void setLayout(CLayout *pLayout)
std::string mCurDir
void change_style(const CLRenderInformationBase *pRenderInfo, bool defaultStyle=false)
CQGLLayoutViewer * mpLayoutViewer
void CQNewMainWindow::updateRenderInformationList ( )
protected

Definition at line 603 of file CQNewMainWindow.cpp.

References getDefaultStyle(), CLRenderInformationBase::getKey(), CListOfLayouts::getListOfGlobalRenderInformationObjects(), CCopasiDataModel::getListOfLayouts(), CLayout::getListOfLocalRenderInformationObjects(), CLRenderInformationBase::getName(), getNumDefaultStyles(), CListOfLayouts::getRenderInformation(), CLayout::getRenderInformation(), mpCurrentLayout, mpCurrentRenderInformation, mpDataModel, mpRenderDropdown, CCopasiVector< T >::size(), and slotRenderInfoChanged().

Referenced by slotLayoutChanged(), and updateLayoutList().

604 {
605  // disconnect the slot
606  disconnect(this->mpRenderDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotRenderInfoChanged(int)));
607  // remove the local render information items
609 
610  while ((size_t) this->mpRenderDropdown->count() > num)
611  {
612  this->mpRenderDropdown->removeItem(0);
613  }
614 
615  // add the new local render information items
616  if (this->mpCurrentLayout)
617  {
619  size_t i;
620  CLRenderInformationBase* pTmpRenderInfo = NULL;
621 
622  for (i = num; i > 0; --i)
623  {
624  pTmpRenderInfo = this->mpCurrentLayout->getRenderInformation(i - 1);
625  std::string text = pTmpRenderInfo->getKey();
626 
627  if (!pTmpRenderInfo->getName().empty())
628  {
629  text = pTmpRenderInfo->getName();
630  //text += " (";
631  //text += pTmpRenderInfo->getName();
632  //text += ")";
633  }
634 
635  this->mpRenderDropdown->insertItem(0, QString(text.c_str()));
636  }
637  }
638 
639  // if the current render information is a global render information, keep
640  // the selection
641  // otherwise select the first render information if there is one
642  if (dynamic_cast<const CLGlobalRenderInformation*>(this->mpCurrentRenderInformation))
643  {
644  // find the correct index
646 
647  for (i = 0; i < iMax; ++i)
648  {
650  {
651  break;
652  }
653  }
654 
655  if (i == iMax)
656  {
657  // it must be a default style
658  num += i;
659  iMax = getNumDefaultStyles();
660 
661  for (i = 0; i < iMax; ++i)
662  {
664  {
665  break;
666  }
667  }
668 
669  assert(i != iMax);
670  this->mpRenderDropdown->setCurrentIndex((int)(num + i));
671  }
672  else
673  {
674  this->mpRenderDropdown->setCurrentIndex((int)(num + i));
675  }
676  }
677  else
678  {
679  if (this->mpRenderDropdown->count() > 0)
680  {
681  if (num > 0)
682  {
683  // take the first local render information
684  if (this->mpCurrentLayout != NULL)
685  {
687  }
688  else
689  {
690  this->mpCurrentRenderInformation = NULL;
691  }
692 
693  this->mpRenderDropdown->setCurrentIndex(0);
694  }
696  {
697  // take the first global render information
699  this->mpRenderDropdown->setCurrentIndex((int) num);
700  }
701  else if (getNumDefaultStyles() > 0)
702  {
704  }
705  else
706  {
707  this->mpCurrentRenderInformation = NULL;
708  }
709  }
710  else
711  {
712  this->mpCurrentRenderInformation = NULL;
713  }
714  }
715 
716  // reconnect the slot
717  connect(this->mpRenderDropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(slotRenderInfoChanged(int)));
718 }
QComboBox * mpRenderDropdown
const CCopasiVector< CLLocalRenderInformation > & getListOfLocalRenderInformationObjects() const
Definition: CLayout.h:149
CLayout * mpCurrentLayout
virtual size_t size() const
const CLLocalRenderInformation * getRenderInformation(size_t index) const
Definition: CLayout.cpp:658
CCopasiDataModel * mpDataModel
CLRenderInformationBase * mpCurrentRenderInformation
CLGlobalRenderInformation * getDefaultStyle(size_t index)
size_t getNumDefaultStyles()
CListOfLayouts * getListOfLayouts()
CLGlobalRenderInformation * getRenderInformation(size_t index)
const std::string & getKey() const
const std::string & getName() const
void slotRenderInfoChanged(int index)
const CCopasiVector< CLGlobalRenderInformation > & getListOfGlobalRenderInformationObjects() const

Member Data Documentation

QIcon CQNewMainWindow::mAnimationIcon
private

Definition at line 301 of file CQNewMainWindow.h.

Referenced by createActions(), and switchMode().

std::string CQNewMainWindow::mCurDir
private

Definition at line 298 of file CQNewMainWindow.h.

Referenced by CQNewMainWindow(), and updateRenderer().

bool CQNewMainWindow::mDocumentChanged
private

Definition at line 293 of file CQNewMainWindow.h.

std::vector<const CFluxMode*> CQNewMainWindow::mFluxModes
private

Definition at line 329 of file CQNewMainWindow.h.

Referenced by checkForElementaryModesSlot(), and elementaryModeTriggeredSlot().

QIcon CQNewMainWindow::mGraphIcon
private

Definition at line 300 of file CQNewMainWindow.h.

Referenced by switchMode().

std::set<std::string> CQNewMainWindow::mHighlightedMetabolites
private

Definition at line 321 of file CQNewMainWindow.h.

Referenced by selectMetabolite().

std::set<REACTION_SELECTION_ITEM> CQNewMainWindow::mHighlightedReactions
private

Definition at line 322 of file CQNewMainWindow.h.

Referenced by elementaryModeTriggeredSlot(), and selectReaction().

DISPLAY_MODE CQNewMainWindow::mMode
private
CQLayoutMainWindow* CQNewMainWindow::mpAnimationWindow
private
QAction* CQNewMainWindow::mpCalculateDimensions
private

Definition at line 341 of file CQNewMainWindow.h.

Referenced by createActions(), and createMenus().

QAction* CQNewMainWindow::mpChangeColorAction
private
QAction* CQNewMainWindow::mpCircularShape
private

Definition at line 278 of file CQNewMainWindow.h.

Referenced by createActions(), and createMenus().

QAction* CQNewMainWindow::mpCloseAct
private

Definition at line 275 of file CQNewMainWindow.h.

Referenced by createActions(), and createMenus().

CLayout* CQNewMainWindow::mpCopy
protected

the copy on which the layout operates

Definition at line 367 of file CQNewMainWindow.h.

Referenced by createSpringLayout(), slotLayoutFinished(), and ~CQNewMainWindow().

CLayout* CQNewMainWindow::mpCurrentLayout
private
CLRenderInformationBase* CQNewMainWindow::mpCurrentRenderInformation
private
CCopasiDataModel* CQNewMainWindow::mpDataModel
private
QMenu* CQNewMainWindow::mpElementaryModesMenu
private
QMenu* CQNewMainWindow::mpFileMenu
private

Definition at line 263 of file CQNewMainWindow.h.

Referenced by createMenus().

QToolBar* CQNewMainWindow::mpFileToolBar
private

Definition at line 271 of file CQNewMainWindow.h.

Referenced by createToolBars().

QPixmap* CQNewMainWindow::mpFogColorPixmap
private

Definition at line 333 of file CQNewMainWindow.h.

Referenced by changeColorSlot(), CQNewMainWindow(), and toggleHighlightSlot().

QAction* CQNewMainWindow::mpFogDensityAction
private

Definition at line 336 of file CQNewMainWindow.h.

Referenced by createMenus().

QPixmap* CQNewMainWindow::mpHighlightColorPixmap
private

Definition at line 334 of file CQNewMainWindow.h.

Referenced by changeColorSlot(), CQNewMainWindow(), and toggleHighlightSlot().

QAction* CQNewMainWindow::mpHighlightModeAction
private

Definition at line 335 of file CQNewMainWindow.h.

Referenced by changeColorSlot(), createMenus(), and switchMode().

QComboBox* CQNewMainWindow::mpLayoutDropdown
private

Definition at line 287 of file CQNewMainWindow.h.

Referenced by createToolBars(), and updateLayoutList().

QMenu* CQNewMainWindow::mpLayoutMenu
private

Definition at line 265 of file CQNewMainWindow.h.

Referenced by createMenus(), setAnimationMenu(), and setGraphMenu().

CQLayoutThread* CQNewMainWindow::mpLayoutThread
protected

the layout thread

Definition at line 364 of file CQNewMainWindow.h.

Referenced by CQNewMainWindow(), createSpringLayout(), randomizeLayout(), slotStopClicked(), and ~CQNewMainWindow().

CQGLLayoutViewer* CQNewMainWindow::mpLayoutViewer
private
QAction* CQNewMainWindow::mpLoadDataAct
private
QAction* CQNewMainWindow::mpLoopItemAction
private

Definition at line 282 of file CQNewMainWindow.h.

Referenced by createMenus().

QAction* CQNewMainWindow::mpMimaNodeSizes
private

Definition at line 280 of file CQNewMainWindow.h.

Referenced by createActions(), and createMenus().

QMenu* CQNewMainWindow::mpOptionsMenu
private

Definition at line 267 of file CQNewMainWindow.h.

Referenced by createMenus(), setAnimationMenu(), and setGraphMenu().

QMenu* CQNewMainWindow::mpPlayMenu
private

Definition at line 264 of file CQNewMainWindow.h.

Referenced by createMenus(), setAnimationMenu(), and setGraphMenu().

QAction* CQNewMainWindow::mpRandomizeLayout
private

Definition at line 340 of file CQNewMainWindow.h.

Referenced by createActions(), createMenus(), and createToolBars().

QAction* CQNewMainWindow::mpRectangularShape
private

Definition at line 279 of file CQNewMainWindow.h.

Referenced by createActions(), and createMenus().

QComboBox* CQNewMainWindow::mpRenderDropdown
private
QLabel* CQNewMainWindow::mpRenderLabel
private

Definition at line 291 of file CQNewMainWindow.h.

Referenced by createToolBars(), setAnimationToolbar(), and setGraphToolbar().

QAction* CQNewMainWindow::mpRevertCurveAct
private
QAction* CQNewMainWindow::mpScreenshotAct
private

Definition at line 276 of file CQNewMainWindow.h.

Referenced by createActions(), createMenus(), createToolBars(), setMode(), and switchMode().

QToolBar* CQNewMainWindow::mpSelectionToolBar
private

Definition at line 272 of file CQNewMainWindow.h.

Referenced by createToolBars().

QAction* CQNewMainWindow::mpSFontSize
private

Definition at line 281 of file CQNewMainWindow.h.

Referenced by createActions(), and createMenus().

QAction* CQNewMainWindow::mpStopLayoutAction
private
QAction* CQNewMainWindow::mpSwitchModeAct
private

Definition at line 273 of file CQNewMainWindow.h.

Referenced by createActions(), createMenus(), createToolBars(), and switchMode().

QMenu* CQNewMainWindow::mpViewMenu
private

Definition at line 266 of file CQNewMainWindow.h.

Referenced by CQNewMainWindow(), and createMenus().

QStackedWidget* CQNewMainWindow::mpWidgetStack
private

Definition at line 262 of file CQNewMainWindow.h.

Referenced by CQNewMainWindow(), and switchMode().

QMenu* CQNewMainWindow::mpWindowMenu
private

Definition at line 268 of file CQNewMainWindow.h.

Referenced by createMenus(), and getWindowMenu().

QActionGroup* CQNewMainWindow::mpZoomActionGroup
private
QComboBox* CQNewMainWindow::mpZoomDropdown
private
QMenu* CQNewMainWindow::mpZoomMenu
private

Definition at line 269 of file CQNewMainWindow.h.

Referenced by createMenus().

const char *const CQNewMainWindow::ZOOM_FACTOR_STRINGS = {"1%", "2%", "3%", "4%", "5%", "10%", "20%", "25%", "30%", "40%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "500%", "1000%"}
staticprivate
const double CQNewMainWindow::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}
staticprivate

Definition at line 296 of file CQNewMainWindow.h.

Referenced by slotZoomChanged(), and slotZoomMenuItemActivated().


The documentation for this class was generated from the following files: