int loadRconsole(Gui gui, const char *optf) { int ok, done, cfgerr; char *opt[2]; if (!optopenfile(optf)) { return 0; /* this should not happen unless there are permission problems, etc */ } cfgerr = 0; while ((ok = optread(opt, '='))) { done = 0; if (ok == 2) { if (!strcmp(opt[0], "font")) { if(strlen(opt[1]) > 127) opt[1][127] = '\0'; gui->tt_font = FALSE; { const char *pf; if ((strlen(opt[1]) > 1) && (opt[1][0] == 'T') && (opt[1][1] == 'T')) { gui->tt_font = TRUE; for (pf = opt[1]+2; isspace(*pf) ; pf++); } else pf = opt[1]; strcpy(gui->font, pf); } done = 1; } if (!strcmp(opt[0], "points")) { gui->pointsize = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "style")) { strcpy(gui->style, opt[1]); done = 1; } if (!strcmp(opt[0], "rows")) { gui->crows = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "columns")) { gui->ccols = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "xconsole")) { gui->cx = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "yconsole")) { gui->cy = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "xgraphics")) { gui->grx = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "ygraphics")) { gui->gry = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "cursor_blink")) { int i; for (i = 0; i < 3; i++) { if (!strcmp(opt[1], BlinkList[i])) { gui->cursor_blink = i; done = 1; break; } } } if (!strcmp(opt[0], "pgrows")) { gui->prows = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "pgcolumns")) { gui->pcols = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "pagerstyle")) { if (!strcmp(opt[1], "singlewindow")) gui->pagerMultiple = 0; else gui->pagerMultiple = 1; done = 1; } if (!strcmp(opt[0], "bufbytes")) { gui->cbb = atoi(opt[1]); done = 1; } if (!strcmp(opt[0], "buflines")) { gui->cbl = atoi(opt[1]); done = 1; } #ifdef USE_MDI if (!strcmp(opt[0], "MDI")) { if (!strcmp(opt[1], "yes")) gui->MDI = 1; else if (!strcmp(opt[1], "no")) gui->MDI = 0; done = 1; } if (!strcmp(opt[0], "toolbar")) { if (!strcmp(opt[1], "yes")) gui->toolbar = 1; else if (!strcmp(opt[1], "no")) gui->toolbar = 0; done = 1; } if (!strcmp(opt[0], "statusbar")) { if (!strcmp(opt[1], "yes")) gui->statusbar = 1; else if (!strcmp(opt[1], "no")) gui->statusbar = 0; done = 1; } if (!strcmp(opt[0], "MDIsize")) { /* wxh+x+y */ int x=0, y=0, w=0, h=0, sign; char *p = opt[1]; if(*p == '-') {sign = -1; p++;} else sign = +1; for(w=0; isdigit(*p); p++) w = 10*w + (*p - '0'); w *= sign; p++; if(*p == '-') {sign = -1; p++;} else sign = +1; for(h=0; isdigit(*p); p++) h = 10*h + (*p - '0'); h *= sign; if(*p == '-') sign = -1; else sign = +1; p++; for(x=0; isdigit(*p); p++) x = 10*x + (*p - '0'); x *= sign; if(*p == '-') sign = -1; else sign = +1; p++; for(y=0; isdigit(*p); p++) y = 10*y + (*p - '0'); y *= sign; gui->MDIsize = rect(x, y, w, h); done = 1; } #endif for (int i=0; i<numGuiColors; i++) if (!strcmp(opt[0], GuiElementNames[i])) { if (!strcmpi(opt[1], "Windows")) gui->guiColors[i] = myGetSysColor(COLOR_WINDOW); else gui->guiColors[i] = nametorgb(opt[1]); if (gui->guiColors[i] != Transparent) done = 1; } if (!strcmp(opt[0], "setwidthonresize")) { if (!strcmp(opt[1], "yes")) gui->setWidthOnResize = 1; else if (!strcmp(opt[1], "no")) gui->setWidthOnResize = 0; done = 1; } if (!strcmp(opt[0], "language")) { strcpy(gui->language, opt[1]); done = 1; } if (!strcmp(opt[0], "buffered")) { if (!strcmp(opt[1], "yes")) gui->buffered = 1; else if (!strcmp(opt[1], "no")) gui->buffered = 0; done = 1; } } else if (ok == 3) { /* opt[1] == "" */ if (!strcmp(opt[0], "language")) { strcpy(gui->language, opt[1]); done = 1; } } if (!done) snprintf(gui->warning, sizeof(gui->warning), G_("Ignored '%s' at line %d of file %s"), opt[0], optline(), optfile()); } return !cfgerr; }
rgb dialog_bg() { return myGetSysColor(COLOR_BTNFACE); }