--- np2/x11/main.c 2003/12/19 16:08:01 1.10 +++ np2/x11/main.c 2004/06/16 12:50:49 1.17 @@ -27,6 +27,7 @@ #include "compiler.h" +#include #include #include @@ -46,6 +47,8 @@ #include "sysmenu.h" #include "toolwin.h" #include "viewer.h" +#include "debugwin.h" +#include "skbdwin.h" #include "commng.h" #include "fontmng.h" @@ -100,6 +103,9 @@ static struct option longopts[] = { { "config", required_argument, 0, 'c' }, { "timidity-config", required_argument, 0, 'C' }, { "shared-pixmap", no_argument, 0, 'p' }, +#if defined(USE_SDL) || defined(USE_SYSMENU) + { "ttfont", required_argument, 0, 't' }, +#endif { "help", no_argument, 0, 'h' }, { 0, 0, 0, 0 }, }; @@ -110,7 +116,15 @@ static void usage(void) { - printf("Usage: %s [options] [[FD1 image] [[FD2 image] [[FD3 image] [FD4 image]]]]\n", progname); + printf("Usage: %s [options] [[FD1 image] [[FD2 image] [[FD3 image] [FD4 image]]]]\n\n", progname); + printf("options:\n"); + printf("\t--help [-h] : print this message\n"); + printf("\t--config [-c] : specify config file\n"); + printf("\t--timidity-config [-C] : specify timidity config file\n"); + printf("\t--shared-pixmap [-p] : use MIT-SHM pixmap extention\n"); +#if defined(USE_SDL) || defined(USE_SYSMENU) + printf("\t--ttfont [-t] : specify TrueType font\n"); +#endif exit(1); } @@ -133,7 +147,7 @@ main(int argc, char *argv[]) toolkit_initialize(); toolkit_arginit(&argc, &argv); - while ((ch = getopt_long(argc, argv, "c:C:nh", longopts, NULL)) != -1) { + while ((ch = getopt_long(argc, argv, "c:C:t:ph", longopts, NULL)) != -1) { switch (ch) { case 'c': if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) { @@ -156,6 +170,14 @@ main(int argc, char *argv[]) sizeof(timidity_cfgfile_path)); break; + case 't': + if (stat(optarg, &sb) < 0 || !S_ISREG(sb.st_mode)) { + fprintf(stderr, "Can't access %s.\n", optarg); + exit(1); + } + milstr_ncpy(fontfilename, optarg, sizeof(fontfilename)); + break; + case 'p': shared_pixmap_flag = TRUE; break; @@ -227,10 +249,11 @@ main(int argc, char *argv[]) initload(); toolwin_readini(); kdispwin_readini(); + skbdwin_readini(); rand_setseed((SINT32)time(NULL)); -#if defined(__GNUC__) && (defined(i386) || defined(__i386__)) +#if defined(GCC_CPU_ARCH_IA32) mmxflag = havemmx() ? 0 : MMXFLAG_NOTSUPPORT; mmxflag += np2oscfg.disablemmx ? MMXFLAG_DISABLE : 0; #endif @@ -244,12 +267,13 @@ main(int argc, char *argv[]) kdispwin_initialize(); viewer_init(); + skbdwin_initialize(); toolkit_widget_create(); scrnmng_initialize(); kbdmng_init(); inputmng_init(); - keystat_reset(); + keystat_initialize(); scrnmode = 0; if (np2cfg.RASTER) { @@ -303,6 +327,9 @@ main(int argc, char *argv[]) if (np2oscfg.keydisp) { kdispwin_create(); } + if (np2oscfg.softkbd) { + skbdwin_create(); + } } if (np2oscfg.resume) { @@ -324,6 +351,7 @@ main(int argc, char *argv[]) kdispwin_destroy(); toolwin_destroy(); + skbdwin_destroy(); pccore_cfgupdate(); @@ -337,6 +365,7 @@ main(int argc, char *argv[]) } pccore_term(); + debugwin_destroy(); soundmng_deinitialize(); scrnmng_destroy(); @@ -352,8 +381,11 @@ fontmng_failure: initsave(); toolwin_writeini(); kdispwin_writeini(); + skbdwin_writeini(); } + skbdwin_deinitialize(); + TRACETERM(); dosio_term();