summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-09-26 00:29:14 +0200
committerMatthias Melcher <github@matthiasm.com>2023-09-26 00:29:26 +0200
commit0a2f05a2fe2898ee1407319a6764018fdf54e562 (patch)
treec71eb3a9c9bbab15b38730bde6b0f4a429e62c02 /fluid
parentb8fa522ca42407515f28dcdba4caddefe211ca27 (diff)
FLUID: Fixes regression #777
Wrote wrong path in #inlude statement under certain conditions. Also removed 'snap' tag if not needed.
Diffstat (limited to 'fluid')
-rw-r--r--fluid/Fd_Snap_Action.cxx8
-rw-r--r--fluid/about_panel.fl5
-rw-r--r--fluid/alignment_panel.fl2
-rw-r--r--fluid/code.cxx2
-rw-r--r--fluid/fluid.cxx22
-rw-r--r--fluid/function_panel.fl5
-rw-r--r--fluid/print_panel.fl5
-rw-r--r--fluid/sourceview_panel.fl12
-rw-r--r--fluid/template_panel.fl5
-rw-r--r--fluid/widget_panel.fl5
10 files changed, 27 insertions, 44 deletions
diff --git a/fluid/Fd_Snap_Action.cxx b/fluid/Fd_Snap_Action.cxx
index c1ac3982b..3f52907ad 100644
--- a/fluid/Fd_Snap_Action.cxx
+++ b/fluid/Fd_Snap_Action.cxx
@@ -714,6 +714,14 @@ void Fd_Layout_List::read(Fl_Preferences &prefs, int storage) {
Write Suite and Layout selection and project layout data to an .fl project file.
*/
void Fd_Layout_List::write(Fd_Project_Writer *out) {
+ // Don't write the Snap field if no custom layout was used
+ if ((current_suite()==0) && (current_preset()==0)) {
+ int nSuite = 0;
+ for (int i=0; i<list_size_; i++) {
+ if (list_[i].storage_ == FD_STORE_PROJECT) nSuite++;
+ }
+ if (nSuite == 0) return;
+ }
out->write_string("\nsnap {\n ver 1\n");
out->write_string(" current_suite "); out->write_word(list_[current_suite()].name_); out->write_string("\n");
out->write_string(" current_preset %d\n", current_preset());
diff --git a/fluid/about_panel.fl b/fluid/about_panel.fl
index 8c524a5dd..c39d839c2 100644
--- a/fluid/about_panel.fl
+++ b/fluid/about_panel.fl
@@ -2,11 +2,6 @@
version 1.0400
header_name {.h}
code_name {.cxx}
-snap {
- ver 1
- current_suite FLTK
- current_preset 1
-}
comment {//
// About dialog for the Fast Light Tool Kit (FLTK).
//
diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl
index 845d7b7f6..da80df3a4 100644
--- a/fluid/alignment_panel.fl
+++ b/fluid/alignment_panel.fl
@@ -5,7 +5,7 @@ code_name {.cxx}
snap {
ver 1
current_suite FLTK
- current_preset 1
+ current_preset 0
suite {
name {FLUID (based on FLTK)}
preset { 1
diff --git a/fluid/code.cxx b/fluid/code.cxx
index 561d6fca7..1a66895a6 100644
--- a/fluid/code.cxx
+++ b/fluid/code.cxx
@@ -771,7 +771,7 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
} else if (g_project.header_file_name[0] == '.' && strchr(g_project.header_file_name.c_str(), '/') == NULL) {
write_c("#include \"%s\"\n", fl_filename_name(t));
} else {
- write_c("#include \"%s\"\n", t);
+ write_c("#include \"%s\"\n", g_project.header_file_name.c_str());
}
}
Fl_String loc_include, loc_conditional;
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx
index 2a95cfd0b..7fc5b3add 100644
--- a/fluid/fluid.cxx
+++ b/fluid/fluid.cxx
@@ -311,6 +311,10 @@ void Fluid_Project::reset() {
code_file_set = 0;
header_file_name = ".h";
code_file_name = ".cxx";
+
+ g_layout_list.remove_all(FD_STORE_PROJECT);
+ g_layout_list.current_suite(0);
+ g_layout_list.current_preset(0);
}
void Fluid_Project::update_settings_dialog() {
@@ -1127,29 +1131,31 @@ int write_code_files()
// -- write the code and header files
if (!batch_mode) enter_project_dir();
int x = f.write_code(code_filename.c_str(), header_filename.c_str());
+ Fl_String code_filename_rel = fl_filename_relative(code_filename);
+ Fl_String header_filename_rel = fl_filename_relative(header_filename);
if (!batch_mode) leave_project_dir();
// -- print error message in batch mode or pop up an error or confirmation dialog box
if (batch_mode) {
if (!x) {
fprintf(stderr, "%s and %s: %s\n",
- code_filename.c_str(),
- header_filename.c_str(),
+ code_filename_rel.c_str(),
+ header_filename_rel.c_str(),
strerror(errno));
exit(1);
}
} else {
if (!x) {
- fl_message("Can't write %s and %s: %s",
- code_filename.c_str(),
- header_filename.c_str(),
+ fl_message("Can't write %s or %s: %s",
+ code_filename_rel.c_str(),
+ header_filename_rel.c_str(),
strerror(errno));
} else {
set_modflag(-1, 0);
if (completion_button->value()) {
fl_message("Wrote %s and %s",
- g_project.codefile_name().c_str(),
- g_project.headerfile_name().c_str());
+ code_filename_rel.c_str(),
+ header_filename_rel.c_str());
}
}
}
@@ -2080,7 +2086,7 @@ int main(int argc,char **argv) {
exit(0);
}
- // don't lock up if silly command line arguments were given
+ // don't lock up if inconsistent command line arguments were given
if (batch_mode)
exit(0);
diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl
index bb29b403d..d4974b3c4 100644
--- a/fluid/function_panel.fl
+++ b/fluid/function_panel.fl
@@ -2,11 +2,6 @@
version 1.0400
header_name {.h}
code_name {.cxx}
-snap {
- ver 1
- current_suite FLTK
- current_preset 1
-}
comment {//
// Code dialogs for the Fast Light Tool Kit (FLTK).
//
diff --git a/fluid/print_panel.fl b/fluid/print_panel.fl
index 47ce530d7..98d09a641 100644
--- a/fluid/print_panel.fl
+++ b/fluid/print_panel.fl
@@ -2,11 +2,6 @@
version 1.0400
header_name {.h}
code_name {.cxx}
-snap {
- ver 1
- current_suite FLTK
- current_preset 1
-}
comment {//
// FLUID print panel for the Fast Light Tool Kit (FLTK).
//
diff --git a/fluid/sourceview_panel.fl b/fluid/sourceview_panel.fl
index 37c38d2fb..e78224677 100644
--- a/fluid/sourceview_panel.fl
+++ b/fluid/sourceview_panel.fl
@@ -2,11 +2,6 @@
version 1.0400
header_name {.h}
code_name {.cxx}
-snap {
- ver 1
- current_suite FLTK
- current_preset 1
-}
comment {//
// Code dialogs for the Fast Light Tool Kit (FLTK).
//
@@ -31,7 +26,7 @@ decl {\#include "fluid.h"} {private local
decl {\#include "file.h"} {private local
}
-decl {\#include "../src/flstring.h"} {selected private local
+decl {\#include "../src/flstring.h"} {private local
}
decl {\#include <FL/Fl_Tabs.H>} {private local
@@ -136,8 +131,6 @@ and load those into the Code Viewer widgets.} open return_type void
sv_strings->buffer()->loadfile(fn);
sv_strings->scroll(top, 0);
} else if (sv_source->visible_r() || sv_header->visible_r()) {
- g_project.basename = fl_filename_name(sv_source_filename);
- g_project.basename = fl_filename_setext(g_project.basename, "");
Fl_String code_file_name_bak = g_project.code_file_name;
g_project.code_file_name = sv_source_filename;
Fl_String header_file_name_bak = g_project.header_file_name;
@@ -162,7 +155,8 @@ and load those into the Code Viewer widgets.} open return_type void
g_project.code_file_name = code_file_name_bak;
g_project.header_file_name = header_file_name_bak;
- }} {}
+ }} {selected
+ }
}
Function {update_sourceview_timer(void*)} {
diff --git a/fluid/template_panel.fl b/fluid/template_panel.fl
index 0ac6d3363..3d30be846 100644
--- a/fluid/template_panel.fl
+++ b/fluid/template_panel.fl
@@ -2,11 +2,6 @@
version 1.0400
header_name {.h}
code_name {.cxx}
-snap {
- ver 1
- current_suite FLTK
- current_preset 1
-}
comment {//
// FLUID template support for the Fast Light Tool Kit (FLTK).
//
diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl
index 139dbe716..a3fc6fc25 100644
--- a/fluid/widget_panel.fl
+++ b/fluid/widget_panel.fl
@@ -2,11 +2,6 @@
version 1.0400
header_name {.h}
code_name {.cxx}
-snap {
- ver 1
- current_suite FLTK
- current_preset 1
-}
comment {//
// Widget panel for the Fast Light Tool Kit (FLTK).
//