forked from 1b-agent/opencadstudio-upstream
Merge PR #1036: add paper sizes
This commit is contained in:
commit
e889864855
2 files changed
+23
-2
No files matched your search
+10
-1
@@ -133,6 +133,9 @@ fn plot_dialog_sheet_mm(d: &crate::ui::window::plot::PlotDialogState) -> (f64, f
|
||||
"A1" => Some(PaperSize::A1),
|
||||
"A0" => Some(PaperSize::A0),
|
||||
"A4" => Some(PaperSize::A4),
|
||||
"Letter" => Some(PaperSize::Letter),
|
||||
"Legal" => Some(PaperSize::Legal),
|
||||
"Tabloid" => Some(PaperSize::Tabloid),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(paper) = standard {
|
||||
@@ -4285,7 +4288,10 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
.as_deref()
|
||||
.is_some_and(|name| name.eq_ignore_ascii_case(&style_name));
|
||||
let (mut paper, orient) = paper_label_from_dims(ps.paper_width, ps.paper_height);
|
||||
if !matches!(paper.as_str(), "A4" | "A3" | "A2" | "A1" | "A0")
|
||||
if !matches!(
|
||||
paper.as_str(),
|
||||
"A4" | "A3" | "A2" | "A1" | "A0" | "Letter" | "Legal" | "Tabloid"
|
||||
)
|
||||
&& !ps.paper_size.is_empty()
|
||||
{
|
||||
paper = ps.paper_size.clone();
|
||||
@@ -4389,6 +4395,9 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
"A2" => PaperSize::A2,
|
||||
"A1" => PaperSize::A1,
|
||||
"A0" => PaperSize::A0,
|
||||
"Letter" => PaperSize::Letter,
|
||||
"Legal" => PaperSize::Legal,
|
||||
"Tabloid" => PaperSize::Tabloid,
|
||||
_ => PaperSize::A4,
|
||||
};
|
||||
let orient = if d.orientation == "Portrait" {
|
||||
|
||||
+13
-1
@@ -7,15 +7,21 @@ pub enum PaperSize {
|
||||
A2,
|
||||
A1,
|
||||
A0,
|
||||
Letter,
|
||||
Legal,
|
||||
Tabloid,
|
||||
}
|
||||
|
||||
impl PaperSize {
|
||||
pub const ALL: [PaperSize; 5] = [
|
||||
pub const ALL: [PaperSize; 8] = [
|
||||
PaperSize::A4,
|
||||
PaperSize::A3,
|
||||
PaperSize::A2,
|
||||
PaperSize::A1,
|
||||
PaperSize::A0,
|
||||
PaperSize::Letter,
|
||||
PaperSize::Legal,
|
||||
PaperSize::Tabloid,
|
||||
];
|
||||
|
||||
pub fn label(self) -> &'static str {
|
||||
@@ -25,6 +31,9 @@ impl PaperSize {
|
||||
PaperSize::A2 => "A2",
|
||||
PaperSize::A1 => "A1",
|
||||
PaperSize::A0 => "A0",
|
||||
PaperSize::Letter => "Letter",
|
||||
PaperSize::Legal => "Legal",
|
||||
PaperSize::Tabloid => "Tabloid",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +45,9 @@ impl PaperSize {
|
||||
PaperSize::A2 => (420.0, 594.0),
|
||||
PaperSize::A1 => (594.0, 841.0),
|
||||
PaperSize::A0 => (841.0, 1189.0),
|
||||
PaperSize::Letter => (215.9, 279.4),
|
||||
PaperSize::Legal => (215.9, 355.6),
|
||||
PaperSize::Tabloid => (279.4, 431.8),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user