示例#1
0
/* Do scrollbar scaling based on current port drawing area size and
   |  overall PCB board size.
 */
void
ghid_port_ranges_scale (void)
{
  GtkAdjustment *adj;
  gdouble page_size;

  /* Update the scrollbars with PCB units.  So Scale the current
     |  drawing area size in pixels to PCB units and that will be
     |  the page size for the Gtk adjustment.
   */
  gport->view.width = gport->width * gport->view.coord_per_px;
  gport->view.height = gport->height * gport->view.coord_per_px;

  adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->h_range));
  page_size = MIN (gport->view.width, PCB->MaxWidth);
  gtk_adjustment_configure (adj,
                            gtk_adjustment_get_value (adj), /* value          */
                            -gport->view.width,             /* lower          */
                             PCB->MaxWidth + page_size,     /* upper          */
                             page_size / 100.0,             /* step_increment */
                             page_size / 10.0,              /* page_increment */
                             page_size);                    /* page_size      */

  adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->v_range));
  page_size = MIN (gport->view.height, PCB->MaxHeight);
  gtk_adjustment_configure (adj,
                            gtk_adjustment_get_value (adj), /* value          */
                            -gport->view.height,            /* lower          */
                            PCB->MaxHeight + page_size,     /* upper          */
                            page_size / 100.0,              /* step_increment */
                            page_size / 10.0,               /* page_increment */
                            page_size);                     /* page_size      */
}
static void updateAdjustmentFromScrollbar(GtkAdjustment* adjustment, Scrollbar* scrollbar)
{
    if (!adjustment)
        return;
    if (!scrollbar) {
        gtk_adjustment_configure(adjustment, 0, 0, 0, 0, 0, 0); // These are the settings which remove the scrollbar.
        return;
    }
    gtk_adjustment_configure(adjustment, scrollbar->value(), 0, scrollbar->totalSize(),
                             scrollbar->lineStep(), scrollbar->pageStep(), scrollbar->visibleSize());
}
示例#3
0
static void 
realprop_reset_widget(RealProperty *prop, WIDGET *widget)
{
  GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(widget));
  if (prop->common.descr->extra_data) {
    PropNumData *numdata = prop->common.descr->extra_data;
    gtk_adjustment_configure (adj, prop->real_data,
			      numdata->min, numdata->max,
			      numdata->step, 10.0 * numdata->step, 0);
  } else {
    gtk_adjustment_configure (adj, prop->real_data,
			      G_MINFLOAT, G_MAXFLOAT,
			      0.1, 1.0, 0);
  }
}
gboolean
headerbarui_update_seekbar_cb(gpointer user_data)
{
    if (seekbar_ismoving) return TRUE;
    DB_playItem_t *trk = deadbeef->streamer_get_playing_track ();
    if (!trk || deadbeef->pl_get_item_duration (trk) < 0) {
        if (trk) {
            deadbeef->pl_item_unref (trk);
        }
        headerbarui_reset_cb(NULL);
        return TRUE;
    }
    if (deadbeef->pl_get_item_duration (trk) > 0) {
        GtkAdjustment * adjustment = gtk_range_get_adjustment(GTK_RANGE (headerbar_seekbar));
        gtk_adjustment_configure(adjustment,
            deadbeef->streamer_get_playpos (), //value
            0, // lower
            deadbeef->pl_get_item_duration (trk), // upper
            1, // step_increment
            1, // page_increment
            0); // page_size
        gtk_scale_set_draw_value(GTK_SCALE(headerbar_seekbar), TRUE);
    }
    if (trk) {
        deadbeef->pl_item_unref (trk);
    }
    return TRUE;
}
/**
 * @brief Change time-adjustment used by \e GtkVlcPlayer
 *
 * The old adjustment will be
 * unreferenced (and possibly destroyed) and a reference to the new
 * adjustment will be fetched.
 *
 * @sa gtk_vlc_player_get_time_adjustment
 *
 * @param player \e GtkVlcPlayer instance
 * @param adj    New \e GtkAdjustment to use as time-adjustment.
 */
