GeopsyGui/PickLayer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyGui.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2006-04-21
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef PICKLAYER_H
00029 #define PICKLAYER_H
00030 
00031 #include <GeopsyCore.h>
00032 #include <SciFigs.h>
00033 #include "PickFormat.h"
00034 #include "GeopsyGuiDLLExport.h"
00035 
00036 namespace GeopsyGui {
00037 
00038 class SignalLayer;
00039 
00040 class GEOPSYGUI_EXPORT PickLayer : public GraphContentLayer
00041 {
00042   Q_OBJECT
00043 public:
00044   PickLayer(AxisWindow * parent=0);
00045   PickLayer(SignalLayer * sig);
00046   ~PickLayer();
00047 
00048   virtual const QString& xml_tagName() const {return xmlPickLayerTag;}
00049   static const QString xmlPickLayerTag;
00050 
00051   virtual Rect boundingRect() const;
00052 
00053   virtual bool hasProperties() {return true;}
00054   virtual void addProperties(PropertyProxy * pp);
00055   virtual void removeProperties(PropertyProxy * pp);
00056   virtual void properties(PropertyWidget * w) const;
00057   virtual void setProperty(uint wid, int pid, QVariant val);
00058 
00059   PickFormat& format() {return _format;}
00060   const PickFormat& format() const {return _format;}
00061 public slots:
00062   virtual void setPick(const QString& pickName=QString::null);
00063   void toggleMouseLine(bool b);
00064 signals:
00065   void mousePressed(bool& accept, QMouseEvent * e, int iSig, QRect * trackingRect);
00066   void mouseReleased(bool& accept, QMouseEvent * e);
00067   void mouseMoved(double t);
00068   void mouseMoved(const QPoint& pt);
00069   void pickBegin(bool magnify, int context, double time, Signal * sig, int iSig);
00070   void pickChanged(Signal * sig);
00071   void pickEnd();
00072   void currentSignalChanged(Signal * sig, int iSig);
00073 protected:
00074   void initMembers();
00075   virtual void paintData(const LayerPainterRequest& lp, QPainter& p, double dotpercm) const;
00076   virtual void paintText(const LayerPainterRequest& lp, double dotpercm);
00077   virtual bool eventFilter(QObject *obj, QEvent *event);
00078   virtual bool mousePressEvent (QMouseEvent * e, int);
00079   virtual bool mouseReleaseEvent (QMouseEvent * e, int);
00080   virtual void mouseMoveEvent (const QPoint& pt, Qt::MouseButtons, Qt::KeyboardModifiers);
00081   virtual bool keyPressEvent (QKeyEvent * e);
00082 
00083   virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00084   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00085 
00086   void addActions ();
00087 
00088   SignalLayer * _sig;
00089 
00090   // While this is positive, a blue line is following the mouse
00091   int _showMouseLine;
00092   // Currently modified signals, -1 if no pick is being modified
00093   int _iSigPick;
00094   // Currently modified pick
00095   QString _pickName;
00096 
00097   PickFormat _format;
00098   static uint _tab;
00099 private:
00100   QList<QPainterPath> _textPaths;
00101   mutable QMutex _textPathsMutex;
00102 };
00103 
00104 } // namespace GeopsyGui
00105 
00106 #endif // PICKLAYER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines