From: Pablo d'A. <da...@us...> - 2005-05-26 22:11:48
|
Update of /cvsroot/hugin/hugin/src/hugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8375/src/hugin Modified Files: ImagesList.cpp ImagesPanel.cpp MainFrame.cpp Log Message: Feature: image order can be changed after adding images Index: ImagesPanel.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/ImagesPanel.cpp,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- ImagesPanel.cpp 18 May 2005 12:50:21 -0000 1.86 +++ ImagesPanel.cpp 26 May 2005 22:11:37 -0000 1.87 @@ -65,7 +65,7 @@ #endif EVT_LIST_ITEM_SELECTED( XRCID("images_list_unknown"), ImagesPanel::ListSelectionChanged ) - EVT_LIST_ITEM_SELECTED( XRCID("images_list_unknown"), + EVT_LIST_ITEM_DESELECTED( XRCID("images_list_unknown"), ImagesPanel::ListSelectionChanged ) EVT_BUTTON ( XRCID("images_opt_anchor_button"), ImagesPanel::OnOptAnchorChanged) EVT_BUTTON ( XRCID("images_set_orientation_button"), ImagesPanel::OnSelectAnchorPosition) @@ -74,6 +74,8 @@ EVT_BUTTON ( XRCID("images_remove_cp"), ImagesPanel::OnRemoveCtrlPoints) EVT_BUTTON ( XRCID("images_reset_pos"), ImagesPanel::OnResetImagePositions) EVT_BUTTON ( XRCID("action_remove_images"), ImagesPanel::OnRemoveImages) + EVT_BUTTON ( XRCID("images_move_image_down"), ImagesPanel::OnMoveImageDown) + EVT_BUTTON ( XRCID("images_move_image_up"), ImagesPanel::OnMoveImageUp) EVT_TEXT_ENTER ( XRCID("images_text_yaw"), ImagesPanel::OnYawTextChanged ) EVT_TEXT_ENTER ( XRCID("images_text_pitch"), ImagesPanel::OnPitchTextChanged ) @@ -107,6 +109,10 @@ DEBUG_ASSERT(m_matchingButton); m_removeCPButton = XRCCTRL(*this, "images_remove_cp", wxButton); DEBUG_ASSERT(m_removeCPButton); + m_moveUpButton = XRCCTRL(*this, "images_move_image_up", wxButton); + DEBUG_ASSERT(m_moveUpButton); + m_moveDownButton = XRCCTRL(*this, "images_move_image_down", wxButton); + DEBUG_ASSERT(m_moveDownButton); #ifdef USE_WX253 m_img_ctrls = XRCCTRL(*this, "image_control_panel", wxScrolledWindow); @@ -403,6 +409,8 @@ m_optAnchorButton->Enable(); m_setAnchorOrientButton->Enable(); m_colorAnchorButton->Enable(); + m_moveDownButton->Enable(); + m_moveUpButton->Enable(); } else { DEBUG_DEBUG("Multiselection, or no image selected"); // multiselection, clear all values @@ -411,6 +419,8 @@ m_optAnchorButton->Disable(); m_setAnchorOrientButton->Disable(); m_colorAnchorButton->Disable(); + m_moveDownButton->Disable(); + m_moveUpButton->Disable(); } } } @@ -431,6 +441,8 @@ m_setAnchorOrientButton->Disable(); m_matchingButton->Disable(); m_removeCPButton->Disable(); + m_moveDownButton->Disable(); + m_moveUpButton->Disable(); XRCCTRL(*this, "images_reset_pos", wxButton)->Disable(); XRCCTRL(*this, "action_remove_images", wxButton)->Disable(); @@ -444,6 +456,8 @@ XRCCTRL(*this, "images_text_pitch", wxTextCtrl) ->Enable(); m_matchingButton->Enable(); m_removeCPButton->Enable(); + m_moveDownButton->Enable(); + m_moveUpButton->Enable(); XRCCTRL(*this, "images_reset_pos", wxButton)->Enable(); XRCCTRL(*this, "action_remove_images", wxButton)->Enable(); } @@ -673,3 +687,36 @@ } } +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); + } + } +} + +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); + } + } +} + + Index: MainFrame.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/MainFrame.cpp,v retrieving revision 1.151 retrieving revision 1.152 diff -u -d -r1.151 -r1.152 --- MainFrame.cpp 23 May 2005 14:41:11 -0000 1.151 +++ MainFrame.cpp 26 May 2005 22:11:38 -0000 1.152 @@ -1254,11 +1254,11 @@ DEBUG_TRACE("Statusmb : " << msg.mb_str()); m_statbar->SetStatusText(msg,0); - // This is a bad call.. we just want to repaint the window, instead we will - // process user events as well :( Unfortunately, there is not portable workaround... #ifdef __WXMSW__ UpdateWindow(NULL); #else + // This is a bad call.. we just want to repaint the window, instead we will + // process user events as well :( Unfortunately, there is not portable workaround... wxYield(); #endif } Index: ImagesList.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/ImagesList.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- ImagesList.cpp 23 May 2005 14:41:11 -0000 1.29 +++ ImagesList.cpp 26 May 2005 22:11:37 -0000 1.30 @@ -196,6 +196,18 @@ wxListCtrl::DeleteItem(imgNr); } +void ImagesList::SelectSingleImage(unsigned int imgNr) +{ + unsigned int nrItems = GetItemCount(); + for (unsigned int i=0; i < nrItems ; i++) { + int selected = GetItemState(i, wxLIST_STATE_SELECTED); + if (i != imgNr && selected) { + SetItemState(i, 0, wxLIST_STATE_SELECTED); + } + } + SetItemState(imgNr, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); +} + void ImagesList::OnItemSelected ( wxListEvent & e ) { DEBUG_TRACE(e.GetIndex()); |