clocks in mc
- From: Max Schedriviy <max tavrida net>
- To: <mc-devel gnome org>
- Subject: clocks in mc
- Date: Fri, 6 Jul 2001 05:31:41 +0300
6) clocks in right up corner. If using on Linux, clocks update only if key
pressed (may be need to change something in getch_with_delay() ?)
--
C U L8er!
Max Schedriviy mailto:max tavrida net
diff -Naur mc/src/key.c mc-new/src/key.c
--- mc/src/key.c Wed Jun 27 16:29:14 2001
+++ mc-new/src/key.c Mon Jul 2 15:44:18 2001
@@ -43,6 +43,7 @@
#include "win.h"
#include "cons.saver.h"
#include "../vfs/vfs.h"
+#include "layout.h"
#ifdef HAVE_TEXTMODE_X11_SUPPORT
#include <X11/Xlib.h>
@@ -774,6 +775,7 @@
untouchwin (stdscr);
# endif
c = block ? getch_with_delay () : get_key_code(1);
+ set_clock(); /* show clock - mAX */
# ifndef HAVE_SLANG
if (flag)
diff -Naur mc/src/layout.c mc-new/src/layout.c
--- mc/src/layout.c Tue Jun 5 19:41:44 2001
+++ mc-new/src/layout.c Mon Jul 2 15:39:32 2001
@@ -26,6 +26,7 @@
#include <sys/param.h> /* Required by tree.h */
#include <sys/types.h>
#include <sys/stat.h>
+#include <time.h> /* used in set_clock() - mAX */
#if (!defined(__IBMC__) && !defined(__IBMCPP__)) && !defined(HAS_NO_TERMIOS_H)
# include <termios.h>
#endif
@@ -78,6 +79,9 @@
/* Controls the display of the rotating dash on the verbose mode */
int nice_rotating_dash = 1;
+/* Show clock in corner - mAX */
+int show_clock = 1;
+
/* If set, then we have to call the layout_change routine from main */
int layout_do_change = 0;
@@ -863,6 +867,25 @@
move (0, COLS-1);
addch (' ');
+}
+
+/* show clock in corner - mAX */
+void set_clock (void)
+{
+ time_t now;
+ struct tm *t;
+ static char mc_clock[] = "00:00";
+ if (!show_clock || (ok_to_refresh <= 0)) return;
+
+ time (&now);
+ t = localtime(&now);
+ snprintf (mc_clock, 6, "%02i:%02i",t->tm_hour,t->tm_min);
+
+ attrset(SELECTED_COLOR);
+ move (0, COLS - 5);
+ addstr(mc_clock);
+ update_cursor(current_dlg);
+ mc_refresh();
}
char *get_nth_panel_name (int num)
diff -Naur mc/src/layout.h mc-new/src/layout.h
--- mc/src/layout.h Fri Feb 27 06:54:43 1998
+++ mc-new/src/layout.h Mon Jul 2 15:38:15 2001
@@ -20,6 +20,7 @@
int get_current_index (void);
int get_other_index (void);
char *get_nth_panel_name (int num);
+void set_clock (void); /* update clock if show_clock==1 - mAX */
Widget *get_panel_widget (int index);
@@ -38,5 +39,6 @@
extern int horizontal_split;
extern int nice_rotating_dash;
+extern int show_clock; /* show clock in corner - mAX */
#endif /* __LAYOUT_H */
diff -Naur mc/src/option.c mc-new/src/option.c
--- mc/src/option.c Tue Jun 5 19:41:44 2001
+++ mc-new/src/option.c Mon Jul 2 15:25:07 2001
@@ -82,6 +82,7 @@
{N_("shell &Patterns"), &easy_patterns, TOGGLE_VARIABLE, 0, "shell-patt" },
{N_("Compute &Totals"), &file_op_compute_totals, TOGGLE_VARIABLE, 0, "compute-totals" },
{N_("&Verbose operation"), &verbose, TOGGLE_VARIABLE, 0, "verbose" },
+ {N_("show cl&Ock"), &show_clock, TOGGLE_VARIABLE, 0, "clock" }, /* by mAX */
{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" },
@@ -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, 10, first_width); /* changed by mAX */
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 < 21; i++) /* changed by mAX */
{
check_options[i].text = _(check_options[i].text);
l1 = strlen (check_options[i].text) + 7;
@@ -192,7 +193,7 @@
i18n_config_flag = 1;
}
- conf_dlg = create_dlg (0, 0, 20, first_width + second_width + 9,
+ conf_dlg = create_dlg (0, 0, 21, first_width + second_width + 9, /* changed by mAX */
dialog_colors, configure_callback, "[Options Menu]",
"option", DLG_CENTER | DLG_GRID);
@@ -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 < 8; i++){ /* changed by mAX */
+ check_options [i+13].widget = check_new (PY + (8-i), PX+2, /* changed by mAX */
XTRACT(i+13));
add_widget (conf_dlg, check_options [i+13].widget);
}
diff -Naur mc/src/setup.c mc-new/src/setup.c
--- mc/src/setup.c Wed Jun 27 16:29:19 2001
+++ mc-new/src/setup.c Mon Jul 2 15:20:02 2001
@@ -297,6 +297,7 @@
{ "column_width_custom_14", &default_column_width[20] },
#else
{ "nice_rotating_dash", &nice_rotating_dash },
+ { "show_clock", &show_clock }, /* show_clock option - mAX */
{ "horizontal_split", &horizontal_split },
#endif
{ 0, 0 }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]