3 * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "loadbalance.h"
28 #include "pluginclient.h"
29 #include "recordmonitor.inc"
30 #include "scopewindow.inc"
34 // Number of divisions in histogram.
35 // 65536 + min and max range to speed up the tabulation
36 #define TOTAL_BINS 0x13333
37 #define HIST_SECTIONS 4
38 #define FLOAT_RANGE 1.2
39 // Minimum value in percentage
40 #define HISTOGRAM_MIN -10
41 #define FLOAT_MIN -0.1
42 // Maximum value in percentage
43 #define HISTOGRAM_MAX 110
46 #define MIN_SCOPE_W 320
47 #define MIN_SCOPE_H 320
51 #define WAVEFORM_DIVISIONS 12
52 #define VECTORSCOPE_DIVISIONS 11
54 class ScopePackage : public LoadPackage
62 class ScopeUnit : public LoadClient
65 ScopeUnit(ScopeGUI *gui, ScopeEngine *server);
66 void draw_point(unsigned char **rows,
72 void process_package(LoadPackage *package);
73 int bins[HIST_SECTIONS][TOTAL_BINS];
77 class ScopeEngine : public LoadServer
80 ScopeEngine(ScopeGUI *gui, int cpus);
81 virtual ~ScopeEngine();
83 LoadClient* new_client();
84 LoadPackage* new_package();
89 class ScopePanel : public BC_SubWindow
92 ScopePanel(ScopeGUI *gui,
97 void create_objects();
98 virtual void update_point(int x, int y);
99 virtual void draw_point();
100 virtual void clear_point();
101 int button_press_event();
102 int cursor_motion_event();
103 int button_release_event();
108 class ScopeWaveform : public ScopePanel
111 ScopeWaveform(ScopeGUI *gui,
116 virtual void update_point(int x, int y);
117 virtual void draw_point();
118 virtual void clear_point();
124 class ScopeVectorscope : public ScopePanel
127 ScopeVectorscope(ScopeGUI *gui,
132 virtual void update_point(int x, int y);
133 virtual void draw_point();
134 virtual void clear_point();
139 class ScopeHistogram : public ScopePanel
142 ScopeHistogram(ScopeGUI *gui,
148 void update_point(int x, int y);
150 void draw(int flash, int flush);
151 void draw_mode(int mode, int color, int y, int h);
155 class ScopeToggle : public BC_Toggle
158 ScopeToggle(ScopeGUI *gui,
162 static VFrame** get_image_set(ScopeGUI *gui, int *value);
169 class ScopeGUI : public PluginClientWindow
172 ScopeGUI(Theme *theme,
178 ScopeGUI(PluginClient *plugin,
184 virtual void create_objects();
185 void create_panels();
186 virtual int resize_event(int w, int h);
187 virtual int translation_event();
189 // Called for user storage when toggles change
190 virtual void toggle_event();
193 void update_toggles();
194 void calculate_sizes(int w, int h);
195 void allocate_bitmaps();
196 void draw_overlays(int overlays, int borders, int flush);
197 void process(VFrame *output_frame);
198 void draw(int flash, int flush);
199 void clear_points(int flash);
203 VFrame *output_frame;
205 BC_Bitmap *waveform_bitmap;
206 BC_Bitmap *vector_bitmap;
207 ScopeHistogram *histogram;
208 ScopeWaveform *waveform;
209 ScopeVectorscope *vectorscope;
210 ScopeToggle *hist_parade_on;
211 ScopeToggle *hist_on;
212 ScopeToggle *waveform_parade_on;
213 ScopeToggle *waveform_on;
214 ScopeToggle *vector_on;
215 BC_Title *value_text;
218 int vector_x, vector_y, vector_w, vector_h;
219 int wave_x, wave_y, wave_w, wave_h;
220 int hist_x, hist_y, hist_w, hist_h;
223 int use_hist, use_wave, use_vector;
224 int use_hist_parade, use_wave_parade;
226 int bins[HIST_SECTIONS][TOTAL_BINS];