All
I recently had sometime on hand and decided to look at some of the bottlenecks
in my use of hugin..
The first one was not being able to move multiple images up and down in the
list on the image tab. Working in HDR, I often want to move groups of images up
and down, at present you can only move one image at a time which takes
considerable time. (Through with hindsight this appears to be a bug?)
When swapping two images, image1 selected and image2 the destination, something
seems wrong in UpdatePreviewImage() (called as a result of pano.changeFinished)
it loads the destination image2.. This makes moving a single image1 slow, since
all the images it is swapping with get loaded and scaled, despite them never
being displayed. This is not a problem with moving multiple images, since
panoramaImagesChanged tests for selection size equal to one...
The above aside, it seems relatively easy support moving mutiple selected
images. Patch (based on 2010.2) attached if anybody would like to try it.. I've
opted to just automate swapping images pairs to shuffle a block of images. This
avoided writing a new method to delete and re-insert images into the list.
Seems too easy, can anybody see anything I've missed?
Hope this is of interest to other users.
Regards
Stephen
--
You received this message because you are subscribed to the Google Groups
"Hugin and other free panoramic software" group.
A list of frequently asked questions is available at:
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx
# HG changeset patch
# User SBennett
# Date 1283784640 -3600
# Branch 2010.2
# Node ID 771bc77057ad3d307c81c2bb84147f462739fcd8
# Parent ad5544e0c303797689a65081f78aa4bbb5d69e9a
Move multiple images in imagelist panel
diff -r ad5544e0c303 -r 771bc77057ad src/hugin1/hugin/ImagesList.cpp
--- a/src/hugin1/hugin/ImagesList.cpp Sat Aug 07 20:57:41 2010 +0200
+++ b/src/hugin1/hugin/ImagesList.cpp Mon Sep 06 15:50:40 2010 +0100
@@ -247,16 +247,20 @@
wxListCtrl::DeleteItem(imgNr);
}
-void ImagesList::SelectSingleImage(unsigned int imgNr)
+void ImagesList::SelectImageRange(unsigned int imgNs,unsigned int imgNe)
{
unsigned int nrItems = GetItemCount();
+ //Clear all selected images
for (unsigned int i=0; i < nrItems ; i++) {
int selected = GetItemState(i, wxLIST_STATE_SELECTED);
- if (i != imgNr && selected) {
+ if (i < imgNs || i > imgNe && selected) {
SetItemState(i, 0, wxLIST_STATE_SELECTED);
}
}
- SetItemState(imgNr, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ //Select chosen range
+ for (unsigned int i=imgNs; i <= imgNe ; i++) {
+ SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ }
}
void ImagesList::OnItemSelected ( wxListEvent & e )
diff -r ad5544e0c303 -r 771bc77057ad src/hugin1/hugin/ImagesList.h
--- a/src/hugin1/hugin/ImagesList.h Sat Aug 07 20:57:41 2010 +0200
+++ b/src/hugin1/hugin/ImagesList.h Mon Sep 06 15:50:40 2010 +0100
@@ -99,9 +99,10 @@
/** Select an image
*
- * selects image @p imgNr, and deselects all other images
+ * selects images between @p imgNs and imgNe,
+ * and deselects all other images
*/
- void SelectSingleImage(unsigned int imgNr);
+ void SelectImageRange(unsigned int imgNs,unsigned int imgNe);
/** get the currently selected images */
const UIntSet & GetSelected() const;
diff -r ad5544e0c303 -r 771bc77057ad src/hugin1/hugin/ImagesPanel.cpp
--- a/src/hugin1/hugin/ImagesPanel.cpp Sat Aug 07 20:57:41 2010 +0200
+++ b/src/hugin1/hugin/ImagesPanel.cpp Mon Sep 06 15:50:40 2010 +0100
@@ -489,8 +489,8 @@
ShowImgParameters(imgNr);
m_optAnchorButton->Enable();
m_colorAnchorButton->Enable();
- m_moveDownButton->Enable();
- m_moveUpButton->Enable();
+ //m_moveDownButton->Enable();
+ //m_moveUpButton->Enable();
} else {
DEBUG_DEBUG("Multiselection, or no image selected");
// multiselection, clear all values
@@ -499,8 +499,8 @@
ClearImgExifInfo();
m_optAnchorButton->Disable();
m_colorAnchorButton->Disable();
- m_moveDownButton->Disable();
- m_moveUpButton->Disable();
+ //m_moveDownButton->Disable();
+ //m_moveUpButton->Disable();
}
}
}
@@ -870,39 +870,77 @@
void ImagesPanel::OnMoveImageDown(wxCommandEvent & e)
{
UIntSet selImg = images_list->GetSelected();
- if ( selImg.size() == 1) {
- unsigned int i1 = *selImg.begin();
- unsigned int i2 = i1+1;
- if (i2 < pano->getNrOfImages() ) {
- GlobalCmdHist::getInstance().addCommand(
- new SwapImagesCmd(*pano,i1, i2)
- );
- // set new selection
- images_list->SelectSingleImage(i2);
- // Bring the focus back to the button.
- m_moveDownButton->CaptureMouse();
- m_moveDownButton->ReleaseMouse();
- }
- }
+ unsigned int idx, num;
+
+ num = selImg.size();
+
+ //last selected image
+ unsigned int i1 = *selImg.begin()+num-1;
+
+ //image to move into
+ unsigned int i2 = i1+1;
+
+ //Test if there is room to move images down
+ if (i2 < pano->getNrOfImages() )
+ {
+ //Calculate the new position of the selections
+ unsigned int imgNs = *selImg.begin()+1;
+ unsigned int imgNe = *selImg.begin()+num;
+
+ for (idx=1; idx<=num; idx++)
+ {
+
+ GlobalCmdHist::getInstance().addCommand(
+ new SwapImagesCmd(*pano,i2, i1)
+ );
+
+ i1--;i2--;
+ }
+ // set new selection
+ images_list->SelectImageRange(imgNs,imgNe);
+ }
+
+ // Bring the focus back to the button.
+ m_moveDownButton->CaptureMouse();
+ m_moveDownButton->ReleaseMouse();
}
void ImagesPanel::OnMoveImageUp(wxCommandEvent & e)
{
UIntSet selImg = images_list->GetSelected();
- if ( selImg.size() == 1) {
- unsigned int i1 = *selImg.begin();
- unsigned int i2 = i1 -1;
- if (i1 > 0) {
- GlobalCmdHist::getInstance().addCommand(
- new SwapImagesCmd(*pano,i1, i2)
- );
- // set new selection
- images_list->SelectSingleImage(i2);
- // Bring the focus back to the button.
- m_moveUpButton->CaptureMouse();
- m_moveUpButton->ReleaseMouse();
- }
- }
+ unsigned int idx, num;
+
+ num = selImg.size();
+
+ //first selected image
+ unsigned int i1 = *selImg.begin();
+
+ //image to move into.
+ unsigned int i2 = i1-1;
+
+ //Test if there is room to move images up
+ if (i1 > 0 )
+ {
+ //Calculate the new position of the selections
+ unsigned int imgNs = *selImg.begin()-1;
+ unsigned int imgNe = *selImg.begin()+num-2;
+
+ for (idx=1; idx<=num; idx++)
+ {
+
+ GlobalCmdHist::getInstance().addCommand(
+ new SwapImagesCmd(*pano,i2, i1)
+ );
+
+ i1++;i2++;
+ }
+ // set new selection
+ images_list->SelectImageRange(imgNs,imgNe);
+ }
+
+ // Bring the focus back to the button.
+ m_moveDownButton->CaptureMouse();
+ m_moveDownButton->ReleaseMouse();
}
void ImagesPanel::ReloadCPDetectorSettings()