diff --git a/docs/API/knut/cppdocument.md b/docs/API/knut/cppdocument.md index 786758af..de8ecc2d 100644 --- a/docs/API/knut/cppdocument.md +++ b/docs/API/knut/cppdocument.md @@ -29,7 +29,7 @@ Inherited properties: [CodeDocument properties](../knut/codedocument.md#properti |string |**[correspondingHeaderSource](#correspondingHeaderSource)**()| |void |**[deleteMethod](#deleteMethod)**()| |void |**[deleteMethod](#deleteMethod)**(string methodName)| -|void |**[deleteMethod](#deleteMethod)**(string method, string signature)| +|void |**[deleteMethod](#deleteMethod)**(string methodName, string signature)| |int |**[gotoBlockEnd](#gotoBlockEnd)**(int count)| |int |**[gotoBlockStart](#gotoBlockStart)**(int count)| ||**[insertCodeInMethod](#insertCodeInMethod)**(string methodName, string code, Position insertAt)| @@ -142,9 +142,9 @@ Therefore, all overloads of the function will be deleted. Also see: CppDocument::deleteMethod(string methodName, string signature) -#### void **deleteMethod**(string method, string signature) +#### void **deleteMethod**(string methodName, string signature) -Delete the method or function with the specified `method` and optional `signature`. +Delete the method or function with the specified `methodName` and `signature`. The method definition/declaration will be deleted from the current file, as well as the corresponding header/source file. References to the method will not be deleted. diff --git a/docs/API/knut/textdocument.md b/docs/API/knut/textdocument.md index 2d427f03..049b8c53 100644 --- a/docs/API/knut/textdocument.md +++ b/docs/API/knut/textdocument.md @@ -91,7 +91,6 @@ Inherited properties: [Document properties](../knut/document.md#properties) ||**[selectPreviousLine](#selectPreviousLine)**(int count = 1)| ||**[selectPreviousWord](#selectPreviousWord)**(int count = 1)| ||**[selectRange](#selectRange)**([RangeMark](../knut/rangemark.md) range)| -||**[selectRangeMark](#selectRangeMark)**([RangeMark](../knut/rangemark.md) mark)| ||**[selectRegion](#selectRegion)**(int from, int to)| ||**[selectStartOfLine](#selectStartOfLine)**(int count = 1)| ||**[selectStartOfWord](#selectStartOfWord)**()| @@ -475,11 +474,6 @@ Selects the previous word, repeat the operation `count` times. Selects the range passed in parameter. -#### **selectRangeMark**([RangeMark](../knut/rangemark.md) mark) - -Selects the text defined by the range make `mark`. - - #### **selectRegion**(int from, int to) Selects the text between `from` and `to` positions. diff --git a/src/core/cppdocument.cpp b/src/core/cppdocument.cpp index 3bd23545..b5662c78 100644 --- a/src/core/cppdocument.cpp +++ b/src/core/cppdocument.cpp @@ -1594,9 +1594,9 @@ void CppDocument::deleteMethodLocal(const QString &methodName, const QString &si } /*! - * \qmlmethod void CppDocument::deleteMethod(string method, string signature) + * \qmlmethod void CppDocument::deleteMethod(string methodName, string signature) * - * Delete the method or function with the specified `method` and optional `signature`. + * Delete the method or function with the specified `methodName` and `signature`. * The method definition/declaration will be deleted from the current file, * as well as the corresponding header/source file. * References to the method will not be deleted. @@ -1618,16 +1618,16 @@ void CppDocument::deleteMethodLocal(const QString &methodName, const QString &si * * If an empty string is provided as the `signature`, all overloads of the function are deleted as well. */ -void CppDocument::deleteMethod(const QString &method, const QString &signature) +void CppDocument::deleteMethod(const QString &methodName, const QString &signature) { - LOG(method, signature); + LOG(methodName, signature); QString headerSourceName = correspondingHeaderSource(); if (!headerSourceName.isEmpty()) { auto headerSource = qobject_cast(Project::instance()->get(headerSourceName)); - headerSource->deleteMethodLocal(method, signature); + headerSource->deleteMethodLocal(methodName, signature); } - deleteMethodLocal(method, signature); + deleteMethodLocal(methodName, signature); } /*! diff --git a/src/core/rcdocument.cpp b/src/core/rcdocument.cpp index 244b6d35..d7f31fe1 100644 --- a/src/core/rcdocument.cpp +++ b/src/core/rcdocument.cpp @@ -422,12 +422,12 @@ QString extractStringForDialog(const RcCore::Data::Dialog *dialog, const QString if (dialog) { const auto control = findControlWithId(dialog, id); if (!control) { - spdlog::warn("{}: control from id {} does not exist in the rc file.", FUNCTION_NAME, id); + spdlog::warn("{}: control from id \"{}\" does not exist in the rc file.", FUNCTION_NAME, id); return {}; } return control.value().text; } else { - spdlog::warn("{}: id {} does not exist in the rc file.", FUNCTION_NAME, id); + spdlog::warn("{}: id \"{}\" does not exist in the rc file.", FUNCTION_NAME, id); return {}; } } diff --git a/src/core/textdocument.cpp b/src/core/textdocument.cpp index 226995c6..d9b97b04 100644 --- a/src/core/textdocument.cpp +++ b/src/core/textdocument.cpp @@ -833,7 +833,11 @@ void TextDocument::selectRegion(int from, int to) void TextDocument::selectRange(const RangeMark &range) { LOG(range); - selectRegion(range.start(), range.end()); + if (range.document() != this) { + spdlog::error("{}: Can't use a range mark from another editor.", FUNCTION_NAME); + return; + } + range.select(); } /*! @@ -1017,11 +1021,11 @@ void TextDocument::deleteRegion(int from, int to) void TextDocument::deleteRange(const RangeMark &range) { LOG(range); - QTextCursor cursor(m_document->document()); - cursor.setPosition(range.start(), QTextCursor::MoveAnchor); - cursor.setPosition(range.end(), QTextCursor::KeepAnchor); - cursor.removeSelectedText(); - m_document->setTextCursor(cursor); + if (range.document() != this) { + spdlog::error("{}: Can't use a range mark from another editor.", FUNCTION_NAME); + return; + } + range.remove(); } /*! @@ -1185,25 +1189,6 @@ Core::RangeMark TextDocument::createRangeMark() LOG_RETURN("rangeMark", createRangeMark(start, end)); } -/** - * \qmlmethod TextDocument::selectRangeMark(RangeMark mark) - * - * Selects the text defined by the range make `mark`. - * - * \sa RangeMark - */ -void TextDocument::selectRangeMark(const Core::RangeMark &mark) -{ - LOG(LOG_ARG("mark", mark)); - - if (mark.document() != this) { - spdlog::error("{}: Can't use a range mark from another editor.", FUNCTION_NAME); - return; - } - - mark.select(); -} - /*! * \qmlmethod bool TextDocument::find(string text, int options = TextDocument.NoFindFlags) * Searches the string `text` in the editor. Options could be a combination of: diff --git a/src/core/textdocument.h b/src/core/textdocument.h index 29270f94..66914862 100644 --- a/src/core/textdocument.h +++ b/src/core/textdocument.h @@ -142,16 +142,13 @@ public slots: void paste(); void cut(); - // Text handling - void remove(int length); + // Insertion void insert(const QString &text); void insertAtLine(const QString &text, int line = -1); void insertAtPosition(const QString &text, int pos); - void replace(int length, const QString &text); - void replace(int from, int to, const QString &text); - void replace(const Core::RangeMark &range, const QString &text); // Deletion + void remove(int length); void deleteLine(int line = -1); void deleteSelection(); void deleteEndOfLine(); @@ -171,7 +168,6 @@ public slots: // RangeMark Core::RangeMark createRangeMark(int from, int to); Core::RangeMark createRangeMark(); - void selectRangeMark(const Core::RangeMark &mark); // Find bool find(const QString &text, int options = NoFindFlags); @@ -179,6 +175,9 @@ public slots: QString match(const QString ®exp, int options = NoFindFlags); // Replace + void replace(int length, const QString &text); + void replace(int from, int to, const QString &text); + void replace(const Core::RangeMark &range, const QString &text); bool replaceOne(const QString &before, const QString &after, int options = NoFindFlags); int replaceAll(const QString &before, const QString &after, int options = NoFindFlags); int replaceAllInRange(const QString &before, const QString &after, const Core::RangeMark &range, diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index e62c5e53..80199034 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -276,27 +276,20 @@ MainWindow::MainWindow(QWidget *parent) updateScriptActions(); } -static void actionsFromMenu(QMenu *menu, QList &actions) -{ - const auto &menuActions = menu->actions(); - for (QAction *action : menuActions) { - if (action->isSeparator()) - continue; - else if (action->menu()) { - if (action->menu()->objectName() == "recentProjectsMenu") - continue; - actionsFromMenu(action->menu(), actions); - } else - actions.push_back(action); - } -} - QList MainWindow::menuActions() const { QList actions; - const auto &menus = menuBar()->findChildren(); - for (QMenu *menu : menus) - actionsFromMenu(menu, actions); + const auto &actionMenus = menuBar()->actions(); + for (auto action : actionMenus) { + if (action->menu()) { + const auto acts = action->menu()->actions(); + for (const auto ¤tAction : acts) { + if (!currentAction->text().isEmpty()) { + actions.append(currentAction); + } + } + } + } actions.append(QMainWindow::actions()); return actions; } diff --git a/src/gui/optionsdialog.ui b/src/gui/optionsdialog.ui index 2d2f4f7c..c60dc390 100644 --- a/src/gui/optionsdialog.ui +++ b/src/gui/optionsdialog.ui @@ -568,6 +568,9 @@ + + false + true diff --git a/src/rccore/rc_convert.cpp b/src/rccore/rc_convert.cpp index c3744984..f2945179 100644 --- a/src/rccore/rc_convert.cpp +++ b/src/rccore/rc_convert.cpp @@ -226,7 +226,7 @@ static Widget convertCheckBox(const Data &data, Data::Control &control) return widget; } -// TODO +// https://learn.microsoft.com/en-us/windows/desktop/menurc/combobox-control static Widget convertComboBox(const Data &data, const QString &dialogId, Data::Control &control) { Widget widget; diff --git a/src/rccore/rc_parse.cpp b/src/rccore/rc_parse.cpp index 05f82d4d..1b0e0a57 100644 --- a/src/rccore/rc_parse.cpp +++ b/src/rccore/rc_parse.cpp @@ -70,12 +70,13 @@ static QHash loadResourceFile(const QString &resourceFile) QTextStream stream(&file); QHash resourceMap; + static QRegularExpression empty_spaces("\\s+"); while (!stream.atEnd()) { const QString line = stream.readLine(); if (!line.startsWith("#define")) continue; - QStringList fields = line.split(' ', Qt::SkipEmptyParts); + QStringList fields = line.split(empty_spaces, Qt::SkipEmptyParts); if (fields.size() < 3) continue; const auto &value = fields.at(1); diff --git a/test_data/projects/mfc-dialog/Tutorial.cpp b/test_data/projects/mfc-dialog/Tutorial.cpp new file mode 100644 index 00000000..1877b81b --- /dev/null +++ b/test_data/projects/mfc-dialog/Tutorial.cpp @@ -0,0 +1,92 @@ + +// Tutorial.cpp : Defines the class behaviors for the application. +// + +#include "pch.h" +#include "framework.h" +#include "Tutorial.h" +#include "TutorialDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CTutorialApp + +BEGIN_MESSAGE_MAP(CTutorialApp, CWinApp) + ON_COMMAND(ID_HELP, &CWinApp::OnHelp) +END_MESSAGE_MAP() + + +// CTutorialApp construction + +CTutorialApp::CTutorialApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + + +// The one and only CTutorialApp object + +CTutorialApp theApp; + + +// CTutorialApp initialization + +BOOL CTutorialApp::InitInstance() +{ + 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)); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need + // Change the registry key under which our settings are stored + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + CTutorialDlg dlg; + m_pMainWnd = &dlg; + INT_PTR nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + else if (nResponse == -1) + { + TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n"); + TRACE(traceAppMsg, 0, "Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n"); + } + + // Delete the shell manager created above. + if (pShellManager != nullptr) + { + delete pShellManager; + } + +#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS) + ControlBarCleanUp(); +#endif + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} + diff --git a/test_data/projects/mfc-dialog/Tutorial.h b/test_data/projects/mfc-dialog/Tutorial.h new file mode 100644 index 00000000..dac74f48 --- /dev/null +++ b/test_data/projects/mfc-dialog/Tutorial.h @@ -0,0 +1,32 @@ + +// Tutorial.h : main header file for the PROJECT_NAME application +// + +#pragma once + +#ifndef __AFXWIN_H__ + #error "include 'pch.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + + +// CTutorialApp: +// See Tutorial.cpp for the implementation of this class +// + +class CTutorialApp : public CWinApp +{ +public: + CTutorialApp(); + +// Overrides +public: + virtual BOOL InitInstance(); + +// Implementation + + DECLARE_MESSAGE_MAP() +}; + +extern CTutorialApp theApp; diff --git a/test_data/projects/mfc-dialog/Tutorial.rc b/test_data/projects/mfc-dialog/Tutorial.rc new file mode 100644 index 00000000..ece506d8 Binary files /dev/null and b/test_data/projects/mfc-dialog/Tutorial.rc differ diff --git a/test_data/projects/mfc-dialog/TutorialDlg.cpp b/test_data/projects/mfc-dialog/TutorialDlg.cpp new file mode 100644 index 00000000..1c7fc39c --- /dev/null +++ b/test_data/projects/mfc-dialog/TutorialDlg.cpp @@ -0,0 +1,140 @@ + +// TutorialDlg.cpp : implementation file +// + +#include "pch.h" +#include "framework.h" +#include "Tutorial.h" +#include "TutorialDlg.h" +#include "afxdialogex.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CTutorialDlg dialog + + + +CTutorialDlg::CTutorialDlg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_TUTORIAL_DIALOG, pParent) + , m_check(FALSE) + , m_message(_T("")) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); +} + +void CTutorialDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); + DDX_Check(pDX, IDC_CHECK1, m_check); + DDV_MaxChars(pDX, m_message, 3); // added for testing DDV_ doesn't break extraction! + DDX_Control(pDX, IDC_EDIT1, m_edit); + DDX_Control(pDX, IDC_COMBO1, m_combo); + DDX_Control(pDX, IDC_SLIDER1, m_slider); + DDX_Text(pDX, IDC_MESSAGE, m_message); +} + +BEGIN_MESSAGE_MAP(CTutorialDlg, CDialogEx) + ON_WM_PAINT() +// ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_CHECK1, &CTutorialDlg::OnBnClickedCheck1) + ON_EN_CHANGE(IDC_EDIT1, &CTutorialDlg::OnEnChangeEdit1) + ON_CBN_SELCHANGE(IDC_COMBO1, &CTutorialDlg::OnCbnSelchangeCombo1) + ON_WM_HSCROLL() + ON_WM_TIMER() +END_MESSAGE_MAP() + + +// CTutorialDlg message handlers + +BOOL CTutorialDlg::OnInitDialog() +{ + CDialogEx::OnInitDialog(); + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // TODO: Add extra initialization here + + return TRUE; // return TRUE unless you set the focus to a control +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CTutorialDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialogEx::OnPaint(); + } +} + +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +//HCURSOR CTutorialDlg::OnQueryDragIcon() +//{ +// return static_cast(m_hIcon); +//} + + + +void CTutorialDlg::OnBnClickedCheck1() +{ + // TODO: Add your control notification handler code here +} + + +void CTutorialDlg::OnEnChangeEdit1() +{ + // TODO: If this is a RICHEDIT control, the control will not + // send this notification unless you override the CDialogEx::OnInitDialog() + // function and call CRichEditCtrl().SetEventMask() + // with the ENM_CHANGE flag ORed into the mask. + + // TODO: Add your control notification handler code here +} + + +void CTutorialDlg::OnCbnSelchangeCombo1() +{ + // TODO: Add your control notification handler code here +} + + +void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar); +} + + +void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) +{ + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnTimer(nIDEvent); +} diff --git a/test_data/projects/mfc-dialog/TutorialDlg.h b/test_data/projects/mfc-dialog/TutorialDlg.h new file mode 100644 index 00000000..075dcc42 --- /dev/null +++ b/test_data/projects/mfc-dialog/TutorialDlg.h @@ -0,0 +1,45 @@ + +// TutorialDlg.h : header file +// + +#pragma once + + +/// Main dialog for the sample application. This is created and displayed in +/// the CTutorialApp::InitInstance function. +class CTutorialDlg : public CDialogEx +{ +// Construction +public: + CTutorialDlg(CWnd* pParent = nullptr); // standard constructor + +// Dialog Data +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_TUTORIAL_DIALOG }; +#endif + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + +// Implementation +protected: + HICON m_hIcon; + + // Generated message map functions + virtual BOOL OnInitDialog(); + afx_msg void OnPaint(); +// afx_msg HCURSOR OnQueryDragIcon(); + DECLARE_MESSAGE_MAP() +public: + BOOL m_check; + CEdit m_edit; + CComboBox m_combo; + CSliderCtrl m_slider; + CString m_message; + afx_msg void OnBnClickedCheck1(); + afx_msg void OnEnChangeEdit1(); + afx_msg void OnCbnSelchangeCombo1(); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + afx_msg void OnTimer(UINT_PTR nIDEvent); +}; diff --git a/test_data/projects/mfc-dialog/framework.h b/test_data/projects/mfc-dialog/framework.h new file mode 100644 index 00000000..b25aff0c --- /dev/null +++ b/test_data/projects/mfc-dialog/framework.h @@ -0,0 +1,39 @@ +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +#include "targetver.h" + +#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 + + + + + +#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 + +#include // MFC support for ribbons and control bars + + + + + + + + + + + diff --git a/test_data/projects/mfc-dialog/pch.cpp b/test_data/projects/mfc-dialog/pch.cpp new file mode 100644 index 00000000..64b7eef6 --- /dev/null +++ b/test_data/projects/mfc-dialog/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/test_data/projects/mfc-dialog/pch.h b/test_data/projects/mfc-dialog/pch.h new file mode 100644 index 00000000..885d5d62 --- /dev/null +++ b/test_data/projects/mfc-dialog/pch.h @@ -0,0 +1,13 @@ +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here +#include "framework.h" + +#endif //PCH_H diff --git a/test_data/rcfiles/2048Game/res/2048Game.ico b/test_data/projects/mfc-dialog/res/Tutorial.ico similarity index 100% rename from test_data/rcfiles/2048Game/res/2048Game.ico rename to test_data/projects/mfc-dialog/res/Tutorial.ico diff --git a/test_data/projects/mfc-dialog/res/Tutorial.rc2 b/test_data/projects/mfc-dialog/res/Tutorial.rc2 new file mode 100644 index 00000000..dad199e7 Binary files /dev/null and b/test_data/projects/mfc-dialog/res/Tutorial.rc2 differ diff --git a/test_data/projects/mfc-dialog/resource.h b/test_data/projects/mfc-dialog/resource.h new file mode 100644 index 00000000..24b7005c --- /dev/null +++ b/test_data/projects/mfc-dialog/resource.h @@ -0,0 +1,22 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Tutorial.rc +// +#define IDD_TUTORIAL_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDC_CHECK1 1000 +#define IDC_EDIT1 1001 +#define IDC_COMBO1 1002 +#define IDC_SLIDER1 1003 +#define IDC_MESSAGE 1004 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1005 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/test_data/projects/mfc-dialog/targetver.h b/test_data/projects/mfc-dialog/targetver.h new file mode 100644 index 00000000..87c0086d --- /dev/null +++ b/test_data/projects/mfc-dialog/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/test_data/projects/mfc-tutorial/MFC_UpdateGUI.rc b/test_data/projects/mfc-tutorial/MFC_UpdateGUI.rc deleted file mode 100644 index 84462bd8..00000000 --- a/test_data/projects/mfc-tutorial/MFC_UpdateGUI.rc +++ /dev/null @@ -1,185 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#include ""res\\MFC_UpdateGUI.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\MFC_UpdateGUI.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_UPDATEGUI_DIALOG DIALOGEX 0, 0, 320, 200 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | - WS_CAPTION -EXSTYLE WS_EX_APPWINDOW -CAPTION "Application Update GUI Elements" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - DEFPUSHBUTTON "Click to Add",ID_BTN_ADD,65,7,50,16 - PUSHBUTTON "Quit",IDCANCEL,263,177,50,16 - LTEXT "Button Clicks:",IDC_STATIC,118,11,50,8 - LTEXT "0",IDC_ECHO_AREA,166,10,55,11,0,WS_EX_CLIENTEDGE - CONTROL "",IDC_V_SLIDER_BAR,"msctls_trackbar32",TBS_VERT | - TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,17,19,17,141 - CONTROL "",IDC_H_SLIDER_BAR,"msctls_trackbar32",TBS_BOTH | - TBS_NOTICKS | WS_TABSTOP,86,178,162,15 - LTEXT "Vertical Bar",IDC_STATIC,7,161,39,8 - LTEXT "Horizontal Bar",IDC_STATIC,147,163,47,8 - CTEXT "Static",IDC_V_SLIDER_ECHO,12,10,28,10,0, - WS_EX_CLIENTEDGE - CTEXT "Static",IDC_H_SLIDER_ECHO,115,163,28,10,0, - WS_EX_CLIENTEDGE - LTEXT "0",IDC_TIMERECHO,167,142,146,11,0,WS_EX_CLIENTEDGE - LTEXT "0",IDC_MOUSEECHO,167,128,146,11,0,WS_EX_CLIENTEDGE - LTEXT "Timer Echo:",IDC_STATIC,115,143,45,8 - LTEXT "Mouse Echo:",IDC_STATIC,115,130,45,8 - CONTROL "Timer Control Sliders",IDC_TIMER_CONTROL_SLIDERS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,116,74,86,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "TODO: " - VALUE "FileDescription", "TODO: " - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "MFC_UpdateGUI.exe" - VALUE "LegalCopyright", "TODO: (c) . All rights reserved." - VALUE "OriginalFilename", "MFC_UpdateGUI.exe" - VALUE "ProductName", "TODO: " - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_UPDATEGUI_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 313 - TOPMARGIN, 7 - BOTTOMMARGIN, 193 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 -#pragma code_page(1252) -#include "res\MFC_UpdateGUI.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/test_data/projects/mfc-tutorial/Resource.h b/test_data/projects/mfc-tutorial/Resource.h deleted file mode 100644 index e0d15c6f..00000000 --- a/test_data/projects/mfc-tutorial/Resource.h +++ /dev/null @@ -1,28 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by MFC_UpdateGUI.rc -// -#define IDD_MFC_UPDATEGUI_DIALOG 102 -#define IDD_UPDATEGUI_DIALOG 103 -#define IDR_MAINFRAME 128 -#define IDC_ECHO_AREA 1000 -#define ID_BTN_ADD 1001 -#define IDC_TIMERECHO 1002 -#define IDC_V_SLIDER_BAR 1003 -#define IDC_H_SLIDER_BAR 1004 -#define IDC_V_SLIDER_ECHO 1005 -#define IDC_H_SLIDER_ECHO 1006 -#define IDC_MOUSEECHO 1007 -#define IDC_CHECK_CONTROL_SLIDERS 1008 -#define IDC_TIMER_CONTROL_SLIDERS 1008 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1009 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/test_data/projects/mfc-tutorial/TutorialApp.cpp b/test_data/projects/mfc-tutorial/TutorialApp.cpp deleted file mode 100644 index 4bae2157..00000000 --- a/test_data/projects/mfc-tutorial/TutorialApp.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "stdafx.h" -#include "TutorialApp.h" -#include "TutorialDlg.h" - -// DEBUG_NEW macro allows MFC applications to determine memory leak locations in debug builds -#ifdef _DEBUG - #define new DEBUG_NEW -#endif - - -BEGIN_MESSAGE_MAP(CTutorialApp, CWinApp) -END_MESSAGE_MAP() - -CTutorialApp::CTutorialApp() -{ -} - -// The one and only CTutorialApp object -CTutorialApp theApp; - -BOOL CTutorialApp::InitInstance() -{ - // InitCommonControls() 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. - InitCommonControls(); - - CWinApp::InitInstance(); - - // Create and show our dialog - CTutorialDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return FALSE; -} diff --git a/test_data/projects/mfc-tutorial/TutorialApp.h b/test_data/projects/mfc-tutorial/TutorialApp.h deleted file mode 100644 index 1bed30f2..00000000 --- a/test_data/projects/mfc-tutorial/TutorialApp.h +++ /dev/null @@ -1,32 +0,0 @@ -// University of Washington Bothell Graphics Library -// Authors: Kelvin Sung, Steve Baer -// The accompanying library supports CSS Graphics courses taught at UW-Bothell -// See: http://courses.washington.edu/css450/ -// http://courses.washington.edu/css451/ -/////////////////////////////////////////////////////////////////////////////////// -#pragma once - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols - -/// CTutorialApp: -/// All MFC Applications have a single instance of a subclass of CWinApp. -/// This object handles application start-up / shut-down and loading the GUI components -class CTutorialApp : public CWinApp -{ -public: - CTutorialApp(); - - /// This could be considered the "entry point" for the application. - /// The class is constructed on the stack and this function is called at the appropriate - /// time to allow for command line parsing, setting up windows, ... - virtual BOOL InitInstance(); - DECLARE_MESSAGE_MAP() -}; - -/// The one and only application object for this application. All objects -/// can reference this static object by including this header file. -extern CTutorialApp theApp; diff --git a/test_data/projects/mfc-tutorial/TutorialDlg.cpp b/test_data/projects/mfc-tutorial/TutorialDlg.cpp deleted file mode 100644 index 811f6322..00000000 --- a/test_data/projects/mfc-tutorial/TutorialDlg.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include "stdafx.h" -#include "TutorialApp.h" -#include "TutorialDlg.h" - -// DEBUG_NEW macro allows MFC applications to determine memory leak locations in debug builds -#ifdef _DEBUG - #define new DEBUG_NEW -#endif - - -CTutorialDlg::CTutorialDlg(CWnd* pParent) -: CDialog(CTutorialDlg::IDD, pParent) -, m_EchoText(L"") -, m_HSliderEcho(L"") -, m_VSliderEcho(L"") -, m_MouseEcho(L"") -, m_TimerEcho(L"") -, m_TimerCtrlSliders(TRUE) -, m_OkCount(0) -, m_Seconds(0) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CTutorialDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Text(pDX, IDC_ECHO_AREA, m_EchoText); - DDV_MaxChars(pDX, m_EchoText, 3); // added for testing DDV_ doesn't break extraction! - DDX_Text(pDX, IDC_H_SLIDER_ECHO, m_HSliderEcho); - DDX_Text(pDX, IDC_V_SLIDER_ECHO, m_VSliderEcho); - DDX_Control(pDX, IDC_V_SLIDER_BAR, m_VSliderBar); - DDX_Control(pDX, IDC_H_SLIDER_BAR, m_HSliderBar); - // Added a comment here for testing - DDX_Text(pDX, IDC_MOUSEECHO, m_MouseEcho); - DDX_Text(pDX, IDC_TIMERECHO, m_TimerEcho); - DDX_Check(pDX, IDC_TIMER_CONTROL_SLIDERS, m_TimerCtrlSliders); -} - -BEGIN_MESSAGE_MAP(CTutorialDlg, CDialog) - ON_WM_PAINT() - ON_WM_HSCROLL() - ON_WM_VSCROLL() - ON_WM_TIMER() - ON_WM_LBUTTONDOWN() - ON_WM_MOUSEMOVE() - ON_WM_RBUTTONDOWN() - ON_BN_CLICKED(ID_BTN_ADD, /*a random comment*/OnBnClickedBtnAdd) - ON_BN_CLICKED(/*another random comment*/ IDC_TIMER_CONTROL_SLIDERS, OnBnClickedTimerControlSliders) -END_MESSAGE_MAP() - -// This is called when the dialog is first created and shown. -// It is a good spot to initialize member variables. -BOOL CTutorialDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - // Add extra initialization here. - // We want to initialize the slider bars - m_VSliderBar.SetRange(0, 100, TRUE); - m_VSliderBar.SetPos(50); - m_VSliderEcho.Format(L"%d", 50); - - m_HSliderBar.SetRange(0, 10, TRUE); - m_HSliderBar.SetPos(5); - m_HSliderEcho.Format(L"%d", 5); - - // Initialize the timer to go off every 1000 milliseconds (every second) - // when timer "goes-off", our OnTimer() event handler function will be - // called and it is upto us to decide what we want to do. - SetTimer(0, 1000, NULL); - - UpdateData(false); - - return TRUE; // return TRUE unless you set the focus to a control -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. -void CTutorialDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -void CTutorialDlg::OnBnClickedBtnAdd() -{ - m_OkCount++; - m_EchoText.Format(L"%d", m_OkCount); - - // Notice, without UpdateData() status area will _NOT_ be updated. - UpdateData(FALSE); -} - - -void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_HSliderBar) - { - int value = m_HSliderBar.GetPos(); - m_HSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnHScroll(nSBCode, nPos, pScrollBar); -} - -void CTutorialDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_VSliderBar) - { - int value = m_VSliderBar.GetPos(); - m_VSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnVScroll(nSBCode, nPos, pScrollBar); -} - -void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) -{ - m_Seconds++; - - if (m_TimerCtrlSliders) - { - // Get ready to decrease the sliders ... - int hvalue = m_HSliderBar.GetPos(); - if (hvalue > 0) - { - m_HSliderBar.SetPos(hvalue-1); - m_HSliderEcho.Format(L"%d", hvalue-1); - } - - int vvalue = m_VSliderBar.GetPos(); - if (vvalue > 0) - { - m_VSliderBar.SetPos(vvalue-1); - m_VSliderEcho.Format(L"%d", vvalue-1); - } - - if ( (hvalue==0) && (vvalue==0) ) - m_TimerCtrlSliders = false; - } - - m_TimerEcho.Format(L"%d: Seconds have passed", m_Seconds); - UpdateData(false); -} - -void CTutorialDlg::OnLButtonDown(UINT nFlags, CPoint point) -{ - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sLeft mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); -} - -void CTutorialDlg::OnMouseMove(UINT nFlags, CPoint point) -{ - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sMouse move at %d,%d", prefix, point.x, point.y); - UpdateData(false); -} - -void CTutorialDlg::OnRButtonDown(UINT nFlags, CPoint point) -{ - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sRight mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); -} - -void CTutorialDlg::OnBnClickedTimerControlSliders() -{ - UpdateData(true); - // This will fill all UI-connected variables with whatever - // value that is showing on the UI control objects. - // - // In this case, we care most about the value for m_TimerCtrlSliders -} diff --git a/test_data/projects/mfc-tutorial/TutorialDlg.h b/test_data/projects/mfc-tutorial/TutorialDlg.h deleted file mode 100644 index b2a4830d..00000000 --- a/test_data/projects/mfc-tutorial/TutorialDlg.h +++ /dev/null @@ -1,71 +0,0 @@ -// University of Washington Bothell Graphics Library -// Authors: Kelvin Sung, Steve Baer -// The accompanying library supports CSS Graphics courses taught at UW-Bothell -// See: http://courses.washington.edu/css450/ -// http://courses.washington.edu/css451/ -/////////////////////////////////////////////////////////////////////////////////// -#pragma once - -/// Main dialog for the sample application. This is created and displayed in -/// the CTutorialApp::InitInstance function. -class CTutorialDlg : public CDialog -{ -public: - CTutorialDlg(CWnd* pParent = NULL); - - /// The IDD enum is a common technique in MFC to associate a dialog with - /// a resource that you edit in the dialog editor - enum { IDD = IDD_UPDATEGUI_DIALOG }; - -protected: - /// The virtual DoDataExchange is an MFC method for synchronizing values in this - /// class with their corresponding controls on the dialog. - /// See MSDN documentation for more information - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - - /// Called immediately after a dialog is created, but before it is displayed. - /// This is where all of the control initialization usually occurs. This is - /// also where the graphics window is set up - virtual BOOL OnInitDialog(); - - /// A message map is an MFC macro for mapping window's events (paint, size, mouse,...) that - /// occur on a window to functions in this class. - /// The functions in this class that begin with afx_msg are "handlers" for window's messages - DECLARE_MESSAGE_MAP() - - /// Called when this dialog receives a WM_PAINT message (event) - /// The MFC wizard adds code to paint properly if this dialog is minimized to the taskbar - afx_msg void OnPaint(); - - /// Called when this dialog receives slider scroll messages from the slider controls - /// Horizontal Scroll - afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - - /// Called when this dialog receives slider scroll messages from the slider controls - /// Vertical Scroll - afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - afx_msg void OnTimer(UINT_PTR nIDEvent); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnRButtonDown(UINT nFlags, CPoint point); - /// - /// Called when this dialog receives button click message from the add button - afx_msg void OnBnClickedBtnAdd(); - afx_msg void OnBnClickedTimerControlSliders(); - -private: - int m_Seconds; - int m_OkCount; - CString m_EchoText; - - CString m_HSliderEcho; - CString m_VSliderEcho; - CSliderCtrl m_VSliderBar; - CSliderCtrl m_HSliderBar; - - CString m_MouseEcho; - CString m_TimerEcho; - - BOOL m_TimerCtrlSliders; - HICON m_hIcon; -}; diff --git a/test_data/projects/mfc-tutorial/res/MFC_UpdateGUI.ico b/test_data/projects/mfc-tutorial/res/MFC_UpdateGUI.ico deleted file mode 100644 index 8a84ca3d..00000000 Binary files a/test_data/projects/mfc-tutorial/res/MFC_UpdateGUI.ico and /dev/null differ diff --git a/test_data/projects/mfc-tutorial/res/MFC_UpdateGUI.rc2 b/test_data/projects/mfc-tutorial/res/MFC_UpdateGUI.rc2 deleted file mode 100644 index 08ef4bba..00000000 --- a/test_data/projects/mfc-tutorial/res/MFC_UpdateGUI.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// MFC_UpdateGUI.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/test_data/projects/mfc-tutorial/stdafx.cpp b/test_data/projects/mfc-tutorial/stdafx.cpp deleted file mode 100644 index 01aee718..00000000 --- a/test_data/projects/mfc-tutorial/stdafx.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// MFC_UpdateGUI.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - - diff --git a/test_data/projects/mfc-tutorial/stdafx.h b/test_data/projects/mfc-tutorial/stdafx.h deleted file mode 100644 index 1bbdeb7a..00000000 --- a/test_data/projects/mfc-tutorial/stdafx.h +++ /dev/null @@ -1,51 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#pragma once - -#ifndef _SECURE_ATL -#define _SECURE_ATL 1 -#endif - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers -#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 // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - -#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 - - - - - -#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 - diff --git a/test_data/rcfiles/2048Game/2048Game.rc b/test_data/rcfiles/2048Game/2048Game.rc deleted file mode 100644 index 2156d261..00000000 --- a/test_data/rcfiles/2048Game/2048Game.rc +++ /dev/null @@ -1,687 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#include "afxres.h" -#include "verrsrc.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Ukrainian (Ukraine) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_UKR) -LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT -#pragma code_page(1251) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#include ""afxres.h""\r\n" - "#include ""verrsrc.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "LANGUAGE 9, 1\r\n" - "#include ""res\\My2048Game.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#include ""afxprint.rc"" // printing/print preview resources\r\n" - "#if !defined(_AFXDLL)\r\n" - "#include ""afxribbon.rc"" // MFC ribbon and control bar resources\r\n" - "#endif\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_DIALOG1 DIALOGEX 0, 0, 201, 87 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Настройки" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,64,66,50,14 - PUSHBUTTON "Cancel",IDCANCEL,144,66,50,14 - LTEXT "Количество квадратов",IDC_STATIC,7,15,80,8 - COMBOBOX IDC_COMBO1,96,12,88,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Имя игрока",IDC_STATIC,7,41,39,8 - COMBOBOX IDC_COMBO2,95,36,89,12,CBS_SIMPLE | CBS_SORT | WS_VSCROLL | WS_TABSTOP -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_DIALOG1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 194 - TOPMARGIN, 7 - BOTTOMMARGIN, 80 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// AFX_DIALOG_LAYOUT -// - -IDD_DIALOG1 AFX_DIALOG_LAYOUT -BEGIN - 0 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog Info -// - -IDD_DIALOG1 DLGINIT -BEGIN - IDC_COMBO1, 0x403, 2, 0 -0x0033, - IDC_COMBO1, 0x403, 2, 0 -0x0034, - IDC_COMBO1, 0x403, 2, 0 -0x0035, - IDC_COMBO1, 0x403, 2, 0 -0x0036, - 0 -END - -#endif // Ukrainian (Ukraine) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About 2048Game" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20 - LTEXT "2048Game, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX - LTEXT "Copyright (C) 2016",IDC_STATIC,42,26,114,8 - DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 163 - TOPMARGIN, 7 - BOTTOMMARGIN, 55 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\2048Game.ico" - -IDR_My2048GameTYPE ICON "res\\2048GameDoc.ico" - -IDI_FILE_VIEW ICON "res\\file_view.ico" - -IDI_FILE_VIEW_HC ICON "res\\file_view_hc.ico" - -IDI_CLASS_VIEW ICON "res\\class_view.ico" - -IDI_CLASS_VIEW_HC ICON "res\\class_view_hc.ico" - -IDI_OUTPUT_WND ICON "res\\output_wnd.ico" - -IDI_OUTPUT_WND_HC ICON "res\\output_wnd_hc.ico" - -IDI_PROPERTIES_WND ICON "res\\properties_wnd.ico" - -IDI_PROPERTIES_WND_HC ICON "res\\properties_wnd_hc.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDR_MAINFRAME BITMAP "res\\Toolbar.bmp" - -IDR_MAINFRAME_256 BITMAP "res\\Toolbar256.bmp" - -IDR_SORT BITMAP "res\\sort.bmp" - -IDB_SORT_24 BITMAP "res\\sort_hc.bmp" - -IDB_FILE_VIEW BITMAP "res\\fileview.bmp" - -IDB_FILE_VIEW_24 BITMAP "res\\fileview_hc.bmp" - -IDB_CLASS_VIEW BITMAP "res\\classview.bmp" - -IDB_CLASS_VIEW_24 BITMAP "res\\classview_hc.bmp" - -IDR_EXPLORER BITMAP "res\\explorer.bmp" - -IDB_EXPLORER_24 BITMAP "res\\explorer_hc.bmp" - -IDR_MENU_IMAGES BITMAP "res\\menuimages.bmp" - -IDB_MENU_IMAGES_24 BITMAP "res\\menuimages_hc.bmp" - -IDR_PROPERTIES BITMAP "res\\properties.bmp" - -IDB_PROPERTIES_HC BITMAP "res\\properties_hc.bmp" - - -///////////////////////////////////////////////////////////////////////////// -// -// Toolbar -// - -IDR_MAINFRAME TOOLBAR 16, 15 -BEGIN - BUTTON ID_FILE_NEW - BUTTON ID_FILE_OPEN - BUTTON ID_FILE_SAVE - SEPARATOR - BUTTON ID_EDIT_CUT - BUTTON ID_EDIT_COPY - BUTTON ID_EDIT_PASTE - SEPARATOR - BUTTON ID_FILE_PRINT - BUTTON ID_APP_ABOUT -END - -IDR_MAINFRAME_256 TOOLBAR 16, 15 -BEGIN - BUTTON ID_FILE_NEW - BUTTON ID_FILE_OPEN - BUTTON ID_FILE_SAVE - SEPARATOR - BUTTON ID_EDIT_CUT - BUTTON ID_EDIT_COPY - BUTTON ID_EDIT_PASTE - SEPARATOR - BUTTON ID_FILE_PRINT - BUTTON ID_APP_ABOUT -END - -IDR_SORT TOOLBAR 16, 15 -BEGIN - BUTTON ID_SORT_MENU - BUTTON ID_NEW_FOLDER -END - -IDR_EXPLORER TOOLBAR 16, 15 -BEGIN - BUTTON ID_PROPERTIES -END - -IDR_MENU_IMAGES TOOLBAR 16, 15 -BEGIN - BUTTON ID_WINDOW_MANAGER - SEPARATOR - BUTTON ID_WINDOW_CASCADE - BUTTON ID_WINDOW_TILE_HORZ - BUTTON ID_TOOLS_MACRO - BUTTON ID_SORTING_SORTALPHABETIC - BUTTON ID_SORTING_SORTBYTYPE - BUTTON ID_SORTING_SORTBYACCESS - BUTTON ID_SORTING_GROUPBYTYPE -END - -IDR_PROPERTIES TOOLBAR 16, 15 -BEGIN - BUTTON ID_EXPAND_ALL - BUTTON ID_SORTPROPERTIES - BUTTON ID_PROPERTIES1 - BUTTON ID_PROPERTIES2 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_MAINFRAME MENU -BEGIN - POPUP "&File" - BEGIN - MENUITEM "&New\tCtrl+N", ID_FILE_NEW - MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN - MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE - MENUITEM "Save &As...", ID_FILE_SAVE_AS - MENUITEM SEPARATOR - MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT - MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW - MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP - MENUITEM SEPARATOR - MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED - MENUITEM SEPARATOR - MENUITEM "E&xit", ID_APP_EXIT - END - POPUP "&Edit" - BEGIN - MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO - MENUITEM SEPARATOR - MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT - MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY - MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE - END - POPUP "&View" - BEGIN - POPUP "&Toolbars and Docking Windows" - BEGIN - MENUITEM "", ID_VIEW_TOOLBAR - END - MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR - POPUP "&Application Look" - BEGIN - MENUITEM "Windows &2000", ID_VIEW_APPLOOK_WIN_2000 - MENUITEM "Office &XP", ID_VIEW_APPLOOK_OFF_XP - MENUITEM "&Windows XP", ID_VIEW_APPLOOK_WIN_XP - MENUITEM "Office 200&3", ID_VIEW_APPLOOK_OFF_2003 - MENUITEM "Visual Studio 200&5", ID_VIEW_APPLOOK_VS_2005 - MENUITEM "Visual Studio 200&8", ID_VIEW_APPLOOK_VS_2008 - POPUP "Office 200&7" - BEGIN - MENUITEM "&Blue Style", ID_VIEW_APPLOOK_OFF_2007_BLUE - MENUITEM "B&lack Style", ID_VIEW_APPLOOK_OFF_2007_BLACK - MENUITEM "&Silver Style", ID_VIEW_APPLOOK_OFF_2007_SILVER - MENUITEM "&Aqua Style", ID_VIEW_APPLOOK_OFF_2007_AQUA - END - END - END - POPUP "&Help" - BEGIN - MENUITEM "&About 2048Game...", ID_APP_ABOUT - END - POPUP "Settings" - BEGIN - MENUITEM "Field settings", ID_SETTINGS_FIELDSETTINGS - MENUITEM "Background color", ID_SETTINGS_BACKGROUNDCOLOR - END -END - -IDR_POPUP_EDIT MENU -BEGIN - POPUP "Edit" - BEGIN - MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT - MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY - MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE - END -END - -IDR_POPUP_SORT MENU -BEGIN - POPUP "Sorting" - BEGIN - MENUITEM "&Sort Alphabeticaly", ID_SORTING_SORTALPHABETIC - MENUITEM "Sort by &Type", ID_SORTING_SORTBYTYPE - MENUITEM "Sort by Acc&ess", ID_SORTING_SORTBYACCESS - MENUITEM "Group by t&ype", ID_SORTING_GROUPBYTYPE - END -END - -IDR_POPUP_EXPLORER MENU -BEGIN - POPUP "Explorer" - BEGIN - MENUITEM "&Open", ID_OPEN - MENUITEM "Open &With....", ID_OPEN_WITH - MENUITEM SEPARATOR - MENUITEM "&Compile", ID_DUMMY_COMPILE - MENUITEM SEPARATOR - MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT - MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY - MENUITEM "&Remove", ID_EDIT_CLEAR - MENUITEM SEPARATOR - MENUITEM "&Properties...", ID_PROPERTIES - END -END - -IDR_OUTPUT_POPUP MENU -BEGIN - POPUP "Popup" - BEGIN - MENUITEM "&Copy", ID_EDIT_COPY - MENUITEM "&Clear", ID_EDIT_CLEAR - MENUITEM SEPARATOR - MENUITEM "&Hide", ID_VIEW_OUTPUTWND - END -END - -IDR_HELP_MENU MENU -BEGIN - MENUITEM "&About 2048Game...", ID_APP_ABOUT -END - -IDR_THEME_MENU MENU -BEGIN - MENUITEM "Office 2007 (&Blue Style)", ID_VIEW_APPLOOK_OFF_2007_BLUE - MENUITEM "Office 2007 (B&lack Style)", ID_VIEW_APPLOOK_OFF_2007_BLACK - MENUITEM "Office 2007 (&Silver Style)", ID_VIEW_APPLOOK_OFF_2007_SILVER - MENUITEM "Office 2007 (&Aqua Style)", ID_VIEW_APPLOOK_OFF_2007_AQUA - MENUITEM "Win&dows 7", ID_VIEW_APPLOOK_WINDOWS_7 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Accelerator -// - -IDR_MAINFRAME ACCELERATORS -BEGIN - "N", ID_FILE_NEW, VIRTKEY, CONTROL - "O", ID_FILE_OPEN, VIRTKEY, CONTROL - "S", ID_FILE_SAVE, VIRTKEY, CONTROL - "P", ID_FILE_PRINT, VIRTKEY, CONTROL - "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL - "X", ID_EDIT_CUT, VIRTKEY, CONTROL - "C", ID_EDIT_COPY, VIRTKEY, CONTROL - "V", ID_EDIT_PASTE, VIRTKEY, CONTROL - VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT - VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT - VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL - VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT - VK_F6, ID_NEXT_PANE, VIRTKEY - VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "TODO: " - VALUE "FileDescription", "2048Game" - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "2048Game.exe" - VALUE "LegalCopyright", "TODO: (c) . All rights reserved." - VALUE "OriginalFilename", "2048Game.exe" - VALUE "ProductName", "TODO: " - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDP_OLE_INIT_FAILED "OLE initialization failed. Make sure that the OLE libraries are the correct version." - IDS_LOSE "You lose" - IDS_POINTS "Points" - IDS_START_GAME "Start game" - IDS_ABOUT "About game" - IDS_UNDO "Undo" - IDS_MENU "Menu" -END - -STRINGTABLE -BEGIN - IDR_MAINFRAME "2048Game\n\n2048Game\n\n\nMy2048Game.Document\n2048Game.Document" -END - -STRINGTABLE -BEGIN - AFX_IDS_APP_TITLE "2048Game" - AFX_IDS_IDLEMESSAGE "Ready" -END - -STRINGTABLE -BEGIN - ID_INDICATOR_EXT "EXT" - ID_INDICATOR_CAPS "CAP" - ID_INDICATOR_NUM "NUM" - ID_INDICATOR_SCRL "SCRL" - ID_INDICATOR_OVR "OVR" - ID_INDICATOR_REC "REC" -END - -STRINGTABLE -BEGIN - ID_FILE_NEW "Create a new document\nNew" - ID_FILE_OPEN "Open an existing document\nOpen" - ID_FILE_CLOSE "Close the active document\nClose" - ID_FILE_SAVE "Save the active document\nSave" - ID_FILE_SAVE_AS "Save the active document with a new name\nSave As" - ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup" - ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup" - ID_FILE_PRINT "Print the active document\nPrint" - ID_FILE_PRINT_DIRECT "Print the active document using current options\nQuick Print" - ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview" -END - -STRINGTABLE -BEGIN - ID_APP_ABOUT "Display program information, version number and copyright\nAbout" - ID_APP_EXIT "Quit the application; prompts to save documents\nExit" -END - -STRINGTABLE -BEGIN - ID_FILE_MRU_FILE1 "Open this document" - ID_FILE_MRU_FILE2 "Open this document" - ID_FILE_MRU_FILE3 "Open this document" - ID_FILE_MRU_FILE4 "Open this document" - ID_FILE_MRU_FILE5 "Open this document" - ID_FILE_MRU_FILE6 "Open this document" - ID_FILE_MRU_FILE7 "Open this document" - ID_FILE_MRU_FILE8 "Open this document" - ID_FILE_MRU_FILE9 "Open this document" - ID_FILE_MRU_FILE10 "Open this document" - ID_FILE_MRU_FILE11 "Open this document" - ID_FILE_MRU_FILE12 "Open this document" - ID_FILE_MRU_FILE13 "Open this document" - ID_FILE_MRU_FILE14 "Open this document" - ID_FILE_MRU_FILE15 "Open this document" - ID_FILE_MRU_FILE16 "Open this document" -END - -STRINGTABLE -BEGIN - ID_NEXT_PANE "Switch to the next window pane\nNext Pane" - ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" -END - -STRINGTABLE -BEGIN - ID_WINDOW_SPLIT "Split the active window into panes\nSplit" -END - -STRINGTABLE -BEGIN - ID_EDIT_CLEAR "Erase the selection\nErase" - ID_EDIT_CLEAR_ALL "Erase everything\nErase All" - ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" - ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" - ID_EDIT_FIND "Find the specified text\nFind" - ID_EDIT_PASTE "Insert Clipboard contents\nPaste" - ID_EDIT_REPEAT "Repeat the last action\nRepeat" - ID_EDIT_REPLACE "Replace specific text with different text\nReplace" - ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" - ID_EDIT_UNDO "Undo the last action\nUndo" - ID_EDIT_REDO "Redo the previously undone action\nRedo" -END - -STRINGTABLE -BEGIN - ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle Status Bar" -END - -STRINGTABLE -BEGIN - AFX_IDS_SCSIZE "Change the window size" - AFX_IDS_SCMOVE "Change the window position" - AFX_IDS_SCMINIMIZE "Reduce the window to an icon" - AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" - AFX_IDS_SCNEXTWINDOW "Switch to the next document window" - AFX_IDS_SCPREVWINDOW "Switch to the previous document window" - AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" -END - -STRINGTABLE -BEGIN - AFX_IDS_SCRESTORE "Restore the window to normal size" - AFX_IDS_SCTASKLIST "Activate Task List" -END - -STRINGTABLE -BEGIN - AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview" -END - -STRINGTABLE -BEGIN - IDS_STATUS_PANE1 "Pane 1" - IDS_STATUS_PANE2 "Pane 2" - IDS_TOOLBAR_STANDARD "Standard" - IDS_TOOLBAR_CUSTOMIZE "Customize..." -END - -STRINGTABLE -BEGIN - IDS_FILE_VIEW "File View" - IDS_CLASS_VIEW "Class View" - IDS_OUTPUT_WND "Output" - IDS_PROPERTIES_WND "Properties" -END - -STRINGTABLE -BEGIN - IDS_EXPLORER "Explorer" - IDS_EDIT_MENU "Edit" -END - -STRINGTABLE -BEGIN - IDS_BUILD_TAB "Build" - IDS_DEBUG_TAB "Debug" - IDS_FIND_TAB "Find" -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 -#include "res\My2048Game.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#include "afxprint.rc" // printing/print preview resources -#if !defined(_AFXDLL) -#include "afxribbon.rc" // MFC ribbon and control bar resources -#endif -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/test_data/rcfiles/2048Game/res/Toolbar256.bmp b/test_data/rcfiles/2048Game/res/Toolbar256.bmp deleted file mode 100644 index 91a25530..00000000 Binary files a/test_data/rcfiles/2048Game/res/Toolbar256.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/res/classview.bmp b/test_data/rcfiles/2048Game/res/classview.bmp deleted file mode 100644 index 1e02aa1a..00000000 Binary files a/test_data/rcfiles/2048Game/res/classview.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/res/classview_hc.bmp b/test_data/rcfiles/2048Game/res/classview_hc.bmp deleted file mode 100644 index 6b22e786..00000000 Binary files a/test_data/rcfiles/2048Game/res/classview_hc.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/res/fileview.bmp b/test_data/rcfiles/2048Game/res/fileview.bmp deleted file mode 100644 index a2d62d0c..00000000 Binary files a/test_data/rcfiles/2048Game/res/fileview.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/res/fileview_hc.bmp b/test_data/rcfiles/2048Game/res/fileview_hc.bmp deleted file mode 100644 index b60f4838..00000000 Binary files a/test_data/rcfiles/2048Game/res/fileview_hc.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/res/menuimages.bmp b/test_data/rcfiles/2048Game/res/menuimages.bmp deleted file mode 100644 index 77718413..00000000 Binary files a/test_data/rcfiles/2048Game/res/menuimages.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/res/menuimages_hc.bmp b/test_data/rcfiles/2048Game/res/menuimages_hc.bmp deleted file mode 100644 index 577926e4..00000000 Binary files a/test_data/rcfiles/2048Game/res/menuimages_hc.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/res/properties.bmp b/test_data/rcfiles/2048Game/res/properties.bmp deleted file mode 100644 index 72e2b298..00000000 Binary files a/test_data/rcfiles/2048Game/res/properties.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/res/properties_hc.bmp b/test_data/rcfiles/2048Game/res/properties_hc.bmp deleted file mode 100644 index d18a7ca4..00000000 Binary files a/test_data/rcfiles/2048Game/res/properties_hc.bmp and /dev/null differ diff --git a/test_data/rcfiles/2048Game/resource.h b/test_data/rcfiles/2048Game/resource.h deleted file mode 100644 index 7ce1e14d..00000000 --- a/test_data/rcfiles/2048Game/resource.h +++ /dev/null @@ -1,109 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by 2048Game.rc -// -#define IDD_ABOUTBOX 100 -#define IDP_OLE_INIT_FAILED 100 -#define IDS_LOSE 101 -#define IDS_POINTS 102 -#define IDS_START_GAME 103 -#define IDS_ABOUT 104 -#define IDS_UNDO 105 -#define IDS_MENU 106 -#define IDR_POPUP_EDIT 119 -#define ID_STATUSBAR_PANE1 120 -#define ID_STATUSBAR_PANE2 121 -#define IDS_STATUS_PANE1 122 -#define IDS_STATUS_PANE2 123 -#define IDS_TOOLBAR_STANDARD 124 -#define IDS_TOOLBAR_CUSTOMIZE 125 -#define ID_VIEW_CUSTOMIZE 126 -#define IDR_MAINFRAME 128 -#define IDR_MAINFRAME_256 129 -#define IDR_My2048GameTYPE 130 -#define ID_WINDOW_MANAGER 131 -#define ID_VIEW_FILEVIEW 133 -#define ID_VIEW_CLASSVIEW 134 -#define ID_PROPERTIES 135 -#define ID_OPEN 136 -#define ID_OPEN_WITH 137 -#define ID_DUMMY_COMPILE 138 -#define ID_CLASS_ADD_MEMBER_FUNCTION 139 -#define ID_CLASS_ADD_MEMBER_VARIABLE 140 -#define ID_CLASS_DEFINITION 141 -#define ID_CLASS_PROPERTIES 142 -#define ID_NEW_FOLDER 143 -#define ID_SORT_MENU 144 -#define ID_SORTING_GROUPBYTYPE 145 -#define ID_SORTING_SORTALPHABETIC 146 -#define ID_SORTING_SORTBYTYPE 147 -#define ID_SORTING_SORTBYACCESS 148 -#define ID_VIEW_OUTPUTWND 149 -#define ID_VIEW_PROPERTIESWND 150 -#define ID_SORTPROPERTIES 151 -#define ID_PROPERTIES1 152 -#define ID_PROPERTIES2 153 -#define ID_EXPAND_ALL 154 -#define IDS_FILE_VIEW 155 -#define IDS_CLASS_VIEW 156 -#define IDS_OUTPUT_WND 157 -#define IDS_PROPERTIES_WND 158 -#define IDI_FILE_VIEW 161 -#define IDI_FILE_VIEW_HC 162 -#define IDI_CLASS_VIEW 163 -#define IDI_CLASS_VIEW_HC 164 -#define IDI_OUTPUT_WND 165 -#define IDI_OUTPUT_WND_HC 166 -#define IDI_PROPERTIES_WND 167 -#define IDI_PROPERTIES_WND_HC 168 -#define IDR_EXPLORER 169 -#define IDB_EXPLORER_24 170 -#define IDR_SORT 171 -#define IDB_SORT_24 172 -#define IDR_POPUP_SORT 173 -#define IDR_POPUP_EXPLORER 174 -#define IDB_FILE_VIEW 175 -#define IDB_FILE_VIEW_24 176 -#define IDB_CLASS_VIEW 177 -#define IDB_CLASS_VIEW_24 178 -#define IDR_MENU_IMAGES 179 -#define IDB_MENU_IMAGES_24 180 -#define ID_TOOLS_MACRO 181 -#define IDR_OUTPUT_POPUP 182 -#define IDR_PROPERTIES 183 -#define IDB_PROPERTIES_HC 184 -#define IDR_THEME_MENU 200 -#define ID_SET_STYLE 201 -#define ID_VIEW_APPLOOK_WIN_2000 205 -#define ID_VIEW_APPLOOK_OFF_XP 206 -#define ID_VIEW_APPLOOK_WIN_XP 207 -#define ID_VIEW_APPLOOK_OFF_2003 208 -#define ID_VIEW_APPLOOK_VS_2005 209 -#define ID_VIEW_APPLOOK_VS_2008 210 -#define ID_VIEW_APPLOOK_OFF_2007_BLUE 215 -#define ID_VIEW_APPLOOK_OFF_2007_BLACK 216 -#define ID_VIEW_APPLOOK_OFF_2007_SILVER 217 -#define ID_VIEW_APPLOOK_OFF_2007_AQUA 218 -#define ID_VIEW_APPLOOK_WINDOWS_7 219 -#define IDS_BUILD_TAB 300 -#define IDS_DEBUG_TAB 301 -#define IDS_FIND_TAB 302 -#define IDS_EXPLORER 305 -#define IDS_EDIT_MENU 306 -#define IDD_DIALOG1 310 -#define IDC_COMBO1 1000 -#define IDC_COMBO2 1001 -#define ID_SETTINGS_CHANGESETTINGS 32771 -#define ID_SETTINGS_FIELDSETTINGS 32772 -#define ID_SETTINGS_BACKGROUNDCOLOR 32773 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 313 -#define _APS_NEXT_COMMAND_VALUE 32774 -#define _APS_NEXT_CONTROL_VALUE 1002 -#define _APS_NEXT_SYMED_VALUE 310 -#endif -#endif diff --git a/test_data/rcfiles/mainWindow/MainWindow.rc b/test_data/rcfiles/mainWindow/MainWindow.rc new file mode 100644 index 00000000..026b786d Binary files /dev/null and b/test_data/rcfiles/mainWindow/MainWindow.rc differ diff --git a/test_data/rcfiles/mainWindow/res/MainWindow.ico b/test_data/rcfiles/mainWindow/res/MainWindow.ico new file mode 100644 index 00000000..d56fbcdf Binary files /dev/null and b/test_data/rcfiles/mainWindow/res/MainWindow.ico differ diff --git a/test_data/rcfiles/2048Game/res/My2048Game.rc2 b/test_data/rcfiles/mainWindow/res/MainWindow.rc2 similarity index 92% rename from test_data/rcfiles/2048Game/res/My2048Game.rc2 rename to test_data/rcfiles/mainWindow/res/MainWindow.rc2 index 245b3a1d..73fc9754 100644 Binary files a/test_data/rcfiles/2048Game/res/My2048Game.rc2 and b/test_data/rcfiles/mainWindow/res/MainWindow.rc2 differ diff --git a/test_data/rcfiles/mainWindow/res/MainWindowDoc.ico b/test_data/rcfiles/mainWindow/res/MainWindowDoc.ico new file mode 100644 index 00000000..96365d43 Binary files /dev/null and b/test_data/rcfiles/mainWindow/res/MainWindowDoc.ico differ diff --git a/test_data/rcfiles/2048Game/res/Toolbar.bmp b/test_data/rcfiles/mainWindow/res/Toolbar.bmp similarity index 100% rename from test_data/rcfiles/2048Game/res/Toolbar.bmp rename to test_data/rcfiles/mainWindow/res/Toolbar.bmp diff --git a/test_data/rcfiles/mainWindow/res/userimages.bmp b/test_data/rcfiles/mainWindow/res/userimages.bmp new file mode 100644 index 00000000..affe6570 Binary files /dev/null and b/test_data/rcfiles/mainWindow/res/userimages.bmp differ diff --git a/test_data/rcfiles/mainWindow/resource.h b/test_data/rcfiles/mainWindow/resource.h new file mode 100644 index 00000000..497c252d --- /dev/null +++ b/test_data/rcfiles/mainWindow/resource.h @@ -0,0 +1,28 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by MainWindow.rc +// +#define IDD_ABOUTBOX 100 +#define IDR_POPUP_EDIT 119 +#define ID_STATUSBAR_PANE1 120 +#define ID_STATUSBAR_PANE2 121 +#define IDS_STATUS_PANE1 122 +#define IDS_STATUS_PANE2 123 +#define IDS_TOOLBAR_STANDARD 124 +#define IDS_TOOLBAR_CUSTOMIZE 125 +#define ID_VIEW_CUSTOMIZE 126 +#define IDR_MAINFRAME 128 +#define IDR_MAINFRAME_256 129 +#define IDR_MainWindowTYPE 130 +#define IDS_EDIT_MENU 306 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 310 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 310 +#define _APS_NEXT_COMMAND_VALUE 32771 +#endif +#endif diff --git a/test_data/tst_cppdocument/message_map/TutorialDialogWithNamespace.cpp b/test_data/tst_cppdocument/message_map/TutorialDialogWithNamespace.cpp index 9ba03f05..1cf6e6b9 100644 --- a/test_data/tst_cppdocument/message_map/TutorialDialogWithNamespace.cpp +++ b/test_data/tst_cppdocument/message_map/TutorialDialogWithNamespace.cpp @@ -1,217 +1,141 @@ -#include "stdafx.h" -#include "TutorialApp.h" + +// TutorialDlg.cpp : implementation file +// + +#include "pch.h" +#include "framework.h" +#include "Tutorial.h" #include "TutorialDlg.h" +#include "afxdialogex.h" -// DEBUG_NEW macro allows MFC applications to determine memory leak locations in debug builds #ifdef _DEBUG - #define new DEBUG_NEW +#define new DEBUG_NEW #endif + +// CTutorialDlg dialog + namespace TestNamespace { -CTutorialDlg::CTutorialDlg(CWnd* pParent) -: CDialog(CTutorialDlg::IDD, pParent) -, m_EchoText(L"") -, m_HSliderEcho(L"") -, m_VSliderEcho(L"") -, m_MouseEcho(L"") -, m_TimerEcho(L"") -, m_TimerCtrlSliders(TRUE) -, m_OkCount(0) -, m_Seconds(0) +CTutorialDlg::CTutorialDlg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_TUTORIAL_DIALOG, pParent) + , m_check(FALSE) + , m_message(_T("")) { - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CTutorialDlg::DoDataExchange(CDataExchange* pDX) { - CDialog::DoDataExchange(pDX); - DDX_Text(pDX, IDC_ECHO_AREA, m_EchoText); - DDX_Text(pDX, IDC_H_SLIDER_ECHO, m_HSliderEcho); - DDX_Text(pDX, IDC_V_SLIDER_ECHO, m_VSliderEcho); - DDX_Control(pDX, IDC_V_SLIDER_BAR, m_VSliderBar); - DDX_Control(pDX, IDC_H_SLIDER_BAR, m_HSliderBar); - DDX_Text(pDX, IDC_MOUSEECHO, m_MouseEcho); - DDX_Text(pDX, IDC_TIMERECHO, m_TimerEcho); - DDX_Check(pDX, IDC_TIMER_CONTROL_SLIDERS, m_TimerCtrlSliders); + CDialogEx::DoDataExchange(pDX); + DDX_Check(pDX, IDC_CHECK1, m_check); + DDX_Control(pDX, IDC_EDIT1, m_edit); + DDX_Control(pDX, IDC_COMBO1, m_combo); + DDX_Control(pDX, IDC_SLIDER1, m_slider); + DDX_Text(pDX, IDC_MESSAGE, m_message); } -BEGIN_MESSAGE_MAP(CTutorialDlg, CDialog) - ON_WM_PAINT() - ON_WM_HSCROLL() - ON_WM_VSCROLL() - ON_WM_TIMER() - ON_WM_LBUTTONDOWN() - ON_WM_MOUSEMOVE() - ON_WM_RBUTTONDOWN() - ON_BN_CLICKED(ID_BTN_ADD, OnBnClickedBtnAdd) - ON_BN_CLICKED(IDC_TIMER_CONTROL_SLIDERS, OnBnClickedTimerControlSliders) +BEGIN_MESSAGE_MAP(CTutorialDlg, CDialogEx) + ON_WM_PAINT() +// ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_CHECK1, &CTutorialDlg::OnBnClickedCheck1) + ON_EN_CHANGE(IDC_EDIT1, &CTutorialDlg::OnEnChangeEdit1) + ON_CBN_SELCHANGE(IDC_COMBO1, &CTutorialDlg::OnCbnSelchangeCombo1) + ON_WM_HSCROLL() + ON_WM_TIMER() END_MESSAGE_MAP() -// This is called when the dialog is first created and shown. -// It is a good spot to initialize member variables. -BOOL CTutorialDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - // Add extra initialization here. - // We want to initialize the slider bars - m_VSliderBar.SetRange(0, 100, TRUE); - m_VSliderBar.SetPos(50); - m_VSliderEcho.Format(L"%d", 50); +// CTutorialDlg message handlers - m_HSliderBar.SetRange(0, 10, TRUE); - m_HSliderBar.SetPos(5); - m_HSliderEcho.Format(L"%d", 5); +BOOL CTutorialDlg::OnInitDialog() +{ + CDialogEx::OnInitDialog(); - // Initialize the timer to go off every 1000 milliseconds (every second) - // when timer "goes-off", our OnTimer() event handler function will be - // called and it is upto us to decide what we want to do. - SetTimer(0, 1000, NULL); + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon - UpdateData(false); + // TODO: Add extra initialization here - return TRUE; // return TRUE unless you set the focus to a control + return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + void CTutorialDlg::OnPaint() { - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialogEx::OnPaint(); + } } -void CTutorialDlg::OnBnClickedBtnAdd() -{ - m_OkCount++; - m_EchoText.Format(L"%d", m_OkCount); +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +//HCURSOR CTutorialDlg::OnQueryDragIcon() +//{ +// return static_cast(m_hIcon); +//} - // Notice, without UpdateData() status area will _NOT_ be updated. - UpdateData(FALSE); -} -void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void CTutorialDlg::OnBnClickedCheck1() { - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_HSliderBar) - { - int value = m_HSliderBar.GetPos(); - m_HSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnHScroll(nSBCode, nPos, pScrollBar); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_VSliderBar) - { - int value = m_VSliderBar.GetPos(); - m_VSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnVScroll(nSBCode, nPos, pScrollBar); -} -void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) +void CTutorialDlg::OnEnChangeEdit1() { - m_Seconds++; - - if (m_TimerCtrlSliders) - { - // Get ready to decrease the sliders ... - int hvalue = m_HSliderBar.GetPos(); - if (hvalue > 0) - { - m_HSliderBar.SetPos(hvalue-1); - m_HSliderEcho.Format(L"%d", hvalue-1); - } - - int vvalue = m_VSliderBar.GetPos(); - if (vvalue > 0) - { - m_VSliderBar.SetPos(vvalue-1); - m_VSliderEcho.Format(L"%d", vvalue-1); - } - - if ( (hvalue==0) && (vvalue==0) ) - m_TimerCtrlSliders = false; - } - - m_TimerEcho.Format(L"%d: Seconds have passed", m_Seconds); - UpdateData(false); -} + // TODO: If this is a RICHEDIT control, the control will not + // send this notification unless you override the CDialogEx::OnInitDialog() + // function and call CRichEditCtrl().SetEventMask() + // with the ENM_CHANGE flag ORed into the mask. -void CTutorialDlg::OnLButtonDown(UINT nFlags, CPoint point) -{ - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sLeft mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnMouseMove(UINT nFlags, CPoint point) + +void CTutorialDlg::OnCbnSelchangeCombo1() { - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sMouse move at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnRButtonDown(UINT nFlags, CPoint point) + +void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sRight mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar); } -void CTutorialDlg::OnBnClickedTimerControlSliders() + +void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) { - UpdateData(true); - // This will fill all UI-connected variables with whatever - // value that is showing on the UI control objects. - // - // In this case, we care most about the value for m_TimerCtrlSliders + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnTimer(nIDEvent); } } // namespace TestNamespace diff --git a/test_data/tst_cppdocument/message_map/TutorialDlg.cpp.expected b/test_data/tst_cppdocument/message_map/TutorialDlg.cpp.expected index 88fcdc9f..1374039b 100644 --- a/test_data/tst_cppdocument/message_map/TutorialDlg.cpp.expected +++ b/test_data/tst_cppdocument/message_map/TutorialDlg.cpp.expected @@ -1,204 +1,132 @@ -#include "stdafx.h" -#include "TutorialApp.h" + +// TutorialDlg.cpp : implementation file +// + +#include "pch.h" +#include "framework.h" +#include "Tutorial.h" #include "TutorialDlg.h" +#include "afxdialogex.h" -// DEBUG_NEW macro allows MFC applications to determine memory leak locations in debug builds #ifdef _DEBUG - #define new DEBUG_NEW +#define new DEBUG_NEW #endif -CTutorialDlg::CTutorialDlg(CWnd* pParent) -: CDialog(CTutorialDlg::IDD, pParent) -, m_EchoText(L"") -, m_HSliderEcho(L"") -, m_VSliderEcho(L"") -, m_MouseEcho(L"") -, m_TimerEcho(L"") -, m_TimerCtrlSliders(TRUE) -, m_OkCount(0) -, m_Seconds(0) +// CTutorialDlg dialog + + + +CTutorialDlg::CTutorialDlg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_TUTORIAL_DIALOG, pParent) + , m_check(FALSE) + , m_message(_T("")) { - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CTutorialDlg::DoDataExchange(CDataExchange* pDX) { - CDialog::DoDataExchange(pDX); - DDX_Text(pDX, IDC_ECHO_AREA, m_EchoText); - DDX_Text(pDX, IDC_H_SLIDER_ECHO, m_HSliderEcho); - DDX_Text(pDX, IDC_V_SLIDER_ECHO, m_VSliderEcho); - DDX_Control(pDX, IDC_V_SLIDER_BAR, m_VSliderBar); - DDX_Control(pDX, IDC_H_SLIDER_BAR, m_HSliderBar); - DDX_Text(pDX, IDC_MOUSEECHO, m_MouseEcho); - DDX_Text(pDX, IDC_TIMERECHO, m_TimerEcho); - DDX_Check(pDX, IDC_TIMER_CONTROL_SLIDERS, m_TimerCtrlSliders); + CDialogEx::DoDataExchange(pDX); + DDX_Check(pDX, IDC_CHECK1, m_check); + DDV_MaxChars(pDX, m_message, 3); // added for testing DDV_ doesn't break extraction! + DDX_Control(pDX, IDC_EDIT1, m_edit); + DDX_Control(pDX, IDC_COMBO1, m_combo); + DDX_Control(pDX, IDC_SLIDER1, m_slider); + DDX_Text(pDX, IDC_MESSAGE, m_message); } -// This is called when the dialog is first created and shown. -// It is a good spot to initialize member variables. -BOOL CTutorialDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon +// CTutorialDlg message handlers - // Add extra initialization here. - // We want to initialize the slider bars - m_VSliderBar.SetRange(0, 100, TRUE); - m_VSliderBar.SetPos(50); - m_VSliderEcho.Format(L"%d", 50); - - m_HSliderBar.SetRange(0, 10, TRUE); - m_HSliderBar.SetPos(5); - m_HSliderEcho.Format(L"%d", 5); +BOOL CTutorialDlg::OnInitDialog() +{ + CDialogEx::OnInitDialog(); - // Initialize the timer to go off every 1000 milliseconds (every second) - // when timer "goes-off", our OnTimer() event handler function will be - // called and it is upto us to decide what we want to do. - SetTimer(0, 1000, NULL); + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon - UpdateData(false); + // TODO: Add extra initialization here - return TRUE; // return TRUE unless you set the focus to a control + return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. -void CTutorialDlg::OnPaint() +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CTutorialDlg::OnPaint() { - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialogEx::OnPaint(); + } } -void CTutorialDlg::OnBnClickedBtnAdd() -{ - m_OkCount++; - m_EchoText.Format(L"%d", m_OkCount); +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +//HCURSOR CTutorialDlg::OnQueryDragIcon() +//{ +// return static_cast(m_hIcon); +//} - // Notice, without UpdateData() status area will _NOT_ be updated. - UpdateData(FALSE); -} -void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void CTutorialDlg::OnBnClickedCheck1() { - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_HSliderBar) - { - int value = m_HSliderBar.GetPos(); - m_HSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnHScroll(nSBCode, nPos, pScrollBar); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_VSliderBar) - { - int value = m_VSliderBar.GetPos(); - m_VSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnVScroll(nSBCode, nPos, pScrollBar); -} -void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) +void CTutorialDlg::OnEnChangeEdit1() { - m_Seconds++; - - if (m_TimerCtrlSliders) - { - // Get ready to decrease the sliders ... - int hvalue = m_HSliderBar.GetPos(); - if (hvalue > 0) - { - m_HSliderBar.SetPos(hvalue-1); - m_HSliderEcho.Format(L"%d", hvalue-1); - } - - int vvalue = m_VSliderBar.GetPos(); - if (vvalue > 0) - { - m_VSliderBar.SetPos(vvalue-1); - m_VSliderEcho.Format(L"%d", vvalue-1); - } - - if ( (hvalue==0) && (vvalue==0) ) - m_TimerCtrlSliders = false; - } - - m_TimerEcho.Format(L"%d: Seconds have passed", m_Seconds); - UpdateData(false); -} + // TODO: If this is a RICHEDIT control, the control will not + // send this notification unless you override the CDialogEx::OnInitDialog() + // function and call CRichEditCtrl().SetEventMask() + // with the ENM_CHANGE flag ORed into the mask. -void CTutorialDlg::OnLButtonDown(UINT nFlags, CPoint point) -{ - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sLeft mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnMouseMove(UINT nFlags, CPoint point) + +void CTutorialDlg::OnCbnSelchangeCombo1() { - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sMouse move at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnRButtonDown(UINT nFlags, CPoint point) + +void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sRight mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar); } -void CTutorialDlg::OnBnClickedTimerControlSliders() + +void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) { - UpdateData(true); - // This will fill all UI-connected variables with whatever - // value that is showing on the UI control objects. - // - // In this case, we care most about the value for m_TimerCtrlSliders + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnTimer(nIDEvent); } diff --git a/test_data/tst_cppdocument/message_map/TutorialDlg.cpp.original b/test_data/tst_cppdocument/message_map/TutorialDlg.cpp.original index 673f24e0..1c7fc39c 100644 --- a/test_data/tst_cppdocument/message_map/TutorialDlg.cpp.original +++ b/test_data/tst_cppdocument/message_map/TutorialDlg.cpp.original @@ -1,214 +1,140 @@ -#include "stdafx.h" -#include "TutorialApp.h" + +// TutorialDlg.cpp : implementation file +// + +#include "pch.h" +#include "framework.h" +#include "Tutorial.h" #include "TutorialDlg.h" +#include "afxdialogex.h" -// DEBUG_NEW macro allows MFC applications to determine memory leak locations in debug builds #ifdef _DEBUG - #define new DEBUG_NEW +#define new DEBUG_NEW #endif -CTutorialDlg::CTutorialDlg(CWnd* pParent) -: CDialog(CTutorialDlg::IDD, pParent) -, m_EchoText(L"") -, m_HSliderEcho(L"") -, m_VSliderEcho(L"") -, m_MouseEcho(L"") -, m_TimerEcho(L"") -, m_TimerCtrlSliders(TRUE) -, m_OkCount(0) -, m_Seconds(0) +// CTutorialDlg dialog + + + +CTutorialDlg::CTutorialDlg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_TUTORIAL_DIALOG, pParent) + , m_check(FALSE) + , m_message(_T("")) { - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CTutorialDlg::DoDataExchange(CDataExchange* pDX) { - CDialog::DoDataExchange(pDX); - DDX_Text(pDX, IDC_ECHO_AREA, m_EchoText); - DDX_Text(pDX, IDC_H_SLIDER_ECHO, m_HSliderEcho); - DDX_Text(pDX, IDC_V_SLIDER_ECHO, m_VSliderEcho); - DDX_Control(pDX, IDC_V_SLIDER_BAR, m_VSliderBar); - DDX_Control(pDX, IDC_H_SLIDER_BAR, m_HSliderBar); - DDX_Text(pDX, IDC_MOUSEECHO, m_MouseEcho); - DDX_Text(pDX, IDC_TIMERECHO, m_TimerEcho); - DDX_Check(pDX, IDC_TIMER_CONTROL_SLIDERS, m_TimerCtrlSliders); + CDialogEx::DoDataExchange(pDX); + DDX_Check(pDX, IDC_CHECK1, m_check); + DDV_MaxChars(pDX, m_message, 3); // added for testing DDV_ doesn't break extraction! + DDX_Control(pDX, IDC_EDIT1, m_edit); + DDX_Control(pDX, IDC_COMBO1, m_combo); + DDX_Control(pDX, IDC_SLIDER1, m_slider); + DDX_Text(pDX, IDC_MESSAGE, m_message); } -BEGIN_MESSAGE_MAP(CTutorialDlg, CDialog) - ON_WM_PAINT() - ON_WM_HSCROLL() - ON_WM_VSCROLL() - ON_WM_TIMER() - ON_WM_LBUTTONDOWN() - ON_WM_MOUSEMOVE() - ON_WM_RBUTTONDOWN() - ON_BN_CLICKED(ID_BTN_ADD, OnBnClickedBtnAdd) - ON_BN_CLICKED(IDC_TIMER_CONTROL_SLIDERS, OnBnClickedTimerControlSliders) +BEGIN_MESSAGE_MAP(CTutorialDlg, CDialogEx) + ON_WM_PAINT() +// ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_CHECK1, &CTutorialDlg::OnBnClickedCheck1) + ON_EN_CHANGE(IDC_EDIT1, &CTutorialDlg::OnEnChangeEdit1) + ON_CBN_SELCHANGE(IDC_COMBO1, &CTutorialDlg::OnCbnSelchangeCombo1) + ON_WM_HSCROLL() + ON_WM_TIMER() END_MESSAGE_MAP() -// This is called when the dialog is first created and shown. -// It is a good spot to initialize member variables. -BOOL CTutorialDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon +// CTutorialDlg message handlers - // Add extra initialization here. - // We want to initialize the slider bars - m_VSliderBar.SetRange(0, 100, TRUE); - m_VSliderBar.SetPos(50); - m_VSliderEcho.Format(L"%d", 50); - - m_HSliderBar.SetRange(0, 10, TRUE); - m_HSliderBar.SetPos(5); - m_HSliderEcho.Format(L"%d", 5); +BOOL CTutorialDlg::OnInitDialog() +{ + CDialogEx::OnInitDialog(); - // Initialize the timer to go off every 1000 milliseconds (every second) - // when timer "goes-off", our OnTimer() event handler function will be - // called and it is upto us to decide what we want to do. - SetTimer(0, 1000, NULL); + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon - UpdateData(false); + // TODO: Add extra initialization here - return TRUE; // return TRUE unless you set the focus to a control + return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. -void CTutorialDlg::OnPaint() +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CTutorialDlg::OnPaint() { - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialogEx::OnPaint(); + } } -void CTutorialDlg::OnBnClickedBtnAdd() -{ - m_OkCount++; - m_EchoText.Format(L"%d", m_OkCount); +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +//HCURSOR CTutorialDlg::OnQueryDragIcon() +//{ +// return static_cast(m_hIcon); +//} - // Notice, without UpdateData() status area will _NOT_ be updated. - UpdateData(FALSE); -} -void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void CTutorialDlg::OnBnClickedCheck1() { - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_HSliderBar) - { - int value = m_HSliderBar.GetPos(); - m_HSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnHScroll(nSBCode, nPos, pScrollBar); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_VSliderBar) - { - int value = m_VSliderBar.GetPos(); - m_VSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnVScroll(nSBCode, nPos, pScrollBar); -} -void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) +void CTutorialDlg::OnEnChangeEdit1() { - m_Seconds++; - - if (m_TimerCtrlSliders) - { - // Get ready to decrease the sliders ... - int hvalue = m_HSliderBar.GetPos(); - if (hvalue > 0) - { - m_HSliderBar.SetPos(hvalue-1); - m_HSliderEcho.Format(L"%d", hvalue-1); - } - - int vvalue = m_VSliderBar.GetPos(); - if (vvalue > 0) - { - m_VSliderBar.SetPos(vvalue-1); - m_VSliderEcho.Format(L"%d", vvalue-1); - } - - if ( (hvalue==0) && (vvalue==0) ) - m_TimerCtrlSliders = false; - } - - m_TimerEcho.Format(L"%d: Seconds have passed", m_Seconds); - UpdateData(false); -} + // TODO: If this is a RICHEDIT control, the control will not + // send this notification unless you override the CDialogEx::OnInitDialog() + // function and call CRichEditCtrl().SetEventMask() + // with the ENM_CHANGE flag ORed into the mask. -void CTutorialDlg::OnLButtonDown(UINT nFlags, CPoint point) -{ - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sLeft mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnMouseMove(UINT nFlags, CPoint point) + +void CTutorialDlg::OnCbnSelchangeCombo1() { - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sMouse move at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnRButtonDown(UINT nFlags, CPoint point) + +void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { - CString prefix; - if(nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if(nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sRight mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar); } -void CTutorialDlg::OnBnClickedTimerControlSliders() + +void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) { - UpdateData(true); - // This will fill all UI-connected variables with whatever - // value that is showing on the UI control objects. - // - // In this case, we care most about the value for m_TimerCtrlSliders + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnTimer(nIDEvent); } diff --git a/test_data/tst_cppdocument/message_map/afx_msg_declaration.h.expected b/test_data/tst_cppdocument/message_map/afx_msg_declaration.h.expected index 4092e400..bd25cfad 100644 --- a/test_data/tst_cppdocument/message_map/afx_msg_declaration.h.expected +++ b/test_data/tst_cppdocument/message_map/afx_msg_declaration.h.expected @@ -1,71 +1,44 @@ -// University of Washington Bothell Graphics Library -// Authors: Kelvin Sung, Steve Baer -// The accompanying library supports CSS Graphics courses taught at UW-Bothell -// See: http://courses.washington.edu/css450/ -// http://courses.washington.edu/css451/ -/////////////////////////////////////////////////////////////////////////////////// -#pragma once - -/// Main dialog for the sample application. This is created and displayed in -/// the CTutorialApp::InitInstance function. -class CTutorialDlg : public CDialog -{ -public: - CTutorialDlg(CWnd* pParent = NULL); - - /// The IDD enum is a common technique in MFC to associate a dialog with - /// a resource that you edit in the dialog editor - enum { IDD = IDD_UPDATEGUI_DIALOG }; - -protected: - /// The virtual DoDataExchange is an MFC method for synchronizing values in this - /// class with their corresponding controls on the dialog. - /// See MSDN documentation for more information - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - /// Called immediately after a dialog is created, but before it is displayed. - /// This is where all of the control initialization usually occurs. This is - /// also where the graphics window is set up - virtual BOOL OnInitDialog(); +// TutorialDlg.h : header file +// - /// A message map is an MFC macro for mapping window's events (paint, size, mouse,...) that - /// occur on a window to functions in this class. - /// The functions in this class that begin with afx_msg are "handlers" for window's messages - DECLARE_MESSAGE_MAP() +#pragma once - /// Called when this dialog receives a WM_PAINT message (event) - /// The MFC wizard adds code to paint properly if this dialog is minimized to the taskbar - afx_msg void OnPaint(); - /// Called when this dialog receives slider scroll messages from the slider controls - /// Horizontal Scroll - afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); +// CTutorialDlg dialog +class CTutorialDlg : public CDialogEx +{ +// Construction +public: + CTutorialDlg(CWnd* pParent = nullptr); // standard constructor - /// Called when this dialog receives slider scroll messages from the slider controls - /// Vertical Scroll - afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - void timerEvent(QTimerEvent *event) override; - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnRButtonDown(UINT nFlags, CPoint point); - /// - /// Called when this dialog receives button click message from the add button - afx_msg void OnBnClickedBtnAdd(); - afx_msg void OnBnClickedTimerControlSliders(); +// Dialog Data +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_TUTORIAL_DIALOG }; +#endif -private: - int m_Seconds; - int m_OkCount; - CString m_EchoText; + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - CString m_HSliderEcho; - CString m_VSliderEcho; - CSliderCtrl m_VSliderBar; - CSliderCtrl m_HSliderBar; - CString m_MouseEcho; - CString m_TimerEcho; +// Implementation +protected: + HICON m_hIcon; - BOOL m_TimerCtrlSliders; - HICON m_hIcon; + // Generated message map functions + virtual BOOL OnInitDialog(); + afx_msg void OnPaint(); +// afx_msg HCURSOR OnQueryDragIcon(); + DECLARE_MESSAGE_MAP() +public: + BOOL m_check; + CEdit m_edit; + CComboBox m_combo; + CSliderCtrl m_slider; + CString m_message; + afx_msg void OnBnClickedCheck1(); + afx_msg void OnEnChangeEdit1(); + afx_msg void OnCbnSelchangeCombo1(); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + void timerEvent(QTimerEvent *event) override; }; diff --git a/test_data/tst_cppdocument/message_map/afx_msg_declaration.h.original b/test_data/tst_cppdocument/message_map/afx_msg_declaration.h.original index b2a4830d..861323c5 100644 --- a/test_data/tst_cppdocument/message_map/afx_msg_declaration.h.original +++ b/test_data/tst_cppdocument/message_map/afx_msg_declaration.h.original @@ -1,71 +1,44 @@ -// University of Washington Bothell Graphics Library -// Authors: Kelvin Sung, Steve Baer -// The accompanying library supports CSS Graphics courses taught at UW-Bothell -// See: http://courses.washington.edu/css450/ -// http://courses.washington.edu/css451/ -/////////////////////////////////////////////////////////////////////////////////// -#pragma once - -/// Main dialog for the sample application. This is created and displayed in -/// the CTutorialApp::InitInstance function. -class CTutorialDlg : public CDialog -{ -public: - CTutorialDlg(CWnd* pParent = NULL); - - /// The IDD enum is a common technique in MFC to associate a dialog with - /// a resource that you edit in the dialog editor - enum { IDD = IDD_UPDATEGUI_DIALOG }; - -protected: - /// The virtual DoDataExchange is an MFC method for synchronizing values in this - /// class with their corresponding controls on the dialog. - /// See MSDN documentation for more information - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - /// Called immediately after a dialog is created, but before it is displayed. - /// This is where all of the control initialization usually occurs. This is - /// also where the graphics window is set up - virtual BOOL OnInitDialog(); +// TutorialDlg.h : header file +// - /// A message map is an MFC macro for mapping window's events (paint, size, mouse,...) that - /// occur on a window to functions in this class. - /// The functions in this class that begin with afx_msg are "handlers" for window's messages - DECLARE_MESSAGE_MAP() +#pragma once - /// Called when this dialog receives a WM_PAINT message (event) - /// The MFC wizard adds code to paint properly if this dialog is minimized to the taskbar - afx_msg void OnPaint(); - /// Called when this dialog receives slider scroll messages from the slider controls - /// Horizontal Scroll - afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); +// CTutorialDlg dialog +class CTutorialDlg : public CDialogEx +{ +// Construction +public: + CTutorialDlg(CWnd* pParent = nullptr); // standard constructor - /// Called when this dialog receives slider scroll messages from the slider controls - /// Vertical Scroll - afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - afx_msg void OnTimer(UINT_PTR nIDEvent); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnRButtonDown(UINT nFlags, CPoint point); - /// - /// Called when this dialog receives button click message from the add button - afx_msg void OnBnClickedBtnAdd(); - afx_msg void OnBnClickedTimerControlSliders(); +// Dialog Data +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_TUTORIAL_DIALOG }; +#endif -private: - int m_Seconds; - int m_OkCount; - CString m_EchoText; + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - CString m_HSliderEcho; - CString m_VSliderEcho; - CSliderCtrl m_VSliderBar; - CSliderCtrl m_HSliderBar; - CString m_MouseEcho; - CString m_TimerEcho; +// Implementation +protected: + HICON m_hIcon; - BOOL m_TimerCtrlSliders; - HICON m_hIcon; + // Generated message map functions + virtual BOOL OnInitDialog(); + afx_msg void OnPaint(); +// afx_msg HCURSOR OnQueryDragIcon(); + DECLARE_MESSAGE_MAP() +public: + BOOL m_check; + CEdit m_edit; + CComboBox m_combo; + CSliderCtrl m_slider; + CString m_message; + afx_msg void OnBnClickedCheck1(); + afx_msg void OnEnChangeEdit1(); + afx_msg void OnCbnSelchangeCombo1(); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + afx_msg void OnTimer(UINT_PTR nIDEvent); }; diff --git a/test_data/tst_project.qml b/test_data/tst_project.qml index b0e0c4af..f4d871f6 100644 --- a/test_data/tst_project.qml +++ b/test_data/tst_project.qml @@ -13,24 +13,24 @@ import Knut Script { function test_allFiles() { - Project.root = Dir.currentScriptPath + "/projects/mfc-tutorial" + Project.root = Dir.currentScriptPath + "/projects/mfc-dialog" var files = Project.allFiles(); - compare(files.length, 10) - compare(files[0], "MFC_UpdateGUI.rc") + compare(files.length, 12) + compare(files[0], "Tutorial.cpp") var rcFiles = Project.allFilesWithExtension("rc"); compare(rcFiles.length, 1) - compare(rcFiles[0], "MFC_UpdateGUI.rc") + compare(rcFiles[0], "Tutorial.rc") } function test_open() { - Project.root = Dir.currentScriptPath + "/projects/mfc-tutorial" + Project.root = Dir.currentScriptPath + "/projects/mfc-dialog" var txtdoc = Project.open("TutorialDlg.cpp") compare(txtdoc.type, Document.Cpp) - var rcdoc = Project.open("MFC_UpdateGUI.rc") + var rcdoc = Project.open("Tutorial.rc") compare(rcdoc.type, Document.Rc) } @@ -43,21 +43,21 @@ Script { simpleResults.sort((a, b) => a.file.localeCompare(b.file)); - compare(simpleResults[0].file, Project.root + "/TutorialApp.cpp") - compare(simpleResults[0].line, 21) + compare(simpleResults[0].file, Project.root + "/Tutorial.cpp") + compare(simpleResults[0].line, 38) compare(simpleResults[0].column, 6) compare(simpleResults[1].file, Project.root + "/TutorialDlg.h") - compare(simpleResults[1].line, 10) + compare(simpleResults[1].line, 9) compare(simpleResults[1].column, 9) - let multilinePattern = "m_VSliderBar\\.SetRange\\(0,\\s*100,\\s*TRUE\\);\\s*m_VSliderBar\\.SetPos\\(50\\);"; + let multilinePattern = "SetIcon\\(m_hIcon,\\s*TRUE\\);.*\\s*SetIcon\\(m_hIcon,\\s*FALSE\\);"; let multilineResults = Project.findInFiles(multilinePattern) compare(multilineResults.length, 1) compare(multilineResults[0].file, Project.root + "/TutorialDlg.cpp") - compare(multilineResults[0].line, 65) - compare(multilineResults[0].column, 3) + compare(multilineResults[0].line, 58) + compare(multilineResults[0].column, 2) } else { Message.warning("Ripgrep (rg) isn't available on the system") diff --git a/test_data/tst_rcdocument.qml b/test_data/tst_rcdocument.qml index dea79c97..4783d673 100644 --- a/test_data/tst_rcdocument.qml +++ b/test_data/tst_rcdocument.qml @@ -13,44 +13,45 @@ import Knut Script { property var document: RcDocument { - fileName: Dir.currentScriptPath + "/rcfiles/2048Game/2048Game.rc" + fileName: Dir.currentScriptPath + "/rcfiles/mainWindow/MainWindow.rc" Component.onCompleted: mergeAllLanguages() } function test_assets() { verify(document.valid) - compare(document.assets.length, 14) + compare(document.assets.length, 2) document.convertAssets(RcDocument.RemoveUnknown | RcDocument.SplitToolBar | RcDocument.ConvertToPng); - compare(document.assets.length, 34) + compare(document.assets.length, 8) compare(document.assets[1].id, "IDR_MAINFRAME_1") + Message.log(document.assets[1].fileName) verify(document.assets[1].fileName.endsWith("res/Toolbar_1.png")) } function test_toolBar() { - compare(document.toolBars.length, 6) - compare(document.toolBars[2].id, "IDR_SORT") - compare(document.toolBars[2].iconSize, Qt.size(16, 15)) - compare(document.toolBars[2].children.length, 2) - compare(document.toolBars[2].children[1].id, "ID_NEW_FOLDER") - - var toolBar = document.toolBar("IDR_MENU_IMAGES") - compare(toolBar.id, "IDR_MENU_IMAGES") - compare(toolBar.children.length, 9) - verify(toolBar.children[1].isSeparator) - compare(toolBar.children[4].id, "ID_TOOLS_MACRO") + compare(document.toolBars.length, 2) + compare(document.toolBars[0].id, "IDR_MAINFRAME") + compare(document.toolBars[0].iconSize, Qt.size(16, 15)) + compare(document.toolBars[0].children.length, 10) + compare(document.toolBars[0].children[1].id, "ID_FILE_OPEN") + + var toolBar = document.toolBar("IDR_MAINFRAME_256") + compare(toolBar.id, "IDR_MAINFRAME_256") + compare(toolBar.children.length, 10) + verify(toolBar.children[3].isSeparator) + compare(toolBar.children[4].id, "ID_EDIT_CUT") } function test_dialog() { - var dialog = document.dialog("IDD_DIALOG1", RcDocument.UpdateGeometry | RcDocument.UpdateHierachy, 2, 2) - compare(dialog.geometry.width, 402) - compare(dialog.geometry.height, 174) + var dialog = document.dialog("IDD_ABOUTBOX", RcDocument.UpdateGeometry | RcDocument.UpdateHierachy, 2, 2) + compare(dialog.geometry.width, 340) + compare(dialog.geometry.height, 124) } function test_menu() { var menu = document.menu("IDR_MAINFRAME") compare(menu.id, "IDR_MAINFRAME") - compare(menu.children.length, 5) + compare(menu.children.length, 4) var editMenu = menu.children[1] var separator = editMenu.children[1] @@ -65,15 +66,11 @@ Script { compare(subAction.text, "&Status Bar") compare(subAction.isAction, true) compare(subAction.id, "ID_VIEW_STATUS_BAR") - var subMenu = viewMenu.children[2] - compare(subMenu.text, "&Application Look") - compare(subMenu.isAction, false) - compare(subMenu.isTopLevel, false) } function test_actions() { var actions = document.actionsFromMenu("IDR_MAINFRAME") - compare(actions.length, 28) + compare(actions.length, 13) var actionFileNew = actions[0] compare(actionFileNew.id, "ID_FILE_NEW"); @@ -85,7 +82,7 @@ Script { Message.log(actionFileNew.iconPath) verify(actionFileNew.iconPath.endsWith("res/Toolbar_0.png")); - var actionEditPaste = actions[12] + var actionEditPaste = actions[9] compare(actionEditPaste.id, "ID_EDIT_PASTE"); compare(actionEditPaste.title, "&Paste"); compare(actionEditPaste.shortcuts.length, 2); @@ -94,7 +91,7 @@ Script { Message.log(actionEditPaste.iconPath) verify(actionEditPaste.iconPath.endsWith("res/Toolbar_5.png")); - var actionPrevPane = actions[25] + var actionPrevPane = actions[12] compare(actionPrevPane.id, "ID_APP_ABOUT"); compare(actionPrevPane.toolTip, "About"); compare(actionPrevPane.statusTip, "Display program information, version number and copyright"); diff --git a/test_data/tst_rcwriter/qrc_expected_default.qrc b/test_data/tst_rcwriter/qrc_expected_default.qrc index 93c6b0e0..5feb7ed0 100644 --- a/test_data/tst_rcwriter/qrc_expected_default.qrc +++ b/test_data/tst_rcwriter/qrc_expected_default.qrc @@ -3,17 +3,5 @@ res/Toolbar.bmp res/Toolbar256.bmp - res/sort.bmp - res/sort_hc.bmp - res/fileview.bmp - res/fileview_hc.bmp - res/classview.bmp - res/classview_hc.bmp - res/explorer.bmp - res/explorer_hc.bmp - res/menuimages.bmp - res/menuimages_hc.bmp - res/properties.bmp - res/properties_hc.bmp \ No newline at end of file diff --git a/test_data/tst_rcwriter/qrc_expected_noalias_onlyexist.qrc b/test_data/tst_rcwriter/qrc_expected_noalias_onlyexist.qrc index 8e1ef53f..cff20cd6 100644 --- a/test_data/tst_rcwriter/qrc_expected_noalias_onlyexist.qrc +++ b/test_data/tst_rcwriter/qrc_expected_noalias_onlyexist.qrc @@ -9,31 +9,5 @@ res/Toolbar_5.png res/Toolbar_6.png res/Toolbar_7.png - res/Toolbar256_0.png - res/Toolbar256_1.png - res/Toolbar256_2.png - res/Toolbar256_3.png - res/Toolbar256_4.png - res/Toolbar256_5.png - res/Toolbar256_6.png - res/Toolbar256_7.png - res/fileview.png - res/fileview_hc.png - res/classview.png - res/classview_hc.png - res/menuimages_0.png - res/menuimages_1.png - res/menuimages_2.png - res/menuimages_3.png - res/menuimages_4.png - res/menuimages_5.png - res/menuimages_6.png - res/menuimages_7.png - res/menuimages_hc.png - res/properties_0.png - res/properties_1.png - res/properties_2.png - res/properties_3.png - res/properties_hc.png \ No newline at end of file diff --git a/test_data/tst_treesitter/mfc-TutorialDlg.cpp b/test_data/tst_treesitter/mfc-TutorialDlg.cpp index 6ed729dc..1c7fc39c 100644 --- a/test_data/tst_treesitter/mfc-TutorialDlg.cpp +++ b/test_data/tst_treesitter/mfc-TutorialDlg.cpp @@ -1,214 +1,140 @@ -#include "stdafx.h" -#include "TutorialApp.h" + +// TutorialDlg.cpp : implementation file +// + +#include "pch.h" +#include "framework.h" +#include "Tutorial.h" #include "TutorialDlg.h" +#include "afxdialogex.h" -// DEBUG_NEW macro allows MFC applications to determine memory leak locations in debug builds #ifdef _DEBUG - #define new DEBUG_NEW +#define new DEBUG_NEW #endif -CTutorialDlg::CTutorialDlg(CWnd* pParent) -: CDialog(CTutorialDlg::IDD, pParent) -, m_EchoText(L"") -, m_HSliderEcho(L"") -, m_VSliderEcho(L"") -, m_MouseEcho(L"") -, m_TimerEcho(L"") -, m_TimerCtrlSliders(TRUE) -, m_OkCount(0) -, m_Seconds(0) +// CTutorialDlg dialog + + + +CTutorialDlg::CTutorialDlg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_TUTORIAL_DIALOG, pParent) + , m_check(FALSE) + , m_message(_T("")) { - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CTutorialDlg::DoDataExchange(CDataExchange* pDX) { - CDialog::DoDataExchange(pDX); - DDX_Text(pDX, IDC_ECHO_AREA, m_EchoText); - DDX_Text(pDX, IDC_H_SLIDER_ECHO, m_HSliderEcho); - DDX_Text(pDX, IDC_V_SLIDER_ECHO, m_VSliderEcho); - DDX_Control(pDX, IDC_V_SLIDER_BAR, m_VSliderBar); - DDX_Control(pDX, IDC_H_SLIDER_BAR, m_HSliderBar); - DDX_Text(pDX, IDC_MOUSEECHO, m_MouseEcho); - DDX_Text(pDX, IDC_TIMERECHO, m_TimerEcho); - DDX_Check(pDX, IDC_TIMER_CONTROL_SLIDERS, m_TimerCtrlSliders); + CDialogEx::DoDataExchange(pDX); + DDX_Check(pDX, IDC_CHECK1, m_check); + DDV_MaxChars(pDX, m_message, 3); // added for testing DDV_ doesn't break extraction! + DDX_Control(pDX, IDC_EDIT1, m_edit); + DDX_Control(pDX, IDC_COMBO1, m_combo); + DDX_Control(pDX, IDC_SLIDER1, m_slider); + DDX_Text(pDX, IDC_MESSAGE, m_message); } -BEGIN_MESSAGE_MAP(CTutorialDlg, CDialog) - ON_WM_PAINT() - ON_WM_HSCROLL() - ON_WM_VSCROLL() - ON_WM_TIMER() - ON_WM_LBUTTONDOWN() - ON_WM_MOUSEMOVE() - ON_WM_RBUTTONDOWN() - ON_BN_CLICKED(ID_BTN_ADD, OnBnClickedBtnAdd) - ON_BN_CLICKED(IDC_TIMER_CONTROL_SLIDERS, OnBnClickedTimerControlSliders) +BEGIN_MESSAGE_MAP(CTutorialDlg, CDialogEx) + ON_WM_PAINT() +// ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_CHECK1, &CTutorialDlg::OnBnClickedCheck1) + ON_EN_CHANGE(IDC_EDIT1, &CTutorialDlg::OnEnChangeEdit1) + ON_CBN_SELCHANGE(IDC_COMBO1, &CTutorialDlg::OnCbnSelchangeCombo1) + ON_WM_HSCROLL() + ON_WM_TIMER() END_MESSAGE_MAP() -// This is called when the dialog is first created and shown. -// It is a good spot to initialize member variables. -BOOL CTutorialDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon +// CTutorialDlg message handlers - // Add extra initialization here. - // We want to initialize the slider bars - m_VSliderBar.SetRange(0, 100, TRUE); - m_VSliderBar.SetPos(50); - m_VSliderEcho.Format(L"%d", 50); - - m_HSliderBar.SetRange(0, 10, TRUE); - m_HSliderBar.SetPos(5); - m_HSliderEcho.Format(L"%d", 5); +BOOL CTutorialDlg::OnInitDialog() +{ + CDialogEx::OnInitDialog(); - // Initialize the timer to go off every 1000 milliseconds (every second) - // when timer "goes-off", our OnTimer() event handler function will be - // called and it is upto us to decide what we want to do. - SetTimer(0, 1000, NULL); + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon - UpdateData(false); + // TODO: Add extra initialization here - return TRUE; // return TRUE unless you set the focus to a control + return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + void CTutorialDlg::OnPaint() { - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialogEx::OnPaint(); + } } -void CTutorialDlg::OnBnClickedBtnAdd() -{ - m_OkCount++; - m_EchoText.Format(L"%d", m_OkCount); +// The system calls this function to obtain the cursor to display while the user drags +// the minimized window. +//HCURSOR CTutorialDlg::OnQueryDragIcon() +//{ +// return static_cast(m_hIcon); +//} - // Notice, without UpdateData() status area will _NOT_ be updated. - UpdateData(FALSE); -} -void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +void CTutorialDlg::OnBnClickedCheck1() { - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_HSliderBar) - { - int value = m_HSliderBar.GetPos(); - m_HSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnHScroll(nSBCode, nPos, pScrollBar); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - // We should check to make sure we know which slider bar is generating the events - if (pScrollBar == (CScrollBar *) &m_VSliderBar) - { - int value = m_VSliderBar.GetPos(); - m_VSliderEcho.Format(L"%d", value); - UpdateData(false); - } - else - CDialog::OnVScroll(nSBCode, nPos, pScrollBar); -} -void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) +void CTutorialDlg::OnEnChangeEdit1() { - m_Seconds++; - - if (m_TimerCtrlSliders) - { - // Get ready to decrease the sliders ... - int hvalue = m_HSliderBar.GetPos(); - if (hvalue > 0) - { - m_HSliderBar.SetPos(hvalue-1); - m_HSliderEcho.Format(L"%d", hvalue-1); - } - - int vvalue = m_VSliderBar.GetPos(); - if (vvalue > 0) - { - m_VSliderBar.SetPos(vvalue-1); - m_VSliderEcho.Format(L"%d", vvalue-1); - } - - if ( (hvalue==0) && (vvalue==0) ) - m_TimerCtrlSliders = false; - } - - m_TimerEcho.Format(L"%d: Seconds have passed", m_Seconds); - UpdateData(false); -} + // TODO: If this is a RICHEDIT control, the control will not + // send this notification unless you override the CDialogEx::OnInitDialog() + // function and call CRichEditCtrl().SetEventMask() + // with the ENM_CHANGE flag ORed into the mask. -void CTutorialDlg::OnLButtonDown(UINT nFlags, CPoint point) -{ - CString prefix; - if (nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if (nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sLeft mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnMouseMove(UINT nFlags, CPoint point) + +void CTutorialDlg::OnCbnSelchangeCombo1() { - CString prefix; - if (nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if (nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sMouse move at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your control notification handler code here } -void CTutorialDlg::OnRButtonDown(UINT nFlags, CPoint point) + +void CTutorialDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { - CString prefix; - if (nFlags & MK_CONTROL) - prefix = L"[CTRL]"; - if (nFlags & MK_SHIFT) - prefix+= L"[SHIFT]"; - m_MouseEcho.Format(L"%sRight mouse down at %d,%d", prefix, point.x, point.y); - UpdateData(false); + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar); } -void CTutorialDlg::OnBnClickedTimerControlSliders() + +void CTutorialDlg::OnTimer(UINT_PTR nIDEvent) { - UpdateData(true); - // This will fill all UI-connected variables with whatever - // value that is showing on the UI control objects. - // - // In this case, we care most about the value for m_TimerCtrlSliders + // TODO: Add your message handler code here and/or call default + + CDialogEx::OnTimer(nIDEvent); } diff --git a/tests/tst_cppdocument_treesitter.cpp b/tests/tst_cppdocument_treesitter.cpp index 93cfebcd..6db8602f 100644 --- a/tests/tst_cppdocument_treesitter.cpp +++ b/tests/tst_cppdocument_treesitter.cpp @@ -25,7 +25,7 @@ private slots: void extractDataExchange() { - Test::testCppDocument("projects/mfc-tutorial", "TutorialDlg.cpp", [](Core::CppDocument *document) { + Test::testCppDocument("projects/mfc-dialog", "TutorialDlg.cpp", [](Core::CppDocument *document) { auto ddx = document->mfcExtractDDX("CTutorialDlg"); QCOMPARE(ddx.className, "CTutorialDlg"); @@ -33,23 +33,23 @@ private slots: QVERIFY(ddx.range.text().startsWith("void CTutorialDlg::DoDataExchange(CDataExchange* pDX)")); QVERIFY(ddx.range.text().endsWith("}")); - QCOMPARE(ddx.entries.size(), 8); - QCOMPARE(ddx.entries.first().function, "DDX_Text"); - QCOMPARE(ddx.entries.first().idc, "IDC_ECHO_AREA"); - QCOMPARE(ddx.entries.first().member, "m_EchoText"); + QCOMPARE(ddx.entries.size(), 5); + QCOMPARE(ddx.entries.first().function, "DDX_Check"); + QCOMPARE(ddx.entries.first().idc, "IDC_CHECK1"); + QCOMPARE(ddx.entries.first().member, "m_check"); QCOMPARE(ddx.entries.at(3).function, "DDX_Control"); - QCOMPARE(ddx.entries.at(3).idc, "IDC_V_SLIDER_BAR"); - QCOMPARE(ddx.entries.at(3).member, "m_VSliderBar"); + QCOMPARE(ddx.entries.at(3).idc, "IDC_SLIDER1"); + QCOMPARE(ddx.entries.at(3).member, "m_slider"); - QCOMPARE(ddx.entries.last().function, "DDX_Check"); - QCOMPARE(ddx.entries.last().idc, "IDC_TIMER_CONTROL_SLIDERS"); - QCOMPARE(ddx.entries.last().member, "m_TimerCtrlSliders"); + QCOMPARE(ddx.entries.last().function, "DDX_Text"); + QCOMPARE(ddx.entries.last().idc, "IDC_MESSAGE"); + QCOMPARE(ddx.entries.last().member, "m_message"); QCOMPARE(ddx.validators.size(), 1); const auto &validator = ddx.validators.first(); QCOMPARE(validator.function, "DDV_MaxChars"); - QCOMPARE(validator.member, "m_EchoText"); + QCOMPARE(validator.member, "m_message"); QCOMPARE(validator.arguments, QStringList({"3"})); }); } @@ -138,18 +138,15 @@ private slots: const QList> expectedEntries = { {"ON_WM_PAINT", {}}, + {"ON_BN_CLICKED", {"IDC_CHECK1", "&CTutorialDlg::OnBnClickedCheck1"}}, + {"ON_EN_CHANGE", {"IDC_EDIT1", "&CTutorialDlg::OnEnChangeEdit1"}}, + {"ON_CBN_SELCHANGE", {"IDC_COMBO1", "&CTutorialDlg::OnCbnSelchangeCombo1"}}, {"ON_WM_HSCROLL", {}}, - {"ON_WM_VSCROLL", {}}, - {"ON_WM_TIMER", {}}, - {"ON_WM_LBUTTONDOWN", {}}, - {"ON_WM_MOUSEMOVE", {}}, - {"ON_WM_RBUTTONDOWN", {}}, - {"ON_BN_CLICKED", {"ID_BTN_ADD", "OnBnClickedBtnAdd"}}, - {"ON_BN_CLICKED", {"IDC_TIMER_CONTROL_SLIDERS", "OnBnClickedTimerControlSliders"}}}; + {"ON_WM_TIMER", {}}}; QVERIFY(messageMap.isValid()); QCOMPARE(messageMap.className, QString("CTutorialDlg")); - QCOMPARE(messageMap.superClass, QString("CDialog")); + QCOMPARE(messageMap.superClass, QString("CDialogEx")); QCOMPARE(messageMap.entries.size(), expectedEntries.size()); for (int i = 0; i < expectedEntries.size(); ++i) { @@ -169,7 +166,7 @@ private slots: { Core::KnutCore core; auto project = Core::Project::instance(); - project->setRoot(Test::testDataPath() + "/projects/mfc-tutorial"); + project->setRoot(Test::testDataPath() + "/projects/mfc-dialog"); auto cppdocument = qobject_cast(Core::Project::instance()->get("TutorialDlg.cpp")); diff --git a/tests/tst_rcparser.cpp b/tests/tst_rcparser.cpp index 698b8797..04f6628b 100644 --- a/tests/tst_rcparser.cpp +++ b/tests/tst_rcparser.cpp @@ -130,9 +130,9 @@ private slots: QCOMPARE(gotoFuncDialog.controls.at(2).styles, styles2); } - void test2048Game() + void testMainWindow() { - RcFile rcFile = parse(Test::testDataPath() + "/rcfiles/2048Game/2048Game.rc"); + RcFile rcFile = parse(Test::testDataPath() + "/rcfiles/mainWindow/MainWindow.rc"); QCOMPARE(rcFile.isValid, true); } diff --git a/tests/tst_rcwriter.cpp b/tests/tst_rcwriter.cpp index 164e91a0..e4343557 100644 --- a/tests/tst_rcwriter.cpp +++ b/tests/tst_rcwriter.cpp @@ -26,7 +26,7 @@ class TestRcwriter : public QObject private slots: void testQrc() { - RcFile rcFile = parse(Test::testDataPath() + "/rcfiles/2048Game/2048Game.rc"); + RcFile rcFile = parse(Test::testDataPath() + "/rcfiles/mainWindow/MainWindow.rc"); auto data = rcFile.data.value("LANG_ENGLISH;SUBLANG_ENGLISH_US"); // Default settings test @@ -34,7 +34,7 @@ private slots: QBuffer buffer; if (buffer.open(QIODevice::WriteOnly)) { auto assets = convertAssets(data, Asset::NoFlags); - writeAssetsToQrc(assets, &buffer, Test::testDataPath() + "/rcfiles/2048Game/2048Game.qrc"); + writeAssetsToQrc(assets, &buffer, Test::testDataPath() + "/rcfiles/mainWindow/MainWindow.qrc"); buffer.close(); } if (buffer.open(QIODevice::ReadOnly)) { @@ -44,12 +44,12 @@ private slots: } } - // Don't add if asset does not exist, don't use aliases + // Don't add if asset does not exist, split toolbars { - QFile buffer; + QBuffer buffer; if (buffer.open(QIODevice::WriteOnly)) { auto assets = convertAssets(data); - writeAssetsToQrc(assets, &buffer, Test::testDataPath() + "/rcfiles/2048Game/2048Game.qrc"); + writeAssetsToQrc(assets, &buffer, Test::testDataPath() + "/rcfiles/mainWindow/MainWindow.qrc"); buffer.close(); } if (buffer.open(QIODevice::ReadOnly)) { @@ -62,26 +62,24 @@ private slots: void testConvertDialog() { - RcFile rcFile = parse(Test::testDataPath() + "/rcfiles/2048Game/2048Game.rc"); - auto usData = rcFile.data.value("LANG_ENGLISH;SUBLANG_ENGLISH_US"); - auto result = convertDialog(usData, usData.dialogs.first(), RcCore::Widget::AllFlags); + RcFile rcFile = parse(Test::testDataPath() + "/rcfiles/luaDebugger/LuaDebugger.rc"); + auto data = rcFile.data.value("LANG_GERMAN;SUBLANG_GERMAN"); + auto result = convertDialog(data, data.dialogs.at(1), RcCore::Widget::AllFlags); - QCOMPARE(result.id, "IDD_ABOUTBOX"); - QCOMPARE(result.geometry, QRect(0, 0, 255, 103)); + QCOMPARE(result.id, "IDD_GOTO"); + QCOMPARE(result.geometry, QRect(0, 0, 273, 95)); QCOMPARE(result.className, "QDialog"); - QCOMPARE(result.properties["windowTitle"].toString(), "About 2048Game"); + QCOMPARE(result.properties["windowTitle"].toString(), "Go To Line"); - auto ukData = rcFile.data.value("LANG_UKRAINIAN;SUBLANG_DEFAULT"); - result = convertDialog(ukData, ukData.dialogs.first(), RcCore::Widget::AllFlags); - QCOMPARE(result.children.size(), 6); + QCOMPARE(result.children.size(), 4); auto item = result.children.at(2); QCOMPARE(item.className, "QPushButton"); QCOMPARE(item.properties.value("text").toString(), "OK"); - QCOMPARE(item.geometry, QRect(96, 108, 75, 24)); + QCOMPARE(item.geometry, QRect(96, 59, 75, 24)); + item = result.children.at(0); + QCOMPARE(item.properties.value("text").toString(), "Line Number:"); item = result.children.last(); - QCOMPARE(item.className, "QComboBox"); - QStringList values = {"3", "4", "5", "6"}; - QCOMPARE(item.properties.value("text").toStringList(), values); + QCOMPARE(item.className, "QLineEdit"); } void testWriteDialog() @@ -126,37 +124,26 @@ private slots: void testConvertAction() { - RcFile rcFile = parse(Test::testDataPath() + "/rcfiles/2048Game/2048Game.rc"); + RcFile rcFile = parse(Test::testDataPath() + "/rcfiles/cryEdit/CryEdit.rc"); auto data = rcFile.data.value("LANG_ENGLISH;SUBLANG_ENGLISH_US"); // MainFrame menu and shortcuts and toolbar auto result = convertActions(data); - QCOMPARE(result.size(), 51); - auto action = result.first(); - QCOMPARE(action.id, "ID_FILE_NEW"); - QCOMPARE(action.title, "&New"); - QCOMPARE(action.toolTip, "New"); - QCOMPARE(action.statusTip, "Create a new document"); + QCOMPARE(result.size(), 690); + auto action = result.at(1); + QCOMPARE(action.id, "ID_FILE_OPEN_LEVEL"); + QCOMPARE(action.title, "Open..."); + QCOMPARE(action.toolTip, "Open"); + QCOMPARE(action.statusTip, "Open an existing level"); QCOMPARE(action.shortcuts.size(), 1); - QCOMPARE(action.shortcuts.first().event, "Ctrl+N"); - QCOMPARE(action.shortcuts.last().event, "Ctrl+N"); - QVERIFY(action.iconPath.endsWith("res/Toolbar_0.png")); - - action = result.value(12); - QCOMPARE(action.id, "ID_EDIT_PASTE"); - QCOMPARE(action.title, "&Paste"); - QCOMPARE(action.shortcuts.size(), 2); - QCOMPARE(action.shortcuts.first().event, "Ctrl+V"); - QCOMPARE(action.shortcuts.last().event, "Shift+Ins"); - QVERIFY(action.iconPath.endsWith("res/Toolbar_5.png")); - - action = result.at(40); - QCOMPARE(action.id, "ID_PREV_PANE"); - QCOMPARE(action.toolTip, "Previous Pane"); - QCOMPARE(action.statusTip, "Switch back to the previous window pane"); - QCOMPARE(action.shortcuts.size(), 1); - QCOMPARE(action.shortcuts.first().event, "Shift+F6"); + QCOMPARE(action.shortcuts.first().event, "Ctrl+O"); + + action = result.value(401); + QCOMPARE(action.id, "ID_VIEW_ERRORREPORT"); + QCOMPARE(action.title, "&Error Report"); + QCOMPARE(action.shortcuts.size(), 0); + QVERIFY(action.checked); } }; diff --git a/tests/tst_textdocument.cpp b/tests/tst_textdocument.cpp index 64070b40..802ea2d2 100644 --- a/tests/tst_textdocument.cpp +++ b/tests/tst_textdocument.cpp @@ -278,7 +278,7 @@ private slots: // When replacing the text in the rangemark, the rangemark should span the new text afterwards. const auto newText = QString("Hello World"); mark.replace(newText); - document.selectRangeMark(mark); + document.selectRange(mark); QCOMPARE(document.selectedText(), newText); // Delete everything in the range mark. diff --git a/tests/tst_treesitter.cpp b/tests/tst_treesitter.cpp index e1ff1f22..50963c6b 100644 --- a/tests/tst_treesitter.cpp +++ b/tests/tst_treesitter.cpp @@ -294,7 +294,7 @@ private slots: cursor.execute(query, tree->rootNode(), std::make_unique(source)); auto matches = cursor.allRemainingMatches(); - QCOMPARE(matches.size(), 2); + QCOMPARE(matches.size(), 3); } void eq_except_predicate_errors()