Skip to content
Snippets Groups Projects
Commit 9847400d authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Add a new "Blocky Scaling" option to syncterm

Which required a new ciolib option of course.
Only usable in X11 mode at present, though it may land for SDL
this weekend.
parent d5808927
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2182 failed
...@@ -305,6 +305,7 @@ typedef struct { ...@@ -305,6 +305,7 @@ typedef struct {
#define CONIO_OPT_SET_NAME 512 #define CONIO_OPT_SET_NAME 512
#define CONIO_OPT_SET_ICON 1024 #define CONIO_OPT_SET_ICON 1024
#define CONIO_OPT_EXTENDED_PALETTE 2048 #define CONIO_OPT_EXTENDED_PALETTE 2048
#define CONIO_OPT_BLOCKY_SCALING 4096
void (*clreol) (void); void (*clreol) (void);
int (*puttext) (int,int,int,int,void *); int (*puttext) (int,int,int,int,void *);
int (*vmem_puttext) (int,int,int,int,struct vmem_cell *); int (*vmem_puttext) (int,int,int,int,struct vmem_cell *);
......
#include "ciolib.h"
#include "scale.h" #include "scale.h"
#include "xbr.h" #include "xbr.h"
...@@ -119,6 +120,7 @@ do_scale(struct rectlist* rect, int xscale, int yscale, double ratio) ...@@ -119,6 +120,7 @@ do_scale(struct rectlist* rect, int xscale, int yscale, double ratio)
xscale = 1; xscale = 1;
total_yscaling = yscale; total_yscaling = yscale;
yscale = 1; yscale = 1;
if (!(cio_api.options & CONIO_OPT_BLOCKY_SCALING)) {
if ((total_xscaling & 1) == 1 && (total_xscaling == total_yscaling || (total_yscaling % total_xscaling == 0))) { if ((total_xscaling & 1) == 1 && (total_xscaling == total_yscaling || (total_yscaling % total_xscaling == 0))) {
pointymult = total_xscaling; pointymult = total_xscaling;
total_xscaling /= pointymult; total_xscaling /= pointymult;
...@@ -154,6 +156,7 @@ do_scale(struct rectlist* rect, int xscale, int yscale, double ratio) ...@@ -154,6 +156,7 @@ do_scale(struct rectlist* rect, int xscale, int yscale, double ratio)
total_yscaling /= 2; total_yscaling /= 2;
yscale *= 2; yscale *= 2;
} }
}
xmult = total_xscaling; xmult = total_xscaling;
xscale *= xmult; xscale *= xmult;
......
...@@ -1587,8 +1587,8 @@ void change_settings(int connected) ...@@ -1587,8 +1587,8 @@ void change_settings(int connected)
char inipath[MAX_PATH+1]; char inipath[MAX_PATH+1];
FILE *inifile; FILE *inifile;
str_list_t inicontents; str_list_t inicontents;
char opts[12][80]; char opts[13][80];
char *opt[13]; char *opt[14];
char *subopts[8]; char *subopts[8];
int i,j,k,l; int i,j,k,l;
char str[64]; char str[64];
...@@ -1632,6 +1632,8 @@ void change_settings(int connected) ...@@ -1632,6 +1632,8 @@ void change_settings(int connected)
" The complete path to the user's BBS list.\n\n" " The complete path to the user's BBS list.\n\n"
"~ TERM For Shell ~\n" "~ TERM For Shell ~\n"
" The value to set the TERM envirnonment variable to goes here.\n\n" " The value to set the TERM envirnonment variable to goes here.\n\n"
"~ Blocky Scaling ~\n"
" Toggle \"blocky\" scaling.\n\n"
"~ Custom Screen Mode ~\n" "~ Custom Screen Mode ~\n"
" Configure the Custom screen mode.\n\n"; " Configure the Custom screen mode.\n\n";
SAFEPRINTF(opts[0],"Confirm Program Exit %s",settings.confirm_close?"Yes":"No"); SAFEPRINTF(opts[0],"Confirm Program Exit %s",settings.confirm_close?"Yes":"No");
...@@ -1649,10 +1651,13 @@ void change_settings(int connected) ...@@ -1649,10 +1651,13 @@ void change_settings(int connected)
SAFEPRINTF(opts[8],"Modem Dial String %s",settings.mdm.dial_string); SAFEPRINTF(opts[8],"Modem Dial String %s",settings.mdm.dial_string);
SAFEPRINTF(opts[9],"List Path %s",settings.list_path); SAFEPRINTF(opts[9],"List Path %s",settings.list_path);
SAFEPRINTF(opts[10],"TERM For Shell %s",settings.TERM); SAFEPRINTF(opts[10],"TERM For Shell %s",settings.TERM);
if (connected) sprintf(opts[11],"Blocky Scaling %s", settings.blocky ? "On" : "Off");
opt[11] = NULL; if (connected) {
else opt[12] = NULL;
sprintf(opts[11],"Custom Screen Mode"); }
else {
sprintf(opts[12],"Custom Screen Mode");
}
switch(uifc.list(WIN_MID|WIN_SAV|WIN_ACT,0,0,0,&cur,NULL,"Program Settings",opt)) { switch(uifc.list(WIN_MID|WIN_SAV|WIN_ACT,0,0,0,&cur,NULL,"Program Settings",opt)) {
case -1: case -1:
check_exit(FALSE); check_exit(FALSE);
...@@ -1858,6 +1863,14 @@ void change_settings(int connected) ...@@ -1858,6 +1863,14 @@ void change_settings(int connected)
check_exit(FALSE); check_exit(FALSE);
break; break;
case 11: case 11:
settings.blocky = !settings.blocky;
iniSetBool(&inicontents,"SyncTERM","BlockyScaling",settings.blocky,&ini_style);
if (settings.blocky)
cio_api.options |= CONIO_OPT_BLOCKY_SCALING;
else
cio_api.options &= ~CONIO_OPT_BLOCKY_SCALING;
break;
case 12:
uifc.helpbuf= "`Custom Screen Mode`\n\n" uifc.helpbuf= "`Custom Screen Mode`\n\n"
"~ Rows ~\n" "~ Rows ~\n"
" Sets the number of rows in the custom screen mode\n" " Sets the number of rows in the custom screen mode\n"
......
...@@ -1253,6 +1253,7 @@ void load_settings(struct syncterm_settings *set) ...@@ -1253,6 +1253,7 @@ void load_settings(struct syncterm_settings *set)
set->scaling_factor=iniReadInteger(inifile,"SyncTERM","ScalingFactor",0); set->scaling_factor=iniReadInteger(inifile,"SyncTERM","ScalingFactor",0);
set->window_width=iniReadInteger(inifile,"SyncTERM","WindowWidth",0); set->window_width=iniReadInteger(inifile,"SyncTERM","WindowWidth",0);
set->window_height=iniReadInteger(inifile,"SyncTERM","WindowHeight",0); set->window_height=iniReadInteger(inifile,"SyncTERM","WindowHeight",0);
set->blocky=iniReadBool(inifile,"SyncTERM","BlockyScaling",FALSE);
// TODO: Add this to the UI somewhere. // TODO: Add this to the UI somewhere.
set->left_just=iniReadBool(inifile,"SyncTERM","LeftJustify",FALSE); set->left_just=iniReadBool(inifile,"SyncTERM","LeftJustify",FALSE);
...@@ -1597,8 +1598,16 @@ int main(int argc, char **argv) ...@@ -1597,8 +1598,16 @@ int main(int argc, char **argv)
SAFECOPY(url,argv[i]); SAFECOPY(url,argv[i]);
} }
if (settings.blocky)
cio_api.options |= CONIO_OPT_BLOCKY_SCALING;
else
cio_api.options &= ~CONIO_OPT_BLOCKY_SCALING;
if(initciolib(ciolib_mode)) if(initciolib(ciolib_mode))
return(1); return(1);
if (settings.blocky)
cio_api.options |= CONIO_OPT_BLOCKY_SCALING;
else
cio_api.options &= ~CONIO_OPT_BLOCKY_SCALING;
ciolib_reaper=FALSE; ciolib_reaper=FALSE;
seticon(syncterm_icon.pixel_data,syncterm_icon.width); seticon(syncterm_icon.pixel_data,syncterm_icon.width);
if (settings.scaling_factor) if (settings.scaling_factor)
......
...@@ -65,6 +65,7 @@ struct syncterm_settings { ...@@ -65,6 +65,7 @@ struct syncterm_settings {
int window_width; int window_width;
int window_height; int window_height;
int left_just; int left_just;
int blocky;
}; };
extern char *inpath; extern char *inpath;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment