Changeset da3e3a0201b8e4eb8cc106101386ca2e7234c06e
- Timestamp:
- 07/02/08 22:54:27 (5 years ago)
- Author:
- Armin Burgmeier <armin@…>
- Parents:
- 93f6a42ac3ff9aae384c3628b155631b6f3c22ff
- Children:
- 08eae59d49170034303842da09846cc88a3216fe
- git-committer:
- Armin Burgmeier <armin@arbur.net> / 2008-07-02T22:54:27Z+0200
- Message:
-
Added Undo/Redo functionality
2008-07-02 Armin Burgmeier <armin@…>
- inc/core/docwindow.hpp:
- src/core/docwindow.cpp: Added the active_user_changed signal and
the get_active_user() function.
- src/core/header.cpp: Added shortcuts for Undo and Redo.
- src/core/noteplugin.cpp: Disable GtkSourceView? Undo/Redo system by
calling gtk_source_buffer_begin_non_undoable_action() without ever
ending that non-undoable action.
- inc/commands/edit-commands.hpp:
- src/commands/edit-commands.cpp: New class handling the commands in
the Edit submenu. For now Undo and Redo are implemented.
- inc/commands/Makefile.am:
- src/commands/Makefile.am: Added new files to build.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r93f6a42
|
rda3e3a0
|
|
| | 1 | 2008-07-02 Armin Burgmeier <armin@0x539.de> |
| | 2 | |
| | 3 | * inc/core/docwindow.hpp: |
| | 4 | * src/core/docwindow.cpp: Added the active_user_changed signal and |
| | 5 | the get_active_user() function. |
| | 6 | |
| | 7 | * src/core/header.cpp: Added shortcuts for Undo and Redo. |
| | 8 | |
| | 9 | * src/core/noteplugin.cpp: Disable GtkSourceView Undo/Redo system by |
| | 10 | calling gtk_source_buffer_begin_non_undoable_action() without ever |
| | 11 | ending that non-undoable action. |
| | 12 | |
| | 13 | * inc/commands/edit-commands.hpp: |
| | 14 | * src/commands/edit-commands.cpp: New class handling the commands in |
| | 15 | the Edit submenu. For now Undo and Redo are implemented. |
| | 16 | |
| | 17 | * inc/window.hpp: |
| | 18 | * src/window.cpp: Instantiate EditCommands. |
| | 19 | |
| | 20 | * inc/commands/Makefile.am: |
| | 21 | * src/commands/Makefile.am: Added new files to build. |
| | 22 | |
| 1 | 23 | 2008-06-29 Armin Burgmeier <armin@0x539.de> |
| 2 | 24 | |
-
|
rdddf956
|
rda3e3a0
|
|
| 2 | 2 | noinst_HEADERS = \ |
| 3 | 3 | browser-commands.hpp \ |
| | 4 | edit-commands.hpp \ |
| 4 | 5 | file-commands.hpp |
-
|
re321deb
|
rda3e3a0
|
|
| 42 | 42 | public: |
| 43 | 43 | typedef sigc::signal<void, GtkSourceLanguage*> SignalLanguageChanged; |
| | 44 | typedef sigc::signal<void, InfTextUser*> SignalActiveUserChanged; |
| 44 | 45 | |
| 45 | 46 | DocWindow(InfTextSession* session, const Glib::ustring& title, |
| … |
… |
|
| 65 | 66 | void set_language(GtkSourceLanguage* language); |
| 66 | 67 | |
| | 68 | InfTextUser* get_active_user() const; |
| 67 | 69 | void set_active_user(InfTextUser* user); |
| 68 | 70 | |
| … |
… |
|
| 76 | 78 | { |
| 77 | 79 | return m_signal_language_changed; |
| | 80 | } |
| | 81 | |
| | 82 | SignalActiveUserChanged signal_active_user_changed() const |
| | 83 | { |
| | 84 | return m_signal_active_user_changed; |
| 78 | 85 | } |
| 79 | 86 | |
| … |
… |
|
| 106 | 113 | |
| 107 | 114 | SignalLanguageChanged m_signal_language_changed; |
| | 115 | SignalActiveUserChanged m_signal_active_user_changed; |
| 108 | 116 | }; |
| 109 | 117 | |
-
|
r883ac1c
|
rda3e3a0
|
|
| 25 | 25 | #include "commands/browser-commands.hpp" |
| 26 | 26 | #include "commands/file-commands.hpp" |
| | 27 | #include "commands/edit-commands.hpp" |
| 27 | 28 | #include "operations/operations.hpp" |
| 28 | 29 | |
| 29 | | /*#include "dialogs/finddialog.hpp" |
| 30 | | #include "dialogs/gotodialog.hpp" |
| 31 | | #include "dialogs/preferencesdialog.hpp"*/ |
| 32 | 30 | #include "dialogs/initialdialog.hpp" |
| 33 | 31 | |
| … |
… |
|
| 35 | 33 | #include "core/iconmanager.hpp" |
| 36 | 34 | #include "core/header.hpp" |
| 37 | | #include "core/docwindow.hpp" |
| 38 | 35 | #include "core/folder.hpp" |
| 39 | 36 | #include "core/browser.hpp" |
| … |
… |
|
| 47 | 44 | #include <gtkmm/messagedialog.h> |
| 48 | 45 | |
| 49 | | #include <queue> |
| 50 | 46 | #include <memory> |
| 51 | 47 | |
| … |
… |
|
| 94 | 90 | BrowserCommands m_commands_browser; |
| 95 | 91 | FileCommands m_commands_file; |
| | 92 | EditCommands m_commands_edit; |
| 96 | 93 | |
| 97 | 94 | // TODO: Can't we use this directly now that the session is |
| … |
… |
|
| 101 | 98 | // Dialogs |
| 102 | 99 | std::auto_ptr<InitialDialog> m_initial_dlg; |
| 103 | | /* std::auto_ptr<PreferencesDialog> m_preferences_dlg; |
| 104 | | std::auto_ptr<FindDialog> m_finddialog; |
| 105 | | std::auto_ptr<GotoDialog> m_gotodialog;*/ |
| 106 | 100 | }; |
| 107 | 101 | |
-
|
rdddf956
|
rda3e3a0
|
|
| 3 | 3 | libgobby_commands_a_SOURCES = \ |
| 4 | 4 | browser-commands.cpp \ |
| | 5 | edit-commands.cpp \ |
| 5 | 6 | file-commands.cpp |
| 6 | 7 | |
-
|
re321deb
|
rda3e3a0
|
|
| 270 | 270 | } |
| 271 | 271 | |
| | 272 | InfTextUser* Gobby::DocWindow::get_active_user() const |
| | 273 | { |
| | 274 | InfTextGtkBuffer* buffer = INF_TEXT_GTK_BUFFER( |
| | 275 | inf_session_get_buffer(INF_SESSION(m_session))); |
| | 276 | return inf_text_gtk_buffer_get_active_user(buffer); |
| | 277 | } |
| | 278 | |
| 272 | 279 | void Gobby::DocWindow::set_active_user(InfTextUser* user) |
| 273 | 280 | { |
| … |
… |
|
| 288 | 295 | else |
| 289 | 296 | gtk_text_view_set_editable(GTK_TEXT_VIEW(m_view), FALSE); |
| | 297 | |
| | 298 | m_signal_active_user_changed.emit(user); |
| 290 | 299 | } |
| 291 | 300 | |
-
|
r30f40b5
|
rda3e3a0
|
|
| 280 | 280 | |
| 281 | 281 | group_edit->add(action_edit); |
| 282 | | group_edit->add(action_edit_undo); |
| 283 | | group_edit->add(action_edit_redo); |
| | 282 | group_edit->add(action_edit_undo, |
| | 283 | Gtk::AccelKey("<control>Z", |
| | 284 | "<Actions>/MenuEdit/EditUndo")); |
| | 285 | group_edit->add(action_edit_redo, |
| | 286 | Gtk::AccelKey("<control><shift>Z", |
| | 287 | "<Actions>/MenuEdit/EditRedo")); |
| 284 | 288 | group_edit->add(action_edit_cut); |
| 285 | 289 | group_edit->add(action_edit_copy); |
-
|
rb599f99
|
rda3e3a0
|
|
| 36 | 36 | { |
| 37 | 37 | GtkSourceBuffer* textbuffer = gtk_source_buffer_new(NULL); |
| | 38 | // We never end this non-undoable action since we have our |
| | 39 | // own (collaborative) Undo implementanion, and we don't want |
| | 40 | // GtkSourceView to get in our way: |
| | 41 | gtk_source_buffer_begin_not_undoable_action(textbuffer); |
| | 42 | |
| 38 | 43 | InfUserTable* user_table = inf_user_table_new(); |
| 39 | 44 | InfTextGtkBuffer* buffer = |
-
|
re321deb
|
rda3e3a0
|
|
| 36 | 36 | m_preferences), |
| 37 | 37 | m_commands_file(*this, m_header, m_browser, m_folder, m_operations, |
| 38 | | m_info_storage, m_preferences) |
| | 38 | m_info_storage, m_preferences), |
| | 39 | m_commands_edit(*this, m_header, m_folder, m_preferences) |
| 39 | 40 | { |
| 40 | 41 | m_header.show(); |