void
gtk_vlc_player_set_time_adjustment(GtkVlcPlayer *player, GtkAdjustment *adj)
{
	if (player->priv->time_adjustment == NULL)
		return;

	g_signal_handler_disconnect(G_OBJECT(player->priv->time_adjustment),
				    player->priv->time_adj_on_changed_id);
	g_signal_handler_disconnect(G_OBJECT(player->priv->time_adjustment),
				    player->priv->time_adj_on_value_changed_id);

	g_object_unref(player->priv->time_adjustment);
	player->priv->time_adjustment = GTK_OBJECT(adj);
	g_object_ref_sink(player->priv->time_adjustment);

	/*
	 * NOTE: not setting value and upper properly, as well as setting the
	 * page-size might cause problems if adjustment is set after loading/playing
	 * a media or setting it on other widgets
	 */
	gtk_adjustment_configure(GTK_ADJUSTMENT(player->priv->time_adjustment),
				 0., 0., 0.,
				 GTK_VLC_PLAYER_TIME_ADJ_STEP,
				 GTK_VLC_PLAYER_TIME_ADJ_PAGE,
				 0.);

	player->priv->time_adj_on_value_changed_id =
		g_signal_connect(G_OBJECT(player->priv->time_adjustment),
				 "value-changed",
				 G_CALLBACK(time_adj_on_value_changed), player);
	player->priv->time_adj_on_changed_id =
		g_signal_connect(G_OBJECT(player->priv->time_adjustment),
				 "changed",
				 G_CALLBACK(time_adj_on_changed), player);
}
示例#6
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkAdjustment_gtk_1adjustment_1configure
(
    JNIEnv* env,
    jclass cls,
    jlong _self,
    jdouble _value,
    jdouble _lower,
    jdouble _upper,
    jdouble _stepIncrement,
    jdouble _pageIncrement,
    jdouble _pageSize
)
{
    GtkAdjustment* self;
    gdouble value;
    gdouble lower;
    gdouble upper;
    gdouble stepIncrement;
    gdouble pageIncrement;
    gdouble pageSize;

    // convert parameter self
    self = (GtkAdjustment*) _self;

    // convert parameter value
    value = (gdouble) _value;

    // convert parameter lower
    lower = (gdouble) _lower;

    // convert parameter upper
    upper = (gdouble) _upper;

    // convert parameter stepIncrement
    stepIncrement = (gdouble) _stepIncrement;

    // convert parameter pageIncrement
    pageIncrement = (gdouble) _pageIncrement;

    // convert parameter pageSize
    pageSize = (gdouble) _pageSize;

    // call function
    gtk_adjustment_configure(self, value, lower, upper, stepIncrement, pageIncrement, pageSize);

    // cleanup parameter self

    // cleanup parameter value

    // cleanup parameter lower

    // cleanup parameter upper

    // cleanup parameter stepIncrement

    // cleanup parameter pageIncrement

    // cleanup parameter pageSize
}
示例#7
0
static gboolean
gimp_levels_tool_initialize (GimpTool     *tool,
                             GimpDisplay  *display,
                             GError      **error)
{
  GimpLevelsTool   *l_tool   = GIMP_LEVELS_TOOL (tool);
  GimpImage        *image    = gimp_display_get_image (display);
  GimpDrawable     *drawable = gimp_image_get_active_drawable (image);
  gdouble           scale_factor;
  gdouble           step_increment;
  gdouble           page_increment;
  gint              digits;

  if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
    {
      return FALSE;
    }

  gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
                                      levels_menu_sensitivity, drawable, NULL);

  gimp_drawable_calculate_histogram (drawable, l_tool->histogram);
  gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (l_tool->histogram_view),
                                     l_tool->histogram);

  if (gimp_drawable_get_component_type (drawable) == GIMP_COMPONENT_TYPE_U8)
    {
      scale_factor   = 255.0;
      step_increment = 1.0;
      page_increment = 8.0;
      digits         = 0;
    }
  else
    {
      scale_factor   = 100;
      step_increment = 0.01;
      page_increment = 1.0;
      digits         = 2;
    }

  gimp_prop_widget_set_factor (l_tool->low_input_spinbutton,
                               scale_factor, step_increment, page_increment,
                               digits);
  gimp_prop_widget_set_factor (l_tool->high_input_spinbutton,
                               scale_factor, step_increment, page_increment,
                               digits);
  gimp_prop_widget_set_factor (l_tool->low_output_spinbutton,
                               scale_factor, step_increment, page_increment,
                               digits);
  gimp_prop_widget_set_factor (l_tool->high_output_spinbutton,
                               scale_factor, step_increment, page_increment,
                               digits);

  gtk_adjustment_configure (l_tool->gamma_linear,
                            scale_factor / 2.0,
                            0, scale_factor, 0.1, 1.0, 0);

  return TRUE;
}
示例#8
0
文件: gui.c 项目: vincentdoba/LPlayer
/* When a folder is selected, use that as the new location of the other chooser. */
static void folder_changed (GtkFileChooser *chooser1, struct arguments *argument) {
    gchar *folder = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser1));
    GDir *dir = g_dir_open (folder, 0, NULL);
    FILE *list;
    list = fopen("list.txt", "w+");
    explore(dir, folder, list);
    float resnum = 0;
    char line[1000];
    int i;
    int count = 0, tmpcount;
    int rand;
    char *pline;

    rewind(list);
    for(; fgets(line, 1000, list) != NULL; ++count)
        ;

    tmpcount = count;

    while(resnum != 1 && tmpcount-- > 0) {
        free(current_sample_array);
        int rand = g_random_int_range(0, count);
        rewind(list);

        for(i = 0; i < rand; ++i)
            fgets(line, 1000, list);
        line[strcspn(line, "\n")] = '\0';

        resnum = analyze(line);
    }

    if (tmpcount > 0) {
        char artist[strlen(current_song.artist) + 9];
        char title[strlen(current_song.title) + 8];
        char album[strlen(current_song.album) + 8];
        strcpy(artist, "Artist: ");
        strcpy(title, "Title: ");
        strcpy(album, "Album: ");

        gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->label), "");
        gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->artist_label), strcat(artist, current_song.artist));
        gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->title_label), strcat(title, current_song.title));
        gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->album_label), strcat(album, current_song.album));

        gtk_adjustment_configure(((struct arguments*)argument)->adjust, 0, 0, current_song.duration, 1, 1, 1);
        ((struct arguments*)argument)->offset = 0;
        gtk_adjustment_changed(((struct arguments*)argument)->adjust);
    }
    else
        gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->label), "No calm songs found!");

}
static VALUE
rg_configure(VALUE self, VALUE value, VALUE lower, VALUE upper, VALUE step_increment, VALUE page_increment, VALUE page_size)
{
    gtk_adjustment_configure(_SELF(self),
                             NUM2DBL(value),
                             NUM2DBL(lower),
                             NUM2DBL(upper),
                             NUM2DBL(step_increment),
                             NUM2DBL(page_increment),
                             NUM2DBL(page_size));

    return self;
}
示例#10
0
文件: gui.c 项目: vincentdoba/LPlayer
static gboolean endless(gpointer argument) {
    float resnum = 0;
    FILE *file;
    char line[1000];
    int i;
    int count;
    int rand;
    char *pline;

    pline = line;

    file = fopen("list.txt", "r");

    for(; fgets(line, 1000, file) != NULL; ++count)
        ;

    while(resnum != 1) {
        free(current_sample_array);
        int rand = g_random_int_range(0, count);
        rewind(file);
        pline = line;
        for(i = 0; i < rand; ++i)
            fgets(line, 1000, file);

        for(; *pline != '\n'; ++pline)
            ;
        *pline = '\0';
        resnum = analyze(line);
    }

    char artist[strlen(current_song.artist) + 9];
    char title[strlen(current_song.title) + 8];
    char album[strlen(current_song.album) + 8];
    strcpy(artist, "Artist: ");
    strcpy(title, "Title: ");
    strcpy(album, "Album: ");

    gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->label), "");
    gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->artist_label), strcat(artist, current_song.artist));
    gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->title_label), strcat(title, current_song.title));
    gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->album_label), strcat(album, current_song.album));

    g_timer_reset(((struct arguments*)argument)->elapsed);
    ((struct arguments*)argument)->offset = 0;
    gtk_adjustment_configure(((struct arguments*)argument)->adjust, 0, 0, current_song.duration, 1, 1, 1);
    gtk_adjustment_changed(((struct arguments*)argument)->adjust);

    if(--((struct arguments*)argument)->continue_count != 0) {
        play(NULL, argument);
    }
}
示例#11
0
static int gtkCanvasSetDYAttrib(Ihandle* ih, const char *value)
{
  if (ih->data->sb & IUP_SB_VERT)
  {
    double ymin, ymax, liney;
    float dy;
    int value_changed;
    GtkAdjustment* sb_vert = gtk_scrolled_window_get_vadjustment(gtkCanvasGetScrolledWindow(ih));
    if (!sb_vert) return 1;

    if (!iupStrToFloat(value, &dy))
      return 1;

    ymin = iupAttribGetFloat(ih, "YMIN");
    ymax = iupAttribGetFloat(ih, "YMAX");

    if (!iupAttribGet(ih,"LINEY"))
    {
      liney = dy/10;
      if (liney==0)
        liney = 1;
    }
    else
      liney = iupAttribGetFloat(ih,"LINEY");

#if GTK_CHECK_VERSION(2, 14, 0)
    {
      double page_size = dy;
      double dvalue = gtk_adjustment_get_value(sb_vert);
      value_changed = gtkCanvasCheckScroll(ymin, ymax, &page_size, &dvalue);
      gtk_adjustment_configure(sb_vert, dvalue, ymin, ymax, liney, page_size, dy);
    }
#else
    sb_vert->lower = ymin;
    sb_vert->upper = ymax;
    sb_vert->step_increment = liney;
    sb_vert->page_size = dy;

    value_changed = gtkCanvasCheckScroll(ymin, ymax, &sb_vert->page_size, &sb_vert->value);
    sb_vert->page_increment = sb_vert->page_size;

    gtk_adjustment_changed(sb_vert);
#endif

    if (value_changed)
      gtk_adjustment_value_changed(sb_vert);
  }
  return 1;
}
示例#12
0
static int gtkCanvasSetDXAttrib(Ihandle* ih, const char *value)
{
  if (ih->data->sb & IUP_SB_HORIZ)
  {
    double xmin, xmax, linex;
    float dx;
    int value_changed;
    GtkAdjustment* sb_horiz = gtk_scrolled_window_get_hadjustment(gtkCanvasGetScrolledWindow(ih));
    if (!sb_horiz) return 1;

    if (!iupStrToFloat(value, &dx))
      return 1;

    xmin = iupAttribGetFloat(ih, "XMIN");
    xmax = iupAttribGetFloat(ih, "XMAX");

    if (!iupAttribGet(ih,"LINEX"))
    {
      linex = dx/10;
      if (linex==0)
        linex = 1;
    }
    else
      linex = iupAttribGetFloat(ih,"LINEX");

#if GTK_CHECK_VERSION(2, 14, 0)
    {
      double page_size = dx;
      double dvalue = gtk_adjustment_get_value(sb_horiz);
      value_changed = gtkCanvasCheckScroll(xmin, xmax, &page_size, &dvalue);
      gtk_adjustment_configure(sb_horiz, dvalue, xmin, xmax, linex, page_size, dx);
    }
#else
    sb_horiz->lower = xmin;
    sb_horiz->upper = xmax;
    sb_horiz->step_increment = linex;
    sb_horiz->page_size = dx;

    value_changed = gtkCanvasCheckScroll(xmin, xmax, &sb_horiz->page_size, &sb_horiz->value);
    sb_horiz->page_increment = sb_horiz->page_size;

    gtk_adjustment_changed(sb_horiz);
#endif

    if (value_changed)
      gtk_adjustment_value_changed(sb_horiz);
  }
  return 1;
}
gboolean
headerbarui_reset_cb(gpointer user_data)
{
    GtkAdjustment * adjustment = gtk_range_get_adjustment(GTK_RANGE (headerbar_seekbar));
    gtk_adjustment_configure(adjustment,
    deadbeef->streamer_get_playpos (), //value
    0, // lower
    0, // upper
    0, // step_increment
    0, // page_increment
    0); // page_size
    gtk_range_set_value(GTK_RANGE (headerbar_seekbar), 0);
    gtk_scale_set_draw_value(GTK_SCALE(headerbar_seekbar), FALSE);
    return FALSE;
}
static void
gimp_scrolled_preview_hscr_update (GimpScrolledPreview *preview)
{
  GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (preview->hscr));
  gint           width;

  width = GIMP_PREVIEW (preview)->xmax - GIMP_PREVIEW (preview)->xmin;

  gtk_adjustment_configure (adj,
                            gtk_adjustment_get_value (adj),
                            0, width,
                            1.0,
                            MAX (GIMP_PREVIEW (preview)->width / 2.0, 1.0),
                            GIMP_PREVIEW (preview)->width);
}
示例#15
0
/**
 * gwy_adjustment_new_set: (constructor)
 * @value: Initial value.
 * @defaultval: Default value.
 * @lower: Minimum value.
 * @upper: Maximum value.
 * @step_increment: Step increment.
 * @page_increment: Page increment.
 *
 * Creates a new adjustable bounded value with given ranges and value.
 *
 * Returns: A newly created adjustment.
 **/
