From 14168825ec7ce2baddf346fdc1010398ed00cebf Mon Sep 17 00:00:00 2001 From: Radek Dutkiewicz Date: Thu, 29 Nov 2018 23:51:08 +0000 Subject: [PATCH] Suppress file open dialog when running from batch and shift or alt was pressed. Suppress File Open Options Dialogs checkbox in batch window must be UNCHECKED --- src/photoshop/SuperPNG.cpp | 4 +++- src/photoshop/SuperPNG.r | 6 ++++++ src/photoshop/SuperPNG_Scripting.cpp | 4 +++- src/photoshop/SuperPNG_Terminology.h | 1 + src/photoshop/SuperPNG_UI.h | 3 ++- src/photoshop/win/SuperPNG_InUI_Win.cpp | 5 +++-- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/photoshop/SuperPNG.cpp b/src/photoshop/SuperPNG.cpp index c490990..b49de77 100755 --- a/src/photoshop/SuperPNG.cpp +++ b/src/photoshop/SuperPNG.cpp @@ -293,7 +293,9 @@ static void DoReadStart(GPtr globals) // SuperPNG_InUI is responsible for not popping a dialog if the user // didn't request it. It still has to set the read settings from preferences though. - bool result = SuperPNG_InUI(¶ms, plugHndl, hwnd); + + PIDescriptorParameters * descParams = globals->formatParamBlock->descriptorParameters; + bool result = SuperPNG_InUI(¶ms, plugHndl, hwnd, descParams->playInfo); if(result) { diff --git a/src/photoshop/SuperPNG.r b/src/photoshop/SuperPNG.r index 160c29e..746f8b3 100755 --- a/src/photoshop/SuperPNG.r +++ b/src/photoshop/SuperPNG.r @@ -239,6 +239,12 @@ resource 'aete' (ResourceID, plugInName " dictionary", purgeable) "Clear areas where alpha is 0", flagsSingleProperty, + "Premultiply Alpha", + keyPNGpremultiplyAlpha, + typeBoolean, + "Multiply RGB by Alpha", + flagsSingleProperty, + "Quantizing", keyPNGpngquant, typeBoolean, diff --git a/src/photoshop/SuperPNG_Scripting.cpp b/src/photoshop/SuperPNG_Scripting.cpp index 4e7be9e..bdb723e 100755 --- a/src/photoshop/SuperPNG_Scripting.cpp +++ b/src/photoshop/SuperPNG_Scripting.cpp @@ -167,11 +167,13 @@ OSErr WriteScriptParamsOnWrite(GPtr globals) PIPutEnum(token, keyPNGalpha, typeAlphaChannel, AlphaToKey(gOptions.alpha)); if(gOptions.alpha != PNG_ALPHA_NONE) + { PIPutBool(token, keyPNGcleanTransparent, gOptions.clean_transparent); + PIPutBool(token, keyPNGpremultiplyAlpha, gOptions.premultiply); + } PIPutBool(token, keyPNGinterlace, gOptions.interlace); PIPutBool(token, keyPNGmeta, gOptions.metadata); - PIPutBool(token, keyPNGpremultiply, gOptions.premultiply); gotErr = CloseWriter(&token); /* closes and sets dialog optional */ /* done. Now pass handle on to Photoshop */ diff --git a/src/photoshop/SuperPNG_Terminology.h b/src/photoshop/SuperPNG_Terminology.h index ce89795..8bc9460 100755 --- a/src/photoshop/SuperPNG_Terminology.h +++ b/src/photoshop/SuperPNG_Terminology.h @@ -40,6 +40,7 @@ #define keyPNGpremultiply 'pngP' #define keyPNGalpha 'pngA' #define keyPNGcleanTransparent 'pngX' +#define keyPNGpremultiplyAlpha 'pngP' #define keyPNGpngquant 'pngQ' #define keyPNGquantQuality 'pngq' diff --git a/src/photoshop/SuperPNG_UI.h b/src/photoshop/SuperPNG_UI.h index 3679cf5..fc711cf 100644 --- a/src/photoshop/SuperPNG_UI.h +++ b/src/photoshop/SuperPNG_UI.h @@ -75,7 +75,8 @@ bool SuperPNG_InUI( SuperPNG_InUI_Data *params, const void *plugHndl, - const void *mwnd); + const void *mwnd, + int playInfo); bool SuperPNG_OutUI( diff --git a/src/photoshop/win/SuperPNG_InUI_Win.cpp b/src/photoshop/win/SuperPNG_InUI_Win.cpp index 3ecfe6e..30d07f4 100644 --- a/src/photoshop/win/SuperPNG_InUI_Win.cpp +++ b/src/photoshop/win/SuperPNG_InUI_Win.cpp @@ -196,7 +196,8 @@ bool SuperPNG_InUI( SuperPNG_InUI_Data *params, const void *plugHndl, - const void *mwnd) + const void *mwnd, + int playInfo) { bool continue_reading = true; @@ -209,7 +210,7 @@ SuperPNG_InUI( // check for that shift key bool shift_key = ( KeyIsDown(VK_LSHIFT) || KeyIsDown(VK_RSHIFT) || KeyIsDown(VK_LMENU) || KeyIsDown(VK_RMENU) ); - if(g_always || shift_key) + if ((g_always || shift_key) && playInfo == plugInDialogSilent) { int status = DialogBox(hDllInstance, (LPSTR)"IN_DIALOG", (HWND)mwnd, (DLGPROC)DialogProc);