Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManualPicker: automatically save when closing the window #1028

Merged
merged 4 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/displayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,10 @@ int pickerViewerCanvas::handle(int ev)
else if ( strcmp(m->label(), "Help") == 0 )
printHelp();
else if ( strcmp(m->label(), "Quit (CTRL-q)") == 0 )
exit(0);
{
saveCoordinates(false);
exit(0);
}
redraw();
return 1; // (tells caller we handled this event)
}
Expand Down
14 changes: 9 additions & 5 deletions src/manualpicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
{

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions src/manualpicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Loading