Exemplo n.º 1
0
void comp_gang_ma(int band)
{
    if (gang_ma[band])
    {
        gang_ma[band] = FALSE;
        /* gtk_widget_override_color ((GtkWidget *) lab_ma[band],
           GTK_STATE_FLAG_NORMAL,
                              get_color (TEXT_COLOR)); */
        prev_value_ma[band] = gtk_adjustment_get_value(adj_ma[band]);
    }
    else
    {
        gang_ma[band] = TRUE;
        /* gtk_widget_override_color ((GtkWidget *) lab_ma[band],
           GTK_STATE_FLAG_NORMAL,
                              get_color (GANG_HIGHLIGHT_COLOR)); */
    }
}
Exemplo n.º 2
0
static void
scroll_lines (WebKitWebView *web_view,
              int num_lines)
{
#ifdef HAVE_WEBKIT2
        /* TODO: Scroll API? */
#else
        GtkScrolledWindow *scrolled_window;
        GtkAdjustment *vadj;
        gdouble value;

        scrolled_window = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (web_view)));
        vadj = gtk_scrolled_window_get_vadjustment (scrolled_window);

        value = gtk_adjustment_get_value (vadj) + (num_lines * gtk_adjustment_get_step_increment (vadj));
        gtk_adjustment_set_value (vadj, value);
#endif
}
Exemplo n.º 3
0
static void
gimp_text_style_editor_baseline_changed (GtkAdjustment       *adjustment,
                                         GimpTextStyleEditor *editor)
{
  GtkTextBuffer *buffer = GTK_TEXT_BUFFER (editor->buffer);
  GtkTextIter    start, end;

  if (! gtk_text_buffer_get_selection_bounds (buffer, &start, &end))
    {
      gtk_text_buffer_get_iter_at_mark (buffer, &start,
                                        gtk_text_buffer_get_insert (buffer));
      gtk_text_buffer_get_end_iter (buffer, &end);
    }

  gimp_text_buffer_set_baseline (editor->buffer, &start, &end,
                                 gtk_adjustment_get_value (adjustment) *
                                 PANGO_SCALE);
}
Exemplo n.º 4
0
static void
uint_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
  GtkAdjustment *adj = GTK_ADJUSTMENT (data);
  GValue val = G_VALUE_INIT;

  g_value_init (&val, G_TYPE_UINT);
  get_property_value (object, pspec, &val);

  if (g_value_get_uint (&val) != (guint)gtk_adjustment_get_value (adj))
    {
      block_controller (G_OBJECT (adj));
      gtk_adjustment_set_value (adj, g_value_get_uint (&val));
      unblock_controller (G_OBJECT (adj));
    }

  g_value_unset (&val);
}
Exemplo n.º 5
0
void fm_tab_page_chdir(FmTabPage* page, FmPath* path, FmPath* select_path)
{
    g_return_if_fail(page);

    FmFolderView* fv = page->folder_view;

    FmPath * cwd = fm_tab_page_get_cwd(page);
    int scroll_pos;
    if(cwd && path && fm_path_equal(cwd, path))
    {
        if (select_path)
            fm_folder_view_select_file_path(fv, select_path);
        return;
    }
    scroll_pos = gtk_adjustment_get_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(page->folder_view)));
    fm_nav_history_chdir(page->nav_history, path, scroll_pos);
    fm_tab_page_chdir_without_history(page, path, select_path);
}
Exemplo n.º 6
0
/*
 * More or less a copy of gtk_tree_view_clamp_column_visible.
 */
