update TTF menu options

This commit is contained in:
Wengier
2021-05-19 07:37:58 -04:00
parent bddf063c8e
commit 7ae956ab9c
2 changed files with 31 additions and 6 deletions

View File

@@ -316,7 +316,8 @@ typedef struct {
uint8_t alpha; // unused uint8_t alpha; // unused
} alt_rgb; } alt_rgb;
alt_rgb altBGR0[16], altBGR1[16]; alt_rgb altBGR0[16], altBGR1[16];
static int prev_sline = -1, blinkCursor = -1; int blinkCursor = -1;
static int prev_sline = -1;
static alt_rgb *rgbColors = (alt_rgb*)render.pal.rgb; static alt_rgb *rgbColors = (alt_rgb*)render.pal.rgb;
static bool blinkstate = false; static bool blinkstate = false;
bool colorChanged = false, justChanged = false; bool colorChanged = false, justChanged = false;
@@ -3660,7 +3661,7 @@ bool readTTF(const char *fName, bool bold, bool ital) {
void SetBlinkRate(Section_prop* section) { void SetBlinkRate(Section_prop* section) {
const char * blinkCstr = section->Get_string("ttf.blinkc"); const char * blinkCstr = section->Get_string("ttf.blinkc");
unsigned int num=-1; unsigned int num=-1;
if (!strcasecmp(blinkCstr, "false")) blinkCursor = -1; if (!strcasecmp(blinkCstr, "false")||!strcmp(blinkCstr, "-1")) blinkCursor = -1;
else if (1==sscanf(blinkCstr,"%u",&num)&&num>=0&&num<=7) blinkCursor = num; else if (1==sscanf(blinkCstr,"%u",&num)&&num>=0&&num<=7) blinkCursor = num;
else blinkCursor = IS_PC98_ARCH?6:4; // default cursor blinking is slower on PC-98 systems else blinkCursor = IS_PC98_ARCH?6:4; // default cursor blinking is slower on PC-98 systems
} }
@@ -4039,7 +4040,7 @@ void change_output(int output) {
mainMenu.get_item("ttf_wpwp").enable(TTF_using()).check(wpType==1).refresh_item(mainMenu); mainMenu.get_item("ttf_wpwp").enable(TTF_using()).check(wpType==1).refresh_item(mainMenu);
mainMenu.get_item("ttf_wpws").enable(TTF_using()).check(wpType==2).refresh_item(mainMenu); mainMenu.get_item("ttf_wpws").enable(TTF_using()).check(wpType==2).refresh_item(mainMenu);
mainMenu.get_item("ttf_wpxy").enable(TTF_using()).check(wpType==3).refresh_item(mainMenu); mainMenu.get_item("ttf_wpxy").enable(TTF_using()).check(wpType==3).refresh_item(mainMenu);
mainMenu.get_item("ttf_blinkc").enable(TTF_using()).check(blinkCursor).refresh_item(mainMenu); mainMenu.get_item("ttf_blinkc").enable(TTF_using()).check(blinkCursor>-1).refresh_item(mainMenu);
#if C_PRINTER #if C_PRINTER
mainMenu.get_item("ttf_printfont").enable(TTF_using()).check(printfont).refresh_item(mainMenu); mainMenu.get_item("ttf_printfont").enable(TTF_using()).check(printfont).refresh_item(mainMenu);
#endif #endif
@@ -13889,7 +13890,7 @@ int main(int argc, char* argv[]) SDL_MAIN_NOEXCEPT {
mainMenu.get_item("ttf_wpwp").enable(TTF_using()).check(wpType==1); mainMenu.get_item("ttf_wpwp").enable(TTF_using()).check(wpType==1);
mainMenu.get_item("ttf_wpws").enable(TTF_using()).check(wpType==2); mainMenu.get_item("ttf_wpws").enable(TTF_using()).check(wpType==2);
mainMenu.get_item("ttf_wpxy").enable(TTF_using()).check(wpType==3); mainMenu.get_item("ttf_wpxy").enable(TTF_using()).check(wpType==3);
mainMenu.get_item("ttf_blinkc").enable(TTF_using()).check(blinkCursor); mainMenu.get_item("ttf_blinkc").enable(TTF_using()).check(blinkCursor>-1);
#if C_PRINTER #if C_PRINTER
mainMenu.get_item("ttf_printfont").enable(TTF_using()).check(printfont); mainMenu.get_item("ttf_printfont").enable(TTF_using()).check(printfont);
#endif #endif

View File

@@ -48,8 +48,8 @@ typedef struct {
Bitu call_program; Bitu call_program;
extern const char *modifier; extern const char *modifier;
extern int enablelfn, paste_speed, wheel_key, freesizecap, wpType, wpVersion, wpBG, wpFG, lastset; extern int enablelfn, paste_speed, wheel_key, freesizecap, wpType, wpVersion, wpBG, wpFG, lastset, blinkCursor;
extern bool dos_kernel_disabled, force_nocachedir, wpcolon, lockmount, enable_config_as_shell_commands, load, winrun, winautorun, startwait, startquiet, mountwarning, wheel_guest, clipboard_dosapi, noremark_save_state, force_load_state, sync_time, manualtime, showbold, showital, showline, showsout, char512; extern bool dos_kernel_disabled, force_nocachedir, wpcolon, lockmount, enable_config_as_shell_commands, load, winrun, winautorun, startwait, startquiet, mountwarning, wheel_guest, clipboard_dosapi, noremark_save_state, force_load_state, sync_time, manualtime, showbold, showital, showline, showsout, char512, printfont, dbcs_sbcs, autoboxdraw;
/* This registers a file on the virtual drive and creates the correct structure for it*/ /* This registers a file on the virtual drive and creates the correct structure for it*/
@@ -1430,31 +1430,55 @@ void CONFIG::Run(void) {
} else if (!strcasecmp(inputline.substr(0, 9).c_str(), "ttf.bold=")) { } else if (!strcasecmp(inputline.substr(0, 9).c_str(), "ttf.bold=")) {
#if defined(USE_TTF) #if defined(USE_TTF)
showbold = section->Get_bool("ttf.bold"); showbold = section->Get_bool("ttf.bold");
mainMenu.get_item("ttf_showbold").check(showbold).refresh_item(mainMenu);
resetFontSize(); resetFontSize();
#endif #endif
} else if (!strcasecmp(inputline.substr(0, 11).c_str(), "ttf.italic=")) { } else if (!strcasecmp(inputline.substr(0, 11).c_str(), "ttf.italic=")) {
#if defined(USE_TTF) #if defined(USE_TTF)
showital = section->Get_bool("ttf.italic"); showital = section->Get_bool("ttf.italic");
mainMenu.get_item("ttf_showital").check(showital).refresh_item(mainMenu);
resetFontSize(); resetFontSize();
#endif #endif
} else if (!strcasecmp(inputline.substr(0, 14).c_str(), "ttf.underline=")) { } else if (!strcasecmp(inputline.substr(0, 14).c_str(), "ttf.underline=")) {
#if defined(USE_TTF) #if defined(USE_TTF)
showline = section->Get_bool("ttf.underline"); showline = section->Get_bool("ttf.underline");
mainMenu.get_item("ttf_showline").check(showline).refresh_item(mainMenu);
resetFontSize(); resetFontSize();
#endif #endif
} else if (!strcasecmp(inputline.substr(0, 14).c_str(), "ttf.strikeout=")) { } else if (!strcasecmp(inputline.substr(0, 14).c_str(), "ttf.strikeout=")) {
#if defined(USE_TTF) #if defined(USE_TTF)
showsout = section->Get_bool("ttf.strikeout"); showsout = section->Get_bool("ttf.strikeout");
mainMenu.get_item("ttf_showsout").check(showsout).refresh_item(mainMenu);
resetFontSize(); resetFontSize();
#endif #endif
} else if (!strcasecmp(inputline.substr(0, 12).c_str(), "ttf.char512=")) { } else if (!strcasecmp(inputline.substr(0, 12).c_str(), "ttf.char512=")) {
#if defined(USE_TTF) #if defined(USE_TTF)
char512 = section->Get_bool("ttf.char512"); char512 = section->Get_bool("ttf.char512");
resetFontSize(); resetFontSize();
#endif
} else if (!strcasecmp(inputline.substr(0, 14).c_str(), "ttf.printfont=")) {
#if defined(USE_TTF) && C_PRINTER
printfont = section->Get_bool("ttf.printfont");
mainMenu.get_item("ttf_printfont").check(printfont).refresh_item(mainMenu);
void UpdateDefaultPrinterFont();
UpdateDefaultPrinterFont();
#endif
} else if (!strcasecmp(inputline.substr(0, 13).c_str(), "ttf.autodbcs=")) {
#if defined(USE_TTF)
dbcs_sbcs = section->Get_bool("ttf.autodbcs");
mainMenu.get_item("ttf_dbcs_sbcs").check(dbcs_sbcs).refresh_item(mainMenu);
resetFontSize();
#endif
} else if (!strcasecmp(inputline.substr(0, 16).c_str(), "ttf.autoboxdraw=")) {
#if defined(USE_TTF)
autoboxdraw = section->Get_bool("ttf.autoboxdraw");
mainMenu.get_item("ttf_autoboxdraw").check(autoboxdraw).refresh_item(mainMenu);
resetFontSize();
#endif #endif
} else if (!strcasecmp(inputline.substr(0, 11).c_str(), "ttf.blinkc=")) { } else if (!strcasecmp(inputline.substr(0, 11).c_str(), "ttf.blinkc=")) {
#if defined(USE_TTF) #if defined(USE_TTF)
SetBlinkRate(section); SetBlinkRate(section);
mainMenu.get_item("ttf_blinkc").check(blinkCursor>-1).refresh_item(mainMenu);
#endif #endif
} else if (!strcasecmp(inputline.substr(0, 9).c_str(), "glshader=")) { } else if (!strcasecmp(inputline.substr(0, 9).c_str(), "glshader=")) {
#if C_OPENGL #if C_OPENGL