summaryrefslogtreecommitdiffstats
path: root/kmplot/kmplot/FktDlg.h
blob: c0b914e2fcc73c5e9f53ba25741522184ea40a98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
* 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"

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 FktDlgData
{
	Q_OBJECT
  TQ_OBJECT

public:
	/** 
	 * The constructor gets the current parser instance
	 * @param tqparent Parent widget.
	 * @param view points to the current view instance.
	 */
	FktDlg( TQWidget* tqparent, 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(TQListViewItem *, const TQPoint &, int);
	void lb_fktliste_clicked(TQListViewItem * item);
	void lb_fktliste_spacePressed(TQListViewItem * item);
	
	/// 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 TQString &f_str );
	/// Looks up the indices of the parametric pair of function.
	int getParamId( const TQString &f_str );
	/// Update the view of the main window.
	void updateView();
	/// Called when the dialog is showed
	void showEvent ( TQShowEvent * );
	// /// 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;
};

#endif // FktDlg_included