/* Emacs, this is -*- C++ -*- */

#ifndef _XYPLOT_H_
#define _XYPLOT_H_


#include <qobject.h>
#include <qfile.h>
#include <qwidget.h>
#include <qpopmenu.h>
#include <qpainter.h>
#include <qpixmap.h>

#include "plot.h"
#include "page.h"
#include "column.h"


class KConfig;


/** This class is for X/Y plot internal use only.

	It holds information for exactly one dataset (i.e. X, Y, Xerror,
	Yerror, label column), and how to draw it.

	@short Internal auxillary class.
*/

class XYPlotRecord
{
public:
  enum XYPlotMarker {
	NoMarker,
	Square,
	Diamond,
	Circle,
	Point
  };
  
public:
  XYPlotRecord ();
  XYPlotRecord (const XYPlotRecord&);

  Worksheet* worksheet;
  bool re_calc;
  QPen pen;
  QColor color;
  XYPlotMarker marker;
  Column input [5];
};


/** This class is for X/Y plot internal use only.

	It holds information on how to plot the axes.

	@short Internal auxillary class.
*/

class XYAxisRecord
{
public:
  bool auto_x;
  bool auto_y;
  int log_x;
  int log_y;
  double xmin, xmax;
  double ymin, ymax;
  int x_steps;
  int y_steps;
  bool x_zero;
  bool y_zero;
  bool x_at_zero;
  bool y_at_zero;
  char x_format [64];
  char y_format [64];
  QColor x_color;
  QColor y_color;
  QFont x_font;
  QFont y_font;
  QPen x_pen;
  QPen y_pen;
public:
  XYAxisRecord ();
  XYAxisRecord (const XYAxisRecord& rhs);
};


/** This is an Y vs. X plot.

	It is currently under construction, as is the documentation
	for it. You should not edit anything here since this file
	(as the whole X/Y plot) is subject to rapid change.

	@short X/Y plot type.
	@author Patrick Schemitz
	@version build 980210
*/

class Plot.html">XYPlot : public Plot
{
  Q_OBJECT

public:

  XYPlot ();
  ~XYPlot ();
  void instantiate (Page*, QWidget* parent=0, const char* name=0, WFlags f=0);
  Plot* clone ();
  
  QPopupMenu* menu (QPopupMenu* predefined = 0);
  
  //void activate ();
  //void deactivate ();

  void storeOptions ();
  void restoreOptions ();
  const char* start_mark () { return "<xyplot>\n"; }
  const char* end_mark () { return "</xyplot>\n"; }
  bool store (QFile& f, bool);
  bool restore (QFile& f, bool);

  const char* name ();
  const char* description ();
  QPixmap* icon ();
  
  int paramCount ();
  const char* paramName (int i);
  
  void paint (QPainter* p);
  void mousePressEvent (QMouseEvent*);

public slots:

  void optionsDialog ();
  void plotSelectedColumns ();

private slots:

  void slotAxis ();
  void slotDataset ();

private:

  friend class XYPlotAxisDialog;
  friend class XYPlotDatasetDialog;

  static XYAxisRecord* defaultAxis;
  static XYPlotRecord* defaultSet;

  XYAxisRecord* axis;
  QList<XYPlotRecord> records;

  bool prepare ();
  bool paintAxis (QPainter*);
  bool paintSets (QPainter*);
  bool findSetRange (XYPlotRecord*, double&, double&, double&, double&);

  //void preparePaint ();
  //void paintSet (QPainter*, int);
  int x2pixel (double);
  int y2pixel (double);
  double pixel2x (int);
  double pixel2y (int);
  // ...
};


#endif /* _XYPLOT_H_ */

Documentation generated by patrick@nemesis on Tue Feb 10 23:05:12 MET 1998