- struct casereader *reader;
- const struct caseproto *proto;
- casenumber case_cnt;
- unsigned long int lazy_serial;
-
- /* When the user executes a number of snippets of syntax in a
- row, none of which read from the active dataset, the GUI becomes
- progressively less responsive. The reason is that each syntax
- execution encapsulates the active dataset data in another
- datasheet layer. The cumulative effect of having a number of
- layers of datasheets wastes time and space.
-
- To solve the problem, we use a "lazy casereader", a wrapper
- around the casereader obtained from the data store, that
- only actually instantiates that casereader when it is
- needed. If the data store casereader is never needed, then
- it is reused the next time syntax is run, without wrapping
- it in another layer. */
- proto = psppire_data_store_get_proto (the_data_store);
- case_cnt = psppire_data_store_get_case_count (the_data_store);
- reader = lazy_casereader_create (proto, case_cnt,
- create_casereader_from_data_store,
- the_data_store, &lazy_serial);
- dataset_set_source (the_dataset, reader);
-
- g_return_val_if_fail (dataset_has_source (the_dataset), FALSE);
+ PsppireDataWindow *pdw, *next_pdw;
+
+ ll_for_each (pdw, PsppireDataWindow, ll, &all_data_windows)
+ {
+ const struct caseproto *proto;
+ struct casereader *reader;
+ casenumber case_cnt;
+
+ /* When the user executes a number of snippets of syntax in a
+ row, none of which read from the active dataset, the GUI becomes
+ progressively less responsive. The reason is that each syntax
+ execution encapsulates the active dataset data in another
+ datasheet layer. The cumulative effect of having a number of
+ layers of datasheets wastes time and space.
+
+ To solve the problem, we use a "lazy casereader", a wrapper
+ around the casereader obtained from the data store, that
+ only actually instantiates that casereader when it is
+ needed. If the data store casereader is never needed, then
+ it is reused the next time syntax is run, without wrapping
+ it in another layer. */
+ proto = psppire_data_store_get_proto (pdw->data_store);
+ case_cnt = psppire_data_store_get_case_count (pdw->data_store);
+ reader = lazy_casereader_create (proto, case_cnt,
+ create_casereader_from_data_store,
+ pdw->data_store, &pdw->lazy_serial);
+ dataset_set_source (pdw->dataset, reader);
+
+ if (pdw == window)
+ session_set_active_dataset (the_session, pdw->dataset);
+
+ g_return_val_if_fail (dataset_has_source (pdw->dataset), FALSE);
+
+ pdw->dataset_seqno = dataset_seqno (pdw->dataset);
+ }