this->gui = gui;
}
+#define SCOPE_SEARCHPATH "/scopes"
#define incr_point(rows,h, iv,comp) { \
if(iy >= 0 && iy < h) { \
grat_image = 0;
overlay = 0;
grat_idx = 0;
- vect_grats = 0;
+ settings = 0;
output_frame = 0;
data_frame = 0;
frame_w = 1;
use_smooth = 1;
+ use_refresh = 0;
+ use_release = 0;
use_wave_gain = 5;
use_vect_gain = 5;
use_hist = 0;
lock_window("ScopeGUI::create_objects");
int margin = theme->widget_border;
- int x = margin;
- int y = margin;
- add_subwindow(smooth = new ScopeSmooth(this, x, y));
- y += smooth->get_h() + margin;
+ int x = margin, y = margin;
add_subwindow(scope_menu = new ScopeMenu(this, x, y));
scope_menu->create_objects();
- y += scope_menu->get_h() + margin;
+ int x1 = x + scope_menu->get_w() + 2*margin;
+ add_subwindow(settings = new ScopeSettings(this, x1, y));
+ settings->create_objects();
create_panels();
update_toggles();
{
calculate_sizes(get_w(), get_h());
int slider_w = xS(100);
- int margin = theme->widget_border;
if( (use_wave || use_wave_parade) ) {
int px = wave_x + wave_w - slider_w - xS(5);
int py = wave_y - ScopeGain::calculate_h() - yS(5);
vectorscope->create_objects();
vect_slider = new ScopeVectSlider(this, vx, vy, slider_w);
vect_slider->create_objects();
- if( use_vector < 0 ) {
- vect_grats = new ScopeVectGrats(this, vx, 2*margin);
- add_subwindow(vect_grats);
- vect_grats->create_objects();
- }
}
else {
vectorscope->reposition_window(
vector_x, vector_y, vector_w, vector_h);
vectorscope->clear_box(0, 0, vector_w, vector_h);
vect_slider->reposition_window(vx, vy);
- if( use_vector > 0 ) {
- delete vect_grats; vect_grats = 0;
- }
- else if( !vect_grats ) {
- vect_grats = new ScopeVectGrats(this, vx, 2*margin);
- add_subwindow(vect_grats);
- vect_grats->create_objects();
- }
- else
- vect_grats->reposition_window(vx, 2*margin);
}
}
else if( !use_vector && vectorscope ) {
delete vectorscope; vectorscope = 0;
delete vect_slider; vect_slider = 0;
- delete vect_grats; vect_grats = 0;
}
if( (use_hist || use_hist_parade) ) {
void ScopeGUI::calculate_sizes(int w, int h)
{
int margin = theme->widget_border;
- int menu_h = smooth->get_h() + scope_menu->get_h() + margin * 3;
+ int menu_h = scope_menu->get_h() + ScopeGain::calculate_h() + margin * 3;
int text_w = get_text_width(SMALLFONT, "000") + margin * 2;
int total_panels = ((use_hist || use_hist_parade) ? 1 : 0) +
((use_wave || use_wave_parade) ? 1 : 0) +
int vx = vector_x + vector_w - vect_slider->get_w() - margin;
int vy = vector_y - vect_slider->get_h() - margin;
vect_slider->reposition_window(vx, vy);
- if( vect_grats )
- vect_grats->reposition_window(vx, 2*margin);
}
allocate_vframes();
void ScopeGUI::update_toggles()
{
scope_menu->update_toggles();
+ settings->update_toggles();
}
ScopePanel::ScopePanel(ScopeGUI *gui, int x, int y, int w, int h)
}
ScopeMenu::ScopeMenu(ScopeGUI *gui, int x, int y)
- : BC_PopupMenu(x, y, xS(100), _("Scopes"))
+ : BC_PopupMenu(x, y, xS(110), _("Scopes"))
{
this->gui = gui;
}
}
-ScopeVectGrats::ScopeVectGrats(ScopeGUI *gui, int x, int y)
- : BC_PopupMenu(x, y, _("Overlay"))
+ScopeSettingOn::ScopeSettingOn(ScopeSettings *settings, const char *text, int id)
+ : BC_MenuItem(text)
{
- this->gui = gui;
+ this->settings = settings;
+ this->id = id;
}
-#define SCOPE_SEARCHPATH "/scopes"
-void ScopeVectGrats::create_objects()
+int ScopeSettingOn::handle_event()
+{
+ int v = get_checked() ? 0 : 1;
+ set_checked(v);
+ ScopeGUI *gui = settings->gui;
+ switch( id ) {
+ case SCOPE_SMOOTH:
+ gui->use_smooth = v;
+ break;
+ case SCOPE_REFRESH:
+ gui->use_refresh = v;
+ gui->use_release = 0;
+ break;
+ case SCOPE_RELEASE:
+ gui->use_release = v;
+ gui->use_refresh = 0;
+ }
+ gui->toggle_event();
+ gui->update_toggles();
+ gui->update_scope();
+ gui->show_window();
+ return 1;
+}
+
+ScopeSettings::ScopeSettings(ScopeGUI *gui, int x, int y)
+ : BC_PopupMenu(x, y, xS(150), _("Settings"))
{
+ this->gui = gui;
+ refresh_on = 0;
+ release_on = 0;
+}
+
+void ScopeSettings::create_objects()
+{
+ add_item(smooth_on =
+ new ScopeSettingOn(this, _("Smooth"), SCOPE_SMOOTH));
+ smooth_on->set_checked(gui->use_smooth);
+ if( gui->use_refresh >= 0 ) {
+ add_item(refresh_on =
+ new ScopeSettingOn(this, _("Refresh on Stop"), SCOPE_REFRESH));
+ add_item(release_on =
+ new ScopeSettingOn(this, _("Refresh on Release"), SCOPE_RELEASE));
+ refresh_on->set_checked(gui->use_refresh);
+ release_on->set_checked(gui->use_release);
+ }
+ add_item(new BC_MenuItem(_("-VectorWheel Grids-")));
+
gui->grat_paths.remove_all_objects();
ScopeGratItem *item;
- add_item(item = new ScopeGratItem(this, _("none"), 0));
+ add_item(item = new ScopeGratItem(this, _("None"), 0));
if( item->idx == gui->grat_idx ) item->set_checked(1);
gui->grat_paths.append(0);
FileSystem fs;
}
}
-ScopeGratItem::ScopeGratItem(ScopeVectGrats *vect_grats, const char *text, int idx)
+void ScopeSettings::update_toggles()
+{
+ if( refresh_on )
+ refresh_on->set_checked(gui->use_refresh);
+ if( release_on )
+ release_on->set_checked(gui->use_release);
+}
+
+ScopeGratItem::ScopeGratItem(ScopeSettings *settings, const char *text, int idx)
: BC_MenuItem(text)
{
- this->vect_grats = vect_grats;
+ this->settings = settings;
this->idx = idx;
}
int ScopeGratItem::handle_event()
{
- for( int i=0,n=vect_grats->total_items(); i<n; ++i ) {
- ScopeGratItem *item = (ScopeGratItem *)vect_grats->get_item(i);
+ for( int i=0,n=settings->total_items(); i<n; ++i ) {
+ ScopeGratItem *item = (ScopeGratItem *)settings->get_item(i);
item->set_checked(item->idx == idx);
}
- vect_grats->gui->update_graticule(idx);
+ settings->gui->update_graticule(idx);
return 1;
}
{
}
-ScopeSmooth::ScopeSmooth(ScopeGUI *gui, int x, int y)
- : BC_CheckBox(x, y, gui->use_smooth, _("Smooth"))
-{
- this->gui = gui;
-}
-
-int ScopeSmooth::handle_event()
-{
- gui->use_smooth = get_value();
- gui->update_scope();
- gui->toggle_event();
- return 1;
-}
-