static void
tree_view_clamp_column_visible (GtkTreeView       *tree_view,
				GtkTreeViewColumn *column)
{
	GtkAdjustment *hadjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (tree_view));
	double hval = gtk_adjustment_get_value (hadjustment);
	double hps = gtk_adjustment_get_page_size (hadjustment);
	GtkWidget *button = gtk_tree_view_column_get_button (column);
	GtkAllocation ba;

	gtk_widget_get_allocation (button, &ba);

	if (hval + hps < ba.x + ba.width)
		gtk_adjustment_set_value (hadjustment,
					  ba.x + ba.width - hps);
	else if (hval > ba.x)
		gtk_adjustment_set_value (hadjustment, ba.x);
}
Exemplo n.º 7
0
static GtkAdjustment *
scaled_adjustment (GtkAdjustment *a,
                   gdouble        scale)
{
  GtkAdjustment *as;

  as = gtk_adjustment_new (gtk_adjustment_get_value (a) * scale,
                           gtk_adjustment_get_lower (a) * scale,
                           gtk_adjustment_get_upper (a) * scale,
                           gtk_adjustment_get_step_increment (a) * scale,
                           gtk_adjustment_get_page_increment (a) * scale,
                           gtk_adjustment_get_page_size (a) * scale);

  g_signal_connect (a, "value-changed", G_CALLBACK (value_changed), as);
  g_signal_connect (as, "value-changed", G_CALLBACK (value_changed), a);

  return as;
}
Exemplo n.º 8
0
static void scale_value_changed(GtkAdjustment *adjustment,
                                     gpointer user_data)
{
    CtkImageSliders *ctk_image_sliders = CTK_IMAGE_SLIDERS(user_data);
    CtrlTarget *ctrl_target = ctk_image_sliders->ctrl_target;

    gint value;
    gint attribute;

    value = (gint) gtk_adjustment_get_value(adjustment);

    user_data = g_object_get_data(G_OBJECT(adjustment), "attribute");
    attribute = GPOINTER_TO_INT(user_data);

    NvCtrlSetAttribute(ctrl_target, attribute, (int) value);

    post_scale_value_changed(adjustment, ctk_image_sliders, value);

} /* scale_value_changed() */
Exemplo n.º 9
0
static void
height_changed_cb(GtkAdjustment *adj,
                  ScaleArgs *args)
{
    ScaleControls *controls;

    controls = g_object_get_data(G_OBJECT(adj), "controls");
    if (controls->in_update)
        return;

    controls->in_update = TRUE;
    args->yres = gtk_adjustment_get_value(adj);
    if (args->proportional) {
        args->ratio = (gdouble)args->yres/args->org_yres;
        args->xres = ROUND(args->ratio*args->org_xres);
    }
    scale_dialog_update(controls, args);
    controls->in_update = FALSE;
}
Exemplo n.º 10
0
Arquivo: view.c Projeto: mrirecon/view
extern gboolean fit_callback(GtkWidget *widget, gpointer data)
{
	struct view_s* v = data;

	double aniso = gtk_adjustment_get_value(v->gtk_aniso);

	GtkAllocation alloc;
	gtk_widget_get_allocation(v->gtk_viewport, &alloc);
	double xz = (double)(alloc.width - 5) / (double)v->dims[v->xdim];
	double yz = (double)(alloc.height - 5) / (double)v->dims[v->ydim];


	if (yz > xz / aniso)
		yz = xz / aniso; // aniso

	gtk_adjustment_set_value(v->gtk_zoom, yz);

	return FALSE;
}
Exemplo n.º 11
0
gboolean
scroll_horiz_cb(GtkAdjustment *adjust, void *w)
{
    (void) w;

    gdouble value = gtk_adjustment_get_value(adjust);
    gdouble min = gtk_adjustment_get_lower(adjust);
    gdouble max = gtk_adjustment_get_upper(adjust);
    gdouble page = gtk_adjustment_get_page_size(adjust);

    send_event (SCROLL_HORIZ, NULL,
        TYPE_FLOAT, value,
        TYPE_FLOAT, min,
        TYPE_FLOAT, max,
        TYPE_FLOAT, page,
        NULL);

    return (FALSE);
}
Exemplo n.º 12
0
static void
spin_value_changed (GtkAdjustment *adjustment, GtkWidget *label)
{
  GtkWidget *w;
  gint v;
  gchar *text;

  v = (int)gtk_adjustment_get_value (adjustment);

  if ((v % 3) == 0)
    {
      text = g_strdup_printf ("%d is a multiple of 3", v);
      gtk_label_set_label (GTK_LABEL (label), text);
      g_free (text);
    }

  w = gtk_widget_get_ancestor (label, GTK_TYPE_REVEALER);
  gtk_revealer_set_reveal_child (GTK_REVEALER (w), (v % 3) == 0);
}
Exemplo n.º 13
0
void Scale::onValueChanged(GtkAdjustment *w,gpointer data)
{
	gchar * text = NULL;
	Scale * scale =(Scale*)data;
	scale->mValue = gtk_adjustment_get_value(w);
	if(scale->mRetValue)
	{
		*(scale->mRetValue) = scale->mValue;
	}
	if(scale->mHex)
	{
		text = g_strdup_printf("%s%03X",scale->mPrefix,(int)scale->mValue);
	}
	else
	{
		text = g_strdup_printf("%s%03d",scale->mPrefix,(int)scale->mValue);
	}
	gtk_button_set_label(GTK_BUTTON(scale->mButton),text);
}
Exemplo n.º 14
0
static gboolean
chat_text_view_is_scrolled_down (EmpathyChatTextView *view)
{
	GtkAdjustment *vadj;
	gdouble value;
	gdouble upper;
	gdouble page_size;

	vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (view));
	value = gtk_adjustment_get_value (vadj);
	upper = gtk_adjustment_get_upper (vadj);
	page_size = gtk_adjustment_get_page_size (vadj);

	if (value < upper - page_size) {
		return FALSE;
	}

	return TRUE;
}
Exemplo n.º 15
0
static void
update_pulse_time (GtkAdjustment *adjustment, GtkWidget *widget)
{
  gdouble value;

  value = gtk_adjustment_get_value (adjustment);

  /* vary between 50 and 450 */
  pulse_time = 50 + 4 * value;

  if (value == 100 && pulse_id != 0)
    {
      g_source_remove (pulse_id);
      pulse_id = 0;
    }
  else if (value < 100 && pulse_id == 0)
    {
      pulse_id = g_timeout_add (pulse_time, (GSourceFunc)pulse_it, widget);
    }
}
Exemplo n.º 16
0
void ScrolledFileView::drawRightMargin(cairo_t *cr)
    {
    GtkTextView *textView = getTextView();
    GdkWindow *window = gtk_text_view_get_window(textView, GTK_TEXT_WINDOW_WIDGET);
    int textWindowHeight;
    gdk_window_get_geometry(window, NULL, NULL, NULL, &textWindowHeight);

    GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(
            gtk_widget_get_parent(GTK_WIDGET(textView)));
    GtkAdjustment *adjust = gtk_scrolled_window_get_hadjustment(scrolledWindow);
    int scrollAdjust = (int)gtk_adjustment_get_value(adjust);
//    cairo_text_extents_t extents;
//    cairo_text_extents(cr, "5555555555", &extents);

    cairo_set_source_rgb(cr, 128/255.0, 128/255.0, 128/255.0);
    cairo_rectangle(cr, (mLeftMargin.getMarginWidth() +
            (mLeftMargin.getPixPerChar() * 80)) - scrollAdjust,
            0, mLeftMargin.getMarginLineWidth(), textWindowHeight);
    cairo_fill(cr);
    }
