From 7d2c70b7a863a6197882819807d4e5b2c7ba216b Mon Sep 17 00:00:00 2001 From: rogerman Date: Mon, 16 Oct 2017 11:56:24 -0700 Subject: [PATCH] Cocoa Port: Fix some issues with the Screenshot Capture Tool. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix potential crashing bug that may occur if the target directory isn’t found when clicking the Take Screenshot button. - In the Display Layout dropdown panel, reposition the Display Separation menu to be in the center section instead of in the leftmost section. --- .../translations/English.lproj/MainMenu.xib | 149 +++++++----------- .../userinterface/MacScreenshotCaptureTool.mm | 19 +-- 2 files changed, 68 insertions(+), 100 deletions(-) diff --git a/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.xib b/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.xib index 03ffb4b96..0346dba1d 100644 --- a/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.xib +++ b/desmume/src/frontend/cocoa/translations/English.lproj/MainMenu.xib @@ -12,7 +12,9 @@ YES + + YES @@ -2164,9 +2166,9 @@ 134217728 33554432 - + NSImage - AppIcon_DeSmuME + NSApplicationIcon 0 1 @@ -3863,7 +3865,7 @@ L3d3dy5hZHZhbnNjZW5lLmNvbS9vZmZsaW5lL2RhdGFzL0FEVkFOc0NFbmVfUlRvb2xEUy56aXA -2034483200 100 - + 200 @@ -14890,7 +14892,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 134217728 33554432 - + 0 3 0 @@ -17308,7 +17310,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 134217728 33554432 - + 0 3 0 @@ -18440,7 +18442,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 134217728 33554432 - + 0 3 0 @@ -27969,7 +27971,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 134217728 33554432 - + 0 3 0 @@ -28674,7 +28676,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 23 2 - {{57, 380}, {480, 185}} + {{57, 380}, {480, 177}} -461896704 Screenshot Capture Tool NSPanel @@ -28690,9 +28692,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 306 - {{8, 9}, {267, 127}} + {{8, 8}, {267, 121}} - _NS:2337 YES @@ -28714,9 +28715,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 266 - {{10, 144}, {377, 18}} + {{10, 136}, {377, 18}} - _NS:817 YES @@ -28736,9 +28736,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 265 - {{390, 138}, {85, 28}} + {{390, 130}, {85, 28}} - _NS:610 YES @@ -28760,9 +28759,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 268 - {{11, 163}, {161, 14}} + {{11, 155}, {161, 14}} - _NS:4068 YES @@ -28791,9 +28789,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 289 - {{155, 22}, {27, 27}} + {{155, 17}, {27, 27}} - YES 67108864 @@ -28814,9 +28811,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 289 - {{10, 29}, {142, 14}} + {{10, 24}, {142, 14}} - _NS:4068 YES @@ -28835,9 +28831,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 289 - {{19, 85}, {76, 14}} + {{19, 80}, {76, 14}} - _NS:4068 YES @@ -28856,9 +28851,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 289 - {{10, 63}, {173, 22}} + {{10, 58}, {173, 22}} - _NS:791 YES @@ -28958,9 +28952,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 12 - {{9, 53}, {175, 5}} + {{9, 48}, {175, 5}} - _NS:2429 {0, 0} @@ -28980,15 +28973,13 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 NO - {{1, 1}, {193, 109}} + {{1, 1}, {193, 104}} - _NS:21 - {{278, 9}, {195, 125}} + {{278, 8}, {195, 120}} - _NS:18 {0, 0} @@ -29009,9 +29000,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 NO - {480, 185} + {480, 177} - _NS:103 {{0, 0}, {1440, 878}} @@ -29028,9 +29018,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 8 - {{313, 5}, {5, 165}} + {{313, 5}, {5, 157}} - _NS:2182 {0, 0} @@ -29052,9 +29041,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 8 - {{156, 5}, {5, 165}} + {{156, 5}, {5, 157}} - _NS:2182 {0, 0} @@ -29076,9 +29064,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{329, 53}, {74, 14}} + {{329, 45}, {74, 14}} - _NS:4068 YES @@ -29097,9 +29084,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{15, 32}, {103, 14}} + {{172, 104}, {103, 14}} - _NS:4068 YES @@ -29118,9 +29104,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{7, 10}, {146, 22}} + {{164, 82}, {146, 22}} - _NS:791 YES @@ -29209,9 +29194,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{15, 112}, {92, 14}} + {{15, 104}, {92, 14}} - _NS:4068 YES @@ -29230,9 +29214,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{7, 90}, {146, 22}} + {{7, 82}, {146, 22}} - _NS:791 YES @@ -29465,9 +29448,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{15, 72}, {92, 14}} + {{15, 64}, {92, 14}} - _NS:4068 YES @@ -29486,9 +29468,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{7, 50}, {146, 22}} + {{7, 42}, {146, 22}} - _NS:791 YES @@ -29566,9 +29547,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{15, 152}, {80, 14}} + {{15, 144}, {80, 14}} - _NS:4068 YES @@ -29587,9 +29567,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{7, 130}, {146, 22}} + {{7, 122}, {146, 22}} - _NS:791 YES @@ -29657,9 +29636,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{329, 94}, {80, 14}} + {{329, 86}, {80, 14}} - _NS:4068 YES @@ -29678,9 +29656,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{172, 152}, {90, 14}} + {{172, 144}, {90, 14}} - _NS:4068 YES @@ -29711,7 +29688,6 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 268 {{15, 12}, {87, 18}} - _NS:682 YES @@ -29735,13 +29711,11 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 {{1, 1}, {144, 38}} - _NS:21 - {{321, 112}, {146, 54}} + {{321, 104}, {146, 54}} - _NS:18 {0, 0} @@ -29764,9 +29738,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{321, 31}, {146, 22}} + {{321, 23}, {146, 22}} - _NS:791 YES @@ -30031,9 +30004,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{321, 72}, {146, 22}} + {{321, 64}, {146, 22}} - _NS:791 YES @@ -30134,9 +30106,8 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 264 - {{164, 130}, {146, 22}} + {{164, 122}, {146, 22}} - _NS:791 YES @@ -30237,7 +30208,6 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 268 {{8, 14}, {132, 32}} - _NS:736 YES NO @@ -30483,13 +30453,11 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 {{1, 1}, {144, 56}} - _NS:21 - {{164, 54}, {146, 72}} + {{164, 6}, {146, 72}} - _NS:18 {0, 0} @@ -30510,16 +30478,15 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 NO - {474, 175} + {474, 167} - NSView - {474, 175} - {0, 175} - {474, 175} + {474, 167} + {0, 167} + {474, 167} 1 0.0 0.0 @@ -32064,7 +32031,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 134217728 33554432 - + 0 3 0 @@ -32570,7 +32537,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 134217728 33554432 - + 0 3 0 @@ -63577,17 +63544,17 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 - - - + + + Screenshot Capture Tool Layout Drawer Content View @@ -68520,9 +68487,9 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{670, 677}, {480, 185}} + {{670, 685}, {480, 177}} com.apple.InterfaceBuilder.CocoaPlugin - {{670, 677}, {480, 185}} + {{670, 685}, {480, 177}} @@ -68544,7 +68511,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 P4AAAL+AAABD8AAAw9aAAA com.apple.InterfaceBuilder.CocoaPlugin - {{671, 472}, {474, 175}} + {{671, 480}, {474, 167}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -68555,7 +68522,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - AUMkAABCWAAAA + AUMkAABCJAAAA com.apple.InterfaceBuilder.CocoaPlugin @@ -68715,11 +68682,11 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABBQAAAwwcAAA + P4AAAL+AAABA4AAAwfAAAA com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABBoAAAwxUAAA + P4AAAL+AAABBcAAAwjAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -68857,7 +68824,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{664, 271}, {161, 302}} + {{667, 282}, {161, 302}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -75815,7 +75782,6 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 YES YES - AppIcon_DeSmuME ColorSwatch_Blue_16x16 ColorSwatch_Brown_16x16 ColorSwatch_DarkBlue_16x16 @@ -75853,6 +75819,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 Image_Piano NSActionTemplate NSAddTemplate + NSApplicationIcon NSMenuCheckmark NSMenuMixedState NSPreferencesGeneral @@ -75862,7 +75829,6 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 YES - {512, 512} {16, 16} {16, 16} {16, 16} @@ -75900,6 +75866,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2 {515, 457} {14, 14} {8, 8} + {512, 512} {11, 11} {10, 3} {32, 32} diff --git a/desmume/src/frontend/cocoa/userinterface/MacScreenshotCaptureTool.mm b/desmume/src/frontend/cocoa/userinterface/MacScreenshotCaptureTool.mm index 372642541..944842a6d 100644 --- a/desmume/src/frontend/cocoa/userinterface/MacScreenshotCaptureTool.mm +++ b/desmume/src/frontend/cocoa/userinterface/MacScreenshotCaptureTool.mm @@ -120,19 +120,20 @@ NSFileManager *fileManager = [[NSFileManager alloc] init]; BOOL isDirectoryFound = [fileManager createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil]; + + if (!isDirectoryFound) + { + // This was the last chance for the user to try to get a working writable directory. + [self chooseDirectoryPath:self]; + isDirectoryFound = [fileManager createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil]; + } + [fileManager release]; if (!isDirectoryFound) { - [self chooseDirectoryPath:self]; - - isDirectoryFound = [fileManager createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil]; - if (!isDirectoryFound) - { - // This was the last chance for the user to try to get a working writable directory. - // If the directory is still invalid, then just bail. - return; - } + // If the directory is still invalid, then just bail. + return; } // Note: We're allocating the parameter's memory block here, but we will be freeing it once we copy it in the detached thread.