Added MooBigPaned
This commit is contained in:
parent
bee6e2634e
commit
ac56bf2a91
18
moo.kdevelop
18
moo.kdevelop
@ -24,7 +24,7 @@
|
||||
</ignoreparts>
|
||||
<projectdirectory>.</projectdirectory>
|
||||
<absoluteprojectpath>false</absoluteprojectpath>
|
||||
<description/>
|
||||
<description></description>
|
||||
<secondaryLanguages>
|
||||
<language>C</language>
|
||||
</secondaryLanguages>
|
||||
@ -36,17 +36,17 @@
|
||||
<useconfiguration>debug</useconfiguration>
|
||||
</general>
|
||||
<run>
|
||||
<mainprogram>tests/testfileview</mainprogram>
|
||||
<mainprogram>tests/testpaned</mainprogram>
|
||||
<directoryradio>executable</directoryradio>
|
||||
<customdirectory>/</customdirectory>
|
||||
<programargs/>
|
||||
<programargs>--sync</programargs>
|
||||
<terminal>false</terminal>
|
||||
<autocompile>false</autocompile>
|
||||
<envvars/>
|
||||
</run>
|
||||
<configurations>
|
||||
<debug>
|
||||
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --disable-moo-module --without-python --without-mooapp --without-mooterm</configargs>
|
||||
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --disable-moo-module</configargs>
|
||||
<builddir>build/debug</builddir>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
@ -166,10 +166,10 @@
|
||||
<general>
|
||||
<dbgshell>libtool</dbgshell>
|
||||
<programargs>--g-fatal-warnings --sync</programargs>
|
||||
<gdbpath/>
|
||||
<configGdbScript/>
|
||||
<runShellScript/>
|
||||
<runGdbScript/>
|
||||
<gdbpath></gdbpath>
|
||||
<configGdbScript></configGdbScript>
|
||||
<runShellScript></runShellScript>
|
||||
<runGdbScript></runGdbScript>
|
||||
<breakonloadinglibs>true</breakonloadinglibs>
|
||||
<separatetty>false</separatetty>
|
||||
<floatingtoolbar>true</floatingtoolbar>
|
||||
@ -270,7 +270,7 @@
|
||||
</codecompletion>
|
||||
<references/>
|
||||
<creategettersetter>
|
||||
<prefixGet/>
|
||||
<prefixGet></prefixGet>
|
||||
<prefixSet>set</prefixSet>
|
||||
<prefixVariable>m_,_</prefixVariable>
|
||||
<parameterName>theValue</parameterName>
|
||||
|
@ -31,6 +31,8 @@ libmooedit_la_LIBADD = \
|
||||
$(xdgmime_lib)
|
||||
|
||||
libmooedit_la_SOURCES = \
|
||||
moobigpaned.c \
|
||||
moobigpaned.h \
|
||||
mooedit.c \
|
||||
mooedit.h \
|
||||
mooedit-private.h \
|
||||
@ -58,6 +60,8 @@ libmooedit_la_SOURCES = \
|
||||
mooeditsearch.c \
|
||||
mooeditsearch.h \
|
||||
mooeditwindow.c \
|
||||
moopaned.c \
|
||||
moopaned.h \
|
||||
mootextiter.h
|
||||
|
||||
if MOO_USE_XML
|
||||
|
342
moo/mooedit/moobigpaned.c
Normal file
342
moo/mooedit/moobigpaned.c
Normal file
@ -0,0 +1,342 @@
|
||||
/*
|
||||
* moobigpaned.c
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "mooedit/moobigpaned.h"
|
||||
#include "mooutils/moostock.h"
|
||||
#include "mooutils/moomarshals.h"
|
||||
|
||||
|
||||
static void moo_big_paned_finalize (GObject *object);
|
||||
static void moo_big_paned_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void moo_big_paned_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void child_open_pane (MooPaned *child,
|
||||
guint index,
|
||||
MooBigPaned *paned);
|
||||
static void child_hide_pane (MooPaned *child,
|
||||
MooBigPaned *paned);
|
||||
static gboolean check_children_order (MooBigPaned *paned);
|
||||
|
||||
|
||||
/* MOO_TYPE_BIG_PANED */
|
||||
G_DEFINE_TYPE (MooBigPaned, moo_big_paned, GTK_TYPE_FRAME)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PANE_ORDER
|
||||
};
|
||||
|
||||
enum {
|
||||
OPEN_PANE,
|
||||
HIDE_PANE,
|
||||
NUM_SIGNALS
|
||||
};
|
||||
|
||||
static guint signals[NUM_SIGNALS];
|
||||
|
||||
static void moo_big_paned_class_init (MooBigPanedClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = moo_big_paned_finalize;
|
||||
gobject_class->set_property = moo_big_paned_set_property;
|
||||
gobject_class->get_property = moo_big_paned_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PANE_ORDER,
|
||||
g_param_spec_pointer ("pane-order",
|
||||
"pane-order",
|
||||
"pane-order",
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
signals[OPEN_PANE] =
|
||||
g_signal_new ("open-pane",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MooBigPanedClass, open_pane),
|
||||
NULL, NULL,
|
||||
_moo_marshal_VOID__ENUM_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
MOO_TYPE_PANE_POSITION, G_TYPE_UINT);
|
||||
|
||||
signals[HIDE_PANE] =
|
||||
g_signal_new ("hide-pane",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MooBigPanedClass, hide_pane),
|
||||
NULL, NULL,
|
||||
_moo_marshal_VOID__ENUM,
|
||||
G_TYPE_NONE, 1,
|
||||
MOO_TYPE_PANE_POSITION);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#define NTH_CHILD(paned,n) paned->paned[paned->order[n]]
|
||||
|
||||
static void moo_big_paned_init (MooBigPaned *paned)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* XXX destroy */
|
||||
/* XXX order */
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
MooPaned *child;
|
||||
|
||||
paned->paned[i] = child = MOO_PANED (moo_paned_new (i));
|
||||
|
||||
g_object_ref (child);
|
||||
gtk_object_sink (GTK_OBJECT (child));
|
||||
gtk_widget_show (GTK_WIDGET (child));
|
||||
|
||||
g_signal_connect (child, "hide-pane",
|
||||
G_CALLBACK (child_hide_pane),
|
||||
paned);
|
||||
g_signal_connect (child, "open-pane",
|
||||
G_CALLBACK (child_open_pane),
|
||||
paned);
|
||||
}
|
||||
|
||||
paned->order[0] = MOO_PANE_POS_LEFT;
|
||||
paned->order[1] = MOO_PANE_POS_RIGHT;
|
||||
paned->order[2] = MOO_PANE_POS_TOP;
|
||||
paned->order[3] = MOO_PANE_POS_BOTTOM;
|
||||
|
||||
paned->inner = NTH_CHILD (paned, 3);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (paned),
|
||||
GTK_WIDGET (NTH_CHILD (paned, 0)));
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
gtk_container_add (GTK_CONTAINER (NTH_CHILD (paned, i)),
|
||||
GTK_WIDGET (NTH_CHILD (paned, i+1)));
|
||||
|
||||
g_assert (check_children_order (paned));
|
||||
}
|
||||
|
||||
|
||||
static gboolean check_children_order (MooBigPaned *paned)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (GTK_BIN(paned)->child != GTK_WIDGET (NTH_CHILD (paned, 0)))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
if (GTK_BIN (NTH_CHILD (paned, i))->child !=
|
||||
GTK_WIDGET (NTH_CHILD (paned, i+1)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void moo_big_paned_set_pane_order (MooBigPaned *paned,
|
||||
int *order)
|
||||
{
|
||||
MooPanePosition new_order[4] = {8, 8, 8, 8};
|
||||
int i;
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_if_fail (MOO_IS_BIG_PANED (paned));
|
||||
g_return_if_fail (order != NULL);
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
g_return_if_fail (new_order[i] >= 4);
|
||||
g_return_if_fail (0 <= order[i] && order[i] < 4);
|
||||
new_order[i] = order[i];
|
||||
}
|
||||
|
||||
g_return_if_fail (check_children_order (paned));
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
if (new_order[i] != paned->order[i])
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 4)
|
||||
return;
|
||||
|
||||
child = moo_big_paned_get_child (paned);
|
||||
|
||||
if (child)
|
||||
g_object_ref (child);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (paned), GTK_WIDGET (NTH_CHILD (paned, 0)));
|
||||
for (i = 0; i < 3; ++i)
|
||||
gtk_container_remove (GTK_CONTAINER (NTH_CHILD (paned, i)),
|
||||
GTK_WIDGET (NTH_CHILD (paned, i+1)));
|
||||
if (child)
|
||||
gtk_container_remove (GTK_CONTAINER (NTH_CHILD (paned, 3)), child);
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
paned->order[i] = new_order[i];
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (paned), GTK_WIDGET (NTH_CHILD (paned, 0)));
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
gtk_container_add (GTK_CONTAINER (NTH_CHILD (paned, i)), GTK_WIDGET (NTH_CHILD (paned, i+1)));
|
||||
|
||||
paned->inner = NTH_CHILD (paned, 3);
|
||||
|
||||
if (child)
|
||||
{
|
||||
gtk_container_add (GTK_CONTAINER (paned->inner), child);
|
||||
g_object_unref (child);
|
||||
}
|
||||
|
||||
g_assert (check_children_order (paned));
|
||||
g_object_notify (G_OBJECT (paned), "pane-order");
|
||||
}
|
||||
|
||||
|
||||
static void moo_big_paned_finalize (GObject *object)
|
||||
{
|
||||
MooBigPaned *paned = MOO_BIG_PANED (object);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
g_object_unref (paned->paned[i]);
|
||||
|
||||
G_OBJECT_CLASS (moo_big_paned_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
GtkWidget *moo_big_paned_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (MOO_TYPE_BIG_PANED, NULL));
|
||||
}
|
||||
|
||||
|
||||
static void child_open_pane (MooPaned *child,
|
||||
guint index,
|
||||
MooBigPaned *paned)
|
||||
{
|
||||
MooPanePosition pos;
|
||||
|
||||
g_object_get (child, "pane-position", &pos, NULL);
|
||||
g_return_if_fail (paned->paned[pos] == child);
|
||||
|
||||
g_signal_emit (paned, signals[OPEN_PANE], 0, pos, index);
|
||||
}
|
||||
|
||||
|
||||
static void child_hide_pane (MooPaned *child,
|
||||
MooBigPaned *paned)
|
||||
{
|
||||
MooPanePosition pos;
|
||||
|
||||
g_object_get (child, "pane-position", &pos, NULL);
|
||||
g_return_if_fail (paned->paned[pos] == child);
|
||||
|
||||
g_signal_emit (paned, signals[HIDE_PANE], 0, pos);
|
||||
}
|
||||
|
||||
|
||||
void moo_big_paned_add_pane (MooBigPaned *paned,
|
||||
GtkWidget *pane_widget,
|
||||
MooPanePosition position,
|
||||
const char *button_label,
|
||||
const char *button_stock_id)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_BIG_PANED (paned));
|
||||
g_return_if_fail (GTK_IS_WIDGET (pane_widget));
|
||||
g_return_if_fail (position < 4);
|
||||
|
||||
moo_paned_add_pane (paned->paned[position], pane_widget,
|
||||
button_label, button_stock_id);
|
||||
}
|
||||
|
||||
|
||||
void moo_big_paned_insert_pane (MooBigPaned *paned,
|
||||
GtkWidget *pane_widget,
|
||||
GtkWidget *button_widget,
|
||||
MooPanePosition position,
|
||||
int index_)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_BIG_PANED (paned));
|
||||
g_return_if_fail (GTK_IS_WIDGET (pane_widget));
|
||||
g_return_if_fail (position < 4);
|
||||
|
||||
moo_paned_insert_pane (paned->paned[position], pane_widget,
|
||||
button_widget, index_);
|
||||
}
|
||||
|
||||
|
||||
void moo_big_paned_add_child (MooBigPaned *paned,
|
||||
GtkWidget *child)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_BIG_PANED (paned));
|
||||
gtk_container_add (GTK_CONTAINER (paned->inner), child);
|
||||
}
|
||||
|
||||
|
||||
void moo_big_paned_remove_child (MooBigPaned *paned)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_BIG_PANED (paned));
|
||||
gtk_container_remove (GTK_CONTAINER (paned->inner), GTK_BIN(paned->inner)->child);
|
||||
}
|
||||
|
||||
|
||||
GtkWidget *moo_big_paned_get_child (MooBigPaned *paned)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_BIG_PANED (paned), NULL);
|
||||
return GTK_BIN(paned->inner)->child;
|
||||
}
|
||||
|
||||
|
||||
static void moo_big_paned_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MooBigPaned *paned = MOO_BIG_PANED (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PANE_ORDER:
|
||||
moo_big_paned_set_pane_order (paned, g_value_get_pointer (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void moo_big_paned_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MooBigPaned *paned = MOO_BIG_PANED (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PANE_ORDER:
|
||||
g_value_set_pointer (value, paned->order);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
80
moo/mooedit/moobigpaned.h
Normal file
80
moo/mooedit/moobigpaned.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* moobigpaned.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_BIG_PANED_H__
|
||||
#define __MOO_BIG_PANED_H__
|
||||
|
||||
#include "moopaned.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_BIG_PANED (moo_big_paned_get_type ())
|
||||
#define MOO_BIG_PANED(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_BIG_PANED, MooBigPaned))
|
||||
#define MOO_BIG_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_BIG_PANED, MooBigPanedClass))
|
||||
#define MOO_IS_BIG_PANED(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_BIG_PANED))
|
||||
#define MOO_IS_BIG_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_BIG_PANED))
|
||||
#define MOO_BIG_PANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_BIG_PANED, MooBigPanedClass))
|
||||
|
||||
|
||||
typedef struct _MooBigPaned MooBigPaned;
|
||||
typedef struct _MooBigPanedPrivate MooBigPanedPrivate;
|
||||
typedef struct _MooBigPanedClass MooBigPanedClass;
|
||||
|
||||
struct _MooBigPaned
|
||||
{
|
||||
GtkFrame parent;
|
||||
MooPaned *paned[4];
|
||||
MooPanePosition order[4]; /* inner is paned[order[3]]*/
|
||||
MooPaned *inner;
|
||||
};
|
||||
|
||||
struct _MooBigPanedClass
|
||||
{
|
||||
GtkFrameClass parent_class;
|
||||
|
||||
void (*open_pane) (MooBigPaned *paned,
|
||||
MooPanePosition position,
|
||||
guint index);
|
||||
void (*hide_pane) (MooBigPaned *paned,
|
||||
MooPanePosition position);
|
||||
};
|
||||
|
||||
|
||||
GType moo_big_paned_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget *moo_big_paned_new (void);
|
||||
|
||||
void moo_big_paned_set_pane_order (MooBigPaned *paned,
|
||||
int *order);
|
||||
|
||||
void moo_big_paned_add_child (MooBigPaned *paned,
|
||||
GtkWidget *widget);
|
||||
void moo_big_paned_remove_child (MooBigPaned *paned);
|
||||
GtkWidget *moo_big_paned_get_child (MooBigPaned *paned);
|
||||
|
||||
void moo_big_paned_add_pane (MooBigPaned *paned,
|
||||
GtkWidget *pane_widget,
|
||||
MooPanePosition position,
|
||||
const char *button_label,
|
||||
const char *button_stock_id);
|
||||
void moo_big_paned_insert_pane (MooBigPaned *paned,
|
||||
GtkWidget *pane_widget,
|
||||
GtkWidget *button_widget,
|
||||
MooPanePosition position,
|
||||
int index_);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __MOO_BIG_PANED_H__ */
|
@ -14,6 +14,7 @@
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooeditdialogs.h"
|
||||
#include "mooedit/moobigpaned.h"
|
||||
#include "moofileview/moofileview.h"
|
||||
#include "mooui/moouiobject-impl.h"
|
||||
#include "mooui/moomenuaction.h"
|
||||
@ -22,7 +23,6 @@
|
||||
#include "mooutils/moostock.h"
|
||||
#include "mooutils/moomarshals.h"
|
||||
#include "mooutils/moosignal.h"
|
||||
#include "mooutils/moopaned.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
|
||||
struct _MooEditWindowPrivate {
|
||||
MooPaned *paned;
|
||||
MooBigPaned *paned;
|
||||
GtkNotebook *notebook;
|
||||
MooFileView *fileview;
|
||||
gboolean use_fullname;
|
||||
@ -107,10 +107,12 @@ static void moo_edit_window_previous_tab (MooEditWindow *window);
|
||||
static void moo_edit_window_next_tab (MooEditWindow *window);
|
||||
static void show_file_selector_toggled_cb (MooEditWindow *window,
|
||||
gboolean show);
|
||||
static void pane_opened (MooPaned *paned,
|
||||
static void pane_opened (MooBigPaned *paned,
|
||||
MooPanePosition position,
|
||||
guint index,
|
||||
MooEditWindow *window);
|
||||
static void pane_hidden (MooPaned *paned,
|
||||
static void pane_hidden (MooBigPaned *paned,
|
||||
MooPanePosition position,
|
||||
MooEditWindow *window);
|
||||
|
||||
|
||||
@ -469,10 +471,10 @@ GObject *moo_edit_window_constructor (GType type,
|
||||
|
||||
gtk_widget_show (MOO_WINDOW(window)->vbox);
|
||||
|
||||
paned = moo_paned_new (GTK_POS_RIGHT);
|
||||
paned = moo_big_paned_new ();
|
||||
gtk_widget_show (paned);
|
||||
gtk_box_pack_start (GTK_BOX (MOO_WINDOW(window)->vbox), paned, TRUE, TRUE, 0);
|
||||
window->priv->paned = MOO_PANED (paned);
|
||||
window->priv->paned = MOO_BIG_PANED (paned);
|
||||
g_signal_connect (window->priv->paned, "open-pane",
|
||||
G_CALLBACK (pane_opened), window);
|
||||
g_signal_connect (window->priv->paned, "hide-pane",
|
||||
@ -482,7 +484,7 @@ GObject *moo_edit_window_constructor (GType type,
|
||||
mgr = moo_editor_get_file_mgr (window->priv->editor);
|
||||
|
||||
fileview = GTK_WIDGET (g_object_new (MOO_TYPE_FILE_VIEW,
|
||||
"file-mgr", mgr,
|
||||
// "file-mgr", mgr,
|
||||
NULL));
|
||||
g_signal_connect_swapped (fileview, "activate",
|
||||
G_CALLBACK (fileview_activate),
|
||||
@ -506,14 +508,14 @@ GObject *moo_edit_window_constructor (GType type,
|
||||
G_CALLBACK (current_doc_dir_clicked),
|
||||
window);
|
||||
|
||||
moo_paned_add_pane (MOO_PANED (paned),
|
||||
fileview, "File Selector",
|
||||
GTK_STOCK_OPEN);
|
||||
moo_big_paned_add_pane (MOO_BIG_PANED (paned),
|
||||
fileview, MOO_PANE_POS_LEFT,
|
||||
"File Selector", GTK_STOCK_OPEN);
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
|
||||
gtk_widget_show (notebook);
|
||||
gtk_container_add (GTK_CONTAINER (paned), notebook);
|
||||
moo_big_paned_add_child (window->priv->paned, notebook);
|
||||
|
||||
window->priv->notebook = GTK_NOTEBOOK (notebook);
|
||||
g_signal_connect_after (window->priv->notebook, "switch-page",
|
||||
@ -566,8 +568,8 @@ 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);
|
||||
@ -1243,7 +1245,7 @@ static void current_doc_dir_clicked (MooEditWindow *window)
|
||||
static void show_file_selector_toggled_cb (MooEditWindow *window,
|
||||
gboolean show)
|
||||
{
|
||||
gboolean open = moo_paned_is_open (window->priv->paned);
|
||||
/* gboolean open = moo_paned_is_open (window->priv->paned);
|
||||
|
||||
if (BOOL_EQUAL (show, open))
|
||||
return;
|
||||
@ -1259,11 +1261,12 @@ static void show_file_selector_toggled_cb (MooEditWindow *window,
|
||||
MooEdit *edit = ACTIVE_DOC (window);
|
||||
moo_paned_hide_pane (window->priv->paned);
|
||||
if (edit) gtk_widget_grab_focus (GTK_WIDGET (edit));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
static void pane_opened (G_GNUC_UNUSED MooPaned *paned,
|
||||
static void pane_opened (G_GNUC_UNUSED MooBigPaned *paned,
|
||||
G_GNUC_UNUSED MooPanePosition position,
|
||||
G_GNUC_UNUSED guint index,
|
||||
MooEditWindow *window)
|
||||
{
|
||||
@ -1278,7 +1281,8 @@ static void pane_opened (G_GNUC_UNUSED MooPaned *paned,
|
||||
}
|
||||
|
||||
|
||||
static void pane_hidden (G_GNUC_UNUSED MooPaned *paned,
|
||||
static void pane_hidden (G_GNUC_UNUSED MooBigPaned *paned,
|
||||
G_GNUC_UNUSED MooPanePosition position,
|
||||
MooEditWindow *window)
|
||||
{
|
||||
MooActionGroup *actions;
|
||||
|
@ -1565,6 +1565,8 @@ static gchar *g_utf8_collate_key_for_filename (const gchar *str,
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
/* XXX check out IconTheme changes */
|
||||
|
||||
typedef enum {
|
||||
MOO_ICON_LINK = 1 << 0,
|
||||
MOO_ICON_LOCK = 1 << 1,
|
||||
|
@ -662,6 +662,9 @@ static void moo_file_view_set_current_dir (MooFileView *fileview,
|
||||
if (gtk_tree_model_get_iter_first (fileview->priv->filter_model, &filter_iter))
|
||||
file_view_move_selection (fileview, &filter_iter);
|
||||
|
||||
if (gtk_widget_is_focus (GTK_WIDGET (fileview->priv->entry)))
|
||||
focus_to_file_view (fileview);
|
||||
|
||||
path = g_filename_display_name (moo_folder_get_path (folder));
|
||||
path_entry_set_text (fileview, path);
|
||||
g_free (path);
|
||||
|
@ -11,7 +11,7 @@
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#include "mooutils/moopaned.h"
|
||||
#include "mooedit/moopaned.h"
|
||||
#include "mooutils/moostock.h"
|
||||
#include "mooutils/moomarshals.h"
|
||||
|
||||
@ -30,7 +30,7 @@ typedef struct {
|
||||
|
||||
|
||||
struct _MooPanedPrivate {
|
||||
GtkPositionType pane_position;
|
||||
MooPanePosition pane_position;
|
||||
|
||||
GdkWindow *handle_window;
|
||||
GdkWindow *pane_window;
|
||||
@ -105,6 +105,8 @@ static void moo_paned_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
static void moo_paned_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void moo_paned_remove (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void moo_paned_remove_pane (MooPaned *paned,
|
||||
@ -167,6 +169,7 @@ static void moo_paned_class_init (MooPanedClass *klass)
|
||||
container_class->forall = moo_paned_forall;
|
||||
container_class->set_focus_child = moo_paned_set_focus_child;
|
||||
container_class->remove = moo_paned_remove;
|
||||
container_class->add = moo_paned_add;
|
||||
|
||||
klass->open_pane = moo_paned_open_pane_real;
|
||||
klass->hide_pane = moo_paned_hide_pane_real;
|
||||
@ -176,8 +179,8 @@ static void moo_paned_class_init (MooPanedClass *klass)
|
||||
g_param_spec_enum ("pane-position",
|
||||
"pane-position",
|
||||
"pane-position",
|
||||
GTK_TYPE_POSITION_TYPE,
|
||||
GTK_POS_LEFT,
|
||||
MOO_TYPE_PANE_POSITION,
|
||||
MOO_PANE_POS_LEFT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
@ -258,6 +261,8 @@ static void moo_paned_init (MooPaned *paned)
|
||||
paned->priv->handle_prelit = FALSE;
|
||||
paned->priv->in_drag = FALSE;
|
||||
paned->priv->drag_start = -1;
|
||||
|
||||
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (paned), FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -278,19 +283,19 @@ static GObject *moo_paned_constructor (GType type,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
paned->button_box = gtk_vbox_new (FALSE, button_spacing);
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
paned->button_box = gtk_hbox_new (FALSE, button_spacing);
|
||||
break;
|
||||
default:
|
||||
g_warning ("%s: invalid 'pane-position' property value '%d',"
|
||||
"falling back to GTK_POS_LEFT", G_STRLOC,
|
||||
"falling back to MOO_PANE_POS_LEFT", G_STRLOC,
|
||||
paned->priv->pane_position);
|
||||
paned->priv->pane_position = GTK_POS_LEFT;
|
||||
paned->priv->pane_position = MOO_PANE_POS_LEFT;
|
||||
paned->button_box = gtk_vbox_new (FALSE, button_spacing);
|
||||
break;
|
||||
}
|
||||
@ -373,7 +378,7 @@ static void moo_paned_finalize (GObject *object)
|
||||
}
|
||||
|
||||
|
||||
GtkWidget *moo_paned_new (GtkPositionType pane_position)
|
||||
GtkWidget *moo_paned_new (MooPanePosition pane_position)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (MOO_TYPE_PANED,
|
||||
"pane-position", pane_position,
|
||||
@ -424,14 +429,14 @@ static void realize_handle (MooPaned *paned)
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
attributes.y = 0;
|
||||
attributes.width = paned->priv->handle_size;
|
||||
attributes.height = widget->allocation.height;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
attributes.x = 0;
|
||||
attributes.width = widget->allocation.width;
|
||||
attributes.height = paned->priv->handle_size;
|
||||
@ -440,16 +445,16 @@ static void realize_handle (MooPaned *paned)
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
attributes.x = paned->priv->pane_widget_size;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
attributes.x = 0;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case MOO_PANE_POS_TOP:
|
||||
attributes.y = paned->priv->pane_widget_size;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
attributes.y = 0;
|
||||
break;
|
||||
}
|
||||
@ -470,12 +475,12 @@ static void realize_handle (MooPaned *paned)
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
attributes.cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
attributes.cursor = gdk_cursor_new (GDK_SB_V_DOUBLE_ARROW);
|
||||
break;
|
||||
}
|
||||
@ -503,13 +508,13 @@ static void realize_pane (MooPaned *paned)
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
attributes.y = 0;
|
||||
attributes.height = widget->allocation.height;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
attributes.x = 0;
|
||||
attributes.width = widget->allocation.width;
|
||||
break;
|
||||
@ -517,24 +522,24 @@ static void realize_pane (MooPaned *paned)
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
attributes.x = paned->priv->button_box_size;
|
||||
attributes.width = paned->priv->pane_widget_size +
|
||||
paned->priv->handle_size;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
attributes.width = paned->priv->pane_widget_size +
|
||||
paned->priv->handle_size;
|
||||
attributes.x = widget->allocation.width -
|
||||
paned->priv->button_box_size -
|
||||
attributes.width;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case MOO_PANE_POS_TOP:
|
||||
attributes.y = paned->priv->button_box_size;
|
||||
attributes.height = paned->priv->pane_widget_size +
|
||||
paned->priv->handle_size;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
attributes.height = paned->priv->pane_widget_size +
|
||||
paned->priv->handle_size;
|
||||
attributes.y = widget->allocation.height -
|
||||
@ -600,14 +605,14 @@ static void add_button_box_requisition (MooPaned *paned,
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
requisition->width += child_requisition->width;
|
||||
requisition->height = MAX (child_requisition->height, requisition->height);
|
||||
paned->priv->button_box_size = child_requisition->width;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
requisition->height += child_requisition->height;
|
||||
requisition->width = MAX (child_requisition->width, requisition->width);
|
||||
paned->priv->button_box_size = child_requisition->height;
|
||||
@ -625,12 +630,12 @@ static void add_handle_requisition (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
requisition->width += paned->priv->handle_size;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
requisition->height += paned->priv->handle_size;
|
||||
break;
|
||||
}
|
||||
@ -643,8 +648,8 @@ static void add_pane_widget_requisition (MooPaned *paned,
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
requisition->height = MAX (child_requisition->height, requisition->height);
|
||||
|
||||
if (paned->priv->sticky)
|
||||
@ -660,8 +665,8 @@ static void add_pane_widget_requisition (MooPaned *paned,
|
||||
|
||||
break;
|
||||
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
requisition->width = MAX (child_requisition->width, requisition->width);
|
||||
|
||||
if (paned->priv->sticky)
|
||||
@ -680,14 +685,14 @@ static void add_pane_widget_requisition (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
paned->priv->pane_widget_size = MAX (paned->priv->position,
|
||||
child_requisition->width);
|
||||
paned->priv->position = paned->priv->pane_widget_size;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
paned->priv->pane_widget_size = MAX (paned->priv->position,
|
||||
child_requisition->height);
|
||||
paned->priv->position = paned->priv->pane_widget_size;
|
||||
@ -745,25 +750,25 @@ static void get_pane_widget_allocation (MooPaned *paned,
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
allocation->x = 0;
|
||||
allocation->y = 0;
|
||||
allocation->width = paned->priv->pane_widget_size;
|
||||
allocation->height = GTK_WIDGET(paned)->allocation.height;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
allocation->x = paned->priv->handle_size;
|
||||
allocation->y = 0;
|
||||
allocation->width = paned->priv->pane_widget_size;
|
||||
allocation->height = GTK_WIDGET(paned)->allocation.height;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case MOO_PANE_POS_TOP:
|
||||
allocation->x = 0;
|
||||
allocation->y = 0;
|
||||
allocation->width = GTK_WIDGET(paned)->allocation.width;
|
||||
allocation->height = paned->priv->pane_widget_size;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
allocation->x = 0;
|
||||
allocation->y = paned->priv->handle_size;
|
||||
allocation->width = GTK_WIDGET(paned)->allocation.width;
|
||||
@ -778,14 +783,14 @@ static void get_button_box_allocation (MooPaned *paned,
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
allocation->y = 0;
|
||||
allocation->height = GTK_WIDGET(paned)->allocation.height;
|
||||
allocation->width = paned->priv->button_box_size;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
allocation->x = 0;
|
||||
allocation->width = GTK_WIDGET(paned)->allocation.width;
|
||||
allocation->height = paned->priv->button_box_size;
|
||||
@ -794,17 +799,17 @@ static void get_button_box_allocation (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
allocation->x = 0;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
allocation->x = GTK_WIDGET(paned)->allocation.width -
|
||||
allocation->width;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case MOO_PANE_POS_TOP:
|
||||
allocation->y = 0;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
allocation->y = GTK_WIDGET(paned)->allocation.height -
|
||||
allocation->height;
|
||||
break;
|
||||
@ -817,59 +822,57 @@ static void get_bin_child_allocation (MooPaned *paned,
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
allocation->y = 0;
|
||||
allocation->height = GTK_WIDGET(paned)->allocation.height;
|
||||
allocation->width = GTK_WIDGET(paned)->allocation.width -
|
||||
paned->priv->button_box_size -
|
||||
paned->priv->handle_size;
|
||||
paned->priv->button_box_size;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
allocation->x = 0;
|
||||
allocation->width = GTK_WIDGET(paned)->allocation.width;
|
||||
allocation->height = GTK_WIDGET(paned)->allocation.height -
|
||||
paned->priv->button_box_size -
|
||||
paned->priv->handle_size;
|
||||
paned->priv->button_box_size;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
allocation->x = paned->priv->button_box_size +
|
||||
paned->priv->handle_size;
|
||||
case MOO_PANE_POS_LEFT:
|
||||
allocation->x = paned->priv->button_box_size;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
allocation->x = 0;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
allocation->y = paned->priv->button_box_size +
|
||||
paned->priv->handle_size;
|
||||
case MOO_PANE_POS_TOP:
|
||||
allocation->y = paned->priv->button_box_size;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
allocation->y = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (paned->priv->sticky)
|
||||
{
|
||||
int add = paned->priv->handle_size + paned->priv->pane_widget_size;
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
allocation->x += paned->priv->pane_widget_size;
|
||||
allocation->width -= paned->priv->pane_widget_size;
|
||||
case MOO_PANE_POS_LEFT:
|
||||
allocation->x += add;
|
||||
allocation->width -= add;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
allocation->width -= paned->priv->pane_widget_size;
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
allocation->width -= add;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
allocation->y += paned->priv->pane_widget_size;
|
||||
allocation->height -= paned->priv->pane_widget_size;
|
||||
case MOO_PANE_POS_TOP:
|
||||
allocation->y += add;
|
||||
allocation->height -= add;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
allocation->height -= paned->priv->pane_widget_size;
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
allocation->height -= add;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -880,13 +883,13 @@ static void clamp_handle_size (MooPaned *paned)
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
paned->priv->handle_size = CLAMP (paned->priv->handle_size, 0,
|
||||
GTK_WIDGET(paned)->allocation.width);
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
paned->priv->handle_size = CLAMP (paned->priv->handle_size, 0,
|
||||
GTK_WIDGET(paned)->allocation.height);
|
||||
break;
|
||||
@ -898,14 +901,14 @@ static void clamp_button_box_size (MooPaned *paned)
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
paned->priv->button_box_size = CLAMP (paned->priv->button_box_size, 0,
|
||||
GTK_WIDGET(paned)->allocation.width -
|
||||
paned->priv->handle_size);
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
paned->priv->button_box_size = CLAMP (paned->priv->button_box_size, 0,
|
||||
GTK_WIDGET(paned)->allocation.height -
|
||||
paned->priv->handle_size);
|
||||
@ -919,15 +922,15 @@ static void clamp_child_requisition (MooPaned *paned,
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
requisition->width = CLAMP (requisition->width, 0,
|
||||
GTK_WIDGET(paned)->allocation.width -
|
||||
paned->priv->handle_size -
|
||||
paned->priv->button_box_size);
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
requisition->height = CLAMP (requisition->height, 0,
|
||||
GTK_WIDGET(paned)->allocation.height -
|
||||
paned->priv->handle_size -
|
||||
@ -945,16 +948,16 @@ static void clamp_pane_widget_size (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
max_size = GTK_WIDGET(paned)->allocation.width -
|
||||
paned->priv->handle_size -
|
||||
paned->priv->button_box_size;
|
||||
if (paned->priv->sticky)
|
||||
max_size -= child_requisition->width;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
max_size = GTK_WIDGET(paned)->allocation.height -
|
||||
paned->priv->handle_size -
|
||||
paned->priv->button_box_size;
|
||||
@ -975,14 +978,14 @@ static void get_pane_window_rect (MooPaned *paned,
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
rect->width = paned->priv->pane_widget_size + paned->priv->handle_size;
|
||||
rect->height = GTK_WIDGET(paned)->allocation.height;
|
||||
rect->y = 0;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
rect->height = paned->priv->pane_widget_size + paned->priv->handle_size;
|
||||
rect->width = GTK_WIDGET(paned)->allocation.width;
|
||||
rect->x = 0;
|
||||
@ -991,18 +994,18 @@ static void get_pane_window_rect (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
rect->x = paned->priv->button_box_size;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
rect->x = GTK_WIDGET(paned)->allocation.width -
|
||||
rect->width -
|
||||
paned->priv->button_box_size;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case MOO_PANE_POS_TOP:
|
||||
rect->y = paned->priv->button_box_size;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
rect->y = GTK_WIDGET(paned)->allocation.height -
|
||||
rect->height -
|
||||
paned->priv->button_box_size;
|
||||
@ -1016,14 +1019,14 @@ static void get_handle_window_rect (MooPaned *paned,
|
||||
{
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
rect->y = 0;
|
||||
rect->width = paned->priv->handle_size;
|
||||
rect->height = GTK_WIDGET(paned)->allocation.height;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
rect->x = 0;
|
||||
rect->height = paned->priv->handle_size;
|
||||
rect->width = GTK_WIDGET(paned)->allocation.width;
|
||||
@ -1032,16 +1035,16 @@ static void get_handle_window_rect (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
rect->x = paned->priv->pane_widget_size;
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
rect->x = 0;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case MOO_PANE_POS_TOP:
|
||||
rect->y = paned->priv->pane_widget_size;
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
rect->y = 0;
|
||||
break;
|
||||
}
|
||||
@ -1060,6 +1063,13 @@ static void moo_paned_size_allocate (GtkWidget *widget,
|
||||
bin = GTK_BIN (widget);
|
||||
paned = MOO_PANED (widget);
|
||||
|
||||
if (!paned->priv->handle_visible)
|
||||
paned->priv->handle_size = 0;
|
||||
if (!paned->priv->button_box_visible)
|
||||
paned->priv->button_box_size = 0;
|
||||
if (!paned->priv->pane_widget_visible)
|
||||
paned->priv->pane_widget_size = 0;
|
||||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
gtk_widget_get_child_requisition (bin->child, &child_requisition);
|
||||
|
||||
@ -1087,11 +1097,11 @@ static void moo_paned_size_allocate (GtkWidget *widget,
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
|
||||
if (paned->priv->pane_window)
|
||||
/* XXX */
|
||||
if (paned->priv->pane_widget_visible)
|
||||
{
|
||||
get_pane_window_rect (paned, &rect);
|
||||
gdk_window_show (paned->priv->pane_window);
|
||||
gdk_window_raise (paned->priv->pane_window);
|
||||
gdk_window_move_resize (paned->priv->pane_window,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
@ -1139,7 +1149,6 @@ static void moo_paned_map (GtkWidget *widget)
|
||||
{
|
||||
gdk_window_show (paned->priv->pane_window);
|
||||
gdk_window_show (paned->priv->handle_window);
|
||||
gdk_window_raise (paned->priv->pane_window);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1176,8 +1185,11 @@ static gboolean moo_paned_expose (GtkWidget *widget,
|
||||
paned->button_box, event);
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (GTK_BIN(paned)->child))
|
||||
{
|
||||
gtk_container_propagate_expose (GTK_CONTAINER (paned),
|
||||
GTK_BIN(paned)->child, event);
|
||||
GTK_BIN(paned)->child,
|
||||
event);
|
||||
}
|
||||
|
||||
if (paned->priv->pane_widget_visible)
|
||||
gtk_container_propagate_expose (GTK_CONTAINER (paned),
|
||||
@ -1191,6 +1203,94 @@ static gboolean moo_paned_expose (GtkWidget *widget,
|
||||
}
|
||||
|
||||
|
||||
static GdkEventExpose *clip_bin_child_event (MooPaned *paned,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkAllocation child_alloc;
|
||||
GdkRegion *child_rect;
|
||||
GdkEventExpose *child_event;
|
||||
|
||||
get_bin_child_allocation (paned, &child_alloc);
|
||||
child_rect = gdk_region_rectangle ((GdkRectangle*) &child_alloc);
|
||||
|
||||
child_event = (GdkEventExpose*) gdk_event_copy ((GdkEvent*) event);
|
||||
gdk_region_intersect (child_event->region, child_rect);
|
||||
gdk_region_get_clipbox (child_event->region, &child_event->area);
|
||||
|
||||
gdk_region_destroy (child_rect);
|
||||
return child_event;
|
||||
}
|
||||
|
||||
|
||||
static gboolean child_expose (GtkWidget *child,
|
||||
GdkEventExpose *event,
|
||||
MooPaned *paned)
|
||||
{
|
||||
GdkEvent *child_event;
|
||||
|
||||
g_return_val_if_fail (GTK_BIN(paned)->child == child, FALSE);
|
||||
|
||||
/* this is bullshit. widgets with window get expose directly from gdk */
|
||||
/* XXX */
|
||||
return FALSE;
|
||||
|
||||
child_event = (GdkEvent*) clip_bin_child_event (paned, event);
|
||||
|
||||
g_signal_handlers_block_by_func (child, (gpointer) child_expose, paned);
|
||||
gtk_widget_event (child, child_event);
|
||||
g_signal_handlers_unblock_by_func (child, (gpointer) child_expose, paned);
|
||||
|
||||
gdk_event_free (child_event);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void moo_paned_add (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkBin *bin = GTK_BIN (container);
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
if (bin->child != NULL)
|
||||
{
|
||||
g_warning ("Attempting to add a widget with type %s to a %s, "
|
||||
"but as a GtkBin subclass a %s can only contain one widget at a time; "
|
||||
"it already contains a widget of type %s",
|
||||
g_type_name (G_OBJECT_TYPE (child)),
|
||||
g_type_name (G_OBJECT_TYPE (bin)),
|
||||
g_type_name (G_OBJECT_TYPE (bin)),
|
||||
g_type_name (G_OBJECT_TYPE (bin->child)));
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (bin));
|
||||
bin->child = child;
|
||||
|
||||
g_signal_connect (child, "expose-event",
|
||||
G_CALLBACK (child_expose), bin);
|
||||
}
|
||||
|
||||
|
||||
static void moo_paned_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
MooPaned *paned = MOO_PANED (container);
|
||||
|
||||
if (widget == GTK_BIN(paned)->child)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (widget,
|
||||
(gpointer) child_expose,
|
||||
container);
|
||||
GTK_CONTAINER_CLASS(moo_paned_parent_class)->remove (container, widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
moo_paned_remove_pane (paned, widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void draw_handle (MooPaned *paned)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (paned);
|
||||
@ -1206,16 +1306,16 @@ static void draw_handle (MooPaned *paned)
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
area.width = paned->priv->handle_size;
|
||||
area.height = widget->allocation.height;
|
||||
if (area.width <= 2)
|
||||
shadow_size = 0;
|
||||
orientation = GTK_ORIENTATION_VERTICAL;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
area.width = widget->allocation.width;
|
||||
area.height = paned->priv->handle_size;
|
||||
if (area.height <= 2)
|
||||
@ -1342,31 +1442,26 @@ static gboolean moo_paned_motion (GtkWidget *widget,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
gtk_widget_get_pointer (widget, &size, NULL);
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
gdk_window_get_pointer (widget->window, &size, NULL, NULL);
|
||||
|
||||
if (paned->priv->pane_position == MOO_PANE_POS_RIGHT)
|
||||
size = widget->allocation.width - size;
|
||||
|
||||
size -= (paned->priv->drag_start + paned->priv->button_box_size);
|
||||
size = CLAMP (size, requisition.width,
|
||||
widget->allocation.width - paned->priv->button_box_size -
|
||||
paned->priv->handle_size);
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
gtk_widget_get_pointer (widget, &size, NULL);
|
||||
size = widget->allocation.width - size;
|
||||
size -= (paned->priv->drag_start + paned->priv->button_box_size);
|
||||
size = CLAMP (size, requisition.width,
|
||||
widget->allocation.width - paned->priv->button_box_size -
|
||||
paned->priv->handle_size);
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
gtk_widget_get_pointer (widget, NULL, &size);
|
||||
size -= (paned->priv->drag_start + paned->priv->button_box_size);
|
||||
size = CLAMP (size, requisition.height,
|
||||
widget->allocation.height - paned->priv->button_box_size -
|
||||
paned->priv->handle_size);
|
||||
break;
|
||||
case GTK_POS_BOTTOM:
|
||||
gtk_widget_get_pointer (widget, NULL, &size);
|
||||
size = widget->allocation.height - size;
|
||||
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
gdk_window_get_pointer (widget->window, NULL, &size, NULL);
|
||||
|
||||
if (paned->priv->pane_position == MOO_PANE_POS_BOTTOM)
|
||||
size = widget->allocation.height - size;
|
||||
|
||||
size -= (paned->priv->drag_start + paned->priv->button_box_size);
|
||||
size = CLAMP (size, requisition.height,
|
||||
widget->allocation.height - paned->priv->button_box_size -
|
||||
@ -1389,13 +1484,13 @@ static void get_handle_rect (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
rect->width = paned->priv->handle_size;
|
||||
rect->height = GTK_WIDGET(paned)->allocation.height;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
rect->height = paned->priv->handle_size;
|
||||
rect->width = GTK_WIDGET(paned)->allocation.width;
|
||||
break;
|
||||
@ -1467,12 +1562,12 @@ static gboolean moo_paned_button_press (GtkWidget *widget,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
paned->priv->drag_start = event->x;
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
paned->priv->drag_start = event->y;
|
||||
break;
|
||||
}
|
||||
@ -1513,14 +1608,14 @@ void moo_paned_set_pane_size (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
size = CLAMP (size, 0,
|
||||
widget->allocation.width - paned->priv->button_box_size -
|
||||
paned->priv->handle_size);
|
||||
break;
|
||||
case GTK_POS_TOP:
|
||||
case GTK_POS_BOTTOM:
|
||||
case MOO_PANE_POS_TOP:
|
||||
case MOO_PANE_POS_BOTTOM:
|
||||
size = CLAMP (size, 0,
|
||||
widget->allocation.height - paned->priv->button_box_size -
|
||||
paned->priv->handle_size);
|
||||
@ -1571,8 +1666,8 @@ void moo_paned_add_pane (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
box = gtk_vbox_new (FALSE, SPACING_IN_BUTTON);
|
||||
break;
|
||||
default:
|
||||
@ -1589,10 +1684,10 @@ void moo_paned_add_pane (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
gtk_label_set_angle (GTK_LABEL (label), 90);
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
case MOO_PANE_POS_RIGHT:
|
||||
gtk_label_set_angle (GTK_LABEL (label), 270);
|
||||
break;
|
||||
default:
|
||||
@ -1609,7 +1704,7 @@ void moo_paned_add_pane (MooPaned *paned,
|
||||
|
||||
switch (paned->priv->pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
case MOO_PANE_POS_LEFT:
|
||||
if (label)
|
||||
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
||||
if (icon)
|
||||
@ -1742,18 +1837,6 @@ void moo_paned_insert_pane (MooPaned *paned,
|
||||
}
|
||||
|
||||
|
||||
static void moo_paned_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
MooPaned *paned = MOO_PANED (container);
|
||||
|
||||
if (widget == GTK_BIN(paned)->child)
|
||||
GTK_CONTAINER_CLASS(moo_paned_parent_class)->remove (container, widget);
|
||||
else
|
||||
moo_paned_remove_pane (paned, widget);
|
||||
}
|
||||
|
||||
|
||||
static void moo_paned_remove_pane (MooPaned *paned,
|
||||
GtkWidget *pane_widget)
|
||||
{
|
||||
@ -1962,3 +2045,40 @@ gboolean moo_paned_is_open (MooPaned *paned)
|
||||
{
|
||||
return moo_paned_get_open_pane (paned) != -1;
|
||||
}
|
||||
|
||||
|
||||
GType moo_pane_position_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GEnumValue values[] = {
|
||||
{ MOO_PANE_POS_LEFT, (char*) "MOO_PANE_POS_LEFT", (char*) "left" },
|
||||
{ MOO_PANE_POS_RIGHT, (char*) "MOO_PANE_POS_RIGHT", (char*) "right" },
|
||||
{ MOO_PANE_POS_TOP, (char*) "MOO_PANE_POS_TOP", (char*) "top" },
|
||||
{ MOO_PANE_POS_BOTTOM, (char*) "MOO_PANE_POS_BOTTOM", (char*) "bottom" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
type = g_enum_register_static ("MooPanePosition", values);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
GSList *moo_paned_get_panes (MooPaned *paned)
|
||||
{
|
||||
GSList *list = NULL, *l;
|
||||
Pane *pane;
|
||||
|
||||
g_return_val_if_fail (MOO_IS_PANED (paned), NULL);
|
||||
|
||||
for (l = paned->priv->panes; l != NULL; l = l->next)
|
||||
{
|
||||
pane = l->data;
|
||||
list = g_slist_prepend (list, pane->child);
|
||||
}
|
||||
|
||||
return g_slist_reverse (list);
|
||||
}
|
@ -26,11 +26,19 @@ G_BEGIN_DECLS
|
||||
#define MOO_IS_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_PANED))
|
||||
#define MOO_PANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_PANED, MooPanedClass))
|
||||
|
||||
#define MOO_TYPE_PANE_POSITION (moo_pane_position_get_type ())
|
||||
|
||||
typedef struct _MooPaned MooPaned;
|
||||
typedef struct _MooPanedPrivate MooPanedPrivate;
|
||||
typedef struct _MooPanedClass MooPanedClass;
|
||||
|
||||
typedef enum {
|
||||
MOO_PANE_POS_LEFT = 0,
|
||||
MOO_PANE_POS_RIGHT,
|
||||
MOO_PANE_POS_TOP,
|
||||
MOO_PANE_POS_BOTTOM
|
||||
} MooPanePosition;
|
||||
|
||||
struct _MooPaned
|
||||
{
|
||||
GtkBin bin;
|
||||
@ -49,8 +57,9 @@ struct _MooPanedClass
|
||||
|
||||
|
||||
GType moo_paned_get_type (void) G_GNUC_CONST;
|
||||
GType moo_pane_position_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget *moo_paned_new (GtkPositionType pane_position);
|
||||
GtkWidget *moo_paned_new (MooPanePosition pane_position);
|
||||
|
||||
void moo_paned_add_pane (MooPaned *paned,
|
||||
GtkWidget *pane_widget,
|
||||
@ -62,7 +71,7 @@ void moo_paned_insert_pane (MooPaned *paned,
|
||||
int position);
|
||||
|
||||
guint moo_paned_n_panes (MooPaned *paned);
|
||||
|
||||
GSList *moo_paned_get_panes (MooPaned *paned);
|
||||
GtkWidget *moo_paned_get_nth_pane (MooPaned *paned,
|
||||
guint n);
|
||||
|
@ -744,6 +744,7 @@ static gboolean extend_selection (MooText *obj,
|
||||
}
|
||||
|
||||
|
||||
/* TODO */
|
||||
static int char_class (MooTerm *term,
|
||||
const GtkTextIter *iter)
|
||||
{
|
||||
|
@ -55,8 +55,6 @@ libmooutils_la_SOURCES = \
|
||||
moomarkup.h \
|
||||
mooobjectfactory.c \
|
||||
mooobjectfactory.h \
|
||||
moopaned.c \
|
||||
moopaned.h \
|
||||
mooparam.c \
|
||||
mooparam.h \
|
||||
mooprefs.c \
|
||||
|
@ -12,6 +12,8 @@ STRING:VOID
|
||||
VOID:BOOL
|
||||
VOID:BOXED
|
||||
VOID:BOXED,POINTER,OBJECT
|
||||
VOID:ENUM
|
||||
VOID:ENUM,UINT
|
||||
VOID:INT
|
||||
VOID:STRING
|
||||
VOID:UINT
|
||||
|
@ -21,13 +21,13 @@ if BUILD_MOOAPP
|
||||
bin_PROGRAMS += editor
|
||||
endif
|
||||
if BUILD_MOOEDIT
|
||||
noinst_PROGRAMS += medit testfileview testpanedfileview
|
||||
noinst_PROGRAMS += medit testfileview testpanedfileview testpaned
|
||||
endif
|
||||
if BUILD_MOOTERM
|
||||
noinst_PROGRAMS += mterm termbuffer
|
||||
endif
|
||||
if BUILD_MOOUTILS
|
||||
noinst_PROGRAMS += markup testpaned
|
||||
noinst_PROGRAMS += markup
|
||||
endif
|
||||
|
||||
|
||||
|
@ -26,6 +26,7 @@ int main (int argc, char *argv[])
|
||||
MooEditWindow *win;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
// gdk_window_set_debug_updates (TRUE);
|
||||
|
||||
init_terminal ();
|
||||
init_editor ();
|
||||
|
@ -141,4 +141,5 @@ int main (int argc, char *argv[])
|
||||
g_signal_connect (term, "bell", G_CALLBACK (gdk_beep), NULL);
|
||||
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
|
@ -129,4 +129,5 @@ int main (int argc, char *argv[])
|
||||
|
||||
g_signal_connect (win, "destroy", gtk_main_quit, NULL);
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,34 +1,39 @@
|
||||
#include "mooutils/moopaned.h"
|
||||
#include "mooedit/moobigpaned.h"
|
||||
|
||||
|
||||
static int WINDOWS = 0;
|
||||
|
||||
static void window_destroyed (void)
|
||||
static void add_panes (GtkWidget *paned, MooPanePosition pane_position)
|
||||
{
|
||||
if (!--WINDOWS) gtk_main_quit ();
|
||||
}
|
||||
|
||||
|
||||
static void sticky_button_toggled (GtkToggleButton *button,
|
||||
MooPaned *paned)
|
||||
{
|
||||
gboolean active = gtk_toggle_button_get_active (button);
|
||||
moo_paned_set_sticky_pane (paned, active);
|
||||
}
|
||||
|
||||
|
||||
static void create_window_with_paned (GtkPositionType pane_position)
|
||||
{
|
||||
GtkWidget *window, *paned, *textview, *button, *label, *swin;
|
||||
GtkWidget *textview;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (window_destroyed), NULL);
|
||||
WINDOWS++;
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
|
||||
gtk_text_buffer_insert_at_cursor (buffer, "Hi there. Hi there. "
|
||||
"Hi there. Hi there. Hi there. Hi there. Hi there. ", -1);
|
||||
moo_big_paned_add_pane (MOO_BIG_PANED (paned),
|
||||
textview, pane_position,
|
||||
"TextView", GTK_STOCK_OK);
|
||||
moo_big_paned_add_pane (MOO_BIG_PANED (paned),
|
||||
gtk_label_new ("This is a label"),
|
||||
pane_position, "Label", GTK_STOCK_CANCEL);
|
||||
}
|
||||
|
||||
paned = moo_paned_new (pane_position);
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window, *paned, *textview, *swin;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
// gdk_window_set_debug_updates (TRUE);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
paned = moo_big_paned_new ();
|
||||
gtk_widget_show (paned);
|
||||
gtk_container_add (GTK_CONTAINER (window), paned);
|
||||
|
||||
@ -39,78 +44,33 @@ static void create_window_with_paned (GtkPositionType pane_position)
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_widget_show (swin);
|
||||
gtk_container_add (GTK_CONTAINER (paned), swin);
|
||||
moo_big_paned_add_child (MOO_BIG_PANED (paned), swin);
|
||||
gtk_container_add (GTK_CONTAINER (swin), textview);
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
|
||||
gtk_text_buffer_insert_at_cursor (buffer, "Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. ",
|
||||
-1);
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. "
|
||||
"Click a button. Click a button. Click a button. Click a button. ",
|
||||
-1);
|
||||
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
|
||||
gtk_text_buffer_insert_at_cursor (buffer, "Hi there. Hi there. "
|
||||
"Hi there. Hi there. Hi there. Hi there. Hi there. ", -1);
|
||||
moo_paned_add_pane (MOO_PANED (paned),
|
||||
textview,
|
||||
"TextView",
|
||||
GTK_STOCK_OK);
|
||||
moo_paned_add_pane (MOO_PANED (paned),
|
||||
gtk_label_new ("This is a label"),
|
||||
"Label",
|
||||
GTK_STOCK_CANCEL);
|
||||
|
||||
button = gtk_toggle_button_new ();
|
||||
gtk_widget_show (button);
|
||||
g_signal_connect (button, "toggled",
|
||||
G_CALLBACK (sticky_button_toggled),
|
||||
paned);
|
||||
gtk_box_pack_end (GTK_BOX (MOO_PANED(paned)->button_box),
|
||||
button, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Sticky");
|
||||
switch (pane_position)
|
||||
{
|
||||
case GTK_POS_LEFT:
|
||||
gtk_label_set_angle (GTK_LABEL (label), 90);
|
||||
break;
|
||||
case GTK_POS_RIGHT:
|
||||
gtk_label_set_angle (GTK_LABEL (label), 270);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_widget_show (label);
|
||||
gtk_container_add (GTK_CONTAINER (button), label);
|
||||
add_panes (paned, MOO_PANE_POS_RIGHT);
|
||||
add_panes (paned, MOO_PANE_POS_LEFT);
|
||||
add_panes (paned, MOO_PANE_POS_TOP);
|
||||
add_panes (paned, MOO_PANE_POS_BOTTOM);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
// gdk_window_set_debug_updates (TRUE);
|
||||
|
||||
create_window_with_paned (GTK_POS_RIGHT);
|
||||
create_window_with_paned (GTK_POS_LEFT);
|
||||
create_window_with_paned (GTK_POS_TOP);
|
||||
create_window_with_paned (GTK_POS_BOTTOM);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "mooutils/moopaned.h"
|
||||
#include "mooedit/moopaned.h"
|
||||
#include "moofileview/moofileview.h"
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user