GwyAdjustment*
gwy_adjustment_new_set(gdouble value,
                       gdouble defaultval,
                       gdouble lower,
                       gdouble upper,
                       gdouble step_increment,
                       gdouble page_increment)
{
    GwyAdjustment *adj = gwy_adjustment_new();
    gtk_adjustment_configure(GTK_ADJUSTMENT(adj),
                             value, lower, upper,
                             step_increment, page_increment, 0.0);
    adj->priv->defaultval = defaultval;
    return adj;
}
static void
gimp_scrolled_preview_vscr_update (GimpScrolledPreview *preview)
{
  GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (preview->vscr));
  gint           height;

  height = GIMP_PREVIEW (preview)->ymax - GIMP_PREVIEW (preview)->ymin;

  gtk_adjustment_configure (adj,
                            gtk_adjustment_get_value (adj),
                            0, height,
                            1.0,
                            MAX (GIMP_PREVIEW (preview)->height / 2.0, 1.0),
                            GIMP_PREVIEW (preview)->height);
}
static void
rcm_spinbutton_to_radians_over_PI (GtkWidget *button,
				   float      value,
				   GtkWidget *label)
{
  GtkAdjustment *adj;

  adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (button));

  gtk_adjustment_configure (adj,
                            value * rcm_units_factor (Current.Units),
                            gtk_adjustment_get_lower (adj), 2.0,
                            0.0001, 0.001,
                            gtk_adjustment_get_page_size (adj));

  gtk_spin_button_set_digits (GTK_SPIN_BUTTON (button), 4);

  gtk_label_set_text (GTK_LABEL (label), rcm_units_string (Current.Units));
}
示例#18
0
文件: gui.c 项目: vincentdoba/LPlayer
static void file_changed (GtkFileChooser *chooser2, struct arguments *argument) {
    int resnum = 0;
    gchar *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser2));

    resnum = analyze(filename);
    gtk_adjustment_configure(argument->adjust, 0, 0, current_song.duration, 1, 1, 1);
    gtk_adjustment_changed(argument->adjust);

    if(resnum == 2) {
        gtk_label_set_text ((GtkLabel*)argument->label, "Can't Conclude");
        gtk_label_set_text((GtkLabel*)argument->artist_label, current_song.artist);
        gtk_label_set_text((GtkLabel*)argument->title_label, current_song.title);
        gtk_label_set_text((GtkLabel*)argument->album_label, current_song.album);

    }
    else if(resnum == 0) {
        gtk_label_set_text ((GtkLabel*)argument->label, "Much loud");
        gtk_label_set_text((GtkLabel*)argument->artist_label, current_song.artist);
        gtk_label_set_text((GtkLabel*)argument->title_label, current_song.title);
        gtk_label_set_text((GtkLabel*)argument->album_label, current_song.album);

    }
    else if(resnum == 1) {
        gtk_label_set_text((GtkLabel*)argument->artist_label, current_song.artist);
        gtk_label_set_text((GtkLabel*)argument->title_label, current_song.title);
        gtk_label_set_text((GtkLabel*)argument->album_label, current_song.album);
        gtk_label_set_text ((GtkLabel*)argument->label, "Such calm");

    }
    char artist[strlen(current_song.artist) + 9];
    char title[strlen(current_song.title) + 8];
    char album[strlen(current_song.album) + 8];
    strcpy(artist, "Artist: ");
    strcpy(title, "Title: ");
    strcpy(album, "Album: ");

    gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->artist_label), strcat(artist, current_song.artist));
    gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->title_label), strcat(title, current_song.title));
    gtk_label_set_text((GtkLabel*)(((struct arguments*)argument)->album_label), strcat(album, current_song.album));

}
示例#19
0
void gx_selector_set_model(GxSelector *selector, GtkTreeModel *model)
{
	g_return_if_fail(GX_IS_SELECTOR(selector));
	g_return_if_fail(model == NULL || GTK_IS_TREE_MODEL (model));
	GxSelectorPrivate *priv = selector->priv;
	if (model == selector->model)
		return;
	gx_selector_unset_model(selector);
	int n = 0;
	if (model != NULL) {
		selector->model = model;
		g_object_ref (selector->model);
		n = gtk_tree_model_iter_n_children(model, NULL) - 1;
		if (n < 0) {
			n = 0;
		}
	}
	gtk_adjustment_configure(gtk_range_get_adjustment(GTK_RANGE(selector)), 0.0, 0.0, n, 1.0, 1.0, 0.0);
	priv->req_ok = FALSE;
	gtk_widget_queue_resize(GTK_WIDGET(selector));
	g_object_notify(G_OBJECT(selector), "model");
}
void ScrollView::setHorizontalAdjustment(GtkAdjustment* hadj, bool resetValues)
{
    ASSERT(!parent() || !hadj);
    if (parent())
        return;

    m_horizontalAdjustment = hadj;

    if (!m_horizontalAdjustment) {
        MainFrameScrollbarGtk* hScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(horizontalScrollbar());
        if (hScrollbar)
            hScrollbar->detachAdjustment();

        return;
    }

    // We may be lacking scrollbars when returning to a cached
    // page, this kicks the page to recreate the scrollbars.
    setHasHorizontalScrollbar(true);

    MainFrameScrollbarGtk* hScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(horizontalScrollbar());
    hScrollbar->attachAdjustment(m_horizontalAdjustment.get());

    // We used to reset everything to 0 here, but when page cache
    // is enabled we reuse FrameViews that are cached. Since their
    // size is not going to change when being restored, (which is
    // what would cause the upper limit in the adjusments to be
    // set in the normal case), we make sure they are up-to-date
    // here. This is needed for the parent scrolling widget to be
    // able to report correct values.
    int horizontalPageStep = max(max<int>(frameRect().width() * Scrollbar::minFractionToStepWhenPaging(), frameRect().width() - Scrollbar::maxOverlapBetweenPages()), 1);
    gtk_adjustment_configure(m_horizontalAdjustment.get(),
                             resetValues ? 0 : scrollOffset().width(), 0,
                             resetValues ? 0 : contentsSize().width(),
                             resetValues ? 0 : Scrollbar::pixelsPerLineStep(),
                             resetValues ? 0 : horizontalPageStep,
                             resetValues ? 0 : frameRect().width());
}
void AP_UnixFrameImpl::_setScrollRange(apufi_ScrollType scrollType, int iValue, gfloat fUpperLimit, gfloat fSize)
{
	GtkAdjustment *pScrollAdjustment = (scrollType == apufi_scrollX) ? m_pHadj : m_pVadj;
	GtkWidget *wScrollWidget = (scrollType == apufi_scrollX) ? m_hScroll : m_vScroll;
	UT_DEBUGMSG(("Scroll Adjustment set to %d upper %f size %f\n",iValue, fUpperLimit, fSize));
	GR_Graphics * pGr = getFrame()->getCurrentView()->getGraphics ();
	XAP_Frame::tZoomType tZoom = getFrame()->getZoomType();
	if(pScrollAdjustment) //this isn't guaranteed in AbiCommand
	{
#if GTK_CHECK_VERSION(2,14,0)
		gtk_adjustment_configure(pScrollAdjustment, iValue, 0.0, fUpperLimit,
                                 pGr->tluD(20.0), fSize, fSize);
#else
		pScrollAdjustment->value = iValue;
		pScrollAdjustment->lower = 0.0;
		pScrollAdjustment->upper = fUpperLimit;
		pScrollAdjustment->step_increment = pGr->tluD(20.0);
		pScrollAdjustment->page_increment = fSize;
		pScrollAdjustment->page_size = fSize;
		g_signal_emit_by_name(G_OBJECT(pScrollAdjustment), "changed");
#endif
	}

	// hide the horizontal scrollbar if the scroll range is such that the window can contain it all
	// show it otherwise
// Hide the horizontal scrollbar if we've set to page width or fit to page.
// This stops a resizing race condition.
//
 	if ((m_hScroll == wScrollWidget) && ((fUpperLimit <= fSize) ||(  tZoom == XAP_Frame::z_PAGEWIDTH) || (tZoom == XAP_Frame::z_WHOLEPAGE)))
	{
 		gtk_widget_hide(wScrollWidget);
	}
 	else if((wScrollWidget != m_vScroll) || !getFrame()->isMenuScrollHidden())
	{
 		gtk_widget_show(wScrollWidget);
	}
}
/**
 * @brief Change volume-adjustment used by \e GtkVlcPlayer
 *
 * The old adjustment will be unreferenced (and possibly destroyed) and a
 * reference to the new adjustment will be fetched.
 *
 * @sa gtk_vlc_player_get_volume_adjustment
 *
 * @param player \e GtkVlcPlayer instance
 * @param adj    New \e GtkAdjustment to use as volume-adjustment.
 */
void
gtk_vlc_player_set_volume_adjustment(GtkVlcPlayer *player, GtkAdjustment *adj)
{
	if (player->priv->volume_adjustment == NULL)
		return;

	g_signal_handler_disconnect(G_OBJECT(player->priv->volume_adjustment),
				    player->priv->vol_adj_on_value_changed_id);

	g_object_unref(player->priv->volume_adjustment);
	player->priv->volume_adjustment = GTK_OBJECT(adj);
	g_object_ref_sink(player->priv->volume_adjustment);

	gtk_adjustment_configure(GTK_ADJUSTMENT(player->priv->volume_adjustment),
				 1., 0., 1.,
				 GTK_VLC_PLAYER_VOL_ADJ_STEP,
				 GTK_VLC_PLAYER_VOL_ADJ_PAGE,
				 0.);

	player->priv->vol_adj_on_value_changed_id =
		g_signal_connect(G_OBJECT(player->priv->volume_adjustment),
				 "value-changed",
				 G_CALLBACK(vol_adj_on_value_changed), player);
}
示例#23
0
static int gtkCanvasSetDYAttrib(Ihandle* ih, const char *value)
{
  if (ih->data->sb & IUP_SB_VERT)
  {
    double ymin, ymax, liney;
    float dy;
    int value_changed;
    GtkAdjustment* sb_vert_adjust;
    GtkWidget* sb_vert = (GtkWidget*)iupAttribGet(ih, "_IUPGTK_SBVERT");
    if (!sb_vert) return 1;

    if (!iupStrToFloat(value, &dy))
      return 1;

    ymin = iupAttribGetFloat(ih, "YMIN");
    ymax = iupAttribGetFloat(ih, "YMAX");

    if (!iupAttribGet(ih,"LINEY"))
    {
      liney = dy/10;
      if (liney==0)
        liney = 1;
    }
    else
      liney = iupAttribGetFloat(ih,"LINEY");

    sb_vert_adjust = gtk_range_get_adjustment(GTK_RANGE(sb_vert));

    if (dy >= (ymax-ymin))
    {
      if (iupAttribGetBoolean(ih, "YAUTOHIDE"))
      {
        if (iupgtkIsVisible(sb_vert))
        {
          gtk_widget_hide(sb_vert);
          gtkCanvasUpdateChildLayout(ih);
        }
      }
      else
        gtk_widget_set_sensitive(sb_vert, FALSE);

      ih->data->posy = (float)ymin;
      gtkCanvasAdjustmentSetValue(ih, sb_vert_adjust, ymin);
      return 1;
    }
    else
    {
      if (!iupgtkIsVisible(sb_vert))
      {
        gtk_widget_show(sb_vert);
        gtkCanvasUpdateChildLayout(ih);
      }
      gtk_widget_set_sensitive(sb_vert, TRUE);
    }

#if GTK_CHECK_VERSION(2, 14, 0)
    {
      double page_size = dy;
      double dvalue = gtk_adjustment_get_value(sb_vert_adjust);
      value_changed = gtkCanvasCheckScroll(ymin, ymax, &page_size, &dvalue);
      gtk_adjustment_configure(sb_vert_adjust, dvalue, ymin, ymax, liney, page_size, dy);
    }
#else
    {
      sb_vert_adjust->lower = ymin;
      sb_vert_adjust->upper = ymax;
      sb_vert_adjust->step_increment = liney;
      sb_vert_adjust->page_size = dy;

      value_changed = gtkCanvasCheckScroll(ymin, ymax, &sb_vert_adjust->page_size, &sb_vert_adjust->value);
      sb_vert_adjust->page_increment = sb_vert_adjust->page_size;

      gtk_adjustment_changed(sb_vert_adjust);
    }
#endif

    if (value_changed)
      gtk_adjustment_value_changed(sb_vert_adjust);
  }
  return 1;
}
示例#24
0
static int gtkCanvasSetDXAttrib(Ihandle* ih, const char *value)
{
  if (ih->data->sb & IUP_SB_HORIZ)
  {
    double xmin, xmax, linex;
    float dx;
    int value_changed;
    GtkAdjustment* sb_horiz_adjust;
    GtkWidget* sb_horiz = (GtkWidget*)iupAttribGet(ih, "_IUPGTK_SBHORIZ");
    if (!sb_horiz) return 1;

    if (!iupStrToFloat(value, &dx))
      return 1;

    xmin = iupAttribGetFloat(ih, "XMIN");
    xmax = iupAttribGetFloat(ih, "XMAX");

    if (!iupAttribGet(ih,"LINEX"))
    {
      linex = dx/10;
      if (linex==0)
        linex = 1;
    }
    else
      linex = iupAttribGetFloat(ih,"LINEX");

    sb_horiz_adjust = gtk_range_get_adjustment(GTK_RANGE(sb_horiz));

    if (dx >= (xmax-xmin))
    {
      if (iupAttribGetBoolean(ih, "XAUTOHIDE"))
      {
        if (iupgtkIsVisible(sb_horiz))
        {
          gtk_widget_hide(sb_horiz);
          gtkCanvasUpdateChildLayout(ih);
        }
      }
      else
        gtk_widget_set_sensitive(sb_horiz, FALSE);

      ih->data->posx = (float)xmin;
      gtkCanvasAdjustmentSetValue(ih, sb_horiz_adjust, xmin);
      return 1;
    }
    else
    {
      if (!iupgtkIsVisible(sb_horiz))
      {
        gtk_widget_show(sb_horiz);
        gtkCanvasUpdateChildLayout(ih);
      }
      gtk_widget_set_sensitive(sb_horiz, TRUE);
    }

#if GTK_CHECK_VERSION(2, 14, 0)
    {
      double page_size = dx;
      double dvalue = gtk_adjustment_get_value(sb_horiz_adjust);
      value_changed = gtkCanvasCheckScroll(xmin, xmax, &page_size, &dvalue);
      gtk_adjustment_configure(sb_horiz_adjust, dvalue, xmin, xmax, linex, page_size, dx);
    }
#else
    {
      sb_horiz_adjust->lower = xmin;
      sb_horiz_adjust->upper = xmax;
      sb_horiz_adjust->step_increment = linex;
      sb_horiz_adjust->page_size = dx;

      value_changed = gtkCanvasCheckScroll(xmin, xmax, &sb_horiz_adjust->page_size, &sb_horiz_adjust->value);
      sb_horiz_adjust->page_increment = sb_horiz_adjust->page_size;

      gtk_adjustment_changed(sb_horiz_adjust);
    }
#endif

    if (value_changed)
      gtk_adjustment_value_changed(sb_horiz_adjust);
  }
  return 1;
}
示例#25
0
/**
 * gwy_adjustment_new_for_property:
 * @object: (transfer none):
 *          An object.
 * @propname: Name of property to create adjustment for.  The property must be
 *            of integral or double type.
 *
 * Creates a new adjustment with ranges, default and current value given by
 * the property of an object.
 *
 * Changes to the property value are reflected by changes in the adjustment
 * value and vice versa.  The adjustment does not take a reference to @object.
 * If @object ceases to exist before the adjustment does the adjustment will
 * remain configured the same way, just the value will not be synchronised with
 * anything.
 *
 * You can limit the adjustment range further than what is permitted by the
 * property after the construction.  Extending it is not allowed.
 *
 * Returns: A newly created adjustment.
 **/
GwyAdjustment*
gwy_adjustment_new_for_property(GObject *object,
                                const gchar *propname)
{
    GwyAdjustment *adj = gwy_adjustment_new();
    g_return_val_if_fail(G_IS_OBJECT(object), adj);
    Adjustment *priv = adj->priv;

    g_return_val_if_fail(propname, adj);
    GObjectClass *klass = G_OBJECT_GET_CLASS(object);
    GParamSpec *property = g_object_class_find_property(klass, propname);
    g_return_val_if_fail(property, adj);

    gdouble lower, upper, defaultval;
    gboolean is_integral = TRUE;

    // Try the types by descending probability.
    if (G_IS_PARAM_SPEC_DOUBLE(property)) {
        GParamSpecDouble *pspec = G_PARAM_SPEC_DOUBLE(property);
        lower = pspec->minimum;
        upper = pspec->maximum;
        defaultval = pspec->default_value;
        is_integral = FALSE;
    }
    else if (G_IS_PARAM_SPEC_UINT(property)) {
        GParamSpecUInt *pspec = G_PARAM_SPEC_UINT(property);
        lower = pspec->minimum;
        upper = pspec->maximum;
        defaultval = pspec->default_value;
    }
    else if (G_IS_PARAM_SPEC_INT(property)) {
        GParamSpecInt *pspec = G_PARAM_SPEC_INT(property);
        lower = pspec->minimum;
        upper = pspec->maximum;
        defaultval = pspec->default_value;
    }
    else if (G_IS_PARAM_SPEC_LONG(property)) {
        GParamSpecLong *pspec = G_PARAM_SPEC_LONG(property);
        lower = pspec->minimum;
        upper = pspec->maximum;
        defaultval = pspec->default_value;
    }
    else if (G_IS_PARAM_SPEC_ULONG(property)) {
        GParamSpecULong *pspec = G_PARAM_SPEC_ULONG(property);
        lower = pspec->minimum;
        upper = pspec->maximum;
        defaultval = pspec->default_value;
    }
    else if (G_IS_PARAM_SPEC_FLOAT(property)) {
        GParamSpecFloat *pspec = G_PARAM_SPEC_FLOAT(property);
        lower = pspec->minimum;
        upper = pspec->maximum;
        defaultval = pspec->default_value;
        is_integral = FALSE;
    }
    else {
        g_critical("Cannot create adjustment for value type %s.",
                   g_type_name(property->value_type));
        return adj;
    }

    // Construct a harmless value for the gtk_adjustment_configure() call.
    gdouble step_increment, page_increment, value;
    // XXX: This needs more elaboration.
    if (is_integral) {
        value = gwy_round(0.5*(lower + upper));
        step_increment = 1.0;
        page_increment = MIN(upper - lower, 10.0);
    }
    else {
        value = 0.5*(lower + upper);
        step_increment = MAX((upper - lower)/100000.0, fabs(lower));
        step_increment = gwy_powi(10.0, gwy_round(log10(step_increment)));
        page_increment = sqrt(step_increment*(upper - lower));
        page_increment = gwy_powi(10.0, gwy_round(log10(page_increment)));
    }

    gtk_adjustment_configure(GTK_ADJUSTMENT(adj),
                             value, lower, upper,
                             step_increment, page_increment, 0.0);
    priv->defaultval = defaultval;
    // This takes care of value synchronisation from the property to us.
    priv->binding = g_object_bind_property(object, propname,
                                           adj, "value",
                                           G_BINDING_BIDIRECTIONAL
                                           | G_BINDING_SYNC_CREATE);
    g_object_add_weak_pointer(G_OBJECT(priv->binding),
                              (gpointer*)&priv->binding);

    return adj;
}
示例#26
0
static gint
moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget,
                              GdkDrawable* drawable, GdkRectangle* rect,
                              GdkRectangle* cliprect, GtkWidgetState* state,
                              GtkTextDirection direction)
{
    GtkStateType state_type = (state->inHover || state->active) ?
        GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
    GtkShadowType shadow_type = GTK_SHADOW_OUT;
    GtkStyle* style;
    GtkScrollbar *scrollbar;
    GtkAdjustment *adj;
    gboolean activate_slider;

    ensure_scrollbar_widget();

    if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL)
        scrollbar = GTK_SCROLLBAR(gParts->horizScrollbarWidget);
    else
        scrollbar = GTK_SCROLLBAR(gParts->vertScrollbarWidget);

    gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);

    /* Make sure to set the scrollbar range before painting so that
       everything is drawn properly.  At least the bluecurve (and
       maybe other) themes don't draw the top or bottom black line
       surrounding the scrollbar if the theme thinks that it's butted
       up against the scrollbar arrows.  Note the increases of the
       clip rect below. */
    /* Changing the cliprect is pretty bogus. This lets themes draw
       outside the frame, which means we don't invalidate them
       correctly. See bug 297508. But some themes do seem to need
       it. So we modify the frame's overflow area to account for what
       we're doing here; see nsNativeThemeGTK::GetWidgetOverflow. */
    adj = gtk_range_get_adjustment(GTK_RANGE(scrollbar));

    if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) {
        cliprect->x -= 1;
        cliprect->width += 2;
        gtk_adjustment_set_page_size(adj, rect->width);
    }
    else {
        cliprect->y -= 1;
        cliprect->height += 2;
        gtk_adjustment_set_page_size(adj, rect->height);
    }

#if GTK_CHECK_VERSION(2, 14, 0)
    gtk_adjustment_configure(adj,
                             state->curpos,
                             0,
                             state->maxpos,
                             gtk_adjustment_get_step_increment(adj),
                             gtk_adjustment_get_page_increment(adj),
                             gtk_adjustment_get_page_size(adj));
#else
    adj->lower = 0;
    adj->value = state->curpos;
    adj->upper = state->maxpos;
    gtk_adjustment_changed(adj);
#endif

    style = gtk_widget_get_style(GTK_WIDGET(scrollbar));
    
    gtk_widget_style_get(GTK_WIDGET(scrollbar), "activate-slider",
                         &activate_slider, NULL);
    
    if (activate_slider && state->active) {
        shadow_type = GTK_SHADOW_IN;
        state_type = GTK_STATE_ACTIVE;
    }

    TSOffsetStyleGCs(style, rect->x, rect->y);

    gtk_paint_slider(style, drawable, state_type, shadow_type, cliprect,
                     GTK_WIDGET(scrollbar), "slider", rect->x, rect->y,
                     rect->width,  rect->height,
                     (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ?
                     GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);

    return MOZ_GTK_SUCCESS;
}
示例#27
0
void
procdialog_create_renice_dialog (GsmApplication *app)
{
    ProcInfo *info;

    GtkLabel *label;
    GtkLabel *priority_label;
    GtkAdjustment *renice_adj;
    GtkBuilder *builder;
    gchar     *text;
    gchar     *dialog_title;

    if (renice_dialog)
        return;

    gtk_tree_selection_selected_foreach (app->selection, get_last_selected,
                                         &info);
    gint selected_count = gtk_tree_selection_count_selected_rows (app->selection);
    if (!info)
        return;

    builder = gtk_builder_new();
    gtk_builder_add_from_resource (builder, "/org/gnome/gnome-system-monitor/data/renice.ui", NULL);

    renice_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "renice_dialog"));
    if ( selected_count == 1 ) {
        dialog_title = g_strdup_printf (_("Change Priority of Process “%s” (PID: %u)"),
                                        info->name, info->pid);
    } else {
        dialog_title = g_strdup_printf (ngettext("Change Priority of the selected process", "Change Priority of %d selected processes", selected_count),
                                        selected_count);
    }

    gtk_window_set_title (GTK_WINDOW(renice_dialog), dialog_title);

    g_free (dialog_title);

    gtk_dialog_set_default_response (GTK_DIALOG (renice_dialog), 100);
    new_nice_value = -100;

    renice_adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "renice_adj"));
    gtk_adjustment_configure( GTK_ADJUSTMENT(renice_adj), info->nice, RENICE_VAL_MIN, RENICE_VAL_MAX, 1, 1, 0);

    new_nice_value = 0;

    priority_label =  GTK_LABEL (gtk_builder_get_object (builder, "priority_label"));
    gtk_label_set_label (priority_label, procman::get_nice_level_with_priority (info->nice));

    text = g_strconcat("<small><i><b>", _("Note:"), "</b> ",
                       _("The priority of a process is given by its nice value. A lower nice value corresponds to a higher priority."),
                       "</i></small>", NULL);
    label = GTK_LABEL (gtk_builder_get_object (builder, "note_label"));
    gtk_label_set_label (label, _(text));
    gtk_label_set_line_wrap (label, TRUE);
    g_free (text);

    g_signal_connect (G_OBJECT (renice_dialog), "response",
                      G_CALLBACK (renice_dialog_button_pressed), app);
    g_signal_connect (G_OBJECT (renice_adj), "value_changed",
                      G_CALLBACK (renice_scale_changed), priority_label);

    gtk_window_set_transient_for (GTK_WINDOW (renice_dialog), GTK_WINDOW (GsmApplication::get()->main_window));
    gtk_widget_show_all (GTK_WIDGET (renice_dialog));

    gtk_builder_connect_signals (builder, NULL);

    g_object_unref (G_OBJECT (builder));
}
示例#28
0
/**
 * gimp_scale_entry_set_logarithmic:
 * @adjustment:  a  #GtkAdjustment as returned by gimp_scale_entry_new()
 * @logarithmic: a boolean value to set or reset logarithmic behaviour
 *               of the scale widget
 *
 * Sets whether the scale_entry's scale widget will behave in a linear
 * or logharithmic fashion. Useful when an entry has to attend large
 * ranges, but smaller selections on that range require a finer
 * adjustment.
 *
 * Since: GIMP 2.2
 **/
void
gimp_scale_entry_set_logarithmic (GtkObject *adjustment,
                                  gboolean   logarithmic)
{
  GtkAdjustment *adj;
  GtkAdjustment *scale_adj;

  g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));

  adj       = GTK_ADJUSTMENT (adjustment);
  scale_adj = GIMP_SCALE_ENTRY_SCALE_ADJ (adjustment);

  if (logarithmic == gimp_scale_entry_get_logarithmic (adjustment))
    return;

  if (logarithmic)
    {
      gdouble correction;
      gdouble log_value, log_lower, log_upper;
      gdouble log_step_increment, log_page_increment;

      correction = (gtk_adjustment_get_lower (scale_adj) > 0 ?
                    0 : 0.1 + - gtk_adjustment_get_lower (scale_adj));

      log_value = log (gtk_adjustment_get_value (scale_adj) + correction);
      log_lower = log (gtk_adjustment_get_lower (scale_adj) + correction);
      log_upper = log (gtk_adjustment_get_upper (scale_adj) + correction);
      log_step_increment =
        (log_upper - log_lower) / ((gtk_adjustment_get_upper (scale_adj) -
                                    gtk_adjustment_get_lower (scale_adj)) /
                                   gtk_adjustment_get_step_increment (scale_adj));
      log_page_increment =
        (log_upper - log_lower) / ((gtk_adjustment_get_upper (scale_adj) -
                                    gtk_adjustment_get_lower (scale_adj)) /
                                   gtk_adjustment_get_page_increment (scale_adj));

      if (scale_adj == adj)
        {
          GtkObject *new_adj;

          new_adj = gtk_adjustment_new (gtk_adjustment_get_value (scale_adj),
                                        gtk_adjustment_get_lower (scale_adj),
                                        gtk_adjustment_get_upper (scale_adj),
                                        gtk_adjustment_get_step_increment (scale_adj),
                                        gtk_adjustment_get_page_increment (scale_adj),
                                        0.0);
          gtk_range_set_adjustment (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (adj)),
                                    GTK_ADJUSTMENT (new_adj));

          scale_adj = (GtkAdjustment *) new_adj;
        }
      else
        {
          g_signal_handlers_disconnect_by_func (adj,
                                                gimp_scale_entry_unconstrained_adjustment_callback,
                                                scale_adj);

          g_signal_handlers_disconnect_by_func (scale_adj,
                                                gimp_scale_entry_unconstrained_adjustment_callback,
                                                adj);
        }

      gtk_adjustment_configure (scale_adj,
                                log_value, log_lower, log_upper,
                                log_step_increment, log_page_increment, 0.0);

      g_signal_connect (scale_adj, "value-changed",
                        G_CALLBACK (gimp_scale_entry_exp_adjustment_callback),
                        adj);

      g_signal_connect (adj, "value-changed",
                        G_CALLBACK (gimp_scale_entry_log_adjustment_callback),
                        scale_adj);

      g_object_set_data (G_OBJECT (adjustment),
                         "logarithmic", GINT_TO_POINTER (TRUE));
    }
  else
    {
      gdouble lower, upper;

      g_signal_handlers_disconnect_by_func (adj,
                                            gimp_scale_entry_log_adjustment_callback,
                                            scale_adj);

      g_signal_handlers_disconnect_by_func (scale_adj,
                                            gimp_scale_entry_exp_adjustment_callback,
                                            adj);

      lower = exp (gtk_adjustment_get_lower (scale_adj));
      upper = exp (gtk_adjustment_get_upper (scale_adj));

      if (gtk_adjustment_get_lower (adj) <= 0.0)
        {
          lower += - 0.1 + gtk_adjustment_get_lower (adj);
          upper += - 0.1 + gtk_adjustment_get_lower (adj);
        }

      gtk_adjustment_configure (scale_adj,
                                gtk_adjustment_get_value (adj),
                                lower, upper,
                                gtk_adjustment_get_step_increment (adj),
                                gtk_adjustment_get_page_increment (adj),
                                0.0);

      g_signal_connect (scale_adj, "value-changed",
                        G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
                        adj);

      g_signal_connect (adj, "value-changed",
                        G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
                        scale_adj);

      g_object_set_data (G_OBJECT (adjustment),
                         "logarithmic", GINT_TO_POINTER (FALSE));
    }
}
示例#29
0
文件: reset.c 项目: Lamieur/Lac
void zrob_okno_Resetu( void )
{
    GtkWidget *tree;
    int i;
    char bufor[ MIL ];

    ZNAJDZ_KONTROLKE( dres.Reset, "oknoreset" );
    ZNAJDZ_KONTROLKE( dres.spin_mob, "res_spin_mob" );
    ZNAJDZ_KONTROLKE( dres.spin_pom, "res_spin_pom" );
    ZNAJDZ_KONTROLKE( dres.spin_prz, "res_spin_prz" );
    ZNAJDZ_KONTROLKE2( dres.label_mob, "res_label_mob", GTK_LABEL );
    ZNAJDZ_KONTROLKE2( dres.label_pom, "res_label_pom", GTK_LABEL );
    ZNAJDZ_KONTROLKE2( dres.label_prz, "res_label_prz", GTK_LABEL );
    ZNAJDZ_KONTROLKE( dres.spin_int, "res_spin_int" );
    ZNAJDZ_KONTROLKE2( dres.label_int, "res_label_int", GTK_LABEL );
    ZNAJDZ_KONTROLKE( dres.button_poprz, "res_button_poprz" );
    ZNAJDZ_KONTROLKE( dres.button_nast, "res_button_nast" );
    ZNAJDZ_KONTROLKE( dres.hbox_mob, "res_hbox_mob" );
    ZNAJDZ_KONTROLKE( dres.hbox_prz, "res_hbox_prz" );
    ZNAJDZ_KONTROLKE( dres.frame_ekw, "res_frame_ekw" );
    ZNAJDZ_KONTROLKE( dres.button_poprz, "res_button_poprz" );
    ZNAJDZ_KONTROLKE( dres.button_nast, "res_button_nast" );

    ZNAJDZ_KONTROLKE( dres.frame_inw, "res_frame_inw" );
    ZNAJDZ_KONTROLKE2( dres.label_inw, "res_label_inw", GTK_LABEL );
    ZNAJDZ_KONTROLKE( dres.button_inw_usun, "res_button_inw_usun" );
    ZNAJDZ_KONTROLKE2( dres.store_inw, "res_treestore_inw", GTK_TREE_STORE );
    ZNAJDZ_KONTROLKE2( dres.treeview_inw, "res_treeview_inw", GTK_TREE_VIEW );
    ZNAJDZ_KONTROLKE( tree, "res_treeview_inw" );
    dres.select_inw = gtk_tree_view_get_selection( GTK_TREE_VIEW( tree ) );
    ZNAJDZ_KONTROLKE( dres.spin_inw_dodaj, "res_spin_inw_dodaj" );
    ZNAJDZ_KONTROLKE( dres.toggle_inw_dodaj, "res_toggle_inw_dodaj" );
    ZNAJDZ_KONTROLKE2( dres.label_inw_dodaj, "res_label_inw_dodaj", GTK_LABEL );
    ZNAJDZ_KONTROLKE( dres.button_inw_dodaj, "res_button_inw_dodaj" );
    gtk_adjustment_configure(
	gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( dres.spin_inw_dodaj ) ),
	1, 1, MAX_VNUM, 1, 10, 0 );

    dres.wear_na_item[ WEAR_LIGHT    ] = ITEM_TAKE | 0;
    dres.wear_na_item[ WEAR_FINGER_L ] = ITEM_TAKE | ITEM_WEAR_FINGER;
    dres.wear_na_item[ WEAR_FINGER_R ] = ITEM_TAKE | ITEM_WEAR_FINGER;
    dres.wear_na_item[ WEAR_NECK_1   ] = ITEM_TAKE | ITEM_WEAR_NECK;
    dres.wear_na_item[ WEAR_NECK_2   ] = ITEM_TAKE | ITEM_WEAR_NECK;
    dres.wear_na_item[ WEAR_BODY     ] = ITEM_TAKE | ITEM_WEAR_BODY;
    dres.wear_na_item[ WEAR_HEAD     ] = ITEM_TAKE | ITEM_WEAR_HEAD;
    dres.wear_na_item[ WEAR_LEGS     ] = ITEM_TAKE | ITEM_WEAR_LEGS;
    dres.wear_na_item[ WEAR_FEET     ] = ITEM_TAKE | ITEM_WEAR_FEET;
    dres.wear_na_item[ WEAR_HANDS    ] = ITEM_TAKE | ITEM_WEAR_HANDS;
    dres.wear_na_item[ WEAR_ARMS     ] = ITEM_TAKE | ITEM_WEAR_ARMS;
    dres.wear_na_item[ WEAR_SHIELD   ] = ITEM_TAKE | ITEM_WEAR_SHIELD;
    dres.wear_na_item[ WEAR_ABOUT    ] = ITEM_TAKE | ITEM_WEAR_ABOUT;
    dres.wear_na_item[ WEAR_WAIST    ] = ITEM_TAKE | ITEM_WEAR_WAIST;
    dres.wear_na_item[ WEAR_WRIST_L  ] = ITEM_TAKE | ITEM_WEAR_WRIST;
    dres.wear_na_item[ WEAR_WRIST_R  ] = ITEM_TAKE | ITEM_WEAR_WRIST;
    dres.wear_na_item[ WEAR_WIELD    ] = ITEM_TAKE | ITEM_WIELD;
    dres.wear_na_item[ WEAR_HOLD     ] = ITEM_TAKE | ITEM_HOLD;
    dres.wear_na_item[ WEAR_WIELD_2  ] = ITEM_TAKE | ITEM_WIELD;
    dres.wear_na_item[ WEAR_FACE     ] = ITEM_TAKE | ITEM_WEAR_FACE;

    for ( i = 0; i < MAX_WEAR; i++ )
    {
	GtkLabel *label;

	sprintf( bufor, "res_label_ekw%d", i );
	ZNAJDZ_KONTROLKE2( dres.label_ekw[ i ], bufor, GTK_LABEL );

	sprintf( bufor, "res_spin_ekw%d", i );
	ZNAJDZ_KONTROLKE( dres.spin_ekw[ i ], bufor );

	gtk_adjustment_configure(
	    gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( dres.spin_ekw[ i ] ) ),
	    -1, -1, MAX_VNUM, 1, 10, 0 );
	/* powyzsze 3 koniecznie w takiej kolejnosci */

	sprintf( bufor, "res_label_miejsce%d", i );
	ZNAJDZ_KONTROLKE2( label, bufor, GTK_LABEL );
	gtk_label_set_text( label, _( wearloc_str[ i ] ) );

	sprintf( bufor, "res_toggle_ekw%d", i );
	ZNAJDZ_KONTROLKE( dres.toggle_ekw[ i ], bufor );
	g_signal_connect( G_OBJECT( dres.toggle_ekw[ i ] ), "toggled",
	    G_CALLBACK( combo_res_ekw ), NULL );
    }

    return;
}
示例#30
0
static void
gvc_balance_bar_set_control (GvcBalanceBar *bar, MateMixerStreamControl *control)
{
        g_return_if_fail (GVC_BALANCE_BAR (bar));
        g_return_if_fail (MATE_MIXER_IS_STREAM_CONTROL (control));

        if (bar->priv->control != NULL) {
                g_signal_handlers_disconnect_by_func (G_OBJECT (bar->priv->control),
                                                      on_balance_value_changed,
                                                      bar);
                g_object_unref (bar->priv->control);
        }

        bar->priv->control = g_object_ref (control);

        if (bar->priv->btype == BALANCE_TYPE_LFE) {
                gdouble minimum;
                gdouble maximum;

                minimum = mate_mixer_stream_control_get_min_volume (bar->priv->control);
                maximum = mate_mixer_stream_control_get_normal_volume (bar->priv->control);

                /* Configure the adjustment for the volume limits of the current
                 * stream.
                 * Only subwoofer scale uses volume, balance and fade use fixed
                 * limits which do not need to be updated as balance type is
                 * only set during construction. */
                gtk_adjustment_configure (GTK_ADJUSTMENT (bar->priv->adjustment),
                                          gtk_adjustment_get_value (bar->priv->adjustment),
                                          minimum,
                                          maximum,
                                          (maximum - minimum) / 100.0,
                                          (maximum - minimum) / 10.0,
                                          0.0);

                bar->priv->lfe_channel = find_stream_lfe_channel (bar->priv->control);

                if (G_LIKELY (bar->priv->lfe_channel > -1))
                        g_debug ("Found LFE channel at position %d", bar->priv->lfe_channel);
                else
                        g_warn_if_reached ();
        } else
                bar->priv->lfe_channel = -1;

        switch (bar->priv->btype) {
        case BALANCE_TYPE_RL:
                g_signal_connect (G_OBJECT (bar->priv->control),
                                  "notify::balance",
                                  G_CALLBACK (on_balance_value_changed),
                                  bar);
                break;
        case BALANCE_TYPE_FR:
                g_signal_connect (G_OBJECT (bar->priv->control),
                                  "notify::fade",
                                  G_CALLBACK (on_balance_value_changed),
                                  bar);
                break;
        case BALANCE_TYPE_LFE:
                g_signal_connect (G_OBJECT (bar->priv->control),
                                  "notify::volume",
                                  G_CALLBACK (on_balance_value_changed),
                                  bar);
                break;
        }

        update_balance_value (bar);
        update_scale_marks (bar);

        g_object_notify_by_pspec (G_OBJECT (bar), properties[PROP_CONTROL]);
}