/* * MathPlanner 3.1 - Mathematical design tool. * Copyright(C) 2002 Jarmo Nikkanen * * 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. * * You should have received a copy of the GNU General Public License with this program. * */ #ifndef _MATHPLANNER_PAPER_H #define _MATHPLANNER_PAPER_H #include #include #include #include #include #include #include #include #include #include #include "Extern.h" class MathFrame; class ApplicationControl; class NMemory; class config_file_reader; class DataStorage; class Paper : public QWidget { Q_OBJECT private: bool exclude_i; int Focused_function; int *Order; int Function_count,selections; double WorldScaleX,WorldScaleY; QPoint Begin_move_align; bool Begin_move,Begin_resize,selectposition; QRect PaperLimits,Printable; int Grid; QColor GridColor; QTimer Timer; QPoint mouseposition; QPixmap DragImage; QBitmap CRectPixmap; QCursor RectCursor; QPoint selectrect_begin_point; QRect selectionrect,selectionrect_old; int sel_pos_msg,sel_pos_to,sel_rect_msg,sel_rect_to; bool selectrect,selectrect_begin,multiselection; QPoint start_point[64]; class MathFrame *selected[64]; class MathFrame **function; class NMemory *function_mem; class NMemory *Order_mem; class NMemory *Position_mem; public: class config_file_reader *Prefs; class ApplicationControl *AppControl; Paper(QWidget *,QRect,class ApplicationControl *); void CalculateAll(); DataStorage *BuildStorage(); void Record(DataStorage *); void SelectPosition(int msg,int to); // Enable position selection void SelectRect(int msg,int to); // Enable position selection void dragEnterEvent(QDragEnterEvent *); void dropEvent(QDropEvent *); void StartDragging(); void CopyObject(); void PasteObject(QPoint point=QPoint(0,0)); QImage CreateImage(class MathFrame *); void New(); void UpDate(); void DrawFunction(class MathFrame *,bool rep=true); void Draw(QPainter *,QRect,bool); void DrawSelectionRect(QPainter *paint); void DrawGrid(QPainter *); QRect Scale(int zoom,QRect); QPoint ScreenToDocument(QPoint); QRect ScreenToDocument(QRect); void UnFocusCurrentFunction(); void FocusFunction(int no); void FocusFunction(MathFrame *); class MathFrame *GetFocus(); class m_function_object *GetFunctionFocus(); void SetNewFunctionAfter(class MathFrame *); void DeleteCurrentFunction(); void AddGraph(); void keyPressEvent(class QKeyEvent *); void MessageReceived(DataStorage *msg,int rec); void PostMessage(DataStorage *msg,int dest=TO_FRAME); private: void SetSelection(MathFrame *); void ClearSelections(); int Selections(); QPoint FixedFunctionPosition(int no); void FindSelectedFunctions(); MathFrame *SelectedFunction(int); bool MoveFunction(MathFrame *,QPoint); void CursorAction(QPoint); void Snap(QPoint p,int *x,int *y); void DeleteEmptyFunctions(); void SetFunctionSpace(int); void AddFunctionSpace(int); int FindFunctionIndex(class MathFrame *); void AddFunction(QPoint p,class MathFrame *,bool flag=false); void DeleteFunction(int i); bool CheckPoint(QPoint); void mousePressEvent(class QMouseEvent *); void mouseReleaseEvent(class QMouseEvent *); void mouseMoveEvent(class QMouseEvent *); void paintEvent(class QPaintEvent *); int OrderFunctions(); private slots: void TimeOut(); }; #endif