2003-12-01 Olga Rodimina <rodimina@redhat.com>
* java/awt/TextComponent.java: (getSelectionStart): Updated javadocs. (getSelectionEnd): Ditto. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer: (getSelectionStart): Changed to return caret position if no text is selected (getSelectionEnd): Ditto. From-SVN: r74124
This commit is contained in:
parent
bde5dd2520
commit
ea91ed0989
@ -1,3 +1,13 @@
|
||||
2003-12-01 Olga Rodimina <rodimina@redhat.com>
|
||||
|
||||
* java/awt/TextComponent.java:
|
||||
(getSelectionStart): Updated javadocs.
|
||||
(getSelectionEnd): Ditto.
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer:
|
||||
(getSelectionStart): Changed to return caret position if no
|
||||
text is selected
|
||||
(getSelectionEnd): Ditto.
|
||||
|
||||
2003-12-01 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||
|
||||
* gnu/awt/gtk/GtkButtonPeer.java, gnu/awt/gtk/gtkcommon.cc,
|
||||
|
@ -163,7 +163,7 @@ getSelectedText()
|
||||
|
||||
/**
|
||||
* Returns the starting position of the selected text region.
|
||||
* // FIXME: What is returned if there is no selected text?
|
||||
* If the text is not selected then caret position is returned.
|
||||
*
|
||||
* @return The starting position of the selected text region.
|
||||
*/
|
||||
@ -196,7 +196,7 @@ setSelectionStart(int selectionStart)
|
||||
|
||||
/**
|
||||
* Returns the ending position of the selected text region.
|
||||
* // FIXME: What is returned if there is no selected text.
|
||||
* If the text is not selected, then caret position is returned
|
||||
*
|
||||
* @return The ending position of the selected text region.
|
||||
*/
|
||||
|
@ -194,6 +194,8 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionStart
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
int starti, endi;
|
||||
GtkTextMark *mark;
|
||||
GtkTextIter iter;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
@ -204,6 +206,8 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionStart
|
||||
editable = GTK_EDITABLE (ptr);
|
||||
if (gtk_editable_get_selection_bounds (editable, &starti, &endi))
|
||||
pos = starti;
|
||||
else
|
||||
pos = gtk_editable_get_position (editable);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -221,6 +225,12 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionStart
|
||||
buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
|
||||
if (gtk_text_buffer_get_selection_bounds(buf, &start, &end))
|
||||
pos = gtk_text_iter_get_offset (&start);
|
||||
else
|
||||
{
|
||||
mark = gtk_text_buffer_get_insert (buf);
|
||||
gtk_text_buffer_get_iter_at_mark (buf, &iter, mark);
|
||||
pos = gtk_text_iter_get_offset (&iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,6 +251,8 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionEnd
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
int starti, endi;
|
||||
GtkTextMark *mark;
|
||||
GtkTextIter iter;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
@ -251,6 +263,8 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionEnd
|
||||
editable = GTK_EDITABLE (ptr);
|
||||
if (gtk_editable_get_selection_bounds (editable, &starti, &endi))
|
||||
pos = endi;
|
||||
else
|
||||
pos = gtk_editable_get_position (editable);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -268,6 +282,12 @@ Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionEnd
|
||||
buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
|
||||
if (gtk_text_buffer_get_selection_bounds(buf, &start, &end))
|
||||
pos = gtk_text_iter_get_offset (&end);
|
||||
else
|
||||
{
|
||||
mark = gtk_text_buffer_get_insert (buf);
|
||||
gtk_text_buffer_get_iter_at_mark (buf, &iter, mark);
|
||||
pos = gtk_text_iter_get_offset (&iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user