Skip to content

Commit

Permalink
Caution icon and preview as OIDs
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.viathinksoft.com/svn/filter_foundry/trunk@575 1b5a0048-3058-4200-831f-25aa9e3a14b9
  • Loading branch information
danielmarschall committed Jun 8, 2024
1 parent 2802a63 commit eb2e9a6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
28 changes: 17 additions & 11 deletions ui_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ HICON hIconCautionSign;

extern HINSTANCE hDllInstance;

// { iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 37476 products(2) filter-foundry(72) controls(2) slider(1) }
#define OID_SLIDER_WNDCLASS "1.3.6.1.4.1.37476.2.72.2.1"

// { iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 37476 products(2) filter-foundry(72) controls(2) preview(2) }
#define OID_PREVIEW_WNDCLASS "1.3.6.1.4.1.37476.2.72.2.2"

// { iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 37476 products(2) filter-foundry(72) controls(2) caution(3) }
#define OID_CAUTION_WNDCLASS "1.3.6.1.4.1.37476.2.72.2.3"

void DoAbout(AboutRecordPtr pb){
TCHAR* tmp1;
TCHAR* filters = (TCHAR*)malloc(4096);
Expand Down Expand Up @@ -427,14 +436,11 @@ Boolean maindialog(FilterRecordPtr pb){
PlatformData *p;
INT_PTR res;

// "1.3.6.1.4.1.37476.2.72.2.1" is the class name of the slider control. It is the Object Identifier.
// { iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 37476 products(2) filter-foundry(72) controls(2) slider(1) }

// First try to use the sliders from PLUGIN.DLL (only Photoshop)
if (!Slider_Init_PluginDll(TEXT("1.3.6.1.4.1.37476.2.72.2.1"))) {
if (!Slider_Init_PluginDll(TEXT(OID_SLIDER_WNDCLASS))) {
// If we couldn't get the sliders from PLUGIN.DLL (probably not running in Photoshop),
// then try the Microsoft Trackbar Control instead
if (!Slider_Init_MsTrackbar(TEXT("1.3.6.1.4.1.37476.2.72.2.1"))) {
if (!Slider_Init_MsTrackbar(TEXT(OID_SLIDER_WNDCLASS))) {
// This will happen if we neither have PLUGIN.DLL, nor the Microsoft Trackbar Control (msctls_trackbar32).
// "msctls_trackbar32" is not included in Windows NT 3.1, and since there is no OCX or RegSvr32.
// It is included in Windows NT 3.5x.
Expand All @@ -444,13 +450,13 @@ Boolean maindialog(FilterRecordPtr pb){

// We simply hide the sliders and let the user enter the numeric values in the edit-box.
simplewarning_id(MSG_SLIDER_UNAVAILABLE_ID);
Slider_Init_None(TEXT("1.3.6.1.4.1.37476.2.72.2.1"));
Slider_Init_None(TEXT(OID_SLIDER_WNDCLASS));
}
}

// For the preview image and caution symbols, we register subclasses, so that we can assign a mouse cursor to this class.
MakeSimpleSubclass(TEXT("Preview"), WC_STATIC);
MakeSimpleSubclass(TEXT("Caution"), WC_BUTTON);
MakeSimpleSubclass(TEXT(OID_PREVIEW_WNDCLASS), WC_STATIC);
MakeSimpleSubclass(TEXT(OID_CAUTION_WNDCLASS), WC_BUTTON);

// Now show the dialog
p = (PlatformData*)pb->platformData;
Expand All @@ -469,9 +475,9 @@ Boolean maindialog(FilterRecordPtr pb){
}

// Clean up after the dialog has been closed
UnregisterClass(TEXT("Preview"), hDllInstance);
UnregisterClass(TEXT("Caution"), hDllInstance);
UnregisterClass(TEXT("1.3.6.1.4.1.37476.2.72.2.1"), hDllInstance);
UnregisterClass(TEXT(OID_PREVIEW_WNDCLASS), hDllInstance);
UnregisterClass(TEXT(OID_CAUTION_WNDCLASS), hDllInstance);
UnregisterClass(TEXT(OID_SLIDER_WNDCLASS), hDllInstance);
Slider_Uninit_PluginDll();
Slider_Uninit_MsTrackbar();
Slider_Uninit_None();
Expand Down
38 changes: 19 additions & 19 deletions ui_win.rc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop
Copyright (C) 2003-2009 Toby Thain, toby@telegraphics.net
Copyright (C) 2018-2022 Daniel Marschall, ViaThinkSoft
Copyright (C) 2018-2024 Daniel Marschall, ViaThinkSoft

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -47,8 +47,8 @@ FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 260, 253, 42, 14

/* "Preview" is a subclass of "Static", defined in ui_win.c */
CONTROL "", PREVIEWITEM, "Preview", SS_OWNERDRAW|SS_NOTIFY|SS_SUNKEN, 15,10, 100,100
/* "1.3.6.1.4.1.37476.2.72.2.2" (Preview) is a subclass of "Static", defined in ui_win.c */
CONTROL "", PREVIEWITEM, "1.3.6.1.4.1.37476.2.72.2.2", SS_OWNERDRAW|SS_NOTIFY|SS_SUNKEN, 15,10, 100,100

CONTROL "+", ZOOMINITEM, "Button", BS_PUSHBUTTON | BS_CENTER | BS_FLAT | WS_CHILD | WS_VISIBLE, 102,115, 14,12
CONTROL "-", ZOOMOUTITEM, "Button", BS_PUSHBUTTON | BS_CENTER | BS_FLAT | WS_CHILD | WS_VISIBLE, 15,115, 14,12
Expand Down Expand Up @@ -86,11 +86,11 @@ BEGIN
LTEXT "B =",FIRSTLABELITEM+2, 15,191, 13,12
LTEXT "A =",FIRSTLABELITEM+3, 15,219, 13,12

/* "Caution" is a subclass of "Button", defined in ui_win.c */
CONTROL "!",FIRSTICONITEM, "Caution",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,147, 16,16
CONTROL "!",FIRSTICONITEM+1, "Caution",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,175, 16,16
CONTROL "!",FIRSTICONITEM+2, "Caution",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,203, 16,16
CONTROL "!",FIRSTICONITEM+3, "Caution",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,231, 16,16
/* "1.3.6.1.4.1.37476.2.72.2.3" (Caution icon) is a subclass of "Button", defined in ui_win.c */
CONTROL "!",FIRSTICONITEM, "1.3.6.1.4.1.37476.2.72.2.3",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,147, 16,16
CONTROL "!",FIRSTICONITEM+1, "1.3.6.1.4.1.37476.2.72.2.3",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,175, 16,16
CONTROL "!",FIRSTICONITEM+2, "1.3.6.1.4.1.37476.2.72.2.3",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,203, 16,16
CONTROL "!",FIRSTICONITEM+3, "1.3.6.1.4.1.37476.2.72.2.3",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,231, 16,16

EDITTEXT FIRSTEXPRITEM, 35,135, 262, 24, ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL
EDITTEXT FIRSTEXPRITEM+1, 35,163, 262, 24, ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL
Expand All @@ -112,8 +112,8 @@ FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 260, 253, 42, 14

/* "Preview" is a subclass of "Static", defined in ui_win.c */
CONTROL "", PREVIEWITEM, "Preview", SS_OWNERDRAW|SS_NOTIFY|SS_SUNKEN, 15,10, 100,100
/* "1.3.6.1.4.1.37476.2.72.2.2" (Preview) is a subclass of "Static", defined in ui_win.c */
CONTROL "", PREVIEWITEM, "1.3.6.1.4.1.37476.2.72.2.2", SS_OWNERDRAW|SS_NOTIFY|SS_SUNKEN, 15,10, 100,100

CONTROL "+", ZOOMINITEM, "Button", BS_PUSHBUTTON | BS_CENTER | BS_FLAT | WS_CHILD | WS_VISIBLE, 102,115, 14,12
CONTROL "-", ZOOMOUTITEM, "Button", BS_PUSHBUTTON | BS_CENTER | BS_FLAT | WS_CHILD | WS_VISIBLE, 15,115, 14,12
Expand Down Expand Up @@ -151,11 +151,11 @@ BEGIN
LTEXT "B =",FIRSTLABELITEM+2, 15,191, 13,12
LTEXT "A =",FIRSTLABELITEM+3, 15,219, 13,12

/* "Caution" is a subclass of "Button", defined in ui_win.c */
CONTROL "!",FIRSTICONITEM, "Caution",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,147, 16,16
CONTROL "!",FIRSTICONITEM+1, "Caution",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,175, 16,16
CONTROL "!",FIRSTICONITEM+2, "Caution",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,203, 16,16
CONTROL "!",FIRSTICONITEM+3, "Caution",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,231, 16,16
/* "1.3.6.1.4.1.37476.2.72.2.3" (Caution icon) is a subclass of "Button", defined in ui_win.c */
CONTROL "!",FIRSTICONITEM, "1.3.6.1.4.1.37476.2.72.2.3",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,147, 16,16
CONTROL "!",FIRSTICONITEM+1, "1.3.6.1.4.1.37476.2.72.2.3",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,175, 16,16
CONTROL "!",FIRSTICONITEM+2, "1.3.6.1.4.1.37476.2.72.2.3",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,203, 16,16
CONTROL "!",FIRSTICONITEM+3, "1.3.6.1.4.1.37476.2.72.2.3",BS_PUSHBUTTON | BS_CENTER | BS_FLAT | BS_OWNERDRAW | WS_CHILD | WS_CLIPSIBLINGS, 15,231, 16,16

EDITTEXT FIRSTEXPRITEM, 35,135, 262, 24, ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL
EDITTEXT FIRSTEXPRITEM+1, 35,163, 262, 24, ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN|WS_VSCROLL
Expand All @@ -177,8 +177,8 @@ FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 256,137, 42,14

/* "Preview" is a subclass of "Static", defined in ui_win.c */
CONTROL "", PREVIEWITEM, "Preview",SS_OWNERDRAW|SS_NOTIFY|SS_SUNKEN, 15,10, 100,100
/* "1.3.6.1.4.1.37476.2.72.2.2" (Preview) is a subclass of "Static", defined in ui_win.c */
CONTROL "", PREVIEWITEM, "1.3.6.1.4.1.37476.2.72.2.2",SS_OWNERDRAW|SS_NOTIFY|SS_SUNKEN, 15,10, 100,100

CONTROL "+", ZOOMINITEM, "Button", BS_PUSHBUTTON | BS_CENTER | BS_FLAT | WS_CHILD | WS_VISIBLE, 103,115, 12,12
CONTROL "-", ZOOMOUTITEM, "Button", BS_PUSHBUTTON | BS_CENTER | BS_FLAT | WS_CHILD | WS_VISIBLE, 15,115, 12,12
Expand Down Expand Up @@ -229,8 +229,8 @@ FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 256,137, 42,14

/* "Preview" is a subclass of "Static", defined in ui_win.c */
CONTROL "", PREVIEWITEM, "Preview",SS_OWNERDRAW|SS_NOTIFY|SS_SUNKEN, 15,10, 100,100
/* "1.3.6.1.4.1.37476.2.72.2.2" (Preview) is a subclass of "Static", defined in ui_win.c */
CONTROL "", PREVIEWITEM, "1.3.6.1.4.1.37476.2.72.2.2",SS_OWNERDRAW|SS_NOTIFY|SS_SUNKEN, 15,10, 100,100

CONTROL "+", ZOOMINITEM, "Button", BS_PUSHBUTTON | BS_CENTER | BS_FLAT | WS_CHILD | WS_VISIBLE, 103,115, 12,12
CONTROL "-", ZOOMOUTITEM, "Button", BS_PUSHBUTTON | BS_CENTER | BS_FLAT | WS_CHILD | WS_VISIBLE, 15,115, 12,12
Expand Down

0 comments on commit eb2e9a6

Please sign in to comment.