From 2fbe8958d904e74d4b337c296522f8e43109ce96 Mon Sep 17 00:00:00 2001 From: osamu-kj <64986162+0xdeadbeer@users.noreply.github.com> Date: Sat, 20 May 2023 02:31:33 +0200 Subject: [PATCH] Shortcuts: Add copy-paste shortcuts --- README.md | 1 + src/engine/engine.cpp | 11 ++++++++++- src/engine/engine.hpp | 7 ++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f543adf..6ceacae 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ The following is a list of things that have been/still have to be completed. - Alerting function for errors and issues - Logging / Debug flag - Read input from stdin + - ~~Shortcut: ability to clone an event into another day~~ # Contributions diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 9b3523f..2e97084 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -167,6 +167,15 @@ bool Engine::input_handle_universal(WINDOW *win, char key) { exit(EXIT_SUCCESS); break; + case 'y': + this->clipboard_day = this->calendar->get_info(); + break; + case 'p': + if (this->events_map.find(this->clipboard_day) == this->events_map.end()) + break; + + this->events_map[this->calendar->get_info()] = this->events_map[this->clipboard_day]; + break; default: return false; break; @@ -237,7 +246,7 @@ void Engine::input_handle_month(WINDOW *win, char key) { this->calendar->set_day(this->calendar->get_info().current_month_days); this->active_cell = this->calendar->get_info().current_month_days-1; break; - } + } } calendar_information Engine::parse_date(std::string date) { diff --git a/src/engine/engine.hpp b/src/engine/engine.hpp index a54b007..1cac541 100644 --- a/src/engine/engine.hpp +++ b/src/engine/engine.hpp @@ -45,14 +45,15 @@ class Engine { bool write_calendar(); Calendar *calendar; - // std::unordered_map events_map; + std::map events_map; int active_cell; - int padding; // padding + int padding; // GUI padding private: std::fstream calendar_file; - char * calendar_file_location; + char *calendar_file_location; + calendar_information clipboard_day; }; #endif