ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
December 2023
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
274 discussions
Start a n
N
ew thread
[reactos] 01/03: [NDK] Add Affinity helper inline functions
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d87b45bee7e57971f41f1…
commit d87b45bee7e57971f41f1f4aa36c2d9adc340f1b Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Sun Nov 26 17:32:27 2023 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Fri Dec 8 19:28:57 2023 +0200 [NDK] Add Affinity helper inline functions --- hal/halx86/include/smp.h | 9 -------- ntoskrnl/include/internal/ke.h | 1 - sdk/include/ndk/kefuncs.h | 47 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/hal/halx86/include/smp.h b/hal/halx86/include/smp.h index d35189801c5..3b98c788ab9 100644 --- a/hal/halx86/include/smp.h +++ b/hal/halx86/include/smp.h @@ -7,15 +7,6 @@ #pragma once -#define AFFINITY_MASK(Id) ((KAFFINITY)1 << (Id)) - -/* Helper to find the lowest CPU in a KAFFINITY */ -#ifdef _WIN64 -#define BitScanForwardAffinity BitScanForward64 -#else -#define BitScanForwardAffinity BitScanForward -#endif - /* This table is filled for each physical processor on system */ typedef struct _PROCESSOR_IDENTITY { diff --git a/ntoskrnl/include/internal/ke.h b/ntoskrnl/include/internal/ke.h index fbd3660553e..6a477545c44 100644 --- a/ntoskrnl/include/internal/ke.h +++ b/ntoskrnl/include/internal/ke.h @@ -155,7 +155,6 @@ extern VOID __cdecl KiInterruptTemplate(VOID); /* MACROS *************************************************************************/ -#define AFFINITY_MASK(ProcessorIndex) ((KAFFINITY)1 << (ProcessorIndex)) #define PRIORITY_MASK(Priority) (1UL << (Priority)) /* Tells us if the Timer or Event is a Syncronization or Notification Object */ diff --git a/sdk/include/ndk/kefuncs.h b/sdk/include/ndk/kefuncs.h index 0d53714e63f..f1ac4888be8 100644 --- a/sdk/include/ndk/kefuncs.h +++ b/sdk/include/ndk/kefuncs.h @@ -33,6 +33,53 @@ extern "C" #ifndef NTOS_MODE_USER +// +// Affinity helpers +// +FORCEINLINE KAFFINITY AFFINITY_MASK(ULONG Index) +{ + ASSERT(Index < sizeof(KAFFINITY) * 8); + return (KAFFINITY)1 << Index; +} + +FORCEINLINE BOOLEAN BitScanForwardAffinity(PULONG Index, KAFFINITY Mask) +{ +#ifdef _WIN64 + return BitScanForward64(Index, Mask); +#else + return BitScanForward(Index, Mask); +#endif +} + +FORCEINLINE BOOLEAN BitScanReverseAffinity(PULONG Index, KAFFINITY Mask) +{ +#ifdef _WIN64 + return BitScanReverse64(Index, Mask); +#else + return BitScanReverse(Index, Mask); +#endif +} + +FORCEINLINE BOOLEAN InterlockedBitTestAndSetAffinity(volatile KAFFINITY *Affinity, ULONG Index) +{ + ASSERT(Index < sizeof(KAFFINITY) * 8); +#ifdef _WIN64 + return InterlockedBitTestAndSet64((PLONG64)Affinity, Index); +#else + return InterlockedBitTestAndSet((PLONG)Affinity, Index); +#endif +} + +FORCEINLINE BOOLEAN InterlockedBitTestAndResetAffinity(volatile KAFFINITY *Affinity, ULONG Index) +{ + ASSERT(Index < sizeof(KAFFINITY) * 8); +#ifdef _WIN64 + return InterlockedBitTestAndReset64((PLONG64)Affinity, Index); +#else + return InterlockedBitTestAndReset((PLONG)Affinity, Index); +#endif +} + // // APC Functions //
1 year
1
0
0
0
[reactos] 01/01: [SHIMGVW] Add g_ or s_ prefix to global variables (#6134)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=57e7f0b321a9f5f7d55d7…
commit 57e7f0b321a9f5f7d55d7122767ae0b9fd7b0da1 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Dec 8 21:35:43 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Dec 8 21:35:43 2023 +0900 [SHIMGVW] Add g_ or s_ prefix to global variables (#6134) Renaming global variables: - s/hInstance/g_hInstance/ - s/shiSettings/g_Settings/ - s/currentFile/g_pCurrentFile/ - s/image/g_pImage/ - s/PrevProc/g_fnPrevProc/ - s/hDispWnd/g_hDispWnd/ - s/hToolBar/g_hToolBar/ - s/ZoomPercents/s_nZoomPercents/ - s/ZoomSteps/s_ZoomSteps/ - s/Buttons/s_Buttons/ - s/BtnConfig/s_ButtonConfig/ CORE-19358 --- dll/win32/shimgvw/shimgvw.c | 285 ++++++++++++++++++++++---------------------- 1 file changed, 143 insertions(+), 142 deletions(-) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index 613cb250023..86dec69785b 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -35,24 +35,25 @@ #include "shimgvw.h" -HINSTANCE hInstance; -SHIMGVW_SETTINGS shiSettings; -SHIMGVW_FILENODE *currentFile; -GpImage *image = NULL; -WNDPROC PrevProc = NULL; +HINSTANCE g_hInstance; +SHIMGVW_SETTINGS g_Settings; +SHIMGVW_FILENODE *g_pCurrentFile; +GpImage *g_pImage = NULL; +WNDPROC g_fnPrevProc = NULL; -HWND hDispWnd, hToolBar; +HWND g_hDispWnd = NULL; +HWND g_hToolBar = NULL; /* zooming */ -UINT ZoomPercents = 100; +static UINT s_nZoomPercents = 100; -static const UINT ZoomSteps[] = +static const UINT s_ZoomSteps[] = { 10, 25, 50, 100, 200, 400, 800, 1600 }; -#define MIN_ZOOM ZoomSteps[0] -#define MAX_ZOOM ZoomSteps[_countof(ZoomSteps)-1] +#define MIN_ZOOM s_ZoomSteps[0] +#define MAX_ZOOM s_ZoomSteps[_countof(s_ZoomSteps) - 1] /* ToolBar Buttons */ typedef struct { @@ -68,7 +69,7 @@ typedef struct { { 15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0 } /* ToolBar Buttons */ -static const TBBUTTON Buttons[] = +static const TBBUTTON s_Buttons[] = { DEFINE_BTN_INFO(PREV_PIC), DEFINE_BTN_INFO(NEXT_PIC), @@ -93,7 +94,7 @@ static const TBBUTTON Buttons[] = #define DEFINE_BTN_CONFIG(_name) { IDB_##_name, IDS_TOOLTIP_##_name } -static const TB_BUTTON_CONFIG BtnConfig[] = +static const TB_BUTTON_CONFIG s_ButtonConfig[] = { DEFINE_BTN_CONFIG(PREV_PIC), DEFINE_BTN_CONFIG(NEXT_PIC), @@ -142,42 +143,42 @@ static BOOL Anime_LoadInfo(void) PropertyItem *pItem; Anime_FreeInfo(); - KillTimer(hDispWnd, ANIME_TIMER_ID); + KillTimer(g_hDispWnd, ANIME_TIMER_ID); - if (!image) + if (!g_pImage) return FALSE; - GdipImageGetFrameDimensionsCount(image, &nDimCount); + GdipImageGetFrameDimensionsCount(g_pImage, &nDimCount); if (nDimCount) { dims = (GUID *)calloc(nDimCount, sizeof(GUID)); if (dims) { - GdipImageGetFrameDimensionsList(image, dims, nDimCount); - GdipImageGetFrameCount(image, dims, &result); + GdipImageGetFrameDimensionsList(g_pImage, dims, nDimCount); + GdipImageGetFrameCount(g_pImage, dims, &result); m_nFrameCount = result; free(dims); } } result = 0; - GdipGetPropertyItemSize(image, PropertyTagFrameDelay, &result); + GdipGetPropertyItemSize(g_pImage, PropertyTagFrameDelay, &result); cbItem = result; if (cbItem) { m_pDelayItem = (PropertyItem *)malloc(cbItem); - GdipGetPropertyItem(image, PropertyTagFrameDelay, cbItem, m_pDelayItem); + GdipGetPropertyItem(g_pImage, PropertyTagFrameDelay, cbItem, m_pDelayItem); } result = 0; - GdipGetPropertyItemSize(image, PropertyTagLoopCount, &result); + GdipGetPropertyItemSize(g_pImage, PropertyTagLoopCount, &result); cbItem = result; if (cbItem) { pItem = (PropertyItem *)malloc(cbItem); if (pItem) { - if (GdipGetPropertyItem(image, PropertyTagLoopCount, cbItem, pItem) == Ok) + if (GdipGetPropertyItem(g_pImage, PropertyTagLoopCount, cbItem, pItem) == Ok) { m_nLoopCount = *(WORD *)pItem->value; } @@ -187,7 +188,7 @@ static BOOL Anime_LoadInfo(void) if (m_pDelayItem) { - SetTimer(hDispWnd, ANIME_TIMER_ID, 0, NULL); + SetTimer(g_hDispWnd, ANIME_TIMER_ID, 0, NULL); } return m_pDelayItem != NULL; @@ -198,10 +199,10 @@ static void Anime_SetFrameIndex(UINT nFrameIndex) if (nFrameIndex < m_nFrameCount) { GUID guid = FrameDimensionTime; - if (Ok != GdipImageSelectActiveFrame(image, &guid, nFrameIndex)) + if (Ok != GdipImageSelectActiveFrame(g_pImage, &guid, nFrameIndex)) { guid = FrameDimensionPage; - GdipImageSelectActiveFrame(image, &guid, nFrameIndex); + GdipImageSelectActiveFrame(g_pImage, &guid, nFrameIndex); } } m_nFrameIndex = nFrameIndex; @@ -247,10 +248,10 @@ static void UpdateZoom(UINT NewZoom, BOOL bEnableBestFit, BOOL bEnableRealSize) BOOL bEnableZoomIn, bEnableZoomOut; /* If zoom has not been changed, ignore it */ - if (ZoomPercents == NewZoom) + if (s_nZoomPercents == NewZoom) return; - ZoomPercents = NewZoom; + s_nZoomPercents = NewZoom; /* Check if a zoom button of the toolbar must be grayed */ bEnableZoomIn = bEnableZoomOut = TRUE; @@ -265,50 +266,50 @@ static void UpdateZoom(UINT NewZoom, BOOL bEnableBestFit, BOOL bEnableRealSize) } /* Update the state of the zoom buttons */ - SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_ZOOM_OUT, bEnableZoomOut); - SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_ZOOM_IN, bEnableZoomIn); + SendMessageW(g_hToolBar, TB_ENABLEBUTTON, IDC_ZOOM_OUT, bEnableZoomOut); + SendMessageW(g_hToolBar, TB_ENABLEBUTTON, IDC_ZOOM_IN, bEnableZoomIn); /* Redraw the display window */ - InvalidateRect(hDispWnd, NULL, FALSE); + InvalidateRect(g_hDispWnd, NULL, FALSE); /* Update toolbar buttons */ - SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_BEST_FIT, bEnableBestFit); - SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_REAL_SIZE, bEnableRealSize); + SendMessageW(g_hToolBar, TB_ENABLEBUTTON, IDC_BEST_FIT, bEnableBestFit); + SendMessageW(g_hToolBar, TB_ENABLEBUTTON, IDC_REAL_SIZE, bEnableRealSize); } static void ZoomInOrOut(BOOL bZoomIn) { UINT i, NewZoom; - if (image == NULL) + if (g_pImage == NULL) return; if (bZoomIn) /* zoom in */ { /* find next step */ - for (i = 0; i < _countof(ZoomSteps); ++i) + for (i = 0; i < _countof(s_ZoomSteps); ++i) { - if (ZoomPercents < ZoomSteps[i]) + if (s_nZoomPercents < s_ZoomSteps[i]) break; } - if (i == _countof(ZoomSteps)) + if (i == _countof(s_ZoomSteps)) NewZoom = MAX_ZOOM; else - NewZoom = ZoomSteps[i]; + NewZoom = s_ZoomSteps[i]; } else /* zoom out */ { /* find previous step */ - for (i = _countof(ZoomSteps); i > 0; ) + for (i = _countof(s_ZoomSteps); i > 0; ) { --i; - if (ZoomSteps[i] < ZoomPercents) + if (s_ZoomSteps[i] < s_nZoomPercents) break; } if (i < 0) NewZoom = MIN_ZOOM; else - NewZoom = ZoomSteps[i]; + NewZoom = s_ZoomSteps[i]; } /* Update toolbar and refresh screen */ @@ -320,13 +321,13 @@ static void ResetZoom(void) RECT Rect; UINT ImageWidth, ImageHeight, NewZoom; - if (image == NULL) + if (g_pImage == NULL) return; /* get disp window size and image size */ - GetClientRect(hDispWnd, &Rect); - GdipGetImageWidth(image, &ImageWidth); - GdipGetImageHeight(image, &ImageHeight); + GetClientRect(g_hDispWnd, &Rect); + GdipGetImageWidth(g_pImage, &ImageWidth); + GdipGetImageHeight(g_pImage, &ImageHeight); /* compare two aspect rates. same as (ImageHeight / ImageWidth < Rect.bottom / Rect.right) in real */ @@ -370,8 +371,8 @@ static void pLoadImage(LPCWSTR szOpenFileName) } /* load now */ - GdipLoadImageFromFile(szOpenFileName, &image); - if (!image) + GdipLoadImageFromFile(szOpenFileName, &g_pImage); + if (!g_pImage) { DPRINT1("GdipLoadImageFromFile() failed\n"); return; @@ -398,7 +399,7 @@ static void pSaveImageAs(HWND hwnd) UINT j; WCHAR *c; - if (image == NULL) + if (g_pImage == NULL) return; GdipGetImageEncodersSize(&num, &size); @@ -410,7 +411,7 @@ static void pSaveImageAs(HWND hwnd) } GdipGetImageEncoders(num, size, codecInfo); - GdipGetImageRawFormat(image, &rawFormat); + GdipGetImageRawFormat(g_pImage, &rawFormat); sizeRemain = 0; @@ -436,7 +437,7 @@ static void pSaveImageAs(HWND hwnd) ZeroMemory(&sfn, sizeof(sfn)); sfn.lStructSize = sizeof(sfn); sfn.hwndOwner = hwnd; - sfn.hInstance = hInstance; + sfn.hInstance = g_hInstance; sfn.lpstrFile = szSaveFileName; sfn.lpstrFilter = szFilterMask; sfn.nMaxFile = _countof(szSaveFileName); @@ -470,20 +471,20 @@ static void pSaveImageAs(HWND hwnd) if (m_pDelayItem) { /* save animation */ - KillTimer(hDispWnd, ANIME_TIMER_ID); + KillTimer(g_hDispWnd, ANIME_TIMER_ID); DPRINT1("FIXME: save animation\n"); - if (GdipSaveImageToFile(image, szSaveFileName, &codecInfo[sfn.nFilterIndex - 1].Clsid, NULL) != Ok) + if (GdipSaveImageToFile(g_pImage, szSaveFileName, &codecInfo[sfn.nFilterIndex - 1].Clsid, NULL) != Ok) { DPRINT1("GdipSaveImageToFile() failed\n"); } - SetTimer(hDispWnd, ANIME_TIMER_ID, 0, NULL); + SetTimer(g_hDispWnd, ANIME_TIMER_ID, 0, NULL); } else { /* save non-animation */ - if (GdipSaveImageToFile(image, szSaveFileName, &codecInfo[sfn.nFilterIndex - 1].Clsid, NULL) != Ok) + if (GdipSaveImageToFile(g_pImage, szSaveFileName, &codecInfo[sfn.nFilterIndex - 1].Clsid, NULL) != Ok) { DPRINT1("GdipSaveImageToFile() failed\n"); } @@ -503,8 +504,8 @@ pPrintImage(HWND hwnd) static VOID EnableToolBarButtons(BOOL bEnable) { - SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_SAVEAS, bEnable); - SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_PRINT, bEnable); + SendMessageW(g_hToolBar, TB_ENABLEBUTTON, IDC_SAVEAS, bEnable); + SendMessageW(g_hToolBar, TB_ENABLEBUTTON, IDC_PRINT, bEnable); } static VOID @@ -514,10 +515,10 @@ pLoadImageFromNode(SHIMGVW_FILENODE *node, HWND hwnd) WCHAR szResStr[512]; LPWSTR pchFileTitle; - if (image) + if (g_pImage) { - GdipDisposeImage(image); - image = NULL; + GdipDisposeImage(g_pImage); + g_pImage = NULL; } if (node == NULL) @@ -528,7 +529,7 @@ pLoadImageFromNode(SHIMGVW_FILENODE *node, HWND hwnd) pLoadImage(node->FileName); - LoadStringW(hInstance, IDS_APPTITLE, szResStr, _countof(szResStr)); + LoadStringW(g_hInstance, IDS_APPTITLE, szResStr, _countof(szResStr)); pchFileTitle = PathFindFileNameW(node->FileName); if (pchFileTitle && *pchFileTitle) @@ -542,7 +543,7 @@ pLoadImageFromNode(SHIMGVW_FILENODE *node, HWND hwnd) SetWindowTextW(hwnd, szResStr); } - EnableToolBarButtons(image != NULL); + EnableToolBarButtons(g_pImage != NULL); /* Redraw the display window */ InvalidateRect(hwnd, NULL, FALSE); @@ -739,11 +740,11 @@ ImageView_DrawImage(HWND hwnd) GetClientRect(hwnd, &rect); white = GetStockObject(WHITE_BRUSH); - if (image == NULL) + if (g_pImage == NULL) { FillRect(hdc, &rect, white); - LoadStringW(hInstance, IDS_NOPREVIEW, szText, _countof(szText)); + LoadStringW(g_hInstance, IDS_NOPREVIEW, szText, _countof(szText)); SetTextColor(hdc, RGB(0, 0, 0)); SetBkMode(hdc, TRANSPARENT); @@ -755,11 +756,11 @@ ImageView_DrawImage(HWND hwnd) } else { - GdipGetImageWidth(image, &ImageWidth); - GdipGetImageHeight(image, &ImageHeight); + GdipGetImageWidth(g_pImage, &ImageWidth); + GdipGetImageHeight(g_pImage, &ImageHeight); - ZoomedWidth = (ImageWidth * ZoomPercents) / 100; - ZoomedHeight = (ImageHeight * ZoomPercents) / 100; + ZoomedWidth = (ImageWidth * s_nZoomPercents) / 100; + ZoomedHeight = (ImageHeight * s_nZoomPercents) / 100; x = (rect.right - ZoomedWidth) / 2; y = (rect.bottom - ZoomedHeight) / 2; @@ -784,10 +785,10 @@ ImageView_DrawImage(HWND hwnd) DPRINT("x = %d, y = %d, ImageWidth = %u, ImageHeight = %u\n"); DPRINT("rect.right = %ld, rect.bottom = %ld\n", rect.right, rect.bottom); - DPRINT("ZoomPercents = %d, ZoomedWidth = %d, ZoomedHeight = %d\n", - ZoomPercents, ZoomedWidth, ZoomedWidth); + DPRINT("s_nZoomPercents = %d, ZoomedWidth = %d, ZoomedHeight = %d\n", + s_nZoomPercents, ZoomedWidth, ZoomedWidth); - if (ZoomPercents % 100 == 0) + if (s_nZoomPercents % 100 == 0) { GdipSetInterpolationMode(graphics, InterpolationModeNearestNeighbor); GdipSetSmoothingMode(graphics, SmoothingModeNone); @@ -799,7 +800,7 @@ ImageView_DrawImage(HWND hwnd) } uFlags = 0; - GdipGetImageFlags(image, &uFlags); + GdipGetImageFlags(g_pImage, &uFlags); if (uFlags & (ImageFlagsHasAlpha | ImageFlagsHasTranslucent)) { @@ -816,7 +817,7 @@ ImageView_DrawImage(HWND hwnd) SelectObject(hdc, hbrOld); } - GdipDrawImageRectI(graphics, image, x, y, ZoomedWidth, ZoomedHeight); + GdipDrawImageRectI(graphics, g_pImage, x, y, ZoomedWidth, ZoomedHeight); } GdipDeleteGraphics(graphics); EndPaint(hwnd, &ps); @@ -829,18 +830,18 @@ ImageView_LoadSettings(VOID) DWORD dwSize; LONG nError; - shiSettings.Maximized = FALSE; - shiSettings.X = CW_USEDEFAULT; - shiSettings.Y = CW_USEDEFAULT; - shiSettings.Width = 520; - shiSettings.Height = 400; + g_Settings.Maximized = FALSE; + g_Settings.X = CW_USEDEFAULT; + g_Settings.Y = CW_USEDEFAULT; + g_Settings.Width = 520; + g_Settings.Height = 400; nError = RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\shimgvw", 0, KEY_READ, &hKey); if (nError) return FALSE; - dwSize = sizeof(shiSettings); - nError = RegQueryValueExW(hKey, L"Settings", NULL, NULL, (LPBYTE)&shiSettings, &dwSize); + dwSize = sizeof(g_Settings); + nError = RegQueryValueExW(hKey, L"Settings", NULL, NULL, (LPBYTE)&g_Settings, &dwSize); RegCloseKey(hKey); return !nError; @@ -857,16 +858,16 @@ ImageView_SaveSettings(HWND hwnd) GetWindowPlacement(hwnd, &wp); prc = &wp.rcNormalPosition; - shiSettings.X = prc->left; - shiSettings.Y = prc->top; - shiSettings.Width = prc->right - prc->left; - shiSettings.Height = prc->bottom - prc->top; - shiSettings.Maximized = IsZoomed(hwnd); + g_Settings.X = prc->left; + g_Settings.Y = prc->top; + g_Settings.Width = prc->right - prc->left; + g_Settings.Height = prc->bottom - prc->top; + g_Settings.Maximized = IsZoomed(hwnd); if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\ReactOS\\shimgvw"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) { - RegSetValueEx(hKey, _T("Settings"), 0, REG_BINARY, (LPBYTE)&shiSettings, sizeof(SHIMGVW_SETTINGS)); + RegSetValueEx(hKey, _T("Settings"), 0, REG_BINARY, (LPBYTE)&g_Settings, sizeof(SHIMGVW_SETTINGS)); RegCloseKey(hKey); } } @@ -874,33 +875,33 @@ ImageView_SaveSettings(HWND hwnd) static BOOL ImageView_CreateToolBar(HWND hwnd) { - hToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, - WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | CCS_BOTTOM | TBSTYLE_TOOLTIPS, - 0, 0, 0, 0, hwnd, - 0, hInstance, NULL); - if (hToolBar != NULL) + g_hToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, + WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | CCS_BOTTOM | TBSTYLE_TOOLTIPS, + 0, 0, 0, 0, hwnd, + 0, g_hInstance, NULL); + if (g_hToolBar != NULL) { HIMAGELIST hImageList; - SendMessageW(hToolBar, TB_SETEXTENDEDSTYLE, + SendMessageW(g_hToolBar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_HIDECLIPPEDBUTTONS); - SendMessageW(hToolBar, TB_BUTTONSTRUCTSIZE, - sizeof(Buttons[0]), 0); + SendMessageW(g_hToolBar, TB_BUTTONSTRUCTSIZE, + sizeof(s_Buttons[0]), 0); hImageList = ImageList_Create(TB_IMAGE_WIDTH, TB_IMAGE_HEIGHT, ILC_MASK | ILC_COLOR24, 1, 1); if (hImageList == NULL) return FALSE; - for (UINT n = 0; n < _countof(BtnConfig); n++) + for (UINT n = 0; n < _countof(s_ButtonConfig); n++) { - ImageList_AddMasked(hImageList, LoadImageW(hInstance, MAKEINTRESOURCEW(BtnConfig[n].idb), IMAGE_BITMAP, + ImageList_AddMasked(hImageList, LoadImageW(g_hInstance, MAKEINTRESOURCEW(s_ButtonConfig[n].idb), IMAGE_BITMAP, TB_IMAGE_WIDTH, TB_IMAGE_HEIGHT, LR_DEFAULTCOLOR), RGB(255, 255, 255)); } - ImageList_Destroy((HIMAGELIST)SendMessageW(hToolBar, TB_SETIMAGELIST, + ImageList_Destroy((HIMAGELIST)SendMessageW(g_hToolBar, TB_SETIMAGELIST, 0, (LPARAM)hImageList)); - SendMessageW(hToolBar, TB_ADDBUTTONS, _countof(Buttons), (LPARAM)Buttons); + SendMessageW(g_hToolBar, TB_ADDBUTTONS, _countof(s_Buttons), (LPARAM)s_Buttons); return TRUE; } @@ -941,18 +942,18 @@ ImageView_DispWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) break; } } - return CallWindowProcW(PrevProc, hwnd, Message, wParam, lParam); + return CallWindowProcW(g_fnPrevProc, hwnd, Message, wParam, lParam); } static VOID ImageView_InitControls(HWND hwnd) { - hDispWnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_STATIC, L"", - WS_CHILD | WS_VISIBLE, - 0, 0, 0, 0, hwnd, NULL, hInstance, NULL); + g_hDispWnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_STATIC, L"", + WS_CHILD | WS_VISIBLE, + 0, 0, 0, 0, hwnd, NULL, g_hInstance, NULL); - SetClassLongPtr(hDispWnd, GCL_STYLE, CS_HREDRAW | CS_VREDRAW); - PrevProc = (WNDPROC) SetWindowLongPtr(hDispWnd, GWLP_WNDPROC, (LPARAM) ImageView_DispWndProc); + SetClassLongPtr(g_hDispWnd, GCL_STYLE, CS_HREDRAW | CS_VREDRAW); + g_fnPrevProc = (WNDPROC) SetWindowLongPtr(g_hDispWnd, GWLP_WNDPROC, (LPARAM) ImageView_DispWndProc); ImageView_CreateToolBar(hwnd); } @@ -972,11 +973,11 @@ ImageView_OnSize(HWND hwnd, UINT state, INT cx, INT cy) { RECT rc; - SendMessageW(hToolBar, TB_AUTOSIZE, 0, 0); + SendMessageW(g_hToolBar, TB_AUTOSIZE, 0, 0); - GetWindowRect(hToolBar, &rc); + GetWindowRect(g_hToolBar, &rc); - MoveWindow(hDispWnd, 0, 0, cx, cy - (rc.bottom - rc.top), TRUE); + MoveWindow(g_hDispWnd, 0, 0, cx, cy - (rc.bottom - rc.top), TRUE); /* is it maximized or restored? */ if (state == SIZE_MAXIMIZED || state == SIZE_RESTORED) @@ -992,18 +993,18 @@ ImageView_Delete(HWND hwnd) WCHAR szCurFile[MAX_PATH + 1], szNextFile[MAX_PATH]; SHFILEOPSTRUCT FileOp = { hwnd, FO_DELETE }; - if (image) + if (g_pImage) { - GdipDisposeImage(image); - image = NULL; + GdipDisposeImage(g_pImage); + g_pImage = NULL; } /* FileOp.pFrom must be double-null-terminated */ - GetFullPathNameW(currentFile->FileName, _countof(szCurFile) - 1, szCurFile, NULL); + GetFullPathNameW(g_pCurrentFile->FileName, _countof(szCurFile) - 1, szCurFile, NULL); szCurFile[_countof(szCurFile) - 2] = UNICODE_NULL; /* Avoid buffer overrun */ szCurFile[lstrlenW(szCurFile) + 1] = UNICODE_NULL; - GetFullPathNameW(currentFile->Next->FileName, _countof(szNextFile), szNextFile, NULL); + GetFullPathNameW(g_pCurrentFile->Next->FileName, _countof(szNextFile), szNextFile, NULL); szNextFile[_countof(szNextFile) - 1] = UNICODE_NULL; /* Avoid buffer overrun */ FileOp.pFrom = szCurFile; @@ -1011,11 +1012,11 @@ ImageView_Delete(HWND hwnd) if (SHFileOperation(&FileOp) != 0) return 0; - pFreeFileList(currentFile); - currentFile = NULL; + pFreeFileList(g_pCurrentFile); + g_pCurrentFile = NULL; - currentFile = pBuildFileList(szNextFile); - pLoadImageFromNode(currentFile, hwnd); + g_pCurrentFile = pBuildFileList(szNextFile); + pLoadImageFromNode(g_pCurrentFile, hwnd); return 1; } @@ -1023,7 +1024,7 @@ ImageView_Delete(HWND hwnd) static LRESULT ImageView_Modify(HWND hwnd) { - int nChars = GetFullPathNameW(currentFile->FileName, 0, NULL, NULL); + int nChars = GetFullPathNameW(g_pCurrentFile->FileName, 0, NULL, NULL); LPWSTR pszPathName; SHELLEXECUTEINFOW sei; @@ -1040,7 +1041,7 @@ ImageView_Modify(HWND hwnd) return 1; } - GetFullPathNameW(currentFile->FileName, nChars, pszPathName, NULL); + GetFullPathNameW(g_pCurrentFile->FileName, nChars, pszPathName, NULL); sei.cbSize = sizeof(sei); sei.fMask = 0; @@ -1078,13 +1079,13 @@ ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) switch (LOWORD(wParam)) { case IDC_PREV_PIC: - currentFile = currentFile->Prev; - pLoadImageFromNode(currentFile, hwnd); + g_pCurrentFile = g_pCurrentFile->Prev; + pLoadImageFromNode(g_pCurrentFile, hwnd); break; case IDC_NEXT_PIC: - currentFile = currentFile->Next; - pLoadImageFromNode(currentFile, hwnd); + g_pCurrentFile = g_pCurrentFile->Next; + pLoadImageFromNode(g_pCurrentFile, hwnd); break; case IDC_BEST_FIT: @@ -1116,17 +1117,17 @@ ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) break; case IDC_ROT_CLOCKW: - if (image) + if (g_pImage) { - GdipImageRotateFlip(image, Rotate270FlipNone); + GdipImageRotateFlip(g_pImage, Rotate270FlipNone); ImageView_UpdateWindow(hwnd); } break; case IDC_ROT_COUNCW: - if (image) + if (g_pImage) { - GdipImageRotateFlip(image, Rotate90FlipNone); + GdipImageRotateFlip(g_pImage, Rotate90FlipNone); ImageView_UpdateWindow(hwnd); } break; @@ -1157,9 +1158,9 @@ ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) LPTOOLTIPTEXTW lpttt; lpttt = (LPTOOLTIPTEXTW)lParam; - lpttt->hinst = hInstance; + lpttt->hinst = g_hInstance; - lpttt->lpszText = MAKEINTRESOURCEW(BtnConfig[lpttt->hdr.idFrom - IDC_TOOL_BASE].ids); + lpttt->lpszText = MAKEINTRESOURCEW(s_ButtonConfig[lpttt->hdr.idFrom - IDC_TOOL_BASE].ids); return 0; } } @@ -1180,7 +1181,7 @@ ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) case WM_DESTROY: { ImageView_SaveSettings(hwnd); - SetWindowLongPtr(hDispWnd, GWLP_WNDPROC, (LPARAM) PrevProc); + SetWindowLongPtr(g_hDispWnd, GWLP_WNDPROC, (LPARAM)g_fnPrevProc); PostQuitMessage(0); break; } @@ -1225,35 +1226,35 @@ ImageView_CreateWindow(HWND hwnd, LPCWSTR szFileName) // Create the window WndClass.lpszClassName = WC_SHIMGVW; WndClass.lpfnWndProc = ImageView_WndProc; - WndClass.hInstance = hInstance; + WndClass.hInstance = g_hInstance; WndClass.style = CS_HREDRAW | CS_VREDRAW; - WndClass.hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_APP_ICON)); + WndClass.hIcon = LoadIconW(g_hInstance, MAKEINTRESOURCEW(IDI_APP_ICON)); WndClass.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); WndClass.hbrBackground = NULL; /* less flicker */ if (!RegisterClassW(&WndClass)) return -1; - LoadStringW(hInstance, IDS_APPTITLE, szBuf, _countof(szBuf)); + LoadStringW(g_hInstance, IDS_APPTITLE, szBuf, _countof(szBuf)); hMainWnd = CreateWindowExW(WS_EX_WINDOWEDGE, WC_SHIMGVW, szBuf, WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS, - shiSettings.X, shiSettings.Y, - shiSettings.Width, shiSettings.Height, - NULL, NULL, hInstance, NULL); - if (shiSettings.Maximized) + g_Settings.X, g_Settings.Y, + g_Settings.Width, g_Settings.Height, + NULL, NULL, g_hInstance, NULL); + if (g_Settings.Maximized) ShowWindow(hMainWnd, SW_MAXIMIZE); // make sure the path has no quotes on it StringCbCopyW(szInitialFile, sizeof(szInitialFile), szFileName); PathUnquoteSpacesW(szInitialFile); - currentFile = pBuildFileList(szInitialFile); - if (currentFile) + g_pCurrentFile = pBuildFileList(szInitialFile); + if (g_pCurrentFile) { - pLoadImageFromNode(currentFile, hMainWnd); + pLoadImageFromNode(g_pCurrentFile, hMainWnd); } /* Create accelerator table for keystrokes */ - hKbdAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDR_ACCELERATOR)); + hKbdAccel = LoadAcceleratorsW(g_hInstance, MAKEINTRESOURCEW(IDR_ACCELERATOR)); // Show it ShowWindow(hMainWnd, SW_SHOW); @@ -1275,12 +1276,12 @@ ImageView_CreateWindow(HWND hwnd, LPCWSTR szFileName) /* Destroy accelerator table */ DestroyAcceleratorTable(hKbdAccel); - pFreeFileList(currentFile); + pFreeFileList(g_pCurrentFile); - if (image) + if (g_pImage) { - GdipDisposeImage(image); - image = NULL; + GdipDisposeImage(g_pImage); + g_pImage = NULL; } Anime_FreeInfo(); @@ -1344,7 +1345,7 @@ DllMain(IN HINSTANCE hinstDLL, { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: - hInstance = hinstDLL; + g_hInstance = hinstDLL; break; }
1 year
1
0
0
0
[reactos] 01/01: [SHIMGVW] Implement ImageView_Delete (#6132)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e7f6b473e6b2fb28efac4…
commit e7f6b473e6b2fb28efac42ee9cabb21db9171a73 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Dec 8 15:30:55 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Dec 8 15:30:55 2023 +0900 [SHIMGVW] Implement ImageView_Delete (#6132) - Call SHFileOperation to delete. - Rebuild the file list and load the next file. CORE-19358 --- dll/win32/shimgvw/shimgvw.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index 800f60d20d5..613cb250023 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -989,8 +989,35 @@ ImageView_OnSize(HWND hwnd, UINT state, INT cx, INT cy) static LRESULT ImageView_Delete(HWND hwnd) { - DPRINT1("ImageView_Delete: unimplemented.\n"); - return 0; + WCHAR szCurFile[MAX_PATH + 1], szNextFile[MAX_PATH]; + SHFILEOPSTRUCT FileOp = { hwnd, FO_DELETE }; + + if (image) + { + GdipDisposeImage(image); + image = NULL; + } + + /* FileOp.pFrom must be double-null-terminated */ + GetFullPathNameW(currentFile->FileName, _countof(szCurFile) - 1, szCurFile, NULL); + szCurFile[_countof(szCurFile) - 2] = UNICODE_NULL; /* Avoid buffer overrun */ + szCurFile[lstrlenW(szCurFile) + 1] = UNICODE_NULL; + + GetFullPathNameW(currentFile->Next->FileName, _countof(szNextFile), szNextFile, NULL); + szNextFile[_countof(szNextFile) - 1] = UNICODE_NULL; /* Avoid buffer overrun */ + + FileOp.pFrom = szCurFile; + FileOp.fFlags = FOF_ALLOWUNDO; + if (SHFileOperation(&FileOp) != 0) + return 0; + + pFreeFileList(currentFile); + currentFile = NULL; + + currentFile = pBuildFileList(szNextFile); + pLoadImageFromNode(currentFile, hwnd); + + return 1; } static LRESULT
1 year
1
0
0
0
[reactos] 01/01: [SHIMGVW] Check VK_CONTROL on ImageView_OnMouseWheel
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0faa1561a65da174ce045…
commit 0faa1561a65da174ce04587a816a99a1e46d6089 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Dec 8 15:03:18 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Fri Dec 8 15:03:18 2023 +0900 [SHIMGVW] Check VK_CONTROL on ImageView_OnMouseWheel CORE-19358 --- dll/win32/shimgvw/shimgvw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index 0d9d3dc8342..800f60d20d5 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -962,7 +962,8 @@ ImageView_OnMouseWheel(HWND hwnd, INT x, INT y, INT zDelta, UINT fwKeys) { if (zDelta != 0) { - ZoomInOrOut(zDelta > 0); + if (GetKeyState(VK_CONTROL) < 0) + ZoomInOrOut(zDelta > 0); } }
1 year
1
0
0
0
[reactos] 01/01: [SHIMGVW] Improve window size handling
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=77ab709b61991c7e137d5…
commit 77ab709b61991c7e137d5ea0264a107dd3787208 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Dec 8 14:56:12 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Fri Dec 8 14:56:12 2023 +0900 [SHIMGVW] Improve window size handling CORE-19358 --- dll/win32/shimgvw/shimgvw.c | 41 +++++++++++++++++++---------------------- dll/win32/shimgvw/shimgvw.h | 8 ++++---- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index 6e04d71bcfc..0d9d3dc8342 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -829,6 +829,12 @@ ImageView_LoadSettings(VOID) DWORD dwSize; LONG nError; + shiSettings.Maximized = FALSE; + shiSettings.X = CW_USEDEFAULT; + shiSettings.Y = CW_USEDEFAULT; + shiSettings.Width = 520; + shiSettings.Height = 400; + nError = RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\shimgvw", 0, KEY_READ, &hKey); if (nError) return FALSE; @@ -845,16 +851,17 @@ ImageView_SaveSettings(HWND hwnd) { WINDOWPLACEMENT wp; HKEY hKey; + RECT *prc; - ShowWindow(hwnd, SW_HIDE); wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(hwnd, &wp); - shiSettings.Left = wp.rcNormalPosition.left; - shiSettings.Top = wp.rcNormalPosition.top; - shiSettings.Right = wp.rcNormalPosition.right; - shiSettings.Bottom = wp.rcNormalPosition.bottom; - shiSettings.Maximized = (IsZoomed(hwnd) || (wp.flags & WPF_RESTORETOMAXIMIZED)); + prc = &wp.rcNormalPosition; + shiSettings.X = prc->left; + shiSettings.Y = prc->top; + shiSettings.Width = prc->right - prc->left; + shiSettings.Height = prc->bottom - prc->top; + shiSettings.Maximized = IsZoomed(hwnd); if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\ReactOS\\shimgvw"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) @@ -940,12 +947,6 @@ ImageView_DispWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) static VOID ImageView_InitControls(HWND hwnd) { - MoveWindow(hwnd, shiSettings.Left, shiSettings.Top, - shiSettings.Right - shiSettings.Left, - shiSettings.Bottom - shiSettings.Top, TRUE); - - if (shiSettings.Maximized) ShowWindow(hwnd, SW_MAXIMIZE); - hDispWnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_STATIC, L"", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, NULL, hInstance, NULL); @@ -1182,14 +1183,7 @@ ImageView_CreateWindow(HWND hwnd, LPCWSTR szFileName) DPRINT1("Warning, CoInitializeEx failed with code=%08X\n", (int)hComRes); } - if (!ImageView_LoadSettings()) - { - shiSettings.Maximized = FALSE; - shiSettings.Left = 0; - shiSettings.Top = 0; - shiSettings.Right = 520; - shiSettings.Bottom = 400; - } + ImageView_LoadSettings(); // Initialize GDI+ gdiplusStartupInput.GdiplusVersion = 1; @@ -1214,8 +1208,11 @@ ImageView_CreateWindow(HWND hwnd, LPCWSTR szFileName) LoadStringW(hInstance, IDS_APPTITLE, szBuf, _countof(szBuf)); hMainWnd = CreateWindowExW(WS_EX_WINDOWEDGE, WC_SHIMGVW, szBuf, WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS, - CW_USEDEFAULT, CW_USEDEFAULT, - 0, 0, NULL, NULL, hInstance, NULL); + shiSettings.X, shiSettings.Y, + shiSettings.Width, shiSettings.Height, + NULL, NULL, hInstance, NULL); + if (shiSettings.Maximized) + ShowWindow(hMainWnd, SW_MAXIMIZE); // make sure the path has no quotes on it StringCbCopyW(szInitialFile, sizeof(szInitialFile), szFileName); diff --git a/dll/win32/shimgvw/shimgvw.h b/dll/win32/shimgvw/shimgvw.h index 4f89213a445..76aa255856f 100644 --- a/dll/win32/shimgvw/shimgvw.h +++ b/dll/win32/shimgvw/shimgvw.h @@ -8,10 +8,10 @@ extern HINSTANCE hInstance; typedef struct { BOOL Maximized; - INT Left; - INT Top; - INT Right; - INT Bottom; + INT X; + INT Y; + INT Width; + INT Height; } SHIMGVW_SETTINGS; typedef struct SHIMGVW_FILENODE_INTERNAL
1 year
1
0
0
0
[reactos] 01/01: [SHIMGVW] Use WM_GETMINMAXINFO instead of WM_SIZING
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a500b513b0d0c8ed5f8b6…
commit a500b513b0d0c8ed5f8b62e18c85259f6a6ecff9 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Dec 8 14:30:35 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Fri Dec 8 14:30:35 2023 +0900 [SHIMGVW] Use WM_GETMINMAXINFO instead of WM_SIZING to limit window size. CORE-19358 --- dll/win32/shimgvw/shimgvw.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index 9cbea84cec3..6e04d71bcfc 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -1136,15 +1136,12 @@ ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) } break; } - case WM_SIZING: + case WM_GETMINMAXINFO: { - LPRECT pRect = (LPRECT)lParam; - if (pRect->right-pRect->left < 350) - pRect->right = pRect->left + 350; - - if (pRect->bottom-pRect->top < 290) - pRect->bottom = pRect->top + 290; - return TRUE; + MINMAXINFO *pMMI = (MINMAXINFO*)lParam; + pMMI->ptMinTrackSize.x = 350; + pMMI->ptMinTrackSize.y = 290; + return 0; } case WM_SIZE: {
1 year
1
0
0
0
[reactos] 01/01: [SHIMGVW] Add VK_OEM_PLUS and VK_OEM_MINUS to IDR_ACCELERATOR
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d178e6bb418f9666b0abf…
commit d178e6bb418f9666b0abfaa0a5387ee92dd83217 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Dec 8 14:22:56 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Fri Dec 8 14:22:56 2023 +0900 [SHIMGVW] Add VK_OEM_PLUS and VK_OEM_MINUS to IDR_ACCELERATOR Improve keyboard usability. CORE-19358 --- dll/win32/shimgvw/shimgvw.rc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dll/win32/shimgvw/shimgvw.rc b/dll/win32/shimgvw/shimgvw.rc index ea1fa645a60..b7b0b093da1 100644 --- a/dll/win32/shimgvw/shimgvw.rc +++ b/dll/win32/shimgvw/shimgvw.rc @@ -41,6 +41,8 @@ BEGIN VK_F11, IDC_SLIDE_SHOW, VIRTKEY VK_ADD, IDC_ZOOM_IN, VIRTKEY VK_SUBTRACT, IDC_ZOOM_OUT, VIRTKEY + VK_OEM_PLUS, IDC_ZOOM_IN, VIRTKEY, SHIFT + VK_OEM_MINUS,IDC_ZOOM_OUT, VIRTKEY "K", IDC_ROT_CLOCKW, VIRTKEY, CONTROL "L", IDC_ROT_COUNCW, VIRTKEY, CONTROL VK_DELETE, IDC_DELETE, VIRTKEY
1 year
1
0
0
0
[reactos] 01/01: [SHIMGVW] Implement IDC_BEST_FIT
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0f519a783cd77ab96ae33…
commit 0f519a783cd77ab96ae33df2a02c3eb204f1571d Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Dec 8 11:44:03 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Fri Dec 8 11:44:03 2023 +0900 [SHIMGVW] Implement IDC_BEST_FIT - Add two parameters to UpdateZoom. - Enable/disable IDC_BEST_FIT and IDC_REAL_SIZE buttons in UpdateZoom. - Call ResetZoom on IDC_BEST_FIT. CORE-19358 --- dll/win32/shimgvw/shimgvw.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index 0a84f3e5208..9cbea84cec3 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -242,7 +242,7 @@ BOOL Anime_Step(DWORD *pdwDelay) return FALSE; } -static void UpdateZoom(UINT NewZoom) +static void UpdateZoom(UINT NewZoom, BOOL bEnableBestFit, BOOL bEnableRealSize) { BOOL bEnableZoomIn, bEnableZoomOut; @@ -270,6 +270,10 @@ static void UpdateZoom(UINT NewZoom) /* Redraw the display window */ InvalidateRect(hDispWnd, NULL, FALSE); + + /* Update toolbar buttons */ + SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_BEST_FIT, bEnableBestFit); + SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_REAL_SIZE, bEnableRealSize); } static void ZoomInOrOut(BOOL bZoomIn) @@ -308,7 +312,7 @@ static void ZoomInOrOut(BOOL bZoomIn) } /* Update toolbar and refresh screen */ - UpdateZoom(NewZoom); + UpdateZoom(NewZoom, TRUE, TRUE); } static void ResetZoom(void) @@ -353,7 +357,7 @@ static void ResetZoom(void) } } - UpdateZoom(NewZoom); + UpdateZoom(NewZoom, FALSE, TRUE); } static void pLoadImage(LPCWSTR szOpenFileName) @@ -1055,11 +1059,11 @@ ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) break; case IDC_BEST_FIT: - DPRINT1("IDC_BEST_FIT unimplemented\n"); + ResetZoom(); break; case IDC_REAL_SIZE: - UpdateZoom(100); + UpdateZoom(100, TRUE, FALSE); return 0; case IDC_SLIDE_SHOW:
1 year
1
0
0
0
[reactos] 01/01: [SHIMGVW] Main window class must be "ShImgVw:CPreviewWnd"
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=02312c7bf1f0af1bbb4da…
commit 02312c7bf1f0af1bbb4da9d0098d6c3c995977a0 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Dec 8 11:01:00 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Fri Dec 8 11:01:00 2023 +0900 [SHIMGVW] Main window class must be "ShImgVw:CPreviewWnd" and window style is (WS_VISIBLE | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW). CORE-19358 --- dll/win32/shimgvw/shimgvw.c | 8 ++++---- dll/win32/shimgvw/shimgvw.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index cb167561af2..0a84f3e5208 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -1200,19 +1200,19 @@ ImageView_CreateWindow(HWND hwnd, LPCWSTR szFileName) pLoadImage(szFileName); // Create the window - WndClass.lpszClassName = L"shimgvw_window"; + WndClass.lpszClassName = WC_SHIMGVW; WndClass.lpfnWndProc = ImageView_WndProc; WndClass.hInstance = hInstance; WndClass.style = CS_HREDRAW | CS_VREDRAW; WndClass.hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_APP_ICON)); - WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); + WndClass.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); WndClass.hbrBackground = NULL; /* less flicker */ if (!RegisterClassW(&WndClass)) return -1; LoadStringW(hInstance, IDS_APPTITLE, szBuf, _countof(szBuf)); - hMainWnd = CreateWindowExW(0, L"shimgvw_window", szBuf, - WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CAPTION, + hMainWnd = CreateWindowExW(WS_EX_WINDOWEDGE, WC_SHIMGVW, szBuf, + WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, hInstance, NULL); diff --git a/dll/win32/shimgvw/shimgvw.h b/dll/win32/shimgvw/shimgvw.h index 9bce39c6cbf..4f89213a445 100644 --- a/dll/win32/shimgvw/shimgvw.h +++ b/dll/win32/shimgvw/shimgvw.h @@ -20,3 +20,5 @@ typedef struct SHIMGVW_FILENODE_INTERNAL struct SHIMGVW_FILENODE_INTERNAL *Prev; struct SHIMGVW_FILENODE_INTERNAL *Next; } SHIMGVW_FILENODE; + +#define WC_SHIMGVW L"ShImgVw:CPreviewWnd"
1 year
1
0
0
0
[reactos] 01/01: [REGEDIT][REG] Limit registry type to 8 hex digits when importing (#6063)
by Whindmar Saksit
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e4d03f471b4b4ccac2a6c…
commit e4d03f471b4b4ccac2a6c952ae6eb89550dbbd7a Author: Whindmar Saksit <whindsaks(a)proton.me> AuthorDate: Mon Dec 4 16:46:06 2023 +0100 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Dec 4 16:46:06 2023 +0100 [REGEDIT][REG] Limit registry type to 8 hex digits when importing (#6063) Matches Windows and lets the Wine13i test in regedit_winetest pass. --- base/applications/cmdutils/reg/import.c | 5 +++++ base/applications/regedit/regproc.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/base/applications/cmdutils/reg/import.c b/base/applications/cmdutils/reg/import.c index 1d4e3d53536..91442cf06b3 100644 --- a/base/applications/cmdutils/reg/import.c +++ b/base/applications/cmdutils/reg/import.c @@ -276,7 +276,12 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line) /* "hex(xx):" is special */ val = wcstoul(*line, &end, 16); +#ifdef __REACTOS__ + /* Up to 8 hex digits, "hex(000000002)" is invalid */ + if (*end != ')' || *(end + 1) != ':' || (val == ~0u && errno == ERANGE) || end - *line > 8) +#else if (*end != ')' || *(end + 1) != ':' || (val == ~0u && errno == ERANGE)) +#endif return FALSE; parser->data_type = val; diff --git a/base/applications/regedit/regproc.c b/base/applications/regedit/regproc.c index 1ef1fc9e6c2..f8d448e08c8 100644 --- a/base/applications/regedit/regproc.c +++ b/base/applications/regedit/regproc.c @@ -339,7 +339,12 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line) /* "hex(xx):" is special */ val = wcstoul(*line, &end, 16); +#ifdef __REACTOS__ + /* Up to 8 hex digits, "hex(000000002)" is invalid */ + if (*end != ')' || *(end + 1) != ':' || (val == ~0u && errno == ERANGE) || end - *line > 8) +#else if (*end != ')' || *(end + 1) != ':' || (val == ~0u && errno == ERANGE)) +#endif return FALSE; parser->data_type = val;
1 year
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
28
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Results per page:
10
25
50
100
200