ADD_EXECUTABLE(TestWxGimmickDialog WIN32 main)
SET_TARGET_PROPERTIES(TestWxGimmickDialog PROPERTIES LINK_FLAGS /subsystem:console )
ELSE(WIN32)
- ADD_EXECUTABLE(TestWxGimmickDialog main)
+ ADD_EXECUTABLE(TestWxGimmickDialog MACOSX_BUNDLE main)
ENDIF(WIN32)
TARGET_LINK_LIBRARIES( TestWxGimmickDialog creaImageIO)
ADD_EXECUTABLE(TestWxGimmickReaderDialog WIN32 main)
SET_TARGET_PROPERTIES(TestWxGimmickReaderDialog PROPERTIES LINK_FLAGS /subsystem:console )
ELSE(WIN32)
- ADD_EXECUTABLE(TestWxGimmickReaderDialog main)
+ ADD_EXECUTABLE(TestWxGimmickReaderDialog MACOSX_BUNDLE main)
ENDIF(WIN32)
TARGET_LINK_LIBRARIES( TestWxGimmickReaderDialog creaImageIO2)
ADD_EXECUTABLE(${NAME} WIN32 main)
SET_TARGET_PROPERTIES(${NAME} PROPERTIES LINK_FLAGS /subsystem:console )
ELSE(WIN32)
- ADD_EXECUTABLE(${NAME} main)
+ ADD_EXECUTABLE(${NAME} MACOSX_BUNDLE main)
ENDIF(WIN32)
TARGET_LINK_LIBRARIES( ${NAME} creaImageIO2)
// Author: Robert Roebling
// Maintainer: Otto Wyss
// Created: 01/02/97
-// RCS-ID: $Id: treelistctrl.cpp,v 1.3 2008/10/01 14:23:59 guigues Exp $
+// RCS-ID: $Id: treelistctrl.cpp,v 1.4 2009/03/20 14:43:12 davila Exp $
// Copyright: (c) 2004 Robert Roebling, Julian Smart, Alberto Griggio,
// Vadim Zeitlin, Otto Wyss
// Licence: wxWindows
dc->DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
#if defined( __WXMAC__ )
- wxPen pen( wxColour( 0x88 , 0x88 , 0x88 ), 1, wxSOLID );
+
+ // EED
+ // wxPen pen( wxColour( 0x88 , 0x88 , 0x88 ), 1, wxSOLID );
+ pen.SetColour( wxColour( 0x88 , 0x88 , 0x88 ) );
+
#endif
dc->SetPen( pen );
dc->DrawLine( x+w-m_corner, y, x+w-1, y+h ); // right (inner)
{
GimmickDebugMessage(1,"GimmickView::GimmickView"
<<std::endl);
- // Start the threads ...
- mReader.Start();
+ // Anciently started the threads ...
+ // Threads now automatically start at first image request
+ //mReader.Start();
}
//======================================================================
bool GimmickView::ValidateSelected (std::vector<tree::Node*>& sel, int min_dim, int max_dim)
{
GimmickMessage(2,"Validating selected"<<std::endl);
+
bool valid=true;
+
+ // EED validate all
+ mValidationSignal(valid);
+ return valid;
+
int level;
std::string mMessage;
if(sel.size()>0)
void GimmickView::RequestReading(tree::Node* n,
int prio, int selection_index)
{
+ mReader.Start();
ImageEventType t(n,0,selection_index);
mImageEventMap[n->GetAttribute("FullFileName")] = t;
mReader.Request(this,n->GetAttribute("FullFileName"),prio);
mQueue.set(mIndexer);
//
// no thread : alloc self reader
- if (number_of_threads==0)
- {
+// if (number_of_threads==0)
+// {
mReader = new ImageReader();
- }
+// }
}
//=====================================================================
// std::cout << "#### MultiThreadImageReader::Start()"
// <<std::endl;
+ if (mNumberOfThreadedReadersRunning > 0) return true;
+
ThreadedImageReaderListType::iterator i;
for (i =mThreadedImageReaderList.begin();
i!=mThreadedImageReaderList.end();
const std::string& filename,
int priority )
{
- wxMutexLocker lock(GetMultiThreadImageReaderUserMutex()); //mMutex);
+ wxMutexLocker lock(GetMultiThreadImageReaderUserMutex()); //mMutex);
- if (mThreadedImageReaderList.size()==0)
+ if (mNumberOfThreadedReadersRunning==0)
+// if (mThreadedImageReaderList.size()==0)
{
// no detached reader : use self reader
ImageToLoad itl(user,filename);
//=====================================================================
vtkImageData* MultiThreadImageReader::GetImage(const std::string& filename)
{
-
+ // Start();
// std::cout << "** MultiThreadImageReader::GetImage('"<<filename<<"')"
// <<std::endl;
{
wxMutexLocker lock(GetMultiThreadImageReaderUserMutex()); //mMutex);
- if (mThreadedImageReaderList.size()==0)
+ if (mNumberOfThreadedReadersRunning==0)
+// if (mThreadedImageReaderList.size()==0)
{
ImageToLoad itl(this,filename);
ImageMapType::iterator i = mImages.find(&itl);
// Bottom panel
mBottomPanel = new wxPanel(mSplitter,-1);
- wxBoxSizer *bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
+ wxBoxSizer *bottom_sizer = new wxBoxSizer(wxVERTICAL); //HORIZONTAL);
- mText = new wxStaticText(mBottomPanel, wxID_ANY, wxT("Status: Welcome to Gimmick!"));
- bottom_sizer->Add(mText,1,wxGROW,0);
// Previewer
mViewer = new WxViewer(mBottomPanel, wxID_ANY, wxT("Gimmick! Viewer"),wxDefaultPosition, wxDefaultSize );
mViewer->SetMovieSize(1);
mViewer->SetImage(0,GetDefaultImage());
+ mViewer->ShowNextImage();
- bottom_sizer->Add(mViewer,1,wxGROW,0);
+ bottom_sizer->Add(mViewer,1,wxGROW,1);
// mViewer->Show();
+ mText = new wxStaticText(mBottomPanel, wxID_ANY, wxT("Welcome to Gimmick!"));
+ bottom_sizer->Add(mText,0,wxGROW,0);
+
+
+
mBottomPanel->SetSizer(bottom_sizer);
// Splitting
bool valid = ValidateSelected(sel,
mSelectionMinDimension,
mSelectionMaxDimension );
- mText->SetLabel(_T("Status: ")+crea::std2wx(GetMessage()));
+ mText->SetLabel(crea::std2wx(GetMessage()));
if(valid)
{
ReadImageThreaded(sel);
while (!IsQueueEmpty())
{
+ mViewer->StartPlayer();
+
GimmickDebugMessage(5,
"Queue not empty"
<<std::endl);
}
ClearQueue();
-
MultiThreadImageReaderEventUnlock();
/*
first_time = false;
}
// GimmickMessage(1,"WxGimmickView : Refresh viewer"<<std::endl);
-
+ // mViewer->StartPlayer();
if (mViewer->RefreshIfNecessary())
{
// mViewer->Refresh();
mCurrent = 0;
- mPlayer = new WxViewerPlayer(this); //images, mViewer, mInteractor, this);
-
- mPlayer->Create();
- mPlayer->Run();
-
+ mPlayer = 0;
+
topsizer-> Add( mInteractor ,1,wxGROW ,0);
SetSizer( topsizer );
Layout();
void WxViewer::ShowNextImage()
{
- wxMutexLocker lock(mMutex);
+ wxMutexLocker lock(mMutex);
- /*
- GimmickMessage(1,"WxViewer::ShowNextImage() "
+
+ GimmickMessage(10,"WxViewer::ShowNextImage() "
<<mCurrent+1<<"/"
<<images.size()<<std::endl);
- */
+
if (mCurrent<images.size())
{
//=====================================================================
void WxViewer::ShowImage(vtkImageData* im)
{
+
GimmickDebugMessage(5,"WxViewer::ShowImage"
<<std::endl);
if (im==0) return;
im->GetSpacing(spx,spy,spz);
im->GetExtent (x1,x2,y1,y2,z1,z2);
- /*
- std::cout << "-----------------------------"<<std::endl;
- std::cout << x1 << "-"<<x2<<std::endl;
- std::cout << y1 << "-"<<y2<<std::endl;
- std::cout << z1 << "-"<<z2<<std::endl;
- std::cout << spx << "-"<<spy<<"-"<<spz<<std::endl;
- */
if ((x1!=mx1) ||
(x2!=mx2) ||
mViewer->GetRenderer()->ComputeVisiblePropBounds(bounds);
- /*
- std::cout <<"bounds : "<<bounds[0]<<","
-<<bounds[1]<<","
-<<bounds[2]<<","
-<<bounds[3]<<","
-<<bounds[4]<<","
- <<bounds[5]<<std::endl;
- */
mViewer->GetRenderer()->ResetCameraClippingRange(bounds);
- /*
- vtkCamera *camera = mViewer->GetRenderer()->GetActiveCamera();
-
- camera->SetViewUp ( spx*0, -spy*1, spz*0);
- camera->SetPosition( spx*(x1+x2)/2, spy*(y1+y2)/2, spz*10000000);
- camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0);
-
- camera->ComputeViewPlaneNormal();
- camera->SetParallelScale( spx*(x2-x1)/2.0 );
-
- camera->Roll ( 180 );
- */
+
}
- // mInteractor->Refresh();
- //mInteractor->Render();
- // mViewer->Render();
-
//::wxWakeUpIdle();
+
}
//================================================================
//==================================================
void WxViewer::StopPlayer()
{
- mPlayer->Delete();
+ wxMutexLocker lock(mMutex);
+ if (mPlayer==0) return;
+ mPlayer->Delete();
+ mPlayer=0;
}
-
+
+ //==================================================
+ void WxViewer::StartPlayer()
+ {
+ // wxMutexLocker lock(mMutex);
+ if (mPlayer != 0) return;
+ mPlayer = new WxViewerPlayer(this);
+ mPlayer->Create();
+ mPlayer->Run();
+ }
+
+
+
// BEGIN_EVENT_TABLE(WxGimmickFrame, wxDialog)
{
GimmickMessage(1,"WxViewerPlayer::Entry()"<<std::endl);
-
- while(true)
- {
- if(!TestDestroy())
+
+ while(!TestDestroy())
{
mWxViewer->ShowNextImage();
- // mWxViewer->Refresh();
::wxWakeUpIdle();
clock_t endwait;
endwait = clock () + 0.2 * CLOCKS_PER_SEC ;
while (clock() < endwait) {}
- }
- else
- {
- break;
- }
- /*
- for(i=mImagesToPlay.begin();i!=mImagesToPlay.end();++i)
- {
- if(i!=mImagesToPlay.end())
- {
-
- GimmickMessage(1,"ThreadedMovie next image"<<std::endl);
-
- ShowImage(*i);
- mParent->Refresh();
- endwait = clock () + 0.2 * CLOCKS_PER_SEC ;
- while (clock() < endwait) {}
-
-
- }
- */
}
return 0;
}
void OnInternalIdle();
+ void StartPlayer();
+
void StopPlayer();
bool RefreshIfNecessary();