]> git.lyx.org Git - features.git/commitdiff
* QToc.[Ch], QTocDialog.[Ch]: adaptation to ControlToc changes in r13772
authorAbdelrazak Younes <younes@lyx.org>
Fri, 28 Apr 2006 09:16:48 +0000 (09:16 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 28 Apr 2006 09:16:48 +0000 (09:16 +0000)
* TocModel.[Ch]: small cleanup + eol-style set to native

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13774 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/QToc.C
src/frontends/qt4/QToc.h
src/frontends/qt4/QTocDialog.C
src/frontends/qt4/QTocDialog.h
src/frontends/qt4/TocModel.C
src/frontends/qt4/TocModel.h

index 0d45e7ade8c9441cfda69990a059021fe4f7e4f9..4d3b332cedace6f2f6652206e7b942d5937084b7 100644 (file)
@@ -142,12 +142,5 @@ void QToc::updateToc(int type)
 }
 
 
-void QToc::move(toc::OutlineOp const operation)
-{
-       outline(operation);
-//     updateToc(type_);
-       update();
-}
-
 } // namespace frontend
 } // namespace lyx
index 6acc5c6209231d035a458c34b07f381f46ba1948..abee279bfb79874e5ed0117e513783e49c31455c 100644 (file)
@@ -48,8 +48,6 @@ public:
        ///
        void goTo(QModelIndex const & index);
 
-       void move(toc::OutlineOp const operation);
-
 private:
 
        std::vector<TocModel *> toc_models_;
index 1e74c397301ffff6c12a883d95d46e5cc52f7f0b..4a155bdfcee0fe7021947d901e34992262928505 100644 (file)
@@ -70,16 +70,6 @@ void QTocDialog::selectionChanged(const QModelIndex & current,
 }
 
 
-void QTocDialog::on_tocTV_clicked(const QModelIndex & index )
-{
-       lyxerr[Debug::GUI]
-               << "on_tocTV_clicked index " << index.row() << ", " << index.column()
-               << endl;
-
-       form_->goTo(index);
-}
-
-
 void QTocDialog::on_closePB_clicked()
 {
        accept();
@@ -119,37 +109,41 @@ void QTocDialog::on_typeCO_activated(int value)
 
 void QTocDialog::on_moveUpPB_clicked()
 {
-       move(toc::UP);
+       enableButtons(false);
+       QModelIndex index = tocTV->selectionModel()->selectedIndexes()[0];
+       form_->goTo(index);
+       form_->outlineUp();
+       update();
 }
 
 
 void QTocDialog::on_moveDownPB_clicked()
 {
-       move(toc::DOWN);
+       enableButtons(false);
+       QModelIndex index = tocTV->selectionModel()->selectedIndexes()[0];
+       form_->goTo(index);
+       form_->outlineDown();
+       update();
 }
 
 
 void QTocDialog::on_moveInPB_clicked()
 {
-       move(toc::IN);
+       enableButtons(false);
+       QModelIndex index = tocTV->selectionModel()->selectedIndexes()[0];
+       form_->goTo(index);
+       form_->outlineIn();
+       update();
 }
 
 
 void QTocDialog::on_moveOutPB_clicked()
-{
-       move(toc::OUT);
-}
-
-
-void QTocDialog::move(toc::OutlineOp const operation)
 {
        enableButtons(false);
        QModelIndex index = tocTV->selectionModel()->selectedIndexes()[0];
        form_->goTo(index);
-       form_->move(operation);
-       updateGui();
-//     select(index);
-//     enableButtons();
+       form_->outlineOut();
+       update();
 }
 
 
index b20f4843c9b03cda8e0d091f53bf0ff5d5a90bea..dd9d60b90b7b829a29451e76cf0c3bf3c46de1bb 100644 (file)
@@ -59,9 +59,6 @@ protected slots:
        void selectionChanged(const QModelIndex & current,
                const QModelIndex & previous);
 
-       /// Temporary until the slot above work.
-       void on_tocTV_clicked(const QModelIndex & index );
-
        void on_closePB_clicked();
        void on_updatePB_clicked();
        void on_depthSL_valueChanged(int depth);
@@ -74,9 +71,6 @@ protected slots:
 protected:
        ///
        void enableButtons(bool enable = true);
-       ///
-       void move(toc::OutlineOp const operation);
-       ///
 
 private:
 
index 24e51a749b8225adaf9d3ee02595653330412a4e..a97eba44cca53fced72e22e45c740f514171d226 100644 (file)
@@ -25,7 +25,7 @@ using std::make_pair;
 
 namespace lyx {
 namespace frontend {
-\r
+
 
 TocModel::TocModel(TocBackend::Toc const & toc)
 {
@@ -38,7 +38,7 @@ TocModel const & TocModel::operator=(TocBackend::Toc const & toc)
        populate(toc);
        return *this;
 }
-\r
+
 
 TocIterator const TocModel::tocIterator(QModelIndex const & index) const
 {
@@ -46,7 +46,7 @@ TocIterator const TocModel::tocIterator(QModelIndex const & index) const
        BOOST_ASSERT(map_it != toc_map_.end()); 
        return map_it->second;
 }
-\r
+
 
 QModelIndex const TocModel::modelIndex(TocIterator const & it) const
 {
@@ -58,7 +58,7 @@ QModelIndex const TocModel::modelIndex(TocIterator const & it) const
        
        return map_it->second;
 }
-\r
+
 
 void TocModel::clear()
 {
@@ -83,19 +83,19 @@ void TocModel::populate(TocBackend::Toc const & toc)
        TocIterator iter = toc.begin();
        TocIterator end = toc.end();
 
-    insertColumns(0, 1);
+       insertColumns(0, 1);
 
        while (iter != end) {
 
-               if (iter->depth() >= 0) {
+               if (iter->isValid()) {
 
                        current_row = rowCount();
                        insertRows(current_row, 1);
                        top_level_item = QStandardItemModel::index(current_row, 0);
                        //setData(top_level_item, toqstr(iter->str()));
                        setData(top_level_item, toqstr(iter->str()), Qt::DisplayRole);
-                       toc_map_.insert(make_pair(top_level_item, iter));
-                       model_map_.insert(make_pair(iter, top_level_item));
+                       toc_map_[top_level_item] = iter;
+                       model_map_[iter] = top_level_item;
 
                        lyxerr[Debug::GUI]
                                << "Toc: at depth " << iter->depth()
@@ -124,7 +124,7 @@ void TocModel::populate(TocIterator & iter,
        int current_row;
        QModelIndex child_item;
 
-    insertColumns(0, 1, parent);
+       insertColumns(0, 1, parent);
        while (iter != end) {
 
                ++iter;
@@ -136,27 +136,18 @@ void TocModel::populate(TocIterator & iter,
                        --iter;
                        return;
                }
-//             if (iter->depth() > curdepth) {
-//                     return;
-//             }
                
                current_row = rowCount(parent);
                insertRows(current_row, 1, parent);
                child_item = QStandardItemModel::index(current_row, 0, parent);
                //setData(child_item, toqstr(iter->str()));
                setData(child_item, toqstr(iter->str()), Qt::DisplayRole);
-               toc_map_.insert(make_pair(child_item, iter));
-               model_map_.insert(make_pair(iter, child_item));
-
-//             lyxerr[Debug::GUI]
-//                     << "Toc: at depth " << iter->depth()
-//                     << ", added item " << iter->str()
-//                     << endl;
-
+               toc_map_[child_item] = iter;
+               model_map_[iter] = child_item;
                populate(iter, end, child_item);
        }
 }
-\r
+
 
 } // namespace frontend
 } // namespace lyx
index 265999b1654e34ec32d510c3aab48d6b34e4cd88..8a97aebff7d2d54fe1ad957f052564ca137c6140 100644 (file)
 namespace lyx {
 namespace frontend {
 
-typedef TocBackend::Toc::const_iterator TocIterator;\r
-\r
+typedef TocBackend::Toc::const_iterator TocIterator;
+
 class TocModel: public QStandardItemModel {
        Q_OBJECT
-\r
+
 public:
        ///
        TocModel() {}
@@ -51,13 +51,13 @@ private:
        ///
        void populate(TocIterator & it,
                TocIterator const & end,
-               QModelIndex const & parent);\r
+               QModelIndex const & parent);
        ///
        typedef std::map<QModelIndex, TocIterator> TocMap;
        ///
        typedef std::map<TocIterator, QModelIndex> ModelMap;
        ///
-       TocMap toc_map_;\r
+       TocMap toc_map_;
        ///
        ModelMap model_map_;
 };