/* called when a ServiceItem signals it is active or when
 * the active ServiceItem is removed from list*/
static void
_set_active_item (CarrickList *list, GtkWidget *item)
{
  CarrickListPrivate *priv = list->priv;

  if (priv->active_item)
    g_signal_handlers_disconnect_by_func (priv->active_item,
                                         active_item_alloc_cb,
                                         list);

  priv->active_item = item;
  if (priv->active_item)
    {
      priv->active_item_rel_pos = priv->active_item->allocation.y -
                                  gtk_adjustment_get_value (priv->adjustment);
      priv->active_item_height = priv->active_item->allocation.height;
      g_signal_connect (priv->active_item, "size-allocate",
                        G_CALLBACK (active_item_alloc_cb), list);
    }
}
Exemplo n.º 18
0
static void
gsr2_scroll_value_changed_cb (GtkAdjustment *adj, gpointer user_data)
{
    GNCSplitReg2 *gsr = user_data;
    GncTreeModelSplitReg *model;
    gchar *text;
    gint  trans_position;

    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);

    trans_position = gtk_adjustment_get_value (adj);

    text = gnc_tree_model_split_reg_get_tooltip (model, trans_position);

    g_object_set (gtk_widget_get_settings (gsr->scroll_bar), "gtk-tooltip-timeout", 2, NULL);

    gtk_widget_set_tooltip_text (gsr->scroll_bar, text);

    g_free (text);
}
Exemplo n.º 19
0
static gboolean
drag_motion_autoscroll_cb (gpointer user_data)
{
	GthBrowser    *browser = user_data;
	BrowserData   *data;
	GtkAdjustment *adj;
	double         max_value;
	double         value;

	data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);

	adj = gth_file_list_get_vadjustment (GTH_FILE_LIST (gth_browser_get_file_list (browser)));
	max_value = gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj);
	value = gtk_adjustment_get_value (adj) + data->scroll_diff;
	if (value > max_value)
		value = max_value;
	gtk_adjustment_set_value (adj, value);

	return TRUE;
}
Exemplo n.º 20
0
static void
gd_thumb_nav_adj_changed (GtkAdjustment *adj, gpointer user_data)
{
    GdThumbNav *nav;
    GdThumbNavPrivate *priv;
    gboolean ltr, right_sensitive;
    gdouble value, upper, page_size;

    nav = GD_THUMB_NAV (user_data);
    priv = GD_THUMB_NAV_GET_PRIVATE (nav);
    ltr = gtk_widget_get_direction (priv->sw) == GTK_TEXT_DIR_LTR;

    value = gtk_adjustment_get_value (adj);
    upper = gtk_adjustment_get_upper (adj);
    page_size = gtk_adjustment_get_page_size (adj);

    right_sensitive = (value < upper - page_size);
    gtk_widget_set_sensitive (ltr ? priv->button_right : priv->button_left,
                              right_sensitive);
}
Exemplo n.º 21
0
static void
poly_level_max_degree_changed(GtkObject *spin,
                              PolyLevelControls *controls)
{
    PolyLevelArgs *args;
    gdouble v;
    gint degree;

    if (controls->in_update)
        return;

    args = controls->args;
    v = gtk_adjustment_get_value(GTK_ADJUSTMENT(spin));
    degree = GWY_ROUND(v);
    if (degree == args->max_degree)
        return;

    args->max_degree = degree;
    poly_level_update_preview(controls, controls->args);
}
Exemplo n.º 22
0
static void adjustment_value_changed(GtkAdjustment *adjustment,
                                     gpointer user_data)
{
    CtkDisplayDeviceTv *ctk_display_device_tv =
        CTK_DISPLAY_DEVICE_TV(user_data);
    
    gint value;
    gint attribute;
    
    value = (gint) gtk_adjustment_get_value(adjustment);
    
    user_data = g_object_get_data(G_OBJECT(adjustment), "attribute");
    attribute = GPOINTER_TO_INT(user_data);

    NvCtrlSetAttribute(ctk_display_device_tv->handle,
                       attribute, (int) value);

    post_adjustment_value_changed(adjustment, ctk_display_device_tv, value);
    
} /* adjustment_value_changed() */
Exemplo n.º 23
0
static void
gimp_scale_entry_exp_adjustment_callback (GtkAdjustment *adjustment,
                                          GtkAdjustment *other_adj)
{
  gdouble value;

  g_signal_handlers_block_by_func (other_adj,
                                   gimp_scale_entry_log_adjustment_callback,
                                   adjustment);

  value = exp (gtk_adjustment_get_value (adjustment));
  if (gtk_adjustment_get_lower (other_adj) <= 0.0)
    value += gtk_adjustment_get_lower (other_adj) - 0.1;

  gtk_adjustment_set_value (other_adj, value);

  g_signal_handlers_unblock_by_func (other_adj,
                                     gimp_scale_entry_log_adjustment_callback,
                                     adjustment);
}
// Used when the print properties dialog is to be initialized but not displayed - like
// when the user clicks "Preview" before ever having used the dialog.  Also used for
// filling out the print_OP structure
void init_print_design_options (print_design_OP *pPrintOp, DESIGN *design)
  {
  int Nix ;

  if (NULL == print_properties.dlgPrintProps)
    {
    create_print_design_properties_dialog (&print_properties, pPrintOp) ;
    init_print_design_properties_dialog (&print_properties, NULL, pPrintOp, design) ;
    }

  qcad_print_dialog_get_options (QCAD_PRINT_DIALOG (print_properties.dlgPrintProps), &(pPrintOp->po)) ;

  // points per nanometer
  pPrintOp->dPointsPerNano = qcad_print_dialog_from_current_units (QCAD_PRINT_DIALOG (print_properties.dlgPrintProps),
    gtk_adjustment_get_value (GTK_ADJUSTMENT (print_properties.adjNanoToUnits))) ;

  g_free (pPrintOp->pbPrintedObjs) ;
  pPrintOp->icPrintedObjs = print_properties.icPrintedObjs ;
  pPrintOp->pbPrintedObjs = g_malloc0 (print_properties.icPrintedObjs * sizeof (gboolean)) ;

  // The various layers
  for (Nix = 0 ; Nix < print_properties.icPrintedObjs ; Nix++)
    pPrintOp->pbPrintedObjs[Nix] =
      gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print_properties.ppPrintedObjs[Nix])) ;

  // Print over than down ?
  pPrintOp->bPrintOrderOver = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print_properties.tbtnPrintOrder)) ;

  // Center on pages ?
  pPrintOp->bCenter = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print_properties.tbtnCenter)) ;

  // Number of horizontal pages - takes precedence over the scaling factor
  pPrintOp->iCXPages = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (print_properties.spnCXPages)) ;

  // Number of vertical pages - takes precedence over the scaling factor
  pPrintOp->iCYPages = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (print_properties.spnCYPages)) ;

  pPrintOp->bFit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print_properties.rbFitPages)) ;

  pPrintOp->bColour = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print_properties.chkColour)) ;
  }
