//----------------------------------------------------------------------------- T_Display *t_display_new_from_configuration(config_setting_t *disp) { T_Display *d ; config_setting_t *s, *plot_list, *p ; unsigned width = 200, height = 200, i ; T_DisplayType type = GRAPHICAL ; s = config_setting_get_member(disp, "type") ; if (s != NULL) type = config_setting_get_int(s) ; if (type == ALPHANUMERIC) d = t_display_new_alphanumeric() ; else d = t_display_new() ; s = config_setting_get_member(disp, "width") ; if (s != NULL) width = config_setting_get_int(s) ; s = config_setting_get_member(disp, "height") ; if (s != NULL) height = config_setting_get_int(s) ; gtk_widget_set_size_request((GtkWidget*)(d->canvas),width,height) ; s = config_setting_get_member(disp, "time_range") ; if (s != NULL) d->time_range = config_setting_get_int(s) ; //s = config_setting_get_member(disp, "last_time") ; // to chyba usunac //d->last_time = config_setting_get_int(s) ; s = config_setting_get_member(disp, "time_step") ; if (s != NULL) d->time_step = config_setting_get_int(s) ; s = config_setting_get_member(disp, "temp_max") ; if (s != NULL) d->temp_max = config_setting_get_int(s) ; s = config_setting_get_member(disp, "temp_min") ; if (s != NULL) d->temp_min = config_setting_get_int(s) ; s = config_setting_get_member(disp, "temp_step") ; if (s != NULL) d->temp_step = config_setting_get_int(s) ; d->font_size = 10 ; s = config_setting_get_member(disp, "font_size") ; if (s != NULL) d->font_size = config_setting_get_int(s) ; d->show_legend = TRUE ; s = config_setting_get_member(disp, "show_legend") ; if (s != NULL) d->show_legend = config_setting_get_bool(s) ; plot_list = config_setting_get_member(disp, "Plots") ; i=0 ; while ((p = config_setting_get_elem(plot_list,i)) != NULL) { t_display_add_plot(d,t_plot_new_from_configuration(p)) ; i++ ; } ; return d ; } ;
static void write_request() { time_t now; /* Half-hour remind */ if (*currmsg) { outmsg(currmsg); bell(); *currmsg = 0; return; } time(&now); #ifdef LINUX signal(SIGUSR2, write_request); #endif update_data(); ++cuser.receivemsg; substitute_record(fn_passwd, &cuser, sizeof(userec), usernum); bell(); show_last_call_in(); /* wildcat patch : 看不到水球??!! */ currutmp->msgcount--; memcpy(&oldmsg[no_oldmsg], &currutmp->msgs[0], sizeof(msgque)); no_oldmsg++; no_oldmsg %= MAX_REVIEW; if (oldmsg_count < MAX_REVIEW) oldmsg_count++; if (watermode) { if (watermode < oldmsg_count) watermode++; t_display_new(0); } refresh(); currutmp->msgcount = 0; }
static void write_request(int sig) { struct tm *ptime; time_t now; extern char watermode; time(&now); ptime = localtime(&now); if(currutmp->pager != 0 && cuser.userlevel != 0 && currutmp->msgcount != 0 && currutmp->mode != TALK && currutmp->mode != EDITING && currutmp->mode != CHATING && currutmp->mode != PAGE && currutmp->mode != IDLE && currutmp->mode != MAILALL && currutmp->mode != MONITOR) { int i; char c0 = currutmp->chatid[0]; int currstat0 = currstat; unsigned char mode0 = currutmp->mode; currutmp->mode = 0; currutmp->chatid[0] = 2; currstat = XMODE; do { bell(); show_last_call_in(1); igetch(); currutmp->msgcount--; if(currutmp->msgcount>=MAX_MSGS) { /* this causes chaos... jochang */ raise(SIGFPE); } memcpy(&oldmsg[(int)no_oldmsg], &currutmp->msgs[0], sizeof(msgque_t)); no_oldmsg++; no_oldmsg %= MAX_REVIEW; if(oldmsg_count < MAX_REVIEW) oldmsg_count++; for(i = 0; i < currutmp->msgcount; i++) currutmp->msgs[i] = currutmp->msgs[i + 1]; } while(currutmp->msgcount); currutmp->chatid[0] = c0; currutmp->mode = mode0; currstat = currstat0; } else { bell(); show_last_call_in(1); memcpy(&oldmsg[(int)no_oldmsg], &currutmp->msgs[0], sizeof(msgque_t)); no_oldmsg++; no_oldmsg %= MAX_REVIEW; if(oldmsg_count < MAX_REVIEW) oldmsg_count++; if(watermode > 0) { if(watermode < oldmsg_count) watermode++; t_display_new(); } refresh(); currutmp->msgcount = 0; } }
int igetch() { register int ch; while(ch = dogetch()) { switch (ch) { case Ctrl('L'): redoscr(); continue; case Ctrl('I'): if(currutmp != NULL && currutmp->mode == MMENU) { screenline* screen = (screenline *)calloc(t_lines, sizeof(screenline)); vs_save(screen); t_idle(); vs_restore(screen); continue; } else return(ch); case Ctrl('Q'): /* wildcat : 快速離站 :p */ if(currutmp->mode && currutmp->mode != READING) { if(answer("\033[0;30;47m 確定要離站?? (y/N) \033[m") != 'y') return(ch); update_data(); u_exit("ABORT"); pressanykey("謝謝光臨, 記得常來喔 !"); exit(0); } else return (ch); case Ctrl('U'): resetutmpent(); if(currutmp != NULL && currutmp->mode != EDITING && currutmp->mode != LUSERS && currutmp->mode) { int mode0 = currutmp->mode; int stat0 = currstat; screenline* screen = (screenline *)calloc(t_lines, sizeof(screenline)); vs_save(screen); t_users(); vs_restore(screen); currutmp->mode = mode0; currstat = stat0; continue; } else return (ch); case Ctrl('R'): { if(currutmp == NULL) return (ch); else if(watermode > 0) { watermode = (watermode + oldmsg_count)% oldmsg_count + 1; t_display_new(0); continue; } else if (!currutmp->mode && (currutmp->chatid[0] == 2 || currutmp->chatid[0] == 3) && oldmsg_count && !watermode) { watermode=1; t_display_new(1); continue; } else if (currutmp->msgs[0].last_pid && currutmp->mode) { screenline* screen = (screenline *)calloc(t_lines, sizeof(screenline)); vs_save(screen); watermode=1; t_display_new(1); my_write(currutmp->msgs[0].last_pid, "水球丟回去:"); vs_restore(screen); continue; } else return (ch); } case '\n': /* Ptt把 \n拿掉 */ continue; case Ctrl('T'): if(watermode > 0 ) { watermode = (watermode + oldmsg_count - 2 )% oldmsg_count + 1; t_display_new(0); continue; } default: return (ch); } } }