1
1

Keyboard works on iconic view. It is basically done.

We now just need to get some nice icons.

I am also revamping a little the toolbar, to have a switch to
icon mode and switch to listing mode icons.  To make people
happy.  More on this tomorrow.

Miguel.
Этот коммит содержится в:
Miguel de Icaza 1998-05-12 04:26:21 +00:00
родитель bd0f31b9ba
Коммит 595c9f87d8
11 изменённых файлов: 231 добавлений и 46 удалений

Просмотреть файл

@ -110,7 +110,9 @@ OBJS = $(LOBJS) $(OOBJS) \
PIXMAPS = \
dev.xpm \
link.xpm \
directory.xpm
directory.xpm \
listing-list.xpm \
listing-iconic.xpm
DISTGNOME = Makefile.in gnome.TODO layout $(PIXMAPS) $(ICONS) $(GNOMESRCS) $(GNOMEHDRS)

Просмотреть файл

@ -34,6 +34,10 @@
#define PORT_DOES_BACKGROUND_EXEC 1
#define PORT_HAS_UPDATE_PANELS 1
#define PORT_HAS_ICON_VIEW 1
#define PORT_LIST_MODE_NAME "gnome_list_mode"
#define PORT_LIST_MODE_DEFAULT "icons"
#define ICONS_PER_ROW(x) (GNOME_ICON_LIST(x->icons)->icon_cols)
#define mi_getch() fprintf (stderr, "mi_getch is not implemented in this port\n")
#define frontend_run_dlg(x) gtkrundlg_event (x)

Просмотреть файл

@ -38,7 +38,8 @@
#include "directory.xpm"
#include "link.xpm"
#include "dev.xpm"
#include "listing-list.xpm"
#include "listing-iconic.xpm"
/* This is used to initialize our pixmaps */
static int pixmaps_ready;
GdkPixmap *icon_directory_pixmap;
@ -307,6 +308,17 @@ x_panel_select_item (WPanel *panel, int index, int value)
void
x_select_item (WPanel *panel)
{
if (panel->list_type == list_icons){
GnomeIconList *list = GNOME_ICON_LIST (panel->icons);
do_file_mark (panel, panel->selected, 1);
display_mini_info (panel);
gnome_icon_list_select_icon (list, panel->selected);
if (list->icon_rows){
if (!gnome_icon_list_icon_is_visible (list, panel->selected))
gnome_icon_list_moveto (list, panel->selected, 0.5);
}
} else {
GtkCList *clist = GTK_CLIST (panel->list);
int color, marked;
@ -322,10 +334,18 @@ x_select_item (WPanel *panel)
if (gtk_clist_row_is_visible (clist, panel->selected) != GTK_VISIBILITY_FULL)
gtk_clist_moveto (clist, panel->selected, 0, 0.5, 0.0);
}
}
void
x_unselect_item (WPanel *panel)
{
if (panel->list_type == list_icons){
int selected = panel->selected;
/* This changes the panel->selected */
gnome_icon_list_unselect_all (GNOME_ICON_LIST (panel->icons), NULL, NULL);
panel->selected = selected;
} else {
int color;
int val;
@ -333,6 +353,7 @@ x_unselect_item (WPanel *panel)
color = file_compute_color (val, &panel->dir.list [panel->selected]);
panel_file_list_set_row_colors (GTK_CLIST (panel->list), panel->selected, color);
}
}
void
x_filter_changed (WPanel *panel)
@ -1068,6 +1089,9 @@ panel_icon_list_select_icon (GtkWidget *widget, int index, GdkEvent *event, WPan
display_mini_info (panel);
execute_hooks (select_file_hook);
if (!event)
return;
switch (event->type){
case GDK_BUTTON_PRESS:
if (event->button.button == 3){
@ -1550,6 +1574,45 @@ panel_up (GtkWidget *button, WPanel *panel)
do_panel_cd (panel, "..", cd_exact);
}
static GtkWidget *
button_switch_to (char **icon, GtkSignalFunc fn, void *closure)
{
GtkWidget *button, *pix;
button = gtk_button_new ();
pix = gnome_pixmap_new_from_xpm_d (icon);
gtk_container_add (GTK_CONTAINER (button), pix);
gtk_signal_connect (GTK_OBJECT (button), "clicked", fn, closure);
return button;
}
static void
do_switch_to_iconic (GtkWidget *widget, WPanel *panel)
{
if (panel->list_type == list_icons)
return;
}
static void
do_switch_to_listing (GtkWidget *widget, WPanel *panel)
{
if (panel->list_type != list_icons)
return;
}
static GtkWidget *
button_switch_to_icon (WPanel *panel)
{
return button_switch_to (listing_iconic_xpm, GTK_SIGNAL_FUNC (do_switch_to_iconic), panel);
}
static GtkWidget *
button_switch_to_listing (WPanel *panel)
{
return button_switch_to (listing_list_xpm, GTK_SIGNAL_FUNC (do_switch_to_listing), panel);
}
void
x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel)
{
@ -1598,12 +1661,19 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel)
gtk_widget_show (panel->ministatus);
status_line = gtk_hbox_new (0, 0);
gtk_container_border_width (GTK_CONTAINER (status_line), 3);
gtk_label_set_justify (GTK_LABEL (panel->ministatus), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (status_line), panel->back_b, 0, 0, 2);
gtk_box_pack_start (GTK_BOX (status_line), panel->up_b, 0, 0, 2);
gtk_box_pack_start (GTK_BOX (status_line), panel->fwd_b, 0, 0, 2);
gtk_box_pack_start (GTK_BOX (status_line), cwd, 1, 1, 5);
gtk_box_pack_start (GTK_BOX (status_line), button_switch_to_icon (panel), 0, 0, 2);
gtk_box_pack_start (GTK_BOX (status_line), button_switch_to_listing (panel), 0, 0, 2);
#if 0
/* Remove the filter for now, until I add another toolbar */
gtk_box_pack_end (GTK_BOX (status_line), filter, 0, 0, 0);
#endif
gtk_widget_show_all (status_line);
/* The statusbar */

22
gnome/listing-iconic.xpm Обычный файл
Просмотреть файл

@ -0,0 +1,22 @@
/* XPM */
static char * listing_iconic_xpm[] = {
"19 16 3 1",
" c #FFFFFFFFFFFF",
". c #000000000000",
"X c #FFFFFFFF0000",
" ",
" ",
" ... ... ",
" .X.... .X.... ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" ...... ...... ",
" ",
" ",
" ... ... ",
" .X.... .X.... ",
" .XXXX. .XXXX. ",
" .XXXX. .XXXX. ",
" ...... ...... ",
" ",
" "};

22
gnome/listing-list.xpm Обычный файл
Просмотреть файл

@ -0,0 +1,22 @@
/* XPM */
static char * listing_list_xpm[] = {
"19 16 3 1",
" c #FFFFFFFFFFFF",
". c #000000000000",
"X c #FFFFFFFF0000",
" ",
" ... ",
" .X... . ",
" .XXX. .. . . ",
" ..... ..... ... ",
" ",
" ... ",
" .X... . ",
" .XXX. . .. . ",
" ..... .......... ",
" ",
" ... ",
" .X... . . ",
" .XXX. .. .. . ",
" ..... .......... ",
" "};

Просмотреть файл

@ -1,3 +1,9 @@
1998-05-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
* main.c: New default: auto-save setup.
* screen.c (move_right, move_left): Add support for icon-view movement.
1998-05-09 Miguel de Icaza <miguel@nuclecu.unam.mx>
* setup.c (panel_load_setup): On non-icon editions, fall back to

Просмотреть файл

@ -1429,7 +1429,6 @@ configure_panel_listing (WPanel *p, int view_type, int use_msformat, char *user,
p->list_type = view_type;
if (view_type == list_user || use_msformat){
free (p->user_format);
p->user_format = user;

Просмотреть файл

@ -191,7 +191,7 @@ enum { pause_never, pause_on_dumb_terminals, pause_always };
int pause_after_run = pause_on_dumb_terminals;
/* It true saves the setup when quitting */
int auto_save_setup = 0;
int auto_save_setup = 1;
/* If true, be eight bit clean */
int eight_bit_clean = 0;

Просмотреть файл

@ -83,6 +83,7 @@ typedef struct {
int split; /* Split panel to allow two columns */
int is_panelized; /* Flag: special filelisting, can't reload */
int frame_size; /* half or full frame */
int icons_per_row; /* Icon view; how many icons displayed per row */
sortfn *sort_type; /* Sort type */
char *filter; /* File name filter */

Просмотреть файл

@ -138,6 +138,10 @@ set_colors (WPanel *panel)
}
#endif
#ifndef ICONS_PER_ROW
# define ICONS_PER_ROW(x) 1
#endif
/* Delete format string, it is a linked list */
void
delete_format (format_e *format)
@ -1576,10 +1580,8 @@ unselect_item (WPanel *panel)
}
#endif
/* */
/* Panel key binded commands */
/* */
static void move_down (WPanel *panel)
static void
do_move_down (WPanel *panel)
{
if (panel->selected+1 == panel->count)
return;
@ -1602,7 +1604,7 @@ static void move_down (WPanel *panel)
}
static void
move_up (WPanel *panel)
do_move_up (WPanel *panel)
{
if (panel->selected == 0)
return;
@ -1620,6 +1622,45 @@ move_up (WPanel *panel)
select_item (panel);
}
static int
move_rel (WPanel *panel, int rel)
{
unselect_item (panel);
if (rel < 0){
if (panel->selected + rel < 0)
panel->selected = 0;
else
panel->selected = panel->selected + rel;
} else {
if (panel->selected + rel >= panel->count)
panel->selected = panel->count - 1;
else
panel->selected = panel->selected + rel;
}
select_item (panel);
}
/* */
/* Panel key binded commands */
/* */
static void
move_up (WPanel *panel)
{
if (panel->list_type == list_icons){
move_rel (panel, -ICONS_PER_ROW (panel));
} else
do_move_up (panel);
}
static void
move_down (WPanel *panel)
{
if (panel->list_type == list_icons){
move_rel (panel, ICONS_PER_ROW (panel));
} else
do_move_down (panel);
}
/* Changes the selection by lines (may be negative) */
static void
@ -1663,22 +1704,32 @@ move_selection (WPanel *panel, int lines)
static int
move_left (WPanel *panel, int c_code)
{
if (panel->list_type == list_icons){
do_move_up (panel);
return 1;
} else {
if (panel->split){
move_selection (panel, -llines (panel));
return 1;
} else
return maybe_cd (c_code, 0);
}
}
static int
move_right (WPanel *panel, int c_code)
{
if (panel->list_type == list_icons){
do_move_down (panel);
return 1;
} else {
if (panel->split){
move_selection (panel, llines (panel));
return 1;
} else
return maybe_cd (c_code, 1);
}
}
static void
prev_page (WPanel *panel)

Просмотреть файл

@ -49,6 +49,14 @@
# include "gdesktop.h"
#endif
#ifndef PORT_LIST_MODE_NAME
# define PORT_LIST_MODE_NAME "list_mode"
#endif
#ifndef PORT_LIST_MODE_DEFAULT
# define PORT_LIST_MODE_DEFAULT "full"
#endif
#include "../vfs/vfs.h"
#ifdef USE_NETCODE
# include "../vfs/ftpfs.h"
@ -108,6 +116,7 @@ static struct {
{ "brief", list_brief },
{ "long", list_long },
{ "user", list_user },
{ "icons", list_icons },
{ 0, 0 }
};
@ -263,8 +272,7 @@ void panel_save_setup (WPanel *panel, char *section)
for (i = 0; list_types [i].key; i++)
if (list_types [i].list_type == panel->list_type){
save_string (section, "list_mode",
list_types [i].key, profile_name);
save_string (section, PORT_LIST_MODE_NAME, list_types [i].key, profile_name);
break;
}
@ -396,7 +404,7 @@ void panel_load_setup (WPanel *panel, char *section)
}
/* Load the listing mode */
load_string (section, "list_mode", "full", buffer, sizeof (buffer));
load_string (section, PORT_LIST_MODE_NAME, PORT_LIST_MODE_DEFAULT, buffer, sizeof (buffer));
panel->list_type = list_full;
for (i = 0; list_types [i].key; i++)
if (strcasecmp (list_types [i].key, buffer) == 0){