mirror of https://github.com/GNOME/gimp.git
tools/pdbgen/pdb/guides.pdb fixed a bug in image_find_next_guide
* tools/pdbgen/pdb/guides.pdb * app/guides_cmds.c: fixed a bug in image_find_next_guide * plug-ins/xjt: reflect the name change of gimp_image_find_next_guide * app/interface.c: applied the patch from Shuji Narazaki <narazaki@gimp.org> that allows to open images by dropping them onto the toolbar --Sven
This commit is contained in:
parent
0be340efed
commit
6b56a53703
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Thu Jul 1 10:29:44 MEST 1999 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/guides.pdb
|
||||
* app/guides_cmds.c: fixed a bug in image_find_next_guide
|
||||
|
||||
* plug-ins/xjt: reflect the name change of gimp_image_find_next_guide
|
||||
|
||||
* app/interface.c: applied the patch from
|
||||
Shuji Narazaki <narazaki@gimp.org> that allows to open images by
|
||||
dropping them onto the toolbar
|
||||
|
||||
1999-06-30 Tuomas Kuosmanen <tigert@gimp.org>
|
||||
|
||||
* gimp1_1_splash.ppm: Dont even ask what this is :)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "actionarea.h"
|
||||
#include "app_procs.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "errors.h"
|
||||
#include "fileops.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimage.h"
|
||||
|
@ -73,6 +75,15 @@ static GdkPixmap *create_pixmap (GdkWindow *parent,
|
|||
char **data,
|
||||
int width,
|
||||
int height);
|
||||
static void gimp_set_drop_open (GtkWidget *);
|
||||
static void gimp_dnd_data_received (GtkWidget *,
|
||||
GdkDragContext *,
|
||||
gint,
|
||||
gint,
|
||||
GtkSelectionData *,
|
||||
guint,
|
||||
guint);
|
||||
static gint gimp_dnd_open_files (gchar *);
|
||||
|
||||
static int pixmap_colors[8][3] =
|
||||
{
|
||||
|
@ -101,6 +112,21 @@ GtkTooltips * tool_tips;
|
|||
static GdkColor colors[12];
|
||||
static GtkWidget * toolbox_shell = NULL;
|
||||
|
||||
enum {
|
||||
TARGET_URI_LIST,
|
||||
TARGET_TEXT_PLAIN,
|
||||
} TargetType;
|
||||
|
||||
static
|
||||
GtkTargetEntry dnd_target_table[] =
|
||||
{
|
||||
{ "text/uri-list", 0, TARGET_URI_LIST },
|
||||
{ "text/plain", 0, TARGET_TEXT_PLAIN }
|
||||
};
|
||||
|
||||
static guint
|
||||
dnd_n_targets = sizeof(dnd_target_table) / sizeof(dnd_target_table[0]);
|
||||
|
||||
static void
|
||||
tools_select_update (GtkWidget *w,
|
||||
gpointer data)
|
||||
|
@ -549,7 +575,7 @@ create_toolbox ()
|
|||
if (show_indicators && (!no_data) )
|
||||
create_indicator_area (vbox);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gimp_set_drop_open (window);
|
||||
|
||||
toolbox_shell = window;
|
||||
}
|
||||
|
@ -1332,3 +1358,74 @@ message_box_close_callback (GtkWidget *w,
|
|||
|
||||
g_free (msg_box);
|
||||
}
|
||||
|
||||
/* DnD functions */
|
||||
static void
|
||||
gimp_set_drop_open (GtkWidget *object)
|
||||
{
|
||||
gtk_drag_dest_set (object,
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
dnd_target_table, dnd_n_targets,
|
||||
GDK_ACTION_COPY);
|
||||
gtk_signal_connect (GTK_OBJECT (object),
|
||||
"drag_data_received",
|
||||
GTK_SIGNAL_FUNC (gimp_dnd_data_received),
|
||||
object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dnd_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *data,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
switch (context->action)
|
||||
{
|
||||
case GDK_ACTION_DEFAULT:
|
||||
case GDK_ACTION_COPY:
|
||||
case GDK_ACTION_MOVE:
|
||||
case GDK_ACTION_LINK:
|
||||
case GDK_ACTION_ASK:
|
||||
default:
|
||||
gimp_dnd_open_files ((gchar *) data->data);
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static gint
|
||||
gimp_dnd_open_files (gchar *buffer)
|
||||
{
|
||||
gchar name_buffer[1024];
|
||||
const gchar *data_type = "file:";
|
||||
const gint sig_len = strlen (data_type);
|
||||
|
||||
while (*buffer)
|
||||
{
|
||||
gchar *name = name_buffer;
|
||||
gint len = 0;
|
||||
|
||||
while ((*buffer != 0) && (*buffer != '\n'))
|
||||
{
|
||||
*name++ = *buffer++;
|
||||
len++;
|
||||
}
|
||||
if (len == 0)
|
||||
break;
|
||||
if (*(name - 1) == 0xd)
|
||||
*(name - 1) = 0;
|
||||
name = name_buffer;
|
||||
if ((sig_len < len) && (! strncmp (name, data_type, sig_len)))
|
||||
name += sig_len;
|
||||
|
||||
file_open (name, name);
|
||||
|
||||
if (*buffer)
|
||||
buffer++;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "actionarea.h"
|
||||
#include "app_procs.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "errors.h"
|
||||
#include "fileops.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimage.h"
|
||||
|
@ -73,6 +75,15 @@ static GdkPixmap *create_pixmap (GdkWindow *parent,
|
|||
char **data,
|
||||
int width,
|
||||
int height);
|
||||
static void gimp_set_drop_open (GtkWidget *);
|
||||
static void gimp_dnd_data_received (GtkWidget *,
|
||||
GdkDragContext *,
|
||||
gint,
|
||||
gint,
|
||||
GtkSelectionData *,
|
||||
guint,
|
||||
guint);
|
||||
static gint gimp_dnd_open_files (gchar *);
|
||||
|
||||
static int pixmap_colors[8][3] =
|
||||
{
|
||||
|
@ -101,6 +112,21 @@ GtkTooltips * tool_tips;
|
|||
static GdkColor colors[12];
|
||||
static GtkWidget * toolbox_shell = NULL;
|
||||
|
||||
enum {
|
||||
TARGET_URI_LIST,
|
||||
TARGET_TEXT_PLAIN,
|
||||
} TargetType;
|
||||
|
||||
static
|
||||
GtkTargetEntry dnd_target_table[] =
|
||||
{
|
||||
{ "text/uri-list", 0, TARGET_URI_LIST },
|
||||
{ "text/plain", 0, TARGET_TEXT_PLAIN }
|
||||
};
|
||||
|
||||
static guint
|
||||
dnd_n_targets = sizeof(dnd_target_table) / sizeof(dnd_target_table[0]);
|
||||
|
||||
static void
|
||||
tools_select_update (GtkWidget *w,
|
||||
gpointer data)
|
||||
|
@ -549,7 +575,7 @@ create_toolbox ()
|
|||
if (show_indicators && (!no_data) )
|
||||
create_indicator_area (vbox);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gimp_set_drop_open (window);
|
||||
|
||||
toolbox_shell = window;
|
||||
}
|
||||
|
@ -1332,3 +1358,74 @@ message_box_close_callback (GtkWidget *w,
|
|||
|
||||
g_free (msg_box);
|
||||
}
|
||||
|
||||
/* DnD functions */
|
||||
static void
|
||||
gimp_set_drop_open (GtkWidget *object)
|
||||
{
|
||||
gtk_drag_dest_set (object,
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
dnd_target_table, dnd_n_targets,
|
||||
GDK_ACTION_COPY);
|
||||
gtk_signal_connect (GTK_OBJECT (object),
|
||||
"drag_data_received",
|
||||
GTK_SIGNAL_FUNC (gimp_dnd_data_received),
|
||||
object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dnd_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *data,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
switch (context->action)
|
||||
{
|
||||
case GDK_ACTION_DEFAULT:
|
||||
case GDK_ACTION_COPY:
|
||||
case GDK_ACTION_MOVE:
|
||||
case GDK_ACTION_LINK:
|
||||
case GDK_ACTION_ASK:
|
||||
default:
|
||||
gimp_dnd_open_files ((gchar *) data->data);
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static gint
|
||||
gimp_dnd_open_files (gchar *buffer)
|
||||
{
|
||||
gchar name_buffer[1024];
|
||||
const gchar *data_type = "file:";
|
||||
const gint sig_len = strlen (data_type);
|
||||
|
||||
while (*buffer)
|
||||
{
|
||||
gchar *name = name_buffer;
|
||||
gint len = 0;
|
||||
|
||||
while ((*buffer != 0) && (*buffer != '\n'))
|
||||
{
|
||||
*name++ = *buffer++;
|
||||
len++;
|
||||
}
|
||||
if (len == 0)
|
||||
break;
|
||||
if (*(name - 1) == 0xd)
|
||||
*(name - 1) = 0;
|
||||
name = name_buffer;
|
||||
if ((sig_len < len) && (! strncmp (name, data_type, sig_len)))
|
||||
name += sig_len;
|
||||
|
||||
file_open (name, name);
|
||||
|
||||
if (*buffer)
|
||||
buffer++;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -319,8 +319,10 @@ image_find_next_guide_invoker (Argument *args)
|
|||
while (tmplist && (((Guide *) tmplist->data)->position < 0))
|
||||
tmplist = tmplist->next;
|
||||
|
||||
if (tmplist);
|
||||
next_guide = ((Guide *) tmplist->data)->guide_ID;
|
||||
if (tmplist)
|
||||
next_guide = ((Guide *) tmplist->data)->guide_ID;
|
||||
else
|
||||
next_guide = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "appenv.h"
|
||||
#include "actionarea.h"
|
||||
#include "app_procs.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "errors.h"
|
||||
#include "fileops.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimage.h"
|
||||
|
@ -73,6 +75,15 @@ static GdkPixmap *create_pixmap (GdkWindow *parent,
|
|||
char **data,
|
||||
int width,
|
||||
int height);
|
||||
static void gimp_set_drop_open (GtkWidget *);
|
||||
static void gimp_dnd_data_received (GtkWidget *,
|
||||
GdkDragContext *,
|
||||
gint,
|
||||
gint,
|
||||
GtkSelectionData *,
|
||||
guint,
|
||||
guint);
|
||||
static gint gimp_dnd_open_files (gchar *);
|
||||
|
||||
static int pixmap_colors[8][3] =
|
||||
{
|
||||
|
@ -101,6 +112,21 @@ GtkTooltips * tool_tips;
|
|||
static GdkColor colors[12];
|
||||
static GtkWidget * toolbox_shell = NULL;
|
||||
|
||||
enum {
|
||||
TARGET_URI_LIST,
|
||||
TARGET_TEXT_PLAIN,
|
||||
} TargetType;
|
||||
|
||||
static
|
||||
GtkTargetEntry dnd_target_table[] =
|
||||
{
|
||||
{ "text/uri-list", 0, TARGET_URI_LIST },
|
||||
{ "text/plain", 0, TARGET_TEXT_PLAIN }
|
||||
};
|
||||
|
||||
static guint
|
||||
dnd_n_targets = sizeof(dnd_target_table) / sizeof(dnd_target_table[0]);
|
||||
|
||||
static void
|
||||
tools_select_update (GtkWidget *w,
|
||||
gpointer data)
|
||||
|
@ -549,7 +575,7 @@ create_toolbox ()
|
|||
if (show_indicators && (!no_data) )
|
||||
create_indicator_area (vbox);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gimp_set_drop_open (window);
|
||||
|
||||
toolbox_shell = window;
|
||||
}
|
||||
|
@ -1332,3 +1358,74 @@ message_box_close_callback (GtkWidget *w,
|
|||
|
||||
g_free (msg_box);
|
||||
}
|
||||
|
||||
/* DnD functions */
|
||||
static void
|
||||
gimp_set_drop_open (GtkWidget *object)
|
||||
{
|
||||
gtk_drag_dest_set (object,
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
dnd_target_table, dnd_n_targets,
|
||||
GDK_ACTION_COPY);
|
||||
gtk_signal_connect (GTK_OBJECT (object),
|
||||
"drag_data_received",
|
||||
GTK_SIGNAL_FUNC (gimp_dnd_data_received),
|
||||
object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dnd_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *data,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
switch (context->action)
|
||||
{
|
||||
case GDK_ACTION_DEFAULT:
|
||||
case GDK_ACTION_COPY:
|
||||
case GDK_ACTION_MOVE:
|
||||
case GDK_ACTION_LINK:
|
||||
case GDK_ACTION_ASK:
|
||||
default:
|
||||
gimp_dnd_open_files ((gchar *) data->data);
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static gint
|
||||
gimp_dnd_open_files (gchar *buffer)
|
||||
{
|
||||
gchar name_buffer[1024];
|
||||
const gchar *data_type = "file:";
|
||||
const gint sig_len = strlen (data_type);
|
||||
|
||||
while (*buffer)
|
||||
{
|
||||
gchar *name = name_buffer;
|
||||
gint len = 0;
|
||||
|
||||
while ((*buffer != 0) && (*buffer != '\n'))
|
||||
{
|
||||
*name++ = *buffer++;
|
||||
len++;
|
||||
}
|
||||
if (len == 0)
|
||||
break;
|
||||
if (*(name - 1) == 0xd)
|
||||
*(name - 1) = 0;
|
||||
name = name_buffer;
|
||||
if ((sig_len < len) && (! strncmp (name, data_type, sig_len)))
|
||||
name += sig_len;
|
||||
|
||||
file_open (name, name);
|
||||
|
||||
if (*buffer)
|
||||
buffer++;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -495,7 +495,7 @@ gint32 p_gimp_image_add_guide(gint32 image_id, gint32 position, gint32 orienta
|
|||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
if(orientation == 0 ) /* in GIMP 1.1 we could use (orientation == ORIENTATION_VERTICAL) */
|
||||
if(orientation != 1 ) /* in GIMP 1.1 we could use (orientation != ORIENTATION_HORIZONTAL) */
|
||||
{
|
||||
l_add_guide_proc = "gimp_image_add_vguide";
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ gint32 p_gimp_image_add_guide(gint32 image_id, gint32 position, gint32 orienta
|
|||
|
||||
gint32 p_gimp_image_findnext_guide(gint32 image_id, gint32 guide_id)
|
||||
{
|
||||
static char *l_findnext_guide_proc = "gimp_image_findnext_guide";
|
||||
static char *l_findnext_guide_proc = "gimp_image_find_next_guide";
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
|
@ -630,6 +630,10 @@ gint p_gimp_image_get_guide_orientation(gint32 image_id, gint32 guide_id)
|
|||
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
{
|
||||
if(return_vals[1].data.d_int32 != 1) /* in GIMP 1.1 we could use (orientation != ORIENTATION_HORIZONTAL) */
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
return(return_vals[1].data.d_int32); /* return the guide orientation */
|
||||
}
|
||||
printf("XJT: Error: PDB call of %s failed\n", l_get_guide_pos_orient);
|
||||
|
|
|
@ -182,8 +182,10 @@ HELP
|
|||
while (tmplist && (((Guide *) tmplist->data)->position < 0))
|
||||
tmplist = tmplist->next;
|
||||
|
||||
if (tmplist);
|
||||
next_guide = ((Guide *) tmplist->data)->guide_ID;
|
||||
if (tmplist)
|
||||
next_guide = ((Guide *) tmplist->data)->guide_ID;
|
||||
else
|
||||
next_guide = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue