summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1999-02-10 00:39:49 +0000
committerOwen Taylor <otaylor@src.gnome.org>1999-02-10 00:39:49 +0000
commitc3a4205cfaf1cbe1b299a3dc49bb2e1907d580de (patch)
treee76b008a3ef88ebe04c4deabaa33357483a467f3
parent72d584389835b1f7de3dafd6b0fb0497c63646e3 (diff)
downloadgtk+-c3a4205cfaf1cbe1b299a3dc49bb2e1907d580de.tar.gz
Moved entry->visible into editable class. (Leave it behind deprecated for
Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved entry->visible into editable class. (Leave it behind deprecated for compatibility) * gtk/gtkeditable.c: If not editable->visible, return *'s for clipboard and selection.
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.pre-2-09
-rw-r--r--ChangeLog.pre-2-109
-rw-r--r--ChangeLog.pre-2-29
-rw-r--r--ChangeLog.pre-2-49
-rw-r--r--ChangeLog.pre-2-69
-rw-r--r--ChangeLog.pre-2-89
-rw-r--r--gtk/gtkeditable.c45
-rw-r--r--gtk/gtkeditable.h1
-rw-r--r--gtk/gtkentry.c15
-rw-r--r--gtk/gtkentry.h2
11 files changed, 112 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index ae35e800c6..d5034718d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index ae35e800c6..d5034718d3 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,12 @@
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index ae35e800c6..d5034718d3 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,12 @@
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index ae35e800c6..d5034718d3 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,12 @@
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index ae35e800c6..d5034718d3 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,12 @@
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index ae35e800c6..d5034718d3 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,12 @@
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index ae35e800c6..d5034718d3 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,12 @@
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
diff --git a/gtk/gtkeditable.c b/gtk/gtkeditable.c
index d85743f874..178b5ca990 100644
--- a/gtk/gtkeditable.c
+++ b/gtk/gtkeditable.c
@@ -75,6 +75,9 @@ static void gtk_editable_set_arg (GtkObject *object,
static void gtk_editable_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
+static void *gtk_editable_get_public_chars (GtkEditable *editable,
+ gint start,
+ gint end);
static gint gtk_editable_selection_clear (GtkWidget *widget,
GdkEventSelection *event);
static void gtk_editable_selection_get (GtkWidget *widget,
@@ -382,6 +385,7 @@ gtk_editable_init (GtkEditable *editable)
editable->selection_end_pos = 0;
editable->has_selection = FALSE;
editable->editable = 1;
+ editable->visible = 1;
editable->clipboard_text = NULL;
#ifdef USE_XIM
@@ -473,6 +477,35 @@ gtk_editable_get_chars (GtkEditable *editable,
return klass->get_chars (editable, start, end);
}
+/*
+ * Like gtk_editable_get_chars, but if the editable is not
+ * visible, return asterisks
+ */
+static void *
+gtk_editable_get_public_chars (GtkEditable *editable,
+ gint start,
+ gint end)
+{
+ if (editable->visible)
+ return gtk_editable_get_chars (editable, start, end);
+ else
+ {
+ gint i;
+ gint nchars = end - start;
+ gchar *str;
+
+ if (nchars < 0)
+ nchars = -nchars;
+
+ str = g_new (gchar, nchars + 1);
+ for (i = 0; i<nchars; i++)
+ str[i] = '*';
+ str[i] = '\0';
+
+ return str;
+ }
+}
+
static void
gtk_editable_set_selection (GtkEditable *editable,
gint start_pos,
@@ -568,9 +601,9 @@ gtk_editable_selection_get (GtkWidget *widget,
{
selection_start_pos = MIN (editable->selection_start_pos, editable->selection_end_pos);
selection_end_pos = MAX (editable->selection_start_pos, editable->selection_end_pos);
- str = gtk_editable_get_chars(editable,
- selection_start_pos,
- selection_end_pos);
+ str = gtk_editable_get_public_chars(editable,
+ selection_start_pos,
+ selection_end_pos);
if (!str)
return; /* Refuse */
length = strlen (str);
@@ -890,9 +923,9 @@ gtk_editable_real_copy_clipboard (GtkEditable *editable)
if (gtk_selection_owner_set (GTK_WIDGET (editable),
clipboard_atom,
time))
- editable->clipboard_text = gtk_editable_get_chars (editable,
- selection_start_pos,
- selection_end_pos);
+ editable->clipboard_text = gtk_editable_get_public_chars (editable,
+ selection_start_pos,
+ selection_end_pos);
}
}
diff --git a/gtk/gtkeditable.h b/gtk/gtkeditable.h
index 672d7cb61b..bf609c4327 100644
--- a/gtk/gtkeditable.h
+++ b/gtk/gtkeditable.h
@@ -51,6 +51,7 @@ struct _GtkEditable
guint selection_end_pos;
guint has_selection : 1;
guint editable : 1;
+ guint visible : 1;
GdkIC *ic;
GdkICAttr *ic_attr;
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 045566ac9d..642ea264e8 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -326,7 +326,7 @@ gtk_entry_get_arg (GtkObject *object,
GTK_VALUE_UINT (*arg) = entry->text_max_length;
break;
case ARG_VISIBILITY:
- GTK_VALUE_BOOL (*arg) = entry->visible;
+ GTK_VALUE_BOOL (*arg) = GTK_EDITABLE (entry)->visible;
break;
default:
arg->type = GTK_TYPE_INVALID;
@@ -460,7 +460,8 @@ gtk_entry_set_visibility (GtkEntry *entry,
g_return_if_fail (entry != NULL);
g_return_if_fail (GTK_IS_ENTRY (entry));
- entry->visible = visible;
+ entry->visible = visible ? TRUE : FALSE;
+ GTK_EDITABLE (entry)->visible = visible ? TRUE : FALSE;
gtk_entry_recompute_offsets (entry);
gtk_widget_queue_draw (GTK_WIDGET (entry));
}
@@ -1344,8 +1345,8 @@ gtk_entry_draw_text (GtkEntry *entry)
selection_end_xoffset =
entry->char_offset[selection_end_pos] -entry->scroll_offset;
- /* if entry->visible, print a bunch of stars. If not, print the standard text. */
- if (entry->visible)
+ /* if editable->visible, print a bunch of stars. If not, print the standard text. */
+ if (editable->visible)
{
toprint = entry->text + start_pos;
}
@@ -1391,7 +1392,7 @@ gtk_entry_draw_text (GtkEntry *entry)
toprint + selection_end_pos - start_pos,
end_pos - selection_end_pos);
/* free the space allocated for the stars if it's neccessary. */
- if (!entry->visible)
+ if (!editable->visible)
g_free (toprint);
if (editable->editable)
@@ -1725,7 +1726,7 @@ gtk_entry_insert_text (GtkEditable *editable,
for (i=start_pos; i<end_pos; i++)
{
entry->char_offset[i] = entry->char_offset[start_pos] + offset;
- if (entry->visible)
+ if (editable->visible)
{
offset += gdk_char_width_wc (GTK_WIDGET (entry)->style->font,
entry->text[i]);
@@ -1756,7 +1757,7 @@ gtk_entry_recompute_offsets (GtkEntry *entry)
for (i=0; i<entry->text_length; i++)
{
entry->char_offset[i] = offset;
- if (entry->visible)
+ if (GTK_EDITABLE (entry)->visible)
{
offset += gdk_char_width_wc (GTK_WIDGET (entry)->style->font,
entry->text[i]);
diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h
index f29ccaaae7..ca129e783b 100644
--- a/gtk/gtkentry.h
+++ b/gtk/gtkentry.h
@@ -52,7 +52,7 @@ struct _GtkEntry
guint16 text_length; /* length in use */
guint16 text_max_length;
gint scroll_offset;
- guint visible : 1;
+ guint visible : 1; /* deprecated - see editable->visible */
guint32 timer;
guint button;