Source Code (Use browser search to find items of interest.)
Class Index
kspread'QtCalculator (./koffice/kspread/plugins/calculator/kcalc.h:196)
class QtCalculator : public QDialog
{
Q_OBJECT
public:
QtCalculator( Calculator* _corba, QWidget *parent=0, const char *name=0 );
~QtCalculator();
void keyPressEvent( QKeyEvent *e );
void keyReleaseEvent( QKeyEvent *e );
void closeEvent( QCloseEvent *e );
void writeSettings();
void readSettings();
void set_precision();
void set_display_font();
void set_style();
void temp_stack_next();
void temp_stack_prev();
void ComputeMean();
void ComputeSin();
void ComputeStd();
void ComputeCos();
void ComputeMedean();
void ComputeTan();
void ComputeSum();
void ComputeMul();
void ComputeMin();
void ComputeMax();
void setLabel( const char *_text );
void setValue( double _value );
void setData( const QRect& _range, const char *_table );
void useData();
public slots:
void helpclicked();
void set_colors();
void display_selected();
void invertColors();
void quitCalc();
void selection_timed_out();
void clear_buttons();
void clear_status_label();
void setStatusLabel(const QString&);
void EnterDigit(int data);
void EnterDecimal();
void EnterStackFunction(int data);
void EnterNegate();
void EnterOpenParen();
void EnterCloseParen();
void EnterRecip();
void EnterInt();
void EnterFactorial();
void EnterSquare();
void EnterNotCmp();
void EnterHyp();
void EnterPercent();
void EnterLogr();
void EnterLogn();
void SetDeg();
void SetGra();
void SetRad();
void SetHex();
void SetOct();
void SetBin();
void SetDec();
void Deg_Selected();
void Rad_Selected();
void Gra_Selected();
void Hex_Selected();
void Dec_Selected();
void Oct_Selected();
void Bin_Selected();
void SetInverse();
void EnterEqual();
void Clear();
void ClearAll();
void RefreshCalculator(void);
void InitializeCalculator(void);
void UpdateDisplay();
void ExecSin();
void ExecCos();
void ExecTan();
void button0();
void button1();
void button2();
void button3();
void button4();
void button5();
void button6();
void button7();
void button8();
void button9();
void buttonA();
void buttonB();
void buttonC();
void buttonD();
void buttonE();
void buttonF();
void base_selected(int number);
void angle_selected(int number);
void Or();
void And();
void Shift();
void Plus();
void Minus();
void Multiply();
void Divide();
void Mod();
void Power();
void EE();
void MR();
void Mplusminus();
void MC();
void exit();
void EEtoggled(bool myboolean);
void pbinvtoggled(bool myboolean);
void pbMRtoggled(bool myboolean);
void pbAtoggled(bool myboolean);
void pbSintoggled(bool myboolean);
void pbplusminustoggled(bool myboolean);
void pbMplusminustoggled(bool myboolean);
void pbBtoggled(bool myboolean);
void pbCostoggled(bool myboolean);
void pbrecitoggled(bool myboolean);
void pbCtoggled(bool myboolean);
void pbTantoggled(bool myboolean);
void pbfactorialtoggled(bool myboolean);
void pbDtoggled(bool myboolean);
void pblogtoggled(bool myboolean);
void pbsquaretoggled(bool myboolean);
void pbEtoggled(bool myboolean);
void pblntoggled(bool myboolean);
void pbpowertoggled(bool myboolean);
void pbFtoggled(bool myboolean);
void pbMCtoggled(bool myboolean);
void pbCleartoggled(bool myboolean);
void pbACtoggled(bool myboolean);
void pb7toggled(bool myboolean);
void pb8toggled(bool myboolean);
void pb9toggled(bool myboolean);
void pbparenopentoggled(bool myboolean);
void pbparenclosetoggled(bool myboolean);
void pbandtoggled(bool myboolean);
void pb4toggled(bool myboolean);
void pb5toggled(bool myboolean);
void pb6toggled(bool myboolean);
void pbXtoggled(bool myboolean);
void pbdivisiontoggled(bool myboolean);
void pbortoggled(bool myboolean);
void pb1toggled(bool myboolean);
void pb2toggled(bool myboolean);
void pb3toggled(bool myboolean);
void pbplustoggled(bool myboolean);
void pbminustoggled(bool myboolean);
void pbshifttoggled(bool myboolean);
void pbperiodtoggled(bool myboolean);
void pb0toggled(bool myboolean);
void pbequaltoggled(bool myboolean);
void pbpercenttoggled(bool myboolean);
void pbnegatetoggled(bool myboolean);
void pbmodtoggled(bool myboolean);
void pbhyptoggled(bool myboolean);
void configclicked();
public:
DefStruct kcalcdefaults;
private:
QTimer* selection_timer;
QLabel* statusINVLabel;
QLabel* statusHYPLabel;
QLabel* statusERRORLabel;
DLabel* calc_display;
QRadioButton* anglebutton[3];
QRadioButton* basebutton[4];
QPushButton* pbhyp;
QPushButton* pbEE;
QPushButton* pbinv;
QPushButton* pbMR;
QPushButton* pbA;
QPushButton* pbSin;
QPushButton* pbplusminus;
QPushButton* pbMplusminus;
QPushButton* pbB;
QPushButton* pbCos;
QPushButton* pbreci;
QPushButton* pbC;
QPushButton* pbTan;
QPushButton* pbfactorial;
QPushButton* pbD;
QPushButton* pblog;
QPushButton* pbsquare;
QPushButton* pbE;
QPushButton* pbln;
QPushButton* pbpower;
QPushButton* pbF;
QPushButton* pbMC;
QPushButton* pbClear;
QPushButton* pbAC;
QPushButton* pb7;
QPushButton* pb8;
QPushButton* pb9;
QPushButton* pbparenopen;
QPushButton* pbparenclose;
QPushButton* pband;
QPushButton* pb4;
QPushButton* pb5;
QPushButton* pb6;
QPushButton* pbX;
QPushButton* pbdivision;
QPushButton* pbor;
QPushButton* pb1;
QPushButton* pb2;
QPushButton* pb3;
QPushButton* pbplus;
QPushButton* pbminus;
QPushButton* pbshift;
QPushButton* pbperiod;
QPushButton* pb0;
QPushButton* pbequal;
QPushButton* pbpercent;
QPushButton* pbnegate;
QPushButton* pbmod;
bool key_pressed;
int buttonxmargin;
int myxmargin, myymargin, bigbuttonwidth, smallbuttonwidth;
int bigbuttonheight, smallbuttonheight;
int anglegroupheight, anglegroupwidth;
int basegroupheight, basegroupwidth;
int helpbuttonwidth, helpbuttonheight;
int displaywidth, displayheight;
int radiobuttonwidth, radiobuttonheight;
KStats stats;
QListBox *paper;
QTimer *status_timer;
QRect table_range;
QString table_name;
Calculator* corba;
};
kspread'QtCalculator::QtCalculator() (./koffice/kspread/plugins/calculator/kcalc.cpp:44)
QtCalculator :: QtCalculator( Calculator *_corba, QWidget *parent, const char *name )
: QDialog( parent, name )
{
int u = 0;
corba = _corba;
myxmargin = 9;
myymargin = 9;
bigbuttonwidth = 30;
bigbuttonheight = 23;
smallbuttonwidth = 30;
smallbuttonheight = 20;
anglegroupheight = 36;
anglegroupwidth = 144;
basegroupwidth = 189;
basegroupheight = anglegroupheight;
helpbuttonwidth = 100;
helpbuttonheight = 25;
displaywidth = 233;
displayheight = helpbuttonheight;
radiobuttonwidth = 37;
radiobuttonheight = 15;
int x,y;
key_pressed = false;
selection_timer = new QTimer;
status_timer = new QTimer;
connect(status_timer,SIGNAL(timeout()),this,SLOT(clear_status_label()));
connect(selection_timer,SIGNAL(timeout()),this,SLOT(selection_timed_out()));
readSettings();
QFont buttonfont( "-misc-fixed-medium-*-semicondensed-*-13-*-*-*-*-*-*-*" );
buttonfont.setRawMode( true );
// Set the window caption/title
// connect(kapp,SIGNAL(kdisplayPaletteChanged()),this,SLOT(set_colors()));
// setCaption( kapp->caption() );
// create help button
QPushButton *pb;
pb = new QPushButton( this, "helpbutton" );
pb->setText( "kCalc" );
pb->setGeometry(myxmargin,myymargin, helpbuttonwidth,helpbuttonheight );
pb->setFont( QFont("times",12,QFont::Bold,FALSE) );
QToolTip::add( pb, i18n("KCalc Setup/Help") );
connect( pb, SIGNAL(clicked()), SLOT(configclicked()) );
// Create the display
calc_display = new DLabel( this, "display" );
calc_display->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
calc_display->setAlignment( AlignRight|AlignVCenter );
calc_display->setGeometry( myxmargin + helpbuttonwidth + myxmargin ,
myymargin , displaywidth ,displayheight );
calc_display->setFocus();
calc_display->setFocusPolicy( QWidget::StrongFocus );
connect(calc_display,SIGNAL(clicked()),this,SLOT(display_selected()));
statusINVLabel = new QLabel( this, "INV" );
CHECK_PTR( statusINVLabel );
statusINVLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
statusINVLabel->setAlignment( AlignCenter );
statusINVLabel->setGeometry(8,218,50 -1 , 20);
statusINVLabel->setText("NORM");
statusINVLabel->setFont(buttonfont);
statusHYPLabel = new QLabel( this, "HYP" );
CHECK_PTR( statusHYPLabel );
statusHYPLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
statusHYPLabel->setAlignment( AlignCenter );
statusHYPLabel->setGeometry(58 ,218,50 -1, 20);
statusHYPLabel->setFont(buttonfont);
statusERRORLabel = new QLabel( this, "ERROR" );
CHECK_PTR( statusERRORLabel );
statusERRORLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
statusERRORLabel->setAlignment( AlignLeft|AlignVCenter );
statusERRORLabel->setGeometry(108 ,218,9 + 100 + 9 + 233 + 9 - 100 - 16, 20);
statusERRORLabel->setFont(QFont("Hevetica",12));
// create angle button group
x = myxmargin + basegroupwidth + myxmargin;
y = myymargin + displayheight + myymargin/2;
QAccel *accel = new QAccel( this );
accel->connectItem( accel->insertItem(Key_Q+ALT),this,SLOT(quitCalc()) );
accel->connectItem( accel->insertItem(Key_X+ALT),this,SLOT(quitCalc()) );
QButtonGroup *angle_group = new QButtonGroup( this, "AngleButtons" );
angle_group->setFont(buttonfont);
angle_group->setTitle(i18n( "Angle") );
anglebutton[0] = new QRadioButton( angle_group );
anglebutton[0]->setText( "&Deg" ) ;
anglebutton[0]->setGeometry( 10,anglegroupheight/2 -2,
radiobuttonwidth,radiobuttonheight);
anglebutton[0]->setChecked( TRUE);
accel->connectItem( accel->insertItem(Key_D + ALT), this ,
SLOT(Deg_Selected()) );
anglebutton[1] = new QRadioButton( angle_group );
anglebutton[1]->setText( "&Rad" );
anglebutton[1]->setGeometry( 10 + radiobuttonwidth+ 8,anglegroupheight/2 - 2,
radiobuttonwidth,radiobuttonheight );
accel->connectItem( accel->insertItem(Key_R + ALT), this ,
SLOT(Rad_Selected()) );
anglebutton[2] = new QRadioButton( angle_group );
anglebutton[2]->setText( "&Gra" );
anglebutton[2]->setGeometry( 10 +2* radiobuttonwidth+ 16 ,anglegroupheight/2 -2,
radiobuttonwidth, radiobuttonheight );
accel->connectItem( accel->insertItem(Key_G + ALT), this ,
SLOT(Gra_Selected()) );
for(u = 0;u <3;u++) anglebutton[u]->setFont(buttonfont);
angle_group->setGeometry( x, y, anglegroupwidth, anglegroupheight );
connect( angle_group, SIGNAL(clicked(int)), SLOT(angle_selected(int)) );
//////////////////////////////////////////////////////////////////////
//
// Create Number Base Button Group
//
QButtonGroup *base_group = new QButtonGroup( this, "BaseButtons" );
base_group->setFont(buttonfont);
base_group->setTitle( i18n("Base") );
basebutton[0] = new QRadioButton( base_group );
basebutton[0]->setText( "&Hex" );
basebutton[0]->setGeometry( 10 , basegroupheight/2 -2,
radiobuttonwidth, radiobuttonheight );
accel->connectItem( accel->insertItem(Key_H + ALT), this ,
SLOT(Hex_Selected()) );
basebutton[1] = new QRadioButton( base_group );
basebutton[1]->setText( "D&ec" );
basebutton[1]->setGeometry( 10 + radiobuttonwidth +8 , basegroupheight/2 -2,
radiobuttonwidth, radiobuttonheight );
basebutton[1]->setChecked(TRUE);
accel->connectItem( accel->insertItem(Key_E + ALT), this ,
SLOT(Dec_Selected()) );
basebutton[2] = new QRadioButton( base_group );
basebutton[2]->setText( "&Oct" );
basebutton[2]->setGeometry( 10 + 2*radiobuttonwidth + 16, basegroupheight/2 -2,
radiobuttonwidth, radiobuttonheight );
accel->connectItem( accel->insertItem(Key_O + ALT), this ,
SLOT(Oct_Selected()) );
basebutton[3] = new QRadioButton( base_group);
basebutton[3]->setText( "&Bin" );
basebutton[3]->setGeometry( 10 + 3*radiobuttonwidth + 24, basegroupheight/2 -2,
radiobuttonwidth, radiobuttonheight );
accel->connectItem( accel->insertItem(Key_B + ALT), this ,
SLOT(Bin_Selected()) );
for(u = 0;u <4;u++) basebutton[u]->setFont(buttonfont);
myxmargin = 9;
base_group->setGeometry( myxmargin,y, basegroupwidth,basegroupheight );
connect( base_group, SIGNAL(clicked(int)), SLOT(base_selected(int)) );
////////////////////////////////////////////////////////////////////////
//
// Create Calculator Buttons
//
buttonxmargin = 9;
y = myymargin + displayheight + myymargin/2 + basegroupheight + myymargin/2;
myymargin = 6;
pbhyp = new QPushButton( this, "hypbutton" );
pbhyp->setText( "Hyp" );
pbhyp->setGeometry(buttonxmargin,y, smallbuttonwidth,smallbuttonheight );
connect( pbhyp, SIGNAL(toggled(bool)), SLOT(pbhyptoggled(bool)));
pbhyp->setToggleButton(TRUE);
pbhyp->setFont(buttonfont);
pbinv = new QPushButton( this, "InverseButton" );
pbinv->setText( "Inv" );
pbinv->setGeometry(buttonxmargin + buttonxmargin + smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbinv, SIGNAL(toggled(bool)), SLOT(pbinvtoggled(bool)));
pbinv->setToggleButton(TRUE);
pbinv->setFont(buttonfont);
pbA = new QPushButton( this, "Abutton" );
pbA->setText( "A" );
pbA->setGeometry(buttonxmargin + buttonxmargin + buttonxmargin + 2*smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbA, SIGNAL(toggled(bool)), SLOT(pbAtoggled(bool)));
pbA->setToggleButton(TRUE);
pbA->setFont(buttonfont);
y = y + myymargin/2 + smallbuttonheight;
pbSin = new QPushButton( this, "Sinbutton" );
pbSin->setText( "Sin" );
pbSin->setGeometry(buttonxmargin,y, smallbuttonwidth,smallbuttonheight );
connect( pbSin, SIGNAL(toggled(bool)), SLOT(pbSintoggled(bool)));
pbSin->setToggleButton(TRUE);
pbSin->setFont(buttonfont);
pbplusminus = new QPushButton( this, "plusminusbutton" );
pbplusminus->setText( "+/-" );
pbplusminus->setGeometry(buttonxmargin + buttonxmargin + smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbplusminus, SIGNAL(toggled(bool)), SLOT(pbplusminustoggled(bool)));
pbplusminus->setToggleButton(TRUE);
pbplusminus->setFont(buttonfont);
pbB = new QPushButton( this, "Bbutton" );
pbB->setText( "B" );
pbB->setGeometry(buttonxmargin + buttonxmargin + buttonxmargin + 2*smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbB, SIGNAL(toggled(bool)), SLOT(pbBtoggled(bool)));
pbB->setToggleButton(TRUE);
pbB->setFont(buttonfont);
y = y + myymargin/2 + smallbuttonheight;
pbCos = new QPushButton( this, "Cosbutton" );
pbCos->setText( "Cos" );
pbCos->setGeometry(buttonxmargin,y, smallbuttonwidth,smallbuttonheight );
connect( pbCos, SIGNAL(toggled(bool)), SLOT(pbCostoggled(bool)));
pbCos->setToggleButton(TRUE);
pbCos->setFont(buttonfont);
pbreci = new QPushButton( this, "recibutton" );
pbreci->setText( "1/x" );
pbreci->setGeometry(buttonxmargin + buttonxmargin + smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbreci, SIGNAL(toggled(bool)), SLOT(pbrecitoggled(bool)));
pbreci->setToggleButton(TRUE);
pbreci->setFont(buttonfont);
pbC = new QPushButton( this, "Cbutton" );
pbC->setText( "C" );
pbC->setGeometry(buttonxmargin + buttonxmargin + buttonxmargin + 2*smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbC, SIGNAL(toggled(bool)), SLOT(pbCtoggled(bool)));
pbC->setToggleButton(TRUE);
pbC->setFont(buttonfont);
y = y + myymargin/2 + smallbuttonheight;
pbTan = new QPushButton( this, "Tanbutton" );
pbTan->setText( "Tan" );
pbTan->setGeometry(buttonxmargin,y, smallbuttonwidth,smallbuttonheight );
connect( pbTan, SIGNAL(toggled(bool)), SLOT(pbTantoggled(bool)));
pbTan->setToggleButton(TRUE);
pbTan->setFont(buttonfont);
pbfactorial = new QPushButton( this, "factorialbutton" );
pbfactorial->setText( "x!" );
pbfactorial->setGeometry(buttonxmargin + buttonxmargin + smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbfactorial, SIGNAL(toggled(bool)), SLOT(pbfactorialtoggled(bool)));
pbfactorial->setToggleButton(TRUE);
pbfactorial->setFont(buttonfont);
pbD = new QPushButton( this, "Dbutton" );
pbD->setText( "D" );
pbD->setGeometry(buttonxmargin + buttonxmargin + buttonxmargin + 2*smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbD, SIGNAL(toggled(bool)), SLOT(pbDtoggled(bool)));
pbD->setToggleButton(TRUE);
pbD->setFont(buttonfont);
y = y + myymargin/2 + smallbuttonheight;
pblog = new QPushButton( this, "logbutton" );
pblog->setText( "Log" );
pblog->setGeometry(buttonxmargin ,y, smallbuttonwidth,smallbuttonheight );
connect( pblog, SIGNAL(toggled(bool)), SLOT(pblogtoggled(bool)));
pblog->setToggleButton(TRUE);
pblog->setFont(buttonfont);
pbsquare = new QPushButton( this, "squarebutton" );
pbsquare->setText( "x^2" );
pbsquare->setGeometry(buttonxmargin + buttonxmargin + smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbsquare, SIGNAL(toggled(bool)), SLOT(pbsquaretoggled(bool)));
pbsquare->setToggleButton(TRUE);
pbsquare->setFont(buttonfont);
pbE = new QPushButton( this, "Ebutton" );
pbE->setText( "E" );
pbE->setGeometry(buttonxmargin + buttonxmargin + buttonxmargin + 2*smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbE, SIGNAL(toggled(bool)), SLOT(pbEtoggled(bool)));
pbE->setToggleButton(TRUE);
pbE->setFont(buttonfont);
y = y + myymargin/2 + smallbuttonheight;
pbln = new QPushButton( this, "lnbutton" );
pbln->setText( "Ln" );
pbln->setGeometry(buttonxmargin,y, smallbuttonwidth,smallbuttonheight );
connect( pbln, SIGNAL(toggled(bool)), SLOT(pblntoggled(bool)));
pbln->setToggleButton(TRUE);
pbln->setFont(buttonfont);
pbpower = new QPushButton( this, "powerbutton" );
pbpower->setText( "x^y" );
pbpower->setGeometry(buttonxmargin + buttonxmargin + smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbpower, SIGNAL(toggled(bool)), SLOT(pbpowertoggled(bool)));
pbpower->setToggleButton(TRUE);
pbpower->setFont(buttonfont);
pbF = new QPushButton( this, "Fbutton" );
pbF->setText( "F" );
pbF->setGeometry(buttonxmargin + buttonxmargin +buttonxmargin + 2*smallbuttonwidth
,y, smallbuttonwidth,smallbuttonheight );
connect( pbF, SIGNAL(toggled(bool)), SLOT(pbFtoggled(bool)));
pbF->setToggleButton(TRUE);
pbF->setFont(buttonfont);
/////////////////////////////////////////////////////////////////////
//
//
myymargin = 9;
y = myymargin + displayheight + myymargin/2 + basegroupheight + myymargin/2;
x = buttonxmargin + buttonxmargin +buttonxmargin + 3*smallbuttonwidth + buttonxmargin;
myymargin = 10;
pbEE = new QPushButton( this, "EEbutton" );
pbEE->setText( "EE" );
pbEE->setGeometry( x
,y, bigbuttonwidth,bigbuttonheight );
pbEE->setToggleButton(TRUE);
connect( pbEE, SIGNAL(toggled(bool)), SLOT(EEtoggled(bool)));
pbEE->setFont(buttonfont);
pbMR = new QPushButton( this, "MRbutton" );
pbMR->setText( "MR" );
pbMR->setGeometry( x + bigbuttonwidth + buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbMR, SIGNAL(toggled(bool)), SLOT(pbMRtoggled(bool)));
pbMR->setToggleButton(TRUE);
pbMR->setFont(buttonfont);
pbMplusminus = new QPushButton( this, "Mplusminusbutton" );
pbMplusminus->setText( "M+-" );
pbMplusminus->setGeometry(x + 2*bigbuttonwidth + 2*buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbMplusminus, SIGNAL(toggled(bool)), SLOT(pbMplusminustoggled(bool)));
pbMplusminus->setToggleButton(TRUE);
pbMplusminus->setFont(buttonfont);
pbMC = new QPushButton( this, "MCbutton" );
pbMC->setText( "MC" );
pbMC->setGeometry(x + 3*bigbuttonwidth + 3*buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbMC, SIGNAL(toggled(bool)), SLOT(pbMCtoggled(bool)));
pbMC->setToggleButton(TRUE);
pbMC->setFont(buttonfont);
pbClear = new QPushButton( this, "Clearbutton" );
pbClear->setText( "C" );
pbClear->setGeometry(x + 4*bigbuttonwidth + 4* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbClear, SIGNAL(toggled(bool)), SLOT(pbCleartoggled(bool)));
pbClear->setToggleButton(TRUE);
pbClear->setFont(buttonfont);
pbAC = new QPushButton( this, "ACbutton" );
pbAC->setText( "AC" );
pbAC->setGeometry(x + 5 * bigbuttonwidth + 5 * buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbAC, SIGNAL(toggled(bool)), SLOT(pbACtoggled(bool)));
pbAC->setToggleButton(TRUE);
pbAC->setFont(buttonfont);
//////////////////////////////////////////////////////////////////////
//
//
y = y + myymargin/2 + bigbuttonheight;
x = buttonxmargin + buttonxmargin +buttonxmargin + 3*smallbuttonwidth + buttonxmargin;
pb7 = new QPushButton( this, "7button" );
pb7->setText( "7" );
pb7->setGeometry(x
,y, bigbuttonwidth,bigbuttonheight );
connect( pb7, SIGNAL(toggled(bool)), SLOT(pb7toggled(bool)));
pb7->setToggleButton(TRUE);
pb7->setFont(buttonfont);
pb8 = new QPushButton( this, "8button" );
pb8->setText( "8" );
pb8->setGeometry(x + bigbuttonwidth + buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pb8, SIGNAL(toggled(bool)), SLOT(pb8toggled(bool)));
pb8->setToggleButton(TRUE);
pb8->setFont(buttonfont);
pb9 = new QPushButton( this, "9button" );
pb9->setText( "9" );
pb9->setGeometry(x + 2*bigbuttonwidth + 2 * buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pb9, SIGNAL(toggled(bool)), SLOT(pb9toggled(bool)));
pb9->setToggleButton(TRUE);
pb9->setFont(buttonfont);
pbparenopen = new QPushButton( this, "parenopenbutton" );
pbparenopen->setText( "(" );
pbparenopen->setGeometry(x + 3 * bigbuttonwidth + 3 * buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbparenopen, SIGNAL(toggled(bool)), SLOT(pbparenopentoggled(bool)));
pbparenopen->setToggleButton(TRUE);
pbparenopen->setFont(buttonfont);
pbparenclose = new QPushButton( this, "parenclosebutton" );
pbparenclose->setText( ")" );
pbparenclose->setGeometry(x + 4* bigbuttonwidth + 4 * buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbparenclose, SIGNAL(toggled(bool)), SLOT(pbparenclosetoggled(bool)));
pbparenclose->setToggleButton(TRUE);
pbparenclose->setFont(buttonfont);
pband = new QPushButton( this, "andbutton" );
pband->setText( "And" );
pband->setGeometry(x + 5 * bigbuttonwidth + 5 * buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pband, SIGNAL(toggled(bool)), SLOT(pbandtoggled(bool)));
pband->setToggleButton(TRUE);
pband->setFont(buttonfont);
//////////////////////////////////////////////////////////////////////
//
//
y = y + myymargin/2 + bigbuttonheight ;
x = buttonxmargin + buttonxmargin +buttonxmargin + 3*smallbuttonwidth + buttonxmargin;
pb4 = new QPushButton( this, "4button" );
pb4->setText( "4" );
pb4->setGeometry(x
,y, bigbuttonwidth,bigbuttonheight );
connect( pb4, SIGNAL(toggled(bool)), SLOT(pb4toggled(bool)));
pb4->setToggleButton(TRUE);
pb4->setFont(buttonfont);
pb5 = new QPushButton( this, "5button" );
pb5->setText( "5" );
pb5->setGeometry(x + bigbuttonwidth + buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pb5, SIGNAL(toggled(bool)), SLOT(pb5toggled(bool)));
pb5->setToggleButton(TRUE);
pb5->setFont(buttonfont);
pb6 = new QPushButton( this, "6button" );
pb6->setText( "6" );
pb6->setGeometry(x + 2*bigbuttonwidth + 2*buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pb6, SIGNAL(toggled(bool)), SLOT(pb6toggled(bool)));
pb6->setToggleButton(TRUE);
pb6->setFont(buttonfont);
pbX = new QPushButton( this, "Multiplybutton" );
pbX->setText( "X" );
pbX->setGeometry(x + 3*bigbuttonwidth + 3*buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbX, SIGNAL(toggled(bool)), SLOT(pbXtoggled(bool)));
pbX->setToggleButton(TRUE);
pbX->setFont(buttonfont);
pbdivision = new QPushButton( this, "divisionbutton" );
pbdivision->setText( "/" );
pbdivision->setGeometry(x + 4*bigbuttonwidth + 4 * buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbdivision, SIGNAL(toggled(bool)), SLOT(pbdivisiontoggled(bool)));
pbdivision->setToggleButton(TRUE);
pbdivision->setFont(buttonfont);
pbor = new QPushButton( this, "orbutton" );
pbor->setText( "Or" );
pbor->setGeometry(x + 5 * bigbuttonwidth + 5 *buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbor, SIGNAL(toggled(bool)), SLOT(pbortoggled(bool)));
pbor->setToggleButton(TRUE);
pbor->setFont(buttonfont);
/////////////////////////////////////////////////////////////////////////////
//
//
y = y + myymargin/2 + bigbuttonheight ;
x = buttonxmargin + buttonxmargin +buttonxmargin + 3*smallbuttonwidth + buttonxmargin;
pb1 = new QPushButton( this, "1button" );
pb1->setText( "1" );
pb1->setGeometry(x
,y, bigbuttonwidth,bigbuttonheight );
//connect( pb1, SIGNAL(clicked()), SLOT(button1()) );
connect( pb1, SIGNAL(toggled(bool)), SLOT(pb1toggled(bool)));
pb1->setToggleButton(TRUE);
pb1->setFont(buttonfont);
pb2 = new QPushButton( this, "2button" );
pb2->setText( "2" );
pb2->setGeometry(x + bigbuttonwidth + buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pb2, SIGNAL(toggled(bool)), SLOT(pb2toggled(bool)));
pb2->setToggleButton(TRUE);
pb2->setFont(buttonfont);
pb3 = new QPushButton( this, "3button" );
pb3->setText( "3" );
pb3->setGeometry(x + 2* bigbuttonwidth + 2* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pb3, SIGNAL(toggled(bool)), SLOT(pb3toggled(bool)));
pb3->setToggleButton(TRUE);
pb3->setFont(buttonfont);
pbplus = new QPushButton( this, "plusbutton" );
pbplus->setText( "+" );
pbplus->setGeometry(x + 3* bigbuttonwidth + 3* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbplus, SIGNAL(toggled(bool)), SLOT(pbplustoggled(bool)));
pbplus->setToggleButton(TRUE);
pbplus->setFont(buttonfont);
pbminus = new QPushButton( this, "minusbutton" );
pbminus->setText( "-" );
pbminus->setGeometry(x + 4* bigbuttonwidth + 4* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbminus, SIGNAL(toggled(bool)), SLOT(pbminustoggled(bool)));
pbminus->setToggleButton(TRUE);
pbminus->setFont(buttonfont);
pbshift = new QPushButton( this, "shiftbutton" );
pbshift->setText( "Lsh" );
pbshift->setGeometry(x + 5* bigbuttonwidth + 5* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbshift, SIGNAL(toggled(bool)), SLOT(pbshifttoggled(bool)));
pbshift->setToggleButton(TRUE);
pbshift->setFont(buttonfont);
///////////////////////////////////////////////////////////////////////////
//
//
y = y + myymargin/2 + bigbuttonheight ;
x = buttonxmargin + buttonxmargin +buttonxmargin + 3*smallbuttonwidth + buttonxmargin;
pbperiod = new QPushButton( this, "periodbutton" );
pbperiod->setText( "." );
pbperiod->setGeometry(x
,y, bigbuttonwidth,bigbuttonheight );
connect( pbperiod, SIGNAL(toggled(bool)), SLOT(pbperiodtoggled(bool)));
pbperiod->setToggleButton(TRUE);
pbperiod->setFont(buttonfont);
pb0 = new QPushButton( this, "0button" );
pb0->setText( "0" );
pb0->setGeometry(x + 1* bigbuttonwidth + 1* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pb0, SIGNAL(toggled(bool)), SLOT(pb0toggled(bool)));
pb0->setToggleButton(TRUE);
pb0->setFont(buttonfont);
pbequal = new QPushButton( this, "equalbutton" );
pbequal->setText( "=" );
pbequal->setGeometry(x + 2* bigbuttonwidth + 2* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbequal, SIGNAL(toggled(bool)), SLOT(pbequaltoggled(bool)));
pbequal->setToggleButton(TRUE);
pbequal->setFont(buttonfont);
pbpercent = new QPushButton( this, "percentbutton" );
pbpercent->setText( "%" );
pbpercent->setGeometry(x + 3* bigbuttonwidth + 3* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbpercent, SIGNAL(toggled(bool)), SLOT(pbpercenttoggled(bool)));
pbpercent->setToggleButton(TRUE);
pbpercent->setFont(buttonfont);
pbnegate = new QPushButton( this, "OneComplementbutton" );
pbnegate->setText( "Cmp" );
pbnegate->setGeometry(x + 4* bigbuttonwidth + 4* buttonxmargin
,y, bigbuttonwidth, bigbuttonheight );
connect( pbnegate, SIGNAL(toggled(bool)), SLOT(pbnegatetoggled(bool)));
pbnegate->setToggleButton(TRUE);
pbnegate->setFont(buttonfont);
pbmod = new QPushButton( this, "modbutton" );
pbmod->setText( "Mod" );
pbmod->setGeometry(x + 5* bigbuttonwidth + 5* buttonxmargin
,y, bigbuttonwidth,bigbuttonheight );
connect( pbmod, SIGNAL(toggled(bool)), SLOT(pbmodtoggled(bool)));
pbmod->setToggleButton(TRUE);
pbmod->setFont(buttonfont);
set_colors();
set_display_font();
set_precision();
set_style();
/* paper = new QListBox(0,"paper");
paper->resize(200,400);
paper->show();*/
InitializeCalculator();
}
kspread'QtCalculator::~QtCalculator() (./koffice/kspread/plugins/calculator/kcalc.cpp:688)
QtCalculator::~QtCalculator()
{
}
kspread'QtCalculator::exit() (./koffice/kspread/plugins/calculator/kcalc.cpp:692)
void QtCalculator::exit()
{
// QApplication::exit();
}
kspread'QtCalculator::Hex_Selected() (./koffice/kspread/plugins/calculator/kcalc.cpp:697)
void QtCalculator::Hex_Selected()
{
basebutton[0]->setChecked(TRUE);
basebutton[1]->setChecked(FALSE);
basebutton[2]->setChecked(FALSE);
basebutton[3]->setChecked(FALSE);
SetHex();
}
kspread'QtCalculator::Dec_Selected() (./koffice/kspread/plugins/calculator/kcalc.cpp:707)
void QtCalculator::Dec_Selected()
{
basebutton[0]->setChecked(FALSE);
basebutton[1]->setChecked(TRUE);
basebutton[2]->setChecked(FALSE);
basebutton[3]->setChecked(FALSE);
SetDec();
}
kspread'QtCalculator::Oct_Selected() (./koffice/kspread/plugins/calculator/kcalc.cpp:717)
void QtCalculator::Oct_Selected()
{
basebutton[0]->setChecked(FALSE);
basebutton[1]->setChecked(FALSE);
basebutton[2]->setChecked(TRUE);
basebutton[3]->setChecked(FALSE);
SetOct();
}
kspread'QtCalculator::Bin_Selected() (./koffice/kspread/plugins/calculator/kcalc.cpp:728)
void QtCalculator::Bin_Selected()
{
basebutton[0]->setChecked(FALSE);
basebutton[1]->setChecked(FALSE);
basebutton[2]->setChecked(FALSE);
basebutton[3]->setChecked(TRUE);
SetBin();
}
kspread'QtCalculator::Deg_Selected() (./koffice/kspread/plugins/calculator/kcalc.cpp:737)
void QtCalculator::Deg_Selected()
{
anglebutton[0]->setChecked(TRUE);
anglebutton[1]->setChecked(FALSE);
anglebutton[2]->setChecked(FALSE);
SetDeg();
}
kspread'QtCalculator::Rad_Selected() (./koffice/kspread/plugins/calculator/kcalc.cpp:746)
void QtCalculator::Rad_Selected()
{
anglebutton[0]->setChecked(FALSE);
anglebutton[1]->setChecked(TRUE);
anglebutton[2]->setChecked(FALSE);
SetRad();
}
kspread'QtCalculator::Gra_Selected() (./koffice/kspread/plugins/calculator/kcalc.cpp:756)
void QtCalculator::Gra_Selected()
{
anglebutton[0]->setChecked(FALSE);
anglebutton[1]->setChecked(FALSE);
anglebutton[2]->setChecked(TRUE);
SetGra();
}
kspread'QtCalculator::helpclicked() (./koffice/kspread/plugins/calculator/kcalc.cpp:765)
void QtCalculator::helpclicked(){
// kapp->invokeHTMLHelp("","");
}
kspread'QtCalculator::keyPressEvent() (./koffice/kspread/plugins/calculator/kcalc.cpp:771)
void QtCalculator::keyPressEvent( QKeyEvent *e ){
switch (e->key() ){
case Key_F1:
helpclicked();
break;
case Key_F2:
configclicked();
break;
case Key_F3:
if(kcalcdefaults.style == 0)
kcalcdefaults.style = 1;
else if(kcalcdefaults.style == 1)
kcalcdefaults.style = 2;
else
kcalcdefaults.style = 0;
set_style();
break;
case Key_Up:
temp_stack_prev();
break;
case Key_Down:
temp_stack_next();
break;
case Key_Next:
key_pressed = TRUE;
pbAC->setOn(TRUE);
break;
case Key_Prior:
key_pressed = TRUE;
pbClear->setOn(TRUE);
break;
case Key_H:
key_pressed = TRUE;
pbhyp->setOn(TRUE);
break;
case Key_I:
key_pressed = TRUE;
pbinv->setOn(TRUE);
break;
case Key_A:
key_pressed = TRUE;
pbA->setOn(TRUE);
break;
case Key_E:
key_pressed = TRUE;
if (current_base == NB_HEX)
pbE->setOn(TRUE);
else
pbEE->setOn(TRUE);
break;
case Key_Escape:
key_pressed = TRUE;
pbClear->setOn(TRUE);
break;
case Key_Delete:
key_pressed = TRUE;
pbAC->setOn(TRUE);
break;
case Key_S:
key_pressed = TRUE;
pbSin->setOn(TRUE);
break;
case Key_Backslash:
key_pressed = TRUE;
pbplusminus->setOn(TRUE);
break;
case Key_B:
key_pressed = TRUE;
pbB->setOn(TRUE);
break;
case Key_7:
key_pressed = TRUE;
pb7->setOn(TRUE);
break;
case Key_8:
key_pressed = TRUE;
pb8->setOn(TRUE);
break;
case Key_9:
key_pressed = TRUE;
pb9->setOn(TRUE);
break;
case Key_ParenLeft:
key_pressed = TRUE;
pbparenopen->setOn(TRUE);
break;
case Key_ParenRight:
key_pressed = TRUE;
pbparenclose->setOn(TRUE);
break;
case Key_Ampersand:
key_pressed = TRUE;
pband->setOn(TRUE);
break;
case Key_C:
key_pressed = TRUE;
if (current_base == NB_HEX)
pbC->setOn(TRUE);
else
pbCos->setOn(TRUE);
break;
case Key_4:
key_pressed = TRUE;
pb4->setOn(TRUE);
break;
case Key_5:
key_pressed = TRUE;
pb5->setOn(TRUE);
break;
case Key_6:
key_pressed = TRUE;
pb6->setOn(TRUE);
break;
case Key_Asterisk:
key_pressed = TRUE;
pbX->setOn(TRUE);
break;
case Key_Slash:
key_pressed = TRUE;
pbdivision->setOn(TRUE);
break;
case Key_O:
key_pressed = TRUE;
pbor->setOn(TRUE);
break;
case Key_T:
key_pressed = TRUE;
pbTan->setOn(TRUE);
break;
case Key_Exclam:
key_pressed = TRUE;
pbfactorial->setOn(TRUE);
break;
case Key_D:
key_pressed = TRUE;
if(kcalcdefaults.style == 0)
pbD->setOn(TRUE); // trig mode
else
pblog->setOn(TRUE); // stat mode
break;
case Key_1:
key_pressed = TRUE;
pb1->setOn(TRUE);
break;
case Key_2:
key_pressed = TRUE;
pb2->setOn(TRUE);
break;
case Key_3:
key_pressed = TRUE;
pb3->setOn(TRUE);
break;
case Key_Plus:
key_pressed = TRUE;
pbplus->setOn(TRUE);
break;
case Key_Minus:
key_pressed = TRUE;
pbminus->setOn(TRUE);
break;
case Key_Less:
key_pressed = TRUE;
pbshift->setOn(TRUE);
break;
case Key_N:
key_pressed = TRUE;
pbln->setOn(TRUE);
break;
case Key_L:
key_pressed = TRUE;
pblog->setOn(TRUE);
break;
case Key_AsciiCircum:
key_pressed = TRUE;
pbpower->setOn(TRUE);
break;
case Key_F:
key_pressed = TRUE;
pbF->setOn(TRUE);
break;
case Key_Period:
key_pressed = TRUE;
pbperiod->setOn(TRUE);
break;
case Key_Comma:
key_pressed = TRUE;
pbperiod->setOn(TRUE);
break;
case Key_0:
key_pressed = TRUE;
pb0->setOn(TRUE);
break;
case Key_Equal:
key_pressed = TRUE;
pbequal->setOn(TRUE);
break;
case Key_Return:
key_pressed = TRUE;
pbequal->setOn(TRUE);
break;
case Key_Enter:
key_pressed = TRUE;
pbequal->setOn(TRUE);
break;
case Key_Percent:
key_pressed = TRUE;
pbpercent->setOn(TRUE);
break;
case Key_AsciiTilde:
key_pressed = TRUE;
pbnegate->setOn(TRUE);
break;
case Key_Colon:
key_pressed = TRUE;
pbmod->setOn(TRUE);
break;
case Key_BracketLeft:
key_pressed = TRUE;
pbsquare->setOn(TRUE);
break;
case Key_Backspace:
key_pressed = TRUE;
pbAC->setOn(TRUE);
break;
case Key_R:
key_pressed = TRUE;
pbreci->setOn(TRUE);
break;
}
}
kspread'QtCalculator::keyReleaseEvent() (./koffice/kspread/plugins/calculator/kcalc.cpp:1007)
void QtCalculator::keyReleaseEvent( QKeyEvent *e ){
switch (e->key() ){
case Key_Next:
key_pressed = FALSE;
pbAC->setOn(FALSE);
break;
case Key_Prior:
key_pressed = FALSE;
pbClear->setOn(FALSE);
break;
case Key_H:
key_pressed = FALSE;
pbhyp->setOn(FALSE);
break;
case Key_I:
key_pressed = FALSE;
pbinv->setOn(FALSE);
break;
case Key_A:
key_pressed = FALSE;
pbA->setOn(FALSE);
break;
case Key_E:
key_pressed = FALSE;
if (current_base == NB_HEX)
pbE->setOn(FALSE);
else
pbEE->setOn(FALSE);
break;
case Key_Escape:
key_pressed = FALSE;
pbClear->setOn(FALSE);
break;
case Key_Delete:
key_pressed = FALSE;
pbAC->setOn(FALSE);
break;
case Key_S:
key_pressed = FALSE;
pbSin->setOn(FALSE);
break;
case Key_Backslash:
key_pressed = FALSE;
pbplusminus->setOn(FALSE);
break;
case Key_B:
key_pressed = FALSE;
pbB->setOn(FALSE);
break;
case Key_7:
key_pressed = FALSE;
pb7->setOn(FALSE);
break;
case Key_8:
key_pressed = FALSE;
pb8->setOn(FALSE);
break;
case Key_9:
key_pressed = FALSE;
pb9->setOn(FALSE);
break;
case Key_ParenLeft:
key_pressed = FALSE;
pbparenopen->setOn(FALSE);
break;
case Key_ParenRight:
key_pressed = FALSE;
pbparenclose->setOn(FALSE);
break;
case Key_Ampersand:
key_pressed = FALSE;
pband->setOn(FALSE);
break;
case Key_C:
key_pressed = FALSE;
if (current_base == NB_HEX)
pbC->setOn(FALSE);
else
pbCos->setOn(FALSE);
break;
case Key_4:
key_pressed = FALSE;
pb4->setOn(FALSE);
break;
case Key_5:
key_pressed = FALSE;
pb5->setOn(FALSE);
break;
case Key_6:
key_pressed = FALSE;
pb6->setOn(FALSE);
break;
case Key_Asterisk:
key_pressed = FALSE;
pbX->setOn(FALSE);
break;
case Key_Slash:
key_pressed = FALSE;
pbdivision->setOn(FALSE);
break;
case Key_O:
key_pressed = FALSE;
pbor->setOn(FALSE);
break;
case Key_T:
key_pressed = FALSE;
pbTan->setOn(FALSE);
break;
case Key_Exclam:
key_pressed = FALSE;
pbfactorial->setOn(FALSE);
break;
case Key_D:
key_pressed = FALSE;
if(kcalcdefaults.style == 0)
pbD->setOn(FALSE); // trig mode
else
pblog->setOn(FALSE);// stat mode
break;
case Key_1:
key_pressed = FALSE;
pb1->setOn(FALSE);
break;
case Key_2:
key_pressed = FALSE;
pb2->setOn(FALSE);
break;
case Key_3:
key_pressed = FALSE;
pb3->setOn(FALSE);
break;
case Key_Plus:
key_pressed = FALSE;
pbplus->setOn(FALSE);
break;
case Key_Minus:
key_pressed = FALSE;
pbminus->setOn(FALSE);
break;
case Key_Less:
key_pressed = FALSE;
pbshift->setOn(FALSE);
break;
case Key_N:
key_pressed = FALSE;
pbln->setOn(FALSE);
break;
case Key_L:
key_pressed = FALSE;
pblog->setOn(FALSE);
break;
case Key_AsciiCircum:
key_pressed = FALSE;
pbpower->setOn(FALSE);
break;
case Key_F:
key_pressed = FALSE;
pbF->setOn(FALSE);
break;
case Key_Period:
key_pressed = FALSE;
pbperiod->setOn(FALSE);
break;
case Key_Comma:
key_pressed = FALSE;
pbperiod->setOn(FALSE);
break;
case Key_0:
key_pressed = FALSE;
pb0->setOn(FALSE);
break;
case Key_Equal:
key_pressed = FALSE;
pbequal->setOn(FALSE);
break;
case Key_Return:
key_pressed = FALSE;
pbequal->setOn(FALSE);
break;
case Key_Enter:
key_pressed = FALSE;
pbequal->setOn(FALSE);
break;
case Key_Percent:
key_pressed = FALSE;
pbpercent->setOn(FALSE);
break;
case Key_AsciiTilde:
key_pressed = FALSE;
pbnegate->setOn(FALSE);
break;
case Key_Colon:
key_pressed = FALSE;
pbmod->setOn(FALSE);
break;
case Key_BracketLeft:
key_pressed = FALSE;
pbsquare->setOn(FALSE);
break;
case Key_Backspace:
key_pressed = FALSE;
pbAC->setOn(FALSE);
break;
case Key_R:
key_pressed = FALSE;
pbreci->setOn(FALSE);
break;
}
clear_buttons();
}
kspread'QtCalculator::clear_buttons() (./koffice/kspread/plugins/calculator/kcalc.cpp:1221)
void QtCalculator::clear_buttons(){
}
kspread'QtCalculator::EEtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1225)
void QtCalculator::EEtoggled(bool myboolean){
if(myboolean)
EE();
if(pbEE->isOn() && (!key_pressed))
pbEE->setOn(FALSE);
}
kspread'QtCalculator::pbinvtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1233)
void QtCalculator::pbinvtoggled(bool myboolean){
if(myboolean)
SetInverse();
if(pbinv->isOn() && (!key_pressed))
pbinv->setOn(FALSE);
}
kspread'QtCalculator::pbhyptoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1240)
void QtCalculator::pbhyptoggled(bool myboolean){
if(myboolean)
EnterHyp();
if(pbhyp->isOn() && (!key_pressed))
pbhyp->setOn(FALSE);
}
kspread'QtCalculator::pbMRtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1246)
void QtCalculator::pbMRtoggled(bool myboolean){
if(myboolean)
MR();
if(pbMR->isOn() && (!key_pressed))
pbMR->setOn(FALSE);
}
kspread'QtCalculator::pbAtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1253)
void QtCalculator::pbAtoggled(bool myboolean){
if(myboolean)
buttonA();
if(pbA->isOn() && (!key_pressed))
pbA->setOn(FALSE);
}
kspread'QtCalculator::pbSintoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1260)
void QtCalculator::pbSintoggled(bool myboolean){
if(myboolean)
ExecSin();
if(pbSin->isOn() && (!key_pressed))
pbSin->setOn(FALSE);
}
kspread'QtCalculator::pbplusminustoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1266)
void QtCalculator::pbplusminustoggled(bool myboolean){
if(myboolean)
EnterNegate();
if(pbplusminus->isOn() && (!key_pressed))
pbplusminus->setOn(FALSE);
}
kspread'QtCalculator::pbMplusminustoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1272)
void QtCalculator::pbMplusminustoggled(bool myboolean){
if(myboolean)
Mplusminus();
if(pbMplusminus->isOn() && (!key_pressed))
pbMplusminus->setOn(FALSE);
}
kspread'QtCalculator::pbBtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1278)
void QtCalculator::pbBtoggled(bool myboolean){
if(myboolean)
buttonB();
if(pbB->isOn() && (!key_pressed))
pbB->setOn(FALSE);
}
kspread'QtCalculator::pbCostoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1284)
void QtCalculator::pbCostoggled(bool myboolean){
if(myboolean)
ExecCos();
if(pbCos->isOn() && (!key_pressed))
pbCos->setOn(FALSE);
}
kspread'QtCalculator::pbrecitoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1290)
void QtCalculator::pbrecitoggled(bool myboolean){
if(myboolean)
EnterRecip();
if(pbreci->isOn() && (!key_pressed))
pbreci->setOn(FALSE);
}
kspread'QtCalculator::pbCtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1296)
void QtCalculator::pbCtoggled(bool myboolean){
if(myboolean)
buttonC();
if(pbC->isOn() && (!key_pressed))
pbC->setOn(FALSE);
}
kspread'QtCalculator::pbTantoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1302)
void QtCalculator::pbTantoggled(bool myboolean){
if(myboolean)
ExecTan();
if(pbTan->isOn() && (!key_pressed))
pbTan->setOn(FALSE);
}
kspread'QtCalculator::pbfactorialtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1308)
void QtCalculator::pbfactorialtoggled(bool myboolean){
if(myboolean)
EnterFactorial();
if(pbfactorial->isOn() && (!key_pressed))
pbfactorial->setOn(FALSE);
}
kspread'QtCalculator::pbDtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1314)
void QtCalculator::pbDtoggled(bool myboolean){
if(myboolean)
buttonD();
if(pbD->isOn() && (!key_pressed))
pbD->setOn(FALSE);
}
kspread'QtCalculator::pblogtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1320)
void QtCalculator::pblogtoggled(bool myboolean){
if(myboolean)
EnterLogr();
if(pblog->isOn() && (!key_pressed))
pblog->setOn(FALSE);
}
kspread'QtCalculator::pbsquaretoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1326)
void QtCalculator::pbsquaretoggled(bool myboolean){
if(myboolean)
EnterSquare();
if(pbsquare->isOn() && (!key_pressed))
pbsquare->setOn(FALSE);
}
kspread'QtCalculator::pbEtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1332)
void QtCalculator::pbEtoggled(bool myboolean){
if(myboolean)
buttonE();
if(pbE->isOn() && (!key_pressed))
pbE->setOn(FALSE);
}
kspread'QtCalculator::pblntoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1338)
void QtCalculator::pblntoggled(bool myboolean){
if(myboolean)
EnterLogn();
if(pbln->isOn() && (!key_pressed))
pbln->setOn(FALSE);
}
kspread'QtCalculator::pbpowertoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1344)
void QtCalculator::pbpowertoggled(bool myboolean){
if(myboolean)
Power();
if(pbpower->isOn() && (!key_pressed))
pbpower->setOn(FALSE);
}
kspread'QtCalculator::pbFtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1350)
void QtCalculator::pbFtoggled(bool myboolean){
if(myboolean)
buttonF();
if(pbF->isOn() && (!key_pressed))
pbF->setOn(FALSE);
}
kspread'QtCalculator::pbMCtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1356)
void QtCalculator::pbMCtoggled(bool myboolean){
if(myboolean)
MC();
if(pbMC->isOn() && (!key_pressed))
pbMC->setOn(FALSE);
}
kspread'QtCalculator::pbCleartoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1362)
void QtCalculator::pbCleartoggled(bool myboolean){
if(myboolean)
Clear();
if(pbClear->isOn() && (!key_pressed))
pbClear->setOn(FALSE);
}
kspread'QtCalculator::pbACtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1368)
void QtCalculator::pbACtoggled(bool myboolean){
if(myboolean)
ClearAll();
if(pbAC->isOn() && (!key_pressed))
pbAC->setOn(FALSE);
}
kspread'QtCalculator::pb7toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1374)
void QtCalculator::pb7toggled(bool myboolean){
if(myboolean)
button7();
if(pb7->isOn() && (!key_pressed))
pb7->setOn(FALSE);
}
kspread'QtCalculator::pb8toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1380)
void QtCalculator::pb8toggled(bool myboolean){
if(myboolean)
button8();
if(pb8->isOn() && (!key_pressed))
pb8->setOn(FALSE);
}
kspread'QtCalculator::pb9toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1386)
void QtCalculator::pb9toggled(bool myboolean){
if(myboolean)
button9();
if(pb9->isOn() && (!key_pressed))
pb9->setOn(FALSE);
}
kspread'QtCalculator::pbparenopentoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1392)
void QtCalculator::pbparenopentoggled(bool myboolean){
if(myboolean)
EnterOpenParen();
if(pbparenopen->isOn() && (!key_pressed))
pbparenopen->setOn(FALSE);
}
kspread'QtCalculator::pbparenclosetoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1398)
void QtCalculator::pbparenclosetoggled(bool myboolean){
if(myboolean)
EnterCloseParen();
if(pbparenclose->isOn() && (!key_pressed))
pbparenclose->setOn(FALSE);
}
kspread'QtCalculator::pbandtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1404)
void QtCalculator::pbandtoggled(bool myboolean){
if(myboolean)
And();
if(pband->isOn() && (!key_pressed))
pband->setOn(FALSE);
}
kspread'QtCalculator::pb4toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1410)
void QtCalculator::pb4toggled(bool myboolean){
if(myboolean)
button4();
if(pb4->isOn() && (!key_pressed))
pb4->setOn(FALSE);
}
kspread'QtCalculator::pb5toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1416)
void QtCalculator::pb5toggled(bool myboolean){
if(myboolean)
button5();
if(pb5->isOn() && (!key_pressed))
pb5->setOn(FALSE);
}
kspread'QtCalculator::pb6toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1422)
void QtCalculator::pb6toggled(bool myboolean){
if(myboolean)
button6();
if(pb6->isOn() && (!key_pressed))
pb6->setOn(FALSE);
}
kspread'QtCalculator::pbXtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1428)
void QtCalculator::pbXtoggled(bool myboolean){
if(myboolean)
Multiply();
if(pbX->isOn() && (!key_pressed))
pbX->setOn(FALSE);
}
kspread'QtCalculator::pbdivisiontoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1434)
void QtCalculator::pbdivisiontoggled(bool myboolean){
if(myboolean)
Divide();
if(pbdivision->isOn() && (!key_pressed))
pbdivision->setOn(FALSE);
}
kspread'QtCalculator::pbortoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1440)
void QtCalculator::pbortoggled(bool myboolean){
if(myboolean)
Or();
if(pbor->isOn() && (!key_pressed))
pbor->setOn(FALSE);
}
kspread'QtCalculator::pb1toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1446)
void QtCalculator::pb1toggled(bool myboolean){
if(myboolean)
button1();
if(pb1->isOn() && (!key_pressed))
pb1->setOn(FALSE);
}
kspread'QtCalculator::pb2toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1452)
void QtCalculator::pb2toggled(bool myboolean){
if(myboolean)
button2();
if(pb2->isOn() && (!key_pressed))
pb2->setOn(FALSE);
}
kspread'QtCalculator::pb3toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1458)
void QtCalculator::pb3toggled(bool myboolean){
if(myboolean)
button3();
if(pb3->isOn() && (!key_pressed))
pb3->setOn(FALSE);
}
kspread'QtCalculator::pbplustoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1464)
void QtCalculator::pbplustoggled(bool myboolean){
if(myboolean)
Plus();
if(pbplus->isOn() && (!key_pressed))
pbplus->setOn(FALSE);
}
kspread'QtCalculator::pbminustoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1470)
void QtCalculator::pbminustoggled(bool myboolean){
if(myboolean)
Minus();
if(pbminus->isOn() && (!key_pressed))
pbminus->setOn(FALSE);
}
kspread'QtCalculator::pbshifttoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1476)
void QtCalculator::pbshifttoggled(bool myboolean){
if(myboolean)
Shift();
if(pbshift->isOn() && (!key_pressed))
pbshift->setOn(FALSE);
}
kspread'QtCalculator::pbperiodtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1482)
void QtCalculator::pbperiodtoggled(bool myboolean){
if(myboolean)
EnterDecimal();
if(pbperiod->isOn() && (!key_pressed))
pbperiod->setOn(FALSE);
}
kspread'QtCalculator::pb0toggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1488)
void QtCalculator::pb0toggled(bool myboolean){
if(myboolean)
button0();
if(pb0->isOn() && (!key_pressed))
pb0->setOn(FALSE);
}
kspread'QtCalculator::pbequaltoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1494)
void QtCalculator::pbequaltoggled(bool myboolean){
if(myboolean)
EnterEqual();
if(pbequal->isOn() && (!key_pressed))
pbequal->setOn(FALSE);
}
kspread'QtCalculator::pbpercenttoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1500)
void QtCalculator::pbpercenttoggled(bool myboolean){
if(myboolean)
EnterPercent();
if(pbpercent->isOn() && (!key_pressed))
pbpercent->setOn(FALSE);
}
kspread'QtCalculator::pbnegatetoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1506)
void QtCalculator::pbnegatetoggled(bool myboolean){
if(myboolean)
EnterNotCmp();
if(pbnegate->isOn() && (!key_pressed))
pbnegate->setOn(FALSE);
}
kspread'QtCalculator::pbmodtoggled() (./koffice/kspread/plugins/calculator/kcalc.cpp:1512)
void QtCalculator::pbmodtoggled(bool myboolean) {
if(myboolean)
Mod();
if(pbmod->isOn() && (!key_pressed))
pbmod->setOn(FALSE);
}
kspread'QtCalculator::configclicked() (./koffice/kspread/plugins/calculator/kcalc.cpp:1519)
void QtCalculator::configclicked(){
QTabDialog * tabdialog;
tabdialog = new QTabDialog(0,"tabdialog",TRUE);
tabdialog->setCaption( i18n("KCalc Configuraton") );
tabdialog->resize( 360, 390 );
tabdialog->setCancelButton( i18n("Cancel") );
QWidget *about = new QWidget(tabdialog,"about");
QGroupBox *box = new QGroupBox(about,"box");
QLabel *label = new QLabel(box,"label");
QLabel *label2 = new QLabel(box,"label2");
box->setGeometry(10,10,320,260);
box->setTitle(i18n("About"));
label->setGeometry(140,30,160,170);
label2->setGeometry(20,150,280,100);
QString labelstring = "KCalc "KCALCVERSION"\n"\
"Bernd Johannes Wuebben\n"\
"wuebben@math.cornell.edu\n"\
"wuebben@kde.org\n"\
"Copyright (C) 1996-98\n"\
"\n\n";
QString labelstring2 =
#ifdef HAVE_LONG_DOUBLE
i18n( "Base type: long double\n");
#else
i18n( "Due to broken glibc's everywhere, "\
"I had to reduce KCalc's precision from 'long double' "\
"to 'double'. "\
"Owners of systems with a working libc "\
"should recompile KCalc with 'long double' precision "\
"enabled. See the README for details.");
#endif
label->setAlignment(AlignLeft|WordBreak|ExpandTabs);
label->setText(labelstring.data());
label2->setAlignment(AlignLeft|WordBreak|ExpandTabs);
label2->setText(labelstring2.data());
// HACK
// QPixmap pm( BarIcon( "kcalclogo" ) );
QPixmap pm;
QLabel *logo = new QLabel(box);
logo->setPixmap(pm);
logo->setGeometry(30, 20, pm.width(), pm.height());
DefStruct newdefstruct;
newdefstruct.forecolor = kcalcdefaults.forecolor;
newdefstruct.backcolor = kcalcdefaults.backcolor;
newdefstruct.font = kcalcdefaults.font;
newdefstruct.precision = kcalcdefaults.precision;
newdefstruct.fixedprecision = kcalcdefaults.fixedprecision;
newdefstruct.fixed = kcalcdefaults.fixed;
newdefstruct.style = kcalcdefaults.style;
newdefstruct.beep = kcalcdefaults.beep;
ConfigDlg *configdlg;
configdlg = new ConfigDlg(tabdialog,"configdlg",&newdefstruct);
FontDlg* fontdlg;
fontdlg = new FontDlg(tabdialog,"fontdlg",&newdefstruct);
tabdialog->addTab(configdlg,i18n("Defaults"));
tabdialog->addTab(fontdlg,i18n("Display Font"));
tabdialog->addTab(about,i18n("About"));
if(tabdialog->exec() == QDialog::Accepted){
kcalcdefaults.forecolor = newdefstruct.forecolor;
kcalcdefaults.backcolor = newdefstruct.backcolor;
kcalcdefaults.font = newdefstruct.font;
kcalcdefaults.precision = newdefstruct.precision;
kcalcdefaults.fixedprecision = newdefstruct.fixedprecision;
kcalcdefaults.fixed = newdefstruct.fixed;
kcalcdefaults.style = newdefstruct.style;
kcalcdefaults.beep = newdefstruct.beep;
set_colors();
set_precision();
set_display_font();
set_style();
}
}
kspread'QtCalculator::set_style() (./koffice/kspread/plugins/calculator/kcalc.cpp:1617)
void QtCalculator::set_style(){
switch(kcalcdefaults.style){
case 0:{
pbhyp->setText( "Hyp" );
pbSin->setText( "Sin" );
pbCos->setText( "Cos" );
pbTan->setText( "Tan" );
pblog->setText( "Log" );
pbln ->setText( "Ln" );
break;
}
case 1:{
pbhyp->setText( "N" );
pbSin->setText( "Mea" );
pbCos->setText( "Std" );
pbTan->setText( "Med" );
pblog->setText( "Dat" );
pbln ->setText( "CSt" );
break;
}
case 2:{
pbhyp->setText( "N" );
pbSin->setText( "Min" );
pbCos->setText( "Max" );
pbTan->setText( "Med" );
pblog->setText( "Sum" );
pbln ->setText( "Mul" );
break;
}
default:
break;
}
}
kspread'QtCalculator::readSettings() (./koffice/kspread/plugins/calculator/kcalc.cpp:1653)
void QtCalculator::readSettings()
{
kcalcdefaults.font = QFont("helvetica",16,QFont::Bold);
QColor tmpC(189, 255, 222);
QColor blackC(0,0,0);
kcalcdefaults.forecolor = blackC;
kcalcdefaults.backcolor = tmpC;
#ifdef HAVE_LONG_DOUBLE
kcalcdefaults.precision = 14;
#else
kcalcdefaults.precision = 10;
#endif
kcalcdefaults.fixedprecision = 2;
kcalcdefaults.fixed = FALSE;
kcalcdefaults.style = 2;
kcalcdefaults.beep = 1;
/*
QString str;
KConfig *config = kapp->config();
config->setGroup( "Font" );
kcalcdefaults.font = config->readFontEntry("Font",
new QFont("helvetica",16,QFont::Bold));
config->setGroup("Colors");
QColor tmpC(189, 255, 222);
QColor blackC(0,0,0);
kcalcdefaults.forecolor = config->readColorEntry("ForeColor",&blackC);
kcalcdefaults.backcolor = config->readColorEntry("BackColor",&tmpC);
config->setGroup("Precision");
#ifdef HAVE_LONG_DOUBLE
kcalcdefaults.precision = config->readNumEntry("precision",(int)14);
#else
kcalcdefaults.precision = config->readNumEntry("precision",(int)10);
#endif
kcalcdefaults.fixedprecision = config->readNumEntry("fixedprecision",(int)2);
kcalcdefaults.fixed = (bool) config->readNumEntry("fixed",(int)0);
config->setGroup("General");
kcalcdefaults.style = config->readNumEntry("style",(int)2);
kcalcdefaults.beep = config->readNumEntry("beep",(int)1);
*/
}
kspread'QtCalculator::writeSettings() (./koffice/kspread/plugins/calculator/kcalc.cpp:1705)
void QtCalculator::writeSettings()
{
/*
KConfig *config = kapp->config();
config->setGroup( "Font" );
config->writeEntry("Font",kcalcdefaults.font);
config->setGroup("Colors");
config->writeEntry("ForeColor",kcalcdefaults.forecolor);
config->writeEntry("BackColor",kcalcdefaults.backcolor);
config->setGroup("Precision");
config->writeEntry("precision", kcalcdefaults.precision);
config->writeEntry("fixedprecision", kcalcdefaults.fixedprecision);
config->writeEntry("fixed", (int)kcalcdefaults.fixed);
config->setGroup("General");
config->writeEntry("style",(int)kcalcdefaults.style);
config->writeEntry("beep",(int)kcalcdefaults.beep);
config->sync(); */
}
kspread'QtCalculator::display_selected() (./koffice/kspread/plugins/calculator/kcalc.cpp:1729)
void QtCalculator::display_selected(){
if(calc_display->Button() == LeftButton){
if(calc_display->isLit()){
QClipboard *cb = QApplication::clipboard();
cb->setText(calc_display->text());
selection_timer->start(100);
}
else{
selection_timer->stop();
}
invertColors();
}
else{
QClipboard *cb = QApplication::clipboard();
CALCAMNT result;
result = (CALCAMNT) strtod( cb->text(),0);
// printf("%Lg\n",result);
last_input = PASTE;
DISPLAY_AMOUNT = result;
UpdateDisplay();
}
}
kspread'QtCalculator::selection_timed_out() (./koffice/kspread/plugins/calculator/kcalc.cpp:1762)
void QtCalculator::selection_timed_out(){
// printf("selection timed out\n");
selection_timer->stop();
calc_display->setLit(FALSE);
invertColors();
}
kspread'QtCalculator::clear_status_label() (./koffice/kspread/plugins/calculator/kcalc.cpp:1773)
void QtCalculator::clear_status_label(){
statusERRORLabel->setText("");
status_timer->stop();
}
kspread'QtCalculator::setStatusLabel() (./koffice/kspread/plugins/calculator/kcalc.cpp:1779)
void QtCalculator::setStatusLabel(const QString& string){
statusERRORLabel->setText(string);
status_timer->start(3000,TRUE);
}
kspread'QtCalculator::invertColors() (./koffice/kspread/plugins/calculator/kcalc.cpp:1787)
void QtCalculator::invertColors(){
QColor tmpcolor;
if(calc_display->isLit()){
tmpcolor = kcalcdefaults.backcolor;
kcalcdefaults.backcolor = kcalcdefaults.forecolor;
kcalcdefaults.forecolor = tmpcolor;
set_colors();
tmpcolor = kcalcdefaults.backcolor;
kcalcdefaults.backcolor = kcalcdefaults.forecolor;
kcalcdefaults.forecolor = tmpcolor;
}
else{
set_colors();
//printf("normal Colors\n");
}
}
kspread'QtCalculator::closeEvent() (./koffice/kspread/plugins/calculator/kcalc.cpp:1806)
void QtCalculator::closeEvent( QCloseEvent*e )
{
// quitCalc();
e->accept();
}
kspread'QtCalculator::quitCalc() (./koffice/kspread/plugins/calculator/kcalc.cpp:1812)
void QtCalculator::quitCalc(){
writeSettings();
/* qApp->quit(); */
}
kspread'QtCalculator::set_colors() (./koffice/kspread/plugins/calculator/kcalc.cpp:1819)
void QtCalculator::set_colors(){
QPalette mypalette = (calc_display->palette()).copy();
QColorGroup cgrp = mypalette.normal();
QColorGroup ncgrp(kcalcdefaults.forecolor,
cgrp.background(),
cgrp.light(),
cgrp.dark(),
cgrp.mid(),
kcalcdefaults.forecolor,
kcalcdefaults.backcolor);
mypalette.setNormal(ncgrp);
mypalette.setDisabled(ncgrp);
mypalette.setActive(ncgrp);
calc_display->setPalette(mypalette);
calc_display->setBackgroundColor(kcalcdefaults.backcolor);
}
kspread'QtCalculator::set_precision() (./koffice/kspread/plugins/calculator/kcalc.cpp:1842)
void QtCalculator::set_precision(){
UpdateDisplay();
}
kspread'QtCalculator::set_display_font() (./koffice/kspread/plugins/calculator/kcalc.cpp:1847)
void QtCalculator::set_display_font(){
calc_display->setFont(kcalcdefaults.font);
}
kspread'QtCalculator::temp_stack_next() (./koffice/kspread/plugins/calculator/kcalc.cpp:1853)
void QtCalculator::temp_stack_next(){
CALCAMNT *number;
if( temp_stack.current() == temp_stack.getLast()){
QApplication::beep();
return;
}
number = temp_stack.next();
if(number == NULL){
QApplication::beep();
return;
}
else{
// printf("Number: %Lg\n",*number);
last_input = RECALL;
DISPLAY_AMOUNT = *number;
UpdateDisplay();
}
}
kspread'QtCalculator::temp_stack_prev() (./koffice/kspread/plugins/calculator/kcalc.cpp:1879)
void QtCalculator::temp_stack_prev(){
CALCAMNT *number;
if( temp_stack.current() == temp_stack.getFirst()){
QApplication::beep();
return;
}
number = temp_stack.prev();
if(number == NULL){
QApplication::beep();
return;
}
else{
// printf("Number: %Lg\n",*number);
last_input = RECALL;
DISPLAY_AMOUNT = *number;
UpdateDisplay();
}
}
kspread'QtCalculator::InitializeCalculator() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:155)
void QtCalculator::InitializeCalculator(void) {
//
// Basic initialization involves initializing the calcultion
// stack, forcing the display to refresh to zero, and setting
// up the floating point excetion signal handler to trap the
// errors that the code can/has not been written to trap.
//
// We also calculate pi as double the arc sine of 1.
//
display_data.s_item_type = ITEM_AMOUNT;
display_data.s_item_data.item_amount = 0.0;
display_data.s_item_data.item_func_data.item_function = 0;
display_data.s_item_data.item_func_data.item_precedence = 0;
void fpe_handler(int fpe_parm);
struct sigaction fpe_trap;
fpe_trap.sa_handler = &fpe_handler;
#ifdef SA_RESTART
fpe_trap.sa_flags = SA_RESTART;
#endif
sigaction(SIGFPE, &fpe_trap, NULL);
RefreshCalculator();
pi = ASIN(1L) * 2L;
}
kspread'QtCalculator::setData() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:194)
void QtCalculator::setData( const QRect& _range, const char *_table )
{
table_range = _range;
table_name = _table;
}
kspread'QtCalculator::setValue() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:200)
void QtCalculator::setValue( double _value )
{
last_input = DIGIT;
DISPLAY_AMOUNT = _value;
decimal_point = 0;
refresh_display = 1;
input_count = 0;
UpdateDisplay();
}
kspread'QtCalculator::setLabel() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:211)
void QtCalculator::setLabel( const char *_text )
{
last_input = DIGIT;
DISPLAY_AMOUNT = 0L;
decimal_point = 0;
refresh_display = 0;
input_count = 0;
calc_display->setText( _text );
}
kspread'QtCalculator::RefreshCalculator() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:222)
void QtCalculator::RefreshCalculator(void)
{
InitStack();
display_error = 0;
DISPLAY_AMOUNT = 0L;
inverse = FALSE;
UpdateDisplay();
last_input = DIGIT; // must set last to DIGIT after Update Display in order
// not to get a display holding e.g. 0.000
input_count = 0;
decimal_point = 0;
}
kspread'QtCalculator::EnterDigit() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:235)
void QtCalculator::EnterDigit(int data)
{
if(eestate){
QString string;
string.setNum(data);
strcat(display_str,string.data());
DISPLAY_AMOUNT = (CALCAMNT) strtod(display_str,0);
UpdateDisplay();
return;
}
last_input = DIGIT;
if (refresh_display) {
DISPLAY_AMOUNT = 0L;
decimal_point = 0;
refresh_display = 0;
input_count = 0;
}
if (!(input_limit && input_count >= input_limit))
if (DISPLAY_AMOUNT < 0)
DISPLAY_AMOUNT = decimal_point ?
DISPLAY_AMOUNT - ((CALCAMNT)data /
POW(current_base, decimal_point++)) :
(current_base * DISPLAY_AMOUNT) - data;
else
DISPLAY_AMOUNT = decimal_point ?
DISPLAY_AMOUNT + ((CALCAMNT)data /
POW(current_base, decimal_point++)) :
(current_base * DISPLAY_AMOUNT) + data;
if (decimal_point){
input_count ++;
#ifdef MYDEBUG
printf("EnterDigit() inc dec.point:%d\n",input_count);
#endif
}
UpdateDisplay();
}
kspread'QtCalculator::button0() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:280)
void QtCalculator::button0()
{
EnterDigit(0);
}
kspread'QtCalculator::button1() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:285)
void QtCalculator::button1()
{
EnterDigit(1);
}
kspread'QtCalculator::button2() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:290)
void QtCalculator::button2()
{
if (current_base == NB_BINARY)
return;
EnterDigit(2);
}
kspread'QtCalculator::button3() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:297)
void QtCalculator::button3()
{
if (current_base == NB_BINARY)
return;
EnterDigit(3);
}
kspread'QtCalculator::button4() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:304)
void QtCalculator::button4()
{
if (current_base == NB_BINARY)
return;
EnterDigit(4);
}
kspread'QtCalculator::button5() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:311)
void QtCalculator::button5()
{
if (current_base == NB_BINARY)
return;
EnterDigit(5);
}
kspread'QtCalculator::button6() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:318)
void QtCalculator::button6()
{
if (current_base == NB_BINARY)
return;
EnterDigit(6);
}
kspread'QtCalculator::button7() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:325)
void QtCalculator::button7()
{
if (current_base == NB_BINARY)
return;
EnterDigit(7);
}
kspread'QtCalculator::button8() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:332)
void QtCalculator::button8()
{
if ((current_base == NB_BINARY) || (current_base == NB_OCTAL))
return;
EnterDigit(8);
}
kspread'QtCalculator::button9() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:339)
void QtCalculator::button9()
{
if ((current_base == NB_BINARY) || (current_base == NB_OCTAL))
return;
EnterDigit(9);
}
kspread'QtCalculator::buttonA() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:347)
void QtCalculator::buttonA()
{
if ((current_base == NB_BINARY) || (current_base == NB_OCTAL)
|| (current_base == NB_DECIMAL))
return;
EnterDigit(10);
}
kspread'QtCalculator::buttonB() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:356)
void QtCalculator::buttonB()
{
if ((current_base == NB_BINARY) || (current_base == NB_OCTAL)
|| (current_base == NB_DECIMAL))
return;
EnterDigit(11);
}
kspread'QtCalculator::buttonC() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:365)
void QtCalculator::buttonC()
{
if ((current_base == NB_BINARY) || (current_base == NB_OCTAL)
|| (current_base == NB_DECIMAL))
return;
EnterDigit(12);
}
kspread'QtCalculator::buttonD() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:374)
void QtCalculator::buttonD()
{
if ((current_base == NB_BINARY) || (current_base == NB_OCTAL)
|| (current_base == NB_DECIMAL))
return;
EnterDigit(13);
}
kspread'QtCalculator::buttonE() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:383)
void QtCalculator::buttonE()
{
if ((current_base == NB_BINARY) || (current_base == NB_OCTAL)
|| (current_base == NB_DECIMAL))
return;
EnterDigit(14);
}
kspread'QtCalculator::buttonF() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:391)
void QtCalculator::buttonF()
{
if ((current_base == NB_BINARY) || (current_base == NB_OCTAL)
|| (current_base == NB_DECIMAL))
return;
EnterDigit(15);
}
kspread'QtCalculator::EnterDecimal() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:401)
void QtCalculator::EnterDecimal()
{
if(eestate){
QApplication::beep();
return;
}
decimal_point = 1;
if (refresh_display) {
DISPLAY_AMOUNT = 0L;
refresh_display = 0;
input_count = 0;
}
if (last_input == DIGIT && !strpbrk( display_str,".")){
// if the last input was a DIGIT and we don't have already a period in our
// display string then display a period
calc_display->setText(strcat(display_str, "."));
}
else {
// the last input wasn't a DIGIT so we are about to
// input a new number in particular we neet do display a "0.".
DISPLAY_AMOUNT = 0L;
refresh_display = 0;
// decimal_point = 1;
// input_count = 1;
strcpy(display_str, "0.");
calc_display->setText(display_str);
}
}
kspread'QtCalculator::Or() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:438)
void QtCalculator::Or()
{
eestate = false;
if (inverse){
EnterStackFunction(2); // XOR
inverse = FALSE;
}
else {
EnterStackFunction(1); // OR
}
last_input = OPERATION;
}
kspread'QtCalculator::And() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:451)
void QtCalculator::And()
{
eestate = false;
last_input = OPERATION;
EnterStackFunction(3);
}
kspread'QtCalculator::Shift() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:459)
void QtCalculator::Shift()
{
eestate = false;
last_input = OPERATION;
if (inverse){
EnterStackFunction(5); // Rsh
inverse = FALSE;
}
else {
EnterStackFunction(4); // Lsh
}
}
kspread'QtCalculator::Plus() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:473)
void QtCalculator::Plus()
{
eestate = false;
last_input = OPERATION;
EnterStackFunction(6);
}
kspread'QtCalculator::Minus() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:480)
void QtCalculator::Minus()
{
eestate = false;
last_input = OPERATION;
EnterStackFunction(7);
}
kspread'QtCalculator::Multiply() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:488)
void QtCalculator::Multiply()
{
eestate = false;
last_input = OPERATION;
EnterStackFunction(8);
}
kspread'QtCalculator::Divide() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:495)
void QtCalculator::Divide()
{
eestate = false;
last_input = OPERATION;
EnterStackFunction(9);
}
kspread'QtCalculator::Mod() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:502)
void QtCalculator::Mod()
{
eestate = false;
last_input = OPERATION;
if (inverse){
EnterStackFunction(13); // InvMod
inverse = FALSE;
}
else {
EnterStackFunction(10); // Mod
}
}
kspread'QtCalculator::Power() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:515)
void QtCalculator::Power()
{
eestate = false;
last_input = OPERATION;
if (inverse){
EnterStackFunction(12); // InvPower
inverse = FALSE;
}
else {
EnterStackFunction(11); // Power
}
}
kspread'QtCalculator::EnterStackFunction() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:531)
void QtCalculator::EnterStackFunction(int data)
{
item_contents new_item;
int new_precedence;
int dummy;
dummy = 0;
/*
if (inverse ) {
dummy = 3;
inverse = FALSE;
}
else {
dummy = 1;
}
*/
// printf("data %d dummy %d\n",data,dummy);
data = adjust_op[data][dummy];
// printf("data %d \n",data );
PushStack(&display_data);
new_item.s_item_type = ITEM_FUNCTION;
new_item.s_item_data.item_func_data.item_function = data;
new_item.s_item_data.item_func_data.item_precedence =
new_precedence = precedence[data] + precedence_base;
refresh_display = 1;
if (UpdateStack(new_precedence))
UpdateDisplay();
PushStack(&new_item);
}
kspread'QtCalculator::EnterNegate() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:566)
void QtCalculator::EnterNegate()
{
if(eestate){
QString string;
string = display_str;
int pos;
pos = string.findRev('e',-1,false);
if(pos == -1)
return;
if(display_str[pos+1] == '+')
display_str[pos+1] = '-';
else{
if(display_str[pos+1] == '-')
display_str[pos+1] = '+';
else{
string.insert(pos +1,'-');
strncpy(display_str,string.data(),DSP_SIZE);
}
}
DISPLAY_AMOUNT = (CALCAMNT)strtod(display_str,0);
UpdateDisplay();
}
else{
// last_input = OPERATION;
if (DISPLAY_AMOUNT != 0) {
DISPLAY_AMOUNT *= -1;
UpdateDisplay();
}
}
last_input = DIGIT;
}
kspread'QtCalculator::EnterOpenParen() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:600)
void QtCalculator::EnterOpenParen()
{
eestate = false;
last_input = OPERATION;
precedence_base += PRECEDENCE_INCR;
refresh_display = 1;
}
kspread'QtCalculator::EnterCloseParen() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:609)
void QtCalculator::EnterCloseParen()
{
eestate = false;
last_input = OPERATION;
PushStack(&display_data);
refresh_display = 1;
if (UpdateStack(precedence_base))
UpdateDisplay();
if ((precedence_base -= PRECEDENCE_INCR) < 0)
precedence_base = 0;
}
kspread'QtCalculator::EnterRecip() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:622)
void QtCalculator::EnterRecip()
{
eestate = false;
last_input = OPERATION;
DISPLAY_AMOUNT = 1 / DISPLAY_AMOUNT;
refresh_display = 1;
UpdateDisplay();
}
kspread'QtCalculator::EnterInt() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:631)
void QtCalculator::EnterInt()
{
eestate = false;
CALCAMNT work_amount1, work_amount2;
last_input = OPERATION;
if (!inverse){
work_amount2 = MODF(DISPLAY_AMOUNT, &work_amount1);
DISPLAY_AMOUNT = work_amount2 ;
}
else {
DISPLAY_AMOUNT = work_amount1;
inverse = FALSE;
}
refresh_display = 1;
UpdateDisplay();
}
kspread'QtCalculator::EnterFactorial() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:651)
void QtCalculator::EnterFactorial()
{
eestate = false;
CALCAMNT work_amount1, work_amount2;
int incr;
MODF(DISPLAY_AMOUNT, &work_amount1);
incr = work_amount1 < 0 ? -1 : 1;
work_amount2 = work_amount1 - incr;
while (work_amount1 != 0 && work_amount2 != 0 && !display_error) {
work_amount1 *= work_amount2;
work_amount2 -= incr;
if(isinf(work_amount1)) {
display_error=1;
break;
}
}
if( work_amount1 == 0.0)
work_amount1 = 1.0;
DISPLAY_AMOUNT = work_amount1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::EnterSquare() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:680)
void QtCalculator::EnterSquare()
{
eestate = false;
if (!inverse){
DISPLAY_AMOUNT *= DISPLAY_AMOUNT;
}
else if (DISPLAY_AMOUNT < 0)
display_error = 1;
else
DISPLAY_AMOUNT = SQRT(DISPLAY_AMOUNT);
refresh_display = 1;
inverse = FALSE;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::EnterNotCmp() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:697)
void QtCalculator::EnterNotCmp()
{
eestate = false;
CALCAMNT boh_work_d;
long boh_work;
MODF(DISPLAY_AMOUNT, &boh_work_d);
if (FABS(boh_work_d) > LONG_MAX)
display_error = 1;
else {
boh_work = (long int) boh_work_d;
DISPLAY_AMOUNT = ~boh_work;
}
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::EnterHyp() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:716)
void QtCalculator::EnterHyp()
{
switch(kcalcdefaults.style){
case 2:
case 1:{
if ( !table_name.isEmpty() )
useData();
if(!inverse){
eestate = false; // terminate ee input mode
DISPLAY_AMOUNT = stats.count();
last_input = OPERATION;
refresh_display = 1;
UpdateDisplay();
}
else{
inverse = false;
eestate = false; // terminate ee input mode
DISPLAY_AMOUNT = stats.sum();
last_input = OPERATION;
refresh_display = 1;
UpdateDisplay();
}
break;
}
case 0: {
// toggle between hyperbolic and standart trig functions
hyp_mode = !hyp_mode;
if (hyp_mode){
statusHYPLabel->setText("HYP");
}
else{
statusHYPLabel->setText("");
}
break;
}
}
}
kspread'QtCalculator::ExecSin() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:760)
void QtCalculator::ExecSin(){
switch(kcalcdefaults.style){
case 0:{ // trig mode
ComputeSin();
break;
}
case 1:{ // stats mode
if ( !table_name.isEmpty() )
useData();
ComputeMean();
break;
}
case 2:{ // table mode
if ( !table_name.isEmpty() )
useData();
ComputeMin();
break;
}
}
}
kspread'QtCalculator::ComputeSum() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:790)
void QtCalculator::ComputeSum()
{
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.sum();
if (stats.error())
display_error = 1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::ComputeMul() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:803)
void QtCalculator::ComputeMul()
{
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.mul();
if (stats.error())
display_error = 1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::ComputeMin() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:816)
void QtCalculator::ComputeMin()
{
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.min();
if (stats.error())
display_error = 1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::ComputeMax() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:829)
void QtCalculator::ComputeMax()
{
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.max();
if (stats.error())
display_error = 1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::ComputeMean() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:842)
void QtCalculator::ComputeMean(){
if(!inverse){
eestate = false;
DISPLAY_AMOUNT = stats.mean();
if (stats.error())
display_error = 1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
else{
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.sum_of_squares();
if (stats.error())
display_error = 1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
}
kspread'QtCalculator::ComputeSin() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:868)
void QtCalculator::ComputeSin()
{
CALCAMNT work_amount;
eestate = false;
work_amount = DISPLAY_AMOUNT;
if (hyp_mode){
// sinh or arcsinh
if (!inverse){
DISPLAY_AMOUNT = SINH( work_amount);
}
else {
DISPLAY_AMOUNT = ASINH( work_amount);
if (errno == EDOM || errno == ERANGE)
display_error = 1;
inverse = FALSE; // reset the inverse flag
}
}
else {
// sine or arcsine
if (!inverse){
// sine
switch (angle_mode) {
case ANG_DEGREE:
work_amount = DEG2RAD(DISPLAY_AMOUNT);
break;
case ANG_GRADIENT:
work_amount = GRA2RAD(DISPLAY_AMOUNT);
break;
case ANG_RADIAN:
work_amount = DISPLAY_AMOUNT;
break;
}
DISPLAY_AMOUNT = SIN( work_amount);
}
else {
// arcsine
DISPLAY_AMOUNT = ASIN(work_amount);
switch (angle_mode) {
case ANG_DEGREE:
work_amount = RAD2DEG(DISPLAY_AMOUNT);
break;
case ANG_GRADIENT:
work_amount = RAD2GRA(DISPLAY_AMOUNT);
break;
case ANG_RADIAN:
work_amount = DISPLAY_AMOUNT;
break;
}
DISPLAY_AMOUNT = work_amount;
if (errno == EDOM || errno == ERANGE)
display_error = 1;
inverse = FALSE; // reset the inverse flag
}
}
// Now a cheat to help the weird case of COS 90 degrees not being 0!!!
if (DISPLAY_AMOUNT < POS_ZERO && DISPLAY_AMOUNT > NEG_ZERO)
DISPLAY_AMOUNT=0;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::ExecCos() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:934)
void QtCalculator::ExecCos(){
switch(kcalcdefaults.style){
case 0:{ // trig mode
ComputeCos();
break;
}
case 1:{ // stats mode
if ( !table_name.isEmpty() )
useData();
ComputeStd();
break;
}
case 2:{ // table mode
if ( !table_name.isEmpty() )
useData();
ComputeMax();
break;
}
}
}
kspread'QtCalculator::ComputeStd() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:964)
void QtCalculator::ComputeStd(){
if(!inverse){ // std (n-1)
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.std();
if (stats.error()){
display_error = 1;
}
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
else{ // std (n)
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.sample_std();
if (stats.error())
display_error = 1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
}
kspread'QtCalculator::ComputeCos() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:998)
void QtCalculator::ComputeCos()
{
CALCAMNT work_amount;
eestate = false;
work_amount = DISPLAY_AMOUNT;
if (hyp_mode){
// cosh or arccosh
if (!inverse){
DISPLAY_AMOUNT = COSH( work_amount);
}
else {
DISPLAY_AMOUNT = ACOSH( work_amount);
if (errno == EDOM || errno == ERANGE)
display_error = 1;
inverse = FALSE; // reset the inverse flag
}
}
else {
// cosine or arccosine
if (!inverse){
// sine
switch (angle_mode) {
case ANG_DEGREE:
work_amount = DEG2RAD(DISPLAY_AMOUNT);
break;
case ANG_GRADIENT:
work_amount = GRA2RAD(DISPLAY_AMOUNT);
break;
case ANG_RADIAN:
work_amount = DISPLAY_AMOUNT;
break;
}
DISPLAY_AMOUNT = COS( work_amount);
}
else {
// arccosine
DISPLAY_AMOUNT = ACOS(work_amount);
switch (angle_mode) {
case ANG_DEGREE:
work_amount = RAD2DEG(DISPLAY_AMOUNT);
break;
case ANG_GRADIENT:
work_amount = RAD2GRA(DISPLAY_AMOUNT);
break;
case ANG_RADIAN:
work_amount = DISPLAY_AMOUNT;
break;
}
DISPLAY_AMOUNT = work_amount;
if (errno == EDOM || errno == ERANGE)
display_error = 1;
inverse = FALSE; // reset the inverse flag
}
}
// Now a cheat to help the weird case of COS 90 degrees not being 0!!!
if (DISPLAY_AMOUNT < POS_ZERO && DISPLAY_AMOUNT > NEG_ZERO)
DISPLAY_AMOUNT=0;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::ExecTan() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1067)
void QtCalculator::ExecTan(){
switch(kcalcdefaults.style){
case 0:{ // trig mode
ComputeTan();
break;
}
case 2:
case 1:{ // stats mode
if ( !table_name.isEmpty() )
useData();
ComputeMedean();
break;
}
}
}
kspread'QtCalculator::ComputeMedean() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1091)
void QtCalculator::ComputeMedean(){
if(!inverse){ // std (n-1)
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.median();
if (stats.error()){
display_error = 1;
}
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
else{ // std (n)
inverse = false;
eestate = false;
DISPLAY_AMOUNT = stats.median();
if (stats.error())
display_error = 1;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
}
kspread'QtCalculator::ComputeTan() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1123)
void QtCalculator::ComputeTan()
{
CALCAMNT work_amount;
eestate = false;
work_amount = DISPLAY_AMOUNT;
if (hyp_mode){
// tanh or arctanh
if (!inverse){
DISPLAY_AMOUNT = TANH( work_amount);
}
else {
DISPLAY_AMOUNT = ATANH( work_amount);
if (errno == EDOM || errno == ERANGE)
display_error = 1;
inverse = FALSE; // reset the inverse flag
}
}
else {
// tan or arctan
if (!inverse){
// tan
switch (angle_mode) {
case ANG_DEGREE:
work_amount = DEG2RAD(DISPLAY_AMOUNT);
break;
case ANG_GRADIENT:
work_amount = GRA2RAD(DISPLAY_AMOUNT);
break;
case ANG_RADIAN:
work_amount = DISPLAY_AMOUNT;
break;
}
DISPLAY_AMOUNT = TAN( work_amount);
if (errno == EDOM || errno == ERANGE)
display_error = 1;
}
else {
// arctan
DISPLAY_AMOUNT = ATAN(work_amount);
switch (angle_mode) {
case ANG_DEGREE:
work_amount = RAD2DEG(DISPLAY_AMOUNT);
break;
case ANG_GRADIENT:
work_amount = RAD2GRA(DISPLAY_AMOUNT);
break;
case ANG_RADIAN:
work_amount = DISPLAY_AMOUNT;
break;
}
DISPLAY_AMOUNT = work_amount;
if (errno == EDOM || errno == ERANGE)
display_error = 1;
inverse = FALSE; // reset the inverse flag
}
}
// Now a cheat to help the weird case of COS 90 degrees not being 0!!!
if (DISPLAY_AMOUNT < POS_ZERO && DISPLAY_AMOUNT > NEG_ZERO)
DISPLAY_AMOUNT=0;
refresh_display = 1;
last_input = OPERATION;
UpdateDisplay();
}
kspread'QtCalculator::EnterPercent() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1194)
void QtCalculator::EnterPercent()
{
eestate = false;
last_input = OPERATION;
percent_mode = 1;
EnterEqual();
percent_mode = 0;
}
kspread'QtCalculator::EnterLogr() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1204)
void QtCalculator::EnterLogr()
{
switch(kcalcdefaults.style){
case 2:
{
if ( !table_name.isEmpty() )
useData();
ComputeSum();
break;
}
case 1:{
if ( !table_name.isEmpty() )
useData();
if(!inverse){
eestate = false; // terminate ee input mode
stats.enterData(DISPLAY_AMOUNT);
last_input = OPERATION;
refresh_display = 1;
DISPLAY_AMOUNT = stats.count();
UpdateDisplay();
}
else{
inverse = false;
last_input = OPERATION;
refresh_display = 1;
stats.clearLast();
setStatusLabel("Last stat item erased");
DISPLAY_AMOUNT = stats.count();
UpdateDisplay();
}
break;
}
case 0:{
eestate = false;
last_input = OPERATION;
if (!inverse) {
if (DISPLAY_AMOUNT <= 0)
display_error = 1;
else
DISPLAY_AMOUNT = LOG_TEN(DISPLAY_AMOUNT);
refresh_display = 1;
UpdateDisplay();
} else if (inverse) {
DISPLAY_AMOUNT = POW(10, DISPLAY_AMOUNT);
refresh_display = 1;
inverse = FALSE;
UpdateDisplay();
}
break;
}
}
}
kspread'QtCalculator::EnterLogn() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1265)
void QtCalculator::EnterLogn()
{
switch(kcalcdefaults.style){
case 2:{
if ( !table_name.isEmpty() )
useData();
ComputeMul();
break;
}
case 1:{
if ( !table_name.isEmpty() )
useData();
if(!inverse){
stats.clearAll();
setStatusLabel(i18n("Stat Mem cleared"));
}
else{
inverse = false;
UpdateDisplay();
}
break;
}
case 0:{
eestate = false;
last_input = OPERATION;
if (!inverse) {
if (DISPLAY_AMOUNT <= 0)
display_error = 1;
else
DISPLAY_AMOUNT = LOG(DISPLAY_AMOUNT);
refresh_display = 1;
UpdateDisplay();
} else if (inverse) {
DISPLAY_AMOUNT = EXP(DISPLAY_AMOUNT);
refresh_display = 1;
inverse =FALSE;
UpdateDisplay();
}
break;
}
}
}
kspread'QtCalculator::base_selected() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1319)
void QtCalculator::base_selected(int number){
switch(number){
case 0:
SetHex();
break;
case 1:
SetDec();
break;
case 2:
SetOct();
break;
case 3:
SetBin();
break;
default: // we shouldn't ever end up here
SetDec();
}
}
kspread'QtCalculator::angle_selected() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1340)
void QtCalculator::angle_selected(int number){
switch(number){
case 0:
SetDeg();
break;
case 1:
SetRad();
break;
case 2:
SetGra();
break;
default: // we shouldn't ever end up here
SetRad();
}
}
kspread'QtCalculator::SetInverse() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1357)
void QtCalculator::SetInverse(){
inverse = ! inverse;
if (inverse){
statusINVLabel->setText("INV");
}
else{
statusINVLabel->setText("NORM");
}
}
kspread'QtCalculator::SetDeg() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1369)
void QtCalculator::SetDeg() {
angle_mode = ANG_DEGREE;
}
kspread'QtCalculator::SetGra() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1373)
void QtCalculator::SetGra() {
angle_mode = ANG_GRADIENT;
}
kspread'QtCalculator::SetRad() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1377)
void QtCalculator::SetRad() {
angle_mode = ANG_RADIAN;
}
kspread'QtCalculator::SetHex() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1382)
void QtCalculator::SetHex() {
/*
* Set Hex Mode
*/
current_base = NB_HEX;
display_size = BOH_SIZE;
decimal_point = 0;
input_limit = 8;
UpdateDisplay();
}
kspread'QtCalculator::SetOct() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1395)
void QtCalculator::SetOct() {
/*
* Set Oct Mode
*/
current_base = NB_OCTAL;
display_size = BOH_SIZE;
decimal_point = 0;
input_limit = 11;
UpdateDisplay();
}
kspread'QtCalculator::SetBin() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1408)
void QtCalculator::SetBin() {
/*
* Set Bin Mode
*/
current_base = NB_BINARY;
display_size = BOH_SIZE;
decimal_point = 0;
input_limit = 16;
UpdateDisplay();
}
kspread'QtCalculator::SetDec() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1421)
void QtCalculator::SetDec()
{
/*
* Set Dec Mode
*/
current_base = NB_DECIMAL;
display_size = DEC_SIZE;
input_limit = 0;
UpdateDisplay();
}
kspread'QtCalculator::EE() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1436)
void QtCalculator::EE()
{
if(inverse){
DISPLAY_AMOUNT = pi;
inverse = FALSE;
UpdateDisplay();
}
else{
if(eestate == true)
eestate = false;
else{
eestate = true;
strcat(display_str,"e");
}
UpdateDisplay();
}
}
kspread'QtCalculator::MR() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1456)
void QtCalculator::MR()
{
eestate = false;
last_input = OPERATION;
DISPLAY_AMOUNT = memory_num;
refresh_display = 1;
UpdateDisplay();
}
kspread'QtCalculator::Mplusminus() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1466)
void QtCalculator::Mplusminus()
{
eestate = false;
EnterEqual();
if (!inverse)
memory_num += DISPLAY_AMOUNT;
else {
memory_num -= DISPLAY_AMOUNT;
inverse = FALSE;
}
}
kspread'QtCalculator::MC() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1479)
void QtCalculator::MC()
{
memory_num = 0;
refresh_display = 1;
}
kspread'QtCalculator::EnterEqual() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1486)
void QtCalculator::EnterEqual()
{
eestate = false;
last_input = OPERATION;
PushStack(&display_data);
refresh_display = 1;
/* if (UpdateStack(0))*/
UpdateStack(0);
UpdateDisplay();
precedence_base = 0;
CALCAMNT* number ;
if(temp_stack.count() > TEMP_STACK_SIZE){
number = temp_stack.getFirst();
temp_stack.removeFirst();
if(number)
free(number);
}
number = (CALCAMNT*) malloc(sizeof(CALCAMNT));
*number = DISPLAY_AMOUNT;
//printf("appending %Lg\n",*number);
temp_stack.append(number);
}
kspread'QtCalculator::Clear() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1520)
void QtCalculator::Clear(){
eestate = false;
input_count = 0;
decimal_point = 0;
if(last_input == OPERATION){
// printf("LAST_INPUT = OPERATION\n");
last_input = DIGIT;
PopStack();
}
else{
// printf("LAST_INPUT = DIGIT\n");
last_input = DIGIT;
}
if( display_error){
display_error = 0;
refresh_display = 0;
}
if (!refresh_display) {
DISPLAY_AMOUNT = 0L;
UpdateDisplay();
}
}
kspread'QtCalculator::ClearAll() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1550)
void QtCalculator::ClearAll()
{
eestate = false;
// last_input = OPERATION;
last_input = DIGIT;
RefreshCalculator();
refresh_display = 1;
}
kspread'QtCalculator::UpdateDisplay() (./koffice/kspread/plugins/calculator/kcalc_core.cpp:1563)
void QtCalculator::UpdateDisplay()
{
// this needs to be rewritten based on whether we are currently
// inputting a number so that the period and the 0 after a period
// are correctly displayed.
CALCAMNT boh_work_d;
long boh_work = 0;
int str_size = 0;
if(eestate && (current_base == NB_DECIMAL)){
calc_display->setText(display_str);
return;
}
if (current_base != NB_DECIMAL) {
MODF(DISPLAY_AMOUNT, &boh_work_d);
if (boh_work_d < LONG_MIN || boh_work_d > ULONG_MAX)
display_error = 1;
/*
* We may be in that never-never land where boh numbers
* turn from positive to negative - if so then we do
* just that, allowing boh negative numbers to be entered
* as read (from dumps and the like!)
*/
else if (boh_work_d > LONG_MAX) {
DISPLAY_AMOUNT =
LONG_MIN+(boh_work_d-LONG_MAX-1);
boh_work = (long)DISPLAY_AMOUNT;
}
else {
DISPLAY_AMOUNT = boh_work_d;
boh_work = (long) boh_work_d;
}
}
if (!display_error) {
if (current_base == NB_BINARY)
str_size = cvb(display_str,
boh_work,
BOH_SIZE);
else if (current_base == NB_OCTAL)
str_size = sprintf(display_str,
"%lo",
boh_work);
else if (current_base == NB_DECIMAL) {
if(!kcalcdefaults.fixed || last_input == DIGIT
|| (DISPLAY_AMOUNT > 1.0e+16)){
// if I don't guard against the DISPLAY_AMOUNT being too large
// kcalc will segfault on larger amount. Such as from typing
// from 5*5*******
str_size = sprintf(display_str,
#ifdef HAVE_LONG_DOUBLE
"%.*Lg", // was *Lg
kcalcdefaults.precision +1,
#else
"%.*g",
kcalcdefaults.precision +1,
#endif
DISPLAY_AMOUNT);
}
else{//fixed
str_size = sprintf(display_str,
#ifdef HAVE_LONG_DOUBLE
"%.*Lf", // was *Lg
kcalcdefaults.fixedprecision ,
#else
"%.*f",
kcalcdefaults.fixedprecision ,
#endif
DISPLAY_AMOUNT);
}// fixed
if ( input_count > 0 && !strpbrk(display_str,"e") &&
last_input == DIGIT ) {
#ifdef HAVE_LONG_DOUBLE
str_size = sprintf(display_str,
"%.*Lf",
(kcalcdefaults.precision +1 > input_count)?
input_count : kcalcdefaults.precision ,
DISPLAY_AMOUNT);
#else
str_size = sprintf(display_str,
"%.*f",
(kcalcdefaults.precision +1 > input_count)?
input_count : kcalcdefaults.precision ,
DISPLAY_AMOUNT);
#endif
}
}
else
if (current_base == NB_HEX)
str_size = sprintf(display_str,
"%lX",
boh_work);
else
display_error = 1;
}
if (display_error || str_size < 0) {
display_error = 1;
strcpy(display_str,"Error");
if(kcalcdefaults.beep)
QApplication::beep();
}
calc_display->setText(display_str);
if (inverse){
statusINVLabel->setText("INV");
}
else{
statusINVLabel->setText("NORM");
}
if (hyp_mode){
statusHYPLabel->setText("HYP");
}
else{
statusHYPLabel->setText("");
}
}
kspread'QtCalculator::useData() (./koffice/kspread/plugins/calculator/main.cpp:175)
void QtCalculator::useData()
{
stats.clearAll();
// How many cells ?
int len = ( table_range.right() - table_range.left() + 1 ) *
( table_range.bottom() - table_range.top() + 1 );
double *v = new double[ len ];
int n = 0;
for( int x = table_range.left(); x <= table_range.right(); x++ )
for( int y = table_range.top(); y <= table_range.bottom(); y++ )
{
KSpreadView* view = corba->view();
KSpreadTable* table = view->doc()->map()->findTable( table_name );
if ( !table )
return;
KSpreadCell* cell = table->cellAt( x, y );
if ( !cell )
return;
v[n++] = cell->valueDouble();
}
for( int i = 0; i < n; i++ )
stats.enterData( v[i] );
delete []v;
table_name = QString::null;
}