2005-11-02 19:06:55 +00:00
|
|
|
//
|
|
|
|
|
// FLUID template support for the Fast Light Tool Kit (FLTK).
|
|
|
|
|
//
|
2020-04-06 18:04:16 +00:00
|
|
|
// Copyright 1998-2020 by Bill Spitzak and others.
|
2005-11-02 19:06:55 +00:00
|
|
|
//
|
2011-07-19 04:49:30 +00:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
|
//
|
2020-04-06 18:04:16 +00:00
|
|
|
// https://www.fltk.org/COPYING.php
|
2005-11-02 19:06:55 +00:00
|
|
|
//
|
2020-07-01 16:03:10 +00:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-11-02 19:06:55 +00:00
|
|
|
//
|
2020-07-01 16:03:10 +00:00
|
|
|
// https://www.fltk.org/bugs.php
|
2005-11-02 19:06:55 +00:00
|
|
|
//
|
|
|
|
|
|
2025-03-06 17:16:03 +00:00
|
|
|
// generated by Fast Light User Interface Designer (fluid) version 1.0500
|
2005-11-02 19:06:55 +00:00
|
|
|
|
|
|
|
|
#include "template_panel.h"
|
2021-12-08 14:52:15 +00:00
|
|
|
#include "fluid.h"
|
|
|
|
|
#include <FL/Fl_Shared_Image.H>
|
|
|
|
|
#include <FL/fl_ask.H>
|
2022-01-16 18:02:36 +00:00
|
|
|
#include <FL/fl_string_functions.h>
|
2023-10-22 17:30:37 +00:00
|
|
|
#include "fluid_filename.h"
|
2021-12-08 14:52:15 +00:00
|
|
|
#include "../src/flstring.h"
|
2005-11-02 19:06:55 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <errno.h>
|
2023-11-16 12:21:17 +00:00
|
|
|
#include <zlib.h>
|
2018-02-09 14:39:42 +00:00
|
|
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
2005-11-02 19:06:55 +00:00
|
|
|
#include <io.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <unistd.h>
|
2018-02-09 14:39:42 +00:00
|
|
|
#endif // _WIN32 && !__CYGWIN__
|
2005-11-02 19:06:55 +00:00
|
|
|
|
|
|
|
|
Fl_Double_Window *template_panel=(Fl_Double_Window *)0;
|
|
|
|
|
|
|
|
|
|
static void cb_template_panel(Fl_Double_Window*, void*) {
|
|
|
|
|
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
|
2021-12-11 02:33:25 +00:00
|
|
|
if (img) img->release();
|
|
|
|
|
template_preview->image(0);
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
template_browser->deselect();
|
|
|
|
|
template_name->value("");
|
|
|
|
|
template_instance->value("");
|
|
|
|
|
template_panel->hide();
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Fl_Browser *template_browser=(Fl_Browser *)0;
|
|
|
|
|
|
|
|
|
|
static void cb_template_browser(Fl_Browser*, void*) {
|
|
|
|
|
if (Fl::event_clicks()) {
|
2021-12-11 02:33:25 +00:00
|
|
|
template_panel->hide();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
|
|
|
|
|
if (img) img->release();
|
|
|
|
|
template_preview->image(0);
|
2005-11-02 19:06:55 +00:00
|
|
|
template_preview->redraw();
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
int item = template_browser->value();
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
if (item <= 1) template_instance->deactivate();
|
|
|
|
|
else template_instance->activate();
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
if (item < 1) {
|
|
|
|
|
template_submit->deactivate();
|
|
|
|
|
template_delete->deactivate();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
template_submit->activate();
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
const char *flfile = (const char *)template_browser->data(item);
|
|
|
|
|
if (!flfile) {
|
|
|
|
|
template_delete->deactivate();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
template_name->value(template_browser->text(item));
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
template_delete->activate();
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
char pngfile[1024], *ext;
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
strlcpy(pngfile, flfile, sizeof(pngfile));
|
|
|
|
|
if ((ext = strrchr(pngfile, '.')) == NULL) return;
|
|
|
|
|
strcpy(ext, ".png");
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
img = Fl_Shared_Image::get(pngfile);
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
if (img) {
|
|
|
|
|
template_preview->image(img);
|
|
|
|
|
template_preview->redraw();
|
|
|
|
|
}
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Fl_Box *template_preview=(Fl_Box *)0;
|
|
|
|
|
|
|
|
|
|
Fl_Input *template_name=(Fl_Input *)0;
|
|
|
|
|
|
|
|
|
|
static void cb_template_name(Fl_Input*, void*) {
|
|
|
|
|
if (strlen(template_name->value())) {
|
2021-12-11 02:33:25 +00:00
|
|
|
template_submit->activate();
|
|
|
|
|
if (Fl::event_key() == FL_Enter) template_panel->hide();
|
|
|
|
|
} else template_submit->deactivate();
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Fl_Input *template_instance=(Fl_Input *)0;
|
|
|
|
|
|
|
|
|
|
Fl_Button *template_delete=(Fl_Button *)0;
|
|
|
|
|
|
|
|
|
|
static void cb_Cancel(Fl_Button*, void*) {
|
|
|
|
|
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
|
2021-12-11 02:33:25 +00:00
|
|
|
if (img) img->release();
|
|
|
|
|
template_preview->image(0);
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
template_browser->deselect();
|
|
|
|
|
template_name->value("");
|
|
|
|
|
template_instance->value("");
|
|
|
|
|
template_panel->hide();
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Fl_Return_Button *template_submit=(Fl_Return_Button *)0;
|
|
|
|
|
|
|
|
|
|
static void cb_template_submit(Fl_Return_Button*, void*) {
|
|
|
|
|
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
|
2021-12-11 02:33:25 +00:00
|
|
|
if (img) img->release();
|
|
|
|
|
template_preview->image(0);
|
2021-12-14 22:55:21 +00:00
|
|
|
|
2021-12-11 02:33:25 +00:00
|
|
|
template_panel->hide();
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Fl_Double_Window* make_template_panel() {
|
2008-08-15 20:32:01 +00:00
|
|
|
{ template_panel = new Fl_Double_Window(460, 355, "New/Save Template");
|
|
|
|
|
template_panel->callback((Fl_Callback*)cb_template_panel);
|
|
|
|
|
{ template_browser = new Fl_Browser(10, 28, 180, 250, "Available Templates:");
|
|
|
|
|
template_browser->type(2);
|
|
|
|
|
template_browser->labelfont(1);
|
|
|
|
|
template_browser->callback((Fl_Callback*)cb_template_browser);
|
2010-12-20 12:21:24 +00:00
|
|
|
template_browser->align(Fl_Align(FL_ALIGN_TOP_LEFT));
|
2023-01-26 14:23:43 +00:00
|
|
|
template_browser->when(FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED);
|
2008-08-15 20:32:01 +00:00
|
|
|
} // Fl_Browser* template_browser
|
2023-11-16 12:21:17 +00:00
|
|
|
{ template_preview = new Fl_Box(200, 28, 250, 250);
|
2008-08-15 20:32:01 +00:00
|
|
|
template_preview->box(FL_THIN_DOWN_BOX);
|
2023-11-06 18:09:48 +00:00
|
|
|
template_preview->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
|
2008-08-15 20:32:01 +00:00
|
|
|
Fl_Group::current()->resizable(template_preview);
|
|
|
|
|
} // Fl_Box* template_preview
|
2016-10-17 19:20:36 +00:00
|
|
|
{ template_name = new Fl_Input(198, 288, 252, 25, "Template Name:");
|
2008-08-15 20:32:01 +00:00
|
|
|
template_name->labelfont(1);
|
|
|
|
|
template_name->textfont(4);
|
|
|
|
|
template_name->callback((Fl_Callback*)cb_template_name);
|
2023-01-26 14:23:43 +00:00
|
|
|
template_name->when(FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED);
|
2008-08-15 20:32:01 +00:00
|
|
|
} // Fl_Input* template_name
|
2016-10-17 19:20:36 +00:00
|
|
|
{ template_instance = new Fl_Input(198, 288, 252, 25, "Instance Name:");
|
2008-08-15 20:32:01 +00:00
|
|
|
template_instance->labelfont(1);
|
|
|
|
|
template_instance->textfont(4);
|
|
|
|
|
template_instance->hide();
|
|
|
|
|
} // Fl_Input* template_instance
|
2005-11-02 19:06:55 +00:00
|
|
|
{ Fl_Group* o = new Fl_Group(10, 323, 440, 25);
|
2014-05-17 20:46:25 +00:00
|
|
|
{ template_delete = new Fl_Button(10, 323, 143, 25, "Delete Template");
|
2008-08-15 20:32:01 +00:00
|
|
|
template_delete->callback((Fl_Callback*)template_delete_cb);
|
|
|
|
|
} // Fl_Button* template_delete
|
2005-11-02 19:06:55 +00:00
|
|
|
{ Fl_Box* o = new Fl_Box(153, 323, 126, 25);
|
|
|
|
|
Fl_Group::current()->resizable(o);
|
2008-08-15 20:32:01 +00:00
|
|
|
} // Fl_Box* o
|
2005-11-02 19:06:55 +00:00
|
|
|
{ Fl_Button* o = new Fl_Button(289, 323, 72, 25, "Cancel");
|
|
|
|
|
o->callback((Fl_Callback*)cb_Cancel);
|
2008-08-15 20:32:01 +00:00
|
|
|
} // Fl_Button* o
|
|
|
|
|
{ template_submit = new Fl_Return_Button(371, 323, 79, 25, "Save");
|
|
|
|
|
template_submit->callback((Fl_Callback*)cb_template_submit);
|
|
|
|
|
} // Fl_Return_Button* template_submit
|
2005-11-02 19:06:55 +00:00
|
|
|
o->end();
|
2008-08-15 20:32:01 +00:00
|
|
|
} // Fl_Group* o
|
|
|
|
|
template_panel->set_modal();
|
|
|
|
|
template_panel->end();
|
|
|
|
|
} // Fl_Double_Window* template_panel
|
|
|
|
|
return template_panel;
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void template_clear() {
|
|
|
|
|
int i;
|
2010-12-20 12:21:24 +00:00
|
|
|
void *filename;
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
for (i = 1; i <= template_browser->size(); i ++) {
|
|
|
|
|
if ((filename = template_browser->data(i)) != NULL) free(filename);
|
|
|
|
|
}
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
template_browser->deselect();
|
|
|
|
|
template_browser->clear();
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void template_delete_cb(Fl_Button *, void *) {
|
|
|
|
|
int item = template_browser->value();
|
2010-12-20 12:21:24 +00:00
|
|
|
if (item < 1) return;
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
const char *name = template_browser->text(item);
|
|
|
|
|
const char *flfile = (const char *)template_browser->data(item);
|
|
|
|
|
if (!flfile) return;
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
if (!fl_choice("Are you sure you want to delete the template \"%s\"?",
|
|
|
|
|
"Cancel", "Delete", 0, name)) return;
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2017-10-15 10:18:53 +00:00
|
|
|
if (fl_unlink(flfile)) {
|
2010-12-20 12:21:24 +00:00
|
|
|
fl_alert("Unable to delete template \"%s\":\n%s", name, strerror(errno));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2023-11-16 12:21:17 +00:00
|
|
|
char pngfile[1024], *ext;
|
|
|
|
|
strlcpy(pngfile, flfile, sizeof(pngfile));
|
|
|
|
|
if ((ext = strrchr(pngfile, '.')) != NULL) {
|
|
|
|
|
strcpy(ext, ".png");
|
|
|
|
|
fl_unlink(pngfile);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
template_browser->remove(item);
|
|
|
|
|
template_browser->do_callback();
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
|
|
|
|
|
2024-12-09 21:41:45 +00:00
|
|
|
static int tmpl_FLTK_License_fl_size = 614;
|
|
|
|
|
static unsigned char tmpl_FLTK_License_fl[397] = /* data compressed and inlined from templates/FLTK_License.fl */
|
|
|
|
|
{120,156,133,82,77,79,27,49,16,189,239,175,120,162,23,144,202,110,130,56,20,
|
|
|
|
|
78,208,80,170,8,148,34,17,14,61,33,239,122,118,61,194,177,87,246,44,75,26,229,
|
|
|
|
|
191,215,94,18,245,88,159,236,241,251,154,177,191,64,43,81,104,217,18,90,31,32,
|
|
|
|
|
134,112,111,229,13,47,145,2,150,78,40,180,170,33,220,81,228,206,165,210,105,107,
|
|
|
|
|
7,214,103,197,59,133,200,222,97,94,206,46,103,243,194,144,210,20,94,157,218,
|
|
|
|
|
16,118,165,217,23,141,215,116,60,54,31,31,185,176,217,144,19,236,170,170,168,
|
|
|
|
|
42,220,44,87,207,235,219,213,226,199,205,63,95,21,5,143,220,25,193,218,123,139,
|
|
|
|
|
7,22,156,222,63,174,31,206,202,226,147,180,240,253,54,76,128,249,213,213,183,
|
|
|
|
|
243,139,217,197,37,234,45,190,179,181,120,238,89,254,168,55,40,167,225,147,92,
|
|
|
|
|
136,71,214,218,112,132,229,58,168,176,69,218,182,129,8,209,183,50,170,64,37,238,
|
|
|
|
|
56,74,224,122,144,220,78,102,15,145,48,185,68,36,0,252,32,150,29,105,176,203,
|
|
|
|
|
106,57,233,52,174,147,197,175,167,223,203,213,207,19,140,134,27,131,104,252,96,
|
|
|
|
|
53,140,122,39,212,68,46,225,27,59,232,68,28,89,76,226,101,235,68,44,129,101,59,
|
|
|
|
|
29,179,220,36,149,110,54,28,35,187,14,105,22,90,109,84,71,250,43,98,202,153,
|
|
|
|
|
237,44,55,228,82,40,37,215,135,150,242,50,34,125,188,174,170,113,28,203,54,61,
|
|
|
|
|
89,233,67,87,29,50,149,189,233,15,208,39,75,42,113,143,90,173,183,214,143,217,
|
|
|
|
|
169,79,38,72,45,27,63,66,60,2,245,62,8,234,161,139,211,20,82,158,129,226,127,13,
|
|
|
|
|
51,254,232,182,199,142,221,107,244,67,72,63,38,237,62,63,69,177,47,254,2,228,
|
|
|
|
|
190,201,192};
|
2023-11-16 12:21:17 +00:00
|
|
|
|
|
|
|
|
static int tmpl_1of7GUIs_fl_size = 763;
|
|
|
|
|
static unsigned char tmpl_1of7GUIs_fl[486] = /* data compressed and inlined from templates/1of7GUIs.fl */
|
|
|
|
|
{120,156,109,82,203,138,219,64,16,188,207,87,52,228,178,102,177,45,25,59,
|
|
|
|
|
187,142,73,14,121,56,187,36,224,92,76,142,102,36,181,164,206,142,102,196,60,252,
|
|
|
|
|
88,33,216,223,200,61,127,146,63,201,151,164,37,69,176,9,97,4,163,26,122,170,
|
|
|
|
|
170,171,231,5,100,210,75,200,73,33,228,198,130,47,17,182,202,63,192,222,161,133,
|
|
|
|
|
123,237,209,230,50,69,120,143,142,10,205,71,87,185,10,148,77,4,28,209,58,50,26,
|
|
|
|
|
226,89,180,140,34,1,37,202,12,237,65,203,10,161,153,149,173,72,77,134,35,76,207,
|
|
|
|
|
231,86,64,106,170,10,181,135,70,196,96,114,184,249,184,191,119,66,244,27,156,
|
|
|
|
|
164,131,4,81,67,106,81,122,204,128,177,4,87,147,158,154,60,239,202,59,107,149,
|
|
|
|
|
116,236,232,215,211,119,39,24,58,114,240,206,84,181,180,228,216,9,215,236,146,
|
|
|
|
|
111,152,250,233,206,18,235,116,36,58,131,109,208,169,103,167,82,137,47,214,20,
|
|
|
|
|
86,86,21,233,162,239,150,149,185,179,35,42,83,247,198,146,11,124,8,5,155,248,
|
|
|
|
|
68,142,229,125,167,41,238,66,37,245,180,211,9,126,204,68,246,140,80,88,19,234,
|
|
|
|
|
209,219,103,164,68,211,163,216,107,234,179,241,63,127,120,184,147,90,27,134,64,
|
|
|
|
|
26,22,81,188,156,9,81,122,95,187,87,243,249,77,17,200,205,10,242,101,72,102,
|
|
|
|
|
100,6,60,23,45,52,14,21,119,193,246,73,31,156,9,150,243,215,198,31,24,13,33,139,
|
|
|
|
|
86,136,177,43,104,248,130,169,81,119,23,197,86,29,190,146,206,204,169,63,22,74,
|
|
|
|
|
38,168,56,162,208,121,134,190,234,124,57,149,208,44,111,95,194,98,189,128,120,
|
|
|
|
|
189,132,213,170,5,127,169,121,198,38,36,252,12,44,231,250,40,187,191,35,57,226,
|
|
|
|
|
125,100,222,5,207,17,240,20,123,186,195,137,178,2,187,97,14,148,241,10,248,187,
|
|
|
|
|
141,96,177,24,102,31,65,243,119,233,244,205,81,170,128,87,209,100,211,114,11,
|
|
|
|
|
204,248,54,120,255,167,133,231,94,69,42,149,74,100,250,0,13,241,84,8,94,195,191,
|
|
|
|
|
76,52,80,77,54,130,174,175,55,226,255,66,212,9,13,238,214,235,103,238,134,245,
|
|
|
|
|
27,226,34,7,2};
|
|
|
|
|
|
|
|
|
|
void template_install(const char *path, const char *name, const uchar *inSrc, int inSrcLen, int inDstLen) {
|
|
|
|
|
char filename[FL_PATH_MAX];
|
|
|
|
|
strcpy(filename, path);
|
|
|
|
|
strcat(filename, name);
|
|
|
|
|
FILE *f = fopen(filename, "wb");
|
|
|
|
|
if (!f) return;
|
|
|
|
|
uLong dstLen = inDstLen;
|
|
|
|
|
Bytef *dst = (Bytef*)::malloc(inDstLen);
|
|
|
|
|
if (uncompress(dst, &dstLen, (Bytef*)inSrc, (uLong)inSrcLen) != Z_OK) { /* error */ }
|
|
|
|
|
if (fwrite(dst, dstLen, 1, f) <= 0) { /* error */ }
|
|
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-02 19:06:55 +00:00
|
|
|
void template_load() {
|
|
|
|
|
int i;
|
2019-08-29 15:32:26 +00:00
|
|
|
char name[1024], filename[1400], path[1024], *ptr;
|
2010-12-20 12:21:24 +00:00
|
|
|
struct dirent **files;
|
|
|
|
|
int num_files;
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
fluid_prefs.getUserdataPath(path, sizeof(path));
|
|
|
|
|
strlcat(path, "templates", sizeof(path));
|
2023-11-15 12:43:19 +00:00
|
|
|
fl_make_path(path);
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2019-02-01 22:16:49 +00:00
|
|
|
int sample_templates_generated = 0;
|
|
|
|
|
fluid_prefs.get("sample_templates_generated", sample_templates_generated, 0);
|
2023-11-15 12:43:19 +00:00
|
|
|
|
2023-11-16 12:21:17 +00:00
|
|
|
if (sample_templates_generated < 2) {
|
2019-02-01 22:16:49 +00:00
|
|
|
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"
|
2020-07-01 16:03:10 +00:00
|
|
|
"code_name {.cxx}\ncomment {//\n// @INSTANCE@ for the Fast Light Tool Kit (FLT"
|
2023-07-21 11:34:04 +00:00
|
|
|
"K).\n//\n// Copyright 1998-2023 by Bill Spitzak and others.\n//\n// This library is free sof"
|
2019-02-01 22:16:49 +00:00
|
|
|
"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"
|
2020-07-01 16:03:10 +00:00
|
|
|
"//\n// https://www.fltk.org/COPYING.php\n//\n// Please see the following page on how to report "
|
|
|
|
|
"bugs and issues:\n//\n// https://www.fltk.org/bugs.php\n//\n} {selected in_source in_head"
|
|
|
|
|
"er\n}\n", f);
|
2019-02-01 22:16:49 +00:00
|
|
|
fclose(f);
|
|
|
|
|
}
|
2023-11-27 14:33:53 +00:00
|
|
|
|
2023-11-16 12:21:17 +00:00
|
|
|
template_install(path, "/FLTK_License.fl", tmpl_FLTK_License_fl, sizeof(tmpl_FLTK_License_fl), tmpl_FLTK_License_fl_size);
|
|
|
|
|
template_install(path, "/1of7GUIs.fl", tmpl_1of7GUIs_fl, sizeof(tmpl_1of7GUIs_fl), tmpl_1of7GUIs_fl_size);
|
2023-11-06 18:09:48 +00:00
|
|
|
sample_templates_generated = 2;
|
2019-02-01 22:16:49 +00:00
|
|
|
fluid_prefs.set("sample_templates_generated", sample_templates_generated);
|
|
|
|
|
fluid_prefs.flush();
|
|
|
|
|
}
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
num_files = fl_filename_list(path, &files);
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
for (i = 0; i < num_files; i ++) {
|
|
|
|
|
if (fl_filename_match(files[i]->d_name, "*.fl")) {
|
|
|
|
|
// Format the name as the filename with "_" replaced with " "
|
|
|
|
|
// and without the trailing ".fl"...
|
|
|
|
|
strlcpy(name, files[i]->d_name, sizeof(name));
|
|
|
|
|
*strstr(name, ".fl") = '\0';
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
for (ptr = name; *ptr; ptr ++) {
|
|
|
|
|
if (*ptr == '_') *ptr = ' ';
|
|
|
|
|
}
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
// Add the template to the browser...
|
|
|
|
|
snprintf(filename, sizeof(filename), "%s/%s", path, files[i]->d_name);
|
2020-07-22 03:15:41 +00:00
|
|
|
template_browser->add(name, fl_strdup(filename));
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
free(files[i]);
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|
2020-07-01 16:03:10 +00:00
|
|
|
|
2010-12-20 12:21:24 +00:00
|
|
|
if (num_files > 0) free(files);
|
2005-11-02 19:06:55 +00:00
|
|
|
}
|