Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
c8977896
Commit
c8977896
authored
20 years ago
by
rnc
Browse files
Options
Downloads
Patches
Plain Diff
Moved pane-splitting code to zmapControl
parent
3b82621a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/zmapWindow/zmapWindow.c
+13
-358
13 additions, 358 deletions
src/zmapWindow/zmapWindow.c
with
13 additions
and
358 deletions
src/zmapWindow/zmapWindow.c
+
13
−
358
View file @
c8977896
...
...
@@ -28,28 +28,18 @@
*
* Exported functions: See ZMap/zmapWindow.h
* HISTORY:
* Last edited: Ju
n 30
1
5
:4
7
2004 (
edgrif
)
* Last edited: Ju
l 2
1
4
:4
2
2004 (
rnc
)
* Created: Thu Jul 24 14:36:27 2003 (edgrif)
* CVS info: $Id: zmapWindow.c,v 1.1
3
2004-07-0
1 09:26:25 edgrif
Exp $
* CVS info: $Id: zmapWindow.c,v 1.1
4
2004-07-0
2 13:52:14 rnc
Exp $
*-------------------------------------------------------------------
*/
#include
<string.h>
#include
<glib.h>
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
#include
<../acedb/regular.h>
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
#include
<ZMap/zmapUtils.h>
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
#include
<ZMap/zmapcommon.h>
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
#include
<ZMap/zmapFeature.h>
#include
<zmapWindow_P.h>
#include
<zmap
control.c
>
#include
<zmap
Draw.h
>
static
void
dataEventCB
(
GtkWidget
*
widget
,
GdkEventClient
*
event
,
gpointer
data
)
;
...
...
@@ -189,11 +179,11 @@ static void dataEventCB(GtkWidget *widget, GdkEventClient *event, gpointer cb_da
/* Can either get data from my dummied up GFF routine or if you set up an acedb server
* you can get data from there.... just undef the one you want... */
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
//
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
feature_context
=
testGetGFF
()
;
/* Data read from a file... */
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
//
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
feature_context
=
(
ZMapFeatureContext
)
data
;
/* Data from a server... */
//
feature_context = (ZMapFeatureContext)data ; /* Data from a server... */
/* ****Remember that someone needs to free the data passed over....**** */
...
...
@@ -201,7 +191,7 @@ static void dataEventCB(GtkWidget *widget, GdkEventClient *event, gpointer cb_da
/* <<<<<<<<<<<<< ROB, this is where calls to your drawing code need to go >>>>>>>>>>>> */
zmapWindowDrawFeatures
(
window
,
feature_context
);
g_free
(
window_data
)
;
/* Free the WindowData struct. */
...
...
@@ -299,13 +289,6 @@ void zMapWindowSetHandle(ZMapWindow window)
void
zMapWindowCreateRegion
(
ZMapWindow
window
)
{
window
->
focuspane
->
zMapRegion
=
(
ZMapRegion
*
)
malloc
(
sizeof
(
ZMapRegion
));
return
;
}
GNode
*
zMapWindowGetPanesTree
(
ZMapWindow
window
)
{
return
window
->
panesTree
;
...
...
@@ -339,40 +322,6 @@ void zMapWindowSetFocuspane(ZMapWindow window, ZMapPane pane)
return
;
}
int
zMapWindowGetHeight
(
ZMapWindow
window
)
{
return
window
->
focuspane
->
graphHeight
;
}
int
zMapWindowGetRegionLength
(
ZMapWindow
window
)
{
return
window
->
focuspane
->
zMapRegion
->
length
;
}
Coord
zMapWindowGetRegionArea
(
ZMapWindow
window
,
int
num
)
{
if
(
num
==
1
)
return
window
->
focuspane
->
zMapRegion
->
area1
;
else
return
window
->
focuspane
->
zMapRegion
->
area2
;
}
void
zMapWindowSetRegionArea
(
ZMapWindow
window
,
Coord
area
,
int
num
)
{
if
(
num
==
1
)
window
->
focuspane
->
zMapRegion
->
area1
=
area
;
else
window
->
focuspane
->
zMapRegion
->
area2
=
area
;
return
;
}
gboolean
zMapWindowGetRegionReverse
(
ZMapWindow
window
)
{
return
window
->
focuspane
->
zMapRegion
->
rootIsReverse
;
}
GtkWidget
*
zMapWindowGetHbox
(
ZMapWindow
window
)
{
return
window
->
hbox
;
...
...
@@ -452,15 +401,15 @@ void zMapWindowSetNavCanvas(ZMapWindow window, FooCanvas *navcanvas)
return
;
}
GtkWidget
*
zMapWindowGet
Zoom
Vbox
(
ZMapWindow
window
)
GtkWidget
*
zMapWindowGet
Display
Vbox
(
ZMapWindow
window
)
{
return
window
->
zoom
vbox
;
return
window
->
display
vbox
;
}
void
zMapWindowSet
Zoom
Vbox
(
ZMapWindow
window
,
GtkWidget
*
vbox
)
void
zMapWindowSet
Display
Vbox
(
ZMapWindow
window
,
GtkWidget
*
vbox
)
{
window
->
zoom
vbox
=
vbox
;
window
->
display
vbox
=
vbox
;
return
;
}
...
...
@@ -486,6 +435,7 @@ Coord zMapWindowGetCoord(ZMapWindow window, char *field)
return
window
->
navEnd
;
}
/***************** commenting out until I know what we really need
void zMapWindowSetCoord(ZMapWindow window, char *field, int size)
{
if (field == "s")
...
...
@@ -516,12 +466,7 @@ ScreenCoord zMapWindowGetScreenCoord(ZMapWindow window, Coord coord, int height)
return height * (coord - window->navStart) / (window->navEnd - window->navStart);
}
int
zMapWindowGetRegionSize
(
ZMapWindow
window
)
{
return
window
->
focuspane
->
zMapRegion
->
area2
-
window
->
focuspane
->
zMapRegion
->
area1
;
}
******************* end of commented out code */
InvarCoord
zMapWindowGetOrigin
(
ZMapWindow
window
)
{
...
...
@@ -587,294 +532,4 @@ void zMapRegionFreeDNA(ZMapRegion *region)
}
// ZMapPane functions
void
zMapPaneNewBox2Col
(
ZMapPane
pane
,
int
elements
)
{
pane
->
box2col
=
g_array_sized_new
(
FALSE
,
TRUE
,
sizeof
(
ZMapColumn
),
elements
);
return
;
}
GArray
*
zMapPaneSetBox2Col
(
ZMapPane
pane
,
ZMapColumn
*
col
,
int
index
)
{
return
g_array_insert_val
(
pane
->
box2col
,
index
,
col
);
}
ZMapColumn
*
zMapPaneGetBox2Col
(
ZMapPane
pane
,
int
index
)
{
return
&
g_array_index
(
pane
->
box2col
,
ZMapColumn
,
index
);
}
void
zMapPaneFreeBox2Col
(
ZMapPane
pane
)
{
if
(
pane
->
box2col
)
g_array_free
(
pane
->
box2col
,
TRUE
);
return
;
}
void
zMapPaneNewBox2Seg
(
ZMapPane
pane
,
int
elements
)
{
pane
->
box2seg
=
g_array_sized_new
(
FALSE
,
TRUE
,
sizeof
(
ZMapFeatureStruct
),
elements
);
return
;
}
GArray
*
zMapPaneSetBox2Seg
(
ZMapPane
pane
,
ZMapColumn
*
seg
,
int
index
)
{
return
g_array_insert_val
(
pane
->
box2seg
,
index
,
seg
);
}
ZMapFeature
zMapPaneGetBox2Seg
(
ZMapPane
pane
,
int
index
)
{
return
&
g_array_index
(
pane
->
box2seg
,
ZMapFeatureStruct
,
index
);
}
void
zMapPaneFreeBox2Seg
(
ZMapPane
pane
)
{
if
(
pane
->
box2seg
)
g_array_free
(
pane
->
box2seg
,
TRUE
);
return
;
}
ZMapRegion
*
zMapPaneGetZMapRegion
(
ZMapPane
pane
)
{
return
pane
->
zMapRegion
;
}
FooCanvasItem
*
zMapPaneGetGroup
(
ZMapPane
pane
)
{
return
pane
->
group
;
}
ZMapWindow
zMapPaneGetZMapWindow
(
ZMapPane
pane
)
{
return
pane
->
window
;
}
FooCanvas
*
zMapPaneGetCanvas
(
ZMapPane
pane
)
{
return
pane
->
canvas
;
}
GPtrArray
*
zMapPaneGetCols
(
ZMapPane
pane
)
{
return
&
pane
->
cols
;
}
int
zMapPaneGetDNAwidth
(
ZMapPane
pane
)
{
return
pane
->
DNAwidth
;
}
void
zMapPaneSetDNAwidth
(
ZMapPane
pane
,
int
width
)
{
pane
->
DNAwidth
=
100
;
return
;
}
void
zMapPaneSetStepInc
(
ZMapPane
pane
,
int
incr
)
{
pane
->
step_increment
=
incr
;
return
;
}
int
zMapPaneGetHeight
(
ZMapPane
pane
)
{
return
pane
->
graphHeight
;
}
InvarCoord
zMapPaneGetCentre
(
ZMapPane
pane
)
{
return
pane
->
centre
;
}
float
zMapPaneGetBPL
(
ZMapPane
pane
)
{
return
pane
->
basesPerLine
;
}
/* addPane is called each time we add a new pane. Creates a new frame, scrolled
* window and canvas. First time through it sticks them in the window->zoomvbox,
* thereafter it packs them into the lower part of the focus pane.
*
* Splitting goes like this: we make a (h or v) pane, add a new frame to the child1
* position of that, then reparent the scrolled window containing the canvas into
* the new frame. That's the shrinkPane() function.
* Then in addPane we add a new frame in the child2 position, and into that we
* load a new scrolled window and canvas.
*/
void
addPane
(
ZMapWindow
window
,
char
orientation
)
{
ZMapPane
pane
=
(
ZMapPane
)
malloc
(
sizeof
(
ZMapPaneStruct
));
GtkAdjustment
*
adj
;
GtkWidget
*
w
;
GNode
*
node
=
NULL
;
/* set up ZMapPane for this window */
pane
->
window
=
window
;
pane
->
DNAwidth
=
100
;
pane
->
step_increment
=
10
;
/* create the bare graph & convert to a widget */
/* pane->graph = graphNakedCreate(TEXT_FIT, "", 20, 100, TRUE);
pane->graphWidget = gexGraph2Widget(pane->graph);*/
// pane->cols = arrayHandleCreate(50, ZMapColumn, zMapWindowGetHandle(window));
// pane->cols = arrayCreate(50, ZMapColumn);
pane
->
box2col
=
g_array_sized_new
(
FALSE
,
TRUE
,
sizeof
(
ZMapColumn
),
50
);
// pane->box2col = NULL;
// pane->box2seg = NULL;
// pane->drawHandle = NULL;
pane
->
frame
=
gtk_frame_new
(
NULL
);
pane
->
scrolledWindow
=
gtk_scrolled_window_new
(
NULL
,
NULL
);
/* The idea of the GNode tree is that panes split horizontally, ie
* one above the other, end up as siblings in the tree, while panes
* split vertically (side by side) are parents/children. In theory
* this enables us to get the sizing right. In practice it's not
* perfect yet.*/
if
(
zMapWindowGetFirstTime
(
window
))
{
pane
->
zoomFactor
=
1
;
g_node_append_data
(
zMapWindowGetPanesTree
(
window
),
pane
);
}
else
{
pane
->
zoomFactor
=
zMapWindowGetFocuspane
(
window
)
->
zoomFactor
;
node
=
g_node_find
(
zMapWindowGetPanesTree
(
window
),
G_IN_ORDER
,
G_TRAVERSE_ALL
,
zMapWindowGetFocuspane
(
window
));
if
(
orientation
==
'h'
)
g_node_append_data
(
node
->
parent
,
pane
);
else
g_node_append_data
(
node
,
pane
);
}
/* draw the canvas */
gdk_rgb_init
();
w
=
foo_canvas_new
();
pane
->
canvas
=
FOO_CANVAS
(
w
);
foo_canvas_set_scroll_region
(
pane
->
canvas
,
0
.
0
,
0
.
0
,
1000
,
1000
);
pane
->
background
=
foo_canvas_item_new
(
foo_canvas_root
(
pane
->
canvas
),
foo_canvas_rect_get_type
(),
"x1"
,(
double
)
0
,
"y1"
,(
double
)
0
,
"x2"
,(
double
)
1000
,
"y2"
,(
double
)
1000
,
"fill_color"
,
"white"
,
"outline_color"
,
"dark gray"
,
NULL
);
/* when the user clicks a button in the view, call recordFocus() */
g_signal_connect
(
GTK_OBJECT
(
pane
->
canvas
),
"button_press_event"
,
GTK_SIGNAL_FUNC
(
recordFocus
),
pane
);
pane
->
group
=
foo_canvas_item_new
(
foo_canvas_root
(
pane
->
canvas
),
foo_canvas_group_get_type
(),
"x"
,
(
double
)
100
,
"y"
,
(
double
)
100
,
NULL
);
/* add the canvas to the scrolled window */
gtk_container_add
(
GTK_CONTAINER
(
pane
->
scrolledWindow
),
w
);
/* you have to set the step_increment manually or the scrollbar arrows don't work.*/
/* Using a member of ZMapPane means I can adjust it if necessary when we zoom. */
GTK_LAYOUT
(
w
)
->
vadjustment
->
step_increment
=
pane
->
step_increment
;
GTK_LAYOUT
(
w
)
->
hadjustment
->
step_increment
=
pane
->
step_increment
;
/* add the scrolled window to the frame */
gtk_container_add
(
GTK_CONTAINER
(
pane
->
frame
),
pane
->
scrolledWindow
);
/* First time through, we add the frame to the main vbox.
* Subsequently it goes in the lower half of the current pane. */
if
(
zMapWindowGetFirstTime
(
window
))
gtk_box_pack_start
(
GTK_BOX
(
zMapWindowGetZoomVbox
(
window
)),
pane
->
frame
,
TRUE
,
TRUE
,
0
);
else
gtk_paned_pack2
(
GTK_PANED
(
zMapWindowGetFocuspane
(
window
)
->
pane
),
pane
->
frame
,
TRUE
,
TRUE
);
/* always show scrollbars, however big the display */
gtk_scrolled_window_set_policy
(
GTK_SCROLLED_WINDOW
(
pane
->
scrolledWindow
),
GTK_POLICY_ALWAYS
,
GTK_POLICY_ALWAYS
);
adj
=
gtk_scrolled_window_get_vadjustment
(
GTK_SCROLLED_WINDOW
(
pane
->
scrolledWindow
));
// g_signal_connect(GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(navUpdate), (gpointer)(pane));
// g_signal_connect(GTK_OBJECT(adj), "changed", GTK_SIGNAL_FUNC(navChange), (gpointer)(pane));
/* focus on the new pane */
recordFocus
(
NULL
,
NULL
,
pane
);
gtk_widget_grab_focus
(
pane
->
frame
);
/* if we do this first time, a little blank box appears before the main display */
if
(
!
zMapWindowGetFirstTime
(
window
))
gtk_widget_show_all
(
zMapWindowGetFrame
(
window
));
zMapWindowSetFirstTime
(
window
,
FALSE
);
zmMainScale
(
pane
->
canvas
,
30
,
0
,
1000
);
return
;
}
void
drawNavigatorWind
(
ZMapPane
pane
)
{
ZMapWindow
window
=
pane
->
window
;
int
height
;
Coord
startWind
,
endWind
;
ScreenCoord
startWindf
,
endWindf
,
lenWindf
;
ScreenCoord
startScreenf
,
endScreenf
;
ScreenCoord
pos
;
GtkAdjustment
*
adj
=
gtk_scrolled_window_get_vadjustment
(
GTK_SCROLLED_WINDOW
(
pane
->
scrolledWindow
));
// graphFitBounds(NULL, &height);
startWind
=
zmCoordFromScreen
(
pane
,
0
);
endWind
=
zmCoordFromScreen
(
pane
,
pane
->
graphHeight
);
startWindf
=
zMapWindowGetScreenCoord
(
window
,
startWind
,
height
);
endWindf
=
zMapWindowGetScreenCoord
(
window
,
endWind
,
height
);
lenWindf
=
endWindf
-
startWindf
;
startScreenf
=
startWindf
+
lenWindf
*
(
adj
->
value
-
adj
->
lower
)
/
(
adj
->
upper
-
adj
->
lower
)
;
endScreenf
=
startWindf
+
lenWindf
*
(
adj
->
page_size
+
adj
->
value
-
adj
->
lower
)
/
(
adj
->
upper
-
adj
->
lower
)
;
// graphColor(BLACK);
if
(
pane
==
window
->
focuspane
)
pos
=
zMapWindowGetScaleOffset
(
window
);
else
pos
=
zMapWindowGetScaleOffset
(
window
);
/* for now we'll not actually draw anything */
// pane->dragBox = graphBoxStart();
// graphLine(pos, startWindf, pos, endWindf);
// pane->scrollBox = graphBoxStart();
// graphColor(GREEN);
// graphFillRectangle(pos - 0.3, startScreenf, pos + 0.5, endScreenf);
// graphBoxEnd();
// graphBoxSetPick(pane->scrollBox, FALSE);
// graphBoxEnd();
// graphBoxDraw(pane->dragBox, -1, LIGHTGRAY);
return
;
}
/****************** end of file ************************************/
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment