Skip to content

Commit

Permalink
Spreadsheet: Removed setPosition() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindkv authored and wwmayer committed Nov 28, 2015
1 parent b748021 commit 87c6af3
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 67 deletions.
19 changes: 0 additions & 19 deletions src/Mod/Spreadsheet/App/Sheet.cpp
Expand Up @@ -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);

Expand Down Expand Up @@ -452,18 +450,6 @@ std::map<int, int> 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.
Expand Down Expand Up @@ -845,11 +831,6 @@ DocumentObjectExecReturn *Sheet::execute(void)
rowHeights.clearDirty();
columnWidths.clearDirty();

positionChanged(CellAddress(currRow.getValue(), currColumn.getValue()));

currRow.purgeTouched();
currColumn.purgeTouched();

std::set<DocumentObject*> ds(cells.getDocDeps());

// Make sure we don't reference ourselves
Expand Down
8 changes: 0 additions & 8 deletions src/Mod/Spreadsheet/App/Sheet.h
Expand Up @@ -162,8 +162,6 @@ class SpreadsheetExport Sheet : public App::DocumentObject

std::map<int, int> getRowHeights() const;

void setPosition(CellAddress address);

// Signals

boost::signal<void (Spreadsheet::CellAddress)> cellUpdated;
Expand All @@ -174,9 +172,6 @@ class SpreadsheetExport Sheet : public App::DocumentObject

boost::signal<void (int, int)> rowHeightChanged;

boost::signal<void (CellAddress)> positionChanged;


/** @name Access properties */
//@{
App::Property* addDynamicProperty(
Expand Down Expand Up @@ -285,9 +280,6 @@ class SpreadsheetExport Sheet : public App::DocumentObject
/* Row heights */
PropertyRowHeights rowHeights;

App::PropertyInteger currRow;
App::PropertyInteger currColumn;

/* Dependencies to other documents */
App::PropertyLinkList docDeps;

Expand Down
5 changes: 0 additions & 5 deletions src/Mod/Spreadsheet/App/SheetPy.xml
Expand Up @@ -155,10 +155,5 @@
<UserDocu>Get given spreadsheet row height</UserDocu>
</Documentation>
</Methode>
<Methode Name="setPosition">
<Documentation>
<UserDocu>Set focused cell for attached view(s).</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>
19 changes: 0 additions & 19 deletions src/Mod/Spreadsheet/App/SheetPyImp.cpp
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/Mod/Spreadsheet/Gui/Command.cpp
Expand Up @@ -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()");
}
}
Expand Down
13 changes: 0 additions & 13 deletions src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp
Expand Up @@ -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));
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/Mod/Spreadsheet/Gui/SpreadsheetView.h
Expand Up @@ -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);
Expand Down

0 comments on commit 87c6af3

Please sign in to comment.