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 "mainsession.h"
28 #include "preferences.h"
29 #include "recordmonitor.h"
30 #include "recordscopes.h"
33 RecordScopeThread::RecordScopeThread(MWindow *mwindow, RecordMonitor *record_monitor)
36 this->mwindow = mwindow;
37 this->record_monitor = record_monitor;
39 gui_lock = new Mutex("RecordScopeThread::gui_lock");
42 RecordScopeThread::~RecordScopeThread()
48 void RecordScopeThread::handle_close_event(int result)
52 void RecordScopeThread::handle_done_event(int result)
54 gui_lock->lock("RecordScopeThread::handle_done_event");
58 record_monitor->window->lock_window("RecordScopeThread::handle_done_event");
59 record_monitor->window->scope_toggle->update(0);
60 record_monitor->window->unlock_window();
63 BC_Window* RecordScopeThread::new_gui()
65 RecordScopeGUI *gui = new RecordScopeGUI(mwindow, record_monitor);
66 gui->create_objects();
71 void RecordScopeThread::process(VFrame *output_frame)
73 if(record_monitor->scope_thread)
75 record_monitor->scope_thread->gui_lock->lock("RecordScopeThread::process");
76 if(record_monitor->scope_thread->scope_gui)
78 RecordScopeGUI *gui = record_monitor->scope_thread->scope_gui;
79 gui->process(output_frame);
84 record_monitor->scope_thread->gui_lock->unlock();
96 RecordScopeGUI::RecordScopeGUI(MWindow *mwindow,
97 RecordMonitor *record_monitor)
98 : ScopeGUI(mwindow->theme,
99 mwindow->session->scope_x,
100 mwindow->session->scope_y,
101 mwindow->session->scope_w,
102 mwindow->session->scope_h,
103 mwindow->preferences->processors)
105 this->mwindow = mwindow;
106 this->record_monitor = record_monitor;
109 RecordScopeGUI::~RecordScopeGUI()
113 void RecordScopeGUI::create_objects()
115 use_hist = mwindow->session->use_hist;
116 use_wave = mwindow->session->use_wave;
117 use_vector = mwindow->session->use_vector;
118 use_hist_parade = mwindow->session->use_hist_parade;
119 use_wave_parade = mwindow->session->use_wave_parade;
120 use_wave_gain = mwindow->session->use_wave_gain;
121 use_vect_gain = mwindow->session->use_vect_gain;
122 use_smooth = mwindow->session->use_smooth;
125 use_graticule = mwindow->session->use_graticule;
126 ScopeGUI::create_objects();
130 void RecordScopeGUI::toggle_event()
132 mwindow->session->use_hist = use_hist;
133 mwindow->session->use_wave = use_wave;
134 mwindow->session->use_vector = use_vector;
135 mwindow->session->use_hist_parade = use_hist_parade;
136 mwindow->session->use_wave_parade = use_wave_parade;
137 mwindow->session->use_wave_gain = use_wave_gain;
138 mwindow->session->use_vect_gain = use_vect_gain;
139 mwindow->session->use_smooth = use_smooth;
140 mwindow->session->use_refresh = 0;
141 mwindow->session->use_release = 0;
142 mwindow->session->use_graticule = use_graticule;
145 int RecordScopeGUI::translation_event()
147 ScopeGUI::translation_event();
148 mwindow->session->scope_x = get_x();
149 mwindow->session->scope_y = get_y();
153 int RecordScopeGUI::resize_event(int w, int h)
155 ScopeGUI::resize_event(w, h);
156 mwindow->session->scope_w = w;
157 mwindow->session->scope_h = h;
165 ScopeEnable::ScopeEnable(MWindow *mwindow, RecordMonitor *record_monitor, int x, int y)
168 mwindow->theme ? mwindow->theme->get_image_set("scope_toggle") : 0,
169 mwindow->session->record_scope)
171 this->record_monitor = record_monitor;
172 this->mwindow = mwindow;
173 set_tooltip(_("View scope"));
174 // *** CONTEXT_HELP ***
175 context_help_set_keyword("Videoscope");
178 ScopeEnable::~ScopeEnable()
183 int ScopeEnable::handle_event()
186 mwindow->session->record_scope = get_value();
188 if(mwindow->session->record_scope)
190 record_monitor->scope_thread->start();
194 record_monitor->scope_thread->close_window();
197 lock_window("ScopeEnable::handle_event");