[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: gschem.c
User: pcjc2
Date: 07/04/21 19:05:37
Modified: . gschem.c i_callbacks.c x_fileselect.c x_pagesel.c
x_window.c
Log:
Cleaned up and consolidated code which creates new pages.
This makes the code cleaner and easier to read, and fixes bugs related
to stray, "unknown" named pages being left when creating a new window.
Fixes bug #1699970, with changes based upon patch #1704834.
Revision Changes Path
1.41 +13 -113 eda/geda/gaf/gschem/src/gschem.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: gschem.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/gschem.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- gschem.c 24 Feb 2007 11:47:34 -0000 1.40
+++ gschem.c 21 Apr 2007 23:05:36 -0000 1.41
@@ -203,14 +203,8 @@
/* At end, complete set up of window. */
colormap = gdk_colormap_get_system ();
x_window_setup_colors();
-
x_window_setup (w_current);
- /* o_text_init(); goes away */
- /* o_text_init(); Moved inside libgeda_init() */
-
- x_repaint_background(w_current);
-
i = argv_index;
while (argv[i] != NULL) {
@@ -227,67 +221,15 @@
filename = g_strconcat (cwd, G_DIR_SEPARATOR_S, argv[i], NULL);
}
- if (first_page) {
- if (w_current->page_current->page_filename) {
- g_free(w_current->page_current->page_filename);
- }
-
- /* Page structure has already been created...
- * so, just set the filename and open the
- * schematic for the first page */
-
- /* always use absolute file names to eliminate confusion */
- w_current->page_current->page_filename = filename;
+ if ( first_page )
+ first_page = 0;
/*
* SDB notes: at this point the filename might be unnormalized, like
- * /path/to/foo/../bar/baz.sch. Bad filenames will be normalized
- * in f_open. This works for Linux and MINGW32.
+ * /path/to/foo/../bar/baz.sch. Bad filenames will be normalized in
+ * f_open (called by x_window_open_page). This works for Linux and MINGW32.
*/
-
- if (!quiet_mode) {
- printf(_("Loading schematic [%s]\n"), filename);
- }
-
- (void)f_open(w_current,
- w_current->page_current->page_filename);
- i_set_filename(w_current,
- w_current->page_current->page_filename);
-
- first_page = 0;
- } else {
- /* Much simpler */
-
- /* create new page, and only load if page not loaded */
- if (!s_page_search (w_current, filename)) {
- PAGE *page = s_page_new (w_current, filename);
- s_page_goto (w_current, page);
-
- if (!quiet_mode) {
- printf(_("Loading schematic [%s]\n"),
- filename);
- }
-
- f_open(w_current,
- w_current->page_current->page_filename);
- i_set_filename(w_current,
- w_current->page_current->page_filename);
- }
- }
-
- /* Run the new page hook */
- if (scm_hook_empty_p(new_page_hook) == SCM_BOOL_F &&
- w_current->page_current != NULL) {
- scm_run_hook(new_page_hook,
- scm_cons(g_make_page_smob(w_current,
- w_current->page_current),
- SCM_EOL));
- }
-
- /* Do a zoom extents for each page */
- a_zoom_extents(w_current,
- w_current->page_current->object_head,
- A_PAN_DONT_REDRAW);
+ x_window_open_page(w_current, filename);
/* Go to the next argument */
i++;
@@ -295,57 +237,15 @@
free(cwd); /* allocated from getcwd, should be regular free */
- if (argv[argv_index] == NULL) {
- if (w_current->page_current->page_filename) {
- g_free(w_current->page_current->page_filename);
+ /* If no page has been loaded (wasn't specified in the command line.) */
+ /* Then create an untitled page */
+ if ( first_page ) {
+ x_window_open_untitled_page( w_current );
}
- w_current->cwd = g_get_current_dir ();
-#ifdef __MINGW32__
- u_basic_strip_trailing(w_current->cwd, G_DIR_SEPARATOR);
-#endif
-
- w_current->page_current->page_filename =
- g_malloc(sizeof(char) * (
- strlen(w_current->cwd) +
- strlen(w_current->untitled_name) +
- strlen("/_##########.sch") +
- 1));
-
- w_current->num_untitled++;
- sprintf(w_current->page_current->page_filename,
- "%s%c%s_%d.sch",
- w_current->cwd, G_DIR_SEPARATOR,
- w_current->untitled_name,
- w_current->num_untitled);
-
- i_set_filename(w_current,
- w_current->page_current->page_filename);
- }
-
- /* If no page has been loaded (wasn't specified in the command line. */
- /* Then run the new page hook and do a zoom extents */
- if (first_page) {
- /* Run the new page hook */
- if (scm_hook_empty_p(new_page_hook) == SCM_BOOL_F &&
- w_current->page_current != NULL) {
- scm_run_hook(new_page_hook,
- scm_cons(g_make_page_smob(w_current,
- w_current->page_current),
- SCM_EOL));
- }
-
- /* Do a zoom extents for this page */
- a_zoom_extents(w_current,
- w_current->page_current->object_head,
- A_PAN_DONT_REDRAW);
- }
-
- o_undo_savestate(w_current, UNDO_ALL);
-
+ /* Update the window to show the current page */
+ x_window_set_current_page( w_current, w_current->page_current );
- x_scrollbars_update(w_current);
- o_redraw_all_fast(w_current);
#if DEBUG
scm_c_eval_string ("(display \"hello guile\n\")");
1.83 +122 -230 eda/geda/gaf/gschem/src/i_callbacks.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_callbacks.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/i_callbacks.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -b -r1.82 -r1.83
--- i_callbacks.c 21 Apr 2007 18:59:06 -0000 1.82
+++ i_callbacks.c 21 Apr 2007 23:05:36 -0000 1.83
@@ -187,10 +187,8 @@
/* create a new page */
page = x_window_open_untitled_page (toplevel);
+ x_window_set_current_page (toplevel, page);
s_log_message (_("New page created [%s]\n"), page->page_filename);
-
- o_undo_savestate (toplevel, UNDO_ALL);
-
}
/*! \todo Finish function documentation!!!
@@ -217,29 +215,15 @@
*/
DEFINE_I_CALLBACK(file_new_window)
{
- TOPLEVEL *w_current;
+ TOPLEVEL *toplevel;
PAGE *page;
- w_current = s_toplevel_new ();
- x_window_setup (w_current);
-
- /* x_window_setup creates a new page, so call the new page hook */
- if (scm_hook_empty_p (new_page_hook) == SCM_BOOL_F) {
- scm_run_hook (new_page_hook,
- scm_cons (g_make_page_smob (w_current,
- w_current->page_current),
- SCM_EOL));
- }
-
- /* Do a zoom extents after calling the new page hook */
- a_zoom_extents(w_current, w_current->page_current->object_head, 0);
-
- exit_if_null(w_current);
-
- s_log_message(_("New Window created\n"));
-
- page = x_window_open_untitled_page (w_current);
+ toplevel = s_toplevel_new ();
+ x_window_setup (toplevel);
+ page = x_window_open_untitled_page (toplevel);
+ x_window_set_current_page (toplevel, page);
+ s_log_message (_("New Window created [%s]\n"), page->page_filename);
}
/*! \todo Finish function documentation!!!
@@ -1623,7 +1607,6 @@
exit_if_null(w_current);
x_pagesel_open (w_current);
-
}
/*! \todo Finish function documentation!!!
@@ -1644,8 +1627,7 @@
}
if (w_current->enforce_hierarchy) {
- p_new = s_hierarchy_find_next_page(p_current,
- p_current->page_control);
+ p_new = s_hierarchy_find_next_page(p_current, p_current->page_control);
} else {
p_new = p_current->next;
}
@@ -1654,14 +1636,7 @@
return;
}
- s_page_goto (w_current, p_new);
-
- i_set_filename(w_current, w_current->page_current->page_filename);
- x_scrollbars_update(w_current);
- o_redraw_all(w_current);
- x_pagesel_update (w_current);
- i_update_menus(w_current);
-
+ x_window_set_current_page (w_current, p_new);
}
/*! \todo Finish function documentation!!!
@@ -1682,8 +1657,7 @@
}
if (w_current->enforce_hierarchy == TRUE) {
- p_new = s_hierarchy_find_prev_page(p_current,
- p_current->page_control);
+ p_new = s_hierarchy_find_prev_page(p_current, p_current->page_control);
} else {
p_new = p_current->prev;
}
@@ -1692,14 +1666,7 @@
return;
}
- s_page_goto (w_current, p_new);
-
- i_set_filename(w_current, w_current->page_current->page_filename);
- x_scrollbars_update(w_current);
- o_redraw_all(w_current);
- x_pagesel_update (w_current);
- i_update_menus(w_current);
-
+ x_window_set_current_page (w_current, p_new);
}
/*! \todo Finish function documentation!!!
@@ -1716,8 +1683,8 @@
/* create a new page */
page = x_window_open_untitled_page (toplevel);
+ x_window_set_current_page (toplevel, page);
s_log_message (_("New page created [%s]\n"), page->page_filename);
-
}
/*! \todo Finish function documentation!!!
@@ -1782,34 +1749,16 @@
page_control = w_current->page_current->page_control;
up = w_current->page_current->up;
- /* delete the page, create a new one and make it the new current */
+ /* delete the page, then re-open the file as a new page */
s_page_delete (w_current, w_current->page_current);
- page = s_page_new (w_current, filename);
- s_page_goto (w_current, page);
- g_free (filename);
-
- /* now re open it */
- f_open(w_current, w_current->page_current->page_filename);
- i_set_filename(w_current, w_current->page_current->page_filename);
-
- /* make sure we maintain the hierarchy info */
- w_current->page_current->page_control = page_control;
- w_current->page_current->up = up;
-
- x_repaint_background(w_current);
- x_manual_resize(w_current);
- a_zoom_extents(w_current, w_current->page_current->object_head,
- A_PAN_DONT_REDRAW);
- o_undo_savestate(w_current, UNDO_ALL);
- /* now update the scrollbars */
- x_hscrollbar_update(w_current);
- x_vscrollbar_update(w_current);
- x_pagesel_update (w_current);
- i_update_menus(w_current);
+ page = x_window_open_page (w_current, filename);
- o_redraw_all(w_current);
+ /* make sure we maintain the hierarchy info */
+ page->page_control = page_control;
+ page->up = up;
+ x_window_set_current_page (w_current, page);
}
/*! \todo Finish function documentation!!!
@@ -1824,7 +1773,6 @@
exit_if_null(w_current);
x_window_close_page (w_current, w_current->page_current);
-
}
/*! \todo Finish function documentation!!!
@@ -2796,22 +2744,17 @@
exit_if_null(w_current);
object = o_select_return_first_object(w_current);
- if (object != NULL) {
+
/* only allow going into symbols */
- if (object->type == OBJ_COMPLEX) {
+ if (object == NULL || object->type != OBJ_COMPLEX)
+ return;
parent = w_current->page_current;
- attrib = o_attrib_search_name_single_count(object,
- "source",
- count);
+ attrib = o_attrib_search_name_single_count(object, "source", count);
/* if above is null, then look inside symbol */
if (attrib == NULL) {
- attrib = o_attrib_search_name(object->
- complex->
- prim_objs,
- "source",
- count);
+ attrib = o_attrib_search_name(object->complex->prim_objs, "source", count);
looking_inside = TRUE;
#if DEBUG
printf("going to look inside now\n");
@@ -2822,59 +2765,42 @@
/* look for source=filename,filename, ... */
pcount = 0;
-
current_filename = u_basic_breakup_string(attrib, ',', pcount);
/* loop over all filenames */
while(current_filename != NULL) {
- s_log_message(
- _("Searching for source [%s]\n"),
- current_filename);
+ s_log_message(_("Searching for source [%s]\n"), current_filename);
saved_page_control = page_control;
page_control =
- s_hierarchy_down_schematic_single(
- w_current,
+ s_hierarchy_down_schematic_single(w_current,
current_filename,
parent,
page_control,
HIERARCHY_NORMAL_LOAD);
+ /* s_hierarchy_down_schematic_single() will not zoom the loaded page */
if (page_control != -1) {
a_zoom_extents(w_current,
- w_current->
- page_current->
- object_head,
+ w_current->page_current->object_head,
A_PAN_DONT_REDRAW);
- o_undo_savestate(w_current,
- UNDO_ALL);
+ o_undo_savestate(w_current, UNDO_ALL);
}
-
/* save the first page */
- if (!loaded_flag &&
- page_control != -1 &&
- page_control != 0) {
- save_first_page = w_current->
- page_current;
+ if ( !loaded_flag && page_control > 0 ) {
+ save_first_page = w_current->page_current;
}
/* now do some error fixing */
if (page_control == -1) {
- s_log_message(
- _("Cannot find source [%s]\n"),
- current_filename);
- fprintf(stderr,
- _("Cannot find source [%s]\n"),
- current_filename);
+ s_log_message(_("Cannot find source [%s]\n"), current_filename);
+ fprintf(stderr, _("Cannot find source [%s]\n"), current_filename);
- /* restore this for the next */
- /* page */
- page_control =
- saved_page_control;
+ /* restore this for the next page */
+ page_control = saved_page_control;
} else {
- /* this only signifies that */
- /* we tried */
+ /* this only signifies that we tried */
loaded_flag = TRUE;
}
@@ -2883,25 +2809,18 @@
current_filename = u_basic_breakup_string(attrib, ',', pcount);
}
- if (attrib) {
- g_free(attrib);
- }
-
- if (current_filename) {
- g_free(current_filename);
- }
+ if (attrib) g_free(attrib);
+ if (current_filename) g_free(current_filename);
count++;
/* continue looking outside first */
if (!looking_inside) {
- attrib =
- o_attrib_search_name_single_count(object, "source", count);
+ attrib = o_attrib_search_name_single_count(object, "source", count);
}
- /* okay we were looking outside and didn't */
- /* find anything, so now we need to look */
- /* inside the symbol */
+ /* okay we were looking outside and didn't find anything,
+ * so now we need to look inside the symbol */
if (!looking_inside && attrib == NULL && !loaded_flag ) {
looking_inside = TRUE;
#if DEBUG
@@ -2913,31 +2832,16 @@
#if DEBUG
printf("looking inside\n");
#endif
- attrib = o_attrib_search_name(
- object->complex->
- prim_objs,
- "source",
- count);
+ attrib = o_attrib_search_name(object->complex->prim_objs, "source", count);
}
}
if (loaded_flag) {
if (save_first_page) {
- w_current->page_current =
- save_first_page;
- }
- i_set_filename(w_current, w_current->
- page_current->page_filename);
- a_zoom_extents(w_current,
- w_current->page_current->object_head,
- A_PAN_DONT_REDRAW);
- o_redraw_all(w_current);
- x_scrollbars_update(w_current);
- x_pagesel_update (w_current);
- i_update_menus(w_current);
- }
+ w_current->page_current = save_first_page;
}
+ x_window_set_current_page( w_current, w_current->page_current );
}
}
@@ -2963,19 +2867,14 @@
G_DIR_SEPARATOR_S,
object->complex_basename, NULL);
s_log_message(_("Searching for symbol [%s]\n"), filename);
- s_hierarchy_down_symbol(w_current, filename,
- w_current->page_current);
- i_set_filename(w_current,
- w_current->page_current->page_filename);
+ s_hierarchy_down_symbol(w_current, filename, w_current->page_current);
+ g_free(filename);
+ /* s_hierarchy_down_symbol() will not zoom the loaded page */
a_zoom_extents(w_current,
w_current->page_current->object_head,
A_PAN_DONT_REDRAW);
- x_scrollbars_update(w_current);
o_undo_savestate(w_current, UNDO_ALL);
- o_redraw_all(w_current);
- x_pagesel_update (w_current);
- i_update_menus(w_current);
- g_free(filename);
+ x_window_set_current_page(w_current, w_current->page_current);
}
}
}
@@ -2992,11 +2891,7 @@
exit_if_null(w_current);
s_hierarchy_up(w_current, w_current->page_current->up);
- i_set_filename(w_current, w_current->page_current->page_filename);
- x_scrollbars_update(w_current);
- o_redraw_all(w_current);
- x_pagesel_update (w_current);
- i_update_menus(w_current);
+ x_window_set_current_page(w_current, w_current->page_current);
}
/*! \todo Finish function documentation!!!
@@ -3025,20 +2920,17 @@
/* look for "documentation" first outside, then inside symbol */
attrib_doc = o_attrib_search_name_single_count(object, "documentation", 0);
if (!attrib_doc) {
- attrib_doc = o_attrib_search_name(object->complex->prim_objs,
- "documentation", 0);
+ attrib_doc = o_attrib_search_name(object->complex->prim_objs, "documentation", 0);
}
/* look for "device" */
attrib_device = o_attrib_search_name_single_count(object, "device", 0);
if (!attrib_device) {
- attrib_device = o_attrib_search_name(object->complex->prim_objs,
- "device", 0);
+ attrib_device = o_attrib_search_name(object->complex->prim_objs, "device", 0);
}
/* look for "value" */
attrib_value = o_attrib_search_name_single_count(object, "value", 0);
if (!attrib_value) {
- attrib_value = o_attrib_search_name(object->complex->prim_objs,
- "value", 0);
+ attrib_value = o_attrib_search_name(object->complex->prim_objs, "value", 0);
}
initiate_gschemdoc(attrib_doc,
attrib_device,
1.36 +7 -3 eda/geda/gaf/gschem/src/x_fileselect.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_fileselect.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_fileselect.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- x_fileselect.c 21 Apr 2007 18:59:07 -0000 1.35
+++ x_fileselect.c 21 Apr 2007 23:05:36 -0000 1.36
@@ -166,6 +166,7 @@
void
x_fileselect_open(TOPLEVEL *toplevel)
{
+ PAGE *page = NULL;
GtkWidget *dialog;
dialog = gtk_file_chooser_dialog_new (_("Open..."),
@@ -197,8 +198,11 @@
/* open each file */
for (tmp = filenames; tmp != NULL;tmp = g_slist_next (tmp)) {
- x_window_open_page (toplevel, (gchar*)tmp->data);
+ page = x_window_open_page (toplevel, (gchar*)tmp->data);
}
+ /* Switch to the last page opened */
+ if ( page != NULL )
+ x_window_set_current_page (toplevel, page);
/* free the list of filenames */
g_slist_foreach (filenames, (GFunc)g_free, NULL);
1.19 +5 -0 eda/geda/gaf/gschem/src/x_pagesel.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_pagesel.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_pagesel.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- x_pagesel.c 21 Apr 2007 18:59:07 -0000 1.18
+++ x_pagesel.c 21 Apr 2007 23:05:37 -0000 1.19
@@ -187,6 +187,11 @@
x_scrollbars_update (toplevel);
o_redraw_all (toplevel);
+ /* We would like to use the following call, but since it calls
+ * x_pagesel_update() it would cause an infinite loop.
+ */
+ /* x_window_set_current_page (toplevel, page); */
+
}
/*! \todo Finish function documentation!!!
1.53 +57 -94 eda/geda/gaf/gschem/src/x_window.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_window.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_window.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- x_window.c 25 Feb 2007 02:15:57 -0000 1.52
+++ x_window.c 21 Apr 2007 23:05:37 -0000 1.53
@@ -38,8 +38,6 @@
*/
void x_window_setup (TOPLEVEL *toplevel)
{
- PAGE *page;
-
/* x_window_setup_rest() - BEGIN */
toplevel->num_untitled=0;
@@ -132,11 +130,10 @@
/* Initialize the autosave callback */
s_page_autosave_init(toplevel);
- /* make sure none of these events happen till we are done */
- toplevel->DONT_DRAW_CONN = 1;
- toplevel->DONT_RESIZE = 1;
- toplevel->DONT_EXPOSE = 1;
- toplevel->DONT_RECALC = 1;
+ toplevel->DONT_DRAW_CONN = 0;
+ toplevel->DONT_RESIZE = 0;
+ toplevel->DONT_EXPOSE = 0;
+ toplevel->DONT_RECALC = 0;
/* X related stuff */
toplevel->display_height = gdk_screen_height ();
@@ -159,31 +156,7 @@
/* x_window_setup_world() - END */
/* X related stuff */
- /* do X fill in first */
x_window_create_main (toplevel);
-
- /* Now create a blank page */
- page = s_page_new (toplevel, "unknown");
- s_page_goto (toplevel, page);
-
- /* Do a zoom extents */
- a_zoom_extents(toplevel, toplevel->page_current->object_head, 0);
-
- o_undo_savestate(toplevel, UNDO_ALL);
- i_update_menus(toplevel);
-
- /* now update the scrollbars */
- toplevel->DONT_REDRAW = 1;
- x_hscrollbar_update(toplevel);
- x_vscrollbar_update(toplevel);
- toplevel->DONT_REDRAW = 0;
-
- /* renable the events */
- toplevel->DONT_DRAW_CONN=0;
- toplevel->DONT_RESIZE=0;
- toplevel->DONT_EXPOSE=0;
- toplevel->DONT_RECALC=0;
-
}
/*! \todo Finish function documentation!!!
@@ -907,22 +880,15 @@
cwd = g_get_current_dir ();
tmp = g_strdup_printf ("%s_%d.sch",
toplevel->untitled_name,
- toplevel->num_untitled++);
+ ++toplevel->num_untitled);
+
filename = g_build_filename (cwd, tmp, NULL);
g_free (cwd);
g_free (tmp);
page = x_window_open_page (toplevel, filename);
-
g_free (filename);
- if (scm_hook_empty_p (new_page_hook) == SCM_BOOL_F) {
- scm_run_hook (new_page_hook,
- scm_cons (g_make_page_smob (toplevel, page), SCM_EOL));
- }
-
- a_zoom_extents(toplevel, page->object_head, 0);
-
return page;
}
@@ -950,36 +916,40 @@
g_return_val_if_fail (toplevel != NULL, NULL);
g_return_val_if_fail (filename != NULL, NULL);
- /* save current page for restore after opening */
- old_current = toplevel->page_current;
-
- /* is file already loaded? */
+ /* Return existing page if it is already loaded */
page = s_page_search (toplevel, filename);
- if (page == NULL) {
- /* no, create a page and load file in it */
+ if ( page != NULL )
+ return page;
+
+ old_current = toplevel->page_current;
page = s_page_new (toplevel, filename);
s_page_goto (toplevel, page);
- if (!quiet_mode) {
+ if (!quiet_mode)
printf(_("Loading schematic [%s]\n"), filename);
- }
- if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ if (g_file_test (filename, G_FILE_TEST_EXISTS))
f_open (toplevel, (gchar *) filename);
- }
- i_set_filename (toplevel, toplevel->page_current->page_filename);
+ if (scm_hook_empty_p (new_page_hook) == SCM_BOOL_F)
+ scm_run_hook (new_page_hook,
+ scm_cons (g_make_page_smob (toplevel, page), SCM_EOL));
+
a_zoom_extents (toplevel,
toplevel->page_current->object_head,
A_PAN_DONT_REDRAW);
- o_undo_savestate (toplevel, UNDO_ALL);
- x_pagesel_update (toplevel);
+ o_undo_savestate (toplevel, UNDO_ALL);
- }
+ if ( old_current != NULL )
+ s_page_goto (toplevel, old_current);
- /* display the page in window */
- x_window_set_current_page (toplevel, page);
+ /* This line is generally un-needed, however if some code
+ * wants to open a page, yet not bring it to the front, it is
+ * needed needed to add it into the page manager. Otherwise,
+ * it will get done in x_window_set_current_page(...)
+ */
+ x_pagesel_update (toplevel); /* ??? */
return page;
}
@@ -1018,7 +988,6 @@
toplevel->DONT_REDRAW = 0;
o_redraw_all (toplevel);
-
}
/*! \brief Saves a page to a file.
@@ -1083,14 +1052,10 @@
s_log_message (log_msg, filename);
/* update display and page manager */
+ x_window_set_current_page (toplevel, old_current);
+
i_set_state_msg (toplevel, SELECT, state_msg);
- i_set_filename (toplevel, page->page_filename);
i_update_toolbar (toplevel);
- i_update_menus (toplevel);
- x_pagesel_update (toplevel);
-
- /* restore current page in toplevel */
- s_page_goto (toplevel, old_current);
return ret;
}
@@ -1140,17 +1105,15 @@
/* remove page from toplevel list of page and free */
s_page_delete (toplevel, page);
+ /* Switch to a different page if we just removed the current */
if (toplevel->page_current == NULL) {
- /* page was the current page of toplevel, set new current */
+
+ /* Create a new page if there wasn't another to switch to */
if (new_current == NULL) {
- /* empty page list in toplevel, create new page */
new_current = x_window_open_untitled_page (toplevel);
- } else {
- /* change to new_current and update display */
- x_window_set_current_page (toplevel, new_current);
}
- g_assert (new_current != NULL);
+ /* change to new_current and update display */
+ x_window_set_current_page (toplevel, new_current);
}
-
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs