1998-10-21 20:29:01 +04:00
|
|
|
//
|
|
|
|
// Fluid file routines for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
|
|
|
// You may find the basic read_* and write_* routines to
|
|
|
|
// be useful for other programs. I have used them many times.
|
|
|
|
// They are somewhat similar to tcl, using matching { and }
|
|
|
|
// to quote strings.
|
|
|
|
//
|
2021-12-13 23:55:03 +03:00
|
|
|
// Copyright 1998-2021 by Bill Spitzak and others.
|
1998-10-21 20:29:01 +04: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:
|
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
1998-10-21 20:29:01 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-04-16 04:13:17 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
1998-10-21 20:29:01 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
#include "file.h"
|
|
|
|
|
|
|
|
#include "fluid.h"
|
|
|
|
#include "factory.h"
|
|
|
|
#include "Fl_Function_Type.h"
|
|
|
|
#include "Fl_Widget_Type.h"
|
|
|
|
#include "Fl_Window_Type.h"
|
1998-12-06 18:09:22 +03:00
|
|
|
#include "alignment_panel.h"
|
2021-12-08 17:52:15 +03:00
|
|
|
#include "widget_browser.h"
|
2021-12-09 04:43:57 +03:00
|
|
|
#include "shell_command.h"
|
2021-12-08 17:52:15 +03:00
|
|
|
#include "code.h"
|
|
|
|
|
2014-12-20 18:00:27 +03:00
|
|
|
#include <FL/Fl.H>
|
2021-12-08 17:52:15 +03:00
|
|
|
#include <FL/Fl_Group.H>
|
2022-01-16 21:02:36 +03:00
|
|
|
#include <FL/fl_string_functions.h>
|
2021-12-08 17:52:15 +03:00
|
|
|
#include <FL/fl_message.H>
|
|
|
|
#include "../src/flstring.h"
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
/// \defgroup flfile .fl Design File Operations
|
|
|
|
/// \{
|
|
|
|
|
2021-12-13 23:55:03 +03:00
|
|
|
// This file contains code to read and write .fl files.
|
2021-12-11 21:43:00 +03:00
|
|
|
// TODO: there is a name confusion with routines that write to the C and Header
|
2021-12-13 23:55:03 +03:00
|
|
|
// TODO: files vs. those that write to the .fl file which should be fixed.
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
static FILE *fout;
|
2021-12-08 17:52:15 +03:00
|
|
|
static FILE *fin;
|
|
|
|
|
|
|
|
static int needspace;
|
|
|
|
static int lineno;
|
|
|
|
static const char *fname;
|
|
|
|
|
|
|
|
int fdesign_flip;
|
|
|
|
int fdesign_magic;
|
|
|
|
|
|
|
|
double read_version;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
// BASIC FILE WRITING:
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Open teh .fl design file for writing.
|
|
|
|
If the filename is NULL, associate stdout instead.
|
|
|
|
\param[in] s the filename or NULL for stdout
|
|
|
|
\return 1 if successful. 0 if the operation failed
|
|
|
|
*/
|
|
|
|
static int open_write(const char *s) {
|
1998-10-06 22:21:25 +04:00
|
|
|
if (!s) {fout = stdout; return 1;}
|
2010-11-18 23:00:01 +03:00
|
|
|
FILE *f = fl_fopen(s,"w");
|
1998-10-06 22:21:25 +04:00
|
|
|
if (!f) return 0;
|
|
|
|
fout = f;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
2021-12-13 23:55:03 +03:00
|
|
|
Close the .fl design file.
|
2021-12-08 17:52:15 +03:00
|
|
|
Don't close, if data was sent to stdout.
|
|
|
|
*/
|
|
|
|
static int close_write() {
|
1998-10-06 22:21:25 +04:00
|
|
|
if (fout != stdout) {
|
|
|
|
int x = fclose(fout);
|
|
|
|
fout = stdout;
|
|
|
|
return x >= 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Write a string to the .fl file, quoting characters if necessary.
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void write_word(const char *w) {
|
|
|
|
if (needspace) putc(' ', fout);
|
|
|
|
needspace = 1;
|
|
|
|
if (!w || !*w) {fprintf(fout,"{}"); return;}
|
|
|
|
const char *p;
|
|
|
|
// see if it is a single word:
|
|
|
|
for (p = w; is_id(*p); p++) ;
|
|
|
|
if (!*p) {fprintf(fout,"%s",w); return;}
|
|
|
|
// see if there are matching braces:
|
|
|
|
int n = 0;
|
|
|
|
for (p = w; *p; p++) {
|
|
|
|
if (*p == '{') n++;
|
|
|
|
else if (*p == '}') {n--; if (n<0) break;}
|
|
|
|
}
|
|
|
|
int mismatched = (n != 0);
|
|
|
|
// write out brace-quoted string:
|
|
|
|
putc('{', fout);
|
|
|
|
for (; *w; w++) {
|
|
|
|
switch (*w) {
|
|
|
|
case '{':
|
|
|
|
case '}':
|
|
|
|
if (!mismatched) break;
|
|
|
|
case '\\':
|
|
|
|
case '#':
|
|
|
|
putc('\\',fout);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
putc(*w,fout);
|
|
|
|
}
|
|
|
|
putc('}', fout);
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
2021-12-09 23:06:04 +03:00
|
|
|
Write an arbitrary formatted word to the .fl file, or a comment, etc .
|
2021-12-08 17:52:15 +03:00
|
|
|
If needspace is set, then one space is written before the string
|
2021-12-09 23:06:04 +03:00
|
|
|
unless the format starts with a newline character \\n.
|
2021-12-08 17:52:15 +03:00
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void write_string(const char *format, ...) {
|
|
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
2015-07-09 04:17:33 +03:00
|
|
|
if (needspace && *format != '\n') fputc(' ',fout);
|
1998-10-06 22:21:25 +04:00
|
|
|
vfprintf(fout, format, args);
|
|
|
|
va_end(args);
|
2006-01-31 19:22:06 +03:00
|
|
|
needspace = !isspace(format[strlen(format)-1] & 255);
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Start a new line in the .fl file and indent it for a given nesting level.
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void write_indent(int n) {
|
|
|
|
fputc('\n',fout);
|
|
|
|
while (n--) {fputc(' ',fout); fputc(' ',fout);}
|
|
|
|
needspace = 0;
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Write a '{' to the .fl file at the given indenting level.
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void write_open(int) {
|
|
|
|
if (needspace) fputc(' ',fout);
|
|
|
|
fputc('{',fout);
|
|
|
|
needspace = 0;
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Write a '}' to the .fl file at the given indenting level.
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void write_close(int n) {
|
|
|
|
if (needspace) write_indent(n);
|
|
|
|
fputc('}',fout);
|
|
|
|
needspace = 1;
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
// BASIC FILE READING:
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Open an .fl file for reading.
|
|
|
|
\param[in] s filename, if NULL, read from stdin instead
|
|
|
|
\return 0 if the operation failed, 1 if it succeeded
|
|
|
|
*/
|
|
|
|
static int open_read(const char *s) {
|
1998-10-06 22:21:25 +04:00
|
|
|
lineno = 1;
|
|
|
|
if (!s) {fin = stdin; fname = "stdin"; return 1;}
|
2010-11-18 23:00:01 +03:00
|
|
|
FILE *f = fl_fopen(s,"r");
|
1998-10-06 22:21:25 +04:00
|
|
|
if (!f) return 0;
|
|
|
|
fin = f;
|
|
|
|
fname = s;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Close the .fl file.
|
|
|
|
\return 0 if the operation failed, 1 if it succeeded
|
|
|
|
*/
|
|
|
|
static int close_read() {
|
1998-10-06 22:21:25 +04:00
|
|
|
if (fin != stdin) {
|
|
|
|
int x = fclose(fin);
|
|
|
|
fin = 0;
|
|
|
|
return x >= 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Display an error while reading the file.
|
|
|
|
If the .fl file isn't opened for reading, pop up an FLTK dialog, otherwise
|
|
|
|
print to stdout.
|
|
|
|
\note Matt: I am not sure why it is done this way. Shouldn;t this depend on \c batch_mode?
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void read_error(const char *format, ...) {
|
|
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
|
|
|
if (!fin) {
|
|
|
|
char buffer[1024];
|
2002-05-16 16:47:44 +04:00
|
|
|
vsnprintf(buffer, sizeof(buffer), format, args);
|
2010-10-29 01:47:01 +04:00
|
|
|
fl_message("%s", buffer);
|
1998-10-06 22:21:25 +04:00
|
|
|
} else {
|
|
|
|
fprintf(stderr, "%s:%d: ", fname, lineno);
|
|
|
|
vfprintf(stderr, format, args);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
}
|
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Convert a single ASCII char, assumed to be a hex digit, into its decimal value.
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
static int hexdigit(int x) {
|
|
|
|
if (isdigit(x)) return x-'0';
|
|
|
|
if (isupper(x)) return x-'A'+10;
|
|
|
|
if (islower(x)) return x-'a'+10;
|
|
|
|
return 20;
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
2021-12-09 23:06:04 +03:00
|
|
|
Convert an ASCII sequence form the \.fl file that starts with a \\ into a single character.
|
|
|
|
Conversion includes the common C style \\ characters like \\n, \\x## hex
|
|
|
|
values, and \\o### octal values.
|
2021-12-08 17:52:15 +03:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static int read_quoted() { // read whatever character is after a \ .
|
1998-10-06 22:21:25 +04:00
|
|
|
int c,d,x;
|
|
|
|
switch(c = fgetc(fin)) {
|
|
|
|
case '\n': lineno++; return -1;
|
|
|
|
case 'a' : return('\a');
|
|
|
|
case 'b' : return('\b');
|
|
|
|
case 'f' : return('\f');
|
|
|
|
case 'n' : return('\n');
|
|
|
|
case 'r' : return('\r');
|
|
|
|
case 't' : return('\t');
|
|
|
|
case 'v' : return('\v');
|
2020-07-01 19:03:10 +03:00
|
|
|
case 'x' : /* read hex */
|
1998-10-06 22:21:25 +04:00
|
|
|
for (c=x=0; x<3; x++) {
|
|
|
|
int ch = fgetc(fin);
|
|
|
|
d = hexdigit(ch);
|
|
|
|
if (d > 15) {ungetc(ch,fin); break;}
|
|
|
|
c = (c<<4)+d;
|
|
|
|
}
|
|
|
|
break;
|
2020-07-01 19:03:10 +03:00
|
|
|
default: /* read octal */
|
1998-10-06 22:21:25 +04:00
|
|
|
if (c<'0' || c>'7') break;
|
|
|
|
c -= '0';
|
|
|
|
for (x=0; x<2; x++) {
|
|
|
|
int ch = fgetc(fin);
|
|
|
|
d = hexdigit(ch);
|
|
|
|
if (d>7) {ungetc(ch,fin); break;}
|
|
|
|
c = (c<<3)+d;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *buffer;
|
|
|
|
static int buflen;
|
2021-12-08 17:52:15 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
A simple growing buffer.
|
2021-12-13 23:55:03 +03:00
|
|
|
Oh how I wish sometimes we would upgrade to modern C++.
|
2021-12-08 17:52:15 +03:00
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
static void expand_buffer(int length) {
|
|
|
|
if (length >= buflen) {
|
|
|
|
if (!buflen) {
|
|
|
|
buflen = length+1;
|
|
|
|
buffer = (char*)malloc(buflen);
|
|
|
|
} else {
|
|
|
|
buflen = 2*buflen;
|
|
|
|
if (length >= buflen) buflen = length+1;
|
|
|
|
buffer = (char *)realloc((void *)buffer,buflen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Return a word read from the .fl file, or NULL at the EOF.
|
|
|
|
|
|
|
|
This will skip all comments (# to end of line), and evaluate
|
|
|
|
all \\xxx sequences and use \\ at the end of line to remove the newline.
|
|
|
|
|
|
|
|
A word is any one of:
|
|
|
|
- a continuous string of non-space chars except { and } and #
|
|
|
|
- everything between matching {...} (unless wantbrace != 0)
|
|
|
|
- the characters '{' and '}'
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
const char *read_word(int wantbrace) {
|
|
|
|
int x;
|
|
|
|
|
|
|
|
// skip all the whitespace before it:
|
|
|
|
for (;;) {
|
|
|
|
x = getc(fin);
|
2020-07-01 19:03:10 +03:00
|
|
|
if (x < 0 && feof(fin)) { // eof
|
1998-10-06 22:21:25 +04:00
|
|
|
return 0;
|
2020-07-01 19:03:10 +03:00
|
|
|
} else if (x == '#') { // comment
|
1998-10-06 22:21:25 +04:00
|
|
|
do x = getc(fin); while (x >= 0 && x != '\n');
|
|
|
|
lineno++;
|
|
|
|
continue;
|
|
|
|
} else if (x == '\n') {
|
|
|
|
lineno++;
|
2006-01-31 19:22:06 +03:00
|
|
|
} else if (!isspace(x & 255)) {
|
1998-10-06 22:21:25 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expand_buffer(100);
|
|
|
|
|
|
|
|
if (x == '{' && !wantbrace) {
|
|
|
|
|
|
|
|
// read in whatever is between braces
|
|
|
|
int length = 0;
|
|
|
|
int nesting = 0;
|
|
|
|
for (;;) {
|
|
|
|
x = getc(fin);
|
|
|
|
if (x<0) {read_error("Missing '}'"); break;}
|
|
|
|
else if (x == '#') { // embedded comment
|
2020-07-01 19:03:10 +03:00
|
|
|
do x = getc(fin); while (x >= 0 && x != '\n');
|
|
|
|
lineno++;
|
|
|
|
continue;
|
1998-10-06 22:21:25 +04:00
|
|
|
} else if (x == '\n') lineno++;
|
|
|
|
else if (x == '\\') {x = read_quoted(); if (x<0) continue;}
|
|
|
|
else if (x == '{') nesting++;
|
|
|
|
else if (x == '}') {if (!nesting--) break;}
|
|
|
|
buffer[length++] = x;
|
|
|
|
expand_buffer(length);
|
|
|
|
}
|
|
|
|
buffer[length] = 0;
|
|
|
|
return buffer;
|
|
|
|
|
|
|
|
} else if (x == '{' || x == '}') {
|
|
|
|
// all the punctuation is a word:
|
|
|
|
buffer[0] = x;
|
|
|
|
buffer[1] = 0;
|
|
|
|
return buffer;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// read in an unquoted word:
|
|
|
|
int length = 0;
|
|
|
|
for (;;) {
|
|
|
|
if (x == '\\') {x = read_quoted(); if (x<0) continue;}
|
2006-01-31 19:22:06 +03:00
|
|
|
else if (x<0 || isspace(x & 255) || x=='{' || x=='}' || x=='#') break;
|
1998-10-06 22:21:25 +04:00
|
|
|
buffer[length++] = x;
|
|
|
|
expand_buffer(length);
|
|
|
|
x = getc(fin);
|
|
|
|
}
|
|
|
|
ungetc(x, fin);
|
|
|
|
buffer[length] = 0;
|
|
|
|
return buffer;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Write an .fl design description file.
|
|
|
|
\param[in] filename create this file, and if it exists, overwrite it
|
|
|
|
\param[in] selected_only write only the selected nodes in the widget_tree. This
|
|
|
|
is used to implement copy and paste.
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
int write_file(const char *filename, int selected_only) {
|
|
|
|
if (!open_write(filename)) return 0;
|
|
|
|
write_string("# data file for the Fltk User Interface Designer (fluid)\n"
|
2020-07-01 19:03:10 +03:00
|
|
|
"version %.4f",FL_VERSION);
|
1998-10-15 18:19:34 +04:00
|
|
|
if(!include_H_from_C)
|
|
|
|
write_string("\ndo_not_include_H_from_C");
|
2007-05-10 16:06:31 +04:00
|
|
|
if(use_FL_COMMAND)
|
|
|
|
write_string("\nuse_FL_COMMAND");
|
2021-12-17 23:15:04 +03:00
|
|
|
if (utf8_in_src)
|
|
|
|
write_string("\nutf8_in_src");
|
2022-01-08 23:55:19 +03:00
|
|
|
if (avoid_early_includes)
|
|
|
|
write_string("\navoid_early_includes");
|
2000-04-24 22:22:50 +04:00
|
|
|
if (i18n_type) {
|
|
|
|
write_string("\ni18n_type %d", i18n_type);
|
2021-12-19 03:09:13 +03:00
|
|
|
write_string("\ni18n_include"); write_word(i18n_include);
|
|
|
|
write_string("\ni18n_conditional"); write_word(i18n_conditional);
|
2000-04-24 22:22:50 +04:00
|
|
|
switch (i18n_type) {
|
|
|
|
case 1 : /* GNU gettext */
|
2021-12-19 03:09:13 +03:00
|
|
|
write_string("\ni18n_function"); write_word(i18n_function);
|
|
|
|
write_string("\ni18n_static_function"); write_word(i18n_static_function);
|
2000-04-24 22:22:50 +04:00
|
|
|
break;
|
|
|
|
case 2 : /* POSIX catgets */
|
2021-12-20 00:31:59 +03:00
|
|
|
if (i18n_file[0]) {
|
|
|
|
write_string("\ni18n_file");
|
|
|
|
write_word(i18n_file);
|
|
|
|
}
|
2021-12-19 03:09:13 +03:00
|
|
|
write_string("\ni18n_set"); write_word(i18n_set);
|
2000-04-24 22:22:50 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-12-15 21:50:21 +03:00
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
if (!selected_only) {
|
|
|
|
write_string("\nheader_name"); write_word(header_file_name);
|
|
|
|
write_string("\ncode_name"); write_word(code_file_name);
|
2021-12-09 04:43:57 +03:00
|
|
|
|
2021-12-15 21:50:21 +03:00
|
|
|
#if 0
|
|
|
|
// https://github.com/fltk/fltk/issues/328
|
|
|
|
// Project wide settings require a redesign.
|
|
|
|
shell_settings_write();
|
2021-12-09 04:43:57 +03:00
|
|
|
if (shell_settings_windows.command) {
|
|
|
|
write_string("\nwin_shell_cmd"); write_word(shell_settings_windows.command);
|
|
|
|
write_string("\nwin_shell_flags"); write_string("%d", shell_settings_windows.flags);
|
|
|
|
}
|
|
|
|
if (shell_settings_linux.command) {
|
|
|
|
write_string("\nlinux_shell_cmd"); write_word(shell_settings_linux.command);
|
|
|
|
write_string("\nlinux_shell_flags"); write_string("%d", shell_settings_linux.flags);
|
|
|
|
}
|
|
|
|
if (shell_settings_macos.command) {
|
|
|
|
write_string("\nmac_shell_cmd"); write_word(shell_settings_macos.command);
|
|
|
|
write_string("\nmac_shell_flags"); write_string("%d", shell_settings_macos.flags);
|
|
|
|
}
|
2021-12-15 21:50:21 +03:00
|
|
|
#endif
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
2021-12-15 21:50:21 +03:00
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
for (Fl_Type *p = Fl_Type::first; p;) {
|
|
|
|
if (!selected_only || p->selected) {
|
|
|
|
p->write();
|
|
|
|
write_string("\n");
|
|
|
|
int q = p->level;
|
2016-02-27 20:27:21 +03:00
|
|
|
for (p = p->next; p && p->level > q; p = p->next) {/*empty*/}
|
1998-10-06 22:21:25 +04:00
|
|
|
} else {
|
|
|
|
p = p->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return close_write();
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
// read all the objects out of the input file:
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
2021-12-09 04:43:57 +03:00
|
|
|
Recursively read child nodes in the .fl design file.
|
|
|
|
|
|
|
|
If this is the first call, also read the global settings for this design.
|
|
|
|
|
|
|
|
\param[in] p parent node or NULL
|
|
|
|
\param[in] paste if set, merge into existing design, else replace design
|
2021-12-11 21:43:00 +03:00
|
|
|
\param[in] strategy add nodes after current or as last child
|
|
|
|
\param[in] skip_options this is set if the options were already found in
|
|
|
|
a previous call, and there is no need to waste time searchingg for them.
|
2021-12-08 17:52:15 +03:00
|
|
|
*/
|
2021-12-11 21:43:00 +03:00
|
|
|
static void read_children(Fl_Type *p, int paste, Strategy strategy, char skip_options=0) {
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_Type::current = p;
|
|
|
|
for (;;) {
|
|
|
|
const char *c = read_word();
|
|
|
|
REUSE_C:
|
|
|
|
if (!c) {
|
|
|
|
if (p && !paste) read_error("Missing '}'");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(c,"}")) {
|
|
|
|
if (!p) read_error("Unexpected '}'");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-12-09 04:43:57 +03:00
|
|
|
// Make sure that we don;t go through the list of options for child nodes
|
2021-12-11 21:43:00 +03:00
|
|
|
if (!skip_options) {
|
2021-12-09 04:43:57 +03:00
|
|
|
// this is the first word in a .fd file:
|
|
|
|
if (!strcmp(c,"Magic:")) {
|
|
|
|
read_fdesign();
|
|
|
|
return;
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-09 04:43:57 +03:00
|
|
|
if (!strcmp(c,"version")) {
|
|
|
|
c = read_word();
|
|
|
|
read_version = strtod(c,0);
|
|
|
|
if (read_version<=0 || read_version>double(FL_VERSION+0.00001))
|
|
|
|
read_error("unknown version '%s'",c);
|
|
|
|
continue;
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-09 04:43:57 +03:00
|
|
|
// back compatibility with Vincent Penne's original class code:
|
|
|
|
if (!p && !strcmp(c,"define_in_struct")) {
|
2021-12-11 21:43:00 +03:00
|
|
|
Fl_Type *t = add_new_widget_from_file("class", kAddAsLastChild);
|
2021-12-09 04:43:57 +03:00
|
|
|
t->name(read_word());
|
|
|
|
Fl_Type::current = p = t;
|
|
|
|
paste = 1; // stops "missing }" error
|
|
|
|
continue;
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-09 04:43:57 +03:00
|
|
|
if (!strcmp(c,"do_not_include_H_from_C")) {
|
|
|
|
include_H_from_C=0;
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
|
|
|
if (!strcmp(c,"use_FL_COMMAND")) {
|
|
|
|
use_FL_COMMAND=1;
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
2021-12-17 23:15:04 +03:00
|
|
|
if (!strcmp(c,"utf8_in_src")) {
|
|
|
|
utf8_in_src=1;
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
2022-01-08 23:55:19 +03:00
|
|
|
if (!strcmp(c,"avoid_early_includes")) {
|
|
|
|
avoid_early_includes=1;
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
2021-12-09 04:43:57 +03:00
|
|
|
if (!strcmp(c,"i18n_type")) {
|
|
|
|
i18n_type = atoi(read_word());
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
|
|
|
if (!strcmp(c,"i18n_function")) {
|
|
|
|
i18n_function = fl_strdup(read_word());
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
2021-12-19 03:09:13 +03:00
|
|
|
if (!strcmp(c,"i18n_static_function")) {
|
|
|
|
i18n_static_function = fl_strdup(read_word());
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
2021-12-09 04:43:57 +03:00
|
|
|
if (!strcmp(c,"i18n_file")) {
|
|
|
|
i18n_file = fl_strdup(read_word());
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
|
|
|
if (!strcmp(c,"i18n_set")) {
|
|
|
|
i18n_set = fl_strdup(read_word());
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
|
|
|
if (!strcmp(c,"i18n_include")) {
|
|
|
|
i18n_include = fl_strdup(read_word());
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
2021-12-19 03:09:13 +03:00
|
|
|
if (!strcmp(c,"i18n_conditional")) {
|
|
|
|
i18n_conditional = fl_strdup(read_word());
|
2021-12-09 04:43:57 +03:00
|
|
|
goto CONTINUE;
|
|
|
|
}
|
|
|
|
if (!strcmp(c,"i18n_type"))
|
|
|
|
{
|
|
|
|
i18n_type = atoi(read_word());
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
|
|
|
if (!strcmp(c,"header_name")) {
|
|
|
|
if (!header_file_set) header_file_name = fl_strdup(read_word());
|
|
|
|
else read_word();
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-09 04:43:57 +03:00
|
|
|
if (!strcmp(c,"code_name")) {
|
|
|
|
if (!code_file_set) code_file_name = fl_strdup(read_word());
|
|
|
|
else read_word();
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-09 04:43:57 +03:00
|
|
|
if (!strcmp(c, "snap") || !strcmp(c, "gridx") || !strcmp(c, "gridy")) {
|
|
|
|
// grid settings are now global
|
|
|
|
read_word();
|
|
|
|
goto CONTINUE;
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2021-12-09 04:43:57 +03:00
|
|
|
if (strcmp(c, "win_shell_cmd")==0) {
|
|
|
|
if (shell_settings_windows.command)
|
|
|
|
free((void*)shell_settings_windows.command);
|
|
|
|
shell_settings_windows.command = fl_strdup(read_word());
|
2021-12-09 20:55:45 +03:00
|
|
|
goto CONTINUE;
|
2021-12-09 04:43:57 +03:00
|
|
|
} else if (strcmp(c, "win_shell_flags")==0) {
|
|
|
|
shell_settings_windows.flags = atoi(read_word());
|
2021-12-09 20:55:45 +03:00
|
|
|
goto CONTINUE;
|
2021-12-09 04:43:57 +03:00
|
|
|
} else if (strcmp(c, "linux_shell_cmd")==0) {
|
|
|
|
if (shell_settings_linux.command)
|
|
|
|
free((void*)shell_settings_linux.command);
|
|
|
|
shell_settings_linux.command = fl_strdup(read_word());
|
2021-12-09 20:55:45 +03:00
|
|
|
goto CONTINUE;
|
2021-12-09 04:43:57 +03:00
|
|
|
} else if (strcmp(c, "linux_shell_flags")==0) {
|
|
|
|
shell_settings_linux.flags = atoi(read_word());
|
2021-12-09 20:55:45 +03:00
|
|
|
goto CONTINUE;
|
2021-12-09 04:43:57 +03:00
|
|
|
} else if (strcmp(c, "mac_shell_cmd")==0) {
|
|
|
|
if (shell_settings_macos.command)
|
|
|
|
free((void*)shell_settings_macos.command);
|
|
|
|
shell_settings_macos.command = fl_strdup(read_word());
|
2021-12-09 20:55:45 +03:00
|
|
|
goto CONTINUE;
|
2021-12-09 04:43:57 +03:00
|
|
|
} else if (strcmp(c, "mac_shell_flags")==0) {
|
|
|
|
shell_settings_macos.flags = atoi(read_word());
|
2021-12-09 20:55:45 +03:00
|
|
|
goto CONTINUE;
|
2021-12-09 04:43:57 +03:00
|
|
|
}
|
|
|
|
}
|
2019-02-01 23:32:48 +03:00
|
|
|
{
|
2021-12-11 21:43:00 +03:00
|
|
|
Fl_Type *t = add_new_widget_from_file(c, strategy);
|
2019-02-01 23:32:48 +03:00
|
|
|
if (!t) {
|
|
|
|
read_error("Unknown word \"%s\"", c);
|
|
|
|
continue;
|
|
|
|
}
|
2021-12-09 04:43:57 +03:00
|
|
|
// After reading the first widget, we no longer need to look for options
|
2021-12-11 21:43:00 +03:00
|
|
|
skip_options = 1;
|
|
|
|
|
|
|
|
t->name(read_word());
|
2021-12-09 04:43:57 +03:00
|
|
|
|
2003-01-28 23:51:17 +03:00
|
|
|
c = read_word(1);
|
2019-02-01 23:32:48 +03:00
|
|
|
if (strcmp(c,"{") && t->is_class()) { // <prefix> <name>
|
|
|
|
((Fl_Class_Type*)t)->prefix(t->name());
|
|
|
|
t->name(c);
|
|
|
|
c = read_word(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(c,"{")) {
|
|
|
|
read_error("Missing property list for %s\n",t->title());
|
|
|
|
goto REUSE_C;
|
|
|
|
}
|
|
|
|
|
|
|
|
t->open_ = 0;
|
|
|
|
for (;;) {
|
|
|
|
const char *cc = read_word();
|
|
|
|
if (!cc || !strcmp(cc,"}")) break;
|
|
|
|
t->read_property(cc);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!t->is_parent()) continue;
|
|
|
|
c = read_word(1);
|
|
|
|
if (strcmp(c,"{")) {
|
|
|
|
read_error("Missing child list for %s\n",t->title());
|
|
|
|
goto REUSE_C;
|
|
|
|
}
|
2021-12-11 21:43:00 +03:00
|
|
|
read_children(t, 0, strategy, skip_options);
|
2003-01-28 23:51:17 +03:00
|
|
|
}
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_Type::current = p;
|
2020-07-01 19:03:10 +03:00
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
CONTINUE:;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Read a .fl design file.
|
|
|
|
\param[in] filename read this file
|
|
|
|
\param[in] merge if this is set, merge the file into an existing design
|
2021-12-11 21:43:00 +03:00
|
|
|
at Fl_Type::current
|
|
|
|
\param[in] strategy add new nodes after current or as last child
|
2021-12-08 17:52:15 +03:00
|
|
|
\return 0 if the operation failed, 1 if it succeeded
|
|
|
|
*/
|
2021-12-11 21:43:00 +03:00
|
|
|
int read_file(const char *filename, int merge, Strategy strategy) {
|
2002-05-14 00:54:49 +04:00
|
|
|
Fl_Type *o;
|
1998-10-06 22:21:25 +04:00
|
|
|
read_version = 0.0;
|
2021-12-09 04:43:57 +03:00
|
|
|
if (!open_read(filename))
|
|
|
|
return 0;
|
|
|
|
if (merge)
|
|
|
|
deselect();
|
|
|
|
else
|
|
|
|
delete_all();
|
2021-12-11 21:43:00 +03:00
|
|
|
read_children(Fl_Type::current, merge, strategy);
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_Type::current = 0;
|
2002-05-12 06:19:18 +04:00
|
|
|
// Force menu items to be rebuilt...
|
2002-05-14 00:54:49 +04:00
|
|
|
for (o = Fl_Type::first; o; o = o->next)
|
2021-12-09 04:43:57 +03:00
|
|
|
if (o->is_menu_button())
|
|
|
|
o->add_child(0,0);
|
2002-05-14 00:54:49 +04:00
|
|
|
for (o = Fl_Type::first; o; o = o->next)
|
2021-12-09 04:43:57 +03:00
|
|
|
if (o->selected) {
|
|
|
|
Fl_Type::current = o;
|
|
|
|
break;
|
|
|
|
}
|
2006-06-19 12:01:01 +04:00
|
|
|
selection_changed(Fl_Type::current);
|
2021-12-09 04:43:57 +03:00
|
|
|
shell_settings_read();
|
1998-10-06 22:21:25 +04:00
|
|
|
return close_read();
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
// Read Forms and XForms fdesign files:
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
static int read_fdesign_line(const char*& name, const char*& value) {
|
1998-10-06 22:21:25 +04:00
|
|
|
int length = 0;
|
|
|
|
int x;
|
|
|
|
// find a colon:
|
|
|
|
for (;;) {
|
|
|
|
x = getc(fin);
|
2006-01-31 22:00:08 +03:00
|
|
|
if (x < 0 && feof(fin)) return 0;
|
1998-10-06 22:21:25 +04:00
|
|
|
if (x == '\n') {length = 0; continue;} // no colon this line...
|
2006-01-31 19:22:06 +03:00
|
|
|
if (!isspace(x & 255)) {
|
1998-10-06 22:21:25 +04:00
|
|
|
buffer[length++] = x;
|
|
|
|
expand_buffer(length);
|
|
|
|
}
|
|
|
|
if (x == ':') break;
|
|
|
|
}
|
|
|
|
int valueoffset = length;
|
|
|
|
buffer[length-1] = 0;
|
|
|
|
|
|
|
|
// skip to start of value:
|
|
|
|
for (;;) {
|
|
|
|
x = getc(fin);
|
2006-01-31 22:00:08 +03:00
|
|
|
if ((x < 0 && feof(fin)) || x == '\n' || !isspace(x & 255)) break;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// read the value:
|
|
|
|
for (;;) {
|
|
|
|
if (x == '\\') {x = read_quoted(); if (x<0) continue;}
|
|
|
|
else if (x == '\n') break;
|
|
|
|
buffer[length++] = x;
|
|
|
|
expand_buffer(length);
|
|
|
|
x = getc(fin);
|
|
|
|
}
|
|
|
|
buffer[length] = 0;
|
|
|
|
name = buffer;
|
|
|
|
value = buffer+valueoffset;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *class_matcher[] = {
|
|
|
|
"FL_CHECKBUTTON", "Fl_Check_Button",
|
|
|
|
"FL_ROUNDBUTTON", "Fl_Round_Button",
|
|
|
|
"FL_ROUND3DBUTTON", "Fl_Round_Button",
|
|
|
|
"FL_LIGHTBUTTON", "Fl_Light_Button",
|
|
|
|
"FL_FRAME", "Fl_Box",
|
|
|
|
"FL_LABELFRAME", "Fl_Box",
|
|
|
|
"FL_TEXT", "Fl_Box",
|
|
|
|
"FL_VALSLIDER", "Fl_Value_Slider",
|
|
|
|
"FL_MENU", "Fl_Menu_Button",
|
|
|
|
"3", "FL_BITMAP",
|
|
|
|
"1", "FL_BOX",
|
|
|
|
"71","FL_BROWSER",
|
|
|
|
"11","FL_BUTTON",
|
|
|
|
"4", "FL_CHART",
|
|
|
|
"42","FL_CHOICE",
|
|
|
|
"61","FL_CLOCK",
|
|
|
|
"25","FL_COUNTER",
|
|
|
|
"22","FL_DIAL",
|
|
|
|
"101","FL_FREE",
|
|
|
|
"31","FL_INPUT",
|
|
|
|
"12","Fl_Light_Button",
|
|
|
|
"41","FL_MENU",
|
|
|
|
"23","FL_POSITIONER",
|
|
|
|
"13","Fl_Round_Button",
|
|
|
|
"21","FL_SLIDER",
|
|
|
|
"2", "FL_BOX", // was FL_TEXT
|
|
|
|
"62","FL_TIMER",
|
|
|
|
"24","Fl_Value_Slider",
|
|
|
|
0};
|
|
|
|
|
2021-12-13 20:32:11 +03:00
|
|
|
|
|
|
|
/**
|
2021-12-13 23:55:03 +03:00
|
|
|
Finish a group of widgets and optionally transform its children's coordinates.
|
|
|
|
|
|
|
|
Implements the same functionality as Fl_Group::forms_end() from the forms
|
|
|
|
compatibility library would have done:
|
|
|
|
|
|
|
|
- resize the group to surround its children if the group's w() == 0
|
|
|
|
- optionally flip the \p y coordinates of all children relative to the group's window
|
|
|
|
- Fl_Group::end() the group
|
|
|
|
|
|
|
|
\note Copied from forms_compatibility.cxx and modified as a static fluid
|
|
|
|
function so we don't have to link to fltk_forms.
|
|
|
|
|
|
|
|
\param[in] g the Fl_Group widget
|
|
|
|
\param[in] flip flip children's \p y coordinates if true (non-zero)
|
|
|
|
*/
|
|
|
|
static void forms_end(Fl_Group *g, int flip) {
|
|
|
|
// set the dimensions of a group to surround its contents
|
|
|
|
const int nc = g->children();
|
|
|
|
if (nc && !g->w()) {
|
|
|
|
Fl_Widget*const* a = g->array();
|
2021-12-13 20:32:11 +03:00
|
|
|
Fl_Widget* o = *a++;
|
|
|
|
int rx = o->x();
|
|
|
|
int ry = o->y();
|
|
|
|
int rw = rx+o->w();
|
|
|
|
int rh = ry+o->h();
|
2021-12-13 23:55:03 +03:00
|
|
|
for (int i = nc - 1; i--;) {
|
2021-12-13 20:32:11 +03:00
|
|
|
o = *a++;
|
|
|
|
if (o->x() < rx) rx = o->x();
|
|
|
|
if (o->y() < ry) ry = o->y();
|
2021-12-13 23:55:03 +03:00
|
|
|
if (o->x() + o->w() > rw) rw = o->x() + o->w();
|
|
|
|
if (o->y() + o->h() > rh) rh = o->y() + o->h();
|
2021-12-13 20:32:11 +03:00
|
|
|
}
|
2021-12-13 23:55:03 +03:00
|
|
|
g->Fl_Widget::resize(rx, ry, rw-rx, rh-ry);
|
2021-12-13 20:32:11 +03:00
|
|
|
}
|
|
|
|
// flip all the children's coordinate systems:
|
2021-12-13 23:55:03 +03:00
|
|
|
if (nc && flip) {
|
|
|
|
Fl_Widget* o = (g->as_window()) ? g : g->window();
|
2021-12-13 20:32:11 +03:00
|
|
|
int Y = o->h();
|
2021-12-13 23:55:03 +03:00
|
|
|
Fl_Widget*const* a = g->array();
|
|
|
|
for (int i = nc; i--;) {
|
2021-12-13 20:32:11 +03:00
|
|
|
Fl_Widget* ow = *a++;
|
2021-12-13 23:55:03 +03:00
|
|
|
int newy = Y - ow->y() - ow->h();
|
|
|
|
ow->Fl_Widget::resize(ow->x(), newy, ow->w(), ow->h());
|
2021-12-13 20:32:11 +03:00
|
|
|
}
|
|
|
|
}
|
2021-12-13 23:55:03 +03:00
|
|
|
g->end();
|
2021-12-13 20:32:11 +03:00
|
|
|
}
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
/**
|
|
|
|
Read a XForms design file.
|
|
|
|
.fl and .fd file start with the same header. Fluid can recognize .fd XForms
|
|
|
|
Design files by a magic number. It will read them and map XForms widgets onto
|
|
|
|
FLTK widgets.
|
|
|
|
\see http://xforms-toolkit.org
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void read_fdesign() {
|
|
|
|
fdesign_magic = atoi(read_word());
|
|
|
|
fdesign_flip = (fdesign_magic < 13000);
|
|
|
|
Fl_Widget_Type *window = 0;
|
|
|
|
Fl_Widget_Type *group = 0;
|
|
|
|
Fl_Widget_Type *widget = 0;
|
|
|
|
if (!Fl_Type::current) {
|
2021-12-11 21:43:00 +03:00
|
|
|
Fl_Type *t = add_new_widget_from_file("Function", kAddAsLastChild);
|
1998-10-06 22:21:25 +04:00
|
|
|
t->name("create_the_forms()");
|
|
|
|
Fl_Type::current = t;
|
|
|
|
}
|
|
|
|
for (;;) {
|
|
|
|
const char *name;
|
|
|
|
const char *value;
|
|
|
|
if (!read_fdesign_line(name, value)) break;
|
|
|
|
|
|
|
|
if (!strcmp(name,"Name")) {
|
|
|
|
|
2021-12-11 21:43:00 +03:00
|
|
|
window = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Window", kAddAsLastChild);
|
1998-10-06 22:21:25 +04:00
|
|
|
window->name(value);
|
|
|
|
window->label(value);
|
|
|
|
Fl_Type::current = widget = window;
|
|
|
|
|
|
|
|
} else if (!strcmp(name,"class")) {
|
|
|
|
|
|
|
|
if (!strcmp(value,"FL_BEGIN_GROUP")) {
|
2021-12-11 21:43:00 +03:00
|
|
|
group = widget = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Group", kAddAsLastChild);
|
2020-07-01 19:03:10 +03:00
|
|
|
Fl_Type::current = group;
|
1998-10-06 22:21:25 +04:00
|
|
|
} else if (!strcmp(value,"FL_END_GROUP")) {
|
2020-07-01 19:03:10 +03:00
|
|
|
if (group) {
|
|
|
|
Fl_Group* g = (Fl_Group*)(group->o);
|
|
|
|
g->begin();
|
2021-12-13 23:55:03 +03:00
|
|
|
forms_end(g, fdesign_flip);
|
2020-07-01 19:03:10 +03:00
|
|
|
Fl_Group::current(0);
|
|
|
|
}
|
|
|
|
group = widget = 0;
|
|
|
|
Fl_Type::current = window;
|
1998-10-06 22:21:25 +04:00
|
|
|
} else {
|
2020-07-01 19:03:10 +03:00
|
|
|
for (int i = 0; class_matcher[i]; i += 2)
|
|
|
|
if (!strcmp(value,class_matcher[i])) {
|
|
|
|
value = class_matcher[i+1]; break;}
|
2021-12-11 21:43:00 +03:00
|
|
|
widget = (Fl_Widget_Type*)add_new_widget_from_file(value, kAddAsLastChild);
|
2020-07-01 19:03:10 +03:00
|
|
|
if (!widget) {
|
|
|
|
printf("class %s not found, using Fl_Button\n", value);
|
2021-12-11 21:43:00 +03:00
|
|
|
widget = (Fl_Widget_Type*)add_new_widget_from_file("Fl_Button", kAddAsLastChild);
|
2020-07-01 19:03:10 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
} else if (widget) {
|
|
|
|
if (!widget->read_fdesign(name, value))
|
2020-07-01 19:03:10 +03:00
|
|
|
printf("Ignoring \"%s: %s\"\n", name, value);
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-08 17:52:15 +03:00
|
|
|
|
|
|
|
/// \}
|