mirror of https://github.com/lapce/lapce.git
Use static str in LapceIcon
This commit is contained in:
parent
066135b824
commit
fd1ecc1514
|
@ -55,7 +55,7 @@ pub fn get_icons(&self, self_size: Size, data: &LapceTabData) -> Vec<LapceIcon>
|
|||
let x =
|
||||
self_size.width - ((icons.len() + 1) as f64) * (gap + self.icon_size);
|
||||
let icon = LapceIcon {
|
||||
icon: "close.svg".to_string(),
|
||||
icon: "close.svg",
|
||||
rect: Size::new(self.icon_size, self.icon_size)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(x, gap)),
|
||||
|
@ -73,7 +73,7 @@ pub fn get_icons(&self, self_size: Size, data: &LapceTabData) -> Vec<LapceIcon>
|
|||
let x =
|
||||
self_size.width - ((icons.len() + 1) as f64) * (gap + self.icon_size);
|
||||
let icon = LapceIcon {
|
||||
icon: "split-horizontal.svg".to_string(),
|
||||
icon: "split-horizontal.svg",
|
||||
rect: Size::new(self.icon_size, self.icon_size)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(x, gap)),
|
||||
|
|
|
@ -152,7 +152,7 @@ fn layout(
|
|||
let x =
|
||||
size.width - ((self.icons.len() + 1) as f64) * (gap + icon_size);
|
||||
let icon = LapceIcon {
|
||||
icon: "close.svg".to_string(),
|
||||
icon: "close.svg",
|
||||
rect: Size::new(icon_size, icon_size)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(x, gap)),
|
||||
|
@ -167,7 +167,7 @@ fn layout(
|
|||
let x =
|
||||
size.width - ((self.icons.len() + 1) as f64) * (gap + icon_size);
|
||||
let icon = LapceIcon {
|
||||
icon: "split-horizontal.svg".to_string(),
|
||||
icon: "split-horizontal.svg",
|
||||
rect: Size::new(icon_size, icon_size)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(x, gap)),
|
||||
|
|
|
@ -27,7 +27,7 @@ pub fn new(view_id: WidgetId, parent_view_id: WidgetId) -> Self {
|
|||
.padding((10.0, 5.0));
|
||||
let icons = vec![
|
||||
LapceIcon {
|
||||
icon: "arrow-up.svg".to_string(),
|
||||
icon: "arrow-up.svg",
|
||||
rect: Rect::ZERO,
|
||||
command: Command::new(
|
||||
LAPCE_COMMAND,
|
||||
|
@ -39,7 +39,7 @@ pub fn new(view_id: WidgetId, parent_view_id: WidgetId) -> Self {
|
|||
),
|
||||
},
|
||||
LapceIcon {
|
||||
icon: "arrow-down.svg".to_string(),
|
||||
icon: "arrow-down.svg",
|
||||
rect: Rect::ZERO,
|
||||
command: Command::new(
|
||||
LAPCE_COMMAND,
|
||||
|
@ -51,7 +51,7 @@ pub fn new(view_id: WidgetId, parent_view_id: WidgetId) -> Self {
|
|||
),
|
||||
},
|
||||
LapceIcon {
|
||||
icon: "close.svg".to_string(),
|
||||
icon: "close.svg",
|
||||
rect: Rect::ZERO,
|
||||
command: Command::new(
|
||||
LAPCE_COMMAND,
|
||||
|
|
|
@ -408,7 +408,7 @@ fn update_icons(&mut self, self_size: Size, data: &LapceTabData) {
|
|||
let mut icons = Vec::new();
|
||||
let x = self_size.width - ((icons.len() + 1) as f64) * (gap + icon_size);
|
||||
let icon = LapceIcon {
|
||||
icon: "close.svg".to_string(),
|
||||
icon: "close.svg",
|
||||
rect: Size::new(icon_size, icon_size)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(x, gap)),
|
||||
|
@ -441,7 +441,7 @@ fn update_icons(&mut self, self_size: Size, data: &LapceTabData) {
|
|||
let x =
|
||||
self_size.width - ((icons.len() + 1) as f64) * (gap + icon_size);
|
||||
let icon = LapceIcon {
|
||||
icon: icon_svg.to_string(),
|
||||
icon: icon_svg,
|
||||
rect: Size::new(icon_size, icon_size)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(x, gap)),
|
||||
|
|
|
@ -67,7 +67,7 @@ fn panel_icons(&self, self_size: Size, data: &LapceTabData) -> Vec<LapceIcon> {
|
|||
};
|
||||
|
||||
LapceIcon {
|
||||
icon: p.svg_name().to_string(),
|
||||
icon: p.svg_name(),
|
||||
rect: Size::new(self_size.height, self_size.height)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(
|
||||
|
|
|
@ -44,8 +44,8 @@ pub fn logo_svg() -> Svg {
|
|||
svgs.get(name).cloned().unwrap().unwrap()
|
||||
}
|
||||
|
||||
pub fn get_svg(name: &str) -> Option<Svg> {
|
||||
SVG_STORE.get_svg(name)
|
||||
pub fn get_svg(name: impl AsRef<str>) -> Option<Svg> {
|
||||
SVG_STORE.get_svg(name.as_ref())
|
||||
}
|
||||
|
||||
pub fn file_svg_new(path: &Path) -> Svg {
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
pub struct LapceIcon {
|
||||
pub rect: Rect,
|
||||
pub command: Command,
|
||||
pub icon: String,
|
||||
pub icon: &'static str,
|
||||
}
|
||||
|
||||
pub struct LapceButton {
|
||||
|
|
|
@ -331,7 +331,7 @@ fn get_icons(&self, self_size: Size, data: &LapceTabData) -> Vec<LapceIcon> {
|
|||
let x =
|
||||
self_size.width - ((icons.len() + 1) as f64) * (gap + self.icon_size);
|
||||
let icon = LapceIcon {
|
||||
icon: "close.svg".to_string(),
|
||||
icon: "close.svg",
|
||||
rect: Size::new(self.icon_size, self.icon_size)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(x, gap)),
|
||||
|
@ -346,7 +346,7 @@ fn get_icons(&self, self_size: Size, data: &LapceTabData) -> Vec<LapceIcon> {
|
|||
let x =
|
||||
self_size.width - ((icons.len() + 1) as f64) * (gap + self.icon_size);
|
||||
let icon = LapceIcon {
|
||||
icon: "split-horizontal.svg".to_string(),
|
||||
icon: "split-horizontal.svg",
|
||||
rect: Size::new(self.icon_size, self.icon_size)
|
||||
.to_rect()
|
||||
.with_origin(Point::new(x, gap)),
|
||||
|
|
Loading…
Reference in New Issue