viewerControl.cc 20.4 KB
Newer Older
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
/*===========================================================================*\
 *                                                                           *
 *                              OpenFlipper                                  *
 *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
 *                           www.openflipper.org                             *
 *                                                                           *
 *---------------------------------------------------------------------------*
 *  This file is part of OpenFlipper.                                        *
 *                                                                           *
 *  OpenFlipper is free software: you can redistribute it and/or modify      *
 *  it under the terms of the GNU Lesser General Public License as           *
 *  published by the Free Software Foundation, either version 3 of           *
 *  the License, or (at your option) any later version with the              *
 *  following exceptions:                                                    *
 *                                                                           *
 *  If other files instantiate templates or use macros                       *
 *  or inline functions from this file, or you compile this file and         *
 *  link it with other files to produce an executable, this file does        *
 *  not by itself cause the resulting executable to be covered by the        *
 *  GNU Lesser General Public License. This exception does not however       *
 *  invalidate any other reasons why the executable file might be            *
 *  covered by the GNU Lesser General Public License.                        *
 *                                                                           *
 *  OpenFlipper 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 Lesser General Public License for more details.                      *
 *                                                                           *
 *  You should have received a copy of the GNU LesserGeneral Public          *
 *  License along with OpenFlipper. If not,                                  *
 *  see <http://www.gnu.org/licenses/>.                                      *
 *                                                                           *
\*===========================================================================*/

/*===========================================================================*\
 *                                                                           *
 *   $Revision$                                                         *
 *   $Author$                                                      *
 *   $Date$                   *
 *                                                                           *
\*===========================================================================*/
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57



//=============================================================================
//
//  CLASS CoreWidget - IMPLEMENTATION
//
//=============================================================================


//== INCLUDES =================================================================

#include "CoreWidget.hh"

#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
58
#include <OpenFlipper/widgets/snapshotDialog/SnapshotDialog.hh>
59
60
61
62
63
64
65
66
67
68
69
70


//== IMPLEMENTATION ==========================================================

//=============================================================================

void CoreWidget::slotToggleStereoMode()
{
  stereoActive_ = !stereoActive_;

  if ( stereoActive_ ) {
    statusBar_->showMessage("Stereo enabled");
Dirk Wilden's avatar
Dirk Wilden committed
71
    stereoButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"stereo.png") );
72
73
  } else {
    statusBar_->showMessage("Stereo disabled");
Dirk Wilden's avatar
Dirk Wilden committed
74
    stereoButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"mono.png") );
75
76
77
78
79
80
  }

  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
    examiner_widgets_[i]->setStereoMode(stereoActive_);
}

Jan Möbius's avatar
Jan Möbius committed
81
82
83
84
85
86
87
void CoreWidget::slotSetGlobalBackgroundColor() {
  ACG::Vec4f bc = PluginFunctions::viewerProperties().backgroundColor() * 255.0;

  QColor backCol((int)bc[0], (int)bc[1], (int)bc[2], (int)bc[3]);
  QColor c = QColorDialog::getColor(backCol,this);

  if (c != backCol && c.isValid())
88
    for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i )
Jan Möbius's avatar
Jan Möbius committed
89
90
91
92
93
94
95
96
97
      PluginFunctions::viewerProperties(i).backgroundColor(ACG::Vec4f(((double) c.redF())   ,
                                                                      ((double) c.greenF()) ,
                                                                      ((double) c.blueF())  ,
                                                                        1.0));

  OpenFlipper::Options::defaultBackgroundColor( c );

}

98
void CoreWidget::slotSetContextBackgroundColor() {
Jan Möbius's avatar
Jan Möbius committed
99
100
101
102
103
104
105
106
107
108
109
110
111
  ACG::Vec4f bc = PluginFunctions::viewerProperties().backgroundColor() * 255.0;

  QColor backCol((int)bc[0], (int)bc[1], (int)bc[2], (int)bc[3]);
  QColor c = QColorDialog::getColor(backCol,this);

  if (c != backCol && c.isValid())
    PluginFunctions::viewerProperties().backgroundColor(ACG::Vec4f(((double) c.redF())   ,
                                                                    ((double) c.greenF()) ,
                                                                    ((double) c.blueF())  ,
                                                                     1.0));
}


