alnmulti_widget.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:26k
- /*
- * ===========================================================================
- * PRODUCTION $Log: alnmulti_widget.cpp,v $
- * PRODUCTION Revision 1000.5 2004/06/01 21:07:16 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.49
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: alnmulti_widget.cpp,v 1000.5 2004/06/01 21:07:16 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Andrey Yazhuk
- *
- * File Description:
- *
- */
- #include <ncbi_pch.hpp>
- #include <gui/widgets/aln_multiple/alnmulti_ds.hpp>
- #include <gui/widgets/aln_multiple/alnmulti_settings.hpp>
- #include <gui/widgets/aln_multiple/alnmulti_widget.hpp>
- #include <gui/types.hpp>
- #include <gui/objutils/utils.hpp>
- #include <FL/Fl.H>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- ////////////////////////////////////////////////////////////////////////////////
- /// class CAlnMultiWidget
- CAlnMultiWidget::CAlnMultiWidget(int PosX, int PosY, int Width, int Height,
- const char* label)
- : Fl_Group(PosX, PosY, Width, Height, label),
- m_pDataSource(NULL),
- m_pListener(NULL),
- m_pModel(NULL),
- m_pAlignPane(NULL),
- m_pScrollX(NULL),
- m_pScrollY(NULL),
- m_pPopupMenu(NULL)
- {
- end();
- }
- void CAlnMultiWidget::Create()
- {
- x_CreateModel();
- begin();
- x_CreateControls();
- end();
- TVPRect rcVP;
- rcVP.SetSize(m_pAlignPane->GetAlignVPWidth(), m_pAlignPane->GetAlignVPHeight());
- x_GetAlignPort().SetViewport(rcVP);
- m_pModel->SetPortLimits();
- }
- CAlnMultiWidget::~CAlnMultiWidget()
- {
- }
- BEGIN_CMD_MAP(CAlnMultiWidget, CCommandTarget)
- ON_COMMAND(eCmdZoomIn, &CAlnMultiWidget::OnZoomIn)
- ON_COMMAND(eCmdZoomOut, &CAlnMultiWidget::OnZoomOut)
- ON_COMMAND(eCmdZoomAll, &CAlnMultiWidget::OnZoomAll)
- ON_COMMAND(eCmdZoomSel, &CAlnMultiWidget::OnZoomSelection)
- ON_COMMAND(eCmdZoomSeq, &CAlnMultiWidget::OnZoomSequence)
- ON_COMMAND(eCmdSetSelMaster, &CAlnMultiWidget::MakeSelectedRowMaster)
- ON_COMMAND(eCmdSetConsMaster, &CAlnMultiWidget::MakeConsensusRowMaster)
- ON_COMMAND(eCmdUnsetMaster, &CAlnMultiWidget::UnsetMaster)
- ON_COMMAND(eCmdResetSelection, &CAlnMultiWidget::OnResetSelection)
- ON_COMMAND(eCmdMarkSelected, &CAlnMultiWidget::OnMarkSelected)
- ON_COMMAND(eCmdUnMarkSelected, &CAlnMultiWidget::OnUnMarkSelected)
- ON_COMMAND(eCmdUnMarkAll, &CAlnMultiWidget::OnUnMarkAll)
- ON_COMMAND(eCmdHideSelected, &CAlnMultiWidget::OnHideSelected)
- ON_COMMAND(eCmdShowAll, &CAlnMultiWidget::OnShowAll)
- ON_COMMAND(eCmdMoveSelectedUp, &CAlnMultiWidget::OnMoveSelectedUp)
- END_CMD_MAP()
- ////////////////////////////////////////////////////////////////////////////////
- // IAlnMultiPaneParent implementation
- IAlnMultiDataSource* CAlnMultiWidget::GetDataSource()
- {
- return m_pDataSource;
- }
- const IAlnMultiDataSource* CAlnMultiWidget::GetDataSource() const
- {
- return m_pDataSource;
- }
- void CAlnMultiWidget::SetListener(CAlnMultiWidgetListener* listener)
- {
- m_pListener = listener;
- }
- /// changes visibility state for given vector of rows to "b_visible"
- void CAlnMultiWidget::SetVisible(const vector<TNumrow>& rows, bool b_visible,
- bool b_invert_others)
- {
- m_pModel->SetVisible(rows, b_visible, b_invert_others);
- x_AdjustVisible(false);
- x_SetScrollbars();
- x_RedrawControls();
- }
- void CAlnMultiWidget::Select(const vector<TNumrow>& rows, bool b_select,
- bool b_invert_others)
- {
- if(m_pModel) {
- CAlnMultiModel::TIndexVector vsel;
- vsel.reserve(rows.size());
-
- for( size_t i = 0; i < rows.size(); i++ ) {
- CAlnMultiModel::TIndex index = m_pModel->GetLineByRowNum(rows[i]);
- vsel.push_back(index);
- }
-
- m_pModel->SLM_SelectItems(vsel, true);
- }
- }
- void CAlnMultiWidget::SetStyleCatalog(const CRowStyleCatalog* catalog)
- {
- m_pModel->SetStyleCatalog(catalog);
- }
- const CWidgetDisplayStyle* CAlnMultiWidget::GetDisplayStyle() const
- {
- return m_pModel->GetDisplayStyle();
- }
-
- void CAlnMultiWidget::SetDataSource(IAlnMultiDataSource* p_ds)
- {
- _ASSERT(m_pModel);
- m_pDataSource = p_ds;
- m_pModel->SetDataSource(m_pDataSource);
-
- x_UpdateOnDataChanged();
- }
- CAlnMultiModel* CAlnMultiWidget::GetModel()
- {
- return m_pModel;
- }
- const CAlnMultiModel* CAlnMultiWidget::GetModel() const
- {
- return m_pModel;
- }
- CAlnMultiWidget::TNumrow CAlnMultiWidget::GetRowNumByLine(TLine line) const
- {
- IAlignRow* p_row = m_pModel->GetRowByLine(line);
- return p_row->GetRowNum();
- }
- /// return -1 if "row" does not exist or is not visible
- int CAlnMultiWidget::GetLineByRowNum(TNumrow row) const
- {
- return m_pModel->GetLineByRowNum(row);
- }
- void CAlnMultiWidget::OnChildResize()
- {
- x_OnResize();
- }
- void CAlnMultiWidget::OnSetScaleX(TModelUnit scale_x, const TModelPoint& point)
- {
- x_GetAlignPort().SetScaleRefPoint(scale_x, x_GetAlignPort().GetScaleY(), point);
- x_UpdateOnZoom();
- }
- void CAlnMultiWidget::OnZoomRect(const TModelRect& rc)
- {
- TSeqPos left = (TSeqPos) floor(rc.Left());
- TSeqPos right = (TSeqPos) ceil(rc.Right());
- x_ZoomToRange(left, right);
- }
- void CAlnMultiWidget::OnScroll(TModelUnit d_x, TModelUnit d_y)
- {
- x_GetAlignPort().Scroll(d_x, d_y);
- x_UpdateOnZoom();
- }
- void CAlnMultiWidget::OnRowChanged(IAlignRow* p_row)
- {
- x_UpdateOnRowHChanged();
- }
- void CAlnMultiWidget::OnShowPopup()
- {
- m_pPopupMenu = new CPopupMenu(x(), y(), w(), h());
- m_pPopupMenu->SetCmdTarget(static_cast<CCommandTarget*>(this));
- add(m_pPopupMenu);
- // create menu
- CMenuItem* root = new CMenuItem("Root");
- root->AddSubItem(new CMenuItem("Zoom In", eCmdZoomIn));
- root->AddSubItem(new CMenuItem("Zoom Out", eCmdZoomOut));
- root->AddSubItem(new CMenuItem("Zoom All", eCmdZoomAll));
- root->AddSubItem(new CMenuItem("Zoom to Sequence", eCmdZoomSeq));
- root->AddSubItem(new CMenuItem("Zoom Selection", eCmdZoomSel));
- root->AddSubItem(new CMenuItem());
- CMenuItem* master = new CMenuItem("Master");
- root->AddSubItem(master);
- master->AddSubItem(new CMenuItem("Set Selected", eCmdSetSelMaster));
- master->AddSubItem(new CMenuItem("Set Consensus", eCmdSetConsMaster));
- master->AddSubItem(new CMenuItem("Unset", eCmdUnsetMaster));
- root->AddSubItem(new CMenuItem());
- root->AddSubItem(new CMenuItem("Hide Selected", eCmdHideSelected));
- root->AddSubItem(new CMenuItem("Show All", eCmdShowAll));
-
- // show menu
- m_pPopupMenu->SetItems(root);
-
- m_pPopupMenu->popup();
- remove(m_pPopupMenu);
- }
- void CAlnMultiWidget::OnNotify(ENotification notification)
- {
- if(m_pListener) {
- m_pListener->OnNotify(notification);
- }
- }
- /// overriding base class implementation
- bool CAlnMultiWidget::IsRendererFocused()
- {
- return Fl::focus() == m_pAlignPane;
- }
- // end IAlnMultiPaneParent implementation
- ////////////////////////////////////////////////////////////////////////////////
- void CAlnMultiWidget::resize(int x, int y, int w, int h)
- {
- Fl_Group::resize(x, y, w, h);
- x_OnResize();
- }
- void CAlnMultiWidget::OnZoomIn()
- {
- if(x_GetAlignPort().IsZoomInAvaiable()) {
- x_GetAlignPort().ZoomInCenter();
- x_UpdateOnZoom();
- }
- }
- void CAlnMultiWidget::OnZoomOut()
- {
- if(x_GetAlignPort().IsZoomOutAvaiable()) {
- x_GetAlignPort().ZoomOutCenter();
- x_UpdateOnZoom();
- }
- }
- void CAlnMultiWidget::OnZoomSequence()
- {
- double w = 1.5 * GetDisplayStyle()->m_SeqFont.GetMetric(CGlBitmapFont::eMetric_MaxCharWidth);
- x_GetAlignPort().SetScale(1 / w, x_GetAlignPort().GetScaleY());
- x_UpdateOnZoom();
- }
- void CAlnMultiWidget::OnZoomAll()
- {
- x_GetAlignPort().ZoomAll();
- x_UpdateOnZoom();
- }
- void CAlnMultiWidget::OnZoomSelection()
- {
- CRange<TSeqPos> sel_r = m_pAlignPane->GetSelectionLimits();
- if(sel_r.NotEmpty()) {
- x_ZoomToRange(sel_r.GetFrom(), sel_r.GetTo());
- }
- x_UpdateOnZoom();
- }
- void CAlnMultiWidget::MakeSelectedRowMaster()
- {
- if(m_pModel->SLM_GetSelectedCount() == 1) {
- CAlnMultiModel::TIndexVector vIndices;
- m_pModel->SLM_GetSelectedIndices(vIndices);
- int SelIndex = vIndices[0]; // take the first selected item
- TNumrow iRow = GetRowNumByLine(SelIndex);
- x_UpdateOnSwitchMaster(iRow);
- }
- }
- void CAlnMultiWidget::x_ZoomToRange(TSeqPos from, TSeqPos to)
- {
- TModelRect rcV = x_GetAlignPort().GetVisibleRect();
- rcV.SetLeft(from);
- rcV.SetRight(to + 1);
- x_GetAlignPort().ZoomRect(rcV);
-
- x_UpdateOnZoom();
- }
- void CAlnMultiWidget::x_MakeVisibleHorz(TSeqPos pos)
- {
- x_MakeVisibleHorz(pos, pos);
- }
- void CAlnMultiWidget::x_MakeVisibleHorz(TSeqPos from, TSeqPos to)
- {
- TModelRect rcV = x_GetAlignPort().GetVisibleRect();
- TModelUnit sh_left = from - rcV.Left();
- TModelUnit sh_right = to + 1 - rcV.Right();
-
- TModelUnit sh = 0;
- if(sh_left < 0) { // shift left
- sh = sh_left;
- } else if(sh_right > 0) {
- sh = min(sh_right, sh_left);
- }
- if(sh != 0) {
- x_GetAlignPort().Scroll(sh, 0);
- x_UpdateOnZoom();
- }
- }
- CGlPane& CAlnMultiWidget::x_GetAlignPort()
- {
- _ASSERT(m_pModel);
- return m_pModel->GetAlignPort();
- }
- void CAlnMultiWidget::UnsetMaster(void)
- {
- x_UpdateOnSwitchMaster(-1);
- }
- void CAlnMultiWidget::MakeConsensusRowMaster(void)
- {
- int iRow = GetDataSource()->GetConsensusRow();
- if(iRow > -1) {
- x_UpdateOnSwitchMaster(iRow);
- }
- }
- void CAlnMultiWidget::OnResetSelection(void)
- {
- m_pAlignPane->ResetSelection(true);
- }
- void CAlnMultiWidget::GetSelectedIds(TRSeqIdVector& ids) const
- {
- if(GetModel() && GetDataSource()) {
- CAlnMultiModel::TIndexVector vindices;
- GetModel()->SLM_GetSelectedIndices(vindices);
- ITERATE(CAlnMultiModel::TIndexVector, itInd, vindices) {
- TNumrow row = GetRowNumByLine(*itInd);
- if(GetDataSource()->CanGetId(row))
- {
- const CSeq_id& id = GetDataSource()->GetSeqId(row);
- ids.push_back(CConstRef<CSeq_id>(&id));
- }
- }
- } else _ASSERT(false);
- }
- void CAlnMultiWidget::SetSelectedIds(const TRSeqIdVector& ids, CScope& scope)
- {
- if(GetModel() && GetDataSource()) {
- vector<CAlnVec::TNumrow> sel_rows;
- ITERATE(TRSeqIdVector, it, ids) {
- const CSeq_id& id = **it;
- //find row corresponding to id
- int n_rows = GetDataSource()->GetNumRows();
- for( CAlnVec::TNumrow row = 0; row < n_rows; row++ ) {
- if((GetModel()->GetRowState(row) & IAlignRow::fItemHidden) == 0) {
- const CSeq_id& row_id = GetDataSource()->GetSeqId(row);
- if(CSeqUtils::Match(row_id, id, &scope)) {
- sel_rows.push_back(row);
- break;
- }
- }
- }
- }
-
- Select(sel_rows, true);
- }
- }
- const CAlnMultiWidget::TRangeColl& CAlnMultiWidget::GetSelection(void) const
- {
- return m_pAlignPane->GetSelection();
- }
- void CAlnMultiWidget::OnMarkSelected(void)
- {
- const TRangeColl& C = m_pAlignPane->GetSelection();
- m_pAlignPane->MarkSelectedRows(C, true);
- m_pAlignPane->redraw();
- }
- void CAlnMultiWidget::OnUnMarkSelected()
- {
- const TRangeColl& C = m_pAlignPane->GetSelection();
- m_pAlignPane->MarkSelectedRows(C, false);
- m_pAlignPane->redraw();
- }
- void CAlnMultiWidget::OnUnMarkAll(void)
- {
- m_pAlignPane->UnMarkAll();
- m_pAlignPane->redraw();
- }
- void CAlnMultiWidget::OnHideSelected()
- {
- CAlnMultiModel::TIndexVector vIndices;
-
- m_pModel->SLM_GetSelectedIndices(vIndices);
- m_pModel->SLM_SelectAll(false);
- size_t N = vIndices.size();
- vector<TNumrow> rows;
- rows.resize(N);
- for(size_t i = 0; i<N; i++ ) {
- rows[i] = GetRowNumByLine(vIndices[i]);
- }
- SetVisible(rows, false);
- }
- void CAlnMultiWidget::OnShowAll()
- {
- m_pModel->ShowAll();
- x_AdjustVisible(false);
- x_SetScrollbars();
- x_RedrawControls();
- }
- void CAlnMultiWidget::OnMoveSelectedUp()
- {
- if(m_pModel) {
- vector<TNumrow> rows;
- m_pModel->GetSelectedRows(rows);
- if(rows.size()) {
- m_pModel->SetRowOrder(rows);
- x_RedrawControls();
- }
- }
- }
- void CAlnMultiWidget::UpdateSortOrder(void)
- {
- m_pModel->UpdateSortOrder();
- x_RedrawControls();
- }
- void CAlnMultiWidget::GetMarks(TPSeqLocList& ls_locs) const
- {
- const CAlnMultiPane::TRowToMarkMap& map = m_pAlignPane->GetMarks();
-
- ITERATE(CAlnMultiPane::TRowToMarkMap, it_m, map) { //for each marked row
- TNumrow row = it_m->first;
- if(GetDataSource()->CanGetId(row)) {
- const CSeq_id& seq_id = GetDataSource()->GetSeqId(row);
- // create CSeq_loc
- ls_locs.push_back(new CSeq_loc());
- CSeq_loc& seq_loc = *ls_locs.back();
-
- // put intervals
- CSeq_loc::TPacked_int& p_int = seq_loc.SetPacked_int();
-
- const TRangeColl& mark = it_m->second;
- ITERATE(TRangeColl, it_r, mark) { // for each range in mark
- p_int.AddInterval(seq_id, it_r->GetFrom(), it_r->GetTo());
- }
- }
- }
- }
- void CAlnMultiWidget::x_CreateControls()
- {
- _ASSERT(! m_pAlignPane && ! m_pScrollX && ! m_pScrollY);
- const int kScrollbarSize = CAlnMultiSettings::GetScrollbarSize();
- int client_w = w() - kScrollbarSize;
- int client_h = h() - kScrollbarSize;
- m_pAlignPane = new CAlnMultiPane(x(), y(), client_w, client_h);
- IAlnMultiPaneParent* pWidget = static_cast<IAlnMultiPaneParent*>(this);
- m_pAlignPane->SetWidget(pWidget);
- m_pAlignPane->SetContext(m_pModel);
-
- m_pModel->SLM_AddSLView(static_cast<TNumrowSelListView*>(m_pAlignPane));
-
- // scrollbars
- m_pScrollX = new Fl_Scrollbar(x(), y() + client_h, client_w, kScrollbarSize);
- m_pScrollX->type(FL_HORIZONTAL);
- m_pScrollX->callback(CAlnMultiWidget::x_OnScrollX, this );
-
- m_pScrollY = new Fl_Scrollbar(x() + client_w, y(), kScrollbarSize, client_h);
- m_pScrollY->type(FL_VERTICAL);
- m_pScrollY->callback(CAlnMultiWidget::x_OnScrollY, this );
-
- resizable(m_pAlignPane);
- end();
- }
- void CAlnMultiWidget::x_SetScrollbars()
- {
- TModelRect rcAll = x_GetAlignPort().GetModelLimitsRect();
- TModelRect rcVisible = x_GetAlignPort().GetVisibleRect();
-
- if (x_GetAlignPort().NeedsScrollX()) {
- m_pScrollX->value((int) rcVisible.Left(), (int) rcVisible.Width(),
- (int) rcAll.Left(), (int)rcAll.Width());
- } else {
- m_pScrollX->value(0, 0, 0, 0);
- }
- if (x_GetAlignPort().NeedsScrollY()) {
- m_pScrollY->value((int) rcVisible.Top(), (int) -rcVisible.Height(),
- (int) rcAll.Top(), (int) -rcAll.Height());
- } else {
- m_pScrollY->value(0, 0, 0, 0);
- }
- }
- void CAlnMultiWidget::x_OnResize()
- {
- TVPRect rcVP;
- rcVP.SetSize(m_pAlignPane->GetAlignVPWidth(), m_pAlignPane->GetAlignVPHeight());
- x_GetAlignPort().SetViewport(rcVP);
- x_AdjustVisible(false);
- x_SetScrollbars();
-
- // do not redraw, FLTK will do it for us -
- }
- void CAlnMultiWidget::x_RedrawControls()
- {
- m_pAlignPane->redraw();
- }
- ////////////////////////////////////////////////////////////////////////////////
- /// Update handlers
- void CAlnMultiWidget::x_UpdateOnDataChanged(bool b_reset)
- {
- if(GetDataSource()) {
- x_AdjustVisible(b_reset);
- }
- m_pAlignPane->ResetSelection(false);
- m_pAlignPane->UnMarkAll();
- x_SetScrollbars();
-
- m_pAlignPane->Update();
- x_RedrawControls();
- }
- void CAlnMultiWidget::x_AdjustVisible(bool b_reset)
- {
- TModelRect rcV;
- if(b_reset) {
- rcV = x_GetAlignPort().GetModelLimitsRect();
- rcV.SetTop(0);
- } else {
- rcV = x_GetAlignPort().GetVisibleRect();
- }
- rcV.SetBottom(rcV.Top() + m_pAlignPane->GetAlignVPHeight());
- x_GetAlignPort().SetVisibleRect(rcV);
- x_GetAlignPort().AdjustToLimits();
- }
- void CAlnMultiWidget::x_UpdateOnRowHChanged()
- {
- _ASSERT(GetDataSource());
-
- // updating model
- m_pModel->UpdateOnRowHChanged();
-
- // updating representation
- x_AdjustVisible(false);
- x_SetScrollbars();
- x_RedrawControls();
- }
- void CAlnMultiWidget::x_UpdateOnSwitchMaster(TNumrow NewMasterRow)
- {
- TModelRect rcV = x_GetAlignPort().GetVisibleRect();
- TSignedSeqPos SeqStart, SeqStop;
-
- if(GetDataSource()->GetAnchor() == NewMasterRow)
- return;
-
- // choose row that will be used for coordinate translations
- TNumrow SelRow = (NewMasterRow != -1) ? NewMasterRow : GetDataSource()->GetAnchor();
- TRangeColl SeqSelection; //selection in coordinates of SelRow
- if(SelRow != -1) {
- TSeqPos AlnStart((TSeqPos) rcV.Left());
- TSeqPos AlnStop((TSeqPos) rcV.Right());
- SeqStart = GetDataSource()->GetSeqPosFromAlnPos(SelRow, AlnStart,
- IAlnMultiDataSource::
- TSearchDirection::eRight);
- SeqStop = GetDataSource()->GetSeqPosFromAlnPos(SelRow, AlnStop,
- IAlnMultiDataSource::
- TSearchDirection::eRight);
- // convert selection to SelRow coordinates
- const TRangeColl& Selection = m_pAlignPane->GetSelection();
- ITERATE(TRangeColl, it, Selection) {
- TSeqPos Start =
- GetDataSource()->GetSeqPosFromAlnPos(SelRow, it->GetFrom(),
- IAlnMultiDataSource::
- TSearchDirection::eRight);
- TSeqPos Stop =
- GetDataSource()->GetSeqPosFromAlnPos(SelRow, it->GetTo(),
- IAlnMultiDataSource::
- TSearchDirection::eLeft);
- SeqSelection.CombineWith(TSeqRange(Start, Stop));
- }
- }
- m_pModel->SetMasterRow(NewMasterRow);
-
- if(SelRow != -1) {
- // calculate new visible rect based on saved positions
- TSignedSeqPos AlnStart = GetDataSource()->GetAlnPosFromSeqPos(SelRow, SeqStart);
- TSignedSeqPos AlnStop = GetDataSource()->GetAlnPosFromSeqPos(SelRow, SeqStop);
-
- TModelRect rcNewV(AlnStart, rcV.Bottom(), AlnStop, rcV.Top());
- x_GetAlignPort().SetVisibleRect(rcNewV);
- // convert Selection back to Alignment space
- TRangeColl AlnSelection;
- const TRangeColl& C = SeqSelection;
- ITERATE(TRangeColl, it, C) {
- TSeqPos Start = GetDataSource()->GetAlnPosFromSeqPos(SelRow, it->GetFrom());
- TSeqPos Stop = GetDataSource()->GetAlnPosFromSeqPos(SelRow, it->GetTo());
- AlnSelection.CombineWith(TSeqRange(Start, Stop));
- }
- m_pAlignPane->SetSelection(AlnSelection, false);
- }
-
- m_pAlignPane->Update();
- x_AdjustVisible(false);
- x_SetScrollbars();
-
- x_RedrawControls();
- }
- void CAlnMultiWidget::x_UpdateOnZoom()
- {
- x_SetScrollbars();
- m_pAlignPane->Update();
- x_RedrawControls();
- }
- ////////////////////////////////////////////////////////////////////////////////
- /// Scroll callbacks
- void CAlnMultiWidget::x_OnScrollX(Fl_Widget* pW, void* pData)
- {
- CAlnMultiWidget* pCont = reinterpret_cast<CAlnMultiWidget*>(pData);
-
- int V = pCont->m_pScrollX->value();
- double dX = V - pCont->x_GetAlignPort().GetVisibleRect().Left();
- pCont->x_GetAlignPort().Scroll(dX, 0);
-
- pCont->x_RedrawControls();
- }
- void CAlnMultiWidget::x_OnScrollY(Fl_Widget* pW, void* pData)
- {
- CAlnMultiWidget* pCont = reinterpret_cast<CAlnMultiWidget*>(pData);
-
- int V = pCont->m_pScrollY->value();
- double dY = V - pCont->x_GetAlignPort().GetVisibleRect().Top();
- pCont->x_GetAlignPort().Scroll(0, dY);
-
- pCont->x_RedrawControls();
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: alnmulti_widget.cpp,v $
- * Revision 1000.5 2004/06/01 21:07:16 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.49
- *
- * Revision 1.49 2004/05/21 22:27:52 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.48 2004/05/10 17:46:35 yazhuk
- * Addressed GCC warnings
- *
- * Revision 1.47 2004/05/03 13:23:57 dicuccio
- * gui/utils --> gui/objutils where needed
- *
- * Revision 1.46 2004/04/29 21:39:56 johnson
- * make viewport reset in x_UpdateOnDataChanged optional
- *
- * Revision 1.45 2004/04/07 13:07:27 dicuccio
- * Changed use of Match() - scope is optional pointer
- *
- * Revision 1.44 2004/04/06 16:04:59 yazhuk
- * Implemented OnMoveSelectedUp() command handler
- *
- * Revision 1.43 2004/04/02 16:34:35 yazhuk
- * Implemented support for selection broadcasting
- *
- * Revision 1.42 2004/04/02 15:55:17 dicuccio
- * Added call to redraw() in OnHideSelected()
- *
- * Revision 1.41 2004/03/25 13:18:49 dicuccio
- * MInor code reformatting
- *
- * Revision 1.40 2004/03/24 19:20:32 yazhuk
- * Fixed initilization/destruction
- *
- * Revision 1.39 2004/03/18 17:07:11 yazhuk
- * Added "b_invert_others" argument to SetVisible()
- *
- * Revision 1.38 2004/03/17 20:11:32 yazhuk
- * Refined CAlnMultiWidget interface and implementation
- *
- * Revision 1.37 2004/03/11 17:50:41 dicuccio
- * Updated typedefs: dropped TDimension, TPosition, TIndex, TColor; use TSeqRange
- * instead of TRange
- *
- * Revision 1.36 2004/03/09 21:04:23 yazhuk
- * Separated part of CAlnMultiWidget class into CAlnMultiModel
- *
- * Revision 1.35 2004/03/08 15:40:18 yazhuk
- * Implemented new functions for IAlnMultiPaneParent interface
- *
- * Revision 1.34 2004/02/04 20:05:08 yazhuk
- * Clean-up
- *
- * Revision 1.33 2004/01/22 16:33:39 yazhuk
- * Fixed FL_MOVE handling
- *
- * Revision 1.32 2004/01/15 20:13:25 yazhuk
- * Implemented popup menus, added UpdateSortOrder() , renamed some x_Update...
- * functions. Fixed focus handling bug in x_UpdateRowOrder()
- *
- * Revision 1.31 2004/01/08 19:40:44 yazhuk
- * Implemented row sorting, bugfixes in hiding/showing rows
- *
- * Revision 1.30 2003/12/22 16:26:05 yazhuk
- * Refactored Update system, optimized visibility support implementation
- *
- * Revision 1.29 2003/12/18 21:19:48 yazhuk
- * Major refactoring - implemented rows hiding, support for display styles
- *
- * Revision 1.28 2003/12/17 19:15:06 yazhuk
- * Added GetSelection()
- *
- * Revision 1.27 2003/12/10 17:07:25 yazhuk
- * Added "ref. point" argument to OnSetScaleX(). Basic support for popup menus.
- *
- * Revision 1.26 2003/12/08 16:41:10 yazhuk
- * Fixed scrollbar setup
- *
- * Revision 1.25 2003/12/01 22:35:52 yazhuk
- * Fixed GCC warnings
- *
- * Revision 1.24 2003/12/01 16:57:41 yazhuk
- * Added OnZoomRect() and OnScroll()
- *
- * Revision 1.23 2003/11/26 16:52:00 johnson
- * switch IAlnMultiDataSource to use CAlnMap::ESearchDirection instead of it's
- * own ESearchDirection
- *
- * Revision 1.22 2003/11/18 17:58:08 yazhuk
- * Fixed GCC warnings
- *
- * Revision 1.21 2003/11/06 20:14:56 dicuccio
- * Added USING_SCOPE(objects) to implementation file
- *
- * Revision 1.20 2003/11/03 16:57:38 yazhuk
- * Added OnRowChanged(), x_UpdateOnRowChanged() functions
- *
- * Revision 1.19 2003/10/31 22:25:37 ucko
- * Properly capitalize FL/Fl.H
- *
- * Revision 1.18 2003/10/29 23:33:12 yazhuk
- * Migrated to new classes, did a lot of refactoring
- *
- * Revision 1.17 2003/10/20 15:49:06 yazhuk
- * Implemented OnSetScaleX(). Clean-up.
- *
- * Revision 1.16 2003/10/15 21:23:08 yazhuk
- * Migrated from using CAlnVec to accessing data via "generic" interface in IAlnMultiDataSource.
- *
- * Revision 1.15 2003/10/10 18:57:41 yazhuk
- * Added scoring, OnZoomSequence() and fonts
- *
- * Revision 1.14 2003/10/07 13:44:59 dicuccio
- * Code beautification
- *
- * Revision 1.13 2003/10/04 16:47:37 dicuccio
- * Fix for compilation on gcc
- *
- * Revision 1.12 2003/10/03 16:26:36 yazhuk
- * Added command map
- *
- * Revision 1.11 2003/09/29 15:53:42 dicuccio
- * Reordered #include statements
- *
- * Revision 1.10 2003/09/29 13:40:31 yazhuk
- * Added GetMarks() function, fixed bug with setting viewport limits
- *
- * Revision 1.9 2003/09/25 20:46:13 yazhuk
- * Update CGlPane calls, added scale limitation
- *
- * Revision 1.8 2003/09/24 18:33:16 dicuccio
- * Code reformatting. Changed to match API in new data source
- *
- * Revision 1.7 2003/09/23 20:51:45 yazhuk
- * Updated IAlnMultiPaneParent member function implementation, added Mark manipulation functions, removed code working with Consensus Row
- *
- * Revision 1.6 2003/09/10 20:45:20 yazhuk
- * Merged 4 Pane classes into CAlnMultiPane class
- *
- * Revision 1.5 2003/09/08 20:42:04 yazhuk
- * Added Selection translation for switching Master Row
- *
- * Revision 1.4 2003/09/08 16:17:27 yazhuk
- * Support for anchoring sequences, "Zoom Selection" and 'Reset Selection" operations, bugfixes
- *
- * Revision 1.3 2003/09/02 16:53:57 yazhuk
- * GCC compilation fixes
- *
- * Revision 1.2 2003/08/28 18:26:16 yazhuk
- * Modified to be used with new CAlnMultiWidget
- *
- * Revision 1.1 2003/07/14 17:36:47 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */