From f32f39d5a68e553881623cbcd9cb9de0fa91786a Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Wed, 10 Jun 2020 14:01:50 -0700 Subject: [PATCH] Rename GUI Layout to Layout System --- src/application.rs | 6 +++--- src/layout_dom_node.rs | 0 src/{gui_layout.rs => layout_system.rs} | 9 +++++---- src/main.rs | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 src/layout_dom_node.rs rename src/{gui_layout.rs => layout_system.rs} (97%) diff --git a/src/application.rs b/src/application.rs index 6cbc02a72..c5c4c0ce5 100644 --- a/src/application.rs +++ b/src/application.rs @@ -3,7 +3,7 @@ use crate::window_events; use crate::pipeline::Pipeline; use crate::texture::Texture; use crate::resource_cache::ResourceCache; -use crate::gui_layout::GuiLayout; +use crate::layout_system::LayoutSystem; use crate::gui_node::GuiNode; use winit::event::*; use winit::event_loop::*; @@ -70,7 +70,7 @@ impl Application { // Data structure maintaining the user interface let gui_rect_pipeline = Pipeline::new( - &device, swap_chain_descriptor.format, Vec::new(), &mut shader_cache, ("shaders/shader.vert", "shaders/shader.frag") + &device, swap_chain_descriptor.format, Vec::new(), &mut shader_cache, ("shaders/shader.vert", "shaders/shader.frag"), ); pipeline_cache.set("gui_rect", gui_rect_pipeline); @@ -79,7 +79,7 @@ impl Application { let gui_root = rctree::Node::new(gui_root_data); // Main window in the XML layout language - let mut main_window_layout = GuiLayout::new(); + let mut main_window_layout = LayoutSystem::new(); main_window_layout.load_layout("window", "main"); Self { diff --git a/src/layout_dom_node.rs b/src/layout_dom_node.rs new file mode 100644 index 000000000..e69de29bb diff --git a/src/gui_layout.rs b/src/layout_system.rs similarity index 97% rename from src/gui_layout.rs rename to src/layout_system.rs index e44d69bf3..1c037aafe 100644 --- a/src/gui_layout.rs +++ b/src/layout_system.rs @@ -5,13 +5,14 @@ use crate::layout_abstract_syntax::*; use crate::layout_attribute_parser::*; use crate::resource_cache::ResourceCache; -pub struct GuiLayout { +pub struct LayoutSystem { + // pub dom_tree: rctree::Node< pub loaded_layouts: ResourceCache>, attribute_parser: AttributeParser, } -impl GuiLayout { - pub fn new() -> GuiLayout { +impl LayoutSystem { + pub fn new() -> LayoutSystem { Self { loaded_layouts: ResourceCache::new(), attribute_parser: AttributeParser::new(), @@ -19,7 +20,7 @@ impl GuiLayout { } pub fn load_layout(&mut self, namespace: &str, name: &str) { - // Load and parse the XML layout + // Load and parse the requested XML layout let xml_path = self.layout_xml_path(namespace, name); let window_main = self.parse_xml_file(&xml_path[..]).unwrap(); diff --git a/src/main.rs b/src/main.rs index 7c26aab74..4791f43db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,10 +9,11 @@ mod draw_command; mod gui_node; mod gui_attributes; mod window_events; -mod gui_layout; +mod layout_system; mod layout_abstract_types; mod layout_abstract_syntax; mod layout_attribute_parser; +mod layout_dom_node; use application::Application; use winit::event_loop::EventLoop;