From 436550868b8fed2b6ca201e6dd7d85e29deae322 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 20 Jun 2018 15:58:46 +0200 Subject: [PATCH] WIP: fixed a initialization issue. --- src/lay/lay/laySession.cc | 101 ++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/src/lay/lay/laySession.cc b/src/lay/lay/laySession.cc index 40e6bbb69..67f5785f1 100644 --- a/src/lay/lay/laySession.cc +++ b/src/lay/lay/laySession.cc @@ -251,56 +251,59 @@ Session::restore (lay::MainWindow &mw) // declaration of the session file XML structure static const tl::XMLStruct -session_structure ("session", - tl::make_member (&Session::width, &Session::set_width, "window-width") + - tl::make_member (&Session::height, &Session::set_height, "window-height") + - tl::make_member (&Session::window_state, &Session::set_window_state, "window-state") + - tl::make_member (&Session::window_geometry, &Session::set_window_geometry, "window-geometry") + - tl::make_member (&Session::current_view, &Session::set_current_view, "current-view") + - tl::make_element::const_iterator, Session> (&Session::begin_layouts, &Session::end_layouts, &Session::add_layout, "layout", - tl::make_member (&SessionLayoutDescriptor::name, "name") + - tl::make_member (&SessionLayoutDescriptor::file_path, "file-path") + - tl::make_member (&SessionLayoutDescriptor::save_options_valid, "save-options-valid") + - tl::make_element (&SessionLayoutDescriptor::save_options, "save-options", - db::save_options_xml_element_list () +session_structure () +{ + return tl::XMLStruct ("session", + tl::make_member (&Session::width, &Session::set_width, "window-width") + + tl::make_member (&Session::height, &Session::set_height, "window-height") + + tl::make_member (&Session::window_state, &Session::set_window_state, "window-state") + + tl::make_member (&Session::window_geometry, &Session::set_window_geometry, "window-geometry") + + tl::make_member (&Session::current_view, &Session::set_current_view, "current-view") + + tl::make_element::const_iterator, Session> (&Session::begin_layouts, &Session::end_layouts, &Session::add_layout, "layout", + tl::make_member (&SessionLayoutDescriptor::name, "name") + + tl::make_member (&SessionLayoutDescriptor::file_path, "file-path") + + tl::make_member (&SessionLayoutDescriptor::save_options_valid, "save-options-valid") + + tl::make_element (&SessionLayoutDescriptor::save_options, "save-options", + db::save_options_xml_element_list () + ) + + tl::make_element (&SessionLayoutDescriptor::load_options, "load-options", + db::load_options_xml_element_list () + ) ) + - tl::make_element (&SessionLayoutDescriptor::load_options, "load-options", - db::load_options_xml_element_list () - ) - ) + - tl::make_element::const_iterator, Session> (&Session::begin_views, &Session::end_views, &Session::add_view, "view", - tl::make_member (&SessionViewDescriptor::title, "title") + - tl::make_member (&SessionViewDescriptor::active_cellview, "active-cellview-index") + - tl::make_element (&SessionViewDescriptor::display_state, "display", lay::DisplayState::xml_format ()) + - tl::make_element (&SessionViewDescriptor::cellviews, "cellviews", - tl::make_element::const_iterator, SessionCellViewDescriptors> (&SessionCellViewDescriptors::begin, &SessionCellViewDescriptors::end, &SessionCellViewDescriptors::push_back, "cellview", - tl::make_member (&SessionCellViewDescriptor::layout_name, "layout-ref") + - tl::make_member (&SessionCellViewDescriptor::tech_name, "tech-name") + - tl::make_element (&SessionCellViewDescriptor::hidden_cell_names, "hidden-cells", - tl::make_member::const_iterator, SessionHiddenCellNames> (&SessionHiddenCellNames::begin, &SessionHiddenCellNames::end, &SessionHiddenCellNames::push_back, "hidden-cell") - ) - ) - ) + - tl::make_element (&SessionViewDescriptor::bookmarks, "bookmarks", - tl::make_element (&BookmarkList::begin, &BookmarkList::end, &BookmarkList::add, "bookmark", BookmarkListElement::xml_format()) - ) + - tl::make_element, SessionViewDescriptor> (&SessionViewDescriptor::rdb_filenames, "rdb-files", - tl::make_member::const_iterator, std::vector > (&std::vector::begin, &std::vector::end, &std::vector::push_back, "rdb-file") - ) + - // for backward compatibility: - tl::make_element (&SessionViewDescriptor::set_layer_properties, "layer-properties", lay::LayerPropertiesList::xml_format ()) + - tl::make_member (&SessionViewDescriptor::current_layer_list, "current-layer-property-tab") + - tl::make_element, SessionViewDescriptor> (&SessionViewDescriptor::layer_properties_lists, "layer-properties-tabs", - tl::make_element::const_iterator, std::vector > (&std::vector::begin, &std::vector::end, &std::vector::push_back, "layer-properties", lay::LayerPropertiesList::xml_format()) - ) + - tl::make_element (&SessionViewDescriptor::annotation_shapes, "annotations", - tl::make_element::const_iterator, SessionAnnotationShapes> (&SessionAnnotationShapes::begin_annotation_shapes, &SessionAnnotationShapes::end_annotation_shapes, &SessionAnnotationShapes::add_annotation_shape, "annotation", - tl::make_member (&SessionAnnotationDescriptor::class_name, "class") + - tl::make_member (&SessionAnnotationDescriptor::value_string, "value") + tl::make_element::const_iterator, Session> (&Session::begin_views, &Session::end_views, &Session::add_view, "view", + tl::make_member (&SessionViewDescriptor::title, "title") + + tl::make_member (&SessionViewDescriptor::active_cellview, "active-cellview-index") + + tl::make_element (&SessionViewDescriptor::display_state, "display", lay::DisplayState::xml_format ()) + + tl::make_element (&SessionViewDescriptor::cellviews, "cellviews", + tl::make_element::const_iterator, SessionCellViewDescriptors> (&SessionCellViewDescriptors::begin, &SessionCellViewDescriptors::end, &SessionCellViewDescriptors::push_back, "cellview", + tl::make_member (&SessionCellViewDescriptor::layout_name, "layout-ref") + + tl::make_member (&SessionCellViewDescriptor::tech_name, "tech-name") + + tl::make_element (&SessionCellViewDescriptor::hidden_cell_names, "hidden-cells", + tl::make_member::const_iterator, SessionHiddenCellNames> (&SessionHiddenCellNames::begin, &SessionHiddenCellNames::end, &SessionHiddenCellNames::push_back, "hidden-cell") + ) + ) + ) + + tl::make_element (&SessionViewDescriptor::bookmarks, "bookmarks", + tl::make_element (&BookmarkList::begin, &BookmarkList::end, &BookmarkList::add, "bookmark", BookmarkListElement::xml_format()) + ) + + tl::make_element, SessionViewDescriptor> (&SessionViewDescriptor::rdb_filenames, "rdb-files", + tl::make_member::const_iterator, std::vector > (&std::vector::begin, &std::vector::end, &std::vector::push_back, "rdb-file") + ) + + // for backward compatibility: + tl::make_element (&SessionViewDescriptor::set_layer_properties, "layer-properties", lay::LayerPropertiesList::xml_format ()) + + tl::make_member (&SessionViewDescriptor::current_layer_list, "current-layer-property-tab") + + tl::make_element, SessionViewDescriptor> (&SessionViewDescriptor::layer_properties_lists, "layer-properties-tabs", + tl::make_element::const_iterator, std::vector > (&std::vector::begin, &std::vector::end, &std::vector::push_back, "layer-properties", lay::LayerPropertiesList::xml_format()) + ) + + tl::make_element (&SessionViewDescriptor::annotation_shapes, "annotations", + tl::make_element::const_iterator, SessionAnnotationShapes> (&SessionAnnotationShapes::begin_annotation_shapes, &SessionAnnotationShapes::end_annotation_shapes, &SessionAnnotationShapes::add_annotation_shape, "annotation", + tl::make_member (&SessionAnnotationDescriptor::class_name, "class") + + tl::make_member (&SessionAnnotationDescriptor::value_string, "value") + ) ) ) - ) -); + ); +} void Session::load (const std::string &fn) @@ -310,7 +313,7 @@ Session::load (const std::string &fn) tl::XMLFileSource in (fn); - session_structure.parse (in, *this); + session_structure ().parse (in, *this); tl::log << "Loaded session from " << fn; } @@ -319,7 +322,7 @@ void Session::save (const std::string &fn) { tl::OutputStream os (fn, tl::OutputStream::OM_Plain); - session_structure.write (os, *this); + session_structure ().write (os, *this); tl::log << "Saved session to " << fn; }