Salome HOME
Merge from V6_main (04/10/2012)
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_SubShapeSelectorWdg.cxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File   : StdMeshersGUI_SubShapeSelectorWdg.cxx
21 // Author : Open CASCADE S.A.S. (dmv)
22 // SMESH includes
23 //
24 #include "StdMeshersGUI_SubShapeSelectorWdg.h"
25
26 // SMESH Includes
27 #include "SMESH_Type.h"
28 #include "SMESHGUI_MeshUtils.h"
29 #include "SMESH_Actor.h"
30 #include "SMESH_PreviewActorsCollection.h"
31 #include "SMESH_ActorUtils.h"
32 #include "SMESHGUI_GroupUtils.h"
33 #include "SMESH_Gen_i.hxx"
34 #include "SMESHGUI_GEOMGenUtils.h"
35 #include "SMESH_LogicalFilter.hxx"
36
37 // SVTK Includes
38 #include <SVTK_ViewWindow.h>
39 #include <SVTK_ViewModel.h>
40 #include <SVTK_ViewWindow.h>
41 #include <SVTK_Selector.h>
42
43 // SALOME GUI includes
44 #include <SALOME_ListIO.hxx>
45 #include <LightApp_SelectionMgr.h>
46 #include <SALOME_ListIteratorOfListIO.hxx>
47
48 // SUIT Includes
49 #include <SUIT_ResourceMgr.h>
50
51 // GEOM Includes
52 #include <GEOMBase.h>
53 #include <GEOM_TypeFilter.h>
54 #include <GEOM_CompoundFilter.h>
55
56 // Qt includes
57 #include <QPushButton>
58 #include <QGridLayout>
59 #include <QListWidget>
60 #include <QCheckBox>
61 #include <QLineEdit>
62
63 // OCCT includes
64 #include <TColStd_MapOfInteger.hxx>
65 #include <TColStd_IndexedMapOfInteger.hxx>
66 #include <TopoDS_Shape.hxx>
67 #include <TopExp.hxx>
68 #include <TopExp_Explorer.hxx>
69 #include <StdSelect_TypeOfEdge.hxx>
70
71 // SALOME KERNEL includes
72 #include <SALOMEDS_SObject.hxx>
73
74
75 #define SPACING 6
76 #define MARGIN 0
77
78 //================================================================================
79 /*!
80  *  Constructor
81  */
82 //================================================================================
83
84 StdMeshersGUI_SubShapeSelectorWdg
85 ::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent, TopAbs_ShapeEnum aSubShType ): 
86   QWidget( parent ),
87   myPreviewActor( 0 ),
88   myMaxSize( -1 )
89 {
90   QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
91
92   QGridLayout* edgesLayout = new QGridLayout( this );
93   edgesLayout->setMargin( MARGIN );
94   edgesLayout->setSpacing( SPACING );
95   
96   myListWidget   = new QListWidget( this );
97   myAddButton    = new QPushButton( tr( "SMESH_BUT_ADD" ),    this );
98   myRemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), this );      
99   myInfoLabel    = new QLabel( this );
100   myPrevButton   = new QPushButton( "<<", this );
101   myNextButton   = new QPushButton( ">>", this );
102   myListWidget->setSelectionMode( QListWidget::ExtendedSelection );
103
104   edgesLayout->addWidget(myListWidget,   0, 0, 3, 3);
105   edgesLayout->addWidget(myAddButton,    0, 3);
106   edgesLayout->addWidget(myRemoveButton, 1, 3);
107   edgesLayout->addWidget(myInfoLabel,    3, 0, 1, 3);
108   edgesLayout->addWidget(myPrevButton,   4, 0);
109   edgesLayout->addWidget(myNextButton,   4, 2);
110
111   edgesLayout->setRowStretch(2, 5);
112   edgesLayout->setColumnStretch(1, 5);
113
114   myListWidget->setMinimumWidth(300);
115   myInfoLabel->setMinimumWidth(300);
116   myInfoLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
117   myInfoLabel->setAlignment(Qt::AlignCenter);
118
119   mySubShType = aSubShType;
120
121   init();
122 }
123
124 //================================================================================
125 /*!
126  *  Destructor
127  */
128 //================================================================================
129
130 StdMeshersGUI_SubShapeSelectorWdg::~StdMeshersGUI_SubShapeSelectorWdg()
131 {
132   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
133     if ( myPreviewActor ) {
134       myPreviewActor->RemoveFromRender( myRenderer );
135       aViewWindow->Repaint();
136
137       delete myPreviewActor;
138       myPreviewActor = 0;
139     }
140   }
141   myEntry = "";
142   myParamValue = "";
143   myMainShape.Nullify();
144
145   if ( mySelectionMgr && myFilter )
146     mySelectionMgr->removeFilter( myFilter );
147   delete myFilter; myFilter=0;
148
149   SUIT_SelectionFilter* filter;
150   foreach( filter, myGeomFilters )
151     delete filter;
152 }
153
154 //================================================================================
155 /*!
156  *  Create a layout, initialize fields
157  */
158 //================================================================================
159
160 void StdMeshersGUI_SubShapeSelectorWdg::init()
161 {
162   myParamValue = "";
163   myIsNotCorrected = true; // to dont call the GetCorrectedValue method twice
164   myListOfIDs.clear();
165   mySelectedIDs.clear();
166
167   myAddButton->setEnabled( false );
168   myRemoveButton->setEnabled( false );
169
170   mySMESHGUI     = SMESHGUI::GetSMESHGUI();
171   mySelectionMgr = SMESH::GetSelectionMgr( mySMESHGUI );
172   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
173
174   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
175     aViewWindow->SetSelectionMode( ActorSelection );
176
177   myFilter=0;
178   //setFilter();
179
180   connect( myAddButton,    SIGNAL(clicked()), SLOT(onAdd()));
181   connect( myRemoveButton, SIGNAL(clicked()), SLOT(onRemove()));
182   connect( myPrevButton,   SIGNAL(clicked()), SLOT(onPrevious()));
183   connect( myNextButton,   SIGNAL(clicked()), SLOT(onNext()));
184   
185   connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
186   connect( myListWidget,   SIGNAL(itemSelectionChanged()),    this, SLOT(onListSelectionChanged()));
187
188   updateState();
189 }
190
191 //================================================================================
192 /*!
193  * \brief Install filters to select sub-shapes of mySubShType or their groups
194  */
195 //================================================================================
196
197 void StdMeshersGUI_SubShapeSelectorWdg::setFilter()
198 {
199   SalomeApp_Study* study = mySMESHGUI->activeStudy();
200   GEOM_TypeFilter* typeFilter = new GEOM_TypeFilter(study, mySubShType, /*isShapeType=*/true );
201   GEOM_CompoundFilter* gpoupFilter = new GEOM_CompoundFilter(study);
202   gpoupFilter->addSubType( mySubShType );
203   myGeomFilters.append( typeFilter );
204   myGeomFilters.append( gpoupFilter );
205   myFilter = new SMESH_LogicalFilter( myGeomFilters, SMESH_LogicalFilter::LO_OR );
206   mySelectionMgr->installFilter( myFilter );
207 }
208
209 //================================================================================
210 /*!
211  *  Create a layout, initialize fields
212  */
213 //================================================================================
214
215 void StdMeshersGUI_SubShapeSelectorWdg::showPreview( bool visible)
216 {
217   if ( !myPreviewActor )
218     return;
219
220   if ( myIsShown != visible ) {
221     myPreviewActor->SetShown( visible );
222     
223     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
224       aViewWindow->Repaint();
225
226     myIsShown = visible;
227   }
228 }
229
230 //=================================================================================
231 // function : SelectionIntoArgument()
232 // purpose  : Called when selection as changed or other case
233 //=================================================================================
234 void StdMeshersGUI_SubShapeSelectorWdg::SelectionIntoArgument()
235 {
236   if ( !myPreviewActor )
237     return;
238
239   mySelectedIDs.clear();
240
241   // get selected mesh
242   SALOME_ListIO aList;
243   mySelectionMgr->selectedObjects( aList );
244   int nbSel = aList.Extent();
245
246   if (nbSel > 0) {
247     SALOME_ListIteratorOfListIO anIt (aList);
248     
249     for ( ; anIt.More(); anIt.Next()) { // Loop on selected objects
250       Handle(SALOME_InteractiveObject) IO = anIt.Value();
251       
252       GEOM::GEOM_Object_var aGeomObj = GetGeomObjectByEntry( IO->getEntry() );
253       if ( !CORBA::is_nil( aGeomObj ) ) { // Selected Object From Study
254         GEOM::GEOM_Object_ptr aGeomFatherObj = aGeomObj->GetMainShape();
255         QString aFatherEntry = "";
256         QString aMainFatherEntry = "";
257         TopoDS_Shape shape;
258         if ( !CORBA::is_nil( aGeomFatherObj ) ) {
259           // Get Main Shape
260           GEOM::GEOM_Object_var aGeomMain = GetGeomObjectByEntry( myEntry );
261           if ( !CORBA::is_nil( aGeomMain ) && aGeomMain->GetType() == 37 ) {  // Main Shape is a Group
262             GEOM::GEOM_Object_ptr aMainFatherObj = aGeomMain->GetMainShape();
263             if ( !CORBA::is_nil( aMainFatherObj ) )
264               aMainFatherEntry = aMainFatherObj->GetStudyEntry();
265           }
266           aFatherEntry = aGeomFatherObj->GetStudyEntry();
267         }
268         
269         if ( aFatherEntry != "" && ( aFatherEntry == myEntry || aFatherEntry == aMainFatherEntry ) )
270         {
271           if ( aGeomObj->GetType() == 37 /*GEOM_GROUP*/ ) { // Selected Group that belongs the main object
272             GEOMBase::GetShape(aGeomObj, shape); 
273             if ( !shape.IsNull() ) {
274               TopExp_Explorer exp( shape, mySubShType );
275               for ( ; exp.More(); exp.Next() ) {
276                 int index = myPreviewActor->GetIndexByShape( exp.Current() );
277                 if ( index ) {
278                   mySelectedIDs.append( index );
279                   myPreviewActor->HighlightID( index );
280                 }
281               }
282             }
283           } else if ( aGeomObj->GetType() == 28 /*GEOM_SUBSHAPE*/  ) {
284             GEOMBase::GetShape(aGeomObj, shape); 
285             if ( !shape.IsNull() && shape.ShapeType() == mySubShType ) {
286               int index = myPreviewActor->GetIndexByShape( shape );
287               if ( index ) {
288                 mySelectedIDs.append( index );
289                 myPreviewActor->HighlightID( index );
290               }
291             }
292           }
293         }
294       } else { // Selected Actor from Actor Collection
295         QString anEntry = IO->getEntry();
296         QString str = "_";
297         int index = anEntry.lastIndexOf( str );
298         anEntry.remove(0, index+1);
299         int ind = anEntry.toInt();
300         if ( ind )
301           mySelectedIDs.append( ind );
302       }
303     }
304   }
305   // update add button
306   myAddButton->setEnabled( ( myListWidget->count() < myMaxSize || myMaxSize == -1 ) &&
307                            mySelectedIDs.size() > 0 &&
308                            ( mySelectedIDs.size() <= myMaxSize || myMaxSize == -1 ) );
309
310   //Connect Selected Ids in viewer and dialog's Ids list
311   bool signalsBlocked = myListWidget->blockSignals( true );
312   myListWidget->clearSelection();
313   if ( mySelectedIDs.size() > 0 ) {
314     for (int i = 0; i < mySelectedIDs.size(); i++) {
315       QString anID = QString(" %1").arg( mySelectedIDs.at(i) );
316       QList<QListWidgetItem*> anItems = myListWidget->findItems ( anID, Qt::MatchExactly );
317       QListWidgetItem* item;
318       foreach(item, anItems)
319         item->setSelected(true);
320     }
321   }
322   myListWidget->blockSignals( signalsBlocked );
323 }
324
325 //=================================================================================
326 // function : onAdd()
327 // purpose  : Called when Add Button Clicked
328 //=================================================================================
329 void StdMeshersGUI_SubShapeSelectorWdg::onAdd()
330 {
331   if ( mySelectedIDs.size() < 1 )
332     return;
333
334   myListWidget->blockSignals( true );
335   for (int i = 0; i < mySelectedIDs.size() && (myMaxSize == -1 || myListOfIDs.size() < myMaxSize); i++) {
336     if ( myListOfIDs.indexOf( mySelectedIDs.at(i) ) == -1 ) {
337       QString anID = QString(" %1").arg( mySelectedIDs.at(i) );
338
339       QListWidgetItem* anItem = new QListWidgetItem( anID, myListWidget );
340       anItem->setSelected(true);
341       
342       myListOfIDs.append( mySelectedIDs.at(i) );
343     }
344   }
345   onListSelectionChanged();
346   myListWidget->blockSignals( false );
347   myAddButton->setEnabled( myMaxSize == -1 || myListOfIDs.size() < myMaxSize );
348 }
349          
350 //=================================================================================
351 // function : onRemove()
352 // purpose  : Called when Remove Button Clicked
353 //=================================================================================
354 void StdMeshersGUI_SubShapeSelectorWdg::onRemove()
355 {
356   if ( myListWidget->count() < 1 )
357     return;
358
359   myListWidget->blockSignals( true );
360   QList<QListWidgetItem*> selItems = myListWidget->selectedItems();
361   QListWidgetItem* item;
362   foreach(item, selItems) {
363     QString idStr = item->text();
364     int id = idStr.toInt();
365
366     int index = myListOfIDs.indexOf( id );
367     myListOfIDs.removeAt( index );
368     delete item;
369   }
370
371   onListSelectionChanged();
372   myListWidget->blockSignals( false );
373   
374   myAddButton->setEnabled( true );
375 }
376
377 void StdMeshersGUI_SubShapeSelectorWdg::onPrevious()
378 {
379   if ( myPreviewActor ) {
380     myPreviewActor->previous();
381     myListWidget->clearSelection();
382     updateButtons();
383     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
384       aViewWindow->Repaint();
385   }
386 }
387
388 void StdMeshersGUI_SubShapeSelectorWdg::onNext()
389 {
390   if ( myPreviewActor ) {
391     myPreviewActor->next();
392     myListWidget->clearSelection();
393     updateButtons();
394     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
395       aViewWindow->Repaint();
396   }
397 }
398
399 //=================================================================================
400 // function : onListSelectionChanged()
401 // purpose  : Called when selection in element list is changed
402 //=================================================================================
403 void StdMeshersGUI_SubShapeSelectorWdg::onListSelectionChanged()
404 {
405   if ( !myPreviewActor )
406     return;
407
408   mySelectionMgr->clearSelected();
409   TColStd_MapOfInteger aIndexes;
410   QList<QListWidgetItem*> selItems = myListWidget->selectedItems();
411   QListWidgetItem* anItem;
412   foreach(anItem, selItems)
413     myPreviewActor->HighlightID( anItem->text().toInt() );
414
415   // update remove button
416   myRemoveButton->setEnabled( selItems.size() > 0 );
417 }
418
419 //=================================================================================
420 // function : setGeomShape
421 // purpose  : Called to set geometry whose sub-shapes are selected
422 //================================================================================
423 void StdMeshersGUI_SubShapeSelectorWdg::SetGeomShapeEntry( const QString& theEntry )
424 {
425   if ( theEntry != "") {
426     myParamValue = theEntry;
427     myEntry = theEntry;
428     myGeomShape = GetTopoDSByEntry( theEntry );
429     updateState();
430     myIsNotCorrected = true;
431   }
432 }
433
434 //=================================================================================
435 // function : updateState
436 // purpose  : update Widget state
437 //=================================================================================
438 void StdMeshersGUI_SubShapeSelectorWdg::updateState()
439 {
440   bool state = false;
441   if ( !myGeomShape.IsNull() )
442     state = true;
443   myInfoLabel->setVisible( false );
444   myPrevButton->setVisible( false );
445   myNextButton->setVisible( false );
446   
447   myListWidget->setEnabled( state );
448   myAddButton->setEnabled( mySelectedIDs.size() > 0 );
449   
450   if (state) {
451     myPreviewActor = new SMESH_PreviewActorsCollection();
452     myPreviewActor->SetSelector( mySelector );
453     myPreviewActor->Init( myGeomShape, mySubShType, myEntry );
454     myPreviewActor->SetShown( false );
455     myIsShown = false;
456     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
457       myRenderer = aViewWindow->getRenderer();
458       myPreviewActor->AddToRender( myRenderer );
459       aViewWindow->Repaint();
460     }
461     updateButtons();
462   }
463 }
464
465 //=================================================================================
466 // function : GetGeomObjectByEntry
467 // purpose  : Called to get GeomObject
468 //=================================================================================
469 GEOM::GEOM_Object_var StdMeshersGUI_SubShapeSelectorWdg::GetGeomObjectByEntry( const QString& theEntry )
470 {
471   GEOM::GEOM_Object_var aGeomObj;
472   SALOMEDS::Study_var aStudy = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
473   if (aStudy != 0) {
474     SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( theEntry.toLatin1().data() );
475     SALOMEDS::GenericAttribute_var anAttr;
476
477     if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
478       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
479       CORBA::String_var aVal = anIOR->Value();
480       CORBA::Object_var obj = aStudy->ConvertIORToObject(aVal);
481       aGeomObj = GEOM::GEOM_Object::_narrow(obj);
482     }
483   }
484   return aGeomObj;
485 }
486
487 //=================================================================================
488 // function : setObjectByEntry
489 // purpose  : Called to get GeomObject
490 //=================================================================================
491 TopoDS_Shape StdMeshersGUI_SubShapeSelectorWdg::GetTopoDSByEntry( const QString& theEntry )
492 {
493   TopoDS_Shape shape;
494   GEOM::GEOM_Object_var aGeomObj = GetGeomObjectByEntry( theEntry );
495   GEOMBase::GetShape(aGeomObj, shape);
496   return shape;
497 }
498
499 //=================================================================================
500 // function : GetListOfIds
501 // purpose  : Called to get the list of SubShapes IDs
502 //=================================================================================
503 SMESH::long_array_var StdMeshersGUI_SubShapeSelectorWdg::GetListOfIDs()
504 {
505   SMESH::long_array_var anArray = new SMESH::long_array;
506
507   if ( myMainEntry != "" && myIsNotCorrected )
508     myListOfIDs = GetCorrectedListOfIDs( true );
509
510   int size = myListOfIDs.size();
511   anArray->length( size );
512   if ( size ) {
513     for (int i = 0; i < size; i++) {
514         anArray[i] = myListOfIDs.at(i);
515     }
516   }
517   return anArray;
518 }
519
520 //=================================================================================
521 // function : SetListOfIds
522 // purpose  : Called to set the list of SubShapes IDs
523 //=================================================================================
524 void StdMeshersGUI_SubShapeSelectorWdg::SetListOfIDs( SMESH::long_array_var theIds)
525 {
526   mySelectedIDs.clear();
527   myListOfIDs.clear();
528   int size = theIds->length();
529   for ( int i = 0; i < size; i++ )
530     mySelectedIDs.append( theIds[ i ] );
531
532   mySelectedIDs = GetCorrectedListOfIDs( false );
533   onAdd();
534 }
535
536 //=================================================================================
537 // function : SetMainShapeEntry
538 // purpose  : Called to set the Entry of main shape of the mesh
539 //=================================================================================
540 void StdMeshersGUI_SubShapeSelectorWdg::SetMainShapeEntry( const QString& theEntry )
541 {
542   myMainEntry = theEntry;
543   myMainShape = GetTopoDSByEntry( theEntry );
544   myIsNotCorrected = true;
545 }
546
547 //=================================================================================
548 // function : GetMainShapeEntry
549 // purpose  : Called to get the Main Object Entry
550 //=================================================================================
551 const char* StdMeshersGUI_SubShapeSelectorWdg::GetMainShapeEntry()
552 {
553   if ( myMainEntry == "")
554     return myEntry.toLatin1().data();
555
556   return myMainEntry.toLatin1().data();
557 }
558
559 //=================================================================================
560 // function : GetCorrectedListOfIds
561 // purpose  : Called to convert the list of IDs from sub-shape IDs to main shape IDs
562 //=================================================================================
563 QList<int> StdMeshersGUI_SubShapeSelectorWdg::GetCorrectedListOfIDs( bool fromSubshapeToMainshape )
564 {
565   if ( ( myMainShape.IsNull() || myGeomShape.IsNull() ) &&  fromSubshapeToMainshape )
566     return myListOfIDs;
567   else   if ( ( myMainShape.IsNull() || myGeomShape.IsNull() ) &&  !fromSubshapeToMainshape )
568     return mySelectedIDs;
569
570   QList<int> aList;
571   TopTools_IndexedMapOfShape   aGeomMap;
572   TopTools_IndexedMapOfShape   aMainMap;
573   TopExp::MapShapes(myGeomShape, aGeomMap);
574   TopExp::MapShapes(myMainShape, aMainMap);
575
576   if ( fromSubshapeToMainshape ) { // convert indexes from sub-shape to mainshape
577     int size = myListOfIDs.size();
578     for (int i = 0; i < size; i++) {
579       TopoDS_Shape aSubShape = aGeomMap.FindKey( myListOfIDs.at(i) );
580       int index = aMainMap.FindIndex( aSubShape );
581       aList.append( index );
582     }
583     myIsNotCorrected = false;
584   } else { // convert indexes from main shape to sub-shape
585     int size = mySelectedIDs.size();
586     for (int i = 0; i < size; i++) {
587       TopoDS_Shape aSubShape = aMainMap.FindKey( mySelectedIDs.at(i) );
588       int index = aGeomMap.FindIndex( aSubShape );
589       aList.append( index );
590     }
591   }
592
593   return aList;
594 }
595
596 void StdMeshersGUI_SubShapeSelectorWdg::updateButtons()
597 {
598   if ( myPreviewActor ) {
599     int total = myPreviewActor->count();
600     int chunk = myPreviewActor->currentChunk();
601     int chunkSize = myPreviewActor->chunkSize();
602     int imin = chunk*chunkSize+1;
603     int imax = std::min((chunk+1)*chunkSize, total);
604     bool vis = imax > 0 && total > chunkSize;
605     myInfoLabel->setVisible( vis );
606     myPrevButton->setVisible( vis );
607     myNextButton->setVisible( vis );
608     myInfoLabel->setText( tr( "X_FROM_Y_ITEMS_SHOWN" ).arg(imin).arg(imax).arg(total) );
609     myPrevButton->setEnabled( myPreviewActor->hasPrevious() );
610     myNextButton->setEnabled( myPreviewActor->hasNext() );
611   }
612 }