FLUID: updates templates and predefined comments

This commit is contained in:
Matthias Melcher 2023-07-21 13:34:04 +02:00
parent 43fe6ee027
commit dac1af37e1
4 changed files with 29 additions and 28 deletions

View File

@ -1583,11 +1583,13 @@ void Fl_Comment_Type::read_property(Fd_Project_Reader &f, const char *c) {
*/
static void load_comments_preset(Fl_Preferences &menu) {
static const char * const predefined_comment[] = {
"GNU Public License/GPL Header", "GNU Public License/GPL Footer",
"GNU Public License/LGPL Header", "GNU Public License/LGPL Footer",
"GNU Public License v3/GPL Header", "GNU Public License v3/GPL Footer",
"GNU Public License v3/LGPL Header", "GNU Public License v3/LGPL Footer",
"FLTK/Header" };
int i;
menu.set("n", 5);
int i, n;
menu.get("n", n, -1);
if (n == -1) menu.set("n", 5);
menu.set("version", 10400);
Fl_Preferences db(Fl_Preferences::USER_L, "fltk.org", "fluid_comments");
for (i=0; i<5; i++) {
menu.set(Fl_Preferences::Name(i), predefined_comment[i]);
@ -1602,13 +1604,13 @@ void Fl_Comment_Type::open() {
if (!comment_panel) make_comment_panel();
const char *text = name();
{
int i=0, n=0;
int i=0, n=0, version = 0;
Fl_Preferences menu(Fl_Preferences::USER_L, "fltk.org", "fluid_comments_menu");
comment_predefined->clear();
comment_predefined->add("_Edit/Add current comment...");
comment_predefined->add("_Edit/Remove last selection...");
menu.get("n", n, -1);
if (n==-1) load_comments_preset(menu);
menu.get("version", version, -1);
if (version < 10400) load_comments_preset(menu);
menu.get("n", n, 0);
for (i=0;i<n;i++) {
char *text;
@ -1651,7 +1653,7 @@ void Fl_Comment_Type::open() {
} else if (comment_predefined->value()==2) {
// remove the last selected comment from the database
if (itempath[0]==0 || last_selected_item==0) {
fl_message("Please select an entry form this menu first.");
fl_message("Please select an entry from this menu first.");
} else if (fl_choice("Are you sure that you want to delete the entry\n"
"\"%s\"\nfrom the database?", "Cancel", "Delete",
NULL, itempath)) {

View File

@ -5,19 +5,18 @@ static const char * const comment_text[] = {
"// NameOfProgram, ShortDescription\n"
"// Copyright (C) YYYY NameOfAuthor\n"
"//\n"
"// This program is free software; you can redistribute it and/or\n"
"// This program is free software: you can redistribute it and/or\n"
"// modify it under the terms of the GNU General Public License\n"
"// as published by the Free Software Foundation; either version 2\n"
"// as published by the Free Software Foundation, either version 3\n"
"// of the License, or (at your option) any later version.\n"
"//\n"
"// This program is distributed in the hope that it will be useful,\n"
"// but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"// GNU General Public License for more details.\n"
"//\n"
"// You should have received a copy of the GNU General Public License\n"
"// along with this program; if not, write to the Free Software\n"
"// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"
"// along with this program. If not, see <https://www.gnu.org/licenses/>.\n"
"//\n",
// GNU Public License/GPL Footer
"\n//\n"
@ -29,19 +28,18 @@ static const char * const comment_text[] = {
"// NameOfLibrary, ShortDescription\n"
"// Copyright (C) YYYY NameOfAuthor\n"
"//\n"
"// This library is free software; you can redistribute it and/or\n"
"// modify it under the terms of the GNU Lesser General Public\n"
"// License as published by the Free Software Foundation; either\n"
"// version 2.1 of the License, or (at your option) any later version.\n"
"// This library is free software: you can redistribute it and/or\n"
"// modify it under the terms of the GNU Lesser General Public License\n"
"// as published by the Free Software Foundation, either version 3\n"
"// of the License, or (at your option) any later version.\n"
"//\n"
"// This library is distributed in the hope that it will be useful,\n"
"// but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"// GNU Lesser General Public License for more details.\n"
"//\n"
"// You should have received a copy of the GNU Lesser General Public\n"
"// License along with this program; if not, write to the Free Software\n"
"// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"
"// You should have received a copy of the GNU Lesser General Public License\n"
"// along with this library. If not, see <https://www.gnu.org/licenses/>.\n"
"//\n",
// GNU Public License/LGPL Footer
"\n//\n"
@ -52,10 +50,10 @@ static const char * const comment_text[] = {
"//\n"
"// ... for the Fast Light Tool Kit (FLTK).\n"
"//\n"
"// Copyright 1998-2020 by Bill Spitzak and others.\n"
"// Copyright 1998-2023 by Bill Spitzak and others.\n"
"//\n"
"// This library is free software. Distribution and use rights are outlined in\n"
"// the file \"COPYING\" which should have been included with this file. If this\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"
"// https://www.fltk.org/COPYING.php\n"

View File

@ -229,7 +229,7 @@ void template_load() {
fputs(
"# data file for the Fltk User Interface Designer (fluid)\nversion 1.0400\nheader_name {.h}\n"
"code_name {.cxx}\ncomment {//\n// @INSTANCE@ for the Fast Light Tool Kit (FLT"
"K).\n//\n// Copyright 1998-2020 by Bill Spitzak and others.\n//\n// This library is free sof"
"K).\n//\n// Copyright 1998-2023 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// https://www.fltk.org/COPYING.php\n//\n// Please see the following page on how to report "

View File

@ -73,7 +73,7 @@ template_preview->image(0);
template_browser->deselect();
template_name->value("");
template_instance->value("");
template_panel->hide();} selected
template_panel->hide();}
xywh {478 284 460 355} type Double resizable modal visible
} {
Fl_Browser template_browser {
@ -209,7 +209,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[1400], path[1024], *ptr;
@ -230,7 +230,7 @@ if (!sample_templates_generated) {
fputs(
"\# data file for the Fltk User Interface Designer (fluid)\\nversion 1.0400\\nheader_name {.h}\\n"
"code_name {.cxx}\\ncomment {//\\n// @INSTANCE@ for the Fast Light Tool Kit (FLT"
"K).\\n//\\n// Copyright 1998-2020 by Bill Spitzak and others.\\n//\\n// This library is free sof"
"K).\\n//\\n// Copyright 1998-2023 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// https://www.fltk.org/COPYING.php\\n//\\n// Please see the following page on how to report "
@ -264,5 +264,6 @@ for (i = 0; i < num_files; i ++) {
free(files[i]);
}
if (num_files > 0) free(files);} {}
if (num_files > 0) free(files);} {selected
}
}