1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "gdk/gdkkeysyms.h"
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
#include "gdk/gdki18n.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkmain.h"
|
1998-03-01 05:11:05 +00:00
|
|
|
#include "gtkselection.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtksignal.h"
|
|
|
|
#include "gtktext.h"
|
|
|
|
#include "line-wrap.xbm"
|
|
|
|
#include "line-arrow.xbm"
|
|
|
|
|
|
|
|
|
|
|
|
#define INITIAL_BUFFER_SIZE 1024
|
|
|
|
#define INITIAL_LINE_CACHE_SIZE 256
|
|
|
|
#define MIN_GAP_SIZE 256
|
|
|
|
#define LINE_DELIM '\n'
|
|
|
|
#define MIN_TEXT_WIDTH_LINES 20
|
|
|
|
#define MIN_TEXT_HEIGHT_LINES 10
|
1998-03-08 21:47:14 +00:00
|
|
|
#define TEXT_BORDER_ROOM 1
|
1997-11-24 22:37:52 +00:00
|
|
|
#define LINE_WRAP_ROOM 8 /* The bitmaps are 6 wide. */
|
|
|
|
#define DEFAULT_TAB_STOP_WIDTH 4
|
|
|
|
#define SCROLL_PIXELS 5
|
|
|
|
#define KEY_SCROLL_PIXELS 10
|
1998-03-07 03:05:36 +00:00
|
|
|
#define SCROLL_TIME 100
|
1998-03-10 03:17:02 +00:00
|
|
|
#define FREEZE_LENGTH 1024
|
|
|
|
/* Freeze text when inserting or deleting more than this many characters */
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
#define SET_PROPERTY_MARK(m, p, o) do { \
|
|
|
|
(m)->property = (p); \
|
|
|
|
(m)->offset = (o); \
|
|
|
|
} while (0)
|
|
|
|
#define MARK_CURRENT_PROPERTY(mark) ((TextProperty*)(mark)->property->data)
|
|
|
|
#define MARK_NEXT_PROPERTY(mark) ((TextProperty*)(mark)->property->next->data)
|
|
|
|
#define MARK_PREV_PROPERTY(mark) ((TextProperty*)((mark)->property->prev ? \
|
|
|
|
(mark)->property->prev->data \
|
|
|
|
: NULL))
|
|
|
|
#define MARK_PREV_LIST_PTR(mark) ((mark)->property->prev)
|
|
|
|
#define MARK_LIST_PTR(mark) ((mark)->property)
|
|
|
|
#define MARK_NEXT_LIST_PTR(mark) ((mark)->property->next)
|
|
|
|
#define MARK_OFFSET(mark) ((mark)->offset)
|
|
|
|
#define MARK_PROPERTY_LENGTH(mark) (MARK_CURRENT_PROPERTY(mark)->length)
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
#define MARK_CURRENT_FONT(text, mark) \
|
|
|
|
((MARK_CURRENT_PROPERTY(mark)->flags & PROPERTY_FONT) ? \
|
|
|
|
MARK_CURRENT_PROPERTY(mark)->font->gdk_font : \
|
|
|
|
GTK_WIDGET (text)->style->font)
|
|
|
|
#define MARK_CURRENT_FORE(text, mark) \
|
|
|
|
((MARK_CURRENT_PROPERTY(mark)->flags & PROPERTY_FOREGROUND) ? \
|
|
|
|
&MARK_CURRENT_PROPERTY(mark)->fore_color : \
|
|
|
|
&((GtkWidget *)text)->style->text[((GtkWidget *)text)->state])
|
|
|
|
#define MARK_CURRENT_BACK(text, mark) \
|
|
|
|
((MARK_CURRENT_PROPERTY(mark)->flags & PROPERTY_BACKGROUND) ? \
|
|
|
|
&MARK_CURRENT_PROPERTY(mark)->back_color : \
|
|
|
|
&((GtkWidget *)text)->style->base[((GtkWidget *)text)->state])
|
|
|
|
#define MARK_CURRENT_TEXT_FONT(text, mark) \
|
|
|
|
((MARK_CURRENT_PROPERTY(mark)->flags & PROPERTY_FONT) ? \
|
|
|
|
MARK_CURRENT_PROPERTY(mark)->font : \
|
|
|
|
text->current_font)
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#define TEXT_LENGTH(t) ((t)->text_end - (t)->gap_size)
|
|
|
|
#define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
|
|
|
|
#define LINE_HEIGHT(l) ((l).font_ascent + (l).font_descent)
|
|
|
|
#define LINE_CONTAINS(l, i) ((l).start.index <= (i) && (l).end.index >= (i))
|
|
|
|
#define LINE_STARTS_AT(l, i) ((l).start.index == (i))
|
|
|
|
#define LINE_START_PIXEL(l) ((l).tab_cont.pixel_offset)
|
|
|
|
#define LAST_INDEX(t, m) ((m).index == TEXT_LENGTH(t))
|
|
|
|
#define CACHE_DATA(c) (*(LineParams*)(c)->data)
|
|
|
|
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
enum {
|
|
|
|
ARG_0,
|
|
|
|
ARG_HADJUSTMENT,
|
|
|
|
ARG_VADJUSTMENT,
|
|
|
|
ARG_LINE_WRAP,
|
|
|
|
ARG_WORD_WRAP
|
|
|
|
};
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
typedef struct _TextProperty TextProperty;
|
|
|
|
typedef struct _TabStopMark TabStopMark;
|
|
|
|
typedef struct _PrevTabCont PrevTabCont;
|
|
|
|
typedef struct _FetchLinesData FetchLinesData;
|
|
|
|
typedef struct _LineParams LineParams;
|
|
|
|
typedef struct _SetVerticalScrollData SetVerticalScrollData;
|
|
|
|
|
|
|
|
typedef gint (*LineIteratorFunction) (GtkText* text, LineParams* lp, void* data);
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
FetchLinesPixels,
|
|
|
|
FetchLinesCount
|
|
|
|
} FLType;
|
|
|
|
|
|
|
|
struct _SetVerticalScrollData {
|
|
|
|
gint pixel_height;
|
|
|
|
gint last_didnt_wrap;
|
|
|
|
gint last_line_start;
|
|
|
|
GtkPropertyMark mark;
|
|
|
|
};
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
struct _GtkTextFont
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
/* The actual font. */
|
|
|
|
GdkFont *gdk_font;
|
1998-08-25 00:06:38 +00:00
|
|
|
guint ref_count;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gint16 char_widths[256];
|
|
|
|
};
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
typedef enum {
|
|
|
|
PROPERTY_FONT = 1 << 0,
|
|
|
|
PROPERTY_FOREGROUND = 1 << 1,
|
|
|
|
PROPERTY_BACKGROUND = 1 << 2
|
|
|
|
} TextPropertyFlags;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
struct _TextProperty
|
|
|
|
{
|
|
|
|
/* Font. */
|
1998-08-25 00:06:38 +00:00
|
|
|
GtkTextFont* font;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Background Color. */
|
1998-01-30 23:47:09 +00:00
|
|
|
GdkColor back_color;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Foreground Color. */
|
1998-01-30 23:47:09 +00:00
|
|
|
GdkColor fore_color;
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
/* Show which properties are set */
|
|
|
|
TextPropertyFlags flags;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Length of this property. */
|
|
|
|
guint length;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _TabStopMark
|
|
|
|
{
|
|
|
|
GList* tab_stops; /* Index into list containing the next tab position. If
|
|
|
|
* NULL, using default widths. */
|
|
|
|
gint to_next_tab;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _PrevTabCont
|
|
|
|
{
|
|
|
|
guint pixel_offset;
|
|
|
|
TabStopMark tab_start;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _FetchLinesData
|
|
|
|
{
|
|
|
|
GList* new_lines;
|
|
|
|
FLType fl_type;
|
|
|
|
gint data;
|
|
|
|
gint data_max;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _LineParams
|
|
|
|
{
|
|
|
|
guint font_ascent;
|
|
|
|
guint font_descent;
|
|
|
|
guint pixel_width;
|
|
|
|
guint displayable_chars;
|
|
|
|
guint wraps : 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
PrevTabCont tab_cont;
|
|
|
|
PrevTabCont tab_cont_next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkPropertyMark start;
|
|
|
|
GtkPropertyMark end;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void gtk_text_class_init (GtkTextClass *klass);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
static void gtk_text_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
|
|
|
static void gtk_text_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_text_init (GtkText *text);
|
1998-03-07 03:05:36 +00:00
|
|
|
static void gtk_text_destroy (GtkObject *object);
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
static void gtk_text_finalize (GObject *object);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_text_realize (GtkWidget *widget);
|
|
|
|
static void gtk_text_unrealize (GtkWidget *widget);
|
1998-05-10 02:46:20 +00:00
|
|
|
static void gtk_text_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *previous_style);
|
2000-03-14 19:57:25 +00:00
|
|
|
static void gtk_text_state_changed (GtkWidget *widget,
|
|
|
|
GtkStateType previous_state);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void gtk_text_draw_focus (GtkWidget *widget);
|
|
|
|
static void gtk_text_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition);
|
|
|
|
static void gtk_text_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
static void gtk_text_adjustment (GtkAdjustment *adjustment,
|
|
|
|
GtkText *text);
|
|
|
|
static void gtk_text_disconnect (GtkAdjustment *adjustment,
|
|
|
|
GtkText *text);
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
static void gtk_text_insert_text (GtkEditable *editable,
|
|
|
|
const gchar *new_text,
|
|
|
|
gint new_text_length,
|
|
|
|
gint *position);
|
|
|
|
static void gtk_text_delete_text (GtkEditable *editable,
|
|
|
|
gint start_pos,
|
|
|
|
gint end_pos);
|
|
|
|
static void gtk_text_update_text (GtkEditable *editable,
|
|
|
|
gint start_pos,
|
|
|
|
gint end_pos);
|
|
|
|
static gchar *gtk_text_get_chars (GtkEditable *editable,
|
|
|
|
gint start,
|
|
|
|
gint end);
|
|
|
|
static void gtk_text_set_selection (GtkEditable *editable,
|
|
|
|
gint start,
|
|
|
|
gint end);
|
|
|
|
static void gtk_text_real_set_editable (GtkEditable *editable,
|
|
|
|
gboolean is_editable);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Event handlers */
|
|
|
|
static void gtk_text_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area);
|
|
|
|
static gint gtk_text_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
|
|
|
static gint gtk_text_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
static gint gtk_text_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
static gint gtk_text_motion_notify (GtkWidget *widget,
|
|
|
|
GdkEventMotion *event);
|
|
|
|
static gint gtk_text_key_press (GtkWidget *widget,
|
|
|
|
GdkEventKey *event);
|
|
|
|
static gint gtk_text_focus_in (GtkWidget *widget,
|
|
|
|
GdkEventFocus *event);
|
|
|
|
static gint gtk_text_focus_out (GtkWidget *widget,
|
|
|
|
GdkEventFocus *event);
|
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
static void move_gap (GtkText* text, guint index);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void make_forward_space (GtkText* text, guint len);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
/* Property management */
|
|
|
|
static GtkTextFont* get_text_font (GdkFont* gfont);
|
|
|
|
static void text_font_unref (GtkTextFont *text_font);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void insert_text_property (GtkText* text, GdkFont* font,
|
|
|
|
GdkColor *fore, GdkColor* back, guint len);
|
1998-08-25 00:06:38 +00:00
|
|
|
static TextProperty* new_text_property (GtkText *text, GdkFont* font,
|
|
|
|
GdkColor* fore, GdkColor* back, guint length);
|
|
|
|
static void destroy_text_property (TextProperty *prop);
|
|
|
|
static void init_properties (GtkText *text);
|
|
|
|
static void realize_property (GtkText *text, TextProperty *prop);
|
|
|
|
static void realize_properties (GtkText *text);
|
|
|
|
static void unrealize_property (GtkText *text, TextProperty *prop);
|
|
|
|
static void unrealize_properties (GtkText *text);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void delete_text_property (GtkText* text, guint len);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static guint pixel_height_of (GtkText* text, GList* cache_line);
|
|
|
|
|
|
|
|
/* Property Movement and Size Computations */
|
|
|
|
static void advance_mark (GtkPropertyMark* mark);
|
|
|
|
static void decrement_mark (GtkPropertyMark* mark);
|
|
|
|
static void advance_mark_n (GtkPropertyMark* mark, gint n);
|
|
|
|
static void decrement_mark_n (GtkPropertyMark* mark, gint n);
|
|
|
|
static void move_mark_n (GtkPropertyMark* mark, gint n);
|
|
|
|
static GtkPropertyMark find_mark (GtkText* text, guint mark_position);
|
|
|
|
static GtkPropertyMark find_mark_near (GtkText* text, guint mark_position, const GtkPropertyMark* near);
|
1998-03-07 03:05:36 +00:00
|
|
|
static void find_line_containing_point (GtkText* text, guint point,
|
|
|
|
gboolean scroll);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* Display */
|
1998-03-10 03:17:02 +00:00
|
|
|
static void compute_lines_pixels (GtkText* text, guint char_count,
|
1998-02-27 06:13:22 +00:00
|
|
|
guint *lines, guint *pixels);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint total_line_height (GtkText* text,
|
|
|
|
GList* line,
|
|
|
|
gint line_count);
|
|
|
|
static LineParams find_line_params (GtkText* text,
|
|
|
|
const GtkPropertyMark *mark,
|
|
|
|
const PrevTabCont *tab_cont,
|
|
|
|
PrevTabCont *next_cont);
|
|
|
|
static void recompute_geometry (GtkText* text);
|
1998-02-27 06:13:22 +00:00
|
|
|
static void insert_expose (GtkText* text, guint old_pixels, gint nchars, guint new_line_count);
|
|
|
|
static void delete_expose (GtkText* text,
|
1998-03-10 03:17:02 +00:00
|
|
|
guint nchars,
|
1998-02-27 06:13:22 +00:00
|
|
|
guint old_lines,
|
|
|
|
guint old_pixels);
|
1999-01-20 18:06:31 +00:00
|
|
|
static GdkGC *create_bg_gc (GtkText *text);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void clear_area (GtkText *text, GdkRectangle *area);
|
|
|
|
static void draw_line (GtkText* text,
|
|
|
|
gint pixel_height,
|
|
|
|
LineParams* lp);
|
|
|
|
static void draw_line_wrap (GtkText* text,
|
|
|
|
guint height);
|
|
|
|
static void draw_cursor (GtkText* text, gint absolute);
|
|
|
|
static void undraw_cursor (GtkText* text, gint absolute);
|
|
|
|
static gint drawn_cursor_min (GtkText* text);
|
|
|
|
static gint drawn_cursor_max (GtkText* text);
|
|
|
|
static void expose_text (GtkText* text, GdkRectangle *area, gboolean cursor);
|
|
|
|
|
|
|
|
/* Search and Placement. */
|
1998-03-07 03:05:36 +00:00
|
|
|
static void find_cursor (GtkText* text,
|
|
|
|
gboolean scroll);
|
1997-11-24 22:37:52 +00:00
|
|
|
static void find_cursor_at_line (GtkText* text,
|
|
|
|
const LineParams* start_line,
|
|
|
|
gint pixel_height);
|
1998-03-01 05:11:05 +00:00
|
|
|
static void find_mouse_cursor (GtkText* text, gint x, gint y);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
/* Scrolling. */
|
|
|
|
static void adjust_adj (GtkText* text, GtkAdjustment* adj);
|
|
|
|
static void scroll_up (GtkText* text, gint diff);
|
|
|
|
static void scroll_down (GtkText* text, gint diff);
|
|
|
|
static void scroll_int (GtkText* text, gint diff);
|
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
static void process_exposes (GtkText *text);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Cache Management. */
|
1998-06-15 21:27:17 +00:00
|
|
|
static void free_cache (GtkText* text);
|
1997-11-24 22:37:52 +00:00
|
|
|
static GList* remove_cache_line (GtkText* text, GList* list);
|
|
|
|
|
|
|
|
/* Key Motion. */
|
|
|
|
static void move_cursor_buffer_ver (GtkText *text, int dir);
|
|
|
|
static void move_cursor_page_ver (GtkText *text, int dir);
|
|
|
|
static void move_cursor_ver (GtkText *text, int count);
|
|
|
|
static void move_cursor_hor (GtkText *text, int count);
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
/* Binding actions */
|
|
|
|
static void gtk_text_move_cursor (GtkEditable *editable,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
static void gtk_text_move_word (GtkEditable *editable,
|
|
|
|
gint n);
|
|
|
|
static void gtk_text_move_page (GtkEditable *editable,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
static void gtk_text_move_to_row (GtkEditable *editable,
|
|
|
|
gint row);
|
|
|
|
static void gtk_text_move_to_column (GtkEditable *editable,
|
|
|
|
gint row);
|
|
|
|
static void gtk_text_kill_char (GtkEditable *editable,
|
|
|
|
gint direction);
|
|
|
|
static void gtk_text_kill_word (GtkEditable *editable,
|
|
|
|
gint direction);
|
|
|
|
static void gtk_text_kill_line (GtkEditable *editable,
|
|
|
|
gint direction);
|
|
|
|
|
|
|
|
/* To be removed */
|
1998-03-01 05:11:05 +00:00
|
|
|
static void gtk_text_move_forward_character (GtkText *text);
|
|
|
|
static void gtk_text_move_backward_character (GtkText *text);
|
|
|
|
static void gtk_text_move_forward_word (GtkText *text);
|
|
|
|
static void gtk_text_move_backward_word (GtkText *text);
|
|
|
|
static void gtk_text_move_beginning_of_line (GtkText *text);
|
|
|
|
static void gtk_text_move_end_of_line (GtkText *text);
|
1998-03-10 03:17:02 +00:00
|
|
|
static void gtk_text_move_next_line (GtkText *text);
|
|
|
|
static void gtk_text_move_previous_line (GtkText *text);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void gtk_text_delete_forward_character (GtkText *text);
|
|
|
|
static void gtk_text_delete_backward_character (GtkText *text);
|
|
|
|
static void gtk_text_delete_forward_word (GtkText *text);
|
|
|
|
static void gtk_text_delete_backward_word (GtkText *text);
|
|
|
|
static void gtk_text_delete_line (GtkText *text);
|
|
|
|
static void gtk_text_delete_to_line_end (GtkText *text);
|
1998-03-10 22:57:26 +00:00
|
|
|
static void gtk_text_select_word (GtkText *text,
|
|
|
|
guint32 time);
|
|
|
|
static void gtk_text_select_line (GtkText *text,
|
|
|
|
guint32 time);
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-05-22 07:07:11 +00:00
|
|
|
static void gtk_text_set_position (GtkEditable *editable,
|
|
|
|
gint position);
|
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
/* #define DEBUG_GTK_TEXT */
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
#if defined(DEBUG_GTK_TEXT) && defined(__GNUC__)
|
|
|
|
/* Debugging utilities. */
|
|
|
|
static void gtk_text_assert_mark (GtkText *text,
|
|
|
|
GtkPropertyMark *mark,
|
|
|
|
GtkPropertyMark *before,
|
|
|
|
GtkPropertyMark *after,
|
|
|
|
const gchar *msg,
|
|
|
|
const gchar *where,
|
|
|
|
gint line);
|
|
|
|
|
|
|
|
static void gtk_text_assert (GtkText *text,
|
|
|
|
const gchar *msg,
|
|
|
|
gint line);
|
|
|
|
static void gtk_text_show_cache_line (GtkText *text, GList *cache,
|
|
|
|
const char* what, const char* func, gint line);
|
|
|
|
static void gtk_text_show_cache (GtkText *text, const char* func, gint line);
|
|
|
|
static void gtk_text_show_adj (GtkText *text,
|
|
|
|
GtkAdjustment *adj,
|
|
|
|
const char* what,
|
|
|
|
const char* func,
|
|
|
|
gint line);
|
|
|
|
static void gtk_text_show_props (GtkText* test,
|
|
|
|
const char* func,
|
|
|
|
int line);
|
|
|
|
|
1998-08-18 03:59:41 +00:00
|
|
|
#define TDEBUG(args) g_message args
|
1997-11-24 22:37:52 +00:00
|
|
|
#define TEXT_ASSERT(text) gtk_text_assert (text,__PRETTY_FUNCTION__,__LINE__)
|
|
|
|
#define TEXT_ASSERT_MARK(text,mark,msg) gtk_text_assert_mark (text,mark, \
|
|
|
|
__PRETTY_FUNCTION__,msg,__LINE__)
|
|
|
|
#define TEXT_SHOW(text) gtk_text_show_cache (text, __PRETTY_FUNCTION__,__LINE__)
|
|
|
|
#define TEXT_SHOW_LINE(text,line,msg) gtk_text_show_cache_line (text,line,msg,\
|
|
|
|
__PRETTY_FUNCTION__,__LINE__)
|
|
|
|
#define TEXT_SHOW_ADJ(text,adj,msg) gtk_text_show_adj (text,adj,msg, \
|
|
|
|
__PRETTY_FUNCTION__,__LINE__)
|
|
|
|
#else
|
|
|
|
#define TDEBUG(args)
|
|
|
|
#define TEXT_ASSERT(text)
|
|
|
|
#define TEXT_ASSERT_MARK(text,mark,msg)
|
|
|
|
#define TEXT_SHOW(text)
|
|
|
|
#define TEXT_SHOW_LINE(text,line,msg)
|
|
|
|
#define TEXT_SHOW_ADJ(text,adj,msg)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Memory Management. */
|
|
|
|
static GMemChunk *params_mem_chunk = NULL;
|
|
|
|
static GMemChunk *text_property_chunk = NULL;
|
|
|
|
|
|
|
|
static GtkWidgetClass *parent_class = NULL;
|
|
|
|
|
|
|
|
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTextFunction control_keys[26] =
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
(GtkTextFunction)gtk_text_move_beginning_of_line, /* a */
|
|
|
|
(GtkTextFunction)gtk_text_move_backward_character, /* b */
|
1998-06-19 01:26:24 +00:00
|
|
|
(GtkTextFunction)gtk_editable_copy_clipboard, /* c */
|
1998-03-01 05:11:05 +00:00
|
|
|
(GtkTextFunction)gtk_text_delete_forward_character, /* d */
|
|
|
|
(GtkTextFunction)gtk_text_move_end_of_line, /* e */
|
|
|
|
(GtkTextFunction)gtk_text_move_forward_character, /* f */
|
|
|
|
NULL, /* g */
|
|
|
|
(GtkTextFunction)gtk_text_delete_backward_character, /* h */
|
|
|
|
NULL, /* i */
|
|
|
|
NULL, /* j */
|
|
|
|
(GtkTextFunction)gtk_text_delete_to_line_end, /* k */
|
|
|
|
NULL, /* l */
|
|
|
|
NULL, /* m */
|
1998-03-10 03:17:02 +00:00
|
|
|
(GtkTextFunction)gtk_text_move_next_line, /* n */
|
1998-03-01 05:11:05 +00:00
|
|
|
NULL, /* o */
|
1998-03-10 03:17:02 +00:00
|
|
|
(GtkTextFunction)gtk_text_move_previous_line, /* p */
|
1998-03-01 05:11:05 +00:00
|
|
|
NULL, /* q */
|
|
|
|
NULL, /* r */
|
|
|
|
NULL, /* s */
|
|
|
|
NULL, /* t */
|
|
|
|
(GtkTextFunction)gtk_text_delete_line, /* u */
|
1998-06-19 01:26:24 +00:00
|
|
|
(GtkTextFunction)gtk_editable_paste_clipboard, /* v */
|
1998-03-01 05:11:05 +00:00
|
|
|
(GtkTextFunction)gtk_text_delete_backward_word, /* w */
|
1998-06-19 01:26:24 +00:00
|
|
|
(GtkTextFunction)gtk_editable_cut_clipboard, /* x */
|
1998-03-01 05:11:05 +00:00
|
|
|
NULL, /* y */
|
|
|
|
NULL, /* z */
|
|
|
|
};
|
|
|
|
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTextFunction alt_keys[26] =
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
NULL, /* a */
|
|
|
|
(GtkTextFunction)gtk_text_move_backward_word, /* b */
|
|
|
|
NULL, /* c */
|
|
|
|
(GtkTextFunction)gtk_text_delete_forward_word, /* d */
|
|
|
|
NULL, /* e */
|
|
|
|
(GtkTextFunction)gtk_text_move_forward_word, /* f */
|
|
|
|
NULL, /* g */
|
|
|
|
NULL, /* h */
|
|
|
|
NULL, /* i */
|
|
|
|
NULL, /* j */
|
|
|
|
NULL, /* k */
|
|
|
|
NULL, /* l */
|
|
|
|
NULL, /* m */
|
|
|
|
NULL, /* n */
|
|
|
|
NULL, /* o */
|
|
|
|
NULL, /* p */
|
|
|
|
NULL, /* q */
|
|
|
|
NULL, /* r */
|
|
|
|
NULL, /* s */
|
|
|
|
NULL, /* t */
|
|
|
|
NULL, /* u */
|
|
|
|
NULL, /* v */
|
|
|
|
NULL, /* w */
|
|
|
|
NULL, /* x */
|
|
|
|
NULL, /* y */
|
|
|
|
NULL, /* z */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
/* Widget Crap */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
GtkType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_text_get_type (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-07-16 20:23:12 +00:00
|
|
|
static GtkType text_type = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!text_type)
|
|
|
|
{
|
1998-11-30 19:07:15 +00:00
|
|
|
static const GtkTypeInfo text_info =
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
"GtkText",
|
|
|
|
sizeof (GtkText),
|
|
|
|
sizeof (GtkTextClass),
|
|
|
|
(GtkClassInitFunc) gtk_text_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_text_init,
|
1998-07-04 15:31:30 +00:00
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
1998-06-28 07:46:10 +00:00
|
|
|
(GtkClassInitFunc) NULL,
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
text_type = gtk_type_unique (GTK_TYPE_EDITABLE, &text_info);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return text_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_class_init (GtkTextClass *class)
|
|
|
|
{
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditableClass *editable_class;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
object_class = (GtkObjectClass*) class;
|
|
|
|
widget_class = (GtkWidgetClass*) class;
|
1998-03-01 05:11:05 +00:00
|
|
|
editable_class = (GtkEditableClass*) class;
|
1998-07-16 20:23:12 +00:00
|
|
|
parent_class = gtk_type_class (GTK_TYPE_EDITABLE);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
gobject_class->finalize = gtk_text_finalize;
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
|
|
|
object_class->set_arg = gtk_text_set_arg;
|
|
|
|
object_class->get_arg = gtk_text_get_arg;
|
1998-03-07 03:05:36 +00:00
|
|
|
object_class->destroy = gtk_text_destroy;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
widget_class->realize = gtk_text_realize;
|
|
|
|
widget_class->unrealize = gtk_text_unrealize;
|
1998-05-10 02:46:20 +00:00
|
|
|
widget_class->style_set = gtk_text_style_set;
|
2000-03-14 19:57:25 +00:00
|
|
|
widget_class->state_changed = gtk_text_state_changed;
|
1997-11-24 22:37:52 +00:00
|
|
|
widget_class->draw_focus = gtk_text_draw_focus;
|
|
|
|
widget_class->size_request = gtk_text_size_request;
|
|
|
|
widget_class->size_allocate = gtk_text_size_allocate;
|
|
|
|
widget_class->draw = gtk_text_draw;
|
|
|
|
widget_class->expose_event = gtk_text_expose;
|
|
|
|
widget_class->button_press_event = gtk_text_button_press;
|
|
|
|
widget_class->button_release_event = gtk_text_button_release;
|
|
|
|
widget_class->motion_notify_event = gtk_text_motion_notify;
|
|
|
|
widget_class->key_press_event = gtk_text_key_press;
|
|
|
|
widget_class->focus_in_event = gtk_text_focus_in;
|
|
|
|
widget_class->focus_out_event = gtk_text_focus_out;
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
editable_class->set_editable = gtk_text_real_set_editable;
|
1998-03-01 05:11:05 +00:00
|
|
|
editable_class->insert_text = gtk_text_insert_text;
|
|
|
|
editable_class->delete_text = gtk_text_delete_text;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
editable_class->move_cursor = gtk_text_move_cursor;
|
|
|
|
editable_class->move_word = gtk_text_move_word;
|
|
|
|
editable_class->move_page = gtk_text_move_page;
|
|
|
|
editable_class->move_to_row = gtk_text_move_to_row;
|
|
|
|
editable_class->move_to_column = gtk_text_move_to_column;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
editable_class->kill_char = gtk_text_kill_char;
|
|
|
|
editable_class->kill_word = gtk_text_kill_word;
|
|
|
|
editable_class->kill_line = gtk_text_kill_line;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable_class->update_text = gtk_text_update_text;
|
|
|
|
editable_class->get_chars = gtk_text_get_chars;
|
|
|
|
editable_class->set_selection = gtk_text_set_selection;
|
1998-05-22 07:07:11 +00:00
|
|
|
editable_class->set_position = gtk_text_set_position;
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
1998-12-02 03:40:03 +00:00
|
|
|
class->set_scroll_adjustments = gtk_text_set_adjustments;
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
|
|
|
gtk_object_add_arg_type ("GtkText::hadjustment",
|
|
|
|
GTK_TYPE_ADJUSTMENT,
|
|
|
|
GTK_ARG_READWRITE,
|
|
|
|
ARG_HADJUSTMENT);
|
|
|
|
gtk_object_add_arg_type ("GtkText::vadjustment",
|
|
|
|
GTK_TYPE_ADJUSTMENT,
|
|
|
|
GTK_ARG_READWRITE,
|
|
|
|
ARG_VADJUSTMENT);
|
|
|
|
gtk_object_add_arg_type ("GtkText::line_wrap",
|
|
|
|
GTK_TYPE_BOOL,
|
|
|
|
GTK_ARG_READWRITE,
|
|
|
|
ARG_LINE_WRAP);
|
|
|
|
gtk_object_add_arg_type ("GtkText::word_wrap",
|
|
|
|
GTK_TYPE_BOOL,
|
|
|
|
GTK_ARG_READWRITE,
|
|
|
|
ARG_WORD_WRAP);
|
|
|
|
|
|
|
|
widget_class->set_scroll_adjustments_signal =
|
|
|
|
gtk_signal_new ("set_scroll_adjustments",
|
|
|
|
GTK_RUN_LAST,
|
|
|
|
GTK_CLASS_TYPE (object_class),
|
|
|
|
GTK_SIGNAL_OFFSET (GtkTextClass, set_scroll_adjustments),
|
|
|
|
gtk_marshal_NONE__POINTER_POINTER,
|
|
|
|
GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_set_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
|
|
|
|
|
|
|
text = GTK_TEXT (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_HADJUSTMENT:
|
|
|
|
gtk_text_set_adjustments (text,
|
|
|
|
GTK_VALUE_POINTER (*arg),
|
|
|
|
text->vadj);
|
|
|
|
break;
|
|
|
|
case ARG_VADJUSTMENT:
|
|
|
|
gtk_text_set_adjustments (text,
|
|
|
|
text->hadj,
|
|
|
|
GTK_VALUE_POINTER (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_LINE_WRAP:
|
|
|
|
gtk_text_set_line_wrap (text, GTK_VALUE_BOOL (*arg));
|
|
|
|
break;
|
|
|
|
case ARG_WORD_WRAP:
|
|
|
|
gtk_text_set_word_wrap (text, GTK_VALUE_BOOL (*arg));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_get_arg (GtkObject *object,
|
|
|
|
GtkArg *arg,
|
|
|
|
guint arg_id)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
|
|
|
|
|
|
|
text = GTK_TEXT (object);
|
|
|
|
|
|
|
|
switch (arg_id)
|
|
|
|
{
|
|
|
|
case ARG_HADJUSTMENT:
|
|
|
|
GTK_VALUE_POINTER (*arg) = text->hadj;
|
|
|
|
break;
|
|
|
|
case ARG_VADJUSTMENT:
|
|
|
|
GTK_VALUE_POINTER (*arg) = text->vadj;
|
|
|
|
break;
|
|
|
|
case ARG_LINE_WRAP:
|
|
|
|
GTK_VALUE_BOOL (*arg) = text->line_wrap;
|
|
|
|
break;
|
|
|
|
case ARG_WORD_WRAP:
|
|
|
|
GTK_VALUE_BOOL (*arg) = text->word_wrap;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
arg->type = GTK_TYPE_INVALID;
|
|
|
|
break;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_init (GtkText *text)
|
|
|
|
{
|
|
|
|
GTK_WIDGET_SET_FLAGS (text, GTK_CAN_FOCUS);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
|
|
|
text->text_area = NULL;
|
|
|
|
text->hadj = NULL;
|
|
|
|
text->vadj = NULL;
|
|
|
|
text->gc = NULL;
|
1999-01-20 18:06:31 +00:00
|
|
|
text->bg_gc = NULL;
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
text->line_wrap_bitmap = NULL;
|
|
|
|
text->line_arrow_bitmap = NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
text->use_wchar = FALSE;
|
|
|
|
text->text.ch = g_new (guchar, INITIAL_BUFFER_SIZE);
|
1997-11-24 22:37:52 +00:00
|
|
|
text->text_len = INITIAL_BUFFER_SIZE;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
|
|
|
text->scratch_buffer.ch = NULL;
|
|
|
|
text->scratch_buffer_len = 0;
|
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
text->freeze_count = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!params_mem_chunk)
|
|
|
|
params_mem_chunk = g_mem_chunk_new ("LineParams",
|
|
|
|
sizeof (LineParams),
|
|
|
|
256 * sizeof (LineParams),
|
|
|
|
G_ALLOC_AND_FREE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->default_tab_width = 4;
|
|
|
|
text->tab_stops = NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->tab_stops = g_list_prepend (text->tab_stops, (void*)8);
|
|
|
|
text->tab_stops = g_list_prepend (text->tab_stops, (void*)8);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-11 19:06:18 +00:00
|
|
|
text->line_start_cache = NULL;
|
1998-09-15 14:59:48 +00:00
|
|
|
text->first_cut_pixels = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->line_wrap = TRUE;
|
1998-03-24 01:43:21 +00:00
|
|
|
text->word_wrap = FALSE;
|
1998-03-07 03:05:36 +00:00
|
|
|
|
|
|
|
text->timer = 0;
|
1998-03-10 03:17:02 +00:00
|
|
|
text->button = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
text->current_font = NULL;
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
init_properties (text);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
|
|
|
GTK_EDITABLE (text)->editable = FALSE;
|
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
gtk_text_set_adjustments (text, NULL, NULL);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
gtk_editable_set_position (GTK_EDITABLE (text), 0);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget*
|
|
|
|
gtk_text_new (GtkAdjustment *hadj,
|
|
|
|
GtkAdjustment *vadj)
|
|
|
|
{
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
GtkWidget *text;
|
|
|
|
|
|
|
|
if (hadj)
|
|
|
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadj), NULL);
|
|
|
|
if (vadj)
|
|
|
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadj), NULL);
|
|
|
|
|
|
|
|
text = gtk_widget_new (GTK_TYPE_TEXT,
|
|
|
|
"hadjustment", hadj,
|
|
|
|
"vadjustment", vadj,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return text;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-03-23 06:27:31 +00:00
|
|
|
void
|
|
|
|
gtk_text_set_word_wrap (GtkText *text,
|
|
|
|
gint word_wrap)
|
|
|
|
{
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-23 06:27:31 +00:00
|
|
|
text->word_wrap = (word_wrap != FALSE);
|
|
|
|
|
1998-04-04 04:21:26 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (text))
|
1998-03-23 06:27:31 +00:00
|
|
|
{
|
|
|
|
recompute_geometry (text);
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (text));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-10-18 13:10:08 +00:00
|
|
|
void
|
|
|
|
gtk_text_set_line_wrap (GtkText *text,
|
|
|
|
gint line_wrap)
|
|
|
|
{
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
|
|
|
|
|
|
|
text->line_wrap = (line_wrap != FALSE);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (text))
|
|
|
|
{
|
|
|
|
recompute_geometry (text);
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (text));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
void
|
|
|
|
gtk_text_set_editable (GtkText *text,
|
1998-07-16 20:23:12 +00:00
|
|
|
gboolean is_editable)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
gtk_editable_set_editable (GTK_EDITABLE (text), is_editable);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_real_set_editable (GtkEditable *editable,
|
|
|
|
gboolean is_editable)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
g_return_if_fail (editable != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (editable));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
text = GTK_TEXT (editable);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
editable->editable = (is_editable != FALSE);
|
1998-03-07 03:05:36 +00:00
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
if (is_editable)
|
1998-03-07 03:05:36 +00:00
|
|
|
draw_cursor (text, TRUE);
|
|
|
|
else
|
|
|
|
undraw_cursor (text, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_text_set_adjustments (GtkText *text,
|
|
|
|
GtkAdjustment *hadj,
|
|
|
|
GtkAdjustment *vadj)
|
|
|
|
{
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
1998-11-23 02:30:45 +00:00
|
|
|
if (hadj)
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
|
|
|
|
else
|
|
|
|
hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
|
|
|
if (vadj)
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
|
|
|
|
else
|
|
|
|
vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->hadj && (text->hadj != hadj))
|
|
|
|
{
|
|
|
|
gtk_signal_disconnect_by_data (GTK_OBJECT (text->hadj), text);
|
|
|
|
gtk_object_unref (GTK_OBJECT (text->hadj));
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->vadj && (text->vadj != vadj))
|
|
|
|
{
|
|
|
|
gtk_signal_disconnect_by_data (GTK_OBJECT (text->vadj), text);
|
|
|
|
gtk_object_unref (GTK_OBJECT (text->vadj));
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->hadj != hadj)
|
|
|
|
{
|
|
|
|
text->hadj = hadj;
|
|
|
|
gtk_object_ref (GTK_OBJECT (text->hadj));
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_object_sink (GTK_OBJECT (text->hadj));
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (text->hadj), "changed",
|
|
|
|
(GtkSignalFunc) gtk_text_adjustment,
|
|
|
|
text);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (text->hadj), "value_changed",
|
|
|
|
(GtkSignalFunc) gtk_text_adjustment,
|
|
|
|
text);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (text->hadj), "disconnect",
|
|
|
|
(GtkSignalFunc) gtk_text_disconnect,
|
|
|
|
text);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
gtk_text_adjustment (hadj, text);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->vadj != vadj)
|
|
|
|
{
|
|
|
|
text->vadj = vadj;
|
|
|
|
gtk_object_ref (GTK_OBJECT (text->vadj));
|
1998-01-30 23:47:09 +00:00
|
|
|
gtk_object_sink (GTK_OBJECT (text->vadj));
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (text->vadj), "changed",
|
|
|
|
(GtkSignalFunc) gtk_text_adjustment,
|
|
|
|
text);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (text->vadj), "value_changed",
|
|
|
|
(GtkSignalFunc) gtk_text_adjustment,
|
|
|
|
text);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (text->vadj), "disconnect",
|
|
|
|
(GtkSignalFunc) gtk_text_disconnect,
|
|
|
|
text);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
gtk_text_adjustment (vadj, text);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_text_set_point (GtkText *text,
|
|
|
|
guint index)
|
|
|
|
{
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
1998-03-14 18:33:41 +00:00
|
|
|
g_return_if_fail (index <= TEXT_LENGTH (text));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->point = find_mark (text, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
guint
|
|
|
|
gtk_text_get_point (GtkText *text)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (text != NULL, 0);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (text), 0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return text->point.index;
|
|
|
|
}
|
|
|
|
|
|
|
|
guint
|
|
|
|
gtk_text_get_length (GtkText *text)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (text != NULL, 0);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (text), 0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return TEXT_LENGTH (text);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_text_freeze (GtkText *text)
|
|
|
|
{
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
text->freeze_count++;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_text_thaw (GtkText *text)
|
|
|
|
{
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
if (text->freeze_count)
|
|
|
|
if (!(--text->freeze_count) && GTK_WIDGET_REALIZED (text))
|
|
|
|
{
|
|
|
|
recompute_geometry (text);
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (text));
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_text_insert (GtkText *text,
|
|
|
|
GdkFont *font,
|
|
|
|
GdkColor *fore,
|
|
|
|
GdkColor *back,
|
|
|
|
const char *chars,
|
1998-03-10 03:17:02 +00:00
|
|
|
gint nchars)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 08:47:36 +00:00
|
|
|
GtkEditable *editable = GTK_EDITABLE (text);
|
1998-03-10 03:17:02 +00:00
|
|
|
gboolean frozen = FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
gint new_line_count = 1;
|
|
|
|
guint old_height = 0;
|
1998-03-10 03:17:02 +00:00
|
|
|
guint length;
|
1998-03-14 18:33:41 +00:00
|
|
|
guint i;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
gint numwcs;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
1998-08-25 00:06:38 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (nchars < 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
length = strlen (chars);
|
1998-03-10 03:17:02 +00:00
|
|
|
else
|
|
|
|
length = nchars;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (length == 0)
|
|
|
|
return;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
if (!text->freeze_count && (length > FREEZE_LENGTH))
|
1998-03-10 03:17:02 +00:00
|
|
|
{
|
|
|
|
gtk_text_freeze (text);
|
|
|
|
frozen = TRUE;
|
|
|
|
}
|
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
if (!text->freeze_count && (text->line_start_cache != NULL))
|
1998-02-27 06:13:22 +00:00
|
|
|
{
|
1998-03-07 03:05:36 +00:00
|
|
|
find_line_containing_point (text, text->point.index, TRUE);
|
1998-02-27 06:13:22 +00:00
|
|
|
old_height = total_line_height (text, text->current_line, 1);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if ((TEXT_LENGTH (text) == 0) && (text->use_wchar == FALSE))
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
widget = GTK_WIDGET (text);
|
|
|
|
gtk_widget_ensure_style (widget);
|
|
|
|
if ((widget->style) && (widget->style->font->type == GDK_FONT_FONTSET))
|
|
|
|
{
|
|
|
|
text->use_wchar = TRUE;
|
|
|
|
g_free (text->text.ch);
|
|
|
|
text->text.wc = g_new (GdkWChar, INITIAL_BUFFER_SIZE);
|
|
|
|
text->text_len = INITIAL_BUFFER_SIZE;
|
|
|
|
if (text->scratch_buffer.ch)
|
|
|
|
g_free (text->scratch_buffer.ch);
|
|
|
|
text->scratch_buffer.wc = NULL;
|
|
|
|
text->scratch_buffer_len = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
move_gap (text, text->point.index);
|
1997-11-24 22:37:52 +00:00
|
|
|
make_forward_space (text, length);
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
char *chars_nt = (char *)chars;
|
|
|
|
if (nchars > 0)
|
|
|
|
{
|
|
|
|
chars_nt = g_new (char, length+1);
|
|
|
|
memcpy (chars_nt, chars, length);
|
|
|
|
chars_nt[length] = 0;
|
|
|
|
}
|
|
|
|
numwcs = gdk_mbstowcs (text->text.wc + text->gap_position, chars_nt,
|
|
|
|
length);
|
|
|
|
if (chars_nt != chars)
|
|
|
|
g_free(chars_nt);
|
|
|
|
if (numwcs < 0)
|
|
|
|
numwcs = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
numwcs = length;
|
|
|
|
memcpy(text->text.ch + text->gap_position, chars, length);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!text->freeze_count && (text->line_start_cache != NULL))
|
|
|
|
{
|
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
for (i=0; i<numwcs; i++)
|
|
|
|
if (text->text.wc[text->gap_position + i] == '\n')
|
|
|
|
new_line_count++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i=0; i<numwcs; i++)
|
|
|
|
if (text->text.ch[text->gap_position + i] == '\n')
|
|
|
|
new_line_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (numwcs > 0)
|
|
|
|
{
|
|
|
|
insert_text_property (text, font, fore, back, numwcs);
|
|
|
|
|
|
|
|
text->gap_size -= numwcs;
|
|
|
|
text->gap_position += numwcs;
|
|
|
|
|
|
|
|
if (text->point.index < text->first_line_start_index)
|
|
|
|
text->first_line_start_index += numwcs;
|
|
|
|
if (text->point.index < editable->selection_start_pos)
|
|
|
|
editable->selection_start_pos += numwcs;
|
|
|
|
if (text->point.index < editable->selection_end_pos)
|
|
|
|
editable->selection_end_pos += numwcs;
|
|
|
|
/* We'll reset the cursor later anyways if we aren't frozen */
|
|
|
|
if (text->point.index < text->cursor_mark.index)
|
|
|
|
text->cursor_mark.index += numwcs;
|
|
|
|
|
|
|
|
advance_mark_n (&text->point, numwcs);
|
|
|
|
|
|
|
|
if (!text->freeze_count && (text->line_start_cache != NULL))
|
|
|
|
insert_expose (text, old_height, numwcs, new_line_count);
|
|
|
|
}
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (frozen)
|
|
|
|
gtk_text_thaw (text);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
gtk_text_backward_delete (GtkText *text,
|
|
|
|
guint nchars)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (text != NULL, 0);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (text), 0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (nchars > text->point.index || nchars <= 0)
|
|
|
|
return FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_text_set_point (text, text->point.index - nchars);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-12-08 23:55:54 +00:00
|
|
|
return gtk_text_forward_delete (text, nchars);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
1997-12-08 23:55:54 +00:00
|
|
|
gtk_text_forward_delete (GtkText *text,
|
1998-03-01 08:47:36 +00:00
|
|
|
guint nchars)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-02-27 06:13:22 +00:00
|
|
|
guint old_lines, old_height;
|
1998-03-10 03:17:02 +00:00
|
|
|
GtkEditable *editable = GTK_EDITABLE (text);
|
|
|
|
gboolean frozen = FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (text != NULL, 0);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (text), 0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->point.index + nchars > TEXT_LENGTH (text) || nchars <= 0)
|
|
|
|
return FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
if (!text->freeze_count && nchars > FREEZE_LENGTH)
|
1998-03-10 03:17:02 +00:00
|
|
|
{
|
|
|
|
gtk_text_freeze (text);
|
|
|
|
frozen = TRUE;
|
|
|
|
}
|
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
if (!text->freeze_count && text->line_start_cache != NULL)
|
1998-02-27 06:13:22 +00:00
|
|
|
{
|
1998-08-04 14:56:44 +00:00
|
|
|
/* We need to undraw the cursor here, since we may later
|
|
|
|
* delete the cursor's property
|
|
|
|
*/
|
|
|
|
undraw_cursor (text, FALSE);
|
1998-03-07 03:05:36 +00:00
|
|
|
find_line_containing_point (text, text->point.index, TRUE);
|
1998-02-27 06:13:22 +00:00
|
|
|
compute_lines_pixels (text, nchars, &old_lines, &old_height);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
/* FIXME, or resizing after deleting will be odd */
|
1998-02-27 06:13:22 +00:00
|
|
|
if (text->point.index < text->first_line_start_index)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-03-10 22:57:26 +00:00
|
|
|
if (text->point.index + nchars >= text->first_line_start_index)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
text->first_line_start_index = text->point.index;
|
|
|
|
while ((text->first_line_start_index > 0) &&
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
(GTK_TEXT_INDEX (text, text->first_line_start_index - 1)
|
|
|
|
!= LINE_DELIM))
|
1998-03-01 05:11:05 +00:00
|
|
|
text->first_line_start_index -= 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
text->first_line_start_index -= nchars;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
if (text->point.index < editable->selection_start_pos)
|
1998-03-10 22:57:26 +00:00
|
|
|
editable->selection_start_pos -=
|
|
|
|
MIN(nchars, editable->selection_start_pos - text->point.index);
|
1998-03-01 08:47:36 +00:00
|
|
|
if (text->point.index < editable->selection_end_pos)
|
1998-03-10 22:57:26 +00:00
|
|
|
editable->selection_end_pos -=
|
|
|
|
MIN(nchars, editable->selection_end_pos - text->point.index);
|
1998-03-10 03:17:02 +00:00
|
|
|
/* We'll reset the cursor later anyways if we aren't frozen */
|
|
|
|
if (text->point.index < text->cursor_mark.index)
|
1998-08-04 14:56:44 +00:00
|
|
|
move_mark_n (&text->cursor_mark,
|
|
|
|
-MIN(nchars, text->cursor_mark.index - text->point.index));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
move_gap (text, text->point.index);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->gap_size += nchars;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
delete_text_property (text, nchars);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-11-28 01:56:09 +00:00
|
|
|
if (!text->freeze_count && (text->line_start_cache != NULL))
|
1998-08-04 14:56:44 +00:00
|
|
|
{
|
|
|
|
delete_expose (text, nchars, old_lines, old_height);
|
|
|
|
draw_cursor (text, FALSE);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (frozen)
|
|
|
|
gtk_text_thaw (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-05-22 07:07:11 +00:00
|
|
|
static void
|
|
|
|
gtk_text_set_position (GtkEditable *editable,
|
|
|
|
gint position)
|
|
|
|
{
|
|
|
|
GtkText *text = (GtkText *) editable;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-11 19:06:18 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
|
|
|
text->cursor_mark = find_mark (text, position);
|
|
|
|
find_cursor (text, TRUE);
|
|
|
|
draw_cursor (text, FALSE);
|
1998-05-22 07:07:11 +00:00
|
|
|
gtk_editable_select_region (editable, 0, 0);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static gchar *
|
1998-03-11 04:05:15 +00:00
|
|
|
gtk_text_get_chars (GtkEditable *editable,
|
|
|
|
gint start_pos,
|
|
|
|
gint end_pos)
|
1998-02-27 06:13:22 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkText *text;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
gchar *retval;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
g_return_val_if_fail (editable != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (editable), NULL);
|
|
|
|
text = GTK_TEXT (editable);
|
1998-02-27 06:13:22 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
if (end_pos < 0)
|
|
|
|
end_pos = TEXT_LENGTH (text);
|
|
|
|
|
1998-03-14 18:33:41 +00:00
|
|
|
if ((start_pos < 0) ||
|
|
|
|
(end_pos > TEXT_LENGTH (text)) ||
|
|
|
|
(end_pos < start_pos))
|
1998-02-27 06:13:22 +00:00
|
|
|
return NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
move_gap (text, TEXT_LENGTH (text));
|
|
|
|
make_forward_space (text, 1);
|
|
|
|
|
|
|
|
if (text->use_wchar)
|
1998-02-27 06:13:22 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
GdkWChar ch;
|
|
|
|
ch = text->text.wc[end_pos];
|
|
|
|
text->text.wc[end_pos] = 0;
|
|
|
|
retval = gdk_wcstombs (text->text.wc + start_pos);
|
|
|
|
text->text.wc[end_pos] = ch;
|
1998-02-27 06:13:22 +00:00
|
|
|
}
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
else
|
1998-02-27 06:13:22 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
guchar ch;
|
|
|
|
ch = text->text.ch[end_pos];
|
|
|
|
text->text.ch[end_pos] = 0;
|
|
|
|
retval = g_strdup (text->text.ch + start_pos);
|
|
|
|
text->text.ch[end_pos] = ch;
|
1998-02-27 06:13:22 +00:00
|
|
|
}
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
1998-03-07 03:05:36 +00:00
|
|
|
gtk_text_destroy (GtkObject *object)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-01-30 23:47:09 +00:00
|
|
|
GtkText *text;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (GTK_IS_TEXT (object));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
text = GTK_TEXT (object);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
if (text->hadj)
|
|
|
|
{
|
|
|
|
gtk_signal_disconnect_by_data (GTK_OBJECT (text->hadj), text);
|
|
|
|
gtk_object_unref (GTK_OBJECT (text->hadj));
|
|
|
|
text->hadj = NULL;
|
|
|
|
}
|
|
|
|
if (text->vadj)
|
|
|
|
{
|
|
|
|
gtk_signal_disconnect_by_data (GTK_OBJECT (text->vadj), text);
|
|
|
|
gtk_object_unref (GTK_OBJECT (text->vadj));
|
|
|
|
text->vadj = NULL;
|
|
|
|
}
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if (text->timer)
|
|
|
|
{
|
|
|
|
gtk_timeout_remove (text->timer);
|
|
|
|
text->timer = 0;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
GTK_OBJECT_CLASS(parent_class)->destroy (object);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
static void
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
gtk_text_finalize (GObject *object)
|
1998-06-15 21:27:17 +00:00
|
|
|
{
|
|
|
|
GtkText *text;
|
|
|
|
GList *tmp_list;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
g_return_if_fail (GTK_IS_TEXT (object));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
text = GTK_TEXT (object);
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
/* Clean up the internal structures */
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
g_free (text->text.wc);
|
|
|
|
else
|
|
|
|
g_free (text->text.ch);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
tmp_list = text->text_properties;
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
1998-08-25 00:06:38 +00:00
|
|
|
destroy_text_property (tmp_list->data);
|
1998-06-15 21:27:17 +00:00
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
1998-08-25 00:06:38 +00:00
|
|
|
|
1998-11-23 02:41:18 +00:00
|
|
|
if (text->current_font)
|
|
|
|
text_font_unref (text->current_font);
|
1998-06-15 21:27:17 +00:00
|
|
|
|
|
|
|
g_list_free (text->text_properties);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
if (text->scratch_buffer.wc)
|
|
|
|
g_free (text->scratch_buffer.wc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (text->scratch_buffer.ch)
|
|
|
|
g_free (text->scratch_buffer.ch);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
g_list_free (text->tab_stops);
|
|
|
|
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
1998-06-15 21:27:17 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_text_realize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
GdkWindowAttr attributes;
|
|
|
|
gint attributes_mask;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (widget));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
text = GTK_TEXT (widget);
|
|
|
|
editable = GTK_EDITABLE (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
GTK_WIDGET_SET_FLAGS (text, GTK_REALIZED);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
|
|
|
attributes.x = widget->allocation.x;
|
|
|
|
attributes.y = widget->allocation.y;
|
|
|
|
attributes.width = widget->allocation.width;
|
|
|
|
attributes.height = widget->allocation.height;
|
|
|
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
attributes.visual = gtk_widget_get_visual (widget);
|
|
|
|
attributes.colormap = gtk_widget_get_colormap (widget);
|
|
|
|
attributes.event_mask = gtk_widget_get_events (widget);
|
|
|
|
attributes.event_mask |= (GDK_EXPOSURE_MASK |
|
|
|
|
GDK_BUTTON_PRESS_MASK |
|
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
|
|
|
GDK_BUTTON_MOTION_MASK |
|
|
|
|
GDK_ENTER_NOTIFY_MASK |
|
|
|
|
GDK_LEAVE_NOTIFY_MASK |
|
|
|
|
GDK_KEY_PRESS_MASK);
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-01-18 15:09:10 +00:00
|
|
|
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_set_user_data (widget->window, text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
attributes.x = (widget->style->xthickness + TEXT_BORDER_ROOM);
|
|
|
|
attributes.y = (widget->style->ythickness + TEXT_BORDER_ROOM);
|
1998-09-15 14:59:48 +00:00
|
|
|
attributes.width = MAX (1, (gint)widget->allocation.width - (gint)attributes.x * 2);
|
|
|
|
attributes.height = MAX (1, (gint)widget->allocation.height - (gint)attributes.y * 2);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->text_area = gdk_window_new (widget->window, &attributes, attributes_mask);
|
|
|
|
gdk_window_set_user_data (text->text_area, text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
widget->style = gtk_style_attach (widget->style, widget->window);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-08 21:47:14 +00:00
|
|
|
/* Can't call gtk_style_set_background here because it's handled specially */
|
2000-03-14 19:57:25 +00:00
|
|
|
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
|
|
|
gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
1999-01-20 18:06:31 +00:00
|
|
|
|
|
|
|
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
|
|
|
text->bg_gc = create_bg_gc (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->line_wrap_bitmap = gdk_bitmap_create_from_data (text->text_area,
|
|
|
|
(gchar*) line_wrap_bits,
|
|
|
|
line_wrap_width,
|
|
|
|
line_wrap_height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->line_arrow_bitmap = gdk_bitmap_create_from_data (text->text_area,
|
|
|
|
(gchar*) line_arrow_bits,
|
|
|
|
line_arrow_width,
|
|
|
|
line_arrow_height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->gc = gdk_gc_new (text->text_area);
|
|
|
|
gdk_gc_set_exposures (text->gc, TRUE);
|
1998-03-01 05:11:05 +00:00
|
|
|
gdk_gc_set_foreground (text->gc, &widget->style->text[GTK_STATE_NORMAL]);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
#ifdef USE_XIM
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (gdk_im_ready () && (editable->ic_attr = gdk_ic_attr_new ()) != NULL)
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
{
|
|
|
|
gint width, height;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
GdkColormap *colormap;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
GdkEventMask mask;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
GdkICAttr *attr = editable->ic_attr;
|
|
|
|
GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
GdkIMStyle style;
|
1998-08-25 00:06:38 +00:00
|
|
|
GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
|
|
|
|
GDK_IM_PREEDIT_NOTHING |
|
|
|
|
GDK_IM_PREEDIT_POSITION |
|
|
|
|
GDK_IM_STATUS_NONE |
|
|
|
|
GDK_IM_STATUS_NOTHING;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
|
1998-08-25 00:06:38 +00:00
|
|
|
supported_style &= ~GDK_IM_PREEDIT_POSITION;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
attr->style = style = gdk_im_decide_style (supported_style);
|
|
|
|
attr->client_window = text->text_area;
|
|
|
|
|
|
|
|
if ((colormap = gtk_widget_get_colormap (widget)) !=
|
|
|
|
gtk_widget_get_default_colormap ())
|
|
|
|
{
|
|
|
|
attrmask |= GDK_IC_PREEDIT_COLORMAP;
|
|
|
|
attr->preedit_colormap = colormap;
|
|
|
|
}
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
switch (style & GDK_IM_PREEDIT_MASK)
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
{
|
1998-08-25 00:06:38 +00:00
|
|
|
case GDK_IM_PREEDIT_POSITION:
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
|
|
|
|
{
|
|
|
|
g_warning ("over-the-spot style requires fontset");
|
|
|
|
break;
|
|
|
|
}
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
|
|
|
attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, &height);
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
attr->spot_location.x = 0;
|
|
|
|
attr->spot_location.y = height;
|
|
|
|
attr->preedit_area.x = 0;
|
|
|
|
attr->preedit_area.y = 0;
|
|
|
|
attr->preedit_area.width = width;
|
|
|
|
attr->preedit_area.height = height;
|
|
|
|
attr->preedit_fontset = widget->style->font;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
editable->ic = gdk_ic_new (attr, attrmask);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->ic == NULL)
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
g_warning ("Can't create input context.");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mask = gdk_window_get_events (text->text_area);
|
1998-03-01 05:11:05 +00:00
|
|
|
mask |= gdk_ic_get_events (editable->ic);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
gdk_window_set_events (text->text_area, mask);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget))
|
|
|
|
gdk_im_begin (editable->ic, text->text_area);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
1998-08-21 00:13:38 +00:00
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
realize_properties (text);
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_show (text->text_area);
|
1998-08-25 00:06:38 +00:00
|
|
|
init_properties (text);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos != editable->selection_end_pos)
|
|
|
|
gtk_editable_claim_selection (editable, TRUE, GDK_CURRENT_TIME);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
recompute_geometry (text);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-05-10 02:46:20 +00:00
|
|
|
static void
|
2000-03-14 19:57:25 +00:00
|
|
|
gtk_text_style_set (GtkWidget *widget,
|
|
|
|
GtkStyle *previous_style)
|
1998-05-10 02:46:20 +00:00
|
|
|
{
|
2000-03-14 19:57:25 +00:00
|
|
|
GtkText *text = GTK_TEXT (widget);
|
|
|
|
|
1998-05-10 02:46:20 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (widget))
|
|
|
|
{
|
2000-03-14 19:57:25 +00:00
|
|
|
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
|
|
|
gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1999-01-20 18:06:31 +00:00
|
|
|
if (text->bg_gc)
|
|
|
|
{
|
|
|
|
gdk_gc_destroy (text->bg_gc);
|
|
|
|
text->bg_gc = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
|
|
|
text->bg_gc = create_bg_gc (text);
|
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
recompute_geometry (text);
|
1998-05-10 02:46:20 +00:00
|
|
|
}
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
if (text->current_font)
|
|
|
|
text_font_unref (text->current_font);
|
|
|
|
text->current_font = get_text_font (widget->style->font);
|
1998-05-10 02:46:20 +00:00
|
|
|
}
|
|
|
|
|
2000-03-14 19:57:25 +00:00
|
|
|
static void
|
|
|
|
gtk_text_state_changed (GtkWidget *widget,
|
|
|
|
GtkStateType previous_state)
|
|
|
|
{
|
|
|
|
GtkText *text = GTK_TEXT (widget);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (widget))
|
|
|
|
{
|
|
|
|
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
|
|
|
gdk_window_set_background (text->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_text_unrealize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (widget));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text = GTK_TEXT (widget);
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
|
|
|
#ifdef USE_XIM
|
|
|
|
if (GTK_EDITABLE (widget)->ic)
|
|
|
|
{
|
|
|
|
gdk_ic_destroy (GTK_EDITABLE (widget)->ic);
|
|
|
|
GTK_EDITABLE (widget)->ic = NULL;
|
|
|
|
}
|
|
|
|
if (GTK_EDITABLE (widget)->ic_attr)
|
|
|
|
{
|
|
|
|
gdk_ic_attr_destroy (GTK_EDITABLE (widget)->ic_attr);
|
|
|
|
GTK_EDITABLE (widget)->ic_attr = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
gdk_window_set_user_data (text->text_area, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_destroy (text->text_area);
|
|
|
|
text->text_area = NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-02 20:40:03 +00:00
|
|
|
gdk_gc_destroy (text->gc);
|
1997-11-24 22:37:52 +00:00
|
|
|
text->gc = NULL;
|
1999-01-20 18:06:31 +00:00
|
|
|
|
|
|
|
if (text->bg_gc)
|
|
|
|
{
|
|
|
|
gdk_gc_destroy (text->bg_gc);
|
|
|
|
text->bg_gc = NULL;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-15 21:27:17 +00:00
|
|
|
gdk_pixmap_unref (text->line_wrap_bitmap);
|
|
|
|
gdk_pixmap_unref (text->line_arrow_bitmap);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
unrealize_properties (text);
|
|
|
|
|
1999-02-16 04:52:21 +00:00
|
|
|
free_cache (text);
|
|
|
|
|
1998-02-12 03:02:14 +00:00
|
|
|
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
|
|
|
|
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clear_focus_area (GtkText *text, gint area_x, gint area_y, gint area_width, gint area_height)
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkWidget *widget = GTK_WIDGET (text);
|
|
|
|
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
gint ythick = TEXT_BORDER_ROOM + widget->style->ythickness;
|
|
|
|
gint xthick = TEXT_BORDER_ROOM + widget->style->xthickness;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gint width, height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gdk_window_get_size (widget->style->bg_pixmap[GTK_STATE_NORMAL], &width, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1999-01-20 18:06:31 +00:00
|
|
|
gdk_gc_set_ts_origin (text->bg_gc,
|
|
|
|
(- text->first_onscreen_hor_pixel + xthick) % width,
|
|
|
|
(- text->first_onscreen_ver_pixel + ythick) % height);
|
1998-03-08 21:47:14 +00:00
|
|
|
|
1999-01-20 18:06:31 +00:00
|
|
|
gdk_draw_rectangle (GTK_WIDGET (text)->window, text->bg_gc, TRUE,
|
|
|
|
area_x, area_y, area_width, area_height);
|
|
|
|
}
|
1998-03-08 21:47:14 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_text_draw_focus (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
|
|
|
gint width, height;
|
|
|
|
gint x, y;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (widget));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text = GTK_TEXT (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
gint ythick = widget->style->ythickness;
|
|
|
|
gint xthick = widget->style->xthickness;
|
1998-03-08 21:47:14 +00:00
|
|
|
gint xextra = TEXT_BORDER_ROOM;
|
|
|
|
gint yextra = TEXT_BORDER_ROOM;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TDEBUG (("in gtk_text_draw_focus\n"));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
width = widget->allocation.width;
|
|
|
|
height = widget->allocation.height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget))
|
|
|
|
{
|
|
|
|
x += 1;
|
|
|
|
y += 1;
|
|
|
|
width -= 2;
|
|
|
|
height -= 2;
|
1998-03-08 21:47:14 +00:00
|
|
|
xextra -= 1;
|
|
|
|
yextra -= 1;
|
1998-11-06 22:05:02 +00:00
|
|
|
|
|
|
|
gtk_paint_focus (widget->style, widget->window,
|
|
|
|
NULL, widget, "text",
|
|
|
|
0, 0,
|
|
|
|
widget->allocation.width - 1,
|
|
|
|
widget->allocation.height - 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
|
|
|
|
gtk_paint_shadow (widget->style, widget->window,
|
|
|
|
GTK_STATE_NORMAL, GTK_SHADOW_IN,
|
|
|
|
NULL, widget, "text",
|
|
|
|
x, y, width, height);
|
|
|
|
|
1998-03-08 21:47:14 +00:00
|
|
|
x += xthick;
|
|
|
|
y += ythick;
|
|
|
|
width -= 2 * xthick;
|
|
|
|
height -= 2 * ythick;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-04-30 15:18:19 +00:00
|
|
|
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
1998-03-08 21:47:14 +00:00
|
|
|
{
|
|
|
|
/* top rect */
|
|
|
|
clear_focus_area (text, x, y, width, yextra);
|
|
|
|
/* left rect */
|
|
|
|
clear_focus_area (text, x, y + yextra,
|
|
|
|
xextra, y + height - 2 * yextra);
|
|
|
|
/* right rect */
|
|
|
|
clear_focus_area (text, x + width - xextra, y + yextra,
|
|
|
|
xextra, height - 2 * ythick);
|
|
|
|
/* bottom rect */
|
|
|
|
clear_focus_area (text, x, x + height - yextra, width, yextra);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TDEBUG (("in gtk_text_draw_focus (undrawable !!!)\n"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition)
|
|
|
|
{
|
|
|
|
gint xthickness;
|
|
|
|
gint ythickness;
|
|
|
|
gint char_height;
|
|
|
|
gint char_width;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (widget));
|
|
|
|
g_return_if_fail (requisition != NULL);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
xthickness = widget->style->xthickness + TEXT_BORDER_ROOM;
|
|
|
|
ythickness = widget->style->ythickness + TEXT_BORDER_ROOM;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
char_height = MIN_TEXT_HEIGHT_LINES * (widget->style->font->ascent +
|
|
|
|
widget->style->font->descent);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
char_width = MIN_TEXT_WIDTH_LINES * (gdk_text_width (widget->style->font,
|
|
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
|
|
26)
|
|
|
|
/ 26);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
requisition->width = char_width + xthickness * 2;
|
|
|
|
requisition->height = char_height + ythickness * 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (widget));
|
|
|
|
g_return_if_fail (allocation != NULL);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text = GTK_TEXT (widget);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
widget->allocation = *allocation;
|
|
|
|
if (GTK_WIDGET_REALIZED (widget))
|
|
|
|
{
|
|
|
|
gdk_window_move_resize (widget->window,
|
|
|
|
allocation->x, allocation->y,
|
|
|
|
allocation->width, allocation->height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_move_resize (text->text_area,
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
widget->style->xthickness + TEXT_BORDER_ROOM,
|
|
|
|
widget->style->ythickness + TEXT_BORDER_ROOM,
|
|
|
|
MAX (1, (gint)widget->allocation.width - (gint)(widget->style->xthickness +
|
1998-09-15 14:59:48 +00:00
|
|
|
(gint)TEXT_BORDER_ROOM) * 2),
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
MAX (1, (gint)widget->allocation.height - (gint)(widget->style->ythickness +
|
1998-09-15 14:59:48 +00:00
|
|
|
(gint)TEXT_BORDER_ROOM) * 2));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
#ifdef USE_XIM
|
1998-08-25 00:06:38 +00:00
|
|
|
if (editable->ic && (gdk_ic_get_style (editable->ic) & GDK_IM_PREEDIT_POSITION))
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
{
|
|
|
|
gint width, height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, &height);
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
editable->ic_attr->preedit_area.width = width;
|
|
|
|
editable->ic_attr->preedit_area.height = height;
|
|
|
|
|
|
|
|
gdk_ic_set_attr (editable->ic,
|
|
|
|
editable->ic_attr, GDK_IC_PREEDIT_AREA);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
}
|
|
|
|
#endif
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
recompute_geometry (text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_draw (GtkWidget *widget,
|
|
|
|
GdkRectangle *area)
|
|
|
|
{
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (widget));
|
|
|
|
g_return_if_fail (area != NULL);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (GTK_WIDGET_DRAWABLE (widget))
|
|
|
|
{
|
|
|
|
expose_text (GTK_TEXT (widget), area, TRUE);
|
|
|
|
gtk_widget_draw_focus (widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_text_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (event->window == GTK_TEXT (widget)->text_area)
|
|
|
|
{
|
|
|
|
TDEBUG (("in gtk_text_expose (expose)\n"));
|
|
|
|
expose_text (GTK_TEXT (widget), &event->area, TRUE);
|
|
|
|
}
|
|
|
|
else if (event->count == 0)
|
|
|
|
{
|
|
|
|
TDEBUG (("in gtk_text_expose (focus)\n"));
|
|
|
|
gtk_widget_draw_focus (widget);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
static gint
|
|
|
|
gtk_text_scroll_timeout (gpointer data)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
|
|
|
GdkEventMotion event;
|
|
|
|
gint x, y;
|
|
|
|
GdkModifierType mask;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-12-16 20:09:30 +00:00
|
|
|
GDK_THREADS_ENTER ();
|
1998-12-15 07:32:11 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
text = GTK_TEXT (data);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
text->timer = 0;
|
|
|
|
gdk_window_get_pointer (text->text_area, &x, &y, &mask);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-12-15 07:32:11 +00:00
|
|
|
if (mask & (GDK_BUTTON1_MASK | GDK_BUTTON3_MASK))
|
|
|
|
{
|
|
|
|
event.is_hint = 0;
|
|
|
|
event.x = x;
|
|
|
|
event.y = y;
|
|
|
|
event.state = mask;
|
|
|
|
|
|
|
|
gtk_text_motion_notify (GTK_WIDGET (text), &event);
|
|
|
|
}
|
|
|
|
|
1998-12-16 20:09:30 +00:00
|
|
|
GDK_THREADS_LEAVE ();
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint
|
|
|
|
gtk_text_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *event)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
|
|
|
static GdkAtom ctext_atom = GDK_NONE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (ctext_atom == GDK_NONE)
|
|
|
|
ctext_atom = gdk_atom_intern ("COMPOUND_TEXT", FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
text = GTK_TEXT (widget);
|
|
|
|
editable = GTK_EDITABLE (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-27 05:17:11 +00:00
|
|
|
if (text->button && (event->button != text->button))
|
|
|
|
return FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
text->button = event->button;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
|
|
|
gtk_widget_grab_focus (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (event->button == 1)
|
|
|
|
{
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
1998-03-10 03:17:02 +00:00
|
|
|
gtk_grab_add (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
1998-03-10 03:17:02 +00:00
|
|
|
find_mouse_cursor (text, (gint)event->x, (gint)event->y);
|
1998-03-01 05:11:05 +00:00
|
|
|
draw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
/* Set it now, so we display things right. We'll unset it
|
|
|
|
* later if things don't work out */
|
|
|
|
editable->has_selection = TRUE;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_text_set_selection (GTK_EDITABLE(text),
|
|
|
|
text->cursor_mark.index,
|
|
|
|
text->cursor_mark.index);
|
1998-03-07 03:05:36 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
case GDK_2BUTTON_PRESS:
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_text_select_word (text, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
case GDK_3BUTTON_PRESS:
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_text_select_line (text, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (event->type == GDK_BUTTON_PRESS)
|
|
|
|
{
|
1998-03-07 03:05:36 +00:00
|
|
|
if ((event->button == 2) && editable->editable)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos == editable->selection_end_pos ||
|
|
|
|
editable->has_selection)
|
|
|
|
{
|
|
|
|
undraw_cursor (text, FALSE);
|
1998-03-10 03:17:02 +00:00
|
|
|
find_mouse_cursor (text, (gint)event->x, (gint)event->y);
|
1998-03-01 05:11:05 +00:00
|
|
|
draw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
1998-03-01 08:47:36 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_selection_convert (widget, GDK_SELECTION_PRIMARY,
|
|
|
|
ctext_atom, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
gtk_grab_add (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
|
|
|
find_mouse_cursor (text, event->x, event->y);
|
|
|
|
draw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_text_set_selection (GTK_EDITABLE(text),
|
|
|
|
text->cursor_mark.index,
|
|
|
|
text->cursor_mark.index);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
editable->has_selection = FALSE;
|
|
|
|
if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
|
|
|
|
gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_text_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *event)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
text = GTK_TEXT (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
gtk_grab_remove (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (text->button != event->button)
|
|
|
|
return FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
text->button = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if (text->timer)
|
|
|
|
{
|
|
|
|
gtk_timeout_remove (text->timer);
|
|
|
|
text->timer = 0;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (event->button == 1)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
text = GTK_TEXT (widget);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_grab_remove (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
editable->has_selection = FALSE;
|
|
|
|
if (editable->selection_start_pos != editable->selection_end_pos)
|
|
|
|
{
|
|
|
|
if (gtk_selection_owner_set (widget,
|
|
|
|
GDK_SELECTION_PRIMARY,
|
|
|
|
event->time))
|
1998-03-07 03:05:36 +00:00
|
|
|
editable->has_selection = TRUE;
|
|
|
|
else
|
|
|
|
gtk_text_update_text (editable, editable->selection_start_pos,
|
|
|
|
editable->selection_end_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
|
|
|
|
gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, event->time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (event->button == 3)
|
|
|
|
{
|
|
|
|
gtk_grab_remove (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
|
|
|
find_cursor (text, TRUE);
|
|
|
|
draw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_text_motion_notify (GtkWidget *widget,
|
1998-03-07 03:05:36 +00:00
|
|
|
GdkEventMotion *event)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-03-07 03:05:36 +00:00
|
|
|
gint x, y;
|
|
|
|
gint height;
|
|
|
|
GdkModifierType mask;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text = GTK_TEXT (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
x = event->x;
|
1998-03-07 03:05:36 +00:00
|
|
|
y = event->y;
|
|
|
|
mask = event->state;
|
1997-11-24 22:37:52 +00:00
|
|
|
if (event->is_hint || (text->text_area != event->window))
|
1998-03-07 03:05:36 +00:00
|
|
|
{
|
|
|
|
gdk_window_get_pointer (text->text_area, &x, &y, &mask);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if ((text->button == 0) ||
|
|
|
|
!(mask & (GDK_BUTTON1_MASK | GDK_BUTTON3_MASK)))
|
1998-03-07 03:05:36 +00:00
|
|
|
return FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
gdk_window_get_size (text->text_area, NULL, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if ((y < 0) || (y > height))
|
|
|
|
{
|
|
|
|
if (text->timer == 0)
|
|
|
|
{
|
|
|
|
text->timer = gtk_timeout_add (SCROLL_TIME,
|
|
|
|
gtk_text_scroll_timeout,
|
|
|
|
text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if (y < 0)
|
|
|
|
scroll_int (text, y/2);
|
|
|
|
else
|
|
|
|
scroll_int (text, (y - height)/2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
undraw_cursor (GTK_TEXT (widget), FALSE);
|
1998-03-07 03:05:36 +00:00
|
|
|
find_mouse_cursor (GTK_TEXT (widget), x, y);
|
1998-03-01 05:11:05 +00:00
|
|
|
draw_cursor (GTK_TEXT (widget), FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_text_set_selection (GTK_EDITABLE(text),
|
|
|
|
GTK_EDITABLE(text)->selection_start_pos,
|
|
|
|
text->cursor_mark.index);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
|
|
|
gtk_text_insert_text (GtkEditable *editable,
|
|
|
|
const gchar *new_text,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint new_text_length,
|
|
|
|
gint *position)
|
1998-01-13 15:14:54 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkText *text = GTK_TEXT (editable);
|
1998-08-25 00:06:38 +00:00
|
|
|
GdkFont *font;
|
|
|
|
GdkColor *fore, *back;
|
|
|
|
|
|
|
|
TextProperty *property;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_text_set_point (text, *position);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
property = MARK_CURRENT_PROPERTY (&text->point);
|
|
|
|
font = property->flags & PROPERTY_FONT ? property->font->gdk_font : NULL;
|
|
|
|
fore = property->flags & PROPERTY_FOREGROUND ? &property->fore_color : NULL;
|
|
|
|
back = property->flags & PROPERTY_BACKGROUND ? &property->back_color : NULL;
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
gtk_text_insert (text, font, fore, back, new_text, new_text_length);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
*position = text->point.index;
|
1998-01-13 15:14:54 +00:00
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
|
|
|
gtk_text_delete_text (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start_pos,
|
|
|
|
gint end_pos)
|
1998-01-13 15:14:54 +00:00
|
|
|
{
|
1998-06-11 17:52:12 +00:00
|
|
|
GtkText *text;
|
|
|
|
|
|
|
|
g_return_if_fail (start_pos >= 0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-11 17:52:12 +00:00
|
|
|
text = GTK_TEXT (editable);
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
gtk_text_set_point (text, start_pos);
|
1998-03-01 08:47:36 +00:00
|
|
|
if (end_pos < 0)
|
|
|
|
end_pos = TEXT_LENGTH (text);
|
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
if (end_pos > start_pos)
|
|
|
|
gtk_text_forward_delete (text, end_pos - start_pos);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_text_key_press (GtkWidget *widget,
|
|
|
|
GdkEventKey *event)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
1997-11-24 22:37:52 +00:00
|
|
|
gchar key;
|
|
|
|
gint return_val;
|
1998-05-22 07:07:11 +00:00
|
|
|
gint position;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return_val = FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text = GTK_TEXT (widget);
|
1998-03-01 05:11:05 +00:00
|
|
|
editable = GTK_EDITABLE (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
key = event->keyval;
|
|
|
|
return_val = TRUE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-11 19:06:18 +00:00
|
|
|
if ((GTK_EDITABLE(text)->editable == FALSE))
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
{
|
|
|
|
switch (event->keyval)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
case GDK_Home:
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
1999-02-24 18:47:49 +00:00
|
|
|
scroll_int (text, -text->vadj->value);
|
|
|
|
else
|
|
|
|
return_val = FALSE;
|
1998-03-10 03:17:02 +00:00
|
|
|
break;
|
|
|
|
case GDK_End:
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
scroll_int (text, +text->vadj->upper);
|
1999-02-24 18:47:49 +00:00
|
|
|
else
|
|
|
|
return_val = FALSE;
|
1998-03-10 03:17:02 +00:00
|
|
|
break;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
case GDK_Page_Up: scroll_int (text, -text->vadj->page_increment); break;
|
|
|
|
case GDK_Page_Down: scroll_int (text, +text->vadj->page_increment); break;
|
|
|
|
case GDK_Up: scroll_int (text, -KEY_SCROLL_PIXELS); break;
|
|
|
|
case GDK_Down: scroll_int (text, +KEY_SCROLL_PIXELS); break;
|
1998-03-10 03:17:02 +00:00
|
|
|
case GDK_Return:
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
|
1999-02-24 18:47:49 +00:00
|
|
|
else
|
|
|
|
return_val = FALSE;
|
1998-03-10 03:17:02 +00:00
|
|
|
break;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
default:
|
|
|
|
return_val = FALSE;
|
|
|
|
break;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
gint extend_selection;
|
|
|
|
gint extend_start;
|
1998-03-10 03:17:02 +00:00
|
|
|
guint initial_pos = editable->current_pos;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
text->point = find_mark (text, text->cursor_mark.index);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
extend_selection = event->state & GDK_SHIFT_MASK;
|
|
|
|
extend_start = FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (extend_selection)
|
|
|
|
{
|
1998-03-08 21:47:14 +00:00
|
|
|
editable->has_selection = TRUE;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos == editable->selection_end_pos)
|
|
|
|
{
|
|
|
|
editable->selection_start_pos = text->point.index;
|
|
|
|
editable->selection_end_pos = text->point.index;
|
|
|
|
}
|
|
|
|
|
|
|
|
extend_start = (text->point.index == editable->selection_start_pos);
|
|
|
|
}
|
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
switch (event->keyval)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
case GDK_Home:
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
move_cursor_buffer_ver (text, -1);
|
|
|
|
else
|
|
|
|
gtk_text_move_beginning_of_line (text);
|
|
|
|
break;
|
|
|
|
case GDK_End:
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
move_cursor_buffer_ver (text, +1);
|
|
|
|
else
|
|
|
|
gtk_text_move_end_of_line (text);
|
|
|
|
break;
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
case GDK_Page_Up: move_cursor_page_ver (text, -1); break;
|
|
|
|
case GDK_Page_Down: move_cursor_page_ver (text, +1); break;
|
1998-03-10 03:17:02 +00:00
|
|
|
/* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
case GDK_Up: move_cursor_ver (text, -1); break;
|
|
|
|
case GDK_Down: move_cursor_ver (text, +1); break;
|
1998-03-10 03:17:02 +00:00
|
|
|
case GDK_Left:
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
gtk_text_move_backward_word (text);
|
|
|
|
else
|
|
|
|
move_cursor_hor (text, -1);
|
|
|
|
break;
|
|
|
|
case GDK_Right:
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
gtk_text_move_forward_word (text);
|
|
|
|
else
|
|
|
|
move_cursor_hor (text, +1);
|
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
case GDK_BackSpace:
|
1998-03-10 03:17:02 +00:00
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
gtk_text_delete_backward_word (text);
|
|
|
|
else
|
|
|
|
gtk_text_delete_backward_character (text);
|
|
|
|
break;
|
|
|
|
case GDK_Clear:
|
|
|
|
gtk_text_delete_line (text);
|
|
|
|
break;
|
|
|
|
case GDK_Insert:
|
|
|
|
if (event->state & GDK_SHIFT_MASK)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
extend_selection = FALSE;
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_editable_paste_clipboard (editable);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
1998-03-10 03:17:02 +00:00
|
|
|
else if (event->state & GDK_CONTROL_MASK)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_editable_copy_clipboard (editable);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
1998-03-10 03:17:02 +00:00
|
|
|
else
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
/* gtk_toggle_insert(text) -- IMPLEMENT */
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
1998-03-10 03:17:02 +00:00
|
|
|
break;
|
|
|
|
case GDK_Delete:
|
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
gtk_text_delete_forward_word (text);
|
|
|
|
else if (event->state & GDK_SHIFT_MASK)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
extend_selection = FALSE;
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_editable_cut_clipboard (editable);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
1998-03-10 03:17:02 +00:00
|
|
|
else
|
|
|
|
gtk_text_delete_forward_character (text);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
break;
|
|
|
|
case GDK_Tab:
|
1998-05-22 07:07:11 +00:00
|
|
|
position = text->point.index;
|
|
|
|
gtk_editable_insert_text (editable, "\t", 1, &position);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
break;
|
|
|
|
case GDK_Return:
|
1998-03-10 03:17:02 +00:00
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
gtk_signal_emit_by_name (GTK_OBJECT (text), "activate");
|
|
|
|
else
|
1998-03-18 21:11:04 +00:00
|
|
|
{
|
1998-05-22 07:07:11 +00:00
|
|
|
position = text->point.index;
|
|
|
|
gtk_editable_insert_text (editable, "\n", 1, &position);
|
1998-03-18 21:11:04 +00:00
|
|
|
}
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
break;
|
|
|
|
case GDK_Escape:
|
|
|
|
/* Don't insert literally */
|
|
|
|
return_val = FALSE;
|
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
default:
|
|
|
|
return_val = FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
if (event->state & GDK_CONTROL_MASK)
|
|
|
|
{
|
|
|
|
if ((key >= 'A') && (key <= 'Z'))
|
|
|
|
key -= 'A' - 'a';
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if ((key >= 'a') && (key <= 'z') && control_keys[(int) (key - 'a')])
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 10:19:22 +00:00
|
|
|
(* control_keys[(int) (key - 'a')]) (editable, event->time);
|
1997-11-24 22:37:52 +00:00
|
|
|
return_val = TRUE;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (event->state & GDK_MOD1_MASK)
|
|
|
|
{
|
|
|
|
if ((key >= 'A') && (key <= 'Z'))
|
|
|
|
key -= 'A' - 'a';
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if ((key >= 'a') && (key <= 'z') && alt_keys[(int) (key - 'a')])
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 10:19:22 +00:00
|
|
|
(* alt_keys[(int) (key - 'a')]) (editable, event->time);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
return_val = TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
}
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
else if (event->length > 0)
|
|
|
|
{
|
1998-03-01 08:47:36 +00:00
|
|
|
extend_selection = FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
gtk_editable_delete_selection (editable);
|
|
|
|
position = text->point.index;
|
|
|
|
gtk_editable_insert_text (editable, event->string, event->length, &position);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
return_val = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return_val = FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (return_val && (editable->current_pos != initial_pos))
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
if (extend_selection)
|
|
|
|
{
|
|
|
|
if (editable->current_pos < editable->selection_start_pos)
|
|
|
|
gtk_text_set_selection (editable, editable->current_pos,
|
|
|
|
editable->selection_end_pos);
|
|
|
|
else if (editable->current_pos > editable->selection_end_pos)
|
|
|
|
gtk_text_set_selection (editable, editable->selection_start_pos,
|
|
|
|
editable->current_pos);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (extend_start)
|
|
|
|
gtk_text_set_selection (editable, editable->current_pos,
|
|
|
|
editable->selection_end_pos);
|
|
|
|
else
|
|
|
|
gtk_text_set_selection (editable, editable->selection_start_pos,
|
|
|
|
editable->current_pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_text_set_selection (editable, 0, 0);
|
|
|
|
|
|
|
|
gtk_editable_claim_selection (editable,
|
|
|
|
editable->selection_start_pos != editable->selection_end_pos,
|
|
|
|
event->time);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return return_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_text_focus_in (GtkWidget *widget,
|
|
|
|
GdkEventFocus *event)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TDEBUG (("in gtk_text_focus_in\n"));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
|
|
|
|
gtk_widget_draw_focus (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
#ifdef USE_XIM
|
1998-03-01 05:11:05 +00:00
|
|
|
if (GTK_EDITABLE(widget)->ic)
|
|
|
|
gdk_im_begin (GTK_EDITABLE(widget)->ic, GTK_TEXT(widget)->text_area);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
#endif
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
draw_cursor (GTK_TEXT(widget), TRUE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_text_focus_out (GtkWidget *widget,
|
|
|
|
GdkEventFocus *event)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TDEBUG (("in gtk_text_focus_out\n"));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
|
|
|
|
gtk_widget_draw_focus (widget);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
undraw_cursor (GTK_TEXT(widget), TRUE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
#ifdef USE_XIM
|
|
|
|
gdk_im_end ();
|
|
|
|
#endif
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_adjustment (GtkAdjustment *adjustment,
|
|
|
|
GtkText *text)
|
|
|
|
{
|
|
|
|
g_return_if_fail (adjustment != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
/* Just ignore it if we haven't been size-allocated and realized yet */
|
|
|
|
if (text->line_start_cache == NULL)
|
1998-05-10 02:46:20 +00:00
|
|
|
return;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (adjustment == text->hadj)
|
|
|
|
{
|
|
|
|
g_warning ("horizontal scrolling not implemented");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gint diff = ((gint)adjustment->value) - text->last_ver_value;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (diff != 0)
|
|
|
|
{
|
|
|
|
undraw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (diff > 0)
|
|
|
|
scroll_down (text, diff);
|
|
|
|
else /* if (diff < 0) */
|
|
|
|
scroll_up (text, diff);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
draw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->last_ver_value = adjustment->value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_disconnect (GtkAdjustment *adjustment,
|
|
|
|
GtkText *text)
|
|
|
|
{
|
|
|
|
g_return_if_fail (adjustment != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
|
|
|
g_return_if_fail (text != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TEXT (text));
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (adjustment == text->hadj)
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
gtk_text_set_adjustments (text, NULL, text->vadj);
|
1997-11-24 22:37:52 +00:00
|
|
|
if (adjustment == text->vadj)
|
added args ::show_text, ::text_xalign, ::text_yalign, ::activity_mode.
Sun Nov 22 16:21:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkprogress.c: added args ::show_text, ::text_xalign,
::text_yalign, ::activity_mode.
* gtk/gtkprogressbar.c: added construct arg ::adjustment. added args
::bar_style, ::orientation, ::discrete_blocks, ::activity_step,
::activity_blocks.
(gtk_progress_bar_new):
(gtk_progress_bar_new_with_adjustment): use gtk_widget_new().
(gtk_progress_bar_construct): deprecated.
* gtk/gtkvscrollbar.c:
(gtk_vscrollbar_draw_step_back):
(gtk_vscrollbar_draw_step_forw): use "vscrollbar" as detail for
gtk_paint_arrow, to be consistent with hscrollbar.
* gtk/gtktext.c
added construct args ::hadjustment, ::vadjustment.
added args ::line_wrap, ::word_wrap.
(gtk_text_class_init): added scroll_adjustments signal.
(gtk_text_new): use gtk_widget_new.
(gtk_text_disconnect): remove adjustement with gtk_text_set_adjustments,
so we don't screw the reference counts and don't leave signals connected.
(gtk_text_destroy): disconnect adjustments signals.
(gtk_text_finalize): unref adjustments.
* gtk/gtkctree.c: added construct args ::n_columns and ::tree_column.
added args ::indent, ::spacing, ::show_stub, ::reorderable,
::use_drag_icons, ::line_style and ::expander_style.
(gtk_ctree_set_show_stub): renamed from gtk_ctree_show_stub, which is
deprecated now.
* gtk/gtkclist.h: remove GTK_CLIST_CONSTRUCT flag.
* gtk/gtkclist.c:
removed ::vadjustment and ::hadjustment args, introduced
::scroll_adjustments signal.
added ::shadow_type, ::selection_mode and ::row_height args.
added n_columns construct arg.
(gtk_clist_construct): call gtk_object_constructed().
(gtk_clist_set_row_height): if height is passed as 0,
revert to automatic height calculation.
(gtk_clist_destroy): before unrefing the adjustments, disconnect our
signal handlers.
Fri Nov 21 22:34:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_new): call gtk_object_default_construct
like gtk_object_new.
(gtk_widget_destroy): assert that we only destroy constructed widgets.
* gtk/gtkobject.h (enum GtkArgFlags): new flag GTK_ARG_CONSTRUCT_ONLY
to identify args that may only be used for construction.
GTK_ARG_CONSTRUCT maybe used as normal arguments besides construction
time.
* gtk/gtkobject.c (gtk_object_new): invoke gtk_object_default_construct
at the end if the object is not fully constructed.
(gtk_object_newv): likewise.
(gtk_object_destroy): assert that we only destroy constructed objects.
(gtk_object_init): setup GTK_CONSTRUCTED from the
objects real klass.
(gtk_object_default_construct): new function to complete default
construction of an object by applying missing construtor args with
default values of 0, 0.0 or NULL.
(gtk_object_constructed): new function to mark an object as being
constructed (used from within constructors).
* gtk/gtkarg.c (gtk_arg_type_new_static): return the args info pointer
so it is immediatedly available for the caller.
* gtk/gtktypeutils.c (gtk_type_new): pass an object's real class to
the object initilizer (GtkObjectInitFunc takes a second arg now, the
real klass), and asure that object initializers may temporarily alter
the class pointer.
Fri Nov 20 08:00:30 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: change all occourances of gtk_container_add (
scrolled_window, widget) to gtk_scrolled_window_add_with_viewport (...)
for widget!=(clist, ctree, text, viewport).
* gtk/gtkcombo.c:
(gtk_combo_init): use gtk_scrolled_window_add_with_viewport()
to add children to the scrolled window.
* gtk/gtkscrolledwindow.h:
* gtk/gtkscrolledwindow.c:
changed scrolled_window->viewport to scrolled_window->child, and use
gtk_widget_scroll_adjustements() to set the scroll adjustments for the
widget, we do not create an additional viewport anymore.
added ::hadjustment and ::vadjustment constructor args.
(gtk_scrolled_window_new): use gtk_widget_new() to create the widget.
(gtk_scrolled_window_set_hadjustment):
(gtk_scrolled_window_set_vadjustment): new functions that superceed
gtk_scrolled_window_construct.
(gtk_scrolled_window_construct): deprecated this function.
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
support a constructor arg "::adjustment", and use gtk_widget_new() for
the widget creation.
* gtk/gtkrange.c: added ::update_policy arg.
(gtk_range_set_adjustment): if adjustment is passed in as NULL, create
a default adjustment so this function can be used for derived widgets
that depend on the adjustment's existance.
(gtk_range_destroy): disconnect the adjustment signal, so we don't
get called after we got destroyed, we don't destroy the adjustment
in here, because it might have been provided from another widget.
* gtk/gtkviewport.c: introduced ::scroll_adjustments signal.
(gtk_viewport_destroy): same as gtk_range_destroy.
* gtk/gtkprogress.c (gtk_progress_destroy): same as gtk_range_destroy.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: changed gtk_widget_activate() to return a
gboolean, indicating whether this widget supports activation.
added gtk_widget_scroll_adjustements() to set the scrolling
adjustments of a widget.
Wed Nov 19 01:22:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c:
(gtk_option_menu_remove_contents):
(gtk_option_menu_update_contents): removed
gtk_container_[un]block_resize() pairs.
* gtk/gtknotebook.h:
* gtk/gtknotebook.c: removed the tab_border field, since it shouldn't
be used outside of gtknotebook.c anyways. made ARG_TAB_BORDER a
wrtie-only argument.
* *.c: made deprecated functions issue a message:
gtk_clist_set_border, gtk_container_block_resize,
gtk_container_unblock_resize, gtk_container_need_resize,
gtk_object_class_add_user_signal, gtk_spin_button_construct,
gtk_scrolled_window_construct.
removed non-functional functions:
gtk_container_disable_resize, gtk_container_enable_resize,
gtk_clist_set_policy.
Wed Nov 18 22:54:36 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbox.c (gtk_box_init):
* gtk/gtkdrawingarea.c (gtk_drawing_area_init):
* gtk/gtkeventbox.c (gtk_event_box_init):
* gtk/gtkfixed.c (gtk_fixed_init):
* gtk/gtkframe.c (gtk_frame_init):
* gtk/gtkhandlebox.c (gtk_handle_box_init):
* gtk/gtkpacker.c (gtk_packer_init):
* gtk/gtkmisc.c (gtk_misc_init):
* gtk/gtkpreview.c (gtk_preview_init):
* gtk/gtkprogress.c (gtk_progress_init):
* gtk/gtkprogressbar.c (gtk_progress_bar_init):
* gtk/gtkseparator.c (gtk_separator_init):
* gtk/gtktable.c (gtk_table_init):
* gtk/gtkviewport.c (gtk_viewport_init):
* gtk/gtkalignment.c (gtk_alignment_init):
removed setting of the GTK_BASIC flag.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c:
removed GTK_BASIC, GTK_WIDGET_BASIC and gtk_widget_basic.
* miscellaneous GtkType and macro fixups.
1998-11-23 01:54:45 +00:00
|
|
|
gtk_text_set_adjustments (text, text->hadj, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GtkPropertyMark
|
|
|
|
find_this_line_start_mark (GtkText* text, guint point_position, const GtkPropertyMark* near)
|
|
|
|
{
|
|
|
|
GtkPropertyMark mark;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
mark = find_mark_near (text, point_position, near);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (mark.index > 0 &&
|
1998-02-27 06:13:22 +00:00
|
|
|
GTK_TEXT_INDEX (text, mark.index - 1) != LINE_DELIM)
|
1997-11-24 22:37:52 +00:00
|
|
|
decrement_mark (&mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return mark;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_tab_cont (GtkText* text, PrevTabCont* tab_cont)
|
|
|
|
{
|
|
|
|
tab_cont->pixel_offset = 0;
|
|
|
|
tab_cont->tab_start.tab_stops = text->tab_stops;
|
|
|
|
tab_cont->tab_start.to_next_tab = (gulong) text->tab_stops->data;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!tab_cont->tab_start.to_next_tab)
|
|
|
|
tab_cont->tab_start.to_next_tab = text->default_tab_width;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
line_params_iterate (GtkText* text,
|
|
|
|
const GtkPropertyMark* mark0,
|
|
|
|
const PrevTabCont* tab_mark0,
|
|
|
|
gint8 alloc,
|
|
|
|
void* data,
|
|
|
|
LineIteratorFunction iter)
|
1998-08-18 03:59:41 +00:00
|
|
|
/* mark0 MUST be a real line start. if ALLOC, allocate line params
|
|
|
|
* from a mem chunk. DATA is passed to ITER_CALL, which is called
|
|
|
|
* for each line following MARK, iteration continues unless ITER_CALL
|
|
|
|
* returns TRUE. */
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkPropertyMark mark = *mark0;
|
|
|
|
PrevTabCont tab_conts[2];
|
|
|
|
LineParams *lp, lpbuf;
|
|
|
|
gint tab_cont_index = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (tab_mark0)
|
|
|
|
tab_conts[0] = *tab_mark0;
|
|
|
|
else
|
|
|
|
init_tab_cont (text, tab_conts);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (alloc)
|
|
|
|
lp = g_chunk_new (LineParams, params_mem_chunk);
|
|
|
|
else
|
|
|
|
lp = &lpbuf;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
*lp = find_line_params (text, &mark, tab_conts + tab_cont_index,
|
|
|
|
tab_conts + (tab_cont_index + 1) % 2);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if ((*iter) (text, lp, data))
|
|
|
|
return;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (LAST_INDEX (text, lp->end))
|
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
mark = lp->end;
|
|
|
|
advance_mark (&mark);
|
|
|
|
tab_cont_index = (tab_cont_index + 1) % 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
fetch_lines_iterator (GtkText* text, LineParams* lp, void* data)
|
|
|
|
{
|
|
|
|
FetchLinesData *fldata = (FetchLinesData*) data;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
fldata->new_lines = g_list_prepend (fldata->new_lines, lp);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
switch (fldata->fl_type)
|
|
|
|
{
|
|
|
|
case FetchLinesCount:
|
|
|
|
if (!text->line_wrap || !lp->wraps)
|
|
|
|
fldata->data += 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (fldata->data >= fldata->data_max)
|
|
|
|
return TRUE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
case FetchLinesPixels:
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
fldata->data += LINE_HEIGHT(*lp);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (fldata->data >= fldata->data_max)
|
|
|
|
return TRUE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GList*
|
|
|
|
fetch_lines (GtkText* text,
|
|
|
|
const GtkPropertyMark* mark0,
|
|
|
|
const PrevTabCont* tab_cont0,
|
|
|
|
FLType fl_type,
|
|
|
|
gint data)
|
|
|
|
{
|
|
|
|
FetchLinesData fl_data;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
fl_data.new_lines = NULL;
|
|
|
|
fl_data.data = 0;
|
|
|
|
fl_data.data_max = data;
|
|
|
|
fl_data.fl_type = fl_type;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
line_params_iterate (text, mark0, tab_cont0, TRUE, &fl_data, fetch_lines_iterator);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return g_list_reverse (fl_data.new_lines);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fetch_lines_backward (GtkText* text)
|
|
|
|
{
|
|
|
|
GList* new_lines = NULL, *new_line_start;
|
1998-03-10 22:57:26 +00:00
|
|
|
GtkPropertyMark mark;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
if (CACHE_DATA(text->line_start_cache).start.index == 0)
|
|
|
|
return;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
mark = find_this_line_start_mark (text,
|
|
|
|
CACHE_DATA(text->line_start_cache).start.index - 1,
|
|
|
|
&CACHE_DATA(text->line_start_cache).start);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
new_line_start = new_lines = fetch_lines (text, &mark, NULL, FetchLinesCount, 1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (new_line_start->next)
|
|
|
|
new_line_start = new_line_start->next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
new_line_start->next = text->line_start_cache;
|
|
|
|
text->line_start_cache->prev = new_line_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fetch_lines_forward (GtkText* text, gint line_count)
|
|
|
|
{
|
|
|
|
GtkPropertyMark mark;
|
|
|
|
GList* line = text->line_start_cache;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while(line->next)
|
|
|
|
line = line->next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
mark = CACHE_DATA(line).end;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (LAST_INDEX (text, mark))
|
|
|
|
return;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_mark(&mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
line->next = fetch_lines (text, &mark, &CACHE_DATA(line).tab_cont_next, FetchLinesCount, line_count);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (line->next)
|
|
|
|
line->next->prev = line;
|
|
|
|
}
|
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
/* Compute the number of lines, and vertical pixels for n characters
|
|
|
|
* starting from the point
|
|
|
|
*/
|
|
|
|
static void
|
1998-03-10 03:17:02 +00:00
|
|
|
compute_lines_pixels (GtkText* text, guint char_count,
|
1998-02-27 06:13:22 +00:00
|
|
|
guint *lines, guint *pixels)
|
|
|
|
{
|
|
|
|
GList *line = text->current_line;
|
1998-03-10 03:17:02 +00:00
|
|
|
gint chars_left = char_count;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
*lines = 0;
|
|
|
|
*pixels = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
/* If chars_left == 0, that means we're joining two lines in a
|
1998-02-27 06:13:22 +00:00
|
|
|
* deletion, so add in the values for the next line as well
|
|
|
|
*/
|
1998-03-10 03:17:02 +00:00
|
|
|
for (; line && chars_left >= 0; line = line->next)
|
1998-02-27 06:13:22 +00:00
|
|
|
{
|
|
|
|
*pixels += LINE_HEIGHT(CACHE_DATA(line));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
if (line == text->current_line)
|
1998-03-10 03:17:02 +00:00
|
|
|
chars_left -= CACHE_DATA(line).end.index - text->point.index + 1;
|
1998-02-27 06:13:22 +00:00
|
|
|
else
|
1998-03-10 22:57:26 +00:00
|
|
|
chars_left -= CACHE_DATA(line).end.index - CACHE_DATA(line).start.index + 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
if (!text->line_wrap || !CACHE_DATA(line).wraps)
|
|
|
|
*lines += 1;
|
|
|
|
else
|
1998-03-10 03:17:02 +00:00
|
|
|
if (chars_left < 0)
|
|
|
|
chars_left = 0; /* force another loop */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
if (!line->next)
|
|
|
|
fetch_lines_forward (text, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint
|
|
|
|
total_line_height (GtkText* text, GList* line, gint line_count)
|
|
|
|
{
|
|
|
|
gint height = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; line && line_count > 0; line = line->next)
|
|
|
|
{
|
|
|
|
height += LINE_HEIGHT(CACHE_DATA(line));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!text->line_wrap || !CACHE_DATA(line).wraps)
|
|
|
|
line_count -= 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!line->next)
|
|
|
|
fetch_lines_forward (text, line_count);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-10 03:17:02 +00:00
|
|
|
swap_lines (GtkText* text, GList* old, GList* new, guint old_line_count)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
if (old == text->line_start_cache)
|
|
|
|
{
|
|
|
|
GList* last;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; old_line_count > 0; old_line_count -= 1)
|
|
|
|
{
|
|
|
|
while (text->line_start_cache &&
|
|
|
|
text->line_wrap &&
|
|
|
|
CACHE_DATA(text->line_start_cache).wraps)
|
|
|
|
remove_cache_line(text, text->line_start_cache);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
remove_cache_line(text, text->line_start_cache);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
last = g_list_last (new);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
last->next = text->line_start_cache;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->line_start_cache)
|
|
|
|
text->line_start_cache->prev = last;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->line_start_cache = new;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GList *last;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_assert (old->prev);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
last = old->prev;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; old_line_count > 0; old_line_count -= 1)
|
|
|
|
{
|
|
|
|
while (old && text->line_wrap && CACHE_DATA(old).wraps)
|
|
|
|
old = remove_cache_line (text, old);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
old = remove_cache_line (text, old);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
last->next = new;
|
|
|
|
new->prev = last;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
last = g_list_last (new);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
last->next = old;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (old)
|
|
|
|
old->prev = last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-02-27 06:13:22 +00:00
|
|
|
correct_cache_delete (GtkText* text, gint nchars, gint lines)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GList* cache = text->current_line;
|
|
|
|
gint i;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = 0; cache && i < lines; i += 1, cache = cache->next)
|
|
|
|
/* nothing */;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; cache; cache = cache->next)
|
|
|
|
{
|
|
|
|
GtkPropertyMark *start = &CACHE_DATA(cache).start;
|
|
|
|
GtkPropertyMark *end = &CACHE_DATA(cache).end;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
start->index -= nchars;
|
|
|
|
end->index -= nchars;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (LAST_INDEX (text, text->point) &&
|
|
|
|
start->index == text->point.index)
|
|
|
|
*start = text->point;
|
|
|
|
else if (start->property == text->point.property)
|
1997-11-24 22:37:52 +00:00
|
|
|
start->offset = start->index - (text->point.index - text->point.offset);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (LAST_INDEX (text, text->point) &&
|
|
|
|
end->index == text->point.index)
|
|
|
|
*end = text->point;
|
1997-11-24 22:37:52 +00:00
|
|
|
if (end->property == text->point.property)
|
|
|
|
end->offset = end->index - (text->point.index - text->point.offset);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/*TEXT_ASSERT_MARK(text, start, "start");*/
|
|
|
|
/*TEXT_ASSERT_MARK(text, end, "end");*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-10 03:17:02 +00:00
|
|
|
delete_expose (GtkText* text, guint nchars, guint old_lines, guint old_pixels)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-04-30 15:18:19 +00:00
|
|
|
GtkWidget *widget = GTK_WIDGET (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gint pixel_height;
|
|
|
|
guint new_pixels = 0;
|
|
|
|
GdkRectangle rect;
|
|
|
|
GList* new_line = NULL;
|
|
|
|
gint width, height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_virtual_x = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
correct_cache_delete (text, nchars, old_lines);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
pixel_height = pixel_height_of(text, text->current_line) -
|
1998-08-18 03:59:41 +00:00
|
|
|
LINE_HEIGHT(CACHE_DATA(text->current_line));
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (CACHE_DATA(text->current_line).start.index == text->point.index)
|
|
|
|
CACHE_DATA(text->current_line).start = text->point;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
new_line = fetch_lines (text,
|
|
|
|
&CACHE_DATA(text->current_line).start,
|
|
|
|
&CACHE_DATA(text->current_line).tab_cont,
|
|
|
|
FetchLinesCount,
|
|
|
|
1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
swap_lines (text, text->current_line, new_line, old_lines);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->current_line = new_line;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
new_pixels = total_line_height (text, new_line, 1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (old_pixels != new_pixels)
|
|
|
|
{
|
1998-04-30 15:18:19 +00:00
|
|
|
if (!widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
|
|
|
{
|
|
|
|
gdk_draw_pixmap (text->text_area,
|
|
|
|
text->gc,
|
|
|
|
text->text_area,
|
|
|
|
0,
|
|
|
|
pixel_height + old_pixels,
|
|
|
|
0,
|
|
|
|
pixel_height + new_pixels,
|
|
|
|
width,
|
|
|
|
height);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
text->vadj->upper += new_pixels;
|
|
|
|
text->vadj->upper -= old_pixels;
|
|
|
|
adjust_adj (text, text->vadj);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
rect.x = 0;
|
|
|
|
rect.y = pixel_height;
|
|
|
|
rect.width = width;
|
|
|
|
rect.height = new_pixels;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
expose_text (text, &rect, FALSE);
|
|
|
|
gtk_text_draw_focus ( (GtkWidget *) text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_mark = text->point;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (text, TRUE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
if (old_pixels != new_pixels)
|
1998-04-30 15:18:19 +00:00
|
|
|
{
|
|
|
|
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
|
|
|
{
|
|
|
|
rect.x = 0;
|
|
|
|
rect.y = pixel_height + new_pixels;
|
|
|
|
rect.width = width;
|
|
|
|
rect.height = height - rect.y;
|
|
|
|
|
|
|
|
expose_text (text, &rect, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
process_exposes (text);
|
|
|
|
}
|
1997-12-18 02:17:14 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TEXT_ASSERT (text);
|
|
|
|
TEXT_SHOW(text);
|
|
|
|
}
|
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
/* note, the point has already been moved forward */
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
1998-02-27 06:13:22 +00:00
|
|
|
correct_cache_insert (GtkText* text, gint nchars)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-07-21 19:31:38 +00:00
|
|
|
GList *cache;
|
|
|
|
GtkPropertyMark *start;
|
|
|
|
GtkPropertyMark *end;
|
1998-08-04 14:56:44 +00:00
|
|
|
gboolean was_split = FALSE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-04 14:56:44 +00:00
|
|
|
/* We need to distinguish whether the property was split in the
|
|
|
|
* insert or not, so we check if the point (which points after
|
|
|
|
* the insertion here), points to the same character as the
|
|
|
|
* point before. Ugh.
|
|
|
|
*/
|
|
|
|
if (nchars > 0)
|
|
|
|
{
|
|
|
|
GtkPropertyMark tmp_mark = text->point;
|
|
|
|
move_mark_n (&tmp_mark, -1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-04 14:56:44 +00:00
|
|
|
if (tmp_mark.property != text->point.property)
|
|
|
|
was_split = TRUE;
|
|
|
|
}
|
1998-07-21 19:31:38 +00:00
|
|
|
|
1998-08-04 14:56:44 +00:00
|
|
|
/* If we inserted a property exactly at the beginning of the
|
1998-07-21 19:31:38 +00:00
|
|
|
* line, we have to correct here, or fetch_lines will
|
|
|
|
* fetch junk.
|
|
|
|
*/
|
|
|
|
start = &CACHE_DATA(text->current_line).start;
|
1998-08-21 00:13:38 +00:00
|
|
|
|
|
|
|
/* Check if if we split exactly at the beginning of the line:
|
|
|
|
* (was_split won't be set if we are inserting at the end of the text,
|
|
|
|
* so we don't check)
|
|
|
|
*/
|
|
|
|
if (start->offset == MARK_CURRENT_PROPERTY (start)->length)
|
|
|
|
SET_PROPERTY_MARK (start, start->property->next, 0);
|
|
|
|
/* Check if we inserted a property at the beginning of the text: */
|
|
|
|
else if (was_split &&
|
|
|
|
(start->property == text->point.property) &&
|
|
|
|
(start->index == text->point.index - nchars))
|
|
|
|
SET_PROPERTY_MARK (start, start->property->prev, 0);
|
|
|
|
|
1998-07-21 19:31:38 +00:00
|
|
|
/* Now correct the offsets, and check for start or end marks that
|
|
|
|
* are after the point, yet point to a property before the point's
|
|
|
|
* property. This indicates that they are meant to point to the
|
|
|
|
* second half of a property we split in insert_text_property(), so
|
|
|
|
* we fix them up that way.
|
|
|
|
*/
|
|
|
|
cache = text->current_line->next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; cache; cache = cache->next)
|
|
|
|
{
|
1998-07-21 19:31:38 +00:00
|
|
|
start = &CACHE_DATA(cache).start;
|
|
|
|
end = &CACHE_DATA(cache).end;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (LAST_INDEX (text, text->point) &&
|
|
|
|
start->index == text->point.index)
|
|
|
|
*start = text->point;
|
|
|
|
else if (start->index >= text->point.index - nchars)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-08-04 14:56:44 +00:00
|
|
|
if (!was_split && start->property == text->point.property)
|
1998-02-27 06:13:22 +00:00
|
|
|
move_mark_n(start, nchars);
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1998-07-21 19:31:38 +00:00
|
|
|
{
|
|
|
|
if (start->property->next &&
|
|
|
|
(start->property->next->next == text->point.property))
|
|
|
|
{
|
|
|
|
g_assert (start->offset >= MARK_CURRENT_PROPERTY (start)->length);
|
|
|
|
start->offset -= MARK_CURRENT_PROPERTY (start)->length;
|
|
|
|
start->property = text->point.property;
|
|
|
|
}
|
|
|
|
start->index += nchars;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
if (LAST_INDEX (text, text->point) &&
|
|
|
|
end->index == text->point.index)
|
|
|
|
*end = text->point;
|
1998-02-27 06:13:22 +00:00
|
|
|
if (end->index >= text->point.index - nchars)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-08-04 14:56:44 +00:00
|
|
|
if (!was_split && end->property == text->point.property)
|
1998-02-27 06:13:22 +00:00
|
|
|
move_mark_n(end, nchars);
|
1998-07-21 19:31:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (end->property->next &&
|
|
|
|
(end->property->next->next == text->point.property))
|
|
|
|
{
|
|
|
|
g_assert (end->offset >= MARK_CURRENT_PROPERTY (end)->length);
|
|
|
|
end->offset -= MARK_CURRENT_PROPERTY (end)->length;
|
|
|
|
end->property = text->point.property;
|
|
|
|
}
|
|
|
|
end->index += nchars;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/*TEXT_ASSERT_MARK(text, start, "start");*/
|
|
|
|
/*TEXT_ASSERT_MARK(text, end, "end");*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
1998-02-27 06:13:22 +00:00
|
|
|
insert_expose (GtkText* text, guint old_pixels, gint nchars,
|
|
|
|
guint new_line_count)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-04-30 15:18:19 +00:00
|
|
|
GtkWidget *widget = GTK_WIDGET (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gint pixel_height;
|
|
|
|
guint new_pixels = 0;
|
|
|
|
GdkRectangle rect;
|
1998-02-27 06:13:22 +00:00
|
|
|
GList* new_lines = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint width, height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_virtual_x = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
correct_cache_insert (text, nchars);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TEXT_SHOW_ADJ (text, text->vadj, "vadj");
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
pixel_height = pixel_height_of(text, text->current_line) -
|
1998-08-18 03:59:41 +00:00
|
|
|
LINE_HEIGHT(CACHE_DATA(text->current_line));
|
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
new_lines = fetch_lines (text,
|
|
|
|
&CACHE_DATA(text->current_line).start,
|
|
|
|
&CACHE_DATA(text->current_line).tab_cont,
|
|
|
|
FetchLinesCount,
|
|
|
|
new_line_count);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
swap_lines (text, text->current_line, new_lines, 1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
text->current_line = new_lines;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
new_pixels = total_line_height (text, new_lines, new_line_count);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (old_pixels != new_pixels)
|
|
|
|
{
|
1998-04-30 15:18:19 +00:00
|
|
|
if (!widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
|
|
|
{
|
|
|
|
gdk_draw_pixmap (text->text_area,
|
|
|
|
text->gc,
|
|
|
|
text->text_area,
|
|
|
|
0,
|
|
|
|
pixel_height + old_pixels,
|
|
|
|
0,
|
|
|
|
pixel_height + new_pixels,
|
|
|
|
width,
|
|
|
|
height + (old_pixels - new_pixels) - pixel_height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-04-30 15:18:19 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
text->vadj->upper += new_pixels;
|
|
|
|
text->vadj->upper -= old_pixels;
|
|
|
|
adjust_adj (text, text->vadj);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
rect.x = 0;
|
|
|
|
rect.y = pixel_height;
|
|
|
|
rect.width = width;
|
|
|
|
rect.height = new_pixels;
|
1998-04-30 15:18:19 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
expose_text (text, &rect, FALSE);
|
|
|
|
gtk_text_draw_focus ( (GtkWidget *) text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_mark = text->point;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (text, TRUE);
|
1998-04-30 15:18:19 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
draw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
if (old_pixels != new_pixels)
|
1998-04-30 15:18:19 +00:00
|
|
|
{
|
|
|
|
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
|
|
|
{
|
|
|
|
rect.x = 0;
|
|
|
|
rect.y = pixel_height + new_pixels;
|
|
|
|
rect.width = width;
|
|
|
|
rect.height = height - rect.y;
|
|
|
|
|
|
|
|
expose_text (text, &rect, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
process_exposes (text);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TEXT_SHOW_ADJ (text, text->vadj, "vadj");
|
|
|
|
TEXT_ASSERT (text);
|
|
|
|
TEXT_SHOW(text);
|
|
|
|
}
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
/* Text property functions */
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static guint
|
1998-06-10 16:59:28 +00:00
|
|
|
font_hash (gconstpointer font)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-06-09 23:18:11 +00:00
|
|
|
return gdk_font_id ((const GdkFont*) font);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
static GHashTable *font_cache_table = NULL;
|
|
|
|
|
|
|
|
static GtkTextFont*
|
1997-11-24 22:37:52 +00:00
|
|
|
get_text_font (GdkFont* gfont)
|
|
|
|
{
|
1998-08-25 00:06:38 +00:00
|
|
|
GtkTextFont* tf;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint i;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!font_cache_table)
|
|
|
|
font_cache_table = g_hash_table_new (font_hash, (GCompareFunc) gdk_font_equal);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
tf = g_hash_table_lookup (font_cache_table, gfont);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
if (tf)
|
|
|
|
{
|
|
|
|
tf->ref_count++;
|
|
|
|
return tf;
|
|
|
|
}
|
|
|
|
|
|
|
|
tf = g_new (GtkTextFont, 1);
|
|
|
|
tf->ref_count = 1;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
tf->gdk_font = gfont;
|
1998-08-25 00:06:38 +00:00
|
|
|
gdk_font_ref (gfont);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for(i = 0; i < 256; i += 1)
|
|
|
|
tf->char_widths[i] = gdk_char_width (gfont, (char)i);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_hash_table_insert (font_cache_table, gfont, tf);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return tf;
|
|
|
|
}
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
static void
|
|
|
|
text_font_unref (GtkTextFont *text_font)
|
|
|
|
{
|
|
|
|
text_font->ref_count--;
|
|
|
|
if (text_font->ref_count == 0)
|
|
|
|
{
|
|
|
|
g_hash_table_remove (font_cache_table, text_font->gdk_font);
|
|
|
|
gdk_font_unref (text_font->gdk_font);
|
|
|
|
g_free (text_font);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint
|
|
|
|
text_properties_equal (TextProperty* prop, GdkFont* font, GdkColor *fore, GdkColor *back)
|
|
|
|
{
|
1998-08-25 00:06:38 +00:00
|
|
|
if (prop->flags & PROPERTY_FONT)
|
|
|
|
{
|
|
|
|
gboolean retval;
|
|
|
|
GtkTextFont *text_font;
|
|
|
|
|
|
|
|
if (!font)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
text_font = get_text_font (font);
|
|
|
|
|
|
|
|
retval = (prop->font == text_font);
|
|
|
|
text_font_unref (text_font);
|
|
|
|
|
|
|
|
if (!retval)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (font != NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (prop->flags & PROPERTY_FOREGROUND)
|
|
|
|
{
|
|
|
|
if (!fore || !gdk_color_equal (&prop->fore_color, fore))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (fore != NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (prop->flags & PROPERTY_BACKGROUND)
|
|
|
|
{
|
1999-01-10 19:49:24 +00:00
|
|
|
if (!back || !gdk_color_equal (&prop->back_color, back))
|
1998-08-25 00:06:38 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
1999-01-10 19:49:24 +00:00
|
|
|
if (back != NULL)
|
1998-08-25 00:06:38 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
realize_property (GtkText *text, TextProperty *prop)
|
|
|
|
{
|
|
|
|
GdkColormap *colormap = gtk_widget_get_colormap (GTK_WIDGET (text));
|
|
|
|
|
|
|
|
if (prop->flags & PROPERTY_FOREGROUND)
|
|
|
|
gdk_colormap_alloc_color (colormap, &prop->fore_color, FALSE, FALSE);
|
|
|
|
|
|
|
|
if (prop->flags & PROPERTY_BACKGROUND)
|
|
|
|
gdk_colormap_alloc_color (colormap, &prop->back_color, FALSE, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
realize_properties (GtkText *text)
|
|
|
|
{
|
|
|
|
GList *tmp_list = text->text_properties;
|
|
|
|
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
realize_property (text, tmp_list->data);
|
|
|
|
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unrealize_property (GtkText *text, TextProperty *prop)
|
|
|
|
{
|
|
|
|
GdkColormap *colormap = gtk_widget_get_colormap (GTK_WIDGET (text));
|
|
|
|
|
|
|
|
if (prop->flags & PROPERTY_FOREGROUND)
|
|
|
|
gdk_colormap_free_colors (colormap, &prop->fore_color, 1);
|
|
|
|
|
|
|
|
if (prop->flags & PROPERTY_BACKGROUND)
|
|
|
|
gdk_colormap_free_colors (colormap, &prop->back_color, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unrealize_properties (GtkText *text)
|
|
|
|
{
|
|
|
|
GList *tmp_list = text->text_properties;
|
|
|
|
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
unrealize_property (text, tmp_list->data);
|
|
|
|
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static TextProperty*
|
1998-08-25 00:06:38 +00:00
|
|
|
new_text_property (GtkText *text, GdkFont *font, GdkColor* fore,
|
|
|
|
GdkColor* back, guint length)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
TextProperty *prop;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text_property_chunk == NULL)
|
|
|
|
{
|
|
|
|
text_property_chunk = g_mem_chunk_new ("text property mem chunk",
|
|
|
|
sizeof(TextProperty),
|
|
|
|
1024*sizeof(TextProperty),
|
1998-07-21 19:31:38 +00:00
|
|
|
G_ALLOC_AND_FREE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
prop = g_chunk_new(TextProperty, text_property_chunk);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
prop->flags = 0;
|
|
|
|
if (font)
|
|
|
|
{
|
|
|
|
prop->flags |= PROPERTY_FONT;
|
|
|
|
prop->font = get_text_font (font);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
prop->font = NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
if (fore)
|
|
|
|
{
|
|
|
|
prop->flags |= PROPERTY_FOREGROUND;
|
|
|
|
prop->fore_color = *fore;
|
|
|
|
}
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
if (back)
|
1998-08-25 00:06:38 +00:00
|
|
|
{
|
|
|
|
prop->flags |= PROPERTY_BACKGROUND;
|
|
|
|
prop->back_color = *back;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
prop->length = length;
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (text))
|
|
|
|
realize_property (text, prop);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return prop;
|
|
|
|
}
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
static void
|
|
|
|
destroy_text_property (TextProperty *prop)
|
|
|
|
{
|
|
|
|
if (prop->font)
|
|
|
|
text_font_unref (prop->font);
|
|
|
|
|
|
|
|
g_mem_chunk_free (text_property_chunk, prop);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Flop the memory between the point and the gap around like a
|
|
|
|
* dead fish. */
|
|
|
|
static void
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
move_gap (GtkText* text, guint index)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->gap_position < index)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
gint diff = index - text->gap_position;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
g_memmove (text->text.wc + text->gap_position,
|
|
|
|
text->text.wc + text->gap_position + text->gap_size,
|
|
|
|
diff*sizeof (GdkWChar));
|
|
|
|
else
|
|
|
|
g_memmove (text->text.ch + text->gap_position,
|
|
|
|
text->text.ch + text->gap_position + text->gap_size,
|
|
|
|
diff);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
text->gap_position = index;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
else if (text->gap_position > index)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
gint diff = text->gap_position - index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
g_memmove (text->text.wc + index + text->gap_size,
|
|
|
|
text->text.wc + index,
|
|
|
|
diff*sizeof (GdkWChar));
|
|
|
|
else
|
|
|
|
g_memmove (text->text.ch + index + text->gap_size,
|
|
|
|
text->text.ch + index,
|
|
|
|
diff);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
text->gap_position = index;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Increase the gap size. */
|
|
|
|
static void
|
|
|
|
make_forward_space (GtkText* text, guint len)
|
|
|
|
{
|
|
|
|
if (text->gap_size < len)
|
|
|
|
{
|
|
|
|
guint sum = MAX(2*len, MIN_GAP_SIZE) + text->text_end;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (sum >= text->text_len)
|
|
|
|
{
|
|
|
|
guint i = 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (i <= sum) i <<= 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
text->text.wc = (GdkWChar *)g_realloc(text->text.wc,
|
|
|
|
i*sizeof(GdkWChar));
|
|
|
|
else
|
|
|
|
text->text.ch = (guchar *)g_realloc(text->text.ch, i);
|
|
|
|
text->text_len = i;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
g_memmove (text->text.wc + text->gap_position + text->gap_size + 2*len,
|
|
|
|
text->text.wc + text->gap_position + text->gap_size,
|
|
|
|
(text->text_end - (text->gap_position + text->gap_size))
|
|
|
|
*sizeof(GdkWChar));
|
|
|
|
else
|
|
|
|
g_memmove (text->text.ch + text->gap_position + text->gap_size + 2*len,
|
|
|
|
text->text.ch + text->gap_position + text->gap_size,
|
|
|
|
text->text_end - (text->gap_position + text->gap_size));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->text_end += len*2;
|
|
|
|
text->gap_size += len*2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Inserts into the text property list a list element that guarantees
|
|
|
|
* that for len characters following the point, text has the correct
|
|
|
|
* property. does not move point. adjusts text_properties_point and
|
|
|
|
* text_properties_point_offset relative to the current value of
|
|
|
|
* point. */
|
|
|
|
static void
|
|
|
|
insert_text_property (GtkText* text, GdkFont* font,
|
|
|
|
GdkColor *fore, GdkColor* back, guint len)
|
|
|
|
{
|
|
|
|
GtkPropertyMark *mark = &text->point;
|
|
|
|
TextProperty* forward_prop = MARK_CURRENT_PROPERTY(mark);
|
|
|
|
TextProperty* backward_prop = MARK_PREV_PROPERTY(mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (MARK_OFFSET(mark) == 0)
|
|
|
|
{
|
|
|
|
/* Point is on the boundary of two properties.
|
|
|
|
* If it is the same as either, grow, else insert
|
|
|
|
* a new one. */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text_properties_equal(forward_prop, font, fore, back))
|
|
|
|
{
|
|
|
|
/* Grow the property in front of us. */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
MARK_PROPERTY_LENGTH(mark) += len;
|
|
|
|
}
|
|
|
|
else if (backward_prop &&
|
|
|
|
text_properties_equal(backward_prop, font, fore, back))
|
|
|
|
{
|
|
|
|
/* Grow property behind us, point property and offset
|
|
|
|
* change. */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
SET_PROPERTY_MARK (&text->point,
|
|
|
|
MARK_PREV_LIST_PTR (mark),
|
|
|
|
backward_prop->length);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
backward_prop->length += len;
|
|
|
|
}
|
1998-03-10 03:17:02 +00:00
|
|
|
else if ((MARK_NEXT_LIST_PTR(mark) == NULL) &&
|
|
|
|
(forward_prop->length == 1))
|
|
|
|
{
|
|
|
|
/* Next property just has last position, take it over */
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (text))
|
|
|
|
unrealize_property (text, forward_prop);
|
|
|
|
|
|
|
|
forward_prop->flags = 0;
|
|
|
|
if (font)
|
|
|
|
{
|
|
|
|
forward_prop->flags |= PROPERTY_FONT;
|
|
|
|
forward_prop->font = get_text_font (font);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
forward_prop->font = NULL;
|
|
|
|
|
|
|
|
if (fore)
|
|
|
|
{
|
|
|
|
forward_prop->flags |= PROPERTY_FOREGROUND;
|
|
|
|
forward_prop->fore_color = *fore;
|
|
|
|
}
|
|
|
|
if (back)
|
|
|
|
{
|
|
|
|
forward_prop->flags |= PROPERTY_BACKGROUND;
|
|
|
|
forward_prop->back_color = *back;
|
|
|
|
}
|
1998-03-10 03:17:02 +00:00
|
|
|
forward_prop->length += len;
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (text))
|
|
|
|
realize_property (text, forward_prop);
|
1998-03-10 03:17:02 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Splice a new property into the list. */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GList* new_prop = g_list_alloc();
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
new_prop->next = MARK_LIST_PTR(mark);
|
|
|
|
new_prop->prev = MARK_PREV_LIST_PTR(mark);
|
|
|
|
new_prop->next->prev = new_prop;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (new_prop->prev)
|
|
|
|
new_prop->prev->next = new_prop;
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
new_prop->data = new_text_property (text, font, fore, back, len);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
SET_PROPERTY_MARK (mark, new_prop, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-07-21 19:31:38 +00:00
|
|
|
/* The following will screw up the line_start cache,
|
|
|
|
* we'll fix it up in correct_cache_insert
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* In the middle of forward_prop, if properties are equal,
|
|
|
|
* just add to its length, else split it into two and splice
|
|
|
|
* in a new one. */
|
|
|
|
if (text_properties_equal (forward_prop, font, fore, back))
|
|
|
|
{
|
|
|
|
forward_prop->length += len;
|
|
|
|
}
|
1998-03-10 03:17:02 +00:00
|
|
|
else if ((MARK_NEXT_LIST_PTR(mark) == NULL) &&
|
1998-03-10 22:57:26 +00:00
|
|
|
(MARK_OFFSET(mark) + 1 == forward_prop->length))
|
1998-03-10 03:17:02 +00:00
|
|
|
{
|
|
|
|
/* Inserting before only the last position in the text */
|
|
|
|
|
|
|
|
GList* new_prop;
|
|
|
|
forward_prop->length -= 1;
|
|
|
|
|
|
|
|
new_prop = g_list_alloc();
|
1998-08-25 00:06:38 +00:00
|
|
|
new_prop->data = new_text_property (text, font, fore, back, len+1);
|
1998-03-10 03:17:02 +00:00
|
|
|
new_prop->prev = MARK_LIST_PTR(mark);
|
|
|
|
new_prop->next = NULL;
|
|
|
|
MARK_NEXT_LIST_PTR(mark) = new_prop;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
SET_PROPERTY_MARK (mark, new_prop, 0);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GList* new_prop = g_list_alloc();
|
|
|
|
GList* new_prop_forward = g_list_alloc();
|
|
|
|
gint old_length = forward_prop->length;
|
|
|
|
GList* next = MARK_NEXT_LIST_PTR(mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Set the new lengths according to where they are split. Construct
|
|
|
|
* two new properties. */
|
|
|
|
forward_prop->length = MARK_OFFSET(mark);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
new_prop_forward->data =
|
|
|
|
new_text_property(text,
|
|
|
|
forward_prop->flags & PROPERTY_FONT ?
|
|
|
|
forward_prop->font->gdk_font : NULL,
|
|
|
|
forward_prop->flags & PROPERTY_FOREGROUND ?
|
|
|
|
&forward_prop->fore_color : NULL,
|
|
|
|
forward_prop->flags & PROPERTY_BACKGROUND ?
|
|
|
|
&forward_prop->back_color : NULL,
|
|
|
|
old_length - forward_prop->length);
|
|
|
|
|
|
|
|
new_prop->data = new_text_property(text, font, fore, back, len);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* Now splice things in. */
|
|
|
|
MARK_NEXT_LIST_PTR(mark) = new_prop;
|
|
|
|
new_prop->prev = MARK_LIST_PTR(mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
new_prop->next = new_prop_forward;
|
|
|
|
new_prop_forward->prev = new_prop;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
new_prop_forward->next = next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (next)
|
|
|
|
next->prev = new_prop_forward;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
SET_PROPERTY_MARK (mark, new_prop, 0);
|
|
|
|
}
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (text->text_properties_end->next)
|
|
|
|
text->text_properties_end = text->text_properties_end->next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (text->text_properties->prev)
|
|
|
|
text->text_properties = text->text_properties->prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
delete_text_property (GtkText* text, guint nchars)
|
|
|
|
{
|
|
|
|
/* Delete nchars forward from point. */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-04 14:56:44 +00:00
|
|
|
/* Deleting text properties is problematical, because we
|
|
|
|
* might be storing around marks pointing to a property.
|
|
|
|
*
|
|
|
|
* The marks in question and how we handle them are:
|
|
|
|
*
|
|
|
|
* point: We know the new value, since it will be at the
|
|
|
|
* end of the deleted text, and we move it there
|
|
|
|
* first.
|
|
|
|
* cursor: We just remove the mark and set it equal to the
|
|
|
|
* point after the operation.
|
|
|
|
* line-start cache: We replace most affected lines.
|
|
|
|
* The current line gets used to fetch the new
|
|
|
|
* lines so, if necessary, (delete at the beginning
|
|
|
|
* of a line) we fix it up by setting it equal to the
|
|
|
|
* point.
|
|
|
|
*/
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TextProperty *prop;
|
|
|
|
GList *tmp;
|
|
|
|
gint is_first;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for(; nchars; nchars -= 1)
|
|
|
|
{
|
|
|
|
prop = MARK_CURRENT_PROPERTY(&text->point);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
prop->length -= 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (prop->length == 0)
|
|
|
|
{
|
|
|
|
tmp = MARK_LIST_PTR (&text->point);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
is_first = tmp == text->text_properties;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
MARK_LIST_PTR (&text->point) = g_list_remove_link (tmp, tmp);
|
|
|
|
text->point.offset = 0;
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (text))
|
|
|
|
unrealize_property (text, prop);
|
|
|
|
|
|
|
|
destroy_text_property (prop);
|
1998-03-10 03:17:02 +00:00
|
|
|
g_list_free_1 (tmp);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
prop = MARK_CURRENT_PROPERTY (&text->point);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (is_first)
|
|
|
|
text->text_properties = MARK_LIST_PTR (&text->point);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_assert (prop->length != 0);
|
|
|
|
}
|
|
|
|
else if (prop->length == text->point.offset)
|
|
|
|
{
|
|
|
|
MARK_LIST_PTR (&text->point) = MARK_NEXT_LIST_PTR (&text->point);
|
|
|
|
text->point.offset = 0;
|
|
|
|
}
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
/* Check to see if we have just the single final position remaining
|
|
|
|
* along in a property; if so, combine it with the previous property
|
|
|
|
*/
|
|
|
|
if (LAST_INDEX (text, text->point) &&
|
|
|
|
(MARK_OFFSET (&text->point) == 0) &&
|
|
|
|
(MARK_PREV_LIST_PTR(&text->point) != NULL))
|
|
|
|
{
|
|
|
|
tmp = MARK_LIST_PTR (&text->point);
|
|
|
|
prop = MARK_CURRENT_PROPERTY(&text->point);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
MARK_LIST_PTR (&text->point) = MARK_PREV_LIST_PTR (&text->point);
|
|
|
|
MARK_CURRENT_PROPERTY(&text->point)->length += 1;
|
|
|
|
MARK_NEXT_LIST_PTR(&text->point) = NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
text->point.offset = MARK_CURRENT_PROPERTY(&text->point)->length - 1;
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (text))
|
|
|
|
unrealize_property (text, prop);
|
|
|
|
|
|
|
|
destroy_text_property (prop);
|
1998-03-10 03:17:02 +00:00
|
|
|
g_list_free_1 (tmp);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_properties (GtkText *text)
|
|
|
|
{
|
|
|
|
if (!text->text_properties)
|
|
|
|
{
|
|
|
|
text->text_properties = g_list_alloc();
|
|
|
|
text->text_properties->next = NULL;
|
|
|
|
text->text_properties->prev = NULL;
|
1998-08-25 00:06:38 +00:00
|
|
|
text->text_properties->data = new_text_property (text, NULL, NULL, NULL, 1);
|
1997-11-24 22:37:52 +00:00
|
|
|
text->text_properties_end = text->text_properties;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
SET_PROPERTY_MARK (&text->point, text->text_properties, 0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->point.index = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Property Movement */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
move_mark_n (GtkPropertyMark* mark, gint n)
|
|
|
|
{
|
|
|
|
if (n > 0)
|
|
|
|
advance_mark_n(mark, n);
|
|
|
|
else if (n < 0)
|
|
|
|
decrement_mark_n(mark, -n);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
advance_mark (GtkPropertyMark* mark)
|
|
|
|
{
|
|
|
|
TextProperty* prop = MARK_CURRENT_PROPERTY (mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
mark->index += 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (prop->length > mark->offset + 1)
|
|
|
|
mark->offset += 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mark->property = MARK_NEXT_LIST_PTR (mark);
|
|
|
|
mark->offset = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-16 23:18:06 +00:00
|
|
|
static void
|
|
|
|
advance_mark_n (GtkPropertyMark* mark, gint n)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
TextProperty* prop;
|
|
|
|
|
|
|
|
g_assert (n > 0);
|
|
|
|
|
|
|
|
i = 0; /* otherwise it migth not be init. */
|
|
|
|
prop = MARK_CURRENT_PROPERTY(mark);
|
|
|
|
|
|
|
|
if ((prop->length - mark->offset - 1) < n) { /* if we need to change prop. */
|
|
|
|
/* to make it easier */
|
|
|
|
n += (mark->offset);
|
|
|
|
mark->index -= mark->offset;
|
|
|
|
mark->offset = 0;
|
|
|
|
/* first we take seven-mile-leaps to get to the right text
|
|
|
|
* property. */
|
|
|
|
while ((n-i) > prop->length - 1) {
|
|
|
|
i += prop->length;
|
|
|
|
mark->index += prop->length;
|
|
|
|
mark->property = MARK_NEXT_LIST_PTR (mark);
|
|
|
|
prop = MARK_CURRENT_PROPERTY (mark);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* and then the rest */
|
|
|
|
mark->index += n - i;
|
|
|
|
mark->offset += n - i;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
decrement_mark (GtkPropertyMark* mark)
|
|
|
|
{
|
|
|
|
mark->index -= 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (mark->offset > 0)
|
|
|
|
mark->offset -= 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mark->property = MARK_PREV_LIST_PTR (mark);
|
|
|
|
mark->offset = MARK_CURRENT_PROPERTY (mark)->length - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
decrement_mark_n (GtkPropertyMark* mark, gint n)
|
|
|
|
{
|
|
|
|
g_assert (n > 0);
|
|
|
|
|
1998-11-16 23:18:06 +00:00
|
|
|
while (mark->offset < n) {
|
|
|
|
/* jump to end of prev */
|
|
|
|
n -= mark->offset + 1;
|
|
|
|
mark->index -= mark->offset + 1;
|
|
|
|
mark->property = MARK_PREV_LIST_PTR (mark);
|
|
|
|
mark->offset = MARK_CURRENT_PROPERTY (mark)->length - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* and the rest */
|
|
|
|
mark->index -= n;
|
|
|
|
mark->offset -= n;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static GtkPropertyMark
|
|
|
|
find_mark (GtkText* text, guint mark_position)
|
|
|
|
{
|
|
|
|
return find_mark_near (text, mark_position, &text->point);
|
|
|
|
}
|
|
|
|
|
1998-11-16 23:18:06 +00:00
|
|
|
/*
|
1997-11-24 22:37:52 +00:00
|
|
|
* You can also start from the end, what a drag.
|
|
|
|
*/
|
|
|
|
static GtkPropertyMark
|
|
|
|
find_mark_near (GtkText* text, guint mark_position, const GtkPropertyMark* near)
|
|
|
|
{
|
|
|
|
gint diffa;
|
|
|
|
gint diffb;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkPropertyMark mark;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!near)
|
|
|
|
diffa = mark_position + 1;
|
|
|
|
else
|
|
|
|
diffa = mark_position - near->index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
diffb = mark_position;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (diffa < 0)
|
|
|
|
diffa = -diffa;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (diffa <= diffb)
|
|
|
|
{
|
|
|
|
mark = *near;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mark.index = 0;
|
|
|
|
mark.property = text->text_properties;
|
|
|
|
mark.offset = 0;
|
|
|
|
}
|
1998-11-16 23:18:06 +00:00
|
|
|
|
|
|
|
move_mark_n (&mark, mark_position - mark.index);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return mark;
|
|
|
|
}
|
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
/* This routine must be called with scroll == FALSE, only when
|
|
|
|
* point is at least partially on screen
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
1998-03-07 03:05:36 +00:00
|
|
|
find_line_containing_point (GtkText* text, guint point,
|
|
|
|
gboolean scroll)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GList* cache;
|
|
|
|
gint height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->current_line = NULL;
|
1999-02-21 18:02:14 +00:00
|
|
|
|
|
|
|
TEXT_SHOW (text);
|
|
|
|
|
|
|
|
/* Scroll backwards until the point is on screen
|
|
|
|
*/
|
|
|
|
while (CACHE_DATA(text->line_start_cache).start.index > point)
|
|
|
|
scroll_int (text, - LINE_HEIGHT(CACHE_DATA(text->line_start_cache)));
|
|
|
|
|
|
|
|
/* Now additionally try to make sure that the point is fully on screen
|
|
|
|
*/
|
|
|
|
if (scroll)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1999-02-21 18:02:14 +00:00
|
|
|
while (text->first_cut_pixels != 0 &&
|
|
|
|
text->line_start_cache->next &&
|
|
|
|
CACHE_DATA(text->line_start_cache->next).start.index > point)
|
|
|
|
scroll_int (text, - LINE_HEIGHT(CACHE_DATA(text->line_start_cache->next)));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1999-02-21 18:02:14 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, NULL, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (cache = text->line_start_cache; cache; cache = cache->next)
|
|
|
|
{
|
|
|
|
guint lph;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (CACHE_DATA(cache).end.index >= point ||
|
|
|
|
LAST_INDEX(text, CACHE_DATA(cache).end))
|
|
|
|
{
|
|
|
|
text->current_line = cache; /* LOOK HERE, this proc has an
|
|
|
|
* important side effect. */
|
|
|
|
return;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TEXT_SHOW_LINE (text, cache, "cache");
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if (cache->next == NULL)
|
|
|
|
fetch_lines_forward (text, 1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if (scroll)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
lph = pixel_height_of (text, cache->next);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-05-10 02:46:20 +00:00
|
|
|
/* Scroll the bottom of the line is on screen, or until
|
|
|
|
* the line is the first onscreen line.
|
|
|
|
*/
|
|
|
|
while (cache->next != text->line_start_cache && lph > height)
|
1998-03-07 03:05:36 +00:00
|
|
|
{
|
|
|
|
TEXT_SHOW_LINE (text, cache, "cache");
|
|
|
|
TEXT_SHOW_LINE (text, cache->next, "cache->next");
|
|
|
|
scroll_int (text, LINE_HEIGHT(CACHE_DATA(cache->next)));
|
|
|
|
lph = pixel_height_of (text, cache->next);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
g_assert_not_reached (); /* Must set text->current_line here */
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static guint
|
|
|
|
pixel_height_of (GtkText* text, GList* cache_line)
|
|
|
|
{
|
|
|
|
gint pixels = - text->first_cut_pixels;
|
|
|
|
GList *cache = text->line_start_cache;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (TRUE) {
|
|
|
|
pixels += LINE_HEIGHT (CACHE_DATA(cache));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (cache->data == cache_line->data)
|
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
cache = cache->next;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return pixels;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Search and Placement */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
static gint
|
|
|
|
find_char_width (GtkText* text, const GtkPropertyMark *mark, const TabStopMark *tab_mark)
|
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
GdkWChar ch;
|
1998-04-14 01:39:40 +00:00
|
|
|
gint16* char_widths;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-04-14 01:39:40 +00:00
|
|
|
if (LAST_INDEX (text, *mark))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ch = GTK_TEXT_INDEX (text, mark->index);
|
1998-08-25 00:06:38 +00:00
|
|
|
char_widths = MARK_CURRENT_TEXT_FONT (text, mark)->char_widths;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (ch == '\t')
|
|
|
|
{
|
|
|
|
return tab_mark->to_next_tab * char_widths[' '];
|
|
|
|
}
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
else if (ch < 256)
|
|
|
|
{
|
|
|
|
return char_widths[ch];
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
return gdk_char_width_wc(MARK_CURRENT_TEXT_FONT(text, mark)->gdk_font, ch);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
advance_tab_mark (GtkText* text, TabStopMark* tab_mark, GdkWChar ch)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
if (tab_mark->to_next_tab == 1 || ch == '\t')
|
|
|
|
{
|
|
|
|
if (tab_mark->tab_stops->next)
|
|
|
|
{
|
|
|
|
tab_mark->tab_stops = tab_mark->tab_stops->next;
|
|
|
|
tab_mark->to_next_tab = (gulong) tab_mark->tab_stops->data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tab_mark->to_next_tab = text->default_tab_width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tab_mark->to_next_tab -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
advance_tab_mark_n (GtkText* text, TabStopMark* tab_mark, gint n)
|
1998-08-18 03:59:41 +00:00
|
|
|
/* No tabs! */
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
while (n--)
|
|
|
|
advance_tab_mark (text, tab_mark, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
find_cursor_at_line (GtkText* text, const LineParams* start_line, gint pixel_height)
|
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
GdkWChar ch;
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable = (GtkEditable *)text;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkPropertyMark mark = start_line->start;
|
|
|
|
TabStopMark tab_mark = start_line->tab_cont.tab_start;
|
|
|
|
gint pixel_width = LINE_START_PIXEL (*start_line);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (mark.index < text->cursor_mark.index)
|
|
|
|
{
|
|
|
|
pixel_width += find_char_width (text, &mark, &tab_mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
advance_tab_mark (text, &tab_mark, GTK_TEXT_INDEX(text, mark.index));
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_mark (&mark);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_pos_x = pixel_width;
|
|
|
|
text->cursor_pos_y = pixel_height;
|
|
|
|
text->cursor_char_offset = start_line->font_descent;
|
|
|
|
text->cursor_mark = mark;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
ch = LAST_INDEX (text, mark) ?
|
|
|
|
LINE_DELIM : GTK_TEXT_INDEX (text, mark.index);
|
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if ((text->use_wchar) ? gdk_iswspace (ch) : isspace (ch))
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_char = 0;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
else
|
|
|
|
text->cursor_char = ch;
|
|
|
|
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
#ifdef USE_XIM
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (GTK_WIDGET_HAS_FOCUS(text) && gdk_im_ready() && editable->ic &&
|
|
|
|
(gdk_ic_get_style (editable->ic) & GDK_IM_PREEDIT_POSITION))
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
GdkICAttributesType mask = GDK_IC_SPOT_LOCATION |
|
|
|
|
GDK_IC_PREEDIT_FOREGROUND |
|
|
|
|
GDK_IC_PREEDIT_BACKGROUND;
|
|
|
|
|
|
|
|
editable->ic_attr->spot_location.x = text->cursor_pos_x;
|
|
|
|
editable->ic_attr->spot_location.y
|
|
|
|
= text->cursor_pos_y - text->cursor_char_offset;
|
|
|
|
editable->ic_attr->preedit_foreground = *MARK_CURRENT_FORE (text, &mark);
|
|
|
|
editable->ic_attr->preedit_background = *MARK_CURRENT_BACK (text, &mark);
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
if (MARK_CURRENT_FONT (text, &mark)->type == GDK_FONT_FONTSET)
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
{
|
|
|
|
mask |= GDK_IC_PREEDIT_FONTSET;
|
|
|
|
editable->ic_attr->preedit_fontset = MARK_CURRENT_FONT (text, &mark);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
gdk_ic_set_attr (editable->ic, editable->ic_attr, mask);
|
Added some support for i18n. The support for input methods, including
Tue Feb 24 22:47:01 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtktext.c: Added some support for i18n. The support
for input methods, including preedit, is there, but input
is ignored unless it comes one byte at a time, so the
CJK locales won't really work. Fixing that would require
variable-width character support in the Text widget, which
is probably the wrong approach. Eventually we'll probably
want to go to UCS-4 internally.
Also, revised key press handling, which should improve
the forwarding of non-handled keypresses to the toplevel,
and make adding selection handling easier.
* gtk/gtkentry.c: Minor changes so that C-d, etc delete
the selection if there is one.
1998-02-25 03:51:04 +00:00
|
|
|
}
|
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (GtkText* text, gboolean scroll)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-08-11 19:06:18 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (text))
|
|
|
|
{
|
|
|
|
find_line_containing_point (text, text->cursor_mark.index, scroll);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-11 19:06:18 +00:00
|
|
|
if (text->current_line)
|
|
|
|
find_cursor_at_line (text,
|
|
|
|
&CACHE_DATA(text->current_line),
|
|
|
|
pixel_height_of(text, text->current_line));
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
GTK_EDITABLE (text)->current_pos = text->cursor_mark.index;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-01 05:11:05 +00:00
|
|
|
find_mouse_cursor_at_line (GtkText *text, const LineParams* lp,
|
1998-08-18 03:59:41 +00:00
|
|
|
guint line_pixel_height,
|
|
|
|
gint button_x)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkPropertyMark mark = lp->start;
|
|
|
|
TabStopMark tab_mark = lp->tab_cont.tab_start;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
gint char_width = find_char_width(text, &mark, &tab_mark);
|
|
|
|
gint pixel_width = LINE_START_PIXEL (*lp) + (char_width+1)/2;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_pos_y = line_pixel_height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
GdkWChar ch = LAST_INDEX (text, mark) ?
|
1998-08-18 03:59:41 +00:00
|
|
|
LINE_DELIM : GTK_TEXT_INDEX (text, mark.index);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (button_x < pixel_width || mark.index == lp->end.index)
|
|
|
|
{
|
|
|
|
text->cursor_pos_x = pixel_width - (char_width+1)/2;
|
|
|
|
text->cursor_mark = mark;
|
|
|
|
text->cursor_char_offset = lp->font_descent;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if ((text->use_wchar) ? gdk_iswspace (ch) : isspace (ch))
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_char = 0;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
else
|
|
|
|
text->cursor_char = ch;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_tab_mark (text, &tab_mark, ch);
|
|
|
|
advance_mark (&mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
pixel_width += char_width/2;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
char_width = find_char_width (text, &mark, &tab_mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
pixel_width += (char_width+1)/2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-01 05:11:05 +00:00
|
|
|
find_mouse_cursor (GtkText* text, gint x, gint y)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-07 03:05:36 +00:00
|
|
|
gint pixel_height;
|
|
|
|
GList* cache = text->line_start_cache;
|
|
|
|
|
|
|
|
g_assert (cache);
|
|
|
|
|
|
|
|
pixel_height = - text->first_cut_pixels;
|
|
|
|
|
|
|
|
for (; cache; cache = cache->next)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-07 03:05:36 +00:00
|
|
|
pixel_height += LINE_HEIGHT(CACHE_DATA(cache));
|
|
|
|
|
|
|
|
if (y < pixel_height || !cache->next)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-07 03:05:36 +00:00
|
|
|
find_mouse_cursor_at_line (text, &CACHE_DATA(cache), pixel_height, x);
|
|
|
|
|
|
|
|
find_cursor (text, FALSE);
|
|
|
|
|
|
|
|
return;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Cache Manager */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_cache (GtkText* text)
|
|
|
|
{
|
|
|
|
GList* cache = text->line_start_cache;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-05-10 02:46:20 +00:00
|
|
|
if (cache)
|
|
|
|
{
|
|
|
|
while (cache->prev)
|
|
|
|
cache = cache->prev;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-05-10 02:46:20 +00:00
|
|
|
text->line_start_cache = cache;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; cache; cache = cache->next)
|
|
|
|
g_mem_chunk_free (params_mem_chunk, cache->data);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_list_free (text->line_start_cache);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->line_start_cache = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GList*
|
|
|
|
remove_cache_line (GtkText* text, GList* member)
|
|
|
|
{
|
1998-05-10 02:46:20 +00:00
|
|
|
GList *list;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-11 17:52:12 +00:00
|
|
|
if (member == NULL)
|
|
|
|
return NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (member == text->line_start_cache)
|
1998-06-11 17:52:12 +00:00
|
|
|
text->line_start_cache = text->line_start_cache->next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-05-10 02:46:20 +00:00
|
|
|
if (member->prev)
|
1998-06-11 17:52:12 +00:00
|
|
|
member->prev->next = member->next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-11 17:52:12 +00:00
|
|
|
if (member->next)
|
|
|
|
member->next->prev = member->prev;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-05-10 02:46:20 +00:00
|
|
|
list = member->next;
|
|
|
|
|
|
|
|
g_mem_chunk_free (params_mem_chunk, member->data);
|
|
|
|
g_list_free_1 (member);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-05-10 02:46:20 +00:00
|
|
|
return list;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Key Motion */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
move_cursor_buffer_ver (GtkText *text, int dir)
|
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (dir > 0)
|
1998-03-10 03:17:02 +00:00
|
|
|
{
|
|
|
|
scroll_int (text, text->vadj->upper);
|
|
|
|
text->cursor_mark = find_this_line_start_mark (text,
|
|
|
|
TEXT_LENGTH (text),
|
|
|
|
&text->cursor_mark);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
1998-03-10 03:17:02 +00:00
|
|
|
{
|
|
|
|
scroll_int (text, - text->vadj->value);
|
|
|
|
text->cursor_mark = find_this_line_start_mark (text,
|
|
|
|
0,
|
|
|
|
&text->cursor_mark);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
find_cursor (text, TRUE);
|
|
|
|
draw_cursor (text, FALSE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
move_cursor_page_ver (GtkText *text, int dir)
|
|
|
|
{
|
|
|
|
scroll_int (text, dir * text->vadj->page_increment);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
move_cursor_ver (GtkText *text, int count)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
GtkPropertyMark mark;
|
|
|
|
gint offset;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
mark = find_this_line_start_mark (text, text->cursor_mark.index, &text->cursor_mark);
|
|
|
|
offset = text->cursor_mark.index - mark.index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (offset > text->cursor_virtual_x)
|
|
|
|
text->cursor_virtual_x = offset;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (count < 0)
|
|
|
|
{
|
|
|
|
if (mark.index == 0)
|
|
|
|
return;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
decrement_mark (&mark);
|
|
|
|
mark = find_this_line_start_mark (text, mark.index, &mark);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mark = text->cursor_mark;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
while (!LAST_INDEX(text, mark) && GTK_TEXT_INDEX(text, mark.index) != LINE_DELIM)
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_mark (&mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (LAST_INDEX(text, mark))
|
1998-08-18 03:59:41 +00:00
|
|
|
return;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_mark (&mark);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i=0; i < text->cursor_virtual_x; i += 1, advance_mark(&mark))
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (LAST_INDEX(text, mark) ||
|
|
|
|
GTK_TEXT_INDEX(text, mark.index) == LINE_DELIM)
|
1997-11-24 22:37:52 +00:00
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_mark = mark;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (text, TRUE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
draw_cursor (text, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
move_cursor_hor (GtkText *text, int count)
|
|
|
|
{
|
|
|
|
/* count should be +-1. */
|
|
|
|
if ( (count > 0 && text->cursor_mark.index + count > TEXT_LENGTH(text)) ||
|
|
|
|
(count < 0 && text->cursor_mark.index < (- count)) ||
|
|
|
|
(count == 0) )
|
|
|
|
return;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_virtual_x = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
move_mark_n (&text->cursor_mark, count);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (text, TRUE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
draw_cursor (text, FALSE);
|
|
|
|
}
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_text_move_cursor (GtkEditable *editable,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
|
|
|
if (x > 0)
|
|
|
|
{
|
|
|
|
while (x-- != 0)
|
|
|
|
move_cursor_hor (GTK_TEXT (editable), 1);
|
|
|
|
}
|
|
|
|
else if (x < 0)
|
|
|
|
{
|
|
|
|
while (x++ != 0)
|
|
|
|
move_cursor_hor (GTK_TEXT (editable), -1);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
if (y > 0)
|
|
|
|
{
|
|
|
|
while (y-- != 0)
|
|
|
|
move_cursor_ver (GTK_TEXT (editable), 1);
|
|
|
|
}
|
1999-01-17 16:51:20 +00:00
|
|
|
else if (y < 0)
|
1998-06-19 01:26:24 +00:00
|
|
|
{
|
|
|
|
while (y++ != 0)
|
|
|
|
move_cursor_ver (GTK_TEXT (editable), -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
|
|
|
gtk_text_move_forward_character (GtkText *text)
|
|
|
|
{
|
|
|
|
move_cursor_hor (text, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_move_backward_character (GtkText *text)
|
|
|
|
{
|
|
|
|
move_cursor_hor (text, -1);
|
|
|
|
}
|
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
static void
|
|
|
|
gtk_text_move_next_line (GtkText *text)
|
|
|
|
{
|
|
|
|
move_cursor_ver (text, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_move_previous_line (GtkText *text)
|
|
|
|
{
|
|
|
|
move_cursor_ver (text, -1);
|
|
|
|
}
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_text_move_word (GtkEditable *editable,
|
|
|
|
gint n)
|
|
|
|
{
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
while (n-- != 0)
|
|
|
|
gtk_text_move_forward_word (GTK_TEXT (editable));
|
|
|
|
}
|
|
|
|
else if (n < 0)
|
|
|
|
{
|
|
|
|
while (n++ != 0)
|
|
|
|
gtk_text_move_backward_word (GTK_TEXT (editable));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
|
|
|
gtk_text_move_forward_word (GtkText *text)
|
|
|
|
{
|
1998-03-10 22:57:26 +00:00
|
|
|
text->cursor_virtual_x = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
while (!LAST_INDEX (text, text->cursor_mark) &&
|
|
|
|
!gdk_iswalnum (GTK_TEXT_INDEX(text, text->cursor_mark.index)))
|
|
|
|
advance_mark (&text->cursor_mark);
|
|
|
|
|
|
|
|
while (!LAST_INDEX (text, text->cursor_mark) &&
|
|
|
|
gdk_iswalnum (GTK_TEXT_INDEX(text, text->cursor_mark.index)))
|
|
|
|
advance_mark (&text->cursor_mark);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (!LAST_INDEX (text, text->cursor_mark) &&
|
|
|
|
!isalnum (GTK_TEXT_INDEX(text, text->cursor_mark.index)))
|
|
|
|
advance_mark (&text->cursor_mark);
|
|
|
|
|
|
|
|
while (!LAST_INDEX (text, text->cursor_mark) &&
|
|
|
|
isalnum (GTK_TEXT_INDEX(text, text->cursor_mark.index)))
|
|
|
|
advance_mark (&text->cursor_mark);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (text, TRUE);
|
1998-03-01 05:11:05 +00:00
|
|
|
draw_cursor (text, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_move_backward_word (GtkText *text)
|
|
|
|
{
|
1998-03-10 22:57:26 +00:00
|
|
|
text->cursor_virtual_x = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
while ((text->cursor_mark.index > 0) &&
|
|
|
|
!gdk_iswalnum (GTK_TEXT_INDEX(text, text->cursor_mark.index-1)))
|
|
|
|
decrement_mark (&text->cursor_mark);
|
|
|
|
|
|
|
|
while ((text->cursor_mark.index > 0) &&
|
|
|
|
gdk_iswalnum (GTK_TEXT_INDEX(text, text->cursor_mark.index-1)))
|
|
|
|
decrement_mark (&text->cursor_mark);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while ((text->cursor_mark.index > 0) &&
|
|
|
|
!isalnum (GTK_TEXT_INDEX(text, text->cursor_mark.index-1)))
|
|
|
|
decrement_mark (&text->cursor_mark);
|
|
|
|
|
|
|
|
while ((text->cursor_mark.index > 0) &&
|
|
|
|
isalnum (GTK_TEXT_INDEX(text, text->cursor_mark.index-1)))
|
|
|
|
decrement_mark (&text->cursor_mark);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (text, TRUE);
|
1998-03-01 05:11:05 +00:00
|
|
|
draw_cursor (text, FALSE);
|
|
|
|
}
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_text_move_page (GtkEditable *editable,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
if (y != 0)
|
|
|
|
scroll_int (GTK_TEXT (editable),
|
|
|
|
y * GTK_TEXT(editable)->vadj->page_increment);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_move_to_row (GtkEditable *editable,
|
|
|
|
gint row)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_move_to_column (GtkEditable *editable,
|
|
|
|
gint column)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
text = GTK_TEXT (editable);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
text->cursor_virtual_x = 0; /* FIXME */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
/* Move to the beginning of the line */
|
1998-03-10 03:17:02 +00:00
|
|
|
while ((text->cursor_mark.index > 0) &&
|
|
|
|
(GTK_TEXT_INDEX (text, text->cursor_mark.index - 1) != LINE_DELIM))
|
|
|
|
decrement_mark (&text->cursor_mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
while (!LAST_INDEX (text, text->cursor_mark) &&
|
|
|
|
(GTK_TEXT_INDEX (text, text->cursor_mark.index) != LINE_DELIM))
|
|
|
|
{
|
|
|
|
if (column > 0)
|
|
|
|
column--;
|
|
|
|
else if (column == 0)
|
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
advance_mark (&text->cursor_mark);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (text, TRUE);
|
1998-03-01 05:11:05 +00:00
|
|
|
draw_cursor (text, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_move_beginning_of_line (GtkText *text)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_move_to_column (GTK_EDITABLE (text), 0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_move_end_of_line (GtkText *text)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_move_to_column (GTK_EDITABLE (text), -1);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_text_kill_char (GtkEditable *editable,
|
|
|
|
gint direction)
|
|
|
|
{
|
|
|
|
GtkText *text;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
text = GTK_TEXT (editable);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos != editable->selection_end_pos)
|
|
|
|
gtk_editable_delete_selection (editable);
|
|
|
|
else
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
if (direction >= 0)
|
|
|
|
{
|
|
|
|
if (text->point.index + 1 <= TEXT_LENGTH (text))
|
|
|
|
gtk_editable_delete_text (editable, text->point.index, text->point.index + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (text->point.index > 0)
|
|
|
|
gtk_editable_delete_text (editable, text->point.index - 1, text->point.index);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_text_delete_forward_character (GtkText *text)
|
|
|
|
{
|
|
|
|
gtk_text_kill_char (GTK_EDITABLE (text), 1);
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
|
|
|
gtk_text_delete_backward_character (GtkText *text)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_kill_char (GTK_EDITABLE (text), -1);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_text_kill_word (GtkEditable *editable,
|
|
|
|
gint direction)
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->selection_start_pos != editable->selection_end_pos)
|
|
|
|
gtk_editable_delete_selection (editable);
|
|
|
|
else
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gint old_pos = editable->current_pos;
|
|
|
|
if (direction >= 0)
|
|
|
|
{
|
|
|
|
gtk_text_move_word (editable, 1);
|
|
|
|
gtk_editable_delete_text (editable, old_pos, editable->current_pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_text_move_word (editable, -1);
|
|
|
|
gtk_editable_delete_text (editable, editable->current_pos, old_pos);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_delete_forward_word (GtkText *text)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_kill_word (GTK_EDITABLE (text), 1);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_delete_backward_word (GtkText *text)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_kill_word (GTK_EDITABLE (text), -1);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-06-19 01:26:24 +00:00
|
|
|
static void
|
|
|
|
gtk_text_kill_line (GtkEditable *editable,
|
|
|
|
gint direction)
|
|
|
|
{
|
|
|
|
gint old_pos = editable->current_pos;
|
|
|
|
if (direction >= 0)
|
|
|
|
{
|
|
|
|
gtk_text_move_to_column (editable, -1);
|
|
|
|
gtk_editable_delete_text (editable, old_pos, editable->current_pos);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
else
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_move_to_column (editable, 0);
|
|
|
|
gtk_editable_delete_text (editable, editable->current_pos, old_pos);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_delete_line (GtkText *text)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_move_to_column (GTK_EDITABLE (text), 0);
|
|
|
|
gtk_text_kill_line (GTK_EDITABLE (text), 1);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_delete_to_line_end (GtkText *text)
|
|
|
|
{
|
1998-06-19 01:26:24 +00:00
|
|
|
gtk_text_kill_line (GTK_EDITABLE (text), 1);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_text_select_word (GtkText *text, guint32 time)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
gint start_pos;
|
|
|
|
gint end_pos;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable;
|
|
|
|
editable = GTK_EDITABLE (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_text_move_backward_word (text);
|
|
|
|
start_pos = text->cursor_mark.index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_text_move_forward_word (text);
|
|
|
|
end_pos = text->cursor_mark.index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
editable->has_selection = TRUE;
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_text_set_selection (editable, start_pos, end_pos);
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_editable_claim_selection (editable, start_pos != end_pos, time);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_text_select_line (GtkText *text, guint32 time)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-03-10 03:17:02 +00:00
|
|
|
gint start_pos;
|
|
|
|
gint end_pos;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
GtkEditable *editable;
|
|
|
|
editable = GTK_EDITABLE (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
gtk_text_move_beginning_of_line (text);
|
|
|
|
start_pos = text->cursor_mark.index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 03:17:02 +00:00
|
|
|
gtk_text_move_end_of_line (text);
|
|
|
|
gtk_text_move_forward_character (text);
|
|
|
|
end_pos = text->cursor_mark.index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
editable->has_selection = TRUE;
|
1998-03-10 03:17:02 +00:00
|
|
|
gtk_text_set_selection (editable, start_pos, end_pos);
|
1998-03-10 22:57:26 +00:00
|
|
|
gtk_editable_claim_selection (editable, start_pos != end_pos, time);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
/* Scrolling */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
adjust_adj (GtkText* text, GtkAdjustment* adj)
|
|
|
|
{
|
|
|
|
gint height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, NULL, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
adj->step_increment = MIN (adj->upper, (float) SCROLL_PIXELS);
|
|
|
|
adj->page_increment = MIN (adj->upper, height - (float) KEY_SCROLL_PIXELS);
|
|
|
|
adj->page_size = MIN (adj->upper, height);
|
|
|
|
adj->value = MIN (adj->value, adj->upper - adj->page_size);
|
|
|
|
adj->value = MAX (adj->value, 0.0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
set_vertical_scroll_iterator (GtkText* text, LineParams* lp, void* data)
|
|
|
|
{
|
1998-09-15 14:59:48 +00:00
|
|
|
SetVerticalScrollData *svdata = (SetVerticalScrollData *) data;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
if ((text->first_line_start_index >= lp->start.index) &&
|
|
|
|
(text->first_line_start_index <= lp->end.index))
|
|
|
|
{
|
|
|
|
svdata->mark = lp->start;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
if (text->first_line_start_index == lp->start.index)
|
|
|
|
{
|
|
|
|
text->first_onscreen_ver_pixel = svdata->pixel_height + text->first_cut_pixels;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
text->first_onscreen_ver_pixel = svdata->pixel_height;
|
|
|
|
text->first_cut_pixels = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
text->vadj->value = (float) text->first_onscreen_ver_pixel;
|
|
|
|
}
|
|
|
|
|
|
|
|
svdata->pixel_height += LINE_HEIGHT (*lp);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
set_vertical_scroll_find_iterator (GtkText* text, LineParams* lp, void* data)
|
|
|
|
{
|
|
|
|
SetVerticalScrollData *svdata = (SetVerticalScrollData *) data;
|
|
|
|
gint return_val;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (svdata->pixel_height <= (gint) text->vadj->value &&
|
|
|
|
svdata->pixel_height + LINE_HEIGHT(*lp) > (gint) text->vadj->value)
|
|
|
|
{
|
|
|
|
svdata->mark = lp->start;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->first_cut_pixels = (gint)text->vadj->value - svdata->pixel_height;
|
|
|
|
text->first_onscreen_ver_pixel = svdata->pixel_height;
|
1998-09-15 14:59:48 +00:00
|
|
|
text->first_line_start_index = lp->start.index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return_val = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
svdata->pixel_height += LINE_HEIGHT (*lp);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return_val = FALSE;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return return_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkPropertyMark
|
|
|
|
set_vertical_scroll (GtkText* text)
|
|
|
|
{
|
|
|
|
GtkPropertyMark mark = find_mark (text, 0);
|
|
|
|
SetVerticalScrollData data;
|
|
|
|
gint height;
|
|
|
|
gint orig_value;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
data.pixel_height = 0;
|
|
|
|
line_params_iterate (text, &mark, NULL, FALSE, &data, set_vertical_scroll_iterator);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
text->vadj->upper = (float) data.pixel_height;
|
1997-11-24 22:37:52 +00:00
|
|
|
orig_value = (gint) text->vadj->value;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, NULL, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->vadj->step_increment = MIN (text->vadj->upper, (float) SCROLL_PIXELS);
|
|
|
|
text->vadj->page_increment = MIN (text->vadj->upper, height - (float) KEY_SCROLL_PIXELS);
|
|
|
|
text->vadj->page_size = MIN (text->vadj->upper, height);
|
|
|
|
text->vadj->value = MIN (text->vadj->value, text->vadj->upper - text->vadj->page_size);
|
|
|
|
text->vadj->value = MAX (text->vadj->value, 0.0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->last_ver_value = (gint)text->vadj->value;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_emit_by_name (GTK_OBJECT (text->vadj), "changed");
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->vadj->value != orig_value)
|
|
|
|
{
|
|
|
|
/* We got clipped, and don't really know which line to put first. */
|
|
|
|
data.pixel_height = 0;
|
|
|
|
data.last_didnt_wrap = TRUE;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
line_params_iterate (text, &mark, NULL,
|
|
|
|
FALSE, &data,
|
|
|
|
set_vertical_scroll_find_iterator);
|
|
|
|
}
|
1998-09-15 14:59:48 +00:00
|
|
|
|
|
|
|
return data.mark;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
scroll_int (GtkText* text, gint diff)
|
|
|
|
{
|
|
|
|
gfloat upper;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->vadj->value += diff;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
upper = text->vadj->upper - text->vadj->page_size;
|
|
|
|
text->vadj->value = MIN (text->vadj->value, upper);
|
|
|
|
text->vadj->value = MAX (text->vadj->value, 0.0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_signal_emit_by_name (GTK_OBJECT (text->vadj), "value_changed");
|
|
|
|
}
|
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
static void
|
|
|
|
process_exposes (GtkText *text)
|
|
|
|
{
|
|
|
|
GdkEvent *event;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
/* Make sure graphics expose events are processed before scrolling
|
|
|
|
* again */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
while ((event = gdk_event_get_graphics_expose (text->text_area)) != NULL)
|
|
|
|
{
|
|
|
|
gtk_widget_event (GTK_WIDGET (text), event);
|
|
|
|
if (event->expose.count == 0)
|
|
|
|
{
|
|
|
|
gdk_event_free (event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
gdk_event_free (event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static gint last_visible_line_height (GtkText* text)
|
|
|
|
{
|
|
|
|
GList *cache = text->line_start_cache;
|
|
|
|
gint height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, NULL, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; cache->next; cache = cache->next)
|
|
|
|
if (pixel_height_of(text, cache->next) > height)
|
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (cache)
|
|
|
|
return pixel_height_of(text, cache) - 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint first_visible_line_height (GtkText* text)
|
|
|
|
{
|
|
|
|
if (text->first_cut_pixels)
|
|
|
|
return pixel_height_of(text, text->line_start_cache) + 1;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
scroll_down (GtkText* text, gint diff0)
|
|
|
|
{
|
|
|
|
GdkRectangle rect;
|
|
|
|
gint real_diff = 0;
|
|
|
|
gint width, height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->first_onscreen_ver_pixel += diff0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (diff0-- > 0)
|
|
|
|
{
|
1998-04-11 06:06:51 +00:00
|
|
|
g_assert (text->line_start_cache);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->first_cut_pixels < LINE_HEIGHT(CACHE_DATA(text->line_start_cache)) - 1)
|
|
|
|
{
|
|
|
|
text->first_cut_pixels += 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
text->first_cut_pixels = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->line_start_cache = text->line_start_cache->next;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->first_line_start_index =
|
|
|
|
CACHE_DATA(text->line_start_cache).start.index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!text->line_start_cache->next)
|
|
|
|
fetch_lines_forward (text, 1);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
real_diff += 1;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, &height);
|
|
|
|
if (height > real_diff)
|
|
|
|
gdk_draw_pixmap (text->text_area,
|
|
|
|
text->gc,
|
|
|
|
text->text_area,
|
|
|
|
0,
|
|
|
|
real_diff,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
width,
|
|
|
|
height - real_diff);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
rect.x = 0;
|
|
|
|
rect.y = MAX (0, height - real_diff);
|
|
|
|
rect.width = width;
|
|
|
|
rect.height = MIN (height, real_diff);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
expose_text (text, &rect, FALSE);
|
|
|
|
gtk_text_draw_focus ( (GtkWidget *) text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->current_line)
|
|
|
|
{
|
|
|
|
gint cursor_min;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_pos_y -= real_diff;
|
|
|
|
cursor_min = drawn_cursor_min(text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (cursor_min < 0)
|
1998-03-01 05:11:05 +00:00
|
|
|
find_mouse_cursor (text, text->cursor_pos_x,
|
|
|
|
first_visible_line_height (text));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
if (height > real_diff)
|
|
|
|
process_exposes (text);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
scroll_up (GtkText* text, gint diff0)
|
|
|
|
{
|
|
|
|
gint real_diff = 0;
|
|
|
|
GdkRectangle rect;
|
|
|
|
gint width, height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->first_onscreen_ver_pixel += diff0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (diff0++ < 0)
|
|
|
|
{
|
|
|
|
g_assert (text->line_start_cache);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->first_cut_pixels > 0)
|
|
|
|
{
|
|
|
|
text->first_cut_pixels -= 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!text->line_start_cache->prev)
|
|
|
|
fetch_lines_backward (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->line_start_cache = text->line_start_cache->prev;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->first_line_start_index =
|
|
|
|
CACHE_DATA(text->line_start_cache).start.index;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->first_cut_pixels = LINE_HEIGHT(CACHE_DATA(text->line_start_cache)) - 1;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
real_diff += 1;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, &height);
|
|
|
|
if (height > real_diff)
|
|
|
|
gdk_draw_pixmap (text->text_area,
|
|
|
|
text->gc,
|
|
|
|
text->text_area,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
real_diff,
|
|
|
|
width,
|
|
|
|
height - real_diff);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
rect.x = 0;
|
|
|
|
rect.y = 0;
|
|
|
|
rect.width = width;
|
|
|
|
rect.height = MIN (height, real_diff);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
expose_text (text, &rect, FALSE);
|
|
|
|
gtk_text_draw_focus ( (GtkWidget *) text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->current_line)
|
|
|
|
{
|
|
|
|
gint cursor_max;
|
|
|
|
gint height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->cursor_pos_y += real_diff;
|
|
|
|
cursor_max = drawn_cursor_max(text);
|
|
|
|
gdk_window_get_size (text->text_area, NULL, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (cursor_max >= height)
|
1998-03-01 05:11:05 +00:00
|
|
|
find_mouse_cursor (text, text->cursor_pos_x,
|
|
|
|
last_visible_line_height (text));
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-12-18 02:17:14 +00:00
|
|
|
if (height > real_diff)
|
|
|
|
process_exposes (text);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Display Code */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
/* Assumes mark starts a line. Calculates the height, width, and
|
|
|
|
* displayable character count of a single DISPLAYABLE line. That
|
|
|
|
* means that in line-wrap mode, this does may not compute the
|
|
|
|
* properties of an entire line. */
|
|
|
|
static LineParams
|
|
|
|
find_line_params (GtkText* text,
|
|
|
|
const GtkPropertyMark* mark,
|
|
|
|
const PrevTabCont *tab_cont,
|
|
|
|
PrevTabCont *next_cont)
|
|
|
|
{
|
|
|
|
LineParams lp;
|
|
|
|
TabStopMark tab_mark = tab_cont->tab_start;
|
|
|
|
guint max_display_pixels;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
GdkWChar ch;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint ch_width;
|
|
|
|
GdkFont *font;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, (gint*) &max_display_pixels, NULL);
|
|
|
|
max_display_pixels -= LINE_WRAP_ROOM;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
lp.wraps = 0;
|
|
|
|
lp.tab_cont = *tab_cont;
|
|
|
|
lp.start = *mark;
|
|
|
|
lp.end = *mark;
|
|
|
|
lp.pixel_width = tab_cont->pixel_offset;
|
|
|
|
lp.displayable_chars = 0;
|
|
|
|
lp.font_ascent = 0;
|
|
|
|
lp.font_descent = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
init_tab_cont (text, next_cont);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (!LAST_INDEX(text, lp.end))
|
|
|
|
{
|
|
|
|
g_assert (lp.end.property);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-27 06:13:22 +00:00
|
|
|
ch = GTK_TEXT_INDEX (text, lp.end.index);
|
1998-08-25 00:06:38 +00:00
|
|
|
font = MARK_CURRENT_FONT (text, &lp.end);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (ch == LINE_DELIM)
|
|
|
|
{
|
|
|
|
/* Newline doesn't count in computation of line height, even
|
|
|
|
* if its in a bigger font than the rest of the line. Unless,
|
|
|
|
* of course, there are no other characters. */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!lp.font_ascent && !lp.font_descent)
|
|
|
|
{
|
|
|
|
lp.font_ascent = font->ascent;
|
|
|
|
lp.font_descent = font->descent;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
lp.tab_cont_next = *next_cont;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return lp;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
ch_width = find_char_width (text, &lp.end, &tab_mark);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-09-15 14:59:48 +00:00
|
|
|
if ((ch_width + lp.pixel_width > max_display_pixels) &&
|
|
|
|
(lp.end.index > lp.start.index))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
lp.wraps = 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->line_wrap)
|
|
|
|
{
|
|
|
|
next_cont->tab_start = tab_mark;
|
|
|
|
next_cont->pixel_offset = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (ch == '\t')
|
|
|
|
{
|
|
|
|
/* Here's the tough case, a tab is wrapping. */
|
|
|
|
gint pixels_avail = max_display_pixels - lp.pixel_width;
|
1998-08-25 00:06:38 +00:00
|
|
|
gint space_width = MARK_CURRENT_TEXT_FONT(text, &lp.end)->char_widths[' '];
|
1997-11-24 22:37:52 +00:00
|
|
|
gint spaces_avail = pixels_avail / space_width;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (spaces_avail == 0)
|
|
|
|
{
|
|
|
|
decrement_mark (&lp.end);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
advance_tab_mark (text, &next_cont->tab_start, '\t');
|
|
|
|
next_cont->pixel_offset = space_width * (tab_mark.to_next_tab -
|
|
|
|
spaces_avail);
|
|
|
|
lp.displayable_chars += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-03-23 06:27:31 +00:00
|
|
|
if (text->word_wrap)
|
|
|
|
{
|
|
|
|
GtkPropertyMark saved_mark = lp.end;
|
|
|
|
guint saved_characters = lp.displayable_chars;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-23 06:27:31 +00:00
|
|
|
lp.displayable_chars += 1;
|
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
1998-03-23 06:27:31 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
while (!gdk_iswspace (GTK_TEXT_INDEX (text, lp.end.index)) &&
|
|
|
|
(lp.end.index > lp.start.index))
|
|
|
|
{
|
|
|
|
decrement_mark (&lp.end);
|
|
|
|
lp.displayable_chars -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (!isspace(GTK_TEXT_INDEX (text, lp.end.index)) &&
|
|
|
|
(lp.end.index > lp.start.index))
|
|
|
|
{
|
|
|
|
decrement_mark (&lp.end);
|
|
|
|
lp.displayable_chars -= 1;
|
|
|
|
}
|
1998-03-23 06:27:31 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-23 06:27:31 +00:00
|
|
|
/* If whole line is one word, revert to char wrapping */
|
|
|
|
if (lp.end.index == lp.start.index)
|
|
|
|
{
|
|
|
|
lp.end = saved_mark;
|
|
|
|
lp.displayable_chars = saved_characters;
|
|
|
|
decrement_mark (&lp.end);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Don't include this character, it will wrap. */
|
|
|
|
decrement_mark (&lp.end);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
lp.tab_cont_next = *next_cont;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return lp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lp.displayable_chars += 1;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
lp.font_ascent = MAX (font->ascent, lp.font_ascent);
|
|
|
|
lp.font_descent = MAX (font->descent, lp.font_descent);
|
|
|
|
lp.pixel_width += ch_width;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_mark(&lp.end);
|
|
|
|
advance_tab_mark (text, &tab_mark, ch);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (LAST_INDEX(text, lp.start))
|
|
|
|
{
|
|
|
|
/* Special case, empty last line. */
|
1998-08-25 00:06:38 +00:00
|
|
|
font = MARK_CURRENT_FONT (text, &lp.end);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
lp.font_ascent = font->ascent;
|
|
|
|
lp.font_descent = font->descent;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
lp.tab_cont_next = *next_cont;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return lp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
expand_scratch_buffer (GtkText* text, guint len)
|
|
|
|
{
|
|
|
|
if (len >= text->scratch_buffer_len)
|
|
|
|
{
|
|
|
|
guint i = 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
while (i <= len && i < MIN_GAP_SIZE) i <<= 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
if (text->scratch_buffer.wc)
|
|
|
|
text->scratch_buffer.wc = g_new (GdkWChar, i);
|
|
|
|
else
|
|
|
|
text->scratch_buffer.wc = g_realloc (text->scratch_buffer.wc,
|
|
|
|
i*sizeof (GdkWChar));
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
{
|
|
|
|
if (text->scratch_buffer.ch)
|
|
|
|
text->scratch_buffer.ch = g_new (guchar, i);
|
|
|
|
else
|
|
|
|
text->scratch_buffer.ch = g_realloc (text->scratch_buffer.ch, i);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
text->scratch_buffer_len = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
/* Side effect: modifies text->gc
|
1998-03-01 05:11:05 +00:00
|
|
|
*/
|
1998-11-06 22:05:02 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
draw_bg_rect (GtkText* text, GtkPropertyMark *mark,
|
|
|
|
gint x, gint y, gint width, gint height,
|
|
|
|
gboolean already_cleared)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
GtkEditable *editable = GTK_EDITABLE(text);
|
1998-11-06 22:05:02 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if ((mark->index >= MIN(editable->selection_start_pos, editable->selection_end_pos) &&
|
|
|
|
mark->index < MAX(editable->selection_start_pos, editable->selection_end_pos)))
|
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
gtk_paint_flat_box(GTK_WIDGET(text)->style, text->text_area,
|
|
|
|
editable->has_selection ?
|
|
|
|
GTK_STATE_SELECTED : GTK_STATE_ACTIVE,
|
|
|
|
GTK_SHADOW_NONE,
|
|
|
|
NULL, GTK_WIDGET(text), "text",
|
|
|
|
x, y, width, height);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
1998-08-25 00:06:38 +00:00
|
|
|
else if (!gdk_color_equal(MARK_CURRENT_BACK (text, mark),
|
2000-03-14 19:57:25 +00:00
|
|
|
>K_WIDGET(text)->style->base[GTK_WIDGET_STATE (text)]))
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
1998-08-25 00:06:38 +00:00
|
|
|
gdk_gc_set_foreground (text->gc, MARK_CURRENT_BACK (text, mark));
|
1998-11-06 22:05:02 +00:00
|
|
|
|
|
|
|
gdk_draw_rectangle (text->text_area,
|
|
|
|
text->gc,
|
|
|
|
TRUE, x, y, width, height);
|
|
|
|
}
|
|
|
|
else if (GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
|
|
|
|
{
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
|
|
|
rect.x = x;
|
|
|
|
rect.y = y;
|
|
|
|
rect.width = width;
|
|
|
|
rect.height = height;
|
|
|
|
|
|
|
|
clear_area (text, &rect);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
1998-11-06 22:05:02 +00:00
|
|
|
else if (!already_cleared)
|
|
|
|
gdk_window_clear_area (text->text_area, x, y, width, height);
|
1998-03-01 05:11:05 +00:00
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
draw_line (GtkText* text,
|
|
|
|
gint pixel_start_height,
|
|
|
|
LineParams* lp)
|
|
|
|
{
|
|
|
|
GdkGCValues gc_values;
|
|
|
|
gint i;
|
|
|
|
gint len = 0;
|
|
|
|
guint running_offset = lp->tab_cont.pixel_offset;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
union { GdkWChar *wc; guchar *ch; } buffer;
|
1998-11-06 22:05:02 +00:00
|
|
|
GdkGC *fg_gc;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkEditable *editable = GTK_EDITABLE(text);
|
|
|
|
|
|
|
|
guint selection_start_pos = MIN (editable->selection_start_pos, editable->selection_end_pos);
|
|
|
|
guint selection_end_pos = MAX (editable->selection_start_pos, editable->selection_end_pos);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkPropertyMark mark = lp->start;
|
|
|
|
TabStopMark tab_mark = lp->tab_cont.tab_start;
|
|
|
|
gint pixel_height = pixel_start_height + lp->font_ascent;
|
|
|
|
guint chars = lp->displayable_chars;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/* First provide a contiguous segment of memory. This makes reading
|
|
|
|
* the code below *much* easier, and only incurs the cost of copying
|
|
|
|
* when the line being displayed spans the gap. */
|
|
|
|
if (mark.index <= text->gap_position &&
|
|
|
|
mark.index + chars > text->gap_position)
|
|
|
|
{
|
|
|
|
expand_scratch_buffer (text, chars);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
for (i = 0; i < chars; i += 1)
|
|
|
|
text->scratch_buffer.wc[i] = GTK_TEXT_INDEX(text, mark.index + i);
|
|
|
|
buffer.wc = text->scratch_buffer.wc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < chars; i += 1)
|
|
|
|
text->scratch_buffer.ch[i] = GTK_TEXT_INDEX(text, mark.index + i);
|
|
|
|
buffer.ch = text->scratch_buffer.ch;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
if (mark.index >= text->gap_position)
|
|
|
|
buffer.wc = text->text.wc + mark.index + text->gap_size;
|
|
|
|
else
|
|
|
|
buffer.wc = text->text.wc + mark.index;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
else
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
{
|
|
|
|
if (mark.index >= text->gap_position)
|
|
|
|
buffer.ch = text->text.ch + mark.index + text->gap_size;
|
|
|
|
else
|
|
|
|
buffer.ch = text->text.ch + mark.index;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
|
|
|
|
if (running_offset > 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
draw_bg_rect (text, &mark, 0, pixel_start_height, running_offset,
|
|
|
|
LINE_HEIGHT (*lp), TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
while (chars > 0)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
len = 0;
|
|
|
|
if ((text->use_wchar && buffer.wc[0] != '\t') ||
|
|
|
|
(!text->use_wchar && buffer.ch[0] != '\t'))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
union { GdkWChar *wc; guchar *ch; } next_tab;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint pixel_width;
|
|
|
|
GdkFont *font;
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
|
|
|
|
next_tab.wc = NULL;
|
|
|
|
if (text->use_wchar)
|
|
|
|
for (i=0; i<chars; i++)
|
|
|
|
{
|
|
|
|
if (buffer.wc[i] == '\t')
|
|
|
|
{
|
|
|
|
next_tab.wc = buffer.wc + i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
next_tab.ch = memchr (buffer.ch, '\t', chars);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
len = MIN (MARK_CURRENT_PROPERTY (&mark)->length - mark.offset, chars);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
{
|
|
|
|
if (next_tab.wc)
|
|
|
|
len = MIN (len, next_tab.wc - buffer.wc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (next_tab.ch)
|
|
|
|
len = MIN (len, next_tab.ch - buffer.ch);
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (mark.index < selection_start_pos)
|
|
|
|
len = MIN (len, selection_start_pos - mark.index);
|
|
|
|
else if (mark.index < selection_end_pos)
|
|
|
|
len = MIN (len, selection_end_pos - mark.index);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
font = MARK_CURRENT_FONT (text, &mark);
|
1997-11-24 22:37:52 +00:00
|
|
|
if (font->type == GDK_FONT_FONT)
|
|
|
|
{
|
|
|
|
gdk_gc_set_font (text->gc, font);
|
|
|
|
gdk_gc_get_values (text->gc, &gc_values);
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
pixel_width = gdk_text_width_wc (gc_values.font,
|
|
|
|
buffer.wc, len);
|
|
|
|
else
|
1997-11-24 22:37:52 +00:00
|
|
|
pixel_width = gdk_text_width (gc_values.font,
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
buffer.ch, len);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
{
|
|
|
|
if (text->use_wchar)
|
|
|
|
pixel_width = gdk_text_width_wc (font, buffer.wc, len);
|
|
|
|
else
|
|
|
|
pixel_width = gdk_text_width (font, buffer.ch, len);
|
|
|
|
}
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
draw_bg_rect (text, &mark, running_offset, pixel_start_height,
|
|
|
|
pixel_width, LINE_HEIGHT (*lp), TRUE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if ((mark.index >= selection_start_pos) &&
|
|
|
|
(mark.index < selection_end_pos))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
if (editable->has_selection)
|
|
|
|
fg_gc = GTK_WIDGET(text)->style->fg_gc[GTK_STATE_SELECTED];
|
|
|
|
else
|
|
|
|
fg_gc = GTK_WIDGET(text)->style->fg_gc[GTK_STATE_ACTIVE];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-08-25 00:06:38 +00:00
|
|
|
gdk_gc_set_foreground (text->gc, MARK_CURRENT_FORE (text, &mark));
|
1998-03-01 05:11:05 +00:00
|
|
|
fg_gc = text->gc;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-25 00:06:38 +00:00
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
gdk_draw_text_wc (text->text_area, MARK_CURRENT_FONT (text, &mark),
|
|
|
|
fg_gc,
|
|
|
|
running_offset,
|
|
|
|
pixel_height,
|
|
|
|
buffer.wc,
|
|
|
|
len);
|
|
|
|
else
|
|
|
|
gdk_draw_text (text->text_area, MARK_CURRENT_FONT (text, &mark),
|
|
|
|
fg_gc,
|
|
|
|
running_offset,
|
|
|
|
pixel_height,
|
|
|
|
buffer.ch,
|
|
|
|
len);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
running_offset += pixel_width;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_tab_mark_n (text, &tab_mark, len);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-11-06 22:05:02 +00:00
|
|
|
gint pixels_remaining;
|
|
|
|
gint space_width;
|
|
|
|
gint spaces_avail;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
len = 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
gdk_window_get_size (text->text_area, &pixels_remaining, NULL);
|
|
|
|
pixels_remaining -= (LINE_WRAP_ROOM + running_offset);
|
|
|
|
|
|
|
|
space_width = MARK_CURRENT_TEXT_FONT(text, &mark)->char_widths[' '];
|
|
|
|
|
|
|
|
spaces_avail = pixels_remaining / space_width;
|
|
|
|
spaces_avail = MIN (spaces_avail, tab_mark.to_next_tab);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
draw_bg_rect (text, &mark, running_offset, pixel_start_height,
|
|
|
|
spaces_avail * space_width, LINE_HEIGHT (*lp), TRUE);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
running_offset += tab_mark.to_next_tab *
|
1998-08-25 00:06:38 +00:00
|
|
|
MARK_CURRENT_TEXT_FONT(text, &mark)->char_widths[' '];
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_tab_mark (text, &tab_mark, '\t');
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
advance_mark_n (&mark, len);
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
if (text->use_wchar)
|
|
|
|
buffer.wc += len;
|
|
|
|
else
|
|
|
|
buffer.ch += len;
|
|
|
|
chars -= len;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
draw_line_wrap (GtkText* text, guint height /* baseline height */)
|
|
|
|
{
|
|
|
|
gint width;
|
|
|
|
GdkPixmap *bitmap;
|
|
|
|
gint bitmap_width;
|
|
|
|
gint bitmap_height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->line_wrap)
|
|
|
|
{
|
|
|
|
bitmap = text->line_wrap_bitmap;
|
|
|
|
bitmap_width = line_wrap_width;
|
|
|
|
bitmap_height = line_wrap_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bitmap = text->line_arrow_bitmap;
|
|
|
|
bitmap_width = line_arrow_width;
|
|
|
|
bitmap_height = line_arrow_height;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, NULL);
|
|
|
|
width -= LINE_WRAP_ROOM;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_gc_set_stipple (text->gc,
|
|
|
|
bitmap);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_gc_set_fill (text->gc, GDK_STIPPLED);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_gc_set_ts_origin (text->gc,
|
|
|
|
width + 1,
|
|
|
|
height - bitmap_height - 1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_rectangle (text->text_area,
|
|
|
|
text->gc,
|
|
|
|
TRUE,
|
|
|
|
width + 1,
|
|
|
|
height - bitmap_height - 1 /* one pixel above the baseline. */,
|
|
|
|
bitmap_width,
|
|
|
|
bitmap_height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_gc_set_ts_origin (text->gc, 0, 0);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_gc_set_fill (text->gc, GDK_SOLID);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undraw_cursor (GtkText* text, gint absolute)
|
|
|
|
{
|
1998-03-07 03:05:36 +00:00
|
|
|
GtkEditable *editable = (GtkEditable *)text;
|
1998-08-25 00:06:38 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TDEBUG (("in undraw_cursor\n"));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (absolute)
|
|
|
|
text->cursor_drawn_level = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if ((text->cursor_drawn_level ++ == 0) &&
|
|
|
|
(editable->selection_start_pos == editable->selection_end_pos) &&
|
1998-08-21 00:13:38 +00:00
|
|
|
GTK_WIDGET_DRAWABLE (text) && text->line_start_cache)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GdkFont* font;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_assert(text->cursor_mark.property);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
font = MARK_CURRENT_FONT(text, &text->cursor_mark);
|
|
|
|
|
1998-11-06 22:05:02 +00:00
|
|
|
draw_bg_rect (text, &text->cursor_mark,
|
|
|
|
text->cursor_pos_x,
|
|
|
|
text->cursor_pos_y - text->cursor_char_offset - font->ascent,
|
|
|
|
1, font->ascent + 1, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (text->cursor_char)
|
|
|
|
{
|
|
|
|
if (font->type == GDK_FONT_FONT)
|
|
|
|
gdk_gc_set_font (text->gc, font);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
gdk_gc_set_foreground (text->gc, MARK_CURRENT_FORE (text, &text->cursor_mark));
|
|
|
|
|
Destroy widgets _after_ propagating unrealize signals through the widget
Mon Dec 7 10:27:09 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c: Destroy widgets _after_ propagating unrealize
signals through the widget heirarchy. This is unpleasant, as it
causes more X traffic, but is necessary, because we have to clean
up our Input Contexts before destroying the X windows.
(from matsu-981109-0.patch)
Mon Dec 7 10:18:18 1998 Owen Taylor <otaylor@redhat.com>
Applied gtk-a-higuti-981202-0 :
[ a-higuti@math.sci.hokudai.ac.jp (Akira Higuchi) ]
* gdk/gdk.h gdk/gdk.c
(gdk_mbstowcs): New function. Nearly equals to mbstowcs, but
implemented by a combination of Xlib functions, so
it works even with X_LOCALE.
(gdk_wcstombs): New function.
(g_mbtowc): Removed. No longer needed.
* gdk/gdk.h gdk/gdkfont.c gdk/gdkdraw.c:
Added _wc() variants to gdk_text_width(),
gdk_char_width(), gdk_draw_text(),
* gdk/gdki18n.h
(mblen, mbtowc, wctomb, mbstowcs, wcstombs,
wcslen, wcscpy, wcsncpy):
Removed. No longer needed.
(iswalnum): Removed.
(gdk_iswalnum): New macro.
(gdk_iswspace): New macro.
* gdk/gdktype.h
(GdkWChar): New typedef.
* gtk/gtkentry.h, gtk/gtkentry.c
There are many changes according to the change of the
internal representation of text, from multibyte string
to wide characters.
* gtk/gtkprivate.h, gtk/gtkmain.c
Removed the variable gtk_use_mb and related codes.
* gtk/gtkspinbutton.c
Some changes according to the change of type of entry->text.
* gtk/gtktext.h, gtk/gtktext.c
Changed the internal representation of text. We use GdkWchar
if a fontset is supplied. If not, we use guchar to save
memory.
1998-12-09 06:36:57 +00:00
|
|
|
gdk_draw_text_wc (text->text_area, font,
|
1997-11-24 22:37:52 +00:00
|
|
|
text->gc,
|
|
|
|
text->cursor_pos_x,
|
|
|
|
text->cursor_pos_y - text->cursor_char_offset,
|
|
|
|
&text->cursor_char,
|
|
|
|
1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
drawn_cursor_min (GtkText* text)
|
|
|
|
{
|
1998-08-11 19:06:18 +00:00
|
|
|
GdkFont* font;
|
|
|
|
|
|
|
|
g_assert(text->cursor_mark.property);
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
font = MARK_CURRENT_FONT(text, &text->cursor_mark);
|
1998-08-11 19:06:18 +00:00
|
|
|
|
|
|
|
return text->cursor_pos_y - text->cursor_char_offset - font->ascent;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
drawn_cursor_max (GtkText* text)
|
|
|
|
{
|
1998-08-11 19:06:18 +00:00
|
|
|
GdkFont* font;
|
|
|
|
|
|
|
|
g_assert(text->cursor_mark.property);
|
|
|
|
|
1998-08-25 00:06:38 +00:00
|
|
|
font = MARK_CURRENT_FONT(text, &text->cursor_mark);
|
1998-08-11 19:06:18 +00:00
|
|
|
|
|
|
|
return text->cursor_pos_y - text->cursor_char_offset;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
draw_cursor (GtkText* text, gint absolute)
|
|
|
|
{
|
1998-03-07 03:05:36 +00:00
|
|
|
GtkEditable *editable = (GtkEditable *)text;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TDEBUG (("in draw_cursor\n"));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (absolute)
|
|
|
|
text->cursor_drawn_level = 1;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
if ((--text->cursor_drawn_level == 0) &&
|
|
|
|
editable->editable &&
|
|
|
|
(editable->selection_start_pos == editable->selection_end_pos) &&
|
1998-08-21 00:13:38 +00:00
|
|
|
GTK_WIDGET_DRAWABLE (text) && text->line_start_cache)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GdkFont* font;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_assert (text->cursor_mark.property);
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
font = MARK_CURRENT_FONT (text, &text->cursor_mark);
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->text[GTK_STATE_NORMAL]);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_draw_line (text->text_area, text->gc, text->cursor_pos_x,
|
|
|
|
text->cursor_pos_y - text->cursor_char_offset,
|
|
|
|
text->cursor_pos_x,
|
|
|
|
text->cursor_pos_y - text->cursor_char_offset - font->ascent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-01-20 18:06:31 +00:00
|
|
|
static GdkGC *
|
|
|
|
create_bg_gc (GtkText *text)
|
|
|
|
{
|
|
|
|
GdkGCValues values;
|
|
|
|
|
|
|
|
values.tile = GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL];
|
|
|
|
values.fill = GDK_TILED;
|
|
|
|
|
|
|
|
return gdk_gc_new_with_values (text->text_area, &values,
|
|
|
|
GDK_GC_FILL | GDK_GC_TILE);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
clear_area (GtkText *text, GdkRectangle *area)
|
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkWidget *widget = GTK_WIDGET (text);
|
|
|
|
|
1999-01-20 18:06:31 +00:00
|
|
|
if (text->bg_gc)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
gint width, height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gdk_window_get_size (widget->style->bg_pixmap[GTK_STATE_NORMAL], &width, &height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1999-01-20 18:06:31 +00:00
|
|
|
gdk_gc_set_ts_origin (text->bg_gc,
|
|
|
|
(- text->first_onscreen_hor_pixel) % width,
|
|
|
|
(- text->first_onscreen_ver_pixel) % height);
|
|
|
|
|
|
|
|
gdk_draw_rectangle (text->text_area, text->bg_gc, TRUE,
|
|
|
|
area->x, area->y, area->width, area->height);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
gdk_window_clear_area (text->text_area, area->x, area->y, area->width, area->height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
expose_text (GtkText* text, GdkRectangle *area, gboolean cursor)
|
|
|
|
{
|
|
|
|
GList *cache = text->line_start_cache;
|
|
|
|
gint pixels = - text->first_cut_pixels;
|
1998-04-11 05:50:16 +00:00
|
|
|
gint min_y = MAX (0, area->y);
|
|
|
|
gint max_y = MAX (0, area->y + area->height);
|
1997-11-24 22:37:52 +00:00
|
|
|
gint height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, NULL, &height);
|
|
|
|
max_y = MIN (max_y, height);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
TDEBUG (("in expose x=%d y=%d w=%d h=%d\n", area->x, area->y, area->width, area->height));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
clear_area (text, area);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; pixels < height; cache = cache->next)
|
|
|
|
{
|
1998-04-11 05:50:16 +00:00
|
|
|
if (pixels < max_y && (pixels + (gint)LINE_HEIGHT(CACHE_DATA(cache))) >= min_y)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
draw_line (text, pixels, &CACHE_DATA(cache));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (CACHE_DATA(cache).wraps)
|
|
|
|
draw_line_wrap (text, pixels + CACHE_DATA(cache).font_ascent);
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-11 19:06:18 +00:00
|
|
|
if (cursor && GTK_WIDGET_HAS_FOCUS (text))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
if (CACHE_DATA(cache).start.index <= text->cursor_mark.index &&
|
|
|
|
CACHE_DATA(cache).end.index >= text->cursor_mark.index)
|
1998-04-30 15:18:19 +00:00
|
|
|
{
|
|
|
|
/* We undraw and draw the cursor here to get the drawn
|
|
|
|
* level right ... FIXME - maybe the second parameter
|
|
|
|
* of draw_cursor should work differently
|
|
|
|
*/
|
|
|
|
undraw_cursor (text, FALSE);
|
|
|
|
draw_cursor (text, FALSE);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
pixels += LINE_HEIGHT(CACHE_DATA(cache));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!cache->next)
|
|
|
|
{
|
|
|
|
fetch_lines_forward (text, 1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!cache->next)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
static void
|
|
|
|
gtk_text_update_text (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start_pos,
|
|
|
|
gint end_pos)
|
1998-03-01 05:11:05 +00:00
|
|
|
{
|
|
|
|
GtkText *text = GTK_TEXT (editable);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
GList *cache = text->line_start_cache;
|
|
|
|
gint pixels = - text->first_cut_pixels;
|
|
|
|
GdkRectangle area;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
if (end_pos < 0)
|
|
|
|
end_pos = TEXT_LENGTH (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-10 22:57:26 +00:00
|
|
|
if (end_pos < start_pos)
|
|
|
|
return;
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, &height);
|
|
|
|
area.x = 0;
|
|
|
|
area.y = -1;
|
|
|
|
area.width = width;
|
|
|
|
area.height = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
TDEBUG (("in expose span start=%d stop=%d\n", start_pos, end_pos));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
for (; pixels < height; cache = cache->next)
|
|
|
|
{
|
|
|
|
if (CACHE_DATA(cache).start.index < end_pos)
|
|
|
|
{
|
|
|
|
if (CACHE_DATA(cache).end.index >= start_pos)
|
|
|
|
{
|
|
|
|
if (area.y < 0)
|
1998-03-23 06:27:31 +00:00
|
|
|
area.y = MAX(0,pixels);
|
1998-03-01 05:11:05 +00:00
|
|
|
area.height = pixels + LINE_HEIGHT(CACHE_DATA(cache)) - area.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
pixels += LINE_HEIGHT(CACHE_DATA(cache));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (!cache->next)
|
|
|
|
{
|
|
|
|
fetch_lines_forward (text, 1);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (!cache->next)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (area.y >= 0)
|
|
|
|
expose_text (text, &area, TRUE);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
recompute_geometry (GtkText* text)
|
|
|
|
{
|
1998-08-25 22:22:12 +00:00
|
|
|
GtkPropertyMark mark, start_mark;
|
|
|
|
GList *new_lines;
|
1997-11-24 22:37:52 +00:00
|
|
|
gint height;
|
|
|
|
gint width;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
free_cache (text);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-08-25 22:22:12 +00:00
|
|
|
mark = start_mark = set_vertical_scroll (text);
|
|
|
|
|
|
|
|
/* We need a real start of a line when calling fetch_lines().
|
|
|
|
* not the start of a wrapped line.
|
|
|
|
*/
|
|
|
|
while (mark.index > 0 &&
|
|
|
|
GTK_TEXT_INDEX (text, mark.index - 1) != LINE_DELIM)
|
|
|
|
decrement_mark (&mark);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_get_size (text->text_area, &width, &height);
|
1998-09-15 14:59:48 +00:00
|
|
|
|
|
|
|
/* Fetch an entire line, to make sure that we get all the text
|
|
|
|
* we backed over above, in addition to enough text to fill up
|
|
|
|
* the space vertically
|
|
|
|
*/
|
|
|
|
|
1998-08-25 22:22:12 +00:00
|
|
|
new_lines = fetch_lines (text,
|
|
|
|
&mark,
|
|
|
|
NULL,
|
1998-09-15 14:59:48 +00:00
|
|
|
FetchLinesCount,
|
|
|
|
1);
|
|
|
|
|
|
|
|
mark = CACHE_DATA (g_list_last (new_lines)).end;
|
|
|
|
if (!LAST_INDEX (text, mark))
|
|
|
|
{
|
|
|
|
advance_mark (&mark);
|
|
|
|
|
|
|
|
new_lines = g_list_concat (new_lines,
|
|
|
|
fetch_lines (text,
|
|
|
|
&mark,
|
|
|
|
NULL,
|
|
|
|
FetchLinesPixels,
|
|
|
|
height + text->first_cut_pixels));
|
|
|
|
}
|
1998-08-25 22:22:12 +00:00
|
|
|
|
|
|
|
/* Now work forward to the actual first onscreen line */
|
|
|
|
|
|
|
|
while (CACHE_DATA (new_lines).start.index < start_mark.index)
|
|
|
|
new_lines = new_lines->next;
|
|
|
|
|
|
|
|
text->line_start_cache = new_lines;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-07 03:05:36 +00:00
|
|
|
find_cursor (text, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/* Selection */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
1998-03-17 19:03:52 +00:00
|
|
|
static void
|
1998-03-01 05:11:05 +00:00
|
|
|
gtk_text_set_selection (GtkEditable *editable,
|
1998-03-01 08:47:36 +00:00
|
|
|
gint start,
|
|
|
|
gint end)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
GtkText *text = GTK_TEXT (editable);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
guint start1, end1, start2, end2;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 08:47:36 +00:00
|
|
|
if (end < 0)
|
|
|
|
end = TEXT_LENGTH (text);
|
|
|
|
|
|
|
|
start1 = MIN(start,end);
|
|
|
|
end1 = MAX(start,end);
|
|
|
|
start2 = MIN(editable->selection_start_pos, editable->selection_end_pos);
|
|
|
|
end2 = MAX(editable->selection_start_pos, editable->selection_end_pos);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (start2 < start1)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-01 05:11:05 +00:00
|
|
|
guint tmp;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
tmp = start1; start1 = start2; start2 = tmp;
|
|
|
|
tmp = end1; end1 = end2; end2 = tmp;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
undraw_cursor (text, FALSE);
|
|
|
|
editable->selection_start_pos = start;
|
|
|
|
editable->selection_end_pos = end;
|
|
|
|
draw_cursor (text, FALSE);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
/* Expose only what changed */
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (start1 < start2)
|
|
|
|
gtk_text_update_text (editable, start1, MIN(end1, start2));
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
if (end2 > end1)
|
|
|
|
gtk_text_update_text (editable, MAX(end1, start2), end2);
|
|
|
|
else if (end2 < end1)
|
|
|
|
gtk_text_update_text (editable, end2, end1);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-03-01 05:11:05 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
/**********************************************************************/
|
|
|
|
/* Debug */
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
#ifdef DEBUG_GTK_TEXT
|
|
|
|
static void
|
|
|
|
gtk_text_show_cache_line (GtkText *text, GList *cache,
|
|
|
|
const char* what, const char* func, gint line)
|
|
|
|
{
|
|
|
|
LineParams *lp = &CACHE_DATA(cache);
|
|
|
|
gint i;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-01-13 15:14:54 +00:00
|
|
|
if (cache == text->line_start_cache)
|
1998-08-18 03:59:41 +00:00
|
|
|
g_message ("Line Start Cache: ");
|
|
|
|
|
1998-01-13 15:14:54 +00:00
|
|
|
if (cache == text->current_line)
|
1998-08-18 03:59:41 +00:00
|
|
|
g_message("Current Line: ");
|
|
|
|
|
|
|
|
g_message ("%s:%d: cache line %s s=%d,e=%d,lh=%d (",
|
|
|
|
func,
|
|
|
|
line,
|
|
|
|
what,
|
|
|
|
lp->start.index,
|
|
|
|
lp->end.index,
|
|
|
|
LINE_HEIGHT(*lp));
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (i = lp->start.index; i < (lp->end.index + lp->wraps); i += 1)
|
1998-08-18 03:59:41 +00:00
|
|
|
g_message ("%c", GTK_TEXT_INDEX (text, i));
|
|
|
|
|
|
|
|
g_message (")\n");
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_show_cache (GtkText *text, const char* func, gint line)
|
|
|
|
{
|
|
|
|
GList *l = text->line_start_cache;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-02-19 18:06:29 +00:00
|
|
|
if (!l) {
|
|
|
|
return;
|
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1998-01-13 15:14:54 +00:00
|
|
|
/* back up to the absolute beginning of the line cache */
|
|
|
|
while (l->prev)
|
|
|
|
l = l->prev;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
|
|
|
g_message ("*** line cache ***\n");
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; l; l = l->next)
|
|
|
|
gtk_text_show_cache_line (text, l, "all", func, line);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_assert_mark (GtkText *text,
|
|
|
|
GtkPropertyMark *mark,
|
|
|
|
GtkPropertyMark *before,
|
|
|
|
GtkPropertyMark *after,
|
|
|
|
const gchar *msg,
|
|
|
|
const gchar *where,
|
|
|
|
gint line)
|
|
|
|
{
|
|
|
|
GtkPropertyMark correct_mark = find_mark (text, mark->index);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (mark->offset != correct_mark.offset ||
|
|
|
|
mark->property != correct_mark.property)
|
|
|
|
g_warning ("incorrect %s text property marker in %s:%d, index %d -- bad!", where, msg, line, mark->index);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_assert (GtkText *text,
|
|
|
|
const gchar *msg,
|
|
|
|
gint line)
|
|
|
|
{
|
|
|
|
GList* cache = text->line_start_cache;
|
|
|
|
GtkPropertyMark* before_mark = NULL;
|
|
|
|
GtkPropertyMark* after_mark = NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_text_show_props (text, msg, line);
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; cache->prev; cache = cache->prev)
|
|
|
|
/* nothing */;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
|
|
|
g_message ("*** line markers ***\n");
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; cache; cache = cache->next)
|
|
|
|
{
|
|
|
|
after_mark = &CACHE_DATA(cache).end;
|
|
|
|
gtk_text_assert_mark (text, &CACHE_DATA(cache).start, before_mark, after_mark, msg, "start", line);
|
|
|
|
before_mark = &CACHE_DATA(cache).start;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (cache->next)
|
|
|
|
after_mark = &CACHE_DATA(cache->next).start;
|
|
|
|
else
|
|
|
|
after_mark = NULL;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_text_assert_mark (text, &CACHE_DATA(cache).end, before_mark, after_mark, msg, "end", line);
|
|
|
|
before_mark = &CACHE_DATA(cache).end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_show_adj (GtkText *text,
|
|
|
|
GtkAdjustment *adj,
|
|
|
|
const char* what,
|
|
|
|
const char* func,
|
|
|
|
gint line)
|
|
|
|
{
|
1998-08-18 03:59:41 +00:00
|
|
|
g_message ("*** adjustment ***\n");
|
|
|
|
|
|
|
|
g_message ("%s:%d: %s adjustment l=%.1f u=%.1f v=%.1f si=%.1f pi=%.1f ps=%.1f\n",
|
|
|
|
func,
|
|
|
|
line,
|
|
|
|
what,
|
|
|
|
adj->lower,
|
|
|
|
adj->upper,
|
|
|
|
adj->value,
|
|
|
|
adj->step_increment,
|
|
|
|
adj->page_increment,
|
|
|
|
adj->page_size);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_text_show_props (GtkText *text,
|
|
|
|
const char* msg,
|
|
|
|
int line)
|
|
|
|
{
|
|
|
|
GList* props = text->text_properties;
|
|
|
|
int proplen = 0;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
|
|
|
g_message ("%s:%d: ", msg, line);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
for (; props; props = props->next)
|
|
|
|
{
|
|
|
|
TextProperty *p = (TextProperty*)props->data;
|
1998-08-18 03:59:41 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
proplen += p->length;
|
1998-08-25 00:06:38 +00:00
|
|
|
|
|
|
|
g_message ("[%d,%p,", p->length, p);
|
|
|
|
if (p->flags & PROPERTY_FONT)
|
|
|
|
g_message ("%p,", p->font);
|
|
|
|
else
|
|
|
|
g_message ("-,");
|
|
|
|
if (p->flags & PROPERTY_FOREGROUND)
|
|
|
|
g_message ("%ld, ", p->fore_color.pixel);
|
|
|
|
else
|
|
|
|
g_message ("-,");
|
|
|
|
if (p->flags & PROPERTY_BACKGROUND)
|
|
|
|
g_message ("%ld] ", p->back_color.pixel);
|
|
|
|
else
|
|
|
|
g_message ("-] ");
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-08-18 03:59:41 +00:00
|
|
|
|
|
|
|
g_message ("\n");
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if (proplen - 1 != TEXT_LENGTH(text))
|
|
|
|
g_warning ("incorrect property list length in %s:%d -- bad!", msg, line);
|
|
|
|
}
|
|
|
|
#endif
|