Skip to content
This repository has been archived by the owner on Apr 4, 2020. It is now read-only.

Commit

Permalink
Tagging version 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BriceLambson_cp authored and BriceLambson_cp committed Dec 12, 2009
1 parent 691343f commit 0e845a9
Show file tree
Hide file tree
Showing 38 changed files with 2,587 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tags/ImageResizer-2.1/..svnbridge/.svnbridge
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?><ItemProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Properties><Property><Name>svn:ignore</Name><Value>*.suo
</Value></Property><Property><Name>svn:ignore</Name><Value>*.suo
*.ncb
</Value></Property><Property><Name>svn:ignore</Name><Value>*.ncb
*.suo
</Value></Property><Property><Name>svn:ignore</Name><Value>*.ncb
*.suo
</Value></Property><Property><Name>bugtraq:url</Name><Value>http://imageresizer.codeplex.com/WorkItem/View.aspx?WorkItemId=%BUGID%</Value></Property><Property><Name>bugtraq:message</Name><Value>Work Item: %BUGID%</Value></Property><Property><Name>bugtraq:logregex</Name><Value>[Ww][Oo][Rr][Kk] ?[Ii][Tt][Ee][Mm][Ss]?: .+
-?\d+</Value></Property></Properties></ItemProperties>
8 changes: 8 additions & 0 deletions tags/ImageResizer-2.1/..svnbridge/PhotoToysClone
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?><ItemProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Properties><Property><Name>svn:ignore</Name><Value>bin
obj
*.user
x64
Debug
*.aps
Release
</Value></Property></Properties></ItemProperties>
6 changes: 6 additions & 0 deletions tags/ImageResizer-2.1/..svnbridge/Setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?><ItemProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Properties><Property><Name>svn:ignore</Name><Value>Debug
Release
obj
bin
*.user
</Value></Property></Properties></ItemProperties>
39 changes: 39 additions & 0 deletions tags/ImageResizer-2.1/ImageResizer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageResizer", "ImageResizer\ImageResizer.vcproj", "{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixproj", "{F14263E6-3501-4619-80FB-B5B83CFBC2EF}"
ProjectSection(ProjectDependencies) = postProject
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7} = {8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}.Debug|x64.ActiveCfg = Debug|x64
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}.Debug|x64.Build.0 = Debug|x64
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}.Debug|x86.ActiveCfg = Debug|Win32
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}.Debug|x86.Build.0 = Debug|Win32
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}.Release|x64.ActiveCfg = Release|x64
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}.Release|x64.Build.0 = Release|x64
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}.Release|x86.ActiveCfg = Release|Win32
{8B910FC0-18BD-4C79-B4CD-5D54EBB594D7}.Release|x86.Build.0 = Release|Win32
{F14263E6-3501-4619-80FB-B5B83CFBC2EF}.Debug|x64.ActiveCfg = Debug|x64
{F14263E6-3501-4619-80FB-B5B83CFBC2EF}.Debug|x64.Build.0 = Debug|x64
{F14263E6-3501-4619-80FB-B5B83CFBC2EF}.Debug|x86.ActiveCfg = Debug|x86
{F14263E6-3501-4619-80FB-B5B83CFBC2EF}.Debug|x86.Build.0 = Debug|x86
{F14263E6-3501-4619-80FB-B5B83CFBC2EF}.Release|x64.ActiveCfg = Release|x64
{F14263E6-3501-4619-80FB-B5B83CFBC2EF}.Release|x64.Build.0 = Release|x64
{F14263E6-3501-4619-80FB-B5B83CFBC2EF}.Release|x86.ActiveCfg = Release|x86
{F14263E6-3501-4619-80FB-B5B83CFBC2EF}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
27 changes: 27 additions & 0 deletions tags/ImageResizer-2.1/ImageResizer/..svnbridge/.svnbridge
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?><ItemProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Properties><Property><Name>svn:ignore</Name><Value>bin
obj
*.user
</Value></Property><Property><Name>svn:ignore</Name><Value>*.user
Debug
Release
bin
obj
x64
</Value></Property><Property><Name>svn:ignore</Name><Value>*.user
Debug
Release
bin
obj
x64
ImageResizer_i.c
ImageResizer_i.h
</Value></Property><Property><Name>svn:ignore</Name><Value>*.user
Debug
Release
bin
obj
x64
ImageResizer_i.c
ImageResizer_i.h
*.aps
</Value></Property></Properties></ItemProperties>
156 changes: 156 additions & 0 deletions tags/ImageResizer-2.1/ImageResizer/ContextMenuHandler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#include "stdafx.h"
#include "ContextMenuHandler.h"
#include "PhotoResizeDlg.h"
#include "ImageHelper.h"

