/* Copyright (C) 2010 Andres Cabrera mantaraya36@gmail.com This file is part of CsoundQt. CsoundQt is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. CsoundQt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Csound; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef QUTESHEET_H #define QUTESHEET_H #include #include #include #include "eventsheet.h" class QuteCells { }; class QuteSheet : public QObject { Q_OBJECT public: QuteSheet(QObject *parent = 0, EventSheet *sheet = 0); void setSheetPointer(EventSheet *sheet); public slots: // add a constructor QuteSheet* new_QuteSheet() { return new QuteSheet(); } // add a destructor void delete_QuteSheet(QuteSheet* o) { delete o; } QString text(QuteSheet* o) { return o->rowsToText(o->data()); } QList > allRows(QuteSheet* o) { return o->data(); } QString selectionText(QuteSheet* o) { return o->rowsToText(o->selectionRows(o)); } QList selection(QuteSheet* o) { return o->getValuesByRow(selectionRows(o)); } QList > selectionRows(QuteSheet* o) { return o->someCols(o->data(), startRow, numRows, startCol, numCols); } QList > selectionFullRows(QuteSheet* o) { return o->allCols(o->data(), startRow, numRows); } void setCellValue(QuteSheet* o, int row, int column, QVariant data) {return o->setSheetCellValue(row, column, data); } bool setRows(QList > new_data, int new_startRow = -1, int new_startCol = -1, int new_numRows = -1, int new_numCols = -1); bool setValues(QList new_data, int new_startRow = -1, int new_startCol = -1, int new_numRows = -1, int new_numCols = -1); bool setText(QString text, int new_startRow = -1, int new_startCol = -1, int new_numRows = -1, int new_numCols = -1); // Helper functions QList > sort(QList > vectors, int p_field = 2); QList > transpose(QList > mtx); QString rowsToText(QList > data); private: QList > data(); bool testConsistency(); void setSheetCellValue(int row, int column, QVariant data); QList getValuesByRow(QList > data); QList > someCols(QList > data, int row, int numRows, int col, int numCols); QList > allCols(QList > data, int row, int numRows); bool writeOutFile(QString text); EventSheet * m_sheet; int startRow; int startCol; int numRows; int numCols; int totalRows; int totalCols; }; #endif // QUTESHEET_H