Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

Grid: larger thumbnail sizes (512, 768, 1024 px)

Dylan-ISE0559c9221876
diff --git a/crates/rf-app/src/folder_view.rs b/crates/rf-app/src/folder_view.rs
index a05186e9..4da44feb 100644
--- a/crates/rf-app/src/folder_view.rs
+++ b/crates/rf-app/src/folder_view.rs
@@ -3573,6 +3573,16 @@ impl FolderView {
px(sizes[(self.row_size as usize).min(sizes.len() - 1)])
}
+ /// How many stops the layout panel's size slider shows for the layout on screen: one per size it has
+ /// (Details' row heights, the Tiles grid's steps). Layouts without sizes keep the slider's old five.
+ pub(crate) fn size_stops(mode: ViewMode, style: GridStyle) -> usize {
+ match (mode, style) {
+ (ViewMode::Details, _) => ROW_SIZES.len(),
+ (ViewMode::Grid, GridStyle::Tiles) => GRID_SIZES.len(),
+ _ => 5,
+ }
+ }
+
/// The "Size" slider's position for the current layout (`None`: it has no sizes).
pub fn layout_size(&self) -> Option<u8> {
match (self.view_mode, self.grid_style) {
@@ -7915,7 +7925,7 @@ const LIST_CELL_CHROME: f32 = 8. + 20. + 8. + 8. + 12.;
const LIST_MEASURE_MOST: usize = 4000;
/// Grid sizes (Ctrl+= / Ctrl+-): tile width, row height, thumbnail pixels. A row is high enough for the picture and two whole lines
/// of the name (see `tile_name_room`).
-pub(crate) const GRID_SIZES: [(f32, f32, u32); 5] = [(76., 102., 64), (92., 114., 80), (124., 150., 128), (172., 204., 192), (236., 276., 272)];
+pub(crate) const GRID_SIZES: [(f32, f32, u32); 8] = [(76., 102., 64), (92., 114., 80), (124., 150., 128), (172., 204., 192), (236., 276., 272), (412., 456., 512), (604., 648., 768), (796., 848., 1024)];
/// The height of one line of a tile's name. It is set on the label instead of left to the toolkit's default (1.618 of the text size,
/// 19.4 px): two such lines were higher than the room under the picture, and the second one was cut in half at the tile's edge
/// with "Compact items" on (a Discord report).
diff --git a/crates/rf-app/src/layout_panel.rs b/crates/rf-app/src/layout_panel.rs
index 134c73f5..ed5d6513 100644
--- a/crates/rf-app/src/layout_panel.rs
+++ b/crates/rf-app/src/layout_panel.rs
@@ -15,7 +15,6 @@ use crate::t;
use crate::theme::{self, Palette};
const WIDTH: f32 = 436.;
-const STOPS: usize = 5;
pub fn open(view: WeakEntity<FolderView>, dual: bool, shelf: bool, pos: Point<Pixels>, window: &mut Window, cx: &mut App) {
let owner = window.window_handle();
@@ -79,13 +78,14 @@ fn render(v: &Entity<FolderView>, owner: AnyWindowHandle, dual: Rc<Cell<bool>>,
// ---- size slider (Details row height / grid tile size)
let enabled = size.is_some();
+ let stops = FolderView::size_stops(mode, style) as f32;
let cur = size.unwrap_or(1) as usize;
- let frac = cur as f32 / (STOPS - 1) as f32;
+ let frac = cur as f32 / (stops - 1.) as f32;
let track_color = if enabled { p.accent } else { p.text_tertiary };
- let mut stops = h_flex().absolute().inset_0();
- for i in 0..STOPS {
+ let mut stop_row = h_flex().absolute().inset_0();
+ for i in 0..stops as usize {
let w = weak.clone();
- stops = stops.child(
+ stop_row = stop_row.child(
div()
.id(("lt-stop", i))
.flex_1()
@@ -125,7 +125,7 @@ fn render(v: &Entity<FolderView>, owner: AnyWindowHandle, dual: Rc<Cell<bool>>,
.border_color(p.border)
.child(div().m(px(4.)).size(px(8.)).rounded_full().bg(track_color)),
)
- .child(stops);
+ .child(stop_row);
let size_icons = h_flex().mx_4().mt_1().justify_between().text_color(if enabled { p.text_secondary } else { p.text_tertiary }).children(
[12., 14., 16., 18., 20.]
.into_iter()
diff --git a/crates/rf-app/src/settings_view.rs b/crates/rf-app/src/settings_view.rs
index d8e945bf..c2bf84cf 100644
--- a/crates/rf-app/src/settings_view.rs
+++ b/crates/rf-app/src/settings_view.rs
@@ -298,10 +298,10 @@ pub(crate) fn sw(id: &'static str, p: &Palette, on: bool, set: fn(&mut Settings,
}
/// A button showing the current value; clicking opens the choices in our menu.
-/// The five size steps of the list's rows or of the grid's tiles, by their height in pixels (names like "Medium" read as other
+/// The size steps of the list's rows or of the grid's tiles, by their height in pixels (names like "Medium" read as other
/// things in some languages: "Orta" had become "Fair"); the default step is marked.
-fn size_steps(px: [f32; 5], default: u8) -> Vec<(u8, String)> {
- (0..5u8)
+fn size_steps<const N: usize>(px: [f32; N], default: u8) -> Vec<(u8, String)> {
+ (0..N as u8)
.map(|i| {
let mut label = format!("{} px", px[i as usize] as u32);
if i == default {