1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-26 00:28:25 +00:00

spock's hddtemp & goto patches

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@679 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2006-08-10 16:56:13 +00:00
parent fe7ec00729
commit ca79c81374
8 changed files with 615 additions and 422 deletions

View File

@ -126,6 +126,9 @@ Lucas Brutschy <lbrutschy at users dot sourceforge dot net>
MLDonkey patch MLDonkey patch
if constructs patch if constructs patch
Michal Januszewski <spock at gentoo dot org>
hddtemp support
Moncelier Camille <pixdamix at users dot sourceforge dot net> Moncelier Camille <pixdamix at users dot sourceforge dot net>
METAR patch METAR patch

138
README
View File

@ -17,8 +17,8 @@ DESCRIPTION
as well as the ability to execute programs and scripts, then display as well as the ability to execute programs and scripts, then display
the output from stdout. the output from stdout.
We are always looking for help, and anyone interested in becoming a We are always looking for help, and anyone interested in becoming a de-
developer is welcome. Please use the facilities at SourceForge to make veloper is welcome. Please use the facilities at SourceForge to make
bug reports, feature requests, and submit patches. bug reports, feature requests, and submit patches.
Thanks for your interest in Conky. Thanks for your interest in Conky.
@ -41,12 +41,12 @@ COMPILING
sh autogen.sh # Only required if building from Svn sh autogen.sh # Only required if building from Svn
./configure --prefix=/usr --mandir=/usr/share/man ./configure --prefix=/usr --mandir=/usr/share/man --in-
--infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc fodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --local-
--localstatedir=/var/lib --enable-xft --enable-seti --enable-dou- statedir=/var/lib --enable-xft --enable-seti --enable-double-buffer
ble-buffer --enable-own-window --enable-proc-uptime --enable-mpd --enable-own-window --enable-proc-uptime --enable-mpd --enable-mldonkey
--enable-mldonkey --enable-x11 --enable-portmon --enable-xmms --enable-x11 --enable-portmon --enable-xmms --enable-bmp --enable-auda-
--enable-bmp --enable-audacious --enable-infopipe --enable-bmpx cious --enable-infopipe --enable-bmpx
make make
@ -135,9 +135,9 @@ OPTIONS
CONFIGURATION SETTINGS CONFIGURATION SETTINGS
Default configuration file is $HOME/.conkyrc (can be changed from Default configuration file is $HOME/.conkyrc (can be changed from
conky.c among other things). See conkyrc.sample. If installing from conky.c among other things). See conkyrc.sample. If installing from De-
Debian package, this should be in /usr/share/doc/conky/examples ("gun- bian package, this should be in /usr/share/doc/conky/examples ("gunzip
zip conkyrc.sample.gz" to get conkyrc.sample). conkyrc.sample.gz" to get conkyrc.sample).
You might want to copy it to $HOME/.conkyrc and then start modifying You might want to copy it to $HOME/.conkyrc and then start modifying
it. Other configs can be found at http://conky.sf.net it. Other configs can be found at http://conky.sf.net
@ -216,8 +216,8 @@ CONFIGURATION SETTINGS
imap Default global IMAP server. Arguments are: "host user pass [-i imap Default global IMAP server. Arguments are: "host user pass [-i
interval] [-f folder] [-p port] [-e command]". Default port is interval] [-f folder] [-p port] [-e command]". Default port is
143, default folder is 'INBOX', default interval is 5 minutes. 143, default folder is 'INBOX', default interval is 5 minutes.
If the password is supplied as '*', you will be prompted to If the password is supplied as '*', you will be prompted to en-
enter the password when Conky starts. ter the password when Conky starts.
no_buffers no_buffers
@ -378,10 +378,10 @@ CONFIGURATION SETTINGS
VARIABLES VARIABLES
Colors are parsed using XParsecolor(), there might be a list of them: Colors are parsed using XParsecolor(), there might be a list of them:
/usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html /usr/X11R6/lib/X11/rgb.txt. Also, <http://sedition.com/perl/rgb.html>.
[http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for- Color can be also in #rrggbb format (hex). Note that when displaying
mat (hex). Note that when displaying bytes, power is 1024 and not 1000 bytes, power is 1024 and not 1000 so 1M really means 1024*1024 bytes
so 1M really means 1024*1024 bytes and not 1000*1000. and not 1000*1000.
addr interface addr interface
IP address for an interface IP address for an interface
@ -522,9 +522,9 @@ VARIABLES
execbar command execbar command
Same as exec, except if the first value return is a value Same as exec, except if the first value return is a value be-
between 0-100, it will use that number for a bar. The size for tween 0-100, it will use that number for a bar. The size for the
the bar is currently fixed, but that may change in the future. bar is currently fixed, but that may change in the future.
execgraph command execgraph command
@ -594,6 +594,15 @@ VARIABLES
File system used space File system used space
goto x The next element will be printed at position 'x'.
hddtemp dev, (host,(port))
Displays temperature of a selected hard disk drive as reported
by the hddtemp daemon running on host:port. Default host is
127.0.0.1, default port is 7634.
head logfile lines (interval) head logfile lines (interval)
Displays first N lines of supplied text text file. If interval Displays first N lines of supplied text text file. If interval
is not supplied, Conky assumes 2x Conky's interval. Max of 30 is not supplied, Conky assumes 2x Conky's interval. Max of 30
@ -658,8 +667,8 @@ VARIABLES
i8k_left_fan_status i8k_left_fan_status
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the left fan status as listed in /proc/i8k (translated to human- the left fan status as listed in /proc/i8k (translated to human-
readable). Beware, some laptops i8k reports these fans in readable). Beware, some laptops i8k reports these fans in re-
reverse order. verse order.
i8k_right_fan_rpm i8k_right_fan_rpm
@ -671,8 +680,8 @@ VARIABLES
i8k_right_fan_status i8k_right_fan_status
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the right fan status as listed in /proc/i8k (translated to the right fan status as listed in /proc/i8k (translated to hu-
human-readable). Beware, some laptops i8k reports these fans in man-readable). Beware, some laptops i8k reports these fans in
reverse order. reverse order.
@ -722,23 +731,21 @@ VARIABLES
imap_messages (args) imap_messages (args)
Displays the number of messages in your global IMAP inbox by Displays the number of messages in your global IMAP inbox by de-
default. You can define individual IMAP inboxes seperately by fault. You can define individual IMAP inboxes seperately by
passing arguments to this object. Arguments are: "host user pass passing arguments to this object. Arguments are: "host user pass
[-i interval] [-p port] [-e command]". Default port is 110, [-i interval] [-p port] [-e command]". Default port is 110, de-
default interval is 5 minutes. If the password is supplied as fault interval is 5 minutes. If the password is supplied as '*',
'*', you will be prompted to enter the password when Conky you will be prompted to enter the password when Conky starts.
starts.
imap_unseen (args) imap_unseen (args)
Displays the number of unseen messages in your global IMAP inbox Displays the number of unseen messages in your global IMAP inbox
by default. You can define individual IMAP inboxes seperately by by default. You can define individual IMAP inboxes seperately by
passing arguments to this object. Arguments are: "host user pass passing arguments to this object. Arguments are: "host user pass
[-i interval] [-p port] [-e command]". Default port is 110, [-i interval] [-p port] [-e command]". Default port is 110, de-
default interval is 5 minutes. If the password is supplied as fault interval is 5 minutes. If the password is supplied as '*',
'*', you will be prompted to enter the password when Conky you will be prompted to enter the password when Conky starts.
starts.
kernel Kernel version kernel Kernel version
@ -860,11 +867,9 @@ VARIABLES
status: Display if battery is fully charged, charging, discharg- status: Display if battery is fully charged, charging, discharg-
ing or absent (running on AC) ing or absent (running on AC)
percent: Display charge of battery in percent, if charging or percent: Display charge of battery in percent, if charging or
discharging. Nothing will be displayed, if battery is fully discharging. Nothing will be displayed, if battery is fully
charged or absent. charged or absent.
time: Display the time remaining until the battery will be fully time: Display the time remaining until the battery will be fully
charged or discharged at current rate. Nothing is displayed, if charged or discharged at current rate. Nothing is displayed, if
battery is absent or if it's present but fully charged and not battery is absent or if it's present but fully charged and not
@ -875,10 +880,9 @@ VARIABLES
Displays the number of unseen messages in your global POP3 inbox Displays the number of unseen messages in your global POP3 inbox
by default. You can define individual POP3 inboxes seperately by by default. You can define individual POP3 inboxes seperately by
passing arguments to this object. Arguments are: "host user pass passing arguments to this object. Arguments are: "host user pass
[-i interval] [-p port] [-e command]". Default port is 110, [-i interval] [-p port] [-e command]". Default port is 110, de-
default interval is 5 minutes. If the password is supplied as fault interval is 5 minutes. If the password is supplied as '*',
'*', you will be prompted to enter the password when Conky you will be prompted to enter the password when Conky starts.
starts.
pop3_used (args) pop3_used (args)
@ -936,46 +940,32 @@ VARIABLES
in the range 1 to 65535. Valid items are: in the range 1 to 65535. Valid items are:
count - total number of connections in the range count - total number of connections in the range
rip - remote ip address rip - remote ip address
rhost - remote host name rhost - remote host name
rport - remote port number rport - remote port number
rservice - remote service name from /etc/services rservice - remote service name from /etc/services
lip - local ip address lip - local ip address
lhost - local host name lhost - local host name
lport - local port number lport - local port number
lservice - local service name from /etc/services lservice - local service name from /etc/services
The connection index provides you with access to each connection The connection index provides you with access to each connection
in the port monitor. The monitor will return information for in the port monitor. The monitor will return information for in-
index values from 0 to n-1 connections. Values higher than n-1 dex values from 0 to n-1 connections. Values higher than n-1 are
are simply ignored. For the "count" item, the connection index simply ignored. For the "count" item, the connection index must
must be omitted. It is required for all other items. be omitted. It is required for all other items.
Examples: Examples:
${tcp_portmon 6881 6999 count} - displays the number of connec- ${tcp_portmon 6881 6999 count} - displays the number of connec-
tions in the bittorrent port range tions in the bittorrent port range
${tcp_portmon 22 22 rip 0} - displays the remote host ip of the ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
first sshd connection first sshd connection
${tcp_portmon 22 22 rip 9} - displays the remote host ip of the ${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
tenth sshd connection tenth sshd connection
${tcp_portmon 1 1024 rhost 0} - displays the remote host name of ${tcp_portmon 1 1024 rhost 0} - displays the remote host name of
the first connection on a privileged port the first connection on a privileged port
${tcp_portmon 1 1024 rport 4} - displays the remote host port of ${tcp_portmon 1 1024 rport 4} - displays the remote host port of
the fifth connection on a privileged port the fifth connection on a privileged port
${tcp_portmon 1 65535 lservice 14} - displays the local service ${tcp_portmon 1 65535 lservice 14} - displays the local service
name of the fifteenth connection in the range of all ports name of the fifteenth connection in the range of all ports
@ -991,14 +981,18 @@ VARIABLES
thread. Use this if you have a slow script to keep Conky updat- thread. Use this if you have a slow script to keep Conky updat-
ing. You should make the interval slightly longer then the time ing. You should make the interval slightly longer then the time
it takes your script to execute. For example, if you have a it takes your script to execute. For example, if you have a
script that take 5 seconds to execute, you should make the script that take 5 seconds to execute, you should make the in-
interval at least 6 seconds. See also $execi. terval at least 6 seconds. See also $execi.
offset (pixels) offset (pixels)
Move text over by N pixels. See also $voffset. Move text over by N pixels. See also $voffset.
tab (width, (start))
Puts a tab of the specified width, starting from column 'start'.
tail logfile lines (interval) tail logfile lines (interval)
Displays last N lines of supplied text text file. If interval is Displays last N lines of supplied text text file. If interval is
not supplied, Conky assumes 2x Conky's interval. Max of 30 lines not supplied, Conky assumes 2x Conky's interval. Max of 30 lines
@ -1010,16 +1004,27 @@ VARIABLES
mat mat
utime (format)
Display time in UTC (universal coordinate time).
tztime (timezone) (format)
Local time for specified timezone, see man strftime to get more
information about format. The timezone argument is specified in
similar fashion as TZ environment variable. For hints, look in
/usr/share/zoneinfo. e.g. US/Pacific, Europe/Zurich, etc.
totaldown net totaldown net
Total download, overflows at 4 GB on Linux with 32-bit arch and Total download, overflows at 4 GB on Linux with 32-bit arch and
there doesn't seem to be a way to know how many times it has there doesn't seem to be a way to know how many times it has al-
already done that before conky has started. ready done that before conky has started.
top type, num top type, num
This takes arguments in the form:top (name) (number) Basically, This takes arguments in the form:top (name) (number) Basically,
processes are ranked from highest to lowest in terms of cpu processes are ranked from highest to lowest in terms of cpu us-
usage, which is what (num) represents. The types are: "name", age, which is what (num) represents. The types are: "name",
"pid", "cpu", and "mem". There can be a max of 10 processes "pid", "cpu", and "mem". There can be a max of 10 processes
listed. listed.
@ -1167,10 +1172,9 @@ BUGS
which makes Conky to create its own window. which makes Conky to create its own window.
SEE ALSO SEE ALSO
http://conky.sourceforge.net [http://conky.sourceforge.net] <http://conky.sourceforge.net>
http://www.sourceforge.net/projects/conky [http://www.source- <http://www.sourceforge.net/projects/conky>
forge.net/projects/conky]
#conky on irc.freenode.net #conky on irc.freenode.net

View File

@ -291,6 +291,20 @@ if test x$want_seti = xyes; then
AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats]) AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
fi fi
dnl
dnl Hddtemp
dnl
want_hddtemp=yes
AC_ARG_ENABLE(hddtemp,
[ --enable-hddtemp enable if you want hddtemp support [[default=yes]]],
[want_hddtemp="$enableval"])
AM_CONDITIONAL(BUILD_HDDTEMP, test x$want_hddtemp = xyes)
if test x$want_hddtemp = xyes; then
AC_DEFINE(HDDTEMP, 1, [Define if you want hddtemp support])
fi
dnl dnl
dnl MPD dnl MPD
dnl dnl

File diff suppressed because it is too large Load Diff

View File

@ -452,6 +452,27 @@
<para></para></listitem> <para></para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command><option>goto</option></command>
<option>x</option>
</term>
<listitem>
The next element will be printed at position 'x'.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>hddtemp</option></command>
<option>dev, (host,(port))</option>
</term>
<listitem>
Displays temperature of a selected hard disk drive as reported by the hddtemp daemon running on host:port.
Default host is 127.0.0.1, default port is 7634.
<para></para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command><option>head</option></command> <command><option>head</option></command>
@ -1174,6 +1195,16 @@
<para></para></listitem> <para></para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command><option>tab</option></command>
<option>(width, (start))</option>
</term>
<listitem>
Puts a tab of the specified width, starting from column 'start'.
<para></para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command><option>tail</option></command> <command><option>tail</option></command>

View File

@ -62,9 +62,13 @@ if BUILD_X11
x11 = x11.c x11 = x11.c
endif endif
conky_SOURCES = common.c fs.c $(linux) mail.c mixer.c $(seti) $(mpd) $(xmms2) $(solaris) $(freebsd) $(netbsd) $(port_monitors) conky.c conky.h $(x11) $(mldonkey) remoted.c remoted.h remotec.c remotec.h $(xmms) $(bmpx) if BUILD_HDDTEMP
hddtemp = hddtemp.c
endif
conky_SOURCES = common.c fs.c $(linux) mail.c mixer.c $(seti) $(mpd) $(xmms2) $(solaris) $(freebsd) $(netbsd) $(port_monitors) conky.c conky.h $(x11) $(mldonkey) remoted.c remoted.h remotec.c remotec.h $(xmms) $(bmpx) $(hddtemp)
AM_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS) $(PTHREAD_LIBS) -lm AM_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS) $(PTHREAD_LIBS) -lm
EXTRA_DIST = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \ EXTRA_DIST = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
libmpdclient.h xmms2.c top.h mldonkey.c ftp.c ftp.h x11.c libmpdclient.h xmms2.c top.h mldonkey.c ftp.c ftp.h x11.c hddtemp.c

