-\f
-#if 0 /* These no longer seem like the right way to do things. */
-
-/* Draw a rectangle on the frame with left top corner including
- the character specified by LEFT_CHAR and TOP_CHAR. The rectangle is
- CHARS by LINES wide and long and is the color of the cursor. */
-
-void
-x_rectangle (f, gc, left_char, top_char, chars, lines)
- register struct frame *f;
- GC gc;
- register int top_char, left_char, chars, lines;
-{
- int width;
- int height;
- int left = (left_char * FONT_WIDTH (f->output_data.x->font)
- + f->output_data.x->internal_border_width);
- int top = (top_char * f->output_data.x->line_height
- + f->output_data.x->internal_border_width);
-
- if (chars < 0)
- width = FONT_WIDTH (f->output_data.x->font) / 2;
- else
- width = FONT_WIDTH (f->output_data.x->font) * chars;
- if (lines < 0)
- height = f->output_data.x->line_height / 2;
- else
- height = f->output_data.x->line_height * lines;
-
- XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- gc, left, top, width, height);
-}
-
-DEFUN ("x-draw-rectangle", Fx_draw_rectangle, Sx_draw_rectangle, 5, 5, 0,
- "Draw a rectangle on FRAME between coordinates specified by\n\
-numbers X0, Y0, X1, Y1 in the cursor pixel.")
- (frame, X0, Y0, X1, Y1)
- register Lisp_Object frame, X0, X1, Y0, Y1;
-{
- register int x0, y0, x1, y1, top, left, n_chars, n_lines;
-
- CHECK_LIVE_FRAME (frame, 0);
- CHECK_NUMBER (X0, 0);
- CHECK_NUMBER (Y0, 1);
- CHECK_NUMBER (X1, 2);
- CHECK_NUMBER (Y1, 3);
-
- x0 = XINT (X0);
- x1 = XINT (X1);
- y0 = XINT (Y0);
- y1 = XINT (Y1);
-
- if (y1 > y0)
- {
- top = y0;
- n_lines = y1 - y0 + 1;
- }
- else
- {
- top = y1;
- n_lines = y0 - y1 + 1;
- }
-
- if (x1 > x0)
- {
- left = x0;
- n_chars = x1 - x0 + 1;
- }
- else
- {
- left = x1;
- n_chars = x0 - x1 + 1;
- }
-
- BLOCK_INPUT;
- x_rectangle (XFRAME (frame), XFRAME (frame)->output_data.x->cursor_gc,
- left, top, n_chars, n_lines);
- UNBLOCK_INPUT;
-
- return Qt;
-}
-
-DEFUN ("x-erase-rectangle", Fx_erase_rectangle, Sx_erase_rectangle, 5, 5, 0,
- "Draw a rectangle drawn on FRAME between coordinates\n\
-X0, Y0, X1, Y1 in the regular background-pixel.")
- (frame, X0, Y0, X1, Y1)
- register Lisp_Object frame, X0, Y0, X1, Y1;
-{
- register int x0, y0, x1, y1, top, left, n_chars, n_lines;
-
- CHECK_LIVE_FRAME (frame, 0);
- CHECK_NUMBER (X0, 0);
- CHECK_NUMBER (Y0, 1);
- CHECK_NUMBER (X1, 2);
- CHECK_NUMBER (Y1, 3);
-
- x0 = XINT (X0);
- x1 = XINT (X1);
- y0 = XINT (Y0);
- y1 = XINT (Y1);
-
- if (y1 > y0)
- {
- top = y0;
- n_lines = y1 - y0 + 1;
- }
- else
- {
- top = y1;
- n_lines = y0 - y1 + 1;
- }
-
- if (x1 > x0)
- {
- left = x0;
- n_chars = x1 - x0 + 1;
- }
- else
- {
- left = x1;
- n_chars = x0 - x1 + 1;
- }
-
- BLOCK_INPUT;
- x_rectangle (XFRAME (frame), XFRAME (frame)->output_data.x->reverse_gc,
- left, top, n_chars, n_lines);
- UNBLOCK_INPUT;
-
- return Qt;
-}
-
-/* Draw lines around the text region beginning at the character position
- TOP_X, TOP_Y and ending at BOTTOM_X and BOTTOM_Y. GC specifies the
- pixel and line characteristics. */
-
-#define line_len(line) (FRAME_CURRENT_GLYPHS (f)->used[(line)])
-
-static void
-outline_region (f, gc, top_x, top_y, bottom_x, bottom_y)
- register struct frame *f;
- GC gc;
- int top_x, top_y, bottom_x, bottom_y;
-{
- register int ibw = f->output_data.x->internal_border_width;
- register int font_w = FONT_WIDTH (f->output_data.x->font);
- register int font_h = f->output_data.x->line_height;
- int y = top_y;
- int x = line_len (y);
- XPoint *pixel_points
- = (XPoint *) alloca (((bottom_y - top_y + 2) * 4) * sizeof (XPoint));
- register XPoint *this_point = pixel_points;
-
- /* Do the horizontal top line/lines */
- if (top_x == 0)
- {
- this_point->x = ibw;
- this_point->y = ibw + (font_h * top_y);
- this_point++;
- if (x == 0)
- this_point->x = ibw + (font_w / 2); /* Half-size for newline chars. */
- else
- this_point->x = ibw + (font_w * x);
- this_point->y = (this_point - 1)->y;
- }
- else
- {
- this_point->x = ibw;
- this_point->y = ibw + (font_h * (top_y + 1));
- this_point++;
- this_point->x = ibw + (font_w * top_x);
- this_point->y = (this_point - 1)->y;
- this_point++;
- this_point->x = (this_point - 1)->x;
- this_point->y = ibw + (font_h * top_y);
- this_point++;
- this_point->x = ibw + (font_w * x);
- this_point->y = (this_point - 1)->y;
- }
-
- /* Now do the right side. */
- while (y < bottom_y)
- { /* Right vertical edge */
- this_point++;
- this_point->x = (this_point - 1)->x;
- this_point->y = ibw + (font_h * (y + 1));
- this_point++;
-
- y++; /* Horizontal connection to next line */
- x = line_len (y);
- if (x == 0)
- this_point->x = ibw + (font_w / 2);
- else
- this_point->x = ibw + (font_w * x);
-
- this_point->y = (this_point - 1)->y;
- }
-
- /* Now do the bottom and connect to the top left point. */
- this_point->x = ibw + (font_w * (bottom_x + 1));
-
- this_point++;
- this_point->x = (this_point - 1)->x;
- this_point->y = ibw + (font_h * (bottom_y + 1));
- this_point++;
- this_point->x = ibw;
- this_point->y = (this_point - 1)->y;
- this_point++;
- this_point->x = pixel_points->x;
- this_point->y = pixel_points->y;
-
- XDrawLines (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- gc, pixel_points,
- (this_point - pixel_points + 1), CoordModeOrigin);
-}
-
-DEFUN ("x-contour-region", Fx_contour_region, Sx_contour_region, 1, 1, 0,
- "Highlight the region between point and the character under the mouse\n\
-selected frame.")
- (event)
- register Lisp_Object event;
-{
- register int x0, y0, x1, y1;
- register struct frame *f = selected_frame;
- struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
- register int p1, p2;
-
- CHECK_CONS (event, 0);
-
- BLOCK_INPUT;
- x0 = XINT (Fcar (Fcar (event)));
- y0 = XINT (Fcar (Fcdr (Fcar (event))));
-
- /* If the mouse is past the end of the line, don't that area. */
- /* ReWrite this... */
-
- /* Where the cursor is. */
- x1 = WINDOW_TO_FRAME_PIXEL_X (w, w->cursor.x);
- y1 = WINDOW_TO_FRAME_PIXEL_Y (w, w->cursor.y);
-
- if (y1 > y0) /* point below mouse */
- outline_region (f, f->output_data.x->cursor_gc,
- x0, y0, x1, y1);
- else if (y1 < y0) /* point above mouse */
- outline_region (f, f->output_data.x->cursor_gc,
- x1, y1, x0, y0);
- else /* same line: draw horizontal rectangle */
- {
- if (x1 > x0)
- x_rectangle (f, f->output_data.x->cursor_gc,
- x0, y0, (x1 - x0 + 1), 1);
- else if (x1 < x0)
- x_rectangle (f, f->output_data.x->cursor_gc,
- x1, y1, (x0 - x1 + 1), 1);
- }
-
- XFlush (FRAME_X_DISPLAY (f));
- UNBLOCK_INPUT;
-
- return Qnil;
-}
-
-DEFUN ("x-uncontour-region", Fx_uncontour_region, Sx_uncontour_region, 1, 1, 0,
- "Erase any highlighting of the region between point and the character\n\
-at X, Y on the selected frame.")
- (event)
- register Lisp_Object event;
-{
- register int x0, y0, x1, y1;
- register struct frame *f = selected_frame;
- struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
-
- BLOCK_INPUT;
- x0 = XINT (Fcar (Fcar (event)));
- y0 = XINT (Fcar (Fcdr (Fcar (event))));
- x1 = WINDOW_TO_FRAME_PIXEL_X (w, w->cursor.x);
- y1 = WINDOW_TO_FRAME_PIXEL_Y (w, w->cursor.y);
-
- if (y1 > y0) /* point below mouse */
- outline_region (f, f->output_data.x->reverse_gc,
- x0, y0, x1, y1);
- else if (y1 < y0) /* point above mouse */
- outline_region (f, f->output_data.x->reverse_gc,
- x1, y1, x0, y0);
- else /* same line: draw horizontal rectangle */
- {
- if (x1 > x0)
- x_rectangle (f, f->output_data.x->reverse_gc,
- x0, y0, (x1 - x0 + 1), 1);
- else if (x1 < x0)
- x_rectangle (f, f->output_data.x->reverse_gc,
- x1, y1, (x0 - x1 + 1), 1);
- }
- UNBLOCK_INPUT;
-
- return Qnil;
-}