00001
00018 #define GITK_RENDERER_C
00019 #define GITKR_INIT_C
00020
00021 #include "gitkrincludes.h"
00022
00029 gboolean gitkr_init(guint *argc, gchar ***argv) {
00030 (void)g_log_set_handler(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG|G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_WARNING|G_LOG_LEVEL_ERROR, gitk_log_handler, NULL);
00031 gitk_log("text mode render plugin init beg");
00032
00033 if(!gitkr_init_process_commandline(argc,argv)) {
00034
00035
00036 initscr();
00037 if(has_colors()) {
00038 gitk_log("color output available!");
00039 start_color();
00040 }
00041 else {
00042 gitk_log("*no* color output available!");
00043 }
00044 gitk_log1("supported terminal attribute are (0x%012lx)",termattrs());
00045 cbreak();
00046 noecho();
00047 nonl();
00048 scrollok(stdscr, FALSE);
00049 intrflush(stdscr, FALSE);
00050 keypad(stdscr, TRUE);
00051
00052
00053 gitk_log2("curses color capabillities : num_colors=%d max_color_pairs=%d",COLORS,COLOR_PAIRS);
00054
00055
00056 signal(SIGINT, sighandler_on_sigint);
00057 signal(SIGHUP, sighandler_on_sighup);
00058 signal(SIGWINCH, sighandler_on_sigwinch);
00059
00060 #ifdef HAVE_SPEECH
00061 if(gitkr_text_speech_name && (!strncmp(gitkr_text_speech_name,"festival\0",9))) {
00062
00063 if(!(ftinfo=festival_initialize(NULL,-1,NULL))) {
00064 gitk_log("*no* speech output available!");
00065 }
00066 else {
00067 gitk_log("speech output available!");
00068 }
00069 }
00070 #endif
00071 }
00072 gitk_log("text mode render plugin init end");
00073 return(TRUE);
00074 }
00075
00080 gboolean gitkr_init_process_commandline(guint *argc, gchar ***argv) {
00081 guint i;
00082 gchar *arg;
00083 gboolean info_only=FALSE;
00084 gboolean info_help=FALSE, info_version=FALSE;
00085
00086 gitk_log("gitkr_init_process_commandline() beg");
00087
00088
00089 for (i=1;i<*argc;) {
00090 if (!strcmp("--help", (*argv)[i]) || !strcmp("-h", (*argv)[i])) {
00091 info_only=info_help=TRUE;
00092 }
00093 else if((*argv)[i] && (!strcmp("--version", (*argv)[i]))) {
00094 info_only=info_version=TRUE;
00095 }
00096 #ifdef HAVE_SPEECH
00097 else if((*argv)[i] && (arg=parse_commandline_arg(argc,argv,&i,"--gitkr-text-speech"))) {
00098 gitkr_text_speech_name=strdup(arg);
00099 gitk_log1("selected speech (par) : \"%s\"",gitkr_text_speech_name);
00100 }
00101 #endif
00102 i++;
00103 }
00104 if(info_help) {
00105 gitk_puts(_("GITK-Renderer-Text options"));
00106 #ifdef HAVE_SPEECH
00107 gitk_puts(_(" --gitkr-text-speech\twhich speech module to use {festival}"));
00108 #endif
00109 putchar('\n');
00110 }
00111 if(info_version) puts(PACKAGE_NAME": version "PACKAGE_VERSION" by "PACKAGE_BUGREPORT);
00112
00113
00114 cleanup_commandline_args(argc,argv);
00115 gitk_log1("gitk_init_process_commandline()=%1d end",info_only);
00116 return(info_only);
00117 }