Beispiel #1
0
void float2_param_t::value_changed( double value)
{
    param_set()->begin_edit();

    if( proportional_checked())
    {
        calc_proportional_factors();
        Imath::V2f v = get_value<Imath::V2f>( *this);
        
        if( sender() == input0_)
        {
            float inc = value - v.x;
            v.x = value;
            v.y = clamp( v.y + ( inc * proportional_factor.y));
        }
        else
        {
            float inc = value - v.y;
            v.y = value;
            v.x = clamp( v.x + ( inc * proportional_factor.x));
        }        

        set_value( absolute_to_relative( Imath::V2f( round ( v.x), round( v.y))));
        update_widgets();
    }
    else
        set_value( absolute_to_relative( Imath::V2f( round (input0_->value()), round( input1_->value()))));

    param_set()->end_edit();
}
Beispiel #2
0
void float2_param_t::spinbox_moved( double value)
{
    if( proportional_checked())
    {
        Imath::V2f v = get_value<Imath::V2f>( *this);

        if( sender() == input0_)
        {
            float inc = value - v.x;
            v.x = value;
            v.y = clamp( v.y + ( inc * proportional_factor.y));
        }
        else
        {
            float inc = value - v.y;
            v.y = value;
            v.x = clamp( v.x + ( inc * proportional_factor.x));
        }

        set_value( absolute_to_relative( Imath::V2f( round ( v.x), round( v.y))));
        update_widgets();
    }
    else
        set_value( absolute_to_relative( Imath::V2f( round (input0_->value()), round( input1_->value()))));

    if( track_mouse())
        param_set()->notify_parent();

    ui::anim_editor_t::Instance().update();
}
Beispiel #3
0
void se_expr_param_t::expr_editor_accept( const std::string& new_expr)
{
    param_set()->begin_edit();
    set_value( new_expr);
    param_set()->end_edit();
    saved_expression_.clear();
    update_widgets();
}
static GtkWidget * ad9739a_init(struct osc_plugin *plugin, GtkWidget *notebook, const char *ini_fn)
{
	GtkBuilder *builder;
	GtkWidget *ad9739a_panel;
	GtkWidget *dds_container;

	ctx = osc_create_context();
	if (!ctx)
		return NULL;

	dac = iio_context_find_device(ctx, DAC_DEVICE);
	dac_tx_manager = dac_data_manager_new(dac, NULL, ctx);
	if (!dac_tx_manager) {
		osc_destroy_context(ctx);
		return NULL;
	}

	builder = gtk_builder_new();
	if (osc_load_glade_file(builder, "ad9739a") < 0)
		return NULL;

	ad9739a_panel = GTK_WIDGET(gtk_builder_get_object(builder, "ad9739a_panel"));
	dds_container = GTK_WIDGET(gtk_builder_get_object(builder, "dds_transmit_block"));
	gtk_container_add(GTK_CONTAINER(dds_container), dac_data_manager_get_gui_container(dac_tx_manager));
	gtk_widget_show_all(dds_container);

	/* Bind the IIO device files to the GUI widgets */

	iio_combo_box_init_from_builder(&tx_widgets[num_tx++],
		dac, NULL, "operation_mode", "operation_modes_available",
		 builder, "operation_modes_combo", NULL);

	iio_spin_button_int_init_from_builder(&tx_widgets[num_tx++],
		dac, NULL, "full_scale_current", builder,
		"full_scale_spin", NULL);

	if (ini_fn)
		load_profile(NULL, ini_fn);

	/* Update all widgets with current values */
	update_widgets();

	make_widget_update_signal_based(tx_widgets, num_tx);
	g_builder_connect_signal(builder, "ad9739a_settings_reload", "clicked",
		G_CALLBACK(reload_button_clicked), NULL);

	dac_data_manager_freq_widgets_range_update(dac_tx_manager, 2E15 / 2);

	dac_data_manager_update_iio_widgets(dac_tx_manager);

	dac_data_manager_set_buffer_chooser_current_folder(dac_tx_manager, OSC_WAVEFORM_FILE_PATH);

	can_update_widgets = true;

	return ad9739a_panel;
}
Beispiel #5
0
void
Update_Operator_Widgets (int op)
{

  update_widgets (9, wave[op]);
  update_widgets (10, H[op]);
  update_widgets (11, HF[op]);
  update_widgets (12, Ovol[op]);
  update_widgets (13, attack[op]);
  update_widgets (14, decay[op]);
  update_widgets (15, sustain[op]);
  update_widgets (16, release[op]);
  update_widgets (17, pLFO[op]);

}
static void reload_button_clicked(GtkButton *btn, gpointer data)
{
	update_widgets();

	filter_fir_update();
	rx_freq_info_update();
	glb_settings_update_labels();
	rssi_update_labels();
	rx_phase_rotation_update();
}
void ColorDialog::setColorInternal(const QColor &c)
{
    /**
     * \note Unlike setColor, this is used to update the current color which
     * migth differ from the final selected color
     */
    p->ui.wheel->setColor(c);
    p->ui.slide_alpha->setValue(c.alpha());
    update_widgets();
}
Beispiel #8
0
void se_expr_param_t::expr_editor_cancel()
{
    if( get_value<std::string>( *this) != saved_expression_)
    {
        set_value( saved_expression_, node_edited);
        param_set()->notify_parent();
    }

    saved_expression_.clear();
    update_widgets();
}
void ColorDialog::set_hsv()
{
    if ( !signalsBlocked() )
    {
        p->ui.wheel->setColor(QColor::fromHsv(
                p->ui.slide_hue->value(),
                p->ui.slide_saturation->value(),
                p->ui.slide_value->value()
            ));
        update_widgets();
    }
}
Beispiel #10
0
void image_format_param_t::preset_picked( int v)
{
    if( v == image::format_t::presets().size())
        return;

    image::format_t new_format;
    new_format.set_from_preset( v);

    param_set()->begin_edit();
    set_value( new_format);
    param_set()->end_edit();
    update_widgets();
}
Beispiel #11
0
int
control_handler (const char *path, const char *types, lo_arg ** argv,
		 int argc, void *data, void *user_data)
{


  if (argc < 2)
    {
      printf ("Error: too few arguments to control_handler\n");
      return 1;
    }

  const int port = argv[0]->i;
  const float value = argv[1]->f;


  if ((port < 9) || (port > 62))
    update_widgets (port, value);
  else if (port < 63)
    update_widgets (((port + 3) / 6) + 7, value);

  return 0;
}
Beispiel #12
0
void 
preferences_show (void)
{
	if (dialog == NULL) 
	{
		glade_xml = glade_xml_new(g_build_filename(MINBAR_DATADIR,GLADE_MAIN_INTERFACE,NULL), NULL, NULL);
		glade_xml_signal_autoconnect(glade_xml);

		dialog = glade_xml_get_widget(glade_xml, "editcity");

		setup_dialog();
		update_widgets();
	}
	gtk_window_present(GTK_WINDOW(dialog));
}
void ColorDialog::set_rgb()
{
    if ( !signalsBlocked() )
    {
        QColor col(
                p->ui.slide_red->value(),
                p->ui.slide_green->value(),
                p->ui.slide_blue->value()
            );
        if (col.saturation() == 0)
            col = QColor::fromHsv(p->ui.slide_hue->value(), 0, col.value());
        p->ui.wheel->setColor(col);
        update_widgets();
    }
}
Beispiel #14
0
void corner_pin_node_t::param_changed( param_t *p, param_t::change_reason reason)
{
	RAMEN_ASSERT( composition());
	
	if( reason == param_t::user_edited && p == &param( "apply_track"))
	{		
		const tracker_node_t *tracker = ui::apply_corner_track_dialog_t::instance().exec();
		
		if( tracker)
		{
			float2_param_t *topleft		= dynamic_cast<float2_param_t*>( &param( "topleft"));
			float2_param_t *topright	= dynamic_cast<float2_param_t*>( &param( "topright"));
			float2_param_t *botleft		= dynamic_cast<float2_param_t*>( &param( "botleft"));
			float2_param_t *botright	= dynamic_cast<float2_param_t*>( &param( "botright"));
			
			float start_frame = composition()->start_frame();
			float end_frame = composition()->end_frame();
			
			param_set().begin_edit();
			
			for( float frame = start_frame; frame <= end_frame; frame += 1.0f)
			{
				boost::optional<Imath::V2f> p = tracker->tracker_pos( 0, frame);
				
				if( p)
					topleft->set_absolute_value_at_frame( p.get(), frame);

				p = tracker->tracker_pos( 1, frame);
				
				if( p)
					topright->set_absolute_value_at_frame( p.get(), frame);
				
				p = tracker->tracker_pos( 2, frame);

				if( p)
					botright->set_absolute_value_at_frame( p.get(), frame);
				
				p = tracker->tracker_pos( 3, frame);
				
				if( p)
					botleft->set_absolute_value_at_frame( p.get(), frame);
			}
			
			param_set().end_edit();
			update_widgets();
		}
	}
}
Beispiel #15
0
static void load_profile(const char *ini_fn)
{
	char *value;

	update_from_ini(ini_fn, THIS_DRIVER, dev,
			fmcomms2_adv_sr_attribs,
			ARRAY_SIZE(fmcomms2_adv_sr_attribs));
	if (can_update_widgets)
		update_widgets(builder);

	value = read_token_from_ini(ini_fn, THIS_DRIVER, "calibrate");
	if (value) {
		fmcomms2adv_handle_driver("calibrate", value);
		free(value);
	}
}
Beispiel #16
0
void float2_param_t::do_domain_changed( const Imath::Box2i& new_domain)
{
    if( input0_)
    {
	input0_->blockSignals( true);
	input1_->blockSignals( true);

	input0_->setRange( absolute_min(), absolute_max());
	input1_->setRange( absolute_min(), absolute_max());

	input0_->blockSignals( false);
	input1_->blockSignals( false);

	update_widgets();
    }
}
Beispiel #17
0
        void introduce_dialog::introduce()
        {
            INVARIANT(_user_service);
            INVARIANT(_user_service);
            INVARIANT(_contact_1);
            INVARIANT(_contact_2);
            INVARIANT(_message_1);
            INVARIANT(_message_2);

            auto c1 = _contact_1->selected_contact();
            auto c2 = _contact_2->selected_contact();
            if(!c1 || !c2)
            {
                update_widgets();
                return;
            }

            CHECK(c1);
            CHECK(c2);

            //validate that they want to introduce the two selected
            std::stringstream msg;
            msg << convert(tr("Are you sure you want to introduce `")) << c1->name() << convert(tr("' to `")) << c2->name() << "'?";
            auto a = QMessageBox::warning(this, tr("Introduce"), msg.str().c_str(), QMessageBox::Yes | QMessageBox::No);
            if(a != QMessageBox::Yes) return;

            std::string GREETER = ""; //TODO SET THIS

            us::contact_introduction i1{
                _user_service->user().info().id(),
                    GREETER,
                    convert(_message_1->text()),
                    *c2
            };

            us::contact_introduction i2{
                _user_service->user().info().id(),
                    GREETER,
                    convert(_message_2->text()),
                    *c1
            };

            _user_service->send_introduction(c1->id(), i1);
            _user_service->send_introduction(c2->id(), i2);
            accept();
        }
