1998-11-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
* Makefile.in: Removed gtrans.c from the list of sources. * gdesktop-icon.c: #ifdef cleanups. * gscreen.c (panel_create_file_list): Doh. Return the scrolled window, not the clist. * gdnd.c (get_action): Implement the DnD actions menu. 1998-11-10 Federico Mena Quintero <federico@nuclecu.unam.mx> * setup.c: Removed the icons_snap_to_grid and want_transparent_{icons,text} options.
Этот коммит содержится в:
родитель
d493c369f9
Коммит
c346f8892e
@ -1,3 +1,14 @@
|
||||
1998-11-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* Makefile.in: Removed gtrans.c from the list of sources.
|
||||
|
||||
* gdesktop-icon.c: #ifdef cleanups.
|
||||
|
||||
* gscreen.c (panel_create_file_list): Doh. Return the scrolled
|
||||
window, not the clist.
|
||||
|
||||
* gdnd.c (get_action): Implement the DnD actions menu.
|
||||
|
||||
1998-11-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gdnd.c: New file that handles all the DnD stuff. Mainly used to
|
||||
|
@ -29,7 +29,6 @@ GNOMESRCS = \
|
||||
gtools.c \
|
||||
gdesktop.c \
|
||||
gutil.c \
|
||||
gtrans.c \
|
||||
gview.c \
|
||||
gcmd.c \
|
||||
gprop.c \
|
||||
@ -98,7 +97,6 @@ OBJS = $(LOBJS) $(OOBJS) \
|
||||
glayout.o \
|
||||
gtools.o \
|
||||
gdesktop.o \
|
||||
gtrans.o \
|
||||
gutil.o \
|
||||
gcmd.o \
|
||||
gmc-chargrid.o \
|
||||
|
@ -230,11 +230,7 @@ set_text (DesktopIcon *dicon, char *text)
|
||||
|
||||
gnome_icon_text_item_configure (GNOME_ICON_TEXT_ITEM (dicon->text),
|
||||
0, icon_height + SPACING,
|
||||
#if 1
|
||||
DESKTOP_SNAP_X,
|
||||
#else
|
||||
SNAP_X,
|
||||
#endif
|
||||
DESKTOP_ICON_FONT,
|
||||
text,
|
||||
TRUE);
|
||||
@ -333,11 +329,8 @@ create_window_shape (DesktopIcon *dicon, int icon_width, int icon_height, int te
|
||||
im = GNOME_CANVAS_IMAGE (dicon->icon)->im;
|
||||
gdk_imlib_render (im, icon_width, icon_height);
|
||||
im_mask = gdk_imlib_move_mask (im);
|
||||
#if 1
|
||||
|
||||
if (im_mask && desktop_use_shaped_icons) {
|
||||
#else
|
||||
if (im_mask && want_transparent_icons) {
|
||||
#endif
|
||||
gdk_draw_pixmap (mask,
|
||||
mgc,
|
||||
im_mask,
|
||||
@ -399,11 +392,8 @@ desktop_icon_reshape (DesktopIcon *dicon)
|
||||
text_height = y2 - y1 + 1;
|
||||
|
||||
/* Calculate new size of widget */
|
||||
#if 1
|
||||
|
||||
dicon->width = MAX (icon_width, DESKTOP_SNAP_X);
|
||||
#else
|
||||
dicon->width = MAX (icon_width, SNAP_X);
|
||||
#endif
|
||||
dicon->height = icon_height + SPACING + text_height;
|
||||
|
||||
/* Set new position of children */
|
||||
|
@ -35,8 +35,6 @@
|
||||
#include "gmetadata.h"
|
||||
#include "../vfs/vfs.h"
|
||||
|
||||
/* use grid? */
|
||||
int icons_snap_to_grid = 1;
|
||||
|
||||
/* Name of the user's desktop directory (i.e. ~/desktop) */
|
||||
#define DESKTOP_DIR_NAME "desktop"
|
||||
|
@ -25,7 +25,6 @@ extern int desktop_snap_icons; /* Whether to snap icons to the grid or not */
|
||||
|
||||
extern int want_transparent_icons;
|
||||
extern int want_transparent_text;
|
||||
extern int icons_snap_to_grid;
|
||||
|
||||
/* Initializes the desktop -- init DnD, load the default desktop icons, etc. */
|
||||
void desktop_init (void);
|
||||
@ -62,7 +61,6 @@ typedef struct {
|
||||
int grid_x, grid_y;
|
||||
char *pathname;
|
||||
} desktop_icon_t;
|
||||
GtkWidget *make_transparent_window (char *file);
|
||||
|
||||
#else
|
||||
|
||||
|
43
gnome/gdnd.c
43
gnome/gdnd.c
@ -8,22 +8,55 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <sys/stat.h>
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include "gdnd.h"
|
||||
#include "file.h"
|
||||
#include "main.h"
|
||||
#include "panel.h"
|
||||
#include "gscreen.h"
|
||||
#include "../vfs/vfs.h"
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include "gdnd.h"
|
||||
|
||||
|
||||
/* The menu of DnD actions */
|
||||
static GnomeUIInfo actions[] = {
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Move here"), NULL, NULL),
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Copy here"), NULL, NULL),
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Link here"), NULL, NULL),
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
GNOMEUIINFO_ITEM_NONE (N_("Cancel drag"), NULL, NULL)
|
||||
};
|
||||
|
||||
/* Pops up a menu of actions to perform on dropped files */
|
||||
static GdkDragAction
|
||||
get_action (void)
|
||||
{
|
||||
/* FIXME */
|
||||
printf ("Should query for the action!\n");
|
||||
return GDK_ACTION_LINK;
|
||||
GtkWidget *menu;
|
||||
int a;
|
||||
GdkDragAction action;
|
||||
|
||||
menu = gnome_popup_menu_new (actions);
|
||||
a = gnome_popup_menu_do_popup_modal (menu, NULL, NULL, NULL, NULL);
|
||||
|
||||
switch (action) {
|
||||
case 0:
|
||||
action = GDK_ACTION_MOVE;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
action = GDK_ACTION_COPY;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
action = GDK_ACTION_LINK;
|
||||
break;
|
||||
|
||||
default:
|
||||
action = GDK_ACTION_ASK; /* Magic value to indicate cancellation */
|
||||
}
|
||||
|
||||
gtk_widget_destroy (menu);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
/* Looks for a panel that has the specified window for its list display. It is used to figure out
|
||||
|
@ -1309,16 +1309,6 @@ panel_artificial_drag_start (GtkCList *window, GdkEventMotion *event)
|
||||
}
|
||||
#endif /* OLD_DND */
|
||||
|
||||
static GtkWidget *
|
||||
load_transparent_image (char *base)
|
||||
{
|
||||
char *f = concat_dir_and_file (ICONDIR, base);
|
||||
GtkWidget *w;
|
||||
|
||||
w = make_transparent_window (f);
|
||||
g_free (f);
|
||||
return w;
|
||||
}
|
||||
|
||||
static void
|
||||
load_dnd_icons (void)
|
||||
@ -1453,7 +1443,7 @@ panel_create_file_list (WPanel *panel)
|
||||
gtk_signal_connect (GTK_OBJECT (file_list), "motion_notify_event",
|
||||
GTK_SIGNAL_FUNC (panel_widget_motion), panel);
|
||||
|
||||
return file_list;
|
||||
return sw;
|
||||
}
|
||||
|
||||
/*
|
||||
|
280
gnome/gtrans.c
280
gnome/gtrans.c
@ -1,280 +0,0 @@
|
||||
/* Module for creating a shaped window with text (for desktop icons)
|
||||
*
|
||||
* Copyright (C) 1998 the Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena <federico@nuclecu.unam.mx>
|
||||
*/
|
||||
|
||||
#include <gnome.h>
|
||||
#include <string.h>
|
||||
#include "gdesktop.h"
|
||||
#include "gcache.h"
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
/* The spacing between the cute little icon and the text */
|
||||
#define SPACING 2
|
||||
|
||||
int want_transparent_icons = 1;
|
||||
int want_transparent_text = 0;
|
||||
|
||||
|
||||
#if 0
|
||||
static void
|
||||
set_window_text (GtkWidget *window, GdkImlibImage *im, char *text)
|
||||
{
|
||||
GdkPixmap *pixmap;
|
||||
GdkPixmap *im_pixmap;
|
||||
GdkBitmap *mask;
|
||||
GdkBitmap *im_mask;
|
||||
GnomeIconTextInfo *ti;
|
||||
GdkColor color;
|
||||
GdkGC *p_gc, *m_gc;
|
||||
int width, height;
|
||||
|
||||
ti = gnome_icon_layout_text (window->style->font, text, " /.-_", SNAP_X, FALSE);
|
||||
|
||||
width = MAX (ti->width, im->rgb_width);
|
||||
height = im->rgb_height + SPACING + ti->height;
|
||||
|
||||
/* Create pixmap, mask, and gc's */
|
||||
|
||||
pixmap = gdk_pixmap_new (window->window, width, height, gdk_imlib_get_visual ()->depth);
|
||||
mask = gdk_pixmap_new (window->window, width, height, 1);
|
||||
|
||||
p_gc = gdk_gc_new (pixmap);
|
||||
m_gc = gdk_gc_new (mask);
|
||||
|
||||
/* Fill mask with transparent */
|
||||
|
||||
color.pixel = 0;
|
||||
gdk_gc_set_foreground (m_gc, &color);
|
||||
gdk_draw_rectangle (mask,
|
||||
m_gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
width, height);
|
||||
|
||||
/* Icon */
|
||||
|
||||
im_pixmap = gdk_imlib_move_image (im);
|
||||
im_mask = gdk_imlib_move_mask (im);
|
||||
|
||||
if (!want_transparent_icons || im_mask == NULL) {
|
||||
/* black background */
|
||||
|
||||
gdk_color_black (gdk_imlib_get_colormap (), &color);
|
||||
gdk_gc_set_foreground (p_gc, &color);
|
||||
gdk_draw_rectangle (pixmap,
|
||||
p_gc,
|
||||
TRUE,
|
||||
(width - im->rgb_width) / 2,
|
||||
0,
|
||||
im->rgb_width,
|
||||
im->rgb_height);
|
||||
|
||||
/* opaque mask */
|
||||
|
||||
color.pixel = 1;
|
||||
gdk_gc_set_foreground (m_gc, &color);
|
||||
gdk_draw_rectangle (mask,
|
||||
m_gc,
|
||||
TRUE,
|
||||
(width - im->rgb_width) / 2,
|
||||
0,
|
||||
im->rgb_width,
|
||||
im->rgb_height);
|
||||
} else if (im_mask)
|
||||
gdk_draw_pixmap (mask,
|
||||
m_gc,
|
||||
im_mask,
|
||||
0, 0,
|
||||
(width - im->rgb_width) / 2,
|
||||
0,
|
||||
im->rgb_width,
|
||||
im->rgb_height);
|
||||
|
||||
if (im_mask) {
|
||||
gdk_gc_set_clip_mask (p_gc, im_mask);
|
||||
gdk_gc_set_clip_origin (p_gc, (width - im->rgb_width) / 2, 0);
|
||||
}
|
||||
|
||||
gdk_draw_pixmap (pixmap,
|
||||
p_gc,
|
||||
im_pixmap,
|
||||
0, 0,
|
||||
(width - im->rgb_width) / 2,
|
||||
0,
|
||||
im->rgb_width,
|
||||
im->rgb_height);
|
||||
|
||||
if (im_mask) {
|
||||
gdk_gc_set_clip_mask (p_gc, NULL);
|
||||
gdk_imlib_free_bitmap (im_mask);
|
||||
}
|
||||
|
||||
gdk_imlib_free_pixmap (im_pixmap);
|
||||
|
||||
/* Text */
|
||||
|
||||
if (!want_transparent_text) {
|
||||
/* black background */
|
||||
|
||||
gdk_color_black (gdk_imlib_get_colormap (), &color);
|
||||
gdk_gc_set_foreground (p_gc, &color);
|
||||
gdk_draw_rectangle (pixmap,
|
||||
p_gc,
|
||||
TRUE,
|
||||
(width - ti->width) / 2,
|
||||
im->rgb_height + SPACING,
|
||||
ti->width,
|
||||
ti->height);
|
||||
|
||||
/* opaque mask */
|
||||
|
||||
color.pixel = 1;
|
||||
gdk_gc_set_foreground (m_gc, &color);
|
||||
gdk_draw_rectangle (mask,
|
||||
m_gc,
|
||||
TRUE,
|
||||
(width - ti->width) / 2,
|
||||
im->rgb_height + SPACING,
|
||||
ti->width,
|
||||
ti->height);
|
||||
} else {
|
||||
color.pixel = 1;
|
||||
gdk_gc_set_foreground (m_gc, &color);
|
||||
gnome_icon_paint_text (ti, mask, m_gc,
|
||||
(width - ti->width) / 2,
|
||||
im->rgb_height + SPACING,
|
||||
GTK_JUSTIFY_CENTER);
|
||||
}
|
||||
|
||||
gdk_color_white (gdk_imlib_get_colormap (), &color);
|
||||
gdk_gc_set_foreground (p_gc, &color);
|
||||
gnome_icon_paint_text (ti, pixmap, p_gc,
|
||||
(width - ti->width) / 2,
|
||||
im->rgb_height + SPACING,
|
||||
GTK_JUSTIFY_CENTER);
|
||||
|
||||
/* Set contents of window */
|
||||
|
||||
gtk_widget_set_usize (window, width, height);
|
||||
gdk_window_set_back_pixmap (window->window, pixmap, FALSE);
|
||||
gdk_window_shape_combine_mask (window->parent->window, mask, 0, 0);
|
||||
|
||||
gdk_gc_destroy (p_gc);
|
||||
gdk_gc_destroy (m_gc);
|
||||
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_pixmap_unref (mask);
|
||||
|
||||
gnome_icon_text_info_free (ti);
|
||||
}
|
||||
|
||||
static void
|
||||
lower_icon_window(GtkWidget *widget, GdkEventExpose *event)
|
||||
{
|
||||
gdk_window_lower(widget->window);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_transparent_text_window (char *file, char *text, int extra_events)
|
||||
{
|
||||
GtkWidget *window, *win;
|
||||
GdkImlibImage *im;
|
||||
GdkCursor *cursor;
|
||||
|
||||
if (!g_file_exists (file))
|
||||
return NULL;
|
||||
|
||||
im = image_cache_load_image (file);
|
||||
if (!im)
|
||||
return NULL;
|
||||
|
||||
win = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
gtk_widget_set_events (win, gtk_widget_get_events (win) | extra_events);
|
||||
|
||||
gtk_widget_push_visual (gdk_imlib_get_visual ());
|
||||
gtk_widget_push_colormap (gdk_imlib_get_colormap ());
|
||||
|
||||
window = gtk_drawing_area_new ();
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(win), window);
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_widget_set_events (window, gtk_widget_get_events (window) | extra_events);
|
||||
|
||||
gtk_widget_pop_colormap ();
|
||||
gtk_widget_pop_visual ();
|
||||
|
||||
gtk_widget_realize (window);
|
||||
|
||||
gdk_imlib_render (im, im->rgb_width, im->rgb_height);
|
||||
|
||||
set_window_text (window, im, text);
|
||||
|
||||
cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
|
||||
gdk_window_set_cursor (window->window, cursor);
|
||||
gdk_cursor_destroy (cursor);
|
||||
|
||||
#if 0
|
||||
/* Do not enable this code */
|
||||
/* We do this so the desktop icons appear to really be part of the
|
||||
desktop */
|
||||
|
||||
/* This is wrong. If you have two icons, one on top of the other,
|
||||
* guess what is the result.
|
||||
*/
|
||||
gtk_signal_connect(window, "expose_event", GTK_SIGNAL_FUNC(lower_icon_window), NULL);
|
||||
#endif
|
||||
return win;
|
||||
}
|
||||
#endif
|
||||
|
||||
GtkWidget *
|
||||
make_transparent_window (char *file)
|
||||
{
|
||||
GdkImlibImage *im;
|
||||
GtkWidget *window, *win;
|
||||
XSetWindowAttributes xwa;
|
||||
|
||||
if (!g_file_exists (file))
|
||||
return NULL;
|
||||
|
||||
im = image_cache_load_image (file);
|
||||
if (!im)
|
||||
return NULL;
|
||||
|
||||
win = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
|
||||
gtk_widget_push_visual (gdk_imlib_get_visual ());
|
||||
gtk_widget_push_colormap (gdk_imlib_get_colormap ());
|
||||
|
||||
window = gtk_drawing_area_new ();
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(win), window);
|
||||
gtk_widget_show(window);
|
||||
|
||||
gtk_widget_pop_colormap ();
|
||||
gtk_widget_pop_visual ();
|
||||
|
||||
gtk_widget_realize (window);
|
||||
|
||||
xwa.save_under = True;
|
||||
XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (win->window),
|
||||
GDK_WINDOW_XWINDOW (win->window),
|
||||
CWSaveUnder, &xwa);
|
||||
|
||||
gtk_widget_set_usize (window, im->rgb_width, im->rgb_height);
|
||||
|
||||
|
||||
/* All of the following 3 lines should not be required, only
|
||||
* gdk_imlib_apply_image, but is is buggy.
|
||||
*/
|
||||
gdk_imlib_render (im, im->rgb_width, im->rgb_height);
|
||||
gdk_window_set_back_pixmap (window->window, gdk_imlib_move_image (im), FALSE);
|
||||
gdk_window_shape_combine_mask (win->window, gdk_imlib_move_mask (im), 0, 0);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
1998-11-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* setup.c: Removed the icons_snap_to_grid and
|
||||
want_transparent_{icons,text} options.
|
||||
|
||||
Thu Nov 5 12:10:10 1998 Pavel Machek <pavel@atrey.karlin.mff.cuni.cz>
|
||||
|
||||
* file.c (panel_operate): check for null pointer before passing it
|
||||
|
@ -245,13 +245,7 @@ static struct {
|
||||
{ "editor_syntax_highlighting", &option_syntax_highlighting },
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
#if 0
|
||||
{ "want_transparent_text", &want_transparent_text },
|
||||
{ "want_transparent_icons", &want_transparent_icons },
|
||||
{ "icons_snap_to_grid", &icons_snap_to_grid },
|
||||
#endif
|
||||
#else
|
||||
#ifndef HAVE_GNOME
|
||||
{ "nice_rotating_dash", &nice_rotating_dash },
|
||||
{ "horizontal_split", &horizontal_split },
|
||||
#endif
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user