void edit_select_rep::selection_cut (string key) { if (inside_active_graphics ()) { if (key != "none") { tree t= as_tree (eval ("(graphics-cut)")); selection_set (key, t); } } else if (selection_active_any ()) { path p1, p2; if (selection_active_table ()) { p1= start_p; p2= end_p; if(key != "none") { tree sel= selection_get (); selection_set (key, sel); } } else { selection_get (p1, p2); go_to (p2); if (p2 == p1) return; if (key != "none") { tree sel= selection_compute (et, p1, p2); selection_set (key, simplify_correct (sel)); } } cut (p1, p2); } }
void edit_select_rep::selection_copy (string key) { if (inside_active_graphics ()) { tree t= as_tree (eval ("(graphics-copy)")); selection_set (key, t); return; } if (selection_active_any ()) { path old_tp= tp; selection sel; selection_get (sel); go_to (sel->end); tree t= selection_get (); go_to (sel->start); selection_set (key, t); go_to (old_tp); } }
void tsm_screen_selection_target(struct tsm_screen *con, unsigned int posx, unsigned int posy) { if (!con || !con->sel_active) return; selection_set(con, &con->sel_end, posx, posy); }
void tsm_screen_selection_start(struct tsm_screen *con, unsigned int posx, unsigned int posy) { if (!con) return; con->sel_active = true; selection_set(con, &con->sel_start, posx, posy); memcpy(&con->sel_end, &con->sel_start, sizeof(con->sel_end)); }
SHL_EXPORT void tsm_screen_selection_target(struct tsm_screen *con, unsigned int posx, unsigned int posy) { if (!con || !con->sel_active) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; selection_set(con, &con->sel_end, posx, posy); }
SHL_EXPORT void tsm_screen_selection_start(struct tsm_screen *con, unsigned int posx, unsigned int posy) { if (!con) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; con->sel_active = true; selection_set(con, &con->sel_start, posx, posy); memcpy(&con->sel_end, &con->sel_start, sizeof(con->sel_end)); }
void edit_select_rep::selection_set (tree t) { selection_set ("primary", t); }