This file is indexed.

/usr/include/sofa/gui/qt/RealGUI.h is in libsofa1-dev 1.0~beta4-12.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/******************************************************************************
*       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 4      *
*                (c) 2006-2009 MGH, INRIA, USTL, UJF, CNRS                    *
*                                                                             *
* This program is free software; you can redistribute it and/or modify it     *
* under the terms of the GNU General Public License as published by the Free  *
* Software Foundation; either version 2 of the License, or (at your option)   *
* any later version.                                                          *
*                                                                             *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    *
* more details.                                                               *
*                                                                             *
* You should have received a copy of the GNU General Public License along     *
* with this program; if not, write to the Free Software Foundation, Inc., 51  *
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.                   *
*******************************************************************************
*                            SOFA :: Applications                             *
*                                                                             *
* Authors: M. Adam, J. Allard, B. Andre, P-J. Bensoussan, S. Cotin, C. Duriez,*
* H. Delingette, F. Falipou, F. Faure, S. Fonteneau, L. Heigeas, C. Mendoza,  *
* M. Nesme, P. Neumann, J-P. de la Plata Alcade, F. Poyer and F. Roy          *
*                                                                             *
* Contact information: contact@sofa-framework.org                             *
******************************************************************************/
#ifndef SOFA_GUI_VIEWER_REALGUI_H
#define SOFA_GUI_VIEWER_REALGUI_H

#ifdef SOFA_PML
#  include <sofa/filemanager/sofapml/PMLReader.h>
#  include <sofa/filemanager/sofapml/LMLReader.h>
#endif

#include <time.h>
 

#include <sofa/gui/SofaGUI.h>

#include "GUI.h"
#include <sofa/gui/qt/GraphListenerQListView.h>
#include <sofa/gui/qt/FileManagement.h>
#include <sofa/gui/qt/viewer/SofaViewer.h>
#include <sofa/gui/qt/AddObject.h>
#include <sofa/gui/qt/ModifyObject.h>
#include <sofa/gui/qt/DisplayFlagWidget.h>
#include <sofa/gui/qt/WindowVisitor.h>
#include <sofa/gui/qt/GraphVisitor.h>
#include <sofa/gui/qt/SofaPluginManager.h>

#include <sofa/simulation/tree/xml/XML.h>
#include <sofa/helper/system/SetDirectory.h>


#ifdef SOFA_QT4
#include <QApplication>
#include <QDesktopWidget>
#include <Q3ListViewItem>
#include <QStackedWidget>
#include <QSlider>
#include <QTimer>
#include <Q3TextDrag>
#include <Q3PopupMenu>
#include <QLibrary>
typedef Q3ListViewItem QListViewItem;
typedef QStackedWidget QWidgetStack;
typedef Q3PopupMenu QPopupMenu;
#else
typedef QTextDrag Q3TextDrag;
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <qdragobject.h>
#include <qwidgetstack.h>
#include <qlistview.h>
#include <qslider.h>
#include <qpopupmenu.h>
#include <qlibrary.h>
#endif 
 

namespace sofa
{

namespace gui
{

namespace qt
{

//enum TYPE{ NORMAL, PML, LML};  
enum SCRIPT_TYPE { PHP, PERL };

using sofa::simulation::tree::GNode;
using sofa::simulation::Node;
#ifdef SOFA_PML
using namespace sofa::filemanager::pml;
#endif


class RealGUI : public ::GUI, public SofaGUI
{
    Q_OBJECT

    /// @name SofaGUI Interface
    /// @{


public:

    static int InitGUI(const char* name, const std::vector<std::string>& options);
    static SofaGUI* CreateGUI(const char* name, const std::vector<std::string>& options, sofa::simulation::Node* groot = NULL, const char* filename = NULL);

    int mainLoop();

    int closeGUI();

    Node* currentSimulation();

    /// @}

    const char* viewerName;

    sofa::gui::qt::viewer::SofaViewer* viewer;

