mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
Shortcuts reference opens at a moderate fixed height; FindBar options icon is the adjustments glyph (trial)
This commit is contained in:
@@ -445,6 +445,10 @@ impl<'a> ShortcutsDialog<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The size a read-only shortcuts dialog opens at, in points.
|
||||
const READ_ONLY_WIDTH: f32 = 560.0;
|
||||
const READ_ONLY_HEIGHT: f32 = 480.0;
|
||||
|
||||
/// What a footer button does.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum Act {
|
||||
@@ -499,9 +503,13 @@ fn frame(ui: &mut Ui, env: &mut Env<'_>, state: &mut DialogState) -> ShortcutsOu
|
||||
let enter = env.options.enter_is_ok && !state.modal() && !state.is_recording();
|
||||
let title = env.title();
|
||||
let mut open = true;
|
||||
// A read-only reference opens at a fixed, moderate height (production's key list scrolls inside it), not at the
|
||||
// window's; the user's own resize is still remembered.
|
||||
let reference = !env.options.editable;
|
||||
let session = RefCell::new(Session { env, state });
|
||||
let shown = Dialog::new(title)
|
||||
.resizable(true)
|
||||
.overlay(|overlay| if reference { overlay.size(egui::vec2(READ_ONLY_WIDTH, READ_ONLY_HEIGHT)) } else { overlay })
|
||||
.remember(SaveKey::new("craft_menu.shortcuts"))
|
||||
.outer_gesture(true)
|
||||
.collection_body()
|
||||
|
||||
@@ -4,3 +4,17 @@ mod import_offer;
|
||||
mod recorder;
|
||||
mod rows;
|
||||
mod sets;
|
||||
|
||||
use craft_keymap::Platform;
|
||||
use craft_ui::testing::trial;
|
||||
|
||||
use fixture::Rig;
|
||||
|
||||
/// A read-only shortcuts reference does not stretch to the window's height: it opens at a moderate, fixed height and
|
||||
/// scrolls inside it.
|
||||
#[trial]
|
||||
fn a_read_only_dialog_opens_at_a_moderate_height() {
|
||||
let rig = Rig::tuned(Platform::Windows, |options| options.editable = false);
|
||||
let close = rig.fixture.by_label("Close").expect("the close button");
|
||||
assert!(close.rect.bottom() < 560.0, "the dialog's footer sits within a moderate height, not the 700-point window: {:?}", close.rect);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ impl<'a> FindBar<'a> {
|
||||
*open = !*open;
|
||||
}
|
||||
let active = options.match_case || options.whole_word;
|
||||
let button = IconButton::new(IconId::new("sliders-horizontal")).label(words.options.clone()).popup(PopupKind::Menu).selected(active).show(ui);
|
||||
let button = IconButton::new(IconId::new("adjustments")).label(words.options.clone()).popup(PopupKind::Menu).selected(active).show(ui);
|
||||
let entries = [
|
||||
Entry::new(BarOption::WholeWords, words.whole_words_only.clone()).checked(options.whole_word),
|
||||
Entry::new(BarOption::MatchCase, words.case_sensitive.clone()).checked(options.match_case),
|
||||
|
||||
Reference in New Issue
Block a user