From: <hug...@li...> - 2012-05-19 07:54:33
|
branch: gui_overhaul details: http://hugin.hg.sourceforge.net/hgweb/hugin/hugin/hgroot/hugin/hugin/rev/635968dc934a changeset: 5802:635968dc934a user: tmodes date: Sat May 19 09:55:41 2012 +0200 description: Extended identify tool to open image in mask/crop tab (if only one image is selected with identify tool) diffstat: src/hugin1/hugin/MainFrame.cpp | 11 +++++++++++ src/hugin1/hugin/MainFrame.h | 5 ++++- src/hugin1/hugin/MaskEditorPanel.cpp | 6 +++++- src/hugin1/hugin/MaskEditorPanel.h | 9 +++++++-- src/hugin1/hugin/PreviewIdentifyTool.cpp | 21 +++++++++++++++------ 5 files changed, 42 insertions(+), 10 deletions(-) diffs (112 lines): diff -r 0086f5f54e97 -r 635968dc934a src/hugin1/hugin/MainFrame.cpp --- a/src/hugin1/hugin/MainFrame.cpp Sat May 19 08:14:55 2012 +0200 +++ b/src/hugin1/hugin/MainFrame.cpp Sat May 19 09:55:41 2012 +0200 @@ -1673,6 +1673,17 @@ cpe->setRightImage(img2); } +void MainFrame::ShowMaskEditor(size_t imgNr) +{ + if(!IsShown()) + { + Show(); + Raise(); + }; + m_notebook->SetSelection(1); + mask_panel->setImage(imgNr, true); +}; + void MainFrame::ShowStitcherTab() { ///@todo Stop using magic numbers for the tabs. diff -r 0086f5f54e97 -r 635968dc934a src/hugin1/hugin/MainFrame.h --- a/src/hugin1/hugin/MainFrame.h Sat May 19 08:14:55 2012 +0200 +++ b/src/hugin1/hugin/MainFrame.h Sat May 19 09:55:41 2012 +0200 @@ -139,8 +139,11 @@ /** call help browser with given file */ void DisplayHelp(wxString section); - + /** opens the control points tab with the both images selected */ void ShowCtrlPointEditor(unsigned int img1, unsigned int img2); + /** opens the mask/crop editor with the given image selected */ + void ShowMaskEditor(size_t imgNr); + /** opens the stitcher tab */ void ShowStitcherTab(); void resetProgress(double max); diff -r 0086f5f54e97 -r 635968dc934a src/hugin1/hugin/MaskEditorPanel.cpp --- a/src/hugin1/hugin/MaskEditorPanel.cpp Sat May 19 08:14:55 2012 +0200 +++ b/src/hugin1/hugin/MaskEditorPanel.cpp Sat May 19 09:55:41 2012 +0200 @@ -225,7 +225,7 @@ }; }; -void MaskEditorPanel::setImage(unsigned int imgNr) +void MaskEditorPanel::setImage(unsigned int imgNr, bool updateListSelection) { DEBUG_TRACE("image " << imgNr); bool restoreMaskSelection=(imgNr==GetImgNr()); @@ -281,6 +281,10 @@ UpdateMaskList(restoreMaskSelection); // FIXME: lets hope that nobody holds references to these images.. ImageCache::getInstance().softFlush(); + if(updateListSelection) + { + m_imagesListMask->SelectSingleImage(imgNr); + }; } void MaskEditorPanel::setMask(unsigned int maskNr) diff -r 0086f5f54e97 -r 635968dc934a src/hugin1/hugin/MaskEditorPanel.h --- a/src/hugin1/hugin/MaskEditorPanel.h Sat May 19 08:14:55 2012 +0200 +++ b/src/hugin1/hugin/MaskEditorPanel.h Sat May 19 09:55:41 2012 +0200 @@ -58,8 +58,13 @@ void SetPano(PT::Panorama * panorama) { m_pano = panorama; }; - /** sets the image, which is currently edited, set imgNr to UINT_MAX if no image is editing */ - void setImage(unsigned int imgNr); + /** sets the image, which is currently edited + @param imgNr the image which should be shown, use UINT_MAX for no image selected + @param updateListSelection if true, the selection of the images list is updated, + otherwise the selection of the list remains unchanged (e.g. when calling + from the list selection changed event handler) + */ + void setImage(unsigned int imgNr, bool updateListSelection=false); /** sets active mask number, set to UINT_MAX, if no mask is currently editing */ void setMask(unsigned int maskNr); /** called when mask where changed in MaskImageCtrl */ diff -r 0086f5f54e97 -r 635968dc934a src/hugin1/hugin/PreviewIdentifyTool.cpp --- a/src/hugin1/hugin/PreviewIdentifyTool.cpp Sat May 19 08:14:55 2012 +0200 +++ b/src/hugin1/hugin/PreviewIdentifyTool.cpp Sat May 19 09:55:41 2012 +0200 @@ -513,14 +513,23 @@ holdLeft = true; } - if (holdLeft && e.LeftUp() && image_set.size() == 2) { + if (holdLeft && e.LeftUp() && (image_set.size()==1 || image_set.size() == 2)) + { holdLeft = false; - if (constantOn || e.CmdDown()) { - // when there are only two images with indicators shown, show the - // control point editor with those images when left clicked. + if (constantOn || e.CmdDown()) + { + // when there are only two images with indicators shown, show the + // control point editor with those images when left clicked. + if(image_set.size()==2) + { MainFrame::Get()->ShowCtrlPointEditor(*(image_set.begin()), - *(++image_set.begin())); - MainFrame::Get()->Raise(); + *(++image_set.begin())); + } + else + { + MainFrame::Get()->ShowMaskEditor(*image_set.begin()); + }; + MainFrame::Get()->Raise(); } } |