Back to index

plt-scheme  4.2.1
Defines | Functions | Variables
de_win.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define OTHER_FLAG   0x100
#define EDIT_CMD_FLAG   0x200
#define REPEAT_FLAG   0x400
#define CHAR_CMD(i)   ((i) & 0xff)
#define IDM_FILESAVE   (EDIT_CMD_FLAG + WRITE)
#define IDM_FILEEXIT   (OTHER_FLAG + 1)
#define IDM_HELPABOUT   (OTHER_FLAG + 2)
#define IDM_HELPCONTENTS   (OTHER_FLAG + 3)
#define IDM_EDITPDOWN   (REPEAT_FLAG + EDIT_CMD_FLAG + DOWN)
#define IDM_EDITPUP   (REPEAT_FLAG + EDIT_CMD_FLAG + UP)
#define IDM_EDITUNDO   (EDIT_CMD_FLAG + UNDO)
#define IDM_EDITLOCATE   (EDIT_CMD_FLAG + LOCATE)
#define IDM_EDITDOWN   (EDIT_CMD_FLAG + DOWN)
#define IDM_EDITUP   (EDIT_CMD_FLAG + UP)
#define IDM_EDITLEFT   (EDIT_CMD_FLAG + LEFT)
#define IDM_EDITRIGHT   (EDIT_CMD_FLAG + RIGHT)
#define IDM_EDITBS   (EDIT_CMD_FLAG + BS)
#define IDM_EDITDEL   (EDIT_CMD_FLAG + DEL)
#define IDM_EDITREPEAT   (EDIT_CMD_FLAG + REPEAT)
#define IDM_EDITTOP   (EDIT_CMD_FLAG + TOP)

Functions

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
LRESULT CALLBACK AboutBox (HWND hDlg, UINT message, UINT wParam, LONG lParam)
CORD retrieve_screen_line (int i)
void set_position (int x, int y)
void do_command (int)
void generic_init (void)
void move_cursor (int column, int line)
void invalidate_line (int line)
void de_error (char *s)

Variables

int LINES
int COLS
char * arg_file_name
int dis_line
int dis_col
int line
int col

Define Documentation

#define CHAR_CMD (   i)    ((i) & 0xff)

Definition at line 22 of file de_win.h.

#define EDIT_CMD_FLAG   0x200

Definition at line 19 of file de_win.h.

#define IDM_EDITBS   (EDIT_CMD_FLAG + BS)

Definition at line 38 of file de_win.h.

#define IDM_EDITDEL   (EDIT_CMD_FLAG + DEL)

Definition at line 39 of file de_win.h.

#define IDM_EDITDOWN   (EDIT_CMD_FLAG + DOWN)

Definition at line 34 of file de_win.h.

#define IDM_EDITLEFT   (EDIT_CMD_FLAG + LEFT)

Definition at line 36 of file de_win.h.

Definition at line 33 of file de_win.h.

Definition at line 30 of file de_win.h.

Definition at line 31 of file de_win.h.

Definition at line 40 of file de_win.h.

#define IDM_EDITRIGHT   (EDIT_CMD_FLAG + RIGHT)

Definition at line 37 of file de_win.h.

#define IDM_EDITTOP   (EDIT_CMD_FLAG + TOP)

Definition at line 41 of file de_win.h.

#define IDM_EDITUNDO   (EDIT_CMD_FLAG + UNDO)

Definition at line 32 of file de_win.h.

#define IDM_EDITUP   (EDIT_CMD_FLAG + UP)

Definition at line 35 of file de_win.h.

#define IDM_FILEEXIT   (OTHER_FLAG + 1)

Definition at line 26 of file de_win.h.

#define IDM_FILESAVE   (EDIT_CMD_FLAG + WRITE)

Definition at line 25 of file de_win.h.

#define IDM_HELPABOUT   (OTHER_FLAG + 2)

Definition at line 27 of file de_win.h.

#define IDM_HELPCONTENTS   (OTHER_FLAG + 3)

Definition at line 28 of file de_win.h.

#define OTHER_FLAG   0x100

Definition at line 18 of file de_win.h.

#define REPEAT_FLAG   0x400

Definition at line 20 of file de_win.h.


Function Documentation

LRESULT CALLBACK AboutBox ( HWND  hDlg,
UINT  message,
UINT  wParam,
LONG  lParam 
)
void de_error ( char *  s)

Definition at line 39 of file de_win.c.

{
    MessageBox( hwnd, (LPSTR) s,
                (LPSTR) FullAppName,
                MB_ICONINFORMATION | MB_OK );
    InvalidateRect(hwnd, NULL, TRUE);
}

Definition at line 397 of file de.c.

{
    int i;
    int need_fix_pos;
    FILE * out;
    
    if ( c == '\r') c = '\n';
    if (locate_mode) {
        size_t new_pos;
          
        if (c == LOCATE) {
              locate_mode = 0;
              locate_string = CORD_EMPTY;
              return;
        }
        locate_string = CORD_cat_char(locate_string, (char)c);
        new_pos = CORD_str(current, file_pos - CORD_len(locate_string) + 1,
                        locate_string);
        if (new_pos != CORD_NOT_FOUND) {
            need_redisplay = ALL;
            new_pos += CORD_len(locate_string);
            for (;;) {
                     file_pos = line_pos(line + 1, 0);
                     if (file_pos > new_pos) break;
                     line++;
            }
            col = new_pos - line_pos(line, 0);
            file_pos = new_pos;
            fix_cursor();
        } else {
            locate_string = CORD_substr(locate_string, 0,
                                          CORD_len(locate_string) - 1);
            beep();
        }
        return;
    }
    if (c == REPEAT) {
       repeat_count = BARE_PREFIX; return;
    } else if (c < 0x100 && isdigit(c)){
        if (repeat_count == BARE_PREFIX) {
          repeat_count = c - '0'; return;
        } else if (repeat_count != NO_PREFIX) {
          repeat_count = 10 * repeat_count + c - '0'; return;
        }
    }
    if (repeat_count == NO_PREFIX) repeat_count = 1;
    if (repeat_count == BARE_PREFIX && (c == UP || c == DOWN)) {
       repeat_count = LINES - dis_granularity;
    }
    if (repeat_count == BARE_PREFIX) repeat_count = 8;
    need_fix_pos = 0;
    for (i = 0; i < repeat_count; i++) {
        switch(c) {
          case LOCATE:
            locate_mode = 1;
            break;
          case TOP:
            line = col = file_pos = 0;
            break;
         case UP:
           if (line != 0) {
               line--;
               need_fix_pos = 1;
           }
           break;
         case DOWN:
           line++;
           need_fix_pos = 1;
           break;
         case LEFT:
           if (col != 0) {
               col--; file_pos--;
           }
           break;
         case RIGHT:
           if (CORD_fetch(current, file_pos) == '\n') break;
           col++; file_pos++;
           break;
         case UNDO:
           del_hist();
           need_redisplay = ALL; need_fix_pos = 1;
           break;
         case BS:
           if (col == 0) {
               beep();
               break;
           }
           col--; file_pos--;
           /* fall through: */
         case DEL:
           if (file_pos == current_len-1) break;
              /* Can't delete trailing newline */
           if (CORD_fetch(current, file_pos) == '\n') {
               need_redisplay = ALL; need_fix_pos = 1;
           } else {
               need_redisplay = line - dis_line;
           }
           add_hist(CORD_cat(
                     CORD_substr(current, 0, file_pos),
                     CORD_substr(current, file_pos+1, current_len)));
           invalidate_map(line);
           break;
         case WRITE:
           {
              CORD name = CORD_cat(CORD_from_char_star(arg_file_name),
                                 ".new");

               if ((out = fopen(CORD_to_const_char_star(name), "wb")) == NULL
                   || CORD_put(current, out) == EOF) {
                  de_error("Write failed\n");
                  need_redisplay = ALL;
                } else {
                    fclose(out);
                }
           }
            break;
         default:
           {
               CORD left_part = CORD_substr(current, 0, file_pos);
               CORD right_part = CORD_substr(current, file_pos, current_len);
               
               add_hist(CORD_cat(CORD_cat_char(left_part, (char)c),
                              right_part));
               invalidate_map(line);
               if (c == '\n') {
                   col = 0; line++; file_pos++;
                   need_redisplay = ALL;
               } else {
                   col++; file_pos++;
                   need_redisplay = line - dis_line;
              }
               break;
           }
        }
    }
    if (need_fix_pos) fix_pos();
    fix_cursor();
    repeat_count = NO_PREFIX;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 539 of file de.c.

{
    FILE * f;
    CORD initial;
    
    if ((f = fopen(arg_file_name, "rb")) == NULL) {
       initial = "\n";
    } else {
        initial = CORD_from_file(f);
        if (initial == CORD_EMPTY
            || CORD_fetch(initial, CORD_len(initial)-1) != '\n') {
            initial = CORD_cat(initial, "\n");
        }
    }
    add_map(0,0);
    add_hist(initial);
    now -> map = current_map;
    now -> previous = now;  /* Can't back up further: beginning of the world */
    need_redisplay = ALL;
    fix_cursor();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 330 of file de_win.c.

{
    RECT line;
    
    if (!screen_was_painted) return;
       /* Invalidating a rectangle before painting seems result in a  */
       /* major performance problem.                                  */
    get_line_rect(i, COLS*char_width, &line);
    InvalidateRect(hwnd, &line, FALSE);
}

Here is the call graph for this function:

void move_cursor ( int  column,
int  line 
)

Definition at line 316 of file de_win.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void set_position ( int  x,
int  y 
)

Here is the caller graph for this function:

LRESULT CALLBACK WndProc ( HWND  hwnd,
UINT  message,
UINT  wParam,
LONG  lParam 
)

Variable Documentation

Definition at line 378 of file de.c.

Definition at line 108 of file de.c.

Definition at line 32 of file de_win.c.

Definition at line 99 of file de.c.

Definition at line 98 of file de.c.

Definition at line 107 of file de.c.

Definition at line 31 of file de_win.c.