[ekg2-commit] r3901 - in trunk: ekg plugins/ncurses: trunk/ekg/windows.c trunk/plugins/ncurses/commands-pl.txt trunk/plugins/ncurses/main.c trunk/plugins/ncurses/old.c trunk/plugins/ncurses/vars-en.txt trunk/plugins/ncurses/vars-pl.txt

SVN commit svn w toxygen.net
Pią, 14 Mar 2008, 19:54:14 CET


Author: wiechu
Date: 2008-03-14 19:54:13 +0100 (Fri, 14 Mar 2008)
New Revision: 3901

Modified:
   trunk/ekg/windows.c
   trunk/plugins/ncurses/commands-pl.txt
   trunk/plugins/ncurses/main.c
   trunk/plugins/ncurses/old.c
   trunk/plugins/ncurses/vars-en.txt
   trunk/plugins/ncurses/vars-pl.txt
Log:
    Add variable ncurses:mark_on_window_change
    Change syntax of command /ncurses:mark
    Few changes in ncurses_redraw()


Modified: trunk/ekg/windows.c
===================================================================
--- trunk/ekg/windows.c	2008-03-14 15:56:12 UTC (rev 3900)
+++ trunk/ekg/windows.c	2008-03-14 18:54:13 UTC (rev 3901)
@@ -43,7 +43,7 @@
 
 #include "queries.h"
 
-static int window_last_id = -1;		/* ostatnio wyświetlone okno */
+int window_last_id = -1;		/* ostatnio wyświetlone okno */
 
 list_t windows = NULL;			/* lista okien */
 int config_display_crap = 1;		/* czy wyświetlać śmieci? */

Modified: trunk/plugins/ncurses/commands-pl.txt
===================================================================
--- trunk/plugins/ncurses/commands-pl.txt	2008-03-14 15:56:12 UTC (rev 3900)
+++ trunk/plugins/ncurses/commands-pl.txt	2008-03-14 18:54:13 UTC (rev 3901)
@@ -1,6 +1,10 @@
 mark
-	parametry:  [opcje]
-	krotki opis: dodaje znacznik do aktualnego okna
+	parametry:  [numer|opcje]
+	krotki opis: dodaje znacznik do okna
 	
 	-a, --all   dodaje znacznik do wszystkich nieaktywnych okien
 
+
+	Jeśli wywołanie nastąpiło bez podania numeru okna, to marker
+	wstawiany jest w bieżącym oknie. Jeśli numer jest ujemny, to
+	marker wstawiany jest w poprzednio aktywnym oknie.

Modified: trunk/plugins/ncurses/main.c
===================================================================
--- trunk/plugins/ncurses/main.c	2008-03-14 15:56:12 UTC (rev 3900)
+++ trunk/plugins/ncurses/main.c	2008-03-14 18:54:13 UTC (rev 3901)
@@ -50,6 +50,7 @@
 int config_enter_scrolls;
 int config_header_size;
 int config_margin_size;
+int config_mark_on_window_change = 0;
 int config_kill_irc_window = 1;
 int config_statusbar_size;
 int config_lastlog_size;
@@ -150,6 +151,9 @@
 
 	ncurses_window_t *n = w->private;
 
+	if (config_mark_on_window_change)
+		command_exec(NULL, NULL, "/mark -1", 1);
+
 	if ((wc = window_find_sa(NULL, "__contacts", 1))) {
 		/* XXX, na pewno nie chcemy zapisywac polozenia userlisty podczas zmiany okna? */
 		ncurses_contacts_update(wc, 0);
@@ -523,6 +527,7 @@
 	config_header_size = 0;
 	config_enter_scrolls = 0;
 	config_margin_size = 15;
+	config_mark_on_window_change = 0;
 #ifdef WITH_ASPELL
         xfree(config_aspell_lang);
 
@@ -678,6 +683,7 @@
 	variable_add(&ncurses_plugin, ("header_size"), VAR_INT, 1, &config_header_size, header_statusbar_resize, NULL, NULL);
 	variable_add(&ncurses_plugin, ("kill_irc_window"),  VAR_BOOL, 1, &config_kill_irc_window, NULL, NULL, NULL);
         variable_add(&ncurses_plugin, ("margin_size"), VAR_INT, 1, &config_margin_size, NULL, NULL, NULL);
+        variable_add(&ncurses_plugin, ("mark_on_window_change"), VAR_BOOL, 1, &config_mark_on_window_change, NULL, NULL, NULL);
 	variable_add(&ncurses_plugin, ("statusbar_size"), VAR_INT, 1, &config_statusbar_size, header_statusbar_resize, NULL, NULL);
 	variable_add(&ncurses_plugin, ("text_bottomalign"), VAR_INT, 1, &config_text_bottomalign, NULL,
 			variable_map(3, 0, 0, "off", 1, 2, "except-floating", 2, 1, "all"), NULL);

Modified: trunk/plugins/ncurses/old.c
===================================================================
--- trunk/plugins/ncurses/old.c	2008-03-14 15:56:12 UTC (rev 3900)
+++ trunk/plugins/ncurses/old.c	2008-03-14 18:54:13 UTC (rev 3901)
@@ -973,13 +973,18 @@
 			}
 		}
 		return 0;
