-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If no items are selected when the user clicks Export, assume they want to export all files. This commit also adds a new Dialog base class, to avoid code duplication, and removes old export code
- Loading branch information
Showing
10 changed files
with
253 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/**************************************************************** | ||
BeebEm - BBC Micro and Master 128 Emulator | ||
Copyright (C) 2023 Chris Needham | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public | ||
License along with this program; if not, write to the Free | ||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
Boston, MA 02110-1301, USA. | ||
****************************************************************/ | ||
|
||
#include <windows.h> | ||
|
||
#include "Dialog.h" | ||
|
||
/****************************************************************************/ | ||
|
||
Dialog::Dialog(HINSTANCE hInstance, | ||
HWND hwndParent, | ||
int DialogID) : | ||
m_hInstance(hInstance), | ||
m_hwndParent(hwndParent), | ||
m_DialogID(DialogID), | ||
m_hwnd(nullptr) | ||
{ | ||
} | ||
|
||
/****************************************************************************/ | ||
|
||
bool Dialog::DoModal() | ||
{ | ||
// Show dialog box | ||
int Result = DialogBoxParam(m_hInstance, | ||
MAKEINTRESOURCE(m_DialogID), | ||
m_hwndParent, | ||
sDlgProc, | ||
reinterpret_cast<LPARAM>(this)); | ||
|
||
return Result == IDOK; | ||
} | ||
|
||
/****************************************************************************/ | ||
|
||
INT_PTR CALLBACK Dialog::sDlgProc(HWND hwnd, | ||
UINT nMessage, | ||
WPARAM wParam, | ||
LPARAM lParam) | ||
{ | ||
Dialog* dialog; | ||
|
||
if (nMessage == WM_INITDIALOG) | ||
{ | ||
SetWindowLongPtr(hwnd, DWLP_USER, lParam); | ||
dialog = reinterpret_cast<Dialog*>(lParam); | ||
dialog->m_hwnd = hwnd; | ||
} | ||
else | ||
{ | ||
dialog = reinterpret_cast<Dialog*>( | ||
GetWindowLongPtr(hwnd, DWLP_USER) | ||
); | ||
} | ||
|
||
if (dialog) | ||
{ | ||
return dialog->DlgProc(nMessage, wParam, lParam); | ||
} | ||
else | ||
{ | ||
return FALSE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/**************************************************************** | ||
BeebEm - BBC Micro and Master 128 Emulator | ||
Copyright (C) 2023 Chris Needham | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public | ||
License along with this program; if not, write to the Free | ||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
Boston, MA 02110-1301, USA. | ||
****************************************************************/ | ||
|
||
#ifndef DIALOG_HEADER | ||
#define DIALOG_HEADER | ||
|
||
class Dialog | ||
{ | ||
public: | ||
Dialog( | ||
HINSTANCE hInstance, | ||
HWND hwndParent, | ||
int DialogID | ||
); | ||
|
||
public: | ||
bool DoModal(); | ||
|
||
private: | ||
static INT_PTR CALLBACK sDlgProc( | ||
HWND hwnd, | ||
UINT nMessage, | ||
WPARAM wParam, | ||
LPARAM lParam | ||
); | ||
|
||
virtual INT_PTR DlgProc( | ||
UINT nMessage, | ||
WPARAM wParam, | ||
LPARAM lParam | ||
) = 0; | ||
|
||
protected: | ||
HINSTANCE m_hInstance; | ||
HWND m_hwndParent; | ||
int m_DialogID; | ||
HWND m_hwnd; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.