Commit 73af1509 authored by David Saxton's avatar David Saxton

Implemented new KmPlot UI, as mentioned on kde-edu ml. All the plot dialogs

have been removed, and their functionality has been put into a QDockWidget in
the main view.

svn path=/trunk/KDE/kdeedu/kmplot/; revision=524074
parent 7402f5db
......@@ -11,48 +11,48 @@
</ignoreparts>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description></description>
<description/>
<secondaryLanguages>
<language>C++</language>
</secondaryLanguages>
<versioncontrol></versioncontrol>
<versioncontrol/>
</general>
<kdevcustomproject>
<run>
<mainprogram>kmplot/kmplot</mainprogram>
<directoryradio>executable</directoryradio>
<customdirectory>/</customdirectory>
<programargs></programargs>
<programargs/>
<terminal>false</terminal>
<autocompile>true</autocompile>
<envvars/>
</run>
<build>
<buildtool>make</buildtool>
<builddir></builddir>
<builddir/>
</build>
<make>
<abortonerror>false</abortonerror>
<numberofjobs>1</numberofjobs>
<dontact>false</dontact>
<makebin></makebin>
<makebin/>
<selectedenvironment>default</selectedenvironment>
<environments>
<default/>
</environments>
<makeoptions></makeoptions>
<makeoptions/>
<prio>0</prio>
<defaulttarget></defaulttarget>
<defaulttarget/>
</make>
</kdevcustomproject>
<kdevdebugger>
<general>
<dbgshell></dbgshell>
<programargs></programargs>
<gdbpath></gdbpath>
<configGdbScript></configGdbScript>
<runShellScript></runShellScript>
<runGdbScript></runGdbScript>
<dbgshell/>
<programargs/>
<gdbpath/>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
......@@ -141,10 +141,10 @@
<qt>
<used>false</used>
<version>3</version>
<root></root>
<root/>
</qt>
<creategettersetter>
<prefixGet></prefixGet>
<prefixGet/>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
......@@ -153,7 +153,10 @@
</creategettersetter>
</kdevcppsupport>
<kdevfileview>
<groups/>
<groups>
<hidenonprojectfiles>false</hidenonprojectfiles>
<hidenonlocation>false</hidenonlocation>
</groups>
<tree>
<hidepatterns>*.o,*.lo,CVS,*.moc,*~</hidepatterns>
<hidenonprojectfiles>false</hidenonprojectfiles>
......@@ -167,8 +170,8 @@
</cppsupportpart>
<kdevvisualadvance>
<emulator>VisualBoyAdvance</emulator>
<binary></binary>
<addOptions></addOptions>
<binary/>
<addOptions/>
<terminal>false</terminal>
<fullscreen>false</fullscreen>
<graphicFilter>-f0</graphicFilter>
......@@ -176,13 +179,13 @@
</kdevvisualadvance>
<kdevdocumentation>
<projectdoc>
<docsystem></docsystem>
<docurl></docurl>
<usermanualurl></usermanualurl>
<docsystem/>
<docurl/>
<usermanualurl/>
</projectdoc>
</kdevdocumentation>
<ctagspart>
<customArguments></customArguments>
<customTagfilePath></customTagfilePath>
<customArguments/>
<customTagfilePath/>
</ctagspart>
</kdevelop>
......@@ -87,3 +87,5 @@ kmplot/keditpolar.cpp
kmplot/keditpolar.h
kmplot/qeditparametric.ui
kmplot/qeditpolar.ui
/functioneditor.h
/functioneditor.cpp
......@@ -6,18 +6,15 @@ include_directories( ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_D
########### next target ###############
set(kmplotpart_PART_SRCS
functioneditor.cpp
parser.cpp
xparser.cpp
diagr.cpp
View.cpp
MainDlg.cpp
FktDlg.cpp
kprinterdlg.cpp
kconstanteditor.cpp
kparametereditor.cpp
keditparametric.cpp
keditpolar.cpp
editfunction.cpp
kminmax.cpp
kmplotio.cpp
ksliderwindow.cpp
......@@ -26,14 +23,9 @@ set(kmplotpart_PART_SRCS
kde4_automoc(${kmplotpart_PART_SRCS})
kde4_add_ui_files(kmplotpart_PART_SRCS
functioneditorwidget.ui
editcoords.ui
editderivativespage.ui
editfunctionpage.ui
editintegralpage.ui
editscaling.ui
FktDlgData.ui
qeditparametric.ui
qeditpolar.ui
qminmax.ui
qparametereditor.ui
settingspagecolor.ui
......
This diff is collapsed.
/*
* KmPlot - a math. function plotter for the KDE-Desktop
*
* Copyright (C) 1998, 1999 Klaus-Dieter M�ler
* 2000, 2002 kd.moeller@t-online.de
*
* 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.
*
*/
/** @file FktDlg.h
* @brief Contains the FktDlg class. Entering and editing functions equation and attributes.
*/
#ifndef FktDlg_included
#define FktDlg_included
// locale includes
#include "FktDlgData.h"
#include "View.h"
#include <kdialog.h>
#include <QShowEvent>
class FktDlgData;
class XParser;
/** @short This widget class handles the users function input.
*
* The list of stored plots is shown. The entries can be edited and/or removed.
* New plots can be entered calling special dialog windows.
* @see KEditFunction, KEditParametric, KEditPolar
*/
class FktDlg : public KDialog
{
Q_OBJECT
public:
/**
* The constructor gets the current parser instance
* @param parent Parent widget.
* @param view points to the current view instance.
*/
FktDlg( QWidget* parent, View* view );
/// Empty destructor.
virtual ~FktDlg();
/// Fill the widgets with plots contained in the parser instance.
void getPlots();
/// Returns true if a function was changed
bool isChanged();
public slots:
/// Pressed on the "Copy Function.." button
void slotCopyFunction();
/// Pressed on the "Move Function.." button
void slotMoveFunction();
protected slots:
/// Delete selected plot
void slotDelete();
/// Edit selected Plot
void slotEdit();
/// Enables/disables actions if the list has a/no selection.
void slotHasSelection();
void lb_fktliste_doubleClicked(QListWidgetItem *);
void lb_fktliste_clicked(QListWidgetItem * item);
/// called after item is clicked on to check the check state
void checkCurrentItemCheckState();
/// Edit a function plot.
/// @param id Id of the function plot to edit
/// @see KEditFunction
void slotEditFunction( int id = -1 );
/// Edit a parametric plot.
/// @param x_id Function index to edit
/// @param y_id Function index to edit
/// @see KEditParametric
void slotEditParametric( int x_id = -1, int y_id = -1 );
/// Edit a polar plot.
/// @param id Function index of the parser instance.
/// @see KEditPolar
void slotEditPolar( int id = -1 );
/// Edit a new function plot.
void slotNewFunction();
/// Edit a new parametric plot.
void slotNewParametric();
/// Edit a new polar plot.
void slotNewPolar();
/// Invoke Help
void slotHelp();
private:
/// Looks up the id of \a f_str in the parser instance.
int getId( const QString &f_str );
/// Looks up the indices of the parametric pair of function.
int getParamId( const QString &f_str );
/// Update the view of the main window.
void updateView();
/// Called when the dialog is showed
void showEvent ( QShowEvent * );
// /// Send a function to an other instance of Kmplot. Returns true if it success, otherwise false
// bool sendFunction();
/// Ponts to the parser instance.
View* m_view;
/// indicates if a function is changed/added/removed
bool changed;
/// pointer to the main widget (FktDlgData) in this dialog
FktDlgData * m_mainWidget;
};
class FktDlgData : public QWidget, public Ui::FktDlgData
{
public:
FktDlgData( QWidget * parent = 0 )
: QWidget( parent )
{ setupUi(this); }
};
#endif // FktDlg_included
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>FktDlgData</class>
<widget class="QWidget" name="FktDlgData" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>545</width>
<height>334</height>
</rect>
</property>
<property name="windowTitle" >
<string>Edit Plots</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="8" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>170</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item rowspan="9" row="0" column="0" >
<widget class="QListWidget" name="lb_fktliste" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>255</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="5" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>170</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1" >
<widget class="QPushButton" name="cmdCopyFunction" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>define a new function</string>
</property>
<property name="whatsThis" >
<string>Click here to define a new function. There are 3 types of function, explicit given functions, parametric plots and polar plots. Choose the appropriate type from the drop down list.</string>
</property>
<property name="text" >
<string>&amp;Copy Function...</string>
</property>
</widget>
</item>
<item row="7" column="1" >
<widget class="QPushButton" name="cmdMoveFunction" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>define a new function</string>
</property>
<property name="whatsThis" >
<string>Click here to define a new function. There are 3 types of function, explicit given functions, parametric plots and polar plots. Choose the appropriate type from the drop down list.</string>
</property>
<property name="text" >
<string>&amp;Move Function...</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="PushButtonEdit" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>edit the selected function</string>
</property>
<property name="whatsThis" >
<string>Click here to edit the selected function.</string>
</property>
<property name="text" >
<string>&amp;Edit...</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="PushButtonNewPolar" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>define a new function</string>
</property>
<property name="whatsThis" >
<string>Click here to define a new function. There are 3 types of function, explicit given functions, parametric plots and polar plots. Choose the appropriate type from the drop down list.</string>
</property>
<property name="text" >
<string>&amp;New Polar Plot...</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="PushButtonNewFunction" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>define a new function</string>
</property>
<property name="whatsThis" >
<string>Click here to define a new function. There are 3 types of function, explicit given functions, parametric plots and polar plots. Choose the appropriate type from the drop down list.</string>
</property>
<property name="text" >
<string>New &amp;Function Plot...</string>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="PushButtonNewParametric" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>define a new function</string>
</property>
<property name="whatsThis" >
<string>Click here to define a new function. There are 3 types of function, explicit given functions, parametric plots and polar plots. Choose the appropriate type from the drop down list.</string>
</property>
<property name="text" >
<string>New &amp;Parametric Plot...</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QPushButton" name="PushButtonDel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>delete the selected function</string>
</property>
<property name="whatsThis" >
<string>Click here to delete the selected function from the list.</string>
</property>
<property name="text" >
<string>&amp;Delete</string>
</property>
</widget>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>
......@@ -25,8 +25,9 @@
*/
// Qt includes
#include <qslider.h>
#include <QMainWindow>
#include <QPixmap>
#include <qslider.h>
// KDE includes
#include <dcopclient.h>
......@@ -45,9 +46,7 @@
#include <ktoolinvocation.h>
// local includes
#include "editfunction.h"
#include "keditparametric.h"
#include "keditpolar.h"
#include "functioneditor.h"
#include "kprinterdlg.h"
#include "kconstanteditor.h"
#include "MainDlg.h"
......@@ -79,11 +78,18 @@ MainDlg::MainDlg(QWidget *parentWidget, const char *, QObject *parent ) : DCOPO
m_readonly = true;
new BrowserExtension(this); // better integration with Konqueror
}
fdlg = 0;
coordsDialog = 0;
m_popupmenu = new KMenu(parentWidget);
view = new View( m_readonly, m_modified, m_popupmenu, parentWidget, actionCollection() );
connect( view, SIGNAL( setStatusBarText(const QString &)), this, SLOT( setReadOnlyStatusBarText(const QString &) ) );
if ( !m_readonly )
{
m_functionEditor = new FunctionEditor( view, parentWidget );
static_cast<QMainWindow*>(parentWidget)->addDockWidget( Qt::LeftDockWidgetArea, m_functionEditor );
}
setWidget( view );
view->setFocusPolicy(Qt::ClickFocus);
minmaxdlg = new KMinMax(view, m_parent);
......@@ -144,7 +150,7 @@ void MainDlg::setupActions()
//END file menu
//BEGIN zoom menu
//BEGIN view menu
KAction * zoomIn = new KAction( i18n("Zoom &In"), actionCollection(), "zoom_in" );
zoomIn->setShortcut( "CTRL+1" );
zoomIn->setIcon( KIcon("viewmag+") );
......@@ -157,17 +163,7 @@ void MainDlg::setupActions()
KAction * zoomTrig = new KAction( i18n("&Fit Widget to Trigonometric Functions"), actionCollection(), "zoom_trig" );
connect( zoomTrig, SIGNAL(triggered(bool)), view, SLOT( mnuTrig_clicked() ) );
//END zoom menu
//BEGIN help menu
KAction * namesAction = new KAction( i18n( "Predefined &Math Functions" ), actionCollection(), "names" );
namesAction->setIcon( KIcon("functionhelp") );
connect( namesAction, SIGNAL(triggered(bool)), this, SLOT( slotNames() ) );
//END help menu
//BEGIN edit menu
KAction * editAxes = new KAction( i18n( "&Coordinate System..." ), actionCollection(), "editaxes" );
editAxes->setIcon( KIcon("coords.png") );
connect( editAxes, SIGNAL(triggered(bool)), this, SLOT( editAxes() ) );
......@@ -187,27 +183,8 @@ void MainDlg::setupActions()
KAction * coordIII = new KAction( i18n( "Coordinate System III" ), actionCollection(), "coord_iii" );
coordIII->setIcon( KIcon("ksys3.png") );
connect( coordIII, SIGNAL(triggered(bool)), this, SLOT( slotCoord3() ) );
//END edit menu
//BEGIN plot menu
KAction * newFunction = new KAction( i18n( "&New Function Plot..." ), actionCollection(), "newfunction" );
newFunction->setIcon( KIcon("newfunction") );
connect( newFunction, SIGNAL(triggered(bool)), this, SLOT( newFunction() ) );
KAction * newParametric = new KAction( i18n( "New Parametric Plot..." ), actionCollection(), "newparametric" );
newParametric->setIcon( KIcon("newparametric") );
connect( newParametric, SIGNAL(triggered(bool)), this, SLOT( newParametric() ) );
//END view menu
KAction * newPolar = new KAction( i18n( "New Polar Plot..." ), actionCollection(), "newpolar" );
newPolar->setIcon( KIcon("newpolar") );
connect( newPolar, SIGNAL(triggered(bool)), this, SLOT( newPolar() ) );
KAction * editPlots = new KAction( i18n( "Edit Plots..." ), actionCollection(), "editplots" );
editPlots->setIcon( KIcon("editplots") );
connect( editPlots, SIGNAL(triggered(bool)), this, SLOT( slotEditPlots() ) );
//END plot menu
//BEGIN tools menu
KAction *mnuYValue = new KAction( i18n( "&Get y-Value..." ), actionCollection(), "yvalue" );
......@@ -226,10 +203,14 @@ void MainDlg::setupActions()
mnuArea->setIcon( KIcon("") );
connect( mnuArea, SIGNAL(triggered(bool)),this, SLOT( graphArea() ) );
//END tools menu
m_quickEditAction = new QuickEditAction( actionCollection(), "quickedit" );
connect( m_quickEditAction, SIGNAL( completed( const QString& ) ), this, SLOT( slotQuickEdit( const QString& ) ) );
//BEGIN help menu
KAction * namesAction = new KAction( i18n( "Predefined &Math Functions" ), actionCollection(), "names" );
namesAction->setIcon( KIcon("functionhelp") );
connect( namesAction, SIGNAL(triggered(bool)), this, SLOT( slotNames() ) );
//END help menu
view->m_menuSliderAction = new KToggleAction( i18n( "Show Sliders" ), actionCollection(), "options_configure_show_sliders" );
connect( view->m_menuSliderAction, SIGNAL(triggered(bool)), this, SLOT( toggleShowSliders() ) );
......@@ -268,6 +249,8 @@ void MainDlg::setupActions()
mnuMaxValue->plug(m_popupmenu);
mnuArea->plug(m_popupmenu);
}
bool MainDlg::checkModified()
{
if( m_modified )
......@@ -495,114 +478,6 @@ void MainDlg::slotNames()
KToolInvocation::invokeHelp( "func-predefined", "kmplot" );
}
void MainDlg::newFunction()
{
EditFunction* editFunction = new EditFunction( view->parser(), m_parent );
editFunction->setCaption(i18n( "New Function Plot" ) );
editFunction->initDialog();