diff options
author | Pixel <pixel@nobis-crew.org> | 2010-06-15 00:59:57 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2010-06-15 00:59:57 -0700 |
commit | eed0eb6a476d54ce19aeff137984aa981d9e3976 (patch) | |
tree | 807891636efd2f87dcbd261e971216269973ae07 /iup/src/gtk/iupgtk_text.c | |
parent | ccc8261e4d48de89da4ddfe7b55e378ae0cd6f47 (diff) |
Upgrading to iup 3.1
Diffstat (limited to 'iup/src/gtk/iupgtk_text.c')
-rwxr-xr-x | iup/src/gtk/iupgtk_text.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/iup/src/gtk/iupgtk_text.c b/iup/src/gtk/iupgtk_text.c index 4c2906a..d0909d7 100755 --- a/iup/src/gtk/iupgtk_text.c +++ b/iup/src/gtk/iupgtk_text.c @@ -101,7 +101,7 @@ static void gtkTextParseParagraphFormat(Ihandle* formattag, GtkTextTag* tag) align = PANGO_TAB_LEFT; free(str); - pango_tab_array_set_tab(tabs, i, align, IUPGTK_PIXELS2PANGOUNITS(pos)); + pango_tab_array_set_tab(tabs, i, align, iupGTK_PIXELS2PANGOUNITS(pos)); i++; if (i == 32) break; } @@ -171,7 +171,7 @@ static void gtkTextParseCharacterFormat(Ihandle* formattag, GtkTextTag* tag) else iupStrToInt(format, &val); - val = IUPGTK_PIXELS2PANGOUNITS(val); + val = iupGTK_PIXELS2PANGOUNITS(val); g_object_set(G_OBJECT(tag), "rise", val, NULL); } @@ -214,7 +214,7 @@ static void gtkTextParseCharacterFormat(Ihandle* formattag, GtkTextTag* tag) { if (val < 0) /* in pixels */ { - val = IUPGTK_PIXELS2PANGOUNITS(-val); + val = iupGTK_PIXELS2PANGOUNITS(-val); g_object_set(G_OBJECT(tag), "size", val, NULL); } else /* in points */ @@ -387,8 +387,8 @@ static int gtkTextConvertXYToPos(Ihandle* ih, int x, int y) /* transform to Layout coordinates */ gtk_entry_get_layout_offsets(GTK_ENTRY(ih->handle), &off_x, &off_y); - x = IUPGTK_PIXELS2PANGOUNITS(x - off_x); - y = IUPGTK_PIXELS2PANGOUNITS(y - off_y); + x = iupGTK_PIXELS2PANGOUNITS(x - off_x); + y = iupGTK_PIXELS2PANGOUNITS(y - off_y); pango_layout_xy_to_index(gtk_entry_get_layout(GTK_ENTRY(ih->handle)), x, y, &pos, &trailing); return pos; @@ -851,7 +851,7 @@ static char* gtkTextGetValueAttrib(Ihandle* ih) static int gtkTextSetInsertAttrib(Ihandle* ih, const char* value) { - if (!ih->handle) /* do not store the action before map */ + if (!ih->handle) /* do not do the action before map */ return 0; if (!value) return 0; @@ -875,7 +875,8 @@ static int gtkTextSetInsertAttrib(Ihandle* ih, const char* value) static int gtkTextSetAppendAttrib(Ihandle* ih, const char* value) { - if (!ih->handle) /* do not store the action before map */ + gint pos; + if (!ih->handle) /* do not do the action before map */ return 0; /* disable callbacks */ iupAttribSetStr(ih, "_IUPGTK_DISABLE_TEXT_CB", "1"); @@ -884,13 +885,18 @@ static int gtkTextSetAppendAttrib(Ihandle* ih, const char* value) GtkTextIter iter; GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ih->handle)); gtk_text_buffer_get_end_iter(buffer, &iter); - if (ih->data->append_newline) + pos = gtk_text_buffer_get_char_count(buffer); + if (ih->data->append_newline && pos!=0) gtk_text_buffer_insert(buffer, &iter, "\n", 1); gtk_text_buffer_insert(buffer, &iter, iupgtkStrConvertToUTF8(value), -1); } else { - gint pos = strlen(gtk_entry_get_text(GTK_ENTRY(ih->handle)))+1; +#if GTK_CHECK_VERSION(2, 14, 0) + pos = gtk_entry_get_text_length(GTK_ENTRY(ih->handle))+1; +#else + pos = strlen(gtk_entry_get_text(GTK_ENTRY(ih->handle)))+1; +#endif gtk_editable_insert_text(GTK_EDITABLE(ih->handle), iupgtkStrConvertToUTF8(value), -1, &pos); } iupAttribSetStr(ih, "_IUPGTK_DISABLE_TEXT_CB", NULL); @@ -946,8 +952,10 @@ static int gtkTextSetPaddingAttrib(Ihandle* ih, const char* value) gtk_entry_set_inner_border(GTK_ENTRY(ih->handle), &border); #endif } + return 0; } - return 0; + else + return 1; /* store until not mapped, when mapped will be set again */ } static int gtkTextSetNCAttrib(Ihandle* ih, const char* value) @@ -955,10 +963,14 @@ static int gtkTextSetNCAttrib(Ihandle* ih, const char* value) if (!iupStrToInt(value, &ih->data->nc)) ih->data->nc = INT_MAX; - if (!ih->data->is_multiline && ih->handle) - gtk_entry_set_max_length(GTK_ENTRY(ih->handle), ih->data->nc); - - return 0; + if (ih->handle) + { + if (!ih->data->is_multiline) + gtk_entry_set_max_length(GTK_ENTRY(ih->handle), ih->data->nc); + return 0; + } + else + return 1; /* store until not mapped, when mapped will be set again */ } static int gtkTextSetClipboardAttrib(Ihandle *ih, const char *value) |