[SHIMGVW] Add 'rotate and save image' buttons (#6186)

- Add IDC_ROT_CWSAVE and IDC_ROT_CCWSAVE buttons.
- Add Preview_pSaveImage helper function.
- Use it in IDC_ROT_CWSAVE and IDC_ROT_CCWSAVE
  command handling.
CORE-19358, CORE-19387
This commit is contained in:
Katayama Hirofumi MZ 2023-12-19 13:22:53 +09:00 committed by GitHub
parent 53cc92613f
commit 084fae1eb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 162 additions and 39 deletions

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Намаляване (-)"
IDS_TOOLTIP_ROT_CLOCKW "Завъртане по часовника (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Завъртане срещу часовника (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Разпечатване (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Записване като... (Ctrl+S)"

View file

@ -21,6 +21,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Oddálit (-)"
IDS_TOOLTIP_ROT_CLOCKW "Otočit po směru hodinových ručiček (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Otočit proti směru hodinových ručiček (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Odstranit (DEL)"
IDS_TOOLTIP_PRINT "Tisk (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Uložit jako... (Ctrl+S)"

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Verkleinern (-)"
IDS_TOOLTIP_ROT_CLOCKW "Drehen im Uhrzeigersinn (Strg+K)"
IDS_TOOLTIP_ROT_COUNCW "Drehen gegen den Uhrzeigersinn (Strg+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Löschen (Entf)"
IDS_TOOLTIP_PRINT "Drucken (Strg+P)"
IDS_TOOLTIP_SAVEAS "Speichern unter... (Strg+S)"

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Zoom Out (-)"
IDS_TOOLTIP_ROT_CLOCKW "Rotate Clockwise (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Rotate Counterclockwise (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Print (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Save As... (Ctrl+S)"

View file

@ -18,6 +18,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Alejar (-)"
IDS_TOOLTIP_ROT_CLOCKW "Rotar en el sentido de las agujas del reloj (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Rotar en el sentido opuesto a las agujas del reloj (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Imprimir (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Guardar como... (Ctrl+S)"

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Diminuer (-)"
IDS_TOOLTIP_ROT_CLOCKW "Tourner dans le sens des aiguilles d'une montre (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Tourner dans le sens opposé des aiguilles d'une montre (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Supprimer (Suppr)"
IDS_TOOLTIP_PRINT "Imprimer (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Enregistrer sous... (Ctrl+S)"

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "הרחקה (-)"
IDS_TOOLTIP_ROT_CLOCKW "סובב עם כיוון השעון (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "סובב כנגד כיוון השעון (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "הדפס (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "שמירה בשם... (Ctrl+S)"

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Riduci (-)"
IDS_TOOLTIP_ROT_CLOCKW "Ruota in senso orario (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Ruota in senso antiorario (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Elimina (CANC)"
IDS_TOOLTIP_PRINT "Stampa (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Salva come... (Ctrl+S)"

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "ズームアウト (-)"
IDS_TOOLTIP_ROT_CLOCKW "時計回りに回転 (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "反時計回りに回転 (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "印刷 (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "名前を付けて保存... (Ctrl+S)"

View file

@ -18,6 +18,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Mažinti (-)"
IDS_TOOLTIP_ROT_CLOCKW "Pasukti pagal laikrodžio rodyklę (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Pasukti prieš laikrodžio rodyklę (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Spausdinti (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Įrašyti kaip... (Ctrl+S)"

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Forminske (-)"
IDS_TOOLTIP_ROT_CLOCKW "Med urviseren (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Dreie mot urviseren (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Skriv ut (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Lagre som... (Ctrl+S)"

View file

@ -21,6 +21,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Pomniejsz (-)"
IDS_TOOLTIP_ROT_CLOCKW "Obróć zgodnie z ruchem wskazówek zegara (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Obróć przeciwnie do ruchu wskazówek zegara (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Usuń (Delete)"
IDS_TOOLTIP_PRINT "Drukuj (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Zapisz jako... (Ctrl+S)"

View file

@ -21,6 +21,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Zoom (-)"
IDS_TOOLTIP_ROT_CLOCKW "Girar no sentido dos ponteiros do relógio(Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Girar no sentido anti-horário (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Imprimir (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Guardar como... (Ctrl+S)"

View file

@ -24,6 +24,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Micșorare (-)"
IDS_TOOLTIP_ROT_CLOCKW "Rotește în sens orar (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Rotește în sens antiorar (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Șterge (DEL)"
IDS_TOOLTIP_PRINT "Imprimă (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Salvează ca… (Ctrl+S)"

View file

@ -16,6 +16,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Уменьшить (-)"
IDS_TOOLTIP_ROT_CLOCKW "Повернуть по часовой стрелке (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Повернуть против часовой стрелки (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Печать (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Сохранить как... (Ctrl+S)"

View file

@ -20,6 +20,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Vzdialiť (-)"
IDS_TOOLTIP_ROT_CLOCKW "Otočiť v smere hodinových ručičiek (Ctrl+K)" // Otočiť vpravo
IDS_TOOLTIP_ROT_COUNCW "Otočiť proti smeru hodinových ručičiek (Ctrl+L)" // Otočiť vľavo
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Vytlačiť (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Uložiť ako... (Ctrl+S)"

View file

@ -20,6 +20,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Zoom Jashtë (-)"
IDS_TOOLTIP_ROT_CLOCKW "Rrotullo KrahAkrepave (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Rrotullo kundërKrahAkrepave (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Printo (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Ruaj Si... (Ctrl+S)"

View file

@ -18,6 +18,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Uzaklaştır (-)"
IDS_TOOLTIP_ROT_CLOCKW "Saat Yönünde Döndür (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Saat Yönünün Tersi Yönünde Döndür (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Sil (DEL)"
IDS_TOOLTIP_PRINT "Yazdır (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Farklı Kaydet... (Ctrl+S)"

View file

@ -24,6 +24,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "Зменшити (-)"
IDS_TOOLTIP_ROT_CLOCKW "Повернути за годинниковою стрілкою (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "Повернути проти годинникової стрілки (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "Delete (DEL)"
IDS_TOOLTIP_PRINT "Друк (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "Зберегти як... (Ctrl+S)"

View file

@ -25,6 +25,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "缩小 (-)"
IDS_TOOLTIP_ROT_CLOCKW "顺时针旋转 (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "逆时针旋转 (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "删除 (DEL)"
IDS_TOOLTIP_PRINT "打印 (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "另存为...(Ctrl+S)"

View file

@ -24,6 +24,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "縮小 (-)"
IDS_TOOLTIP_ROT_CLOCKW "順時針旋轉 (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "逆時針旋轉 (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "刪除 (DEL)"
IDS_TOOLTIP_PRINT "列印 (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "另存新檔... (Ctrl+S)"

View file

@ -24,6 +24,8 @@ BEGIN
IDS_TOOLTIP_ZOOM_OUT "縮小 (-)"
IDS_TOOLTIP_ROT_CLOCKW "順時針旋轉 (Ctrl+K)"
IDS_TOOLTIP_ROT_COUNCW "逆時針旋轉 (Ctrl+L)"
IDS_TOOLTIP_ROT_CWSAVE "Rotate Clockwise and Save (Lossy)"
IDS_TOOLTIP_ROT_CCWSAVE "Rotate Counterclockwise and Save (Lossy)"
IDS_TOOLTIP_DELETE "刪除 (DEL)"
IDS_TOOLTIP_PRINT "列印 (Ctrl+P)"
IDS_TOOLTIP_SAVEAS "另存新檔... (Ctrl+S)"

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

View file

@ -20,11 +20,13 @@
#define IDB_ZOOM_OUT 56
#define IDB_ROT_CLOCKW 57
#define IDB_ROT_COUNCW 58
#define IDB_DELETE 59
#define IDB_PRINT 60
#define IDB_SAVEAS 61
#define IDB_MODIFY 62
#define IDB_HELP_TOC 63
#define IDB_ROT_CWSAVE 59
#define IDB_ROT_CCWSAVE 60
#define IDB_DELETE 61
#define IDB_PRINT 62
#define IDB_SAVEAS 63
#define IDB_MODIFY 64
#define IDB_HELP_TOC 65
/* ToolBar buttons */
#define IDC_TOOL_BASE 500
@ -38,12 +40,14 @@
#define IDC_ZOOM_OUT (IDC_TOOL_BASE + 6)
#define IDC_ROT_CLOCKW (IDC_TOOL_BASE + 7)
#define IDC_ROT_COUNCW (IDC_TOOL_BASE + 8)
#define IDC_DELETE (IDC_TOOL_BASE + 9)
#define IDC_PRINT (IDC_TOOL_BASE + 10)
#define IDC_SAVEAS (IDC_TOOL_BASE + 11)
#define IDC_MODIFY (IDC_TOOL_BASE + 12)
#define IDC_HELP_TOC (IDC_TOOL_BASE + 13)
#define IDC_ENDSLIDESHOW (IDC_TOOL_BASE + 14)
#define IDC_ROT_CWSAVE (IDC_TOOL_BASE + 9)
#define IDC_ROT_CCWSAVE (IDC_TOOL_BASE + 10)
#define IDC_DELETE (IDC_TOOL_BASE + 11)
#define IDC_PRINT (IDC_TOOL_BASE + 12)
#define IDC_SAVEAS (IDC_TOOL_BASE + 13)
#define IDC_MODIFY (IDC_TOOL_BASE + 14)
#define IDC_HELP_TOC (IDC_TOOL_BASE + 15)
#define IDC_ENDSLIDESHOW (IDC_TOOL_BASE + 16)
#define TBICON_PREV_PIC 0
#define TBICON_NEXT_PIC 1
@ -54,11 +58,13 @@
#define TBICON_ZOOM_OUT 6
#define TBICON_ROT_CLOCKW 7
#define TBICON_ROT_COUNCW 8
#define TBICON_DELETE 9
#define TBICON_PRINT 10
#define TBICON_SAVEAS 11
#define TBICON_MODIFY 12
#define TBICON_HELP_TOC 13
#define TBICON_ROT_CWSAVE 9
#define TBICON_ROT_CCWSAVE 10
#define TBICON_DELETE 11
#define TBICON_PRINT 12
#define TBICON_SAVEAS 13
#define TBICON_MODIFY 14
#define TBICON_HELP_TOC 15
/* Strings */
#define IDS_APPTITLE 100
@ -90,6 +96,8 @@
#define IDS_TOOLTIP_SAVEAS 411
#define IDS_TOOLTIP_MODIFY 412
#define IDS_TOOLTIP_HELP_TOC 413
#define IDS_TOOLTIP_ROT_CWSAVE 414
#define IDS_TOOLTIP_ROT_CCWSAVE 415
/* Keyboard accelerators */
#define IDR_ACCELERATOR 600

View file

@ -59,6 +59,9 @@ static const TBBUTTON s_Buttons[] =
DEFINE_BTN_INFO(ROT_CLOCKW),
DEFINE_BTN_INFO(ROT_COUNCW),
DEFINE_BTN_SEPARATOR,
DEFINE_BTN_INFO(ROT_CWSAVE),
DEFINE_BTN_INFO(ROT_CCWSAVE),
DEFINE_BTN_SEPARATOR,
DEFINE_BTN_INFO(DELETE),
DEFINE_BTN_INFO(PRINT),
DEFINE_BTN_INFO(SAVEAS),
@ -87,11 +90,13 @@ static const TB_BUTTON_CONFIG s_ButtonConfig[] =
DEFINE_BTN_CONFIG(ZOOM_OUT),
DEFINE_BTN_CONFIG(ROT_CLOCKW),
DEFINE_BTN_CONFIG(ROT_COUNCW),
DEFINE_BTN_CONFIG(ROT_CWSAVE),
DEFINE_BTN_CONFIG(ROT_CCWSAVE),
DEFINE_BTN_CONFIG(DELETE),
DEFINE_BTN_CONFIG(PRINT),
DEFINE_BTN_CONFIG(SAVEAS),
DEFINE_BTN_CONFIG(MODIFY),
DEFINE_BTN_CONFIG(HELP_TOC)
DEFINE_BTN_CONFIG(HELP_TOC),
};
typedef struct tagPREVIEW_DATA
@ -106,6 +111,7 @@ typedef struct tagPREVIEW_DATA
UINT m_nMouseDownMsg;
POINT m_ptOrigin;
IStream *m_pMemStream;
WCHAR m_szFile[MAX_PATH];
} PREVIEW_DATA, *PPREVIEW_DATA;
static inline PPREVIEW_DATA
@ -344,6 +350,8 @@ Preview_pFreeImage(PPREVIEW_DATA pData)
pData->m_pMemStream->lpVtbl->Release(pData->m_pMemStream);
pData->m_pMemStream = NULL;
}
pData->m_szFile[0] = UNICODE_NULL;
}
IStream* MemStreamFromFile(LPCWSTR pszFileName)
@ -384,14 +392,6 @@ Preview_pLoadImage(PPREVIEW_DATA pData, LPCWSTR szOpenFileName)
{
Preview_pFreeImage(pData);
/* check file presence */
if (!szOpenFileName || GetFileAttributesW(szOpenFileName) == 0xFFFFFFFF)
{
DPRINT1("File %s not found!\n", szOpenFileName);
Preview_UpdateTitle(pData, NULL);
return;
}
pData->m_pMemStream = MemStreamFromFile(szOpenFileName);
if (!pData->m_pMemStream)
{
@ -413,8 +413,8 @@ Preview_pLoadImage(PPREVIEW_DATA pData, LPCWSTR szOpenFileName)
Anime_LoadInfo(&pData->m_Anime);
if (szOpenFileName && szOpenFileName[0])
SHAddToRecentDocs(SHARD_PATHW, szOpenFileName);
SHAddToRecentDocs(SHARD_PATHW, szOpenFileName);
GetFullPathNameW(szOpenFileName, _countof(pData->m_szFile), pData->m_szFile, NULL);
/* Reset zoom and redraw display */
Preview_ResetZoom(pData);
@ -428,6 +428,53 @@ Preview_pLoadImageFromNode(PPREVIEW_DATA pData, SHIMGVW_FILENODE *pNode)
Preview_pLoadImage(pData, (pNode ? pNode->FileName : NULL));
}
static BOOL
Preview_pSaveImage(PPREVIEW_DATA pData, LPCWSTR pszFile)
{
ImageCodecInfo *codecInfo;
GUID rawFormat;
UINT j, num, nFilterIndex, size;
BOOL ret = FALSE;
if (g_pImage == NULL)
return FALSE;
GdipGetImageEncodersSize(&num, &size);
codecInfo = QuickAlloc(size, FALSE);
if (!codecInfo)
{
DPRINT1("QuickAlloc() failed in pSaveImage()\n");
return FALSE;
}
GdipGetImageEncoders(num, size, codecInfo);
GdipGetImageRawFormat(g_pImage, &rawFormat);
if (IsEqualGUID(&rawFormat, &ImageFormatMemoryBMP))
rawFormat = ImageFormatBMP;
nFilterIndex = 0;
for (j = 0; j < num; ++j)
{
if (IsEqualGUID(&rawFormat, &codecInfo[j].FormatID))
{
nFilterIndex = j + 1;
break;
}
}
Anime_Pause(&pData->m_Anime);
ret = (nFilterIndex > 0) &&
(GdipSaveImageToFile(g_pImage, pszFile, &codecInfo[nFilterIndex - 1].Clsid, NULL) == Ok);
if (!ret)
DPRINT1("GdipSaveImageToFile() failed\n");
Anime_Start(&pData->m_Anime, 0);
QuickFree(codecInfo);
return ret;
}
static VOID
Preview_pSaveImageAs(PPREVIEW_DATA pData)
{
@ -453,7 +500,10 @@ Preview_pSaveImageAs(PPREVIEW_DATA pData)
}
GdipGetImageEncoders(num, size, codecInfo);
GdipGetImageRawFormat(g_pImage, &rawFormat);
if (IsEqualGUID(&rawFormat, &ImageFormatMemoryBMP))
rawFormat = ImageFormatBMP;
sizeRemain = 0;
for (j = 0; j < num; ++j)
@ -500,13 +550,13 @@ Preview_pSaveImageAs(PPREVIEW_DATA pData)
c++;
sizeRemain -= sizeof(*c);
if (IsEqualGUID(&rawFormat, &codecInfo[j].FormatID) != FALSE)
if (IsEqualGUID(&rawFormat, &codecInfo[j].FormatID))
{
sfn.nFilterIndex = j + 1;
}
}
if (GetSaveFileNameW(&sfn))
if (GetSaveFileNameW(&sfn) && sfn.nFilterIndex > 0)
{
Anime_Pause(&pData->m_Anime);
@ -1266,16 +1316,20 @@ Preview_Delete(PPREVIEW_DATA pData)
HWND hwnd = pData->m_hwnd;
SHFILEOPSTRUCTW FileOp = { hwnd, FO_DELETE };
if (!g_pCurrentFile)
if (!pData->m_szFile[0])
return;
/* FileOp.pFrom must be double-null-terminated */
GetFullPathNameW(g_pCurrentFile->FileName, _countof(szCurFile) - 1, szCurFile, NULL);
GetFullPathNameW(pData->m_szFile, _countof(szCurFile) - 1, szCurFile, NULL);
szCurFile[_countof(szCurFile) - 2] = UNICODE_NULL; /* Avoid buffer overrun */
szCurFile[lstrlenW(szCurFile) + 1] = UNICODE_NULL;
GetFullPathNameW(g_pCurrentFile->Next->FileName, _countof(szNextFile), szNextFile, NULL);
szNextFile[_countof(szNextFile) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
szNextFile[0] = UNICODE_NULL;
if (g_pCurrentFile)
{
GetFullPathNameW(g_pCurrentFile->Next->FileName, _countof(szNextFile), szNextFile, NULL);
szNextFile[_countof(szNextFile) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
}
/* Confirm file deletion and delete if allowed */
FileOp.pFrom = szCurFile;
@ -1295,19 +1349,16 @@ Preview_Delete(PPREVIEW_DATA pData)
static VOID
Preview_Edit(HWND hwnd)
{
WCHAR szPathName[MAX_PATH];
SHELLEXECUTEINFOW sei;
PPREVIEW_DATA pData = Preview_GetData(hwnd);
if (!g_pCurrentFile)
if (!pData->m_szFile[0])
return;
GetFullPathNameW(g_pCurrentFile->FileName, _countof(szPathName), szPathName, NULL);
szPathName[_countof(szPathName) - 1] = UNICODE_NULL; /* Avoid buffer overrun */
ZeroMemory(&sei, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.lpVerb = L"edit";
sei.lpFile = szPathName;
sei.lpFile = pData->m_szFile;
sei.nShow = SW_SHOWNORMAL;
if (!ShellExecuteExW(&sei))
{
@ -1435,6 +1486,24 @@ Preview_OnCommand(HWND hwnd, UINT nCommandID)
}
break;
case IDC_ROT_CWSAVE:
if (g_pImage)
{
GdipImageRotateFlip(g_pImage, Rotate270FlipNone);
Preview_pSaveImage(pData, pData->m_szFile);
Preview_UpdateImage(pData);
}
break;
case IDC_ROT_CCWSAVE:
if (g_pImage)
{
GdipImageRotateFlip(g_pImage, Rotate90FlipNone);
Preview_pSaveImage(pData, pData->m_szFile);
Preview_UpdateImage(pData);
}
break;
case IDC_DELETE:
Preview_Delete(pData);
Preview_UpdateImage(pData);

View file

@ -28,6 +28,8 @@ IDB_ZOOM_IN BITMAP "res/zoomp.bmp"
IDB_ZOOM_OUT BITMAP "res/zoomm.bmp"
IDB_ROT_CLOCKW BITMAP "res/rot1.bmp"
IDB_ROT_COUNCW BITMAP "res/rot2.bmp"
IDB_ROT_CWSAVE BITMAP "res/rot1save.bmp"
IDB_ROT_CCWSAVE BITMAP "res/rot2save.bmp"
IDB_DELETE BITMAP "res/delete.bmp"
IDB_PRINT BITMAP "res/print.bmp"
IDB_SAVEAS BITMAP "res/save.bmp"