File: posedit.h

package info (click to toggle)
muse 0.6.3-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,936 kB
  • ctags: 7,446
  • sloc: cpp: 66,262; sh: 8,355; makefile: 755; ansic: 172
file content (98 lines) | stat: -rw-r--r-- 2,542 bytes parent folder | download
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
//=========================================================
//  MusE
//  Linux Music Editor
//    $Id: posedit.h,v 1.1.1.1 2003/10/29 10:06:27 wschweer Exp $
//  (C) Copyright 2001 Werner Schweer (ws@seh.de)
//=========================================================

#ifndef __POSEDIT_H__
#define __POSEDIT_H__

#include <qwidget.h>
#include <qstring.h>
#include "pos.h"

class PosEditor;
class QSpinWidget;

#include "section.h"

//---------------------------------------------------------
//   PosEdit
//---------------------------------------------------------

class PosEdit : public QWidget
      {
      Q_OBJECT
      Q_PROPERTY(QString separator READ separator WRITE setSeparator)
      Q_PROPERTY(bool smpte READ smpte WRITE setSmpte)

      void init();
      void setSections();
      QString sectionText(int sec);
      Section midiSections[3];
      Section smpteSections[4];
      Section* sec;

      bool _smpte;

      bool adv;
      bool overwrite;
      int timerId;
      bool typing;
      Pos min;
      Pos max;
      bool changed;
      PosEditor *ed;
      QSpinWidget* controls;

   private slots:
      void stepUp();
      void stepDown();

   signals:
      void valueChanged(const Pos&);

   protected:
      bool event(QEvent *e );
      void timerEvent(QTimerEvent* e);
      void resizeEvent(QResizeEvent*);
      QString sectionFormattedText(int sec);
      void addNumber(int sec, int num);
      void removeLastNumber(int sec);
      bool setFocusSection(int s);

      virtual bool outOfRange(int, int) const;
      virtual void setSec(int, int);
      friend class PosEditor;

   protected slots:
      void updateButtons();

   public slots:
      virtual void setValue(const Pos& time);
      void setValue(int t);
      void setValue(const QString& s);

   public:
      PosEdit(QWidget*,  const char* = 0);
      PosEdit(const Pos& time, QWidget*,  const char* = 0);
      ~PosEdit();

      QSize sizeHint() const;
      Pos pos() const;
      virtual void setAutoAdvance(bool advance) { adv = advance; }
      bool autoAdvance() const                  { return adv; }

      virtual void setMinValue(const Pos& d)    { setRange(d, maxValue()); }
      Pos minValue() const;
      virtual void setMaxValue( const Pos& d )  { setRange(minValue(), d ); }
      Pos maxValue() const;
      virtual void setRange(const Pos& min, const Pos& max);
      QString separator() const;
      virtual void setSeparator(const QString& s);
      void setSmpte(bool);
      bool smpte() const;
      };

#endif