+2002-12-13 [christoph] 0.8.6claws107
+
+ * src/Makefile.am
+ * src/compose.c
+ * src/gtkstext.[ch] ** REMOVE **
+ * src/gtkutils.[ch]
+ * src/textview.c
+ * src/gtk/gtkstext.[ch] ** NEW **
+ * src/gtk/Makefile.am
+ o move stext functions to gtkstext.c to remove
+ dependency of gtkutils
+ o move gtkstext files to common
+
+ * src/gtk/Makefile.am
+ * src/gtk/sslcertwindow.[ch]
+ UI stuff can always depend on common code so
+ it's ok to add ../common to include path
+
2002-12-13 [colin] 0.8.6claws106
* src/summaryview.c
MICRO_VERSION=6
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws106
+EXTRA_VERSION=claws107
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
procheader.c procheader.h \
compose.c compose.h \
gtkshruler.c gtkshruler.h \
- gtkstext.c gtkstext.h \
menu.c menu.h \
stock_pixmap.c stock_pixmap.h \
prefs.c prefs.h \
/* skip delete if it is continuous URL */
if (do_delete && (line_pos - p_pos <= i_len) &&
- gtkut_stext_is_uri_string(text, line_pos, tlen))
+ gtk_stext_is_uri_string(text, line_pos, tlen))
do_delete = FALSE;
#ifdef WRAP_DEBUG
indent string, delete them */
if (i_len) {
guint ilen;
- ilen = gtkut_stext_str_compare_n
+ ilen = gtk_stext_str_compare_n
(text, cur_pos, p_pos, i_len,
tlen);
if (ilen) {
#endif
/* force wrapping if it is one long word but not URL */
if (line_pos - p_pos <= i_len)
- if (!gtkut_stext_is_uri_string
+ if (!gtk_stext_is_uri_string
(text, line_pos, tlen))
line_pos = cur_pos - 1;
#ifdef WRAP_DEBUG
/* if next character is space delete it */
if (clen == 1 && isspace(*cbuf)) {
if (p_pos + i_len != line_pos ||
- !gtkut_stext_is_uri_string
+ !gtk_stext_is_uri_string
(text, line_pos, tlen)) {
STEXT_FREEZE();
/* workaround for correct cursor
/* if it is URL at beginning of line don't wrap */
if (p_pos + i_len == line_pos &&
- gtkut_stext_is_uri_string(text, line_pos, tlen)) {
+ gtk_stext_is_uri_string(text, line_pos, tlen)) {
#ifdef WRAP_DEBUG
g_print("found URL at ");
dump_text(text, line_pos, tlen, 1);
/* should we insert quotation ? */
if (linewrap_quote && i_len) {
/* only if line is not already quoted */
- if (!gtkut_stext_str_compare
+ if (!gtk_stext_str_compare
(text, line_pos, tlen, qfmt)) {
guint ins_len;
libsylpheedgtk_la_SOURCES = \
gtksctree.c gtksctree.h \
+ gtkstext.c gtkstext.h \
sslcertwindow.c sslcertwindow.h
INCLUDES = \
+ -I../common \
$(GTK_CFLAGS)
libsylpheedgtk_la_LIBADD = \
#include <ctype.h>
#include <string.h>
+
#include <gdk/gdkkeysyms.h>
#include <gdk/gdki18n.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkselection.h>
#include <gtk/gtksignal.h>
-/* #include "compose.h" */
#include "gtkstext.h"
-#include "gtkutils.h"
+#include "utils.h"
/* line_arrow.xbm */
#define line_arrow_width 6
if (lp.end.index == lp.start.index)
{
/* SYLPHEED: don't wrap URLs */
- if (gtkut_stext_is_uri_string(text, lp.end.index,
+ if (gtk_stext_is_uri_string(text, lp.end.index,
gtk_stext_get_length(text)))
{
lp.end = saved_mark;
text->wrap_rmargin = rmargin >= 0 ? rmargin : 0;
}
+gboolean gtk_stext_match_string(GtkSText *text, gint pos, wchar_t *wcs,
+ gint len, gboolean case_sens)
+{
+ gint match_count = 0;
+
+ for (; match_count < len; pos++, match_count++) {
+ if (case_sens) {
+ if (GTK_STEXT_INDEX(text, pos) != wcs[match_count])
+ break;
+ } else {
+ if (towlower(GTK_STEXT_INDEX(text, pos)) !=
+ towlower(wcs[match_count]))
+ break;
+ }
+ }
+
+ if (match_count == len)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+guint gtk_stext_str_compare_n(GtkSText *text, guint pos1, guint pos2,
+ guint len, guint text_len)
+{
+ guint i;
+ GdkWChar ch1, ch2;
+
+ for (i = 0; i < len && pos1 + i < text_len && pos2 + i < text_len; i++) {
+ ch1 = GTK_STEXT_INDEX(text, pos1 + i);
+ ch2 = GTK_STEXT_INDEX(text, pos2 + i);
+ if (ch1 != ch2)
+ break;
+ }
+
+ return i;
+}
+
+guint gtk_stext_str_compare(GtkSText *text, guint start_pos, guint text_len,
+ const gchar *str)
+{
+ wchar_t *wcs;
+ guint len;
+ gboolean result;
+
+ if (!str) return 0;
+
+ wcs = strdup_mbstowcs(str);
+ if (!wcs) return 0;
+ len = wcslen(wcs);
+
+ if (len > text_len - start_pos)
+ result = FALSE;
+ else
+ result = gtk_stext_match_string(text, start_pos, wcs, len,
+ TRUE);
+
+ g_free(wcs);
+
+ return result ? len : 0;
+}
+
+gboolean gtk_stext_is_uri_string(GtkSText *text,
+ guint start_pos, guint text_len)
+{
+ if (gtk_stext_str_compare(text, start_pos, text_len, "http://") ||
+ gtk_stext_str_compare(text, start_pos, text_len, "ftp://") ||
+ gtk_stext_str_compare(text, start_pos, text_len, "https://") ||
+ gtk_stext_str_compare(text, start_pos, text_len, "www."))
+ return TRUE;
+
+ return FALSE;
+}
+
+void gtk_stext_clear(GtkSText *text)
+{
+ gtk_stext_freeze(text);
+ gtk_stext_set_point(text, 0);
+ gtk_stext_forward_delete(text, gtk_stext_get_length(text));
+ gtk_stext_thaw(text);
+}
+
/**********************************************************************/
/* Debug */
/**********************************************************************/
#ifndef __GTK_STEXT_H__
#define __GTK_STEXT_H__
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if (HAVE_WCTYPE_H && HAVE_WCHAR_H)
+# include <wchar.h>
+# include <wctype.h>
+#endif
#include <gdk/gdk.h>
#include <gtk/gtkadjustment.h>
* behaviour */
void gtk_stext_set_wrap_rmargin (GtkSText *text, gint rmargin);
+/* gtk stext functions */
+gboolean gtk_stext_match_string (GtkSText *text,
+ gint pos,
+ wchar_t *wcs,
+ gint len,
+ gboolean case_sens);
+guint gtk_stext_str_compare_n (GtkSText *text,
+ guint pos1,
+ guint pos2,
+ guint len,
+ guint text_len);
+guint gtk_stext_str_compare (GtkSText *text,
+ guint start_pos,
+ guint text_len,
+ const gchar *str);
+gboolean gtk_stext_is_uri_string (GtkSText *text,
+ guint start_pos,
+ guint text_len);
+void gtk_stext_clear (GtkSText *text);
+
+
#define GTK_STEXT_INDEX(t, index) (((t)->use_wchar) \
? ((index) < (t)->gap_position ? (t)->text.wc[index] : \
#include <openssl/ssl.h>
#include <glib.h>
#include <gtk/gtk.h>
-#include "../common/intl.h"
-#include "../common/ssl_certificate.h"
-#include "../common/utils.h"
+#include "intl.h"
+#include "ssl_certificate.h"
+#include "utils.h"
#include "../alertpanel.h"
-#include "../common/hooks.h"
+#include "hooks.h"
static void toggle_cert_cb(GtkWidget *widget,
gpointer data);
#include <openssl/objects.h>
#include <glib.h>
#include <gtk/gtk.h>
-#include "../common/ssl_certificate.h"
+#include "ssl_certificate.h"
GtkWidget *cert_presenter(SSLCertificate *cert);
void sslcertwindow_show_cert(SSLCertificate *cert);
gtk_container_remove(container, widget);
}
-gboolean gtkut_stext_match_string(GtkSText *text, gint pos, wchar_t *wcs,
- gint len, gboolean case_sens)
-{
- gint match_count = 0;
-
- for (; match_count < len; pos++, match_count++) {
- if (case_sens) {
- if (GTK_STEXT_INDEX(text, pos) != wcs[match_count])
- break;
- } else {
- if (towlower(GTK_STEXT_INDEX(text, pos)) !=
- towlower(wcs[match_count]))
- break;
- }
- }
-
- if (match_count == len)
- return TRUE;
- else
- return FALSE;
-}
-
-guint gtkut_stext_str_compare_n(GtkSText *text, guint pos1, guint pos2,
- guint len, guint text_len)
-{
- guint i;
- GdkWChar ch1, ch2;
-
- for (i = 0; i < len && pos1 + i < text_len && pos2 + i < text_len; i++) {
- ch1 = GTK_STEXT_INDEX(text, pos1 + i);
- ch2 = GTK_STEXT_INDEX(text, pos2 + i);
- if (ch1 != ch2)
- break;
- }
-
- return i;
-}
-
-guint gtkut_stext_str_compare(GtkSText *text, guint start_pos, guint text_len,
- const gchar *str)
-{
- wchar_t *wcs;
- guint len;
- gboolean result;
-
- if (!str) return 0;
-
- wcs = strdup_mbstowcs(str);
- if (!wcs) return 0;
- len = wcslen(wcs);
-
- if (len > text_len - start_pos)
- result = FALSE;
- else
- result = gtkut_stext_match_string(text, start_pos, wcs, len,
- TRUE);
-
- g_free(wcs);
-
- return result ? len : 0;
-}
-
-gboolean gtkut_stext_is_uri_string(GtkSText *text,
- guint start_pos, guint text_len)
-{
- if (gtkut_stext_str_compare(text, start_pos, text_len, "http://") ||
- gtkut_stext_str_compare(text, start_pos, text_len, "ftp://") ||
- gtkut_stext_str_compare(text, start_pos, text_len, "https://") ||
- gtkut_stext_str_compare(text, start_pos, text_len, "www."))
- return TRUE;
-
- return FALSE;
-}
-
-void gtk_stext_clear(GtkSText *text)
-{
- gtk_stext_freeze(text);
- gtk_stext_set_point(text, 0);
- gtk_stext_forward_delete(text, gtk_stext_get_length(text));
- gtk_stext_thaw(text);
-}
-
void gtkut_widget_disable_theme_engine(GtkWidget *widget)
{
GtkStyle *style, *new_style;
void gtkut_container_remove (GtkContainer *container,
GtkWidget *widget);
-gboolean gtkut_stext_match_string (GtkSText *text,
- gint pos,
- wchar_t *wcs,
- gint len,
- gboolean case_sens);
-guint gtkut_stext_str_compare_n (GtkSText *text,
- guint pos1,
- guint pos2,
- guint len,
- guint text_len);
-guint gtkut_stext_str_compare (GtkSText *text,
- guint start_pos,
- guint text_len,
- const gchar *str);
-gboolean gtkut_stext_is_uri_string (GtkSText *text,
- guint start_pos,
- guint text_len);
-void gtk_stext_clear (GtkSText *text);
-
void gtkut_widget_disable_theme_engine (GtkWidget *widget);
void gtkut_widget_wait_for_draw (GtkWidget *widget);
void gtkut_widget_get_uposition (GtkWidget *widget,
for (; pos < text_len; pos++) {
if (text_len - pos < len) break;
- if (gtkut_stext_match_string(text, pos, wcs, len, case_sens)
+ if (gtk_stext_match_string(text, pos, wcs, len, case_sens)
== TRUE) {
gtk_widget_hide(GTK_WIDGET(textview->scrolledwin));
gtk_editable_set_position(GTK_EDITABLE(text),
pos = text_len - len;
for (; pos >= textview->body_pos; pos--) {
- if (gtkut_stext_match_string(text, pos, wcs, len, case_sens)
+ if (gtk_stext_match_string(text, pos, wcs, len, case_sens)
== TRUE) {
gtk_editable_set_position(GTK_EDITABLE(text), pos);
gtk_editable_select_region(GTK_EDITABLE(text),