summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cargo/config.toml3
-rw-r--r--src/icon.rs2
-rw-r--r--src/main.rs17
-rw-r--r--src/panes/code_view.rs4
-rw-r--r--src/panes/designer_view.rs4
-rw-r--r--src/types.rs4
6 files changed, 13 insertions, 21 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml
index 669a8c7..feb6aad 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -1,6 +1,3 @@
[alias]
lint = "clippy --no-deps -- -D warnings"
lint-all = "clippy --no-deps -- -D clippy::pedantic"
-
-[build]
-rustflags = ["-Z", "threads=6"]
diff --git a/src/icon.rs b/src/icon.rs
index f6760d5..9dc0a89 100644
--- a/src/icon.rs
+++ b/src/icon.rs
@@ -18,6 +18,6 @@ pub fn save<'a>() -> Text<'a> {
icon("\u{1F4BE}")
}
-fn icon<'a>(codepoint: &'a str) -> Text<'a> {
+fn icon(codepoint: &str) -> Text<'_> {
text(codepoint).font(Font::with_name("icons"))
}
diff --git a/src/main.rs b/src/main.rs
index ca2c017..f826c36 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -22,7 +22,7 @@ use iced_anim::transition::Easing;
use iced_anim::{Animated, Animation};
use panes::{code_view, designer_view, element_list};
use tokio::runtime;
-use types::{Action, DesignerPage, ElementName, Message, Project};
+use types::{Action, DesignerPane, ElementName, Message, Project};
//pub(crate) type Result<T> = core::result::Result<T, Error>;
@@ -68,7 +68,7 @@ struct App {
theme: Animated<Theme>,
pane_state: pane_grid::State<Panes>,
focus: Option<Pane>,
- designer_page: DesignerPage,
+ designer_page: DesignerPane,
element_list: &'static [ElementName],
editor_content: text_editor::Content,
}
@@ -119,7 +119,7 @@ impl App {
theme: Animated::new(theme, Easing::EASE_IN),
pane_state: state,
focus: None,
- designer_page: DesignerPage::DesignerView,
+ designer_page: DesignerPane::DesignerView,
element_list: ElementName::ALL,
editor_content: text_editor::Content::new(),
},
@@ -279,12 +279,7 @@ impl App {
Ok((path, project)) => {
self.project = project;
self.project_path = Some(path);
- self.editor_content = text_editor::Content::with_text(
- &self
- .project
- .app_code(&self.config)
- .unwrap_or_else(|err| err.to_string()),
- );
+ return Task::done(Message::RefreshEditorContent);
}
Err(error) => error_dialog(error.to_string()),
}
@@ -360,12 +355,12 @@ impl App {
let is_focused = Some(id) == self.focus;
match pane {
Panes::Designer => match &self.designer_page {
- DesignerPage::DesignerView => designer_view::view(
+ DesignerPane::DesignerView => designer_view::view(
self.project.element_tree.as_ref(),
self.project.get_theme(&self.config),
is_focused,
),
- DesignerPage::CodeView => code_view::view(
+ DesignerPane::CodeView => code_view::view(
&self.editor_content,
self.theme.value().clone(),
is_focused,
diff --git a/src/panes/code_view.rs b/src/panes/code_view.rs
index 956eb87..bb21530 100644
--- a/src/panes/code_view.rs
+++ b/src/panes/code_view.rs
@@ -5,7 +5,7 @@ use iced_custom_highlighter::{Highlight, Highlighter, Scope, Settings};
use super::style;
use crate::icon::copy;
-use crate::types::{DesignerPage, Message};
+use crate::types::{DesignerPane, Message};
use crate::widget::tip;
fn highlight_style(theme: &Theme, scope: &Scope) -> Format<Font> {
@@ -33,7 +33,7 @@ pub fn view(
),
Space::with_width(20),
button("Switch to Designer view")
- .on_press(Message::SwitchPage(DesignerPage::DesignerView))
+ .on_press(Message::SwitchPage(DesignerPane::DesignerView))
]
.align_y(Alignment::Center);
let title_bar = pane_grid::TitleBar::new(title)
diff --git a/src/panes/designer_view.rs b/src/panes/designer_view.rs
index 8dfea5a..b0ba202 100644
--- a/src/panes/designer_view.rs
+++ b/src/panes/designer_view.rs
@@ -2,7 +2,7 @@ use iced::widget::{button, container, pane_grid, row, text, themer, Space};
use iced::{Alignment, Element, Length};
use super::style;
-use crate::types::{DesignerPage, Message, RenderedElement};
+use crate::types::{DesignerPane, Message, RenderedElement};
pub fn view<'a>(
element_tree: Option<&RenderedElement>,
@@ -21,7 +21,7 @@ pub fn view<'a>(
text("Designer"),
Space::with_width(Length::Fill),
button("Switch to Code view")
- .on_press(Message::SwitchPage(DesignerPage::CodeView)),
+ .on_press(Message::SwitchPage(DesignerPane::CodeView)),
]
.align_y(Alignment::Center);
let title_bar = pane_grid::TitleBar::new(title)
diff --git a/src/types.rs b/src/types.rs
index ac9d039..b9fd68f 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -17,7 +17,7 @@ use crate::Error;
pub enum Message {
ToggleTheme(Event<Theme>),
CopyCode,
- SwitchPage(DesignerPage),
+ SwitchPage(DesignerPane),
EditorAction(text_editor::Action),
RefreshEditorContent,
DropNewElement(ElementName, iced::Point, iced::Rectangle),
@@ -42,7 +42,7 @@ pub enum Message {
}
#[derive(Debug, Clone)]
-pub enum DesignerPage {
+pub enum DesignerPane {
DesignerView,
CodeView,
}