diff --git a/Code/Visu/otbImageViewer.h b/Code/Visu/otbImageViewer.h index 3b60ac01b804e30c51742256a137f5da688dad79..d51f9c1556ce999171baf0360a4c8e340a2215ea 100755 --- a/Code/Visu/otbImageViewer.h +++ b/Code/Visu/otbImageViewer.h @@ -100,6 +100,8 @@ public: void *), void * newClickSelectArg); virtual void ZoomAction(void); + virtual void PrincipalResize(void); + virtual void ScrollResize(void); virtual void PrincipalAction(const IndexType & index); virtual void ScrollAction(const IndexType & index); virtual void ExtractImagePrincipal(const RegionType & zone); diff --git a/Code/Visu/otbImageViewer.txx b/Code/Visu/otbImageViewer.txx index 1927e299ef2c0bd1ad845290154b6c8fda4186e1..93d988bb4a4356741b0c833bf2f75af292279cde 100755 --- a/Code/Visu/otbImageViewer.txx +++ b/Code/Visu/otbImageViewer.txx @@ -45,8 +45,83 @@ void ImageViewer<TPixel,TOverlayPixel> ::ZoomAction(void) { + m_PrincipalView->SetDrawViewRectangle( m_ZoomView->GetViewImageRegion() ); + m_PrincipalView->update(); +} +template <class TPixel, class TOverlayPixel> +void +ImageViewer<TPixel,TOverlayPixel> +::PrincipalResize(void) +{ + IndexType lIndex; + SizeType lSize; + lIndex[0] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[0] - m_PrincipalView->sizeX())/2); + lIndex[1] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[1] - m_PrincipalView->sizeY())/2); + lSize[0] = m_PrincipalView->sizeX(); + lSize[1] = m_PrincipalView->sizeY(); + RegionType lNewRegion; + lNewRegion.SetIndex(lIndex); + lNewRegion.SetSize(lSize); + //Update principal image + ExtractImagePrincipal( lNewRegion ); + + //Reconstruit la fenetre principal + m_PrincipalView->Show(); + + //Maj de la fenetre Zoom + m_ZoomView->SetInput( m_PrincipalImage ); + IndexType lNewCenter = m_PrincipalView->GetCenterRegion( m_PrincipalView->GetViewImageRegion() ); + this->PrincipalAction( lNewCenter ); -// m_PrincipalView->DrawRectangle( m_ZoomView->GetViewImageRegion() ); + //Dessine le rectangle sur l'image Scroll + if ( m_ScrollImageView == true ) + { + m_ScrollView->SetDrawViewRectangle( ImageViewBaseType::ShrinkRegion(m_PrincipalView->GetViewImageRegion(),(float)1./(float)m_ShrinkFactors ) ); + m_ScrollView->Show(); + } +} + +template <class TPixel, class TOverlayPixel> +void +ImageViewer<TPixel,TOverlayPixel> +::ScrollResize(void) +{ + //Détection si l'image est grande + m_ScrollImageView = GenereImageScroll(m_ShrinkFactors); + if ( m_ScrollImageView == false ) + { + m_PrincipalImage = m_InputImage; + } + else + { + // Traitement de la fenetre Principal + m_ExtractROIFilter->SetInput( m_InputImage ); + IndexType lIndex; + SizeType lSize; + lIndex[0] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[0] - m_PrincipalView->sizeX())/2); + lIndex[1] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[1] - m_PrincipalView->sizeY())/2); + lSize[0] = m_PrincipalView->sizeX(); + lSize[1] = m_PrincipalView->sizeY(); + RegionType lNewRegion; + lNewRegion.SetIndex(lIndex); + lNewRegion.SetSize(lSize); + //Update principal image + ExtractImagePrincipal( lNewRegion ); + +/* m_ExtractROIFilter->SetSizeX( m_PrincipalView->sizeX() ); + m_ExtractROIFilter->SetSizeY( m_PrincipalView->sizeY() ); + m_ExtractROIFilter->SetStartX( (m_InputImage->GetLargestPossibleRegion().GetSize()[0] - m_PrincipalView->sizeX())/2 ); + m_ExtractROIFilter->SetStartY( (m_InputImage->GetLargestPossibleRegion().GetSize()[1] - m_PrincipalView->sizeY())/2 ); + m_ExtractROIFilter->Update(); + m_PrincipalImage = m_ExtractROIFilter->GetOutput(); +*/ + // Traitement de la fenetre Scroll + m_ShrinkImageFilter->SetShrinkFactors(m_ShrinkFactors); + m_ShrinkImageFilter->SetInput( m_InputImage ); + m_ShrinkImageFilter->Update(); + m_ScrollImage = m_ShrinkImageFilter->GetOutput(); + } + PrincipalResize(); } template <class TPixel, class TOverlayPixel> @@ -58,77 +133,35 @@ ImageViewer<TPixel,TOverlayPixel> IndexType lIndex; lIndex[0] = index[0] * m_ShrinkFactors; lIndex[1] = index[1] * m_ShrinkFactors; -//std::cout << "lIndex image : "<<lIndex<<std::endl; -//std::cout << "m_InputImage->GetRequestedRegion(): "<<m_InputImage->GetRequestedRegion()<<std::endl; -//std::cout << "m_InputImage->GetLargestPossibleRegion(): "<<m_InputImage->GetLargestPossibleRegion()<<std::endl; -// RegionType lNewRegion = m_PrincipalView->GetViewRegion( m_InputImage->GetRequestedRegion(), lIndex ); RegionType lNewRegion = m_PrincipalView->GetViewRegion( m_InputImage->GetLargestPossibleRegion(), lIndex ); -//std::cout << "Nouvelle region active sur Scroll : "<<lNewRegion<<std::endl; -//std::cout << "m_InputImage->GetRequestedRegion(): "<<m_InputImage->GetRequestedRegion()<<std::endl; -//std::cout << "Avant Extract"<<std::endl; -// THOMAS + //Update principal image ExtractImagePrincipal( lNewRegion ); - m_PrincipalImage = m_ExtractROIFilter->GetOutput(); -//std::cout << "Nouvelle region requested sur Principal : "<<m_PrincipalImage->GetRequestedRegion()<<std::endl; - m_PrincipalView->SetInput( m_PrincipalImage ); -//std::cout << "m_InputImage->GetRequestedRegion(): "<<m_InputImage->GetRequestedRegion()<<std::endl; -//std::cout << "m_InputImage->GetLargestPossibleRegion(): "<<m_InputImage->GetLargestPossibleRegion()<<std::endl; - //Reconstruit la fenetre principal m_PrincipalView->Show(); -// m_PrincipalView->BuildWithImageRegion(); //Maj de la fenetre Zoom m_ZoomView->SetInput( m_PrincipalImage ); IndexType lNewCenter = m_PrincipalView->GetCenterRegion( m_PrincipalView->GetViewImageRegion() ); this->PrincipalAction( lNewCenter ); -//std::cout << "m_InputImage->GetRequestedRegion(): "<<m_InputImage->GetRequestedRegion()<<std::endl; - -// m_PrincipalView->SetCenterPointImage( lNewCenter ); - //Maj de la region / au centre -// m_PrincipalView->MajViewRegion(); -// m_PrincipalView->update(); - - -// m_ZoomView->Show(); - -//std::cout << "m_InputImage->GetRequestedRegion(): "<<m_InputImage->GetRequestedRegion()<<std::endl; - - //Dessine le rectangle sur l'image Scroll m_ScrollView->SetDrawViewRectangle( ImageViewBaseType::ShrinkRegion(m_PrincipalView->GetViewImageRegion(),(float)1./(float)m_ShrinkFactors ) ); - -// m_ScrollView->update(); m_ScrollView->Show(); - -// m_PrincipalView->DrawRectangle( m_ScrollView->GetViewImageRegion() ); -// m_PrincipalView->DrawRectangle( m_ZoomView->GetViewImageRegion() ); -// m_ScrollView->PrintInfos(); -// m_PrincipalView->PrintInfos(); -// m_ZoomView->PrintInfos(); - -//std::cout << "FIN scroll Action : m_InputImage->GetRequestedRegion(): "<<m_InputImage->GetRequestedRegion()<<std::endl; - } template <class TPixel, class TOverlayPixel> void ImageViewer<TPixel,TOverlayPixel> ::PrincipalAction(const IndexType & index) { -//std::cout << " --------------- PrincipalAction ------------------------------- "<< std::endl; //Si une action est faite sur la fenetre principale (ex : agrandir al fenetre, dans le cas ou il la fenetre scroll existe) -// m_ZoomView->winCenter( x, y ); m_ZoomView->SetCenterPointImage( index ); m_ZoomView->MajViewRegion(); m_ZoomView->update(); m_PrincipalView->SetDrawViewRectangle( m_ZoomView->GetViewImageRegion() ); m_PrincipalView->update(); - -// m_ScrollView->DrawRectangle( m_PrincipalView->GetViewImageRegion() ); } @@ -141,10 +174,9 @@ ImageViewer<TPixel,TOverlayPixel> m_ExtractROIFilter->SetSizeY( zone.GetSize()[1] ); m_ExtractROIFilter->SetStartX( zone.GetIndex()[0] ); m_ExtractROIFilter->SetStartY( zone.GetIndex()[1] ); -// m_ExtractROIFilter->SetInput( m_InputImage ); m_ExtractROIFilter->UpdateLargestPossibleRegion(); m_ExtractROIFilter->Update(); -// m_PrincipalImage = m_ExtractROIFilter->GetOutput(); + m_PrincipalImage = m_ExtractROIFilter->GetOutput(); } template <class TPixel, class TOverlayPixel> bool @@ -156,7 +188,6 @@ ImageViewer<TPixel,TOverlayPixel> pShrinkFactors = 0; //Si pas besoin de Scroll, alors on dit que l'image Principal n'est pas "resizable" !!! SizeType lInputImageSize = m_InputImage->GetLargestPossibleRegion().GetSize(); -// if ( MIN(lInputImageSize[0], lInputImageSize[1]) > m_ScrollWinSizeMax ) // Si la dimension Min de l'image est plus grande que la fenetre Principal, alors on créée la fenetre Scroll if ( MIN(lInputImageSize[0], lInputImageSize[1]) > MAX( m_PrincipalView->sizeX(), m_PrincipalView->sizeY() ) ) { @@ -182,6 +213,7 @@ ImageViewer<TPixel,TOverlayPixel> ::PrepareIHM(void) { m_InputImage->Update(); + //Détection si l'image est grande m_ScrollImageView = GenereImageScroll(m_ShrinkFactors); if ( m_ScrollImageView == false ) @@ -191,14 +223,26 @@ ImageViewer<TPixel,TOverlayPixel> else { // Traitement de la fenetre Principal - m_ExtractROIFilter->SetSizeX( m_PrincipalView->sizeX() ); + m_ExtractROIFilter->SetInput( m_InputImage ); + IndexType lIndex; + SizeType lSize; + lIndex[0] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[0] - m_PrincipalView->sizeX())/2); + lIndex[1] = static_cast<unsigned long>((m_InputImage->GetLargestPossibleRegion().GetSize()[1] - m_PrincipalView->sizeY())/2); + lSize[0] = m_PrincipalView->sizeX(); + lSize[1] = m_PrincipalView->sizeY(); + RegionType lNewRegion; + lNewRegion.SetIndex(lIndex); + lNewRegion.SetSize(lSize); + //Update principal image + ExtractImagePrincipal( lNewRegion ); + +/* m_ExtractROIFilter->SetSizeX( m_PrincipalView->sizeX() ); m_ExtractROIFilter->SetSizeY( m_PrincipalView->sizeY() ); m_ExtractROIFilter->SetStartX( (m_InputImage->GetLargestPossibleRegion().GetSize()[0] - m_PrincipalView->sizeX())/2 ); m_ExtractROIFilter->SetStartY( (m_InputImage->GetLargestPossibleRegion().GetSize()[1] - m_PrincipalView->sizeY())/2 ); - m_ExtractROIFilter->SetInput( m_InputImage ); m_ExtractROIFilter->Update(); m_PrincipalImage = m_ExtractROIFilter->GetOutput(); - +*/ // Traitement de la fenetre Scroll m_ShrinkImageFilter->SetShrinkFactors(m_ShrinkFactors); m_ShrinkImageFilter->SetInput( m_InputImage ); diff --git a/Code/Visu/otbPrincipalImageView.txx b/Code/Visu/otbPrincipalImageView.txx index e065a71e5f00873e102689c92919be2bd96cde4f..468221bdfa208bed2ca26f2f569fcac3904d7f84 100755 --- a/Code/Visu/otbPrincipalImageView.txx +++ b/Code/Visu/otbPrincipalImageView.txx @@ -27,73 +27,15 @@ int PrincipalImageView<TPixel, OverlayPixelType>::handle(int event) { - int x = Fl::event_x(); - int y = Fl::event_y(); - int button; - static int boxX, boxY; -/* - switch(event) - { - case FL_PUSH: - case FL_DRAG: - case FL_RELEASE: - button = Fl::event_button()-1; - if(button <= 0) - { - if(this->cClickMode == CM_BOX) - { - if(event == FL_PUSH) - { - boxX = x; - boxY = y; - } - else - { - if(event == FL_DRAG) - { - this->make_current(); - fl_overlay_clear(); - fl_overlay_rect(boxX, boxY, x-boxY, y-boxY); - } - else - { - this->make_current(); - fl_overlay_clear(); - } - } - } - } - break; - default: - break; - } -*/ int key; -#if 0 - static int fastMov = 0; - int pace; - - int imgShiftSize = (int)(this->cWinSizeX/10/this->cWinZoom); - if(imgShiftSize<1) - { - imgShiftSize = 1; - } - - double zoomBase = this->cW/(this->cDimSize[0 /*this->cWinOrder[0]*/]*(fabs(this->cSpacing[0 /*this->cWinOrder[0]*/])/fabs(this->cSpacing[0]))); - if(zoomBase > - this->cH/(this->cDimSize[1 /*this->cWinOrder[1]*/]*(fabs(this->cSpacing[1 /*this->cWinOrder[1]*/])/fabs(this->cSpacing[0])))) - { - zoomBase = this->cH/(this->cDimSize[1 /*this->cWinOrder[1]*/]*(fabs(this->cSpacing[1 /*this->cWinOrder[1]*/])/fabs(this->cSpacing[0]))); - } - - double scale0 = this->cWinZoom * zoomBase * fabs(this->cSpacing[0 /*this->cWinOrder[0]*/])/fabs(this->cSpacing[0]); - double scale1 = this->cWinZoom * zoomBase * fabs(this->cSpacing[1 /*this->cWinOrder[1]*/])/fabs(this->cSpacing[0]); -#endif switch(event) { case FL_PUSH: case FL_DRAG: + { + int x = Fl::event_x(); + int y = Fl::event_y(); IndexType lCenter; IndexType lCenterPointImage; lCenter[0] = x; @@ -102,117 +44,18 @@ PrincipalImageView<TPixel, OverlayPixelType>::handle(int event) lCenterPointImage = this->WindowCoord2ImageCoord(lCenter); // Mise a jour de la fenetre Zoom this->GetViewer()->PrincipalAction(lCenterPointImage); -#if 0 - -// button = Fl::event_button()-1; - if(button <= 0) - { - if(this->cClickMode == CM_SELECT || this->cClickMode == CM_BOX) - { - double originX = 0; - double originY = 0; - if(this->cWinZoom<=1) - { - if(this->cW-scale0*this->cDimSize[0 /*this->cWinOrder[0]*/]>0) - { - originX = (int)((this->cW-scale0*this->cDimSize[0 /*this->cWinOrder[0]*/])/2.0); - } - if(this->cH-scale1*this->cDimSize[1 /*this->cWinOrder[1]*/]>0) - { - originY = (int)((this->cH-scale1*this->cDimSize[1 /*this->cWinOrder[1]*/])/2.0); - } - } - float p[2]; -/* p[this->cWinOrder[0]] = this->cWinMinX + ( (1-this->cFlipX[this->cWinOrientation])*(x-originX) - + (this->cFlipX[this->cWinOrientation])*(this->cW-x-originX) ) - / scale0; - p[this->cWinOrder[1]] = this->cWinMinY + (this->cFlipY[this->cWinOrientation]*(y-originY) - + (1-this->cFlipY[this->cWinOrientation])*(this->cH-y-originY)) - / scale1;*/ - p[0] = this->cWinMinX + ( (this->cW-x-originX) ) / scale0; - p[1] = this->cWinMinY + ( (y-originY) )/ scale1; - if(p[0 /*this->cWinOrder[0]*/]<this->cWinMinX) - p[0 /*this->cWinOrder[0]*/] = this->cWinMinX; - if(p[0 /*this->cWinOrder[0]*/]>this->cWinMaxX) - p[0 /*this->cWinOrder[0]*/] = this->cWinMaxX; - if(p[1 /*this->cWinOrder[1]*/]<this->cWinMinY) - p[1 /*this->cWinOrder[1]*/] = this->cWinMinY; - if(p[1 /*this->cWinOrder[1]*/]>this->cWinMaxY) - p[1 /*this->cWinOrder[1]*/] = this->cWinMaxY; -/* if(this->cImageMode != IMG_MIP) - p[this->cWinOrder[2]] = this->cWinCenter[this->cWinOrder[2]]; - else - p[this->cWinOrder[2]] = this->cWinZBuffer[(int)p[this->cWinOrder[0]] - - this->cWinMinX - + ((int)p[this->cWinOrder[1]] - - this->cWinMinY) - * this->cWinDataSizeX]; -*/ - if(this->cClickMode == CM_SELECT) - this->clickSelect(p[0], p[1]/*, p[2]*/); - else if(this->cClickMode == CM_BOX) - if(event == FL_PUSH) - this->boxMin(p[0], p[1]/*, p[2]*/); - - return 1; - } - } - return 0; -#endif + } break; + case FL_FOCUS : + this->update(); + this->GetViewer()->PrincipalResize(); + return 1; + break; case FL_HIDE : this->GetViewer()->Hide(); return 0; break; case FL_RELEASE: -#if 0 - if(this->cClickMode == CM_BOX) - { - double originX = 0; - double originY = 0; - if(this->cWinZoom<=1) - { - if(this->cW-scale0*this->cDimSize[0 /*this->cWinOrder[0]*/]>0) - { - originX = (int)((this->cW-scale0*this->cDimSize[0 /*this->cWinOrder[0]*/])/2.0); - } - if(this->cH-scale1*this->cDimSize[1 /*this->cWinOrder[1]*/]>0) - { - originY = (int)((this->cH-scale1*this->cDimSize[1 /*this->cWinOrder[1]*/])/2.0); - } - } - float p[2]; -/* p[this->cWinOrder[0]] = this->cWinMinX + (this->cFlipX[this->cWinOrientation]*(this->cW-x-originX) - + (1-this->cFlipX[this->cWinOrientation])*(x-originX)) - / scale0; - p[this->cWinOrder[1]] = this->cWinMinY + (this->cFlipY[this->cWinOrientation]*(y-originY) - + (1-this->cFlipY[this->cWinOrientation])*(this->cH-y-originY)) - / scale1;*/ - p[0] = this->cWinMinX + ((this->cW-x-originX) + (0)*(x-originX)) / scale0; - p[1] = this->cWinMinY + ((y-originY) + (0)*(this->cH-y-originY)) / scale1; - - if(p[0 /*this->cWinOrder[0]*/]<this->cWinMinX) - p[0 /*this->cWinOrder[0]*/] = this->cWinMinX; - if(p[0 /*this->cWinOrder[0]*/]>this->cWinMaxX) - p[0 /*this->cWinOrder[0]*/] = this->cWinMaxX; - - if(p[1 /*this->cWinOrder[1]*/]<this->cWinMinY) - p[1 /*this->cWinOrder[1]*/] = this->cWinMinY; - if(p[1 /*this->cWinOrder[1]*/]>this->cWinMaxY) - p[1 /*this->cWinOrder[1]*/] = this->cWinMaxY; - -/* if(this->cImageMode != IMG_MIP) - p[this->cWinOrder[2]] = this->cWinCenter[this->cWinOrder[2]]; - else - p[this->cWinOrder[2]] = this->cWinZBuffer[(int)p[this->cWinOrder[0]] - - this->cWinMinX - + ((int)p[this->cWinOrder[1]] - - this->cWinMinY) - * this->cWinDataSizeX];*/ - this->boxMax(p[0], p[1]/*, p[2]*/); - return 1; - } -#endif return 0; break; diff --git a/Code/Visu/otbScrollImageView.txx b/Code/Visu/otbScrollImageView.txx index 5b99dfdc0321137697145b84f3fff1dd3a511560..ab00b6ff8ef135b48d914748b08dabcf38bdfa67 100755 --- a/Code/Visu/otbScrollImageView.txx +++ b/Code/Visu/otbScrollImageView.txx @@ -27,66 +27,31 @@ int ScrollImageView<TPixel, OverlayPixelType>::handle(int event) { - int x = Fl::event_x(); - int y = Fl::event_y(); - int button; - static int boxX, boxY; -/* - switch(event) - { - case FL_PUSH: - case FL_DRAG: - case FL_RELEASE: - button = Fl::event_button()-1; - if(button <= 0) - { - if(this->cClickMode == CM_BOX) - { - if(event == FL_PUSH) - { - boxX = x; - boxY = y; - } - else - { - if(event == FL_DRAG) - { - this->make_current(); - fl_overlay_clear(); -//std::cout << "GLVectorImageView<TPixel, OverlayPixelType>::handle DRAG " << std::endl; - fl_overlay_rect(boxX, boxY, x-boxY, y-boxY); - } - else - { - this->make_current(); - fl_overlay_clear(); - } - } - } - } - break; - default: - break; - } -*/ int key; switch(event) { case FL_PUSH: + { + int x = Fl::event_x(); + int y = Fl::event_y(); IndexType lCenter; IndexType lCenterPointImage; lCenter[0] = x; lCenter[1] = y; //Position du centre de l'image en coordonnees image lCenterPointImage = this->WindowCoord2ImageCoord(lCenter); -//std::cout << " Scroll Window : clicked souris -> ecran : "<<lCenter<< std::endl; -//std::cout << " -> image : "<<lCenterPointImage<< std::endl; - // Mise a jour de la fenetre Zoom - this->GetViewer()->ScrollAction(lCenterPointImage); - break; + // Mise a jour de la fenetre Zoom + this->GetViewer()->ScrollAction(lCenterPointImage); + } + break; case FL_KEYUP: break; + case FL_FOCUS : + this->update(); + this->GetViewer()->ScrollResize(); + return 1; + break; case FL_HIDE : this->GetViewer()->Hide(); return 0; diff --git a/Code/Visu/otbZoomImageView.h b/Code/Visu/otbZoomImageView.h index 9dfead1ebcd2db122ccfad75888464b1ee97b6cf..009121a0df7abc1821df1fca81def8a225a2b1ff 100755 --- a/Code/Visu/otbZoomImageView.h +++ b/Code/Visu/otbZoomImageView.h @@ -57,8 +57,8 @@ public: { this->BuildWithWindowRegion(4); this->m_flDoubleWindow->show(); - this->m_flDoubleWindow->size( this->GetViewImageRegion().GetSize()[0], - this->GetViewImageRegion().GetSize()[1]); +// this->m_flDoubleWindow->size( this->GetViewImageRegion().GetSize()[0], +// this->GetViewImageRegion().GetSize()[1]); this->show(); this->update(); } diff --git a/Code/Visu/otbZoomImageView.txx b/Code/Visu/otbZoomImageView.txx index ff96d8fcf939ab1de7a42a41416a6b947bfd9604..c22690394e1b9c901f9bdff9f34aa59a2b6324f4 100755 --- a/Code/Visu/otbZoomImageView.txx +++ b/Code/Visu/otbZoomImageView.txx @@ -25,48 +25,6 @@ template <class TPixel, class OverlayPixelType> int ZoomImageView<TPixel, OverlayPixelType>::handle(int event) { - - int x = Fl::event_x(); - int y = Fl::event_y(); - int button; - static int boxX, boxY; -/* - switch(event) - { - case FL_PUSH: - case FL_DRAG: - case FL_RELEASE: - button = Fl::event_button()-1; - if(button <= 0) - { - if(this->cClickMode == CM_BOX) - { - if(event == FL_PUSH) - { - boxX = x; - boxY = y; - } - else - { - if(event == FL_DRAG) - { - this->make_current(); - fl_overlay_clear(); - fl_overlay_rect(boxX, boxY, x-boxY, y-boxY); - } - else - { - this->make_current(); - fl_overlay_clear(); - } - } - } - } - break; - default: - break; - } -*/ int key; switch(event) @@ -75,6 +33,11 @@ ZoomImageView<TPixel, OverlayPixelType>::handle(int event) this->GetViewer()->Hide(); return 0; break; + case FL_FOCUS : + this->update(); + this->GetViewer()->ZoomAction(); + return 1; + break; case FL_KEYBOARD: case FL_SHORTCUT: key = Fl::event_text()[0]; @@ -82,27 +45,28 @@ ZoomImageView<TPixel, OverlayPixelType>::handle(int event) { case 'u': case 'U': - this->update(); - return 1; - break; + this->update(); + this->GetViewer()->ZoomAction(); + return 1; + break; case '+': case '=': - this->winZoom(this->cWinZoom*2); - this->MajViewRegion(); - this->update(); - this->GetViewer()->ZoomAction(); - return 1; - break; + this->winZoom(this->cWinZoom*2); + this->MajViewRegion(); + this->update(); + this->GetViewer()->ZoomAction(); + return 1; + break; case '-': case '_': - this->winZoom(this->cWinZoom*0.5); - this->MajViewRegion(); - this->update(); - this->GetViewer()->ZoomAction(); - return 1; - break; - default: - break; + this->winZoom(this->cWinZoom*0.5); + this->MajViewRegion(); + this->update(); + this->GetViewer()->ZoomAction(); + return 1; + break; + default: + break; } default: break;