wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
-
+ mslide = new wxSlider(this,-1,0,0,1, wxDefaultPosition, wxSize(400,10), wxSL_HORIZONTAL | wxSL_LABELS);
+ Connect( mslide->GetId(), wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WxViewer::OnSlide );
+ mcheck = new wxCheckBox(this,5123,crea::std2wx("Cine Loop"));
+ Connect( mcheck->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &WxViewer::OnCineLoop );
+ mcheck->SetValue(false);
// previewer
mInteractor = new crea::creawxVTKRenderWindowInteractor(this,-1);
mInteractor->UseCaptureMouseOn();
mCurrent = 0;
mPlayer = 0;
-
+
+ topsizer-> Add( mslide,1,wxALIGN_CENTER ,0);
topsizer-> Add( mInteractor ,1,wxGROW ,0);
+
SetSizer( topsizer );
Layout();
}
// TO DO : desallocate cleanly
// delete mPlayer;
// delete mInteractor;
+ delete mslide;
}
//=====================================================================
wxMutexLocker lock(mMutex);
GimmickDebugMessage(6,"WxViewer::SetImageVector"<<std::endl);
imagePointers=pointers;
+
+ mslide->SetMax(pointers.size());
+ // Refresh don't work, TO MODIFY
+ mslide->Refresh();
+ mslide->ClearTicks();
+ mslide->Hide();
+ mslide->Show();
+ StartPlayer();
}
//================================================================
//==================================================
void WxViewer::StartPlayer()
{
- // wxMutexLocker lock(mMutex);
- if (mPlayer != 0) return;
- mPlayer = new WxViewerPlayer(this);
- mPlayer->Create();
- mPlayer->Run();
+ if(mcheck->IsChecked())
+ {
+ // wxMutexLocker lock(mMutex);
+ if (mPlayer != 0) return;
+ mPlayer = new WxViewerPlayer(this);
+ mPlayer->Create();
+ mPlayer->Run();
+ }
+ else
+ {
+ ShowNextImage();
+ }
+ }
+
+ //================================================================
+
+ //==================================================
+
+ void WxViewer::OnCineLoop(wxCommandEvent &Event)
+ {
+ if(!mcheck->IsChecked())
+ {
+ mPlayer->Pause();
+ mPlayer->Delete();
+ mPlayer = 0;
+ }
+ StartPlayer();
}
+ //================================================================
+
+ //==================================================
+
+ void WxViewer::OnSlide(wxCommandEvent &Event)
+ {
+ mCurrent = mslide->GetValue();
+ StartPlayer();
+ }
+ //================================================================
+
+ //==================================================
+
+ void WxViewer::SetValue()
+ {
+ mslide->SetValue(mCurrent);
+ }
// BEGIN_EVENT_TABLE(WxGimmickFrame, wxDialog)
// END_EVENT_TABLE()
{
mWxViewer->ShowNextImage();
+ mWxViewer->SetValue();
::wxWakeUpIdle();
clock_t endwait;
endwait = clock () + 0.2 * CLOCKS_PER_SEC ;
///Refreshes the interface if the current image shown has changed
bool RefreshIfNecessary();
///Sets a new image vector to be read
-
void SetImageVector(std::vector<boost::shared_ptr<ImagePointerHolder> > &pointers);
-
+
+ /// Set value of slider control
+ void SetValue();
private:
+
+ /// Event to resume or start cine loop
+ void OnCineLoop(wxCommandEvent &Event);
+
+ /// Event to change displayed frames with slide control
+ void OnSlide(wxCommandEvent &Event);
+
+
///Shows the image passed as parameter
void ShowImage(vtkImageData* im);
/// Previewer
vtkImageViewer2* mViewer;
+
+ ///Slider
+ wxSlider *mslide ;
+
+ ///CheckBox to cine loop
+ wxCheckBox *mcheck;
+
/// Associated wxvtk interactor
crea::creawxVTKRenderWindowInteractor *mInteractor;