mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-22 03:02:06 +03:00
* bookmark.c: Eliminate all code disabled for the text edition.
* edit-widget.h: Likewise. * editcmd.c: Likewise. * editdraw.c: Likewise. * editoptions.c: Likewise.
This commit is contained in:
parent
c11389facb
commit
d1caf46603
@ -1,5 +1,11 @@
|
||||
2001-09-07 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* bookmark.c: Eliminate all code disabled for the text edition.
|
||||
* edit-widget.h: Likewise.
|
||||
* editcmd.c: Likewise.
|
||||
* editdraw.c: Likewise.
|
||||
* editoptions.c: Likewise.
|
||||
|
||||
* edit.h: Eliminate all code disabled for the text edition.
|
||||
Reorder and simplify includes.
|
||||
* edit.c: Likewise.
|
||||
|
@ -23,9 +23,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "edit.h"
|
||||
#if defined (HAVE_MAD) && ! defined (MIDNIGHT) && ! defined (GTK)
|
||||
#include "mad.h"
|
||||
#endif
|
||||
|
||||
/* note, if there is more than one bookmark on a line, then they are
|
||||
appended after each other and the last one is always the one found
|
||||
@ -141,9 +138,6 @@ void book_mark_insert (WEdit * edit, int line, int c)
|
||||
if (p->next)
|
||||
p->next->prev = q;
|
||||
p->next = q;
|
||||
#if !defined (GTK) && !defined (MIDNIGHT)
|
||||
render_scrollbar (edit->widget->vert_scrollbar);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* remove a bookmark if there is one at this line matching this colour - c of -1 clear all */
|
||||
@ -174,10 +168,6 @@ int book_mark_clear (WEdit * edit, int line, int c)
|
||||
free (edit->book_mark);
|
||||
edit->book_mark = 0;
|
||||
}
|
||||
#if !defined (GTK) && !defined (MIDNIGHT)
|
||||
if (rend)
|
||||
render_scrollbar (edit->widget->vert_scrollbar);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -205,10 +195,6 @@ void book_mark_flush (WEdit * edit, int c)
|
||||
free (edit->book_mark);
|
||||
edit->book_mark = 0;
|
||||
}
|
||||
#if !defined (GTK) && !defined (MIDNIGHT)
|
||||
if (rend)
|
||||
render_scrollbar (edit->widget->vert_scrollbar);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* shift down bookmarks after this line */
|
||||
@ -223,10 +209,6 @@ void book_mark_inc (WEdit * edit, int line)
|
||||
rend = 1;
|
||||
}
|
||||
}
|
||||
#if !defined (GTK) && !defined (MIDNIGHT)
|
||||
if (rend)
|
||||
render_scrollbar (edit->widget->vert_scrollbar);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* shift up bookmarks after this line */
|
||||
@ -241,11 +223,4 @@ void book_mark_dec (WEdit * edit, int line)
|
||||
rend = 1;
|
||||
}
|
||||
}
|
||||
#if !defined (GTK) && !defined (MIDNIGHT)
|
||||
if (rend)
|
||||
render_scrollbar (edit->widget->vert_scrollbar);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -37,22 +37,12 @@ struct _book_mark {
|
||||
};
|
||||
|
||||
struct editor_widget {
|
||||
#ifdef MIDNIGHT
|
||||
Widget widget;
|
||||
#elif defined(GTK)
|
||||
GtkEdit *widget;
|
||||
#else
|
||||
struct cool_widget *widget;
|
||||
#endif
|
||||
#define from_here num_widget_lines
|
||||
int num_widget_lines;
|
||||
int num_widget_columns;
|
||||
|
||||
#ifdef MIDNIGHT
|
||||
int have_frame;
|
||||
#else
|
||||
int stopped;
|
||||
#endif
|
||||
|
||||
char *filename; /* Name of the file */
|
||||
char *dir; /* current directory */
|
||||
@ -80,11 +70,9 @@ struct editor_widget {
|
||||
unsigned char modified; /*has the file been changed?: 1 if char inserted or
|
||||
deleted at all since last load or save */
|
||||
unsigned char screen_modified; /* has the file been changed since the last screen draw? */
|
||||
#if defined(MIDNIGHT) || defined(GTK)
|
||||
int delete_file; /* has the file been created in edit_load_file? Delete
|
||||
it at end of editing when it hasn't been modified
|
||||
or saved */
|
||||
#endif
|
||||
unsigned char highlight;
|
||||
long prev_col; /*recent column position of the cursor - used when moving
|
||||
up or down past lines that are shorter than the current line */
|
||||
@ -141,4 +129,4 @@ typedef struct editor_widget WEdit;
|
||||
#define ERROR_FILE "/.cedit/cooledit.error"
|
||||
#define TEMP_FILE "/.cedit/cooledit.temp"
|
||||
|
||||
#endif
|
||||
#endif /* !__EDIT_WIDGET_H */
|
||||
|
796
edit/editcmd.c
796
edit/editcmd.c
File diff suppressed because it is too large
Load Diff
405
edit/editdraw.c
405
edit/editdraw.c
@ -27,20 +27,12 @@
|
||||
|
||||
#define MAX_LINE_LEN 1024
|
||||
|
||||
#if ! defined (MIDNIGHT) && ! defined (GTK)
|
||||
#include "app_glob.c"
|
||||
#include "coollocal.h"
|
||||
#include "mad.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
#include "../src/charsets.h"
|
||||
#include "src/charsets.h"
|
||||
#endif
|
||||
|
||||
extern int column_highlighting;
|
||||
|
||||
#if defined (MIDNIGHT) || defined (GTK)
|
||||
|
||||
static void status_string (WEdit * edit, char *s, int w, int fill, int font_width)
|
||||
{
|
||||
char byte_str[16];
|
||||
@ -79,10 +71,6 @@ static void status_string (WEdit * edit, char *s, int w, int fill, int font_widt
|
||||
byte_str);
|
||||
}
|
||||
|
||||
#endif /* MIDNIGHT || GTK */
|
||||
|
||||
#ifdef MIDNIGHT
|
||||
|
||||
/* how to get as much onto the status line as is numerically possible :) */
|
||||
void edit_status (WEdit * edit)
|
||||
{
|
||||
@ -113,94 +101,6 @@ void edit_status (WEdit * edit)
|
||||
free (s);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
void render_status (CWidget * wdt, int expose);
|
||||
|
||||
#ifdef GTK
|
||||
|
||||
void edit_status (WEdit *edit)
|
||||
{
|
||||
GtkEntry *entry;
|
||||
int w, i, t;
|
||||
char s[160];
|
||||
w = edit->num_widget_columns - 1;
|
||||
if (w > 150)
|
||||
w = 150;
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
memset (s, 0, w);
|
||||
if (w > 1) {
|
||||
i = w > 24 ? 18 : w - 6;
|
||||
i = i < 13 ? 13 : i;
|
||||
strcpy (s, (char *) name_trunc (edit->filename ? edit->filename : "", i));
|
||||
i = strlen (s);
|
||||
s[i] = ' ';
|
||||
s[i + 1] = ' ';
|
||||
t = w - i - 2;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
status_string (edit, s + i + 2, t, 0, FONT_MEAN_WIDTH);
|
||||
}
|
||||
s[w] = 0;
|
||||
entry = GTK_ENTRY (edit->widget->status);
|
||||
if (strcmp (s, gtk_entry_get_text (entry)))
|
||||
gtk_entry_set_text (entry, s);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void edit_status (WEdit * edit)
|
||||
{
|
||||
long start_mark, end_mark;
|
||||
CWidget *wdt;
|
||||
mode_t m;
|
||||
char *p;
|
||||
char id[33];
|
||||
char s[256];
|
||||
if (eval_marks (edit, &start_mark, &end_mark))
|
||||
end_mark = start_mark = 0;
|
||||
if ((COptionsOf (edit->widget) & EDITOR_NO_TEXT))
|
||||
return;
|
||||
CPushFont ("editor", 0);
|
||||
m = edit->stat.st_mode;
|
||||
p = edit->filename ? edit->filename : "";
|
||||
sprintf (s, "\034%c%s\033\035 \034-%c%c%c%c%c%c%c%c%c\035 \034%s%s%s%c\035 \034\030%02ld\033\035 \034%-4ld+%2ld=\030%4ld\033/%3ld\035 \034*%-5ld/%5ldb=%c%3d\035%c \034\001%ld\033\035",
|
||||
*p ? '\033' : '\003', *p ? (char *) name_trunc (p, max (edit->num_widget_lines / 3, 16)) : _ ("<unnamed>"),
|
||||
m & S_IRUSR ? 'r' : '-',
|
||||
m & S_IWUSR ? 'w' : '-',
|
||||
m & S_IXUSR ? 'x' : '-',
|
||||
m & S_IRGRP ? 'r' : '-',
|
||||
m & S_IWGRP ? 'w' : '-',
|
||||
m & S_IXGRP ? 'x' : '-',
|
||||
m & S_IROTH ? 'r' : '-',
|
||||
m & S_IWOTH ? 'w' : '-',
|
||||
m & S_IXOTH ? 'x' : '-',
|
||||
end_mark - start_mark || (edit->mark2 == -1 && !edit->highlight) ? (column_highlighting ? "\032C\033" : "\001B\033") : "-",
|
||||
edit->modified ? "\012M\033" : "-", edit->macro_i < 0 ? "-" : "\023R\033",
|
||||
edit->overwrite == 0 ? '-' : 'O',
|
||||
edit->curs_col / FONT_MEAN_WIDTH, edit->start_line + 1, edit->curs_row,
|
||||
edit->curs_line + 1, edit->total_lines + 1, edit->curs1,
|
||||
edit->last_byte, edit->curs1 == edit->last_byte ? '\014' : '\033', edit->curs1 < edit->last_byte
|
||||
? edit_get_byte (edit, edit->curs1) : -1,
|
||||
end_mark - start_mark && !column_highlighting ? ' ' : '\0',
|
||||
end_mark - start_mark);
|
||||
strcpy (id, CIdentOf (edit->widget));
|
||||
strcat (id, ".text");
|
||||
wdt = CIdent (id);
|
||||
free (wdt->text);
|
||||
wdt->text = (char *) strdup (s);
|
||||
CSetWidgetSize (id, CWidthOf (edit->widget), CHeightOf (wdt));
|
||||
render_status (wdt, 0);
|
||||
CPopFont ();
|
||||
}
|
||||
|
||||
#endif /* GTK */
|
||||
|
||||
#endif /* !MIDNIGHT */
|
||||
|
||||
|
||||
/* result is boolean */
|
||||
int cursor_in_screen (WEdit * edit, long row)
|
||||
{
|
||||
@ -230,10 +130,6 @@ int cursor_out_of_screen (WEdit * edit)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef MIDNIGHT
|
||||
int edit_width_of_long_printable (int c);
|
||||
#endif
|
||||
|
||||
/* this scrolls the text so that cursor is on the screen */
|
||||
void edit_scroll_screen_over_cursor (WEdit * edit)
|
||||
{
|
||||
@ -262,18 +158,10 @@ void edit_scroll_screen_over_cursor (WEdit * edit)
|
||||
}
|
||||
p = edit_get_col (edit);
|
||||
edit_update_curs_row (edit);
|
||||
#ifdef MIDNIGHT
|
||||
outby = p + edit->start_col - edit->num_widget_columns + 1 + (r_extreme + edit->found_len);
|
||||
#else
|
||||
outby = p + edit->start_col - CWidthOf (edit->widget) + 7 + (r_extreme + edit->found_len) * FONT_MEAN_WIDTH + edit_width_of_long_printable (edit_get_byte (edit, edit->curs1));
|
||||
#endif
|
||||
if (outby > 0)
|
||||
edit_scroll_right (edit, outby);
|
||||
#ifdef MIDNIGHT
|
||||
outby = l_extreme - p - edit->start_col;
|
||||
#else
|
||||
outby = l_extreme * FONT_MEAN_WIDTH - p - edit->start_col;
|
||||
#endif
|
||||
if (outby > 0)
|
||||
edit_scroll_left (edit, outby);
|
||||
p = edit->curs_row;
|
||||
@ -286,53 +174,6 @@ void edit_scroll_screen_over_cursor (WEdit * edit)
|
||||
edit_update_curs_row (edit);
|
||||
}
|
||||
|
||||
|
||||
#ifndef MIDNIGHT
|
||||
|
||||
#define CACHE_WIDTH 256
|
||||
#define CACHE_HEIGHT 128
|
||||
|
||||
int EditExposeRedraw = 0;
|
||||
int EditClear = 0;
|
||||
|
||||
/*
|
||||
* background colors: marked is refers to mouse highlighting,
|
||||
* highlighted refers to a found string.
|
||||
*/
|
||||
unsigned long edit_abnormal_color, edit_marked_abnormal_color;
|
||||
unsigned long edit_highlighted_color, edit_marked_color;
|
||||
unsigned long edit_normal_background_color;
|
||||
|
||||
/* foreground colors */
|
||||
unsigned long edit_normal_foreground_color, edit_bold_color;
|
||||
unsigned long edit_italic_color;
|
||||
|
||||
/* cursor color */
|
||||
unsigned long edit_cursor_color;
|
||||
|
||||
void edit_set_foreground_colors (unsigned long normal, unsigned long bold, unsigned long italic)
|
||||
{
|
||||
edit_normal_foreground_color = normal;
|
||||
edit_bold_color = bold;
|
||||
edit_italic_color = italic;
|
||||
}
|
||||
|
||||
void edit_set_background_colors (unsigned long normal, unsigned long abnormal, unsigned long marked, unsigned long marked_abnormal, unsigned long highlighted)
|
||||
{
|
||||
edit_abnormal_color = abnormal;
|
||||
edit_marked_abnormal_color = marked_abnormal;
|
||||
edit_marked_color = marked;
|
||||
edit_highlighted_color = highlighted;
|
||||
edit_normal_background_color = normal;
|
||||
}
|
||||
|
||||
void edit_set_cursor_color (unsigned long c)
|
||||
{
|
||||
edit_cursor_color = c;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define set_color(font) attrset (font)
|
||||
|
||||
#define edit_move(x,y) widget_move(edit, y, x);
|
||||
@ -470,49 +311,12 @@ static void edit_draw_this_line (WEdit * edit, long b, long row, long start_col,
|
||||
print_to_widget (edit, row, start_col, start_col_real, end_col, line);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MIDNIGHT
|
||||
|
||||
#define key_pending(x) (!is_idle())
|
||||
|
||||
#else
|
||||
|
||||
#define edit_draw_this_line edit_draw_this_line_proportional
|
||||
|
||||
int option_smooth_scrolling = 0;
|
||||
|
||||
static int key_pending (WEdit * edit)
|
||||
{
|
||||
#ifdef GTK
|
||||
/* ******* */
|
||||
#else
|
||||
static int flush = 0, line = 0;
|
||||
if (!edit) {
|
||||
flush = line = 0;
|
||||
} else if (!(edit->force & REDRAW_COMPLETELY) && !EditExposeRedraw && !option_smooth_scrolling) {
|
||||
/* this flushes the display in logarithmic intervals - so both fast and
|
||||
slow machines will get good performance vs nice-refreshing */
|
||||
if ((1 << flush) == ++line) {
|
||||
flush++;
|
||||
return CKeyPending ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static void edit_draw_this_char (WEdit * edit, long curs, long row)
|
||||
{
|
||||
int b = edit_bol (edit, curs);
|
||||
#ifdef MIDNIGHT
|
||||
edit_draw_this_line (edit, b, row, 0, edit->num_widget_columns - 1);
|
||||
#else
|
||||
edit_draw_this_line (edit, b, row, 0, CWidthOf (edit->widget));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* cursor must be in screen for other than REDRAW_PAGE passed in force */
|
||||
@ -525,95 +329,21 @@ void render_edit_text (WEdit * edit, long start_row, long start_column, long end
|
||||
static long prev_curs = 0;
|
||||
static long prev_start = -1;
|
||||
|
||||
#ifndef MIDNIGHT
|
||||
static unsigned long prev_win = 0;
|
||||
#endif
|
||||
|
||||
int force = edit->force;
|
||||
long b;
|
||||
|
||||
CPushFont ("editor", 0);
|
||||
|
||||
#ifndef MIDNIGHT
|
||||
key_pending (0);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the position of the page has not moved then we can draw the cursor
|
||||
* character only. This will prevent line flicker when using arrow keys.
|
||||
*/
|
||||
if ((!(force & REDRAW_CHAR_ONLY)) || (force & REDRAW_PAGE)
|
||||
#ifndef MIDNIGHT
|
||||
#ifdef GTK
|
||||
|| prev_win != ((GdkWindowPrivate *) CWindowOf (edit->widget)->text_area)->xwindow
|
||||
#else
|
||||
|| prev_win != CWindowOf (edit->widget)
|
||||
#endif
|
||||
#endif
|
||||
) {
|
||||
#if !defined(MIDNIGHT) && !defined(GTK)
|
||||
int time_division = 5;
|
||||
#if 0
|
||||
if (CPending ())
|
||||
time_division--;
|
||||
#endif
|
||||
if (prev_start < 0)
|
||||
prev_start = edit->start_line;
|
||||
if (option_smooth_scrolling && prev_win == CWindowOf (edit->widget) && !edit->screen_modified) {
|
||||
int i, t;
|
||||
int pos1, pos2;
|
||||
i = edit->start_line - prev_start;
|
||||
if (i <= time_division && i > 0) {
|
||||
edit_draw_proportional (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
for (pos2 = 0, t = 0; t < time_division; t++) {
|
||||
int move;
|
||||
pos1 = FONT_PIX_PER_LINE * i * (t + 1) / time_division;
|
||||
move = pos1 - pos2;
|
||||
pos2 += move;
|
||||
XCopyArea (CDisplay, edit->widget->winid, edit->widget->winid, CGC,
|
||||
EDIT_TEXT_HORIZONTAL_OFFSET,
|
||||
EDIT_TEXT_VERTICAL_OFFSET + move,
|
||||
edit->widget->width - EDIT_FRAME_W,
|
||||
edit->widget->height - EDIT_FRAME_H - move,
|
||||
EDIT_TEXT_HORIZONTAL_OFFSET, EDIT_TEXT_VERTICAL_OFFSET);
|
||||
XClearArea (CDisplay, edit->widget->winid, EDIT_TEXT_HORIZONTAL_OFFSET,
|
||||
edit->widget->height - EDIT_FRAME_H +
|
||||
EDIT_TEXT_VERTICAL_OFFSET - move,
|
||||
edit->widget->width - EDIT_FRAME_W, move, 0);
|
||||
XFlush (CDisplay);
|
||||
pause ();
|
||||
}
|
||||
} else if (i >= -time_division && i < 0) {
|
||||
edit_draw_proportional (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
i = -i;
|
||||
for (pos2 = 0, t = 0; t < time_division; t++) {
|
||||
int move;
|
||||
pos1 = FONT_PIX_PER_LINE * i * (t + 1) / time_division;
|
||||
move = pos1 - pos2;
|
||||
pos2 += move;
|
||||
XCopyArea (CDisplay, edit->widget->winid, edit->widget->winid, CGC,
|
||||
EDIT_TEXT_HORIZONTAL_OFFSET, EDIT_TEXT_VERTICAL_OFFSET,
|
||||
edit->widget->width - EDIT_FRAME_W,
|
||||
edit->widget->height - EDIT_FRAME_H -
|
||||
move, EDIT_TEXT_HORIZONTAL_OFFSET, EDIT_TEXT_VERTICAL_OFFSET + move);
|
||||
XClearArea (CDisplay, edit->widget->winid, EDIT_TEXT_HORIZONTAL_OFFSET,
|
||||
EDIT_TEXT_VERTICAL_OFFSET,
|
||||
edit->widget->width - EDIT_FRAME_W, move, 0);
|
||||
XFlush (CDisplay);
|
||||
pause ();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if ((!(force & REDRAW_CHAR_ONLY)) || (force & REDRAW_PAGE)) {
|
||||
if (!(force & REDRAW_IN_BOUNDS)) { /* !REDRAW_IN_BOUNDS means to ignore bounds and redraw whole rows */
|
||||
start_row = 0;
|
||||
end_row = edit->num_widget_lines - 1;
|
||||
start_column = 0;
|
||||
#ifdef MIDNIGHT
|
||||
end_column = edit->num_widget_columns - 1;
|
||||
#else
|
||||
end_column = CWidthOf (edit->widget);
|
||||
#endif
|
||||
}
|
||||
if (force & REDRAW_PAGE) {
|
||||
row = start_row;
|
||||
@ -696,13 +426,6 @@ void render_edit_text (WEdit * edit, long start_row, long start_column, long end
|
||||
prev_curs_row = edit->curs_row;
|
||||
prev_curs = edit->curs1;
|
||||
prev_start_col = edit->start_col;
|
||||
#ifndef MIDNIGHT
|
||||
#ifdef GTK
|
||||
prev_win = ((GdkWindowPrivate *) CWindowOf (edit->widget)->text_area)->xwindow;
|
||||
#else
|
||||
prev_win = CWindowOf (edit->widget);
|
||||
#endif
|
||||
#endif
|
||||
exit_render:
|
||||
edit->screen_modified = 0;
|
||||
prev_start = edit->start_line;
|
||||
@ -710,99 +433,18 @@ void render_edit_text (WEdit * edit, long start_row, long start_column, long end
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef MIDNIGHT
|
||||
|
||||
void edit_convert_expose_to_area (XExposeEvent * xexpose, int *row1, int *col1, int *row2, int *col2)
|
||||
{
|
||||
*col1 = xexpose->x - EDIT_TEXT_HORIZONTAL_OFFSET;
|
||||
*row1 = (xexpose->y - EDIT_TEXT_VERTICAL_OFFSET) / FONT_PIX_PER_LINE;
|
||||
*col2 = xexpose->x + xexpose->width + EDIT_TEXT_HORIZONTAL_OFFSET + 3;
|
||||
*row2 = (xexpose->y + xexpose->height - EDIT_TEXT_VERTICAL_OFFSET) / FONT_PIX_PER_LINE;
|
||||
}
|
||||
|
||||
#ifdef GTK
|
||||
|
||||
void edit_render_tidbits (GtkEdit * edit)
|
||||
{
|
||||
gtk_widget_draw_focus (GTK_WIDGET (edit));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void edit_render_tidbits (CWidget * wdt)
|
||||
{
|
||||
int isfocussed;
|
||||
int w = wdt->width, h = wdt->height;
|
||||
Window win;
|
||||
|
||||
win = wdt->winid;
|
||||
isfocussed = (win == CGetFocus ());
|
||||
CSetColor (COLOR_FLAT);
|
||||
#ifdef NEXT_LOOK
|
||||
render_bevel (win, 0, 0, w - 1, h - 1, 1, 1); /*most outer border bevel */
|
||||
#else
|
||||
if (isfocussed) {
|
||||
render_bevel (win, 0, 0, w - 1, h - 1, 3, 1); /*most outer border bevel */
|
||||
} else {
|
||||
render_bevel (win, 2, 2, w - 3, h - 3, 1, 1); /*border bevel */
|
||||
render_bevel (win, 0, 0, w - 1, h - 1, 2, 0); /*most outer border bevel */
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void edit_set_space_width (int s);
|
||||
extern int option_long_whitespace;
|
||||
|
||||
#endif
|
||||
|
||||
void edit_render (WEdit * edit, int page, int row_start, int col_start, int row_end, int col_end)
|
||||
{
|
||||
int f = 0;
|
||||
#ifdef GTK
|
||||
GtkEdit *win;
|
||||
#endif
|
||||
if (page) /* if it was an expose event, 'page' would be set */
|
||||
edit->force |= REDRAW_PAGE | REDRAW_IN_BOUNDS;
|
||||
f = edit->force & (REDRAW_PAGE | REDRAW_COMPLETELY);
|
||||
|
||||
#ifdef MIDNIGHT
|
||||
if (edit->force & REDRAW_COMPLETELY)
|
||||
redraw_labels (edit->widget.parent, (Widget *) edit);
|
||||
#else
|
||||
if (option_long_whitespace)
|
||||
edit_set_space_width (FONT_PER_CHAR[' '] * 2);
|
||||
else
|
||||
edit_set_space_width (FONT_PER_CHAR[' ']);
|
||||
#ifdef GTK
|
||||
win = (GtkEdit *) edit->widget;
|
||||
#endif
|
||||
edit_set_foreground_colors (
|
||||
color_palette (option_editor_fg_normal),
|
||||
color_palette (option_editor_fg_bold),
|
||||
color_palette (option_editor_fg_italic)
|
||||
);
|
||||
edit_set_background_colors (
|
||||
color_palette (option_editor_bg_normal),
|
||||
color_palette (option_editor_bg_abnormal),
|
||||
color_palette (option_editor_bg_marked),
|
||||
color_palette (option_editor_bg_marked_abnormal),
|
||||
color_palette (option_editor_bg_highlighted)
|
||||
);
|
||||
edit_set_cursor_color (
|
||||
color_palette (option_editor_fg_cursor)
|
||||
);
|
||||
|
||||
#ifdef GTK
|
||||
/* *********** */
|
||||
#else
|
||||
if (!EditExposeRedraw)
|
||||
set_cursor_position (0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
render_edit_text (edit, row_start, col_start, row_end, col_end);
|
||||
/*
|
||||
* edit->force != 0 means a key was pending and the redraw
|
||||
@ -811,52 +453,9 @@ void edit_render (WEdit * edit, int page, int row_start, int col_start, int row_
|
||||
*/
|
||||
if (edit->force)
|
||||
edit->force |= REDRAW_PAGE;
|
||||
#ifndef MIDNIGHT
|
||||
if (f) {
|
||||
edit_render_tidbits (edit->widget);
|
||||
#ifdef GTK
|
||||
/* ***************** */
|
||||
#else
|
||||
#ifndef NEXT_LOOK
|
||||
CSetColor (edit_normal_background_color);
|
||||
CLine (CWindowOf (edit->widget), 3, 3, 3, CHeightOf (edit->widget) - 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef MIDNIGHT
|
||||
void edit_render_expose (WEdit * edit, XExposeEvent * xexpose)
|
||||
{
|
||||
int row_start, col_start, row_end, col_end;
|
||||
CPushFont ("editor", 0);
|
||||
EditExposeRedraw = 1;
|
||||
edit->num_widget_lines = (CHeightOf (edit->widget) - EDIT_FRAME_H) / FONT_PIX_PER_LINE;
|
||||
edit->num_widget_columns = (CWidthOf (edit->widget) - EDIT_FRAME_W) / FONT_MEAN_WIDTH;
|
||||
if (edit->force & (REDRAW_PAGE | REDRAW_COMPLETELY)) {
|
||||
edit->force |= REDRAW_PAGE | REDRAW_COMPLETELY;
|
||||
edit_render_keypress (edit);
|
||||
} else {
|
||||
edit_convert_expose_to_area (xexpose, &row_start, &col_start, &row_end, &col_end);
|
||||
edit_render (edit, 1, row_start, col_start, row_end, col_end);
|
||||
}
|
||||
CPopFont ();
|
||||
EditExposeRedraw = 0;
|
||||
}
|
||||
|
||||
void edit_render_keypress (WEdit * edit)
|
||||
{
|
||||
CPushFont ("editor", 0);
|
||||
edit_render (edit, 0, 0, 0, 0, 0);
|
||||
CPopFont ();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void edit_render_keypress (WEdit * edit)
|
||||
{
|
||||
edit_render (edit, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define USE_INTERNAL_EDIT 1
|
||||
#endif
|
||||
|
||||
#include "../src/main.h" /* extern int option_this_and_that ... */
|
||||
#include "src/main.h" /* extern int option_this_and_that ... */
|
||||
|
||||
char *key_emu_str[] =
|
||||
{N_("Intuitive"), N_("Emacs"), NULL};
|
||||
@ -81,13 +81,13 @@ void edit_options_dialog (void)
|
||||
{quick_input, OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 5, OPT_DLG_H, "", OPT_DLG_W / 2 - 4 - 24, 0,
|
||||
0, 0, "edit-tab-spacing"},
|
||||
/*6 */
|
||||
#if !defined(MIDNIGHT) || defined(HAVE_SYNTAXH)
|
||||
#ifdef HAVE_SYNTAXH
|
||||
#define OA 1
|
||||
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H, N_("synta&X highlighting"), 8, 0,
|
||||
0, 0, NULL},
|
||||
#else
|
||||
#define OA 0
|
||||
#endif
|
||||
#endif /* !HAVE_SYNTAXH */
|
||||
/*7 */
|
||||
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 8, OPT_DLG_H, N_("confir&M before saving"), 6, 0,
|
||||
0, 0, NULL},
|
||||
@ -170,10 +170,6 @@ void edit_options_dialog (void)
|
||||
option_tab_spacing = atoi (q);
|
||||
if (option_tab_spacing < 0)
|
||||
option_tab_spacing = 2;
|
||||
#if 0
|
||||
/* Only allow even numbers */
|
||||
option_tab_spacing += option_tab_spacing & 1;
|
||||
#endif
|
||||
free (q);
|
||||
}
|
||||
option_syntax_highlighting = *quick_widgets[5 + OA].result;
|
||||
|
Loading…
Reference in New Issue
Block a user