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 {
#define CONIO_OPT_SET_NAME 512
#define CONIO_OPT_SET_ICON 1024
#define CONIO_OPT_EXTENDED_PALETTE 2048
#define CONIO_OPT_BLOCKY_SCALING 4096
void (*clreol) (void);
int (*puttext) (int,int,int,int,void *);
int (*vmem_puttext) (int,int,int,int,struct vmem_cell *);
......
#include "ciolib.h"
#include "scale.h"
#include "xbr.h"
......@@ -119,40 +120,42 @@ do_scale(struct rectlist* rect, int xscale, int yscale, double ratio)
xscale = 1;
total_yscaling = yscale;
yscale = 1;
if ((total_xscaling & 1) == 1 && (total_xscaling == total_yscaling || (total_yscaling % total_xscaling == 0))) {
pointymult = total_xscaling;
total_xscaling /= pointymult;
xscale *= pointymult;
total_yscaling /= pointymult;
yscale *= pointymult;
}
while (total_xscaling > 1 && ((total_xscaling % 5) == 0) && ((total_yscaling % 5) == 0)) {
pointy5++;
total_xscaling /= 5;
xscale *= 5;
total_yscaling /= 5;
yscale *= 5;
}
while (total_xscaling > 1 && ((total_xscaling % 3) == 0) && ((total_yscaling % 3) == 0)) {
pointy3++;
total_xscaling /= 3;
xscale *= 3;
total_yscaling /= 3;
yscale *= 3;
}
while (total_xscaling > 1 && ((total_xscaling % 4) == 0) && ((total_yscaling % 4) == 0)) {
xbr4++;
total_xscaling /= 4;
xscale *= 4;
total_yscaling /= 4;
yscale *= 4;
}
while (total_xscaling > 1 && ((total_xscaling % 2) == 0) && ((total_yscaling % 2) == 0)) {
xbr2++;
total_xscaling /= 2;
xscale *= 2;
total_yscaling /= 2;
yscale *= 2;
if (!(cio_api.options & CONIO_OPT_BLOCKY_SCALING)) {
if ((total_xscaling & 1) == 1 && (total_xscaling == total_yscaling || (total_yscaling % total_xscaling == 0))) {
pointymult = total_xscaling;
total_xscaling /= pointymult;
xscale *= pointymult;
total_yscaling /= pointymult;
yscale *= pointymult;
}
while (total_xscaling > 1 && ((total_xscaling % 5) == 0) && ((total_yscaling % 5) == 0)) {
pointy5++;
total_xscaling /= 5;
xscale *= 5;
total_yscaling /= 5;
yscale *= 5;
}
while (total_xscaling > 1 && ((total_xscaling % 3) == 0) && ((total_yscaling % 3) == 0)) {
pointy3++;
total_xscaling /= 3;
xscale *= 3;
total_yscaling /= 3;
yscale *= 3;
}
while (total_xscaling > 1 && ((total_xscaling % 4) == 0) && ((total_yscaling % 4) == 0)) {
xbr4++;
total_xscaling /= 4;
xscale *= 4;
total_yscaling /= 4;
yscale *= 4;
}
while (total_xscaling > 1 && ((total_xscaling % 2) == 0) && ((total_yscaling % 2) == 0)) {
xbr2++;
total_xscaling /= 2;
xscale *= 2;
total_yscaling /= 2;
yscale *= 2;
}
}
xmult = total_xscaling;
......
......@@ -1587,8 +1587,8 @@ void change_settings(int connected)
char inipath[MAX_PATH+1];
FILE *inifile;
str_list_t inicontents;
char opts[12][80];
char *opt[13];
char opts[13][80];
char *opt[14];
char *subopts[8];
int i,j,k,l;
char str[64];
......@@ -1632,6 +1632,8 @@ void change_settings(int connected)
" The complete path to the user's BBS list.\n\n"
"~ TERM For Shell ~\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"
" Configure the Custom screen mode.\n\n";
SAFEPRINTF(opts[0],"Confirm Program Exit %s",settings.confirm_close?"Yes":"No");
......@@ -1649,10 +1651,13 @@ void change_settings(int connected)
SAFEPRINTF(opts[8],"Modem Dial String %s",settings.mdm.dial_string);
SAFEPRINTF(opts[9],"List Path %s",settings.list_path);
SAFEPRINTF(opts[10],"TERM For Shell %s",settings.TERM);
if (connected)
opt[11] = NULL;
else
sprintf(opts[11],"Custom Screen Mode");
sprintf(opts[11],"Blocky Scaling %s", settings.blocky ? "On" : "Off");
if (connected) {
opt[12] = NULL;
}
else {
sprintf(opts[12],"Custom Screen Mode");
}
switch(uifc.list(WIN_MID|WIN_SAV|WIN_ACT,0,0,0,&cur,NULL,"Program Settings",opt)) {
case -1:
check_exit(FALSE);
......@@ -1858,6 +1863,14 @@ void change_settings(int connected)
check_exit(FALSE);
break;
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"
"~ Rows ~\n"
" Sets the number of rows in the custom screen mode\n"
......
......@@ -1253,6 +1253,7 @@ void load_settings(struct syncterm_settings *set)
set->scaling_factor=iniReadInteger(inifile,"SyncTERM","ScalingFactor",0);
set->window_width=iniReadInteger(inifile,"SyncTERM","WindowWidth",0);
set->window_height=iniReadInteger(inifile,"SyncTERM","WindowHeight",0);
set->blocky=iniReadBool(inifile,"SyncTERM","BlockyScaling",FALSE);
// TODO: Add this to the UI somewhere.
set->left_just=iniReadBool(inifile,"SyncTERM","LeftJustify",FALSE);
......@@ -1597,8 +1598,16 @@ int main(int argc, char **argv)
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))
return(1);
if (settings.blocky)
cio_api.options |= CONIO_OPT_BLOCKY_SCALING;
else
cio_api.options &= ~CONIO_OPT_BLOCKY_SCALING;
ciolib_reaper=FALSE;
seticon(syncterm_icon.pixel_data,syncterm_icon.width);
if (settings.scaling_factor)
......
......@@ -65,6 +65,7 @@ struct syncterm_settings {
int window_width;
int window_height;
int left_just;
int blocky;
};
extern char *inpath;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment