Ejemplo n.º 1
0
static void
wire_item_paste (SchematicView *sv, ItemData *data)
{
	g_return_if_fail (sv != NULL);
	g_return_if_fail (IS_SCHEMATIC_VIEW (sv));
	g_return_if_fail (data != NULL);
	g_return_if_fail (IS_WIRE (data));

	schematic_view_add_ghost_item (sv, data);
}
Ejemplo n.º 2
0
void sheet_connect_part_item_to_floating_group (Sheet *sheet, gpointer *sv)
{
	g_return_if_fail (sheet);
	g_return_if_fail (IS_SHEET (sheet));
	g_return_if_fail (sv);
	g_return_if_fail (IS_SCHEMATIC_VIEW (sv));

	sheet->state = SHEET_STATE_FLOAT_START;

	if (sheet->priv->float_handler_id != 0)
		return;

	sheet->priv->float_handler_id =
	    g_signal_connect (G_OBJECT (sheet), "event", G_CALLBACK (sheet_item_floating_event), sv);
}
Ejemplo n.º 3
0
static void response_callback (GtkButton *button, SchematicView *sv)
{
	g_return_if_fail (sv != NULL);
	g_return_if_fail (IS_SCHEMATIC_VIEW (sv));
	g_return_if_fail (button != NULL);
	g_return_if_fail (GTK_IS_BUTTON (button));
	gint page;
	gchar *tmp = NULL;
	gchar **node_ids = NULL;

	Schematic *sm = schematic_view_get_schematic (sv);

	SimSettingsGui *s_gui = schematic_get_sim_settings_gui(sm);
	SimSettings *s = s_gui->sim_settings;

	g_object_get (s_gui->notebook, "page", &page, NULL);

	// Transient analysis
	s->trans_enable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_trans_enable));

	g_free (s->trans_start);
	s->trans_start = gtk_editable_get_chars (GTK_EDITABLE (s_gui->w_trans_start), 0, -1);

	g_free (s->trans_stop);
	s->trans_stop = gtk_editable_get_chars (GTK_EDITABLE (s_gui->w_trans_stop), 0, -1);

	g_free (s->trans_step);
	s->trans_step = gtk_editable_get_chars (GTK_EDITABLE (s_gui->w_trans_step), 0, -1);

	s->trans_step_enable =
	    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_trans_step_enable));

	s->trans_init_cond =
	    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_trans_init_cond));

	s->trans_analyze_all =
	    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_trans_analyze_all));

	// DC
	s->dc_enable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_dc_enable));

	g_free (s->dc_vin);
	s->dc_vin = NULL;
	tmp = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_dc_vin));
	if (tmp) {
		node_ids = g_strsplit (tmp, "V(", 0);
		tmp = g_strdup (node_ids[1]);
		g_strfreev (node_ids);
		if (tmp) {
			node_ids = g_strsplit (tmp, ")", 0);
			g_free (tmp);
			if (node_ids[0])
				s->dc_vin = g_strdup (node_ids[0]);
			else
				s->dc_vin = g_strdup("");
			g_strfreev (node_ids);
		}
	}
	if (s->dc_vin == NULL)
		s->dc_vin = g_strdup ("");

	g_free (s->dc_vout);
	s->dc_vout = NULL;
	tmp = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_dc_vout));
	if (tmp) {
		node_ids = g_strsplit (tmp, "V(", 0);
		tmp = g_strdup (node_ids[1]);
		g_strfreev (node_ids);
		if (tmp) {
			node_ids = g_strsplit (tmp, ")", 0);
			g_free (tmp);
			if (node_ids[0])
				s->dc_vout = g_strdup (node_ids[0]);
			else
				s->dc_vout = g_strdup("");
			g_strfreev (node_ids);
		}
	}
	if (s->dc_vout == NULL)
		s->dc_vout = g_strdup("");

	g_free (s->dc_start);
	s->dc_start = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_dc_start)));

	g_free (s->dc_stop);
	s->dc_stop = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_dc_stop)));

	g_free (s->dc_step);
	s->dc_step = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_dc_step)));

	// AC
	s->ac_enable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_ac_enable));

	g_free (s->ac_vout);
	s->ac_vout = NULL;
	tmp = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_ac_vout));
	if (tmp) {
		node_ids = g_strsplit (tmp, "V(", 0);
		tmp = g_strdup (node_ids[1]);
		g_strfreev (node_ids);
		if (tmp) {
			node_ids = g_strsplit (tmp, ")", 0);
			g_free (tmp);
			if (node_ids[0])
				s->ac_vout = g_strdup (node_ids[0]);
			else
				s->ac_vout = g_strdup("");
			g_strfreev (node_ids);
		}
	}
	if (s->ac_vout == NULL)
		s->ac_vout = g_strdup("");

	g_free (s->ac_type);
	s->ac_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_ac_type));

	g_free (s->ac_npoints);
	s->ac_npoints = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_ac_npoints)));

	g_free (s->ac_start);
	s->ac_start = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_ac_start)));

	g_free (s->ac_stop);
	s->ac_stop = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_ac_stop)));

	// Fourier analysis
	s->fourier_enable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_four_enable));

	g_free (s->fourier_frequency);
	s->fourier_frequency = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_four_freq)));

	// Noise
	s->noise_enable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_noise_enable));

	g_free (s->noise_vin);
	s->noise_vin = NULL;
	tmp = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_noise_vin));
	if (tmp) {
		node_ids = g_strsplit (tmp, "V(", 0);
		tmp = g_strdup (node_ids[1]);
		g_strfreev (node_ids);
		if (tmp) {
			node_ids = g_strsplit (tmp, ")", 0);
			g_free (tmp);
			if (node_ids[0])
				s->noise_vin = g_strdup (node_ids[0]);
			else
				s->noise_vin = g_strdup("");
			g_strfreev (node_ids);
		}
	}
	if (s->noise_vin == NULL)
		s->noise_vin = g_strdup("");

	g_free (s->noise_vout);
	s->noise_vout = NULL;
	tmp = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_noise_vout));
	if (tmp) {
		node_ids = g_strsplit (tmp, "V(", 0);
		tmp = g_strdup (node_ids[1]);
		g_strfreev (node_ids);
		if (tmp) {
			node_ids = g_strsplit (tmp, ")", 0);
			g_free (tmp);
			if (node_ids[0])
				s->noise_vout = g_strdup (node_ids[0]);
			else
				s->noise_vout = g_strdup("");
			g_strfreev (node_ids);
		}
	}
	if (s->noise_vout == NULL)
		s->noise_vout = g_strdup("");

	g_free (s->noise_type);
	s->noise_type = g_strdup (gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_noise_type)));

	g_free (s->noise_npoints);
	s->noise_npoints = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_noise_npoints)));

	g_free (s->noise_start);
	s->noise_start = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_noise_start)));

	g_free (s->noise_stop);
	s->noise_stop = g_strdup (gtk_entry_get_text (GTK_ENTRY (s_gui->w_noise_stop)));

	// Options
	get_options_from_list (s_gui);
	gtk_widget_hide (GTK_WIDGET (s_gui->pbox));
	s_gui->pbox = NULL;
	s_gui->notebook = NULL;

	// Schematic is dirty now ;-)
	schematic_set_dirty (sm, TRUE);

	s->configured = TRUE;

	// The simulation settings configuration has
	// been triggered by an attempt to lauch the
	// simulation for the first time without
	// configuring it first.
	if (s->simulation_requested) {
		s->simulation_requested = FALSE;
		schematic_view_simulate_cmd (NULL, sv);
	}
}