mirror of
https://github.com/fltk/fltk.git
synced 2026-06-01 23:06:54 +08:00
FLUID: updates templates and predefined comments
This commit is contained in:
@@ -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 void load_comments_preset(Fl_Preferences &menu) {
|
||||||
static const char * const predefined_comment[] = {
|
static const char * const predefined_comment[] = {
|
||||||
"GNU Public License/GPL Header", "GNU Public License/GPL Footer",
|
"GNU Public License v3/GPL Header", "GNU Public License v3/GPL Footer",
|
||||||
"GNU Public License/LGPL Header", "GNU Public License/LGPL Footer",
|
"GNU Public License v3/LGPL Header", "GNU Public License v3/LGPL Footer",
|
||||||
"FLTK/Header" };
|
"FLTK/Header" };
|
||||||
int i;
|
int i, n;
|
||||||
menu.set("n", 5);
|
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");
|
Fl_Preferences db(Fl_Preferences::USER_L, "fltk.org", "fluid_comments");
|
||||||
for (i=0; i<5; i++) {
|
for (i=0; i<5; i++) {
|
||||||
menu.set(Fl_Preferences::Name(i), predefined_comment[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();
|
if (!comment_panel) make_comment_panel();
|
||||||
const char *text = name();
|
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");
|
Fl_Preferences menu(Fl_Preferences::USER_L, "fltk.org", "fluid_comments_menu");
|
||||||
comment_predefined->clear();
|
comment_predefined->clear();
|
||||||
comment_predefined->add("_Edit/Add current comment...");
|
comment_predefined->add("_Edit/Add current comment...");
|
||||||
comment_predefined->add("_Edit/Remove last selection...");
|
comment_predefined->add("_Edit/Remove last selection...");
|
||||||
menu.get("n", n, -1);
|
menu.get("version", version, -1);
|
||||||
if (n==-1) load_comments_preset(menu);
|
if (version < 10400) load_comments_preset(menu);
|
||||||
menu.get("n", n, 0);
|
menu.get("n", n, 0);
|
||||||
for (i=0;i<n;i++) {
|
for (i=0;i<n;i++) {
|
||||||
char *text;
|
char *text;
|
||||||
@@ -1651,7 +1653,7 @@ void Fl_Comment_Type::open() {
|
|||||||
} else if (comment_predefined->value()==2) {
|
} else if (comment_predefined->value()==2) {
|
||||||
// remove the last selected comment from the database
|
// remove the last selected comment from the database
|
||||||
if (itempath[0]==0 || last_selected_item==0) {
|
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"
|
} else if (fl_choice("Are you sure that you want to delete the entry\n"
|
||||||
"\"%s\"\nfrom the database?", "Cancel", "Delete",
|
"\"%s\"\nfrom the database?", "Cancel", "Delete",
|
||||||
NULL, itempath)) {
|
NULL, itempath)) {
|
||||||
|
|||||||
+10
-12
@@ -5,9 +5,9 @@ static const char * const comment_text[] = {
|
|||||||
"// NameOfProgram, ShortDescription\n"
|
"// NameOfProgram, ShortDescription\n"
|
||||||
"// Copyright (C) YYYY NameOfAuthor\n"
|
"// Copyright (C) YYYY NameOfAuthor\n"
|
||||||
"//\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"
|
"// 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"
|
"// of the License, or (at your option) any later version.\n"
|
||||||
"//\n"
|
"//\n"
|
||||||
"// This program is distributed in the hope that it will be useful,\n"
|
"// This program is distributed in the hope that it will be useful,\n"
|
||||||
@@ -16,8 +16,7 @@ static const char * const comment_text[] = {
|
|||||||
"// GNU General Public License for more details.\n"
|
"// GNU General Public License for more details.\n"
|
||||||
"//\n"
|
"//\n"
|
||||||
"// You should have received a copy of the GNU General Public License\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"
|
"// along with this program. If not, see <https://www.gnu.org/licenses/>.\n"
|
||||||
"// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"
|
|
||||||
"//\n",
|
"//\n",
|
||||||
// GNU Public License/GPL Footer
|
// GNU Public License/GPL Footer
|
||||||
"\n//\n"
|
"\n//\n"
|
||||||
@@ -29,19 +28,18 @@ static const char * const comment_text[] = {
|
|||||||
"// NameOfLibrary, ShortDescription\n"
|
"// NameOfLibrary, ShortDescription\n"
|
||||||
"// Copyright (C) YYYY NameOfAuthor\n"
|
"// Copyright (C) YYYY NameOfAuthor\n"
|
||||||
"//\n"
|
"//\n"
|
||||||
"// This library is free software; you can redistribute it and/or\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"
|
"// modify it under the terms of the GNU Lesser General Public License\n"
|
||||||
"// License as published by the Free Software Foundation; either\n"
|
"// as published by the Free Software Foundation, either version 3\n"
|
||||||
"// version 2.1 of the License, or (at your option) any later version.\n"
|
"// of the License, or (at your option) any later version.\n"
|
||||||
"//\n"
|
"//\n"
|
||||||
"// This library is distributed in the hope that it will be useful,\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"
|
"// 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"
|
"// GNU Lesser General Public License for more details.\n"
|
||||||
"//\n"
|
"//\n"
|
||||||
"// You should have received a copy of the GNU Lesser General Public\n"
|
"// You should have received a copy of the GNU Lesser General Public License\n"
|
||||||
"// License along with this program; if not, write to the Free Software\n"
|
"// along with this library. If not, see <https://www.gnu.org/licenses/>.\n"
|
||||||
"// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"
|
|
||||||
"//\n",
|
"//\n",
|
||||||
// GNU Public License/LGPL Footer
|
// GNU Public License/LGPL Footer
|
||||||
"\n//\n"
|
"\n//\n"
|
||||||
@@ -52,7 +50,7 @@ static const char * const comment_text[] = {
|
|||||||
"//\n"
|
"//\n"
|
||||||
"// ... for the Fast Light Tool Kit (FLTK).\n"
|
"// ... for the Fast Light Tool Kit (FLTK).\n"
|
||||||
"//\n"
|
"//\n"
|
||||||
"// Copyright 1998-2020 by Bill Spitzak and others.\n"
|
"// Copyright 1998-2023 by Bill Spitzak and others.\n"
|
||||||
"//\n"
|
"//\n"
|
||||||
"// This library is free software. Distribution and use rights are outlined in\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"
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ void template_load() {
|
|||||||
fputs(
|
fputs(
|
||||||
"# data file for the Fltk User Interface Designer (fluid)\nversion 1.0400\nheader_name {.h}\n"
|
"# 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"
|
"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 "
|
"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"
|
"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 "
|
"//\n// https://www.fltk.org/COPYING.php\n//\n// Please see the following page on how to report "
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ template_preview->image(0);
|
|||||||
template_browser->deselect();
|
template_browser->deselect();
|
||||||
template_name->value("");
|
template_name->value("");
|
||||||
template_instance->value("");
|
template_instance->value("");
|
||||||
template_panel->hide();} selected
|
template_panel->hide();}
|
||||||
xywh {478 284 460 355} type Double resizable modal visible
|
xywh {478 284 460 355} type Double resizable modal visible
|
||||||
} {
|
} {
|
||||||
Fl_Browser template_browser {
|
Fl_Browser template_browser {
|
||||||
@@ -209,7 +209,7 @@ template_browser->remove(item);
|
|||||||
template_browser->do_callback();} {}
|
template_browser->do_callback();} {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Function {template_load()} {return_type void
|
Function {template_load()} {open return_type void
|
||||||
} {
|
} {
|
||||||
code {int i;
|
code {int i;
|
||||||
char name[1024], filename[1400], path[1024], *ptr;
|
char name[1024], filename[1400], path[1024], *ptr;
|
||||||
@@ -230,7 +230,7 @@ if (!sample_templates_generated) {
|
|||||||
fputs(
|
fputs(
|
||||||
"\# data file for the Fltk User Interface Designer (fluid)\\nversion 1.0400\\nheader_name {.h}\\n"
|
"\# 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"
|
"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 "
|
"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"
|
"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 "
|
"//\\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]);
|
free(files[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_files > 0) free(files);} {}
|
if (num_files > 0) free(files);} {selected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user