	  RealGUI( const char* viewername, const std::vector<std::string>& options = std::vector<std::string>() );
	  ~RealGUI();


	  virtual void fileOpen(std::string filename); //, int TYPE=NORMAL);
      	  virtual void fileOpenSimu(std::string filename); //, int TYPE=NORMAL);
	  virtual void setScene(Node* groot, const char* filename=NULL);
          virtual void setDimension(int w, int h);
          virtual void setFullScreen();
	  virtual void setTitle( std::string windowTitle );

	  //public slots:
	  virtual void fileNew();
	  virtual void fileOpen();
	  virtual void fileSave(); 
 	  virtual void fileSaveAs(){fileSaveAs((Node *)NULL);};
	  virtual void fileSaveAs(Node *node);	 
	  virtual void fileSaveAs(Node* node,const char* filename);
	  
	  virtual void fileReload();
	  virtual void fileExit();
	  virtual void saveXML();
	  virtual void viewerOpenGL();
	  virtual void viewerQGLViewer();
	  virtual void viewerOGRE();
	  
	  virtual void editRecordDirectory();
	  virtual void editGnuplotDirectory();
	  virtual void showPluginManager();

	  void dragEnterEvent( QDragEnterEvent* event){event->accept();}
	  void dropEvent(QDropEvent* event);

	  public slots:
	  void fileRecentlyOpened(int id);
	  void updateRecentlyOpened(std::string fileLoaded);
	  void DoubleClickeItemInSceneView(QListViewItem * item);
	  void RightClickedItemInSceneView(QListViewItem *item, const QPoint& point, int index);
	  void playpauseGUI(bool value);
	  void step();
	  void setDt(double);
	  void setDt(const QString&);
	  void resetScene();
	  void screenshot();

	  void showhideElements(int FILTER, bool value);

	  void clearRecord();
	  void slot_recordSimulation( bool);
	  void slot_backward( );
	  void slot_stepbackward( );
// 	  void slot_playbackward(  );
	  void slot_playforward(  ) ;
	  void slot_stepforward( ) ;
	  void slot_forward( );
	  void slot_sliderValue(int value,bool updateTime=true);
	  void slot_loadrecord_timevalue(bool updateTime=true);


	  void updateViewerParameters();
	  void updateBackgroundColour();
	  void updateBackgroundImage();

	  void changeInstrument(int);
  
	  void clearGraph();
	  //Used in Context Menu
	  void graphSaveObject();
	  void graphAddObject();
	  void graphRemoveObject();
	  void graphModify();
	  void graphCollapse();
	  void graphExpand();
	  void graphDesactivateNode();
	  void graphActivateNode();
	  //When adding an object in the graph
	  void loadObject(std::string path, double dx, double dy, double dz,double rx, double ry, double rz, double scale=1.0);
	  //refresh the visualization window	 
	  void redraw();
	  //when a dialog modify object is closed
	  void modifyUnlock(void *Id);
	  void transformObject( Node *node, double dx, double dy, double dz, double rx, double ry, double rz, double scale=1.0);
	  

	  void exportGraph();
	  void exportGraph(sofa::simulation::Node*);
	  void exportOBJ(bool exportMTL=true);
	  void dumpState(bool);
	  void displayComputationTime(bool);
	  void setExportGnuplot(bool);
	  void setExportVisitor(bool);
	  void currentTabChanged(QWidget*);

	signals:
	  void reload();
	  void newScene();
	  void newStep(); 	  
	  void quit();

	protected:
	  
	  void eventNewStep();
	  void eventNewTime();
	  void init();
	  void keyPressEvent ( QKeyEvent * e );
	  
	  void loadSimulation(bool one_step=false);

	  void initDesactivatedNode();
	  //Graph Stats
	  bool graphCreateStats(Node *groot); 	  
	  void graphAddCollisionModelsStat(sofa::helper::vector< sofa::core::CollisionModel* > &v);	  
	  void graphSummary();
	  	 
