<commit_before>#include "stdafx.h"
#include <iostream>

#include "SettingsUI.h"
#include "SettingsSheet.h"

#include "About.h"
#include "Display.h"
#include "General.h"
#include "Hotkeys.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

BEGIN_MESSAGE_MAP(CSettingsUIApp, CWinApp)

END_MESSAGE_MAP()

CSettingsUIApp::CSettingsUIApp() {

}

CSettingsUIApp theApp;

BOOL CSettingsUIApp::InitInstance() {
    _mutex = CreateMutex(NULL, FALSE, L"Local\\3RVX-Settings");
    if (GetLastError() == ERROR_ALREADY_EXISTS) {
        if (_mutex) {
            ReleaseMutex(_mutex);
        }

        SendMessage(HWND_BROADCAST, WM_3RVX_SETTINGSCTRL, NULL, NULL);
        return FALSE;
    }


    /* InitCommonControlsEx() is required on Windows XP if an application
     * manifest specifies use of ComCtl32.dll version 6 or later to enable
     * visual styles.  Otherwise, any window creation will fail. */
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();

    /* Create the shell manager, in case the dialog contains any shell tree
     * view or shell list view controls. */
    CShellManager *pShellManager = new CShellManager;

    /* Activate "Windows Native" visual manager for enabling themes in MFC
     * controls */
    CMFCVisualManager::SetDefaultManager(
        RUNTIME_CLASS(CMFCVisualManagerWindows));

    SetRegistryKey(_T("3RVX Settings Editor"));

    SettingsSheet settingsSheet(L"3RVX Settings");
    General g;
    Display d;
    Hotkeys h;
    About a;

    UIUtils::pages.push_back(&g);
    UIUtils::pages.push_back(&d);
    UIUtils::pages.push_back(&h);
    UIUtils::pages.push_back(&a);

    for (CPropertyPage *page : UIUtils::pages) {
        settingsSheet.AddPage(page);
    }

    /* Disable help for the PropertySheet and its pages */
    settingsSheet.m_psh.dwFlags &= ~(PSH_HASHELP);
    for (int i = 0; i < settingsSheet.GetPageCount(); ++i) {
        CPropertyPage *page = settingsSheet.GetPage(i);
        page->m_psp.dwFlags &= ~(PSP_HASHELP);
    }

    m_pMainWnd = &settingsSheet;
    INT_PTR nResponse = settingsSheet.DoModal();

    if (nResponse == -1) {<commit_msg>Fix SettingsUI settings load bug<commit_after>#include "stdafx.h"
#include <iostream>

#include "Settings.h"
#include "SettingsUI.h"
#include "SettingsSheet.h"

#include "About.h"
#include "Display.h"
#include "General.h"
#include "Hotkeys.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

BEGIN_MESSAGE_MAP(CSettingsUIApp, CWinApp)

END_MESSAGE_MAP()

CSettingsUIApp::CSettingsUIApp() {

}

CSettingsUIApp theApp;

BOOL CSettingsUIApp::InitInstance() {
    _mutex = CreateMutex(NULL, FALSE, L"Local\\3RVX-Settings");
    if (GetLastError() == ERROR_ALREADY_EXISTS) {
        if (_mutex) {
            ReleaseMutex(_mutex);
        }

        SendMessage(HWND_BROADCAST, WM_3RVX_SETTINGSCTRL, NULL, NULL);
        return FALSE;
    }


    /* InitCommonControlsEx() is required on Windows XP if an application
     * manifest specifies use of ComCtl32.dll version 6 or later to enable
     * visual styles.  Otherwise, any window creation will fail. */
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();

    /* Create the shell manager, in case the dialog contains any shell tree
     * view or shell list view controls. */
    CShellManager *pShellManager = new CShellManager;

    /* Activate "Windows Native" visual manager for enabling themes in MFC
     * controls */
    CMFCVisualManager::SetDefaultManager(
        RUNTIME_CLASS(CMFCVisualManagerWindows));

    SetRegistryKey(_T("3RVX Settings Editor"));

    Settings::Instance()->Load();

    SettingsSheet settingsSheet(L"3RVX Settings");
    General g;
    Display d;
    Hotkeys h;
    About a;

    UIUtils::pages.push_back(&g);
    UIUtils::pages.push_back(&d);
    UIUtils::pages.push_back(&h);
    UIUtils::pages.push_back(&a);

    for (CPropertyPage *page : UIUtils::pages) {
        settingsSheet.AddPage(page);
    }

    /* Disable help for the PropertySheet and its pages */
    settingsSheet.m_psh.dwFlags &= ~(PSH_HASHELP);
    for (int i = 0; i < settingsSheet.GetPageCount(); ++i) {
        CPropertyPage *page = settingsSheet.GetPage(i);
        page->m_psp.dwFlags &= ~(PSP_HASHELP);
    }

    m_pMainWnd = &settingsSheet;
    INT_PTR nResponse = settingsSheet.DoModal();

    if (nResponse == -1) {
{'fraction_non_alphanumeric': 0.11308739569609134, 'fraction_numerical': 0.004830917874396135, 'mean_word_length': 3.568706118355065, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5686440', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1471, 'n_words': 347}