#define IDM_PHOTORESIZE 0
#define VERB_PHOTORESIZE _T("PhotoResize")

HRESULT CContextMenuHandler::Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
{
// ATL-ify parameters.
CString strFolder;

SHGetPathFromIDList(pidlFolder, strFolder.GetBuffer(MAX_PATH));
strFolder.ReleaseBuffer();

// Set drop folder.
m_pathFolder.m_strPath = strFolder;

// Get selected files.
STGMEDIUM medium;
FORMATETC formatetc;

formatetc.cfFormat = CF_HDROP;
formatetc.ptd = NULL;
formatetc.dwAspect = DVASPECT_CONTENT;
formatetc.lindex = -1;
formatetc.tymed = TYMED_HGLOBAL;

pdtobj->GetData(&formatetc, &medium);

UINT numFiles = DragQueryFile((HDROP)medium.hGlobal, 0xFFFFFFFF, NULL, 0);

for (UINT i = 0; i < numFiles; i++)
{
CString strFile;

DragQueryFile((HDROP)medium.hGlobal, i, strFile.GetBuffer(MAX_PATH), MAX_PATH);
strFile.ReleaseBuffer();

m_aFiles.Add(CPath(strFile));
}

// Cleanup.
ReleaseStgMedium(&medium);

return S_OK;
}

HRESULT CContextMenuHandler::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
if (!(uFlags & CMF_DEFAULTONLY))
{
CString strResizeItem;
strResizeItem.LoadString(IDS_RESIZEITEM);

InsertMenu(hmenu, indexMenu, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_PHOTORESIZE, strResizeItem);
}

return MAKE_HRESULT(SEVERITY_SUCCESS, 0, IDM_PHOTORESIZE + 1);
}

HRESULT CContextMenuHandler::GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax)
{
if (uFlags == GCS_VERBA)
{
if (idCmd == IDM_PHOTORESIZE)
{
CStringA::CopyChars(pszName, cchMax, CT2CA(VERB_PHOTORESIZE), CString(VERB_PHOTORESIZE).GetLength());

return S_OK;
}
}
else if (uFlags == GCS_VERBW)
{
if (idCmd == IDM_PHOTORESIZE)
{
CStringW::CopyChars((LPWSTR)pszName, cchMax, CT2CW(VERB_PHOTORESIZE), CString(VERB_PHOTORESIZE).GetLength());

return S_OK;
}
}

return E_INVALIDARG;
}

HRESULT CContextMenuHandler::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
{
BOOL fUnicode = pici->cbSize == sizeof(CMINVOKECOMMANDINFOEX) &&
pici->fMask & CMIC_MASK_UNICODE;

if (!fUnicode && HIWORD(pici->lpVerb))
{
if (CString(pici->lpVerb).CompareNoCase(VERB_PHOTORESIZE) == 0)
{
return OnPhotoResize(pici);
}
}
else if (fUnicode && HIWORD(((LPCMINVOKECOMMANDINFOEX)pici)->lpVerbW))
{
if (CString(((LPCMINVOKECOMMANDINFOEX)pici)->lpVerbW).CompareNoCase(VERB_PHOTORESIZE) == 0)
{
return OnPhotoResize(pici);
}
}
else
{
if (LOWORD(pici->lpVerb) == IDM_PHOTORESIZE)
{
return OnPhotoResize(pici);
}
}

return E_FAIL;
}

HRESULT CContextMenuHandler::OnPhotoResize(LPCMINVOKECOMMANDINFO pici)
{
CPhotoResizeDlg dlgPhotoResize;

// TODO: Don't block.
if (dlgPhotoResize.DoModal(pici->hwnd) == IDOK)
{
CPath pathSource;
ImageHelper imageHelper;
size_t numFiles = m_aFiles.GetCount();
CPath pathDirectory;

IMAGE_SIZE size = dlgPhotoResize.GetSize();
UINT nWidth = dlgPhotoResize.GetWidth();
UINT nHeight = dlgPhotoResize.GetHeight();
BOOL fSmallerOnly = dlgPhotoResize.IsSmallerOnly();
BOOL fOverwriteOriginal = dlgPhotoResize.IsOverwriteOriginal();

if (!CString(m_pathFolder).IsEmpty())
{
pathDirectory = m_pathFolder;
}

// TODO: Multi-thread.
for (UINT i = 0; i < numFiles; i++)
{
pathSource = m_aFiles[i];

if (CString(m_pathFolder).IsEmpty())
{
pathDirectory = pathSource;
pathDirectory.RemoveFileSpec();
}

imageHelper.Resize(pathSource, pathDirectory, size, nWidth, nHeight, fSmallerOnly, fOverwriteOriginal);
}
}

return S_OK;
}
35 changes: 35 additions & 0 deletions tags/ImageResizer-2.1/ImageResizer/ContextMenuHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "ImageResizer_i.h"

#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif

using namespace ATL;

class ATL_NO_VTABLE CContextMenuHandler :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CContextMenuHandler, &CLSID_ContextMenuHandler>,
public IContextMenu,
public IShellExtInit
{
public:
BEGIN_COM_MAP(CContextMenuHandler)
COM_INTERFACE_ENTRY(IShellExtInit)
COM_INTERFACE_ENTRY(IContextMenu)
END_COM_MAP()
DECLARE_NOT_AGGREGATABLE(CContextMenuHandler)
DECLARE_REGISTRY_RESOURCEID(IDR_CONTEXTMENUHANDLER)
HRESULT STDMETHODCALLTYPE Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID);
HRESULT STDMETHODCALLTYPE GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax);
HRESULT STDMETHODCALLTYPE InvokeCommand(LPCMINVOKECOMMANDINFO pici);
HRESULT STDMETHODCALLTYPE QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);

private:
CPath m_pathFolder;
CAtlArray<CPath> m_aFiles;
HRESULT OnPhotoResize(LPCMINVOKECOMMANDINFO pici);
};

OBJECT_ENTRY_AUTO(__uuidof(ContextMenuHandler), CContextMenuHandler)
60 changes: 60 additions & 0 deletions tags/ImageResizer-2.1/ImageResizer/ContextMenuHandler.rgs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
HKCR
{
ImageResizer.ContextMenuHandler.2 = s 'ContextMenuHandler Class'
{
CLSID = s '{4CF20B46-D006-4B90-A64B-DBAA9470EFBE}'
}
ImageResizer.ContextMenuHandler = s 'ContextMenuHandler Class'
{
CLSID = s '{4CF20B46-D006-4B90-A64B-DBAA9470EFBE}'
CurVer = s 'ImageResizer.ContextMenuHandler.2'
}
NoRemove CLSID
{
ForceRemove {4CF20B46-D006-4B90-A64B-DBAA9470EFBE} = s 'ContextMenuHandler Class'
{
ProgID = s 'ImageResizer.ContextMenuHandler.2'
VersionIndependentProgID = s 'ImageResizer.ContextMenuHandler'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
TypeLib = s '{204306FD-15A9-40AB-A450-3E355EDDDA75}'
}
}
NoRemove SystemFileAssociations
{
NoRemove image
{
NoRemove ShellEx
{
NoRemove ContextMenuHandlers
{
ForceRemove PhotoResize = s '{4CF20B46-D006-4B90-A64B-DBAA9470EFBE}'
}
}
}
}
}
HKLM
{
NoRemove SOFTWARE
{
NoRemove Microsoft
{
NoRemove Windows
{
NoRemove CurrentVersion
{
NoRemove 'Shell Extensions'
{
NoRemove Approved
{
val {4CF20B46-D006-4B90-A64B-DBAA9470EFBE} = s 'ImageResizer'
}
}
}
}
}
}
}
Loading

0 comments on commit 0e845a9

Please sign in to comment.