コード例 #1
0
ファイル: unit-menu.cpp プロジェクト: AakashDabas/inkscape
Unit const * UnitMenu::getUnit() const
{
    if (get_active_text() == "") {
        g_assert(_type != UNIT_TYPE_NONE);
        return unit_table.getUnit(unit_table.primary(_type));
    }
    return unit_table.getUnit(get_active_text());
}
コード例 #2
0
ファイル: unit-menu.cpp プロジェクト: AakashDabas/inkscape
Glib::ustring UnitMenu::getUnitAbbr() const
{
    if (get_active_text() == "") {
        return "";
    }
    return getUnit()->abbr;
}
コード例 #3
0
ファイル: equipment.c プロジェクト: XinyuSimov/subsurface
static void record_cylinder_changes(cylinder_t *cyl, struct cylinder_widget *cylinder)
{
	const gchar *desc;
	GtkComboBox *box;
	double volume, pressure, start, end;
	int o2, he;

	/* Ignore uninitialized cylinder widgets */
	box = cylinder->description;
	if (!box)
		return;

	desc = strdup(get_active_text(box));
	volume = gtk_spin_button_get_value(cylinder->size);
	pressure = gtk_spin_button_get_value(cylinder->pressure);
	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->pressure_button))) {
		start = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->start));
		end = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->end));
	} else {
		start = end = 0;
	}
	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder->gasmix_button))) {
		o2 = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->o2))*10 + 0.5;
		he = gtk_spin_button_get_value(GTK_SPIN_BUTTON(cylinder->he))*10 + 0.5;
	} else {
		o2 = 0;
		he = 0;
	}
	fill_cylinder_info(cylinder, cyl, desc, volume, pressure, start, end, o2, he);
}
コード例 #4
0
std::string Gobby::EncodingSelector::get_encoding() const
{	
	// Return untranslated "auto detection" encoding. This is meant as an
	// opaque object.
	if(get_active_row_number() == 0 && m_show_automatic)
		return AUTO_DETECT;

	return get_active_text();
}
コード例 #5
0
ファイル: equipment.c プロジェクト: XinyuSimov/subsurface
static void cylinder_cb(GtkComboBox *combo_box, gpointer data)
{
	GtkTreeIter iter;
	GtkTreeModel *model = gtk_combo_box_get_model(combo_box);
	int ml, mbar;
	struct cylinder_widget *cylinder = data;
	struct dive *dive;
	cylinder_t *cyl;

	if (cylinder->w_idx == W_IDX_PRIMARY)
		dive = current_dive;
	else
		dive = &edit_dive;
	cyl = dive->cylinder + cylinder->index;

	/* Did the user set it to some non-standard value? */
	if (!get_active_item(combo_box, &iter, cylinder_model)) {
		cylinder->changed = 1;
		return;
	}

	/*
	 * We get "change" signal callbacks just because we set
	 * the description by hand. Whatever. So ignore them if
	 * they are no-ops.
	 */
	if (!cylinder->changed && cyl->type.description) {
		int same;
		const char *desc = get_active_text(combo_box);

		same = !strcmp(desc, cyl->type.description);
		if (same)
			return;
	}
	cylinder->changed = 1;

	gtk_tree_model_get(model, &iter,
		CYL_SIZE, &ml,
		CYL_WORKP, &mbar,
		-1);

	set_cylinder_type_spinbuttons(cylinder, ml, mbar);
}
コード例 #6
0
ファイル: equipment.c プロジェクト: XinyuSimov/subsurface
static int get_active_item(GtkComboBox *combo_box, GtkTreeIter *iter, GtkListStore *model)
{
	const char *desc;

	if (gtk_combo_box_get_active_iter(combo_box, iter))
		return TRUE;

	desc = get_active_text(combo_box);

	found_match = NULL;
	gtk_tree_model_foreach(GTK_TREE_MODEL(model), match_desc, (void *)desc);

	if (!found_match)
		return FALSE;

	*iter = *found_match;
	gtk_combo_box_set_active_iter(combo_box, iter);
	return TRUE;
}
コード例 #7
0
ファイル: equipment.c プロジェクト: XinyuSimov/subsurface
static void weight_cb(GtkComboBox *combo_box, gpointer data)
{
	GtkTreeIter iter;
	GtkTreeModel *model = gtk_combo_box_get_model(combo_box);
	int weight;
	struct ws_widget *ws_widget = data;
	struct dive *dive;
	weightsystem_t *ws;
	if (ws_widget->w_idx == W_IDX_PRIMARY)
		dive = current_dive;
	else
		dive = &edit_dive;
	ws = dive->weightsystem + ws_widget->index;

	/* Did the user set it to some non-standard value? */
	if (!get_active_item(combo_box, &iter, weightsystem_model)) {
		ws_widget->changed = 1;
		return;
	}

	/*
	 * We get "change" signal callbacks just because we set
	 * the description by hand. Whatever. So ignore them if
	 * they are no-ops.
	 */
	if (!ws_widget->changed && ws->description) {
		int same;
		const char *desc = get_active_text(combo_box);

		same = !strcmp(desc, ws->description);
		if (same)
			return;
	}
	ws_widget->changed = 1;

	gtk_tree_model_get(model, &iter,
		WS_WEIGHT, &weight,
		-1);

	set_weight_weight_spinbutton(ws_widget, weight);
}
コード例 #8
0
ファイル: equipment.c プロジェクト: XinyuSimov/subsurface
static void record_weightsystem_changes(weightsystem_t *ws, struct ws_widget *weightsystem_widget)
{
	const gchar *desc;
	GtkComboBox *box;
	int grams;
	double value;
	GtkTreeIter iter;

	/* Ignore uninitialized cylinder widgets */
	box = weightsystem_widget->description;
	if (!box)
		return;

	desc = strdup(get_active_text(box));
	value = gtk_spin_button_get_value(weightsystem_widget->weight);

	if (prefs.units.weight == LBS)
		grams = lbs_to_grams(value);
	else
		grams = value * 1000;
	ws->weight.grams = grams;
	ws->description = desc;
	add_weightsystem_type(desc, grams, &iter);
}
コード例 #9
0
ファイル: radiobutton.cpp プロジェクト: wdmchaft/DoonSketch
 virtual void on_changed() {
     if ( base ) {
         base->set(get_active_text().c_str(), doc, node);
     }
 }