	  bool isErasable(core::objectmodel::Base* element);

	  void startDumpVisitor();
	  void stopDumpVisitor();

	  bool m_dumpState;
	  std::ofstream* m_dumpStateStream;
	  std::ofstream* m_dumpVisitorStream;
	  bool m_exportGnuplot;
	  bool _animationOBJ; int _animationOBJcounter;// save a succession of .obj indexed by _animationOBJcounter
	  bool m_displayComputationTime;


	  QWidget* currentTab;
	  QWidget *tabInstrument;
	  
	  GraphListenerQListView* graphListener;
	  QListViewItem *item_clicked;
	  Node *node_clicked;
	  QTimer* timerStep;
	  QTimer* timerRecordStep;
	  QLabel* fpsLabel;
	  QLabel* timeLabel;
	  WFloatLineEdit *background[3];
	  QLineEdit *backgroundImage;

	  
	  void setPixmap(std::string pixmap_filename, QPushButton* b);

	   double getRecordInitialTime() const; 
	   void   setRecordInitialTime(const double time);
	   double getRecordFinalTime  () const;	 
	   void   setRecordFinalTime  (const double time);	 
	   double getRecordTime       () const;	 
	   void   setRecordTime       (const double time);
	   void   setTimeSimulation   (const double time);
	  
	  QPushButton* record;
	  QPushButton* backward_record;
	  QPushButton* stepbackward_record;
// 	  QPushButton* playbackward_record;
	  QPushButton* playforward_record;
	  QPushButton* stepforward_record;
	  QPushButton* forward_record;
	  
	  QLineEdit* loadRecordTime;
	  QLabel* initialTime;
	  QLabel* finalTime;
	  QSlider* timeSlider;
	  
	  std::string simulation_name;
	  std::string record_directory;
	  std::string gnuplot_directory;
	  std::string writeSceneName;
	  std::string pathDumpVisitor;
	      
	  QWidgetStack* left_stack;
	  AddObject *dialog;



	  sofa::simulation::Node* getScene() { if (viewer) return viewer->getScene(); else return NULL; }

	  void sleep(float seconds, float init_time)
	  {
	    unsigned int t = 0;
	    clock_t goal = (clock_t) (seconds + init_time);
	    while (goal > clock()/(float)CLOCKS_PER_SEC) t++;
	  }
	  
	private:
	  //Map: Id -> Node currently modified. Used to avoid dependancies during removing actions
	  std::map< void*, core::objectmodel::Base* >            map_modifyDialogOpened;
	  
	  std::map< void*, QDialog* >                       map_modifyObjectWindow;
	  std::vector<std::pair<core::objectmodel::Base*, Q3ListViewItem*> > items_stats;
	  //unique ID to pass to a modify object dialog
	  void *current_Id_modifyDialog;

 
	  //currently unused: scale is experimental
 	  float object_Scale[2]; 

	  float initial_time;
	  int frameCounter;
	  //At initialization: list of the path to the basic objects you can add to the scene
	  std::vector< std::string > list_object;
	  std::list< GNode *> list_object_added;
	  std::list< GNode *> list_object_removed;
	  std::list< GNode *> list_object_initial;
	  bool record_simulation;

	  bool setViewer(const char* name);
	  void addViewer();	  
	  void setGUI(void);
	  
	  bool setWriteSceneName();
	  void addReadState(bool init);
	  void addWriteState();
	  
#ifdef SOFA_PML
	  virtual void pmlOpen(const char* filename, bool resetView=true);
	  virtual void lmlOpen(const char* filename);
	  PMLReader *pmlreader;
	  LMLReader *lmlreader;
#endif

	  DisplayFlagWidget *displayFlag;
	  WindowVisitor* windowTraceVisitor;
	  GraphVisitor* handleTraceVisitor;
	  SofaPluginManager* pluginManager;

};

} // namespace qt

} // namespace gui

} // namespace sofa

#endif // SOFA_GUI_VIEWER_REALGUI_H