Mercurial > dwindows
comparison gtk3/dw.c @ 994:f1c7b03f944d
Removed carriage return stripping from GTK3, it is not needed.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 07 May 2011 19:46:58 +0000 |
parents | 87dc0f5f96d0 |
children | f019c5e8511f |
comparison
equal
deleted
inserted
replaced
993:98d73c9e81fc | 994:f1c7b03f944d |
---|---|
4265 g_list_free(orig); | 4265 g_list_free(orig); |
4266 DW_MUTEX_UNLOCK; | 4266 DW_MUTEX_UNLOCK; |
4267 return 0L; | 4267 return 0L; |
4268 } | 4268 } |
4269 | 4269 |
4270 void _strip_cr(char *dest, char *src) | |
4271 { | |
4272 int z, x = 0; | |
4273 | |
4274 for(z=0;z<strlen(src);z++) | |
4275 { | |
4276 if(src[z] != '\r') | |
4277 { | |
4278 dest[x] = src[z]; | |
4279 x++; | |
4280 } | |
4281 } | |
4282 dest[x] = 0; | |
4283 } | |
4284 | |
4285 /* | 4270 /* |
4286 * Adds text to an MLE box and returns the current point. | 4271 * Adds text to an MLE box and returns the current point. |
4287 * Parameters: | 4272 * Parameters: |
4288 * handle: Handle to the MLE to be queried. | 4273 * handle: Handle to the MLE to be queried. |
4289 * buffer: Text buffer to be imported. | 4274 * buffer: Text buffer to be imported. |
4299 { | 4284 { |
4300 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); | 4285 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); |
4301 | 4286 |
4302 if(tmp && GTK_IS_TEXT_VIEW(tmp)) | 4287 if(tmp && GTK_IS_TEXT_VIEW(tmp)) |
4303 { | 4288 { |
4304 char *impbuf = malloc(strlen(buffer)+1); | |
4305 GtkTextBuffer *tbuffer; | 4289 GtkTextBuffer *tbuffer; |
4306 GtkTextIter iter; | 4290 GtkTextIter iter; |
4307 | |
4308 _strip_cr(impbuf, buffer); | |
4309 | 4291 |
4310 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); | 4292 tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tmp)); |
4311 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, startpoint); | 4293 gtk_text_buffer_get_iter_at_offset(tbuffer, &iter, startpoint); |
4312 gtk_text_buffer_place_cursor(tbuffer, &iter); | 4294 gtk_text_buffer_place_cursor(tbuffer, &iter); |
4313 gtk_text_buffer_insert_at_cursor(tbuffer, impbuf, -1); | 4295 gtk_text_buffer_insert_at_cursor(tbuffer, buffer, -1); |
4314 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(impbuf); | 4296 tmppoint = (startpoint > -1 ? startpoint : 0) + strlen(buffer); |
4315 free(impbuf); | |
4316 } | 4297 } |
4317 } | 4298 } |
4318 DW_MUTEX_UNLOCK; | 4299 DW_MUTEX_UNLOCK; |
4319 return tmppoint; | 4300 return tmppoint; |
4320 } | 4301 } |