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

View File

@ -32,6 +32,9 @@
#define CHECK_SELECTION do { \ #define CHECK_SELECTION do { \
if (selection.op) selection_check(); \ if (selection.op) selection_check(); \
} while (0) } 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) #define scr_touch() scr_expose(0, 0, TermWin.width, TermWin.height)
/* /*
@ -218,7 +221,6 @@ extern unsigned int colorfgbg;
/************ Function Prototypes ************/ /************ Function Prototypes ************/
_XFUNCPROTOBEGIN _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_dline(text_t *, rend_t *, int, rend_t);
extern void blank_sline(text_t *, rend_t *, int); extern void blank_sline(text_t *, rend_t *, int);
extern void make_screen_mem(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(); LK_RET();
break; break;
/* Eterm extras */
case XK_KP_Add: /* Shift+KP_Add = bigger font */ case XK_KP_Add: /* Shift+KP_Add = bigger font */
change_font(0, FONT_UP); change_font(0, FONT_UP);
LK_RET(); LK_RET();
@ -1717,105 +1716,126 @@ xterm_seq(int op, const char *str)
redraw_all_images(); redraw_all_images();
break; break;
case 1: case 1:
if ((color = (char *) strsep(&tnstr, ";")) == NULL) { changed = 0;
break; for (; 1;) {
}
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) { if ((color = (char *) strsep(&tnstr, ";")) == NULL) {
break; break;
} }
} else { if ((strlen(color) == 2) || (!strcasecmp(color, "down"))) {
which = image_bg; /* They specified an image index */
} if (!strcasecmp(color, "bg")) {
if ((mod = (char *) strsep(&tnstr, ";")) == NULL) { which = image_bg;
break; } else if (!strcasecmp(color, "sb")) {
} which = image_sb;
if ((valptr = (char *) strsep(&tnstr, ";")) == NULL) { } else if (!strcasecmp(color, "sa")) {
break; which = image_sa;
} } else if (!strcasecmp(color, "up")) {
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)); which = image_up;
if (image_mode_is(which, MODE_TRANS) && (desktop_pixmap != None)) { } else if (!strcasecmp(color, "down")) {
free_desktop_pixmap(); which = image_down;
} } else {
if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) { break;
XFreePixmap(Xdisplay, viewport_pixmap); }
viewport_pixmap = None; /* Force the re-read */ if ((color = (char *) strsep(&tnstr, ";")) == NULL) {
} break;
if (!strcasecmp(color, "image")) { }
imlib_t *iml = images[which].current->iml; } else {
which = image_bg;
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)) { if ((mod = (char *) strsep(&tnstr, ";")) == NULL) {
iml->mod->brightness = (int) strtol(valptr, (char **) NULL, 0); break;
} 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 (!strcasecmp(mod, "clear")) {
imlib_t *iml = images[which].current->iml;
} else if (!strcasecmp(color, "red")) { if (!strcasecmp(color, "image")) {
imlib_t *iml = images[which].current->iml; FREE(iml->mod);
} else if (!strcasecmp(color, "red")) {
if (iml->rmod == NULL) { FREE(iml->rmod);
iml->rmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier)); } else if (!strcasecmp(color, "green")) {
iml->rmod->brightness = iml->rmod->contrast = iml->rmod->gamma = 0xff; FREE(iml->gmod);
} else if (!strcasecmp(color, "blue")) {
FREE(iml->bmod);
}
changed = 1;
continue;
} }
if (!BEG_STRCASECMP("brightness", mod)) { if ((valptr = (char *) strsep(&tnstr, ";")) == NULL) {
iml->rmod->brightness = (int) strtol(valptr, (char **) NULL, 0); break;
} 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);
} }
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));
} else if (!strcasecmp(color, "green")) { changed = 1;
imlib_t *iml = images[which].current->iml; if (image_mode_is(which, MODE_TRANS) && (desktop_pixmap != None)) {
free_desktop_pixmap();
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)) { if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) {
iml->gmod->brightness = (int) strtol(valptr, (char **) NULL, 0); XFreePixmap(Xdisplay, viewport_pixmap);
} else if (!BEG_STRCASECMP("contrast", mod)) { viewport_pixmap = None; /* Force the re-read */
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 (!strcasecmp(color, "image")) {
imlib_t *iml = images[which].current->iml;
} else if (!strcasecmp(color, "blue")) { if (iml->mod == NULL) {
imlib_t *iml = images[which].current->iml; 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) { } else if (!strcasecmp(color, "red")) {
iml->bmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier)); imlib_t *iml = images[which].current->iml;
iml->bmod->brightness = iml->bmod->contrast = iml->bmod->gamma = 0xff;
} if (iml->rmod == NULL) {
if (!BEG_STRCASECMP("brightness", mod)) { iml->rmod = (ImlibColorModifier *) MALLOC(sizeof(ImlibColorModifier));
iml->bmod->brightness = (int) strtol(valptr, (char **) NULL, 0); iml->rmod->brightness = iml->rmod->contrast = iml->rmod->gamma = 0xff;
} else if (!BEG_STRCASECMP("contrast", mod)) { }
iml->bmod->contrast = (int) strtol(valptr, (char **) NULL, 0); if (!BEG_STRCASECMP("brightness", mod)) {
} else if (!BEG_STRCASECMP("gamma", mod)) { iml->rmod->brightness = (int) strtol(valptr, (char **) NULL, 0);
iml->bmod->gamma = (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; break;
case 3: case 3:
get_desktop_window(); get_desktop_window();