Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 4145) +++ trunk/scconfig/Rev.h (revision 4146) @@ -1 +1 @@ -static const int myrev = 4039; +static const int myrev = 4146; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 4145) +++ trunk/scconfig/Rev.tab (revision 4146) @@ -1,3 +1,4 @@ +4146 configure about box 4039 configure sheet selector GUI in top window 3828 configure centralzie local lib support into libcschem 3699 configure expotr_lpr plugin for printing Index: trunk/src/plugins/sch_dialogs/Plug.tmpasm =================================================================== --- trunk/src/plugins/sch_dialogs/Plug.tmpasm (revision 4145) +++ trunk/src/plugins/sch_dialogs/Plug.tmpasm (revision 4146) @@ -1,6 +1,7 @@ put /local/pcb/mod {sch_dialogs} put /local/pcb/mod/OBJS [@ $(PLUGDIR)/sch_dialogs/sch_dialogs.o + $(PLUGDIR)/sch_dialogs/dlg_about.o $(PLUGDIR)/sch_dialogs/dlg_undo.o $(PLUGDIR)/sch_dialogs/dlg_pref_apptab.o $(PLUGDIR)/sch_dialogs/dlg_pen.o Index: trunk/src/plugins/sch_dialogs/dlg_about.c =================================================================== --- trunk/src/plugins/sch_dialogs/dlg_about.c (nonexistent) +++ trunk/src/plugins/sch_dialogs/dlg_about.c (revision 4146) @@ -0,0 +1,120 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - GUI + * Copyright (C) 2018 Tibor 'Igor2' Palinkas (in pcb-rnd) + * Copyright (C) 2022 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include "dlg_about.h" + +typedef struct{ + RND_DAD_DECL_NOINIT(dlg) + int active; /* already open - allow only one instance */ +} about_ctx_t; + +about_ctx_t about_ctx; + +static void about_close_cb(void *caller_data, rnd_hid_attr_ev_t ev) +{ + about_ctx_t *ctx = caller_data; + RND_DAD_FREE(ctx->dlg); + memset(ctx, 0, sizeof(about_ctx_t)); /* reset all states to the initial - includes ctx->active = 0; */ +} + + +static void sch_rnd_dlg_about(void) +{ + const char *tabs[] = { "About sch-rnd", "Options", "Paths", "License", NULL }; + rnd_hid_dad_buttons_t clbtn[] = {{"Close", 0}, {NULL, 0}}; + htsp_entry_t *e; + gds_t s; + + if (about_ctx.active) + return; + + RND_DAD_BEGIN_VBOX(about_ctx.dlg); + RND_DAD_COMPFLAG(about_ctx.dlg, RND_HATF_EXPFILL); + RND_DAD_BEGIN_TABBED(about_ctx.dlg, tabs); + RND_DAD_COMPFLAG(about_ctx.dlg, RND_HATF_EXPFILL); + RND_DAD_BEGIN_VBOX(about_ctx.dlg); + RND_DAD_LABEL(about_ctx.dlg, sch_rnd_get_info_program()); + RND_DAD_LABEL(about_ctx.dlg, sch_rnd_get_info_copyright()); + RND_DAD_LABEL(about_ctx.dlg, sch_rnd_get_info_websites(NULL)); + RND_DAD_END(about_ctx.dlg); + + RND_DAD_BEGIN_VBOX(about_ctx.dlg); + RND_DAD_COMPFLAG(about_ctx.dlg, /*RND_HATF_SCROLL |*/ /*RND_HATF_FRAME |*/ RND_HATF_EXPFILL); + RND_DAD_LABEL(about_ctx.dlg, sch_rnd_get_info_compile_options()); + RND_DAD_COMPFLAG(about_ctx.dlg, RND_HATF_EXPFILL); + RND_DAD_END(about_ctx.dlg); + + + RND_DAD_BEGIN_VBOX(about_ctx.dlg); + RND_DAD_COMPFLAG(about_ctx.dlg, RND_HATF_SCROLL); + gds_init(&s); + for (e = htsp_first(&rnd_file_loaded); e; e = htsp_next(&rnd_file_loaded, e)) { + htsp_entry_t *e2; + rnd_file_loaded_t *cat = e->value; + RND_DAD_LABEL(about_ctx.dlg, cat->name); + gds_truncate(&s, 0); + for (e2 = htsp_first(&cat->data.category.children); e2; e2 = htsp_next(&cat->data.category.children, e2)) { + rnd_file_loaded_t *file = e2->value; + rnd_append_printf(&s, " %s\t%s\t%s\n", file->name, file->data.file.path, file->data.file.desc); + } + RND_DAD_LABEL(about_ctx.dlg, s.array); + } + gds_uninit(&s); + RND_DAD_END(about_ctx.dlg); + + RND_DAD_BEGIN_VBOX(about_ctx.dlg); + RND_DAD_LABEL(about_ctx.dlg, sch_rnd_get_info_license()); + RND_DAD_END(about_ctx.dlg); + + RND_DAD_END(about_ctx.dlg); + RND_DAD_BUTTON_CLOSES(about_ctx.dlg, clbtn); + RND_DAD_END(about_ctx.dlg); + + /* set up the context */ + about_ctx.active = 1; + + RND_DAD_NEW("about", about_ctx.dlg, "About sch-rnd", &about_ctx, rnd_false, about_close_cb); +} + +const char csch_acts_About[] = "About()\n"; +const char csch_acth_About[] = "Present the about box"; +fgw_error_t csch_act_About(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + sch_rnd_dlg_about(); + RND_ACT_IRES(0); + return 0; +} Index: trunk/src/plugins/sch_dialogs/dlg_about.h =================================================================== --- trunk/src/plugins/sch_dialogs/dlg_about.h (nonexistent) +++ trunk/src/plugins/sch_dialogs/dlg_about.h (revision 4146) @@ -0,0 +1,3 @@ +extern const char csch_acts_About[]; +extern const char csch_acth_About[]; +fgw_error_t csch_act_About(fgw_arg_t *res, int argc, fgw_arg_t *argv); Index: trunk/src/plugins/sch_dialogs/sch_dialogs.c =================================================================== --- trunk/src/plugins/sch_dialogs/sch_dialogs.c (revision 4145) +++ trunk/src/plugins/sch_dialogs/sch_dialogs.c (revision 4146) @@ -44,6 +44,7 @@ #include #include "dlg_attrib.h" +#include "dlg_about.h" #include "dlg_abstract.h" #include "dlg_undo.h" #include "dlg_pen.h" @@ -74,6 +75,7 @@ {"LibraryDialog", csch_act_LibraryDialog, csch_acth_LibraryDialog, csch_acts_LibraryDialog}, {"InfoBarFileChanged", csch_act_InfoBarFileChanged, csch_acth_InfoBarFileChanged, csch_acts_InfoBarFileChanged}, {"ViewDialog", csch_act_ViewDialog, csch_acth_ViewDialog, csch_acts_ViewDialog}, + {"About", csch_act_About, csch_acth_About, csch_acts_About}, {"quick_attr_role", csch_act_quick_attr_role, csch_acth_quick_attr_role, csch_acts_quick_attr_role}, {"QuickAttr", csch_act_QuickAttr, csch_acth_QuickAttr, csch_acts_QuickAttr} Index: trunk/src/sch-rnd/Makefile.dep =================================================================== --- trunk/src/sch-rnd/Makefile.dep (revision 4145) +++ trunk/src/sch-rnd/Makefile.dep (revision 4146) @@ -373,6 +373,9 @@ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ ../libcschem/engine.h +../plugins/sch_dialogs/dlg_about.o: ../plugins/sch_dialogs/dlg_about.c \ + ../libcschem/config.h ../sch-rnd/build_run.h \ + ../plugins/sch_dialogs/dlg_about.h ../plugins/sch_dialogs/dlg_abstract.o: \ ../plugins/sch_dialogs/dlg_abstract.c ../libcschem/config.h \ ../libcschem/abstract.h ../libcschem/common_types.h \ @@ -499,11 +502,11 @@ ../../src_3rd/libuundo/uundo.h \ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ - ../libcschem/TODO.h ../plugins/sch_dialogs/dlg_abstract.h \ - ../plugins/sch_dialogs/dlg_undo.h ../plugins/sch_dialogs/dlg_pen.h \ - ../plugins/sch_dialogs/dlg_text.h ../libcschem/cnc_text.h \ - ../libcschem/cnc_text_dyn.h ../plugins/sch_dialogs/dlg_tree.h \ - ../plugins/sch_dialogs/dlg_library.h \ + ../libcschem/TODO.h ../plugins/sch_dialogs/dlg_about.h \ + ../plugins/sch_dialogs/dlg_abstract.h ../plugins/sch_dialogs/dlg_undo.h \ + ../plugins/sch_dialogs/dlg_pen.h ../plugins/sch_dialogs/dlg_text.h \ + ../libcschem/cnc_text.h ../libcschem/cnc_text_dyn.h \ + ../plugins/sch_dialogs/dlg_tree.h ../plugins/sch_dialogs/dlg_library.h \ ../plugins/sch_dialogs/dlg_infobar.c ../libcschem/plug_io.h \ ../libcschem/abstract.h ../plugins/sch_dialogs/dlg_view.h \ ../plugins/sch_dialogs/quick_attr.h \