Skip to content
Snippets Groups Projects
Commit f43b3bab authored by edgrif's avatar edgrif
Browse files

make the window navigator scroll bar only appear when needed.

parent 74f0f45d
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,9 @@
* Description: External interface to the Navigator for sequence views.
*
* HISTORY:
* Last edited: Jan 20 16:58 2005 (edgrif)
* Last edited: Feb 22 13:44 2006 (edgrif)
* Created: Fri Jan 7 14:38:22 2005 (edgrif)
* CVS info: $Id: zmapNavigator.h,v 1.2 2005-01-24 11:27:03 edgrif Exp $
* CVS info: $Id: zmapNavigator.h,v 1.3 2006-02-22 15:02:02 edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_NAVIGATOR_H
......@@ -45,7 +45,7 @@ typedef void (*ZMapNavigatorScrollValue)(void *user_data, double start, double e
ZMapNavigator zMapNavigatorCreate(GtkWidget **top_widg_out) ;
void zMapNavigatorSetWindowCallback(ZMapNavigator navigator,
ZMapNavigatorScrollValue cb_func, void *user_data) ;
void zMapNavigatorSetWindowPos(ZMapNavigator navigator, double top_pos, double bot_pos) ;
int zMapNavigatorSetWindowPos(ZMapNavigator navigator, double top_pos, double bot_pos) ;
void zMapNavigatorSetView(ZMapNavigator navigator, ZMapFeatureContext features,
double top, double bottom) ;
void zMapNavigatorDestroy(ZMapNavigator navigator) ;
......
......@@ -26,9 +26,9 @@
* the window code and the threaded server code.
* Exported functions: See ZMap.h
* HISTORY:
* Last edited: Feb 20 17:30 2006 (edgrif)
* Last edited: Feb 22 14:49 2006 (edgrif)
* Created: Thu Jul 24 16:06:44 2003 (edgrif)
* CVS info: $Id: zmapControl.c,v 1.58 2006-02-21 15:13:14 edgrif Exp $
* CVS info: $Id: zmapControl.c,v 1.59 2006-02-22 15:02:03 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -355,7 +355,6 @@ void zmapControlClose(ZMap zmap)
void zmapControlWindowSetGUIState(ZMap zmap)
{
......@@ -372,19 +371,23 @@ void zmapControlWindowSetGUIState(ZMap zmap)
/* This function sets the button status and other bits of the GUI for a particular view/window. */
void zmapControlSetGUIVisChange(ZMap zmap, ZMapWindowVisibilityChange vis_change)
{
int pane_width ;
/* There is replication here so need to deal with that.... */
zmapControlWindowSetButtonState(zmap) ;
zmapControlWindowSetZoomButtons(zmap, vis_change->zoom_status) ;
zmapControlWindowSetStatus(zmap) ;
/* If the user has zoomed in so far that we cannot show the whole sequence in one window
* then open the pane that shows the window navigator scroll bar. */
pane_width = zMapNavigatorSetWindowPos(zmap->navigator,
vis_change->scrollable_top, vis_change->scrollable_bot) ;
gtk_paned_set_position(GTK_PANED(zmap->hpane), pane_width) ;
zMapNavigatorSetWindowPos(zmap->navigator,
vis_change->scrollable_top, vis_change->scrollable_bot) ;
return ;
}
......
......@@ -29,9 +29,9 @@
*
* Exported functions: See zmapControl_P.h
* HISTORY:
* Last edited: Feb 1 09:38 2005 (edgrif)
* Last edited: Feb 22 14:48 2006 (edgrif)
* Created: Thu Jul 8 12:54:27 2004 (edgrif)
* CVS info: $Id: zmapControlNavigator.c,v 1.23 2005-02-02 11:03:49 edgrif Exp $
* CVS info: $Id: zmapControlNavigator.c,v 1.24 2006-02-22 15:02:03 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -61,8 +61,11 @@ ZMapNavigator zMapNavigatorCreate(GtkWidget **top_widg_out)
navigator = g_new0(ZMapNavStruct, 1);
pane = gtk_hpaned_new() ;
navigator->pane = pane = gtk_hpaned_new() ;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
gtk_widget_set_size_request(pane, 100, -1) ;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
/* Construct the region locator. */
......@@ -140,18 +143,40 @@ void zMapNavigatorSetWindowCallback(ZMapNavigator navigator,
}
void zMapNavigatorSetWindowPos(ZMapNavigator navigator, double top_pos, double bot_pos)
/* Set the window adjuster to match the Max Window size of the underlying canvas. This is needed
* because with a long sequence it is not possible to zoom the whole sequence down to the level
* of bases without exceeding the maximum window size of X Windows.
* We need to watch for when the scroll bar shrinks and at this point open the window
* slider so the user sees it.....then they can use this to navigate when we can't show the whole
* sequence in one window.
* Returns an integer which is the width in pixels of the window scrollbar. */
int zMapNavigatorSetWindowPos(ZMapNavigator navigator, double top_pos, double bot_pos)
{
GtkObject *window_adjuster ;
int pane_width = 0 ;
GtkAdjustment *window_adjuster ;
enum {PANED_WINDOW_GUTTER_SIZE = 10} ; /* There is no simple way to get this. */
window_adjuster = (GtkObject *)gtk_range_get_adjustment(GTK_RANGE(navigator->wind_scroll)) ;
/* Set the new scrollbar size. */
window_adjuster = (GtkAdjustment *)gtk_range_get_adjustment(GTK_RANGE(navigator->wind_scroll)) ;
GTK_ADJUSTMENT(window_adjuster)->value = top_pos ;
GTK_ADJUSTMENT(window_adjuster)->page_size = (gdouble)(fabs(bot_pos - top_pos) + 1) ;
window_adjuster->value = top_pos ;
window_adjuster->page_size = (gdouble)(fabs(bot_pos - top_pos) + 1) ;
gtk_adjustment_changed(GTK_ADJUSTMENT(window_adjuster)) ;
gtk_adjustment_changed(window_adjuster) ;
return ;
/* find out if page_size is smaller than max pane size....if so then return width of window
navigator box, otherwise return 0 so the window navigator will not be visible. */
if (window_adjuster->page_size < (window_adjuster->upper - window_adjuster->lower + 1))
{
GtkRequisition box_size ;
gtk_widget_size_request(GTK_WIDGET(navigator->wind_vbox), &box_size) ;
pane_width = box_size.width + PANED_WINDOW_GUTTER_SIZE ;
}
return pane_width ;
}
......
......@@ -25,9 +25,9 @@
* Description:
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Jan 20 16:23 2005 (edgrif)
* Last edited: Feb 21 15:43 2006 (edgrif)
* Created: Thu Apr 29 11:06:06 2004 (edgrif)
* CVS info: $Id: zmapControlWindowFrame.c,v 1.16 2005-01-24 11:34:44 edgrif Exp $
* CVS info: $Id: zmapControlWindowFrame.c,v 1.17 2006-02-22 15:02:03 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -81,6 +81,11 @@ static void createNavViewWindow(ZMap zmap, GtkWidget *parent)
gtk_paned_pack2(GTK_PANED(zmap->hpane),
zmap->pane_vbox, TRUE, TRUE);
/* Set left hand (sliders) pane closed by default. */
gtk_paned_set_position(GTK_PANED(zmap->hpane), 0) ;
gtk_widget_show_all(zmap->hpane);
return ;
......
......@@ -26,9 +26,9 @@
* positional information for sequences.
*
* HISTORY:
* Last edited: Jan 20 16:35 2005 (edgrif)
* Last edited: Feb 22 13:42 2006 (edgrif)
* Created: Fri Jan 7 13:50:33 2005 (edgrif)
* CVS info: $Id: zmapNavigator_P.h,v 1.1 2005-02-02 14:51:07 edgrif Exp $
* CVS info: $Id: zmapNavigator_P.h,v 1.2 2006-02-22 15:02:03 edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_NAVIGATOR_P_H
......@@ -46,6 +46,7 @@ typedef struct _ZMapNavStruct
/* The region locator showing the position/extent of this sequence region
* within the total sequence. */
GtkWidget *pane ;
GtkWidget *navVBox ;
GtkWidget *navVScroll ;
GtkWidget *topLabel ;
......
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