Shortcuts: Add copy-paste shortcuts

This commit is contained in:
osamu-kj 2023-05-20 02:31:33 +02:00
parent 15f8c9534f
commit 2fbe8958d9
3 changed files with 15 additions and 4 deletions

View File

@ -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 - Alerting function for errors and issues
- Logging / Debug flag - Logging / Debug flag
- Read input from stdin - Read input from stdin
- ~~Shortcut: ability to clone an event into another day~~
# Contributions # Contributions

View File

@ -167,6 +167,15 @@ bool Engine::input_handle_universal(WINDOW *win, char key) {
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; 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: default:
return false; return false;
break; 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->calendar->set_day(this->calendar->get_info().current_month_days);
this->active_cell = this->calendar->get_info().current_month_days-1; this->active_cell = this->calendar->get_info().current_month_days-1;
break; break;
} }
} }
calendar_information Engine::parse_date(std::string date) { calendar_information Engine::parse_date(std::string date) {

View File

@ -45,14 +45,15 @@ class Engine {
bool write_calendar(); bool write_calendar();
Calendar *calendar; Calendar *calendar;
// std::unordered_map<calendar_information, std::string> events_map;
std::map<calendar_information, std::string> events_map; std::map<calendar_information, std::string> events_map;
int active_cell; int active_cell;
int padding; // padding int padding; // GUI padding
private: private:
std::fstream calendar_file; std::fstream calendar_file;
char * calendar_file_location; char *calendar_file_location;
calendar_information clipboard_day;
}; };
#endif #endif