name directory correctly
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
What do these patches do ?
|
||||
==========================
|
||||
|
||||
1. HKEY - Hybrid Right/Left Key option in LCDd.conf
|
||||
|
||||
If selected, the same config works on 4 or 6 key pads, any key wakes up
|
||||
the menus, the keys behave a bit more intuitively and if you have a menu
|
||||
w/ only ring or slider you can't get stuck in them on a 4 key system.
|
||||
Ultimately, I wonder if the key processing could be simplified a bit, it
|
||||
currently has 3 levels, that might be able to be flattened, I've been
|
||||
pondering it and don't have a simple sol'n yet, but feel like there's
|
||||
one there, so I'll keep thinking on it for now.
|
||||
|
||||
2. OPT - adds options to the LCDd.conf for;
|
||||
storing the default display string on the CFontz633.c, we use this to
|
||||
put up a "starting" message for reboot for example.
|
||||
setting the main menu name - which show's up on the LCD menu list, we
|
||||
give it a more meaningful name like "admin" for the menus, instead of
|
||||
"lcdproc"
|
||||
setting the goodbye msg - which we set to "shutting down", instead of
|
||||
"Thanks for using lcdproc+linux"
|
||||
|
||||
3. SEG - adds the ability to get a stack trace for the LCDd daemon. I
|
||||
didn't actually catch a useful trace w/ it, but might be a nice
|
||||
diagnostic ability or not worth the trouble, maybe gdb's just easier
|
||||
when you need?
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
Here's a patch for lcdproc to add a config file, as promised, it applies
|
||||
to the 20060226 version from CVS.
|
||||
|
||||
It covers the basics and get's the infrastructure to add more, like on
|
||||
the process size screen, we may want an option not to add up the sizes
|
||||
of each of the procs, since in a shared mem app, the answer is
|
||||
incorrectly large.
|
||||
|
||||
I realize in doing it that I'm not entirely clear on the purpose of "on
|
||||
time" "off time" and "show invisible" in the sequence structure, so
|
||||
they're now settable, but I could use some help putting more descriptive
|
||||
helpful text in the lcdproc.conf file to describe them for folks.
|
||||
|
||||
thanks,
|
||||
andrew
|
||||
|
||||
@@ -0,0 +1,373 @@
|
||||
diff --exclude='.??*' --exclude=config.h --exclude='*.orig' --exclude=Makefile --exclude='*.o' --exclude=Doxyfile --exclude='*.a' --exclude=config.log --exclude=config.status --exclude='init-*' --exclude lcdproc -Nuarp lcdproc/lcdproc.conf lcdproc-cfgfile/lcdproc.conf
|
||||
--- lcdproc/lcdproc.conf 1969-12-31 16:00:00.000000000 -0800
|
||||
+++ lcdproc-cfgfile/lcdproc.conf 2006-02-27 05:15:00.000000000 -0800
|
||||
@@ -0,0 +1,69 @@
|
||||
+# LCDproc client configuration file
|
||||
+
|
||||
+## Options for lcdproc ##
|
||||
+[lcdproc]
|
||||
+# address of the LCDd server to connect to
|
||||
+Server=localhost
|
||||
+
|
||||
+# Port of the server to connect to
|
||||
+Port=13666
|
||||
+
|
||||
+# set reporting level
|
||||
+ReportLevel=2
|
||||
+
|
||||
+# report to to syslog ?
|
||||
+ReportToSyslog=false
|
||||
+
|
||||
+# stay in foreground ?
|
||||
+Foreground=false
|
||||
+
|
||||
+# slow down initial announcement of modes (in 1/100s)
|
||||
+#delay=2
|
||||
+
|
||||
+# screen specific configuration options
|
||||
+[CPU]
|
||||
+# Show screen
|
||||
+Active = True
|
||||
+OnTime = 1
|
||||
+OffTime = 2
|
||||
+ShowInvisible = false
|
||||
+[Memory]
|
||||
+# Show screen
|
||||
+Active = True
|
||||
+[Load]
|
||||
+# Show screen
|
||||
+Active = True
|
||||
+[TimeDate]
|
||||
+# Show screen
|
||||
+Active = True
|
||||
+[About]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[SMP-CPU]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[OldTime]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[BigClock]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[Uptime]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[Battery]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[CPUGraph]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[ProcSize]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[Disk]
|
||||
+# Show screen
|
||||
+Active = false
|
||||
+[MiniClock]
|
||||
+# Show screen
|
||||
+Active = True
|
||||
+# EOF
|
||||
diff --exclude='.??*' --exclude=config.h --exclude='*.orig' --exclude=Makefile --exclude='*.o' --exclude=Doxyfile --exclude='*.a' --exclude=config.log --exclude=config.status --exclude='init-*' --exclude lcdproc -Nuarp lcdproc/main.c lcdproc-cfgfile/main.c
|
||||
--- lcdproc/main.c 2006-02-19 00:00:11.000000000 -0800
|
||||
+++ lcdproc-cfgfile/main.c 2006-02-27 05:13:14.000000000 -0800
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "mode.h"
|
||||
#include "shared/sockets.h"
|
||||
#include "shared/debug.h"
|
||||
+#include "shared/configfile.h"
|
||||
+#include "shared/report.h"
|
||||
|
||||
#include "batt.h"
|
||||
#include "chrono.h"
|
||||
@@ -53,6 +55,10 @@ static struct utsname unamebuf;
|
||||
static void HelpScreen(int exit_state);
|
||||
static void exit_program(int val);
|
||||
static void main_loop();
|
||||
+static int process_command_line(int argc, char **argv);
|
||||
+static int process_configfile(char *cfgfile);
|
||||
+#define CHAIN(e,f) { if( e>=0 ) { e=(f); }}
|
||||
+#define CHAIN_END(e,msg) { if( e<0 ) { report( RPT_CRIT,(msg)); exit(e); }}
|
||||
|
||||
static int islow = -1;
|
||||
|
||||
@@ -64,26 +70,39 @@ mode sequence[] =
|
||||
{
|
||||
// flags default ACTIVE will run by default
|
||||
// longname which on off inv timer flags
|
||||
- { "CPU", 'C', 1, 2, 0, 0xffff, ACTIVE, cpu_screen }, // [C]PU
|
||||
- { "Memory", 'M', 4, 16, 0, 0xffff, ACTIVE, mem_screen }, // [M]emory
|
||||
- { "Load", 'L', 64, 128, 1, 0xffff, ACTIVE, xload_screen }, // [L]oad (load histogram)
|
||||
- { "TimeDate", 'T', 4, 64, 0, 0xffff, ACTIVE, time_screen }, // [T]ime/Date
|
||||
- { "About", 'A', 999, 9999, 0, 0xffff, ACTIVE, credit_screen }, // [A]bout (credits)
|
||||
- { "SMP-CPU", 'P', 1, 2, 0, 0xffff, 0, cpu_smp_screen }, // CPU_SM[P]
|
||||
- { "OldTime", 'O', 4, 64, 0, 0xffff, 0, clock_screen }, // [O]ld Timescreen
|
||||
- { "BigClock", 'K', 4, 64, 0, 0xffff, 0, big_clock_screen }, // big cloc[K]
|
||||
- { "Uptime", 'U', 4, 128, 0, 0xffff, 0, uptime_screen }, // Old [U]ptime Screen
|
||||
- { "Battery", 'B', 32, 256, 1, 0xffff, 0, battery_screen }, // [B]attery Status
|
||||
- { "CPUGraph", 'G', 1, 2, 0, 0xffff, 0, cpu_graph_screen }, // CPU histogram [G]raph
|
||||
- { "ProcSize", 'S', 16, 256, 1, 0xffff, 0, mem_top_screen }, // [S]ize of biggest processes
|
||||
- { "Disk", 'D', 256, 256, 1, 0xffff, 0, disk_screen }, // [D]isk stats
|
||||
- { "MiniClock", 'N', 4, 64, 0, 0xffff, 0, mini_clock_screen }, // Mi[n]i clock
|
||||
- { NULL, 0, 0, 0, 0, 0,}, // No more.. all done.
|
||||
+ { "CPU", 'C', 1, 2, 0, 0xffff, ACTIVE, cpu_screen }, // [C]PU
|
||||
+ { "Memory", 'M', 4, 16, 0, 0xffff, ACTIVE, mem_screen }, // [M]emory
|
||||
+ { "Load", 'L', 64, 128, 1, 0xffff, ACTIVE, xload_screen }, // [L]oad (load histogram)
|
||||
+ { "TimeDate", 'T', 4, 64, 0, 0xffff, ACTIVE, time_screen }, // [T]ime/Date
|
||||
+ { "About", 'A', 999, 9999, 0, 0xffff, ACTIVE, credit_screen }, // [A]bout (credits)
|
||||
+ { "SMP-CPU", 'P', 1, 2, 0, 0xffff, 0, cpu_smp_screen }, // CPU_SM[P]
|
||||
+ { "OldTime", 'O', 4, 64, 0, 0xffff, 0, clock_screen }, // [O]ld Timescreen
|
||||
+ { "BigClock", 'K', 4, 64, 0, 0xffff, 0, big_clock_screen }, // big cloc[K]
|
||||
+ { "Uptime", 'U', 4, 128, 0, 0xffff, 0, uptime_screen }, // Old [U]ptime Screen
|
||||
+ { "Battery", 'B', 32, 256, 1, 0xffff, 0, battery_screen }, // [B]attery Status
|
||||
+ { "CPUGraph", 'G', 1, 2, 0, 0xffff, 0, cpu_graph_screen }, // CPU histogram [G]raph
|
||||
+ { "ProcSize", 'S', 16, 256, 1, 0xffff, 0, mem_top_screen }, // [S]ize of biggest processes
|
||||
+ { "Disk", 'D', 256, 256, 1, 0xffff, 0, disk_screen }, // [D]isk stats
|
||||
+ { "MiniClock", 'N', 4, 64, 0, 0xffff, 0, mini_clock_screen },// Mi[n]i clock
|
||||
+ { NULL, 0, 0, 0, 0, 0, 0, 0}, // No more.. all done.
|
||||
};
|
||||
|
||||
|
||||
|
||||
// TODO: Config file; not just command line
|
||||
+/* All variables are set to 'unset' values*/
|
||||
+#define UNSET_INT -1
|
||||
+#define UNSET_STR "\01"
|
||||
+#define DEFAULT_SERVER "127.0.0.1"
|
||||
+#define DEFAULT_CONFIGFILE "/usr/local/etc/lcdproc.conf"
|
||||
+char * progname = "lcdproc";
|
||||
+char * server = NULL;
|
||||
+int port = LCDPORT;
|
||||
+int daemonize = FALSE;
|
||||
+static int report_level = UNSET_INT;
|
||||
+static int report_dest = UNSET_INT;
|
||||
+char configfile[256]; /* a lot of space in the executable. */
|
||||
+
|
||||
|
||||
const char *get_hostname()
|
||||
{
|
||||
@@ -134,11 +153,7 @@ void clear_modes()
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
- int i, j;
|
||||
- int c;
|
||||
- char *server = NULL;
|
||||
- int port = LCDPORT;
|
||||
- int daemonize = FALSE;
|
||||
+ int error = 0;
|
||||
|
||||
/* get uname information */
|
||||
if (uname(&unamebuf) == -1) {
|
||||
@@ -152,12 +167,77 @@ main(int argc, char **argv)
|
||||
signal(SIGHUP, exit_program); // kill -HUP
|
||||
signal(SIGKILL, exit_program); // kill -9 [cannot be trapped; but ...]
|
||||
|
||||
+ /* Set default config file, command line may overwrite */
|
||||
+ strncpy(configfile, DEFAULT_CONFIGFILE, sizeof(configfile));
|
||||
+
|
||||
+ /* Read command line*/
|
||||
+ CHAIN( error, process_command_line(argc, argv) );
|
||||
+
|
||||
+ /* Read config file*/
|
||||
+ if (strcmp(configfile, UNSET_STR)!=0)
|
||||
+ CHAIN( error, process_configfile(configfile) );
|
||||
+
|
||||
+ CHAIN_END( error, "Error in config file or command line\n" );
|
||||
+
|
||||
+ if (server == NULL)
|
||||
+ server = DEFAULT_SERVER;
|
||||
+
|
||||
+ // Connect to the server...
|
||||
+ usleep(500000); // wait for the server to start up
|
||||
+ sock = sock_connect(server, port);
|
||||
+ if (sock <= 0) {
|
||||
+ fprintf(stderr, "Error connecting to LCD server %s on port %d.\n"
|
||||
+ "Check to see that the server is running and operating normally.\n",
|
||||
+ server, port);
|
||||
+ return(EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ sock_send_string(sock, "hello\n");
|
||||
+ usleep(500000); // wait for the server to say hi.
|
||||
+
|
||||
+ // We grab the real values below, from the "connect" line.
|
||||
+ lcd_wid = 20;
|
||||
+ lcd_hgt = 4;
|
||||
+ lcd_cellwid = 5;
|
||||
+ lcd_cellhgt = 8;
|
||||
+
|
||||
+ if (daemonize) {
|
||||
+ if (daemon(1,0) != 0) {
|
||||
+ fprintf(stderr, "Error: daemonize failed");
|
||||
+ return(EXIT_FAILURE);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Init the status gatherers...
|
||||
+ mode_init();
|
||||
+
|
||||
+ // And spew stuff!
|
||||
+ main_loop();
|
||||
+
|
||||
+ // Clean up
|
||||
+ exit_program(EXIT_SUCCESS);
|
||||
+
|
||||
+ return(0);
|
||||
+}
|
||||
+
|
||||
+/* parses arguments given on command line */
|
||||
+static int
|
||||
+process_command_line(int argc, char **argv)
|
||||
+{
|
||||
+ int i;
|
||||
+ int c;
|
||||
+
|
||||
/* No error output from getopt */
|
||||
opterr = 0;
|
||||
|
||||
/* get options */
|
||||
- while ((c = getopt( argc, argv, "s:p:e:dhv")) > 0) {
|
||||
+ while ((c = getopt( argc, argv, "s:p:e:c:dhv")) > 0) {
|
||||
switch (c) {
|
||||
+ // c is for config file
|
||||
+ case 'c':
|
||||
+ strncpy(configfile, optarg, sizeof(configfile));
|
||||
+ configfile[sizeof(configfile)-1] = 0; /* Terminate string */
|
||||
+ break;
|
||||
// s is for server
|
||||
case 's':
|
||||
if (server == NULL)
|
||||
@@ -203,50 +283,71 @@ main(int argc, char **argv)
|
||||
int found = set_mode(shortname, argv[i], 1);
|
||||
|
||||
if (!found) {
|
||||
- fprintf(stderr, "Invalid Mode: %c, ignoring\n", argv[i][0]);
|
||||
+ fprintf(stderr, "Invalid Mode: %c\n", argv[i][0]);
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
- if (server == NULL)
|
||||
- server = "localhost";
|
||||
+/* reads and parses configuration file */
|
||||
+static int
|
||||
+process_configfile(char *configfile)
|
||||
+{
|
||||
+ int k;
|
||||
|
||||
- // Connect to the server...
|
||||
- usleep(500000); // wait for the server to start up
|
||||
- sock = sock_connect(server, port);
|
||||
- if (sock <= 0) {
|
||||
- fprintf(stderr, "Error connecting to LCD server %s on port %d.\n"
|
||||
- "Check to see that the server is running and operating normally.\n",
|
||||
- server, port);
|
||||
- return(EXIT_FAILURE);
|
||||
- }
|
||||
+ debug( RPT_DEBUG, "%s()", __FUNCTION__ );
|
||||
|
||||
- sock_send_string(sock, "hello\n");
|
||||
- usleep(500000); // wait for the server to say hi.
|
||||
+ /* Read server settings*/
|
||||
|
||||
- // We grab the real values below, from the "connect" line.
|
||||
- lcd_wid = 20;
|
||||
- lcd_hgt = 4;
|
||||
- lcd_cellwid = 5;
|
||||
- lcd_cellhgt = 8;
|
||||
+ if( strcmp( configfile, UNSET_STR ) == 0 ) {
|
||||
+ configfile = DEFAULT_CONFIGFILE;
|
||||
+ }
|
||||
+ if( config_read_file( configfile ) != 0 ) {
|
||||
+ report( RPT_CRIT, "Could not read config file: %s", configfile );
|
||||
+ return -1;
|
||||
+ //report( RPT_WARNING, "Could not read config file: %s", configfile );
|
||||
+ }
|
||||
|
||||
- if (daemonize) {
|
||||
- if (daemon(1,0) != 0) {
|
||||
- fprintf(stderr, "Error: daemonize failed");
|
||||
- return(EXIT_FAILURE);
|
||||
+ if( server == NULL ) {
|
||||
+ server = strdup( config_get_string( progname, "Server", 0, DEFAULT_SERVER ));
|
||||
+ }
|
||||
+ if( port == UNSET_INT ) {
|
||||
+ port = config_get_int( progname, "Port", 0, LCDPORT );
|
||||
+ }
|
||||
+ if( report_level == UNSET_INT ) {
|
||||
+ report_level = config_get_int( progname, "ReportLevel", 0, RPT_WARNING );
|
||||
+ }
|
||||
+ if( report_dest == UNSET_INT ) {
|
||||
+ if( config_get_bool( progname, "ReportToSyslog", 0, 0 )) {
|
||||
+ report_dest = RPT_DEST_SYSLOG;
|
||||
+ } else {
|
||||
+ report_dest = RPT_DEST_STDERR;
|
||||
}
|
||||
- }
|
||||
-
|
||||
- // Init the status gatherers...
|
||||
- mode_init();
|
||||
-
|
||||
- // And spew stuff!
|
||||
- main_loop();
|
||||
+ }
|
||||
+ if( daemonize == UNSET_INT ) {
|
||||
+ daemonize = config_get_bool( progname, "Foreground", 0, 1 );
|
||||
+ }
|
||||
+ if( islow < 0 ) {
|
||||
+ islow = config_get_int( progname, "delay", 0, -1 );
|
||||
+ }
|
||||
|
||||
- // Clean up
|
||||
- exit_program(EXIT_SUCCESS);
|
||||
+ /*
|
||||
+ * check for config file variables to override all the sequence defaults
|
||||
+ */
|
||||
+ for ( k = 0; sequence[k].which ; k++) {
|
||||
+ if (sequence[k].longname) {
|
||||
+ sequence[k].on_time = config_get_int( sequence[k].longname, "OnTime", 0, sequence[k].on_time );
|
||||
+ sequence[k].off_time = config_get_int( sequence[k].longname, "OffTime", 0, sequence[k].off_time );
|
||||
+ sequence[k].show_invisible = config_get_bool( sequence[k].longname, "ShowInvisible", 0, sequence[k].show_invisible );
|
||||
+ if ( config_get_bool( sequence[k].longname, "Active", 0, sequence[k].flags & ACTIVE ) )
|
||||
+ sequence[k].flags |= ACTIVE;
|
||||
+ else
|
||||
+ sequence[k].flags &= (~ACTIVE);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- return(0);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -259,6 +360,7 @@ HelpScreen (int exit_state)
|
||||
" -p <port> connect to LCDd daemon using <port>\n"
|
||||
" -d daemonize\n"
|
||||
" -e <delay> slow down initial announcement of modes (in 1/100s)\n"
|
||||
+ " -c <config> Use a configuration file other than %s\n"
|
||||
" -h show this help screen\n"
|
||||
" -v display program version\n"
|
||||
" and <modes> are\n"
|
||||
@@ -272,14 +374,14 @@ HelpScreen (int exit_state)
|
||||
" B Battery battery status\n"
|
||||
" T TimeDate time & date information\n"
|
||||
" O OldTime old time screen\n"
|
||||
- " U Uptime old uptime screen\n"
|
||||
+ " U Uptime uptime screen\n"
|
||||
" K BigClock big clock\n"
|
||||
" N MiniClock minimal clock\n"
|
||||
" A About credits page\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
" lcdproc -s my.lcdproc.server.com p 13666 C M X\n"
|
||||
- );
|
||||
+ , DEFAULT_CONFIGFILE);
|
||||
|
||||
exit(exit_state);
|
||||
}
|
||||
@@ -0,0 +1,547 @@
|
||||
diff --exclude='*.wanjet' --exclude='.??*' --exclude=config.h --exclude='*.orig' --exclude=Makefile --exclude='*.o' --exclude=Doxyfile --exclude='*.a' --exclude=config.log --exclude=config.status --exclude='init-*' -Nuarp server/menu.c server.HKEY/menu.c
|
||||
--- server/menu.c 2006-01-26 19:47:59.000000000 -0800
|
||||
+++ server.HKEY/menu.c 2006-02-21 09:21:25.000000000 -0800
|
||||
@@ -39,6 +39,13 @@
|
||||
#include "screen.h"
|
||||
#include "widget.h"
|
||||
|
||||
+#ifndef HKEY //hybrid keys
|
||||
+#include "shared/configfile.h"
|
||||
+
|
||||
+extern int hybrid_left_key;
|
||||
+extern int hybrid_right_key;
|
||||
+#endif //HKEY
|
||||
+
|
||||
/** Basicly a patched version of LL_GetByIndex() that ignores hidden
|
||||
* entries completely. (But it takes a menu as an argument.) */
|
||||
static void *
|
||||
@@ -559,12 +566,86 @@ MenuResult menu_process_input(Menu *menu
|
||||
return MENURESULT_ERROR;
|
||||
|
||||
switch (token) {
|
||||
+ case MENUTOKEN_LEFT:
|
||||
+ if (!extended)
|
||||
+ return MENURESULT_NONE;
|
||||
+#ifndef HKEY //hybrid key left
|
||||
+ /*
|
||||
+ * hybrid left key just fall through to menu key
|
||||
+ */
|
||||
+ if (!hybrid_left_key) {
|
||||
+ subitem = menu_get_subitem (menu, menu->data.menu.selector_pos);
|
||||
+ if (subitem == NULL)
|
||||
+ break;
|
||||
+ switch (subitem->type) {
|
||||
+ case MENUITEM_CHECKBOX:
|
||||
+ /* note: this dangerous looking code works since
|
||||
+ * CheckboxValue is an enum >= 0. */
|
||||
+ if (subitem->data.checkbox.allow_gray) {
|
||||
+ subitem->data.checkbox.value = (subitem->data.checkbox.value - 1) % 3;
|
||||
+ }
|
||||
+ else {
|
||||
+ subitem->data.checkbox.value = (subitem->data.checkbox.value - 1) % 2;
|
||||
+ }
|
||||
+ if (subitem->event_func)
|
||||
+ subitem->event_func (subitem, MENUEVENT_UPDATE);
|
||||
+ return MENURESULT_NONE;
|
||||
+ case MENUITEM_RING:
|
||||
+ /* ring: jump to the end if beginning is reached */
|
||||
+ subitem->data.ring.value = (subitem->data.ring.value < 1)
|
||||
+ ? LL_Length (subitem->data.ring.strings) - 1
|
||||
+ : (subitem->data.ring.value - 1) % LL_Length (subitem->data.ring.strings);
|
||||
+ if (subitem->event_func)
|
||||
+ subitem->event_func (subitem, MENUEVENT_UPDATE);
|
||||
+ return MENURESULT_NONE;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ return MENURESULT_NONE;
|
||||
+ }
|
||||
+#endif //HKEY
|
||||
case MENUTOKEN_MENU:
|
||||
subitem = menu_get_item_for_predecessor_check(menu);
|
||||
if ( ! subitem)
|
||||
return MENURESULT_ERROR;
|
||||
return menuitem_predecessor2menuresult(
|
||||
subitem->predecessor_id, MENURESULT_CLOSE);
|
||||
+ case MENUTOKEN_RIGHT:
|
||||
+#ifndef HKEY //hybrid key right
|
||||
+ /*
|
||||
+ * hybrid right key just fall through to enter key
|
||||
+ */
|
||||
+ if (!hybrid_right_key) {
|
||||
+ if (!extended) /* Can you get a MENUTOKEN_RIGHT w/o a RightKey defined, this code maybe be unecessary */
|
||||
+ return MENURESULT_NONE;
|
||||
+
|
||||
+ subitem = menu_get_subitem(menu, menu->data.menu.selector_pos);
|
||||
+ if (subitem == NULL)
|
||||
+ break;
|
||||
+ switch (subitem->type) {
|
||||
+ case MENUITEM_CHECKBOX:
|
||||
+ if (subitem->data.checkbox.allow_gray) {
|
||||
+ subitem->data.checkbox.value = (subitem->data.checkbox.value + 1) % 3;
|
||||
+ }
|
||||
+ else {
|
||||
+ subitem->data.checkbox.value = (subitem->data.checkbox.value + 1) % 2;
|
||||
+ }
|
||||
+ if (subitem->event_func)
|
||||
+ subitem->event_func (subitem, MENUEVENT_UPDATE);
|
||||
+ return MENURESULT_NONE;
|
||||
+ case MENUITEM_RING:
|
||||
+ subitem->data.ring.value = (subitem->data.ring.value + 1) % LL_Length (subitem->data.ring.strings);
|
||||
+ if (subitem->event_func)
|
||||
+ subitem->event_func (subitem, MENUEVENT_UPDATE);
|
||||
+ return MENURESULT_NONE;
|
||||
+ case MENUITEM_MENU:
|
||||
+ return MENURESULT_ENTER;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ return MENURESULT_NONE;
|
||||
+ }
|
||||
+#endif //HKEY
|
||||
case MENUTOKEN_ENTER:
|
||||
subitem = menu_get_subitem (menu, menu->data.menu.selector_pos);
|
||||
if (!subitem)
|
||||
@@ -609,6 +690,18 @@ MenuResult menu_process_input(Menu *menu
|
||||
menu->data.menu.scroll --;
|
||||
}
|
||||
else if (menu->data.menu.selector_pos == 0) {
|
||||
+#ifndef HKEY //hybrid key left
|
||||
+ if ( hybrid_left_key ) {
|
||||
+ /*
|
||||
+ * If this menu has only checkbox's and/or rings
|
||||
+ * need a key to get back from this menu on a 4 key pad
|
||||
+ */
|
||||
+ subitem = menu_get_item_for_predecessor_check(menu);
|
||||
+ if ( subitem && ((subitem->type == MENUITEM_CHECKBOX) || (subitem->type == MENUITEM_RING)))
|
||||
+ return menuitem_predecessor2menuresult(
|
||||
+ subitem->predecessor_id, MENURESULT_CLOSE);
|
||||
+ }
|
||||
+#endif // HKEY
|
||||
// wrap around to last menu entry
|
||||
menu->data.menu.selector_pos = menu_visible_item_count(menu) - 1;
|
||||
menu->data.menu.scroll = menu->data.menu.selector_pos + 2 - display_props->height;
|
||||
@@ -626,67 +719,6 @@ MenuResult menu_process_input(Menu *menu
|
||||
menu->data.menu.scroll = 0;
|
||||
}
|
||||
return MENURESULT_NONE;
|
||||
- case MENUTOKEN_LEFT:
|
||||
- if (!extended)
|
||||
- return MENURESULT_NONE;
|
||||
-
|
||||
- subitem = menu_get_subitem (menu, menu->data.menu.selector_pos);
|
||||
- if (subitem == NULL)
|
||||
- break;
|
||||
- switch (subitem->type) {
|
||||
- case MENUITEM_CHECKBOX:
|
||||
- /* note: this dangerous looking code works since
|
||||
- * CheckboxValue is an enum >= 0. */
|
||||
- if (subitem->data.checkbox.allow_gray) {
|
||||
- subitem->data.checkbox.value = (subitem->data.checkbox.value - 1) % 3;
|
||||
- }
|
||||
- else {
|
||||
- subitem->data.checkbox.value = (subitem->data.checkbox.value - 1) % 2;
|
||||
- }
|
||||
- if (subitem->event_func)
|
||||
- subitem->event_func (subitem, MENUEVENT_UPDATE);
|
||||
- return MENURESULT_NONE;
|
||||
- case MENUITEM_RING:
|
||||
- /* ring: jump to the end if beginning is reached */
|
||||
- subitem->data.ring.value = (subitem->data.ring.value < 1)
|
||||
- ? LL_Length (subitem->data.ring.strings) - 1
|
||||
- : (subitem->data.ring.value - 1) % LL_Length (subitem->data.ring.strings);
|
||||
- if (subitem->event_func)
|
||||
- subitem->event_func (subitem, MENUEVENT_UPDATE);
|
||||
- return MENURESULT_NONE;
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- return MENURESULT_NONE;
|
||||
- case MENUTOKEN_RIGHT:
|
||||
- if (!extended)
|
||||
- return MENURESULT_NONE;
|
||||
-
|
||||
- subitem = menu_get_subitem(menu, menu->data.menu.selector_pos);
|
||||
- if (subitem == NULL)
|
||||
- break;
|
||||
- switch (subitem->type) {
|
||||
- case MENUITEM_CHECKBOX:
|
||||
- if (subitem->data.checkbox.allow_gray) {
|
||||
- subitem->data.checkbox.value = (subitem->data.checkbox.value + 1) % 3;
|
||||
- }
|
||||
- else {
|
||||
- subitem->data.checkbox.value = (subitem->data.checkbox.value + 1) % 2;
|
||||
- }
|
||||
- if (subitem->event_func)
|
||||
- subitem->event_func (subitem, MENUEVENT_UPDATE);
|
||||
- return MENURESULT_NONE;
|
||||
- case MENUITEM_RING:
|
||||
- subitem->data.ring.value = (subitem->data.ring.value + 1) % LL_Length (subitem->data.ring.strings);
|
||||
- if (subitem->event_func)
|
||||
- subitem->event_func (subitem, MENUEVENT_UPDATE);
|
||||
- return MENURESULT_NONE;
|
||||
- case MENUITEM_MENU:
|
||||
- return MENURESULT_ENTER;
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- return MENURESULT_NONE;
|
||||
case MENUTOKEN_OTHER:
|
||||
/* TODO: move to the selected number and enter it */
|
||||
return MENURESULT_NONE;
|
||||
diff --exclude='*.wanjet' --exclude='.??*' --exclude=config.h --exclude='*.orig' --exclude=Makefile --exclude='*.o' --exclude=Doxyfile --exclude='*.a' --exclude=config.log --exclude=config.status --exclude='init-*' -Nuarp server/menuitem.c server.HKEY/menuitem.c
|
||||
--- server/menuitem.c 2006-01-26 19:47:59.000000000 -0800
|
||||
+++ server.HKEY/menuitem.c 2006-02-21 09:22:53.000000000 -0800
|
||||
@@ -84,6 +84,10 @@ const IpSstringProperties IPinfo[] = {
|
||||
{ 39, ':', 16, 4, 65535, { 4096, 256, 16, 1, 0 }, "%04x", verify_ipv6, "0:0:0:0:0:0:0:0" }
|
||||
};
|
||||
|
||||
+#ifndef HKEY // hybrid keys
|
||||
+extern int hybrid_left_key;
|
||||
+extern int hybrid_right_key;
|
||||
+#endif //HKEY
|
||||
|
||||
/******** MENU UTILITY FUNCTIONS ********/
|
||||
|
||||
@@ -983,26 +987,38 @@ MenuResult menuitem_process_input_slider
|
||||
return MENURESULT_ERROR;
|
||||
|
||||
switch (token) {
|
||||
- case MENUTOKEN_MENU:
|
||||
- return menuitem_predecessor2menuresult(
|
||||
- item->predecessor_id, MENURESULT_CLOSE);
|
||||
- case MENUTOKEN_ENTER:
|
||||
- return menuitem_successor2menuresult(
|
||||
- item->successor_id, MENURESULT_CLOSE);
|
||||
case MENUTOKEN_UP:
|
||||
case MENUTOKEN_RIGHT:
|
||||
- item->data.slider.value = min (item->data.slider.maxvalue,
|
||||
+#ifndef HKEY //hybrid key right
|
||||
+ if ( !hybrid_right_key || token == MENUTOKEN_UP ) {
|
||||
+#endif /*HKEY*/
|
||||
+ item->data.slider.value = min (item->data.slider.maxvalue,
|
||||
item->data.slider.value + item->data.slider.stepsize);
|
||||
- if (item->event_func)
|
||||
- item->event_func (item, MENUEVENT_PLUS);
|
||||
- return MENURESULT_NONE;
|
||||
+ if (item->event_func)
|
||||
+ item->event_func (item, MENUEVENT_PLUS);
|
||||
+ return MENURESULT_NONE;
|
||||
+#ifndef HKEY //hybrid key right
|
||||
+ } /* hybrid right key fall through to enter */
|
||||
+#endif /*HKEY*/
|
||||
+ case MENUTOKEN_ENTER:
|
||||
+ return menuitem_successor2menuresult(
|
||||
+ item->successor_id, MENURESULT_CLOSE);
|
||||
case MENUTOKEN_DOWN:
|
||||
case MENUTOKEN_LEFT:
|
||||
- item->data.slider.value = max (item->data.slider.minvalue,
|
||||
+#ifndef HKEY //hybrid key left
|
||||
+ if ( !hybrid_left_key || token == MENUTOKEN_DOWN ) {
|
||||
+#endif /*HKEY*/
|
||||
+ item->data.slider.value = max (item->data.slider.minvalue,
|
||||
item->data.slider.value - item->data.slider.stepsize);
|
||||
- if (item->event_func)
|
||||
- item->event_func (item, MENUEVENT_MINUS);
|
||||
- return MENURESULT_NONE;
|
||||
+ if (item->event_func)
|
||||
+ item->event_func (item, MENUEVENT_MINUS);
|
||||
+ return MENURESULT_NONE;
|
||||
+#ifndef HKEY //hybrid key left
|
||||
+ } /* hybrid left key fall through to menu */
|
||||
+#endif /*HKEY*/
|
||||
+ case MENUTOKEN_MENU:
|
||||
+ return menuitem_predecessor2menuresult(
|
||||
+ item->predecessor_id, MENURESULT_CLOSE);
|
||||
case MENUTOKEN_OTHER:
|
||||
default:
|
||||
break;
|
||||
@@ -1037,6 +1053,21 @@ MenuResult menuitem_process_input_numeri
|
||||
item->data.numeric.error_code = 0;
|
||||
|
||||
switch (token) {
|
||||
+ case MENUTOKEN_LEFT:
|
||||
+ /* The user wants to go to back a digit */
|
||||
+ if (pos > 0) {
|
||||
+ item->data.numeric.edit_pos--;
|
||||
+ if (item->data.numeric.edit_offs > item->data.numeric.edit_pos)
|
||||
+ item->data.numeric.edit_offs = item->data.numeric.edit_pos;
|
||||
+#ifndef HKEY //hybrid key left
|
||||
+ if( hybrid_left_key ) return MENURESULT_NONE;
|
||||
+ }
|
||||
+ if( !hybrid_left_key ) return MENURESULT_NONE;
|
||||
+ /* fall through to MENU */
|
||||
+#else
|
||||
+ }
|
||||
+ return MENURESULT_NONE;
|
||||
+#endif /*HKEY*/
|
||||
case MENUTOKEN_MENU:
|
||||
if (pos == 0) {
|
||||
return menuitem_predecessor2menuresult(
|
||||
@@ -1047,6 +1078,21 @@ MenuResult menuitem_process_input_numeri
|
||||
menuitem_reset_numeric(item);
|
||||
}
|
||||
return MENURESULT_NONE;
|
||||
+ case MENUTOKEN_RIGHT:
|
||||
+ /* The user wants to go to next digit */
|
||||
+ if (str[pos] != '\0' && pos < max_len) {
|
||||
+ item->data.numeric.edit_pos++;
|
||||
+ if (pos >= display_props->width - 2)
|
||||
+ item->data.numeric.edit_offs++;
|
||||
+#ifndef HKEY //hybrid key right
|
||||
+ if( hybrid_right_key ) return MENURESULT_NONE;
|
||||
+ }
|
||||
+ if( !hybrid_right_key ) return MENURESULT_NONE;
|
||||
+ /* fall through to ENTER */
|
||||
+#else
|
||||
+ }
|
||||
+ return MENURESULT_NONE;
|
||||
+#endif /*HKEY*/
|
||||
case MENUTOKEN_ENTER:
|
||||
if ((extended) || (str[pos] == '\0')) {
|
||||
int value;
|
||||
@@ -1131,22 +1177,6 @@ MenuResult menuitem_process_input_numeri
|
||||
}
|
||||
}
|
||||
return MENURESULT_NONE;
|
||||
- case MENUTOKEN_RIGHT:
|
||||
- /* The user wants to go to next digit */
|
||||
- if (str[pos] != '\0' && pos < max_len) {
|
||||
- item->data.numeric.edit_pos++;
|
||||
- if (pos >= display_props->width - 2)
|
||||
- item->data.numeric.edit_offs++;
|
||||
- }
|
||||
- return MENURESULT_NONE;
|
||||
- case MENUTOKEN_LEFT:
|
||||
- /* The user wants to go to back a digit */
|
||||
- if (pos > 0) {
|
||||
- item->data.numeric.edit_pos--;
|
||||
- if (item->data.numeric.edit_offs > item->data.numeric.edit_pos)
|
||||
- item->data.numeric.edit_offs = item->data.numeric.edit_pos;
|
||||
- }
|
||||
- return MENURESULT_NONE;
|
||||
case MENUTOKEN_OTHER:
|
||||
if (pos >= max_len) {
|
||||
/* We're not allowed to add anything anymore */
|
||||
@@ -1196,6 +1226,21 @@ MenuResult menuitem_process_input_alpha
|
||||
item->data.alpha.error_code = 0;
|
||||
|
||||
switch (token) {
|
||||
+ case MENUTOKEN_LEFT:
|
||||
+ /* The user wants to go to back a digit */
|
||||
+ if (pos > 0) {
|
||||
+ item->data.alpha.edit_pos--;
|
||||
+ if (item->data.alpha.edit_offs > item->data.alpha.edit_pos)
|
||||
+ item->data.alpha.edit_offs = item->data.alpha.edit_pos;
|
||||
+#ifndef HKEY //hybrid key left
|
||||
+ if( hybrid_left_key ) return MENURESULT_NONE;
|
||||
+ }
|
||||
+ if( !hybrid_left_key ) return MENURESULT_NONE;
|
||||
+ /* fall through to MENU */
|
||||
+#else
|
||||
+ }
|
||||
+ return MENURESULT_NONE;
|
||||
+#endif /*HKEY*/
|
||||
case MENUTOKEN_MENU:
|
||||
if (pos == 0) {
|
||||
return menuitem_predecessor2menuresult(
|
||||
@@ -1206,6 +1251,22 @@ MenuResult menuitem_process_input_alpha
|
||||
menuitem_reset_alpha(item);
|
||||
}
|
||||
return MENURESULT_NONE;
|
||||
+ case MENUTOKEN_RIGHT:
|
||||
+ /* The user wants to go to next digit */
|
||||
+ if (str[item->data.alpha.edit_pos] != '\0' &&
|
||||
+ pos < item->data.alpha.maxlength - 1) {
|
||||
+ item->data.alpha.edit_pos++;
|
||||
+ if (pos >= display_props->width - 2)
|
||||
+ item->data.alpha.edit_offs++;
|
||||
+#ifndef HKEY //hybrid key right
|
||||
+ if( hybrid_right_key ) return MENURESULT_NONE;
|
||||
+ }
|
||||
+ if( !hybrid_right_key ) return MENURESULT_NONE;
|
||||
+ /* fall through to ENTER */
|
||||
+#else
|
||||
+ }
|
||||
+ return MENURESULT_NONE;
|
||||
+#endif /*HKEY*/
|
||||
case MENUTOKEN_ENTER:
|
||||
if ((extended) || (str[item->data.alpha.edit_pos] == '\0')) {
|
||||
/* The user completed his input */
|
||||
@@ -1278,23 +1339,6 @@ MenuResult menuitem_process_input_alpha
|
||||
}
|
||||
}
|
||||
return MENURESULT_NONE;
|
||||
- case MENUTOKEN_RIGHT:
|
||||
- /* The user wants to go to next digit */
|
||||
- if (str[item->data.alpha.edit_pos] != '\0' &&
|
||||
- pos < item->data.alpha.maxlength - 1) {
|
||||
- item->data.alpha.edit_pos++;
|
||||
- if (pos >= display_props->width - 2)
|
||||
- item->data.alpha.edit_offs++;
|
||||
- }
|
||||
- return MENURESULT_NONE;
|
||||
- case MENUTOKEN_LEFT:
|
||||
- /* The user wants to go to back a digit */
|
||||
- if (pos > 0) {
|
||||
- item->data.alpha.edit_pos--;
|
||||
- if (item->data.alpha.edit_offs > item->data.alpha.edit_pos)
|
||||
- item->data.alpha.edit_offs = item->data.alpha.edit_pos;
|
||||
- }
|
||||
- return MENURESULT_NONE;
|
||||
case MENUTOKEN_OTHER:
|
||||
if (pos >= item->data.alpha.maxlength) {
|
||||
/* We're not allowed to add anything anymore */
|
||||
@@ -1333,7 +1377,24 @@ MenuResult menuitem_process_input_ip (Me
|
||||
item->data.ip.error_code = 0;
|
||||
|
||||
switch (token) {
|
||||
- case MENUTOKEN_MENU:
|
||||
+ case MENUTOKEN_LEFT:
|
||||
+ /* The user wants to go to back a digit */
|
||||
+ if (pos > 0) {
|
||||
+ item->data.ip.edit_pos--;
|
||||
+ if (str[item->data.ip.edit_pos] == ipinfo->sep)
|
||||
+ item->data.ip.edit_pos--;
|
||||
+ if (item->data.ip.edit_offs > item->data.ip.edit_pos)
|
||||
+ item->data.ip.edit_offs = item->data.ip.edit_pos;
|
||||
+#ifndef HKEY //hybrid key left
|
||||
+ if( hybrid_left_key ) return MENURESULT_NONE;
|
||||
+ }
|
||||
+ if( !hybrid_left_key ) return MENURESULT_NONE;
|
||||
+ /* fall through to MENU */
|
||||
+#else
|
||||
+ }
|
||||
+ return MENURESULT_NONE;
|
||||
+#endif /*HKEY*/
|
||||
+ case MENUTOKEN_MENU:
|
||||
if (pos == 0) {
|
||||
return menuitem_predecessor2menuresult(
|
||||
item->predecessor_id, MENURESULT_CLOSE);
|
||||
@@ -1343,6 +1404,22 @@ MenuResult menuitem_process_input_ip (Me
|
||||
menuitem_reset_ip(item);
|
||||
}
|
||||
return MENURESULT_NONE;
|
||||
+ case MENUTOKEN_RIGHT:
|
||||
+ if (pos < item->data.ip.maxlength - 1) {
|
||||
+ item->data.ip.edit_pos++;
|
||||
+ if (str[item->data.ip.edit_pos] == ipinfo->sep)
|
||||
+ item->data.ip.edit_pos++;
|
||||
+ while (item->data.ip.edit_pos - item->data.ip.edit_offs > display_props->width - 2)
|
||||
+ item->data.ip.edit_offs++;
|
||||
+#ifndef HKEY //hybrid key right
|
||||
+ if( hybrid_right_key ) return MENURESULT_NONE;
|
||||
+ }
|
||||
+ if( !hybrid_right_key ) return MENURESULT_NONE;
|
||||
+ /* fall through to ENTER */
|
||||
+#else
|
||||
+ }
|
||||
+ return MENURESULT_NONE;
|
||||
+#endif /*HKEY*/
|
||||
case MENUTOKEN_ENTER:
|
||||
if (extended || (pos >= item->data.ip.maxlength - 1)) {
|
||||
// remove the leading spaces/zeros in each octet-representing string
|
||||
@@ -1409,25 +1486,6 @@ MenuResult menuitem_process_input_ip (Me
|
||||
snprintf(numstr, 5, ipinfo->format, num);
|
||||
memcpy(&str[pos - (pos % (ipinfo->width + 1))], numstr, ipinfo->width);
|
||||
return MENURESULT_NONE;
|
||||
- case MENUTOKEN_RIGHT:
|
||||
- if (pos < item->data.ip.maxlength - 1) {
|
||||
- item->data.ip.edit_pos++;
|
||||
- if (str[item->data.ip.edit_pos] == ipinfo->sep)
|
||||
- item->data.ip.edit_pos++;
|
||||
- while (item->data.ip.edit_pos - item->data.ip.edit_offs > display_props->width - 2)
|
||||
- item->data.ip.edit_offs++;
|
||||
- }
|
||||
- return MENURESULT_NONE;
|
||||
- case MENUTOKEN_LEFT:
|
||||
- /* The user wants to go to back a digit */
|
||||
- if (pos > 0) {
|
||||
- item->data.ip.edit_pos--;
|
||||
- if (str[item->data.ip.edit_pos] == ipinfo->sep)
|
||||
- item->data.ip.edit_pos--;
|
||||
- if (item->data.ip.edit_offs > item->data.ip.edit_pos)
|
||||
- item->data.ip.edit_offs = item->data.ip.edit_pos;
|
||||
- }
|
||||
- return MENURESULT_NONE;
|
||||
case MENUTOKEN_OTHER:
|
||||
/* process other keys */
|
||||
if ((strlen(key) == 1) &&
|
||||
diff --exclude='*.wanjet' --exclude='.??*' --exclude=config.h --exclude='*.orig' --exclude=Makefile --exclude='*.o' --exclude=Doxyfile --exclude='*.a' --exclude=config.log --exclude=config.status --exclude='init-*' -Nuarp server/menuscreens.c server.HKEY/menuscreens.c
|
||||
--- server/menuscreens.c 2006-01-26 19:47:59.000000000 -0800
|
||||
+++ server.HKEY/menuscreens.c 2006-02-21 09:33:21.000000000 -0800
|
||||
@@ -48,6 +48,15 @@ char * down_key;
|
||||
char * left_key;
|
||||
char * right_key;
|
||||
|
||||
+#ifndef HKEY //hybrid keys
|
||||
+/*
|
||||
+ * hybrid left becomes menu key at left edge of screen
|
||||
+ * hybrid right becomes enter key at right edge of screen
|
||||
+ */
|
||||
+int hybrid_left_key = 0;
|
||||
+int hybrid_right_key = 0;
|
||||
+#endif //HKEY
|
||||
+
|
||||
Screen * menuscreen = NULL;
|
||||
MenuItem * active_menuitem = NULL;
|
||||
/** the "real" main_menu */
|
||||
@@ -91,6 +100,11 @@ int menuscreens_init()
|
||||
if (tmp)
|
||||
right_key = strdup(tmp);
|
||||
|
||||
+#ifndef HKEY //get hybrid keys from config file
|
||||
+ hybrid_right_key = config_get_bool ("menu", "HybridRightKey", 0, 0);
|
||||
+ hybrid_left_key = config_get_bool ("menu", "HybridLeftKey", 0, 0);
|
||||
+#endif
|
||||
+
|
||||
|
||||
/* Now reserve keys */
|
||||
input_reserve_key (menu_key, true, NULL);
|
||||
@@ -186,6 +200,11 @@ void menuscreen_inform_item_modified (Me
|
||||
|
||||
bool is_menu_key (char * key)
|
||||
{
|
||||
+#ifndef HKEY //hybrid keys, any key wake-up menus
|
||||
+ /* any key wakes up menus */
|
||||
+ if (key && ( hybrid_left_key || hybrid_right_key ))
|
||||
+ return true;
|
||||
+#endif //HKEY
|
||||
if (menu_key && key && strcmp (key, menu_key) == 0)
|
||||
return true;
|
||||
else
|
||||
@@ -466,28 +485,28 @@ void menuscreen_create_menu ()
|
||||
menu_add_item (options_menu, driver_menu);
|
||||
if (contrast_avail) {
|
||||
int contrast = driver->get_contrast(driver);
|
||||
-
|
||||
+
|
||||
/* menu's client is NULL since we're in the server */
|
||||
slider = menuitem_create_slider ("contrast", contrast_handler, "Contrast",
|
||||
- NULL, "min", "max", 0, 1000, 25, contrast);
|
||||
+ NULL, "min", "max", 0, 1000, 25, contrast);
|
||||
menu_add_item (driver_menu, slider);
|
||||
}
|
||||
if (brightness_avail) {
|
||||
int onbrightness = driver->get_brightness (driver, BACKLIGHT_ON);
|
||||
int offbrightness = driver->get_brightness (driver, BACKLIGHT_OFF);
|
||||
-
|
||||
+
|
||||
slider = menuitem_create_slider ("onbrightness", brightness_handler, "On Brightness",
|
||||
- NULL, "min", "max", 0, 1000, 25, onbrightness);
|
||||
+ NULL, "min", "max", 0, 1000, 25, onbrightness);
|
||||
menu_add_item (driver_menu, slider);
|
||||
|
||||
slider = menuitem_create_slider ("offbrightness", brightness_handler, "Off Brightness",
|
||||
- NULL, "min", "max", 0, 1000, 25, offbrightness);
|
||||
+ NULL, "min", "max", 0, 1000, 25, offbrightness);
|
||||
menu_add_item (driver_menu, slider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-#ifdef LCDPROC_TESTMENUS
|
||||
+#ifdef LCDPROC_TESTMENUS
|
||||
test_menu = menu_create ("test", NULL, "Test menu", NULL);
|
||||
menu_add_item (main_menu, test_menu);
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
diff --exclude='*.wanjet' --exclude='.??*' --exclude=config.h --exclude='*.orig' --exclude=Makefile --exclude='*.o' --exclude=Doxyfile --exclude='*.a' --exclude=config.log --exclude=config.status --exclude='init-*' -Nuarp server/drivers/CFontz633.c server.OPT/drivers/CFontz633.c
|
||||
--- server/drivers/CFontz633.c 2006-01-26 19:47:59.000000000 -0800
|
||||
+++ server.OPT/drivers/CFontz633.c 2006-02-21 19:35:27.000000000 -0800
|
||||
@@ -131,6 +131,9 @@ static void CFontz633_init_vbar (Driver
|
||||
static void CFontz633_init_hbar (Driver *drvthis);
|
||||
static void CFontz633_no_live_report (Driver *drvthis);
|
||||
static void CFontz633_hardware_clear (Driver *drvthis);
|
||||
+#ifndef OPT //store boot screen
|
||||
+static void CFontz633_store_boot_state (Driver *drvthis);
|
||||
+#endif //OPT
|
||||
|
||||
|
||||
/*
|
||||
@@ -305,6 +308,16 @@ CFontz633_init (Driver *drvthis)
|
||||
CFontz633_no_live_report (drvthis);
|
||||
CFontz633_hardware_clear (drvthis);
|
||||
|
||||
+#ifndef OPT //store boot screen
|
||||
+ /* get and store the power on boot line, repurposing the "size" buffer */
|
||||
+ strncpy(size, drvthis->config_get_string (drvthis->name, "BootDisplay", 0, "" ), sizeof(size));
|
||||
+ if ( size[0] ) {
|
||||
+ CFontz633_string (drvthis, 1, 1, size);
|
||||
+ CFontz633_flush (drvthis);
|
||||
+ CFontz633_store_boot_state (drvthis);
|
||||
+ }
|
||||
+#endif //OPT
|
||||
+
|
||||
report (RPT_DEBUG, "%s: done\n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
@@ -1118,3 +1131,15 @@ CFontz633_string (Driver *drvthis, int x
|
||||
}
|
||||
}
|
||||
|
||||
+#ifndef OPT //store boot screen
|
||||
+/*
|
||||
+ * Saves current state as boot state
|
||||
+ */
|
||||
+static void
|
||||
+CFontz633_store_boot_state (Driver *drvthis)
|
||||
+{
|
||||
+ PrivateData *p = drvthis->private_data;
|
||||
+
|
||||
+ send_zerobyte_message(p->fd, CF633_Store_Current_State_As_Boot_State);
|
||||
+}
|
||||
+#endif //OPT
|
||||
diff --exclude='*.wanjet' --exclude='.??*' --exclude=config.h --exclude='*.orig' --exclude=Makefile --exclude='*.o' --exclude=Doxyfile --exclude='*.a' --exclude=config.log --exclude=config.status --exclude='init-*' -Nuarp server/menuscreens.c server.OPT/menuscreens.c
|
||||
--- server/menuscreens.c 2006-01-26 19:47:59.000000000 -0800
|
||||
+++ server.OPT/menuscreens.c 2006-02-21 19:31:00.000000000 -0800
|
||||
@@ -48,6 +48,9 @@ char * down_key;
|
||||
char * left_key;
|
||||
char * right_key;
|
||||
|
||||
+#ifndef OPT
|
||||
+char * menuname; /* the name for the default menu */
|
||||
+#endif //OPT
|
||||
Screen * menuscreen = NULL;
|
||||
MenuItem * active_menuitem = NULL;
|
||||
/** the "real" main_menu */
|
||||
@@ -91,6 +94,11 @@ int menuscreens_init()
|
||||
if (tmp)
|
||||
right_key = strdup(tmp);
|
||||
|
||||
+#ifndef OPT //get main menu name and hybrid keys from config file
|
||||
+ /* Get main menu name from config file */
|
||||
+ menuname = strdup (config_get_string ("menu", "menuname", 0, "LCDproc Menu"));
|
||||
+#endif //OPT
|
||||
+
|
||||
|
||||
/* Now reserve keys */
|
||||
input_reserve_key (menu_key, true, NULL);
|
||||
@@ -437,55 +445,62 @@ void menuscreen_create_menu ()
|
||||
|
||||
debug (RPT_DEBUG, "%s()", __FUNCTION__);
|
||||
|
||||
+#ifndef OPT //main menu name from config file
|
||||
+ main_menu = menu_create ("mainmenu", NULL, menuname, NULL);
|
||||
+#else //OPT
|
||||
main_menu = menu_create ("mainmenu", NULL, "LCDproc Menu", NULL);
|
||||
+#endif //OPT
|
||||
|
||||
- options_menu = menu_create ("options", NULL, "Options", NULL);
|
||||
- menu_add_item (main_menu, options_menu);
|
||||
-
|
||||
-#ifdef LCDPROC_TESTMENUS
|
||||
- screens_menu = menu_create ("screens", NULL, "Screens", NULL);
|
||||
- menu_add_item (main_menu, screens_menu);
|
||||
-#endif /*LCDPROC_TESTMENUS*/
|
||||
-
|
||||
- /* menu's client is NULL since we're in the server */
|
||||
- checkbox = menuitem_create_checkbox ("heartbeat", heartbeat_handler, "Heartbeat", NULL, true, heartbeat);
|
||||
- menu_add_item (options_menu, checkbox);
|
||||
-
|
||||
- /* menu's client is NULL since we're in the server */
|
||||
- checkbox = menuitem_create_checkbox ("backlight", backlight_handler, "Backlight", NULL, true, backlight);
|
||||
- menu_add_item (options_menu, checkbox);
|
||||
+#ifndef OPT //Options menu display from config file
|
||||
+ if ( config_get_bool ("server", "LCDOptionsMenu", 0, 0)) {
|
||||
+ options_menu = menu_create ("options", NULL, "Options", NULL);
|
||||
+ menu_add_item (main_menu, options_menu);
|
||||
+
|
||||
+ /* menu's client is NULL since we're in the server */
|
||||
+ checkbox = menuitem_create_checkbox ("heartbeat", heartbeat_handler, "Heartbeat", NULL, true, heartbeat);
|
||||
+ menu_add_item (options_menu, checkbox);
|
||||
+
|
||||
+ /* menu's client is NULL since we're in the server */
|
||||
+ checkbox = menuitem_create_checkbox ("backlight", backlight_handler, "Backlight", NULL, true, backlight);
|
||||
+ menu_add_item (options_menu, checkbox);
|
||||
+
|
||||
+ for (driver = drivers_getfirst(); driver; driver = drivers_getnext()) {
|
||||
+ int contrast_avail = (driver->get_contrast && driver->set_contrast) ? 1 : 0;
|
||||
+ int brightness_avail = (driver->get_brightness && driver->set_brightness) ? 1 : 0;
|
||||
|
||||
- for (driver = drivers_getfirst(); driver; driver = drivers_getnext()) {
|
||||
- int contrast_avail = (driver->get_contrast && driver->set_contrast) ? 1 : 0;
|
||||
- int brightness_avail = (driver->get_brightness && driver->set_brightness) ? 1 : 0;
|
||||
-
|
||||
- if (contrast_avail || brightness_avail) {
|
||||
- /* menu's client is NULL since we're in the server */
|
||||
- driver_menu = menu_create (driver->name, NULL, driver->name, NULL);
|
||||
- menu_set_association(driver_menu, driver);
|
||||
- menu_add_item (options_menu, driver_menu);
|
||||
- if (contrast_avail) {
|
||||
- int contrast = driver->get_contrast(driver);
|
||||
-
|
||||
+ if (contrast_avail || brightness_avail) {
|
||||
/* menu's client is NULL since we're in the server */
|
||||
- slider = menuitem_create_slider ("contrast", contrast_handler, "Contrast",
|
||||
- NULL, "min", "max", 0, 1000, 25, contrast);
|
||||
- menu_add_item (driver_menu, slider);
|
||||
- }
|
||||
- if (brightness_avail) {
|
||||
- int onbrightness = driver->get_brightness (driver, BACKLIGHT_ON);
|
||||
- int offbrightness = driver->get_brightness (driver, BACKLIGHT_OFF);
|
||||
-
|
||||
- slider = menuitem_create_slider ("onbrightness", brightness_handler, "On Brightness",
|
||||
- NULL, "min", "max", 0, 1000, 25, onbrightness);
|
||||
- menu_add_item (driver_menu, slider);
|
||||
-
|
||||
- slider = menuitem_create_slider ("offbrightness", brightness_handler, "Off Brightness",
|
||||
- NULL, "min", "max", 0, 1000, 25, offbrightness);
|
||||
- menu_add_item (driver_menu, slider);
|
||||
+ driver_menu = menu_create (driver->name, NULL, driver->name, NULL);
|
||||
+ menu_set_association(driver_menu, driver);
|
||||
+ menu_add_item (options_menu, driver_menu);
|
||||
+ if (contrast_avail) {
|
||||
+ int contrast = driver->get_contrast(driver);
|
||||
+
|
||||
+ /* menu's client is NULL since we're in the server */
|
||||
+ slider = menuitem_create_slider ("contrast", contrast_handler, "Contrast",
|
||||
+ NULL, "min", "max", 0, 1000, 25, contrast);
|
||||
+ menu_add_item (driver_menu, slider);
|
||||
+ }
|
||||
+ if (brightness_avail) {
|
||||
+ int onbrightness = driver->get_brightness (driver, BACKLIGHT_ON);
|
||||
+ int offbrightness = driver->get_brightness (driver, BACKLIGHT_OFF);
|
||||
+
|
||||
+ slider = menuitem_create_slider ("onbrightness", brightness_handler, "On Brightness",
|
||||
+ NULL, "min", "max", 0, 1000, 25, onbrightness);
|
||||
+ menu_add_item (driver_menu, slider);
|
||||
+
|
||||
+ slider = menuitem_create_slider ("offbrightness", brightness_handler, "Off Brightness",
|
||||
+ NULL, "min", "max", 0, 1000, 25, offbrightness);
|
||||
+ menu_add_item (driver_menu, slider);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
+ if ( config_get_bool ("server", "LCDScreensMenu", 0, 0)) {
|
||||
+ screens_menu = menu_create ("screens", NULL, "Screens", NULL);
|
||||
+ menu_add_item (main_menu, screens_menu);
|
||||
+ }
|
||||
+#endif //OPT
|
||||
|
||||
#ifdef LCDPROC_TESTMENUS
|
||||
test_menu = menu_create ("test", NULL, "Test menu", NULL);
|
||||
diff --exclude='*.wanjet' --exclude='.??*' --exclude=config.h --exclude='*.orig' --exclude=Makefile --exclude='*.o' --exclude=Doxyfile --exclude='*.a' --exclude=config.log --exclude=config.status --exclude='init-*' -Nuarp server/serverscreens.c server.OPT/serverscreens.c
|
||||
--- server/serverscreens.c 2006-01-26 19:47:59.000000000 -0800
|
||||
+++ server.OPT/serverscreens.c 2006-02-21 19:27:40.000000000 -0800
|
||||
@@ -31,6 +31,12 @@
|
||||
#include "widget.h"
|
||||
#include "serverscreens.h"
|
||||
|
||||
+#ifndef OPT //startup screen title from config
|
||||
+#include "shared/configfile.h"
|
||||
+
|
||||
+char * title;
|
||||
+#endif //OPT
|
||||
+
|
||||
#define UNSET_INT -1
|
||||
|
||||
Screen * server_screen;
|
||||
@@ -38,6 +44,7 @@ int rotate_server_screen = UNSET_INT;
|
||||
|
||||
#define MAX_SERVERSCREEN_WIDTH 40
|
||||
|
||||
+
|
||||
int
|
||||
server_screen_init ()
|
||||
{
|
||||
@@ -46,6 +53,11 @@ server_screen_init ()
|
||||
|
||||
debug (RPT_DEBUG, "server_screen_init");
|
||||
|
||||
+#ifndef OPT //startup screen title from config
|
||||
+ /* Get server title name from config file */
|
||||
+ title = strdup (config_get_string ("server", "title", 0, "LCDproc Server"));
|
||||
+#endif //OPT
|
||||
+
|
||||
/* Create the screen */
|
||||
server_screen = screen_create ("_server_screen", NULL);
|
||||
if (!server_screen) {
|
||||
@@ -77,7 +89,11 @@ server_screen_init ()
|
||||
w->text = malloc (MAX_SERVERSCREEN_WIDTH+1);
|
||||
if (line == 1) {
|
||||
w->type = WID_TITLE;
|
||||
+#ifndef OPT //startup screen titel from config
|
||||
+ strncpy (w->text, title, MAX_SERVERSCREEN_WIDTH);
|
||||
+#else //OPT
|
||||
strncpy (w->text, "LCDproc Server", MAX_SERVERSCREEN_WIDTH);
|
||||
+#endif //OPT
|
||||
} else {
|
||||
w->text[0] = 0;
|
||||
}
|
||||
@@ -156,6 +172,18 @@ goodbye_screen ()
|
||||
char *l16 = " LCDproc! ";
|
||||
#endif
|
||||
|
||||
+#ifndef OPT // disable config goobye
|
||||
+ char * goodbye_string;
|
||||
+
|
||||
+ if ( (goodbye_string = strdup(config_get_string("server", "goodbye", 0, "")))) {
|
||||
+ t20=t16=goodbye_string;
|
||||
+ if (strlen(goodbye_string) > 16 )
|
||||
+ l16 = goodbye_string + 16;
|
||||
+ if (strlen(goodbye_string) > 20 )
|
||||
+ l20 = goodbye_string + 20;
|
||||
+ }
|
||||
+#endif //OPT
|
||||
+
|
||||
if( !display_props )
|
||||
return 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user