112
113
114
115
116
/// Set the viewer to home position
void CoreWidget::slotContextHomeView() {
  examiner_widgets_[PluginFunctions::activeExaminer()]->home();
}

117
118
/// Show / hide wheels in examiner windows
void CoreWidget::slotSwitchWheels(bool _state) {
119
  std::vector< glViewer* >::iterator it = examiner_widgets_.begin();
120

121
122
  for(; it != examiner_widgets_.end(); it++) 
    _state ? (*it)->slotShowWheels() : (*it)->slotHideWheels();
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

/// Set the viewer to home position
void CoreWidget::slotGlobalHomeView() {
  for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
    examiner_widgets_[i]->home();
}

/// Set the viewers home position
void CoreWidget::slotContextSetHomeView() {
  examiner_widgets_[PluginFunctions::activeExaminer()]->setHome();
}


/// Set the home position for all viewers
void CoreWidget::slotGlobalSetHomeView() {
  for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
    examiner_widgets_[i]->setHome();
}

/// Change view on active viewer to view complete scene
void CoreWidget::slotContextViewAll() {
  examiner_widgets_[PluginFunctions::activeExaminer()]->viewAll();
}


/// Change view on all viewers to view complete scene
void CoreWidget::slotGlobalViewAll() {
  for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
    examiner_widgets_[i]->viewAll();
}

/// Toggle projection Mode of the active viewer
void CoreWidget::slotContextSwitchProjection() {
  examiner_widgets_[PluginFunctions::activeExaminer()]->toggleProjectionMode();
}

/// Toggle projection Mode of all viewers to perspective projection
void CoreWidget::slotGlobalPerspectiveProjection() {
  for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
    examiner_widgets_[i]->perspectiveProjection();
}

/// Toggle projection Mode of all viewers to orthogonal projection
void CoreWidget::slotGlobalOrthographicProjection() {
  for ( int i = 0 ; i < PluginFunctions::viewers() ; ++i )
    examiner_widgets_[i]->orthographicProjection();
}

/// Set the animation Mode for all viewers
void CoreWidget::slotGlobalChangeAnimation(bool _animation){
  for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
    PluginFunctions::viewerProperties(i).animation(_animation);
}

/// Set the animation Mode for active viewer
void CoreWidget::slotLocalChangeAnimation(bool _animation){
  PluginFunctions::viewerProperties().animation(_animation);
}

/// Set Backface culling for all viewers
void CoreWidget::slotGlobalChangeBackFaceCulling(bool _backFaceCulling){
  for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
    PluginFunctions::viewerProperties(i).backFaceCulling(_backFaceCulling);
187
188
  
  std::cerr << " Backface Culling " << std::endl;
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208

}

/// Set Backface culling for active viewer
void CoreWidget::slotLocalChangeBackFaceCulling(bool _backFaceCulling){
  PluginFunctions::viewerProperties().backFaceCulling(_backFaceCulling);
}


/// Set two sided lighting for all viewers
void CoreWidget::slotGlobalChangeTwoSidedLighting(bool _lighting) {
  for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
    PluginFunctions::viewerProperties(i).twoSidedLighting(_lighting);
}

/// Set two sided lighting for active viewer
void CoreWidget::slotLocalChangeTwoSidedLighting(bool _lighting) {
  PluginFunctions::viewerProperties().twoSidedLighting(_lighting);
}

209
210
211
212
213
214
215
216
217
218
219
/// Set Multisampling for all viewers
void CoreWidget::slotGlobalChangeMultisampling(bool _multisampling) {
  for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
    PluginFunctions::viewerProperties(i).multisampling( _multisampling );
}

/// Set Multisampling for active viewer
void CoreWidget::slotLocalChangeMultisampling(bool _multisampling) {
  PluginFunctions::viewerProperties().multisampling( _multisampling );
}

Dirk Wilden's avatar
Dirk Wilden committed
220
/// Take a snapshot of the current Viewer
221
void CoreWidget::slotSnapshot() {
Dirk Wilden's avatar
Dirk Wilden committed
222
223
224
225

  QFileInfo fi(PluginFunctions::viewerProperties().snapshotName());
  int counter = PluginFunctions::viewerProperties().snapshotCounter();

Jan Möbius's avatar
Jan Möbius committed
226
227
228
229
230
231
    // Add leading zeros
  QString number = QString::number(counter);
  while ( number.size() < 7 )
    number = "0" + number;

  QString suggest = fi.baseName() + "." + number + ".";
Dirk Wilden's avatar
Dirk Wilden committed
232
233
234
235
236
237

  QString format="png";

  if (fi.completeSuffix() == "ppm")
    format="ppmraw";

Jan Möbius's avatar
Jan Möbius committed
238
239
240
  if (fi.completeSuffix() == "jpg")
    format="jpg";

Dirk Wilden's avatar
Dirk Wilden committed
241
242
  suggest += format;

Dirk Wilden's avatar
Dirk Wilden committed
243
244
245
  QFileDialog dialog(this);
  dialog.setFileMode(QFileDialog::AnyFile);
  dialog.setDefaultSuffix("png");
Jan Möbius's avatar
Jan Möbius committed
246
  dialog.setNameFilter("Images (*.png *.ppm *.jpg)");
Dirk Wilden's avatar
Dirk Wilden committed
247
248
249
250
251
252
  dialog.setFileMode(QFileDialog::AnyFile);
  dialog.setConfirmOverwrite(true);
  dialog.setDirectory( fi.path() );
  dialog.selectFile( suggest );
  dialog.setAcceptMode(QFileDialog::AcceptSave);
  dialog.setWindowTitle("Save Snapshot");
Dirk Wilden's avatar
Dirk Wilden committed
253

Dirk Wilden's avatar
Dirk Wilden committed
254
255
256
257
258
 if (dialog.exec()){
     QString newName = dialog.selectedFiles()[0];

      if (newName != fi.path() + OpenFlipper::Options::dirSeparator() + suggest)
        PluginFunctions::viewerProperties().snapshotBaseFileName(newName);
Dirk Wilden's avatar
Dirk Wilden committed
259

Dirk Wilden's avatar
Dirk Wilden committed
260
261
      QImage image;
      examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(image);
Dirk Wilden's avatar
Dirk Wilden committed
262

Dirk Wilden's avatar
Dirk Wilden committed
263
      image.save(newName);
Dirk Wilden's avatar
Dirk Wilden committed
264
265
266
267
268
269
270
271
  }
}

///Take a snapshot of the whole application
void CoreWidget::applicationSnapshotDialog() {

  QFileInfo fi(snapshotName_);

Jan Möbius's avatar
Jan Möbius committed
272
273
274
275
276
277
  // Add leading zeros
  QString number = QString::number(snapshotCounter_);
  while ( number.size() < 7 )
    number = "0" + number;

  QString suggest = fi.baseName() + "." + number + ".";
Dirk Wilden's avatar
Dirk Wilden committed
278
279
280
281
282
283

  QString format="png";

  if (fi.completeSuffix() == "ppm")
    format="ppmraw";

Jan Möbius's avatar
Jan Möbius committed
284
285
286
  if (fi.completeSuffix() == "jpg")
    format="jpg";

Dirk Wilden's avatar
Dirk Wilden committed
287
288
  suggest += format;

Dirk Wilden's avatar
Dirk Wilden committed
289

290
  SnapshotDialog dialog(suggest, false, 0);
291

292
293
294
295
296
297
  int w = width();
  int h = height();

  connect(&dialog, SIGNAL(resizeApplication(int,int)), this, SIGNAL(resizeApplication(int,int)) );

  bool ok = dialog.exec();
298
299

  if ( ok ){
300
    QString newName = dialog.filename->text();
Dirk Wilden's avatar
Dirk Wilden committed
301
302

    if (newName != fi.path() + OpenFlipper::Options::dirSeparator() + suggest){
Dirk Wilden's avatar
Dirk Wilden committed
303
304
305
306
307
308
309
310
311
312
313
      snapshotName_ = newName;
      snapshotCounter_ = 0;
    }else
      snapshotCounter_++;

    QApplication::processEvents();

    QPixmap pic = QPixmap::grabWindow( winId() );

    pic.save(newName);
  }
314
315

  emit resizeApplication(w,h);
Dirk Wilden's avatar
Dirk Wilden committed
316
317
318
319
320
321
322
}

///Take a snapshot of the whole application
void CoreWidget::applicationSnapshot() {

  QFileInfo fi(snapshotName_);

Jan Möbius's avatar
Jan Möbius committed
323
324
325
326
327
328
  // Add leading zeros
  QString number = QString::number(snapshotCounter_++);
  while ( number.size() < 7 )
    number = "0" + number;

  QString suggest = fi.path() + QDir::separator() +fi.baseName() + "." + number + ".";
Dirk Wilden's avatar
Dirk Wilden committed
329
330
331
332
333
334

  QString format="png";

  if (fi.completeSuffix() == "ppm")
    format="ppmraw";

335
336
337
  if (fi.completeSuffix() == "jpg")
    format="jpg";

Dirk Wilden's avatar
Dirk Wilden committed
338
339
340
341
342
343
344
  suggest += format;

  QApplication::processEvents();

  QPixmap pic = QPixmap::grabWindow( winId() );

  pic.save(suggest);
345
346
}

Dirk Wilden's avatar
Dirk Wilden committed
347
348
349
350
351
352

///Take a snapshot of all viewers
void CoreWidget::viewerSnapshotDialog() {

  QFileInfo fi(snapshotName_);

Jan Möbius's avatar
Jan Möbius committed
353
354
355
356
357
358
  // Add leading zeros
  QString number = QString::number(snapshotCounter_);
  while ( number.size() < 7 )
    number = "0" + number;

  QString suggest = fi.baseName() + "." + number + ".";
Dirk Wilden's avatar
Dirk Wilden committed
359
360
361
362
363
364

  QString format="png";

  if (fi.completeSuffix() == "ppm")
    format="ppmraw";

Jan Möbius's avatar
Jan Möbius committed
365
366
367
  if (fi.completeSuffix() == "jpg")
    format="jpg";

Dirk Wilden's avatar
Dirk Wilden committed
368
369
  suggest += format;

370
  SnapshotDialog dialog(suggest, true, 0);
Dirk Wilden's avatar
Dirk Wilden committed
371

372
373
374
375
376
377
378
379
380
  int w = glView_->width();
  int h = glView_->height();

  connect(&dialog, SIGNAL(resizeViewers(int,int)), this, SIGNAL(resizeViewers(int,int)) );

  bool ok = dialog.exec();

  if (ok){
    QString newName = dialog.filename->text();
Dirk Wilden's avatar
Dirk Wilden committed
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409

    if (newName != fi.path() + OpenFlipper::Options::dirSeparator() + suggest){
      snapshotName_ = newName;
      snapshotCounter_ = 0;
    }else
      snapshotCounter_++;

    //now take the snapshot
    switch ( baseLayout_->mode() ){

      case QtMultiViewLayout::SingleView:
      {
        QImage finalImage;

        examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage);

        finalImage.save(newName);

        break;
      }
      case QtMultiViewLayout::Grid:
      {
        QImage img0,img1,img2,img3;

        examiner_widgets_[0]->snapshot(img0);
        examiner_widgets_[1]->snapshot(img1);
        examiner_widgets_[2]->snapshot(img2);
        examiner_widgets_[3]->snapshot(img3);

410
        QImage finalImage(img0.width() + img1.width()+2, img0.height() + img2.height()+2, QImage::Format_ARGB32_Premultiplied);
Dirk Wilden's avatar
Dirk Wilden committed
411
412

        QPainter painter(&finalImage);
413
414
415

        painter.fillRect(0,0,finalImage.width(), finalImage.height(), QBrush(Qt::gray));

Dirk Wilden's avatar
Dirk Wilden committed
416
417
        painter.drawImage(QRectF(           0,             0, img0.width(), img0.height()),img0,
                          QRectF(           0,             0, img0.width(), img0.height()) );
418
        painter.drawImage(QRectF(img0.width()+2,           0, img1.width(), img1.height()),img1,
Dirk Wilden's avatar
Dirk Wilden committed
419
                          QRectF(           0,             0, img1.width(), img1.height()) );
420
        painter.drawImage(QRectF(          0,img0.height()+2, img2.width(), img2.height()),img2,
Dirk Wilden's avatar
Dirk Wilden committed
421
                          QRectF(           0,             0, img2.width(), img2.height()) );
422
        painter.drawImage(QRectF(img0.width()+2, img0.height()+2, img3.width(), img3.height()),img3,
Dirk Wilden's avatar
Dirk Wilden committed
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
                          QRectF(           0,             0, img3.width(), img3.height()) );

        finalImage.save(newName);

        break;
      }
      case QtMultiViewLayout::HSplit:
      {
        QImage img0,img1,img2,img3;

        examiner_widgets_[0]->snapshot(img0);
        examiner_widgets_[1]->snapshot(img1);
        examiner_widgets_[2]->snapshot(img2);
        examiner_widgets_[3]->snapshot(img3);

438
        QImage finalImage(img0.width() + img1.width() +2, img0.height(), QImage::Format_ARGB32_Premultiplied);
Dirk Wilden's avatar
Dirk Wilden committed
439
440

        QPainter painter(&finalImage);
441
442
443

        painter.fillRect(0,0,finalImage.width(), finalImage.height(), QBrush(Qt::gray));

Dirk Wilden's avatar
Dirk Wilden committed
444
445
        painter.drawImage(QRectF(           0,             0, img0.width(), img0.height()),img0,
                          QRectF(           0,             0, img0.width(), img0.height()) );
446
        painter.drawImage(QRectF(img0.width()+2,             0, img1.width(), img1.height()),img1,
Dirk Wilden's avatar
Dirk Wilden committed
447
                          QRectF(           0,             0, img1.width(), img1.height()) );
448
        painter.drawImage(QRectF(img0.width()+2, img1.height()+2, img2.width(), img2.height()),img2,
Dirk Wilden's avatar
Dirk Wilden committed
449
                          QRectF(           0,             0, img2.width(), img2.height()) );
450
        painter.drawImage(QRectF(img0.width()+2, img1.height()+img2.height()+4, img3.width(),img3.height()),img3,
Dirk Wilden's avatar
Dirk Wilden committed
451
452
453
454
455
456
457
458
459
460
                          QRectF(           0,             0, img3.width(), img3.height()) );

        finalImage.save(newName);

        break;
      }
      default: break;

    }
  }
461
  glView_->resize(w, h);
Dirk Wilden's avatar
Dirk Wilden committed
462
463
}

