Ejemplo n.º 1
0
void anypaper_window_set_position_range(AnypaperWindow *window, gint rangex, gint rangey)
{
	if (rangex < 0)	gtk_spin_button_set_range (GTK_SPIN_BUTTON (window->priv->spin1), (gdouble) 2 * rangex, 0);
	if (rangex >= 0) gtk_spin_button_set_range (GTK_SPIN_BUTTON (window->priv->spin1), 0, 2 * rangex);
	if (rangey < 0)	gtk_spin_button_set_range (GTK_SPIN_BUTTON (window->priv->spin2), (gdouble) 2 * rangey, 0);
	if (rangey >= 0) gtk_spin_button_set_range (GTK_SPIN_BUTTON (window->priv->spin2), 0, 2 * rangey);
	if (rangex == 0) 
	{
		gtk_widget_set_sensitive (window->priv->spin1, FALSE);
		gtk_widget_set_sensitive (window->priv->label1, FALSE);
	}
	else
	{
		gtk_widget_set_sensitive (window->priv->spin1, TRUE);
		gtk_widget_set_sensitive (window->priv->label1, TRUE);
	}
	if (rangey == 0) 
	{
		gtk_widget_set_sensitive (window->priv->spin2, FALSE);
		gtk_widget_set_sensitive (window->priv->label2, FALSE);
	}
	else
	{
		gtk_widget_set_sensitive (window->priv->spin2, TRUE);
		gtk_widget_set_sensitive (window->priv->label2, TRUE);
	}
}
Ejemplo n.º 2
0
G_MODULE_EXPORT void
hanlder_gpgme_add_subkey_type_changed (GtkComboBox *combo, BastileWidget *swidget)
{
	gint type;
	GtkSpinButton *length;
    GtkTreeModel *model;
    GtkTreeIter iter;
    	
	length = GTK_SPIN_BUTTON (bastile_widget_get_widget (swidget, LENGTH));
	
	model = gtk_combo_box_get_model (combo);
	gtk_combo_box_get_active_iter (combo, &iter);
	gtk_tree_model_get (model, &iter,
                        COMBO_INT, &type,
                        -1);
	
	switch (type) {
		/* DSA */
		case 0:
			gtk_spin_button_set_range (length, DSA_MIN, DSA_MAX);
			gtk_spin_button_set_value (length, LENGTH_DEFAULT < DSA_MAX ? LENGTH_DEFAULT : DSA_MAX);
			break;
		/* ElGamal */
		case 1:
			gtk_spin_button_set_range (length, ELGAMAL_MIN, LENGTH_MAX);
			gtk_spin_button_set_value (length, LENGTH_DEFAULT);
			break;
		/* RSA */
		default:
			gtk_spin_button_set_range (length, RSA_MIN, LENGTH_MAX);
			gtk_spin_button_set_value (length, LENGTH_DEFAULT);
			break;
	}
}
Ejemplo n.º 3
0
void _update_dimensions(dt_lib_export_t *d)
{
  uint32_t w=0,h=0;
  _get_max_output_dimension(d,&w,&h);
  gtk_spin_button_set_range( d->width,0, (w>0?w:10000) );
  gtk_spin_button_set_range( d->height,0, (h>0?h:10000) );
}
Ejemplo n.º 4
0
G_MODULE_EXPORT void
x264_me_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
    gint me;

    ghb_widget_to_setting(ud->x264_priv, widget);
    if (!ignore_options_update)
    {
        ignore_options_update = TRUE;
        x264_opt_update(ud, widget);
        ignore_options_update = FALSE;
    }
    ghb_check_dependency(ud, widget, NULL);
    ghb_clear_presets_selection(ud);
    widget = GHB_WIDGET(ud->builder, "x264_merange");
    me = ghb_settings_combo_int(ud->x264_priv, "x264_me");
    if (me < 2)
    {   // me < umh
        // me_range 4 - 16
        gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 16);
    }
    else
    {
        // me_range 4 - 64
        gtk_spin_button_set_range(GTK_SPIN_BUTTON(widget), 4, 64);
    }
}
Ejemplo n.º 5
0
static gboolean
drawable_button_release_cb (GtkWidget *widget, GdkEventButton *event, VnrCrop *crop)
{
    if(event->button == 1)
    {
        crop->drawing_rectangle = FALSE;

        gtk_spin_button_set_range(crop->spin_width, 1,
                                  (crop->width - crop->sub_x) / crop->zoom);
        gtk_spin_button_set_range(crop->spin_height, 1,
                                  (crop->height - crop->sub_y) / crop->zoom);

        vnr_crop_update_spin_button_values (crop);
    }
    return FALSE;
}
Ejemplo n.º 6
0
void wxSpinCtrlGTKBase::DoSetRange(double minVal, double maxVal)
{
    wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );

    wxSpinCtrlEventDisabler disable(this);
    gtk_spin_button_set_range( GTK_SPIN_BUTTON(m_widget), minVal, maxVal);
}
Ejemplo n.º 7
0
void
brasero_split_dialog_set_boundaries (BraseroSplitDialog *self,
				     gint64 start,
				     gint64 end)
{
	BraseroSplitDialogPrivate *priv;
	guint64 length;

	priv = BRASERO_SPLIT_DIALOG_PRIVATE (self);

	if (BRASERO_DURATION_TO_BYTES (start) % 2352)
		start += BRASERO_BYTES_TO_DURATION (2352 - (BRASERO_DURATION_TO_BYTES (start) % 2352));

	if (BRASERO_DURATION_TO_BYTES (end) % 2352)
		end += BRASERO_BYTES_TO_DURATION (2352 - (BRASERO_DURATION_TO_BYTES (end) % 2352));

	if (end - start < BRASERO_MIN_STREAM_LENGTH)
		return;

	priv->start = start;
	priv->end = end;

	brasero_song_control_set_boundaries (BRASERO_SONG_CONTROL (priv->player),
	                                     priv->start,
	                                     priv->end);

	/* Don't allow splitting the track in sections longer than the track
	 * length in seconds */
	length = (gdouble) brasero_song_control_get_length  (BRASERO_SONG_CONTROL (priv->player)) / 1000000000;
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (priv->spin_sec), 1.0, length);
}
Ejemplo n.º 8
0
void
pfi_gui_make ( void )
{
    extern const char pfi_gtk_gui[];
    GtkBuilder * b;
    int i;
    
    pfi_mutex = g_mutex_new();
    
    /* Create the interface builder */
    b = gtk_builder_new();
    
    /* Load spec */
    gtk_builder_add_from_string( b, pfi_gtk_gui, -1, NULL );
    
    /* Grab symbols */
    for( i = 0; syms[i].symname; i++ )
        *syms[i].stor = (GtkWidget*)gtk_builder_get_object( b, syms[i].symname );
    
    system( "touch pfilog.txt" );
    
    gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(pfi_gui_e_file), "pfilog.txt" );
    gtk_spin_button_set_range( GTK_SPIN_BUTTON(pfi_gui_e_arg_start), 0.0, 3.0 ); 
    
    gtk_widget_set_sensitive( pfi_gui_b_disable, FALSE );
    
    g_signal_connect( G_OBJECT(pfi_gui_window), "delete-event", (GCallback)delete_event, NULL );
    g_signal_connect( G_OBJECT(pfi_gui_b_close), "clicked", (GCallback)close, NULL );
    g_signal_connect( G_OBJECT(pfi_gui_b_enable), "clicked", (GCallback)enable, NULL );
    g_signal_connect( G_OBJECT(pfi_gui_b_disable), "clicked", (GCallback)disable, NULL );
}
static void
panel_properties_dialog_setup_size_spin (PanelPropertiesDialog *dialog,
					 GladeXML              *gui)
{
	dialog->size_widgets = glade_xml_get_widget (gui, "size_widgets");
	g_return_if_fail (dialog->size_widgets != NULL);
	dialog->size_spin = glade_xml_get_widget (gui, "size_spin");
	g_return_if_fail (dialog->size_spin != NULL);
	dialog->size_label = glade_xml_get_widget (gui, "size_label");
	g_return_if_fail (dialog->size_label != NULL);
	dialog->size_label_pixels = glade_xml_get_widget (gui, "size_label_pixels");
	g_return_if_fail (dialog->size_label_pixels != NULL);

	gtk_spin_button_set_range (GTK_SPIN_BUTTON (dialog->size_spin),
				   panel_toplevel_get_minimum_size (dialog->toplevel),
				   panel_toplevel_get_maximum_size (dialog->toplevel));

	gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->size_spin),
				   panel_profile_get_toplevel_size (dialog->toplevel));

	g_signal_connect_swapped (dialog->size_spin, "value_changed",
				  G_CALLBACK (panel_properties_dialog_size_changed),
				  dialog);

	if ( ! panel_profile_is_writable_toplevel_size (dialog->toplevel)) {
		gtk_widget_set_sensitive (dialog->size_spin, FALSE);
		gtk_widget_set_sensitive (dialog->size_label, FALSE);
		gtk_widget_set_sensitive (dialog->size_label_pixels, FALSE);
		gtk_widget_show (dialog->writability_warn_general);
	}
}
Ejemplo n.º 10
0
static void
photos_print_setup_set_initial_values (PhotosPrintSetup *self)
{
    PhotosPrintSetupPrivate *priv = self->priv;
    GeglRectangle bbox;
    gdouble page_height;
    gdouble page_width;
    gdouble factor;
    gdouble height;
    gdouble max_perc;
    gdouble width;

    factor = get_scale_to_px_factor (self);

    bbox = gegl_node_get_bounding_box (priv->node);
    width = (gdouble) bbox.width/factor;
    height = (gdouble) bbox.height/factor;

    max_perc = photos_print_setup_get_max_percentage (self);

    width *= max_perc;
    height *= max_perc;

    gtk_range_set_range (GTK_RANGE (priv->scaling), 1, 100 * max_perc);
    gtk_range_set_increments (GTK_RANGE (priv->scaling), max_perc, 10 * max_perc);
    gtk_range_set_value (GTK_RANGE (priv->scaling), 100 * max_perc);

    photos_print_preview_set_scale (PHOTOS_PRINT_PREVIEW (priv->preview), max_perc);
    gtk_spin_button_set_range (GTK_SPIN_BUTTON (priv->width), 0, width);
    gtk_spin_button_set_range (GTK_SPIN_BUTTON (priv->height), 0, height);
    gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->width), width);
    gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->height), height);

    gtk_combo_box_set_active (GTK_COMBO_BOX (priv->center), CENTER_BOTH);

    photos_print_setup_center (gtk_page_setup_get_page_width (priv->page_setup, priv->current_unit),
                               gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->width)),
                               GTK_SPIN_BUTTON (priv->left), GTK_SPIN_BUTTON (priv->right));
    photos_print_setup_center (gtk_page_setup_get_page_height (priv->page_setup, priv->current_unit),
                               gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->height)),
                               GTK_SPIN_BUTTON (priv->top), GTK_SPIN_BUTTON (priv->bottom));

    page_width = gtk_page_setup_get_page_width (priv->page_setup, priv->current_unit);
    page_height = gtk_page_setup_get_page_height (priv->page_setup, priv->current_unit);

    update_image_pos_ranges (self, page_width, page_height, width, height);
}
Ejemplo n.º 11
0
static void cell_width_value_changed(void)
{
        int min;

        min = CELL_HEIGHT_MIN > cell_width ? CELL_HEIGHT_MIN : cell_width;
        gtk_spin_button_set_range(GTK_SPIN_BUTTON(cell_height_spin),
                                  min, CELL_HEIGHT_MAX);
}
Ejemplo n.º 12
0
void wxSpinCtrl::SetRange(int minVal, int maxVal)
{
    wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );

    wxSpinCtrl_GtkDisableEvents( this );
    gtk_spin_button_set_range( GTK_SPIN_BUTTON(m_widget), minVal, maxVal);
    wxSpinCtrl_GtkEnableEvents( this );
}
Ejemplo n.º 13
0
static void update_page(TraceViewStore *store)
{
	if (!store->spin)
		return;

	gtk_spin_button_set_range(GTK_SPIN_BUTTON(store->spin),
				  1, store->pages);
}
GtkWidget * AP_UnixDialog_InsertTable::_constructWindow(void)
{
	GtkWidget * window;
	const XAP_StringSet * pSS = m_pApp->getStringSet();

#if GTK_CHECK_VERSION(3,0,0)	
	GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_InsertTable.ui");
#else
	GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_InsertTable-2.ui");
#endif
	// Update our member variables with the important widgets that 
	// might need to be queried or altered later
	window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_InsertTable"));
    GtkWidget * widget = GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize"));
    UT_ASSERT(widget); // it shouldn't happen if things are propoerly installed.
	m_radioGroup = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
	m_pColSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbNumCols"));
	m_pRowSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbNumRows"));
	m_pColWidthSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbColSize"));
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pColSpin), getNumCols());
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pRowSpin), getNumRows());

	GtkWidget *rbAutoColSize = GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize"));
    UT_ASSERT(rbAutoColSize);
	s_auto_colsize_toggled (GTK_TOGGLE_BUTTON (rbAutoColSize), m_pColWidthSpin);
	g_signal_connect (G_OBJECT (rbAutoColSize), "toggled", G_CALLBACK (s_auto_colsize_toggled), m_pColWidthSpin);
	
	// set the dialog title
    std::string s;
	pSS->getValueUTF8(AP_STRING_ID_DLG_InsertTable_TableTitle,s);
	abiDialogSetTitle(window, "%s", s.c_str());
	// Units
	gtk_label_set_text (GTK_LABEL (GTK_WIDGET(gtk_builder_get_object(builder, "lbInch"))), UT_dimensionName(m_dim));
	double spinstep = getSpinIncr ();
	gtk_spin_button_set_increments (GTK_SPIN_BUTTON(m_pColWidthSpin), spinstep, spinstep * 5);
	double spinmin = getSpinMin ();
	gtk_spin_button_set_range (GTK_SPIN_BUTTON(m_pColWidthSpin), spinmin, spinmin * 1000);
	
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pColWidthSpin), m_columnWidth);
	// localize the strings in our dialog, and set tags for some widgets
	
	localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbTableSize")), pSS, AP_STRING_ID_DLG_InsertTable_TableSize);
	localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbNumCols")), pSS, AP_STRING_ID_DLG_InsertTable_NumCols);
	localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbNumRows")), pSS, AP_STRING_ID_DLG_InsertTable_NumRows);
	
	localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbAutoFit")), pSS, AP_STRING_ID_DLG_InsertTable_AutoFit);
	
	localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize")), pSS, AP_STRING_ID_DLG_InsertTable_AutoColSize);
	g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_AUTOSIZE));	
	
	localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbFixedColSize")), pSS, AP_STRING_ID_DLG_InsertTable_FixedColSize);
	g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbFixedColSize"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_FIXEDSIZE));
	localizeButtonUnderline(GTK_WIDGET(gtk_builder_get_object(builder, "btInsert")), pSS, AP_STRING_ID_DLG_InsertButton);

	g_object_unref(G_OBJECT(builder));

	return window;
}
static void
update_time_unit_limits (GtkComboBox *menu, GtkWidget *spin_button)
{
	/* set the range on the spin button so it can't overflow when
	 * converted to seconds when we're constructing the query
	 */
	gulong mult = time_unit_options [gtk_combo_box_get_active (menu)].timeMultiplier;
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (spin_button), 1, G_MAXINT / mult);
}
Ejemplo n.º 16
0
void
insert_label_spin_with_limits(GtkWidget * table, char * ltext, GtkWidget ** spin, double spinval,
			      double min, double max, int y1, int y2) {


	insert_label_spin(table, ltext, spin, spinval, y1, y2);
	gtk_spin_button_set_range(GTK_SPIN_BUTTON(*spin), min, max);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(*spin), spinval);
}
Ejemplo n.º 17
0
void wxSpinButton::SetRange(int minVal, int maxVal)
{
    wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );

    GtkDisableEvents();
    gtk_spin_button_set_range((GtkSpinButton*)m_widget, minVal, maxVal);
    m_pos = int(gtk_spin_button_get_value((GtkSpinButton*)m_widget));
    GtkEnableEvents();
}
static gboolean
kaplan_meier_tool_set_censor_from_cb (G_GNUC_UNUSED GtkWidget *dummy,
				KaplanMeierToolState *state)
{
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (state->censor_spin_to),
				   gtk_spin_button_get_value (GTK_SPIN_BUTTON (state->censor_spin_from)),G_MAXSHORT);
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->censorship_button), TRUE);

	return FALSE;
}
Ejemplo n.º 19
0
static void remmina_rdp_settings_appscale_on_changed(GtkComboBox *widget, RemminaPluginRdpsetGrid *grid)
{
	TRACE_CALL(__func__);
	GtkTreeIter iter;
	guint i = 0;

	if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(grid->device_scale_factor_combo), &iter)) {
		gtk_tree_model_get(GTK_TREE_MODEL(grid->device_scale_factor_store), &iter, 0, &i, -1);
	}
	if (i == 0) {
		gtk_widget_set_sensitive(GTK_WIDGET(grid->desktop_scale_factor_spin), FALSE);
		gtk_spin_button_set_range(GTK_SPIN_BUTTON(grid->desktop_scale_factor_spin), 0, 0);
		gtk_spin_button_set_value(GTK_SPIN_BUTTON(grid->desktop_scale_factor_spin), 0);
	}else  {
		gtk_widget_set_sensitive(GTK_WIDGET(grid->desktop_scale_factor_spin), TRUE);
		gtk_spin_button_set_range(GTK_SPIN_BUTTON(grid->desktop_scale_factor_spin), 100, 500);
		// gtk_spin_button_set_value(GTK_SPIN_BUTTON(grid->desktop_scale_factor_spin), i);
	}
}
Ejemplo n.º 20
0
static void
cb_dialog_goto_update_sensitivity (G_GNUC_UNUSED GtkWidget *dummy,
				   GotoState *state)
{
	GnmValue *val = dialog_goto_get_val (state);
	if (val != NULL) {
		gint cols, rows;
		Sheet *sheet = val->v_range.cell.a.sheet;
		GnmSheetSize const *ssz;

		if (sheet == NULL)
			sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (state->wbcg));
		ssz = gnm_sheet_get_size (sheet);

		cols = ssz->max_cols;
		rows = ssz->max_rows;

		if (val->v_range.cell.a.sheet != NULL && 
		    val->v_range.cell.b.sheet != NULL &&
		    val->v_range.cell.a.sheet != val->v_range.cell.b.sheet) {
			ssz = gnm_sheet_get_size (sheet);
			if (cols > ssz->max_cols)
				cols = ssz->max_cols;
			if (rows > ssz->max_rows)
				cols = ssz->max_rows;
		}
		cols -= val->v_range.cell.a.col;
		rows -= val->v_range.cell.a.row;
		
		if (cols < 1) cols = 1;
		if (rows < 1) rows = 1;

		gtk_spin_button_set_range (state->spin_cols, 1, cols);
		gtk_spin_button_set_range (state->spin_rows, 1, rows);

		gtk_widget_set_sensitive (state->go_button, TRUE);
		
		value_release (val);
	} else
		gtk_widget_set_sensitive (state->go_button, FALSE);
	gtk_entry_set_activates_default (state->goto_text, (val != NULL));
}
Ejemplo n.º 21
0
static void
update_image_pos_ranges (PhotosPrintSetup *setup,
                         gdouble page_width,
                         gdouble page_height,
                         gdouble width,
                         gdouble height)
{
    PhotosPrintSetupPrivate *priv;

    priv = setup->priv;

    gtk_spin_button_set_range (GTK_SPIN_BUTTON (priv->left),
                               0, page_width - width);
    gtk_spin_button_set_range (GTK_SPIN_BUTTON (priv->right),
                               0, page_width - width);
    gtk_spin_button_set_range (GTK_SPIN_BUTTON (priv->top),
                               0, page_height - height);
    gtk_spin_button_set_range (GTK_SPIN_BUTTON (priv->bottom),
                               0, page_height - height);
}
Ejemplo n.º 22
0
static void
range_subdialog (GtkButton *b, gpointer data)
{
  gint response;
  struct select_cases_dialog *scd = data;

  gint n_cases = psppire_data_store_get_case_count (scd->data_store);

  GtkWidget *parent_dialog = get_widget_assert (scd->xml,
						"select-cases-dialog");

  GtkWidget *dialog = get_widget_assert (scd->xml,
					 "select-cases-range-dialog");

  GtkWidget *first = get_widget_assert (scd->xml,
					"range-dialog-first");

  GtkWidget *last = get_widget_assert (scd->xml,
					"range-dialog-last");


  gtk_spin_button_set_range (GTK_SPIN_BUTTON (last),  1,  n_cases);
  gtk_spin_button_set_range (GTK_SPIN_BUTTON (first), 1,  n_cases);

  gtk_window_set_transient_for (GTK_WINDOW (dialog),
				GTK_WINDOW (parent_dialog));


  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
  if ( response == PSPPIRE_RESPONSE_CONTINUE)
    {
      GtkWidget *first = get_widget_assert (scd->xml, "range-dialog-first");
      GtkWidget *last = get_widget_assert (scd->xml, "range-dialog-last");
      GtkWidget *l1 = get_widget_assert (scd->xml, "range-sample-label");
      gchar *text = widget_printf (_("%d thru %d"), first, last);

      gtk_label_set_text (GTK_LABEL (l1), text);

      g_free (text);
    }
}
Ejemplo n.º 23
0
static void
panel_properties_size_spin_update_range (PanelPropertiesDialog *dialog)
{
	//TODO: we should also do this when the monitor size changes

	/* note: we might not be fully setup, so we have to do checks */
	if (!dialog->size_spin)
		return;

	gtk_spin_button_set_range (GTK_SPIN_BUTTON (dialog->size_spin),
				   panel_toplevel_get_minimum_size (dialog->toplevel),
				   panel_toplevel_get_maximum_size (dialog->toplevel));
}
Ejemplo n.º 24
0
void
jam_spin_button_set(GtkSpinButton *w,
		gboolean numeric,
		gdouble min, gdouble max,
		gdouble step, gdouble page,
		gint digits) {
	g_assert(GTK_IS_SPIN_BUTTON(w));

	gtk_spin_button_set_numeric(w, numeric);
	gtk_spin_button_set_range(w, min, max);
	gtk_spin_button_set_increments(w, step, page);
	gtk_spin_button_set_digits(w, digits);
}
Ejemplo n.º 25
0
static void
cb_plot_area_changed (GtkWidget *spin, PlotAreaPrefState *state)
{
	GogViewAllocation pos;
	double value;
	double max;

       	value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin)) / 100.0;

       	gog_chart_get_plot_area (state->chart, &pos);
	if (spin == state->x_spin) {
		pos.x = value;
		max = 1.0 - pos.x;
		g_signal_handler_block (state->w_spin, state->w_spin_signal);
		gtk_spin_button_set_range (GTK_SPIN_BUTTON (state->w_spin), 0.0, max * 100.0);
		if (pos.w > max) pos.w = max;
		gtk_spin_button_set_value (GTK_SPIN_BUTTON (state->w_spin), pos.w * 100.0);
		g_signal_handler_unblock (state->w_spin, state->w_spin_signal);
	}
	else if (spin == state->y_spin) {
		pos.y = value;
		max = 1.0 - pos.y;
		g_signal_handler_block (state->h_spin, state->h_spin_signal);
		gtk_spin_button_set_range (GTK_SPIN_BUTTON (state->h_spin), 0.0, max * 100.0);
		if (pos.h > max) pos.h = max;
		gtk_spin_button_set_value (GTK_SPIN_BUTTON (state->h_spin), pos.w * 100.0);
		g_signal_handler_unblock (state->h_spin, state->h_spin_signal);
	}
	else if (spin == state->w_spin) {
		pos.w = value;
	}
	else if (spin == state->h_spin) {
		pos.h = value;
	}
	gog_chart_set_plot_area (state->chart, &pos);
	gtk_combo_box_set_active (GTK_COMBO_BOX (state->position_select_combo), 1);
	gtk_widget_show (state->manual_setting_grid);
}
static void
panel_properties_dialog_update_orientation (PanelPropertiesDialog *dialog,
					    GConfValue            *value)
{
	PanelOrientation      orientation;
	GtkTreeModel         *model;
	GtkTreeIter           iter;
	OrientationComboItem *item;
	int                   max_size;
	int                   spin_size;
	int                   profile_size;

	if (!value || value->type != GCONF_VALUE_STRING)
		return;

	if (!panel_profile_map_orientation_string (gconf_value_get_string (value), &orientation))
		return;

	/* change the maximum size of the panel */
	//TODO: we should also do this when the monitor size changes
	max_size = panel_toplevel_get_maximum_size (dialog->toplevel);
	spin_size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->size_spin));
	profile_size = panel_profile_get_toplevel_size (dialog->toplevel);

	gtk_spin_button_set_range (GTK_SPIN_BUTTON (dialog->size_spin),
				   panel_toplevel_get_minimum_size (dialog->toplevel),
				   max_size);

	if (spin_size > max_size)
		gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->size_spin),
					   max_size);
	else if (spin_size != profile_size)
		gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->size_spin),
					   MIN (profile_size, max_size));

	/* update the orientation combo box */
	model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->orientation_combo));

	if (!gtk_tree_model_get_iter_first (model, &iter))
		return;

	do {
		gtk_tree_model_get (model, &iter, COLUMN_ITEM, &item, -1);
		if (item != NULL && item->orientation == orientation) {
			gtk_combo_box_set_active_iter (GTK_COMBO_BOX (dialog->orientation_combo),
						       &iter);
			return;
		}
	} while (gtk_tree_model_iter_next (model, &iter));
}
Ejemplo n.º 27
0
static void update_fade_spins(void)
{
    int fade =      patch_get_fade_samples(se->patch);
    int max_fade =  patch_get_max_fade_samples(se->patch);
    int xfade =     patch_get_xfade_samples(se->patch);
    int max_xfade = patch_get_max_xfade_samples(se->patch);

    g_signal_handlers_block_by_func(se->fade_spin, cb_fade_spin_changed, 0);
    gtk_spin_button_set_range(GTK_SPIN_BUTTON(se->fade_spin), 0, max_fade);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(se->fade_spin), fade);
    g_signal_handlers_unblock_by_func(  se->fade_spin,
                                        cb_fade_spin_changed,
                                        0);

    g_signal_handlers_block_by_func(se->xfade_spin,
                                    cb_xfade_spin_changed,
                                    0);

    gtk_spin_button_set_range(GTK_SPIN_BUTTON(se->xfade_spin), 0,
                                                            max_xfade);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(se->xfade_spin), xfade);
    g_signal_handlers_unblock_by_func(se->xfade_spin,
                                                cb_xfade_spin_changed, 0);
}
Ejemplo n.º 28
0
static void
pgd_render_slice_selector_setup (PgdRenderDemo *demo)
{
	PopplerPage *page;
	gdouble      width, height;

	page = poppler_document_get_page (demo->doc, demo->page);
	if (!page)
		return;

	poppler_page_get_size (page, &width, &height);
	
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (demo->slice_x), 0, width);
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (demo->slice_y), 0, height);
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (demo->slice_w), 0, width);
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (demo->slice_h), 0, height);

	gtk_spin_button_set_value (GTK_SPIN_BUTTON (demo->slice_x), 0);
	gtk_spin_button_set_value (GTK_SPIN_BUTTON (demo->slice_y), 0);
	gtk_spin_button_set_value (GTK_SPIN_BUTTON (demo->slice_w), width);
	gtk_spin_button_set_value (GTK_SPIN_BUTTON (demo->slice_h), height);

	g_object_unref (page);
}
Ejemplo n.º 29
0
static void up_down_converter_toggled_cb(GtkToggleButton *button, gpointer data)
{
	static gint rx_updn_hid, tx_updn_hid;
	static gdouble lo_min, lo_max;
	static void (*rx_lo_update_value)(struct iio_widget *, const char *, size_t);
	static void (*tx_lo_update_value)(struct iio_widget *, const char *, size_t);

	if (gtk_toggle_button_get_active(button)) {
		iio_spin_button_progress_deactivate(&rx_widgets[rx_lo]);
		iio_spin_button_progress_deactivate(&tx_widgets[tx_lo]);
		rx_updn_hid = g_signal_connect(rx_widgets[rx_lo].widget, "value-changed",
			G_CALLBACK(updn_converter_lo_freq_changed_cb), (gpointer)UPDN_RX);
		tx_updn_hid = g_signal_connect(tx_widgets[tx_lo].widget, "value-changed",
			G_CALLBACK(updn_converter_lo_freq_changed_cb), (gpointer)UPDN_TX);
		gtk_spin_button_get_range(GTK_SPIN_BUTTON(rx_widgets[rx_lo].widget), &lo_min, &lo_max);
		gtk_spin_button_set_range(GTK_SPIN_BUTTON(rx_widgets[rx_lo].widget), 1, 100);
		gtk_spin_button_set_range(GTK_SPIN_BUTTON(tx_widgets[tx_lo].widget), 1, 100);
		rx_lo_update_value = rx_widgets[rx_lo].update_value;
		tx_lo_update_value = tx_widgets[tx_lo].update_value;
		rx_widgets[rx_lo].update_value = NULL;
		tx_widgets[tx_lo].update_value = NULL;
	} else {
		g_signal_handler_disconnect(rx_widgets[rx_lo].widget, rx_updn_hid);
		g_signal_handler_disconnect(tx_widgets[tx_lo].widget, tx_updn_hid);
		rx_widgets[rx_lo].update_value = rx_lo_update_value;
		tx_widgets[tx_lo].update_value = tx_lo_update_value;
		iio_spin_button_progress_activate(&rx_widgets[rx_lo]);
		iio_spin_button_progress_activate(&tx_widgets[tx_lo]);
		g_signal_emit_by_name(rx_widgets[rx_lo].widget,
			"value-changed", NULL);
		g_signal_emit_by_name(tx_widgets[tx_lo].widget,
			"value-changed", NULL);
		gtk_spin_button_set_range(GTK_SPIN_BUTTON(rx_widgets[rx_lo].widget), lo_min, lo_max);
		gtk_spin_button_set_range(GTK_SPIN_BUTTON(tx_widgets[tx_lo].widget), lo_min, lo_max);
	}
}
Ejemplo n.º 30
0
static void
pgd_text_area_selector_setup (PgdTextDemo *demo)
{
        PopplerPage *page;
        gdouble      width, height;

        page = poppler_document_get_page (demo->doc, demo->page);
        if (!page)
                return;

        poppler_page_get_size (page, &width, &height);

        gtk_spin_button_set_range (GTK_SPIN_BUTTON (demo->area_x1), -10, width - 10);
        gtk_spin_button_set_range (GTK_SPIN_BUTTON (demo->area_y1), -10, height - 10);
        gtk_spin_button_set_range (GTK_SPIN_BUTTON (demo->area_x2), 0, width + 10);
        gtk_spin_button_set_range (GTK_SPIN_BUTTON (demo->area_y2), 0, height + 10);

        gtk_spin_button_set_value (GTK_SPIN_BUTTON (demo->area_x1), 0);
        gtk_spin_button_set_value (GTK_SPIN_BUTTON (demo->area_y1), 0);
        gtk_spin_button_set_value (GTK_SPIN_BUTTON (demo->area_x2), width);
        gtk_spin_button_set_value (GTK_SPIN_BUTTON (demo->area_y2), height);

        g_object_unref (page);
}