Changeset 30b68f2151c86a90dd3635f539e9c67f92dcd366

Show
Ignore:
Timestamp:
01/06/07 23:50:30 (6 years ago)
Author:
Philipp Kern <phil@…>
Parents:
05f026facbe317e26de827a0c531be67f0f761ae
Children:
f9569c7dbc5524e359650a52028e8d92ed520d5d
git-committer:
Philipp Kern <phil@0x539.de> / 2007-01-06T22:50:30Z+0000
Message:

[project @ Patched set_selection to take Gtk::TextIter? and scroll to selected position]

Original author: Armin Burgmeier <armin@…>
Date: 2005-10-28 21:17:46+00:00

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • inc/document.hpp

    r26c51cd r30b68f2  
    5656        unsigned int get_unsynced_changes_count() const; 
    5757 
    58         /** Selects the given region and places the cursor in front of the 
    59          * selection if <em>cursor_in_front</em> is true, otherwise behind 
    60          * the selection. 
    61          */ 
    62         void set_selection(size_type begin, size_type len, 
    63                            bool cursor_in_front = false); 
     58        /** Selects the given region and scrolls to the selected text. 
     59         */ 
     60        void set_selection(const Gtk::TextIter& begin, 
     61                           const Gtk::TextIter& end); 
    6462 
    6563        /** Returns the current document revision. 
  • src/document.cpp

    r26c51cd r30b68f2  
    185185} 
    186186 
    187 void Gobby::Document::set_selection(size_type begin, size_type end, 
    188                                     bool cursor_in_front) 
    189 { 
    190         Gtk::TextBuffer::iterator begin_it = 
    191                 get_buffer()->get_iter_at_offset(begin); 
    192         Gtk::TextBuffer::iterator end_it = 
    193                 get_buffer()->get_iter_at_offset(end); 
    194  
    195         if(cursor_in_front) 
    196                 get_buffer()->select_range(begin_it, end_it); 
    197         else 
    198                 get_buffer()->select_range(end_it, begin_it); 
     187void Gobby::Document::set_selection(const Gtk::TextIter& begin, 
     188                                    const Gtk::TextIter& end) 
     189{ 
     190        get_buffer()->select_range(begin, end); 
     191        scroll_to(get_buffer()->get_insert(), 0.1); 
    199192} 
    200193 
     
    805798} 
    806799 
     800