Skip to content

Commit

Permalink
Bugfix on image print size.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbarex committed May 29, 2021
1 parent f660254 commit 928c192
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 22 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=======

### 1.5.1
- Bugfix on image print size.

### 1.5
- New user interface.
- Customization of all menu items.
Expand Down
32 changes: 16 additions & 16 deletions MediaInfo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11264,7 +11264,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -11281,7 +11281,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.5.1;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.MediaInfo;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -11299,7 +11299,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -11316,7 +11316,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.5.1;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.MediaInfo;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -11332,7 +11332,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_ASSET_PATHS = "MediaInfo\\ Finder\\ Extension/Assets_menu.xcassets";
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -11347,7 +11347,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.5.1;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = "org.sbarex.MediaInfo.Finder-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -11364,7 +11364,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_ASSET_PATHS = "MediaInfo\\ Finder\\ Extension/Assets_menu.xcassets";
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -11379,7 +11379,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.5.1;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = "org.sbarex.MediaInfo.Finder-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -11439,7 +11439,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
HEADER_SEARCH_PATHS = (
Expand All @@ -11459,7 +11459,7 @@
"$(BUILT_PRODUCTS_DIR)/libwebp",
"$(inherited)",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.5.1;
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.MediaInfoHelperXPC;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -11477,7 +11477,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
HEADER_SEARCH_PATHS = (
Expand All @@ -11497,7 +11497,7 @@
"$(BUILT_PRODUCTS_DIR)/libwebp",
"$(inherited)",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.5.1;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.MediaInfoHelperXPC;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -11514,7 +11514,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
HEADER_SEARCH_PATHS = (
Expand All @@ -11534,7 +11534,7 @@
"$(BUILT_PRODUCTS_DIR)/libwebp",
"$(inherited)",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.5.1;
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.MediaInfoSettingsXPC;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -11550,7 +11550,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 13;
CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
HEADER_SEARCH_PATHS = (
Expand All @@ -11570,7 +11570,7 @@
"$(BUILT_PRODUCTS_DIR)/libwebp",
"$(inherited)",
);
MARKETING_VERSION = 1.5.0;
MARKETING_VERSION = 1.5.1;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.MediaInfoSettingsXPC;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
30 changes: 28 additions & 2 deletions MediaInfoHelperXPC/info/ImageInfoItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ class ImageInfo: DimensionalInfo, FileInfo, PaperInfo {
isFilled = false
return self.formatERR(useEmptyData: useEmptyData)
}
let isCustomDPI = dpi != self.dpi

return format(value: [values?["width"] ?? width, values?["height"] ?? height], isFilled: &isFilled) { v, isFilled in
guard let dim = v as? [Int] else {
Expand All @@ -183,7 +182,7 @@ class ImageInfo: DimensionalInfo, FileInfo, PaperInfo {
if let w_print = Self.numberFormatter.string(from: NSNumber(value: Double(width) / Double(dpi) * unit.scale)), let h_print = Self.numberFormatter.string(from: NSNumber(value: Double(height) / Double(dpi) * unit.scale)) {

isFilled = true
return "\(w_print) × \(h_print) \(unit.label)" + (isCustomDPI ? " (\(dpi) "+NSLocalizedString("dpi", tableName: "LocalizableExt", comment: "")+")" : "")
return "\(w_print) × \(h_print) \(unit.label) (\(dpi) "+NSLocalizedString("dpi", tableName: "LocalizableExt", comment: "")+")"
} else {
isFilled = false
return self.formatND(useEmptyData: useEmptyData)
Expand All @@ -195,6 +194,33 @@ class ImageInfo: DimensionalInfo, FileInfo, PaperInfo {
}
}

override func processSpecialMenuItem(_ item: Settings.MenuItem, inMenu destination_sub_menu: NSMenu, withSettings settings: Settings) -> Bool {
if item.template.hasPrefix("[[print:") {
let s = item.template.trimmingCharacters(in: CharacterSet(charactersIn: "[]")) .split(separator: ":")
guard s.count > 2 else {
return false
}

guard let um = PrintUnit(placeholder: String(s[1])), let dpi = Int(String(s[2])), dpi == self.dpi else {
return false
}

for item2 in settings.imageMenuItems {
guard item2.template != item.template else {
continue
}
if item2.template == "[[print:\(um.placeholder)]]" {
// Prevents duplicate menu items.
return true
}
}

return false
} else {
return super.processSpecialMenuItem(item, inMenu: destination_sub_menu, withSettings: settings)
}
}

override func getStandardTitle(forSettings settings: Settings) -> String {
var template = "[[size]]"
if self.isAnimated {
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ Supported audio format:
Available information:
|**placeholder**|**description**|**example**|
|:----|:----|:----|
|media box|Media box. You can choose different unit (pt, inch, mm, cm).|_595 × 842 pt_|
|bleed box|Bleed box. You can choose different unit (pt, inch, mm, cm).|_595 × 842 pt_|
|crop box|Crop box. You can choose different unit (pt, inch, mm, cm).|_595 × 842 pt_|
|art box|Art box. You can choose different unit (pt, inch, mm, cm).|_595 × 842 pt_|
|media box|Media box. You can choose different unit (pt, inch, mm, cm).|_595 × 842 pt_, _A4_, …|
|bleed box|Bleed box. You can choose different unit (pt, inch, mm, cm, paper size).|_595 × 842 pt_, _A4_, …|
|crop box|Crop box. You can choose different unit (pt, inch, mm, cm, paper size).|_595 × 842 pt_, _A4_, …|
|art box|Art box. You can choose different unit (pt, inch, mm, cm, paper size).|_595 × 842 pt_, _A4_, …|
|paper format|Paper format for the printed size.|_A4_, _Letter_, …|
|pages|Number of pages.|_15 pages_|
|author|Author.|_sbarex_|
Expand Down
12 changes: 12 additions & 0 deletions docs/appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,17 @@
]]>
</description>
</item>
<item>
<title>1.5.1</title>
<pubDate>sab, 29 Mag 2021 23:43:12 +0100</pubDate>
<sparkle:minimumSystemVersion>10.15</sparkle:minimumSystemVersion>
<enclosure url="https://github.com/sbarex/MediaInfo/releases/download/1.5.0/MediaInfo.zip" sparkle:version="14" sparkle:shortVersionString="1.5.1" type="application/octet-stream" sparkle:edSignature="kFET0rOCROKJ0azCjbCcuFKXenRFk4v0dBXMQfUuF6lDtSgqv9SCVK8tgy9AGJXrfdukMJ8ZQp3e7giv/U07AA==" length="20797265"/>
<description><![CDATA[
<ul>
<li>Bugfix on image print size.</li>
</ul>
]]>
</description>
</item>
</channel>
</rss>

0 comments on commit 928c192

Please sign in to comment.