make give_help()'s force_help a bool arg
This commit is contained in:
@@ -533,11 +533,10 @@ void cDialog::run(std::function<void(cDialog&)> onopen){
|
||||
makeFrontWindow(*parentWin);
|
||||
}
|
||||
|
||||
void cDialog::runWithHelp(short help1, short help2) {
|
||||
extern void give_help(short help1, short help2, cDialog& parent);
|
||||
run([help1, help2](cDialog& me) -> void {
|
||||
give_help(help1, help2, me);
|
||||
});
|
||||
void cDialog::runWithHelp(short help1, short help2, bool help_forced) {
|
||||
using namespace std::placeholders;
|
||||
extern void give_help(short help1, short help2, cDialog& parent, bool help_forced);
|
||||
run(std::bind(&give_help,help1, help2, _1, help_forced));
|
||||
}
|
||||
|
||||
// This method is a main event event loop of the dialog.
|
||||
|
@@ -116,7 +116,7 @@ public:
|
||||
/// @param onopen A function to be called after the dialog is displayed but before the event loop starts.
|
||||
void run(std::function<void(cDialog&)> onopen = nullptr); // cd_run_dialog
|
||||
/// Show this dialog. Before starting its event loop, show a help window if it hasn't been shown before.
|
||||
void runWithHelp(short help1, short help2);
|
||||
void runWithHelp(short help1, short help2, bool help_forced = false);
|
||||
/// Get the result of the dialog.
|
||||
/// @tparam type The result type.
|
||||
/// @throw boost::bad_any_cast if the provided result type is different from the type set by setResult().
|
||||
|
@@ -124,14 +124,9 @@ void showFatalError(std::string str1, std::string str2, cDialog* parent) {
|
||||
}
|
||||
|
||||
// Call this anywhere, but don't forget parent!!!
|
||||
static void give_help(short help1,short help2,cDialog* parent) {
|
||||
bool help_forced = false;
|
||||
static void give_help(short help1,short help2,cDialog* parent,bool help_forced) {
|
||||
std::string str1,str2;
|
||||
|
||||
if(help1 >= 200) {
|
||||
help_forced = true;
|
||||
help1 -= 200;
|
||||
}
|
||||
if(!help_forced && (!get_bool_pref("ShowInstantHelp", true) || get_iarray_pref_contains("ReceivedHelp", help1)))
|
||||
return;
|
||||
append_iarray_pref("ReceivedHelp", help1);
|
||||
@@ -144,10 +139,10 @@ static void give_help(short help1,short help2,cDialog* parent) {
|
||||
display_strings.show();
|
||||
}
|
||||
|
||||
void give_help(short help1, short help2) {
|
||||
give_help(help1, help2, nullptr);
|
||||
void give_help(short help1, short help2, bool help_forced) {
|
||||
give_help(help1, help2, nullptr, help_forced);
|
||||
}
|
||||
|
||||
void give_help(short help1, short help2, cDialog& parent) {
|
||||
give_help(help1, help2, &parent);
|
||||
void give_help(short help1, short help2, cDialog& parent, bool help_forced) {
|
||||
give_help(help1, help2, &parent, help_forced);
|
||||
}
|
@@ -88,7 +88,7 @@ void showWarning(std::string str1, std::string str2, cDialog* parent = nullptr);
|
||||
void showWarning(std::string str1, cDialog* parent = nullptr);
|
||||
|
||||
// Show a help window with the given messages from rsrc/strings/help.txt:
|
||||
void give_help(short help1, short help2);
|
||||
void give_help(short help1, short help2, cDialog& parent);
|
||||
void give_help(short help1, short help2, bool help_forced = false);
|
||||
void give_help(short help1, short help2, cDialog& parent, bool help_forced = false);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user