Skip to content
Snippets Groups Projects
Commit 6ce36ac9 authored by rds's avatar rds
Browse files

Fix setting of values in multiple styles so that zooming and hidden columns work again.

parent 5bb52591
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -29,7 +29,7 @@
* HISTORY:
* Last edited: Jun 15 11:37 2009 (rds)
* Created: Wed Dec 3 10:02:22 2008 (rds)
* CVS info: $Id: zmapWindowContainerGroup.c,v 1.7 2009-06-17 09:46:16 rds Exp $
* CVS info: $Id: zmapWindowContainerGroup.c,v 1.8 2010-01-19 06:29:59 rds Exp $
*-------------------------------------------------------------------
*/
......@@ -47,11 +47,11 @@ enum
CONTAINER_PROP_COLUMN_REDRAW,
};
/*! Simple struct to hold data about update hooks. */
typedef struct
{
ZMapWindowContainerUpdateHook hook_func;
gpointer hook_data;
ZMapWindowContainerUpdateHook hook_func; /*! The function. */
gpointer hook_data; /*! The data passed to the function. */
} ContainerUpdateHookStruct, *ContainerUpdateHook;
......@@ -105,6 +105,12 @@ static FooCanvasGroupClass *group_parent_class_G = NULL;
static FooCanvasItemClass *item_parent_class_G = NULL;
/*!
* \brief Get the GType for the ZMapWindowContainerGroup GObjects
*
* \return GType corresponding to the GObject as registered by glib.
*/
GType zmapWindowContainerGroupGetType(void)
{
static GType group_type = 0;
......@@ -133,6 +139,19 @@ GType zmapWindowContainerGroupGetType(void)
return group_type;
}
/*!
* \brief Create a new ZMapWindowContainerGroup object.
*
* \param parent This is the parent ZMapWindowContainerFeatures
* \param level The level the new ZMapWindowContainerGroup should be.
* \param child_spacing The distance between the children of this container.
* \param fill-colour The colour to use for the background.
* \param border-colour The colour to use for the border.
*
* \return ZMapWindowContainerGroup The new group will be of GType corresponding to the level supplied.
* It will be a ZMapWindowContainerGroup by inheritance though.
*/
ZMapWindowContainerGroup zmapWindowContainerGroupCreate(ZMapWindowContainerFeatures parent,
ZMapContainerLevelType level,
double child_spacing,
......@@ -149,6 +168,19 @@ ZMapWindowContainerGroup zmapWindowContainerGroupCreate(ZMapWindowContainerFeatu
return container;
}
/*!
* \brief Create a new ZMapWindowContainerGroup object.
*
* \param parent This is the parent FooCanvasGroup.
* \param level The level the new ZMapWindowContainerGroup should be.
* \param child_spacing The distance between the children of this container.
* \param fill-colour The colour to use for the background.
* \param border-colour The colour to use for the border.
*
* \return ZMapWindowContainerGroup The new group will be of GType corresponding to the level supplied.
* It will be a ZMapWindowContainerGroup by inheritance though.
*/
ZMapWindowContainerGroup zmapWindowContainerGroupCreateFromFoo(FooCanvasGroup *parent,
ZMapContainerLevelType level,
double child_spacing,
......@@ -234,18 +266,24 @@ ZMapWindowContainerGroup zmapWindowContainerGroupCreateFromFoo(FooCanvasGroup
return container;
}
/*!
* \brief Set the visibility of a whole ZMapWindowContainerGroup.
*
* \param container_parent A FooCanvasGroup which _must_ be a ZMapWindowContainerGroup.
* \param visible A boolean to specify visibility. TRUE = visible, FALSE = hidden.
*
* \return boolean set to TRUE if visiblity could be set.
*/
/* Currently this function only works with columns, but the intention
* is that it could work with blocks and aligns too at some later
* point in time... */
gboolean zmapWindowContainerSetVisibility(FooCanvasGroup *container_parent, gboolean visible)
{
gboolean setable = FALSE; /* Most columns aren't */
/* We make sure that the container_parent is
* - A parent
* - Is a featureset... This is probably a limit too far.
*/
/* Currently this function only works with columns, but the intention
* is that it could work with blocks and aligns too at some later
* point in time... THIS ISN'T TRUE. ANY ZMapWindowContainerGroup WILL WORK. */
/* Check this is a container group. Any FooCanvasGroup could be passed. */
if(ZMAP_IS_CONTAINER_GROUP(container_parent))
{
if(visible)
......@@ -259,6 +297,15 @@ gboolean zmapWindowContainerSetVisibility(FooCanvasGroup *container_parent, gboo
return setable ;
}
/*!
* \brief Set flag for the next update/draw cycle in the FooCanvas.
* When the flag is set the container code will do extra calculation
* to determine new positions.
*
* \param container Any container. The code finds the root container.
* \return void
*/
void zmapWindowContainerRequestReposition(ZMapWindowContainerGroup container)
{
ZMapWindowContainerGroup context_container;
......@@ -275,6 +322,16 @@ void zmapWindowContainerRequestReposition(ZMapWindowContainerGroup container)
return ;
}
/*!
* \brief Simple, Set the vertical dimension for the background of the container.
*
* \param container The container that needs its size set.
* \param height The height the container needs to be.
*
* \return void
*/
void zmapWindowContainerGroupBackgroundSize(ZMapWindowContainerGroup container, double height)
{
container->height = height;
......@@ -282,6 +339,16 @@ void zmapWindowContainerGroupBackgroundSize(ZMapWindowContainerGroup container,
return ;
}
/*!
* \brief A ZMapWindowContainerGroup may need to redraw it's children.
* This sets a flag so that it happens
*
* \param container The container that needs its flag set.
* \param flag TRUE = redraw required, FALSE = no redraw necessary
*
* \return void
*/
void zmapWindowContainerGroupChildRedrawRequired(ZMapWindowContainerGroup container,
gboolean redraw_required)
{
......@@ -290,6 +357,15 @@ void zmapWindowContainerGroupChildRedrawRequired(ZMapWindowContainerGroup contai
return ;
}
/*!
* \brief Simple, Set the background colour of the container.
*
* \param container The container that needs its colour set.
* \param colour The colour the container needs to be.
*
* \return void
*/
void zmapWindowContainerGroupSetBackgroundColour(ZMapWindowContainerGroup container,
GdkColor *new_colour)
{
......@@ -301,6 +377,14 @@ void zmapWindowContainerGroupSetBackgroundColour(ZMapWindowContainerGroup contai
return ;
}
/*!
* \brief Simple, Reset the background colour of the container.
*
* \param container The container that needs its colour reset.
*
* \return void
*/
void zmapWindowContainerGroupResetBackgroundColour(ZMapWindowContainerGroup container)
{
ZMapWindowContainerBackground background;
......@@ -357,6 +441,22 @@ void zmapWindowContainerGroupRemovePreUpdateHook(ZMapWindowContainerGroup contai
}
#endif /* NOT_IMPLEMENTED */
/*!
* \brief Add an update hook to the ZMapWindowContainerGroup
*
* Internally the containers hold a list of these hook which get
* called every time the container gets drawn. This can be done
* on a per container basis, rather than across all containers.
* In terms of utility and use case the block marking and navigator
* are users of this.
*
* \param container The container that needs an update hook.
* \param hook This must be a ZMapWindowContainerUpdateHook.
* \param hook-data The data that will be passed to the hook
*
* \return void
*/
void zmapWindowContainerGroupAddUpdateHook(ZMapWindowContainerGroup container,
ZMapWindowContainerUpdateHook hook,
gpointer user_data)
......@@ -375,6 +475,19 @@ void zmapWindowContainerGroupAddUpdateHook(ZMapWindowContainerGroup container,
return ;
}
/*!
* \brief Remove an update hook on a ZMapWindowContainerGroup.
*
* Exactly the opposite of Add. Both the hook and the data are required
* to successfully remove the hook.
*
* \param container The container that needs an update hook removing.
* \param hook The hook that was added.
* \param hook-data The data that was added.
*
* \return void
*/
void zmapWindowContainerGroupRemoveUpdateHook(ZMapWindowContainerGroup container,
ZMapWindowContainerUpdateHook hook,
gpointer user_data)
......@@ -394,6 +507,15 @@ void zmapWindowContainerGroupRemoveUpdateHook(ZMapWindowContainerGroup container
}
}
/*!
* \brief Time to free the memory associated with the ZMapWindowContainerGroup.
*
* \code container = zmapWindowContainerGroupDestroy(container);
*
* \param container The container to be free'd
*
* \return The container that has been free'd. i.e. NULL
*/
ZMapWindowContainerGroup zmapWindowContainerGroupDestroy(ZMapWindowContainerGroup container)
{
......@@ -1160,6 +1282,7 @@ static void zmap_window_container_group_update (FooCanvasItem *item, double i2w_
return ;
}
static void zmap_window_container_group_reposition(ZMapWindowContainerGroup container_group,
double rect_x1, double rect_y1,
double rect_x2, double rect_y2,
......@@ -1181,7 +1304,7 @@ static void zmap_window_container_group_reposition(ZMapWindowContainerGroup cont
}
/* helper to zmapWindowContainerGroupRemoveUpdateHook() */
static gint find_update_hook_cb(gconstpointer list_data, gconstpointer query_data)
{
ContainerUpdateHook current, query;
......
......@@ -29,7 +29,7 @@
* HISTORY:
* Last edited: Jun 4 14:57 2009 (rds)
* Created: Wed Dec 3 08:21:03 2008 (rds)
* CVS info: $Id: zmapWindowContainerGroup.h,v 1.4 2009-06-05 13:18:05 rds Exp $
* CVS info: $Id: zmapWindowContainerGroup.h,v 1.5 2010-01-19 06:30:00 rds Exp $
*-------------------------------------------------------------------
*/
......@@ -43,7 +43,8 @@
/* ZMapWindowContainerGroup for containing and positioning of canvas items.
/*!
* ZMapWindowContainerGroup for containing and positioning of canvas items.
* Each ZMapWindowContainerGroup consists of:
*
* parent_group
......
......@@ -28,7 +28,7 @@
* HISTORY:
* Last edited: Jan 13 15:59 2010 (edgrif)
* Created: Thu Jul 24 14:36:27 2003 (edgrif)
* CVS info: $Id: zmapWindow.c,v 1.300 2010-01-14 09:02:59 edgrif Exp $
* CVS info: $Id: zmapWindow.c,v 1.301 2010-01-19 06:29:57 rds Exp $
*-------------------------------------------------------------------
*/
......@@ -4658,7 +4658,7 @@ static char *makePrimarySelectionText(ZMapWindow window, FooCanvasItem *highligh
item = FOO_CANVAS_ITEM(selected->data) ;
if (ZMAP_IS_CANVAS_ITEM(item))
canvas_item = item ;
canvas_item = ZMAP_CANVAS_ITEM( item );
else
canvas_item = zMapWindowCanvasItemIntervalGetTopLevelObject(item) ;
item_feature = zmapWindowItemGetFeature(canvas_item) ;
......@@ -4692,7 +4692,7 @@ static char *makePrimarySelectionText(ZMapWindow window, FooCanvasItem *highligh
{
item = FOO_CANVAS_ITEM(selected->data) ;
if (ZMAP_IS_CANVAS_ITEM(item))
canvas_item = item ;
canvas_item = ZMAP_CANVAS_ITEM( item );
else
canvas_item = zMapWindowCanvasItemIntervalGetTopLevelObject(item) ;
item_feature = zmapWindowItemGetFeature(canvas_item) ;
......
......@@ -30,7 +30,7 @@
* HISTORY:
* Last edited: Sep 18 13:22 2009 (edgrif)
* Created: Thu Sep 8 10:34:49 2005 (edgrif)
* CVS info: $Id: zmapWindowDraw.c,v 1.113 2009-09-24 13:17:30 edgrif Exp $
* CVS info: $Id: zmapWindowDraw.c,v 1.114 2010-01-19 06:29:58 rds Exp $
*-------------------------------------------------------------------
*/
......@@ -278,12 +278,12 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group,
if (mag_visible && frame_visible)
{
zmapWindowColumnShow(column_group);
zmapWindowContainerSetVisibility(column_group, TRUE) ;
redraw = TRUE;
}
else if (!mag_visible || !frame_visible)
{
zmapWindowColumnHide(column_group);
zmapWindowContainerSetVisibility(column_group, FALSE) ;
redraw = TRUE;
}
......@@ -293,13 +293,13 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group,
if ((curr_col_state == ZMAPSTYLE_COLDISPLAY_HIDE || curr_col_state == ZMAPSTYLE_COLDISPLAY_SHOW_HIDE)
&& mag_visible && frame_visible)
{
zmapWindowColumnShow(column_group) ;
zmapWindowContainerSetVisibility(column_group, TRUE) ;
redraw = TRUE ;
}
else if ((curr_col_state == ZMAPSTYLE_COLDISPLAY_SHOW || curr_col_state == ZMAPSTYLE_COLDISPLAY_SHOW_HIDE)
&& (!mag_visible || !frame_visible))
{
zmapWindowColumnHide(column_group) ;
zmapWindowContainerSetVisibility(column_group, FALSE) ;
redraw = TRUE ;
}
......@@ -357,14 +357,14 @@ void zmapWindowColumnSetMagState(ZMapWindow window, FooCanvasGroup *col_group)
#ifdef DEBUG_COLUMN_MAG
printf("Column '%s' being shown\n", g_quark_to_string(container->unique_id));
#endif /* DEBUG_COLUMN_MAG */
zmapWindowColumnShow(col_group) ;
zmapWindowContainerSetVisibility(FOO_CANVAS_GROUP( container ), TRUE) ;
}
else
{
#ifdef DEBUG_COLUMN_MAG
printf("Column '%s' being hidden\n", g_quark_to_string(container->unique_id));
#endif /* DEBUG_COLUMN_MAG */
zmapWindowColumnHide(col_group) ;
zmapWindowContainerSetVisibility(FOO_CANVAS_GROUP( container ), FALSE) ;
}
}
......@@ -1099,8 +1099,7 @@ static void hideColsCB(ZMapWindowContainerGroup container, FooCanvasPoints *poin
|| zmapWindowContainerFeatureSetGetDisplay((ZMapWindowContainerFeatureSet)container) != ZMAPSTYLE_COLDISPLAY_SHOW))
{
/* No items overlap with given area so hide the column completely. */
zmapWindowColumnHide((FooCanvasGroup *)container) ;
zmapWindowContainerSetVisibility(FOO_CANVAS_GROUP( container ), FALSE) ;
zmapWindowContainerBlockAddCompressedColumn((ZMapWindowContainerBlock)(coord_data->block_group), (FooCanvasGroup *)container);
}
......@@ -1184,10 +1183,15 @@ static void featureInViewCB(void *data, void *user_data)
static void showColsCB(void *data, void *user_data_unused)
{
FooCanvasGroup *col_group = (FooCanvasGroup *)data ;
ZMapWindowContainerFeatureSet container;
/* This is called from the Compress Columns code, which _is_ a user
* action. */
zmapWindowColumnShow(col_group) ;
if(ZMAP_IS_CONTAINER_FEATURESET(col_group))
{
container = ZMAP_CONTAINER_FEATURESET(col_group);
/* This is called from the Compress Columns code, which _is_ a user
* action. */
zmapWindowContainerSetVisibility(FOO_CANVAS_GROUP( container ), TRUE) ;
}
return ;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment