Generate copyright year in fluid's about_panel

Copyright year "1998-XXXX" is now generated from current year.
This avoids editing the source code every year.
This commit is contained in:
Albrecht Schlosser 2020-04-06 19:57:27 +02:00
parent 7793fa812a
commit 21fb8725c6
3 changed files with 33 additions and 14 deletions

View File

@ -3,17 +3,17 @@
//
// About dialog for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2018 by Bill Spitzak and others.
// Copyright 1998-2020 by Bill Spitzak and others.
//
// 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:
//
// http://www.fltk.org/COPYING.php
// https://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
// https://www.fltk.org/str.php
//
// generated by Fast Light User Interface Designer (fluid) version 1.0400
@ -265,6 +265,12 @@ static void cb_Close(Fl_Return_Button* o, void*) {
}
Fl_Double_Window* make_about_panel() {
static char cbuf[200] = "";
if (!cbuf[0]) {
time_t t = time(0);
struct tm *lt = localtime(&t);
sprintf(cbuf, "Copyright © 1998 - %d\nby Bill Spitzak and others", lt->tm_year+1900);
}
{ about_panel = new Fl_Double_Window(345, 180, "About FLUID");
about_panel->color(FL_LIGHT1);
about_panel->selection_color(FL_DARK1);
@ -282,8 +288,10 @@ Fl_Double_Window* make_about_panel() {
snprintf(about,sizeof(about),"FLTK User\nInterface Designer\nVersion %d.%d.%d",FL_MAJOR_VERSION,FL_MINOR_VERSION,FL_PATCH_VERSION);
o->copy_label(about);
} // Fl_Box* o
{ Fl_Box* o = new Fl_Box(135, 90, 200, 45, "Copyright 1998-2018 by\nBill Spitzak and others");
{ // Label edited dynamically:
Fl_Box* o = new Fl_Box(135, 90, 200, 45, "(Copyright)");
o->align(Fl_Align(132|FL_ALIGN_INSIDE));
o->label(cbuf);
} // Fl_Box* o
{ Fl_Button* o = new Fl_Button(115, 145, 123, 25, "View License...");
o->labelcolor(FL_DARK_BLUE);

View File

@ -7,29 +7,38 @@ comment {//
//
// About dialog for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2018 by Bill Spitzak and others.
// Copyright 1998-2020 by Bill Spitzak and others.
//
// 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:
//
// http://www.fltk.org/COPYING.php
// https://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
// https://www.fltk.org/str.php
//
} {in_source in_header
}
decl {\#include <time.h>} {public global
}
decl {void show_help(const char *name);} {public local
}
Function {make_about_panel()} {open
} {
code {static char cbuf[200] = "";
if (!cbuf[0]) {
time_t t = time(0);
struct tm *lt = localtime(&t);
sprintf(cbuf, "Copyright © 1998 - %d\\nby Bill Spitzak and others", lt->tm_year+1900);
}} {}
Fl_Window about_panel {
label {About FLUID} open selected
xywh {340 195 345 180} type Double color 50 selection_color 47 hide hotspot
label {About FLUID} open
xywh {340 190 345 180} type Double color 50 selection_color 47 hide hotspot
code0 {\#include "../src/flstring.h"} non_modal
} {
Fl_Box {} {
@ -45,9 +54,10 @@ Version x.x.x}
code2 {o->copy_label(about);}
}
Fl_Box {} {
label {Copyright 1998-2018 by
Bill Spitzak and others}
label {(Copyright)}
comment {Label edited dynamically:} selected
xywh {135 90 200 45} align 148
code0 {o->label(cbuf);}
}
Fl_Button {} {
label {View License...}

View File

@ -3,17 +3,17 @@
//
// About dialog for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2018 by Bill Spitzak and others.
// Copyright 1998-2020 by Bill Spitzak and others.
//
// 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:
//
// http://www.fltk.org/COPYING.php
// https://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
// https://www.fltk.org/str.php
//
// generated by Fast Light User Interface Designer (fluid) version 1.0400
@ -21,6 +21,7 @@
#ifndef about_panel_h
#define about_panel_h
#include <FL/Fl.H>
#include <time.h>
extern void show_help(const char *name);
#include <FL/Fl_Double_Window.H>
#include "../src/flstring.h"