common.h\
filter.h\
gtkTraceSet.h\
- gtkcustom.h\
+ gtkmultivpaned.h\
hook.h\
iattribute.h\
lttv.h\
+++ /dev/null
-
-#ifndef __GTK_CUSTOM_H__
-#define __GTK_CUSTOM_H__
-
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-#include <lttv/common.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TYPE_CUSTOM (gtk_custom_get_type ())
-#define GTK_CUSTOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CUSTOM, GtkCustom))
-#define GTK_CUSTOM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CUSTOM, GtkCustomClass))
-#define GTK_IS_CUSTOM(obj ) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CUSTOM))
-#define GTK_IS_CUSTOM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CUSTOM))
-#define GTK_CUSTOM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CUSTOM, GtkCustomClass))
-
-
-typedef struct _GtkCustom GtkCustom;
-typedef struct _GtkCustomClass GtkCustomClass;
-
-struct _GtkCustom
-{
- GtkPaned container;
-
- /*< public >*/
- GtkPaned * first_pane;
- GtkPaned * last_pane;
- GtkPaned * focused_pane;
- guint num_children;
-
- GtkWidget * vbox;
- // GtkWidget * scrollWindow;
- // GtkWidget * viewport;
- GtkWidget * hscrollbar;
- GtkAdjustment *hadjust;
- MainWindow * mw;
-};
-
-struct _GtkCustomClass
-{
- GtkPanedClass parent_class;
-};
-
-
-GType gtk_custom_get_type (void) G_GNUC_CONST;
-GtkWidget* gtk_custom_new (void);
-
-void gtk_custom_set_focus (GtkWidget * widget, gpointer user_data);
-void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1);
-void gtk_custom_widget_delete(GtkCustom * custom);
-void gtk_custom_widget_move_up(GtkCustom * custom);
-void gtk_custom_widget_move_down(GtkCustom * custom);
-void gtk_custom_set_adjust(GtkCustom * custom, gboolean first_time);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_CUSTOM_H__ */
--- /dev/null
+
+#ifndef __GTK_MULTI_VPANED_H__
+#define __GTK_MULTI_VPANED_H__
+
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gdk/gdk.h>
+#include <gtk/gtkcontainer.h>
+#include <lttv/common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#define GTK_TYPE_MULTI_VPANED (gtk_multi_vpaned_get_type ())
+#define GTK_MULTI_VPANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MULTI_VPANED, GtkMultiVPaned))
+#define GTK_MULTI_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MULTI_VPANED, GtkMultiVPanedClass))
+#define GTK_IS_MULTI_VPANED(obj ) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MULTI_VPANED))
+#define GTK_IS_MULTI_VPANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MULTI_VPANED))
+#define GTK_MULTI_VPANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MULTI_VPANED, GtkMultiVPanedClass))
+
+
+typedef struct _GtkMultiVPaned GtkMultiVPaned;
+typedef struct _GtkMultiVPanedClass GtkMultiVPanedClass;
+
+struct _GtkMultiVPaned
+{
+ GtkPaned container;
+
+ /*< public >*/
+ GtkPaned * first_pane;
+ GtkPaned * last_pane;
+ GtkPaned * focused_pane;
+ guint num_children;
+
+ GtkWidget * vbox;
+ // GtkWidget * scrollWindow;
+ // GtkWidget * viewport;
+ GtkWidget * hscrollbar;
+ GtkAdjustment *hadjust;
+ MainWindow * mw;
+};
+
+struct _GtkMultiVPanedClass
+{
+ GtkPanedClass parent_class;
+};
+
+
+GType gtk_multi_vpaned_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_multi_vpaned_new (void);
+
+void gtk_multi_vpaned_set_focus (GtkWidget * widget, gpointer user_data);
+void gtk_multi_vpaned_widget_add(GtkMultiVPaned * multi_vpaned, GtkWidget * widget1);
+void gtk_multi_vpaned_widget_delete(GtkMultiVPaned * multi_vpaned);
+void gtk_multi_vpaned_widget_move_up(GtkMultiVPaned * multi_vpaned);
+void gtk_multi_vpaned_widget_move_down(GtkMultiVPaned * multi_vpaned);
+void gtk_multi_vpaned_set_adjust(GtkMultiVPaned * multi_vpaned, gboolean first_time);
+
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __GTK_MULTI_VPANED_H__ */
#include <lttv/processTrace.h>
#include <lttv/common.h>
-#include <lttv/gtkcustom.h>
+#include <lttv/gtkmultivpaned.h>
#include <lttv/hook.h>
#include <lttv/stats.h>
struct _Tab{
GtkWidget * label;
- GtkCustom * custom;
+ GtkMultiVPaned * multi_vpaned;
// startTime is the left of the visible area. Corresponds to the scrollbar
// value.
void set_focused_pane(MainWindow *main_win, gpointer paned)
{
- gtk_custom_set_focus((GtkWidget*)main_win->current_tab->custom,paned);
+ gtk_multi_vpaned_set_focus((GtkWidget*)main_win->current_tab->multi_vpaned,paned);
}
support.c \
interface.c \
callbacks.c \
- gtkcustom.c \
+ gtkmultivpaned.c \
gtkdirsel.c
noinst_HEADERS = \
/* internal functions */
void insert_viewer(GtkWidget* widget, view_constructor constructor)
{
- GtkCustom * custom;
+ GtkMultiVPaned * multi_vpaned;
MainWindow * mw_data;
GtkWidget * viewer;
mw_data = get_window_data_struct(widget);
if(!mw_data->current_tab) return;
- custom = mw_data->current_tab->custom;
+ multi_vpaned = mw_data->current_tab->multi_vpaned;
viewer = (GtkWidget*)constructor(mw_data);
if(viewer)
{
- gtk_custom_widget_add(custom, viewer);
+ gtk_multi_vpaned_widget_add(multi_vpaned, viewer);
// Added by MD
// g_object_unref(G_OBJECT(viewer));
}
{
MainWindow * mw = get_window_data_struct(widget);
if(!mw->current_tab) return;
- gtk_custom_widget_move_up(mw->current_tab->custom);
+ gtk_multi_vpaned_widget_move_up(mw->current_tab->multi_vpaned);
}
void move_down_viewer(GtkWidget * widget, gpointer user_data)
{
MainWindow * mw = get_window_data_struct(widget);
if(!mw->current_tab) return;
- gtk_custom_widget_move_down(mw->current_tab->custom);
+ gtk_multi_vpaned_widget_move_down(mw->current_tab->multi_vpaned);
}
void delete_viewer(GtkWidget * widget, gpointer user_data)
{
MainWindow * mw = get_window_data_struct(widget);
if(!mw->current_tab) return;
- gtk_custom_widget_delete(mw->current_tab->custom);
+ gtk_multi_vpaned_widget_delete(mw->current_tab->multi_vpaned);
}
void open_traceset(GtkWidget * widget, gpointer user_data)
time_window.start_time = time_s;
}
set_time_window(mw_data, &time_window);
- gtk_custom_set_adjust(mw_data->current_tab->custom, FALSE);
+ gtk_multi_vpaned_set_adjust(mw_data->current_tab->multi_vpaned, FALSE);
}
void zoom_in(GtkWidget * widget, gpointer user_data)
}
tmp_tab->attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
// mw_data->current_tab = tmp_tab;
- tmp_tab->custom = (GtkCustom*)gtk_custom_new();
- tmp_tab->custom->mw = mw_data;
- gtk_widget_show((GtkWidget*)tmp_tab->custom);
+ tmp_tab->multi_vpaned = (GtkMultiVPaned*)gtk_multi_vpaned_new();
+ tmp_tab->multi_vpaned->mw = mw_data;
+ gtk_widget_show((GtkWidget*)tmp_tab->multi_vpaned);
tmp_tab->next = NULL;
tmp_tab->mw = mw_data;
gtk_widget_show (tmp_tab->label);
g_object_set_data_full(
- G_OBJECT(tmp_tab->custom),
+ G_OBJECT(tmp_tab->multi_vpaned),
"Tab_Info",
tmp_tab,
(GDestroyNotify)tab_destructor);
- gtk_notebook_append_page(notebook, (GtkWidget*)tmp_tab->custom, tmp_tab->label);
+ gtk_notebook_append_page(notebook, (GtkWidget*)tmp_tab->multi_vpaned, tmp_tab->label);
list = gtk_container_get_children(GTK_CONTAINER(notebook));
gtk_notebook_set_current_page(notebook,g_list_length(list)-1);
}
+++ /dev/null
-#include <gtk/gtk.h>
-
-#include <lttv/gtkcustom.h>
-//#include "gtkintl.h"
-#include <lttv/mainWindow.h>
-#include <lttv/gtkTraceSet.h>
-
-static void gtk_custom_class_init (GtkCustomClass *klass);
-static void gtk_custom_init (GtkCustom *custom);
-
-
-static void gtk_custom_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_custom_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-void gtk_custom_scroll_value_changed (GtkRange *range, gpointer custom);
-
-GType
-gtk_custom_get_type (void)
-{
- static GType custom_type = 0;
-
- if (!custom_type)
- {
- static const GTypeInfo custom_info =
- {
- sizeof (GtkCustomClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_custom_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkCustom),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_custom_init,
- NULL, /* value_table */
- };
-
- custom_type = g_type_register_static (GTK_TYPE_PANED, "GtkCustom",
- &custom_info, 0);
- }
-
- return custom_type;
-}
-
-static void
-gtk_custom_class_init (GtkCustomClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass *) class;
-
- widget_class->size_request = gtk_custom_size_request;
- widget_class->size_allocate = gtk_custom_size_allocate;
-}
-
-static void
-gtk_custom_init (GtkCustom *custom)
-{
- GtkWidget * button;
-
- GTK_WIDGET_SET_FLAGS (custom, GTK_NO_WINDOW);
- gtk_widget_set_redraw_on_allocate (GTK_WIDGET (custom), FALSE);
-
- custom->first_pane = NULL;
- custom->last_pane = NULL;
- custom->focused_pane = NULL;
- custom->num_children = 0;
-
- custom->vbox = NULL;
- // custom->scrollWindow = NULL;
- // custom->viewport = NULL;
- custom->hscrollbar = NULL;
-}
-
-
-GtkWidget* gtk_custom_new ()
-{
- return GTK_WIDGET (g_object_new (gtk_custom_get_type (), NULL));
-}
-
-
-void gtk_custom_set_focus (GtkWidget * widget, gpointer user_data)
-{
- GtkCustom * custom = (GtkCustom*) widget;
- GtkPaned * pane;
- if(!custom->first_pane) return;
-
-
- pane = custom->first_pane;
- while(1){
- if((GtkWidget*)pane == (GtkWidget*)user_data){
- custom->focused_pane = pane;
- break;
- }
- if(pane == custom->last_pane){
- custom->focused_pane = NULL;
- break;
- }
- pane = (GtkPaned*)pane->child1;
- }
-}
-
-void gtk_custom_set_adjust(GtkCustom * custom, gboolean first_time)
-{
- TimeWindow time_window;
- TimeInterval *time_span;
- double tmp, start;
- double range = 0;
-
- get_time_window(custom->mw,&time_window);
- if(first_time){
- time_span = LTTV_TRACESET_CONTEXT(custom->mw->current_tab->traceset_info->
- traceset_context)->Time_Span ;
-
- custom->hadjust->lower = ltt_time_to_double(time_span->startTime) *
- NANOSECONDS_PER_SECOND;
- custom->hadjust->value = custom->hadjust->lower;
- custom->hadjust->upper = ltt_time_to_double(time_span->endTime) *
- NANOSECONDS_PER_SECOND;
- }
-
- /* Page increment of whole visible area */
- if(custom->hadjust == NULL){
- g_warning("Insert a viewer first");
- return;
- }
-
- start = ltt_time_to_double(time_window.start_time) * NANOSECONDS_PER_SECOND;
- tmp = custom->hadjust->upper - custom->hadjust->lower;
-
- custom->hadjust->page_increment = ltt_time_to_double(
- time_window.time_width) * NANOSECONDS_PER_SECOND;
-
- if(custom->hadjust->page_increment >= tmp - range)
- custom->hadjust->value = custom->hadjust->lower;
- if(start + custom->hadjust->page_increment >= custom->hadjust->upper - range)
- custom->hadjust->value = start;
-
- /* page_size to the whole visible area will take care that the
- * scroll value + the shown area will never be more than what is
- * in the trace. */
- custom->hadjust->page_size = custom->hadjust->page_increment;
- custom->hadjust->step_increment = custom->hadjust->page_increment / 10;
-
- gtk_adjustment_changed (custom->hadjust);
-}
-
-void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1)
-{
- GtkPaned * tmpPane;
- GtkWidget * w;
-
- g_return_if_fail(GTK_IS_CUSTOM(custom));
- g_object_ref(G_OBJECT(widget1));
-
-
- if(!custom->first_pane){
- custom->first_pane = (GtkPaned *)gtk_vpaned_new();
- custom->last_pane = custom->first_pane;
-
- custom->hscrollbar = gtk_hscrollbar_new (NULL);
- gtk_widget_show(custom->hscrollbar);
-
- custom->hadjust = gtk_range_get_adjustment(GTK_RANGE(custom->hscrollbar));
- gtk_custom_set_adjust(custom, TRUE);
-
- gtk_range_set_update_policy (GTK_RANGE(custom->hscrollbar),
- GTK_UPDATE_DISCONTINUOUS);
- g_signal_connect(G_OBJECT(custom->hscrollbar), "value-changed",
- G_CALLBACK(gtk_custom_scroll_value_changed), custom);
-
- custom->vbox = gtk_vbox_new(FALSE,0);
- gtk_widget_show(custom->vbox);
-
- // custom->viewport = gtk_viewport_new (NULL,NULL);
- // gtk_widget_show(custom->viewport);
-
- // gtk_container_add(GTK_CONTAINER(custom->viewport), (GtkWidget*)custom->vbox);
- gtk_box_pack_end(GTK_BOX(custom->vbox),(GtkWidget*)custom->hscrollbar,FALSE,FALSE,0);
- gtk_box_pack_end(GTK_BOX(custom->vbox),(GtkWidget*)custom->first_pane,TRUE,TRUE,0);
-
- // custom->scrollWindow = gtk_scrolled_window_new (NULL, NULL);
- // gtk_widget_show(custom->scrollWindow);
- // gtk_container_add (GTK_CONTAINER (custom->scrollWindow), (GtkWidget*)custom->viewport);
- // gtk_paned_pack1(GTK_PANED(custom), (GtkWidget*)custom->scrollWindow,FALSE, TRUE);
-
- gtk_paned_pack1(GTK_PANED(custom), (GtkWidget*)custom->vbox,FALSE, TRUE);
- }else{
- tmpPane = custom->last_pane;
- custom->last_pane = (GtkPaned *)gtk_vpaned_new();
- gtk_paned_pack1 (tmpPane,(GtkWidget*)custom->last_pane, FALSE,TRUE);
- }
- gtk_widget_show((GtkWidget *)custom->last_pane);
-
- gtk_paned_pack2 (custom->last_pane,widget1, TRUE, TRUE);
- custom->focused_pane = custom->last_pane;
- custom->num_children++;
-
-}
-
-void gtk_custom_widget_delete(GtkCustom * custom)
-{
- GtkPaned * tmp, *prev, *next;
-
- if(!custom->focused_pane) return;
-
- tmp = (GtkPaned*)custom->focused_pane->child2; //widget in vpaned
- g_object_unref(G_OBJECT(tmp));
-
- if(custom->focused_pane == custom->first_pane &&
- custom->focused_pane == custom->last_pane){
- // gtk_container_remove(GTK_CONTAINER(custom),(GtkWidget*)custom->scrollWindow);
- gtk_container_remove(GTK_CONTAINER(custom),(GtkWidget*)custom->vbox);
- custom->first_pane = NULL;
- custom->last_pane = NULL;
- custom->focused_pane = NULL;
- }else if(custom->focused_pane == custom->first_pane &&
- custom->focused_pane != custom->last_pane){
- next = (GtkPaned*)custom->first_pane->child1;
- g_object_ref(G_OBJECT(next));
- gtk_container_remove(GTK_CONTAINER(custom->first_pane),(GtkWidget*)next);
- gtk_container_remove(GTK_CONTAINER(custom->vbox),(GtkWidget*)custom->first_pane);
- custom->first_pane = next;
- gtk_box_pack_end(GTK_BOX(custom->vbox),(GtkWidget*)custom->first_pane,TRUE,TRUE,0);
- custom->focused_pane = custom->first_pane;
- g_object_unref(G_OBJECT(next));
- }else if(custom->focused_pane != custom->first_pane &&
- custom->focused_pane == custom->last_pane){
- tmp = custom->last_pane;
- custom->last_pane = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)custom->last_pane);
- custom->focused_pane = custom->last_pane;
- gtk_container_remove(GTK_CONTAINER(custom->last_pane),(GtkWidget*)tmp);
- }else{
- tmp = custom->focused_pane;
- prev = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)tmp);
- next = (GtkPaned*)tmp->child1;
- g_object_ref(G_OBJECT(next));
- gtk_container_remove(GTK_CONTAINER(custom->focused_pane),(GtkWidget*)next);
- gtk_container_remove(GTK_CONTAINER(prev),(GtkWidget*)custom->focused_pane);
- gtk_paned_pack1(prev, (GtkWidget*)next, FALSE, TRUE);
- custom->focused_pane = next;
- g_object_unref(G_OBJECT(next));
- }
-
- custom->num_children--;
-}
-
-
-void gtk_custom_widget_move_up(GtkCustom * custom)
-{
- GtkWidget* upWidget, *downWidget;
- GtkPaned * prev,*next, *prevPrev;
-
- if(custom->last_pane == custom->focused_pane) return;
-
- // move VPane
- prev = (GtkPaned*)custom->focused_pane->child1;
- g_object_ref(G_OBJECT(prev));
- gtk_container_remove(GTK_CONTAINER(custom->focused_pane),(GtkWidget*)prev);
-
- if(prev == custom->last_pane){
- prevPrev = NULL;
- custom->last_pane = custom->focused_pane;
- }else{
- prevPrev = (GtkPaned*)prev->child1;
- g_object_ref(G_OBJECT(prevPrev));
- gtk_container_remove(GTK_CONTAINER(prev),(GtkWidget*)prevPrev);
- }
-
- g_object_ref(G_OBJECT(custom->focused_pane));
- if(custom->first_pane == custom->focused_pane){
- gtk_container_remove(GTK_CONTAINER(custom->vbox),(GtkWidget*)custom->focused_pane);
- gtk_box_pack_end(GTK_BOX(custom->vbox),(GtkWidget*)prev,TRUE,TRUE,0);
- custom->first_pane = prev;
- }else{
- next = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)custom->focused_pane);
- gtk_container_remove(GTK_CONTAINER(next),(GtkWidget*)custom->focused_pane);
- gtk_paned_pack1(GTK_PANED(next), (GtkWidget*)prev, FALSE,TRUE);
- }
- gtk_paned_pack1(GTK_PANED(prev),(GtkWidget*)custom->focused_pane, FALSE,TRUE);
- if(prevPrev)
- gtk_paned_pack1(GTK_PANED(custom->focused_pane),(GtkWidget*)prevPrev, FALSE,TRUE);
-
- g_object_unref(G_OBJECT(prev));
- if(prevPrev) g_object_unref(G_OBJECT(prevPrev));
- g_object_unref(G_OBJECT(custom->focused_pane));
-}
-
-
-void gtk_custom_widget_move_down(GtkCustom * custom)
-{
- GtkWidget* upWidget, *downWidget;
- GtkPaned * prev,*next, *nextNext;
-
- if(custom->first_pane == custom->focused_pane) return;
-
- //move VPane
- next = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)custom->focused_pane);
- g_object_ref(G_OBJECT(next));
-
- if(custom->last_pane == custom->focused_pane){
- prev = NULL;
- custom->last_pane = next;
- }else{
- prev = (GtkPaned*)custom->focused_pane->child1;
- g_object_ref(G_OBJECT(prev));
- gtk_container_remove(GTK_CONTAINER(custom->focused_pane),(GtkWidget*)prev);
- }
-
- g_object_ref(G_OBJECT(custom->focused_pane));
- gtk_container_remove(GTK_CONTAINER(next),(GtkWidget*)custom->focused_pane);
-
- if(next == custom->first_pane){
- custom->first_pane = custom->focused_pane;
- gtk_container_remove(GTK_CONTAINER(custom->vbox),(GtkWidget*)next);
- gtk_box_pack_end(GTK_BOX(custom->vbox),(GtkWidget*)custom->focused_pane,TRUE,TRUE,0);
- }else{
- nextNext = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)next);
- gtk_container_remove(GTK_CONTAINER(nextNext),(GtkWidget*)next);
- gtk_paned_pack1(nextNext, (GtkWidget*)custom->focused_pane, FALSE, TRUE);
- }
- gtk_paned_pack1(custom->focused_pane,(GtkWidget*)next, FALSE,TRUE);
- if(prev)
- gtk_paned_pack1(next,(GtkWidget*)prev, FALSE,TRUE);
-
- if(prev)g_object_unref(G_OBJECT(prev));
- g_object_unref(G_OBJECT(next));
- g_object_unref(G_OBJECT(custom->focused_pane));
-}
-
-void gtk_custom_scroll_value_changed(GtkRange *range, gpointer custom_arg)
-{
- LttTime time;
- GtkCustom * custom = (GtkCustom*)custom_arg;
- gdouble value = gtk_range_get_value(range);
- time = ltt_time_from_double(value / NANOSECONDS_PER_SECOND);
- set_current_time(custom->mw, &time);
- g_warning("The current time is second :%d, nanosecond : %d\n", time.tv_sec, time.tv_nsec);
-}
-
-
-static void
-gtk_custom_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkPaned *paned = GTK_PANED (widget);
- GtkRequisition child_requisition;
-
- requisition->width = 0;
- requisition->height = 0;
-
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- {
- gtk_widget_size_request (paned->child1, &child_requisition);
-
- requisition->height = child_requisition.height;
- requisition->width = child_requisition.width;
- }
-
- if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- {
- gtk_widget_size_request (paned->child2, &child_requisition);
-
- requisition->width = MAX (requisition->width, child_requisition.width);
- requisition->height += child_requisition.height;
- }
-
- requisition->height += GTK_CONTAINER (paned)->border_width * 2;
- requisition->width += GTK_CONTAINER (paned)->border_width * 2;
-
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
- paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- {
- gint handle_size;
-
- gtk_widget_style_get (widget, "handle_size", &handle_size, NULL);
- requisition->height += handle_size;
- }
-
-}
-
-static void
-gtk_custom_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkPaned *paned = GTK_PANED (widget);
- gint border_width = GTK_CONTAINER (paned)->border_width;
-
- widget->allocation = *allocation;
-
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
- paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- {
- GtkRequisition child1_requisition;
- GtkRequisition child2_requisition;
- GtkAllocation child1_allocation;
- GtkAllocation child2_allocation;
- gint handle_size;
-
- gtk_widget_style_get (widget, "handle_size", &handle_size, NULL);
-
- gtk_widget_get_child_requisition (paned->child1, &child1_requisition);
- gtk_widget_get_child_requisition (paned->child2, &child2_requisition);
-
- gtk_paned_compute_position (paned,
- MAX (1, widget->allocation.height
- - handle_size
- - 2 * border_width),
- child1_requisition.height,
- child2_requisition.height);
-
- paned->handle_pos.x = widget->allocation.x + border_width;
- paned->handle_pos.y = widget->allocation.y + paned->child1_size + border_width;
- paned->handle_pos.width = MAX (1, (gint) widget->allocation.width - 2 * border_width);
- paned->handle_pos.height = handle_size;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- if (GTK_WIDGET_MAPPED (widget))
- gdk_window_show (paned->handle);
- gdk_window_move_resize (paned->handle,
- paned->handle_pos.x,
- paned->handle_pos.y,
- paned->handle_pos.width,
- handle_size);
- }
-
- child1_allocation.width = child2_allocation.width = MAX (1, (gint) allocation->width - border_width * 2);
- child1_allocation.height = MAX (1, paned->child1_size);
- child1_allocation.x = child2_allocation.x = widget->allocation.x + border_width;
- child1_allocation.y = widget->allocation.y + border_width;
-
- child2_allocation.y = child1_allocation.y + paned->child1_size + paned->handle_pos.height;
- child2_allocation.height = MAX (1, widget->allocation.y + widget->allocation.height - child2_allocation.y - border_width);
-
- if (GTK_WIDGET_MAPPED (widget) &&
- paned->child1->allocation.height < child1_allocation.height)
- {
- gtk_widget_size_allocate (paned->child2, &child2_allocation);
- gtk_widget_size_allocate (paned->child1, &child1_allocation);
- }
- else
- {
- gtk_widget_size_allocate (paned->child1, &child1_allocation);
- gtk_widget_size_allocate (paned->child2, &child2_allocation);
- }
- }
- else
- {
- GtkAllocation child_allocation;
-
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_hide (paned->handle);
-
- if (paned->child1)
- gtk_widget_set_child_visible (paned->child1, TRUE);
- if (paned->child2)
- gtk_widget_set_child_visible (paned->child2, TRUE);
-
- child_allocation.x = widget->allocation.x + border_width;
- child_allocation.y = widget->allocation.y + border_width;
- child_allocation.width = MAX (1, allocation->width - 2 * border_width);
- child_allocation.height = MAX (1, allocation->height - 2 * border_width);
-
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- gtk_widget_size_allocate (paned->child1, &child_allocation);
- else if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- gtk_widget_size_allocate (paned->child2, &child_allocation);
- }
-}
-
--- /dev/null
+#include <gtk/gtk.h>
+
+#include <lttv/gtkmultivpaned.h>
+//#include "gtkintl.h"
+#include <lttv/mainWindow.h>
+#include <lttv/gtkTraceSet.h>
+
+static void gtk_multi_vpaned_class_init (GtkMultiVPanedClass *klass);
+static void gtk_multi_vpaned_init (GtkMultiVPaned *multi_vpaned);
+
+
+static void gtk_multi_vpaned_size_request (GtkWidget *widget,
+ GtkRequisition *requisition);
+static void gtk_multi_vpaned_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+
+void gtk_multi_vpaned_scroll_value_changed (GtkRange *range, gpointer multi_vpaned);
+
+GType
+gtk_multi_vpaned_get_type (void)
+{
+ static GType multi_vpaned_type = 0;
+
+ if (!multi_vpaned_type)
+ {
+ static const GTypeInfo multi_vpaned_info =
+ {
+ sizeof (GtkMultiVPanedClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) gtk_multi_vpaned_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GtkMultiVPaned),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gtk_multi_vpaned_init,
+ NULL, /* value_table */
+ };
+
+ multi_vpaned_type = g_type_register_static (GTK_TYPE_PANED, "GtkMultiVPaned",
+ &multi_vpaned_info, 0);
+ }
+
+ return multi_vpaned_type;
+}
+
+static void
+gtk_multi_vpaned_class_init (GtkMultiVPanedClass *class)
+{
+ GtkWidgetClass *widget_class;
+
+ widget_class = (GtkWidgetClass *) class;
+
+ widget_class->size_request = gtk_multi_vpaned_size_request;
+ widget_class->size_allocate = gtk_multi_vpaned_size_allocate;
+}
+
+static void
+gtk_multi_vpaned_init (GtkMultiVPaned * multi_vpaned)
+{
+ GtkWidget * button;
+
+ GTK_WIDGET_SET_FLAGS (multi_vpaned, GTK_NO_WINDOW);
+ gtk_widget_set_redraw_on_allocate (GTK_WIDGET (multi_vpaned), FALSE);
+
+ multi_vpaned->first_pane = NULL;
+ multi_vpaned->last_pane = NULL;
+ multi_vpaned->focused_pane = NULL;
+ multi_vpaned->num_children = 0;
+
+ multi_vpaned->vbox = NULL;
+ // multi_vpaned->scrollWindow = NULL;
+ // multi_vpaned->viewport = NULL;
+ multi_vpaned->hscrollbar = NULL;
+}
+
+
+GtkWidget* gtk_multi_vpaned_new ()
+{
+ return GTK_WIDGET (g_object_new (gtk_multi_vpaned_get_type (), NULL));
+}
+
+
+void gtk_multi_vpaned_set_focus (GtkWidget * widget, gpointer user_data)
+{
+ GtkMultiVPaned * multi_vpaned = (GtkMultiVPaned*) widget;
+ GtkPaned * pane;
+ if(!multi_vpaned->first_pane) return;
+
+
+ pane = multi_vpaned->first_pane;
+ while(1){
+ if((GtkWidget*)pane == (GtkWidget*)user_data){
+ multi_vpaned->focused_pane = pane;
+ break;
+ }
+ if(pane == multi_vpaned->last_pane){
+ multi_vpaned->focused_pane = NULL;
+ break;
+ }
+ pane = (GtkPaned*)pane->child1;
+ }
+}
+
+void gtk_multi_vpaned_set_adjust(GtkMultiVPaned * multi_vpaned, gboolean first_time)
+{
+ TimeWindow time_window;
+ TimeInterval *time_span;
+ double tmp, start;
+ double range = 0;
+
+ get_time_window(multi_vpaned->mw,&time_window);
+ if(first_time){
+ time_span = LTTV_TRACESET_CONTEXT(multi_vpaned->mw->current_tab->traceset_info->
+ traceset_context)->Time_Span ;
+
+ multi_vpaned->hadjust->lower = ltt_time_to_double(time_span->startTime) *
+ NANOSECONDS_PER_SECOND;
+ multi_vpaned->hadjust->value = multi_vpaned->hadjust->lower;
+ multi_vpaned->hadjust->upper = ltt_time_to_double(time_span->endTime) *
+ NANOSECONDS_PER_SECOND;
+ }
+
+ /* Page increment of whole visible area */
+ if(multi_vpaned->hadjust == NULL){
+ g_warning("Insert a viewer first");
+ return;
+ }
+
+ start = ltt_time_to_double(time_window.start_time) * NANOSECONDS_PER_SECOND;
+ tmp = multi_vpaned->hadjust->upper - multi_vpaned->hadjust->lower;
+
+ multi_vpaned->hadjust->page_increment = ltt_time_to_double(
+ time_window.time_width) * NANOSECONDS_PER_SECOND;
+
+ if(multi_vpaned->hadjust->page_increment >= tmp - range)
+ multi_vpaned->hadjust->value = multi_vpaned->hadjust->lower;
+ if(start + multi_vpaned->hadjust->page_increment >= multi_vpaned->hadjust->upper - range)
+ multi_vpaned->hadjust->value = start;
+
+ /* page_size to the whole visible area will take care that the
+ * scroll value + the shown area will never be more than what is
+ * in the trace. */
+ multi_vpaned->hadjust->page_size = multi_vpaned->hadjust->page_increment;
+ multi_vpaned->hadjust->step_increment = multi_vpaned->hadjust->page_increment / 10;
+
+ gtk_adjustment_changed (multi_vpaned->hadjust);
+}
+
+void gtk_multi_vpaned_widget_add(GtkMultiVPaned * multi_vpaned, GtkWidget * widget1)
+{
+ GtkPaned * tmpPane;
+ GtkWidget * w;
+
+ g_return_if_fail(GTK_IS_MULTI_VPANED(multi_vpaned));
+ g_object_ref(G_OBJECT(widget1));
+
+
+ if(!multi_vpaned->first_pane){
+ multi_vpaned->first_pane = (GtkPaned *)gtk_vpaned_new();
+ multi_vpaned->last_pane = multi_vpaned->first_pane;
+
+ multi_vpaned->hscrollbar = gtk_hscrollbar_new (NULL);
+ gtk_widget_show(multi_vpaned->hscrollbar);
+
+ multi_vpaned->hadjust = gtk_range_get_adjustment(GTK_RANGE(multi_vpaned->hscrollbar));
+ gtk_multi_vpaned_set_adjust(multi_vpaned, TRUE);
+
+ gtk_range_set_update_policy (GTK_RANGE(multi_vpaned->hscrollbar),
+ GTK_UPDATE_DISCONTINUOUS);
+ g_signal_connect(G_OBJECT(multi_vpaned->hscrollbar), "value-changed",
+ G_CALLBACK(gtk_multi_vpaned_scroll_value_changed), multi_vpaned);
+
+ multi_vpaned->vbox = gtk_vbox_new(FALSE,0);
+ gtk_widget_show(multi_vpaned->vbox);
+
+ // multi_vpaned->viewport = gtk_viewport_new (NULL,NULL);
+ // gtk_widget_show(multi_vpaned->viewport);
+
+ // gtk_container_add(GTK_CONTAINER(multi_vpaned->viewport), (GtkWidget*)multi_vpaned->vbox);
+ gtk_box_pack_end(GTK_BOX(multi_vpaned->vbox),(GtkWidget*)multi_vpaned->hscrollbar,FALSE,FALSE,0);
+ gtk_box_pack_end(GTK_BOX(multi_vpaned->vbox),(GtkWidget*)multi_vpaned->first_pane,TRUE,TRUE,0);
+
+ // multi_vpaned->scrollWindow = gtk_scrolled_window_new (NULL, NULL);
+ // gtk_widget_show(multi_vpaned->scrollWindow);
+ // gtk_container_add (GTK_CONTAINER (multi_vpaned->scrollWindow), (GtkWidget*)multi_vpaned->viewport);
+ // gtk_paned_pack1(GTK_PANED(multi_vpaned), (GtkWidget*)multi_vpaned->scrollWindow,FALSE, TRUE);
+
+ gtk_paned_pack1(GTK_PANED(multi_vpaned), (GtkWidget*)multi_vpaned->vbox,FALSE, TRUE);
+ }else{
+ tmpPane = multi_vpaned->last_pane;
+ multi_vpaned->last_pane = (GtkPaned *)gtk_vpaned_new();
+ gtk_paned_pack1 (tmpPane,(GtkWidget*)multi_vpaned->last_pane, FALSE,TRUE);
+ }
+ gtk_widget_show((GtkWidget *)multi_vpaned->last_pane);
+
+ gtk_paned_pack2 (multi_vpaned->last_pane,widget1, TRUE, TRUE);
+ multi_vpaned->focused_pane = multi_vpaned->last_pane;
+ multi_vpaned->num_children++;
+
+}
+
+void gtk_multi_vpaned_widget_delete(GtkMultiVPaned * multi_vpaned)
+{
+ GtkPaned * tmp, *prev, *next;
+
+ if(!multi_vpaned->focused_pane) return;
+
+ tmp = (GtkPaned*)multi_vpaned->focused_pane->child2; //widget in vpaned
+ g_object_unref(G_OBJECT(tmp));
+
+ if(multi_vpaned->focused_pane == multi_vpaned->first_pane &&
+ multi_vpaned->focused_pane == multi_vpaned->last_pane){
+ // gtk_container_remove(GTK_CONTAINER(multi_vpaned),(GtkWidget*)multi_vpaned->scrollWindow);
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned),(GtkWidget*)multi_vpaned->vbox);
+ multi_vpaned->first_pane = NULL;
+ multi_vpaned->last_pane = NULL;
+ multi_vpaned->focused_pane = NULL;
+ }else if(multi_vpaned->focused_pane == multi_vpaned->first_pane &&
+ multi_vpaned->focused_pane != multi_vpaned->last_pane){
+ next = (GtkPaned*)multi_vpaned->first_pane->child1;
+ g_object_ref(G_OBJECT(next));
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned->first_pane),(GtkWidget*)next);
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned->vbox),(GtkWidget*)multi_vpaned->first_pane);
+ multi_vpaned->first_pane = next;
+ gtk_box_pack_end(GTK_BOX(multi_vpaned->vbox),(GtkWidget*)multi_vpaned->first_pane,TRUE,TRUE,0);
+ multi_vpaned->focused_pane = multi_vpaned->first_pane;
+ g_object_unref(G_OBJECT(next));
+ }else if(multi_vpaned->focused_pane != multi_vpaned->first_pane &&
+ multi_vpaned->focused_pane == multi_vpaned->last_pane){
+ tmp = multi_vpaned->last_pane;
+ multi_vpaned->last_pane = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)multi_vpaned->last_pane);
+ multi_vpaned->focused_pane = multi_vpaned->last_pane;
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned->last_pane),(GtkWidget*)tmp);
+ }else{
+ tmp = multi_vpaned->focused_pane;
+ prev = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)tmp);
+ next = (GtkPaned*)tmp->child1;
+ g_object_ref(G_OBJECT(next));
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned->focused_pane),(GtkWidget*)next);
+ gtk_container_remove(GTK_CONTAINER(prev),(GtkWidget*)multi_vpaned->focused_pane);
+ gtk_paned_pack1(prev, (GtkWidget*)next, FALSE, TRUE);
+ multi_vpaned->focused_pane = next;
+ g_object_unref(G_OBJECT(next));
+ }
+
+ multi_vpaned->num_children--;
+}
+
+
+void gtk_multi_vpaned_widget_move_up(GtkMultiVPaned * multi_vpaned)
+{
+ GtkWidget* upWidget, *downWidget;
+ GtkPaned * prev,*next, *prevPrev;
+
+ if(multi_vpaned->last_pane == multi_vpaned->focused_pane) return;
+
+ // move VPane
+ prev = (GtkPaned*)multi_vpaned->focused_pane->child1;
+ g_object_ref(G_OBJECT(prev));
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned->focused_pane),(GtkWidget*)prev);
+
+ if(prev == multi_vpaned->last_pane){
+ prevPrev = NULL;
+ multi_vpaned->last_pane = multi_vpaned->focused_pane;
+ }else{
+ prevPrev = (GtkPaned*)prev->child1;
+ g_object_ref(G_OBJECT(prevPrev));
+ gtk_container_remove(GTK_CONTAINER(prev),(GtkWidget*)prevPrev);
+ }
+
+ g_object_ref(G_OBJECT(multi_vpaned->focused_pane));
+ if(multi_vpaned->first_pane == multi_vpaned->focused_pane){
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned->vbox),(GtkWidget*)multi_vpaned->focused_pane);
+ gtk_box_pack_end(GTK_BOX(multi_vpaned->vbox),(GtkWidget*)prev,TRUE,TRUE,0);
+ multi_vpaned->first_pane = prev;
+ }else{
+ next = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)multi_vpaned->focused_pane);
+ gtk_container_remove(GTK_CONTAINER(next),(GtkWidget*)multi_vpaned->focused_pane);
+ gtk_paned_pack1(GTK_PANED(next), (GtkWidget*)prev, FALSE,TRUE);
+ }
+ gtk_paned_pack1(GTK_PANED(prev),(GtkWidget*)multi_vpaned->focused_pane, FALSE,TRUE);
+ if(prevPrev)
+ gtk_paned_pack1(GTK_PANED(multi_vpaned->focused_pane),(GtkWidget*)prevPrev, FALSE,TRUE);
+
+ g_object_unref(G_OBJECT(prev));
+ if(prevPrev) g_object_unref(G_OBJECT(prevPrev));
+ g_object_unref(G_OBJECT(multi_vpaned->focused_pane));
+}
+
+
+void gtk_multi_vpaned_widget_move_down(GtkMultiVPaned * multi_vpaned)
+{
+ GtkWidget* upWidget, *downWidget;
+ GtkPaned * prev,*next, *nextNext;
+
+ if(multi_vpaned->first_pane == multi_vpaned->focused_pane) return;
+
+ //move VPane
+ next = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)multi_vpaned->focused_pane);
+ g_object_ref(G_OBJECT(next));
+
+ if(multi_vpaned->last_pane == multi_vpaned->focused_pane){
+ prev = NULL;
+ multi_vpaned->last_pane = next;
+ }else{
+ prev = (GtkPaned*)multi_vpaned->focused_pane->child1;
+ g_object_ref(G_OBJECT(prev));
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned->focused_pane),(GtkWidget*)prev);
+ }
+
+ g_object_ref(G_OBJECT(multi_vpaned->focused_pane));
+ gtk_container_remove(GTK_CONTAINER(next),(GtkWidget*)multi_vpaned->focused_pane);
+
+ if(next == multi_vpaned->first_pane){
+ multi_vpaned->first_pane = multi_vpaned->focused_pane;
+ gtk_container_remove(GTK_CONTAINER(multi_vpaned->vbox),(GtkWidget*)next);
+ gtk_box_pack_end(GTK_BOX(multi_vpaned->vbox),(GtkWidget*)multi_vpaned->focused_pane,TRUE,TRUE,0);
+ }else{
+ nextNext = (GtkPaned*)gtk_widget_get_parent((GtkWidget*)next);
+ gtk_container_remove(GTK_CONTAINER(nextNext),(GtkWidget*)next);
+ gtk_paned_pack1(nextNext, (GtkWidget*)multi_vpaned->focused_pane, FALSE, TRUE);
+ }
+ gtk_paned_pack1(multi_vpaned->focused_pane,(GtkWidget*)next, FALSE,TRUE);
+ if(prev)
+ gtk_paned_pack1(next,(GtkWidget*)prev, FALSE,TRUE);
+
+ if(prev)g_object_unref(G_OBJECT(prev));
+ g_object_unref(G_OBJECT(next));
+ g_object_unref(G_OBJECT(multi_vpaned->focused_pane));
+}
+
+void gtk_multi_vpaned_scroll_value_changed(GtkRange *range, gpointer multi_vpaned_arg)
+{
+ LttTime time;
+ GtkMultiVPaned * multi_vpaned = (GtkMultiVPaned*)multi_vpaned_arg;
+ gdouble value = gtk_range_get_value(range);
+ time = ltt_time_from_double(value / NANOSECONDS_PER_SECOND);
+ set_current_time(multi_vpaned->mw, &time);
+ g_warning("The current time is second :%d, nanosecond : %d\n", time.tv_sec, time.tv_nsec);
+}
+
+
+static void
+gtk_multi_vpaned_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ GtkPaned *paned = GTK_PANED (widget);
+ GtkRequisition child_requisition;
+
+ requisition->width = 0;
+ requisition->height = 0;
+
+ if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
+ {
+ gtk_widget_size_request (paned->child1, &child_requisition);
+
+ requisition->height = child_requisition.height;
+ requisition->width = child_requisition.width;
+ }
+
+ if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
+ {
+ gtk_widget_size_request (paned->child2, &child_requisition);
+
+ requisition->width = MAX (requisition->width, child_requisition.width);
+ requisition->height += child_requisition.height;
+ }
+
+ requisition->height += GTK_CONTAINER (paned)->border_width * 2;
+ requisition->width += GTK_CONTAINER (paned)->border_width * 2;
+
+ if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
+ paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
+ {
+ gint handle_size;
+
+ gtk_widget_style_get (widget, "handle_size", &handle_size, NULL);
+ requisition->height += handle_size;
+ }
+
+}
+
+static void
+gtk_multi_vpaned_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GtkPaned *paned = GTK_PANED (widget);
+ gint border_width = GTK_CONTAINER (paned)->border_width;
+
+ widget->allocation = *allocation;
+
+ if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
+ paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
+ {
+ GtkRequisition child1_requisition;
+ GtkRequisition child2_requisition;
+ GtkAllocation child1_allocation;
+ GtkAllocation child2_allocation;
+ gint handle_size;
+
+ gtk_widget_style_get (widget, "handle_size", &handle_size, NULL);
+
+ gtk_widget_get_child_requisition (paned->child1, &child1_requisition);
+ gtk_widget_get_child_requisition (paned->child2, &child2_requisition);
+
+ gtk_paned_compute_position (paned,
+ MAX (1, widget->allocation.height
+ - handle_size
+ - 2 * border_width),
+ child1_requisition.height,
+ child2_requisition.height);
+
+ paned->handle_pos.x = widget->allocation.x + border_width;
+ paned->handle_pos.y = widget->allocation.y + paned->child1_size + border_width;
+ paned->handle_pos.width = MAX (1, (gint) widget->allocation.width - 2 * border_width);
+ paned->handle_pos.height = handle_size;
+
+ if (GTK_WIDGET_REALIZED (widget))
+ {
+ if (GTK_WIDGET_MAPPED (widget))
+ gdk_window_show (paned->handle);
+ gdk_window_move_resize (paned->handle,
+ paned->handle_pos.x,
+ paned->handle_pos.y,
+ paned->handle_pos.width,
+ handle_size);
+ }
+
+ child1_allocation.width = child2_allocation.width = MAX (1, (gint) allocation->width - border_width * 2);
+ child1_allocation.height = MAX (1, paned->child1_size);
+ child1_allocation.x = child2_allocation.x = widget->allocation.x + border_width;
+ child1_allocation.y = widget->allocation.y + border_width;
+
+ child2_allocation.y = child1_allocation.y + paned->child1_size + paned->handle_pos.height;
+ child2_allocation.height = MAX (1, widget->allocation.y + widget->allocation.height - child2_allocation.y - border_width);
+
+ if (GTK_WIDGET_MAPPED (widget) &&
+ paned->child1->allocation.height < child1_allocation.height)
+ {
+ gtk_widget_size_allocate (paned->child2, &child2_allocation);
+ gtk_widget_size_allocate (paned->child1, &child1_allocation);
+ }
+ else
+ {
+ gtk_widget_size_allocate (paned->child1, &child1_allocation);
+ gtk_widget_size_allocate (paned->child2, &child2_allocation);
+ }
+ }
+ else
+ {
+ GtkAllocation child_allocation;
+
+ if (GTK_WIDGET_REALIZED (widget))
+ gdk_window_hide (paned->handle);
+
+ if (paned->child1)
+ gtk_widget_set_child_visible (paned->child1, TRUE);
+ if (paned->child2)
+ gtk_widget_set_child_visible (paned->child2, TRUE);
+
+ child_allocation.x = widget->allocation.x + border_width;
+ child_allocation.y = widget->allocation.y + border_width;
+ child_allocation.width = MAX (1, allocation->width - 2 * border_width);
+ child_allocation.height = MAX (1, allocation->height - 2 * border_width);
+
+ if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
+ gtk_widget_size_allocate (paned->child1, &child_allocation);
+ else if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
+ gtk_widget_size_allocate (paned->child2, &child_allocation);
+ }
+}
+