+	} else if (params[0] && (atoi(params[0]) || xstrcmp(params[1], ("0")))) {
+		extern int window_last_id;
+		int id = atoi(params[0]);
+		w = window_exist(id<0 ? window_last_id : id);
+	} else
+		w = window_current;
+
+	if (w && !w->floating && (w->act != 2)) {
+		n = w->private;
+		n->last_red_line = time(0);
+		n->redraw = 1;
 	}
-
-	w = window_current;
-	n = w->private;
-	n->last_red_line = time(0);
-	n->redraw = 1;
-
 	return 0;
 }
 
@@ -1042,17 +1047,25 @@
 	if (w->floating) {
 		const char *vertical_line_char	= format_find("contacts_vertical_line_char");
 		const char *horizontal_line_char= format_find("contacts_horizontal_line_char");
+		char vline_ch = vertical_line_char[0];
+		char hline_ch = horizontal_line_char[0];
 
+		if (!vline_ch || !hline_ch) {
+			vline_ch = ACS_VLINE;
+			hline_ch = ACS_HLINE;
+			wattrset(n->window, color_pair(COLOR_BLUE, COLOR_BLACK) | A_ALTCHARSET);
+		}
+
 		if ((w->frames & WF_LEFT)) {
 			left++;
 
 			for (y = 0; y < w->height; y++)
-				mvwaddch(n->window, y, n->margin_left, vertical_line_char[0]);
+				mvwaddch(n->window, y, n->margin_left, vline_ch);
 		}
 
 		if ((w->frames & WF_RIGHT)) {
 			for (y = 0; y < w->height; y++)
-				mvwaddch(n->window, y, w->width - 1 - n->margin_right, vertical_line_char[0]);
+				mvwaddch(n->window, y, w->width - 1 - n->margin_right, vline_ch);
 		}
 			
 		if ((w->frames & WF_TOP)) {
@@ -1060,14 +1073,14 @@
 			height--;
 
 			for (x = 0; x < w->width; x++)
-				mvwaddch(n->window, n->margin_top, x, horizontal_line_char[0]);
+				mvwaddch(n->window, n->margin_top, x, hline_ch);
 		}
 
 		if ((w->frames & WF_BOTTOM)) {
 			height--;
 
 			for (x = 0; x < w->width; x++)
-				mvwaddch(n->window, w->height - 1 - n->margin_bottom, x, horizontal_line_char[0]);
+				mvwaddch(n->window, w->height - 1 - n->margin_bottom, x, hline_ch);
 		}
 
 		if ((w->frames & WF_LEFT) && (w->frames & WF_TOP))

Modified: trunk/plugins/ncurses/vars-en.txt
===================================================================
--- trunk/plugins/ncurses/vars-en.txt	2008-03-14 15:56:12 UTC (rev 3900)
+++ trunk/plugins/ncurses/vars-en.txt	2008-03-14 18:54:13 UTC (rev 3901)
@@ -128,6 +128,12 @@
 	
 	defines margin size used by /| with themes
 
+mark_on_window_change
+	type: bool
+	default value: 1
+
+	if set to 1, add marker to current window and then switch to another window
+
 statusbar_size
 	type: integer
 	default value: 1

Modified: trunk/plugins/ncurses/vars-pl.txt
===================================================================
--- trunk/plugins/ncurses/vars-pl.txt	2008-03-14 15:56:12 UTC (rev 3900)
+++ trunk/plugins/ncurses/vars-pl.txt	2008-03-14 18:54:13 UTC (rev 3901)
@@ -174,6 +174,12 @@
 	
 	określa rozmiar marginesu wykorzystywanego przy /| w themach
 
+mark_on_window_change
+	typ: bool
+	domyślna wartość: 0
+
+	określa czy wstawiać marker do okna przy przejściu z niego do innego okna
+
 statusbar_size
 	typ: liczba
 	domyślna wartość: 1



Więcej informacji o liście dyskusyjnej ekg2-commit