Пример #1
0
static void
toggle_preview_cb(GtkWidget *widget, GridDialog_t *param)
{
   param->enable_preview =
      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
   preview_redraw();
}
Пример #2
0
static void
select_release(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
   SelectRegionCommand_t *command = (SelectRegionCommand_t*) data;
   Object_t *obj = command->obj;
   Rectangle_t *rectangle = ObjectToRectangle(obj);
   gpointer id;
   gint count;

   g_signal_handlers_disconnect_by_func(widget,
                                        select_motion, data);
   g_signal_handlers_disconnect_by_func(widget,
                                        select_release, data);

   object_normalize(obj);

   id = object_list_add_select_cb(command->list, select_one_object, command);
   count = object_list_select_region(command->list, rectangle->x, rectangle->y,
                                     rectangle->width, rectangle->height);
   object_list_remove_select_cb(command->list, id);

   if (count) {
      command_list_add(&command->parent);
   } else {                     /* Nothing selected */
      if (command->unselect_command->sub_commands)
         command_list_add(&command->parent);
   }
   preview_unset_tmp_obj (command->obj);

   preview_redraw ();
}
void preview_clicked(GtkWidget *widget, gpointer data)
{
    if (!dialog_is_init) return;
    if (local_vals.prev == 0)
    {
        local_vals.prev = 1;
        gtk_button_set_label(GTK_BUTTON(widget), "Preview On");
        preview_redraw();
    }
    else
    {
        local_vals.prev = 0;
        gtk_button_set_label(GTK_BUTTON(widget), "Preview Off");

        // html color: #f2f1f0
        gimp_preview_area_fill(GIMP_PREVIEW_AREA(pDrawables.preview_d), 0, 0, PREVIEW_SIZE, PREVIEW_SIZE, 0xF2, 0xF1, 0xF0);
        gimp_preview_area_fill(GIMP_PREVIEW_AREA(pDrawables.preview_ao), 0, 0, PREVIEW_SIZE, PREVIEW_SIZE, 0xF2, 0xF1, 0xF0);
        gimp_preview_area_fill(GIMP_PREVIEW_AREA(pDrawables.preview_s), 0, 0, PREVIEW_SIZE, PREVIEW_SIZE, 0xF2, 0xF1, 0xF0);
        gimp_preview_area_fill(GIMP_PREVIEW_AREA(pDrawables.preview_p), 0, 0, PREVIEW_SIZE, PREVIEW_SIZE, 0xF2, 0xF1, 0xF0);
        gimp_preview_area_fill(GIMP_PREVIEW_AREA(pDrawables.preview_n), 0, 0, PREVIEW_SIZE, PREVIEW_SIZE, 0xF2, 0xF1, 0xF0);

        _active = 'x';
        return;
    }
}
Пример #4
0
static void
grid_assign_value(GtkWidget *widget, gpointer data, gint *value)
{
   GridDialog_t *dialog = (GridDialog_t*) data;
   if (dialog->enable_preview) {
      *value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
      preview_redraw();         /* Fix me! */
   }
}
Пример #5
0
static void
type_toggled_cb(GtkWidget *widget, gpointer data)
{
   if (gtk_widget_get_state (widget) & GTK_STATE_SELECTED)
     {
       grid_type = GPOINTER_TO_INT (data);
       preview_redraw();
     }
}
Пример #6
0
void
preview_zoom(Preview_t *preview, gint zoom_factor)
{
   preview->widget_width = preview->width * zoom_factor;
   preview->widget_height = preview->height * zoom_factor;
   gtk_widget_set_size_request (preview->preview, preview->widget_width,
                                preview->widget_height);
   gtk_widget_queue_resize(preview->window);
   render_preview(preview, &preview->src_rgn);
   preview_redraw();
}
Пример #7
0
static void
select_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data)
{
   SelectRegionCommand_t *command = (SelectRegionCommand_t*) data;
   Object_t *obj = command->obj;
   Rectangle_t *rectangle = ObjectToRectangle(obj);

   gint x = get_real_coord((gint) event->x);
   gint y = get_real_coord((gint) event->y);

   rectangle->width = x - rectangle->x;
   rectangle->height = y - rectangle->y;

   preview_redraw ();
}
Пример #8
0
static gint idle_callback(gpointer data)
{
   if ((update_preview) && (_active == 'x'))
   {
        preview_redraw();
   }
   if (preview_progress_reset == 0) {
       if (preview_progress_timer < 5) {
           preview_progress_timer++;
       } else {
           preview_progress_reset = 1;
           preview_progress_timer = 0 ;
           gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.0);
       }
   }
   return(1);
}
void preview_clicked_supernormal(GtkWidget *widget, gpointer data)
{
    if (!dialog_is_init) return;
    if (local_vals.prev == 0) return;
    int nChecked = 0 ;
    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == TRUE) nChecked = 1;
    
    if ((local_vals.prev == 1) && (nChecked == 1))
    {
        GtkWidget *gLabelWidge = gtk_frame_get_label_widget(GTK_FRAME(g_gwNormalsFrame));
        gtk_label_set_text(GTK_LABEL(gLabelWidge), "Super Normal");
        gcNeedNormal = 's';
        preview_redraw();
    }
    else if ((local_vals.prev == 1) && (nChecked == 0))
    {
        return;
    }
}
Пример #10
0
static void
grid_settings_ok_cb(gpointer data)
{
   GridDialog_t *param = (GridDialog_t*) data;
   gboolean new_snap;

   new_snap = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->snap));
   grid_width = gtk_spin_button_get_value_as_int(
      GTK_SPIN_BUTTON(param->width));
   grid_height = gtk_spin_button_get_value_as_int(
      GTK_SPIN_BUTTON(param->height));
   grid_left = gtk_spin_button_get_value_as_int(
      GTK_SPIN_BUTTON(param->left));
   grid_top = gtk_spin_button_get_value_as_int(
      GTK_SPIN_BUTTON(param->top));

   if (grid_snap != new_snap) {
      grid_snap = new_snap;
      menu_check_grid(grid_snap);
   }
   preview_redraw();
}
Пример #11
0
void
toggle_grid(void)
{
   grid_snap = !grid_snap;
   preview_redraw();
}
/**
 * Set all the usable values to the startup default
 * values.  Take care here to preserve the image ID.  The copyPlugInVals
 * function strips out the image ID.
 * 
 * @param widget - not used but required by gtk signal
 * @param data   - not used but required by gtk signal
 */
void restore_defaults_clicked(GtkWidget *widget, gpointer data)
{
    PlugInVals pivTemp;
    if (!dialog_is_init) return;

    copyPlugInVals(&local_vals, &pivTemp);
    copyPlugInVals(&default_vals, &local_vals);
    /** Restore Button Toggles. */
    if (pivTemp.RemoveLighting != local_vals.RemoveLighting) {
        /** Toggle the Remove Lighting button. */
        gtk_button_clicked(GTK_BUTTON(g_gwRemoveLtgBtn));
        remlightbtn_clicked(g_gwRemoveLtgBtn, NULL);
    }
    if (pivTemp.Resizie != local_vals.Resizie) {
        /** Toggle the Upscale(HD) button. */
        gtk_button_clicked(GTK_BUTTON(g_gwUpscaleBtn));
        upscale_HD_clicked(g_gwUpscaleBtn, NULL);
    }
    if (pivTemp.Tile != local_vals.Tile) {
        /** Toggle the Tile button. */
        gtk_button_clicked(GTK_BUTTON(g_gwTileBtn));
        tile_clicked(g_gwTileBtn, NULL);
    }
    if (pivTemp.EdgeSpecular != local_vals.EdgeSpecular) {
        /** Toggle the Edge Specular Map button. */
        gtk_button_clicked(GTK_BUTTON(g_gwEdgeBtn));
        edge_enhancing_specular_clicked(g_gwEdgeBtn, NULL);
    }
    if (pivTemp.smoothstep != local_vals.smoothstep) {
        /** Toggle the Smooth Step button. */
        gtk_button_clicked(GTK_BUTTON(g_gwSmoothBtn));
        smooth_step_clicked(g_gwSmoothBtn, NULL);
    }
    if (pivTemp.Noise != local_vals.Noise) {
        /** Toggle the Noise button. */
        gtk_button_clicked(GTK_BUTTON(g_gwNoiseBtn));
        noise_clicked(g_gwNoiseBtn, NULL);
    }
    if (pivTemp.invh != local_vals.invh) {
        /** Toggle the Invert Height Map button. */
        gtk_button_clicked(GTK_BUTTON(g_gwInvertBtn));
        invert_height_map_clicked(g_gwInvertBtn, NULL);
    }
    /** Restore spinner edit controls. */
    if (pivTemp.Depth != local_vals.Depth) {
        GtkAdjustment * gaTemp = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(g_gwDepthSpin));
        gtk_adjustment_set_value(GTK_ADJUSTMENT(gaTemp), (gdouble)local_vals.Depth);
    }
    if (pivTemp.LargeDetails != local_vals.LargeDetails) {
        GtkAdjustment * gaTemp = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(g_gwLargeDSpin));
        gtk_adjustment_set_value(GTK_ADJUSTMENT(gaTemp), (gdouble)local_vals.LargeDetails);
    }
    if (pivTemp.MediumDetails != local_vals.MediumDetails) {
        GtkAdjustment * gaTemp = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(g_gwMediumDSpin));
        gtk_adjustment_set_value(GTK_ADJUSTMENT(gaTemp), (gdouble)local_vals.MediumDetails);
    }
    if (pivTemp.SmallDetails != local_vals.SmallDetails) {
        GtkAdjustment * gaTemp = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(g_gwSmallDSpin));
        gtk_adjustment_set_value(GTK_ADJUSTMENT(gaTemp), (gdouble)local_vals.SmallDetails);
    }
    if (pivTemp.ShapeRecog != local_vals.ShapeRecog) {
        GtkAdjustment * gaTemp = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(g_gwShapeSpin));
        gtk_adjustment_set_value(GTK_ADJUSTMENT(gaTemp), (gdouble)local_vals.ShapeRecog);
    }
    if (pivTemp.ao != local_vals.ao) {
        GtkAdjustment * gaTemp = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(g_gwAOSpin));
        gtk_adjustment_set_value(GTK_ADJUSTMENT(gaTemp), (gdouble)local_vals.ao);
    }
    if (pivTemp.defSpecular != local_vals.defSpecular) {
        GtkAdjustment * gaTemp = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(g_gwSpecDefSpin));
        gtk_adjustment_set_value(GTK_ADJUSTMENT(gaTemp), (gdouble)local_vals.defSpecular);
    }
    if (pivTemp.newWidth != local_vals.newWidth) {
        GtkAdjustment * gaTemp = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(g_gwWidthSpin));
        gtk_adjustment_set_value(GTK_ADJUSTMENT(gaTemp), (gdouble)local_vals.newWidth);
    }
    copyPlugInVals(&default_vals, &local_vals);
    local_vals.image_ID = pivTemp.image_ID;
    local_vals.prev = pivTemp.prev;
    
    if (local_vals.prev == 1)
    {
        preview_redraw();
    }
}