File: dataview.h.old

package info (click to toggle)
mixviews 1.20-10.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,928 kB
  • ctags: 5,960
  • sloc: cpp: 32,879; ansic: 2,110; makefile: 445; sh: 17
file content (183 lines) | stat: -rw-r--r-- 6,087 bytes parent folder | download | duplicates (2)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// dataview.h

/******************************************************************************
 *
 *  MiXViews - an X window system based sound & data editor/processor
 *
 *  Copyright (c) 1993, 1994 Regents of the University of California
 *
 *  Author:     Douglas Scott
 *  Date:       December 13, 1994
 *
 *  Permission to use, copy and modify this software and its documentation
 *  for research and/or educational purposes and without fee is hereby granted,
 *  provided that the above copyright notice appear in all copies and that
 *  both that copyright notice and this permission notice appear in
 *  supporting documentation. The author reserves the right to distribute this
 *  software and its documentation.  The University of California and the author
 *  make no representations about the suitability of this software for any 
 *  purpose, and in no event shall University of California be liable for any
 *  damage, loss of data, or profits resulting from its use.
 *  It is provided "as is" without express or implied warranty.
 *
 ******************************************************************************/


// The base class for the objects which control the visual display of Data
// objects.  Its members are:  a pointer to the Data instance, a pointer to 
// the associated Controller, an array of Graph subclass instances, and various
// pointers to internal graphic elements.  The Controller invokes DataView
// methods to change the display of the Data, and the DataView passes these
// messages on to its Graph subclass instances, which do the actual "work".

#ifndef DATAVIEW_H
#ifdef __GNUG__
#pragma interface
#endif
#define DATAVIEW_H

#include <InterViews/scene.h>
#include "range.h"

class HScale;
class VBox;
class Panner;
class Event;
class Perspective;
class Data;
class Controller;
class Graph;
class EditStatusDelegate;
class Block;

// Assisting class passed as an argument to the DataView constructor.

class ViewInfo {
public:
	ViewInfo();
	ViewInfo(RangeUnit units);
	ViewInfo(RangeUnit, const Range&, const Range&);
	RangeUnit rangeUnits;
	Range frameRange;
	Range channelRange;
};

class DataView : public MonoScene {
public:
	DataView(Controller *, ViewInfo &);
	virtual ~DataView();
	
	redefined void Adjust(Perspective &);
	redefined void Handle(Event &);
	redefined void Update();
	redefined void Reconfig();

	// methods invoked by menu items
	virtual void horizontalZoom();
	virtual void horizontalUnZoom();
	virtual void verticalZoom();
	virtual void verticalUnZoom();
	virtual void setVisibleFrameRange();
	virtual void resetVerticalRange();
	virtual void setChannelRange() {}
	virtual void shiftChannelViewUp() {}
	virtual void shiftChannelViewDown() {}
	virtual void setInsertPoint();
	virtual void setEditRegion();
	virtual void toggleGraphMode() {}

	virtual Range getHorizScaleRange()=0;
	virtual Range getVisibleFrameRange()=0;
	virtual void resetHorizontalScale() {}
	virtual void setVisibleFrameRange(const Range &)=0;
	virtual void setInsertPoint(int, const Range&, boolean scroll=true)=0;
	virtual void setEditRegion(const Range&, const Range&, boolean scroll=true)=0;
	virtual void unselect();
	virtual Range getChannelRange()=0;
	virtual void setChannelRange(const Range &)=0;
	virtual Range getDisplayedHorizRange();

	virtual void setHorizScaleLabel(const char *);
	virtual void showVerticalScales(boolean show);
	virtual boolean horizScaleInFrames();
	virtual RangeUnit horizRangeUnits() { return currentRangeUnits; }
	virtual boolean frameScaleInFrames()=0;
	virtual double horizontalScalingFactor();
	virtual boolean keyCommand(unsigned INT32 cmd);
protected:
	redefined void Resize();

	virtual void setHorizScaleTo(RangeUnit);
	virtual void setHorizRangeUnits(RangeUnit unit) { currentRangeUnits = unit; }
	Perspective& constrainView(Perspective &);
	virtual int graphsVisible() { return graphsShown; }
	virtual void incrementGraphsVisible() { graphsShown++; }
	virtual void decrementGraphsVisible() { graphsShown--; }
	virtual void updateGraphs();
	virtual void doChange();
	virtual void graphEvent(Interactor *, Event &);
	virtual void unselectOthers(Interactor *);
	virtual void addGraph(Graph *);
	virtual void removeGraph(boolean update);
	boolean doForGraphs(Block &);
	Graph* topGraph() { return graphs[0]; }	// for use by subclasses only
protected:
	Data *dataptr;
	Controller *controller;
	VBox *interior;
	VBox *graphBox;
	HScale *hscale;
	Perspective* shown;
private:
	friend Controller;
	friend class ViewChanger;

	void Init(ViewInfo &);
	virtual void initPerspective()=0;
	virtual void checkPerspective()=0;
	virtual Perspective* getVerticalPerspective() { return GetPerspective(); }
	virtual Perspective* getHorizontalPerspective() { return GetPerspective(); }
	Interactor *makeEditStatusPanel();
	EditStatusDelegate* getEditDelegate() { return editDelegate; }
	virtual const char* plotWidthAttribute()=0;
	virtual void constrainHorizontalView(Perspective &);
	virtual void constrainVerticalView(Perspective &) {}
	virtual int horizScaleLeftSpacer();
	virtual int horizScaleRightSpacer() { return 0; }
	void expandGraphArray();
	
	EditStatusDelegate* editDelegate;
	Coord cursorLoc;
	Graph **graphs;
	Interactor* viewScroller;
	int graphsShown;
	int maxGraphs;
	boolean perspectiveSet;		// used to determine whether to initialize
	RangeUnit currentRangeUnits;
};

class StatusPanel;

// This class functions as a relay for messages invoked by the DataEditor
// object regarding the numeric display of information about the data and its
// editing status.  These messages are passed on to the StatusPanel members
// which display the numbers (these are visually contained within the View
// window).

class EditStatusDelegate : public Resource {
public:
	virtual ~EditStatusDelegate();
	void update(const Range& current);
	void update() { update(editRange); }
private:
	friend DataView;
	EditStatusDelegate(DataView* view, StatusPanel* start, StatusPanel* end,
		StatusPanel* dur);
	StatusPanel* myStart;
	StatusPanel* myEnd;
	StatusPanel* myDur;
	DataView* myView;
	Range editRange;
};
	
#endif