Commit 7c64198e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added GimpFont DND.

2003-03-26  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdnd.[ch]: added GimpFont DND.
parent ac014ecf
2003-03-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdnd.[ch]: added GimpFont DND.
2003-03-26 Michael Natterer <mitch@gimp.org>
 
* app/gui/image-menu.c
......@@ -45,6 +45,8 @@
#include "core/gimppattern.h"
#include "core/gimptoolinfo.h"
#include "text/gimpfont.h"
#include "vectors/gimpvectors.h"
#include "file/file-open.h"
......@@ -172,6 +174,12 @@ static void gimp_dnd_set_palette_data (GtkWidget *widget,
guchar *vals,
gint format,
gint length);
static void gimp_dnd_set_font_data (GtkWidget *widget,
GCallback set_font_func,
gpointer set_font_data,
guchar *vals,
gint format,
gint length);
static void gimp_dnd_set_buffer_data (GtkWidget *widget,
GCallback set_buffer_func,
gpointer set_buffer_data,
......@@ -360,6 +368,17 @@ static GimpDndDataDef dnd_data_defs[] =
gimp_dnd_set_palette_data
},
{
GIMP_TARGET_FONT,
"gimp_dnd_set_font_func",
"gimp_dnd_set_font_data",
gimp_dnd_get_viewable_icon,
gimp_dnd_get_data_data,
gimp_dnd_set_font_data
},
{
GIMP_TARGET_BUFFER,
......@@ -1148,6 +1167,10 @@ gimp_dnd_data_type_get_by_g_type (GType type)
{
dnd_type = GIMP_DND_TYPE_PALETTE;
}
else if (g_type_is_a (type, GIMP_TYPE_FONT))
{
dnd_type = GIMP_DND_TYPE_FONT;
}
else if (g_type_is_a (type, GIMP_TYPE_BUFFER))
{
dnd_type = GIMP_DND_TYPE_BUFFER;
......@@ -1629,6 +1652,42 @@ gimp_dnd_set_palette_data (GtkWidget *widget,
}
/************************/
/* font dnd functions */
/************************/
static void
gimp_dnd_set_font_data (GtkWidget *widget,
GCallback set_font_func,
gpointer set_font_data,
guchar *vals,
gint format,
gint length)
{
GimpFont *font;
gchar *name;
if ((format != 8) || (length < 1))
{
g_warning ("Received invalid font data\n");
return;
}
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
font = gimp_font_get_standard ();
else
font = (GimpFont *)
gimp_container_get_child_by_name (the_gimp->fonts, name);
if (font)
(* (GimpDndDropViewableFunc) set_font_func) (widget,
GIMP_VIEWABLE (font),
set_font_data);
}
/**************************/
/* buffer dnd functions */
/**************************/
......
......@@ -37,10 +37,11 @@ typedef enum
GIMP_DND_TYPE_PATTERN = 12,
GIMP_DND_TYPE_GRADIENT = 13,
GIMP_DND_TYPE_PALETTE = 14,
GIMP_DND_TYPE_BUFFER = 15,
GIMP_DND_TYPE_IMAGEFILE = 16,
GIMP_DND_TYPE_TOOL = 17,
GIMP_DND_TYPE_DIALOG = 18,
GIMP_DND_TYPE_FONT = 15,
GIMP_DND_TYPE_BUFFER = 16,
GIMP_DND_TYPE_IMAGEFILE = 17,
GIMP_DND_TYPE_TOOL = 18,
GIMP_DND_TYPE_DIALOG = 19,
GIMP_DND_TYPE_LAST = GIMP_DND_TYPE_DIALOG
} GimpDndType;
......@@ -88,6 +89,9 @@ typedef enum
#define GIMP_TARGET_PALETTE \
{ "GIMP_PALETTE", 0, GIMP_DND_TYPE_PALETTE }
#define GIMP_TARGET_FONT \
{ "GIMP_FONT", 0, GIMP_DND_TYPE_FONT }
#define GIMP_TARGET_BUFFER \
{ "GIMP_BUFFER", GTK_TARGET_SAME_APP, GIMP_DND_TYPE_BUFFER }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment