From 6159ad5be20ac5a1fc8f35514c19afe85ee2c41f Mon Sep 17 00:00:00 2001 From: JosephMcc Date: Mon, 4 Dec 2017 03:22:03 -0800 Subject: [PATCH] Add a shortcuts window --- xed/resources/ui/xed-shortcuts.ui | 330 ++++++++++++++++++++++++++++++ xed/resources/ui/xed-ui.xml | 2 + xed/resources/xed.gresource.xml | 3 +- xed/xed-commands-help.c | 32 ++- xed/xed-commands.h | 1 + xed/xed-ui.h | 2 + 6 files changed, 368 insertions(+), 2 deletions(-) create mode 100644 xed/resources/ui/xed-shortcuts.ui diff --git a/xed/resources/ui/xed-shortcuts.ui b/xed/resources/ui/xed-shortcuts.ui new file mode 100644 index 0000000..bd9b628 --- /dev/null +++ b/xed/resources/ui/xed-shortcuts.ui @@ -0,0 +1,330 @@ + + + + + 1 + + + 1 + shortcuts + 12 + + + 1 + Documents + + + 1 + <ctrl>N + Create a new document + + + + + 1 + <ctrl>O + Open a document + + + + + 1 + <ctrl>S + Save the document + + + + + 1 + <ctrl><shift>S + Save the document with a new filename + + + + + 1 + <ctrl><shift>L + Save all the documents + + + + + 1 + <ctrl>W + Close the document + + + + + 1 + <ctrl><shift>W + Close all the documents + + + + + 1 + <ctrl><Alt>Page_Down + Switch to the next document + + + + + 1 + <ctrl><Alt>Page_Up + Switch to the previous document + + + + + 1 + <Alt>1...9 + Switch to the first - ninth document + + + + + + + 1 + Windows and Panes + + + 1 + F9 + Show side pane + + + + + 1 + <ctrl>F9 + Show bottom pane + + + + + 1 + F11 + Fullscreen on / off + + + + + 1 + <ctrl>Q + Quit the application + + + + + + + 1 + Find and Replace + + + 1 + <ctrl>F + Find + + + + + 1 + <ctrl>G + Find the next match + + + + + 1 + <ctrl><Shift>G + Find the previous match + + + + + 1 + <ctrl>H + Find and Replace + + + + + 1 + <ctrl>I + Go to line + + + + + + + 1 + Copy and Paste + + + 1 + <ctrl>C + Copy selected text to clipboard + + + + + 1 + <ctrl>X + Cut selected text to clipboard + + + + + 1 + <ctrl>V + Paste text from clipboard + + + + + + + 1 + Undo and Redo + + + 1 + <ctrl>Z + Undo previous command + + + + + 1 + <ctrl>Y + Redo previous command + + + + + + + 1 + Selection + + + 1 + <ctrl>A + Select all text + + + + + + + 1 + Editing + + + 1 + Insert + Toggle insert / overwrite + + + + + 1 + <ctrl>D + Delete current line + + + + + 1 + <alt>Up + Move current line up + + + + + 1 + <alt>Down + Move current line down + + + + + 1 + <alt>Left + Move current word left + + + + + 1 + <alt>Right + Move current word right + + + + + + 1 + <ctrl><shift>a + Increment number at cursor + + + + + 1 + <ctrl><shift>x + Decrement number at cursor + + + + + + + 1 + Tools + + + 1 + <shift>F7 + Check spelling + + + + + 1 + <ctrl>P + Print the document + + + + + + + + diff --git a/xed/resources/ui/xed-ui.xml b/xed/resources/ui/xed-ui.xml index 10d48bf..91a01ba 100644 --- a/xed/resources/ui/xed-ui.xml +++ b/xed/resources/ui/xed-ui.xml @@ -123,6 +123,8 @@ + + diff --git a/xed/resources/xed.gresource.xml b/xed/resources/xed.gresource.xml index b02bde6..0a55cb5 100644 --- a/xed/resources/xed.gresource.xml +++ b/xed/resources/xed.gresource.xml @@ -6,7 +6,8 @@ ui/xed-preferences-dialog.ui ui/xed-print-preferences.ui ui/xed-searchbar.ui + ui/xed-shortcuts.ui ui/xed-view-frame.ui css/xed-style.css - \ No newline at end of file + diff --git a/xed/xed-commands-help.c b/xed/xed-commands-help.c index b031339..769ddc2 100644 --- a/xed/xed-commands-help.c +++ b/xed/xed-commands-help.c @@ -46,7 +46,7 @@ void _xed_cmd_help_contents (GtkAction *action, XedWindow *window) { - xed_debug(DEBUG_COMMANDS); + xed_debug (DEBUG_COMMANDS); xed_app_show_help (XED_APP (g_application_get_default ()), GTK_WINDOW (window), NULL, NULL); } @@ -67,3 +67,33 @@ void _xed_cmd_help_about (GtkAction *action, "website", "http://github.com/linuxmint/xed", NULL); } + +void +_xed_cmd_help_keyboard_shortcuts (GtkAction *action, + XedWindow *window) +{ + static GtkWidget *shortcuts_window; + + xed_debug (DEBUG_COMMANDS); + + if (shortcuts_window == NULL) + { + GtkBuilder *builder; + + builder = gtk_builder_new_from_resource ("/org/x/editor/ui/xed-shortcuts.ui"); + shortcuts_window = GTK_WIDGET (gtk_builder_get_object (builder, "shortcuts-xed")); + + g_signal_connect (shortcuts_window, "destroy", + G_CALLBACK (gtk_widget_destroyed), &shortcuts_window); + + g_object_unref (builder); + } + + if (GTK_WINDOW (window) != gtk_window_get_transient_for (GTK_WINDOW (shortcuts_window))) + { + gtk_window_set_transient_for (GTK_WINDOW (shortcuts_window), GTK_WINDOW (window)); + } + + gtk_widget_show_all (shortcuts_window); + gtk_window_present (GTK_WINDOW (shortcuts_window)); +} diff --git a/xed/xed-commands.h b/xed/xed-commands.h index 679bc1e..005e64a 100644 --- a/xed/xed-commands.h +++ b/xed/xed-commands.h @@ -66,6 +66,7 @@ void _xed_cmd_documents_move_to_new_window (GtkAction *action, XedWindow *window void _xed_cmd_help_contents (GtkAction *action, XedWindow *window); void _xed_cmd_help_about (GtkAction *action, XedWindow *window); +void _xed_cmd_help_keyboard_shortcuts (GtkAction *action, XedWindow *window); void _xed_cmd_file_close_tab (XedTab *tab, XedWindow *window); diff --git a/xed/xed-ui.h b/xed/xed-ui.h index 24e97b5..5f32f9f 100644 --- a/xed/xed-ui.h +++ b/xed/xed-ui.h @@ -67,6 +67,8 @@ static const GtkActionEntry xed_always_sensitive_menu_entries[] = N_("Open the xed manual"), G_CALLBACK (_xed_cmd_help_contents) }, { "HelpAbout", "help-about-symbolic", N_("_About"), NULL, N_("About this application"), G_CALLBACK (_xed_cmd_help_about) }, + { "HelpShortcuts", NULL, N_("_Keyboard Shortcuts"), NULL, + N_("Show the keyboard shortcuts dialog"), G_CALLBACK (_xed_cmd_help_keyboard_shortcuts) }, /* Fullscreen toolbar */ { "LeaveFullscreen", "view-restore-symbolic", NULL,