From: <hug...@li...> - 2012-06-24 11:14:15
|
branch: gui_overhaul details: http://hugin.hg.sourceforge.net/hgweb/hugin/hugin/hgroot/hugin/hugin/rev/db74b6795cf4 changeset: 5868:db74b6795cf4 user: tmodes date: Sun Jun 24 13:13:53 2012 +0200 description: [Windows] Trying to fix that autocrop progress dialog resulted in lost focus for main window diffstat: src/hugin1/hugin/GLPreviewFrame.cpp | 74 ++++++++++++++++--------------------- src/hugin1/hugin/PanoPanel.cpp | 37 ++++++++---------- 2 files changed, 49 insertions(+), 62 deletions(-) diffs (169 lines): diff -r 594d53c1d6e5 -r db74b6795cf4 src/hugin1/hugin/GLPreviewFrame.cpp --- a/src/hugin1/hugin/GLPreviewFrame.cpp Sun Jun 24 13:12:44 2012 +0200 +++ b/src/hugin1/hugin/GLPreviewFrame.cpp Sun Jun 24 13:13:53 2012 +0200 @@ -2527,75 +2527,65 @@ void GLPreviewFrame::OnAutocrop(wxCommandEvent &e) { DEBUG_INFO("Dirty ROI Calc\n"); - if (m_pano.getActiveImages().size() == 0) return; + if (m_pano.getActiveImages().size() == 0) + { + return; + }; - ProgressReporterDialog progress(2, _("Autocrop"), _("Calculating optimal crop"),this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_ELAPSED_TIME); - progress.increaseProgress(1); - progress.Pulse(); - vigra::Rect2D newROI; - vigra::Size2D newSize; - - m_pano.calcOptimalROI(newROI, newSize); - + { + ProgressReporterDialog progress(2, _("Autocrop"), _("Calculating optimal crop"),this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_ELAPSED_TIME); + progress.increaseProgress(1); + progress.Pulse(); + vigra::Size2D newSize; + m_pano.calcOptimalROI(newROI, newSize); + }; +#ifdef __WXMSW__ + //try to workaround an issue that the main window lost it focus after wxProgressDialog is destroyed + Raise(); +#endif + PanoramaOptions opt = m_pano.getOptions(); - - DEBUG_INFO ( "ROI: left: " << opt.getROI().left() - << " top: " << opt.getROI().top() - << " right: " << opt.getROI().right() - << " bottom: " << opt.getROI().bottom() << " before update"); - //set the ROI - fail if the right/bottom is zero, meaning all zero if(newROI.right() != 0 && newROI.bottom() != 0) { opt.setROI(newROI); - GlobalCmdHist::getInstance().addCommand( new PT::SetPanoOptionsCmd(m_pano, opt ) ); } - PanoramaOptions opt2 = m_pano.getOptions(); - DEBUG_INFO ( "ROI: left: " << opt2.getROI().left() - << " top: " << opt2.getROI().top() - << " right: " << opt2.getROI().right() - << " bottom: " << opt2.getROI().bottom() << " after update"); } void GLPreviewFrame::OnStackAutocrop(wxCommandEvent &e) { DEBUG_INFO("Dirty ROI Calc\n"); - if (m_pano.getActiveImages().size() == 0) return; + if (m_pano.getActiveImages().size() == 0) + { + return; + }; - ProgressReporterDialog progress(2, _("Autocrop"), _("Calculating optimal crop"),this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_ELAPSED_TIME); - progress.increaseProgress(1); - progress.Pulse(); - vigra::Rect2D newROI; - vigra::Size2D newSize; - - m_pano.calcOptimalStackROI(newROI, newSize); - + { + ProgressReporterDialog progress(2, _("Autocrop"), _("Calculating optimal crop"),this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_ELAPSED_TIME); + progress.increaseProgress(1); + progress.Pulse(); + vigra::Size2D newSize; + m_pano.calcOptimalStackROI(newROI, newSize); + }; +#ifdef __WXMSW__ + //try to workaround an issue that the main window lost it focus after wxProgressDialog is destroyed + Raise(); +#endif + PanoramaOptions opt = m_pano.getOptions(); - - DEBUG_INFO ( "ROI: left: " << opt.getROI().left() - << " top: " << opt.getROI().top() - << " right: " << opt.getROI().right() - << " bottom: " << opt.getROI().bottom() << " before update"); - //set the ROI - fail if the right/bottom is zero, meaning all zero if(newROI.right() != 0 && newROI.bottom() != 0) { opt.setROI(newROI); - GlobalCmdHist::getInstance().addCommand( new PT::SetPanoOptionsCmd(m_pano, opt ) ); } - PanoramaOptions opt2 = m_pano.getOptions(); - DEBUG_INFO ( "ROI: left: " << opt2.getROI().left() - << " top: " << opt2.getROI().top() - << " right: " << opt2.getROI().right() - << " bottom: " << opt2.getROI().bottom() << " after update"); } void GLPreviewFrame::OnFullScreen(wxCommandEvent & e) diff -r 594d53c1d6e5 -r db74b6795cf4 src/hugin1/hugin/PanoPanel.cpp --- a/src/hugin1/hugin/PanoPanel.cpp Sun Jun 24 13:12:44 2012 +0200 +++ b/src/hugin1/hugin/PanoPanel.cpp Sun Jun 24 13:13:53 2012 +0200 @@ -964,37 +964,34 @@ void PanoPanel::DoCalcOptimalROI(wxCommandEvent & e) { DEBUG_INFO("Dirty ROI Calc\n"); - if (pano->getActiveImages().size() == 0) return; - ProgressReporterDialog progress(2, _("Autocrop"), _("Calculating optimal crop"),this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_ELAPSED_TIME); - progress.increaseProgress(1); - progress.Pulse(); + if (pano->getActiveImages().size() == 0) + { + return; + }; - //unsigned int left,top,right,bottom; vigra::Rect2D newROI; vigra::Size2D newSize; - - pano->calcOptimalROI(newROI,newSize); - - + { + ProgressReporterDialog progress(2, _("Autocrop"), _("Calculating optimal crop"), this, wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_ELAPSED_TIME); + progress.increaseProgress(1); + progress.Pulse(); + pano->calcOptimalROI(newROI,newSize); + }; +#ifdef __WXMSW__ + //try to workaround an issue that the main window lost it focus after wxProgressDialog is destroyed + MainFrame::Get()->Raise(); +#endif + PanoramaOptions opt = pano->getOptions(); - - DEBUG_INFO ( "ROI: left: " << opt.getROI().left() << " top: " << opt.getROI().top() << " right: " << opt.getROI().right() << " bottom: " << opt.getROI().bottom() << " before update"); - //set the ROI - fail if the right/bottom is zero, meaning all zero if(newROI.right() != 0 && newROI.bottom() != 0) { - //opt.setWidth(newSize.x); - //opt.setHeight(newSize.y); opt.setROI(newROI); - GlobalCmdHist::getInstance().addCommand( new PT::SetPanoOptionsCmd( *pano, opt ) ); - } - PanoramaOptions opt2 = pano->getOptions(); - DEBUG_INFO ( "ROI: left: " << opt2.getROI().left() << " top: " << opt2.getROI().top() << " right: " << opt2.getROI().right() << " bottom: " << opt2.getROI().bottom() << " after update"); - -} + }; +}; void PanoPanel::DoStitch() { |