Wed Nov 17 18:34:43 PST 1999 Michael Jennings <mej@eterm.org>

Some selection changes and escape sequence fixes.  You can now
	specify multiple color modifier commands in a single escape sequence.
	You can also remove any existing color modifiers using "clear".


SVN revision: 1324
This commit is contained in:
Michael Jennings 1999-11-18 01:21:26 +00:00
parent b6305595a7
commit 5894debb3a
4 changed files with 145 additions and 100 deletions

View File

@ -2792,3 +2792,10 @@ Mon Nov 15 13:20:05 PST 1999 Michael Jennings <mej@eterm.org>
raster has given me the cl00bat beating, so it's fixed now. :-]
-------------------------------------------------------------------------------
Wed Nov 17 18:34:43 PST 1999 Michael Jennings <mej@eterm.org>
Some selection changes and escape sequence fixes. You can now
specify multiple color modifier commands in a single escape sequence.
You can also remove any existing color modifiers using "clear".
-------------------------------------------------------------------------------

View File

@ -99,7 +99,9 @@ static short lost_multi = 0;
* SCREEN `COMMON' ROUTINES *
* ------------------------------------------------------------------------- */
/* Fill part/all of a drawn line with blanks. */
void
inline void blank_line(text_t *, rend_t *, int, rend_t);
inline void
blank_line(text_t * et, rend_t * er, int width, rend_t efs)
{
/* int i = width; */
@ -631,13 +633,6 @@ scroll_text(int row1, int row2, int count, int spec)
if (count == 0 || (row1 > row2))
return 0;
if (selection.op) { /* move selected region too */
selection.beg.row -= count;
selection.end.row -= count;
selection.mark.row -= count;
}
CHECK_SELECTION;
if ((count > 0) && (row1 == 0) && (current_screen == PRIMARY)) {
TermWin.nscrolled += count;
MIN_IT(TermWin.nscrolled, TermWin.saveLines);
@ -645,6 +640,26 @@ scroll_text(int row1, int row2, int count, int spec)
row1 += TermWin.saveLines;
row2 += TermWin.saveLines;
if (selection.op && current_screen == selection.screen) {
i = selection.beg.row + TermWin.saveLines;
j = selection.end.row + TermWin.saveLines;
if ((i < row1 && j > row1)
|| (i < row2 && j > row2)
|| (i - count < row1 && i >= row1)
|| (i - count > row2 && i <= row2)
|| (j - count < row1 && j >= row1)
|| (j - count > row2 && j <= row2)) {
CLEAR_ALL_SELECTION;
selection.op = SELECTION_CLEAR;
} else if (j >= row1 && j <= row2) {
/* move selected region too */
selection.beg.row -= count;
selection.end.row -= count;
selection.mark.row -= count;
}
}
CHECK_SELECTION;
if (count > 0) {
/* A: scroll up */
@ -729,6 +744,9 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
rend_t *srp;
row_col_t beg, end;
if (len <= 0) /* sanity */
return;
last_col = TermWin.ncol;
D_SCREEN(("scr_add_lines(*,%d,%d)\n", nlines, len));
@ -755,9 +773,7 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
MIN_IT(screen.col, last_col - 1);
MIN_IT(screen.row, TermWin.nrow - 1);
/*MAX_IT(screen.row, 0); */
MAX_IT(screen.row, -TermWin.saveLines);
if (len <= 0) /* sanity */
return;
MAX_IT(screen.row, -TermWin.nscrolled);
row = screen.row + TermWin.saveLines;
if (screen.text[row] == NULL) {
@ -807,7 +823,7 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
if (screen.text[j] == NULL)
make_screen_mem(screen.text, screen.rend, j);
blank_line(screen.text[j], screen.rend[j],
TermWin.ncol, DEFAULT_RSTYLE | (rstyle & RS_RVid ? RS_RVid : 0));
TermWin.ncol, DEFAULT_RSTYLE | ((rstyle & RS_RVid) ? (RS_RVid) : (0)));
screen.text[j][TermWin.ncol] = 0;
} else if (screen.row < (TermWin.nrow - 1)) {
screen.row++;
@ -838,7 +854,7 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
blank_line(screen.text[j], screen.rend[j], TermWin.ncol,
rstyle); Bug fix from John Ellison - need to reset rstyle */
blank_line(screen.text[j], screen.rend[j], TermWin.ncol,
DEFAULT_RSTYLE | (rstyle & RS_RVid ? RS_RVid : 0));
DEFAULT_RSTYLE | ((rstyle & RS_RVid) ? (RS_RVid) : (0)));
screen.text[j][TermWin.ncol] = 0;
} else if (screen.row < (TermWin.nrow - 1)) {
screen.row++;

View File

@ -32,6 +32,9 @@
#define CHECK_SELECTION do { \
if (selection.op) selection_check(); \
} while (0)
#define CLEAR_SELECTION (selection.beg.row = selection.beg.col = selection.end.row = selection.end.col = 0)
#define CLEAR_ALL_SELECTION (selection.beg.row = selection.beg.col = selection.mark.row = selection.mark.col = selection.end.row = selection.end.col = 0)
#define scr_touch() scr_expose(0, 0, TermWin.width, TermWin.height)
/*
@ -218,7 +221,6 @@ extern unsigned int colorfgbg;
/************ Function Prototypes ************/
_XFUNCPROTOBEGIN
extern void blank_line(text_t *, rend_t *, int, rend_t);
extern void blank_dline(text_t *, rend_t *, int, rend_t);
extern void blank_sline(text_t *, rend_t *, int);
extern void make_screen_mem(text_t **, rend_t **, int);

View File

@ -234,7 +234,6 @@ lookup_key(XEvent * ev)
LK_RET();
break;
/* Eterm extras */
case XK_KP_Add: /* Shift+KP_Add = bigger font */
change_font(0, FONT_UP);
LK_RET();
@ -1717,105 +1716,126 @@ xterm_seq(int op, const char *str)
redraw_all_images();
break;
case 1:
if ((color = (char *) strsep(&tnstr, ";")) == NULL) {
break;
}
if ((strlen(color) == 2) || (!strcasecmp(color, "down"))) {
/* They specified an image index */
if (!strcasecmp(color, "bg")) {
which = image_bg;
} else if (!strcasecmp(color, "sb")) {
which = image_sb;
} else if (!strcasecmp(color, "sa")) {
which = image_sa;
} else if (!strcasecmp(color, "up")) {
which = image_up;
} else if (!strcasecmp(color, "down")) {
which = image_down;
} else {
break;
}
changed = 0;
for (; 1;) {
if ((color = (char *) strsep(&tnstr, ";")) == NULL) {
break;
}
} else {
which = image_bg;
}
if ((mod = (char *) strsep(&tnstr, ";")) == NULL) {
break;
}
if ((valptr = (char *) strsep(&tnstr, ";")) == NULL) {
break;
}
D_CMD(("Modifying the %s attribute of the %s color modifier of the %s image to be %s\n", mod, color, get_image_type(which), valptr));
if (image_mode_is(which, MODE_TRANS) && (desktop_pixmap != None)) {
free_desktop_pixmap();
}
if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) {
XFreePixmap(Xdisplay, viewport_pixmap);
viewport_pixmap = None; /* Force the re-read */
}
if (!strcasecmp(color, "image")) {
imlib_t *iml = images[which].current->iml;
if (iml->mod == NULL) {
iml->mod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->mod->brightness = iml->mod->contrast = iml->mod->gamma = 0xff;
if ((strlen(color) == 2) || (!strcasecmp(color, "down"))) {
/* They specified an image index */
if (!strcasecmp(color, "bg")) {
which = image_bg;
} else if (!strcasecmp(color, "sb")) {
which = image_sb;
} else if (!strcasecmp(color, "sa")) {
which = image_sa;
} else if (!strcasecmp(color, "up")) {
which = image_up;
} else if (!strcasecmp(color, "down")) {
which = image_down;
} else {
break;
}
if ((color = (char *) strsep(&tnstr, ";")) == NULL) {
break;
}
} else {
which = image_bg;
}
if (!BEG_STRCASECMP("brightness", mod)) {
iml->mod->brightness = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("contrast", mod)) {
iml->mod->contrast = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("gamma", mod)) {
iml->mod->gamma = (int) strtol(valptr, (char **) NULL, 0);
if ((mod = (char *) strsep(&tnstr, ";")) == NULL) {
break;
}
if (!strcasecmp(mod, "clear")) {
imlib_t *iml = images[which].current->iml;
} else if (!strcasecmp(color, "red")) {
imlib_t *iml = images[which].current->iml;
if (iml->rmod == NULL) {
iml->rmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->rmod->brightness = iml->rmod->contrast = iml->rmod->gamma = 0xff;
if (!strcasecmp(color, "image")) {
FREE(iml->mod);
} else if (!strcasecmp(color, "red")) {
FREE(iml->rmod);
} else if (!strcasecmp(color, "green")) {
FREE(iml->gmod);
} else if (!strcasecmp(color, "blue")) {
FREE(iml->bmod);
}
changed = 1;
continue;
}
if (!BEG_STRCASECMP("brightness", mod)) {
iml->rmod->brightness = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("contrast", mod)) {
iml->rmod->contrast = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("gamma", mod)) {
iml->rmod->gamma = (int) strtol(valptr, (char **) NULL, 0);
if ((valptr = (char *) strsep(&tnstr, ";")) == NULL) {
break;
}
} else if (!strcasecmp(color, "green")) {
imlib_t *iml = images[which].current->iml;
if (iml->gmod == NULL) {
iml->gmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->gmod->brightness = iml->gmod->contrast = iml->gmod->gamma = 0xff;
D_CMD(("Modifying the %s attribute of the %s color modifier of the %s image to be %s\n", mod, color, get_image_type(which), valptr));
changed = 1;
if (image_mode_is(which, MODE_TRANS) && (desktop_pixmap != None)) {
free_desktop_pixmap();
}
if (!BEG_STRCASECMP("brightness", mod)) {
iml->gmod->brightness = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("contrast", mod)) {
iml->gmod->contrast = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("gamma", mod)) {
iml->gmod->gamma = (int) strtol(valptr, (char **) NULL, 0);
if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) {
XFreePixmap(Xdisplay, viewport_pixmap);
viewport_pixmap = None; /* Force the re-read */
}
if (!strcasecmp(color, "image")) {
imlib_t *iml = images[which].current->iml;
} else if (!strcasecmp(color, "blue")) {
imlib_t *iml = images[which].current->iml;
if (iml->mod == NULL) {
iml->mod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->mod->brightness = iml->mod->contrast = iml->mod->gamma = 0xff;
}
if (!BEG_STRCASECMP("brightness", mod)) {
iml->mod->brightness = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("contrast", mod)) {
iml->mod->contrast = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("gamma", mod)) {
iml->mod->gamma = (int) strtol(valptr, (char **) NULL, 0);
}
if (iml->bmod == NULL) {
iml->bmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->bmod->brightness = iml->bmod->contrast = iml->bmod->gamma = 0xff;
}
if (!BEG_STRCASECMP("brightness", mod)) {
iml->bmod->brightness = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("contrast", mod)) {
iml->bmod->contrast = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("gamma", mod)) {
iml->bmod->gamma = (int) strtol(valptr, (char **) NULL, 0);
} else if (!strcasecmp(color, "red")) {
imlib_t *iml = images[which].current->iml;
if (iml->rmod == NULL) {
iml->rmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->rmod->brightness = iml->rmod->contrast = iml->rmod->gamma = 0xff;
}
if (!BEG_STRCASECMP("brightness", mod)) {
iml->rmod->brightness = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("contrast", mod)) {
iml->rmod->contrast = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("gamma", mod)) {
iml->rmod->gamma = (int) strtol(valptr, (char **) NULL, 0);
}
} else if (!strcasecmp(color, "green")) {
imlib_t *iml = images[which].current->iml;
if (iml->gmod == NULL) {
iml->gmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->gmod->brightness = iml->gmod->contrast = iml->gmod->gamma = 0xff;
}
if (!BEG_STRCASECMP("brightness", mod)) {
iml->gmod->brightness = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("contrast", mod)) {
iml->gmod->contrast = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("gamma", mod)) {
iml->gmod->gamma = (int) strtol(valptr, (char **) NULL, 0);
}
} else if (!strcasecmp(color, "blue")) {
imlib_t *iml = images[which].current->iml;
if (iml->bmod == NULL) {
iml->bmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->bmod->brightness = iml->bmod->contrast = iml->bmod->gamma = 0xff;
}
if (!BEG_STRCASECMP("brightness", mod)) {
iml->bmod->brightness = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("contrast", mod)) {
iml->bmod->contrast = (int) strtol(valptr, (char **) NULL, 0);
} else if (!BEG_STRCASECMP("gamma", mod)) {
iml->bmod->gamma = (int) strtol(valptr, (char **) NULL, 0);
}
}
}
redraw_all_images();
if (changed) {
redraw_all_images();
}
break;
case 3:
get_desktop_window();