Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions editor/src/asset/creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use crate::{
list_view::{ListViewBuilder, ListViewMessage},
message::UiMessage,
stack_panel::StackPanelBuilder,
style::resource::StyleResourceExt,
text::TextMessage,
text_box::TextBoxBuilder,
utils::make_dropdown_list_option,
Expand All @@ -41,7 +42,7 @@ use crate::{
},
},
message::MessageSender,
Message,
Editor, Message,
};
use fyrox::gui::button::Button;
use fyrox::gui::list_view::ListView;
Expand Down Expand Up @@ -73,6 +74,8 @@ impl ResourceCreator {
items.push(make_dropdown_list_option(
ctx,
make_pretty_type_name(&constructor.type_name),
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
))
}
}
Expand All @@ -83,7 +86,11 @@ impl ResourceCreator {
let cancel;
let resource_constructors_list;
let window = WindowBuilder::new(WidgetBuilder::new().with_width(300.0).with_height(400.0))
.with_title(WindowTitle::text("Resource Creator"))
.with_title(WindowTitle::text_with_font_size(
"Resource Creator",
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
))
.open(false)
.with_content(
GridBuilder::new(
Expand All @@ -97,6 +104,7 @@ impl ResourceCreator {
.with_margin(Thickness::uniform(1.0)),
)
.with_text(&name_str)
.with_font_size(ctx.style.property(Editor::UI_FONT_SIZE))
.build(ctx);
name
})
Expand All @@ -121,7 +129,11 @@ impl ResourceCreator {
.with_width(100.0)
.with_height(22.0),
)
.with_text("OK")
.with_text_and_font_size(
"OK",
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
)
.build(ctx);
ok
})
Expand All @@ -132,7 +144,11 @@ impl ResourceCreator {
.with_width(100.0)
.with_height(22.0),
)
.with_text("Cancel")
.with_text_and_font_size(
"Cancel",
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
)
.build(ctx);
cancel
}),
Expand Down
62 changes: 39 additions & 23 deletions editor/src/asset/dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,34 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

use crate::fyrox::{
asset::{
graph::{ResourceDependencyGraph, ResourceGraphNode},
untyped::UntypedResource,
},
core::{log::Log, pool::Handle},
gui::{
button::{ButtonBuilder, ButtonMessage},
copypasta::ClipboardProvider,
grid::{Column, GridBuilder, Row},
message::UiMessage,
scroll_viewer::ScrollViewerBuilder,
stack_panel::StackPanelBuilder,
text::TextBuilder,
tree::{TreeBuilder, TreeRootBuilder, TreeRootMessage},
widget::WidgetBuilder,
window::{WindowBuilder, WindowMessage, WindowTitle},
BuildContext, HorizontalAlignment, Orientation, Thickness, UserInterface,
VerticalAlignment,
use crate::{
fyrox::{
asset::{
graph::{ResourceDependencyGraph, ResourceGraphNode},
untyped::UntypedResource,
},
core::{log::Log, pool::Handle},
gui::{
button::{ButtonBuilder, ButtonMessage},
copypasta::ClipboardProvider,
grid::{Column, GridBuilder, Row},
message::UiMessage,
scroll_viewer::ScrollViewerBuilder,
stack_panel::StackPanelBuilder,
text::TextBuilder,
tree::{TreeBuilder, TreeRootBuilder, TreeRootMessage},
widget::WidgetBuilder,
window::{WindowBuilder, WindowMessage, WindowTitle},
BuildContext, HorizontalAlignment, Orientation, Thickness, UserInterface,
VerticalAlignment,
},
},
Editor,
};
use fyrox::asset::manager::ResourceManager;
use fyrox::gui::button::Button;
use fyrox::gui::tree::{Tree, TreeRoot};
use fyrox::gui::window::{Window, WindowAlignment};
use fyrox::{asset::manager::ResourceManager, gui::style::resource::StyleResourceExt};

pub struct DependencyViewer {
pub window: Handle<Window>,
Expand Down Expand Up @@ -77,6 +80,7 @@ fn build_tree_recursively(
WidgetBuilder::new().with_vertical_alignment(VerticalAlignment::Center),
)
.with_text(format!("{name} ({data_type})"))
.with_font_size(ctx.style.property(Editor::UI_FONT_SIZE))
.build(ctx),
)
.build(ctx)
Expand All @@ -89,7 +93,11 @@ impl DependencyViewer {
let close;
let window = WindowBuilder::new(WidgetBuilder::new().with_width(300.0).with_height(400.0))
.open(false)
.with_title(WindowTitle::text("Dependency Viewer"))
.with_title(WindowTitle::text_with_font_size(
"Dependency Viewer",
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
))
.with_content(
GridBuilder::new(
WidgetBuilder::new()
Expand All @@ -116,7 +124,11 @@ impl DependencyViewer {
.with_width(130.0)
.with_margin(Thickness::uniform(1.0)),
)
.with_text("Copy To Clipboard")
.with_text_and_font_size(
"Copy To Clipboard",
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
)
.build(ctx);
copy_to_clipboard
})
Expand All @@ -126,7 +138,11 @@ impl DependencyViewer {
.with_width(130.0)
.with_margin(Thickness::uniform(1.0)),
)
.with_text("Close")
.with_text_and_font_size(
"Close",
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
)
.build(ctx);
close
}),
Expand Down
4 changes: 3 additions & 1 deletion editor/src/asset/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use crate::{
scene::tilemap::{brush::TileMapBrush, tileset::TileSet},
},
message::MessageSender,
Message,
Editor, Message,
};
use fyrox::core::ok_or_return;
use fyrox::gui::border::Border;
Expand Down Expand Up @@ -357,6 +357,7 @@ fn make_tooltip(ctx: &mut BuildContext, text: &str) -> RcUiNodeHandle {
)
.with_wrap(WrapMode::Letter)
.with_text(text)
.with_font_size(ctx.style.property(Editor::UI_FONT_SIZE))
.build(ctx),
),
)
Expand Down Expand Up @@ -421,6 +422,7 @@ impl AssetItemBuilder {
.to_string(),
)
.with_shadow(true)
.with_font_size(ctx.style.property(Editor::UI_FONT_SIZE))
.build(ctx),
),
)
Expand Down
57 changes: 45 additions & 12 deletions editor/src/asset/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ use crate::{
fyrox::{
asset::manager::ResourceManager,
core::{
futures::executor::block_on, log::Log, ok_or_return, pool::Handle,
pool::HandlesVecExtension, reflect::prelude::*, type_traits::prelude::*,
visitor::prelude::*, SafeLock,
futures::executor::block_on,
log::Log,
ok_or_return,
pool::{Handle, HandlesVecExtension},
reflect::prelude::*,
type_traits::prelude::*,
visitor::prelude::*,
SafeLock,
},
engine::Engine,
graph::SceneGraph,
Expand All @@ -44,6 +49,7 @@ use crate::{
},
popup::{Placement, PopupBuilder, PopupMessage},
stack_panel::StackPanelBuilder,
style::resource::StyleResourceExt,
text::{TextBuilder, TextMessage},
text_box::{TextBox, TextBoxBuilder, TextCommitMode},
widget::{Widget, WidgetBuilder, WidgetMessage},
Expand All @@ -53,7 +59,7 @@ use crate::{
},
},
message::MessageSender,
Message,
Editor, Message,
};
use std::{
fs::File,
Expand Down Expand Up @@ -163,6 +169,7 @@ impl AssetRenameDialogBuilder {
"Enter a new name for {old_file_name}.{extension} resource."
))
.with_wrap(WrapMode::Word)
.with_font_size(ctx.style.property(Editor::UI_FONT_SIZE))
.build(ctx),
)
.with_child({
Expand All @@ -174,6 +181,7 @@ impl AssetRenameDialogBuilder {
)
.with_text(&old_file_name)
.with_text_commit_mode(TextCommitMode::Immediate)
.with_font_size(ctx.style.property(Editor::UI_FONT_SIZE))
.build(ctx);
name_field
})
Expand All @@ -190,7 +198,11 @@ impl AssetRenameDialogBuilder {
.with_height(24.0)
.with_tab_index(Some(1)),
)
.with_text("Rename")
.with_text_and_font_size(
"Rename",
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
)
.build(ctx);
rename
})
Expand All @@ -202,7 +214,11 @@ impl AssetRenameDialogBuilder {
.with_height(24.0)
.with_tab_index(Some(2)),
)
.with_text("Cancel")
.with_text_and_font_size(
"Cancel",
ctx.default_font(),
ctx.style.property(Editor::UI_FONT_SIZE),
)
.build(ctx);
cancel
}),
Expand Down Expand Up @@ -256,6 +272,7 @@ impl AssetItemContextMenu {
fn item(text: &str, ctx: &mut BuildContext) -> Handle<MenuItem> {
MenuItemBuilder::new(WidgetBuilder::new())
.with_content(MenuItemContent::text(text))
.with_font_size(ctx.style.property(Editor::UI_FONT_SIZE))
.build(ctx)
}

Expand Down Expand Up @@ -365,9 +382,15 @@ impl AssetItemContextMenu {
)
.open(false)
.with_remove_on_close(true)
.with_title(WindowTitle::text("Confirm Deletion")),
.with_title(WindowTitle::text_with_font_size(
"Confirm Deletion",
ui.default_font.clone(),
ui.style.property(Editor::UI_FONT_SIZE),
)),
)
.with_text(&text)
.with_font(ui.default_font.clone())
.with_font_size(ui.style.property(Editor::UI_FONT_SIZE))
.with_buttons(MessageBoxButtons::YesNo)
.build(&mut ui.build_ctx());

Expand Down Expand Up @@ -494,19 +517,29 @@ impl AssetItemContextMenu {
item.path.extension(),
item.path.parent(),
) {
let (old_file_name, extension_name, folder_name, old_path) = (
file_stem.to_string_lossy().to_string(),
extension.to_string_lossy().to_string(),
parent.to_string_lossy().to_string(),
item.path.clone(),
);
let dialog = AssetRenameDialogBuilder::new(
WindowBuilder::new(
WidgetBuilder::new().with_width(350.0).with_height(100.0),
)
.with_title(WindowTitle::text("Rename a Resource"))
.with_title(WindowTitle::text_with_font_size(
"Rename a Resource",
ui.default_font.clone(),
ui.style.property(Editor::UI_FONT_SIZE),
))
.with_remove_on_close(true)
.open(false),
)
.build(
file_stem.to_string_lossy().to_string(),
extension.to_string_lossy().to_string(),
parent.to_string_lossy().to_string(),
item.path.clone(),
old_file_name,
extension_name,
folder_name,
old_path,
engine.resource_manager.clone(),
&mut ui.build_ctx(),
);
Expand Down
Loading
Loading