/[classpath]/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
ViewVC logotype

Diff of /classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by mkoch, Mon May 31 21:12:23 2004 UTC revision 1.16 by mark, Thu Jul 22 19:45:39 2004 UTC
# Line 151  Java_gnu_java_awt_peer_gtk_GtkTextCompon Line 151  Java_gnu_java_awt_peer_gtk_GtkTextCompon
151    GtkWidget *text = NULL;    GtkWidget *text = NULL;
152    GtkTextBuffer *buf;    GtkTextBuffer *buf;
153    GtkTextIter iter;    GtkTextIter iter;
154      GtkTextMark *mark;
155      GtkTextMark *oldmark;
156      GtkTextIter olditer;
157      int oldpos;
158    
159    ptr = NSA_GET_PTR (env, obj);    ptr = NSA_GET_PTR (env, obj);
160    
# Line 174  Java_gnu_java_awt_peer_gtk_GtkTextCompon Line 178  Java_gnu_java_awt_peer_gtk_GtkTextCompon
178        if (text)        if (text)
179          {          {
180            buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));            buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
181    
182              /* Save old position. */
183              oldmark = gtk_text_buffer_get_insert (buf);
184              gtk_text_buffer_get_iter_at_mark (buf, &olditer, oldmark);
185              oldpos = gtk_text_iter_get_offset (&olditer);
186    
187              /* Move to new position. */
188            gtk_text_buffer_get_iter_at_offset (buf, &iter, pos);            gtk_text_buffer_get_iter_at_offset (buf, &iter, pos);
189            gtk_text_buffer_place_cursor (buf, &iter);            gtk_text_buffer_place_cursor (buf, &iter);
190    
191              /* Scroll to new position. Alignment is determined
192                 comparing the new position to the old position. */
193              if (oldpos > pos)
194                gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (text),
195                                              &iter, 0, TRUE, 0, 0);
196              else if (oldpos < pos)
197                gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (text),
198                                              &iter, 0, TRUE, 1, 1);
199          }          }
200      }      }
201    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26