Beispiel #18
0
void filter_fir_enable(GtkToggleButton *button, gpointer data)
{
	bool rx, tx, rxtx, disable;

	if (gtk_toggle_button_get_active(button))
		return;

	rx = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (enable_fir_filter_rx));
	tx = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (fir_filter_en_tx));
	rxtx = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (enable_fir_filter_rx_tx));
	disable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (disable_all_fir_filters));

	if (rxtx || disable) {
		iio_device_attr_write_bool(dev,
				"in_out_voltage_filter_fir_en", rxtx);
	} else {
		struct iio_channel *chn;
		if (rx) {
			chn = iio_device_find_channel(dev, "voltage0", true);
			if (chn)
				iio_channel_attr_write_bool(chn, "filter_fir_en", tx);

			chn = iio_device_find_channel(dev, "voltage0", false);
			if (chn)
				iio_channel_attr_write_bool(chn, "filter_fir_en", rx);

		}

		if (tx) {
			chn = iio_device_find_channel(dev, "voltage0", false);
			if (chn)
				iio_channel_attr_write_bool(chn, "filter_fir_en", rx);

			chn = iio_device_find_channel(dev, "voltage0", true);
			if (chn)
				iio_channel_attr_write_bool(chn, "filter_fir_en", tx);

		}
	}

	filter_fir_update();
	glb_settings_update_labels();
	update_widgets();
	rx_freq_info_update();
}
void generic_sys_coordinator::on_animation_update()
{
	if(m_request_termination)
	{
		return;
	}

	auto drawer = static_cast< rtp::animated_system_drawer* >(m_widget->get_drawer());

	// Advance animation state
	auto result = drawer->advance();

	switch(result)
	{
		case rtp::animated_system_drawer::Result::Ongoing:
		// Draw
		update_widgets();

		// And schedule next frame
		m_timer.expires_at(m_timer.expires_at() + boost::posix_time::milliseconds(1000.0f / AnimationFreq));
		m_timer.async_wait(boost::bind(&generic_sys_coordinator::on_animation_update, this));
		break;

		case rtp::animated_system_drawer::Result::Finished:
		{
			switch(m_system_st)
			{
				case SystemState::Active:
//				m_timer.expires_at(m_timer.expires_at() + boost::posix_time::milliseconds(1000.0f / AnimationFreq /* TODO: immediate??? */));
//				m_timer.async_wait(boost::bind(&generic_sys_coordinator::on_system_update, this));
				on_system_update();
				break;

				case SystemState::Completed:
				// All done
				if(m_finish_cb)
				{
					m_finish_cb();
				}
				break;
			}
		}
		break;
	}
}
Beispiel #20
0
int		update_multitrack_widgets( void *data, int *array, int track )
{
	multitracker_t *mt = (multitracker_t*) data;
	sequence_view_t *p = mt->view[ track ];

	p->status_lock = 1;
	int pm = array[PLAY_MODE];
	int i;
	for( i  =  0; i < 20; i ++ )
		p->status_cache[i] = array[i];
	update_widgets(array, p, pm);

	int *his = p->history[ pm ];	
	for( i  =  0; i < 20; i ++ )
		his[i] = array[i];
	p->status_lock = 0;
	return 1;
}
void GVControlsWidget::on_combo_changed(QWidget* control)
{
    GVComboBox* combobox = (GVComboBox*) control;
    int val = combobox->currentIndex();
    int index = combobox->get_index();
    dev->listControls[index].value = val;
    if(!(dev->set_control_val (index)))
    {
        std::cout << dev->listControls[index].control.name 
            << " = " << dev->listControls[index].value << std::endl;
    }
    else
    {
        std::cerr << "ERROR:couldn't set " << dev->listControls[index].control.name 
            << " = " << val << std::endl;
        combobox->blockSignals(true);
        combobox->setCurrentIndex(dev->listControls[index].value);
        combobox->blockSignals(false);
    }
    
    update_widgets();
}
void GVControlsWidget::on_check_button_clicked(QWidget* control)
{
    GVCheckBox* checkbox = (GVCheckBox*) control;
    int val = checkbox->isChecked() ? 1 : 0;
    int index = checkbox->get_index();
    dev->listControls[index].value = val;
    if(!(dev->set_control_val (index)))
    {
        std::cout << dev->listControls[index].control.name << " = " << 
            dev->listControls[index].value << std::endl;
    }
    else
    {
        std::cerr << "ERROR:couldn't set " << dev->listControls[index].control.name 
            << " = " << val << std::endl;
        checkbox->blockSignals(true);
        if(dev->listControls[index].value) checkbox->setChecked(true);
        else checkbox->setChecked(false);
        checkbox->blockSignals(false);
    }
    
    update_widgets();
}
void generic_sys_coordinator::restart()
{
	terminate_system();

	m_sys = m_sys_factory->create_system();
	m_sys->initialize();

	rtp::interactive_input_set all_inputs;
	for(auto const& agent : m_agents_spec.agents)
	{
		auto agent_id = m_sys->register_agent(agent.spec);
		auto& factory = m_agents_spec.controller_factories[agent.controller_id];
		auto controller = std::unique_ptr< rtp::i_controller >(
			factory->create(&m_sys->get_agent(agent_id))
			);

		if(factory->is_interactive())
		{
			auto interactive = static_cast<rtp::i_interactive_controller*>(controller.get());
			auto const& required_inputs = interactive->get_required_interactive_inputs();
			all_inputs.insert(required_inputs.begin(), required_inputs.end());
		}

		m_sys->register_agent_controller(agent_id, std::move(controller));
	}
	/////

	m_widget->set_drawer(m_sys->get_drawer());
	m_widget->enable_interaction(all_inputs);

	m_props_widget->clear_content();
	//m_props_widget->reset(m_sys->get_state_properties());

	m_system_st = SystemState::Active;
	m_step = 0;
	m_avg_update_period = 0.0f;

	// TODO: Set focus????  m_widget->clicked().emit(Wt::WMouseEvent());

	auto uinf = m_sys->get_update_info();

	bool instant = m_sys->is_instantaneous();
	bool realtime = uinf.type == rtp::i_system::update_info::Type::Realtime;
	bool animated = !realtime && m_widget->get_drawer()->is_animated();
	auto delay = instant ?
		0.0 :
		(
		realtime ?
		(1.0 / uinf.frequency) :
		(
		animated ?
		(1.0 / AnimationFreq) :
		(1.0 / NonRealtimeFreq)
		)
		);

	m_io.reset();
	m_timer.expires_from_now(boost::posix_time::milliseconds(1000.0f * delay));
	if(animated)
	{
		auto anim_drawer = static_cast<rtp::animated_system_drawer*>(m_widget->get_drawer());
		anim_drawer->start();

		m_timer.async_wait(boost::bind(&generic_sys_coordinator::on_animation_update, this));
	}
	else
	{
		m_timer.async_wait(boost::bind(&generic_sys_coordinator::on_system_update, this));
	}
	std::thread t(boost::bind(&boost::asio::io_service::run, &m_io));
	m_update_thread.swap(t);

	m_ready_to_display = !instant;
	update_widgets();
}
Beispiel #24
0
void
Update_Main_Widgets ()
{

  update_widgets (2, master_volume);
  update_widgets (3, tune);
  update_widgets (4, portamento);
  update_widgets (5, LFO_Volume);
  update_widgets (6, LFO_Frequency);
  update_widgets (7, LFO_Delay);
  update_widgets (8, LFO_Wave);
  update_widgets (63, Ftype);
  update_widgets (64, Fgain);
  update_widgets (65, Fcutoff);
  update_widgets (66, Fq);
  update_widgets (67, FLFO);
  update_widgets (68, FADSR);
  update_widgets (69, Fstages);
  update_widgets (70, Fvelocity);
  update_widgets (71, algo);


}
static GtkWidget *create_editor_widgets(radio_conf_t * conf)
{
    GtkWidget      *table;
    GtkWidget      *label;

    table = gtk_grid_new();
    gtk_container_set_border_width(GTK_CONTAINER(table), 5);
    gtk_grid_set_column_homogeneous(GTK_GRID(table), FALSE);
    gtk_grid_set_row_homogeneous(GTK_GRID(table), FALSE);
    gtk_grid_set_column_spacing(GTK_GRID(table), 5);
    gtk_grid_set_row_spacing(GTK_GRID(table), 5);

    /* Config name */
    label = gtk_label_new(_("Name"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);

    name = gtk_entry_new();
    gtk_entry_set_max_length(GTK_ENTRY(name), 25);
    g_signal_connect(name, "changed", G_CALLBACK(name_changed), NULL);
    gtk_widget_set_tooltip_text(name,
                                _("Enter a short name for this configuration, "
                                  "e.g. IC910-1.\n"
                                  "Allowed characters: "
                                  "0..9, a..z, A..Z, - and _"));
    gtk_grid_attach(GTK_GRID(table), name, 1, 0, 3, 1);

    /* Host */
    label = gtk_label_new(_("Host"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 0, 1, 1, 1);

    host = gtk_entry_new();
    gtk_entry_set_max_length(GTK_ENTRY(host), 50);
    gtk_entry_set_text(GTK_ENTRY(host), "localhost");
    gtk_widget_set_tooltip_text(host,
                                _("Enter the host where rigctld is running. "
                                  "You can use both host name and IP address, "
                                  "e.g. 192.168.1.100\n\n"
                                  "If gpredict and rigctld are running on the "
                                  "same computer use localhost"));
    gtk_grid_attach(GTK_GRID(table), host, 1, 1, 3, 1);

    /* port */
    label = gtk_label_new(_("Port"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 0, 2, 1, 1);

    port = gtk_spin_button_new_with_range(1024, 65535, 1);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(port), 4532);
    gtk_spin_button_set_digits(GTK_SPIN_BUTTON(port), 0);
    gtk_widget_set_tooltip_text(port,
                                _("Enter the port number where rigctld is "
                                  "listening"));
    gtk_grid_attach(GTK_GRID(table), port, 1, 2, 1, 1);

    /* radio type */
    label = gtk_label_new(_("Radio type"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    //gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4);
    gtk_grid_attach(GTK_GRID(table), label, 0, 3, 1, 1);

    type = gtk_combo_box_text_new();
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type), _("RX only"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type), _("TX only"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type), _("Simplex TRX"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type), _("Duplex TRX"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type),
                                   _("FT817/857/897 (auto)"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type),
                                   _("FT817/857/897 (manual)"));
    gtk_combo_box_set_active(GTK_COMBO_BOX(type), RIG_TYPE_RX);
    g_signal_connect(type, "changed", G_CALLBACK(type_changed), NULL);
    gtk_widget_set_tooltip_markup(type,
                                  _("<b>RX only:</b>  The radio shall only be "
                                    "used as receiver. If <i>Monitor PTT "
                                    "status</i> is checked the doppler tuning "
                                    "will be suspended while PTT is ON "
                                    "(manual TX). If not, the controller will "
                                    "always perform doppler tuning and "
                                    "you cannot use the same RIG for uplink.\n\n"
                                    "<b>TX only:</b>  The radio shall only be "
                                    "used for uplink. If <i>Monitor PTT status</i>"
                                    " is checked the doppler tuning will be "
                                    "suspended while PTT is OFF (manual RX).\n\n"
                                    "<b>Simplex TRX:</b>  The radio should be "
                                    "used for both up- and downlink but in "
                                    "simplex mode only. This option requires "
                                    "that the PTT status is monitored (otherwise "
                                    "gpredict cannot know whether to tune the "
                                    "RX or the TX).\n\n"
                                    "<b>Duplex:</b>  The radio is a full duplex "
                                    "radio, such as the IC910H. Gpredict will "
                                    "be continuously tuning both uplink and "
                                    "downlink simultaneously and not care about "
                                    "PTT setting.\n\n"
                                    "<b>FT817/857/897 (auto):</b> "
                                    "This is a special mode that can be used with "
                                    "YAESU FT-817, 857 and 897 radios. These radios"
                                    " do not allow computer control while in TX mode."
                                    " Therefore, TX Doppler correction is applied "
                                    "while the radio is in RX mode by toggling "
                                    "between VFO A/B.\n\n"
                                    "<b>FT817/857/897 (manual):</b> "
                                    "This is similar to the previous mode except"
                                    " that switching to TX is done by pressing the"
                                    " SPACE key on the keyboard. Gpredict will "
                                    "then update the TX Doppler before actually"
                                    " switching to TX."));
    gtk_grid_attach(GTK_GRID(table), type, 1, 3, 2, 1);

    /* ptt */
    label = gtk_label_new(_("PTT status"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 0, 4, 1, 1);

    ptt = gtk_combo_box_text_new();
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ptt), _("None"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ptt), _("Read PTT"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ptt), _("Read DCD"));
    gtk_combo_box_set_active(GTK_COMBO_BOX(ptt), 0);
    g_signal_connect(ptt, "changed", G_CALLBACK(ptt_changed), NULL);
    gtk_widget_set_tooltip_markup(ptt,
                                  _("Select PTT type.\n\n"
                                    "<b>None:</b>\nDon't read PTT status from this radio.\n\n"
                                    "<b>Read PTT:</b>\nRead PTT status using get_ptt CAT command. "
                                    "You have to check that your radio and hamlib supports this.\n\n"
                                    "<b>Read DCD:</b>\nRead PTT status using get_dcd command. "
                                    "This can be used if your radio does not support the read_ptt "
                                    "CAT command and you have a special interface that can "
                                    "read squelch status and send it via CTS."));
    gtk_grid_attach(GTK_GRID(table), ptt, 1, 4, 2, 1);

    /* VFO Up/Down */
    label = gtk_label_new(_("VFO Up/Down"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 0, 5, 1, 1);

    vfo = gtk_combo_box_text_new();
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(vfo), _("Not applicable"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(vfo),
                                   _("MAIN \342\206\221 / SUB \342\206\223"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(vfo),
                                   _("SUB \342\206\221 / MAIN \342\206\223"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(vfo),
                                   _("A \342\206\221 / B \342\206\223"));
    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(vfo),
                                   _("B \342\206\221 / A \342\206\223"));
    gtk_combo_box_set_active(GTK_COMBO_BOX(vfo), 0);
    g_signal_connect(vfo, "changed", G_CALLBACK(vfo_changed), NULL);
    gtk_widget_set_tooltip_markup(vfo,
                                  _
                                  ("Select which VFO to use for uplink and downlink. "
                                   "This setting is used for full-duplex radios only, "
                                   "such as the IC-910H, FT-847 and the TS-2000.\n\n"
                                   "<b>IC-910H:</b> MAIN\342\206\221 / SUB\342\206\223\n"
                                   "<b>FT-847:</b> SUB\342\206\221 / MAIN\342\206\223\n"
                                   "<b>TS-2000:</b> B\342\206\221 / A\342\206\223"));
    gtk_grid_attach(GTK_GRID(table), vfo, 1, 5, 2, 1);

    /* Downconverter LO frequency */
    label = gtk_label_new(_("LO Down"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 0, 6, 1, 1);

    lo = gtk_spin_button_new_with_range(-10000, 10000, 1);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(lo), 0);
    gtk_spin_button_set_digits(GTK_SPIN_BUTTON(lo), 0);
    gtk_widget_set_tooltip_text(lo,
                                _
                                ("Enter the frequency of the local oscillator "
                                 " of the downconverter, if any."));
    gtk_grid_attach(GTK_GRID(table), lo, 1, 6, 2, 1);

    label = gtk_label_new(_("MHz"));
    g_object_set(label, "xalign", 0.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 3, 6, 1, 1);

    /* Upconverter LO frequency */
    label = gtk_label_new(_("LO Up"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 0, 7, 1, 1);

    loup = gtk_spin_button_new_with_range(-10000, 10000, 1);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(loup), 0);
    gtk_spin_button_set_digits(GTK_SPIN_BUTTON(loup), 0);
    gtk_widget_set_tooltip_text(loup,
                                _
                                ("Enter the frequency of the local oscillator "
                                 "of the upconverter, if any."));
    gtk_grid_attach(GTK_GRID(table), loup, 1, 7, 2, 1);

    label = gtk_label_new(_("MHz"));
    g_object_set(label, "xalign", 0.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 3, 7, 1, 1);

    /* AOS / LOS signalling */
    label = gtk_label_new(_("Signalling"));
    g_object_set(label, "xalign", 1.0, "yalign", 0.5, NULL);
    gtk_grid_attach(GTK_GRID(table), label, 0, 8, 1, 1);

    sigaos = gtk_check_button_new_with_label(_("AOS"));
    gtk_grid_attach(GTK_GRID(table), sigaos, 1, 8, 1, 1);
    gtk_widget_set_tooltip_text(sigaos,
                                _("Enable AOS signalling for this radio."));

    siglos = gtk_check_button_new_with_label(_("LOS"));
    gtk_grid_attach(GTK_GRID(table), siglos, 2, 8, 1, 1);
    gtk_widget_set_tooltip_text(siglos,
                                _("Enable LOS signalling for this radio."));

    if (conf->name != NULL)
        update_widgets(conf);

    gtk_widget_show_all(table);

    return table;
}
Beispiel #26
0
static GtkWidget * fmcomms2_init(GtkWidget *notebook, const char *ini_fn)
{
	GtkBuilder *builder;
	GtkWidget *dds_container;
	struct iio_channel *ch0, *ch1;

	can_update_widgets = false;

	ctx = osc_create_context();
	if (!ctx)
		return NULL;

	dev = iio_context_find_device(ctx, PHY_DEVICE);
	dds = iio_context_find_device(ctx, DDS_DEVICE);
	cap = iio_context_find_device(ctx, CAP_DEVICE);
	udc_rx = iio_context_find_device(ctx, UDC_RX_DEVICE);
	udc_tx = iio_context_find_device(ctx, UDC_TX_DEVICE);
	has_udc_driver = (udc_rx && udc_tx);

	ch0 = iio_device_find_channel(dev, "voltage0", false);
	ch1 = iio_device_find_channel(dev, "voltage1", false);

	dac_tx_manager = dac_data_manager_new(dds, NULL, ctx);
	if (!dac_tx_manager) {
		iio_context_destroy(ctx);
		return NULL;
	}

	const char *env_freq_span = getenv("OSC_UPDN_FREQ_SPAN");
	const char *env_freq_mix_sign = getenv("OSC_UPDN_FREQ_MIX_SIGN");

	if(!env_freq_span) {
		updn_freq_span = 2;
	} else {
		errno = 0;
		updn_freq_span = g_strtod(env_freq_span, NULL);
		if (errno)
			updn_freq_span = 2;
	}

	if(!env_freq_mix_sign) {
		updn_freq_mix_sign = 1;
	} else {
		if (!strncmp(env_freq_mix_sign, "-", 1))
			updn_freq_mix_sign = -1;
		else
			updn_freq_mix_sign = 1;
	}

	builder = gtk_builder_new();
	nbook = GTK_NOTEBOOK(notebook);

	if (!gtk_builder_add_from_file(builder, "fmcomms2.glade", NULL))
		gtk_builder_add_from_file(builder, OSC_GLADE_FILE_PATH "fmcomms2.glade", NULL);

	is_2rx_2tx = ch1 && iio_channel_find_attr(ch1, "hardwaregain");

	fmcomms2_panel = GTK_WIDGET(gtk_builder_get_object(builder, "fmcomms2_panel"));

	/* Global settings */

	ensm_mode = GTK_WIDGET(gtk_builder_get_object(builder, "ensm_mode"));
	ensm_mode_available = GTK_WIDGET(gtk_builder_get_object(builder, "ensm_mode_available"));
	calib_mode = GTK_WIDGET(gtk_builder_get_object(builder, "calib_mode"));
	calib_mode_available = GTK_WIDGET(gtk_builder_get_object(builder, "calib_mode_available"));
	trx_rate_governor = GTK_WIDGET(gtk_builder_get_object(builder, "trx_rate_governor"));
	trx_rate_governor_available = GTK_WIDGET(gtk_builder_get_object(builder, "trx_rate_governor_available"));
	tx_path_rates = GTK_WIDGET(gtk_builder_get_object(builder, "label_tx_path"));
	rx_path_rates = GTK_WIDGET(gtk_builder_get_object(builder, "label_rx_path"));
	filter_fir_config = GTK_WIDGET(gtk_builder_get_object(builder, "filter_fir_config"));
	enable_fir_filter_rx = GTK_WIDGET(gtk_builder_get_object(builder, "enable_fir_filter_rx"));
	fir_filter_en_tx = GTK_WIDGET(gtk_builder_get_object(builder, "fir_filter_en_tx"));
	enable_fir_filter_rx_tx = GTK_WIDGET(gtk_builder_get_object(builder, "enable_fir_filter_tx_rx"));
	disable_all_fir_filters = GTK_WIDGET(gtk_builder_get_object(builder, "disable_all_fir_filters"));
	up_down_converter = GTK_WIDGET(gtk_builder_get_object(builder, "checkbox_up_down_converter"));

	section_toggle[SECTION_GLOBAL] = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "global_settings_toggle"));
	section_setting[SECTION_GLOBAL] = GTK_WIDGET(gtk_builder_get_object(builder, "global_settings"));
	section_toggle[SECTION_TX] = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "tx_toggle"));
	section_setting[SECTION_TX] = GTK_WIDGET(gtk_builder_get_object(builder, "tx_settings"));
	section_toggle[SECTION_RX] = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "rx_toggle"));
	section_setting[SECTION_RX] = GTK_WIDGET(gtk_builder_get_object(builder, "rx_settings"));
	section_toggle[SECTION_FPGA] = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "fpga_toggle"));
	section_setting[SECTION_FPGA] = GTK_WIDGET(gtk_builder_get_object(builder, "fpga_settings"));

	/* Receive Chain */

	rf_port_select_rx = GTK_WIDGET(gtk_builder_get_object(builder, "rf_port_select_rx"));
	rx_gain_control_rx1 = GTK_WIDGET(gtk_builder_get_object(builder, "gain_control_mode_rx1"));
	rx_gain_control_rx2 = GTK_WIDGET(gtk_builder_get_object(builder, "gain_control_mode_rx2"));
	rx_gain_control_modes_rx1 = GTK_WIDGET(gtk_builder_get_object(builder, "gain_control_mode_available_rx1"));
	rx_gain_control_modes_rx2 = GTK_WIDGET(gtk_builder_get_object(builder, "gain_control_mode_available_rx2"));
	rx1_rssi = GTK_WIDGET(gtk_builder_get_object(builder, "rssi_rx1"));
	rx2_rssi = GTK_WIDGET(gtk_builder_get_object(builder, "rssi_rx2"));
	rx_fastlock_profile = GTK_WIDGET(gtk_builder_get_object(builder, "rx_fastlock_profile"));

	/* Transmit Chain */

	rf_port_select_tx = GTK_WIDGET(gtk_builder_get_object(builder, "rf_port_select_tx"));
	tx_fastlock_profile = GTK_WIDGET(gtk_builder_get_object(builder, "tx_fastlock_profile"));
	tx1_rssi = GTK_WIDGET(gtk_builder_get_object(builder, "rssi_tx1"));
	tx2_rssi = GTK_WIDGET(gtk_builder_get_object(builder, "rssi_tx2"));
	dds_container = GTK_WIDGET(gtk_builder_get_object(builder, "dds_transmit_block"));
	gtk_container_add(GTK_CONTAINER(dds_container), dac_data_manager_get_gui_container(dac_tx_manager));
	gtk_widget_show_all(dds_container);

	rx_phase_rotation[0] = GTK_WIDGET(gtk_builder_get_object(builder, "rx1_phase_rotation"));
	rx_phase_rotation[1] = GTK_WIDGET(gtk_builder_get_object(builder, "rx2_phase_rotation"));

	gtk_combo_box_set_active(GTK_COMBO_BOX(ensm_mode_available), 0);
	gtk_combo_box_set_active(GTK_COMBO_BOX(trx_rate_governor_available), 0);
	gtk_combo_box_set_active(GTK_COMBO_BOX(rx_gain_control_modes_rx1), 0);
	gtk_combo_box_set_active(GTK_COMBO_BOX(rx_gain_control_modes_rx2), 0);
	gtk_combo_box_set_active(GTK_COMBO_BOX(rf_port_select_rx), 0);
	gtk_combo_box_set_active(GTK_COMBO_BOX(rf_port_select_tx), 0);
	gtk_combo_box_set_active(GTK_COMBO_BOX(rx_fastlock_profile), 0);
	gtk_combo_box_set_active(GTK_COMBO_BOX(tx_fastlock_profile), 0);

	/* Set FMCOMMS2/3 max sampling freq -> 61.44MHz and FMCOMMS4 -> 122.88 */
	GtkWidget *sfreq = GTK_WIDGET(gtk_builder_get_object(builder, "sampling_freq_tx"));
	GtkAdjustment *sfreq_adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(sfreq));

	if (is_2rx_2tx)
		gtk_adjustment_set_upper(sfreq_adj, 61.44);
	else
		gtk_adjustment_set_upper(sfreq_adj, 122.88);

	/* Bind the IIO device files to the GUI widgets */

	glb_widgets = widgets;

	/* Global settings */
	iio_combo_box_init(&glb_widgets[num_glb++],
		dev, NULL, "ensm_mode", "ensm_mode_available",
		ensm_mode_available, NULL);
	iio_combo_box_init(&glb_widgets[num_glb++],
		dev, NULL, "calib_mode", "calib_mode_available",
		calib_mode_available, NULL);
	iio_combo_box_init(&glb_widgets[num_glb++],
		dev, NULL, "trx_rate_governor", "trx_rate_governor_available",
		trx_rate_governor_available, NULL);

	dcxo_coarse_num = num_glb;
	iio_spin_button_int_init_from_builder(&glb_widgets[num_glb++],
		dev, NULL, "dcxo_tune_coarse", builder, "dcxo_coarse_tune",
		0);
	dcxo_fine_num = num_glb;
	iio_spin_button_int_init_from_builder(&glb_widgets[num_glb++],
		dev, NULL, "dcxo_tune_fine", builder, "dcxo_fine_tune",
		0);

	rx_widgets = &glb_widgets[num_glb];

	/* Receive Chain */

	iio_combo_box_init(&rx_widgets[num_rx++],
		dev, ch0, "gain_control_mode",
		"gain_control_mode_available",
		rx_gain_control_modes_rx1, NULL);

	iio_combo_box_init(&rx_widgets[num_rx++],
		dev, ch0, "rf_port_select",
		"rf_port_select_available",
		rf_port_select_rx, NULL);

	if (is_2rx_2tx)
		iio_combo_box_init(&rx_widgets[num_rx++],
			dev, ch1, "gain_control_mode",
			"gain_control_mode_available",
			rx_gain_control_modes_rx2, NULL);
	rx1_gain = num_rx;
	iio_spin_button_int_init_from_builder(&rx_widgets[num_rx++],
		dev, ch0, "hardwaregain", builder,
		"hardware_gain_rx1", NULL);

	if (is_2rx_2tx) {
		rx2_gain = num_rx;
		iio_spin_button_int_init_from_builder(&rx_widgets[num_rx++],
			dev, ch1, "hardwaregain", builder,
			"hardware_gain_rx2", NULL);
	}
	rx_sample_freq = num_rx;
	iio_spin_button_int_init_from_builder(&rx_widgets[num_rx++],
		dev, ch0, "sampling_frequency", builder,
		"sampling_freq_rx", &mhz_scale);
	iio_spin_button_add_progress(&rx_widgets[num_rx - 1]);

	iio_spin_button_int_init_from_builder(&rx_widgets[num_rx++],
		dev, ch0, "rf_bandwidth", builder, "rf_bandwidth_rx",
		&mhz_scale);
	iio_spin_button_add_progress(&rx_widgets[num_rx - 1]);
	rx_lo = num_rx;

	ch1 = iio_device_find_channel(dev, "altvoltage0", true);
	if (iio_channel_find_attr(ch1, "frequency"))
		freq_name = "frequency";
	else
		freq_name = "RX_LO_frequency";
	iio_spin_button_s64_init_from_builder(&rx_widgets[num_rx++],
		dev, ch1, freq_name, builder,
		"rx_lo_freq", &mhz_scale);
	iio_spin_button_add_progress(&rx_widgets[num_rx - 1]);

	iio_toggle_button_init_from_builder(&rx_widgets[num_rx++],
		dev, ch0, "quadrature_tracking_en", builder,
		"quad", 0);
	iio_toggle_button_init_from_builder(&rx_widgets[num_rx++],
		dev, ch0, "rf_dc_offset_tracking_en", builder,
		"rfdc", 0);
	iio_toggle_button_init_from_builder(&rx_widgets[num_rx++],
		dev, ch0, "bb_dc_offset_tracking_en", builder,
		"bbdc", 0);

	iio_spin_button_init_from_builder(&rx_widgets[num_rx],
		dev, ch1, "calibphase",
		builder, "rx1_phase_rotation", NULL);
	iio_spin_button_add_progress(&rx_widgets[num_rx++]);

	ch0 = iio_device_find_channel(dev, "altvoltage0", true);

	if (iio_channel_find_attr(ch0, "fastlock_store"))
		rx_fastlock_store_name = "fastlock_store";
	else
		rx_fastlock_store_name = "RX_LO_fastlock_store";
	if (iio_channel_find_attr(ch0, "fastlock_recall"))
		rx_fastlock_recall_name = "fastlock_recall";
	else
		rx_fastlock_recall_name = "RX_LO_fastlock_recall";

	/* Transmit Chain */

	tx_widgets = &rx_widgets[num_rx];

	ch0 = iio_device_find_channel(dev, "voltage0", true);
	if (is_2rx_2tx)
		ch1 = iio_device_find_channel(dev, "voltage1", true);

	tx_rssi_available = ch0 && iio_channel_find_attr(ch0, "rssi");
	if (is_2rx_2tx)
		tx_rssi_available = tx_rssi_available &&
				(ch1 && iio_channel_find_attr(ch1, "rssi"));

	iio_combo_box_init(&tx_widgets[num_tx++],
		dev, ch0, "rf_port_select",
		"rf_port_select_available",
		rf_port_select_tx, NULL);

	iio_spin_button_init_from_builder(&tx_widgets[num_tx++],
		dev, ch0, "hardwaregain", builder,
		"hardware_gain_tx1", &inv_scale);

	if (is_2rx_2tx)
		iio_spin_button_init_from_builder(&tx_widgets[num_tx++],
			dev, ch1, "hardwaregain", builder,
			"hardware_gain_tx2", &inv_scale);
	tx_sample_freq = num_tx;
	iio_spin_button_int_init_from_builder(&tx_widgets[num_tx++],
		dev, ch0, "sampling_frequency", builder,
		"sampling_freq_tx", &mhz_scale);
	iio_spin_button_add_progress(&tx_widgets[num_tx - 1]);
	iio_spin_button_int_init_from_builder(&tx_widgets[num_tx++],
		dev, ch0, "rf_bandwidth", builder,
		"rf_bandwidth_tx", &mhz_scale);
	iio_spin_button_add_progress(&tx_widgets[num_tx - 1]);

	tx_lo = num_tx;
	ch1 = iio_device_find_channel(dev, "altvoltage1", true);

	if (iio_channel_find_attr(ch1, "frequency"))
		freq_name = "frequency";
	else
		freq_name = "TX_LO_frequency";
	iio_spin_button_s64_init_from_builder(&tx_widgets[num_tx++],
		dev, ch1, freq_name, builder, "tx_lo_freq", &mhz_scale);
	iio_spin_button_add_progress(&tx_widgets[num_tx - 1]);

	ch1 = iio_device_find_channel(dev, "altvoltage1", true);

	if (ini_fn)
		load_profile(ini_fn);

	/* Update all widgets with current values */
	printf("Updating widgets...\n");
	update_widgets();
	rx_freq_info_update();
	printf("Updating FIR filter...\n");
	filter_fir_update();
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_all_fir_filters), true);
	glb_settings_update_labels();
	rssi_update_labels();
	dac_data_manager_freq_widgets_range_update(dac_tx_manager,
		get_gui_tx_sampling_freq() / 2.0);
	dac_data_manager_update_iio_widgets(dac_tx_manager);

	/* Widgets bindings */
	g_builder_bind_property(builder, "rssi_tx1", "visible",
		"label_rssi_tx1", "sensitive", G_BINDING_DEFAULT);
	g_builder_bind_property(builder, "rssi_tx2", "visible",
		"label_rssi_tx2", "sensitive", G_BINDING_DEFAULT);

	/* Connect signals */

	if (iio_channel_find_attr(ch1, "fastlock_store"))
		tx_fastlock_store_name = "fastlock_store";
	else
		tx_fastlock_store_name = "TX_LO_fastlock_store";
	if (iio_channel_find_attr(ch1, "fastlock_recall"))
		tx_fastlock_recall_name = "fastlock_recall";
	else
		tx_fastlock_recall_name = "TX_LO_fastlock_recall";

	g_builder_connect_signal(builder, "rx1_phase_rotation", "value-changed",
			G_CALLBACK(rx_phase_rotation_set), (gpointer *)0);

	g_builder_connect_signal(builder, "rx2_phase_rotation", "value-changed",
			G_CALLBACK(rx_phase_rotation_set), (gpointer *)2);

	g_builder_connect_signal(builder, "sampling_freq_tx", "value-changed",
			G_CALLBACK(tx_sample_rate_changed), NULL);

	g_builder_connect_signal(builder, "fmcomms2_settings_reload", "clicked",
		G_CALLBACK(reload_button_clicked), NULL);

	g_builder_connect_signal(builder, "filter_fir_config", "file-set",
		G_CALLBACK(filter_fir_config_file_set_cb), NULL);

	g_builder_connect_signal(builder, "rx_fastlock_store", "clicked",
		G_CALLBACK(fastlock_clicked), (gpointer) 1);
	g_builder_connect_signal(builder, "tx_fastlock_store", "clicked",
		G_CALLBACK(fastlock_clicked), (gpointer) 2);
	g_builder_connect_signal(builder, "rx_fastlock_recall", "clicked",
		G_CALLBACK(fastlock_clicked), (gpointer) 3);
	g_builder_connect_signal(builder, "tx_fastlock_recall", "clicked",
		G_CALLBACK(fastlock_clicked), (gpointer) 4);

	g_signal_connect_after(section_toggle[SECTION_GLOBAL], "clicked",
		G_CALLBACK(hide_section_cb), section_setting[SECTION_GLOBAL]);

	g_signal_connect_after(section_toggle[SECTION_TX], "clicked",
		G_CALLBACK(hide_section_cb), section_setting[SECTION_TX]);

	g_signal_connect_after(section_toggle[SECTION_RX], "clicked",
		G_CALLBACK(hide_section_cb), section_setting[SECTION_RX]);

	g_signal_connect_after(section_toggle[SECTION_FPGA], "clicked",
		G_CALLBACK(hide_section_cb), section_setting[SECTION_FPGA]);

	g_signal_connect_after(ensm_mode_available, "changed",
		G_CALLBACK(glb_settings_update_labels), NULL);

	g_signal_connect_after(calib_mode_available, "changed",
		G_CALLBACK(glb_settings_update_labels), NULL);

	g_signal_connect_after(trx_rate_governor_available, "changed",
		G_CALLBACK(glb_settings_update_labels), NULL);

	g_signal_connect_after(rx_gain_control_modes_rx1, "changed",
		G_CALLBACK(glb_settings_update_labels), NULL);
	g_signal_connect_after(rx_gain_control_modes_rx2, "changed",
		G_CALLBACK(glb_settings_update_labels), NULL);

	if (tx_rssi_available)
		g_signal_connect(rf_port_select_rx, "changed",
			G_CALLBACK(rf_port_select_rx_changed_cb), NULL);

	g_signal_connect_after(enable_fir_filter_rx, "toggled",
		G_CALLBACK(filter_fir_enable), NULL);
	g_signal_connect_after(fir_filter_en_tx, "toggled",
		G_CALLBACK(filter_fir_enable), NULL);
	g_signal_connect_after(enable_fir_filter_rx_tx, "toggled",
		G_CALLBACK(filter_fir_enable), NULL);
	g_signal_connect_after(disable_all_fir_filters, "toggled",
		G_CALLBACK(filter_fir_enable), NULL);

	g_signal_connect(up_down_converter, "toggled",
		G_CALLBACK(up_down_converter_toggled_cb), NULL);

	make_widget_update_signal_based(glb_widgets, num_glb);
	make_widget_update_signal_based(rx_widgets, num_rx);
	make_widget_update_signal_based(tx_widgets, num_tx);

	iio_spin_button_set_on_complete_function(&rx_widgets[rx_sample_freq],
		sample_frequency_changed_cb, NULL);
	iio_spin_button_set_on_complete_function(&tx_widgets[tx_sample_freq],
		sample_frequency_changed_cb, NULL);
	iio_spin_button_set_on_complete_function(&rx_widgets[rx_lo],
		sample_frequency_changed_cb, NULL);
	iio_spin_button_set_on_complete_function(&tx_widgets[tx_lo],
		sample_frequency_changed_cb, NULL);

	add_ch_setup_check_fct("cf-ad9361-lpc", channel_combination_check);

	struct iio_device *adc_dev;
	struct extra_dev_info *adc_info;

	adc_dev = iio_context_find_device(get_context_from_osc(), CAP_DEVICE);
	if (adc_dev) {
		adc_info = iio_device_get_data(adc_dev);
		if (adc_info)
			adc_info->plugin_fft_corr = 20 * log10(1/sqrt(HANNING_ENBW));
	}

	block_diagram_init(builder, 2, "fmcomms2.svg", "AD_FMCOMM2S2_RevC.jpg");

	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(filter_fir_config), OSC_FILTER_FILE_PATH);
	dac_data_manager_set_buffer_chooser_current_folder(dac_tx_manager, OSC_WAVEFORM_FILE_PATH);

	if (!is_2rx_2tx) {
		gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(builder, "frame_rx2")));
		gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(builder, "frame_fpga_rx2")));
		gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(builder, "table_hw_gain_tx2")));
	}
	if (!tx_rssi_available) {
		gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(builder, "rssi_tx1")));
		gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(builder, "rssi_tx2")));
		gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(builder, "label_rssi_tx1")));
		gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(builder, "label_rssi_tx2")));
	}
	gtk_widget_set_visible(up_down_converter, has_udc_driver);

	g_timeout_add(1000, (GSourceFunc) update_display, ctx);
	can_update_widgets = true;

	return fmcomms2_panel;
}
Beispiel #27
0
 void introduce_dialog::contact_2_selected(int)
 {
     update_widgets();
 }
