comparison gtk/dw.c @ 993:98d73c9e81fc

Remove carriage return stripping for GTK2... it is only needed in GTK1.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 07 May 2011 19:44:51 +0000
parents 87dc0f5f96d0
children f019c5e8511f
comparison
equal deleted inserted replaced
992:2d80b4dcff9a 993:98d73c9e81fc
4672 g_list_free(orig); 4672 g_list_free(orig);
4673 DW_MUTEX_UNLOCK; 4673 DW_MUTEX_UNLOCK;
4674 return 0L; 4674 return 0L;
4675 } 4675 }
4676 4676
4677 #if GTK_MAJOR_VERSION < 2
4677 void _strip_cr(char *dest, char *src) 4678 void _strip_cr(char *dest, char *src)
4678 { 4679 {
4679 int z, x = 0; 4680 int z, x = 0;
4680 4681
4681 for(z=0;z<strlen(src);z++) 4682 for(z=0;z<strlen(src);z++)
4686 x++; 4687 x++;
4687 } 4688 }
4688 } 4689 }
4689 dest[x] = 0; 4690 dest[x] = 0;
4690 } 4691 }
4692 #endif
4691 4693
4692 /* 4694 /*
4693 * Adds text to an MLE box and returns the current point. 4695 * Adds text to an MLE box and returns the current point.
4694 * Parameters: 4696 * Parameters:
4695 * handle: Handle to the MLE to be queried. 4697 * handle: Handle to the MLE to be queried.
4711 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle)); 4713 GtkWidget *tmp = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle));
4712 4714
4713 #if GTK_MAJOR_VERSION > 1 4715 #if GTK_MAJOR_VERSION > 1
4714 if(tmp && GTK_IS_TEXT_VIEW(tmp)) 4716 if(tmp && GTK_IS_TEXT_VIEW(tmp))
4715 { 4717 {
4716 char *impbuf = malloc(strlen(buffer)+1);
4717 GtkTextBuffer *tbuffer; 4718 GtkTextBuffer *tbuffer;
4718 GtkTextIter iter; 4719 GtkTextIter iter;
4719
4720 _strip_cr(impbuf, buffer);
4721 4720
4722 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); 4721 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp));
4723 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, startpoint); 4722 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, startpoint);
4724 gtk_text_buffer_place_cursor(tbuffer, &iter); 4723 gtk_text_buffer_place_cursor(tbuffer, &iter);
4725 gtk_text_buffer_insert_at_cursor(tbuffer, impbuf, -1); 4724 gtk_text_buffer_insert_at_cursor(tbuffer, buffer, -1);
4726 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(impbuf); 4725 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(buffer);
4727 free(impbuf);
4728 } 4726 }
4729 #else 4727 #else
4730 GdkFont *font = (GdkFont *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_gdkfont"); 4728 GdkFont *font = (GdkFont *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_gdkfont");
4731 4729
4732 if(tmp && GTK_IS_TEXT(tmp)) 4730 if(tmp && GTK_IS_TEXT(tmp))