mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 15:38:11 +08:00
Add the File > Export dialog and PNG/JPG downloading (#629)
* Add export dialog * Code review changes * More code review feedback * Fix compilation on stable Rust * Fixes to problems Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
e3e506ecfb
commit
060182fd31
@@ -27,6 +27,7 @@ pub enum FrontendMessage {
|
||||
TriggerFontLoadDefault,
|
||||
TriggerIndexedDbRemoveDocument { document_id: u64 },
|
||||
TriggerIndexedDbWriteDocument { document: String, details: FrontendDocumentDetails, version: String },
|
||||
TriggerRasterDownload { document: String, name: String, mime: String, size: (f64, f64) },
|
||||
TriggerTextCommit,
|
||||
TriggerTextCopy { copy_text: String },
|
||||
TriggerViewportResize,
|
||||
|
||||
@@ -31,6 +31,41 @@ pub enum MouseCursorIcon {
|
||||
|
||||
impl Default for MouseCursorIcon {
|
||||
fn default() -> Self {
|
||||
Self::Default
|
||||
MouseCursorIcon::Default
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Deserialize, PartialEq, Serialize)]
|
||||
pub enum FileType {
|
||||
Svg,
|
||||
Png,
|
||||
Jpg,
|
||||
}
|
||||
|
||||
impl Default for FileType {
|
||||
fn default() -> Self {
|
||||
FileType::Svg
|
||||
}
|
||||
}
|
||||
|
||||
impl FileType {
|
||||
pub fn to_mime(self) -> &'static str {
|
||||
match self {
|
||||
FileType::Svg => "image/svg+xml",
|
||||
FileType::Png => "image/png",
|
||||
FileType::Jpg => "image/jpeg",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Deserialize, PartialEq, Serialize)]
|
||||
pub enum ExportBounds {
|
||||
AllArtwork,
|
||||
Artboard(LayerId),
|
||||
}
|
||||
|
||||
impl Default for ExportBounds {
|
||||
fn default() -> Self {
|
||||
ExportBounds::AllArtwork
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user