Beispiel #28
0
void se_expr_param_t::expr_editor_apply( const std::string& new_expr)
{
    set_value( new_expr);
    param_set()->notify_parent();
    update_widgets();
}
void generic_sys_coordinator::on_system_update()
{
	if(m_request_termination)
	{
		return;
	}

	time_check();

	bool result;
	{
		std::lock_guard< std::mutex > guard(m_sys_mutex);
		result = m_sys->update(nullptr);
		m_system_st = result ? SystemState::Active : SystemState::Completed;
	}
	++m_step;

	m_ready_to_display = true;

	auto uinf = m_sys->get_update_info();
	if(uinf.type == rtp::i_system::update_info::Type::Realtime)
	{
		if(m_system_st == SystemState::Completed || (m_step % RenderPeriod == 0))
		{
			update_widgets();
		}

		if(m_system_st == SystemState::Active)
		{
			m_timer.expires_at(m_timer.expires_at() + boost::posix_time::milliseconds(1000.0f / uinf.frequency));
			m_timer.async_wait(boost::bind(&generic_sys_coordinator::on_system_update, this));
		}
		else if(m_finish_cb)
		{
			m_finish_cb();
		}
	}
	else
	{
		if(m_widget->get_drawer()->is_animated())
		{
			auto anim_drawer = static_cast<rtp::animated_system_drawer*>(m_widget->get_drawer());
			anim_drawer->start();

			// Initiate animation sequence
			m_timer.expires_at(m_timer.expires_at() + boost::posix_time::milliseconds(1000.0f / AnimationFreq));
			m_timer.async_wait(boost::bind(&generic_sys_coordinator::on_animation_update, this));
		}
		else if(m_system_st == SystemState::Active)
		{
			m_timer.expires_at(m_timer.expires_at() + boost::posix_time::milliseconds(1000.0f / NonRealtimeFreq));
			m_timer.async_wait(boost::bind(&generic_sys_coordinator::on_system_update, this));
		}
		else if(m_finish_cb)
		{
			m_finish_cb();
		}

		// Draw
		update_widgets();
	}
}
static void reload_button_clicked(GtkButton *btn, gpointer data)
{
	update_widgets();
	dac_data_manager_update_iio_widgets(dac_tx_manager);
}