117
119
extern STRING qShitkey;
119
121
extern STRING qSmn_add_ttl,qSmn_add_indi,qSmn_add_fam,qSmn_add_chil,qSmn_add_spou;
120
extern STRING qSmn_del_ttl,qSmn_del_chil,qSmn_del_spou,qSmn_del_indi,qSmn_del_fam;
122
extern STRING qSmn_del_ttl,qSmn_del_chil,qSmn_del_spou;
123
extern STRING qSmn_del_indi,qSmn_del_fam,qSmn_del_any;
121
124
extern STRING qSmn_sca_ttl,qSmn_sca_nmfu,qSmn_sca_nmfr,qSmn_sca_refn;
122
125
extern STRING qSmn_sea_ttl,qSmn_sea_vhis,qSmn_sea_vhi2,qSmn_sea_vhix;
123
126
extern STRING qSmn_sea_chis,qSmn_sea_chi2,qSmn_sea_chix,qSmn_sea_scan;
202
205
static RECORD invoke_add_menu(void);
203
206
static void invoke_cset_display(void);
204
207
static void invoke_del_menu(void);
205
static INT invoke_extra_menu(void);
208
static INT invoke_extra_menu(RECORD *rec);
206
209
static RECORD invoke_search_menu(void);
207
210
static RECORD invoke_fullscan_menu(void);
208
211
static void invoke_utils_menu(void);
276
279
static llchtype gr_hline='-', gr_vline= '|';
277
280
static llchtype gr_llx='*', gr_lrx='*', gr_ulx='*', gr_urx='*';
282
static int ui_time_elapsed = 0; /* total time waiting for user input */
279
284
/*********************************************
280
285
* local & exported function definitions
365
370
wborder(win, gr_vline, gr_vline, gr_hline, gr_hline, gr_ulx, gr_urx, gr_llx, gr_lrx);
367
372
/*=======================================
368
* repaint_main_menu --
373
* repaint_main_menu -- Display choices for main menu
374
* See function main_menu for actions
369
375
*=====================================*/
371
377
repaint_main_menu (UIWINDOW uiwin)
385
391
llstrncpyf(title, width, uu8, _(qSmtitle), get_lifelines_version(ll_cols-4));
386
392
mvccwaddstr(win, 1, 2, title);
387
393
mvccwaddstr(win, 2, 4, _(qScright));
388
str = getoptint("FullDbPath", 1) ? readpath : readpath_file;
394
str = getlloptint("FullDbPath", 1) ? readpath : readpath_file;
389
395
mvccwprintw(win, 3, 4, _(qSdbname), str);
391
397
wprintw(win, _(qSdbimmut));
675
681
case 't': edit_tt_menu(); break;
676
682
case 'u': invoke_utils_menu(); break;
678
c = invoke_extra_menu();
679
if (c != BROWSE_QUIT)
680
main_browse(NULL, c);
686
c = invoke_extra_menu(&rec);
687
if (c != BROWSE_QUIT)
689
/* main_browse consumed rec */
682
692
case 'q': alldone = 1; break;
966
976
* prmpt: [IN] prompt of question (2nd line)
967
977
*====================================*/
969
ask_for_db_filename (STRING ttl, STRING prmpt, STRING basedir, STRING buffer, INT buflen)
979
ask_for_db_filename (CNSTRING ttl, CNSTRING prmpt, CNSTRING basedir, STRING buffer, INT buflen)
971
981
basedir=basedir; /* unused */
972
982
/* This could have a list of existing ones like askprogram.c */
1042
1052
* buflen: [IN] max size of response
1043
1053
*====================================*/
1045
ask_for_string (STRING ttl, STRING prmpt, STRING buffer, INT buflen)
1055
ask_for_string (CNSTRING ttl, CNSTRING prmpt, STRING buffer, INT buflen)
1047
1057
UIWINDOW uiwin = ask_win;
1048
1058
WINDOW *win = uiw_win(uiwin);
1067
1077
* buflen: [IN] max size of response
1068
1078
*====================================*/
1070
ask_for_string2 (STRING ttl1, STRING ttl2, STRING prmpt, STRING buffer, INT buflen)
1080
ask_for_string2 (CNSTRING ttl1, CNSTRING ttl2, CNSTRING prmpt, STRING buffer, INT buflen)
1072
1082
UIWINDOW uiwin = ask_msg_win;
1073
1083
WINDOW *win = uiw_win(uiwin);
1268
1278
* @code: [IN] command to process
1269
1279
* Returns -1 if resized window, 1 if handled, 0 if unhandled.
1270
1280
*===========================================================*/
1272
1282
handle_list_cmds (listdisp * ld, INT code)
1274
1284
INT rows = ld->rectList.bottom - ld->rectList.top + 1;
1754
1765
rec = add_indi_by_edit(&disp_long_rfmt);
1756
case 'f': add_family(NULL, NULL, NULL); break;
1767
case 'f': add_family_by_edit(NULL, NULL, NULL, &disp_long_rfmt); break;
1757
1768
case 'c': my_prompt_add_child(NULL, NULL); break;
1758
1769
case 's': prompt_add_spouse(NULL, NULL, TRUE); break;
1759
1770
case 'q': break;
1770
1781
UIWINDOW uiwin=0;
1771
1782
WINDOW * win=0;
1772
1783
if (!del_menu_win) {
1773
del_menu_win = create_newwin2("del_menu", 8, 66);
1784
del_menu_win = create_newwin2("del_menu", 9, 66);
1774
1785
/* paint it for the first & only time (it's static) */
1775
1786
repaint_delete_menu(del_menu_win);
1780
1791
activate_uiwin(uiwin);
1781
1792
wmove(win, 1, 30);
1782
code = interact(uiwin, "csifq", -1);
1793
code = interact(uiwin, "csifoq", -1);
1783
1794
deactivate_uiwin_and_touch_all();
1785
1796
switch (code) {
1786
1797
case 'c': choose_and_remove_child(NULL, NULL, FALSE); break;
1787
1798
case 's': choose_and_remove_spouse(NULL, NULL, FALSE); break;
1788
case 'i': delete_indi(NULL, TRUE); break;
1799
case 'i': choose_and_remove_indi(NULL, DOCONFIRM); break;
1789
1800
case 'f': choose_and_remove_family(); break;
1801
case 'o': choose_and_remove_any_record(NULL, DOCONFIRM); break;
1790
1802
case 'q': break;
1802
1814
zs_setf(zstr, "%s: %s", _("Internal codeset"), int_codeset);
1803
1815
enqueue_list(list, strsave(zs_str(zstr)));
1817
enqueue_list(list, strsave(_("Internal UTF-8: Yes")));
1819
enqueue_list(list, strsave(_("Internal UTF-8: No")));
1805
1822
if (are_locales_supported())
1806
1823
enqueue_list(list, strsave(_("Locales are enabled.")));
1808
1825
enqueue_list(list, strsave(_("Locales are disabled.")));
1810
1827
if (is_nls_supported()) {
1811
enqueue_list(list, strsave(_("NLS (National Language Support) is enabled.")));
1812
zs_setf(zstr, "LOCALEDIR: %s", LOCALEDIR);
1828
enqueue_list(list, strsave(_("NLS (National Language Support) is compiled in.")));
1829
zs_setf(zstr, "LocaleDir (default): %s", LOCALEDIR);
1813
1830
enqueue_list(list, strsave(zs_str(zstr)));
1814
zs_setf(zstr, "LocaleDir: %s", getoptstr("LocaleDir", ""));
1831
zs_setf(zstr, "LocaleDir (override): %s", getlloptstr("LocaleDir", ""));
1815
1832
enqueue_list(list, strsave(zs_str(zstr)));
1817
enqueue_list(list, strsave(_("NLS (National Language Support) is disabled.")));
1834
enqueue_list(list, strsave(_("NLS (National Language Support) is not compiled in.")));
1838
CNSTRING str = get_gettext_codeset();
1839
str = str ? str : "";
1840
zs_setf(zstr, "bind_textdomain_codeset: %s", str);
1841
enqueue_list(list, strsave(zs_str(zstr)));
1820
1844
add_shims_info(list);
1822
1846
if (is_iconv_supported())
1823
enqueue_list(list, strsave(_("iconv (codeset conversion) is enabled.")));
1847
enqueue_list(list, strsave(_("iconv (codeset conversion) is compiled in.")));
1825
enqueue_list(list, strsave(_("iconv (codeset conversion) is disabled.")));
1849
enqueue_list(list, strsave(_("iconv (codeset conversion) is not compiled in.")));
1827
1851
zs_setf(zstr, _("Startup collate locale: %s"), get_original_locale_collate());
1828
1852
enqueue_list(list, strsave(zs_str(zstr)));
1879
1903
enqueue_list(list, strsave(zs_str(zstr)));
1882
zs_setf(zstr, "TTPATH: %s", getoptstr("TTPATH", "."));
1906
zs_setf(zstr, "TTPATH: %s", getlloptstr("TTPATH", "."));
1883
1907
enqueue_list(list, strsave(zs_str(zstr)));
1909
if (charprops_is_loaded()) {
1910
enqueue_list(list, strsave(_("UTF-8 charprops loaded" )));
1912
enqueue_list(list, strsave(_("UTF-8 charprops not loaded" )));
1885
1916
display_list(_("Codeset information"), list);
1886
make_list_empty(list);
1887
remove_list(list, 0);
1888
1918
zs_free(&zstr);
1890
1920
/*======================================
2021
2051
/* Ask whence to load it */
2022
ttimportdir = getoptstr("TTPATH", ".");
2052
ttimportdir = getlloptstr("TTPATH", ".");
2023
2053
fp = ask_for_input_file(LLREADTEXT, _(qSmintt), &fname, ttimportdir, ".tt");
2055
2085
/* Ask whither to save it */
2056
ttexportdir = getoptstr("LLTTEXPORT", ".");
2086
ttexportdir = getlloptstr("LLTTEXPORT", ".");
2057
2087
fp = ask_for_output_file(LLWRITETEXT, _(qSmouttt), &fname, ttexportdir, ".tt");
2164
2195
case 's': return BROWSE_SOUR;
2165
2196
case 'e': return BROWSE_EVEN;
2166
2197
case 'x': return BROWSE_AUX;
2167
case '1': edit_add_source(); return BROWSE_QUIT;
2168
case '2': edit_source(NULL, &disp_long_rfmt); return BROWSE_QUIT;;
2169
case '3': edit_add_event(); return BROWSE_QUIT;;
2170
case '4': edit_event(NULL, &disp_long_rfmt); return BROWSE_QUIT;;
2171
case '5': edit_add_other(); return BROWSE_QUIT;;
2172
case '6': edit_other(NULL, &disp_long_rfmt); return BROWSE_QUIT;;
2173
case 'q': return BROWSE_QUIT;;
2198
case '1': *prec = edit_add_source(); return BROWSE_SOUR;
2199
case '2': edit_source(NULL, &disp_long_rfmt); return BROWSE_QUIT;
2200
case '3': *prec = edit_add_event(); return BROWSE_EVEN;
2201
case '4': edit_event(NULL, &disp_long_rfmt); return BROWSE_QUIT;
2202
case '5': *prec = edit_add_other(); return BROWSE_AUX;
2203
case '6': edit_other(NULL, &disp_long_rfmt); return BROWSE_QUIT;
2204
case 'q': return BROWSE_QUIT;
2179
2210
* returns descriptive string for failure, 0 for pass
2180
2211
*=============================*/
2182
uopt_validate (TABLE tab)
2213
uopt_validate (TABLE tab, void * param)
2184
2215
STRING codeset = valueof_str(tab, "codeset");
2216
STRING original_codeset = (STRING)param;
2186
2218
our only rule currently is that user may not change codeset
2187
2219
of a populated database
2189
if (!eqstr_ex(codeset, int_codeset)) {
2221
if (!eqstr_ex(codeset, original_codeset)
2222
&& !eqstr_ex(codeset, int_codeset)) {
2190
2223
if (num_indis()+num_fams()+num_sours()+num_evens()+num_othrs())
2191
2224
return _("Impermissible to change codeset in a populated database");
2199
2232
edit_place_table (void)
2201
edit_valtab_from_db("VPLAC", &placabbvs, ':', _(qSabverr), 0);
2234
edit_valtab_from_db("VPLAC", &placabbvs, ':', _(qSabverr), 0, 0);
2203
2236
/*===============================
2204
2237
* edit_user_options -- Allow user to edit options embedded in current db
2207
2240
edit_user_options (void)
2209
TABLE uopts = create_table(FREEBOTH);
2242
TABLE uopts = create_table_str();
2210
2244
get_db_options(uopts);
2211
if (edit_valtab_from_db("VUOPT", &uopts, '=', _(qSuoperr), uopt_validate))
2245
param = valueof_str(uopts, "codeset");
2246
param = (param ? strsave(param) : 0);
2248
if (edit_valtab_from_db("VUOPT", &uopts, '=', _(qSuoperr), uopt_validate, (void *)param))
2212
2249
set_db_options(uopts);
2213
destroy_table(uopts);
2251
release_table(uopts);
2215
2253
/*===============================
2216
2254
* translate_hdware_key --
2270
2308
INT c, i, n = str ? strlen(str) : 0;
2313
INT time_start=time(NULL);
2273
2315
keypad(uiw_win(uiwin),1);
2274
2316
c = wgetch(uiw_win(uiwin));
2317
ui_time_elapsed += time(NULL) - time_start;
2275
2318
if (c == EOF) c = 'q';
2277
2320
if (!progrunning && !lock_std_msg) {
2349
/* Get Menu Command */
2305
2350
cmdnum = menuset_check_cmd(get_screen_menuset(screen), buffer);
2306
if (cmdnum != CMD_NONE && cmdnum != CMD_PARTIAL)
2352
/* Act On Menu Command */
2353
if (cmdnum != CMD_NONE && cmdnum != CMD_PARTIAL) {
2308
2356
if (cmdnum != CMD_PARTIAL) {
2309
2357
msg_error(_(qSmn_unkcmd));
2490
2538
row = LIST_LINES+2;
2491
2539
for (i = top, j = 0; j < viewlines && i < len; i++, j++) {
2492
2540
element_indiseq(seq, i, &key, &name);
2493
indi = key_to_indi(key);
2541
recnode = key_to_type(key, 0);
2494
2542
if (i == 0 && scrollable) mvwaddch(win, row, 1, '^');
2495
2543
if (i == len-1 && scrollable) mvwaddch(win, row, 1, '$');
2496
2544
if (i == mark) mvwaddch(win, row, 2, 'x');
2511
name = manip_name(name, DOSURCAP, REGORDER, 40);
2559
SURCAPTYPE surcaptype = DOSURCAP;
2560
if (!getlloptint("UppercaseSurnames", 1))
2561
surcaptype = NOSURCAP;
2562
name = manip_name(name, surcaptype, REGORDER, 40);
2512
2563
llstrapps(scratch, sizeof(scratch), uu8, name);
2513
2564
llstrapps(scratch, sizeof(scratch), uu8, " ");
2515
if(getoptint("DisplayKeyTags", 0) > 0) {
2516
llstrappf(scratch, sizeof(scratch), uu8, "(i%s)", key_of_record(indi));
2566
if(getlloptint("DisplayKeyTags", 0) > 0) {
2567
llstrappf(scratch, sizeof(scratch), uu8, "(i%s)", key_of_record(recnode));
2518
llstrappf(scratch, sizeof(scratch), uu8, "(%s)", key_of_record(indi));
2569
llstrappf(scratch, sizeof(scratch), uu8, "(%s)", key_of_record(recnode));
2520
2571
mvccwaddstr(win, row, 4, scratch);
2942
3003
all use dynamic menus, and the cursor position in dynamic
2943
3004
menus is controlled by the dynamic menu, because cursor
2944
3005
moves up & down with dynamic menu */
2945
DYNMENU dynmenu = get_screen_dynmenu(cur_screen);
2946
3006
if (dynmenu->hidden) {
2947
/* when dynamic menu hidden, show cursor
2948
at bottom after title */
2949
STRING title = get_screen_title(cur_screen);
2951
col = strlen(title)+3;
3007
/* no need to position cursor */
2953
3009
row = dynmenu->cur_y;
2954
3010
col = dynmenu->cur_x;
3150
3207
clear_hseg (WINDOW *win, INT row, INT x1, INT x2)
3152
3209
/* workaround for curses bug with spacs */
3153
if (getoptint("ForceScreenErase", 0) > 0) {
3210
if (getlloptint("ForceScreenErase", 0) > 0) {
3154
3211
/* fill virtual output with dots */
3155
3212
color_hseg(win, row, x1, x2, '_');
3156
3213
wnoutrefresh(win);
3330
3387
append_to_msg_list (STRING msg)
3333
msg_list = create_list();
3390
msg_list = create_list2(LISTDOFREE);
3334
3391
enqueue_list(msg_list, strsave(msg));
3336
3393
/*=========================================
3429
3486
mvccwaddstr(win, row++, 4, _(qSmn_del_spou));
3430
3487
mvccwaddstr(win, row++, 4, _(qSmn_del_indi));
3431
3488
mvccwaddstr(win, row++, 4, _(qSmn_del_fam));
3489
mvccwaddstr(win, row++, 4, _(qSmn_del_any));
3432
3490
mvccwaddstr(win, row++, 4, _(qSmn_ret));
3434
3492
/*=====================================
3692
3750
WINDOW * win = uiw_win(uiwin);
3693
3751
/* workaround for curses bug with spaces */
3694
if (getoptint("ForceScreenErase", 0) > 0) {
3752
if (getlloptint("ForceScreenErase", 0) > 0) {
3696
3754
To fix the dirty output on a redhat 6 system
3697
3755
(with ncurses-5.2-8), required the call to
3736
3794
color_hseg(win, i, rect->left, rect->right, ch);
3797
/*============================
3798
* get_uitime -- return cumulative elapsed time waiting
3799
* for user input (since start of program)
3800
*==========================*/
3804
return ui_time_elapsed;