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

add function to report zoom in number of bases per line.

parent fc6fd432
No related branches found
No related tags found
No related merge requests found
......@@ -26,9 +26,9 @@
* window displaying genome data.
*
* HISTORY:
* Last edited: Feb 12 15:51 2009 (rds)
* Last edited: Mar 17 14:05 2009 (edgrif)
* Created: Thu Jul 24 15:21:56 2003 (edgrif)
* CVS info: $Id: zmapWindow.h,v 1.101 2009-02-13 10:23:54 rds Exp $
* CVS info: $Id: zmapWindow.h,v 1.102 2009-03-17 15:52:20 edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_WINDOW_H
......@@ -250,6 +250,7 @@ double zMapWindowGetZoomFactor(ZMapWindow window);
double zMapWindowGetZoomMin(ZMapWindow window) ;
double zMapWindowGetZoomMax(ZMapWindow window) ;
double zMapWindowGetZoomMagnification(ZMapWindow window);
double zMapWindowGetZoomMagAsBases(ZMapWindow window) ;
double zMapWindowGetZoomMaxDNAInWrappedColumn(ZMapWindow window);
void zMapWindowZoomToFeature(ZMapWindow window, ZMapFeature feature);
......
......@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Oct 17 09:03 2007 (edgrif)
* Last edited: Mar 17 15:51 2009 (edgrif)
* Created: Fri Jul 8 11:37:39 2005 (rds)
* CVS info: $Id: zmapWindowZoomControl.c,v 1.17 2007-10-17 15:52:47 edgrif Exp $
* CVS info: $Id: zmapWindowZoomControl.c,v 1.18 2009-03-17 15:52:20 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -126,16 +126,49 @@ double zMapWindowGetZoomMax(ZMapWindow window)
double zMapWindowGetZoomMagnification(ZMapWindow window)
{
ZMapWindowZoomControl control = NULL;
double mag;
ZMapWindowZoomControl control = NULL ;
double mag ;
control = controlFromWindow(window) ;
control = controlFromWindow(window);
/* Not sure what this actually needs to be calculating,
* but a ratio might be nice rather than just random numbers */
mag = control->maxZF / control->zF;
mag = control->maxZF / control->zF ;
return mag;
return mag ;
}
double zMapWindowGetZoomMagAsBases(ZMapWindow window)
{
ZMapWindowZoomControl control = NULL ;
double bases ;
control = controlFromWindow(window) ;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
bases = control->zF * control->pix2mmy ;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
bases = control->pix2mmy / control->zF ;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
printf("min/max/curr zoom: %g %g %g\tbases: %g\n", control->minZF, control->maxZF, control->zF, bases) ;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
return bases ;
}
#ifdef RDS_DONT_INCLUDE
PangoFont *zMapWindowGetFixedWidthFont(ZMapWindow window)
{
......@@ -145,6 +178,7 @@ PangoFont *zMapWindowGetFixedWidthFont(ZMapWindow window)
}
#endif
/* Not sure this is right, copy with pango_font_description_copy and merge??? */
PangoFontDescription *zMapWindowZoomGetFixedWidthFontInfo(ZMapWindow window,
double *width_out,
......@@ -212,6 +246,29 @@ ZMapWindowZoomControl zmapWindowZoomControlCreate(ZMapWindow window)
// num_cruncher->max_window_size = (user_set_limit ? user_set_limit : x_windows_limit)
// - ((num_cruncher->border * 2) * num_cruncher->maxZF);
{
GdkScreen *screen ;
double width_pixels, height_pixels, width_mm, height_mm ;
screen = gdk_screen_get_default() ;
width_pixels = (double)gdk_screen_get_width(screen) ;
height_pixels = (double)gdk_screen_get_height(screen) ;
width_mm = (double)gdk_screen_get_width_mm(screen) ;
height_mm = (double)gdk_screen_get_height_mm(screen) ;
num_cruncher->pix2mmy = height_pixels / height_mm ;
num_cruncher->pix2mmx = width_pixels / width_mm ;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
printf("stop here\n") ;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
}
return num_cruncher;
}
......
......@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Oct 17 09:00 2007 (edgrif)
* Last edited: Mar 17 12:21 2009 (edgrif)
* Created: Tue Jul 12 16:02:52 2005 (rds)
* CVS info: $Id: zmapWindowZoomControl_P.h,v 1.8 2007-10-17 15:53:05 edgrif Exp $
* CVS info: $Id: zmapWindowZoomControl_P.h,v 1.9 2009-03-17 15:52:20 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -59,13 +59,18 @@ enum {
typedef struct _ZMapWindowZoomControlStruct
{
ZMapMagic magic;
double zF;
double minZF;
double maxZF;
double textHeight;
double textWidth;
double max_window_size;
double pix2mmy ; /* Convert pixels -> screen mm. */
double pix2mmx ; /* Convert pixels -> screen mm. */
double max_window_size;
int border;
PangoFontDescription *font_desc;
......
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