FLUID: Fixes completion dialog, early shell read.

* when saving the source code from a shell command, the
  completion dialog is  suppressed because the shell window
  pops up anyway, confirming our action
* when reading no project at startup, the user shell commands
  were read, but the shell main menu was not updated
This commit is contained in:
Matthias Melcher 2023-10-23 11:46:41 +02:00
parent 39a157a7dd
commit 667d5b9b72
3 changed files with 10 additions and 9 deletions

View File

@ -1212,7 +1212,7 @@ Fl_String Fluid_Project::basename() const {
\return 1 if the operation failed, 0 if it succeeded
*/
int write_code_files()
int write_code_files(bool dont_show_completion_dialog)
{
// -- handle user interface issues
flush_text_widgets();
@ -1250,7 +1250,7 @@ int write_code_files()
strerror(errno));
} else {
set_modflag(-1, 0);
if (completion_button->value()) {
if (dont_show_completion_dialog==false && completion_button->value()) {
fl_message("Wrote %s and %s",
code_filename_rel.c_str(),
header_filename_rel.c_str());
@ -1835,8 +1835,6 @@ void make_main_window() {
if (!batch_mode) {
load_history();
g_shell_config = new Fd_Shell_Command_List;
// TODO: load example commands if this is the very first time we use this
// g_shell_config->restore_defaults();
make_settings_window();
}
}
@ -2139,12 +2137,15 @@ int main(int argc,char **argv) {
Fl_File_Icon::load_system_icons();
main_window->callback(exit_cb);
position_window(main_window,"main_window_pos", 1, 10, 30, WINWIDTH, WINHEIGHT );
if (g_shell_config) {
g_shell_config->read(fluid_prefs, FD_STORE_USER);
g_shell_config->update_settings_dialog();
g_shell_config->rebuild_shell_menu();
}
g_layout_list.read(fluid_prefs, FD_STORE_USER);
main_window->show(argc,argv);
toggle_widgetbin_cb(0,0);
toggle_sourceview_cb(0,0);
if (g_shell_config)
g_shell_config->read(fluid_prefs, FD_STORE_USER);
g_layout_list.read(fluid_prefs, FD_STORE_USER);
if (!c && openlast_button->value() && absolute_history[0][0]) {
// Open previous file when no file specified...
open_project_file(absolute_history[0]);

View File

@ -155,7 +155,7 @@ extern void save_template_cb(Fl_Widget *, void *);
extern void revert_cb(Fl_Widget *,void *);
extern void exit_cb(Fl_Widget *,void *);
extern int write_code_files();
extern int write_code_files(bool dont_show_completion_dialog=false);
extern void write_strings_cb(Fl_Widget *, void *);
extern void align_widget_cb(Fl_Widget *, long);
extern void toggle_widgetbin_cb(Fl_Widget *, void *);

View File

@ -301,7 +301,7 @@ static bool prepare_shell_command(int flags) {
save_cb(0, 0);
}
if (flags & Fd_Shell_Command::SAVE_SOURCECODE) {
write_code_files();
write_code_files(true);
}
if (flags & Fd_Shell_Command::SAVE_STRINGS) {
write_strings_cb(0, 0);