Changeset 5f4fbabbd782af175903825bb04c5e9056b9ba0b
- Timestamp:
- 10/09/08 21:52:10 (5 years ago)
- Author:
- Armin Burgmeier <armin@…>
- Parents:
- 332744111f03bec9a9f87d1cdd4ee32e3b8808ed
- Children:
- 6649d0af0ada5ff87e2afea89a1fc67c32e6b562
- git-committer:
- Armin Burgmeier <armin@arbur.net> / 2008-10-09T21:52:10Z+0200
- Message:
-
Scroll to cursor position on Undo or Redo
2008-10-09 Armin Burgmeier <armin@…>
- inc/core/docwindow.hpp:
- src/core/docwindow.cpp: Added the scroll_to_cursor_position()
function.
- src/commands/edit-commands.cpp: Scroll to cursor position on Undo or
Redo.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r3327441
|
r5f4fbab
|
|
| | 1 | 2008-10-09 Armin Burgmeier <armin@arbur.net> |
| | 2 | |
| | 3 | * inc/core/docwindow.hpp: |
| | 4 | * src/core/docwindow.cpp: Added the scroll_to_cursor_position() |
| | 5 | function. |
| | 6 | |
| | 7 | * src/commands/edit-commands.cpp: Scroll to cursor position on Undo or |
| | 8 | Redo. |
| | 9 | |
| 1 | 10 | 2008-10-08 Armin Burgmeier <armin@arbur.net> |
| 2 | 11 | |
-
|
rfce3ea7
|
r5f4fbab
|
|
| 64 | 64 | const GtkTextIter* end); |
| 65 | 65 | Glib::ustring get_selected_text() const; |
| | 66 | void scroll_to_cursor_position(double within_margin); |
| 66 | 67 | |
| 67 | 68 | GtkSourceLanguage* get_language() const; |
-
|
r3327441
|
r5f4fbab
|
|
| 308 | 308 | INF_ADOPTED_USER(m_current_document->get_active_user()) |
| 309 | 309 | ); |
| | 310 | |
| | 311 | m_current_document->scroll_to_cursor_position(0.0); |
| 310 | 312 | } |
| 311 | 313 | |
| … |
… |
|
| 318 | 320 | INF_ADOPTED_USER(m_current_document->get_active_user()) |
| 319 | 321 | ); |
| | 322 | |
| | 323 | m_current_document->scroll_to_cursor_position(0.0); |
| 320 | 324 | } |
| 321 | 325 | |
-
|
rb4bda6d
|
r5f4fbab
|
|
| 299 | 299 | gtk_text_view_get_buffer(GTK_TEXT_VIEW(m_view)), begin, end); |
| 300 | 300 | |
| | 301 | scroll_to_cursor_position(0.1); |
| | 302 | } |
| | 303 | |
| | 304 | Glib::ustring Gobby::DocWindow::get_selected_text() const |
| | 305 | { |
| | 306 | GtkTextIter start, end; |
| | 307 | gtk_text_buffer_get_selection_bounds( |
| | 308 | gtk_text_view_get_buffer(GTK_TEXT_VIEW(m_view)), |
| | 309 | &start, &end); |
| | 310 | |
| | 311 | Gtk::TextIter start_cpp(&start), end_cpp(&end); |
| | 312 | return start_cpp.get_slice(end_cpp); |
| | 313 | } |
| | 314 | |
| | 315 | void Gobby::DocWindow::scroll_to_cursor_position(double within_margin) |
| | 316 | { |
| 301 | 317 | gtk_text_view_scroll_to_mark( |
| 302 | 318 | GTK_TEXT_VIEW(m_view), |
| 303 | 319 | gtk_text_buffer_get_insert(gtk_text_view_get_buffer( |
| 304 | 320 | GTK_TEXT_VIEW(m_view))), |
| 305 | | 0.1, FALSE, 0.0, 0.0); |
| 306 | | } |
| 307 | | |
| 308 | | Glib::ustring Gobby::DocWindow::get_selected_text() const |
| 309 | | { |
| 310 | | GtkTextIter start, end; |
| 311 | | gtk_text_buffer_get_selection_bounds( |
| 312 | | gtk_text_view_get_buffer(GTK_TEXT_VIEW(m_view)), |
| 313 | | &start, &end); |
| 314 | | |
| 315 | | Gtk::TextIter start_cpp(&start), end_cpp(&end); |
| 316 | | return start_cpp.get_slice(end_cpp); |
| | 321 | within_margin, FALSE, 0.0, 0.0); |
| 317 | 322 | } |
| 318 | 323 | |