Dirk Wilden's avatar
Dirk Wilden committed
464
///Take a snapshot of all viewers
Dirk Wilden's avatar
Dirk Wilden committed
465
466
467
468
void CoreWidget::viewerSnapshot() {

  QFileInfo fi(snapshotName_);

Jan Möbius's avatar
Jan Möbius committed
469
470
471
472
473
474
  // Add leading zeros
  QString number = QString::number(snapshotCounter_++);
  while ( number.size() < 7 )
    number = "0" + number;

  QString suggest = fi.path() + QDir::separator() +fi.baseName() + "." + number + ".";
Dirk Wilden's avatar
Dirk Wilden committed
475
476
477
478
479
480

  QString format="png";

  if (fi.completeSuffix() == "ppm")
    format="ppmraw";

Jan Möbius's avatar
Jan Möbius committed
481
482
483
  if (fi.completeSuffix() == "jpg")
    format="jpg";

Dirk Wilden's avatar
Dirk Wilden committed
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
  suggest += format;


  switch ( baseLayout_->mode() ){

    case QtMultiViewLayout::SingleView:
    {
      QImage finalImage;

      examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage);

      finalImage.save(suggest);

      break;
    }
    case QtMultiViewLayout::Grid:
    {
Dirk Wilden's avatar
Dirk Wilden committed
501
502
503
504
505
506
507
      QImage img0,img1,img2,img3;

      examiner_widgets_[0]->snapshot(img0);
      examiner_widgets_[1]->snapshot(img1);
      examiner_widgets_[2]->snapshot(img2);
      examiner_widgets_[3]->snapshot(img3);

508
      QImage finalImage(img0.width() + img1.width() + 2, img0.height() + img2.height() + 2, QImage::Format_ARGB32_Premultiplied);
Dirk Wilden's avatar
Dirk Wilden committed
509
510

      QPainter painter(&finalImage);
511
512
513

      painter.fillRect(0,0,finalImage.width(), finalImage.height(), QBrush(Qt::gray));

Dirk Wilden's avatar
Dirk Wilden committed
514
515
      painter.drawImage(QRectF(           0,             0, img0.width(), img0.height()),img0,
                        QRectF(           0,             0, img0.width(), img0.height()) );
516
      painter.drawImage(QRectF(img0.width()+2,           0, img1.width(), img1.height()),img1,
Dirk Wilden's avatar
Dirk Wilden committed
517
                        QRectF(           0,             0, img1.width(), img1.height()) );
518
      painter.drawImage(QRectF(           0, img0.height()+2, img2.width(), img2.height()),img2,
Dirk Wilden's avatar
Dirk Wilden committed
519
                        QRectF(           0,             0, img2.width(), img2.height()) );
520
      painter.drawImage(QRectF(img0.width()+2, img0.height()+2, img3.width(), img3.height()),img3,
Dirk Wilden's avatar
Dirk Wilden committed
521
522
523
                        QRectF(           0,             0, img3.width(), img3.height()) );

      finalImage.save(suggest);
Dirk Wilden's avatar
Dirk Wilden committed
524
525
526
527
528
529
530
531
532
533
534
535

      break;
    }
    case QtMultiViewLayout::HSplit:
    {
      QImage img0,img1,img2,img3;

      examiner_widgets_[0]->snapshot(img0);
      examiner_widgets_[1]->snapshot(img1);
      examiner_widgets_[2]->snapshot(img2);
      examiner_widgets_[3]->snapshot(img3);

536
      QImage finalImage(img0.width() + img1.width() + 2, img0.height(), QImage::Format_ARGB32_Premultiplied);
Dirk Wilden's avatar
Dirk Wilden committed
537

Dirk Wilden's avatar
Dirk Wilden committed
538
      QPainter painter(&finalImage);
539
540
541

      painter.fillRect(0,0,finalImage.width(), finalImage.height(), QBrush(Qt::gray));

Dirk Wilden's avatar
Dirk Wilden committed
542
543
      painter.drawImage(QRectF(           0,             0, img0.width(), img0.height()),img0,
                        QRectF(           0,             0, img0.width(), img0.height()) );
544
      painter.drawImage(QRectF(img0.width()+2,             0, img1.width(), img1.height()),img1,
Dirk Wilden's avatar
Dirk Wilden committed
545
                        QRectF(           0,             0, img1.width(), img1.height()) );
546
      painter.drawImage(QRectF(img0.width()+2, img1.height()+2, img2.width(), img2.height()),img2,
Dirk Wilden's avatar
Dirk Wilden committed
547
                        QRectF(           0,             0, img2.width(), img2.height()) );
548
      painter.drawImage(QRectF(img0.width()+2, img1.height()+img2.height()+4, img3.width(),img3.height()),img3,
Dirk Wilden's avatar
Dirk Wilden committed
549
                        QRectF(           0,             0, img3.width(), img3.height()) );
Dirk Wilden's avatar
Dirk Wilden committed
550
551
552
553
554
555
556
557
558

      finalImage.save(suggest);

      break;
    }
    default: break;

  }
}
Dirk Wilden's avatar
Dirk Wilden committed
559
560
561
562
563
564
565
566

