Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
17681ad2
Commit
17681ad2
authored
Jan 12, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use TaskDialog (windows vista+) for asking to save the set
parent
f6721f15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
+44
-2
src/gui/set/window.cpp
src/gui/set/window.cpp
+44
-2
No files found.
src/gui/set/window.cpp
View file @
17681ad2
...
@@ -358,10 +358,52 @@ void SetWindow::onClose(wxCloseEvent& ev) {
...
@@ -358,10 +358,52 @@ void SetWindow::onClose(wxCloseEvent& ev) {
}
}
}
}
int
ask_save_changes_impl
(
wxWindow
*
parent
,
String
const
&
message
,
String
const
&
title
)
{
#if defined(__WXMSW__) && defined(UNICODE)
// Do we have the TaskDialogIndirect function?
HMODULE
h
=
::
LoadLibrary
(
L"comctl32.dll"
);
if
(
!
h
)
return
0
;
typedef
HRESULT
(
WINAPI
*
type_TaskDialogIndirect
)(
const
TASKDIALOGCONFIG
*
pTaskConfig
,
int
*
pnButton
,
int
*
pnRadioButton
,
BOOL
*
pfVerificationFlagChecked
);
type_TaskDialogIndirect
func_TaskDialogIndirect
=
!
h
?
nullptr
:
(
type_TaskDialogIndirect
)
::
GetProcAddress
(
h
,
"TaskDialogIndirect"
);
if
(
!
func_TaskDialogIndirect
)
return
0
;
int
nButtonPressed
=
0
;
TASKDIALOGCONFIG
config
=
{
0
};
const
TASKDIALOG_BUTTON
buttons
[]
=
{
{
IDYES
,
L"&Save"
},
{
IDNO
,
L"Do&n't Save"
}
};
config
.
cbSize
=
sizeof
(
config
);
config
.
dwCommonButtons
=
TDCBF_CANCEL_BUTTON
;
config
.
pszWindowTitle
=
title
.
c_str
();
config
.
pszMainInstruction
=
message
.
c_str
();
config
.
pButtons
=
buttons
;
config
.
cButtons
=
ARRAYSIZE
(
buttons
);
config
.
hwndParent
=
(
HWND
)(
parent
->
GetHWND
());
// without this the dialog is not modal
func_TaskDialogIndirect
(
&
config
,
&
nButtonPressed
,
NULL
,
NULL
);
FreeLibrary
(
h
);
switch
(
nButtonPressed
)
{
case
IDYES
:
return
wxYES
;
case
IDNO
:
return
wxNO
;
default:
return
wxCANCEL
;
}
#else
return
0
;
#endif
}
// Fancy save dialog
int
ask_save_changes
(
wxWindow
*
parent
,
String
const
&
message
,
String
const
&
title
)
{
int
result
=
ask_save_changes_impl
(
parent
,
message
,
title
);
if
(
result
)
return
result
;
// Use a normal message box
return
wxMessageBox
(
message
,
title
,
wxYES_NO
|
wxCANCEL
|
wxICON_EXCLAMATION
,
parent
);
}
bool
SetWindow
::
askSaveAndContinue
()
{
bool
SetWindow
::
askSaveAndContinue
()
{
if
(
set
->
actions
.
atSavePoint
())
return
true
;
if
(
set
->
actions
.
atSavePoint
())
return
true
;
// todo : if more then one window has the set selected it's ok to proceed
int
save
=
ask_save_changes
(
this
,
_LABEL_1_
(
"save changes"
,
set
->
short_name
),
_TITLE_
(
"save changes"
));
int
save
=
wxMessageBox
(
_LABEL_1_
(
"save changes"
,
set
->
short_name
),
_TITLE_
(
"save changes"
),
wxYES_NO
|
wxCANCEL
|
wxICON_EXCLAMATION
);
if
(
save
==
wxYES
)
{
if
(
save
==
wxYES
)
{
// save the set
// save the set
try
{
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment