1.1 --- a/vymmodel.cpp Thu Jan 22 11:39:53 2009 +0000
1.2 +++ b/vymmodel.cpp Thu Jan 22 15:40:08 2009 +0000
1.3 @@ -1523,18 +1523,6 @@
1.4 }
1.5 }
1.6
1.7 -void VymModel::setHeadingInt(const QString &s)
1.8 -{
1.9 - BranchObj *bo=getSelectedBranch();
1.10 - if (bo)
1.11 - {
1.12 - bo->setHeading(s);
1.13 - reposition();
1.14 - selection.update();
1.15 - ensureSelectionVisible();
1.16 - }
1.17 -}
1.18 -
1.19 BranchObj* VymModel::findText (QString s, bool cs)
1.20 {
1.21 QTextDocument::FindFlags flags=0;
1.22 @@ -4451,7 +4439,7 @@
1.23 TreeItem *ti=lmo->getTreeItem();
1.24 QModelIndex ix=index(ti);
1.25 selModel->select (ix,QItemSelectionModel::ClearAndSelect );
1.26 - //updateSelection(oldsel);
1.27 + //updateSelection(oldsel); //FIXME needed?
1.28 return true;
1.29 }
1.30 return false;
1.31 @@ -4728,33 +4716,28 @@
1.32
1.33 QItemSelection oldsel=selModel->selection();
1.34
1.35 - BranchObj* bo;
1.36 BranchObj* par;
1.37 LinkableMapObj *sel=getSelectedBranch();
1.38 if (sel)
1.39 {
1.40 - if (selectionType()==TreeItem::MapCenter)
1.41 + if (selectionType()== TreeItem::MapCenter)
1.42 {
1.43 - par=getSelectedBranch();
1.44 - bo=par->getLastSelectedBranch();
1.45 - if (bo)
1.46 - {
1.47 - // Workaround for reselecting on left and right side
1.48 - if (bo->getOrientation()==LinkableMapObj::LeftOfCenter)
1.49 - bo=par->getFirstBranch();
1.50 - if (bo)
1.51 - {
1.52 - selection.select(bo);
1.53 - //selection.update();
1.54 - //ensureSelectionVisible();
1.55 - //sendSelection();
1.56 - }
1.57 - }
1.58 + QModelIndex ix=getSelectedIndex();
1.59 + selModel->select (index (0,0,ix),QItemSelectionModel::ClearAndSelect );
1.60 } else
1.61 {
1.62 - par=(BranchObj*)(getSelectedLMO()->getParObj());
1.63 - if (getSelectedLMO()->getOrientation()==LinkableMapObj::LeftOfCenter)
1.64 + par=(BranchObj*)(sel->getParObj());
1.65 + if (sel->getOrientation()==LinkableMapObj::RightOfCenter)
1.66 {
1.67 + // right of center
1.68 + if (selectionType() == TreeItem::Branch )
1.69 + {
1.70 + selectLastSelectedBranch();
1.71 + return;
1.72 + }
1.73 + } else
1.74 + {
1.75 + // left of center
1.76 if (selectionType() == TreeItem::Branch ||
1.77 selectionType() == TreeItem::Image)
1.78 {
1.79 @@ -4762,25 +4745,9 @@
1.80 ix=parent(ix);
1.81 selModel->select (ix,QItemSelectionModel::ClearAndSelect );
1.82 }
1.83 - } else
1.84 - {
1.85 - if (selectionType() == TreeItem::Branch)
1.86 - {
1.87 - bo=getSelectedBranch()->getLastSelectedBranch();
1.88 - if (bo)
1.89 - {
1.90 - selection.select(bo);
1.91 - //selection.update();
1.92 - //ensureSelectionVisible();
1.93 - //sendSelection();
1.94 - }
1.95 - }
1.96 }
1.97 - }
1.98 - QItemSelection newsel=selModel->selection();
1.99 - emit (selectionChanged(newsel,oldsel));
1.100 - ensureSelectionVisible();
1.101 - sendSelection();
1.102 + }
1.103 + updateSelection (oldsel);
1.104 }
1.105 }
1.106