void CoreWidget::applicationSnapshotName(QString _name) {

  snapshotName_ = _name;
  snapshotCounter_ = 0;
}


567
568
569
570
571
572
573
574
void CoreWidget::slotPasteView( ) {
  examiner_widgets_[PluginFunctions::activeExaminer()]->actionPasteView();
}

void CoreWidget::slotCopyView( ) {
  examiner_widgets_[PluginFunctions::activeExaminer()]->actionCopyView();
}

Dirk Wilden's avatar
Dirk Wilden committed
575
void CoreWidget::slotCoordSysVisibility(bool _visible){
576

Dirk Wilden's avatar
Dirk Wilden committed
577
578
579
580
581
582
583
584
  ACG::SceneGraph::BaseNode* root = PluginFunctions::getSceneGraphRootNode();
  ACG::SceneGraph::BaseNode* coordSys = root->find("Core Coordsys Node");

  if (coordSys == 0){
    std::cerr << "CoordSys Node not found!" << std::endl;
    return;
  }

585
if (_visible) 
Dirk Wilden's avatar
Dirk Wilden committed
586
    coordSys->show();
587
  else 
Dirk Wilden's avatar
Dirk Wilden committed
588
    coordSys->hide();
589
590
591
592
  
  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
    examiner_widgets_[i]->updateGL();
  
Dirk Wilden's avatar
Dirk Wilden committed
593
}
Jan Möbius's avatar
Jan Möbius committed
594

595
596
597
598
void CoreWidget::slotSetViewingDirection(QAction* _action) {

  PluginFunctions::setFixedView( _action->data().toInt() );
}
599

600
//=============================================================================