Skip to content

Commit

Permalink
Suppress file open dialog
Browse files Browse the repository at this point in the history
when running from batch and shift or alt was pressed. Suppress File Open Options Dialogs checkbox in batch window must be UNCHECKED
  • Loading branch information
oomek committed Nov 29, 2018
1 parent 77aae35 commit 1416882
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/photoshop/SuperPNG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(&params, plugHndl, hwnd);

PIDescriptorParameters * descParams = globals->formatParamBlock->descriptorParameters;
bool result = SuperPNG_InUI(&params, plugHndl, hwnd, descParams->playInfo);

if(result)
{
Expand Down
6 changes: 6 additions & 0 deletions src/photoshop/SuperPNG.r
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/photoshop/SuperPNG_Scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions src/photoshop/SuperPNG_Terminology.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#define keyPNGpremultiply 'pngP'
#define keyPNGalpha 'pngA'
#define keyPNGcleanTransparent 'pngX'
#define keyPNGpremultiplyAlpha 'pngP'
#define keyPNGpngquant 'pngQ'
#define keyPNGquantQuality 'pngq'

Expand Down
3 changes: 2 additions & 1 deletion src/photoshop/SuperPNG_UI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions src/photoshop/win/SuperPNG_InUI_Win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand Down

0 comments on commit 1416882

Please sign in to comment.