aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMike Kestner <mkestner@ximian.com>2003-04-09 03:48:41 +0800
committerMike Kestner <mkestner@src.gnome.org>2003-04-09 03:48:41 +0800
commit122470e9bebdeb3de701fd5f537741a0075a2230 (patch)
tree1d34fbdb676f870271d1b6ace5d0fb37752586f1 /widgets
parentf146a1feb59ccb1a35ff748051b3c0127da72f61 (diff)
downloadgsoc2013-evolution-122470e9bebdeb3de701fd5f537741a0075a2230.tar
gsoc2013-evolution-122470e9bebdeb3de701fd5f537741a0075a2230.tar.gz
gsoc2013-evolution-122470e9bebdeb3de701fd5f537741a0075a2230.tar.bz2
gsoc2013-evolution-122470e9bebdeb3de701fd5f537741a0075a2230.tar.lz
gsoc2013-evolution-122470e9bebdeb3de701fd5f537741a0075a2230.tar.xz
gsoc2013-evolution-122470e9bebdeb3de701fd5f537741a0075a2230.tar.zst
gsoc2013-evolution-122470e9bebdeb3de701fd5f537741a0075a2230.zip
remove e-font.[ch], test-e-font, and test-font-loading. kill
2003-04-08 Mike Kestner <mkestner@ximian.com> * gal/widgets/Makefile.am : remove e-font.[ch], test-e-font, and test-font-loading. * gal/widgets/e-unicode.[ch] (e_utf8_from_gtk_string): kill (e_utf8_from_gtk_string_sized): kill (e_utf8_to_gtk_string): kill (e_utf8_to_gtk_string_sized): kill (e_utf8_gtk_menu_item_new_with_label): kill (e_utf8_gtk_clist_set_text): kill (e_utf8_gtk_clist_append): kill * e-categories-master-list-option-menu.c (ecmlom_ecml_changed): don't use e_utf8_to_gtk_string. * e-categories-master-list-combo (ecmlc_ecml_changed): don't use e_utf8_to_gtk_string. 2003-04-08 Mike Kestner <mkestner@ximian.com> * e-cell-text.c : break e-font dependency svn path=/trunk/; revision=20766
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-unicode.c217
-rw-r--r--widgets/misc/e-unicode.h18
-rw-r--r--widgets/table/e-cell-text.c48
3 files changed, 2 insertions, 281 deletions
diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c
index fb81db1798..d7bd33caa7 100644
--- a/widgets/misc/e-unicode.c
+++ b/widgets/misc/e-unicode.c
@@ -38,7 +38,6 @@
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkmenuitem.h>
-#include "e-font.h"
#include <libxml/xmlmemory.h>
#include <stdlib.h>
#include "gal/util/e-iconv.h"
@@ -406,173 +405,6 @@ e_utf8_to_charset_string (const gchar *charset, const gchar *string)
}
gchar *
-e_utf8_from_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- if (!string) return NULL;
-
- g_return_val_if_fail (widget, NULL);
-
- ic = e_iconv_from_gdk_font (gtk_style_get_font (widget->style));
- if (ic == (iconv_t) -1) {
- XFontStruct *xfs;
- /* If iconv is missing we assume either iso-10646 or iso-8859-1 */
- xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style));
- if (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))) {
- gint i;
- const guchar *ib;
- guchar * ob, * new;
- /* iso-10646 */
- ib = string;
- new = ob = g_new (unsigned char, bytes * 6 + 1);
- for (i = 0; i < (bytes - 1); i += 2) {
- ob += e_unichar_to_utf8 (ib[i] * 256 + ib[i + 1], ob);
- }
- *ob = '\0';
- return new;
- } else {
- gint i;
- /* iso-8859-1 */
- ib = (char *) string;
- new = ob = g_new (unsigned char, bytes * 2 + 1);
- for (i = 0; i < (bytes); i ++) {
- ob += e_unichar_to_utf8 (ib[i], ob);
- }
- *ob = '\0';
- return new;
- }
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 6 + 1);
- obl = ibl * 6;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- *ob = '\0';
-
- e_iconv_close(ic);
-
- return new;
-}
-
-gchar *
-e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_gtk_string_sized (widget, string, strlen (string));
-}
-
-gchar *
-e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- if (!string) return NULL;
-
- g_return_val_if_fail (widget, NULL);
-
- gtk_widget_ensure_style (widget);
- ic = e_iconv_to_gdk_font (gtk_style_get_font (widget->style));
- if (ic == (iconv_t) -1) {
- XFontStruct *xfs;
- gboolean twobyte;
- gint len;
- const gchar *u;
- gunichar uc;
- /* If iconv is missing we assume either iso-10646 or iso-8859-1 */
- xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style));
- twobyte = (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0)));
-
- new = g_new (unsigned char, bytes * 4 + 2);
- u = string;
- len = 0;
-
- while ((u) && (u - string < bytes)) {
- u = e_unicode_get_utf8 (u, &uc);
- if (twobyte) {
- new[len++] = (uc & 0xff00) >> 8;
- }
- new[len++] = uc & 0xff;
- }
-
- new[len++] = '\0';
- if (twobyte)
- new[len] = '\0';
-
- return new;
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 4 + 4);
- obl = ibl * 4;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- /* Make sure to terminate with plenty of padding */
- memset (ob, 0, 4);
-
- e_iconv_close(ic);
-
- return new;
-}
-
-gchar *
-e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_gtk_string_sized (widget, string, strlen (string));
-}
-
-gchar *
e_utf8_from_locale_string_sized (const gchar *string, gint bytes)
{
iconv_t ic;
@@ -673,55 +505,6 @@ e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text)
gtk_entry_set_text (entry, text);
}
-GtkWidget *
-e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, const gchar *label)
-{
- GtkWidget *w;
- gchar *s;
-
- if (!label) return NULL;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) menu, label);
- w = gtk_menu_item_new_with_label (s);
-
- g_free (s);
-
- return w;
-}
-
-void
-e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text)
-{
- gchar *s;
-
- if (!text) return;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) clist, text);
- gtk_clist_set_text (clist, row, col, s);
-
- if (s) g_free (s);
-}
-
-gint
-e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[])
-{
- gint row, i;
- gchar **v;
-
- if (!text) return 0;
-
- v = g_new (gchar *, clist->columns);
- for (i = 0; i < clist->columns; i++)
- v[i] = e_utf8_to_gtk_string ((GtkWidget *) clist, text[i]);
-
- row = gtk_clist_append (clist, v);
-
- for (i = 0; i < clist->columns; i++)
- if (v[i]) g_free (v[i]);
-
- return row;
-}
-
/*
* Translate \U+XXXX\ sequences to utf8 chars
*/
diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h
index 0a3b3ccafe..12c9ef3aa2 100644
--- a/widgets/misc/e-unicode.h
+++ b/widgets/misc/e-unicode.h
@@ -73,16 +73,6 @@ gchar *e_utf8_to_charset_string (const gchar *char
gchar *e_utf8_to_charset_string_sized (const gchar *charset,
const gchar *string,
gint bytes);
-gchar *e_utf8_from_gtk_string (GtkWidget *widget,
- const gchar *string);
-gchar *e_utf8_from_gtk_string_sized (GtkWidget *widget,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_to_gtk_string (GtkWidget *widget,
- const gchar *string);
-gchar *e_utf8_to_gtk_string_sized (GtkWidget *widget,
- const gchar *string,
- gint bytes);
gchar *e_utf8_from_locale_string (const gchar *string);
gchar *e_utf8_from_locale_string_sized (const gchar *string,
gint bytes);
@@ -108,14 +98,6 @@ void e_utf8_gtk_editable_insert_text (GtkEditable *edit
const gchar *text,
gint length,
gint *position);
-GtkWidget *e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu,
- const gchar *label);
-void e_utf8_gtk_clist_set_text (GtkCList *clist,
- gint row,
- gint col,
- const gchar *text);
-gint e_utf8_gtk_clist_append (GtkCList *clist,
- gchar *text[]);
gchar *e_utf8_xml1_decode (const gchar *text);
gchar *e_utf8_xml1_encode (const gchar *text);
gint e_unichar_to_utf8 (gint c,
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index c848a369c1..a22c9d65d3 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -47,7 +47,6 @@
#include "e-cell-text.h"
#include "gal/util/e-util.h"
#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-font.h"
#include "gal/widgets/e-unicode.h"
#include "e-table-item.h"
#include "gal/util/e-text-event-processor.h"
@@ -112,7 +111,6 @@ typedef struct _CellEdit CellEdit;
typedef struct {
ECellView cell_view;
GdkGC *gc;
- EFont *font;
GdkCursor *i_cursor;
GdkBitmap *stipple; /* Stipple for text */
@@ -193,7 +191,6 @@ static void _get_tep (CellEdit *edit);
static gint get_position_from_xy (CellEdit *edit, gint x, gint y);
static gboolean _blink_scroll_timeout (gpointer data);
-static void calc_ellipsis (ECellTextView *text_view);
static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap);
static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec);
@@ -376,22 +373,11 @@ static void
ect_realize (ECellView *ecell_view)
{
ECellTextView *text_view = (ECellTextView *) ecell_view;
- ECellText *ect = (ECellText *) ecell_view->ecell;
text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window);
text_view->i_cursor = gdk_cursor_new (GDK_XTERM);
- if (ect->font_name){
- text_view->font = e_font_from_gdk_name (ect->font_name);
- }
- if (!text_view->font){
- gdk_font_ref (gtk_style_get_font (GTK_WIDGET (text_view->canvas)->style));
- text_view->font = e_font_from_gdk_font (gtk_style_get_font (GTK_WIDGET (text_view->canvas)->style));
- }
-
- calc_ellipsis (text_view);
-
if (parent_class->realize)
(* parent_class->realize) (ecell_view);
}
@@ -413,10 +399,6 @@ ect_unrealize (ECellView *ecv)
ect_cancel_edit (text_view);
}
- if (text_view->font)
- e_font_unref (text_view->font);
- text_view->font = NULL;
-
if (text_view->stipple)
gdk_bitmap_unref (text_view->stipple);
@@ -1294,7 +1276,6 @@ ect_show_tooltip (ECellView *ecell_view,
tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
e_text_get_type (),
"anchor", GTK_ANCHOR_NW,
-/* "font_gdk", text_view->font, */
"bold", (gboolean) ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row),
"strikeout", (gboolean) ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row),
"underline", (gboolean) ect->underline_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row),
@@ -1555,7 +1536,7 @@ E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, e_cell_
/**
* e_cell_text_construct:
* @cell: The cell to construct
- * @fontname: font to be used to render on the screen
+ * @fontname: this param is no longer used, but left here for api stability
* @justify: Justification of the string in the cell
*
* constructs the ECellText. To be used by subclasses and language
@@ -1573,7 +1554,7 @@ e_cell_text_construct (ECellText *cell, const char *fontname, GtkJustification j
/**
* e_cell_text_new:
- * @fontname: font to be used to render on the screen
+ * @fontname: this param is no longer used, but left here for api stability
* @justify: Justification of the string in the cell.
*
* Creates a new ECell renderer that can be used to render strings that
@@ -1730,14 +1711,11 @@ _get_position (ECellTextView *text_view, ETextEventProcessorCommand *command)
{
int length;
CellEdit *edit = text_view->edit;
- EFont *font;
gchar *p;
int unival;
int index;
int trailing;
- font = text_view->font;
-
switch (command->position) {
case E_TEP_VALUE:
@@ -1982,10 +1960,7 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand *
gboolean redraw = FALSE;
int sel_start, sel_end;
- EFont *font;
- font = text_view->font;
-
/* If the EText isn't editable, then ignore any commands that would
modify the text. */
if (!ect->editable && (command->action == E_TEP_DELETE
@@ -2269,25 +2244,6 @@ _get_tep (CellEdit *edit)
}
}
-static void
-calc_ellipsis (ECellTextView *text_view)
-{
- ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell);
- EFont *font;
-
- font = text_view->font;
- if (font) {
- text_view->ellipsis_width[E_FONT_PLAIN] =
- e_font_utf8_text_width (font, E_FONT_PLAIN,
- ect->ellipsis ? ect->ellipsis : "...",
- ect->ellipsis ? strlen (ect->ellipsis) : 3);
- text_view->ellipsis_width[E_FONT_BOLD] =
- e_font_utf8_text_width (font, E_FONT_BOLD,
- ect->ellipsis ? ect->ellipsis : "...",
- ect->ellipsis ? strlen (ect->ellipsis) : 3);
- }
-}
-
static GdkColor*
e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec)
{