summaryrefslogtreecommitdiff
path: root/fluid/template_panel.fl
diff options
context:
space:
mode:
authorMatthias Melcher <git@matthiasm.com>2019-02-01 23:16:49 +0100
committerMatthias Melcher <git@matthiasm.com>2019-02-01 23:16:49 +0100
commitd6294ac2fccab7e7ffdfbf1ef63a059bba46c777 (patch)
tree1a95be5794379f1a560da1b90ae21d48b11293b6 /fluid/template_panel.fl
parentaf8e406f883f5190cc48dde62fa42bbc54526f04 (diff)
Reorganized Fluid Template feature (STR #3336).
Diffstat (limited to 'fluid/template_panel.fl')
-rw-r--r--fluid/template_panel.fl31
1 files changed, 28 insertions, 3 deletions
diff --git a/fluid/template_panel.fl b/fluid/template_panel.fl
index 21e929d3c..e7d8b35cb 100644
--- a/fluid/template_panel.fl
+++ b/fluid/template_panel.fl
@@ -129,7 +129,7 @@ if (img) {
callback {if (strlen(template_name->value())) {
template_submit->activate();
if (Fl::event_key() == FL_Enter) template_panel->hide();
-} else template_submit->deactivate();} selected
+} else template_submit->deactivate();}
xywh {198 288 252 25} labelfont 1 when 3 textfont 4
}
Fl_Input template_instance {
@@ -206,7 +206,7 @@ template_browser->remove(item);
template_browser->do_callback();} {}
}
-Function {template_load()} {return_type void
+Function {template_load()} {open return_type void
} {
code {int i;
char name[1024], filename[1024], path[1024], *ptr;
@@ -216,6 +216,30 @@ int num_files;
fluid_prefs.getUserdataPath(path, sizeof(path));
strlcat(path, "templates", sizeof(path));
+int sample_templates_generated = 0;
+fluid_prefs.get("sample_templates_generated", sample_templates_generated, 0);
+
+if (!sample_templates_generated) {
+ strcpy(filename, path);
+ strcat(filename, "/FLTK_License.fl");
+ FILE *f = fopen(filename, "wb");
+ if (f) {
+ fputs(
+"\# data file for the Fltk User Interface Designer (fluid)\\nversion 1.0400\\nheader_name {.h}\\n"
+"code_name {.cxx}\\ncomment {//\\n// \\"$Id$\\"\\n//\\n// @INSTANCE@ for the Fast Light Tool Kit (FLT"
+"K).\\n//\\n// Copyright 1998-2019 by Bill Spitzak and others.\\n//\\n// This library is free sof"
+"tware. Distribution and use rights are outlined in\\n// the file \\"COPYING\\" which should have "
+"been included with this file. If this\\n// file is missing or damaged, see the license at:\\n"
+"//\\n// http://www.fltk.org/COPYING.php\\n//\\n// Please report all bugs and problems on th"
+"e following page:\\n//\\n// http://www.fltk.org/str.php\\n//\\n} {selected in_source in_head"
+"er\\n}\\n\\ncomment {\\n//\\n// End of \\"$Id$\\".\\n//} {in_source in_header\\n}\\n", f);
+ fclose(f);
+ }
+ sample_templates_generated = 1;
+ fluid_prefs.set("sample_templates_generated", sample_templates_generated);
+ fluid_prefs.flush();
+}
+
num_files = fl_filename_list(path, &files);
for (i = 0; i < num_files; i ++) {
@@ -237,7 +261,8 @@ for (i = 0; i < num_files; i ++) {
free(files[i]);
}
-if (num_files > 0) free(files);} {}
+if (num_files > 0) free(files);} {selected
+ }
}
comment {