Skip to content

Commit

Permalink
Invert everything Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Brendan Bolles <brendan@fnordware.com>
  • Loading branch information
fnordware committed May 15, 2021
1 parent dd920d8 commit 2afed2e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 32 deletions.
2 changes: 1 addition & 1 deletion vendor/photoshop/win/OpenColorIO_PS_Dialog.rc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ BEGIN
COMBOBOX 12,125,87,99,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Transform:",14,83,112,36,8
COMBOBOX 15,125,111,99,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Invert",16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,250,65,36,10
CONTROL "Invert",16,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,41,36,10
PUSHBUTTON ">",10,230,62,15,14
PUSHBUTTON ">",13,230,86,15,14
END
Expand Down
92 changes: 61 additions & 31 deletions vendor/photoshop/win/OpenColorIO_PS_Dialogs_Win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,20 @@ static void TrackConfigMenu(HWND hwndDlg, bool readFromControl)

if( !configPath.empty() )
{
ENABLE_ITEM(DLOG_OK, TRUE);
ENABLE_ITEM(DLOG_Export, TRUE);
ENABLE_ITEM(DLOG_Convert_Radio, TRUE);
ENABLE_ITEM(DLOG_Display_Radio, TRUE);
ENABLE_ITEM(DLOG_Menu1_Label, TRUE);
ENABLE_ITEM(DLOG_Menu1_Menu, TRUE);
ENABLE_ITEM(DLOG_Menu1_Button, TRUE);
ENABLE_ITEM(DLOG_Menu2_Label, TRUE);
ENABLE_ITEM(DLOG_Menu2_Menu, TRUE);
ENABLE_ITEM(DLOG_Menu2_Button, TRUE);
ENABLE_ITEM(DLOG_Menu3_Label, TRUE);
ENABLE_ITEM(DLOG_Menu3_Menu, TRUE);
ENABLE_ITEM(DLOG_Invert_Check, TRUE);

try
{
delete g_context;
Expand All @@ -532,24 +546,10 @@ static void TrackConfigMenu(HWND hwndDlg, bool readFromControl)
{
g_action = ACTION_LUT;

SHOW_ITEM(DLOG_Invert_Check, TRUE);

if( g_context->canInvertLUT() )
{
ENABLE_ITEM(DLOG_Invert_Check, TRUE);
}
else
{
ENABLE_ITEM(DLOG_Invert_Check, FALSE);

g_invert = false;
}

SET_CHECK(DLOG_Invert_Check, g_invert);

SHOW_ITEM(DLOG_Convert_Radio, FALSE);
SHOW_ITEM(DLOG_Display_Radio, FALSE);

SET_CHECK(DLOG_Invert_Check, g_invert);

const int interpLabel = DLOG_Menu1_Label;
const int interpMenu = DLOG_Menu1_Menu;
Expand Down Expand Up @@ -577,8 +577,6 @@ static void TrackConfigMenu(HWND hwndDlg, bool readFromControl)
}
else
{
SHOW_ITEM(DLOG_Invert_Check, FALSE);

if(g_action == ACTION_LUT)
{
g_action = ACTION_CONVERT;
Expand All @@ -587,8 +585,7 @@ static void TrackConfigMenu(HWND hwndDlg, bool readFromControl)
SHOW_ITEM(DLOG_Convert_Radio, TRUE);
SHOW_ITEM(DLOG_Display_Radio, TRUE);

ENABLE_ITEM(DLOG_Convert_Radio, TRUE);
ENABLE_ITEM(DLOG_Display_Radio, TRUE);
SET_CHECK(DLOG_Invert_Check, g_invert);

const SpaceVec &colorSpaces = g_context->getColorSpaces();

Expand Down Expand Up @@ -624,6 +621,20 @@ static void TrackConfigMenu(HWND hwndDlg, bool readFromControl)
}
catch(const std::exception &e)
{
ENABLE_ITEM(DLOG_OK, FALSE);
ENABLE_ITEM(DLOG_Export, FALSE);
ENABLE_ITEM(DLOG_Convert_Radio, FALSE);
ENABLE_ITEM(DLOG_Display_Radio, FALSE);
ENABLE_ITEM(DLOG_Menu1_Label, FALSE);
ENABLE_ITEM(DLOG_Menu1_Menu, FALSE);
ENABLE_ITEM(DLOG_Menu1_Button, FALSE);
ENABLE_ITEM(DLOG_Menu2_Label, FALSE);
ENABLE_ITEM(DLOG_Menu2_Menu, FALSE);
ENABLE_ITEM(DLOG_Menu2_Button, FALSE);
ENABLE_ITEM(DLOG_Menu3_Label, FALSE);
ENABLE_ITEM(DLOG_Menu3_Menu, FALSE);
ENABLE_ITEM(DLOG_Invert_Check, FALSE);

MessageBox(hwndDlg, e.what(), "OpenColorIO error", MB_OK);

if(g_source != SOURCE_ENVIRONMENT)
Expand All @@ -635,6 +646,20 @@ static void TrackConfigMenu(HWND hwndDlg, bool readFromControl)
}
catch(...)
{
ENABLE_ITEM(DLOG_OK, FALSE);
ENABLE_ITEM(DLOG_Export, FALSE);
ENABLE_ITEM(DLOG_Convert_Radio, FALSE);
ENABLE_ITEM(DLOG_Display_Radio, FALSE);
ENABLE_ITEM(DLOG_Menu1_Label, FALSE);
ENABLE_ITEM(DLOG_Menu1_Menu, FALSE);
ENABLE_ITEM(DLOG_Menu1_Button, FALSE);
ENABLE_ITEM(DLOG_Menu2_Label, FALSE);
ENABLE_ITEM(DLOG_Menu2_Menu, FALSE);
ENABLE_ITEM(DLOG_Menu2_Button, FALSE);
ENABLE_ITEM(DLOG_Menu3_Label, FALSE);
ENABLE_ITEM(DLOG_Menu3_Menu, FALSE);
ENABLE_ITEM(DLOG_Invert_Check, FALSE);

MessageBox(hwndDlg, "Some unknown error", "OpenColorIO error", MB_OK);

if(g_source != SOURCE_ENVIRONMENT)
Expand All @@ -651,10 +676,19 @@ static void TrackConfigMenu(HWND hwndDlg, bool readFromControl)

g_context = NULL;

SHOW_ITEM(DLOG_Invert_Check, FALSE);

ENABLE_ITEM(DLOG_OK, FALSE);
ENABLE_ITEM(DLOG_Export, FALSE);
ENABLE_ITEM(DLOG_Convert_Radio, FALSE);
ENABLE_ITEM(DLOG_Display_Radio, FALSE);
ENABLE_ITEM(DLOG_Menu1_Label, FALSE);
ENABLE_ITEM(DLOG_Menu1_Menu, FALSE);
ENABLE_ITEM(DLOG_Menu1_Button, FALSE);
ENABLE_ITEM(DLOG_Menu2_Label, FALSE);
ENABLE_ITEM(DLOG_Menu2_Menu, FALSE);
ENABLE_ITEM(DLOG_Menu2_Button, FALSE);
ENABLE_ITEM(DLOG_Menu3_Label, FALSE);
ENABLE_ITEM(DLOG_Menu3_Menu, FALSE);
ENABLE_ITEM(DLOG_Invert_Check, FALSE);

REMOVE_ALL_MENU_ITEMS(DLOG_Menu1_Menu);
REMOVE_ALL_MENU_ITEMS(DLOG_Menu2_Menu);
Expand Down Expand Up @@ -738,11 +772,11 @@ static void DoExport(HWND hwndDlg)

if(g_action == ACTION_CONVERT)
{
processor = g_context->getConvertProcessor(g_inputSpace, g_outputSpace);
processor = g_context->getConvertProcessor(g_inputSpace, g_outputSpace, g_invert);
}
else if(g_action == ACTION_DISPLAY)
{
processor = g_context->getDisplayProcessor(g_inputSpace, g_display, g_view);
processor = g_context->getDisplayProcessor(g_inputSpace, g_display, g_view, g_invert);
}
else
{
Expand All @@ -754,9 +788,7 @@ static void DoExport(HWND hwndDlg)
g_interpolation == INTERPO_CUBIC ? OCIO::INTERP_CUBIC :
OCIO::INTERP_BEST);

const OCIO::TransformDirection direction = (g_invert ? OCIO::TRANSFORM_DIR_INVERSE : OCIO::TRANSFORM_DIR_FORWARD);

processor = g_context->getLUTProcessor(interp, direction);
processor = g_context->getLUTProcessor(interp, g_invert);
}


Expand Down Expand Up @@ -796,11 +828,11 @@ static void DoExport(HWND hwndDlg)

if(g_action == ACTION_CONVERT)
{
baker = g_context->getConvertBaker(g_inputSpace, g_outputSpace);
baker = g_context->getConvertBaker(g_inputSpace, g_outputSpace, g_invert);
}
else if(g_action == ACTION_DISPLAY)
{
baker = g_context->getDisplayBaker(g_inputSpace, g_display, g_view);
baker = g_context->getDisplayBaker(g_inputSpace, g_display, g_view, g_invert);
}
else
{
Expand All @@ -812,9 +844,7 @@ static void DoExport(HWND hwndDlg)
g_interpolation == INTERPO_CUBIC ? OCIO::INTERP_CUBIC :
OCIO::INTERP_BEST);

const OCIO::TransformDirection direction = (g_invert ? OCIO::TRANSFORM_DIR_INVERSE : OCIO::TRANSFORM_DIR_FORWARD);

baker = g_context->getLUTBaker(interp, direction);
baker = g_context->getLUTBaker(interp, g_invert);
}

baker->setFormat( format.c_str() );
Expand Down

0 comments on commit 2afed2e

Please sign in to comment.