2005-11-02 22:06:55 +03:00
|
|
|
# data file for the Fltk User Interface Designer (fluid)
|
2016-01-30 03:56:42 +03:00
|
|
|
version 1.0400
|
2015-07-09 05:09:33 +03:00
|
|
|
header_name {.h}
|
2005-11-02 22:06:55 +03:00
|
|
|
code_name {.cxx}
|
|
|
|
comment {//
|
|
|
|
// "$Id$"
|
|
|
|
//
|
|
|
|
// FLUID template support for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2017-06-29 21:12:57 +03:00
|
|
|
// Copyright 1998-2017 by Bill Spitzak and others.
|
2005-11-02 22:06:55 +03:00
|
|
|
//
|
2011-07-19 08:49:30 +04: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:
|
2005-11-02 22:06:55 +03:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// http://www.fltk.org/COPYING.php
|
2005-11-02 22:06:55 +03:00
|
|
|
//
|
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
|
|
|
//
|
|
|
|
} {in_source in_header
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include <stdio.h>} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include <stdlib.h>} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include "../src/flstring.h"} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include <errno.h>} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include <FL/filename.H>} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include <FL/fl_ask.H>} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include <FL/Fl_Shared_Image.H>} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include <FL/Fl_Preferences.H>} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2018-02-09 17:39:42 +03:00
|
|
|
declblock {\#if defined(_WIN32) && !defined(__CYGWIN__)} {after {\#endif // _WIN32 && !__CYGWIN__}
|
2005-11-02 22:06:55 +03:00
|
|
|
} {
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {\#include <io.h>} {private local
|
|
|
|
}
|
|
|
|
decl {\#else} {private local
|
|
|
|
}
|
|
|
|
decl {\#include <unistd.h>} {private local
|
|
|
|
}
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
decl {extern Fl_Preferences fluid_prefs;} {private local
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
Function {make_template_panel()} {open
|
|
|
|
} {
|
2005-11-02 22:06:55 +03:00
|
|
|
Fl_Window template_panel {
|
|
|
|
label {New/Save Template}
|
|
|
|
callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
|
|
|
|
if (img) img->release();
|
|
|
|
template_preview->image(0);
|
|
|
|
|
|
|
|
template_browser->deselect();
|
|
|
|
template_name->value("");
|
|
|
|
template_instance->value("");
|
|
|
|
template_panel->hide();} open
|
2015-03-10 04:41:55 +03:00
|
|
|
xywh {398 200 460 355} type Double hide resizable modal
|
2005-11-02 22:06:55 +03:00
|
|
|
} {
|
|
|
|
Fl_Browser template_browser {
|
|
|
|
label {Available Templates:}
|
|
|
|
callback {if (Fl::event_clicks()) {
|
|
|
|
template_panel->hide();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
|
|
|
|
if (img) img->release();
|
|
|
|
template_preview->image(0);
|
|
|
|
template_preview->redraw();
|
|
|
|
|
|
|
|
int item = template_browser->value();
|
|
|
|
|
|
|
|
if (item <= 1) template_instance->deactivate();
|
|
|
|
else template_instance->activate();
|
|
|
|
|
|
|
|
if (item < 1) {
|
|
|
|
template_submit->deactivate();
|
|
|
|
template_delete->deactivate();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
template_submit->activate();
|
|
|
|
|
|
|
|
const char *flfile = (const char *)template_browser->data(item);
|
|
|
|
if (!flfile) {
|
|
|
|
template_delete->deactivate();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
template_name->value(template_browser->text(item));
|
|
|
|
|
|
|
|
template_delete->activate();
|
|
|
|
|
|
|
|
char pngfile[1024], *ext;
|
|
|
|
|
|
|
|
strlcpy(pngfile, flfile, sizeof(pngfile));
|
|
|
|
if ((ext = strrchr(pngfile, '.')) == NULL) return;
|
|
|
|
strcpy(ext, ".png");
|
|
|
|
|
|
|
|
img = Fl_Shared_Image::get(pngfile);
|
|
|
|
|
|
|
|
if (img) {
|
|
|
|
template_preview->image(img);
|
|
|
|
template_preview->redraw();
|
|
|
|
}}
|
|
|
|
xywh {10 28 180 250} type Hold labelfont 1 align 5 when 3
|
|
|
|
}
|
|
|
|
Fl_Box template_preview {
|
|
|
|
xywh {200 28 250 250} box THIN_DOWN_BOX align 85 resizable
|
|
|
|
}
|
|
|
|
Fl_Input template_name {
|
|
|
|
label {Template Name:}
|
|
|
|
callback {if (strlen(template_name->value())) {
|
|
|
|
template_submit->activate();
|
|
|
|
if (Fl::event_key() == FL_Enter) template_panel->hide();
|
2014-10-05 04:03:27 +04:00
|
|
|
} else template_submit->deactivate();} selected
|
2016-10-17 22:20:36 +03:00
|
|
|
xywh {198 288 252 25} labelfont 1 when 3 textfont 4
|
2005-11-02 22:06:55 +03:00
|
|
|
}
|
|
|
|
Fl_Input template_instance {
|
|
|
|
label {Instance Name:}
|
2016-10-17 22:20:36 +03:00
|
|
|
xywh {198 288 252 25} labelfont 1 textfont 4 hide
|
2005-11-02 22:06:55 +03:00
|
|
|
}
|
|
|
|
Fl_Group {} {
|
|
|
|
xywh {10 323 440 25}
|
|
|
|
} {
|
|
|
|
Fl_Button template_delete {
|
|
|
|
label {Delete Template}
|
|
|
|
callback template_delete_cb
|
2014-05-17 22:43:11 +04:00
|
|
|
xywh {10 323 143 25}
|
2005-11-02 22:06:55 +03:00
|
|
|
}
|
|
|
|
Fl_Box {} {
|
|
|
|
xywh {153 323 126 25} resizable
|
|
|
|
}
|
|
|
|
Fl_Button {} {
|
|
|
|
label Cancel
|
|
|
|
callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
|
|
|
|
if (img) img->release();
|
|
|
|
template_preview->image(0);
|
|
|
|
|
|
|
|
template_browser->deselect();
|
|
|
|
template_name->value("");
|
|
|
|
template_instance->value("");
|
|
|
|
template_panel->hide();}
|
|
|
|
xywh {289 323 72 25}
|
|
|
|
}
|
|
|
|
Fl_Return_Button template_submit {
|
|
|
|
label Save
|
|
|
|
callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
|
|
|
|
if (img) img->release();
|
|
|
|
template_preview->image(0);
|
|
|
|
|
|
|
|
template_panel->hide();}
|
|
|
|
xywh {371 323 79 25}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
|
|
|
Function {template_clear()} {return_type void
|
|
|
|
} {
|
|
|
|
code {int i;
|
|
|
|
void *filename;
|
|
|
|
|
|
|
|
for (i = 1; i <= template_browser->size(); i ++) {
|
|
|
|
if ((filename = template_browser->data(i)) != NULL) free(filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
template_browser->deselect();
|
|
|
|
template_browser->clear();} {}
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2014-10-05 04:03:27 +04:00
|
|
|
Function {template_delete_cb(Fl_Button *, void *)} {return_type void
|
2005-11-02 22:06:55 +03:00
|
|
|
} {
|
|
|
|
code {int item = template_browser->value();
|
|
|
|
if (item < 1) return;
|
|
|
|
|
|
|
|
const char *name = template_browser->text(item);
|
|
|
|
const char *flfile = (const char *)template_browser->data(item);
|
|
|
|
if (!flfile) return;
|
|
|
|
|
|
|
|
if (!fl_choice("Are you sure you want to delete the template \\"%s\\"?",
|
|
|
|
"Cancel", "Delete", 0, name)) return;
|
|
|
|
|
2017-10-15 13:18:53 +03:00
|
|
|
if (fl_unlink(flfile)) {
|
2005-11-02 22:06:55 +03:00
|
|
|
fl_alert("Unable to delete template \\"%s\\":\\n%s", name, strerror(errno));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
template_browser->remove(item);
|
|
|
|
template_browser->do_callback();} {}
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
2008-09-19 01:11:28 +04:00
|
|
|
Function {template_load()} {return_type void
|
2005-11-02 22:06:55 +03:00
|
|
|
} {
|
|
|
|
code {int i;
|
|
|
|
char name[1024], filename[1024], path[1024], *ptr;
|
|
|
|
struct dirent **files;
|
|
|
|
int num_files;
|
|
|
|
|
|
|
|
fluid_prefs.getUserdataPath(path, sizeof(path));
|
|
|
|
strlcat(path, "templates", sizeof(path));
|
|
|
|
|
|
|
|
num_files = fl_filename_list(path, &files);
|
|
|
|
|
|
|
|
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';
|
|
|
|
|
|
|
|
for (ptr = name; *ptr; ptr ++) {
|
|
|
|
if (*ptr == '_') *ptr = ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the template to the browser...
|
|
|
|
snprintf(filename, sizeof(filename), "%s/%s", path, files[i]->d_name);
|
|
|
|
template_browser->add(name, strdup(filename));
|
|
|
|
}
|
|
|
|
|
|
|
|
free(files[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (num_files > 0) free(files);} {}
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|
2005-11-02 22:06:55 +03:00
|
|
|
|
|
|
|
comment {
|
|
|
|
//
|
|
|
|
// End of "$Id$".
|
|
|
|
//} {in_source in_header
|
2015-07-09 05:09:33 +03:00
|
|
|
}
|