📄 fted_draw.c
字号:
fted_cut_copy2(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ if (previous_shift != shifted) { fted_message_user("Sorry, can't change the shift key in the middle of an operation."); fted_rect_reset(x, y, pad_num, mouse_button, shifted); return; } if (shifted) fted_paste2(x, y, pad_num, mouse_button, shifted); else fted_rect2(x, y, pad_num, mouse_button, shifted);}fted_cut0(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ fted_message_user("Cut a rectangular area from the character and place it in the buffer."); fted_rect_reset(x, y, pad_num, mouse_button, shifted);}fted_cut3(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ register int cur_cell_x, cur_cell_y; register struct pixrect *pr; if (previous_shift != shifted) { fted_message_user("Sorry, can't change the shift key in the middle of an operation."); fted_rect_reset(x, y, pad_num, mouse_button, shifted); return; } if (shifted) { fted_paste3(x, y, pad_num, mouse_button, shifted); return; } if (!button_pressed) return; fted_undo_push(&(fted_edit_pad_info[pad_num])); DRAW_RECT_OUTLINE(end_x_wc, end_y_wc); GET_CELL(cur_cell_x, cur_cell_y, x, y, pad_org_x, pad_org_y); if ( base_x_cc < cur_cell_x) { fted_buffer_rect.r_left = base_x_cc; fted_buffer_rect.r_width = cur_cell_x - base_x_cc + 1; } else { fted_buffer_rect.r_left = cur_cell_x; fted_buffer_rect.r_width = base_x_cc - cur_cell_x + 1; } if ( base_y_cc < cur_cell_y) { fted_buffer_rect.r_top = base_y_cc; fted_buffer_rect.r_height = cur_cell_y - base_y_cc + 1; } else { fted_buffer_rect.r_top = cur_cell_y; fted_buffer_rect.r_height = base_y_cc - cur_cell_y + 1; } pr = fted_edit_pad_info[pad_num].pix_char_ptr->pc_pr; pr_rop(fted_buffer_pr, fted_buffer_rect.r_left, fted_buffer_rect.r_top, fted_buffer_rect.r_width, fted_buffer_rect.r_height, PIX_SRC, pr, fted_buffer_rect.r_left, fted_buffer_rect.r_top); pr_rop(pr, fted_buffer_rect.r_left, fted_buffer_rect.r_top, fted_buffer_rect.r_width, fted_buffer_rect.r_height, PIX_CLR, NULL, fted_buffer_rect.r_left, fted_buffer_rect.r_top); pw_write(fted_canvas_pw, fted_edit_pad_info[pad_num].proof.out_fted_line2.r_left + PROOF_X_OFFSET, fted_edit_pad_info[pad_num].proof.out_fted_line2.r_top + PROOF_Y_OFFSET, fted_char_max_width, fted_char_max_height, PIX_SRC, pr, 0, 0); pw_writebackground(fted_canvas_pw, (pad_org_x + (fted_buffer_rect.r_left * CELL_SIZE) + 1), (pad_org_y + (fted_buffer_rect.r_top * CELL_SIZE) + 1), ((fted_buffer_rect.r_width * CELL_SIZE) - 1), ((fted_buffer_rect.r_height * CELL_SIZE) - 1), PIX_CLR); fted_message_user("Rect cut and placed in buffer."); buffer_empty = FALSE; button_pressed = FALSE; fted_edit_pad_info[pad_num].modified = TRUE;}fted_copy0(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ fted_message_user("Copy a rectangular area from the character and place it in the buffer."); fted_rect_reset(x, y, pad_num, mouse_button, shifted);}fted_copy3(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ register int cur_cell_x, cur_cell_y; register struct pixrect *pr; if (previous_shift != shifted) { fted_message_user("Sorry, can't change the shift key in the middle of an operation."); fted_rect_reset(x, y, pad_num, mouse_button, shifted); return; } if (shifted) { fted_paste3(x, y, pad_num, mouse_button, shifted); return; } if (!button_pressed) return; DRAW_RECT_OUTLINE(end_x_wc, end_y_wc); GET_CELL(cur_cell_x, cur_cell_y, x, y, pad_org_x, pad_org_y); if ( base_x_cc < cur_cell_x) { fted_buffer_rect.r_left = base_x_cc; fted_buffer_rect.r_width = cur_cell_x - base_x_cc + 1; } else { fted_buffer_rect.r_left = cur_cell_x; fted_buffer_rect.r_width = base_x_cc - cur_cell_x + 1; } if ( base_y_cc < cur_cell_y) { fted_buffer_rect.r_top = base_y_cc; fted_buffer_rect.r_height = cur_cell_y - base_y_cc + 1; } else { fted_buffer_rect.r_top = cur_cell_y; fted_buffer_rect.r_height = base_y_cc - cur_cell_y + 1; } pr = fted_edit_pad_info[pad_num].pix_char_ptr->pc_pr; pr_rop(fted_buffer_pr, fted_buffer_rect.r_left, fted_buffer_rect.r_top, fted_buffer_rect.r_width, fted_buffer_rect.r_height, PIX_SRC, pr, fted_buffer_rect.r_left, fted_buffer_rect.r_top); pw_write(fted_canvas_pw, fted_edit_pad_info[pad_num].proof.out_fted_line2.r_left+PROOF_X_OFFSET, fted_edit_pad_info[pad_num].proof.out_fted_line2.r_top + PROOF_Y_OFFSET, fted_char_max_width, fted_char_max_height, PIX_SRC, pr, 0, 0); buffer_empty = FALSE; button_pressed = FALSE; fted_message_user("Rect copied into buffer.");}fted_paste0(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ fted_message_user("Paste the contents of the buffer into a character; press down the mouse button."); fted_paste_reset(x, y, pad_num, mouse_button, shifted);}fted_paste1(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ register int cur_cell_x, cur_cell_y; if (buffer_empty) { fted_message_user("Nothing is in the buffer to be pasted!"); return; } button_pressed = TRUE; GET_ORG(pad_org_x, pad_org_y); GET_CELL(cur_cell_x, cur_cell_y, x, y, pad_org_x, pad_org_y); end_x_wc = (cur_cell_x * CELL_SIZE + pad_org_x) + (CELL_SIZE / 2); base_x_wc = end_x_wc + (fted_buffer_rect.r_width - 1) * CELL_SIZE; end_y_wc = (cur_cell_y * CELL_SIZE + pad_org_y) + (CELL_SIZE / 2); base_y_wc = end_y_wc + (fted_buffer_rect.r_height - 1) * CELL_SIZE; DRAW_RECT_OUTLINE(end_x_wc, end_y_wc); fted_message_user("Now, move the mouse.");}fted_paste2(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ register int cur_cell_x, cur_cell_y; if (buffer_empty) { fted_message_user("buffer is empty."); return; } if (!button_pressed) return; DRAW_RECT_OUTLINE(end_x_wc, end_y_wc); GET_CELL(cur_cell_x, cur_cell_y, x, y, pad_org_x, pad_org_y); end_x_wc = (cur_cell_x * CELL_SIZE + pad_org_x) + (CELL_SIZE / 2); base_x_wc = end_x_wc + (fted_buffer_rect.r_width - 1) * CELL_SIZE; end_y_wc = (cur_cell_y * CELL_SIZE + pad_org_y) + (CELL_SIZE / 2); base_y_wc = end_y_wc + (fted_buffer_rect.r_height - 1) * CELL_SIZE; DRAW_RECT_OUTLINE(end_x_wc, end_y_wc);}fted_paste3(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ register int cur_cell_x, cur_cell_y; register struct pixrect *pr; int diff, width, height; struct rect *window; if (buffer_empty) { fted_message_user("buffer is empty."); return; } if (!button_pressed) return; button_pressed = FALSE; fted_undo_push(&(fted_edit_pad_info[pad_num])); DRAW_RECT_OUTLINE(end_x_wc, end_y_wc); GET_CELL(cur_cell_x, cur_cell_y, x, y, pad_org_x, pad_org_y); pr = fted_edit_pad_info[pad_num].pix_char_ptr->pc_pr; window = &(fted_edit_pad_info[pad_num].window); diff = (cur_cell_x + fted_buffer_rect.r_width) - (window->r_left + window->r_width); if (diff > 0) width = fted_buffer_rect.r_width - diff; else width = fted_buffer_rect.r_width; diff = (cur_cell_y + fted_buffer_rect.r_height) - (window->r_top + window->r_height); if (diff > 0) height = fted_buffer_rect.r_height - diff; else height = fted_buffer_rect.r_height; pr_rop(pr, cur_cell_x, cur_cell_y, width, height, PIX_SRC, fted_buffer_pr, fted_buffer_rect.r_left, fted_buffer_rect.r_top); pw_write(fted_canvas_pw, fted_edit_pad_info[pad_num].proof.out_fted_line2.r_left + PROOF_X_OFFSET, fted_edit_pad_info[pad_num].proof.out_fted_line2.r_top + PROOF_Y_OFFSET, fted_char_max_width, fted_char_max_height, PIX_SRC, pr, 0, 0); fted_paint_pad(&(fted_edit_pad_info[pad_num]), fted_edit_pad_groups[pad_num].edit->buttons[EDIT_BUTTON]); fted_message_user("Rect pasted into character."); fted_edit_pad_info[pad_num].modified = TRUE;}fted_paste_reset(x, y, pad_num, mouse_button, shifted)register int x, y; /* coord of point */register int pad_num; /* index of button */int mouse_button; /* which mouse button was used */int shifted; /* true if the shift key is down */{ if (button_pressed) { DRAW_RECT_OUTLINE(end_x_wc, end_y_wc); button_pressed = FALSE; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -