wip: opening trainer v2 desktop UI (repertoires, session, lines), i18n, devhooks doc
One repertoire_ui test still fails (see docs/qa/opening-trainer-v2-devhooks.md).
This commit is contained in:
parent
3db35e4d03
commit
98f0e4749f
18 changed files with 9865 additions and 13790 deletions
|
|
@ -11,6 +11,7 @@ pub fn settings_button(ui: &mut Ui, compact: bool) -> egui::Response {
|
|||
|
||||
/// A section header: reserve global actions before laying out a long title.
|
||||
/// Returns (back, settings).
|
||||
#[allow(dead_code)]
|
||||
pub fn section_header(ui: &mut Ui, back: &str, title: &str) -> (bool, bool) {
|
||||
let mut clicked = (false, false);
|
||||
let compact = ui.available_width() < 600.0;
|
||||
|
|
@ -29,6 +30,37 @@ pub fn section_header(ui: &mut Ui, back: &str, title: &str) -> (bool, bool) {
|
|||
clicked
|
||||
}
|
||||
|
||||
/// A two-line section header in the places of the game's (title and a quiet line under
|
||||
/// it; an empty subtitle keeps its line, so the header never changes height).
|
||||
/// Returns (back, settings).
|
||||
pub fn section_header_sub(ui: &mut Ui, back: &str, title: &str, subtitle: &str) -> (bool, bool) {
|
||||
let mut clicked = (false, false);
|
||||
let compact = ui.available_width() < 600.0;
|
||||
ui.add_space(4.0);
|
||||
ui.horizontal(|ui| {
|
||||
clicked.0 = ui.button(back).clicked();
|
||||
ui.separator();
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
clicked.1 = settings_button(ui, compact).clicked();
|
||||
ui.with_layout(egui::Layout::top_down(egui::Align::Min), |ui| {
|
||||
ui.add(egui::Label::new(egui::RichText::new(title).strong().size(16.0)).truncate())
|
||||
.on_hover_text(title);
|
||||
let sub = ui.add(
|
||||
egui::Label::new(
|
||||
egui::RichText::new(if subtitle.is_empty() { " " } else { subtitle })
|
||||
.weak(),
|
||||
)
|
||||
.truncate(),
|
||||
);
|
||||
if !subtitle.is_empty() {
|
||||
sub.on_hover_text(subtitle);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
clicked
|
||||
}
|
||||
|
||||
/// A dev check (`CP_PANEL_CHECK=1`): a panel whose content is wider than the panel. egui
|
||||
/// then moves a right panel out (its left part under the central panel, its right part
|
||||
/// off the window); the content of every panel must fit its least width
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue