From 54253bc2f4e91bbb09e948c9305e93c82df67a14 Mon Sep 17 00:00:00 2001 From: Steven Hoving Date: Sat, 2 Jun 2018 15:33:50 +0200 Subject: [PATCH] #5 redesign video config settings dialog. --- CamCapture/include/CamCapture/cam_rect.h | 2 + CamHook/stdafx.h | 6 +- CamLib/targetver.h | 6 +- CamStudioPlayerPlus/targetver.h | 6 +- CamStudioRecorder/AudioFormatDlg.cpp | 4 +- CamStudioRecorder/AutopanSpeedDlg.cpp | 8 + CamStudioRecorder/AutopanSpeedDlg.h | 2 + CamStudioRecorder/CMakeLists.txt | 30 +- CamStudioRecorder/EditTransparencyDlg.cpp | 8 + CamStudioRecorder/EditTransparencyDlg.h | 2 + CamStudioRecorder/ListManager.cpp | 20 +- CamStudioRecorder/MainFrm.cpp | 4 +- CamStudioRecorder/MouseCaptureWnd.cpp | 2 +- CamStudioRecorder/MouseCaptureWnd.h | 2 +- CamStudioRecorder/Recorder.cpp | 2 +- CamStudioRecorder/Recorder.rc | 159 +++++++-- CamStudioRecorder/RecorderView.cpp | 303 +++++++++-------- CamStudioRecorder/RecorderView.h | 15 +- CamStudioRecorder/ScreenAnnotationsDlg.cpp | 2 +- CamStudioRecorder/StdAfx.h | 46 ++- CamStudioRecorder/VideoOptionsDlg.cpp | 64 ++-- CamStudioRecorder/VideoOptionsDlg.h | 27 +- CamStudioRecorder/addons/ImageAttributes.h | 2 +- CamStudioRecorder/addons/TextAttributes.h | 2 +- CamStudioRecorder/capture_thread.cpp | 2 + CamStudioRecorder/resource.h | 26 +- CamStudioRecorder/targetver.h | 31 +- CamStudioRecorder/utility/make_array.h | 57 ++++ CamStudioRecorder/video_settings_ui.cpp | 251 ++++++++++++++ CamStudioRecorder/video_settings_ui.h | 359 +++++++++++++++++++++ 30 files changed, 1150 insertions(+), 300 deletions(-) create mode 100644 CamStudioRecorder/utility/make_array.h create mode 100644 CamStudioRecorder/video_settings_ui.cpp create mode 100644 CamStudioRecorder/video_settings_ui.h diff --git a/CamCapture/include/CamCapture/cam_rect.h b/CamCapture/include/CamCapture/cam_rect.h index 6b9ec232..1da18d5e 100644 --- a/CamCapture/include/CamCapture/cam_rect.h +++ b/CamCapture/include/CamCapture/cam_rect.h @@ -19,6 +19,8 @@ #include "cam_size.h" #include "cam_point.h" +#include +#include template class rect diff --git a/CamHook/stdafx.h b/CamHook/stdafx.h index cf21783e..5f90ce19 100644 --- a/CamHook/stdafx.h +++ b/CamHook/stdafx.h @@ -11,11 +11,11 @@ // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER // Specifies that the minimum required platform is Windows Vista. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#define WINVER 0x0601 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#define _WIN32_WINNT 0x0601 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. @@ -23,7 +23,7 @@ #endif #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. #endif #include // MFC core and standard components diff --git a/CamLib/targetver.h b/CamLib/targetver.h index ee2e02e1..2e7fc862 100644 --- a/CamLib/targetver.h +++ b/CamLib/targetver.h @@ -8,11 +8,11 @@ // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER // Specifies that the minimum required platform is Windows Vista. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#define WINVER 0x0601 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#define _WIN32_WINNT 0x0601 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. @@ -20,5 +20,5 @@ #endif #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. #endif diff --git a/CamStudioPlayerPlus/targetver.h b/CamStudioPlayerPlus/targetver.h index c0575f60..1a834f84 100644 --- a/CamStudioPlayerPlus/targetver.h +++ b/CamStudioPlayerPlus/targetver.h @@ -8,11 +8,11 @@ // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER // Specifies that the minimum required platform is Windows Vista. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#define WINVER 0x0601 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#define _WIN32_WINNT 0x0601 // Change this to the appropriate value to target other versions of Windows. #endif #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. @@ -20,5 +20,5 @@ #endif #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. #endif diff --git a/CamStudioRecorder/AudioFormatDlg.cpp b/CamStudioRecorder/AudioFormatDlg.cpp index f0ccb855..7f474523 100644 --- a/CamStudioRecorder/AudioFormatDlg.cpp +++ b/CamStudioRecorder/AudioFormatDlg.cpp @@ -220,7 +220,9 @@ BOOL CAudioFormatDlg::GetFormatDescription(CString &rstrFormatTag, CString &rstr strChannels.Format(_T("%s"), (1 == m_pwfx->nChannels) ? _T("Mono") : _T("Stereo")); CString formatstr; - formatstr = strSamplesPerSecond + ", "; + formatstr.Append(strSamplesPerSecond); + formatstr.Append(CString(", ")); + if (0 < m_pwfx->wBitsPerSample) formatstr = formatstr + strBitsPerSample + ", "; formatstr = formatstr + strChannels + " " + strAvgBytesPerSecond; diff --git a/CamStudioRecorder/AutopanSpeedDlg.cpp b/CamStudioRecorder/AutopanSpeedDlg.cpp index 3a73644c..fe6def8f 100644 --- a/CamStudioRecorder/AutopanSpeedDlg.cpp +++ b/CamStudioRecorder/AutopanSpeedDlg.cpp @@ -38,6 +38,7 @@ BEGIN_MESSAGE_MAP(CAutopanSpeedDlg, CDialog) //{{AFX_MSG_MAP(CAutopanSpeedDlg) ON_WM_HSCROLL() //}}AFX_MSG_MAP +ON_BN_CLICKED(IDOK, &CAutopanSpeedDlg::OnBnClickedOk) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -84,3 +85,10 @@ void CAutopanSpeedDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar CDialog::OnHScroll(nSBCode, nPos, pScrollBar); } + + +void CAutopanSpeedDlg::OnBnClickedOk() +{ + // TODO: Add your control notification handler code here + CDialog::OnOK(); +} diff --git a/CamStudioRecorder/AutopanSpeedDlg.h b/CamStudioRecorder/AutopanSpeedDlg.h index 28d3e4cf..b9a87f76 100644 --- a/CamStudioRecorder/AutopanSpeedDlg.h +++ b/CamStudioRecorder/AutopanSpeedDlg.h @@ -33,6 +33,8 @@ class CAutopanSpeedDlg : public CDialog private: CSliderCtrl m_ctrlSliderPanSpeed; CStatic m_ctrlStaticMaxSpeed; +public: + afx_msg void OnBnClickedOk(); }; //{{AFX_INSERT_LOCATION}} diff --git a/CamStudioRecorder/CMakeLists.txt b/CamStudioRecorder/CMakeLists.txt index 507fed3a..ef956d0a 100644 --- a/CamStudioRecorder/CMakeLists.txt +++ b/CamStudioRecorder/CMakeLists.txt @@ -15,7 +15,18 @@ project(CamStudioRecorder) +set(RECORDER_NEW_SOURCE + # new + video_settings_ui.h + video_settings_ui.cpp + string_convert.h + capture_thread.h + capture_thread.cpp + utility/make_array.h +) + set(RECORDER_SOURCE + # legacy AudioFormatDlg.cpp AudioFormatDlg.h AudioMixer.cpp @@ -102,13 +113,8 @@ set(RECORDER_SOURCE RecorderVersionReleaseInfo.h RecorderView.h ResizeDlg.h - resource.h - targetver.h TransparentWnd.h VideoWnd.h - string_convert.h - capture_thread.h - capture_thread.cpp ) set(RECORDER_VFW_SOURCE @@ -131,11 +137,14 @@ set(RECORDER_ADDONS_SOURCE set(RECORDER_RESOURCE Recorder.rc + resource.h + targetver.h ) set(CMAKE_MFC_FLAG 2) add_executable(CamStudioRecorder WIN32 + ${RECORDER_NEW_SOURCE} ${RECORDER_SOURCE} ${RECORDER_RESOURCE} ${RECORDER_VFW_SOURCE} @@ -151,10 +160,17 @@ source_group(addons FILES ) source_group(src FILES - ${RECORDER_SOURCE} + ${RECORDER_NEW_SOURCE} +) + +source_group(resource FILES ${RECORDER_RESOURCE} ) +source_group(src\\legacy FILES + ${RECORDER_SOURCE} +) + target_include_directories(CamStudioRecorder PUBLIC . @@ -168,7 +184,7 @@ target_compile_definitions(CamStudioRecorder -D_AFXDLL=1 -D_UNICODE -DUNICODE - # silence codecvt deprication warning for now + # silence codecvt deprecation warning for now -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING ) diff --git a/CamStudioRecorder/EditTransparencyDlg.cpp b/CamStudioRecorder/EditTransparencyDlg.cpp index 8ef568ec..023765c1 100644 --- a/CamStudioRecorder/EditTransparencyDlg.cpp +++ b/CamStudioRecorder/EditTransparencyDlg.cpp @@ -59,6 +59,7 @@ BEGIN_MESSAGE_MAP(CEditTransparencyDlg, CDialog) ON_BN_CLICKED(IDC_CHECK1, OnCheck1) ON_WM_HSCROLL() //}}AFX_MSG_MAP +ON_BN_CLICKED(IDOK, &CEditTransparencyDlg::OnBnClickedOk) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -115,3 +116,10 @@ void CEditTransparencyDlg::OnCancel() CDialog::OnCancel(); } + + +void CEditTransparencyDlg::OnBnClickedOk() +{ + // TODO: Add your control notification handler code here + CDialog::OnOK(); +} diff --git a/CamStudioRecorder/EditTransparencyDlg.h b/CamStudioRecorder/EditTransparencyDlg.h index 2050ef62..cc9a988c 100644 --- a/CamStudioRecorder/EditTransparencyDlg.h +++ b/CamStudioRecorder/EditTransparencyDlg.h @@ -47,6 +47,8 @@ class CEditTransparencyDlg : public CDialog CStatic m_ctrlStaticTransparency; protected: +public: + afx_msg void OnBnClickedOk(); }; //{{AFX_INSERT_LOCATION}} diff --git a/CamStudioRecorder/ListManager.cpp b/CamStudioRecorder/ListManager.cpp index 33f31997..15420c7b 100644 --- a/CamStudioRecorder/ListManager.cpp +++ b/CamStudioRecorder/ListManager.cpp @@ -206,7 +206,7 @@ int CListManager::RemoveDisplayArray(CTransparentWnd *removeWnd, int wantDestroy { int found = 0; - int max = displayArray.GetSize(); + int max = (int)displayArray.GetSize(); CTransparentWnd *itemWnd = nullptr; for (int i = 0; i < max; i++) { @@ -259,7 +259,7 @@ int CListManager::RemoveLayoutArray(CLayoutList *pLayout, int wantDestroyLayout) { int found = 0; - int max = layoutArray.GetSize(); + int max = (int)layoutArray.GetSize(); CLayoutList *itemLayout = nullptr; for (int i = max - 1; i >= 0; i--) { @@ -298,7 +298,7 @@ int CListManager::DestroyLayout(CLayoutList *pLayout) int CListManager::DestroyArrayItems(CArray *removeArray) { - int max = removeArray->GetSize(); + int max = (int)removeArray->GetSize(); CTransparentWnd *itemWnd = nullptr; for (int i = max - 1; 0 <= i; i--) { @@ -329,7 +329,7 @@ CArray *CListManager::CloneDisplayArray() // TODO, Possible memory leak, where is the delete operation of the new below done? CArray *cloneArray = new CArray; - int max = displayArray.GetSize(); + int max = (int)displayArray.GetSize(); CTransparentWnd *itemWnd = nullptr; for (int i = 0; i < max; i++) { @@ -361,7 +361,7 @@ int CListManager::FreeDisplayArray() int CListManager::FreeLayoutArray() { // Free Multiple Lists - int max = layoutArray.GetSize(); + int max = (int)layoutArray.GetSize(); for (int i = max - 1; i >= 0; i--) { CLayoutList *pLayout = layoutArray[i]; @@ -380,7 +380,7 @@ CArray *CListManager::CloneLayoutArrayPtr( // TODO, Possible memory leak, where is the delete operation of the new below done? CArray *cloneArray = new CArray; - int max = layoutArrayPtr->GetSize(); + int max = (int)layoutArrayPtr->GetSize(); for (int i = 0; i < max; i++) { CTransparentWnd *itemWnd = (*layoutArrayPtr)[i]; @@ -425,7 +425,7 @@ int CListManager::SwapShapeArray(long uniqueID1, long uniqueID2) int swapItem1 = -1; int swapItem2 = -1; - int max = shapeArray.GetSize(); + int max = (int)shapeArray.GetSize(); for (int i = 0; i < max; i++) { CTransparentWnd *itemWnd = shapeArray[i]; @@ -460,7 +460,7 @@ int CListManager::SwapLayoutArray(long uniqueID1, long uniqueID2) int swapItem1 = -1; int swapItem2 = -1; - int max = layoutArray.GetSize(); + int max = (int)layoutArray.GetSize(); CLayoutList *itemLayout = nullptr; for (int i = 0; i < max; i++) { @@ -575,7 +575,7 @@ int CListManager::SaveLayout(CString saveDir) long fileversion = 100; fwrite((void *)&fileversion, sizeof(long), 1, fptr); - int max = layoutArray.GetSize(); + int max = (int)layoutArray.GetSize(); fwrite((void *)&max, sizeof(int), 1, fptr); // Number of Shapes int reserve[100]; @@ -643,7 +643,7 @@ int CListManager::SaveLayoutArrayToFile(CArray ",IDC_STATIC_VERSION,7,72,267,71 PUSHBUTTON "Visit the \nCamStudio website",IDC_BUTTONLINK3,86,160,102,28,BS_MULTILINE | BS_FLAT @@ -571,33 +579,23 @@ FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,92,261,50,14 PUSHBUTTON "Cancel",IDCANCEL,162,261,50,14 - EDITTEXT IDC_KEYFRAMES,95,68,46,13,ES_AUTOHSCROLL - LTEXT "frames",IDC_STATIC_KEYFRAMES,147,68,22,13,SS_CENTERIMAGE - LTEXT "Quality",IDC_STATIC_QUALITY_LABEL,19,46,22,14,SS_CENTERIMAGE - CONTROL "Slider1",IDC_QUALITY_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,50,46,130,14 - LTEXT "Playback Rate",IDC_STATIC,19,129,48,8 - EDITTEXT IDC_FPS,97,128,46,13,ES_AUTOHSCROLL - LTEXT "Set Key Frames Every",IDC_STATIC,19,68,70,13,SS_CENTERIMAGE - LTEXT "frames/second",IDC_STATIC_KEYFRAMES2,149,130,48,8 - EDITTEXT IDC_KEYFRAMES2,97,108,46,13,ES_AUTOHSCROLL - LTEXT "milliseconds",IDC_STATIC_KEYFRAMES3,149,108,38,13,SS_CENTERIMAGE - LTEXT "Capture Frames Every",IDC_STATIC,19,108,70,13,SS_CENTERIMAGE - COMBOBOX IDC_COMPRESSORS,19,23,191,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Compressor",IDC_STATIC,7,5,291,85 - LTEXT "Ql",IDC_QUALITY,187,47,31,12,SS_CENTERIMAGE - PUSHBUTTON "&About",ID_ABOUT,236,22,50,14,NOT WS_TABSTOP - PUSHBUTTON "&Configure",ID_CONFIGURE,236,43,50,14,NOT WS_TABSTOP - CONTROL "Auto Adjust",IDC_AUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,165,52,10 - CONTROL "Slider2",IDC_ADJUST,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,68,183,167,17 - LTEXT "Max Framerate",IDC_STATIC,21,184,37,21 - LTEXT "Time Lapse ",IDC_STATIC,132,205,40,8 - LTEXT "1 Frame/Minute",IDC_STATIC,236,183,51,17,SS_CENTERIMAGE - GROUPBOX "",IDC_STATIC,7,155,292,96 - GROUPBOX "Framerates",IDC_STATIC,7,93,291,61 - CONTROL "Lock Capture and Playback Rates",IDC_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,168,164,125,10 - PUSHBUTTON "",IDC_CFE_INFO,189,110,12,10,BS_BITMAP | BS_FLAT - CONTROL "Round down video height and width to even numbers",IDC_SUPPORTROUNDDOWN, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,223,252,22 + GROUPBOX "Capture Source",IDC_STATIC,7,5,291,38 + CONTROL "Auto Adjust",IDC_AUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,98,52,10 + CONTROL "Slider2",IDC_ADJUST,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,43,116,167,17 + LTEXT "Max fps",IDC_STATIC,16,121,29,11 + LTEXT "Time Lapse ",IDC_STATIC,105,136,40,8 + LTEXT "1 Frame/Minute",IDC_STATIC,236,116,51,17,SS_CENTERIMAGE + GROUPBOX "",IDC_STATIC,7,89,292,59 + CONTROL "Lock Capture and Playback Rates",IDC_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,169,97,125,10 + COMBOBOX IDC_COMBO1,55,21,89,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "Source:",IDC_STATIC,15,22,24,8 + GROUPBOX "Framerates",IDC_STATIC,7,43,291,48 + LTEXT "Sample rate:",IDC_STATIC,14,57,38,13,SS_CENTERIMAGE + EDITTEXT IDC_KEYFRAMES2,55,57,46,13,ES_AUTOHSCROLL + LTEXT "ms",IDC_STATIC_KEYFRAMES3,106,57,38,13,SS_CENTERIMAGE + LTEXT "fps",IDC_STATIC_KEYFRAMES2,106,75,15,8 + EDITTEXT IDC_FPS,55,73,46,12,ES_AUTOHSCROLL + LTEXT "Capture rate:",IDC_STATIC,14,75,40,8 END IDD_CURSOROPTIONS DIALOGEX 0, 0, 254, 236 @@ -1074,6 +1072,45 @@ BEGIN EDITTEXT IDC_MESSAGE,15,18,239,29,ES_MULTILINE | ES_AUTOHSCROLL | ES_OEMCONVERT | ES_READONLY | NOT WS_BORDER END +IDD_SETTINGS_UI DIALOGEX 0, 0, 410, 267 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Video Settings" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,346,246,57,14 + GROUPBOX "Source",IDC_STATIC,7,7,396,32 + COMBOBOX IDC_VIDEO_SOURCE_COMBO,64,18,102,61,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Source:",IDC_STATIC,37,20,24,8 + LTEXT "Framerate (FPS):",IDC_STATIC,185,20,58,8 + EDITTEXT IDC_FPS,246,18,65,14,ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Output Settings",IDC_STATIC,7,41,396,200 + COMBOBOX IDC_VIDEO_CONTAINER_COMBO,64,54,64,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Container:",IDC_STATIC,26,55,35,8 + LTEXT "Video Codec:",IDC_STATIC,17,90,44,8 + COMBOBOX IDC_VIDEO_CODEC_COMBO,64,89,64,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Video",IDC_STATIC,14,76,19,8 + LTEXT "Optimize Video",IDC_STATIC,14,143,50,8 + CONTROL "",IDC_CODEC_PRESET_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_NOTIFYBEFOREMOVE | WS_TABSTOP,64,155,85,12 + LTEXT "Encoder Preset:",IDC_STATIC,8,156,53,8 + LTEXT "Encoder Tune:",IDC_STATIC,12,171,49,8 + LTEXT "Encoder Profile:",IDC_STATIC,8,187,53,8 + COMBOBOX IDC_CODEC_TUNE_COMBO,64,169,67,91,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_CODEC_PROFILE_COMBO,64,186,67,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Encoder Level:",IDC_STATIC,151,187,49,8 + COMBOBOX IDC_CODEC_LEVEL_COMBO_,203,186,67,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_VIDEO_CODEC_EXTRA,64,206,339,31 + LTEXT "Extra Options:",IDC_STATIC,14,214,47,8 + LTEXT "Quality",IDC_STATIC,199,76,23,8 + CONTROL "Constant Quality:",IDC_CODEC_QUALITY_CONSTANT,"Button",BS_AUTORADIOBUTTON | BS_NOTIFY | WS_GROUP,202,89,72,10 + CONTROL "",IDC_CODEC_CONSTANT_QUALITY_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_NOTIFYBEFOREMOVE | WS_TABSTOP,208,104,175,13 + LTEXT "| Lower Quality",IDC_CODEC_CONSTANT_QUALITY_LOW_LABEL,212,118,51,8 + LTEXT "Higher Quality |",IDC_CODEC_CONSTANT_QUALITY_HIGH_LABEL,327,118,52,8 + CONTROL "Avg Bitrate (kbps):",IDC_CODEC_QUALITY_BITRATE,"Button",BS_AUTORADIOBUTTON | BS_NOTIFY | WS_GROUP,202,135,73,10 + EDITTEXT IDC_CODEC_QUALITY_BITRATE_EDIT,278,134,65,14,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Ultrafast",IDC_STATIC,149,156,28,8 + LTEXT "25",IDC_CODEC_QUALITY_VALUE,278,90,9,8 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -1301,6 +1338,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 89 END + + IDD_SETTINGS_UI, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 403 + TOPMARGIN, 7 + BOTTOMMARGIN, 260 + END END #endif // APSTUDIO_INVOKED @@ -2331,6 +2376,16 @@ BEGIN 0 END +IDD_VIDEOOPTIONS DLGINIT +BEGIN + IDC_COMBO1, 0x403, 4, 0 +0x4447, 0x0049, + IDC_COMBO1, 0x403, 20, 0 +0x6544, 0x736b, 0x6f74, 0x2070, 0x7544, 0x6c70, 0x6369, 0x7461, 0x6f69, +0x006e, + 0 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -2459,6 +2514,48 @@ BEGIN 0 END +IDD_VIDEOOPTIONS AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +IDD_SETTINGS_UI AFX_DIALOG_LAYOUT +BEGIN + 0, + 0, 0, 0, 0, + 0, 0, 100, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 100, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 +END + ///////////////////////////////////////////////////////////////////////////// // diff --git a/CamStudioRecorder/RecorderView.cpp b/CamStudioRecorder/RecorderView.cpp index b219c6de..93c2f266 100644 --- a/CamStudioRecorder/RecorderView.cpp +++ b/CamStudioRecorder/RecorderView.cpp @@ -30,6 +30,7 @@ #include "VideoOptionsDlg.h" #include "ProgressDlg.h" + #include #include #include @@ -54,6 +55,7 @@ #include "addons/EffectsOptions2Dlg.h" #include "string_convert.h" +#include "video_settings_ui.h" #ifdef _DEBUG // #include // Visual Leak Detector utility (In debug mode) @@ -210,7 +212,7 @@ int iAudioTimeInitiated = 0; int sdwSamplesPerSec = 22050; int sdwBytesPerSec = 44100; -INT_PTR g_iCurrentLayout = 0; +int g_iCurrentLayout = 0; sProgramOpts cProgramOpts; sProducerOpts cProducerOpts; @@ -451,136 +453,135 @@ UINT CRecorderView::WM_USER_RECORDSTART = ::RegisterWindowMessage(WM_USER_RECORD IMPLEMENT_DYNCREATE(CRecorderView, CView) BEGIN_MESSAGE_MAP(CRecorderView, CView) -//{{AFX_MSG_MAP(CRecorderView) -ON_WM_PAINT() -ON_WM_CREATE() -ON_WM_DESTROY() -ON_WM_SETFOCUS() -ON_WM_ERASEBKGND() -ON_COMMAND(ID_RECORD, OnRecord) -ON_UPDATE_COMMAND_UI(ID_RECORD, OnUpdateRecord) -ON_COMMAND(ID_STOP, OnStop) -ON_UPDATE_COMMAND_UI(ID_STOP, OnUpdateStop) -ON_COMMAND(ID_REGION_RUBBER, OnRegionRubber) -ON_UPDATE_COMMAND_UI(ID_REGION_RUBBER, OnUpdateRegionRubber) -ON_COMMAND(ID_REGION_PANREGION, OnRegionPanregion) -ON_UPDATE_COMMAND_UI(ID_REGION_PANREGION, OnUpdateRegionPanregion) -ON_COMMAND(ID_OPTIONS_AUTOPAN, OnOptionsAutopan) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_AUTOPAN, OnUpdateOptionsAutopan) -ON_COMMAND(ID_OPTIONS_VIDEOOPTIONS, OnFileVideooptions) -ON_COMMAND(ID_OPTIONS_CURSOROPTIONS, OnOptionsCursoroptions) -ON_COMMAND(ID_OPTIONS_ATUOPANSPEED, OnOptionsAtuopanspeed) -ON_COMMAND(ID_REGION_FULLSCREEN, OnRegionFullscreen) -ON_UPDATE_COMMAND_UI(ID_REGION_FULLSCREEN, OnUpdateRegionFullscreen) -ON_COMMAND(ID_SCREENS_SELECTSCREEN, OnRegionSelectScreen) -ON_UPDATE_COMMAND_UI(ID_SCREENS_SELECTSCREEN, OnUpdateRegionSelectScreen) -ON_COMMAND(ID_SCREENS_ALLSCREENS, OnRegionAllScreens) -ON_UPDATE_COMMAND_UI(ID_SCREENS_ALLSCREENS, OnUpdateRegionAllScreens) -ON_COMMAND(ID_HELP_WEBSITE, OnHelpWebsite) -ON_COMMAND(ID_HELP_HELP, OnHelpHelp) -ON_COMMAND(ID_PAUSE, OnPause) -ON_UPDATE_COMMAND_UI(ID_PAUSE, OnUpdatePause) -ON_COMMAND(ID_OPTIONS_RECORDAUDIO, OnOptionsRecordaudio) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDAUDIO, OnUpdateOptionsRecordaudio) -ON_COMMAND(ID_OPTIONS_AUDIOFORMAT, OnOptionsAudioformat) -ON_COMMAND(ID_OPTIONS_AUDIOSPEAKERS, OnOptionsAudiospeakers) -ON_COMMAND(ID_HELP_FAQ, OnHelpFaq) -ON_COMMAND(ID_OPTIONS_RECORDAUDIO_DONOTRECORDAUDIO, OnOptionsRecordaudioDonotrecordaudio) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDAUDIO_DONOTRECORDAUDIO, OnUpdateOptionsRecordaudioDonotrecordaudio) -ON_COMMAND(ID_OPTIONS_RECORDAUDIO_RECORDFROMSPEAKERS, OnOptionsRecordaudioRecordfromspeakers) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDAUDIO_RECORDFROMSPEAKERS, OnUpdateOptionsRecordaudioRecordfromspeakers) -ON_COMMAND(ID_OPTIONS_RECORDAUDIOMICROPHONE, OnOptionsRecordaudiomicrophone) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDAUDIOMICROPHONE, OnUpdateOptionsRecordaudiomicrophone) -ON_COMMAND(ID_HELP_DONATIONS, OnHelpDonations) -ON_COMMAND(ID_VIEW_SCREENANNOTATIONS, OnViewScreenannotations) -ON_UPDATE_COMMAND_UI(ID_VIEW_SCREENANNOTATIONS, OnUpdateViewScreenannotations) -ON_COMMAND(ID_VIEW_VIDEOANNOTATIONS, OnViewVideoannotations) -ON_COMMAND(ID_OPTIONS_AUDIOOPTIONS_AUDIOVIDEOSYNCHRONIZATION, OnOptionsSynchronization) -ON_COMMAND(ID_AVISWF, OnAVISWFMP4) -ON_COMMAND(ID_OPTIONS_NAMING_AUTODATE, OnOptionsNamingAutodate) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_NAMING_AUTODATE, OnUpdateOptionsNamingAutodate) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_ENGLISH, OnUpdateOptionsLanguageEnglish) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_GERMAN, OnUpdateOptionsLanguageGerman) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_FILIPINO, OnUpdateOptionsLanguageFilipino) -ON_COMMAND(ID_OPTIONS_LANGUAGE_ENGLISH, OnOptionsLanguageEnglish) -ON_COMMAND(ID_OPTIONS_LANGUAGE_GERMAN, OnOptionsLanguageFilipino) -ON_COMMAND(ID_OPTIONS_LANGUAGE_FILIPINO, OnOptionsLanguageFilipino) -ON_COMMAND(ID_REGION_WINDOW, OnRegionWindow) -ON_UPDATE_COMMAND_UI(ID_REGION_WINDOW, OnUpdateRegionWindow) - -ON_COMMAND(ID_ANNOTATION_ADDSYSTEMTIMESTAMP, OnAnnotationAddsystemtimestamp) -ON_UPDATE_COMMAND_UI(ID_ANNOTATION_ADDSYSTEMTIMESTAMP, OnUpdateAnnotationAddsystemtimestamp) - -ON_COMMAND(ID_ANNOTATION_ADDCAPTION, OnAnnotationAddcaption) -ON_UPDATE_COMMAND_UI(ID_ANNOTATION_ADDCAPTION, OnUpdateAnnotationAddcaption) -ON_COMMAND(ID_ANNOTATION_ADDWATERMARK, OnAnnotationAddwatermark) -ON_UPDATE_COMMAND_UI(ID_ANNOTATION_ADDWATERMARK, OnUpdateAnnotationAddwatermark) -ON_COMMAND(ID_EFFECTS_OPTIONS, OnEffectsOptions) -ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_PRESETTIME, OnOptionsProgramoptionsPresettime) -ON_COMMAND(ID_OPTIONS_MINIMIZEONSTART, OnOptionsMinimizeonstart) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_MINIMIZEONSTART, OnUpdateOptionsMinimizeonstart) -ON_COMMAND(ID_OPTIONS_HIDEFLASHING, OnOptionsHideflashing) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_HIDEFLASHING, OnUpdateOptionsHideflashing) -ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_SAVESETTINGSONEXIT, OnOptionsProgramoptionsSavesettingsonexit) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_SAVESETTINGSONEXIT, OnUpdateOptionsProgramoptionsSavesettingsonexit) -ON_COMMAND(ID_OPTIONS_CAPTURETRANS, OnOptionsCapturetrans) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_CAPTURETRANS, OnUpdateOptionsCapturetrans) -ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_PLAYAVI, OnOptionsProgramoptionsPlayavi) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_PLAYAVI, OnUpdateOptionsProgramoptionsPlayavi) -ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_NOPLAY, OnOptionsProgramoptionsNoplay) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_NOPLAY, OnUpdateOptionsProgramoptionsNoplay) -ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_DEFAULTPLAY, OnOptionsProgramoptionsDefaultplay) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_DEFAULTPLAY, OnUpdateOptionsProgramoptionsDefaultplay) -ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_CAMSTUDIOPLAY, OnOptionsProgramoptionsCamstudioplay) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_CAMSTUDIOPLAY, OnUpdateOptionsProgramoptionsCamstudioplay) -ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_PLAYAVIFILEWHENRECORDINGSTOPS_USECAMSTUDIOPLAYER20, OnOptionsUsePlayer20) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_PLAYAVIFILEWHENRECORDINGSTOPS_USECAMSTUDIOPLAYER20, OnUpdateUsePlayer20) -ON_COMMAND(ID_OPTIONS_TEMPDIR_WINDOWS, OnOptionsTempdirWindows) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_TEMPDIR_WINDOWS, OnUpdateOptionsTempdirWindows) -ON_COMMAND(ID_OPTIONS_TEMPDIR_INSTALLED, OnOptionsTempdirInstalled) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_TEMPDIR_INSTALLED, OnUpdateOptionsTempdirInstalled) -ON_COMMAND(ID_OPTIONS_TEMPDIR_USER, OnOptionsTempdirUser) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_TEMPDIR_USER, OnUpdateOptionsTempdirUser) - -ON_COMMAND(ID_OUTPUTDIRECTORY_USEWINDOWSTEMPORARYDIRECTORY, OnOptionsOutputDirWindows) -ON_UPDATE_COMMAND_UI(ID_OUTPUTDIRECTORY_USEWINDOWSTEMPORARYDIRECTORY, OnUpdateOptionsOutputDirWindows) - -ON_COMMAND(ID_OUTPUTDIRECTORY_USEMYCAMSTUDIORECORDINGSDIRECTORY, OnOptionsOutputDirInstalled) -ON_UPDATE_COMMAND_UI(ID_OUTPUTDIRECTORY_USEMYCAMSTUDIORECORDINGSDIRECTORY, OnUpdateOptionsOutputDirInstalled) - -ON_COMMAND(ID_OUTPUTDIRECTORY_USEUSERSPECIFIEDDIRECTORY, OnOptionsOutputDirUser) -ON_UPDATE_COMMAND_UI(ID_OUTPUTDIRECTORY_USEUSERSPECIFIEDDIRECTORY, OnUpdateOptionsUser) - -ON_COMMAND(ID_OPTIONS_RECORDINGTHREADPRIORITY_NORMAL, OnOptionsRecordingthreadpriorityNormal) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDINGTHREADPRIORITY_NORMAL, OnUpdateOptionsRecordingthreadpriorityNormal) -ON_COMMAND(ID_OPTIONS_RECORDINGTHREADPRIORITY_HIGHEST, OnOptionsRecordingthreadpriorityHighest) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDINGTHREADPRIORITY_HIGHEST, OnUpdateOptionsRecordingthreadpriorityHighest) -ON_COMMAND(ID_OPTIONS_RECORDINGTHREADPRIORITY_ABOVENORMAL, OnOptionsRecordingthreadpriorityAbovenormal) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDINGTHREADPRIORITY_ABOVENORMAL, OnUpdateOptionsRecordingthreadpriorityAbovenormal) -ON_COMMAND(ID_OPTIONS_RECORDINGTHREADPRIORITY_TIMECRITICAL, OnOptionsRecordingthreadpriorityTimecritical) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDINGTHREADPRIORITY_TIMECRITICAL, - OnUpdateOptionsRecordingthreadpriorityTimecritical) -ON_COMMAND(ID_OPTIONS_NAMING_ASK, OnOptionsNamingAsk) -ON_UPDATE_COMMAND_UI(ID_OPTIONS_NAMING_ASK, OnUpdateOptionsNamingAsk) -ON_COMMAND(ID_OPTIONS_KEYBOARDSHORTCUTS, OnOptionsKeyboardshortcuts) -ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_TROUBLESHOOT, OnOptionsProgramoptionsTroubleshoot) -//}}AFX_MSG_MAP -// Standard printing commands -ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) -ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) -ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) -ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_RECORDSTART, OnRecordStart) -ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_RECORDINTERRUPTED, OnRecordInterrupted) -ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_RECORDPAUSED, OnRecordPaused) -ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_SAVECURSOR, OnSaveCursor) -ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_GENERIC, OnUserGeneric) -ON_MESSAGE(MM_WIM_DATA, OnMM_WIM_DATA) -ON_MESSAGE(WM_HOTKEY, OnHotKey) -ON_COMMAND(ID_HELP_CAMSTUDIOBLOG, OnHelpCamstudioblog) -ON_BN_CLICKED(IDC_BUTTONLINK, OnBnClickedButtonlink) -ON_WM_CAPTURECHANGED() -ON_UPDATE_COMMAND_UI(ID_OPTIONS_AUDIOOPTIONS_AUDIOVIDEOSYNCHRONIZATION, - &CRecorderView::OnUpdateOptionsAudiooptionsAudiovideosynchronization) + ON_WM_PAINT() + ON_WM_CREATE() + ON_WM_DESTROY() + ON_WM_SETFOCUS() + ON_WM_ERASEBKGND() + ON_COMMAND(ID_RECORD, OnRecord) + ON_UPDATE_COMMAND_UI(ID_RECORD, OnUpdateRecord) + ON_COMMAND(ID_STOP, OnStop) + ON_UPDATE_COMMAND_UI(ID_STOP, OnUpdateStop) + ON_COMMAND(ID_REGION_RUBBER, OnRegionRubber) + ON_UPDATE_COMMAND_UI(ID_REGION_RUBBER, OnUpdateRegionRubber) + ON_COMMAND(ID_REGION_PANREGION, OnRegionPanregion) + ON_UPDATE_COMMAND_UI(ID_REGION_PANREGION, OnUpdateRegionPanregion) + ON_COMMAND(ID_OPTIONS_AUTOPAN, OnOptionsAutopan) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_AUTOPAN, OnUpdateOptionsAutopan) + ON_COMMAND(ID_OPTIONS_VIDEOOPTIONS, OnFileVideooptions) + ON_COMMAND(ID_OPTIONS_CURSOROPTIONS, OnOptionsCursoroptions) + ON_COMMAND(ID_OPTIONS_ATUOPANSPEED, OnOptionsAtuopanspeed) + ON_COMMAND(ID_REGION_FULLSCREEN, OnRegionFullscreen) + ON_UPDATE_COMMAND_UI(ID_REGION_FULLSCREEN, OnUpdateRegionFullscreen) + ON_COMMAND(ID_SCREENS_SELECTSCREEN, OnRegionSelectScreen) + ON_UPDATE_COMMAND_UI(ID_SCREENS_SELECTSCREEN, OnUpdateRegionSelectScreen) + ON_COMMAND(ID_SCREENS_ALLSCREENS, OnRegionAllScreens) + ON_UPDATE_COMMAND_UI(ID_SCREENS_ALLSCREENS, OnUpdateRegionAllScreens) + ON_COMMAND(ID_HELP_WEBSITE, OnHelpWebsite) + ON_COMMAND(ID_HELP_HELP, OnHelpHelp) + ON_COMMAND(ID_PAUSE, OnPause) + ON_UPDATE_COMMAND_UI(ID_PAUSE, OnUpdatePause) + ON_COMMAND(ID_OPTIONS_RECORDAUDIO, OnOptionsRecordaudio) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDAUDIO, OnUpdateOptionsRecordaudio) + ON_COMMAND(ID_OPTIONS_AUDIOFORMAT, OnOptionsAudioformat) + ON_COMMAND(ID_OPTIONS_AUDIOSPEAKERS, OnOptionsAudiospeakers) + ON_COMMAND(ID_HELP_FAQ, OnHelpFaq) + ON_COMMAND(ID_OPTIONS_RECORDAUDIO_DONOTRECORDAUDIO, OnOptionsRecordaudioDonotrecordaudio) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDAUDIO_DONOTRECORDAUDIO, OnUpdateOptionsRecordaudioDonotrecordaudio) + ON_COMMAND(ID_OPTIONS_RECORDAUDIO_RECORDFROMSPEAKERS, OnOptionsRecordaudioRecordfromspeakers) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDAUDIO_RECORDFROMSPEAKERS, OnUpdateOptionsRecordaudioRecordfromspeakers) + ON_COMMAND(ID_OPTIONS_RECORDAUDIOMICROPHONE, OnOptionsRecordaudiomicrophone) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDAUDIOMICROPHONE, OnUpdateOptionsRecordaudiomicrophone) + ON_COMMAND(ID_HELP_DONATIONS, OnHelpDonations) + ON_COMMAND(ID_VIEW_SCREENANNOTATIONS, OnViewScreenannotations) + ON_UPDATE_COMMAND_UI(ID_VIEW_SCREENANNOTATIONS, OnUpdateViewScreenannotations) + ON_COMMAND(ID_VIEW_VIDEOANNOTATIONS, OnViewVideoannotations) + ON_COMMAND(ID_OPTIONS_AUDIOOPTIONS_AUDIOVIDEOSYNCHRONIZATION, OnOptionsSynchronization) + ON_COMMAND(ID_AVISWF, OnAVISWFMP4) + ON_COMMAND(ID_OPTIONS_NAMING_AUTODATE, OnOptionsNamingAutodate) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_NAMING_AUTODATE, OnUpdateOptionsNamingAutodate) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_ENGLISH, OnUpdateOptionsLanguageEnglish) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_GERMAN, OnUpdateOptionsLanguageGerman) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_LANGUAGE_FILIPINO, OnUpdateOptionsLanguageFilipino) + ON_COMMAND(ID_OPTIONS_LANGUAGE_ENGLISH, OnOptionsLanguageEnglish) + ON_COMMAND(ID_OPTIONS_LANGUAGE_GERMAN, OnOptionsLanguageFilipino) + ON_COMMAND(ID_OPTIONS_LANGUAGE_FILIPINO, OnOptionsLanguageFilipino) + ON_COMMAND(ID_REGION_WINDOW, OnRegionWindow) + ON_UPDATE_COMMAND_UI(ID_REGION_WINDOW, OnUpdateRegionWindow) + + ON_COMMAND(ID_ANNOTATION_ADDSYSTEMTIMESTAMP, OnAnnotationAddsystemtimestamp) + ON_UPDATE_COMMAND_UI(ID_ANNOTATION_ADDSYSTEMTIMESTAMP, OnUpdateAnnotationAddsystemtimestamp) + + ON_COMMAND(ID_ANNOTATION_ADDCAPTION, OnAnnotationAddcaption) + ON_UPDATE_COMMAND_UI(ID_ANNOTATION_ADDCAPTION, OnUpdateAnnotationAddcaption) + ON_COMMAND(ID_ANNOTATION_ADDWATERMARK, OnAnnotationAddwatermark) + ON_UPDATE_COMMAND_UI(ID_ANNOTATION_ADDWATERMARK, OnUpdateAnnotationAddwatermark) + ON_COMMAND(ID_EFFECTS_OPTIONS, OnEffectsOptions) + ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_PRESETTIME, OnOptionsProgramoptionsPresettime) + ON_COMMAND(ID_OPTIONS_MINIMIZEONSTART, OnOptionsMinimizeonstart) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_MINIMIZEONSTART, OnUpdateOptionsMinimizeonstart) + ON_COMMAND(ID_OPTIONS_HIDEFLASHING, OnOptionsHideflashing) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_HIDEFLASHING, OnUpdateOptionsHideflashing) + ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_SAVESETTINGSONEXIT, OnOptionsProgramoptionsSavesettingsonexit) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_SAVESETTINGSONEXIT, OnUpdateOptionsProgramoptionsSavesettingsonexit) + ON_COMMAND(ID_OPTIONS_CAPTURETRANS, OnOptionsCapturetrans) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_CAPTURETRANS, OnUpdateOptionsCapturetrans) + ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_PLAYAVI, OnOptionsProgramoptionsPlayavi) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_PLAYAVI, OnUpdateOptionsProgramoptionsPlayavi) + ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_NOPLAY, OnOptionsProgramoptionsNoplay) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_NOPLAY, OnUpdateOptionsProgramoptionsNoplay) + ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_DEFAULTPLAY, OnOptionsProgramoptionsDefaultplay) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_DEFAULTPLAY, OnUpdateOptionsProgramoptionsDefaultplay) + ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_CAMSTUDIOPLAY, OnOptionsProgramoptionsCamstudioplay) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_CAMSTUDIOPLAY, OnUpdateOptionsProgramoptionsCamstudioplay) + ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_PLAYAVIFILEWHENRECORDINGSTOPS_USECAMSTUDIOPLAYER20, OnOptionsUsePlayer20) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_PROGRAMOPTIONS_PLAYAVIFILEWHENRECORDINGSTOPS_USECAMSTUDIOPLAYER20, OnUpdateUsePlayer20) + ON_COMMAND(ID_OPTIONS_TEMPDIR_WINDOWS, OnOptionsTempdirWindows) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_TEMPDIR_WINDOWS, OnUpdateOptionsTempdirWindows) + ON_COMMAND(ID_OPTIONS_TEMPDIR_INSTALLED, OnOptionsTempdirInstalled) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_TEMPDIR_INSTALLED, OnUpdateOptionsTempdirInstalled) + ON_COMMAND(ID_OPTIONS_TEMPDIR_USER, OnOptionsTempdirUser) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_TEMPDIR_USER, OnUpdateOptionsTempdirUser) + + ON_COMMAND(ID_OUTPUTDIRECTORY_USEWINDOWSTEMPORARYDIRECTORY, OnOptionsOutputDirWindows) + ON_UPDATE_COMMAND_UI(ID_OUTPUTDIRECTORY_USEWINDOWSTEMPORARYDIRECTORY, OnUpdateOptionsOutputDirWindows) + + ON_COMMAND(ID_OUTPUTDIRECTORY_USEMYCAMSTUDIORECORDINGSDIRECTORY, OnOptionsOutputDirInstalled) + ON_UPDATE_COMMAND_UI(ID_OUTPUTDIRECTORY_USEMYCAMSTUDIORECORDINGSDIRECTORY, OnUpdateOptionsOutputDirInstalled) + + ON_COMMAND(ID_OUTPUTDIRECTORY_USEUSERSPECIFIEDDIRECTORY, OnOptionsOutputDirUser) + ON_UPDATE_COMMAND_UI(ID_OUTPUTDIRECTORY_USEUSERSPECIFIEDDIRECTORY, OnUpdateOptionsUser) + + ON_COMMAND(ID_OPTIONS_RECORDINGTHREADPRIORITY_NORMAL, OnOptionsRecordingthreadpriorityNormal) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDINGTHREADPRIORITY_NORMAL, OnUpdateOptionsRecordingthreadpriorityNormal) + ON_COMMAND(ID_OPTIONS_RECORDINGTHREADPRIORITY_HIGHEST, OnOptionsRecordingthreadpriorityHighest) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDINGTHREADPRIORITY_HIGHEST, OnUpdateOptionsRecordingthreadpriorityHighest) + ON_COMMAND(ID_OPTIONS_RECORDINGTHREADPRIORITY_ABOVENORMAL, OnOptionsRecordingthreadpriorityAbovenormal) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDINGTHREADPRIORITY_ABOVENORMAL, OnUpdateOptionsRecordingthreadpriorityAbovenormal) + ON_COMMAND(ID_OPTIONS_RECORDINGTHREADPRIORITY_TIMECRITICAL, OnOptionsRecordingthreadpriorityTimecritical) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_RECORDINGTHREADPRIORITY_TIMECRITICAL, + OnUpdateOptionsRecordingthreadpriorityTimecritical) + ON_COMMAND(ID_OPTIONS_NAMING_ASK, OnOptionsNamingAsk) + ON_UPDATE_COMMAND_UI(ID_OPTIONS_NAMING_ASK, OnUpdateOptionsNamingAsk) + ON_COMMAND(ID_OPTIONS_KEYBOARDSHORTCUTS, OnOptionsKeyboardshortcuts) + ON_COMMAND(ID_OPTIONS_PROGRAMOPTIONS_TROUBLESHOOT, OnOptionsProgramoptionsTroubleshoot) + + ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) + ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) + ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) + ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_RECORDSTART, OnRecordStart) + ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_RECORDINTERRUPTED, OnRecordInterrupted) + ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_RECORDPAUSED, OnRecordPaused) + ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_SAVECURSOR, OnSaveCursor) + ON_REGISTERED_MESSAGE(CRecorderView::WM_USER_GENERIC, OnUserGeneric) + ON_MESSAGE(MM_WIM_DATA, OnMM_WIM_DATA) + ON_MESSAGE(WM_HOTKEY, OnHotKey) + ON_COMMAND(ID_HELP_CAMSTUDIOBLOG, OnHelpCamstudioblog) + ON_BN_CLICKED(IDC_BUTTONLINK, OnBnClickedButtonlink) + ON_WM_CAPTURECHANGED() + ON_UPDATE_COMMAND_UI(ID_OPTIONS_AUDIOOPTIONS_AUDIOVIDEOSYNCHRONIZATION, + &CRecorderView::OnUpdateOptionsAudiooptionsAudiovideosynchronization) + ON_COMMAND(ID_TOOLS_SETTINGS, &CRecorderView::OnToolsSettings) END_MESSAGE_MAP() BEGIN_EVENTSINK_MAP(CRecorderView, CView) @@ -599,6 +600,7 @@ CRecorderView::CRecorderView() , zoomed_at_(10, 10) , show_message_(true) { + video_settings_model_ = std::make_unique(); } CRecorderView::~CRecorderView() @@ -1586,14 +1588,11 @@ void CRecorderView::OnFileVideooptions() } } - if (g_num_compressor) - { - CVideoOptionsDlg cDlg(cVideoOpts, this); - if (IDOK == cDlg.DoModal()) - { - cVideoOpts = cDlg.Opts(); - } - } + //if (g_num_compressor) + //{ + video_settings_ui cDlg(nullptr, *video_settings_model_); + cDlg.DoModal(); + //} } void CRecorderView::OnOptionsCursoroptions() @@ -3128,7 +3127,7 @@ LRESULT CRecorderView::OnHotKey(WPARAM wParam, LPARAM /*lParam*/) // sadlg.RefreshLayoutList(); bCreatedSADlg = true; } - INT_PTR max = ListManager.layoutArray.GetSize(); + int max = (int)ListManager.layoutArray.GetSize(); if (max <= 0) { return 0; @@ -4865,3 +4864,27 @@ int InitDrawShiftWindow() } } // namespace + + + +void CRecorderView::OnToolsSettings() +{ + //video_settings_ui test(this); + //test.DoModal(); + +#if 0 + if (!bCreatedSADlg) + { + sadlg.Create(IDD_SCREENANNOTATIONS2, nullptr); + sadlg.RefreshShapeList(); + bCreatedSADlg = true; + } + + if (sadlg.IsWindowVisible()) + sadlg.ShowWindow(SW_HIDE); + else + sadlg.ShowWindow(SW_RESTORE); +#endif + + // TODO: Add your command handler code here +} diff --git a/CamStudioRecorder/RecorderView.h b/CamStudioRecorder/RecorderView.h index eaa46fb9..eb3c2ccd 100644 --- a/CamStudioRecorder/RecorderView.h +++ b/CamStudioRecorder/RecorderView.h @@ -1,19 +1,22 @@ #pragma once -#include "VideoWnd.h" // for CVideoWnd -#include "FlashingWnd.h" // for CFlashingWnd -#include "BasicMessageDlg.h" // for CBasicMessageDlg +#include "VideoWnd.h" +#include "FlashingWnd.h" +#include "BasicMessageDlg.h" #include "screen.h" -#include "capture_thread.h" +#include "capture_thread.h" +#include #include #define TEMPFILETAGINDICATOR "~temp" class CRecorderDoc; +class video_settings_model; + class CRecorderView : public CView { protected: // create from serialization only @@ -195,7 +198,7 @@ class CRecorderView : public CView private: std::unique_ptr capture_thread_; - + std::unique_ptr video_settings_model_; CFlashingWnd flashing_wnd_; CVideoWnd van_wnd_; @@ -221,6 +224,8 @@ class CRecorderView : public CView bool RunProducer(const CString &strNewFile); void DisplayAutopanInfo(CRect rc); // dialog controls +public: + afx_msg void OnToolsSettings(); }; #ifndef _DEBUG // debug version in vscapView.cpp diff --git a/CamStudioRecorder/ScreenAnnotationsDlg.cpp b/CamStudioRecorder/ScreenAnnotationsDlg.cpp index 0d5970ce..50183252 100644 --- a/CamStudioRecorder/ScreenAnnotationsDlg.cpp +++ b/CamStudioRecorder/ScreenAnnotationsDlg.cpp @@ -26,7 +26,7 @@ extern CString g_shapeName; extern CString g_strLayoutName; extern int g_keySCOpened; -extern INT_PTR g_iCurrentLayout; +extern int g_iCurrentLayout; extern int SetAdjustHotKeys(); diff --git a/CamStudioRecorder/StdAfx.h b/CamStudioRecorder/StdAfx.h index 17d4a4fc..6eb47d01 100644 --- a/CamStudioRecorder/StdAfx.h +++ b/CamStudioRecorder/StdAfx.h @@ -8,15 +8,36 @@ //#endif -#define WIN32_LEAN_AND_MEAN -#define VC_EXTRALEAN +//#define WIN32_LEAN_AND_MEAN +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif -//////////////////////////// -// Use MS Private Assemblies to prevent side by side configuration errors as reported by users. -// Based on info http://www.codeproject.com/KB/cpp/PrivateAssemblyProjects.aspx -// #include "UseMSPrivateAssemblies.h" +#include "targetver.h" -#include "targetver.h" // define WINVER +// \todo enable this +//#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include // MFC core and standard components +#include // MFC extensions + +#include // MFC Automation classes + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + + +#if 0 + +//#include "resource.h" #include // MFC core and standard components #include // MFC extensions @@ -26,6 +47,17 @@ #include // MFC support for Windows Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT +#include +#endif + +// just use camcapture gdiplus helper file for now +#include + +#include // MFC support for ribbons and control bars + +#include "resource.h" + + #include #include diff --git a/CamStudioRecorder/VideoOptionsDlg.cpp b/CamStudioRecorder/VideoOptionsDlg.cpp index 8dbbe4b2..5bf48bb3 100644 --- a/CamStudioRecorder/VideoOptionsDlg.cpp +++ b/CamStudioRecorder/VideoOptionsDlg.cpp @@ -50,8 +50,10 @@ int m_arrAutoSetPlaybackRate[100]; ///////////////////////////////////////////////////////////////////////////// // CVideoOptionsDlg dialog +IMPLEMENT_DYNAMIC(CVideoOptionsDlg, CDialogEx) + CVideoOptionsDlg::CVideoOptionsDlg(CWnd *pParent /*=nullptr*/) - : CDialog(CVideoOptionsDlg::IDD, pParent) + : CDialogEx(IDD_VIDEOOPTIONS, pParent) , m_iQuality(0) , m_iKeyFrameInterval(0) , m_iCaptureInterval(0) @@ -80,7 +82,7 @@ CVideoOptionsDlg::CVideoOptionsDlg(CWnd *pParent /*=nullptr*/) } CVideoOptionsDlg::CVideoOptionsDlg(const sVideoOpts &cOpts, CWnd *pParent) - : CDialog(CVideoOptionsDlg::IDD, pParent) + : CDialogEx(IDD_VIDEOOPTIONS, pParent) , m_iQuality(0) , m_iKeyFrameInterval(200) , m_iCaptureInterval(0) @@ -107,17 +109,15 @@ CVideoOptionsDlg::CVideoOptionsDlg(const sVideoOpts &cOpts, CWnd *pParent) void CVideoOptionsDlg::DoDataExchange(CDataExchange *pDX) { - CDialog::DoDataExchange(pDX); + CDialogEx::DoDataExchange(pDX); //{{AFX_DATA_MAP(CVideoOptionsDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP DDX_Control(pDX, IDC_COMPRESSORS, m_ctrlCBCompressor); - DDX_Control(pDX, ID_ABOUT, m_ctrlButtonAbout); - DDX_Control(pDX, ID_CONFIGURE, m_ctrlButtonConfigure); - DDX_Control(pDX, IDC_QUALITY_SLIDER, m_ctrlSliderQuality); - DDX_Control(pDX, IDC_QUALITY, m_ctrlStaticQuality); - DDX_Control(pDX, IDC_KEYFRAMES, m_ctrlEditKeyFrameInterval); - DDX_Control(pDX, IDC_KEYFRAMES2, m_ctrlEditCaptureInterval); + //DDX_Control(pDX, IDC_QUALITY_SLIDER, m_ctrlSliderQuality); + //DDX_Control(pDX, IDC_KEYFRAMES, m_ctrlEditKeyFrameInterval); + //DDX_Control(pDX, IDC_KEYFRAMES2, m_ctrlEditCaptureInterval); +#if 0 DDX_Control(pDX, IDC_FPS, m_ctrlEdiPlaybackRate); DDX_Control(pDX, IDC_AUTO, m_ctrlButtonAutoAdjust); DDX_Control(pDX, IDC_LOCK, m_ctrlButtonLock); @@ -133,6 +133,7 @@ void CVideoOptionsDlg::DoDataExchange(CDataExchange *pDX) DDX_Slider(pDX, IDC_ADJUST, m_iAdjust); DDX_Text(pDX, IDC_QUALITY, m_iStaticQuality); DDX_Control(pDX, IDC_SUPPORTROUNDDOWN, m_ctrlButtonRoundDown); +#endif } BEGIN_MESSAGE_MAP(CVideoOptionsDlg, CDialog) @@ -149,32 +150,6 @@ ON_BN_CLICKED(IDC_SUPPORTROUNDDOWN, &CVideoOptionsDlg::OnBnClickedSupportrounddo ON_BN_CLICKED(IDOK, &CVideoOptionsDlg::OnBnClickedOk) END_MESSAGE_MAP() -void CVideoOptionsDlg::RefreshCompressorButtons() -{ - int sel = m_ctrlCBCompressor.GetCurSel(); - if (sel != CB_ERR) - { - BOOL bEnableAbout = FALSE; - BOOL bEnableCfg = FALSE; - CHIC chic; - if (chic.Open(g_compressor_info[sel].fccType, g_compressor_info[sel].fccHandler, ICMODE_QUERY)) - { - // bEnableAbout = (ICERR_UNSUPPORTED != chic.QueryAbout()); - // bEnableCfg = (ICERR_UNSUPPORTED != chic.QueryConfigure()); - bEnableAbout = chic.QueryAbout() ? TRUE : FALSE; - bEnableCfg = chic.QueryConfigure() ? TRUE : FALSE; - } - m_ctrlButtonAbout.EnableWindow(bEnableAbout); - m_ctrlButtonConfigure.EnableWindow(bEnableCfg); - - // HIC hic = ICOpen(g_compressor_info[sel].fccType, g_compressor_info[sel].fccHandler, ICMODE_QUERY); - // if (hic) { - // m_ctrlButtonAbout.EnableWindow(ICQueryAbout(hic)); - // m_ctrlButtonConfigure.EnableWindow(ICQueryConfigure(hic)); - // ICClose(hic); - //} - } -} void CVideoOptionsDlg::AutoSetRateWithLock(int val, int &framerate, int &delayms) { if (val >= 1 && val <= 63) @@ -356,8 +331,8 @@ void CVideoOptionsDlg::AutoSetRate(int val, int &framerate, int &delayms) void CVideoOptionsDlg::RefreshAutoOptions() { m_ctrlEdiPlaybackRate.EnableWindow(!m_cOpts.m_bAutoAdjust); - m_ctrlEditKeyFrameInterval.EnableWindow(!m_cOpts.m_bAutoAdjust); - m_ctrlEditCaptureInterval.EnableWindow(!m_cOpts.m_bAutoAdjust); + //m_ctrlEditKeyFrameInterval.EnableWindow(!m_cOpts.m_bAutoAdjust); + //m_ctrlEditCaptureInterval.EnableWindow(!m_cOpts.m_bAutoAdjust); m_ctrlSliderAdjust.EnableWindow(m_cOpts.m_bAutoAdjust); // if (m_cOpts.m_bAutoAdjust) { // UpdateAdjustSliderVal(); @@ -488,8 +463,8 @@ void CVideoOptionsDlg::DDV_PlaybackRate(CDataExchange *pDX, int value, int minVa BOOL CVideoOptionsDlg::OnInitDialog() { - CDialog::OnInitDialog(); - m_ctrlSliderQuality.SetRange(1, 100, TRUE); + CDialogEx::OnInitDialog(); + //m_ctrlSliderQuality.SetRange(1, 100, TRUE); AdjustSliderRange(); GetCurrentSliderPos(); m_ctrlButtonAutoAdjust.SetCheck(m_cOpts.m_bAutoAdjust); @@ -500,7 +475,7 @@ BOOL CVideoOptionsDlg::OnInitDialog() m_ctrlButtonInfo.SetBitmap(hBitmap); RefreshAutoOptions(); LoadICList(); - RefreshCompressorButtons(); + //RefreshCompressorButtons(); AdjustSliderRange(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -542,7 +517,7 @@ void CVideoOptionsDlg::AdjustSliderRange() } void CVideoOptionsDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar) { - CDialog::OnHScroll(nSBCode, nPos, pScrollBar); + CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar); UpdateData(); m_iStaticQuality = m_iQuality; UpdateData(FALSE); @@ -608,7 +583,7 @@ void CVideoOptionsDlg::OnOK() m_cOpts.m_iSelectedCompressor = sel; } m_cOpts.m_bRoundDown = m_ctrlButtonRoundDown.GetCheck() ? true : false; - CDialog::OnOK(); // call base; + CDialogEx::OnOK(); // call base; } void CVideoOptionsDlg::OnAbout() @@ -626,7 +601,7 @@ void CVideoOptionsDlg::OnAbout() void CVideoOptionsDlg::OnSelchangeCompressors() { - RefreshCompressorButtons(); + //RefreshCompressorButtons(); } // Ver 1.2 @@ -691,7 +666,7 @@ void CVideoOptionsDlg::OnConfigure() void CVideoOptionsDlg::OnCancel() { - CDialog::OnCancel(); + CDialogEx::OnCancel(); } void CVideoOptionsDlg::OnAuto() @@ -736,3 +711,4 @@ void CVideoOptionsDlg::OnBnClickedOk() // TODO: Add your control notification handler code here OnOK(); } + diff --git a/CamStudioRecorder/VideoOptionsDlg.h b/CamStudioRecorder/VideoOptionsDlg.h index a803225f..a14ea462 100644 --- a/CamStudioRecorder/VideoOptionsDlg.h +++ b/CamStudioRecorder/VideoOptionsDlg.h @@ -2,10 +2,11 @@ #include "profile.h" -class CVideoOptionsDlg : public CDialog +class CVideoOptionsDlg : public CDialogEx { - explicit CVideoOptionsDlg(CWnd *pParent = nullptr); + DECLARE_DYNAMIC(CVideoOptionsDlg) public: + explicit CVideoOptionsDlg(CWnd *pParent = nullptr); CVideoOptionsDlg(const sVideoOpts &cOpts, CWnd *pParent = nullptr); const sVideoOpts &Opts() const @@ -13,7 +14,6 @@ class CVideoOptionsDlg : public CDialog return m_cOpts; } - void RefreshCompressorButtons(); void RefreshAutoOptions(); void UpdateAdjustSliderVal(); @@ -21,13 +21,10 @@ class CVideoOptionsDlg : public CDialog void DDV_CaptureInterval(CDataExchange *pDX, int value, int minVal, int maxVal); void DDV_PlaybackRate(CDataExchange *pDX, int value, int minVal, int maxVal); - // Dialog Data - //{{AFX_DATA(CVideoOptionsDlg) - enum - { - IDD = IDD_VIDEOOPTIONS - }; - //}}AFX_DATA + +#ifdef AFX_DESIGN_TIME + enum {IDD = IDD_VIDEOOPTIONS}; +#endif // Overrides // ClassWizard generated virtual function overrides @@ -55,16 +52,13 @@ class CVideoOptionsDlg : public CDialog private: sVideoOpts m_cOpts; CComboBox m_ctrlCBCompressor; - CSliderCtrl m_ctrlSliderQuality; - CStatic m_ctrlStaticQuality; - CEdit m_ctrlEditKeyFrameInterval; + //CSliderCtrl m_ctrlSliderQuality; + //CEdit m_ctrlEditKeyFrameInterval; CEdit m_ctrlEdiPlaybackRate; CButton m_ctrlButtonAutoAdjust; CButton m_ctrlButtonLock; CSliderCtrl m_ctrlSliderAdjust; - CEdit m_ctrlEditCaptureInterval; - CButton m_ctrlButtonAbout; - CButton m_ctrlButtonConfigure; + //CEdit m_ctrlEditCaptureInterval; CButton m_ctrlButtonInfo; CBitmap m_bInfo; CButton m_ctrlButtonRoundDown; @@ -89,6 +83,7 @@ class CVideoOptionsDlg : public CDialog public: afx_msg void OnBnClickedSupportrounddown(); afx_msg void OnBnClickedOk(); + afx_msg void OnNMCustomdrawAdjust(NMHDR *pNMHDR, LRESULT *pResult); }; //{{AFX_INSERT_LOCATION}} diff --git a/CamStudioRecorder/addons/ImageAttributes.h b/CamStudioRecorder/addons/ImageAttributes.h index eeeb7799..2bd21909 100644 --- a/CamStudioRecorder/addons/ImageAttributes.h +++ b/CamStudioRecorder/addons/ImageAttributes.h @@ -4,7 +4,7 @@ struct ImageAttributes { - ImageAttributes(ePosition pos = TOP_LEFT, ePosType posType = UNDEFINED, int xRatio = 0 , int yRatio = 0, const CString& strText = "") + ImageAttributes(ePosition pos = TOP_LEFT, ePosType posType = UNDEFINED, int xRatio = 0 , int yRatio = 0, const CString& strText = CString("")) : position(pos) , posType(posType) , xPosRatio(xRatio) diff --git a/CamStudioRecorder/addons/TextAttributes.h b/CamStudioRecorder/addons/TextAttributes.h index 7be93e03..d64d68f9 100644 --- a/CamStudioRecorder/addons/TextAttributes.h +++ b/CamStudioRecorder/addons/TextAttributes.h @@ -35,7 +35,7 @@ struct OffsetRatio struct TextAttributes { - TextAttributes(ePosition pos = TOP_LEFT, ePosType posType = UNDEFINED ,int xRatio = 0, int yRatio = 0, const CString& strText = "", COLORREF clrBackground = 0UL, COLORREF clrText = 0UL) + TextAttributes(ePosition pos = TOP_LEFT, ePosType posType = UNDEFINED ,int xRatio = 0, int yRatio = 0, const CString& strText = CString(""), COLORREF clrBackground = 0UL, COLORREF clrText = 0UL) : position(pos) , posType(posType) , xPosRatio(xRatio) diff --git a/CamStudioRecorder/capture_thread.cpp b/CamStudioRecorder/capture_thread.cpp index d9707bc4..19e341d6 100644 --- a/CamStudioRecorder/capture_thread.cpp +++ b/CamStudioRecorder/capture_thread.cpp @@ -32,6 +32,8 @@ av_video_meta cam_create_video_config(const int width, const int height, const i meta.fps = {fps, 1}; meta.preset = video::preset::ultrafast; meta.profile = video::profile::baseline; + //meta.profile = video::profile::high; + //meta.tune = video::tune::animation; meta.tune = video::tune::zerolatency; return meta; } diff --git a/CamStudioRecorder/resource.h b/CamStudioRecorder/resource.h index a3414409..aa761f3f 100644 --- a/CamStudioRecorder/resource.h +++ b/CamStudioRecorder/resource.h @@ -142,6 +142,7 @@ #define IDC_SLIDERY 1008 #define IDC_HEIGHTSLIDER 1008 #define IDC_RATESLIDER 1008 +#define IDC_VIDEO_CONTAINER_COMBO 1008 #define IDC_CUSTOMCURSOR 1009 #define IDC_STOPKEY 1010 #define IDC_FILECURSOR 1011 @@ -303,6 +304,20 @@ #define IDC_PREDEFINEDSHAPE 1290 #define IDC_COMBO3 1291 #define IDC_INPUTDEVICE 1291 +#define IDC_VIDEO_CODEC_COMBO 1291 +#define IDC_VIDEO_SOURCE_COMBO 1292 +#define IDC_CODEC_PRESET_SLIDER 1293 +#define IDC_CODEC_TUNE_COMBO 1294 +#define IDC_CODEC_PROFILE_COMBO 1295 +#define IDC_CODEC_LEVEL_COMBO_ 1296 +#define IDC_CODEC_QUALITY_CONSTANT 1297 +#define IDC_CODEC_QUALITY_BITRATE 1298 +#define IDC_CODEC_CONSTANT_QUALITY_SLIDER 1299 +#define IDC_CODEC_CONSTANT_QUALITY_LOW_LABEL 1300 +#define IDC_CODEC_CONSTANT_QUALITY_HIGH_LABEL 1301 +#define IDC_CODEC_QUALITY_BITRATE_EDIT 1302 +#define IDC_CODEC_QUALITY_VALUE 1303 +#define IDC_VIDEO_CODEC_EXTRA 1304 #define IDD_ABOUTBOX 5100 #define IDD_VIDEOOPTIONS 5101 #define IDD_GRAPHICSOPTIONS 5102 @@ -311,6 +326,7 @@ #define IDD_TRANSPARENCYRATE 5104 #define IDD_TRANSRATE 5104 #define IDD_EFFECTS_OPTIONS2 5105 +#define IDD_SETTINGS_UI 5106 #define IDR_CONTEXTEDITOBJ 5130 #define IDR_CONTEXTEDITLAYOUT 5131 #define IDR_CONTEXTVIDEO 5132 @@ -496,6 +512,7 @@ #define ID_OPTIONSLANGUAGE_FILIPINO 32948 #define ID_OPTIONS_LANGUAGE_FILIPINO 32949 #define ID_MP4 32950 +#define ID_TOOLS_SETTINGS 32951 #define IDS_STRING_NOTE 61446 #define IDS_STRING_INTERLEAVE1 61447 #define IDS_STRING_NOINPUT1 61448 @@ -641,14 +658,17 @@ #define IDS_STRING131 61588 #define IDS_STRING_GENERATING 61588 + + + // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 -#define _APS_NEXT_RESOURCE_VALUE 228 -#define _APS_NEXT_COMMAND_VALUE 32951 -#define _APS_NEXT_CONTROL_VALUE 1084 +#define _APS_NEXT_RESOURCE_VALUE 234 +#define _APS_NEXT_COMMAND_VALUE 32952 +#define _APS_NEXT_CONTROL_VALUE 1098 #define _APS_NEXT_SYMED_VALUE 102 #endif #endif diff --git a/CamStudioRecorder/targetver.h b/CamStudioRecorder/targetver.h index c0575f60..55cb2256 100644 --- a/CamStudioRecorder/targetver.h +++ b/CamStudioRecorder/targetver.h @@ -1,24 +1,17 @@ #pragma once -// The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and -// including the version specified. +//#ifndef WINVER +#define WINVER 0x0601 +//#endif -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif +//#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0601 +//#endif -#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif +//#ifndef _WIN32_WINDOWS +#define _WIN32_WINDOWS 0x0410 +//#endif -#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif +//#ifndef _WIN32_IE +#define _WIN32_IE 0x0700 +//#endif diff --git a/CamStudioRecorder/utility/make_array.h b/CamStudioRecorder/utility/make_array.h new file mode 100644 index 00000000..50c67e72 --- /dev/null +++ b/CamStudioRecorder/utility/make_array.h @@ -0,0 +1,57 @@ +/** + * Copyright(C) 2018 Steven Hoving + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program.If not, see < https://www.gnu.org/licenses/>. + */ + +#pragma once + +#include + +/* \see https://en.cppreference.com/w/cpp/experimental/make_array */ +namespace details +{ + template + struct is_ref_wrapper : std::false_type + { + }; + template + struct is_ref_wrapper> : std::true_type + { + }; + + template + using not_ref_wrapper = std::negation>>; + + template + struct return_type_helper + { + using type = D; + }; + template + struct return_type_helper : std::common_type + { + static_assert(std::conjunction_v...>, + "Types cannot contain reference_wrappers when D is void"); + }; + + template + using return_type = std::array::type, sizeof...(Types)>; +} + +template +constexpr details::return_type make_array(Types &&... t) +{ + return {std::forward(t)...}; +} \ No newline at end of file diff --git a/CamStudioRecorder/video_settings_ui.cpp b/CamStudioRecorder/video_settings_ui.cpp new file mode 100644 index 00000000..02293414 --- /dev/null +++ b/CamStudioRecorder/video_settings_ui.cpp @@ -0,0 +1,251 @@ +/** + * Copyright(C) 2018 Steven Hoving + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program.If not, see < https://www.gnu.org/licenses/>. + */ + +#include "stdafx.h" +#include "afxwinappex.h" +#include "afxdialogex.h" +#include "video_settings_ui.h" + + +IMPLEMENT_DYNAMIC(video_settings_ui, CDialogEx) + +video_settings_ui::video_settings_ui(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_SETTINGS_UI, pParent) +{ +} + +video_settings_ui::video_settings_ui(CWnd *pParent /*= nullptr*/, video_settings_model &model) + : CDialogEx(IDD_SETTINGS_UI, pParent) + , model_(&model) +{ +} + +video_settings_ui::~video_settings_ui() +{ +} + +BOOL video_settings_ui::OnInitDialog() +{ + CDialogEx::OnInitDialog(); + + const auto fps_text = std::to_wstring(model_->video_source_fps_); + video_source_fps_.SetWindowText(fps_text.c_str()); + + for (const auto video_source_name : video_source::names()) + video_source_combo_.AddString(video_source_name); + video_source_combo_.SetCurSel(model_->video_source_.get_index()); + + for (const auto video_container_name : video_container::names()) + video_container_combo_.AddString(video_container_name); + video_container_combo_.SetCurSel(model_->video_container_.get_index()); + + for (const auto video_codec_name : video_codec::names()) + video_codec_combo_.AddString(video_codec_name); + video_codec_combo_.SetCurSel(model_->video_codec_.get_index()); + + // \todo the slider needs some more work + const auto preset_max = video_codec_preset::names().size(); + codec_preset_slider_.SetRange(0, static_cast(preset_max)); + codec_preset_slider_.SetPos(model_->video_codec_.get_index()); + + for (const auto video_encoder_tune_name : video_codec_tune::names()) + video_codec_tune_.AddString(video_encoder_tune_name); + video_codec_tune_.SetCurSel(model_->video_codec_tune_.get_index()); + + for (const auto video_encoder_profile_name : video_codec_profile::names()) + video_codec_profile_.AddString(video_encoder_profile_name); + video_codec_profile_.SetCurSel(model_->video_codec_profile_.get_index()); + + for (const auto video_codec_level_name : video_codec_level::names()) + video_codec_level_.AddString(video_codec_level_name); + video_codec_level_.SetCurSel(model_->video_codec_level_.get_index()); + + if (model_->video_codec_quality_constant_) + { + _set_codec_quality_mode(codec_quality_mode::constant_quality); + /* \todo is the range based on the video encoder? */ + video_codec_constant_quality_slider_.SetRange(0, 51); + + const auto quality = *model_->video_codec_quality_constant_; + video_codec_constant_quality_slider_.SetPos(quality); + const auto quality_str = std::to_wstring(quality); + video_codec_quality_value_label_.SetWindowText(quality_str.c_str()); + } + else if (model_->video_codec_quality_bitrate_) + { + _set_codec_quality_mode(codec_quality_mode::constant_bitrate); + const auto bitrate = std::to_wstring(*model_->video_codec_quality_bitrate_); + codec_quality_bitrate_edit_.SetWindowText(bitrate.c_str()); + } + + return TRUE; +} + +void video_settings_ui::_set_codec_quality_mode(codec_quality_mode mode) +{ + if (mode != codec_quality_mode_) + { + switch (mode) + { + case codec_quality_mode::constant_quality: + codec_constant_quality_radio_.SetCheck(TRUE); + codec_constant_bitrate_radio_.SetCheck(FALSE); + video_codec_constant_quality_slider_.EnableWindow(TRUE); + code_constant_quality_low_label_.EnableWindow(TRUE); + codec_constant_quality_high_label_.EnableWindow(TRUE); + codec_quality_bitrate_edit_.EnableWindow(FALSE); + break; + case codec_quality_mode::constant_bitrate: + codec_constant_quality_radio_.SetCheck(FALSE); + codec_constant_bitrate_radio_.SetCheck(TRUE); + video_codec_constant_quality_slider_.EnableWindow(FALSE); + code_constant_quality_low_label_.EnableWindow(FALSE); + codec_constant_quality_high_label_.EnableWindow(FALSE); + codec_quality_bitrate_edit_.EnableWindow(TRUE); + break; + } + } + + codec_quality_mode_ = mode; +} + +void video_settings_ui::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); + DDX_Control(pDX, IDC_VIDEO_SOURCE_COMBO, video_source_combo_); + DDX_Control(pDX, IDC_VIDEO_CONTAINER_COMBO, video_container_combo_); + DDX_Control(pDX, IDC_VIDEO_CODEC_COMBO, video_codec_combo_); + DDX_Control(pDX, IDC_CODEC_PRESET_SLIDER, codec_preset_slider_); + DDX_Control(pDX, IDC_CODEC_TUNE_COMBO, video_codec_tune_); + DDX_Control(pDX, IDC_CODEC_PROFILE_COMBO, video_codec_profile_); + DDX_Control(pDX, IDC_CODEC_LEVEL_COMBO_, video_codec_level_); + DDX_Control(pDX, IDC_FPS, video_source_fps_); + DDX_Control(pDX, IDC_CODEC_QUALITY_CONSTANT, codec_constant_quality_radio_); + DDX_Control(pDX, IDC_CODEC_QUALITY_BITRATE, codec_constant_bitrate_radio_); + DDX_Control(pDX, IDC_CODEC_CONSTANT_QUALITY_SLIDER, video_codec_constant_quality_slider_); + DDX_Control(pDX, IDC_CODEC_CONSTANT_QUALITY_LOW_LABEL, code_constant_quality_low_label_); + DDX_Control(pDX, IDC_CODEC_CONSTANT_QUALITY_HIGH_LABEL, codec_constant_quality_high_label_); + DDX_Control(pDX, IDC_CODEC_QUALITY_BITRATE_EDIT, codec_quality_bitrate_edit_); + DDX_Control(pDX, IDC_CODEC_QUALITY_VALUE, video_codec_quality_value_label_); +} + +BEGIN_MESSAGE_MAP(video_settings_ui, CDialogEx) + ON_CBN_SELCHANGE(IDC_VIDEO_SOURCE_COMBO, &video_settings_ui::OnCbnSelchangeVideoSourceCombo) + ON_CBN_SELCHANGE(IDC_VIDEO_CONTAINER_COMBO, &video_settings_ui::OnCbnSelchangeVideoContainerCombo) + ON_CBN_SELCHANGE(IDC_VIDEO_CODEC_COMBO, &video_settings_ui::OnCbnSelchangeVideoCodecCombo) + ON_CBN_SELCHANGE(IDC_CODEC_TUNE_COMBO, &video_settings_ui::OnCbnSelchangeCodecTuneCombo) + ON_CBN_SELCHANGE(IDC_CODEC_PROFILE_COMBO, &video_settings_ui::OnCbnSelchangeCodecProfileCombo) + ON_CBN_SELCHANGE(IDC_CODEC_LEVEL_COMBO_, &video_settings_ui::OnCbnSelchangeCodecLevelCombo) + ON_NOTIFY(TRBN_THUMBPOSCHANGING, IDC_CODEC_PRESET_SLIDER, &video_settings_ui::OnTRBNThumbPosChangingCodecPresetSlider) + ON_EN_CHANGE(IDC_FPS, &video_settings_ui::OnEnChangeFps) + ON_BN_CLICKED(IDC_CODEC_QUALITY_CONSTANT, &video_settings_ui::OnBnClickedCodecQualityConstant) + ON_BN_CLICKED(IDC_CODEC_QUALITY_BITRATE, &video_settings_ui::OnBnClickedCodecQualityBitrate) + ON_NOTIFY(TRBN_THUMBPOSCHANGING, IDC_CODEC_CONSTANT_QUALITY_SLIDER, &video_settings_ui::on_pos_changed_codec_constant_quality_slider) + ON_WM_HSCROLL() +END_MESSAGE_MAP() + + +// video_settings_ui message handlers + +void video_settings_ui::OnEnChangeFps() +{ + wchar_t fps_text[10] = {}; + video_source_fps_.GetWindowText(fps_text, 10); + const auto fps = std::stoi(fps_text); + + model_->video_source_fps_ = fps; +} + +void video_settings_ui::OnCbnSelchangeVideoSourceCombo() +{ + const auto index = video_source_combo_.GetCurSel(); + model_->video_source_.set_index(static_cast(index)); +} + +void video_settings_ui::OnCbnSelchangeVideoContainerCombo() +{ + const auto index = video_container_combo_.GetCurSel(); + model_->video_container_.set_index(static_cast(index)); +} + +void video_settings_ui::OnCbnSelchangeVideoCodecCombo() +{ + const auto index = video_codec_combo_.GetCurSel(); + model_->video_codec_.set_index(static_cast(index)); +} + +void video_settings_ui::OnCbnSelchangeCodecTuneCombo() +{ + const auto index = video_codec_tune_.GetCurSel(); + model_->video_codec_tune_.set_index(static_cast(index)); +} + +void video_settings_ui::OnCbnSelchangeCodecProfileCombo() +{ + const auto index = video_codec_profile_.GetCurSel(); + model_->video_codec_profile_.set_index(static_cast(index)); +} + +void video_settings_ui::OnCbnSelchangeCodecLevelCombo() +{ + const auto index = video_codec_level_.GetCurSel(); + model_->video_codec_level_.set_index(static_cast(index)); +} + + + +void video_settings_ui::OnBnClickedCodecQualityConstant() +{ + _set_codec_quality_mode(codec_quality_mode::constant_quality); +} + +void video_settings_ui::OnBnClickedCodecQualityBitrate() +{ + _set_codec_quality_mode(codec_quality_mode::constant_bitrate); +} + +void video_settings_ui::OnTRBNThumbPosChangingCodecPresetSlider(NMHDR *pNMHDR, LRESULT *pResult) +{ + NMTRBTHUMBPOSCHANGING *pNMTPC = reinterpret_cast(pNMHDR); + const auto index = pNMTPC->dwPos; + model_->video_encoder_preset_.set_index(static_cast(index)); + *pResult = 0; +} + +void video_settings_ui::on_pos_changed_codec_constant_quality_slider(NMHDR *pNMHDR, LRESULT *pResult) +{ + NMTRBTHUMBPOSCHANGING *pNMTPC = reinterpret_cast(pNMHDR); + const auto index = pNMTPC->dwPos; + const auto index_text = std::to_wstring(index); + model_->video_codec_quality_constant_ = index; + video_codec_quality_value_label_.SetWindowText(index_text.c_str()); + *pResult = 0; +} + +//void video_settings_ui::OnNMReleasedcaptureCodecConstantQualitySlider(NMHDR *pNMHDR, LRESULT *pResult) +//{ +// // TODO: Add your control notification handler code here +// *pResult = 0; +//} + + +void video_settings_ui::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar); +} diff --git a/CamStudioRecorder/video_settings_ui.h b/CamStudioRecorder/video_settings_ui.h new file mode 100644 index 00000000..1dd0c8fa --- /dev/null +++ b/CamStudioRecorder/video_settings_ui.h @@ -0,0 +1,359 @@ +/** + * Copyright(C) 2018 Steven Hoving + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program.If not, see < https://www.gnu.org/licenses/>. + */ + +#pragma once + +#include "utility/make_array.h" +#include +#include +#include + +class video_source +{ +public: + enum type {gdi, desktop_duplication}; + + static const auto &names() + { + static const auto type_names = make_array(L"GDI", L"Desktop Duplication"); + return type_names; + } + + video_source(type new_type) : type_(new_type) {} + int get_index() const { return type_; } + void set_index(const type new_type) { type_ = new_type; } + +private: + type type_; +}; + +class video_container +{ +public: + enum type{mkv, mp4, avi}; + + static const auto &names() + { + static const auto type_names = make_array(L"MKV", L"MP4", L"AVI"); + return type_names; + } + + video_container(type new_type) : type_(new_type){} + int get_index() const { return type_; } + void set_index(const type new_type) { type_ = new_type; } +private: + type type_; +}; + +class video_codec +{ +public: + enum type{x264, camstudio}; + static const auto &names() + { + static const auto type_names = make_array(L"H.264 (x264)", L"CamStudio"); + return type_names; + } + + video_codec(type new_type) : type_(new_type){} + int get_index() const{return type_;} + void set_index(const type new_type){type_ = new_type;} +private: + type type_; +}; + +class video_codec_preset +{ +public: + enum type + { + ultrafast, + superfast, + veryfast, + faster, + fast, + medium, // default preset + slow, + slower, + veryslow, + }; + static const auto &names() + { + static const auto type_names = make_array( + L"Ultrafast", + L"Superfast", + L"Veryfast", + L"Faster", + L"Fast", + L"Medium", + L"Slow", + L"Slower", + L"Veryslow"); + return type_names; + } + + video_codec_preset(type new_type) + : type_(new_type) + { + } + int get_index() const + { + return type_; + } + void set_index(const type new_type) + { + type_ = new_type; + } + +private: + type type_; +}; + +class video_codec_tune +{ +public: + enum type + { + none, // no tune specified + film, // use for high quality movie content; lowers deblocking + animation, // good for cartoons; uses higher deblocking and more reference frames + grain, // preserves the grain structure in old, grainy film material + stillimage, // good for slideshow-like content + fastdecode, // allows faster decoding by disabling certain filters + zerolatency, // good for fast encoding and low-latency streaming + }; + static const auto &names() + { + static const auto type_names = make_array( + L"None", + L"Film", + L"Animation", + L"Grain", + L"Still Image", + L"Fast Decode", + L"Zero Latency" + ); + return type_names; + } + + video_codec_tune(type new_type) + : type_(new_type) + { + } + int get_index() const + { + return type_; + } + void set_index(const type new_type) + { + type_ = new_type; + } + +private: + type type_; +}; + +class video_codec_profile +{ +public: + enum type + { + none, // no profile specified + baseline, + main, + high, + high10, + high422, + high444 + }; + static const auto &names() + { + static const auto type_names = + make_array( + L"Auto", + L"Baseline", + L"Main", + L"High", + L"High10", + L"High422", + L"High444" + ); + return type_names; + } + + video_codec_profile(type new_type) + : type_(new_type) + { + } + int get_index() const + { + return type_; + } + void set_index(const type new_type) + { + type_ = new_type; + } + +private: + type type_; +}; + +class video_codec_level +{ +public: + enum type + { + none, + level1_0, + level1_b, + level1_1, + level1_2, + level2_0, + level2_1, + level2_2, + level3_0, + level3_1, + level3_2, + level4_0, + level4_1, + level4_2, + level5_0, + level5_1, + level5_2, + }; + static const auto &names() + { + static const auto type_names = make_array( + L"Auto", + L"1.0", + L"1b", + L"1.1", + L"1.2", + L"2.0", + L"2.1", + L"2.2", + L"3.0", + L"3.1", + L"3.2", + L"4.0", + L"4.1", + L"4.2", + L"5.0", + L"5.1", + L"5.2"); + return type_names; + } + + video_codec_level(type new_type) + : type_(new_type) + { + } + int get_index() const + { + return type_; + } + void set_index(const type new_type) + { + type_ = new_type; + } + +private: + type type_; +}; + +class video_settings_model +{ +public: + video_source video_source_{video_source::type::gdi}; + int video_source_fps_{30}; // this is heavily depending on the source and the OS. + video_container video_container_{video_container::type::mkv}; + video_codec video_codec_{video_codec::type::x264}; + video_codec_preset video_encoder_preset_{video_codec_preset::type::ultrafast}; + video_codec_tune video_codec_tune_{video_codec_tune::type::none}; + video_codec_profile video_codec_profile_{video_codec_profile::type::none}; + video_codec_level video_codec_level_{video_codec_level::type::none}; + std::optional video_codec_quality_bitrate_{}; + std::optional video_codec_quality_constant_{27}; +}; + +class video_settings_ui : public CDialogEx +{ + DECLARE_DYNAMIC(video_settings_ui) + +public: + video_settings_ui(CWnd* pParent = nullptr); + video_settings_ui(CWnd* pParent, video_settings_model &model); + + virtual ~video_settings_ui(); + + BOOL OnInitDialog() override; + + // hack for now not following MVP or MVC + video_settings_model *model_{nullptr}; + +// Dialog Data +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_SETTINGS_UI }; +#endif + +private: + enum class codec_quality_mode + { + constant_quality, + constant_bitrate // actually average bitrate... but you get the point + }; + + codec_quality_mode codec_quality_mode_; + + void _set_codec_quality_mode(codec_quality_mode mode); + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + DECLARE_MESSAGE_MAP() +private: + CEdit video_source_fps_; + CComboBox video_source_combo_; + CComboBox video_container_combo_; + CComboBox video_codec_combo_; + CComboBox video_codec_tune_; + CComboBox video_codec_profile_; + CComboBox video_codec_level_; + CSliderCtrl codec_preset_slider_; + CButton codec_constant_quality_radio_; + CButton codec_constant_bitrate_radio_; + CSliderCtrl video_codec_constant_quality_slider_; + CStatic code_constant_quality_low_label_; + CStatic codec_constant_quality_high_label_; + CEdit codec_quality_bitrate_edit_; + CStatic video_codec_quality_value_label_; +public: + afx_msg void OnCbnSelchangeVideoSourceCombo(); + afx_msg void OnCbnSelchangeVideoContainerCombo(); + afx_msg void OnCbnSelchangeVideoCodecCombo(); + afx_msg void OnCbnSelchangeCodecTuneCombo(); + afx_msg void OnCbnSelchangeCodecProfileCombo(); + afx_msg void OnCbnSelchangeCodecLevelCombo(); + afx_msg void OnTRBNThumbPosChangingCodecPresetSlider(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnEnChangeFps(); + afx_msg void OnBnClickedCodecQualityConstant(); + afx_msg void OnBnClickedCodecQualityBitrate(); + afx_msg void on_pos_changed_codec_constant_quality_slider(NMHDR *pNMHDR, LRESULT *pResult); +// afx_msg void OnNMReleasedcaptureCodecConstantQualitySlider(NMHDR *pNMHDR, LRESULT *pResult); +// afx_msg void OnNMReleasedcaptureCodecConstantQualitySlider(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); +};