forked from 1b-agent/opencadstudio-upstream
Merge pull request #1810 from ramox81/codex/insert-import-panel
Insert ribbon: Import panel # Conflicts: # locales/ar-SA/opencadstudio.ftl # locales/bg-BG/opencadstudio.ftl # locales/cs-CZ/opencadstudio.ftl # locales/de-DE/opencadstudio.ftl # locales/el-GR/opencadstudio.ftl # locales/en-US/opencadstudio.ftl # locales/es-ES/opencadstudio.ftl # locales/fi-FI/opencadstudio.ftl # locales/fr-FR/opencadstudio.ftl # locales/hi-IN/opencadstudio.ftl # locales/hu-HU/opencadstudio.ftl # locales/it-IT/opencadstudio.ftl # locales/ja-JP/opencadstudio.ftl # locales/ko-KR/opencadstudio.ftl # locales/lo-LA/opencadstudio.ftl # locales/nl-NL/opencadstudio.ftl # locales/pl-PL/opencadstudio.ftl # locales/pt-BR/opencadstudio.ftl # locales/ru-RU/opencadstudio.ftl # locales/tr-TR/opencadstudio.ftl # locales/zh-CN/opencadstudio.ftl # locales/zh-TW/opencadstudio.ftl # src/modules/insert/mod.rs # src/ui/ribbon/draw_panel.rs
This commit is contained in:
commit
443d3ec13d
33 files changed
+285
-42
No files matched your search
+17
-1
@@ -50,6 +50,11 @@ pub(crate) fn tooltip_style(theme: &Theme) -> container::Style {
|
||||
widgets::tip_style(theme)
|
||||
}
|
||||
|
||||
/// A line over the items of a split button whose face names the chosen item.
|
||||
fn dropdown_header(id: &str) -> Option<&'static str> {
|
||||
(id == "IMPORT_FILE").then_some("Import File — the face runs the last one chosen")
|
||||
}
|
||||
|
||||
// ── Ribbon state ───────────────────────────────────────────────────────────
|
||||
|
||||
pub struct Ribbon {
|
||||
@@ -1069,11 +1074,22 @@ impl Ribbon {
|
||||
.iter()
|
||||
.map(|(_, label, _)| t!(*label).to_string())
|
||||
.collect();
|
||||
let header = dropdown_header(dd_id).map(|header| t!(header).into_owned());
|
||||
let mut rows = rows;
|
||||
if let Some(header) = &header {
|
||||
rows.insert(
|
||||
0,
|
||||
container(text(header.clone()).size(10).style(muted_text_style))
|
||||
.padding([4, 10])
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
let panel_w = crate::ui::style::common::dropdown_popup_width(
|
||||
labels.iter().map(|s| s.as_str()),
|
||||
11.0,
|
||||
68.0,
|
||||
190.0,
|
||||
// A header wraps rather than widening the menu.
|
||||
if header.is_some() { 240.0 } else { 190.0 },
|
||||
);
|
||||
|
||||
let panel = container(column(rows))
|
||||
|
||||
Reference in new issue
Block a user