summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-01-26 16:23:35 +0100
committerMatthias Melcher <github@matthiasm.com>2023-01-26 16:32:17 +0100
commite2028c66fea5fd3d4ee16de098ed596e8fc0688c (patch)
treead4b798a63f1e11d88656a0e3e9b2ee28b166ee6
parent1581662d007ca201d0e0655414154dd2efbd8e10 (diff)
STR 2936: FLUID: option to ignore syntax check in DeclBlock
-rw-r--r--fluid/Fl_Function_Type.cxx27
-rw-r--r--src/fl_ask.cxx6
2 files changed, 20 insertions, 13 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx
index c19077b59..eeb11ee1a 100644
--- a/fluid/Fl_Function_Type.cxx
+++ b/fluid/Fl_Function_Type.cxx
@@ -1401,23 +1401,28 @@ void Fl_DeclBlock_Type::open() {
declblock_panel->show();
const char* message = 0;
for (;;) { // repeat as long as there are errors
- if (message) fl_alert("%s", message);
for (;;) {
Fl_Widget* w = Fl::readqueue();
if (w == declblock_panel_cancel) goto BREAK2;
else if (w == declblock_panel_ok) break;
else if (!w) Fl::wait();
}
- const char*c = decl_before_input->value();
- while (isspace(*c)) c++;
- message = c_check(c&&c[0]=='#' ? c+1 : c);
- if (message) continue;
- name(c);
- c = decl_after_input->value();
- while (isspace(*c)) c++;
- message = c_check(c&&c[0]=='#' ? c+1 : c);
- if (message) continue;
- storestring(c,after);
+ const char* a = decl_before_input->value();
+ while (isspace(*a)) a++;
+ const char* b = decl_after_input->value();
+ while (isspace(*b)) b++;
+ message = c_check(a&&a[0]=='#' ? a+1 : a);
+ if (!message)
+ message = c_check(b&&b[0]=='#' ? b+1 : b);
+ if (message) {
+ int v = fl_choice("%s", "try again", "keep anyway", "cancel", message);
+ printf("%d\n", v);
+ if (v==0) continue; // try again
+ if (v==1) ; // keep input
+ if (v==2) goto BREAK2;
+ }
+ name(a);
+ storestring(b, after);
if (public_ != declblock_public_choice->value()) {
set_modflag(1);
public_ = declblock_public_choice->value();
diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx
index 3fe0e2e96..5657cd3b0 100644
--- a/src/fl_ask.cxx
+++ b/src/fl_ask.cxx
@@ -208,8 +208,10 @@ int fl_ask(const char *fmt, ...) {
\param[in] b0 text label for right button 0
\param[in] b1 text label for middle button 1 (can be 0)
\param[in] b2 text label for left button 2 (can be 0)
- \retval 0 if the button with \p b0 text is pushed
- \retval 1 if the button with \p b1 text is pushed
+ \retval 0 if the button with \p b0 text is pushed or the user pressed
+ the \c Escape key or clicked the window close button
+ \retval 1 if the button with \p b1 text is pushed or the user pressed
+ the \c Return key
\retval 2 if the button with \p b2 text is pushed
*/
int fl_choice(const char *fmt, const char *b0, const char *b1, const char *b2, ...) {