From 87c6af35478ad7c76d45ec61dab92a38dd4d0d1a Mon Sep 17 00:00:00 2001 From: Eivind Kvedalen Date: Sun, 8 Nov 2015 11:58:46 +0100 Subject: [PATCH] Spreadsheet: Removed setPosition() function. --- src/Mod/Spreadsheet/App/Sheet.cpp | 19 ------------------- src/Mod/Spreadsheet/App/Sheet.h | 8 -------- src/Mod/Spreadsheet/App/SheetPy.xml | 5 ----- src/Mod/Spreadsheet/App/SheetPyImp.cpp | 19 ------------------- src/Mod/Spreadsheet/Gui/Command.cpp | 2 -- src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp | 13 ------------- src/Mod/Spreadsheet/Gui/SpreadsheetView.h | 1 - 7 files changed, 67 deletions(-) diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index 50d079857..7f3466ab0 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -84,8 +84,6 @@ Sheet::Sheet() ADD_PROPERTY_TYPE(cells, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Cell contents"); ADD_PROPERTY_TYPE(columnWidths, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Column widths"); ADD_PROPERTY_TYPE(rowHeights, (), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Row heights"); - ADD_PROPERTY_TYPE(currRow, (0), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Current row"); - ADD_PROPERTY_TYPE(currColumn, (0), "Spreadsheet", (PropertyType)(Prop_ReadOnly|Prop_Hidden), "Current column"); docDeps.setSize(0); @@ -452,18 +450,6 @@ std::map Sheet::getRowHeights() const return rowHeights.getValues(); } -/** - * @brief Set selected position for property to \a address. - * @param address Target position - */ - -void Sheet::setPosition(CellAddress address) -{ - currRow.setValue(address.row()); - currColumn.setValue(address.col()); - currRow.purgeTouched(); - currColumn.purgeTouched(); -} /** * @brief Remove all aliases. @@ -845,11 +831,6 @@ DocumentObjectExecReturn *Sheet::execute(void) rowHeights.clearDirty(); columnWidths.clearDirty(); - positionChanged(CellAddress(currRow.getValue(), currColumn.getValue())); - - currRow.purgeTouched(); - currColumn.purgeTouched(); - std::set ds(cells.getDocDeps()); // Make sure we don't reference ourselves diff --git a/src/Mod/Spreadsheet/App/Sheet.h b/src/Mod/Spreadsheet/App/Sheet.h index b84393f1f..bd329bfa0 100644 --- a/src/Mod/Spreadsheet/App/Sheet.h +++ b/src/Mod/Spreadsheet/App/Sheet.h @@ -162,8 +162,6 @@ public: std::map getRowHeights() const; - void setPosition(CellAddress address); - // Signals boost::signal cellUpdated; @@ -174,9 +172,6 @@ public: boost::signal rowHeightChanged; - boost::signal positionChanged; - - /** @name Access properties */ //@{ App::Property* addDynamicProperty( @@ -285,9 +280,6 @@ protected: /* Row heights */ PropertyRowHeights rowHeights; - App::PropertyInteger currRow; - App::PropertyInteger currColumn; - /* Dependencies to other documents */ App::PropertyLinkList docDeps; diff --git a/src/Mod/Spreadsheet/App/SheetPy.xml b/src/Mod/Spreadsheet/App/SheetPy.xml index f4476ef68..731e4f699 100644 --- a/src/Mod/Spreadsheet/App/SheetPy.xml +++ b/src/Mod/Spreadsheet/App/SheetPy.xml @@ -155,10 +155,5 @@ Get given spreadsheet row height - - - Set focused cell for attached view(s). - - diff --git a/src/Mod/Spreadsheet/App/SheetPyImp.cpp b/src/Mod/Spreadsheet/App/SheetPyImp.cpp index 7f2ddd8b0..de63a8d94 100644 --- a/src/Mod/Spreadsheet/App/SheetPyImp.cpp +++ b/src/Mod/Spreadsheet/App/SheetPyImp.cpp @@ -759,25 +759,6 @@ PyObject* SheetPy::getBackground(PyObject *args) } } -PyObject* SheetPy::setPosition(PyObject *args) -{ - const char * strAddress; - CellAddress address; - - if (!PyArg_ParseTuple(args, "s:setPosition", &strAddress)) - return 0; - - try { - address = stringToAddress(strAddress); - getSheetPtr()->setPosition(address); - Py_Return; - } - catch (const Base::Exception & e) { - PyErr_SetString(PyExc_ValueError, e.what()); - return 0; - } -} - PyObject* SheetPy::setColumnWidth(PyObject *args) { const char * columnStr; diff --git a/src/Mod/Spreadsheet/Gui/Command.cpp b/src/Mod/Spreadsheet/Gui/Command.cpp index 0dfebb6e7..56e5f5dec 100644 --- a/src/Mod/Spreadsheet/Gui/Command.cpp +++ b/src/Mod/Spreadsheet/Gui/Command.cpp @@ -82,8 +82,6 @@ void CmdSpreadsheetMergeCells::activated(int iMsg) Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.mergeCells('%s')", sheet->getNameInDocument(), i->rangeString().c_str()); Gui::Command::commitCommand(); - Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.setPosition('%s')", sheet->getNameInDocument(), - ranges[0].address().c_str()); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); } } diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index 88ab91867..55c531115 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -98,7 +98,6 @@ SheetView::SheetView(Gui::Document *pcDocument, App::DocumentObject *docObj, QWi columnWidthChangedConnection = sheet->columnWidthChanged.connect(bind(&SheetView::resizeColumn, this, _1, _2)); rowHeightChangedConnection = sheet->rowHeightChanged.connect(bind(&SheetView::resizeRow, this, _1, _2)); - positionChangedConnection = sheet->positionChanged.connect(bind(&SheetView::setPosition, this, _1)); QPalette palette = ui->cells->palette(); palette.setColor(QPalette::Base, QColor(255, 255, 255)); @@ -263,17 +262,6 @@ void SheetView::resizeColumn(int col, int newSize) ui->cells->setColumnWidth(col, newSize); } -void SheetView::setPosition(CellAddress address) -{ - QModelIndex curr = ui->cells->currentIndex(); - QModelIndex i = ui->cells->model()->index(address.row(), address.col()); - - if (i.isValid() && (curr.row() != address.row() || curr.column() != address.col())) { - ui->cells->clearSelection(); - ui->cells->setCurrentIndex(i); - } -} - void SheetView::resizeRow(int col, int newSize) { if (ui->cells->verticalHeader()->sectionSize(col) != newSize) @@ -299,7 +287,6 @@ void SheetView::editingFinished() void SheetView::currentChanged ( const QModelIndex & current, const QModelIndex & previous ) { updateContentLine(); - sheet->setPosition(CellAddress(current.row(), current.column())); } void SheetView::updateCell(const App::Property *prop) diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.h b/src/Mod/Spreadsheet/Gui/SpreadsheetView.h index 11905493a..b16741ea9 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.h +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.h @@ -87,7 +87,6 @@ protected Q_SLOTS: void columnResizeFinished(); void rowResizeFinished(); protected: - void setPosition(Spreadsheet::CellAddress address); void updateContentLine(); void setCurrentCell(QString str); void keyPressEvent(QKeyEvent *event);