GtkCList updates, GtkText now defaults to editable = FALSE, but you can

turn it on and type now without it seg-faulting.  You can also delete, but it
will eventually seg fault on you (oh well).  -Jay
This commit is contained in:
Jay Painter 1998-01-13 15:14:54 +00:00
parent 4da8e492f7
commit 72da1d3e02
6 changed files with 108 additions and 57 deletions

View File

@ -410,10 +410,12 @@ gtk_clist_new (int columns,
/* initalize memory chunks */
clist->row_mem_chunk = g_mem_chunk_new ("clist row mem chunk",
sizeof (GtkCListRow),
1024, G_ALLOC_AND_FREE);
sizeof (GtkCListRow) * 1024,
G_ALLOC_AND_FREE);
clist->cell_mem_chunk = g_mem_chunk_new ("clist cell mem chunk",
sizeof (GtkCell) * columns,
1024, G_ALLOC_AND_FREE);
sizeof (GtkCell) * columns * 1024,
G_ALLOC_AND_FREE);
/* set number of columns, allocate memory */
clist->columns = columns;

View File

@ -255,7 +255,7 @@ static void move_cursor_page_ver (GtkText *text, int dir);
static void move_cursor_ver (GtkText *text, int count);
static void move_cursor_hor (GtkText *text, int count);
/*#define DEBUG_GTK_TEXT*/
/* #define DEBUG_GTK_TEXT */
#if defined(DEBUG_GTK_TEXT) && defined(__GNUC__)
/* Debugging utilities. */
@ -386,7 +386,7 @@ gtk_text_init (GtkText *text)
text->tab_stops = g_list_prepend (text->tab_stops, (void*)8);
text->line_wrap = TRUE;
text->is_editable = TRUE;
text->is_editable = FALSE;
}
GtkWidget*
@ -410,7 +410,6 @@ gtk_text_set_editable (GtkText *text,
g_return_if_fail (GTK_IS_TEXT (text));
text->is_editable = (editable != FALSE);
text->is_editable = FALSE; /* UNTIL JOSH FIXES IT */
}
void
@ -1021,6 +1020,28 @@ gtk_text_insert_1_at_point (GtkText* text, char key)
MARK_CURRENT_FORE (&text->point),
MARK_CURRENT_BACK (&text->point),
&key, 1);
insert_char_line_expose (text, key,
total_line_height (text, text->current_line, 1));
}
static void
gtk_text_backward_delete_1_at_point (GtkText* text, char key)
{
gtk_text_backward_delete (text, 1);
delete_char_line_expose (text, key,
total_line_height (text, text->current_line, 1));
}
static void
gtk_text_forward_delete_1_at_point (GtkText* text, char key)
{
gtk_text_forward_delete (text, 1);
delete_char_line_expose (text, key,
total_line_height (text, text->current_line, 1));
}
static gint
@ -1076,13 +1097,13 @@ gtk_text_key_press (GtkWidget *widget,
if (!text->has_cursor || text->cursor_mark.index == 0)
break;
gtk_text_backward_delete (text, 1);
gtk_text_backward_delete_1_at_point (text, key);
break;
case GDK_Delete:
if (!text->has_cursor || LAST_INDEX (text, text->cursor_mark))
break;
gtk_text_forward_delete (text, 1);
gtk_text_forward_delete_1_at_point (text, key);
break;
case GDK_Tab:
if (!text->has_cursor)
@ -3436,6 +3457,12 @@ gtk_text_show_cache_line (GtkText *text, GList *cache,
LineParams *lp = &CACHE_DATA(cache);
gint i;
if (cache == text->line_start_cache)
g_print ("Line Start Cache: ");
if (cache == text->current_line)
g_print("Current Line: ");
g_print ("%s:%d: cache line %s s=%d,e=%d,lh=%d (",
func,
line,
@ -3455,6 +3482,10 @@ gtk_text_show_cache (GtkText *text, const char* func, gint line)
{
GList *l = text->line_start_cache;
/* back up to the absolute beginning of the line cache */
while (l->prev)
l = l->prev;
g_print ("*** line cache ***\n");
for (; l; l = l->next)
gtk_text_show_cache_line (text, l, "all", func, line);

View File

@ -1689,6 +1689,15 @@ select_clist (GtkWidget *widget,
clist_selected_row = row;
}
void
list_selection_clist (GtkWidget *widget, gpointer data)
{
GList *list;
GtkCListRow *clist_row;
GtkCList *clist;
}
void
create_clist ()
{
@ -2261,6 +2270,7 @@ create_text ()
gtk_widget_show (table);
text = gtk_text_new (NULL, NULL);
gtk_text_set_editable (text, TRUE);
gtk_table_attach_defaults (GTK_TABLE (table), text, 0, 1, 0, 1);
gtk_widget_show (text);
@ -2270,7 +2280,6 @@ create_text ()
gtk_widget_show (hscrollbar);
vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
gtk_widget_set_usize(vscrollbar, 30, -1);
gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 0, 1,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (vscrollbar);
@ -2279,47 +2288,47 @@ create_text ()
gtk_widget_realize (text);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"spencer blah blah blah\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"kimball\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"is\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"a\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"wuss.\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"but\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"josephine\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"(his\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"girlfriend\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"is\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"not).\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"why?\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"because\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"spencer\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"puked\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"last\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"night\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"but\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"josephine\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"did\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"not", -1);
gtk_text_thaw (GTK_TEXT (text));

View File

@ -47,8 +47,8 @@ style "toggle_button" = "button"
style "text"
{
bg_pixmap[NORMAL] = "marble.xpm"
fg[NORMAL] = { 1.0, 1.0, 1.0 }
# bg_pixmap[NORMAL] = "marble.xpm"
# fg[NORMAL] = { 1.0, 1.0, 1.0 }
}
style "ruler"
@ -70,6 +70,6 @@ widget_class "*GtkCheckButton*" style "toggle_button"
widget_class "*GtkRadioButton*" style "toggle_button"
widget_class "*GtkButton*" style "button"
widget_class "*Ruler" style "ruler"
widget_class "*GtkText" style "text"
#widget_class "*GtkText" style "text"
widget "main window.*GtkButton*" style "main_button"
widget "*GtkCurve" style "curve"

View File

@ -1689,6 +1689,15 @@ select_clist (GtkWidget *widget,
clist_selected_row = row;
}
void
list_selection_clist (GtkWidget *widget, gpointer data)
{
GList *list;
GtkCListRow *clist_row;
GtkCList *clist;
}
void
create_clist ()
{
@ -2261,6 +2270,7 @@ create_text ()
gtk_widget_show (table);
text = gtk_text_new (NULL, NULL);
gtk_text_set_editable (text, TRUE);
gtk_table_attach_defaults (GTK_TABLE (table), text, 0, 1, 0, 1);
gtk_widget_show (text);
@ -2270,7 +2280,6 @@ create_text ()
gtk_widget_show (hscrollbar);
vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
gtk_widget_set_usize(vscrollbar, 30, -1);
gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 0, 1,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (vscrollbar);
@ -2279,47 +2288,47 @@ create_text ()
gtk_widget_realize (text);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"spencer blah blah blah\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"kimball\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"is\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"a\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"wuss.\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"but\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"josephine\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"(his\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"girlfriend\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"is\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"not).\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"why?\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"because\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"spencer\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"puked\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"last\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"night\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"but\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"josephine\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"did\n", -1);
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->white, NULL,
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"not", -1);
gtk_text_thaw (GTK_TEXT (text));

View File

@ -47,8 +47,8 @@ style "toggle_button" = "button"
style "text"
{
bg_pixmap[NORMAL] = "marble.xpm"
fg[NORMAL] = { 1.0, 1.0, 1.0 }
# bg_pixmap[NORMAL] = "marble.xpm"
# fg[NORMAL] = { 1.0, 1.0, 1.0 }
}
style "ruler"
@ -70,6 +70,6 @@ widget_class "*GtkCheckButton*" style "toggle_button"
widget_class "*GtkRadioButton*" style "toggle_button"
widget_class "*GtkButton*" style "button"
widget_class "*Ruler" style "ruler"
widget_class "*GtkText" style "text"
#widget_class "*GtkText" style "text"
widget "main window.*GtkButton*" style "main_button"
widget "*GtkCurve" style "curve"