diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-07-04 09:54:19 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-07-06 01:59:24 +0200 |
commit | dd059ca8129a97dfde79101bdcf5d3f7bcec0a90 (patch) | |
tree | 0e9fa590a258c1bb576e134144313877ffac9eaa | |
parent | a3cf63b3748c5f42214d648f003933d5597a3a8d (diff) | |
download | calcurse-dd059ca8129a97dfde79101bdcf5d3f7bcec0a90.zip |
Add a key binding for generic-copy
This finally adds full copy-paste support. Implements FR#15.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r-- | src/calcurse.c | 8 | ||||
-rw-r--r-- | src/calcurse.h | 1 | ||||
-rw-r--r-- | src/help.c | 28 | ||||
-rw-r--r-- | src/keys.c | 2 | ||||
-rw-r--r-- | src/wins.c | 3 |
5 files changed, 29 insertions, 13 deletions
diff --git a/src/calcurse.c b/src/calcurse.c index ba0f11e..8a5d261 100644 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -292,6 +292,14 @@ int main(int argc, char **argv) } break; + case KEY_GENERIC_COPY: + if (wins_slctd() == APP && apoint_hilt() != 0) { + interact_day_item_copy(&inday.nb_events, &inday.nb_apoints); + inday = do_storage(0); + wins_update(FLAG_CAL | FLAG_APP); + } + break; + case KEY_GENERIC_PASTE: if (wins_slctd() == APP) { interact_day_item_paste(&inday.nb_events, &inday.nb_apoints); diff --git a/src/calcurse.h b/src/calcurse.h index c2f7b2b..8674321 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -396,6 +396,7 @@ enum key { KEY_GENERIC_QUIT, KEY_GENERIC_SAVE, KEY_GENERIC_CUT, + KEY_GENERIC_COPY, KEY_GENERIC_PASTE, KEY_GENERIC_CHANGE_VIEW, KEY_GENERIC_IMPORT, @@ -60,7 +60,7 @@ typedef enum { HELP_GOTO, HELP_DELETE, HELP_ADD, - HELP_CUT_PASTE, + HELP_CUT_COPY_PASTE, HELP_EDIT, HELP_ENOTE, HELP_VNOTE, @@ -127,6 +127,7 @@ help_write_pad(struct window *win, char *title, char *text, enum key action) case KEY_GENERIC_GOTO_TODAY: case KEY_GENERIC_CREDITS: case KEY_GENERIC_CUT: + case KEY_GENERIC_COPY: case KEY_GENERIC_PASTE: break; default: @@ -262,8 +263,9 @@ static int wanted_page(int ch) break; case KEY_GENERIC_CUT: + case KEY_GENERIC_COPY: case KEY_GENERIC_PASTE: - page = HELP_CUT_PASTE; + page = HELP_CUT_COPY_PASTE; break; case KEY_EDIT_ITEM: @@ -536,21 +538,23 @@ void help_screen(void) keys_action_firstkey(KEY_ADD_ITEM), keys_action_firstkey(KEY_ADD_ITEM)); - hscr[HELP_CUT_PASTE].title = _("Cut and Paste\n"); - snprintf(hscr[HELP_CUT_PASTE].text, HELPTEXTSIZ, + hscr[HELP_CUT_COPY_PASTE].title = _("Cut and Paste\n"); + snprintf(hscr[HELP_CUT_COPY_PASTE].text, HELPTEXTSIZ, _ - ("Cut and paste the currently selected item. This is useful to quickly\n" - "move an item from one date to another.\n" - "To do so, one must first highlight the item that needs to be moved,\n" - "then press '%s' to cut this item. It will be removed from the panel.\n" - "Once the new date is chosen in the calendar, the appointment panel must\n" - "be selected and the '%s' key must be pressed to paste the item.\n" - "The item will appear again in the appointment panel, assigned to the\n" - "newly selected date.\n\n" + ( + "Cut/copy and paste the currently selected item. This is useful to\n" + "quickly move or copy an item from one date to another.\n" + "To do so, one must first highlight the item that needs to be moved or\n" + "copied, then press '%s' to cut (or '%s' to copy) this item. Once the\n" + "new date is chosen in the calendar, the appointment panel must be\n" + "selected and the '%s' key must be pressed to paste the item. The item\n" + "will appear again in the appointment panel, assigned to the newly\n" + "selected date.\n\n" "Be careful that if two cuts are performed successively without pasting\n" "between them, the item that was cut at first will be lost, together\n" "with its associated note if it had one."), keys_action_firstkey(KEY_GENERIC_CUT), + keys_action_firstkey(KEY_GENERIC_COPY), keys_action_firstkey(KEY_GENERIC_PASTE)); hscr[HELP_EDIT].title = _("Edit Item\n"); @@ -57,6 +57,7 @@ static struct keydef_s keydef[NBKEYS] = { {"generic-quit", "q Q"}, {"generic-save", "s S C-s"}, {"generic-cut", "C-x"}, + {"generic-copy", "c"}, {"generic-paste", "C-v"}, {"generic-change-view", "TAB"}, {"generic-import", "i I"}, @@ -445,6 +446,7 @@ void keys_popup_info(enum key key) info[KEY_GENERIC_QUIT] = _("Exit from the current menu, or quit calcurse."); info[KEY_GENERIC_SAVE] = _("Save calcurse data."); info[KEY_GENERIC_CUT] = _("Cut the item that is currently selected."); + info[KEY_GENERIC_COPY] = _("Copy the item that is currently selected."); info[KEY_GENERIC_PASTE] = _("Paste an item at the current position."); info[KEY_GENERIC_CHANGE_VIEW] = _("Select next panel in calcurse main screen."); @@ -588,6 +588,7 @@ void wins_status_bar(void) struct binding quit = { _("Quit"), KEY_GENERIC_QUIT }; struct binding save = { _("Save"), KEY_GENERIC_SAVE }; struct binding cut = { _("Cut"), KEY_GENERIC_CUT }; + struct binding copy = { _("Copy"), KEY_GENERIC_COPY }; struct binding paste = { _("Paste"), KEY_GENERIC_PASTE }; struct binding chgvu = { _("Chg Win"), KEY_GENERIC_CHANGE_VIEW }; struct binding import = { _("Import"), KEY_GENERIC_IMPORT }; @@ -638,7 +639,7 @@ void wins_status_bar(void) &help, &quit, &save, &chgvu, &import, &export, &add, &del, &edit, &view, &pipe, &draw, &rept, &flag, &enote, &vnote, &up, &down, &gpday, &gnday, &gpweek, &gnweek, &gpmonth, &gnmonth, &gpyear, &gnyear, &togo, &today, - &conf, &appt, &todo, &cut, &paste + &conf, &appt, &todo, &cut, ©, &paste }; struct binding *bindings_todo[] = { |