Changed version to 0.6.3

master
Yevgen Muntyan 2006-03-10 15:19:53 -06:00
parent 6e31a6cc60
commit 508b132442
9 changed files with 176 additions and 26 deletions

View File

@ -4,7 +4,7 @@
m4_define([moo_major_version], [0])
m4_define([moo_minor_version], [6])
m4_define([moo_micro_version], [2])
m4_define([moo_micro_version], [3])
m4_define([moo_version], [moo_major_version.moo_minor_version.moo_micro_version])
AC_INIT(libmoo, [moo_version], [muntyan@math.tamu.edu], libmoo)

View File

@ -32,7 +32,7 @@ _moo_term_mod_init (void)
if (!mod)
return FALSE;
// _moo_term_add_constants (mod, "MOO_");
_moo_term_add_constants (mod, "MOO_TERM_");
_moo_term_register_classes (PyModule_GetDict (mod));
if (!PyErr_Occurred ())

View File

@ -9,21 +9,25 @@
(gtype-id "MOO_TYPE_TERM")
)
(define-object TermBuffer
(define-object Buffer
(in-module "Moo")
(parent "GObject")
(c-name "MooTermBuffer")
(gtype-id "MOO_TYPE_TERM_BUFFER")
)
(define-object TermTag
(define-object Tag
(in-module "Moo")
(parent "GObject")
(c-name "MooTermTag")
(gtype-id "MOO_TYPE_TERM_TAG")
(fields
'("char*" "name")
'("MooTermTextAttr" "attr")
)
)
(define-object TermWindow
(define-object Window
(in-module "Moo")
(parent "MooWindow")
(c-name "MooTermWindow")
@ -31,7 +35,7 @@
)
(define-boxed TermIter
(define-boxed Iter
(in-module "Moo")
(c-name "MooTermIter")
(gtype-id "MOO_TYPE_TERM_ITER")
@ -46,7 +50,7 @@
)
)
(define-boxed TermCommand
(define-boxed Command
(in-module "Moo")
(c-name "MooTermCommand")
(gtype-id "MOO_TYPE_TERM_COMMAND")
@ -54,16 +58,27 @@
(release-func "moo_term_command_free")
)
(define-pointer TermLine
(define-pointer Line
(in-module "Moo")
(c-name "MooTermLine")
(gtype-id "MOO_TYPE_TERM_LINE")
)
(define-boxed Attr
(in-module "Moo")
(c-name "MooTermTextAttr")
(gtype-id "MOO_TYPE_TERM_TEXT_ATTR")
(fields
'("MooTermTextAttrMask" "mask")
'("MooTermTextColor" "foreground")
'("MooTermTextColor" "background")
)
)
;; Enumerations and flags ...
(define-enum TermEraseBinding
(define-enum EraseBinding
(in-module "Moo")
(c-name "MooTermEraseBinding")
(gtype-id "MOO_TYPE_TERM_ERASE_BINDING")
@ -75,7 +90,7 @@
)
)
(define-flags TermTextAttrMask
(define-flags TextAttrMask
(in-module "Moo")
(c-name "MooTermTextAttrMask")
(gtype-id "MOO_TYPE_TERM_TEXT_ATTR_MASK")
@ -89,7 +104,7 @@
)
)
(define-enum TermTextColor
(define-enum TextColor
(in-module "Moo")
(c-name "MooTermTextColor")
(gtype-id "MOO_TYPE_TERM_TEXT_COLOR")
@ -688,10 +703,47 @@
(c-name "moo_term_tag_set_attr")
(return-type "none")
(parameters
'("MooTermTextAttr" "attr")
'("MooTermTextAttr*" "attr")
)
(docstring "Tag.set_attr(attr) -> None.\n"
"\n"
"attr - TextAttr instance\n"
)
)
(define-method set_attributes
(of-object "MooTermTag")
(c-name "moo_term_tag_set_attributes")
(return-type "none")
(parameters
'("MooTermTextAttrMask" "mask")
'("MooTermTextColor" "foreground" (null-ok) (default "0"))
'("MooTermTextColor" "background" (null-ok) (default "0"))
)
(docstring "Tag.set_attributes(mask, foreground=0, background=0) -> None. Sets tag attributes\n"
"\n"
"mask - combination of TextAttrMask values\n"
"foreground - text color as TextColor value, has effect only if TEXT_FOREGROUND mask is set\n"
"background - background color as TextColor value, has effect only if TEXT_BACKGROUND mask is set\n"
)
)
(define-function moo_term_text_attr_new
(c-name "moo_term_text_attr_new")
(is-constructor-of "MooTermTextAttr")
(return-type "MooTermTextAttr*")
(parameters
'("MooTermTextAttrMask" "mask")
'("MooTermTextColor" "foreground")
'("MooTermTextColor" "background")
)
(docstring "TextAttr(mask, foreground=0, background=0) -> TextAttr.\n"
"\n"
"mask - combination of TextAttrMask values\n"
"foreground - text color as TextColor value, has effect only if TEXT_FOREGROUND mask is set\n"
"background - background color as TextColor value, has effect only if TEXT_BACKGROUND mask is set\n"
)
)
;; From mootermwindow.h

View File

@ -278,7 +278,7 @@ moo_term_update_text_colors (MooTerm *term)
gdk_window_set_background (widget->window, &term->priv->bg_color);
gtk_widget_queue_draw (widget);
_moo_term_invalidate_all (term);
}

View File

@ -1416,8 +1416,13 @@ moo_term_apply_tag (MooTerm *term,
line = buf_line (buf, ITER_ROW (start));
_moo_term_line_apply_tag (line, tag, ITER_COL (start),
_moo_term_line_width (line) - ITER_COL (start));
line = buf_line (buf, ITER_ROW (end));
_moo_term_line_apply_tag (line, tag, 0, ITER_COL (end));
if (ITER_COL (end))
{
line = buf_line (buf, ITER_ROW (end));
_moo_term_line_apply_tag (line, tag, 0, ITER_COL (end));
}
if (ITER_ROW (start) + 1 < ITER_ROW (end))
{
for (i = ITER_ROW (start) + 1; i < ITER_ROW (end); ++i)

View File

@ -82,12 +82,13 @@ typedef enum {
struct _MooTermTagTable {
MooTermBuffer *buffer;
GHashTable *named_tags;
GSList *tags;
};
MooTermTagTable *_moo_term_tag_table_new (void);
MooTermTagTable *_moo_term_tag_table_new (MooTermBuffer *buffer);
void _moo_term_tag_table_free (MooTermTagTable *table);
void _moo_term_buffer_set_line_data (MooTermBuffer *buf,

View File

@ -189,7 +189,7 @@ static void moo_term_buffer_init (MooTermBuffer *buf)
buf->priv->changed = NULL;
buf->priv->changed_all = FALSE;
buf->priv->tag_table = _moo_term_tag_table_new ();
buf->priv->tag_table = _moo_term_tag_table_new (buf);
buf->priv->data_sets = g_hash_table_new (g_direct_hash, g_direct_equal);
set_defaults (buf);

View File

@ -16,6 +16,7 @@
#include "mooterm/mooterm-private.h"
#include "mooterm/mootermline-private.h"
#include "mooterm/mooterm-text.h"
#include "mooutils/moomarshals.h"
static void moo_term_tag_finalize (GObject *object);
@ -28,6 +29,13 @@ static void moo_term_tag_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
enum {
CHANGED,
NUM_SIGNALS
};
static guint signals[NUM_SIGNALS];
static int
ptr_cmp (gconstpointer a,
gconstpointer b)
@ -78,6 +86,15 @@ moo_term_tag_class_init (MooTermTagClass *klass)
"name",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
signals[CHANGED] =
g_signal_new ("changed",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MooTermTagClass, changed),
NULL, NULL,
_moo_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
@ -179,11 +196,12 @@ _moo_term_tag_remove_line (MooTermTag *tag,
MooTermTagTable*
_moo_term_tag_table_new (void)
_moo_term_tag_table_new (MooTermBuffer *buffer)
{
MooTermTagTable *table = g_new0 (MooTermTagTable, 1);
table->named_tags = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
table->buffer = buffer;
return table;
}
@ -292,11 +310,34 @@ moo_term_get_tag_table (MooTerm *term)
void
moo_term_tag_set_attr (MooTermTag *tag,
MooTermTextAttr attr)
MooTermTextAttr *attr)
{
/* TODO */
g_return_if_fail (MOO_IS_TERM_TAG (tag));
tag->attr = attr;
g_return_if_fail (attr != NULL);
tag->attr = *attr;
g_signal_emit (tag, signals[CHANGED], 0);
/* XXX */
buf_changed_set_all (tag->table->buffer);
_moo_term_buffer_changed (tag->table->buffer);
}
void
moo_term_tag_set_attributes (MooTermTag *tag,
MooTermTextAttrMask mask,
MooTermTextColor foreground,
MooTermTextColor background)
{
MooTermTextAttr attr;
g_return_if_fail (MOO_IS_TERM_TAG (tag));
attr.mask = mask;
attr.foreground = foreground;
attr.background = background;
moo_term_tag_set_attr (tag, &attr);
}
@ -348,3 +389,44 @@ moo_term_text_color_get_type (void)
return type;
}
MooTermTextAttr*
moo_term_text_attr_new (MooTermTextAttrMask mask,
MooTermTextColor foreground,
MooTermTextColor background)
{
MooTermTextAttr *attr = g_new (MooTermTextAttr, 1);
attr->mask = mask;
attr->foreground = foreground;
attr->background = background;
return attr;
}
static gpointer
copy_attr (gpointer a)
{
MooTermTextAttr *attr = a;
MooTermTextAttr *copy = g_new (MooTermTextAttr, 1);
*copy = *attr;
return copy;
}
static void
free_attr (gpointer a)
{
g_free (a);
}
GType
moo_term_text_attr_get_type (void)
{
static GType type = 0;
if (!type)
type = g_boxed_type_register_static ("MooTermTextAttr",
copy_attr, free_attr);
return type;
}

View File

@ -19,6 +19,7 @@
G_BEGIN_DECLS
#define MOO_TYPE_TERM_TEXT_ATTR (moo_term_text_attr_get_type ())
#define MOO_TYPE_TERM_TEXT_ATTR_MASK (moo_term_text_attr_mask_get_type ())
#define MOO_TYPE_TERM_TEXT_COLOR (moo_term_text_color_get_type ())
@ -37,10 +38,10 @@ typedef struct _MooTermTagTable MooTermTagTable;
typedef enum {
MOO_TERM_TEXT_REVERSE = 1 << 0,
MOO_TERM_TEXT_BLINK = 1 << 1,
MOO_TERM_TEXT_FOREGROUND = 1 << 2,
MOO_TERM_TEXT_BACKGROUND = 1 << 3,
MOO_TERM_TEXT_BOLD = 1 << 4,
MOO_TERM_TEXT_UNDERLINE = 1 << 5
MOO_TERM_TEXT_BOLD = 1 << 2,
MOO_TERM_TEXT_UNDERLINE = 1 << 3,
MOO_TERM_TEXT_FOREGROUND = 1 << 4,
MOO_TERM_TEXT_BACKGROUND = 1 << 5
} MooTermTextAttrMask;
typedef enum {
@ -78,11 +79,20 @@ struct _MooTermTagClass {
GType moo_term_text_attr_mask_get_type (void) G_GNUC_CONST;
GType moo_term_text_attr_get_type (void) G_GNUC_CONST;
GType moo_term_text_color_get_type (void) G_GNUC_CONST;
GType moo_term_tag_get_type (void) G_GNUC_CONST;
MooTermTextAttr *moo_term_text_attr_new (MooTermTextAttrMask mask,
MooTermTextColor fg,
MooTermTextColor bg);
void moo_term_tag_set_attr (MooTermTag *tag,
MooTermTextAttr attr);
MooTermTextAttr *attr);
void moo_term_tag_set_attributes (MooTermTag *tag,
MooTermTextAttrMask mask,
MooTermTextColor fg,
MooTermTextColor bg);
void _moo_term_tag_add_line (MooTermTag *tag,
gpointer line);