View File

@ -450,6 +450,8 @@ enum {
OFFSET, OFFSET,
VOFFSET, VOFFSET,
FONT, FONT,
GOTO,
TAB,
}; };
static struct special_t { static struct special_t {
@ -752,6 +754,17 @@ static inline void new_alignc(char *buf, long c)
new_special(buf, ALIGNC)->arg = c; new_special(buf, ALIGNC)->arg = c;
} }
static inline void new_goto(char *buf, long c)
{
new_special(buf, GOTO)->arg = c;
}
static inline void new_tab(char *buf, int a, int b) {
struct special_t *s = new_special(buf, TAB);
s->width = a;
s->arg = b;
}
/* quite boring functions */ /* quite boring functions */
static inline void for_each_line(char *b, void (*f) (char *)) static inline void for_each_line(char *b, void (*f) (char *))
@ -856,6 +869,8 @@ enum text_object_type {
OBJ_fs_size, OBJ_fs_size,
OBJ_fs_used, OBJ_fs_used,
OBJ_fs_used_perc, OBJ_fs_used_perc,
OBJ_goto,
OBJ_tab,
OBJ_hr, OBJ_hr,
OBJ_offset, OBJ_offset,
OBJ_voffset, OBJ_voffset,
@ -1032,6 +1047,9 @@ enum text_object_type {
OBJ_iconv_start, OBJ_iconv_start,
OBJ_iconv_stop, OBJ_iconv_stop,
#endif #endif
#ifdef HDDTEMP
OBJ_hddtemp,
#endif
}; };
struct text_object { struct text_object {
@ -1112,6 +1130,11 @@ struct text_object {
int connection_index; /* 0 to n-1 connections. */ int connection_index; /* 0 to n-1 connections. */
} tcp_port_monitor; } tcp_port_monitor;
#endif #endif
struct {
char *addr;
int port;
char *dev;
} hddtemp; /* 2 */
} data; } data;
}; };
@ -1961,6 +1984,12 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
info.first_process = NULL; info.first_process = NULL;
} }
break; break;
#ifdef HDDTEMP
case OBJ_hddtemp:
free(objs[i].data.hddtemp.dev);
free(objs[i].data.hddtemp.addr);
break;
#endif
} }
} }
free(objs); free(objs);
@ -2313,6 +2342,28 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
END OBJ(hr, 0) obj->data.i = arg ? atoi(arg) : 1; END OBJ(hr, 0) obj->data.i = arg ? atoi(arg) : 1;
END OBJ(offset, 0) obj->data.i = arg ? atoi(arg) : 1; END OBJ(offset, 0) obj->data.i = arg ? atoi(arg) : 1;
END OBJ(voffset, 0) obj->data.i = arg ? atoi(arg) : 1; END OBJ(voffset, 0) obj->data.i = arg ? atoi(arg) : 1;
END OBJ(goto, 0)
if (!arg) {
ERR("goto needs arguments");
obj->type = OBJ_text;
obj->data.s = strdup("${goto}");
return NULL;
}
obj->data.i = atoi(arg);
END OBJ(tab, 0)
int a = 10, b = 0;
if (arg) {
if (sscanf(arg, "%d %d", &a, &b) != 2)
sscanf(arg, "%d", &b);
}
if (a <= 0)
a = 1;
obj->data.pair.a = a;
obj->data.pair.b = b;
END OBJ(i2c, INFO_I2C) char buf1[64], buf2[64]; END OBJ(i2c, INFO_I2C) char buf1[64], buf2[64];
int n; int n;
@ -2876,6 +2927,17 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
memset(&(info.bmpx), 0, sizeof(struct bmpx_s)); memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
END END
#endif #endif
#ifdef HDDTEMP
OBJ(hddtemp, 0)
if (!arg || scan_hddtemp(arg, &obj->data.hddtemp.dev,
&obj->data.hddtemp.addr, &obj->data.hddtemp.port)) {
ERR("hddtemp needs arguments");
obj->type = OBJ_text;
obj->data.s = strdup("${hddtemp}");
return NULL;
}
END
#endif
#ifdef TCP_PORT_MONITOR #ifdef TCP_PORT_MONITOR
OBJ(tcp_portmon, INFO_TCP_PORT_MONITOR) OBJ(tcp_portmon, INFO_TCP_PORT_MONITOR)
int argc, port_begin, port_end, item, connection_index; int argc, port_begin, port_end, item, connection_index;
@ -3871,9 +3933,29 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
v[obj->data.loadavg[0] - v[obj->data.loadavg[0] -
1]); 1]);
} }
OBJ(goto) {
new_goto(p, obj->data.i);
}
OBJ(tab) {
new_tab(p, obj->data.pair.a, obj->data.pair.b);
}
OBJ(hr) { OBJ(hr) {
new_hr(p, obj->data.i); new_hr(p, obj->data.i);
} }
OBJ(hddtemp) {
char *temp;
char unit;
temp = get_hddtemp_info(obj->data.hddtemp.dev,
obj->data.hddtemp.addr, obj->data.hddtemp.port, &unit);
if (!temp) {
snprintf(p, p_max_size, "N/A");
} else if (unit == '*') {
snprintf(p, p_max_size, "%s", temp);
} else {
snprintf(p, p_max_size, "%s?%c", temp, unit);
}
}
OBJ(offset) { OBJ(offset) {
new_offset(p, obj->data.i); new_offset(p, obj->data.i);
} }
@ -4834,57 +4916,9 @@ static inline int get_string_width_special(char *s)
} }
#ifdef X11 #ifdef X11
static void text_size_updater(char *s);
int last_font_height; int last_font_height;
static void text_size_updater(char *s)
{
int w = 0;
char *p;
/* get string widths and skip specials */
p = s;
while (*p) {
if (*p == SPECIAL_CHAR) {
*p = '\0';
w += get_string_width(s);
*p = SPECIAL_CHAR;
if (specials[special_index].type == BAR
|| specials[special_index].type == GRAPH) {
w += specials[special_index].width;
if (specials[special_index].height > last_font_height) {
last_font_height = specials[special_index].height;
last_font_height += font_ascent();
}
} else if (specials[special_index].type == OFFSET) {
w += specials[special_index].arg + get_string_width("a"); /* filthy, but works */
} else if (specials[special_index].type == VOFFSET) {
last_font_height += specials[special_index].arg;
} else if (specials[special_index].type == FONT) {
selected_font = specials[special_index].font_added;
if (font_height() > last_font_height) {
last_font_height = font_height();
}
}
special_index++;
s = p + 1;
}
p++;
}
w += get_string_width(s);
if (w > text_width) {
text_width = w;
}
if (text_width > maximum_width && maximum_width) {
text_width = maximum_width;
}
text_height += last_font_height;
last_font_height = font_height();
}
#endif /* X11 */
#ifdef X11
static void update_text_area() static void update_text_area()
{ {
int x, y; int x, y;
@ -4974,6 +5008,64 @@ static int cur_x, cur_y; /* current x and y for drawing */
static int draw_mode; /* FG, BG or OUTLINE */ static int draw_mode; /* FG, BG or OUTLINE */
static long current_color; static long current_color;
#ifdef X11
static void text_size_updater(char *s)
{
int w = 0;
char *p;
/* get string widths and skip specials */
p = s;
while (*p) {
if (*p == SPECIAL_CHAR) {
*p = '\0';
w += get_string_width(s);
*p = SPECIAL_CHAR;
if (specials[special_index].type == BAR
|| specials[special_index].type == GRAPH) {
w += specials[special_index].width;
if (specials[special_index].height > last_font_height) {
last_font_height = specials[special_index].height;
last_font_height += font_ascent();
}
} else if (specials[special_index].type == OFFSET) {
w += specials[special_index].arg + get_string_width("a"); /* filthy, but works */
} else if (specials[special_index].type == VOFFSET) {
last_font_height += specials[special_index].arg;
} else if (specials[special_index].type == GOTO) {
if (specials[special_index].arg >= 0)
w += (int)specials[special_index].arg - cur_x;
} else if (specials[special_index].type == TAB) {
int start = specials[special_index].arg;
int step = specials[special_index].width;
if (!step || step < 0)
step = 10;
w += step - (cur_x - text_start_x - start) % step;
} else if (specials[special_index].type == FONT) {
selected_font = specials[special_index].font_added;
if (font_height() > last_font_height) {
last_font_height = font_height();
}
}
special_index++;
s = p + 1;
}
p++;
}
w += get_string_width(s);
if (w > text_width) {
text_width = w;
}
if (text_width > maximum_width && maximum_width) {
text_width = maximum_width;
}
text_height += last_font_height;
last_font_height = font_height();
}
#endif /* X11 */
static inline void set_foreground_color(long c) static inline void set_foreground_color(long c)
{ {
current_color = c; current_color = c;
@ -5411,13 +5503,25 @@ static void draw_line(char *s)
break; break;
case OFFSET: case OFFSET:
{
w += specials[special_index].arg; w += specials[special_index].arg;
}
break; break;
case VOFFSET: case VOFFSET:
{
cur_y += specials[special_index].arg; cur_y += specials[special_index].arg;
break;
case GOTO:
if (specials[special_index].arg >= 0)
cur_x = (int)specials[special_index].arg;
break;
case TAB:
{
int start = specials[special_index].arg;
int step = specials[special_index].width;
if (!step || step < 0)
step = 10;
w = step - (cur_x - text_start_x - start) % step;
} }
break; break;

View File

@ -599,6 +599,12 @@ extern mldonkey_config mlconfig;
int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info); int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info);
#endif #endif
/* in hddtemp.c */
#ifdef HDDTEMP
int scan_hddtemp(const char *arg, char **dev, char **addr, int *port);
char *get_hddtemp_info(char *dev, char *addr, int port, char *unit);
#endif /* HDDTEMP */
/* in linux.c */ /* in linux.c */
/* nothing to see here */ /* nothing to see here */
@ -607,3 +613,5 @@ int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info);
extern int do_it(void); extern int do_it(void);
#endif #endif