From 7a62e8e3601ee98f5f06261c361fe8132334cd56 Mon Sep 17 00:00:00 2001 From: ar Date: Sat, 12 Jun 2004 09:24:00 +0000 Subject: - rename sheet-qt -> opie-sheet - format source code for a better readability --- (limited to 'noncore/apps/opie-sheet/sheet.h') diff --git a/noncore/apps/opie-sheet/sheet.h b/noncore/apps/opie-sheet/sheet.h index f705cd0..92c8061 100644 --- a/noncore/apps/opie-sheet/sheet.h +++ b/noncore/apps/opie-sheet/sheet.h @@ -1,11 +1,30 @@ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* + =. This file is part of the Opie Project + .=l. Copyright (C) 2004 Opie Developer Team + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ /* * Opie Sheet (formerly Sheet/Qt) @@ -15,23 +34,24 @@ #ifndef SHEET_H #define SHEET_H +/* QT */ #include #include typedef struct typeCellBorders { - QPen right, bottom; + QPen right, bottom; }; typedef struct typeCellData { - int col, row; - typeCellBorders borders; - QBrush background; - Qt::AlignmentFlags alignment; - QColor fontColor; - QFont font; - QString data; + int col, row; + typeCellBorders borders; + QBrush background; + Qt::AlignmentFlags alignment; + QColor fontColor; + QFont font; + QString data; }; @@ -45,36 +65,36 @@ typedef struct typeCellData class Expression { public: - QString Body; - QList CompiledBody; - QList CompiledBodyType; - QString SYMBOL; - QString MATHSYMBOL; - QArray ArgsOfFunc; - int FuncDepth; - bool ErrorFound; - int n; // holds the current parser position - QString chunk; // the piece in the parser we are on - int SymbGroup; // the current type - - QString InExpr; - - QChar chunk0(void); // retunrs the first char of expression; - Expression(QString expr1);// constructor - - bool isSymbol(QChar ch); - bool isMathSymbol(QChar ch); - void GetNext(); - void First(); - void Third(); - void Fourth(); - void Fifth(); - void Sixth(); - void Seventh(); - void Eighth(); - void Ninth(); - - bool Expression::Parse(); //parses the expression in RPN format; + QString Body; + QList CompiledBody; + QList CompiledBodyType; + QString SYMBOL; + QString MATHSYMBOL; + QArray ArgsOfFunc; + int FuncDepth; + bool ErrorFound; + int n; // holds the current parser position + QString chunk; // the piece in the parser we are on + int SymbGroup; // the current type + + QString InExpr; + + QChar chunk0(void); // retunrs the first char of expression; + Expression(QString expr1);// constructor + + bool isSymbol(QChar ch); + bool isMathSymbol(QChar ch); + void GetNext(); + void First(); + void Third(); + void Fourth(); + void Fifth(); + void Sixth(); + void Seventh(); + void Eighth(); + void Ninth(); + + bool Expression::Parse(); //parses the expression in RPN format; }; @@ -82,83 +102,83 @@ public: class Sheet: public QTable { - Q_OBJECT - - // Variables - bool clicksLocked; - int selectionNo; - typeCellBorders defaultBorders; - typeCellData defaultCellData; - - // QT objects - QList sheetData, clipboardData; - QString pressedCell, releasedCell, sheetName; - QStringList listDataParser; - - // Private functions - bool findRowColumn(const QString &variable, int *row, int *col, bool giveError=FALSE); - QString findCellName(int row, int col); - bool findRange(const QString &variable1, const QString &variable2, int *row1, int *col1, int *row2, int *col2); - QString calculateVariable(const QString &variable); - QString calculateFunction(const QString &func, const QString ¶meters, int NumOfParams); - QString getParameter(const QString ¶meters, int paramNo, bool giveError=FALSE, const QString funcName=""); - QString dataParser(const QString &cell, const QString &data); - QString dataParserHelper(const QString &data); - typeCellData *createCellData(int row, int col); - typeCellData *findCellData(int row, int col); - - -//LOGICAL / INFO - double functionCountIf(const QString ¶m1, const QString ¶m2, const QString ¶m3); - double functionSumSQ(const QString ¶m1, const QString ¶m2); //sum of squares - QString functionIndex(const QString ¶m1, const QString ¶m2, int indx); -//math functions computations - double BesselI0(double x); - double BesselI(int n, double x); - double BesselK0(double x); - double BesselI1(double x); - double BesselK1(double x); - double BesselK(int n, double x); - double BesselJ0(double x); - double BesselY0(double x); - double BesselJ1(double x); - double BesselY1(double x); - double BesselY(int n, double x); - double BesselJ(int n, double x); - double GammaLn(double xx); - double Factorial(double n); - double GammaP(double a, double x); - double GammaQ(double a,double x); - void GammaSeries(double *gamser, double a, double x, double *gln); - void GammaContinuedFraction(double *gammcf, double a, double x, double *gln); - double ErrorFunction(double x); - double ErrorFunctionComplementary(double x); - double Beta(double z, double w); - double BetaContinuedFraction(double a, double b, double x); - double BetaIncomplete(double a, double b, double x); - double functionVariance(const QString ¶m1, const QString ¶m2); - double functionVariancePopulation(const QString ¶m1, const QString ¶m2); - double functionSkew(const QString ¶m1, const QString ¶m2); - double functionKurt(const QString ¶m1, const QString ¶m2); - - // Sheet/Qt parser functions - double functionSum(const QString ¶m1, const QString ¶m2); - double functionAvg(const QString ¶m1, const QString ¶m2); - double functionMax(const QString ¶m1, const QString ¶m2); - double functionMin(const QString ¶m1, const QString ¶m2); - double functionCount(const QString ¶m1, const QString ¶m2); - - // Reimplemented QTable functions - void paintCell(QPainter *p, int row, int col, const QRect & cr, bool selected); - void viewportMousePressEvent(QMouseEvent *e); - void viewportMouseMoveEvent(QMouseEvent *e); - void viewportMouseReleaseEvent(QMouseEvent *e); - - public slots: + Q_OBJECT + + // Variables + bool clicksLocked; + int selectionNo; + typeCellBorders defaultBorders; + typeCellData defaultCellData; + + // QT objects + QList sheetData, clipboardData; + QString pressedCell, releasedCell, sheetName; + QStringList listDataParser; + + // Private functions + bool findRowColumn(const QString &variable, int *row, int *col, bool giveError=FALSE); + QString findCellName(int row, int col); + bool findRange(const QString &variable1, const QString &variable2, int *row1, int *col1, int *row2, int *col2); + QString calculateVariable(const QString &variable); + QString calculateFunction(const QString &func, const QString ¶meters, int NumOfParams); + QString getParameter(const QString ¶meters, int paramNo, bool giveError=FALSE, const QString funcName=""); + QString dataParser(const QString &cell, const QString &data); + QString dataParserHelper(const QString &data); + typeCellData *createCellData(int row, int col); + typeCellData *findCellData(int row, int col); + + + //LOGICAL / INFO + double functionCountIf(const QString ¶m1, const QString ¶m2, const QString ¶m3); + double functionSumSQ(const QString ¶m1, const QString ¶m2); //sum of squares + QString functionIndex(const QString ¶m1, const QString ¶m2, int indx); + //math functions computations + double BesselI0(double x); + double BesselI(int n, double x); + double BesselK0(double x); + double BesselI1(double x); + double BesselK1(double x); + double BesselK(int n, double x); + double BesselJ0(double x); + double BesselY0(double x); + double BesselJ1(double x); + double BesselY1(double x); + double BesselY(int n, double x); + double BesselJ(int n, double x); + double GammaLn(double xx); + double Factorial(double n); + double GammaP(double a, double x); + double GammaQ(double a,double x); + void GammaSeries(double *gamser, double a, double x, double *gln); + void GammaContinuedFraction(double *gammcf, double a, double x, double *gln); + double ErrorFunction(double x); + double ErrorFunctionComplementary(double x); + double Beta(double z, double w); + double BetaContinuedFraction(double a, double b, double x); + double BetaIncomplete(double a, double b, double x); + double functionVariance(const QString ¶m1, const QString ¶m2); + double functionVariancePopulation(const QString ¶m1, const QString ¶m2); + double functionSkew(const QString ¶m1, const QString ¶m2); + double functionKurt(const QString ¶m1, const QString ¶m2); + + // Sheet/Qt parser functions + double functionSum(const QString ¶m1, const QString ¶m2); + double functionAvg(const QString ¶m1, const QString ¶m2); + double functionMax(const QString ¶m1, const QString ¶m2); + double functionMin(const QString ¶m1, const QString ¶m2); + double functionCount(const QString ¶m1, const QString ¶m2); + + // Reimplemented QTable functions + void paintCell(QPainter *p, int row, int col, const QRect & cr, bool selected); + void viewportMousePressEvent(QMouseEvent *e); + void viewportMouseMoveEvent(QMouseEvent *e); + void viewportMouseReleaseEvent(QMouseEvent *e); + +public slots: void slotCellSelected(int row, int col); void slotCellChanged(int row, int col); - public: +public: Sheet(int numRows, int numCols, QWidget *parent); ~Sheet(); void ReCalc(void); @@ -195,14 +215,14 @@ class Sheet: public QTable static int getHeaderColumn(const QString §ion); static QString getHeaderString(int section); - public slots: +public slots: void editCut(); void editCopy(); void editPaste(bool onlyContents=FALSE); void editClear(); void swapCells(int row1, int col1, int row2, int col2); - signals: +signals: void currentDataChanged(const QString &data); void cellClicked(const QString &cell); void sheetModified(); -- cgit v0.9.0.2