Пример #1
0
static void
load_dialog_resolution_callback (GimpSizeEntry *res,
                                 const gchar   *filename)
{
  SvgLoadVals  vals = { 0.0, 0, 0 };

  load_vals.resolution = vals.resolution = gimp_size_entry_get_refval (res, 0);

  if (!load_rsvg_size (filename, &vals, NULL))
    return;

  g_signal_handlers_block_by_func (size, load_dialog_size_callback, NULL);

  gimp_size_entry_set_resolution (size, 0, load_vals.resolution, FALSE);
  gimp_size_entry_set_resolution (size, 1, load_vals.resolution, FALSE);

  g_signal_handlers_unblock_by_func (size, load_dialog_size_callback, NULL);

  if (gimp_size_entry_get_unit (size) != GIMP_UNIT_PIXEL)
    {
      ratio_x = gimp_size_entry_get_refval (size, 0) / vals.width;
      ratio_y = gimp_size_entry_get_refval (size, 1) / vals.height;
    }

  svg_width  = vals.width;
  svg_height = vals.height;

  load_dialog_set_ratio (ratio_x, ratio_y);
}
Пример #2
0
static void
print_size_info_unit_changed (GtkWidget *widget)
{
  info.data->unit = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));

  print_size_info_set_page_setup (&info);
}
Пример #3
0
static void
print_size_info_size_changed (GtkWidget *widget)
{
  gdouble width;
  gdouble height;
  gdouble xres;
  gdouble yres;
  gdouble scale;

  scale = gimp_unit_get_factor (gimp_size_entry_get_unit (info.size_entry));

  width  = gimp_size_entry_get_value (info.size_entry, WIDTH);
  height = gimp_size_entry_get_value (info.size_entry, HEIGHT);

  xres = scale * info.image_width  / MAX (0.0001, width);
  yres = scale * info.image_height / MAX (0.0001, height);

  print_size_info_set_resolution (&info, xres, yres);

  info.data->offset_x = gimp_size_entry_get_refval (info.size_entry, LEFT);
  info.data->offset_y = gimp_size_entry_get_refval (info.size_entry, TOP);

  print_preview_set_image_offsets (PRINT_PREVIEW (info.preview),
                                   info.data->offset_x,
                                   info.data->offset_y);
}
Пример #4
0
static void
print_size_info_offset_max_changed (GtkAdjustment *adj,
                                    gpointer       data)
{
  guint index = GPOINTER_TO_INT (data);

  /* return early if we are called from a unit change */
  if (gimp_size_entry_get_unit (info.size_entry) != info.data->unit)
    return;

  g_signal_handlers_block_by_func (info.size_entry,
                                   print_size_info_size_changed, NULL);

  gimp_size_entry_set_value (info.size_entry, index, adj->upper - adj->value);

  g_signal_handlers_unblock_by_func (info.size_entry,
                                     print_size_info_size_changed, NULL);
}
Пример #5
0
static void
size_query_box_response (GtkWidget *widget,
                         gint       response_id,
                         QueryBox  *query_box)
{
  gdouble  size;
  GimpUnit unit;

  query_box_disconnect (query_box);

  /*  Get the sizeentry data  */
  size = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (query_box->entry), 0);
  unit = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (query_box->entry));

  /*  Call the user defined callback  */
  if (response_id == GTK_RESPONSE_OK)
    (* (GimpQuerySizeCallback) query_box->callback) (query_box->qbox,
                                                     size,
                                                     unit,
                                                     query_box->callback_data);

  query_box_destroy (query_box);
}
Пример #6
0
static void
print_size_info_center_none (void)
{
  /* return early if we are called from a unit change */
  if (gimp_size_entry_get_unit (info.size_entry) != info.data->unit)
    return;

  info.data->center = CENTER_NONE;

  if (info.center_combo)
    {
      g_signal_handlers_block_by_func (info.center_combo,
                                       print_size_info_center_changed, NULL);

      info.data->center = CENTER_NONE;

      gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (info.center_combo),
                                     info.data->center);

      g_signal_handlers_unblock_by_func (info.center_combo,
                                         print_size_info_center_changed, NULL);
    }
}