Commit cc720f01 authored by David Saxton's avatar David Saxton

Removed Plot-Progress-Bar (was used when drawing integrals), as it is now

redundant due to increased integral calculation speed.

svn path=/trunk/KDE/kdeedu/kmplot/; revision=528590
parent 7aa5ff18
......@@ -51,7 +51,7 @@ install_targets(${LIB_INSTALL_DIR}/kde4 kmplotpart )
########### next target ###############
set(kmplot_SRCS main.cpp kmplot.cpp kmplotprogress.cpp)
set(kmplot_SRCS main.cpp kmplot.cpp)
kde4_automoc(${kmplot_SRCS})
kde4_add_dcop_skels(kmplot_SRCS kmplotIface.h )
......@@ -84,7 +84,7 @@ kde4_footer()
#INCLUDES= $(all_includes)
#
## these are the headers for your project
#noinst_HEADERS = kmplot.h kmplotprogress.h MainDlg.h
#noinst_HEADERS = kmplot.h MainDlg.h
#
#METASOURCES = AUTO
#
......
......@@ -3,7 +3,7 @@ INCLUDES= $(all_includes)
KDE_CXXFLAGS = -DQT3_SUPPORT_WARNINGS
# these are the headers for your project
noinst_HEADERS = kmplot.h kmplotprogress.h MainDlg.h equationedit.h
noinst_HEADERS = kmplot.h MainDlg.h equationedit.h
METASOURCES = AUTO
......@@ -25,7 +25,7 @@ messages: rc.cpp
bin_PROGRAMS = kmplot
# the application source, library search path, and link libraries
kmplot_SOURCES = main.cpp kmplot.cpp kmplotprogress.cpp kmplotIface.skel
kmplot_SOURCES = main.cpp kmplot.cpp kmplotIface.skel
kmplot_LDFLAGS = $(KDE_RPATH) $(all_libraries)
kmplot_LDADD = $(LIB_KPARTS)
......
......@@ -418,19 +418,12 @@ void View::plotfkt(Function *ufkt, QPainter *pDC)
dx = ufkt->integral_precision*(dmax-dmin)/area.width();
// else
// dx = ufkt->integral_precision;
startProgressBar((int)double((dmax-dmin)/dx)/2);
}
while ( x>=dmin && x<=dmax )
{
p2 = dgr.toPixel( realValue( ufkt, p_mode, x ) );
if ( p_mode == Function::Integral && (int(x*100)%2==0) )
{
KApplication::kApplication()->processEvents(); //makes the program usable when drawing a complicated integral function
increaseProgressBar();
}
bool dxAtMinimum = (dx <= base_dx*(5e-5));
bool dxAtMaximum = (dx >= base_dx*(5e+1));
bool dxTooBig = false;
......@@ -498,9 +491,6 @@ void View::plotfkt(Function *ufkt, QPainter *pDC)
else
break; // no derivatives or integrals left to draw
}
if ( stopProgressBar() )
if( stop_calculating)
KMessageBox::error(this,i18n("The drawing was cancelled by the user."));
}
......@@ -618,8 +608,6 @@ void View::drawHeaderTable(QPainter *pDC)
pDC->drawText(0, 300, i18n("Functions:"));
pDC->Lineh(0, 320, 700);
int ypos = 380;
//for(uint ix=0; ix<XParser::self()->countFunctions() && !stop_calculating; ++ix)
// for(QVector<Function>::iterator it=XParser::self()->ufkt.begin(); it!=XParser::self()->ufkt.end() && !stop_calculating; ++it)
foreach ( Function * it, XParser::self()->m_ufkt )
{
for ( unsigned i = 0; i < 2; ++ i )
......@@ -2231,6 +2219,7 @@ bool View::shouldShowCrosshairs() const
return ( underMouse() && area.contains( mousePos ) && (!it || crosshairPositionValid( it )) );
}
bool View::event( QEvent * e )
{
if ( e->type() == QEvent::WindowDeactivate && isDrawing)
......@@ -2241,6 +2230,7 @@ bool View::event( QEvent * e )
return QWidget::event(e); //send the information further
}
void View::setStatusBar(const QString &text, const int id)
{
if ( m_readonly) //if KmPlot is shown as a KPart with e.g Konqueror, it is only possible to change the status bar in one way: to call setStatusBarText
......@@ -2283,29 +2273,7 @@ void View::setStatusBar(const QString &text, const int id)
m_dcop_client->send(m_dcop_client->appId(), "KmPlotShell","setStatusBarText(QString,int)", parameters);
}
}
void View::startProgressBar(int steps)
{
QByteArray data;
QDataStream stream( &data,QIODevice::WriteOnly);
stream.setVersion(QDataStream::Qt_3_1);
stream << steps;
m_dcop_client->send(m_dcop_client->appId(), "KmPlotShell","startProgressBar(int)", data);
}
bool View::stopProgressBar()
{
DCOPCString replyType;
QByteArray replyData;
m_dcop_client->call(m_dcop_client->appId(), "KmPlotShell","stopProgressBar()", QByteArray(), replyType, replyData);
bool result;
QDataStream stream( &replyData,QIODevice::ReadOnly);
stream.setVersion(QDataStream::Qt_3_1);
stream >> result;
return result;
}
void View::increaseProgressBar()
{
m_dcop_client->send(m_dcop_client->appId(), "KmPlotShell","increaseProgressBar()", QByteArray());
}
void View::slidersWindowClosed()
{
......
......@@ -42,7 +42,6 @@
#include <kdebug.h>
#include <kmenu.h>
#include <kprinter.h>
#include <kprogressbar.h>
#include <kpushbutton.h>
......@@ -205,10 +204,6 @@ private:
void invertColor(QColor &, QColor &);
/// Changes the text in the statusbar
void setStatusBar(const QString &text, const int id);
/// Functions for the progressbar
bool stopProgressBar();
void startProgressBar(int);
void increaseProgressBar();
/// @return whether the crosshairs should be shown for the current mouse position
bool shouldShowCrosshairs() const;
/**
......
......@@ -38,7 +38,6 @@
#include <kurl.h>
#include "MainDlg.h"
#include "kmplotprogress.h"
#include <ktoolinvocation.h>
KmPlot::KmPlot( KCmdLineArgs* args)
......@@ -177,30 +176,6 @@ void KmPlot::fileNew()
KToolInvocation::kdeinitExec("kmplot");
}
bool KmPlot::stopProgressBar()
{
if (m_progressbar && m_progressbar->isVisible())
{
m_progressbar->hide();
return true;
}
return false;
}
void KmPlot::startProgressBar(int steps)
{
if (m_progressbar)
{
m_progressbar->progress->setMaximum(steps);
m_progressbar->show();
}
}
void KmPlot::increaseProgressBar()
{
if (m_progressbar)
m_progressbar->increase();
}
void KmPlot::optionsConfigureKeys()
{
......@@ -309,16 +284,7 @@ void KmPlot::setupStatusBar()
statusBar()->changeItem( "", 1 );
statusBar()->changeItem( "", 2 );
statusBar()->setItemAlignment( 3, Qt::AlignLeft );
m_progressbar = new KmPlotProgress( statusBar() );
m_progressbar->setMaximumHeight( statusBar()->height()-10 );
connect( m_progressbar->button, SIGNAL (clicked() ), this, SLOT( progressbar_clicked() ) );
statusBar()->addWidget(m_progressbar);
}
void KmPlot::progressbar_clicked()
{
kapp->dcopClient()->send(kapp->dcopClient()->appId(), "View","stopDrawing()", QByteArray());
}
#include "kmplot.moc"
......@@ -35,7 +35,6 @@
#include <kparts/mainwindow.h>
#include "kmplotIface.h"
#include "kmplotprogress.h"
class KToggleAction;
......@@ -90,9 +89,6 @@ private slots:
void optionsConfigureToolbars();
void applyNewToolbarConfig();
/// Called when the user want to cancel the drawing
void progressbar_clicked();
public slots:
/// Called when fullscren is enabled/disabled
void slotUpdateFullScreen(bool);
......@@ -106,17 +102,11 @@ private:
bool isModified();
void openFileInNewWindow(const KUrl url);
/// Functions for the progressbar
bool stopProgressBar();
void startProgressBar(int);
void increaseProgressBar();
private:
KParts::ReadOnlyPart *m_part;
/// The fullscreen action to be plugged/unplegged to the toolbar
KToggleFullScreenAction* m_fullScreen;
KmPlotProgress *m_progressbar;
};
#endif // KMPLOT_H_
......@@ -43,10 +43,6 @@ k_dcop:
virtual void optionsConfigureKeys() = 0;
virtual void optionsConfigureToolbars() = 0;
virtual void openFileInNewWindow(const KUrl url) = 0;
virtual bool stopProgressBar() = 0;
virtual void startProgressBar(int) = 0;
virtual void increaseProgressBar() = 0;
virtual void fileOpen(const KUrl &url) = 0;
};
......
/*
* KmPlot - a math. function plotter for the KDE-Desktop
*
* Copyright (C) 2004 Fredrik Edemar
* f_edemar@linux.se
*
* This file is part of the KDE Project.
* KmPlot is part of the KDE-EDU Project.
*
* 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 program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <kiconloader.h>
#include <kprogressbar.h>
#include "kmplotprogress.h"
//#include "kmplotprogress.moc.cpp"
KmPlotProgress::KmPlotProgress( QWidget* parent ) : QWidget( parent )
{
button = new KPushButton(this);
button->setIcon( SmallIcon( "cancel" ) );
button->setGeometry( QRect( 0, 0, 30, 23 ) );
button->setMaximumHeight(height()-10);
progress = new KProgressBar(this);
progress->setGeometry( QRect( 30, 0, 124, 23 ) );
progress->setMaximumHeight(height()-10);
hide();
setMinimumWidth(154);
}
KmPlotProgress::~KmPlotProgress()
{
}
void KmPlotProgress::increase()
{
progress->setValue( progress->value()+1);
}
#include "kmplotprogress.moc"
/*
* KmPlot - a math. function plotter for the KDE-Desktop
*
* Copyright (C) 2004 Fredrik Edemar
* f_edemar@linux.se
*
* This file is part of the KDE Project.
* KmPlot is part of the KDE-EDU Project.
*
* 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 program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef kmplotprogress_included
#define kmplotprogress_included
#include <kprogressbar.h>
#include <kpushbutton.h>
#include <qwidget.h>
/// The progress-widget in the statusbar which appears when drawing integrals
class KmPlotProgress: public QWidget
{
Q_OBJECT
public:
KmPlotProgress( QWidget* parent = 0 );
~KmPlotProgress();
void increase();
KPushButton *button;
KProgressBar *progress;
};
#endif // kmplotprogress_included
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment