panel_scroll_pages patch

Shiar shiar at shiar.org
Thu Apr 11 19:45:53 UTC 2002


hi, again..

latest alterations:
- slight display error w/o panel header fixed.
- corrected mouse position with panel header disabled.
- file [mca]time is now customizable in the ini file.

could anybody plz comment? or am i the only one who likes my added
features?

l8r
-- 
Shiar            m00h  ( _ )
shiar at shiar.org     \  ~O o~__
shiar at irc.shiar.net    (._.) |\
http://www.shiar.org     |_|_|
-------------- next part --------------
Index: layout.c
===================================================================
RCS file: /cvs/gnome/mc/src/layout.c,v
retrieving revision 1.35
diff -u -r1.35 layout.c
--- layout.c	2002/02/06 05:23:50	1.35
+++ layout.c	2002/04/11 19:32:24
@@ -93,6 +93,9 @@
 int output_lines = 0;
 
 /* Set if the command prompt is to be displayed */
+int panel_header = 1;
+
+/* Set if the command prompt is to be displayed */
 int command_prompt = 1;
 
 /* Set if the nice and usefull keybar is visible */
@@ -107,6 +110,11 @@
 /* The starting line for the output of the subprogram */
 int output_start_y = 0;
 
+/* The format in which file dates are displayed */
+char format_filedate [32];
+/* An alternative format used when files are quite old or in the future */
+char format_filedate_year [32];
+
 /* The maximum number of views managed by the set_display_type routine */
 /* Must be at least two (for current and other).  Please note that until */
 /* Janne gets around this, we will only manage two of them :-) */
@@ -128,6 +136,7 @@
 static int _equal_split;
 static int _first_panel_size;
 static int _menubar_visible;
+static int _panel_header;
 static int _output_lines;
 static int _command_prompt;
 static int _keybar_visible;
@@ -169,6 +178,7 @@
     { N_("&Keybar visible"),   &keybar_visible,  0, "k" },
     { N_("command &Prompt"),   &command_prompt,  0, "p" },
     { N_("show &Mini status"), &show_mini_info,  0, "m" },
+    { N_("panel hea&Der"),     &panel_header,    0, "hd" },
     { N_("menu&Bar visible"),  &menubar_visible, 0, "me" },
     { N_("&Equal split"),      &equal_split,     0, "eq" },
     { N_("pe&Rmissions"),      &permission_mode, 0, "pr" },
@@ -233,8 +243,8 @@
     if (_equal_split){
 	/* Turn equal split off */
 	_equal_split = 0;
-	check_options [6].widget->state = check_options [6].widget->state & ~C_BOOL;
-	dlg_select_widget (layout_dlg, check_options [6].widget);
+	check_options [7].widget->state = check_options [7].widget->state & ~C_BOOL;
+	dlg_select_widget (layout_dlg, check_options [7].widget);
 	dlg_select_widget (layout_dlg, bleft_widget);
     }
     _first_panel_size++;
@@ -246,8 +256,8 @@
     if (_equal_split){
 	/* Turn equal split off */
 	_equal_split = 0;
-	check_options [6].widget->state = check_options [6].widget->state & ~C_BOOL;
-	dlg_select_widget (layout_dlg, check_options [6].widget);
+	check_options [7].widget->state = check_options [7].widget->state & ~C_BOOL;
+	dlg_select_widget (layout_dlg, check_options [7].widget);
 	dlg_select_widget (layout_dlg, bright_widget);
     }
     _first_panel_size--;
@@ -300,19 +310,20 @@
 	    if (old_output_lines != _output_lines){
 		old_output_lines = _output_lines;
 		attrset (COLOR_NORMAL);
-		dlg_move (h, 9, 16 + first_width);
+		dlg_move (h, 10, 16 + first_width);
 		addstr (output_lines_label);
-		dlg_move (h, 9, 10 + first_width);
+		dlg_move (h, 10, 10 + first_width);
 		printw ("%02d", _output_lines);
 	    }
 	}
 	break;
 
     case DLG_POST_KEY:
-	_filetype_mode = check_options [8].widget->state & C_BOOL;
-	_permission_mode = check_options [7].widget->state & C_BOOL;
-	_equal_split = check_options [6].widget->state & C_BOOL;
-	_menubar_visible = check_options [5].widget->state & C_BOOL;
+	_filetype_mode = check_options [9].widget->state & C_BOOL;
+	_permission_mode = check_options [8].widget->state & C_BOOL;
+	_equal_split = check_options [7].widget->state & C_BOOL;
+	_menubar_visible = check_options [6].widget->state & C_BOOL;
+	_panel_header = check_options [5].widget->state & C_BOOL;
 	_command_prompt = check_options [4].widget->state & C_BOOL;
 	_keybar_visible = check_options [2].widget->state & C_BOOL;
 	_message_visible = check_options [1].widget->state & C_BOOL;
@@ -346,7 +357,7 @@
 	    if (old_output_lines != _output_lines){
 		old_output_lines = _output_lines;
 		attrset (COLOR_NORMAL);
-		dlg_move (h, 9, 10 + first_width);
+		dlg_move (h, 10, 10 + first_width);
 		printw ("%02d", _output_lines);
 	    }
 	}
@@ -387,7 +398,7 @@
 				first_width = l1;
 		}
 
-		for (i = 0; i <= 8; i++)
+		for (i = 0; i <= 9; i++)
 		{
 			check_options[i].text = _(check_options[i].text);
 			l1 = strlen (check_options[i].text) + 7;
@@ -405,7 +416,7 @@
 		
 
 		second_width = strlen (title3) + 1;
-		for (i = 0; i < 6; i++)
+		for (i = 0; i < 7; i++)
 		{
 			check_options[i].text = _(check_options[i].text);
 			l1 = strlen (check_options[i].text) + 7;
@@ -454,28 +465,29 @@
 		button_new (BY, b1, B_ENTER, DEFPUSH_BUTTON, ok_button, 0, 0, "o"));
     if (console_flag){
 	add_widget (layout_dlg,
-		    button_new (9, 12 + first_width, B_MINUS, NARROW_BUTTON, "&-",
+		    button_new (10, 12 + first_width, B_MINUS, NARROW_BUTTON, "&-",
 			bminus_cback, 0, NULL));
 	add_widget (layout_dlg,
-		    button_new (9, 7 + first_width, B_PLUS, NARROW_BUTTON, "&+", 
+		    button_new (10, 7 + first_width, B_PLUS, NARROW_BUTTON, "&+", 
 			bplus_cback, 0, NULL));
     }
 
 #define XTRACT(i) *check_options[i].variable, check_options[i].text, check_options[i].tkname
 
-    for (i = 0; i < 6; i++){
-	check_options [i].widget = check_new (8 - i, 7 + first_width, XTRACT(i));
+    for (i = 0; i < 7; i++){
+	check_options [i].widget = check_new (9 - i, 7 + first_width, XTRACT(i));
 	add_widget (layout_dlg, check_options [i].widget);
     }
-    check_options [8].widget = check_new (10, 6, XTRACT(8));
+    check_options [9].widget = check_new (10, 6, XTRACT(9));
+    add_widget (layout_dlg, check_options [9].widget);
+    check_options [8].widget = check_new (9, 6, XTRACT(8));
     add_widget (layout_dlg, check_options [8].widget);
-    check_options [7].widget = check_new (9, 6, XTRACT(7));
-    add_widget (layout_dlg, check_options [7].widget);
 
     _filetype_mode = filetype_mode;
     _permission_mode = permission_mode;
     _equal_split = equal_split;
     _menubar_visible = menubar_visible;
+    _panel_header = panel_header;
     _command_prompt = command_prompt;
     _keybar_visible = keybar_visible;
     _message_visible = message_visible;
@@ -484,14 +496,14 @@
     add_widget (layout_dlg, bright_widget);
     bleft_widget = button_new (6, 9, B_2LEFT, NARROW_BUTTON, "&<", b2left_cback, 0, "<");
     add_widget (layout_dlg, bleft_widget);
-    check_options [6].widget = check_new (5, 6, XTRACT(6));
+    check_options [7].widget = check_new (5, 6, XTRACT(7));
     old_first_panel_size = -1;
     old_horizontal_split = -1;
     old_output_lines     = -1;
     
     _first_panel_size = first_panel_size;
     _output_lines = output_lines;
-    add_widget (layout_dlg, check_options [6].widget);
+    add_widget (layout_dlg, check_options [7].widget);
     radio_widget = radio_new (3, 6, 2, s_split_direction, 1, "r");
     add_widget (layout_dlg, radio_widget);
     radio_widget->sel = horizontal_split;
@@ -666,7 +678,12 @@
 	    widget_set_size (&cmdline->input.widget,
 			     LINES-1-keybar_visible, promptl,
 			     1, COLS-promptl-(keybar_visible ? 0 : 1));
-	    winput_set_origin (&cmdline->input, promptl, COLS-promptl-(keybar_visible ? 0 : 1));
+	    #ifdef HAVE_SLANG
+		winput_set_origin (&cmdline->input, promptl,
+		    COLS-promptl-(keybar_visible ? 0 : 1));
+	    #else
+		winput_set_origin (&cmdline->input, promptl, COLS-promptl);
+	    #endif
 	    widget_set_size (&the_prompt->widget,
 			     LINES-1-keybar_visible, 0,
 			     1, promptl);
Index: layout.h
===================================================================
RCS file: /cvs/gnome/mc/src/layout.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 layout.h
--- layout.h	1998/02/27 04:54:43	1.1.1.1
+++ layout.h	2002/04/11 19:32:24
@@ -29,12 +29,15 @@
 extern int equal_split;
 extern int first_panel_size;
 extern int output_lines;
+extern int panel_header;
 extern int command_prompt;
 extern int keybar_visible;
 extern int layout_do_change;
 extern int output_start_y;
 extern int message_visible;
 extern int xterm_hintbar;
+extern char format_filedate [32];
+extern char format_filedate_year [32];
 
 extern int horizontal_split;
 extern int nice_rotating_dash;
Index: main.c
===================================================================
RCS file: /cvs/gnome/mc/src/main.c,v
retrieving revision 1.185
diff -u -r1.185 main.c
--- main.c	2002/03/25 07:46:19	1.185
+++ main.c	2002/04/11 19:32:34
@@ -129,6 +129,9 @@
 /* they do a complete refresh, refreshing all the parts of the program */
 int fast_refresh = 0;
 
+/* If true, scolls panels no more than one file at a time */
+int panel_scroll_pages = 0;
+
 /* If true, marking a files moves the cursor down */
 int   mark_moves_down = 1;
 
@@ -1727,6 +1730,7 @@
     
     if (baudrate () < 9600 || slow_terminal){
 	verbose = 0;
+	panel_scroll_pages = 1;
     }
     init_mouse ();
 
Index: main.h
===================================================================
RCS file: /cvs/gnome/mc/src/main.h,v
retrieving revision 1.29
diff -u -r1.29 main.h
--- main.h	2002/01/17 07:17:54	1.29
+++ main.h	2002/04/11 19:32:35
@@ -34,6 +34,7 @@
 void subshell_chdir (char *command);
 
 /* See main.c for details on these variables */
+extern int panel_scroll_pages;
 extern int mark_moves_down;
 extern int auto_menu;
 extern int pause_after_run;
Index: option.c
===================================================================
RCS file: /cvs/gnome/mc/src/option.c,v
retrieving revision 1.15
diff -u -r1.15 option.c
--- option.c	2001/09/03 05:07:41	1.15
+++ option.c	2002/04/11 19:32:35
@@ -80,11 +80,12 @@
    {N_("auto m&Enus"),        &auto_menu,         TOGGLE_VARIABLE,       0, "auto-menus" },
    {N_("&Auto save setup"),   &auto_save_setup,   TOGGLE_VARIABLE,       0, "auto-save" },
    {N_("shell &Patterns"),    &easy_patterns,     TOGGLE_VARIABLE,       0, "shell-patt" },
-   {N_("Compute &Totals"),    &file_op_compute_totals,           TOGGLE_VARIABLE,       0, "compute-totals" },
+   {N_("Compute &Totals"),    &file_op_compute_totals,TOGGLE_VARIABLE,   0, "compute-totals" },
    {N_("&Verbose operation"), &verbose,           TOGGLE_VARIABLE,       0, "verbose" },
    {N_("&Fast dir reload"),   &fast_reload,       toggle_fast_reload,    0, "fast-reload" },
    {N_("mi&X all files"),     &mix_all_files,     toggle_mix_all_files,  0, "mix-files" },
    {N_("&Drop down menus"),   &drop_menus,        TOGGLE_VARIABLE,       0, "drop-menus" },
+   {N_("scroll paged"),       &panel_scroll_pages,TOGGLE_VARIABLE,       0, "panel-scroll-pages" },
    {N_("ma&Rk moves down"),   &mark_moves_down,   TOGGLE_VARIABLE,       0, "mark-moves" },
    {N_("show &Hidden files"), &show_dot_files,    toggle_show_hidden,    0, "show-hidden" },
    {N_("show &Backup files"), &show_backups,      toggle_show_backup,    0, "show-backup" },
@@ -95,8 +96,8 @@
 
 static char *pause_options [3] = {
     N_("&Never"),
-    N_("on dumb &Terminals"),
-    N_("alwa&Ys") };
+    N_("on dumb terminals"),
+    N_("always") };
 
 static int configure_callback (struct Dlg_head *h, int Id, int Msg)
 {
@@ -105,7 +106,7 @@
 	attrset (COLOR_NORMAL);
 	dlg_erase (h);
 	draw_box (h, 1, 2, h->lines - 2, h->cols - 4);
-	draw_box (h, PY, PX, 8, first_width);
+	draw_box (h, PY, PX, 9, first_width);
 	draw_box (h, RY, RX, 5, first_width);
 	draw_box (h, OY, OX, 15, second_width);
 
@@ -148,7 +149,7 @@
 		title3 = _(" Other options ");
 
 		first_width = strlen (title1) + 1;
-		for (i = 13; i < 19; i++)
+		for (i = 13; i < 20; i++)
 		{
 			check_options[i].text = _(check_options[i].text);
 			l1 = strlen (check_options[i].text) + 7;
@@ -221,8 +222,8 @@
     pause_radio = radio_new (RY+1, RX+2, 3, pause_options, 1, "pause-radio");
     pause_radio->sel = pause_after_run;
     add_widget (conf_dlg, pause_radio);
-    for (i = 0; i < 6; i++){
-	check_options [i+13].widget = check_new (PY + (6-i), PX+2,
+    for (i = 0; i < 7; i++){
+	check_options [i+13].widget = check_new (PY + (7-i), PX+2,
 						  XTRACT(i+13));
 	add_widget (conf_dlg, check_options [i+13].widget);
     }
Index: panel.h
===================================================================
RCS file: /cvs/gnome/mc/src/panel.h,v
retrieving revision 1.54
diff -u -r1.54 panel.h
--- panel.h	2002/01/22 23:16:21	1.54
+++ panel.h	2002/04/11 19:32:36
@@ -136,7 +136,6 @@
 extern int permission_mode;
 extern int filetype_mode;
 extern int show_mini_info;
-extern int panel_scroll_pages;
 
 #define selection(p) (&(p->dir.list [p->selected]))
 
Index: screen.c
===================================================================
RCS file: /cvs/gnome/mc/src/screen.c,v
retrieving revision 1.109
diff -u -r1.109 screen.c
--- screen.c	2002/02/06 05:14:17	1.109
+++ screen.c	2002/04/11 19:32:42
@@ -61,9 +61,6 @@
 /* If true, use some usability hacks by Torben */
 int torben_fj_mode = 0;
 
-/* If true, up/down keys scroll the pane listing by pages */
-int panel_scroll_pages = 1;
-
 /* If 1, we use permission hilighting */
 int permission_mode = 0;
 
@@ -86,7 +83,7 @@
 #define x_reset_sort_labels(x)
 
 /* This macro extracts the number of available lines in a panel */
-#define llines(p) (p->widget.lines-3 - (show_mini_info ? 2 : 0))
+#define llines(p) (p->widget.lines - 2 - panel_header - (show_mini_info ? 2 : 0))
 
 #ifdef PORT_NOT_FOCUS_SELECT_ITEM
 #   define focus_select_item(x)
@@ -594,11 +591,11 @@
     if (mv){
 	if (!isstatus && panel->split){
 	    widget_move (&panel->widget,
-			 (file_index - panel->top_file) %
-			 llines (panel) + 2,
-			 (offset + 1));
+		(file_index - panel->top_file) % llines (panel) + panel_header + 1,
+		(offset + 1));
 	} else
-	    widget_move (&panel->widget, file_index - panel->top_file + 2, 1);
+	    widget_move (&panel->widget,
+		file_index - panel->top_file + panel_header + 1, 1);
     }
 
     format_file (buffer, sizeof(buffer), panel, file_index, width, attr, isstatus);
@@ -619,7 +616,8 @@
     if (!show_mini_info)
 	return;
 
-    widget_move (&panel->widget, llines (panel)+3, 1);
+    /* mini status area */
+    widget_move (&panel->widget, panel->widget.lines - 2, 1);
 
     if (panel->searching){
 	attrset (INPUT_COLOR);
@@ -636,7 +634,7 @@
 
 	attrset (MARKED_COLOR);
 	printw  ("%*s", cols, " ");
-	widget_move (&panel->widget, llines (panel)+3, 1);
+	widget_move (&panel->widget, panel->widget.lines - 2, 1);
 	/* FIXME: use ngettext() here when gettext-0.10.35 becomes history */
 	g_snprintf (buffer, sizeof (buffer), (panel->marked == 1) ?
 		 _("%s bytes in %d file") : _("%s bytes in %d files"),
@@ -703,7 +701,7 @@
 	return;
 
     standend ();
-    widget_move (&panel->widget, llines (panel)+2, 1);
+    widget_move (&panel->widget, panel->widget.lines - 3, 1);
 #ifdef HAVE_SLANG
     attrset (NORMAL_COLOR);
     hline (ACS_HLINE, panel->widget.cols-2);
@@ -727,16 +725,16 @@
     if (show_mini_info) {
 #ifdef linux_unicode
     	if (SLtt_Unicode) {
-            SLsmg_draw_unicode (panel->widget.y + llines (panel) + 2,
+            SLsmg_draw_unicode (panel->widget.y + llines (panel) + panel_header + 1,
                 panel->widget.x, SLUNI_DSLTEE_CHAR);
-            SLsmg_draw_unicode (panel->widget.y + llines (panel) + 2,
+            SLsmg_draw_unicode (panel->widget.y + llines (panel) + panel_header + 1,
                 panel->widget.x + panel->widget.cols - 1, SLUNI_DSRTEE_CHAR);
     	} else
 #endif /* linux_unicode */
 	{
-            SLsmg_draw_object (panel->widget.y + llines (panel) + 2,
+            SLsmg_draw_object (panel->widget.y + llines (panel) + panel_header + 1,
                 panel->widget.x, SLSMG_LTEE_CHAR);
-            SLsmg_draw_object (panel->widget.y + llines (panel) + 2,
+            SLsmg_draw_object (panel->widget.y + llines (panel) + panel_header + 1,
                 panel->widget.x + panel->widget.cols - 1, SLSMG_RTEE_CHAR);
         }
     }
@@ -1040,48 +1038,50 @@
     widget_erase (&panel->widget);
     show_dir (panel);
 
-    widget_move (&panel->widget, 1, 1);
+    if (panel_header){
+	widget_move (&panel->widget, 1, 1);
 
-    for (side = 0; side <= panel->split; side++){
-	format_e *format;
+	for (side = 0; side <= panel->split; side++){
+	    format_e *format;
 
-	if (side){
-	    attrset (NORMAL_COLOR);
-	    one_vline ();
-	    width = panel->widget.cols - panel->widget.cols/2 - 1;
-	} else if (panel->split)
-	    width = panel->widget.cols/2 - 3;
-	else
-	    width = panel->widget.cols - 2;
+	    if (side){
+		attrset (NORMAL_COLOR);
+		one_vline ();
+		width = panel->widget.cols - panel->widget.cols/2 - 1;
+	    } else if (panel->split)
+		width = panel->widget.cols/2 - 3;
+	    else
+		width = panel->widget.cols - 2;
+
+	    for (format = panel->format; format; format = format->next){
+		if (format->string_fn){
+		    txt = format->title;
 
-	for (format = panel->format; format; format = format->next){
-            if (format->string_fn){
-                txt = format->title;
-
-		header_len = strlen (txt);
-		if (header_len > format->field_len){
-		    strcpy (buffer, txt);
-		    txt = buffer;
-		    txt [format->field_len] = 0;
 		    header_len = strlen (txt);
+		    if (header_len > format->field_len){
+			strcpy (buffer, txt);
+			txt = buffer;
+			txt [format->field_len] = 0;
+			header_len = strlen (txt);
+		    }
+
+		    attrset (MARKED_COLOR);
+		    spaces = (format->field_len - header_len) / 2;
+		    extra  = (format->field_len - header_len) % 2;
+		    printw ("%*s%-s%*s", spaces, "",
+			txt, spaces+extra, "");
+		    width -= 2 * spaces + extra + header_len;
+		} else {
+		    attrset (NORMAL_COLOR);
+		    one_vline ();
+		    width --;
+		    continue;
 		}
-
-                attrset (MARKED_COLOR);
-                spaces = (format->field_len - header_len) / 2;
-                extra  = (format->field_len - header_len) % 2;
-		printw ("%*s%-s%*s", spaces, "",
-			 txt, spaces+extra, "");
-		width -= 2 * spaces + extra + header_len;
-	    } else {
-		attrset (NORMAL_COLOR);
-		one_vline ();
-		width --;
-		continue;
 	    }
-	}
 
-	if (width > 0)
-	    printw ("%*s", width, "");
+	    if (width > 0)
+		printw ("%*s", width, "");
+	}
     }
 }
 
@@ -1475,10 +1475,10 @@
     if (panel->selected < 0)
 	panel->selected = 0;
 
-    if (panel->selected > panel->count-1)
+    if (panel->selected >= panel->count)
 	panel->selected = panel->count - 1;
 
-    if (panel->top_file > panel->count-1){
+    if (panel->top_file >= panel->count){
 	repaint = 1;
 	panel->top_file = panel->count-1;
     }
@@ -1541,14 +1541,16 @@
     unselect_item (panel);
     panel->selected++;
 
-    if (panel->selected - panel->top_file == ITEMS (panel) &&
-	panel_scroll_pages){
-	/* Scroll window half screen */
-	panel->top_file += ITEMS (panel)/2;
-	if (panel->top_file > panel->count - ITEMS (panel))
+    if (panel->selected - panel->top_file == ITEMS (panel)){
+	if (panel_scroll_pages){
+	    /* Scroll window half screen */
+	    panel->top_file += ITEMS (panel)/2;
+	    /* w/o the following select_item will correct and redraw */
+	    if (panel->top_file > panel->count - ITEMS (panel))
 		panel->top_file = panel->count - ITEMS (panel);
+	} else panel->top_file++;
+	/* scroll dir (faster than allowing select_item to do so) */
 	paint_dir (panel);
-	select_item (panel);
     }
     select_item (panel);
 }
@@ -1561,10 +1563,13 @@
 
     unselect_item (panel);
     panel->selected--;
-    if (panel->selected < panel->top_file && panel_scroll_pages){
-	/* Scroll window half screen */
-	panel->top_file -= ITEMS (panel)/2;
-	if (panel->top_file < 0) panel->top_file = 0;
+    if (panel->selected < panel->top_file){
+	if (panel_scroll_pages){
+	    /* Scroll window half screen */
+	    panel->top_file -= ITEMS (panel)/2;
+	    if (panel->top_file < 0) panel->top_file = 0;
+	} else panel->top_file--;
+	/* scroll dir (faster than allowing select_item to do so) */
 	paint_dir (panel);
     }
     select_item (panel);
@@ -1574,18 +1579,7 @@
 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;
-    }
+    panel->selected = panel->selected + rel;
     select_item (panel);
 }
 
@@ -1686,22 +1680,25 @@
     	return;
     unselect_item (panel);
     items = ITEMS (panel);
-    if (panel->top_file < items)
-    	items = panel->top_file;
+    if (!panel_scroll_pages) items--;
     if (!items)
     	panel->selected = 0;
     else
     	panel->selected -= items;
-    panel->top_file -= items;
 
     /* This keeps the selection in a reasonable place */
-    if (panel->selected < 0)
-	panel->selected = 0;
-    if (panel->top_file < 0)
-	panel->top_file = 0;
-    x_adjust_top_file (panel);
-    select_item (panel);
+    if (panel->selected < 0) panel->selected = 0;
+
+    if (panel_scroll_pages){
+	panel->top_file -= items;
+	if (panel->top_file < 0) panel->top_file = 0;
+    } else {
+	panel->top_file = panel->selected;
+    }
+
+//  x_adjust_top_file (panel); //what's this??
     paint_dir (panel);
+    select_item (panel);
 }
 
 static void
@@ -1723,24 +1720,27 @@
     	return;
     unselect_item (panel);
     items = ITEMS (panel);
-    if (panel->top_file > panel->count - 2 * items)
-    	items = panel->count - items - panel->top_file;
-    if (panel->top_file + items < 0)
-    	items = - panel->top_file;
+    if (!panel_scroll_pages) items--;
     if (!items)
-    	panel->selected = panel->count - 1;
+	panel->selected = panel->count - 1;
     else
-    	panel->selected += items;
-    panel->top_file += items;
-
+	panel->selected += items;
     /* This keeps the selection in it's relative position */
     if (panel->selected >= panel->count)
 	panel->selected = panel->count - 1;
-    if (panel->top_file >= panel->count)
-	panel->top_file = panel->count - 1;
-    x_adjust_top_file (panel);
-    select_item (panel);
+
+    if (panel_scroll_pages){
+	panel->top_file += items;
+	if (panel->top_file > panel->count - 1)
+	    panel->top_file = panel->count - 1; //items;
+    } else {
+	panel->top_file = panel->selected - items;
+	if (panel->top_file < 0) panel->top_file = 0;
+    }
+
+//  x_adjust_top_file (panel); //what's this??
     paint_dir (panel);
+    select_item (panel);
 }
 
 static void next_page_key (WPanel *panel)
@@ -2314,7 +2314,7 @@
 	return MOU_NORMAL;
     }
 
-    event->y -= 2;
+    event->y -= panel_header + 1;
     if ((event->type & (GPM_DOWN|GPM_DRAG))){
 
 	if (panel != (WPanel *) current_dlg->current->widget)
@@ -2331,6 +2331,7 @@
 
 	if (!((panel->top_file + event->y <= panel->count) &&
 	      event->y <= lines)){
+	    /* in panel but below files */
 	    mark_if_marking (panel, event);
 	    if (mouse_move_pages)
 		next_page (panel);
Index: setup.c
===================================================================
RCS file: /cvs/gnome/mc/src/setup.c,v
retrieving revision 1.58
diff -u -r1.58 setup.c
--- setup.c	2002/02/04 18:09:42	1.58
+++ setup.c	2002/04/11 19:32:43
@@ -135,6 +135,7 @@
     { "xterm_hintbar", &xterm_hintbar },
     { "output_lines", &output_lines },
     { "command_prompt", &command_prompt },
+    { "panel_header", &panel_header },
     { "menubar_visible", &menubar_visible },
     { "show_mini_info", &show_mini_info },
     { "permission_mode", &permission_mode },
@@ -291,6 +292,8 @@
 	g_snprintf (buffer, sizeof (buffer), "%d", *layout [i].opt_addr);
 	save_string ("Layout", layout [i].opt_name, buffer, profile);
     }
+    save_string ("Layout", "format_date", format_filedate_year, profile);
+    save_string ("Layout", "format_time", format_filedate, profile);
 
     g_free (profile);
 }
@@ -439,6 +442,10 @@
 	*layout [i].opt_addr =
 	    load_int ("Layout", layout [i].opt_name,
 				  *layout [i].opt_addr);
+    load_string ("Layout", "format_date", "%b %e  %Y",
+	format_filedate_year, sizeof (format_filedate_year));
+    load_string ("Layout", "format_time", "%b %e %H:%M",
+	format_filedate, sizeof (format_filedate));
 }
 
 static int
Index: util.c
===================================================================
RCS file: /cvs/gnome/mc/src/util.c,v
retrieving revision 1.59
diff -u -r1.59 util.c
--- util.c	2002/03/18 21:08:19	1.59
+++ util.c	2002/04/11 19:32:47
@@ -48,6 +48,7 @@
 #include "cmd.h"		/* guess_message_value */
 #include "../vfs/vfs.h"
 #include "mountlist.h"
+#include "layout.h"		/* format_filedate */
 
 #ifdef HAVE_CHARSET
 #include "charsets.h"
@@ -634,8 +635,8 @@
     char buf [MAX_I18NTIMELENGTH + 1];
     time_t testtime = time (NULL);
     
-    a = strftime (buf, sizeof(buf)-1, _("%b %e %H:%M"), localtime(&testtime));
-    b = strftime (buf, sizeof(buf)-1, _("%b %e  %Y"), localtime(&testtime));
+    a = strftime (buf, sizeof(buf)-1, format_filedate_year, localtime(&testtime));
+    b = strftime (buf, sizeof(buf)-1, format_filedate, localtime(&testtime));
     
     length = max (a, b);
     
@@ -651,16 +652,10 @@
     static char timebuf [MAX_I18NTIMELENGTH + 1];
     time_t current_time = time ((time_t) 0);
     static size_t i18n_timelength = 0;
-    static char *fmtyear, *fmttime;
     char *fmt;
 
     if (i18n_timelength == 0){
 	i18n_timelength = i18n_checktimelength() + 1;
-	
-	/* strftime() format string for old dates */
-	fmtyear = _("%b %e  %Y");
-	/* strftime() format string for recent dates */
-	fmttime = _("%b %e %H:%M");
     }
 
     if (current_time > when + 6L * 30L * 24L * 60L * 60L /* Old. */
@@ -672,9 +667,9 @@
 	   to allow for NFS server/client clock disagreement.
 	   Show the year instead of the time of day.  */
 
-	fmt = fmtyear;
+	fmt = format_filedate_year;
     else
-	fmt = fmttime;
+	fmt = format_filedate;
     
     strftime (timebuf, i18n_timelength, fmt, localtime(&when));
     return timebuf;
Index: util.h
===================================================================
RCS file: /cvs/gnome/mc/src/util.h,v
retrieving revision 1.31
diff -u -r1.31 util.h
--- util.h	2002/01/22 01:23:18	1.31
+++ util.h	2002/04/11 19:32:47
@@ -55,7 +55,7 @@
 char *get_group (int);
 char *get_owner (int);
 
-#define MAX_I18NTIMELENGTH 14
+#define MAX_I18NTIMELENGTH 32
 #define MIN_I18NTIMELENGTH 10
 #define STD_I18NTIMELENGTH 12
 


More information about the mc-devel mailing list