diff --git a/SKIV.vcxproj b/SKIV.vcxproj index 8dabfa0..5ef5e5e 100644 --- a/SKIV.vcxproj +++ b/SKIV.vcxproj @@ -23,7 +23,7 @@ {93301458-CC3B-4924-B659-EB190D6EF9EB} Win32Proj SKIV - 10.0.22621.0 + 10.0 diff --git a/include/tabs/viewer.h b/include/tabs/viewer.h index 1bcd755..140ddd0 100644 --- a/include/tabs/viewer.h +++ b/include/tabs/viewer.h @@ -64,4 +64,4 @@ enum ImageScaling { }; uint32_t SKIV_Viewer_CycleVisualizationModes (void); -ImageScaling SKIV_Viewer_CycleScalingModes (void); \ No newline at end of file +ImageScaling SKIV_Viewer_CycleScalingModes (void); diff --git a/include/utility/fsutil.h b/include/utility/fsutil.h index 2c2b86a..2c3d963 100644 --- a/include/utility/fsutil.h +++ b/include/utility/fsutil.h @@ -96,7 +96,7 @@ struct SKIF_CommonPathsCache { wchar_t skiv_install [MAX_PATH + 2] = { }; // Holds the install folder for SKIV wchar_t skiv_userdata [MAX_PATH + 2] = { }; // Holds the user data folder for SKIV wchar_t specialk_userdata [MAX_PATH + 2] = { }; // Holds the user data folder for SK (often lines up with its install folder) - wchar_t skiv_temp [MAX_PATH + 2] = { }; // Holds the temp data folder for SKIV (images downloaded from the web; cleared out on every launch): %APPDATA%\TEMP\SKIV + wchar_t skiv_temp [MAX_PATH + 2] = { }; // Holds the temp data folder for SKIV (images downloaded from the web; cleared out on every launch): "%APPDATA%\TEMP\SKIV\" wchar_t skiv_screenshots [MAX_PATH + 2] = { }; // Holds the screenshot folder for SKIV char skiv_screenshotsA [MAX_PATH + 2] = { }; // UTF-8 diff --git a/include/utility/image.h b/include/utility/image.h index 06f5c98..cebeece 100644 --- a/include/utility/image.h +++ b/include/utility/image.h @@ -4,6 +4,7 @@ #include #include #include +#include "utility.h" #pragma warning( push ) #pragma warning( disable : 4305 ) @@ -134,14 +135,30 @@ static const ParamsPQ PQ = #pragma warning( pop ) -struct SKIV_Region { - ImRect _rect; - std::wstring _title; - - SKIV_Region (ImRect r_ = ImRect(), std::wstring t_ = L"") +struct SKIV_CaptureData { + ImRect _rect; + struct Application { + std::wstring custom; // #1 - SK/SKIF profiles name + std::wstring product; // #2 - Product name from executable + std::wstring executable; // #3 - Executable filename + std::wstring window; // -optional- + } _names; + CaptureMode _mode; + bool _select = false; + HWND _hwnd = NULL; + + SKIV_CaptureData (ImRect r_, Application n_, CaptureMode m_) { _rect = r_; - _title = t_; + _names = n_; + _mode = m_; + } + + SKIV_CaptureData (ImRect r_, std::wstring t_, CaptureMode m_) + { + _rect = r_; + _mode = m_; + _names.custom = t_; } }; @@ -152,11 +169,11 @@ float SKIV_Image_LinearToPQY (float N); DirectX::XMVECTOR SKIV_Image_Rec709toICtCp (DirectX::XMVECTOR N); DirectX::XMVECTOR SKIV_Image_ICtCptoRec709 (DirectX::XMVECTOR N); -bool SKIV_Image_CopyToClipboard (const DirectX::Image* pImage, bool isHDR, bool isTemp, const wchar_t* wszFileName); +bool SKIV_Image_CopyToClipboard (const DirectX::Image* pImage, bool isHDR, SKIV_CaptureData capture_data); HRESULT SKIV_Image_SaveToDisk_HDR (const DirectX::Image& image, const wchar_t* wszFileName); HRESULT SKIV_Image_SaveToDisk_SDR (const DirectX::Image& image, const wchar_t* wszFileName, bool force_sRGB); HRESULT SKIV_Image_CaptureDesktop (DirectX::ScratchImage& image, POINT pos, int flags = 0x0); -void SKIV_Image_CaptureRegion (SKIV_Region capture_area); +void SKIV_Image_CaptureRegion (SKIV_CaptureData capture_data); HRESULT SKIV_Image_TonemapToSDR (const DirectX::Image& image, DirectX::ScratchImage& final_sdr, float mastering_max_nits, float mastering_sdr_nits); bool SKIV_Image_IsUltraHDR (const wchar_t* wszFileName); @@ -277,4 +294,135 @@ struct skiv_image_desktop_s { _max_display_nits = 1000.0f; _rotation = DXGI_MODE_ROTATION_UNSPECIFIED; } +}; + +// Image Directory + +#include + +struct skiv_image_directory_s { + + class FileSystemBindData : public IFileSystemBindData + { + public: + FileSystemBindData() : _ref(1) + { + ZeroMemory(&_fd, sizeof(_fd)); + } + + // IUnknown + IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) override + { + if (riid == IID_IUnknown || riid == IID_IFileSystemBindData) + { + *ppv = static_cast(this); + AddRef(); + return S_OK; + } + *ppv = nullptr; + return E_NOINTERFACE; + } + + IFACEMETHODIMP_(ULONG) AddRef() override + { + return InterlockedIncrement(&_ref); + } + + IFACEMETHODIMP_(ULONG) Release() override + { + ULONG r = InterlockedDecrement(&_ref); + if (r == 0) delete this; + return r; + } + + // IFileSystemBindData + IFACEMETHODIMP SetFindData (const WIN32_FIND_DATAW* pfd) override + { + _fd = *pfd; + return S_OK; + } + + IFACEMETHODIMP GetFindData (WIN32_FIND_DATAW* pfd) override + { + *pfd = _fd; + return S_OK; + } + + private: + ~FileSystemBindData() = default; + + LONG _ref; + WIN32_FIND_DATAW _fd; + }; + + struct fd_s { + std::wstring filename; // Image filename + //std::wstring folder_path; // Parent folder path + std::wstring path; // Image path (full) + WIN32_FIND_DATA ffd; + }; + + struct fl_s { + fd_s* getActiveFile (void) + { + return (_ptr != nullptr) ? _ptr : nullptr; + } + + std::vector getList (void) + { + return _list; + } + + void setList (std::vector list) + { + _list = std::move(list); + _it = _list.end(); + _ptr = _it._Ptr; + } + + void clear (void) + { + _list.clear(); + _it = _list.end(); + _ptr = nullptr; + } + + bool empty (void) + { + return _list.empty(); + } + + void setImage (const std::wstring& path); + std::wstring nextImage (void); + std::wstring prevImage (void); + std::wstring deleteImage (void); + void updateFileIterator (const std::wstring& path); // Find the position of the image in the current folder + + bool fileDeleted = false; + + private: + std::vector _list; + std::vector::iterator _it; + fd_s* _ptr; + } fileList; + +//std::wstring orig_path; // Holds a cached copy of cover.path +//std::wstring filename; // Image filename + std::wstring folder_path; // Parent folder path + SKIF_DirectoryWatch watch; + + + std::vector sortColumns; // File Explorer + + void reset (void); + + // Retrieve all files in the folder, and identify our current place among them... + int workerThread (bool runThread); // 0 = Not done, 1 = No change in sort order (i.e. same files as before) , 2 = Change in the sort order (i.e. new files/folder) + + // Win32 File Explorer based sorting +private: + static bool updateFolderData (std::vector& list, std::vector& sortColumns, const std::wstring& path); + static void updateSortOrder (std::vector& list, std::vector& sortColumns, const std::wstring& path); + static void sortByColumns (std::vector& list, const std::vector& sortColumns); + static void sortByFilename (std::vector& list); }; \ No newline at end of file diff --git a/include/utility/registry.h b/include/utility/registry.h index 00b3d7f..be405cb 100644 --- a/include/utility/registry.h +++ b/include/utility/registry.h @@ -4,7 +4,7 @@ #include #include #include -#include "sk_utility.h" +#include "utility.h" #ifndef RRF_SUBKEY_WOW6464KEY #define RRF_SUBKEY_WOW6464KEY 0x00010000 @@ -265,10 +265,6 @@ struct SKIF_RegistrySettings { SKIF_MakeRegKeyB ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", LR"(99th Percentile MaxCLL)" ); - KeyValue regKVSaveScreenshots = - SKIF_MakeRegKeyB ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", - LR"(Save Screenshots)" ); - // Integers (DWORDs) KeyValue regKVImageScaling = @@ -311,6 +307,22 @@ struct SKIF_RegistrySettings { SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", LR"(UI Mode)" ); + KeyValue regKVUIWidth = + SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", + LR"(UI Width)" ); + + KeyValue regKVUIHeight = + SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", + LR"(UI Height)" ); + + KeyValue regKVUIPositionX = + SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", + LR"(UI Position X)" ); + + KeyValue regKVUIPositionY = + SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", + LR"(UI Position Y)" ); + KeyValue regKVDiagnostics = SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", LR"(Diagnostics)" ); @@ -347,6 +359,14 @@ struct SKIF_RegistrySettings { SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\PNG\)", LR"(HDR BitDepth)" ); + KeyValue regKVScreenshotsAutosave = + SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", + LR"(Screenshots Autosave)" ); + + KeyValue regKVScreenshotsHotkeys = + SKIF_MakeRegKeyI ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", + LR"(Screenshots Hotkeys)" ); + // Wide Strings KeyValue regKVIgnoreUpdate = @@ -365,6 +385,10 @@ struct SKIF_RegistrySettings { SKIF_MakeRegKeyWS ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", LR"(Screenshots)" ); + KeyValue regKVScreenshotsPattern = + SKIF_MakeRegKeyWS ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", + LR"(Screenshots Pattern)" ); + KeyValue regKVAutoUpdateVersion = SKIF_MakeRegKeyWS ( LR"(SOFTWARE\Kaldaien\Special K\Viewer\)", LR"(Auto-Update Version)" ); @@ -419,18 +443,24 @@ struct SKIF_RegistrySettings { LR"(AppsUseLightTheme)" ); // Default settings (multiple options) -//int iImageScaling = 2; // 0 = None, 1 = Fill, 2 = Fit (default), 3 = Stretch - int iStyle = 0; // 0 = Dynamic, 1 = SKIF Dark, 2 = SKIF Light, 3 = ImGui Classic, 4 = ImGui Dark - int iStyleTemp = 0; // Used to temporary hold changes in the style during the current session - int iDarkenImages = 0; // 0 = Never, 1 = Always, 2 = On mouse hover - int iCheckForUpdates = 1; // 0 = Never, 1 = Weekly, 2 = On each launch - int iLogging = 4; // 0 = None, 1 = Fatal, 2 = Error, 3 = Warning, 4 = Info, 5 = Debug, 6 = Verbose - int iSDRMode = 0; // 0 = 8 bpc, 1 = 10 bpc, 2 = 16 bpc - int iHDRMode = 2; // 0 = Disabled, 1 = HDR10 (10 bpc), 2 = scRGB (16 bpc) +//int iImageScaling = 2; // 0 = None, 1 = Fill, 2 = Fit (default), 3 = Stretch + int iStyle = 0; // 0 = Dynamic, 1 = SKIF Dark, 2 = SKIF Light, 3 = ImGui Classic, 4 = ImGui Dark + int iStyleTemp = 0; // Used to temporary hold changes in the style during the current session + int iDarkenImages = 0; // 0 = Never, 1 = Always, 2 = On mouse hover + int iCheckForUpdates = 1; // 0 = Never, 1 = Weekly, 2 = On each launch + int iLogging = 4; // 0 = None, 1 = Fatal, 2 = Error, 3 = Warning, 4 = Info, 5 = Debug, 6 = Verbose + int iSDRMode = 0; // 0 = 8 bpc, 1 = 10 bpc, 2 = 16 bpc + int iHDRMode = 2; // 0 = Disabled, 1 = HDR10 (10 bpc), 2 = scRGB (16 bpc) int iHDRBrightness = 203; // HDR reference white for BT.2408 - int iHDRToneMapType = 8; // 0 = Do Nothing, 1 = Clip Luminance, 8 = Map to Display - int iUIMode = 1; // 0 = Safe Mode (BitBlt), 1 = Normal, 2 = VRR Compatibility - int iDiagnostics = 1; // 0 = None, 1 = Normal, 2 = Enhanced (not actually used yet) + int iHDRToneMapType = 8; // 0 = Do Nothing, 1 = Clip Luminance, 8 = Map to Display + int iUIMode = 1; // 0 = Safe Mode (BitBlt), 1 = Normal, 2 = VRR Compatibility + int iDiagnostics = 1; // 0 = None, 1 = Normal, 2 = Enhanced (not actually used yet) + int iUIWidth = 0; // 0 = None (default) + int iUIHeight = 0; // 0 = None (default) + int iUIPositionX = -1; // -1 = None (default) + int iUIPositionY = -1; // -1 = None (default) + CaptureMode eScreenshotsAutosave = CaptureMode_ALL, // Default to saving all types of screen captures + eScreenshotsHotkeys = CaptureMode_ALL; // Default to enabling all hotkeys // Default settings (booleans) bool bAdjustWindow = false; // Adjust window size based on the image size? @@ -459,14 +489,14 @@ struct SKIF_RegistrySettings { bool bFadeCovers = true; bool bControllers = true; // Should SKIF support controller input ? bool bLoggingDeveloper = false; // This is a log level "above" verbose logging that also includes stuff like window messages. Only useable for SKIF developers - bool bSaveScreenshots = true; // Wide strings std::wstring wsUpdateChannel = L"Website"; // Default to stable channel std::wstring wsIgnoreUpdate; std::wstring wsPathViewer; - std::wstring wsPathScreenshots; std::wstring wsPathSpecialK; + std::wstring wsPathScreenshots; + std::wstring wsScreenshotsPattern = L"__