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

Fix small buglet in closing the last window of a view when there are multiple...

Fix small buglet in closing the last window of a view when there are multiple views in one ZMap window.
parent be213d6f
No related branches found
No related tags found
No related merge requests found
......@@ -26,9 +26,9 @@
* the window code and the threaded server code.
* Exported functions: See ZMap.h
* HISTORY:
* Last edited: Feb 22 14:49 2006 (edgrif)
* Last edited: Feb 23 16:10 2006 (edgrif)
* Created: Thu Jul 24 16:06:44 2003 (edgrif)
* CVS info: $Id: zmapControl.c,v 1.59 2006-02-22 15:02:03 edgrif Exp $
* CVS info: $Id: zmapControl.c,v 1.60 2006-02-23 16:13:36 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -202,8 +202,6 @@ gboolean zMapDeleteView(ZMap zmap, ZMapView view)
if (!zmap->view_list)
zmap->state = ZMAP_INIT ;
zmapControlWindowSetGUIState(zmap) ;
return result ;
}
......@@ -327,26 +325,28 @@ void zmapControlClose(ZMap zmap)
view_window = zmap->focus_viewwindow ;
view = zMapViewGetView(view_window) ;
num_windows = zMapViewNumWindows(view_window) ;
/* If there is just one view or just window of a view then we warn the user. */
/* If there is just one view or just one window left in a view then we warn the user. */
num_windows = zMapViewNumWindows(view_window) ;
if (num_views == 1 && num_windows == 1)
{
if (zMapGUIShowChoice(GTK_WINDOW(zmap->toplevel), ZMAP_MSG_WARNING,
"Closing this window will close this zmap, "
"Closing this window will close this zmap window, "
"do you really want to do this ?"))
killZMap(zmap) ;
}
else if (num_windows == 1)
{
if (zMapGUIShowChoice(GTK_WINDOW(zmap->toplevel), ZMAP_MSG_WARNING,
"Closing this window will remove this view, "
"do you really want to do this ?"))
zMapDeleteView(zmap, view) ;
}
else
{
zmapControlRemoveWindow(zmap) ;
char *msg ;
msg = g_strdup_printf("Closing this window will remove view \"%s\", "
"do you really want to do this ?", zMapViewGetSequence(view)) ;
if (num_windows > 1
|| zMapGUIShowChoice(GTK_WINDOW(zmap->toplevel), ZMAP_MSG_WARNING, msg))
zmapControlRemoveWindow(zmap) ;
g_free(msg) ;
}
......@@ -690,6 +690,10 @@ static void viewKilledCB(ZMapView view, void *app_data, void *view_data)
if (findViewInZMap(zmap, view))
{
zMapDeleteView(zmap, view) ;
/* do we need to update the focus window here ??? */
}
else
{
......
......@@ -29,9 +29,9 @@
*
* Exported functions: See zmapControl.h
* HISTORY:
* Last edited: Feb 20 12:04 2006 (edgrif)
* Last edited: Feb 23 15:24 2006 (edgrif)
* Created: Mon Jan 10 10:38:43 2005 (edgrif)
* CVS info: $Id: zmapControlViews.c,v 1.9 2006-02-21 15:14:38 edgrif Exp $
* CVS info: $Id: zmapControlViews.c,v 1.10 2006-02-23 16:13:36 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -211,15 +211,15 @@ void zmapControlRemoveWindow(ZMap zmap)
ZMapViewWindow view_window, remaining_view ;
ZMapView view ;
gboolean remove ;
int num_views ;
int num_views, num_windows ;
num_views = zmapControlNumViews(zmap) ;
num_windows = zMapViewNumWindows(zmap->focus_viewwindow) ;
/* We shouldn't get called if there are no views or if a view has one window left. */
/* We shouldn't get called if there are no views or if there is one view with one window left. */
zMapAssert(num_views && zmap->focus_viewwindow
&& (zMapViewNumWindows(zmap->focus_viewwindow) > 1)) ;
&& !(num_views == 1 && num_windows == 1)) ;
/* focus_viewwindow gets reset so hang on to view_window pointer and view.*/
......@@ -229,8 +229,13 @@ void zmapControlRemoveWindow(ZMap zmap)
close_container = g_hash_table_lookup(zmap->viewwindow_2_parent, view_window) ;
/* Make sure we reset focus because we are removing the view it points to ! */
zmap->focus_viewwindow = NULL ;
zMapViewRemoveWindow(view_window) ;
if (num_windows > 1)
zMapViewRemoveWindow(view_window) ;
else
zMapDeleteView(zmap, view) ;
/* this needs to remove the pane.....AND set a new focuspane....if there is one.... */
......@@ -242,10 +247,6 @@ void zmapControlRemoveWindow(ZMap zmap)
zMapAssert(remove) ;
/* Make sure we reset focus because we just removed the view it points to ! */
zmap->focus_viewwindow = NULL ;
/* Having removed one window we need to refocus on another, if there is one....... */
if (remaining_view)
zmapControlSetWindowFocus(zmap, remaining_view) ;
......@@ -336,6 +337,7 @@ GtkWidget *zmapControlAddWindow(ZMap zmap, GtkWidget *curr_frame, GtkOrientation
}
/* Returns the viewWindow left in the other half of the pane, but note when its
* last window, there is no viewWindow left over. */
static ZMapViewWindow closeWindow(ZMap zmap, GtkWidget *close_container)
......
......@@ -26,9 +26,9 @@
*
* Exported functions: See zmapTopWindow_P.h
* HISTORY:
* Last edited: Feb 21 15:16 2006 (edgrif)
* Last edited: Feb 21 15:40 2006 (edgrif)
* Created: Fri May 7 14:43:28 2004 (edgrif)
* CVS info: $Id: zmapControlWindow.c,v 1.19 2006-02-21 15:16:39 edgrif Exp $
* CVS info: $Id: zmapControlWindow.c,v 1.20 2006-02-23 16:13:35 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -50,8 +50,11 @@ gboolean zmapControlWindowCreate(ZMap zmap)
gtk_window_set_title(GTK_WINDOW(toplevel), zmap->zmap_id) ;
gtk_container_border_width(GTK_CONTAINER(toplevel), 5) ;
/* this should be in a config file.... */
gtk_window_set_default_size(GTK_WINDOW(zmap->toplevel), 800, 800);
g_signal_connect(G_OBJECT(toplevel), "realize",
G_CALLBACK(zmapControlRemoteInstaller), (gpointer)zmap);
......
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