# HG changeset patch # User onomou # Date 1309147820 25200 # Branch gsoc2011_straight_line_tool # Node ID f6d3a21fe81752afaddd534f7807d4e68f3db01d # Parent bc56b87211b003c4b98bad8938f55e5a66a29d70 Add Swap Images button to CP editor panel diff --git a/src/hugin1/hugin/CPEditorPanel.cpp b/src/hugin1/hugin/CPEditorPanel.cpp --- a/src/hugin1/hugin/CPEditorPanel.cpp +++ b/src/hugin1/hugin/CPEditorPanel.cpp @@ -118,6 +118,7 @@ EVT_BUTTON(XRCID("cp_editor_delete"), CPEditorPanel::OnDeleteButton) EVT_BUTTON(XRCID("cp_editor_add"), CPEditorPanel::OnAddButton) EVT_BUTTON(XRCID("cp_editor_previous_img"), CPEditorPanel::OnPrevImg) + EVT_BUTTON(XRCID("cp_editor_swap_img"), CPEditorPanel::OnSwapImg) EVT_BUTTON(XRCID("cp_editor_next_img"), CPEditorPanel::OnNextImg) EVT_BUTTON(XRCID("cp_editor_finetune_button"), CPEditorPanel::OnFineTuneButton) EVT_BUTTON(XRCID("cp_editor_celeste_button"), CPEditorPanel::OnCelesteButton) @@ -219,10 +220,10 @@ // setup list view m_cpList = XRCCTRL(*this, "cp_editor_cp_list", wxListCtrl); m_cpList->InsertColumn( 0, _("#"), wxLIST_FORMAT_RIGHT, 35); - m_cpList->InsertColumn( 1, _("left x"), wxLIST_FORMAT_RIGHT, 65); - m_cpList->InsertColumn( 2, _("left y"), wxLIST_FORMAT_RIGHT, 65); - m_cpList->InsertColumn( 3, _("right x"), wxLIST_FORMAT_RIGHT, 65); - m_cpList->InsertColumn( 4, _("right y"), wxLIST_FORMAT_RIGHT, 65); + m_cpList->InsertColumn( 1, _("Left x"), wxLIST_FORMAT_RIGHT, 65); + m_cpList->InsertColumn( 2, _("Left y"), wxLIST_FORMAT_RIGHT, 65); + m_cpList->InsertColumn( 3, _("Right x"), wxLIST_FORMAT_RIGHT, 65); + m_cpList->InsertColumn( 4, _("Right y"), wxLIST_FORMAT_RIGHT, 65); m_cpList->InsertColumn( 5, _("Alignment"), wxLIST_FORMAT_LEFT,110 ); m_cpList->InsertColumn( 6, _("Distance"), wxLIST_FORMAT_RIGHT, 110); @@ -298,6 +299,7 @@ XRCCTRL(*this, "cp_editor_celeste_button", wxButton)->Disable(); XRCCTRL(*this, "cp_editor_choice_zoom", wxChoice)->Disable(); XRCCTRL(*this, "cp_editor_previous_img", wxButton)->Disable(); + XRCCTRL(*this, "cp_editor_swap_img", wxButton)->Disable(); XRCCTRL(*this, "cp_editor_next_img", wxButton)->Disable(); #ifdef HUGIN_CP_IMG_CHOICE m_leftChoice->Disable(); @@ -1295,6 +1297,7 @@ XRCCTRL(*this, "cp_editor_celeste_button", wxButton)->Disable(); XRCCTRL(*this, "cp_editor_choice_zoom", wxChoice)->Disable(); XRCCTRL(*this, "cp_editor_previous_img", wxButton)->Disable(); + XRCCTRL(*this, "cp_editor_swap_img", wxButton)->Disable(); XRCCTRL(*this, "cp_editor_next_img", wxButton)->Disable(); #ifdef HUGIN_CP_IMG_CHOICE m_leftChoice->Disable(); @@ -1310,6 +1313,7 @@ XRCCTRL(*this, "cp_editor_celeste_button", wxButton)->Enable(); XRCCTRL(*this, "cp_editor_choice_zoom", wxChoice)->Enable(); XRCCTRL(*this, "cp_editor_previous_img", wxButton)->Enable(); + XRCCTRL(*this, "cp_editor_swap_img", wxButton)->Enable(); XRCCTRL(*this, "cp_editor_next_img", wxButton)->Enable(); #ifdef HUGIN_CP_IMG_CHOICE m_leftChoice->Enable(); @@ -1919,6 +1923,10 @@ // move to next wxCommandEvent dummy; OnNextImg(dummy); + } else if (e.ControlDown() && e.GetKeyCode() == WXK_SPACE) { + // swap images + wxCommandEvent dummy; + OnSwapImg(dummy); } else if (e.GetKeyCode() == 'f') { bool left = e.GetEventObject() == m_leftImg; if (cpCreationState == NO_POINT) { @@ -2158,6 +2166,16 @@ setRightImage((unsigned int) right); } +void CPEditorPanel::OnSwapImg(wxCommandEvent & e) +{ + if (m_pano->getNrOfImages() < 2) return; + int tmp = m_leftImageNr; + int left = m_rightImageNr; + int right = tmp; + setLeftImage((unsigned int) left); + setRightImage((unsigned int) right); +} + void CPEditorPanel::OnFineTuneButton(wxCommandEvent & e) { if (cpCreationState == NO_POINT) { diff --git a/src/hugin1/hugin/CPEditorPanel.h b/src/hugin1/hugin/CPEditorPanel.h --- a/src/hugin1/hugin/CPEditorPanel.h +++ b/src/hugin1/hugin/CPEditorPanel.h @@ -200,6 +200,7 @@ void OnAutoAddCB(wxCommandEvent & e); void OnPrevImg(wxCommandEvent & e); void OnNextImg(wxCommandEvent & e); + void OnSwapImg(wxCommandEvent & e); void OnColumnWidthChange( wxListEvent & e ); diff --git a/src/hugin1/hugin/xrc/cp_editor_panel.xrc b/src/hugin1/hugin/xrc/cp_editor_panel.xrc --- a/src/hugin1/hugin/xrc/cp_editor_panel.xrc +++ b/src/hugin1/hugin/xrc/cp_editor_panel.xrc @@ -1,323 +1,311 @@ - + - - - wxVERTICAL - - - - wxVERTICAL - - - wxHORIZONTAL - - - - wxVERTICAL - - - wxHORIZONTAL - - - - - - - wxALL|wxADJUST_MINSIZE - 3 - - - - - previous image pair - - wxALL|wxEXPAND - 3 - - - - wxALL|wxEXPAND - 3 - - - - - wxALL|wxEXPAND - 3 - 300,150 - - - - - wxEXPAND - - - - - wxVERTICAL - - - wxHORIZONTAL - - - - next image pair - - wxALL|wxEXPAND - 3 - - - - - - - - wxALL|wxADJUST_MINSIZE - 3 - - - - wxALL|wxEXPAND - 3 - - - - - wxALL|wxEXPAND - 3 - 300,150 - - - - - wxEXPAND - - - - wxEXPAND - - - - wxHORIZONTAL - - - wxVERTICAL - - - - - - wxEXPAND - - - - wxHORIZONTAL - - - - - wxALIGN_CENTRE_VERTICAL - - - - 50,-1 - - - - wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL - 3 - - - - - - wxALIGN_CENTRE_VERTICAL - - - - 50,-1 - - - - wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL - 3 - - - - - - wxALIGN_CENTRE_VERTICAL - - - - 50,-1 - - - - wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL - 3 - - - - - - wxALIGN_CENTRE_VERTICAL - - - - 50,-1 - - - - wxALL|wxEXPAND|wxALIGN_CENTRE_VERTICAL - 3 - - - - - - wxALIGN_CENTRE_VERTICAL - - - - 100,-1 - - normal - vertical line - horizontal line - - - - wxALL|wxEXPAND - 3 - - - wxEXPAND - - - - wxALL|wxEXPAND - 3 - - - - wxVERTICAL - - - wxHORIZONTAL - - - - - wxALL|wxALIGN_CENTRE - 3 - - - - - - 100% - fit to window - 200% - 150% - 75% - 50% - 25% - - 1 - - wxALIGN_CENTRE_VERTICAL - - - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 3 - - - - wxHORIZONTAL - - - - Tries to optimize the currently active point - - wxALL|wxALIGN_CENTRE_VERTICAL - 3 - - - - - Tries to remove control points from clouds - - wxALL|wxALIGN_CENTRE_VERTICAL - 3 - - - wxALL|wxEXPAND - 5 - - - - wxVERTICAL - - - - - wxALL|wxEXPAND - - - - - immediately add control point when selecting a second point - - wxALL|wxEXPAND - - - - - tries to estimate shift between the images and use it while placing control points - - wxALL|wxEXPAND - - - wxALL|wxEXPAND - 5 - - - - wxHORIZONTAL - - - - - wxALL|wxALIGN_CENTRE_VERTICAL - 3 - - - - - add a new Point - - wxALL|wxALIGN_CENTRE_VERTICAL - 3 - - - wxALL|wxEXPAND - 5 - - - wxALL|wxEXPAND - 3 - - - wxEXPAND - - - - - - wxEXPAND - - - - + + + + wxVERTICAL + + + + + wxVERTICAL + + + wxVERTICAL + + + + + + + + + wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + + + + Previous image pair + + wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 3 + + + + + Swap image pair + + wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 3 + + + + + Next image pair + + wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 3 + + + + + + + wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + + + wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + + + + + + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 3 + + + + + + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 3 + + + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + + wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + + + + + wxVERTICAL + + + + + wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + + + + + + + wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + + + + 50,-1 + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + + + + + wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + + + + 50,-1 + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + + + + + wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + + + + 50,-1 + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + + + + + wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + + + + 50,-1 + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + + + + + wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + + + + + normal + vertical line + horizontal line + + 100,-1 + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 3 + + + + wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 3 + + + + + wxVERTICAL + + + + + + + wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 3 + + + + + 100% + fit to window + 200% + 150% + 75% + 50% + 25% + + 1 + + wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + + + + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 3 + + + + + + + Tries to optimize the currently active point + + wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + + + Tries to remove control points from clouds + + wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 5 + + + + wxVERTICAL + + + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + + + immediately add control point when selecting a second point + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + + + tries to estimate shift between the images and use it while placing control points + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 5 + + + + + + + + wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + + + add a new Point + + wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL + 3 + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 5 + + + wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + 3 + + + wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + + wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP + + + +