Exemple #1
0
int
clip_GTK_SPINBUTTONCONFIGURE(ClipMachine * ClipMachineMemory)
{
   C_widget *cspb = _fetch_cw_arg(ClipMachineMemory);

   C_widget *cadj = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   gfloat    climb_rate = DBL_OPTION(ClipMachineMemory, 3, 1);

   guint     digits = INT_OPTION(ClipMachineMemory, 4, 1);

   GtkAdjustment *adj;

   CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(cspb, GTK_IS_SPIN_BUTTON);
   CHECKOPT2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWIDOPT(cadj, GTK_IS_ADJUSTMENT);
   CHECKOPT(3, NUMERIC_type_of_ClipVarType);
   CHECKOPT(4, NUMERIC_type_of_ClipVarType);
   adj = cadj ? GTK_ADJUSTMENT(cadj->widget) : NULL;
   gtk_spin_button_configure(GTK_SPIN_BUTTON(cspb->widget), adj, climb_rate, digits);
   return 0;
 err:
   return 1;
}
Exemple #2
0
static VALUE
rg_configure(VALUE self, VALUE adj, VALUE climb_rate, VALUE digits)
{
    gtk_spin_button_configure(_SELF(self), GTK_ADJUSTMENT(RVAL2GOBJ(adj)),
                              NUM2DBL(climb_rate), NUM2UINT(digits));
    return self;
}
Exemple #3
0
GtkWidget*
unit_spin_button_new (GtkAdjustment  *adjustment,
		      gdouble         climb_rate,
		      guint           digits,
		      const gchar *unit)
{
  UnitSpinButton *spin;
  spin = g_object_new(UNIT_SPIN_BUTTON_TYPE, NULL);
  gtk_spin_button_configure(GTK_SPIN_BUTTON(spin), adjustment, climb_rate, digits);
  spin->unit = g_strdup(unit);
  return GTK_WIDGET(spin);
}
GtkWidget *
extspinbutton_new (GtkAdjustment *adjustment,
		   gfloat climb_rate,
		   guint digits)
{
    ExtSpinButton *s;

    s = gtk_type_new(extspinbutton_get_type());
    s->size_hack = TRUE;
    gtk_spin_button_configure(GTK_SPIN_BUTTON(s), adjustment, climb_rate, digits);

    g_signal_connect(s, "value-changed",
		     G_CALLBACK(extspinbutton_value_changed), NULL);

    return GTK_WIDGET(s);
}
GtkWidget* bimp_resize_gui_new(resize_settings settings)
{
    GtkWidget *gui, *vbox_dimensions, *hbox_padding, *vbox_resolution, *hbox_values, *hbox_quality;
    GtkWidget *align_manualsize, *align_values, *align_res;
    GtkWidget *label_width, *label_height, *label_quality, *label_resX, *label_resY, *label_dpi;
    
    last_percent_w_value = settings->new_w_pc;
    last_percent_h_value = settings->new_h_pc;
    last_pixel_w_value = settings->new_w_px;
    last_pixel_h_value = settings->new_h_px;
    
    gui = gtk_hbox_new(FALSE, 10);
    
    // "change dimensions" side
    vbox_dimensions = gtk_vbox_new(FALSE, 5);
    
    radio_size_percent = gtk_radio_button_new_with_label (NULL, _("Set to a percentage of the original"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_size_percent), (settings->resize_mode == RESIZE_PERCENT));
    radio_size_px = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio_size_percent), _("Set exact size in pixel"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_size_px), (settings->resize_mode != RESIZE_PERCENT));
    
    align_manualsize = gtk_alignment_new(0, 0, 0, 0);
    gtk_alignment_set_padding(GTK_ALIGNMENT(align_manualsize), 0, 5, 20, 0);
    
    combo_manualsize = gtk_combo_box_new_text();
    gtk_combo_box_append_text(GTK_COMBO_BOX(combo_manualsize), _("For both dimensions"));
    gtk_combo_box_append_text(GTK_COMBO_BOX(combo_manualsize), _("Width only"));
    gtk_combo_box_append_text(GTK_COMBO_BOX(combo_manualsize), _("Height only"));
    
    if (settings->resize_mode == RESIZE_PIXEL_WIDTH) gtk_combo_box_set_active(GTK_COMBO_BOX(combo_manualsize), 1);
    else if (settings->resize_mode == RESIZE_PIXEL_HEIGHT) gtk_combo_box_set_active(GTK_COMBO_BOX(combo_manualsize), 2);
    else gtk_combo_box_set_active(GTK_COMBO_BOX(combo_manualsize), 0);
    
    gtk_container_add(GTK_CONTAINER(align_manualsize), combo_manualsize);
    
    GtkWidget* separator1 = gtk_hseparator_new();
    
    radio_stretch_allow = gtk_radio_button_new_with_label (NULL, _("Allow stretching"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_stretch_allow), (settings->stretch_mode == STRETCH_ALLOW));
    radio_stretch_aspect = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio_stretch_allow), _("Preserve aspect ratio"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_stretch_aspect), (settings->stretch_mode == STRETCH_ASPECT));
    radio_stretch_padded = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio_stretch_allow), _("Fill with padding"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_stretch_padded), (settings->stretch_mode == STRETCH_PADDED));
    
    chooser_paddingcolor = gtk_color_button_new_with_color(&(settings->padding_color));
    gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(chooser_paddingcolor), TRUE);
    gtk_color_button_set_alpha(GTK_COLOR_BUTTON(chooser_paddingcolor), settings->padding_color_alpha);
    
    hbox_padding = gtk_hbox_new(FALSE, 5);
    
    GtkWidget* separator2 = gtk_hseparator_new();
    
    align_values = gtk_alignment_new(0.5, 0, 0, 0);
    gtk_alignment_set_padding(GTK_ALIGNMENT(align_values), 5, 5, 0, 0);
    hbox_values = gtk_hbox_new(FALSE, 5);
    label_width = gtk_label_new(g_strconcat(_("Width"), ":", NULL));
    spin_width = gtk_spin_button_new(NULL, 1, 0);
    gtk_widget_set_size_request (spin_width, SPIN_SIZE_W, SPIN_SIZE_H);
    label_height = gtk_label_new(g_strconcat(_("Height"), ":", NULL));
    spin_height = gtk_spin_button_new(NULL, 1, 0);
    gtk_widget_set_size_request (spin_height, SPIN_SIZE_W, SPIN_SIZE_H);
    label_unit = gtk_label_new("<unit>");
    gtk_widget_set_size_request (label_unit, 25, 25);
    
    hbox_quality = gtk_hbox_new(FALSE, 5);
    label_quality = gtk_label_new(_("Interpolation quality"));
    combo_quality = gimp_enum_combo_box_new((GType)GIMP_TYPE_INTERPOLATION_TYPE);
    gimp_int_combo_box_set_active((GimpIntComboBox*)combo_quality, settings->interpolation);
    
    GtkWidget* separator3 = gtk_vseparator_new();
    
    // "change resolution" side
    vbox_resolution = gtk_vbox_new(FALSE, 5);
    
    check_resolution = gtk_check_button_new_with_label(_("Change resolution"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_resolution), settings->change_res);
    
    align_res = gtk_alignment_new(0.5, 0, 0, 0);
    gtk_alignment_set_padding(GTK_ALIGNMENT(align_res), 5, 5, 0, 0);
    hbox_res = gtk_hbox_new(FALSE, 5);
    label_resX = gtk_label_new(g_strconcat(_("X axis"), ":", NULL));
    spin_resX = gtk_spin_button_new(NULL, 1, 0);
    gtk_widget_set_size_request (spin_resX, SPIN_SIZE_W, SPIN_SIZE_H);
    gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_resX), GTK_ADJUSTMENT(gtk_adjustment_new (settings->new_res_x, 0.005, 65536.000, 1.000, 1, 0)), 0, 3);
    label_resY = gtk_label_new(g_strconcat(_("Y axis"), ":", NULL));
    spin_resY = gtk_spin_button_new(NULL, 1, 0);
    gtk_widget_set_size_request (spin_resY, SPIN_SIZE_W, SPIN_SIZE_H);
    gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_resY), GTK_ADJUSTMENT(gtk_adjustment_new (settings->new_res_y, 0.005, 65536.000, 1.000, 1, 0)), 0, 3);
    label_dpi = gtk_label_new("dpi");
    
    // pack everything
    
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), radio_size_percent, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), radio_size_px, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), align_manualsize, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), separator1, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), radio_stretch_allow, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), radio_stretch_aspect, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_padding), radio_stretch_padded, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_padding), chooser_paddingcolor, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), hbox_padding, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), separator2, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(hbox_values), label_width, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_values), spin_width, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_values), label_height, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_values), spin_height, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_values), label_unit, FALSE, FALSE, 0);
    gtk_container_add(GTK_CONTAINER(align_values), hbox_values);
    
    gtk_box_pack_start(GTK_BOX(hbox_quality), label_quality, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_quality), combo_quality, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), align_values, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox_dimensions), hbox_quality, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(vbox_resolution), check_resolution, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(hbox_res), label_resX, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_res), spin_resX, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_res), label_resY, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_res), spin_resY, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox_res), label_dpi, FALSE, FALSE, 0);
    gtk_container_add(GTK_CONTAINER(align_res), hbox_res);
    gtk_box_pack_start(GTK_BOX(vbox_resolution), align_res, FALSE, FALSE, 0);
    
    gtk_box_pack_start(GTK_BOX(gui), vbox_dimensions, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(gui), separator3, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(gui), vbox_resolution, FALSE, FALSE, 0);
    
    
    previous_was_percent = FALSE;
    toggle_units_group(NULL, NULL);
    toggle_resolution(NULL, NULL);
    
    g_signal_connect(G_OBJECT(radio_size_percent), "toggled", G_CALLBACK(toggle_units_group), NULL);
    g_signal_connect(G_OBJECT(radio_size_px), "toggled", G_CALLBACK(toggle_units_group), NULL);
    g_signal_connect(G_OBJECT(combo_manualsize), "changed", G_CALLBACK(toggle_units_group), NULL);
    g_signal_connect(G_OBJECT(radio_stretch_allow), "toggled", G_CALLBACK(toggle_units_group), NULL);
    g_signal_connect(G_OBJECT(radio_stretch_aspect), "toggled", G_CALLBACK(toggle_units_group), NULL);
    g_signal_connect(G_OBJECT(radio_stretch_padded), "toggled", G_CALLBACK(toggle_units_group), NULL);
    g_signal_connect(G_OBJECT(check_resolution), "toggled", G_CALLBACK(toggle_resolution), NULL);
    
    return gui;
}
void toggle_units_group(GtkToggleButton *togglebutton, gpointer user_data) 
{
    gboolean percent_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_size_percent));
    gboolean aspect_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_stretch_aspect));
    
    int combo_manualsize_sel = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_manualsize));
    gboolean both_active = (combo_manualsize_sel == 0);
    gboolean width_active = (combo_manualsize_sel == 1);
    gboolean height_active = (combo_manualsize_sel == 2);
    
    if (percent_active) {
        // store last pixel values
        if (gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_width)) > 0 && gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_height)) > 0) {
            last_pixel_w_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_width));
            last_pixel_h_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_height));
        }
        
        gtk_widget_set_sensitive(GTK_WIDGET(combo_manualsize), FALSE);
        gtk_label_set_text(GTK_LABEL(label_unit), "%");
        
        // set adjustments
        gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_width), GTK_ADJUSTMENT(gtk_adjustment_new (last_percent_w_value, 1, 40960, 0.01, 1, 0)), 0, 2);
        if (aspect_active) {
            gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_height), gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(spin_width)), 0, 2);
        }
        else {
            gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_height), GTK_ADJUSTMENT(gtk_adjustment_new (last_percent_h_value, 1, 40960, 0.01, 1, 0)), 0, 2);
        }
        
        previous_was_percent = TRUE;
    }
    else {
        if (gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_width)) > 0 && gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_height)) > 0) {
            if (previous_was_percent) {
                last_percent_w_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_width));
                last_percent_h_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_height));
            }
            else {
                last_pixel_w_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_width));
                last_pixel_h_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_height));
            }
        }
        
        gtk_widget_set_sensitive(GTK_WIDGET(combo_manualsize), TRUE);
        gtk_label_set_text(GTK_LABEL(label_unit), "px");
        
        gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_width), GTK_ADJUSTMENT(gtk_adjustment_new (last_pixel_w_value, 1, 262144, 1, 10, 0)), 0, 0);
        gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_height), GTK_ADJUSTMENT(gtk_adjustment_new (last_pixel_h_value, 1, 262144, 1, 10, 0)), 0, 0);
        
        previous_was_percent = FALSE;
    }
    
    // adjustments for resolution spinners
    if (aspect_active) {
        gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_resY), gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(spin_resX)), 0, 3);
    }
    else {
        gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_resY), GTK_ADJUSTMENT(gtk_adjustment_new (gtk_spin_button_get_value (GTK_SPIN_BUTTON(spin_resY)), 0.005, 65536.000, 1.000, 1, 0)), 0, 3);
    }
    
    gtk_widget_set_sensitive(GTK_WIDGET(spin_width), (percent_active || both_active || width_active));
    gtk_widget_set_sensitive(GTK_WIDGET(spin_height), (percent_active || both_active || height_active));
    gtk_widget_set_sensitive(GTK_WIDGET(chooser_paddingcolor), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_stretch_padded)));
}
Exemple #7
0
		CVoxelView::CVoxelView(CVoxelDisplay& rVoxelDisplay) :
			m_rVoxelDisplay(rVoxelDisplay),
			m_pBuilderInterface(NULL),
			m_pCubeButton(NULL),
			m_pSphereButton(NULL),
			m_pMinScaleFactorSpinButton(NULL),
			m_pMaxScaleFactorSpinButton(NULL),
			m_f64MinScaleFactor(1),
			m_f64MaxScaleFactor(2),
			m_pThresholdRangeAndOrLabel(NULL),
			m_pMinDisplayThresholdBoundaryButton(NULL),
			m_pMaxDisplayThresholdBoundaryButton(NULL),
			m_pMinDisplayThresholdScale(NULL),
			m_pMaxDisplayThresholdScale(NULL),
			m_f64MinDisplayThreshold(0.25),
			m_f64MaxDisplayThreshold(0.75)
		{
			//load the gtk builder interface
			m_pBuilderInterface=gtk_builder_new(); // glade_xml_new(OpenViBE::Directories::getDataDir() + "/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-VoxelDisplay.ui", NULL, NULL);
			gtk_builder_add_from_file(m_pBuilderInterface, OpenViBE::Directories::getDataDir() + "/openvibe-plugins/simple-visualisation/openvibe-simple-visualisation-VoxelDisplay.ui", NULL);

			if(!m_pBuilderInterface)
			{
				g_warning("Couldn't load the interface!");
				return;
			}

			gtk_builder_connect_signals(m_pBuilderInterface, NULL);

			//toolbar
			//-------

			//voxel object buttons
			m_pCubeButton = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "CubeButton"));
			m_pSphereButton = GTK_RADIO_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "SphereButton"));

			g_signal_connect(G_OBJECT(m_pCubeButton), "toggled", G_CALLBACK(setVoxelObjectCallback), this);
			g_signal_connect(G_OBJECT(m_pSphereButton), "toggled", G_CALLBACK(setVoxelObjectCallback), this);

			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifyColorToolButton")), "toggled", G_CALLBACK(toggleColorModificationCallback), this);
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifyTransparencyToolButton")), "toggled", G_CALLBACK(toggleTransparencyModificationCallback), this);
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "ModifySizeToolButton")), "toggled", G_CALLBACK(toggleSizeModificationCallback), this);

			//min voxel scale factor
			m_pMinScaleFactorSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MinScaleFactorSpinButton"));
			m_rVoxelDisplay.setMinScaleFactor(m_f64MinScaleFactor);
			gtk_spin_button_configure(
				m_pMinScaleFactorSpinButton,
				GTK_ADJUSTMENT(gtk_adjustment_new(
					m_f64MinScaleFactor, //initial value
					0, //lower
					5, //upper
					0.1, //step increment
					0.5, //page increment
					0)), //page size - deprecated
					0.1, //climb rate
					1); //digits
			g_signal_connect(G_OBJECT(m_pMinScaleFactorSpinButton), "value-changed", G_CALLBACK(setMinScaleFactorCallback), this);

			//max voxel scale factor
			m_pMaxScaleFactorSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MaxScaleFactorSpinButton"));
			m_rVoxelDisplay.setMaxScaleFactor(m_f64MaxScaleFactor);
			gtk_spin_button_configure(
				m_pMaxScaleFactorSpinButton,
				GTK_ADJUSTMENT(gtk_adjustment_new(
					m_f64MaxScaleFactor, //initial value
					0, //lower
					5, //upper
					0.1, //step increment
					0.5, //page increment
					0)), //page size - deprecated
					0.1, //climb rate
					1); //digits
			g_signal_connect(G_OBJECT(m_pMaxScaleFactorSpinButton), "value-changed", G_CALLBACK(setMaxScaleFactorCallback), this);

			boolean l_bInclusiveDisplayThresholdBoundary = true;
			m_rVoxelDisplay.setDisplayThresholdBoundaryType(l_bInclusiveDisplayThresholdBoundary);

			//AND/OR label
			m_pThresholdRangeAndOrLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilderInterface, "ThresholdRangeAndOrLabel"));
			gtk_label_set_label(m_pThresholdRangeAndOrLabel, l_bInclusiveDisplayThresholdBoundary? "AND" : "OR");

			//min display threshold boundary type
			m_pMinDisplayThresholdBoundaryButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MinDisplayThresholdBoundaryButton"));
			gtk_button_set_label(m_pMinDisplayThresholdBoundaryButton, l_bInclusiveDisplayThresholdBoundary ? ">" : "<");
			g_signal_connect(G_OBJECT(m_pMinDisplayThresholdBoundaryButton), "clicked", G_CALLBACK(setMinDisplayThresholdBoundaryTypeCallback), this);

			//max display threshold boundary type
			m_pMaxDisplayThresholdBoundaryButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "MaxDisplayThresholdBoundaryButton"));
			gtk_button_set_label(m_pMaxDisplayThresholdBoundaryButton, l_bInclusiveDisplayThresholdBoundary ? "<" : ">");
			g_signal_connect(G_OBJECT(m_pMaxDisplayThresholdBoundaryButton), "clicked", G_CALLBACK(setMaxDisplayThresholdBoundaryTypeCallback), this);

			//min display threshold slider
			m_pMinDisplayThresholdScale = GTK_SCALE(gtk_hscale_new_with_range(0.0, 1.0, 0.01));
			m_rVoxelDisplay.setMinDisplayThreshold(m_f64MinDisplayThreshold);
			gtk_range_set_value(GTK_RANGE(m_pMinDisplayThresholdScale), m_f64MinDisplayThreshold);
			gtk_scale_set_value_pos(m_pMinDisplayThresholdScale, GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(m_pMinDisplayThresholdScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(GTK_WIDGET(m_pMinDisplayThresholdScale), 100, -1);
			gtk_widget_show_all(GTK_WIDGET(m_pMinDisplayThresholdScale));
			g_signal_connect(G_OBJECT(m_pMinDisplayThresholdScale), "value_changed", G_CALLBACK(setMinDisplayThresholdCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldMinScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "MinDisplayThresholdScale"));
			GtkWidget* l_pMinScaleParent = gtk_widget_get_parent(l_pOldMinScale);
			if(l_pMinScaleParent != NULL && GTK_IS_CONTAINER(l_pMinScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pMinScaleParent), l_pOldMinScale);
				if(GTK_IS_BOX(l_pMinScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pMinScaleParent), GTK_WIDGET(m_pMinDisplayThresholdScale), TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pMinScaleParent), GTK_WIDGET(m_pMinDisplayThresholdScale), 1);
				}
			}

			//max display threshold slider
			m_pMaxDisplayThresholdScale = GTK_SCALE(gtk_hscale_new_with_range(0.0, 1.0, 0.01));
			m_rVoxelDisplay.setMaxDisplayThreshold(m_f64MaxDisplayThreshold);
			gtk_range_set_value(GTK_RANGE(m_pMaxDisplayThresholdScale), m_f64MaxDisplayThreshold);
			gtk_scale_set_value_pos(m_pMaxDisplayThresholdScale, GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(m_pMaxDisplayThresholdScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(GTK_WIDGET(m_pMaxDisplayThresholdScale), 100, -1);
			gtk_widget_show_all(GTK_WIDGET(m_pMaxDisplayThresholdScale));
			g_signal_connect(G_OBJECT(m_pMaxDisplayThresholdScale), "value_changed", G_CALLBACK(setMaxDisplayThresholdCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldMaxScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "MaxDisplayThresholdScale"));
			GtkWidget* l_pMaxScaleParent = gtk_widget_get_parent(l_pOldMaxScale);
			if(l_pMaxScaleParent != NULL && GTK_IS_CONTAINER(l_pMaxScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pMaxScaleParent), l_pOldMaxScale);
				if(GTK_IS_BOX(l_pMaxScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pMaxScaleParent), GTK_WIDGET(m_pMaxDisplayThresholdScale), TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pMaxScaleParent), GTK_WIDGET(m_pMaxDisplayThresholdScale), 1);
				}
			}

			//skull opacity slider
			GtkWidget* l_pSkullOpacityScale = gtk_hscale_new_with_range(0.0, 1.0, 0.05);
			float64 l_f64SkullOpacity = 0.07;
			gtk_range_set_value(GTK_RANGE(l_pSkullOpacityScale), l_f64SkullOpacity);
			m_rVoxelDisplay.setSkullOpacity(l_f64SkullOpacity);
			gtk_scale_set_value_pos(GTK_SCALE(l_pSkullOpacityScale), GTK_POS_TOP);
			gtk_range_set_update_policy(GTK_RANGE(l_pSkullOpacityScale), GTK_UPDATE_CONTINUOUS);
			gtk_widget_set_size_request(l_pSkullOpacityScale, 100, -1);
			gtk_widget_show_all(l_pSkullOpacityScale);
			g_signal_connect(G_OBJECT(l_pSkullOpacityScale), "value_changed", G_CALLBACK(setSkullOpacityCallback), this);

			//replace existing scale (which somehow can't be used) with the newly created one
			GtkWidget* l_pOldScale = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "SkullOpacityScale"));
			GtkWidget* l_pScaleParent = gtk_widget_get_parent(l_pOldScale);
			if(l_pScaleParent != NULL && GTK_IS_CONTAINER(l_pScaleParent))
			{
				gtk_container_remove(GTK_CONTAINER(l_pScaleParent), l_pOldScale);
				if(GTK_IS_BOX(l_pScaleParent))
				{
					gtk_box_pack_start(GTK_BOX(l_pScaleParent), l_pSkullOpacityScale, TRUE, TRUE, 0);
					gtk_box_reorder_child(GTK_BOX(l_pScaleParent), l_pSkullOpacityScale, 0);
				}
			}

			//camera animation button
			GtkToggleToolButton* l_pAnimateCameraButton = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "AnimateCameraButton"));
			g_signal_connect(G_OBJECT(l_pAnimateCameraButton), "toggled", G_CALLBACK(toggleAnimateCameraCallback), this);

			//reposition camera
			g_signal_connect(G_OBJECT(gtk_builder_get_object(m_pBuilderInterface, "RepositionCamera")),	"clicked", G_CALLBACK(repositionCameraCallback), this);

			this->toggleColorModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifyColorToolButton")))?true:false);
			this->toggleTransparencyModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifyTransparencyToolButton")))?true:false);
			this->toggleSizeModificationCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "ModifySizeToolButton")))?true:false);
			this->enableAutoCameraMovementCB(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(m_pBuilderInterface, "AnimateCameraButton")))?true:false);
		}
Exemple #8
0
int initUI()
{
    GtkBuilder              *builder;
    GtkWidget               *window;
        
    gtk_init (NULL,NULL);

    builder = gtk_builder_new ();
    gtk_builder_add_from_file (builder, "ui/player-piano.glade", NULL);

    window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
    gtk_builder_connect_signals (builder, NULL);          

    gtk_widget_show (window);       
    currentFrameW = (GtkSpinButton*)gtk_builder_get_object( builder, "currentFrame" );
    leftXW = (GtkSpinButton*)gtk_builder_get_object( builder, "leftX" );
    rightXW = (GtkSpinButton*)gtk_builder_get_object( builder, "rightX" );
    leftYW = (GtkSpinButton*)gtk_builder_get_object( builder, "leftY" );
    rightYW = (GtkSpinButton*)gtk_builder_get_object( builder, "rightY" );
    ROIsizeW = (GtkSpinButton*)gtk_builder_get_object( builder, "boxSize" );
    thresholdValueW = (GtkSpinButton*)gtk_builder_get_object( builder, "threshold" );
    startFrameW = (GtkSpinButton*)gtk_builder_get_object( builder, "startFrame" );
    stopFrameW = (GtkSpinButton*)gtk_builder_get_object( builder, "stopFrame" );
#pragma message("TODO: this is disgustingly verbose. Clean me up.")
    GtkObject* frameCountAdj = 0;
    frameCountAdj = gtk_adjustment_new(0, 0, frameCount-1, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)currentFrameW, (GtkAdjustment*)frameCountAdj, 1, 0);

    GtkObject* startFrameAdj = 0;
    startFrameAdj = gtk_adjustment_new(0, 0, frameCount-1, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)startFrameW, (GtkAdjustment*)startFrameAdj, 1, 0);

    GtkObject* stopFrameAdj = 0;
    stopFrameAdj = gtk_adjustment_new(0, 0, frameCount-1, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)stopFrameW, (GtkAdjustment*)stopFrameAdj, 1, 0);

    GtkObject* leftWidthAdj = 0;
    leftWidthAdj = gtk_adjustment_new(0, 0, width-1, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)leftXW, (GtkAdjustment*)leftWidthAdj, 1, 0);

    GtkObject* rightWidthAdj = 0;
    rightWidthAdj = gtk_adjustment_new(0, 0, width-1, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)rightXW, (GtkAdjustment*)rightWidthAdj, 1, 0);

    GtkObject* leftHeightAdj = 0;
    leftHeightAdj = gtk_adjustment_new(0, 0, height-1, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)leftYW, (GtkAdjustment*)leftHeightAdj, 1, 0);

    GtkObject* rightHeightAdj = 0;
    rightHeightAdj = gtk_adjustment_new(0, 0, height-1, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)rightYW, (GtkAdjustment*)rightHeightAdj, 1, 0);

    GtkObject* roiSizeAdj = 0;
    roiSizeAdj = gtk_adjustment_new(0, 0, 1000, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)ROIsizeW, (GtkAdjustment*)roiSizeAdj, 1, 0);

    GtkObject* thresholdValueAdj = 0;
    thresholdValueAdj = gtk_adjustment_new(0, 0, 1000, 1, 0, 0);
    gtk_spin_button_configure((GtkSpinButton*)thresholdValueW, (GtkAdjustment*)thresholdValueAdj, 1, 5);

    g_object_unref (G_OBJECT (builder));    
    gtk_main ();
        
    return 0;
}
static void update_frame_params(GtkComboBox *widget, changeformat_settings settings) 
{
    increase_dialog_height(0);
    format_type selected_format = (format_type)gtk_combo_box_get_active(widget);
    
    if (selected_format == FORMAT_GIF) {
        inner_widget = gtk_vbox_new(FALSE, 5);
        gtk_container_set_border_width(GTK_CONTAINER(inner_widget), 8);
        check_interlace = gtk_check_button_new_with_label(_("Interlaced"));
        
        if (selected_format == settings->format) {
            format_params_gif settings_gif = (format_params_gif)(settings->params);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_interlace), settings_gif->interlace);
        }
        else {
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_interlace), FALSE);
        }
        
        gtk_box_pack_start(GTK_BOX(inner_widget), check_interlace, FALSE, FALSE, 0);
    } 
    else if (selected_format == FORMAT_JPEG) {
        GtkWidget *hbox_quality, *hbox_smoothing, *hbox_checks, *hbox_comment, *hbox_markers, *hbox_subsampling, *hbox_dct;
        GtkWidget *vbox_advanced, *label_quality, *label_smoothing, *label_markers, *label_comment, *label_subsampling, *label_dct, *text_comment;
        
        inner_widget = gtk_vbox_new(FALSE, 5);
        gtk_container_set_border_width(GTK_CONTAINER(inner_widget), 8);
        
        hbox_quality = gtk_hbox_new(FALSE, 5);
        label_quality = gtk_label_new(_("Quality"));
        gtk_widget_set_size_request (label_quality, 100, LABEL_H);
        gtk_misc_set_alignment(GTK_MISC(label_quality), 0.5, 0.8);
        scale_quality = gtk_hscale_new_with_range(0, 100, 1);
        gtk_widget_set_size_request (scale_quality, 160, SCALE_H);
        
        expander_advanced = gtk_expander_new(_("Advanced params"));
        vbox_advanced = gtk_vbox_new(FALSE, 5);
        
        hbox_smoothing = gtk_hbox_new(FALSE, 5);
        label_smoothing = gtk_label_new(_("Smoothing"));
        gtk_widget_set_size_request (label_smoothing, 100, LABEL_H);
        gtk_misc_set_alignment(GTK_MISC(label_smoothing), 0.5, 0.8);
        scale_smoothing = gtk_hscale_new_with_range(0, 1, 0.01);
        gtk_widget_set_size_request (scale_smoothing, 160, SCALE_H);
        
        hbox_checks = gtk_hbox_new(FALSE, 5);
        check_entrophy = gtk_check_button_new_with_label(_("Optimize"));
        check_progressive = gtk_check_button_new_with_label(_("Progressive"));
        check_baseline = gtk_check_button_new_with_label(_("Save baseline"));
        
        hbox_comment = gtk_hbox_new(FALSE, 5);
        label_comment = gtk_label_new(g_strconcat(_("Comment"), ": ", NULL));
        gtk_widget_set_size_request (label_comment, 100, LABEL_H);
        text_comment =  gtk_text_view_new();
        buffer_comment = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_comment));
        gtk_widget_set_size_request (text_comment, 160, TEXT_H);
        
        hbox_markers = gtk_hbox_new(FALSE, 5);
        label_markers = gtk_label_new(g_strconcat(_("Markers rows"), ": ", NULL));
        gtk_widget_set_size_request (label_markers, 100, LABEL_H);
        spin_markers = gtk_spin_button_new(NULL, 1, 0);
        
        hbox_subsampling = gtk_hbox_new(FALSE, 5);
        label_subsampling = gtk_label_new(g_strconcat(_("Subsampling"), ": ", NULL));
        gtk_widget_set_size_request (label_subsampling, 100, LABEL_H);
        combo_subsampling = gtk_combo_box_new_text();
        gtk_widget_set_size_request (combo_subsampling, 180, COMBO_H);
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_subsampling), g_strconcat("2x2, 1x1, 1x1 (", _("Small size"), ")", NULL));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_subsampling), "2x1, 1x1, 1x1 (4:2:2)");
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_subsampling), g_strconcat("1x1, 1x1, 1x1 (", _("Quality"), ")", NULL));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_subsampling), "1x2, 1x1, 1x1");
        
        
        hbox_dct = gtk_hbox_new(FALSE, 5);
        label_dct = gtk_label_new(g_strconcat(_("DCT algorithm"), ": ", NULL));
        gtk_widget_set_size_request (label_dct, 100, LABEL_H);
        combo_dct = gtk_combo_box_new_text();
        gtk_widget_set_size_request (combo_dct, 150, COMBO_H);
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_dct), _("Integer"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_dct), _("Fast integer"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_dct), _("Float"));
        
        if (selected_format == settings->format) {
            format_params_jpeg settings_jpeg = (format_params_jpeg)(settings->params);
            gtk_range_set_value(GTK_RANGE(scale_quality), settings_jpeg->quality);
            gtk_range_set_value(GTK_RANGE(scale_smoothing), settings_jpeg->smoothing);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_entrophy), settings_jpeg->entropy);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_progressive), settings_jpeg->progressive);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_baseline), settings_jpeg->baseline);
            
            gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_markers), GTK_ADJUSTMENT(gtk_adjustment_new (settings_jpeg->markers, 0, 64, 1, 1, 0)), 0, 0);
            
            buffer_comment = gtk_text_view_get_buffer(GTK_TEXT_VIEW (text_comment));
            gtk_text_buffer_set_text (buffer_comment, settings_jpeg->comment, -1); 
            gtk_text_view_set_buffer(GTK_TEXT_VIEW(text_comment), buffer_comment);
            
            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_subsampling), settings_jpeg->subsampling);
            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_dct), settings_jpeg->dct);
        }
        else {
            gtk_range_set_value(GTK_RANGE(scale_quality), 85.0);
            gtk_range_set_value(GTK_RANGE(scale_smoothing), 0.0);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_entrophy), TRUE);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_progressive), FALSE);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_baseline), FALSE);
            
            gtk_spin_button_configure (GTK_SPIN_BUTTON(spin_markers), GTK_ADJUSTMENT(gtk_adjustment_new (0, 0, 64, 1, 1, 0)), 0, 0);
            
            gtk_text_buffer_set_text (buffer_comment, "", -1); 
            gtk_text_view_set_buffer(GTK_TEXT_VIEW(text_comment), buffer_comment);
            
            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_subsampling), 2);
            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_dct), 1);
        }
        
        gtk_box_pack_start(GTK_BOX(hbox_quality), label_quality, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_quality), scale_quality, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(inner_widget), hbox_quality, FALSE, FALSE, 0);
        
        gtk_box_pack_start(GTK_BOX(inner_widget), expander_advanced, FALSE, FALSE, 0);
        
        gtk_box_pack_start(GTK_BOX(hbox_smoothing), label_smoothing, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_smoothing), scale_smoothing, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), hbox_smoothing, FALSE, FALSE, 0);
        
        gtk_box_pack_start(GTK_BOX(hbox_checks), check_entrophy, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_checks), check_progressive, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_checks), check_baseline, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), hbox_checks, FALSE, FALSE, 0);
                
        gtk_box_pack_start(GTK_BOX(hbox_comment), label_comment, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_comment), text_comment, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), hbox_comment, FALSE, FALSE, 0);
        
        gtk_box_pack_start(GTK_BOX(hbox_markers), label_markers, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_markers), spin_markers, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), hbox_markers, FALSE, FALSE, 0);
        
        gtk_box_pack_start(GTK_BOX(hbox_subsampling), label_subsampling, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_subsampling), combo_subsampling, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), hbox_subsampling, FALSE, FALSE, 0);
        
        gtk_box_pack_start(GTK_BOX(hbox_dct), label_dct, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_dct), combo_dct, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), hbox_dct, FALSE, FALSE, 0);
        
        gtk_container_add (GTK_CONTAINER(expander_advanced), vbox_advanced);
        
        g_signal_connect(G_OBJECT(expander_advanced), "activate", G_CALLBACK(adv_expanded), combo_format);
    }
    else if (selected_format == FORMAT_PNG) {
        GtkWidget *hbox_compression, *label_compression;
        GtkWidget *vbox_advanced;
        
        inner_widget = gtk_vbox_new(FALSE, 5);
        gtk_container_set_border_width(GTK_CONTAINER(inner_widget), 8);
        check_interlace = gtk_check_button_new_with_label(_("Interlace (Adam7)"));
        hbox_compression = gtk_hbox_new(FALSE, 5);
        label_compression = gtk_label_new(_("Compression"));
        gtk_widget_set_size_request (label_compression, 100, LABEL_H);
        gtk_misc_set_alignment(GTK_MISC(label_compression), 0.5, 0.8);
        scale_compression = gtk_hscale_new_with_range(0, 9, 1);
        gtk_widget_set_size_request (scale_compression, 100, SCALE_H);
        
        expander_advanced = gtk_expander_new(_("Advanced params"));
        vbox_advanced = gtk_vbox_new(FALSE, 5);
        
        check_savebgc = gtk_check_button_new_with_label(_("Save background color"));
        check_savegamma = gtk_check_button_new_with_label(_("Save gamma"));
        check_saveoff = gtk_check_button_new_with_label(_("Save layer offset"));
        check_savephys = gtk_check_button_new_with_label(_("Save resolution"));
        check_savetime = gtk_check_button_new_with_label(_("Save creation date"));
        check_savecomm = gtk_check_button_new_with_label(_("Save comments"));
        check_savetrans = gtk_check_button_new_with_label(_("Save color from transparent pixels"));
        
        if (selected_format == settings->format) {
            format_params_png settings_png = (format_params_png)(settings->params);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_interlace), settings_png->interlace);
            gtk_range_set_value(GTK_RANGE(scale_compression), settings_png->compression);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savebgc), settings_png->savebgc);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savegamma), settings_png->savegamma);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_saveoff), settings_png->saveoff);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savephys), settings_png->savephys);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savetime), settings_png->savetime);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savecomm), settings_png->savecomm);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savetrans), settings_png->savetrans);
        }
        else {
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_interlace), FALSE);
            gtk_range_set_value(GTK_RANGE(scale_compression), 9);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savebgc), TRUE);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savegamma), FALSE);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_saveoff), FALSE);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savephys), TRUE);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savetime), TRUE);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savecomm), TRUE);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savetrans), TRUE);
        }
        
        gtk_box_pack_start(GTK_BOX(vbox_advanced), check_savebgc, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), check_savegamma, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), check_saveoff, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), check_savephys, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), check_savetime, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), check_savecomm, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_advanced), check_savetrans, FALSE, FALSE, 0);
        
        gtk_box_pack_start(GTK_BOX(inner_widget), check_interlace, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_compression), label_compression, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_compression), scale_compression, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(inner_widget), hbox_compression, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(inner_widget), expander_advanced, FALSE, FALSE, 0);
        gtk_container_add (GTK_CONTAINER(expander_advanced), vbox_advanced);
        
        g_signal_connect(G_OBJECT(expander_advanced), "activate", G_CALLBACK(adv_expanded), combo_format);
    }
    else if (selected_format == FORMAT_TGA) {    
        GtkWidget *hbox_origin, *label_origin;
            
        inner_widget = gtk_vbox_new(FALSE, 5);
        gtk_container_set_border_width(GTK_CONTAINER(inner_widget), 8);
        check_rle = gtk_check_button_new_with_label(_("RLE compression"));
        
        hbox_origin = gtk_hbox_new(FALSE, 5);
        label_origin = gtk_label_new(g_strconcat(_("Image origin"), ": ", NULL));
        gtk_widget_set_size_request (label_origin, 100, LABEL_H);
        
        combo_origin = gtk_combo_box_new_text();
        gtk_widget_set_size_request (combo_origin, 100, COMBO_H);
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_origin), _("Top-left"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_origin), _("Bottom-left"));
        
        if (selected_format == settings->format) {
            format_params_tga settings_tga = (format_params_tga)(settings->params);
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_rle), settings_tga->rle);
            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_origin), settings_tga->origin);
        }
        else {
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_rle), FALSE);
            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_origin), 0);
        }
        
        gtk_box_pack_start(GTK_BOX(hbox_origin), label_origin, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_origin), combo_origin, FALSE, FALSE, 0);
        
        gtk_box_pack_start(GTK_BOX(inner_widget), check_rle, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(inner_widget), hbox_origin, FALSE, FALSE, 0);
    }
    else if (selected_format == FORMAT_TIFF) {
        GtkWidget *hbox_compression, *label_compression;
        
        inner_widget = gtk_vbox_new(FALSE, 5);
        gtk_container_set_border_width(GTK_CONTAINER(inner_widget), 8);
        hbox_compression = gtk_hbox_new(FALSE, 5);
        label_compression = gtk_label_new(_("Compression"));
        gtk_widget_set_size_request (label_compression, 80, LABEL_H);
        gtk_misc_set_alignment(GTK_MISC(label_compression), 0.5, 0.5);
        combo_compression = gtk_combo_box_new_text();
        gtk_widget_set_size_request (combo_compression, 130, COMBO_H);
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_compression), _("None"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_compression), _("LZW"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_compression), _("Pack bits"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_compression), _("Deflate"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_compression), _("JPEG"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_compression), _("CCITT G3 Fax"));
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_compression), _("CCITT G4 Fax"));
        
        if (selected_format == settings->format) {
            format_params_tiff settings_tiff = (format_params_tiff)(settings->params);
            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_compression), settings_tiff->compression);
        }
        else {
            gtk_combo_box_set_active(GTK_COMBO_BOX(combo_compression), 0);
        }
        
        gtk_box_pack_start(GTK_BOX(hbox_compression), label_compression, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_compression), combo_compression, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(inner_widget), hbox_compression, FALSE, FALSE, 0);
    }
    else {
        inner_widget = gtk_label_new(_("This format has no params"));
    }
    
    if (gtk_bin_get_child(GTK_BIN(frame_params)) != NULL) {
        gtk_widget_destroy(gtk_bin_get_child(GTK_BIN(frame_params)));
    }
    gtk_container_add(GTK_CONTAINER(frame_params), inner_widget);
    gtk_widget_show_all(frame_params);
}