Theme · Platform: one platform for buttons and caps, icon themes, frosted panes
theme::Platform moves out of typography and shell's ControlsStyle folds into it; the theme's platform starts as the system's. Window buttons Ely draws, the title bar's layout and every key cap follow it, secondary included, through typography::keys::keystroke; a title bar whose buttons the OS draws follows the OS. primitives::IconTheme lays an owner's rules by file name and extension over Ely's map, for every file icon. shell::Vibrancy fills a pane with the palette's new glass, translucent so a window opened Blurred shows its backdrop, solid under high contrast. gpui 0.2.2 has no Mica; that line stays blocked.
This commit is contained in:
1 parent
7f2205c811
commit
d3cfc71ead
30 files changed
+593
-162
No files matched your search
@@ -98,6 +98,7 @@ impl RenderOnce for RichTextEditor {
|
||||
};
|
||||
let (open_link, close_link) = (set_linking(true), set_linking(false));
|
||||
let float_id: ElementId = (self.id.clone(), "float").into();
|
||||
let platform = cx.theme().platform;
|
||||
let floating = FloatingToolbar::new(float_id.clone(), &self.field).children(
|
||||
INLINE.iter().map(|tool_of| {
|
||||
let on = pressed.contains(&tool_of.0);
|
||||
@@ -107,6 +108,7 @@ impl RenderOnce for RichTextEditor {
|
||||
*tool_of,
|
||||
on,
|
||||
Some(open_link.clone()),
|
||||
platform,
|
||||
)
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use gpui::{App, ElementId, Entity, IntoElement, Keystroke, ParentElement, RenderOnce, Window};
|
||||
use gpui::{App, ElementId, Entity, IntoElement, ParentElement, RenderOnce, Window};
|
||||
|
||||
use super::format::{Format, active, format};
|
||||
use crate::{
|
||||
@@ -6,7 +6,7 @@ use crate::{
|
||||
forms::{Run, TextInput},
|
||||
primitives::IconName,
|
||||
shell::{Toolbar, ToolbarGroup, ToolbarSeparator},
|
||||
theme::ControlSize,
|
||||
theme::{ActiveTheme, ControlSize, Platform},
|
||||
};
|
||||
|
||||
/// A tool: the format it applies, its icon, its name and its key.
|
||||
@@ -56,12 +56,10 @@ pub(crate) fn tool(
|
||||
(format_of, icon, name, key): Tool,
|
||||
on: bool,
|
||||
on_link: Option<Run>,
|
||||
platform: Platform,
|
||||
) -> ToggleButton {
|
||||
let tip = match key {
|
||||
Some(key) => {
|
||||
let stroke = Keystroke::parse(key).expect("a tool's key parses");
|
||||
format!("{name} {}", shortcut_text(&stroke))
|
||||
}
|
||||
Some(key) => format!("{name} {}", shortcut_text(key, platform)),
|
||||
None => name.to_string(),
|
||||
};
|
||||
let field = field.clone();
|
||||
@@ -105,10 +103,18 @@ impl RenderOnce for FixedFormatToolbar {
|
||||
fn render(self, _: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||
let input = self.field.read(cx);
|
||||
let pressed = active(input.text(), input.selection());
|
||||
let platform = cx.theme().platform;
|
||||
let group = |tools: &[Tool]| {
|
||||
ToolbarGroup::new().children(tools.iter().map(|tool_of| {
|
||||
let on = pressed.contains(&tool_of.0);
|
||||
tool(&self.id, &self.field, *tool_of, on, self.on_link.clone())
|
||||
tool(
|
||||
&self.id,
|
||||
&self.field,
|
||||
*tool_of,
|
||||
on,
|
||||
self.on_link.clone(),
|
||||
platform,
|
||||
)
|
||||
}))
|
||||
};
|
||||
Toolbar::new()
|
||||
|
||||
Reference in new issue
Block a user