From dd7d0561b3c7a357490b991be0889171d0051712 Mon Sep 17 00:00:00 2001 From: Takanori Nakane Date: Sat, 11 Nov 2023 00:22:37 +0900 Subject: [PATCH] ManualPicker: automatically save when closing the window --- src/manualpicker.cpp | 14 +++++++++----- src/manualpicker.h | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/manualpicker.cpp b/src/manualpicker.cpp index 384c51d63..0191accb7 100644 --- a/src/manualpicker.cpp +++ b/src/manualpicker.cpp @@ -250,6 +250,7 @@ int manualpickerGuiWindow::fill() { color(GUI_BACKGROUND_COLOR); + this->callback(cb_closing); Fl_Menu_Bar *menubar = new Fl_Menu_Bar(0, 0, w(), 25); if (do_allow_save) @@ -580,15 +581,22 @@ void manualpickerGuiWindow::cb_menubar_quit(Fl_Widget* w, void* v) void manualpickerGuiWindow::cb_menubar_quit_i() { - cb_menubar_save_i(); + cb_menubar_recount_i(); exit(0); } +void manualpickerGuiWindow::cb_closing(Fl_Widget* w, void* v) +{ + manualpickerGuiWindow* T=(manualpickerGuiWindow*)w; + T->cb_menubar_quit_i(); +} + void manualpickerGuiWindow::cb_menubar_recount(Fl_Widget* w, void* v) { manualpickerGuiWindow* T=(manualpickerGuiWindow*)v; T->cb_menubar_recount_i(); } + void manualpickerGuiWindow::cb_menubar_recount_i() { @@ -781,10 +789,6 @@ void ManualPicker::initialise() global_lowpass = new_nyquist; std::cout << " Set low-pass filter to " << global_lowpass << " due to downscaling of " << global_micscale << std::endl; } - - std::cerr << " NOTE: in order to write the new list of coordinate STAR files, you need to re-count the particles or quite this program through the File menu. Do NOT kill the program using the operating system's window manager!" << std::endl; - - } void ManualPicker::run() diff --git a/src/manualpicker.h b/src/manualpicker.h index 5201ab93d..5f548d400 100644 --- a/src/manualpicker.h +++ b/src/manualpicker.h @@ -104,6 +104,8 @@ class manualpickerGuiWindow : public Fl_Window static void cb_menubar_quit(Fl_Widget*, void*); inline void cb_menubar_quit_i(); + static void cb_closing(Fl_Widget*, void*); + static void cb_menubar_recount(Fl_Widget*, void*); inline void cb_menubar_recount_i();