예제 #1
0
static void
gimp_ruler_class_init (GimpRulerClass *klass)
{
  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);

  object_class->dispose             = gimp_ruler_dispose;
  object_class->set_property        = gimp_ruler_set_property;
  object_class->get_property        = gimp_ruler_get_property;

  widget_class->realize             = gimp_ruler_realize;
  widget_class->unrealize           = gimp_ruler_unrealize;
  widget_class->map                 = gimp_ruler_map;
  widget_class->unmap               = gimp_ruler_unmap;
  widget_class->size_allocate       = gimp_ruler_size_allocate;
  widget_class->size_request        = gimp_ruler_size_request;
  widget_class->style_set           = gimp_ruler_style_set;
  widget_class->motion_notify_event = gimp_ruler_motion_notify;
  widget_class->expose_event        = gimp_ruler_expose;

  g_type_class_add_private (object_class, sizeof (GimpRulerPrivate));

  g_object_class_install_property (object_class,
                                   PROP_ORIENTATION,
                                   g_param_spec_enum ("orientation",
                                                      "Orientation",
                                                      "The orientation of the ruler",
                                                      GTK_TYPE_ORIENTATION,
                                                      GTK_ORIENTATION_HORIZONTAL,
                                                      GIMP_PARAM_READWRITE));

  g_object_class_install_property (object_class,
                                   PROP_LOWER,
                                   gimp_param_spec_unit ("unit",
                                                         "Unit",
                                                         "Unit of ruler",
                                                         TRUE, TRUE,
                                                         GIMP_UNIT_PIXEL,
                                                         GIMP_PARAM_READWRITE));

  g_object_class_install_property (object_class,
                                   PROP_LOWER,
                                   g_param_spec_double ("lower",
                                                        "Lower",
                                                        "Lower limit of ruler",
                                                        -G_MAXDOUBLE,
                                                        G_MAXDOUBLE,
                                                        0.0,
                                                        GIMP_PARAM_READWRITE));

  g_object_class_install_property (object_class,
                                   PROP_UPPER,
                                   g_param_spec_double ("upper",
                                                        "Upper",
                                                        "Upper limit of ruler",
                                                        -G_MAXDOUBLE,
                                                        G_MAXDOUBLE,
                                                        0.0,
                                                        GIMP_PARAM_READWRITE));

  g_object_class_install_property (object_class,
                                   PROP_POSITION,
                                   g_param_spec_double ("position",
                                                        "Position",
                                                        "Position of mark on the ruler",
                                                        -G_MAXDOUBLE,
                                                        G_MAXDOUBLE,
                                                        0.0,
                                                        GIMP_PARAM_READWRITE));

  g_object_class_install_property (object_class,
                                   PROP_MAX_SIZE,
                                   g_param_spec_double ("max-size",
                                                        "Max Size",
                                                        "Maximum size of the ruler",
                                                        -G_MAXDOUBLE,
                                                        G_MAXDOUBLE,
                                                        0.0,
                                                        GIMP_PARAM_READWRITE));

  gtk_widget_class_install_style_property (widget_class,
                                           g_param_spec_double ("font-scale",
                                                                NULL, NULL,
                                                                0.0,
                                                                G_MAXDOUBLE,
                                                                DEFAULT_RULER_FONT_SCALE,
                                                                GIMP_PARAM_READABLE));
}
예제 #2
0
void
register_unit_procs (GimpPDB *pdb)
{
  GimpProcedure *procedure;

  /*
   * gimp-unit-get-number-of-units
   */
  procedure = gimp_procedure_new (unit_get_number_of_units_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-number-of-units");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-number-of-units",
                                     "Returns the number of units.",
                                     "This procedure returns the number of defined units.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_int32 ("num-units",
                                                          "num units",
                                                          "The number of units",
                                                          G_MININT32, G_MAXINT32, 0,
                                                          GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-number-of-built-in-units
   */
  procedure = gimp_procedure_new (unit_get_number_of_built_in_units_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-number-of-built-in-units");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-number-of-built-in-units",
                                     "Returns the number of built-in units.",
                                     "This procedure returns the number of defined units built-in to GIMP.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_int32 ("num-units",
                                                          "num units",
                                                          "The number of built-in units",
                                                          G_MININT32, G_MAXINT32, 0,
                                                          GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-new
   */
  procedure = gimp_procedure_new (unit_new_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-new");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-new",
                                     "Creates a new unit and returns it's integer ID.",
                                     "This procedure creates a new unit and returns it's integer ID. Note that the new unit will have it's deletion flag set to TRUE, so you will have to set it to FALSE with 'gimp-unit-set-deletion-flag' to make it persistent.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("identifier",
                                                       "identifier",
                                                       "The new unit's identifier",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               g_param_spec_double ("factor",
                                                    "factor",
                                                    "The new unit's factor",
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
                                                    GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_int32 ("digits",
                                                      "digits",
                                                      "The new unit's digits",
                                                      G_MININT32, G_MAXINT32, 0,
                                                      GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("symbol",
                                                       "symbol",
                                                       "The new unit's symbol",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("abbreviation",
                                                       "abbreviation",
                                                       "The new unit's abbreviation",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("singular",
                                                       "singular",
                                                       "The new unit's singular form",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_string ("plural",
                                                       "plural",
                                                       "The new unit's plural form",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_unit ("unit-id",
                                                         "unit id",
                                                         "The new unit's ID",
                                                         TRUE,
                                                         FALSE,
                                                         GIMP_UNIT_PIXEL,
                                                         GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-deletion-flag
   */
  procedure = gimp_procedure_new (unit_get_deletion_flag_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-deletion-flag");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-deletion-flag",
                                     "Returns the deletion flag of the unit.",
                                     "This procedure returns the deletion flag of the unit. If this value is TRUE the unit's definition will not be saved in the user's unitrc file on gimp exit.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("deletion-flag",
                                                         "deletion flag",
                                                         "The unit's deletion flag",
                                                         FALSE,
                                                         GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-set-deletion-flag
   */
  procedure = gimp_procedure_new (unit_set_deletion_flag_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-set-deletion-flag");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-set-deletion-flag",
                                     "Sets the deletion flag of a unit.",
                                     "This procedure sets the unit's deletion flag. If the deletion flag of a unit is TRUE on gimp exit, this unit's definition will not be saved in the user's unitrc.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_argument (procedure,
                               g_param_spec_boolean ("deletion-flag",
                                                     "deletion flag",
                                                     "The new deletion flag of the unit",
                                                     FALSE,
                                                     GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-identifier
   */
  procedure = gimp_procedure_new (unit_get_identifier_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-identifier");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-identifier",
                                     "Returns the textual identifier of the unit.",
                                     "This procedure returns the textual identifier of the unit. For built-in units it will be the english singular form of the unit's name. For user-defined units this should equal to the singular form.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("identifier",
                                                           "identifier",
                                                           "The unit's textual identifier",
                                                           FALSE, FALSE, FALSE,
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-factor
   */
  procedure = gimp_procedure_new (unit_get_factor_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-factor");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-factor",
                                     "Returns the factor of the unit.",
                                     "This procedure returns the unit's factor which indicates how many units make up an inch. Note that asking for the factor of \"pixels\" will produce an error.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   g_param_spec_double ("factor",
                                                        "factor",
                                                        "The unit's factor",
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
                                                        GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-digits
   */
  procedure = gimp_procedure_new (unit_get_digits_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-digits");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-digits",
                                     "Returns the number of digits of the unit.",
                                     "This procedure returns the number of digits you should provide in input or output functions to get approximately the same accuracy as with two digits and inches. Note that asking for the digits of \"pixels\" will produce an error.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_int32 ("digits",
                                                          "digits",
                                                          "The unit's number of digits",
                                                          G_MININT32, G_MAXINT32, 0,
                                                          GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-symbol
   */
  procedure = gimp_procedure_new (unit_get_symbol_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-symbol");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-symbol",
                                     "Returns the symbol of the unit.",
                                     "This procedure returns the symbol of the unit (\"''\" for inches).",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("symbol",
                                                           "symbol",
                                                           "The unit's symbol",
                                                           FALSE, FALSE, FALSE,
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-abbreviation
   */
  procedure = gimp_procedure_new (unit_get_abbreviation_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-abbreviation");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-abbreviation",
                                     "Returns the abbreviation of the unit.",
                                     "This procedure returns the abbreviation of the unit (\"in\" for inches).",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("abbreviation",
                                                           "abbreviation",
                                                           "The unit's abbreviation",
                                                           FALSE, FALSE, FALSE,
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-singular
   */
  procedure = gimp_procedure_new (unit_get_singular_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-singular");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-singular",
                                     "Returns the singular form of the unit.",
                                     "This procedure returns the singular form of the unit.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("singular",
                                                           "singular",
                                                           "The unit's singular form",
                                                           FALSE, FALSE, FALSE,
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * gimp-unit-get-plural
   */
  procedure = gimp_procedure_new (unit_get_plural_invoker);
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
                               "gimp-unit-get-plural");
  gimp_procedure_set_static_strings (procedure,
                                     "gimp-unit-get-plural",
                                     "Returns the plural form of the unit.",
                                     "This procedure returns the plural form of the unit.",
                                     "Michael Natterer <*****@*****.**>",
                                     "Michael Natterer",
                                     "1999",
                                     NULL);
  gimp_procedure_add_argument (procedure,
                               gimp_param_spec_unit ("unit-id",
                                                     "unit id",
                                                     "The unit's integer ID",
                                                     TRUE,
                                                     FALSE,
                                                     GIMP_UNIT_PIXEL,
                                                     GIMP_PARAM_READWRITE));
  gimp_procedure_add_return_value (procedure,
                                   gimp_param_spec_string ("plural",
                                                           "plural",
                                                           "The unit's plural form",
                                                           FALSE, FALSE, FALSE,
                                                           NULL,
                                                           GIMP_PARAM_READWRITE));
  gimp_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);
}