Exemplo n.º 25
0
static void
copy_to_counterpart (app_t *app, GObject *object)
{
    static const char *xy_map[] =
    {
	"reconstruct_x_combo_box", "reconstruct_y_combo_box",
	"sample_x_combo_box",      "sample_y_combo_box",
	"scale_x_adjustment",      "scale_y_adjustment",
    };
    GObject *counterpart = NULL;
    int i;

    for (i = 0; i < G_N_ELEMENTS (xy_map); i += 2)
    {
	GObject *x = gtk_builder_get_object (app->builder, xy_map[i]);
	GObject *y = gtk_builder_get_object (app->builder, xy_map[i + 1]);

	if (object == x)
	    counterpart = y;
	if (object == y)
	    counterpart = x;
    }

    if (!counterpart)
	return;
    
    if (GTK_IS_COMBO_BOX (counterpart))
    {
	gtk_combo_box_set_active (
	    GTK_COMBO_BOX (counterpart),
	    gtk_combo_box_get_active (
		GTK_COMBO_BOX (object)));
    }
    else if (GTK_IS_ADJUSTMENT (counterpart))
    {
	gtk_adjustment_set_value (
	    GTK_ADJUSTMENT (counterpart),
	    gtk_adjustment_get_value (
		GTK_ADJUSTMENT (object)));
    }
}
Exemplo n.º 26
0
void calc_auto_gain(int i)
{
    if (adj_ma[i] && adj_th[i] && adj_ra[i])
    {
        ajami_state_set_value_no_history(ajami_get_state(), ajami_state_flags_COMP_MAKEUP(i),
                               (gtk_adjustment_get_value(adj_th[i]) /
                                gtk_adjustment_get_value(adj_ra[i]) -
                                gtk_adjustment_get_value(adj_th[i])) *
                               MUG_CORR_FACT);
        gtk_adjustment_set_value(adj_ma[i],
                                 gtk_adjustment_get_value(adj_th[i]) /
                                 gtk_adjustment_get_value(adj_ra[i]) -
                                 gtk_adjustment_get_value(adj_th[i]));
    }
}
Exemplo n.º 27
0
//================================================================
  int GUI_Slider_cb1 (void *parent, MemObj mo) {
//================================================================
/// GUI_Slider_cb           INTERNAL slider callback

  int          iEv=TYP_EventMove;
  double       d1;
  void         *pTab[2];
  Obj_gui2     *go;

  go = GUI_obj_pos (&mo);
  if(!go) return 0;
  if(!go->uFunc) return 0;

  d1 = gtk_adjustment_get_value  (GTK_ADJUSTMENT(parent));

  pTab[0] = &iEv;
  pTab[1] = &d1;

  go->uFunc (go, pTab);

}
Exemplo n.º 28
0
static void
entry_apply (GtkWidget      *entry,
             GtkColorEditor *editor)
{
  GdkRGBA color;
  gchar *text;

  if (!editor->priv->text_changed)
    return;

  text = gtk_editable_get_chars (GTK_EDITABLE (editor->priv->entry), 0, -1);
  if (gdk_rgba_parse (&color, text))
    {
      color.alpha = gtk_adjustment_get_value (editor->priv->a_adj);
      gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (editor), &color);
    }

  editor->priv->text_changed = FALSE;

  g_free (text);
}
Exemplo n.º 29
0
static void
height_changed(GtkAdjustment *adj,
               TipBlindControls *controls)
{
    TipBlindArgs *args;
    gdouble v;

    args = controls->args;
    v = gtk_adjustment_get_value(adj);
    args->yres = GWY_ROUND(v);
    if (controls->in_update)
        return;

    if (args->same_resolution) {
        controls->in_update = TRUE;
        gtk_adjustment_set_value(GTK_ADJUSTMENT(controls->xres), v);
        controls->in_update = FALSE;
    }

    tip_update(controls);
}
Exemplo n.º 30
0
/* scroll a bar in a given direction */
void
scroll(GtkAdjustment* bar, gchar *amount_str) {
    gchar *end;
    gdouble max_value;

    gdouble page_size = gtk_adjustment_get_page_size(bar);
    gdouble value = gtk_adjustment_get_value(bar);
    gdouble amount = g_ascii_strtod(amount_str, &end);

    if (*end == '%')
        value += page_size * amount * 0.01;
    else
        value += amount;

    max_value = gtk_adjustment_get_upper(bar) - page_size;

    if (value > max_value)
        value = max_value; /* don't scroll past the end of the page */

    gtk_adjustment_set_value (bar, value);
}