Tab markers in GtkSourceView; added MooNotebook, synced MooPaned
This commit is contained in:
parent
69b3062b16
commit
b798580cb3
@ -61,6 +61,8 @@ libmooedit_la_SOURCES = \
|
||||
mooeditsearch.c \
|
||||
mooeditsearch.h \
|
||||
mooeditwindow.c \
|
||||
moonotebook.c \
|
||||
moonotebook.h \
|
||||
moopaned.c \
|
||||
moopaned.h \
|
||||
mootextiter.h
|
||||
|
@ -187,6 +187,10 @@ static void gtk_source_view_get_property (GObject *object,
|
||||
static void gtk_source_view_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_source_view_create_current_line_gc (GtkSourceView *view);
|
||||
static void draw_tabs (GtkSourceView *view,
|
||||
GdkEventExpose *event,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end);
|
||||
|
||||
|
||||
/* Private functions. */
|
||||
@ -1217,6 +1221,7 @@ gtk_source_view_expose (GtkWidget *widget,
|
||||
GtkSourceView *view;
|
||||
GtkTextView *text_view;
|
||||
gboolean event_handled;
|
||||
GtkTextIter start, end;
|
||||
|
||||
view = GTK_SOURCE_VIEW (widget);
|
||||
text_view = GTK_TEXT_VIEW (widget);
|
||||
@ -1236,7 +1241,7 @@ gtk_source_view_expose (GtkWidget *widget,
|
||||
view->priv->source_buffer != NULL)
|
||||
{
|
||||
GdkRectangle visible_rect;
|
||||
GtkTextIter iter1, iter2;
|
||||
GtkTextIter iter1, iter2, iter3, iter4;
|
||||
|
||||
gtk_text_view_get_visible_rect (text_view, &visible_rect);
|
||||
gtk_text_view_get_line_at_y (text_view, &iter1,
|
||||
@ -1247,6 +1252,9 @@ gtk_source_view_expose (GtkWidget *widget,
|
||||
+ visible_rect.height, NULL);
|
||||
gtk_text_iter_forward_line (&iter2);
|
||||
|
||||
start = iter1;
|
||||
end = iter2;
|
||||
|
||||
_gtk_source_buffer_highlight_region (view->priv->source_buffer,
|
||||
&iter1, &iter2, FALSE);
|
||||
}
|
||||
@ -1361,9 +1369,12 @@ gtk_source_view_expose (GtkWidget *widget,
|
||||
event_handled =
|
||||
(* GTK_WIDGET_CLASS (parent_class)->expose_event)
|
||||
(widget, event);
|
||||
|
||||
|
||||
if (event->window == gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT) &&
|
||||
view->priv->source_buffer != NULL)
|
||||
draw_tabs (GTK_SOURCE_VIEW (text_view), event, &start, &end);
|
||||
}
|
||||
|
||||
|
||||
return event_handled;
|
||||
}
|
||||
|
||||
@ -2255,3 +2266,42 @@ gtk_source_view_set_highlight_current_line_color (GtkSourceView *view,
|
||||
else
|
||||
view->priv->current_line_color = *color;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw_tab_at_iter (GtkTextView *textview,
|
||||
GdkEventExpose *event,
|
||||
GtkTextIter *iter)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
GdkPoint points[3];
|
||||
|
||||
gtk_text_view_get_iter_location (textview, iter, &rect);
|
||||
gtk_text_view_buffer_to_window_coords (textview, GTK_TEXT_WINDOW_TEXT,
|
||||
rect.x, rect.y + rect.height - 2,
|
||||
&points[0].x, &points[0].y);
|
||||
points[1] = points[0];
|
||||
points[2] = points[0];
|
||||
points[1].y += 1;
|
||||
points[2].x += 1;
|
||||
points[2].y += 1;
|
||||
gdk_draw_polygon (event->window,
|
||||
GTK_WIDGET(textview)->style->text_gc[GTK_STATE_NORMAL],
|
||||
FALSE, points, 3);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw_tabs (GtkSourceView *view,
|
||||
GdkEventExpose *event,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
while (gtk_text_iter_compare (start, end) < 0)
|
||||
{
|
||||
if (gtk_text_iter_get_char (start) == '\t')
|
||||
draw_tab_at_iter (GTK_TEXT_VIEW (view), event, start);
|
||||
if (!gtk_text_iter_forward_char (start))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,9 @@ G_DEFINE_TYPE (MooBigPaned, moo_big_paned, GTK_TYPE_FRAME)
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PANE_ORDER,
|
||||
PROP_ENABLE_HANDLE_DRAG
|
||||
PROP_ENABLE_HANDLE_DRAG,
|
||||
PROP_ENABLE_DETACHING,
|
||||
PROP_HANDLE_CURSOR_TYPE
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -85,6 +87,23 @@ static void moo_big_paned_class_init (MooBigPanedClass *klass)
|
||||
"enable-handle-drag",
|
||||
"enable-handle-drag",
|
||||
TRUE,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_WRITABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ENABLE_DETACHING,
|
||||
g_param_spec_boolean ("enable-detaching",
|
||||
"enable-detaching",
|
||||
"enable-detaching",
|
||||
FALSE,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_WRITABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HANDLE_CURSOR_TYPE,
|
||||
g_param_spec_enum ("handle-cursor-type",
|
||||
"handle-cursor-type",
|
||||
"handle-cursor-type",
|
||||
GDK_TYPE_CURSOR_TYPE,
|
||||
GDK_HAND2,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
||||
|
||||
signals[OPEN_PANE] =
|
||||
@ -117,7 +136,6 @@ static void moo_big_paned_init (MooBigPaned *paned)
|
||||
int i;
|
||||
|
||||
paned->drop_pos = -1;
|
||||
paned->enable_handle_drag = TRUE;
|
||||
|
||||
/* XXX destroy */
|
||||
for (i = 0; i < 4; ++i)
|
||||
@ -127,7 +145,6 @@ static void moo_big_paned_init (MooBigPaned *paned)
|
||||
paned->paned[i] = child =
|
||||
g_object_new (MOO_TYPE_PANED,
|
||||
"pane-position", (MooPanePosition) i,
|
||||
"enable-handle-drag", paned->enable_handle_drag,
|
||||
NULL);
|
||||
|
||||
g_object_ref (child);
|
||||
@ -346,7 +363,6 @@ static void moo_big_paned_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MooBigPaned *paned = MOO_BIG_PANED (object);
|
||||
gboolean enable;
|
||||
int i;
|
||||
|
||||
switch (prop_id)
|
||||
@ -356,15 +372,27 @@ static void moo_big_paned_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_ENABLE_HANDLE_DRAG:
|
||||
enable = g_value_get_boolean (value);
|
||||
if (enable != paned->enable_handle_drag)
|
||||
{
|
||||
paned->enable_handle_drag = enable;
|
||||
for (i = 0; i < 4; ++i)
|
||||
g_object_set (paned->paned[i], "enable-handle-drag",
|
||||
enable, NULL);
|
||||
g_object_notify (object, "enable-handle-drag");
|
||||
}
|
||||
for (i = 0; i < 4; ++i)
|
||||
g_object_set (paned->paned[i],
|
||||
"enable-handle-drag",
|
||||
g_value_get_boolean (value),
|
||||
NULL);
|
||||
break;
|
||||
|
||||
case PROP_ENABLE_DETACHING:
|
||||
for (i = 0; i < 4; ++i)
|
||||
g_object_set (paned->paned[i],
|
||||
"enable-detaching",
|
||||
g_value_get_boolean (value),
|
||||
NULL);
|
||||
break;
|
||||
|
||||
case PROP_HANDLE_CURSOR_TYPE:
|
||||
for (i = 0; i < 4; ++i)
|
||||
g_object_set (paned->paned[i], "handle-cursor-type",
|
||||
(GdkCursorType) g_value_get_enum (value),
|
||||
NULL);
|
||||
g_object_notify (object, "handle-cursor-type");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -379,6 +407,7 @@ static void moo_big_paned_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MooBigPaned *paned = MOO_BIG_PANED (object);
|
||||
GdkCursorType cursor_type;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -386,8 +415,10 @@ static void moo_big_paned_get_property (GObject *object,
|
||||
g_value_set_pointer (value, paned->order);
|
||||
break;
|
||||
|
||||
case PROP_ENABLE_HANDLE_DRAG:
|
||||
g_value_set_boolean (value, paned->enable_handle_drag);
|
||||
case PROP_HANDLE_CURSOR_TYPE:
|
||||
g_object_get (paned->paned[0], "handle-cursor-type",
|
||||
&cursor_type, NULL);
|
||||
g_value_set_enum (value, cursor_type);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -416,14 +447,8 @@ static void handle_drag_start (G_GNUC_UNUSED MooPaned *child,
|
||||
G_GNUC_UNUSED GtkWidget *pane_widget,
|
||||
MooBigPaned *paned)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
g_return_if_fail (GTK_WIDGET_REALIZED (paned->outer));
|
||||
|
||||
cursor = gdk_cursor_new (GDK_FLEUR);
|
||||
gdk_window_set_cursor (paned->outer->window, cursor);
|
||||
gdk_cursor_unref (cursor);
|
||||
|
||||
g_signal_connect (paned->outer, "expose-event",
|
||||
G_CALLBACK (moo_big_paned_expose), paned);
|
||||
|
||||
@ -477,7 +502,6 @@ static void handle_drag_end (MooPaned *child,
|
||||
g_return_if_fail (GTK_WIDGET_REALIZED (paned->outer));
|
||||
|
||||
gdk_window_get_pointer (paned->outer->window, &x, &y, NULL);
|
||||
gdk_window_set_cursor (paned->outer->window, NULL);
|
||||
|
||||
pos = get_drop_position (paned, child, x, y);
|
||||
|
||||
|
@ -40,7 +40,6 @@ struct _MooBigPaned
|
||||
GtkWidget *inner;
|
||||
GtkWidget *outer;
|
||||
|
||||
gboolean enable_handle_drag;
|
||||
int drop_pos;
|
||||
GdkRectangle drop_rect;
|
||||
GdkWindow *drop_outline;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooeditdialogs.h"
|
||||
#include "mooedit/moobigpaned.h"
|
||||
#include "mooedit/moonotebook.h"
|
||||
#include "moofileview/moofileview.h"
|
||||
#include "mooui/moouiobject-impl.h"
|
||||
#include "mooui/moomenuaction.h"
|
||||
@ -31,7 +32,7 @@
|
||||
|
||||
struct _MooEditWindowPrivate {
|
||||
MooBigPaned *paned;
|
||||
GtkNotebook *notebook;
|
||||
MooNotebook *notebook;
|
||||
MooFileView *fileview;
|
||||
gboolean use_fullname;
|
||||
char *app_name;
|
||||
@ -68,8 +69,8 @@ static gboolean close_tab (MooEditWindow *window,
|
||||
MooEdit *edit);
|
||||
static MooEdit *get_nth_tab (MooEditWindow *window,
|
||||
int n);
|
||||
static void notebook_switch_page (GtkNotebook *notebook,
|
||||
GtkNotebookPage *page,
|
||||
static void notebook_switch_page (MooNotebook *notebook,
|
||||
gpointer whatever,
|
||||
guint page_num,
|
||||
MooEditWindow *window);
|
||||
static void update_window_title (MooEditWindow *window);
|
||||
@ -471,7 +472,10 @@ GObject *moo_edit_window_constructor (GType type,
|
||||
|
||||
gtk_widget_show (MOO_WINDOW(window)->vbox);
|
||||
|
||||
paned = moo_big_paned_new ();
|
||||
paned = g_object_new (MOO_TYPE_BIG_PANED,
|
||||
"handle-cursor-type", GDK_FLEUR,
|
||||
"enable-detaching", TRUE,
|
||||
NULL);
|
||||
gtk_widget_show (paned);
|
||||
gtk_box_pack_start (GTK_BOX (MOO_WINDOW(window)->vbox), paned, TRUE, TRUE, 0);
|
||||
window->priv->paned = MOO_BIG_PANED (paned);
|
||||
@ -512,15 +516,24 @@ GObject *moo_edit_window_constructor (GType type,
|
||||
fileview, MOO_PANE_POS_LEFT,
|
||||
"File Selector", GTK_STOCK_OPEN, -1);
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
|
||||
notebook = moo_notebook_new ();
|
||||
gtk_widget_show (notebook);
|
||||
moo_big_paned_add_child (window->priv->paned, notebook);
|
||||
|
||||
window->priv->notebook = GTK_NOTEBOOK (notebook);
|
||||
window->priv->notebook = MOO_NOTEBOOK (notebook);
|
||||
g_signal_connect_after (window->priv->notebook, "switch-page",
|
||||
G_CALLBACK (notebook_switch_page), window);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
|
||||
icon = gtk_image_new_from_stock (MOO_STOCK_CLOSE, MOO_ICON_SIZE_REAL_SMALL);
|
||||
gtk_container_add (GTK_CONTAINER (button), icon);
|
||||
gtk_widget_show_all (button);
|
||||
moo_notebook_set_action_widget (MOO_NOTEBOOK (notebook),
|
||||
button, TRUE);
|
||||
g_signal_connect_swapped (button, "clicked",
|
||||
G_CALLBACK (moo_edit_window_close_tab), window);
|
||||
|
||||
window = MOO_EDIT_WINDOW (object);
|
||||
edit = MOO_EDIT (_moo_edit_new (window->priv->editor));
|
||||
add_tab (window, edit);
|
||||
@ -568,25 +581,15 @@ static void add_tab (MooEditWindow *window,
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
// gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
// GTK_SHADOW_ETCHED_IN);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), GTK_WIDGET (edit));
|
||||
gtk_widget_show_all (scrolledwindow);
|
||||
g_object_set_qdata (G_OBJECT (edit), SCROLLED_WINDOW_QUARK, scrolledwindow);
|
||||
|
||||
if (!gtk_notebook_get_n_pages (window->priv->notebook))
|
||||
gtk_notebook_set_show_tabs (window->priv->notebook, FALSE);
|
||||
else
|
||||
gtk_notebook_set_show_tabs (window->priv->notebook, TRUE);
|
||||
n = moo_notebook_insert_page (window->priv->notebook, scrolledwindow, label, -1);
|
||||
|
||||
#if GTK_MINOR_VERSION >= 4
|
||||
n = gtk_notebook_append_page (window->priv->notebook, scrolledwindow, label);
|
||||
#else /* GTK_MINOR_VERSION < 4 */
|
||||
gtk_notebook_append_page (window->priv->notebook, scrolledwindow, label);
|
||||
n = gtk_notebook_page_num (window->priv->notebook, scrolledwindow);
|
||||
#endif /* GTK_MINOR_VERSION < 4 */
|
||||
|
||||
gtk_notebook_set_current_page (window->priv->notebook, n);
|
||||
moo_notebook_set_current_page (window->priv->notebook, n);
|
||||
g_signal_connect (edit, "doc_status_changed",
|
||||
G_CALLBACK (edit_changed), window);
|
||||
g_signal_connect_swapped (edit, "can-undo",
|
||||
@ -606,8 +609,8 @@ static void add_tab (MooEditWindow *window,
|
||||
}
|
||||
|
||||
|
||||
static void notebook_switch_page (G_GNUC_UNUSED GtkNotebook *notebook,
|
||||
G_GNUC_UNUSED GtkNotebookPage *page,
|
||||
static void notebook_switch_page (G_GNUC_UNUSED MooNotebook *notebook,
|
||||
G_GNUC_UNUSED gpointer whatever,
|
||||
guint page_num,
|
||||
MooEditWindow *window)
|
||||
{
|
||||
@ -618,7 +621,7 @@ static void notebook_switch_page (G_GNUC_UNUSED GtkNotebook *n
|
||||
static MooEdit *get_nth_tab (MooEditWindow *window,
|
||||
int n)
|
||||
{
|
||||
GtkWidget *swin = gtk_notebook_get_nth_page (window->priv->notebook, n);
|
||||
GtkWidget *swin = moo_notebook_get_nth_page (window->priv->notebook, n);
|
||||
g_return_val_if_fail (swin != NULL, NULL);
|
||||
return MOO_EDIT (gtk_bin_get_child (GTK_BIN (swin)));
|
||||
}
|
||||
@ -629,11 +632,11 @@ void moo_edit_window_set_active_doc (MooEditWindow *window,
|
||||
{
|
||||
int index;
|
||||
g_return_if_fail (MOO_IS_EDIT_WINDOW (window) && MOO_IS_EDIT (edit));
|
||||
index = gtk_notebook_page_num (window->priv->notebook,
|
||||
index = moo_notebook_page_num (window->priv->notebook,
|
||||
g_object_get_qdata (G_OBJECT (edit),
|
||||
SCROLLED_WINDOW_QUARK));
|
||||
g_return_if_fail (index >= 0);
|
||||
gtk_notebook_set_current_page (window->priv->notebook, index);
|
||||
moo_notebook_set_current_page (window->priv->notebook, index);
|
||||
}
|
||||
|
||||
|
||||
@ -777,10 +780,10 @@ static gboolean moo_edit_window_close (MooEditWindow *window)
|
||||
{
|
||||
/* TODO */
|
||||
|
||||
while (gtk_notebook_get_n_pages (window->priv->notebook) &&
|
||||
while (moo_notebook_get_n_pages (window->priv->notebook) &&
|
||||
close_current_tab (window)) ;
|
||||
|
||||
if (gtk_notebook_get_n_pages (window->priv->notebook))
|
||||
if (moo_notebook_get_n_pages (window->priv->notebook))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -804,15 +807,12 @@ static gboolean close_tab (MooEditWindow *window,
|
||||
|
||||
g_object_ref (edit);
|
||||
|
||||
label = gtk_notebook_get_tab_label (window->priv->notebook,
|
||||
label = moo_notebook_get_tab_label (window->priv->notebook,
|
||||
g_object_get_qdata (G_OBJECT (edit),
|
||||
SCROLLED_WINDOW_QUARK));
|
||||
g_signal_handlers_disconnect_by_func(edit, update_tab_label, label);
|
||||
gtk_notebook_remove_page (window->priv->notebook,
|
||||
gtk_notebook_get_current_page (window->priv->notebook));
|
||||
|
||||
if (gtk_notebook_get_n_pages (window->priv->notebook) <= 1)
|
||||
gtk_notebook_set_show_tabs (window->priv->notebook, FALSE);
|
||||
moo_notebook_remove_page (window->priv->notebook,
|
||||
moo_notebook_get_current_page (window->priv->notebook));
|
||||
|
||||
g_signal_emit (window, signals[DOCUMENT_CLOSED], 0, edit);
|
||||
g_object_unref (edit);
|
||||
@ -820,7 +820,9 @@ static gboolean close_tab (MooEditWindow *window,
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -849,28 +851,28 @@ static void moo_edit_window_open_cb (MooEditWindow *window)
|
||||
static void moo_edit_window_close_tab (MooEditWindow *window)
|
||||
{
|
||||
close_current_tab (window);
|
||||
if (!gtk_notebook_get_n_pages (window->priv->notebook))
|
||||
if (!moo_notebook_get_n_pages (window->priv->notebook))
|
||||
moo_edit_window_new_tab (window);
|
||||
}
|
||||
|
||||
|
||||
static void moo_edit_window_previous_tab (MooEditWindow *window)
|
||||
{
|
||||
int n = gtk_notebook_get_current_page (window->priv->notebook);
|
||||
int n = moo_notebook_get_current_page (window->priv->notebook);
|
||||
if (n <= 0)
|
||||
gtk_notebook_set_current_page (window->priv->notebook, -1);
|
||||
moo_notebook_set_current_page (window->priv->notebook, -1);
|
||||
else
|
||||
gtk_notebook_set_current_page (window->priv->notebook, n - 1);
|
||||
moo_notebook_set_current_page (window->priv->notebook, n - 1);
|
||||
}
|
||||
|
||||
|
||||
static void moo_edit_window_next_tab (MooEditWindow *window)
|
||||
{
|
||||
int n = gtk_notebook_get_current_page (window->priv->notebook);
|
||||
if (n == gtk_notebook_get_n_pages (window->priv->notebook) - 1)
|
||||
gtk_notebook_set_current_page (window->priv->notebook, 0);
|
||||
int n = moo_notebook_get_current_page (window->priv->notebook);
|
||||
if (n == moo_notebook_get_n_pages (window->priv->notebook) - 1)
|
||||
moo_notebook_set_current_page (window->priv->notebook, 0);
|
||||
else
|
||||
gtk_notebook_set_current_page (window->priv->notebook, n + 1);
|
||||
moo_notebook_set_current_page (window->priv->notebook, n + 1);
|
||||
}
|
||||
|
||||
|
||||
@ -936,10 +938,10 @@ gboolean _moo_edit_window_open (MooEditWindow *window,
|
||||
MooEdit *moo_edit_window_get_active_doc (MooEditWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL);
|
||||
g_return_val_if_fail (gtk_notebook_get_n_pages (window->priv->notebook) > 0,
|
||||
g_return_val_if_fail (moo_notebook_get_n_pages (window->priv->notebook) > 0,
|
||||
NULL);
|
||||
return get_nth_tab (window,
|
||||
gtk_notebook_get_current_page (window->priv->notebook));
|
||||
moo_notebook_get_current_page (window->priv->notebook));
|
||||
}
|
||||
|
||||
|
||||
@ -1192,7 +1194,7 @@ GSList *moo_edit_window_list_docs (MooEditWindow *window)
|
||||
|
||||
g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL);
|
||||
|
||||
num = gtk_notebook_get_n_pages (window->priv->notebook);
|
||||
num = moo_notebook_get_n_pages (window->priv->notebook);
|
||||
|
||||
for (i = num - 1; i >= 0; i--)
|
||||
list = g_slist_prepend (list, get_nth_tab (window, i));
|
||||
|
3308
moo/mooedit/moonotebook.c
Normal file
3308
moo/mooedit/moonotebook.c
Normal file
File diff suppressed because it is too large
Load Diff
120
moo/mooedit/moonotebook.h
Normal file
120
moo/mooedit/moonotebook.h
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* moonotebook.h
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef __MOO_NOTEBOOK_H__
|
||||
#define __MOO_NOTEBOOK_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_NOTEBOOK (moo_notebook_get_type ())
|
||||
#define MOO_NOTEBOOK(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_NOTEBOOK, MooNotebook))
|
||||
#define MOO_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_NOTEBOOK, MooNotebookClass))
|
||||
#define MOO_IS_NOTEBOOK(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_NOTEBOOK))
|
||||
#define MOO_IS_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_NOTEBOOK))
|
||||
#define MOO_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_NOTEBOOK, MooNotebookClass))
|
||||
|
||||
typedef struct _MooNotebook MooNotebook;
|
||||
typedef struct _MooNotebookPrivate MooNotebookPrivate;
|
||||
typedef struct _MooNotebookClass MooNotebookClass;
|
||||
|
||||
struct _MooNotebook
|
||||
{
|
||||
GtkNotebook parent;
|
||||
MooNotebookPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MooNotebookClass
|
||||
{
|
||||
GtkNotebookClass parent_class;
|
||||
|
||||
gboolean (*populate_popup) (MooNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
GtkMenu *menu);
|
||||
};
|
||||
|
||||
|
||||
GType moo_notebook_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
GtkWidget *moo_notebook_new (void);
|
||||
|
||||
gint moo_notebook_insert_page (MooNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
GtkWidget *tab_label,
|
||||
gint position);
|
||||
void moo_notebook_remove_page (MooNotebook *notebook,
|
||||
gint page_num);
|
||||
|
||||
|
||||
void moo_notebook_set_action_widget (MooNotebook *notebook,
|
||||
GtkWidget *widget,
|
||||
gboolean right);
|
||||
GtkWidget *moo_notebook_get_action_widget (MooNotebook *notebook,
|
||||
gboolean right);
|
||||
|
||||
|
||||
gint moo_notebook_get_current_page (MooNotebook *notebook);
|
||||
GtkWidget* moo_notebook_get_nth_page (MooNotebook *notebook,
|
||||
gint page_num);
|
||||
gint moo_notebook_get_n_pages (MooNotebook *notebook);
|
||||
gint moo_notebook_page_num (MooNotebook *notebook,
|
||||
GtkWidget *child);
|
||||
void moo_notebook_set_current_page (MooNotebook *notebook,
|
||||
gint page_num);
|
||||
|
||||
|
||||
void moo_notebook_set_show_border (MooNotebook *notebook,
|
||||
gboolean show_border);
|
||||
gboolean moo_notebook_get_show_border (MooNotebook *notebook);
|
||||
void moo_notebook_set_show_tabs (MooNotebook *notebook,
|
||||
gboolean show_tabs);
|
||||
gboolean moo_notebook_get_show_tabs (MooNotebook *notebook);
|
||||
|
||||
|
||||
GtkWidget *moo_notebook_get_tab_label (MooNotebook *notebook,
|
||||
GtkWidget *child);
|
||||
void moo_notebook_set_tab_label (MooNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
GtkWidget *tab_label);
|
||||
void moo_notebook_set_tab_label_text (MooNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
const char *tab_text);
|
||||
const char *moo_notebook_get_tab_label_text (MooNotebook *notebook,
|
||||
GtkWidget *child);
|
||||
|
||||
|
||||
void moo_notebook_reorder_child (MooNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
gint position);
|
||||
|
||||
|
||||
typedef GtkWidget* (*MooNotebookPopupCreationFunc) (MooNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
gpointer user_data);
|
||||
|
||||
void moo_notebook_enable_popup (MooNotebook *notebook,
|
||||
gboolean enable);
|
||||
void moo_notebook_set_popup_creation_func (MooNotebook *notebook,
|
||||
MooNotebookPopupCreationFunc func,
|
||||
gpointer user_data);
|
||||
|
||||
void moo_notebook_enable_reordering (MooNotebook *notebook,
|
||||
gboolean enable);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MOO_NOTEBOOK_H__ */
|
File diff suppressed because it is too large
Load Diff
@ -117,8 +117,12 @@ int moo_paned_get_open_pane (MooPaned *paned);
|
||||
gboolean moo_paned_is_open (MooPaned *paned);
|
||||
|
||||
void moo_paned_open_pane (MooPaned *paned,
|
||||
guint index);
|
||||
guint index_);
|
||||
void moo_paned_hide_pane (MooPaned *paned);
|
||||
void moo_paned_detach_pane (MooPaned *paned,
|
||||
guint index_);
|
||||
void moo_paned_attach_pane (MooPaned *paned,
|
||||
guint index_);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -121,12 +121,18 @@ PIXMAPS = \
|
||||
$(srcdir)/pixmaps/gap.png \
|
||||
$(srcdir)/pixmaps/ggap.png \
|
||||
$(srcdir)/pixmaps/close.png \
|
||||
$(srcdir)/pixmaps/detach.png \
|
||||
$(srcdir)/pixmaps/attach.png \
|
||||
$(srcdir)/pixmaps/keepontop.png \
|
||||
$(srcdir)/pixmaps/sticky.png
|
||||
|
||||
stock-moo.h: $(PIXMAPS)
|
||||
gdk-pixbuf-csource --static --build-list \
|
||||
GAP_ICON $(srcdir)/pixmaps/gap.png \
|
||||
GGAP_ICON $(srcdir)/pixmaps/ggap.png \
|
||||
MOO_CLOSE_ICON $(srcdir)/pixmaps/close.png \
|
||||
MOO_STICKY_ICON $(srcdir)/pixmaps/sticky.png \
|
||||
gdk-pixbuf-csource --static --build-list \
|
||||
GAP_ICON $(srcdir)/pixmaps/gap.png \
|
||||
GGAP_ICON $(srcdir)/pixmaps/ggap.png \
|
||||
MOO_CLOSE_ICON $(srcdir)/pixmaps/close.png \
|
||||
MOO_STICKY_ICON $(srcdir)/pixmaps/sticky.png \
|
||||
MOO_DETACH_ICON $(srcdir)/pixmaps/detach.png \
|
||||
MOO_ATTACH_ICON $(srcdir)/pixmaps/attach.png \
|
||||
MOO_KEEP_ON_TOP_ICON $(srcdir)/pixmaps/keepontop.png \
|
||||
> $(srcdir)/stock-moo.h
|
||||
|
@ -38,7 +38,7 @@ static void message_dialog (GtkWidget *parent,
|
||||
parent_window,
|
||||
GTK_DIALOG_MODAL,
|
||||
type,
|
||||
GTK_BUTTONS_OK,
|
||||
GTK_BUTTONS_NONE,
|
||||
"<span weight=\"bold\" size=\"larger\">%s</span>", text);
|
||||
if (secondary_text)
|
||||
gtk_message_dialog_format_secondary_text (
|
||||
@ -49,7 +49,7 @@ static void message_dialog (GtkWidget *parent,
|
||||
parent_window,
|
||||
GTK_DIALOG_MODAL,
|
||||
type,
|
||||
GTK_BUTTONS_OK,
|
||||
GTK_BUTTONS_NONE,
|
||||
"<span weight=\"bold\" size=\"larger\">%s</span>\n%s",
|
||||
text, secondary_text ? secondary_text : "");
|
||||
#else /* !GTK_CHECK_VERSION(2,4,0) */
|
||||
@ -57,11 +57,17 @@ static void message_dialog (GtkWidget *parent,
|
||||
parent_window,
|
||||
GTK_DIALOG_MODAL,
|
||||
type,
|
||||
GTK_BUTTONS_OK,
|
||||
GTK_BUTTONS_NONE,
|
||||
"%s\n%s",
|
||||
text, secondary_text ? secondary_text : "");
|
||||
#endif /* !GTK_CHECK_VERSION(2,4,0) */
|
||||
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
||||
GTK_STOCK_OK, GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_CANCEL);
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
BOOL:ENUM,INT
|
||||
BOOL:ENUM,INT,BOOL
|
||||
BOOL:OBJECT,OBJECT
|
||||
BOOL:POINTER
|
||||
BOOL:STRING
|
||||
BOOL:STRING,POINTER
|
||||
|
@ -102,6 +102,12 @@ void moo_create_stock_items (void)
|
||||
REAL_SMALL, MOO_CLOSE_ICON);
|
||||
add_icon (factory, MOO_STOCK_STICKY,
|
||||
REAL_SMALL, MOO_STICKY_ICON);
|
||||
add_icon (factory, MOO_STOCK_DETACH,
|
||||
REAL_SMALL, MOO_DETACH_ICON);
|
||||
add_icon (factory, MOO_STOCK_ATTACH,
|
||||
REAL_SMALL, MOO_ATTACH_ICON);
|
||||
add_icon (factory, MOO_STOCK_KEEP_ON_TOP,
|
||||
REAL_SMALL, MOO_KEEP_ON_TOP_ICON);
|
||||
|
||||
#if !GTK_CHECK_VERSION(2,6,0)
|
||||
add_icon2 (factory, GTK_STOCK_ABOUT,
|
||||
|
@ -28,6 +28,9 @@ G_BEGIN_DECLS
|
||||
#define MOO_STOCK_DOC_MODIFIED_ON_DISK GTK_STOCK_DIALOG_WARNING
|
||||
#define MOO_STOCK_CLOSE "moo-close"
|
||||
#define MOO_STOCK_STICKY "moo-sticky"
|
||||
#define MOO_STOCK_DETACH "moo-detach"
|
||||
#define MOO_STOCK_ATTACH "moo-attach"
|
||||
#define MOO_STOCK_KEEP_ON_TOP "moo-keep-on-top"
|
||||
|
||||
#define MOO_ICON_SIZE_REAL_SMALL (moo_get_icon_size_real_small ())
|
||||
|
||||
|
@ -6,5 +6,7 @@ EXTRA_DIST = \
|
||||
ggap.png \
|
||||
gap.png \
|
||||
close.png \
|
||||
sticky.png
|
||||
|
||||
sticky.png \
|
||||
detach.png \
|
||||
attach.png \
|
||||
keepontop.png
|
||||
|
BIN
moo/mooutils/pixmaps/attach.png
Normal file
BIN
moo/mooutils/pixmaps/attach.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 B |
BIN
moo/mooutils/pixmaps/detach.png
Normal file
BIN
moo/mooutils/pixmaps/detach.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 B |
BIN
moo/mooutils/pixmaps/keepontop.png
Normal file
BIN
moo/mooutils/pixmaps/keepontop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 B |
@ -257,3 +257,91 @@ static const guint8 MOO_STICKY_ICON[] =
|
||||
"\0\0\1\0\0\0\377"};
|
||||
|
||||
|
||||
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
#pragma align 4 (MOO_DETACH_ICON)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
static const guint8 MOO_DETACH_ICON[] __attribute__ ((__aligned__ (4))) =
|
||||
#else
|
||||
static const guint8 MOO_DETACH_ICON[] =
|
||||
#endif
|
||||
{ ""
|
||||
/* Pixbuf magic (0x47646b50) */
|
||||
"GdkP"
|
||||
/* length: header (24) + pixel_data (75) */
|
||||
"\0\0\0c"
|
||||
/* pixdata_type (0x2010002) */
|
||||
"\2\1\0\2"
|
||||
/* rowstride (28) */
|
||||
"\0\0\0\34"
|
||||
/* width (7) */
|
||||
"\0\0\0\7"
|
||||
/* height (7) */
|
||||
"\0\0\0\7"
|
||||
/* pixel_data: */
|
||||
"\205\0\0\0\377\202\0\0\0\0\204\0\0\0\377\203\0\0\0\0\204\0\0\0\377\203"
|
||||
"\0\0\0\0\205\0\0\0\377\202\0\0\0\0\1\0\0\0\377\202\0\0\0\0\203\0\0\0"
|
||||
"\377\205\0\0\0\0\203\0\0\0\377\205\0\0\0\0\202\0\0\0\377"};
|
||||
|
||||
|
||||
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
#pragma align 4 (MOO_ATTACH_ICON)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
static const guint8 MOO_ATTACH_ICON[] __attribute__ ((__aligned__ (4))) =
|
||||
#else
|
||||
static const guint8 MOO_ATTACH_ICON[] =
|
||||
#endif
|
||||
{ ""
|
||||
/* Pixbuf magic (0x47646b50) */
|
||||
"GdkP"
|
||||
/* length: header (24) + pixel_data (75) */
|
||||
"\0\0\0c"
|
||||
/* pixdata_type (0x2010002) */
|
||||
"\2\1\0\2"
|
||||
/* rowstride (28) */
|
||||
"\0\0\0\34"
|
||||
/* width (7) */
|
||||
"\0\0\0\7"
|
||||
/* height (7) */
|
||||
"\0\0\0\7"
|
||||
/* pixel_data: */
|
||||
"\202\0\0\0\377\205\0\0\0\0\203\0\0\0\377\205\0\0\0\0\203\0\0\0\377\202"
|
||||
"\0\0\0\0\1\0\0\0\377\202\0\0\0\0\205\0\0\0\377\203\0\0\0\0\204\0\0\0"
|
||||
"\377\203\0\0\0\0\204\0\0\0\377\202\0\0\0\0\205\0\0\0\377"};
|
||||
|
||||
|
||||
/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
#pragma align 4 (MOO_KEEP_ON_TOP_ICON)
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
static const guint8 MOO_KEEP_ON_TOP_ICON[] __attribute__ ((__aligned__ (4))) =
|
||||
#else
|
||||
static const guint8 MOO_KEEP_ON_TOP_ICON[] =
|
||||
#endif
|
||||
{ ""
|
||||
/* Pixbuf magic (0x47646b50) */
|
||||
"GdkP"
|
||||
/* length: header (24) + pixel_data (105) */
|
||||
"\0\0\0\201"
|
||||
/* pixdata_type (0x2010002) */
|
||||
"\2\1\0\2"
|
||||
/* rowstride (28) */
|
||||
"\0\0\0\34"
|
||||
/* width (7) */
|
||||
"\0\0\0\7"
|
||||
/* height (7) */
|
||||
"\0\0\0\7"
|
||||
/* pixel_data: */
|
||||
"\203\0\0\0\0\1\0\0\0\377\205\0\0\0\0\203\0\0\0\377\203\0\0\0\0\202\0"
|
||||
"\0\0\377\1\0\0\0\0\202\0\0\0\377\1\0\0\0\0\202\0\0\0\377\203\0\0\0\0"
|
||||
"\202\0\0\0\377\1\0\0\0\0\202\0\0\0\377\1\0\0\0\0\202\0\0\0\377\203\0"
|
||||
"\0\0\0\203\0\0\0\377\205\0\0\0\0\1\0\0\0\377\203\0\0\0\0"};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user