Changeset da3e3a0201b8e4eb8cc106101386ca2e7234c06e

Show
Ignore:
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:
2 added
9 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r93f6a42 rda3e3a0  
     12008-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 
    1232008-06-29  Armin Burgmeier  <armin@0x539.de> 
    224 
  • inc/commands/Makefile.am

    rdddf956 rda3e3a0  
    22noinst_HEADERS = \ 
    33        browser-commands.hpp \ 
     4        edit-commands.hpp \ 
    45        file-commands.hpp 
  • inc/core/docwindow.hpp

    re321deb rda3e3a0  
    4242public: 
    4343        typedef sigc::signal<void, GtkSourceLanguage*> SignalLanguageChanged; 
     44        typedef sigc::signal<void, InfTextUser*> SignalActiveUserChanged; 
    4445 
    4546        DocWindow(InfTextSession* session, const Glib::ustring& title, 
     
    6566        void set_language(GtkSourceLanguage* language); 
    6667 
     68        InfTextUser* get_active_user() const; 
    6769        void set_active_user(InfTextUser* user); 
    6870 
     
    7678        { 
    7779                return m_signal_language_changed; 
     80        } 
     81 
     82        SignalActiveUserChanged signal_active_user_changed() const 
     83        { 
     84                return m_signal_active_user_changed; 
    7885        } 
    7986 
     
    106113 
    107114        SignalLanguageChanged m_signal_language_changed; 
     115        SignalActiveUserChanged m_signal_active_user_changed; 
    108116}; 
    109117 
  • inc/window.hpp

    r883ac1c rda3e3a0  
    2525#include "commands/browser-commands.hpp" 
    2626#include "commands/file-commands.hpp" 
     27#include "commands/edit-commands.hpp" 
    2728#include "operations/operations.hpp" 
    2829 
    29 /*#include "dialogs/finddialog.hpp" 
    30 #include "dialogs/gotodialog.hpp" 
    31 #include "dialogs/preferencesdialog.hpp"*/ 
    3230#include "dialogs/initialdialog.hpp" 
    3331 
     
    3533#include "core/iconmanager.hpp" 
    3634#include "core/header.hpp" 
    37 #include "core/docwindow.hpp" 
    3835#include "core/folder.hpp" 
    3936#include "core/browser.hpp" 
     
    4744#include <gtkmm/messagedialog.h> 
    4845 
    49 #include <queue> 
    5046#include <memory> 
    5147 
     
    9490        BrowserCommands m_commands_browser; 
    9591        FileCommands m_commands_file; 
     92        EditCommands m_commands_edit; 
    9693 
    9794        // TODO: Can't we use this directly now that the session is 
     
    10198        // Dialogs 
    10299        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;*/ 
    106100}; 
    107101 
  • src/commands/Makefile.am

    rdddf956 rda3e3a0  
    33libgobby_commands_a_SOURCES = \ 
    44        browser-commands.cpp \ 
     5        edit-commands.cpp \ 
    56        file-commands.cpp 
    67 
  • src/core/docwindow.cpp

    re321deb rda3e3a0  
    270270} 
    271271 
     272InfTextUser* 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 
    272279void Gobby::DocWindow::set_active_user(InfTextUser* user) 
    273280{ 
     
    288295        else 
    289296                gtk_text_view_set_editable(GTK_TEXT_VIEW(m_view), FALSE); 
     297 
     298        m_signal_active_user_changed.emit(user); 
    290299} 
    291300 
  • src/core/header.cpp

    r30f40b5 rda3e3a0  
    280280 
    281281        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")); 
    284288        group_edit->add(action_edit_cut); 
    285289        group_edit->add(action_edit_copy); 
  • src/core/noteplugin.cpp

    rb599f99 rda3e3a0  
    3636        { 
    3737                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 
    3843                InfUserTable* user_table = inf_user_table_new(); 
    3944                InfTextGtkBuffer* buffer = 
  • src/window.cpp

    re321deb rda3e3a0  
    3636                           m_preferences), 
    3737        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) 
    3940{ 
    4041        m_header.show();