diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index ab8fcd558..165b35ec3 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -490,13 +490,14 @@ TColor_mask::TColor_mask() set(215, ADVANCED_GRAPHICS ? "X" : ""); set(216, color.get_int("TreeView")); - _preview = new TPreview_panel(1, 5, 33, 7, this); + _preview = new TPreview_panel(1, 5, 33, 8, this); _icons = new TPreview_icons(1, 10, -2, -2, this); const int sz = color.get_int("ToolSize"); set(217, (sz-16)/8); set(218, EASY_RIDER ? "X" : ""); + set(219, TOOL_TEXT ? "X" : ""); } KEY TColor_mask::run() @@ -519,6 +520,7 @@ void TColor_mask::save_colors() const int sz = get_int(217); colors.set("ToolSize", 16+sz*8); colors.set("EasyRider", get_bool(218) ? "X" : ""); + colors.set("ToolText", get_bool(219) ? "X" : ""); } COLOR TColor_mask::get_color_entry(const char* name) const @@ -576,22 +578,19 @@ COLOR TColor_mask::cid2color(short cid) const COLOR TColor_mask::cid2syscolor(short cid, const XVT_COLOR_COMPONENT* cc) const { - int entry[] = { XVT_COLOR_TROUGH, XVT_COLOR_BLEND, XVT_COLOR_BORDER, + int entry[] = { XVT_COLOR_BACKGROUND /*XVT_COLOR_TROUGH*/, XVT_COLOR_BLEND, XVT_COLOR_BORDER, XVT_COLOR_FOREGROUND, XVT_COLOR_BACKGROUND, XVT_COLOR_BACKGROUND, XVT_COLOR_HIGHLIGHT, XVT_COLOR_SELECT, XVT_COLOR_BLEND, XVT_COLOR_BORDER, XVT_COLOR_BACKGROUND, XVT_COLOR_BLEND, XVT_COLOR_BORDER }; const unsigned int component = entry[cid-101]; - for (int i = 0; cc[i].type != XVT_COLOR_NULL; i++) + for (int i = 0; cc[i].type != XVT_COLOR_NULL; i++) if (cc[i].type == component) { - if (cc[i].type == component) + switch (cid) { - switch (cid) - { - case 105: return COLOR_WHITE; - case 106: return blend_colors(cid2syscolor(105, cc), cid2syscolor(108, cc), 0.60); - default : return cc[i].color; - } + case 105: return COLOR_WHITE; + case 106: return blend_colors(cid2syscolor(105, cc), cid2syscolor(108, cc), 0.60); + default : return cc[i].color; } } return COLOR_BLACK; diff --git a/ba/ba0101.cpp b/ba/ba0101.cpp index fe73446db..9fd0f5c6b 100755 --- a/ba/ba0101.cpp +++ b/ba/ba0101.cpp @@ -195,9 +195,7 @@ bool TMenuitem::create(const char* t) } int TMenuitem::icon() const -{ - return _icon; -} +{ return _icon; } bool TMenuitem::enabled() const { diff --git a/ba/ba0102.cpp b/ba/ba0102.cpp index bfa753c5e..89ae6bdf6 100755 --- a/ba/ba0102.cpp +++ b/ba/ba0102.cpp @@ -1216,15 +1216,15 @@ bool TExplorer_mask::on_key(KEY k) TExplorer_mask::TExplorer_mask(TMenu& menu) : _tree(menu) { - add_button_tool(DLG_SHRINK, TR("Menu Principale"), TOOL_FIRSTREC); - add_button_tool(DLG_FINDREC, TR("Ricerca"), TOOL_LENTE); - add_button_tool(TOOL_CONFIG, TR("Opzioni"), TOOL_CONFIG); - add_button_tool(DLG_SETPRINT, TR(""), TOOL_SETPRINT); - add_button_tool(TOOL_PREF, TR("Preferiti"), TOOL_PREF); - add_button_tool(TOOL_ADDPREF, TR("Aggiungi ai Preferiti"), TOOL_ADDPREF); - add_button_tool(DLG_INFO, TR("Info"), TOOL_INFO); - add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP); - add_button_tool(DLG_QUIT, TR(""), TOOL_QUIT); + add_button_tool(DLG_SHRINK, TR("Menu Iniziale"), TOOL_FIRSTREC); + add_button_tool(DLG_FINDREC, TR("Ricerca"), TOOL_LENTE); + add_button_tool(TOOL_CONFIG, TR("Opzioni"), TOOL_CONFIG); + add_button_tool(DLG_SETPRINT, TR("Imposta"), TOOL_SETPRINT); + add_button_tool(TOOL_PREF, TR("Preferiti"), TOOL_PREF); + add_button_tool(TOOL_ADDPREF, TR("Aggiungi"), TOOL_ADDPREF); + add_button_tool(DLG_INFO, TR("Info"), TOOL_INFO); + add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP); + add_button_tool(DLG_QUIT, TR(""), TOOL_QUIT); WINDOW panel = page_win(0); diff --git a/ba/ba0103.cpp b/ba/ba0103.cpp index 012509ae5..bca266988 100755 --- a/ba/ba0103.cpp +++ b/ba/ba0103.cpp @@ -37,8 +37,9 @@ protected: public: WINDOW notebook() const { return _ctrl; } + WINDOW page_win(short pg); short add_page(const TString& caption); - void set_page_caption(short page, const TString& caption); + void set_page_caption(short page, const TString& caption, int icon); bool remove_page(WINDOW page); TBook_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner); @@ -97,7 +98,7 @@ void TBook_window::update() { clear(COLOR_WHITE); RCT rctw; xvt_vobj_get_client_rect(win(), &rctw); - if (rctw.right >= 32) + if (rctw.right >= 64 && rctw.bottom >= 64) { if (_logo.ok()) { @@ -156,6 +157,14 @@ void TBook_window::handler(WINDOW win, EVENT* ep) TControl_host_window::handler(win, ep); } +WINDOW TBook_window::page_win(short pg) +{ + WINDOW win = NULL_WIN; + if (_ctrl != NULL_WIN) + win = xvt_notebk_get_page(_ctrl, pg); + return win; +} + short TBook_window::add_page(const TString& caption) { if (_ctrl == NULL_WIN) @@ -163,7 +172,7 @@ short TBook_window::add_page(const TString& caption) WIN_DEF wd; memset(&wd, 0, sizeof(wd)); wd.wtype = WC_NOTEBK; wd.v.ctl.ctrl_id = DLG_MAIN; - wd.v.ctl.flags = CTL_FLAG_RIGHT_JUST; + wd.v.ctl.flags = CTL_FLAG_CENTER_JUST; // i.e. bottom! xvt_vobj_get_client_rect(win(), &wd.rct); _ctrl = xvt_ctl_create_def(&wd, win(), 0L); } @@ -188,10 +197,14 @@ short TBook_window::add_page(const TString& caption) return pg; } -void TBook_window::set_page_caption(short page, const TString& caption) +void TBook_window::set_page_caption(short page, const TString& caption, int icon) { - xvt_notebk_set_tab_title(_ctrl, page, caption); // Titolo dell'orecchio - xvt_notebk_set_page_title(_ctrl, page, caption); // Titolo della finestra + if (_ctrl != NULL_WIN && page >= 0) + { + xvt_notebk_set_tab_title(_ctrl, page, caption); // Titolo dell'orecchio + xvt_notebk_set_tab_icon(_ctrl, page, icon); // Icona dell'orecchio + xvt_notebk_set_page_title(_ctrl, page, caption); // Titolo della finestra + } } bool TBook_window::remove_page(WINDOW page) @@ -258,7 +271,8 @@ public: virtual void create(short dlg, int x, int y, int dx, int dy, WINDOW parent); short add_page(const TString& caption); - void set_page_caption(short page, const TString& caption); + void set_page_caption(short page, const TString& caption, int icon); + WINDOW page_win(short page); void remove_all_pages(); TBook_field(TMask* m) : TWindowed_field(m) {} }; @@ -269,10 +283,16 @@ short TBook_field::add_page(const TString& caption) return bw.add_page(caption); } -void TBook_field::set_page_caption(short page, const TString& caption) +void TBook_field::set_page_caption(short page, const TString& caption, int icon) { TBook_window& bw = (TBook_window&)win(); - bw.set_page_caption(page, caption); + bw.set_page_caption(page, caption, icon); +} + +WINDOW TBook_field::page_win(short page) +{ + TBook_window& bw = (TBook_window&)win(); + return bw.page_win(page); } void TBook_field::remove_all_pages() @@ -302,10 +322,10 @@ short TOutlook_mask::add_page(const TString& caption) return bf.add_page(caption); } -void TOutlook_mask::set_page_caption(short page, const TString& caption) +void TOutlook_mask::set_page_caption(short page, const TString& caption, int icon) { TBook_field& bf = (TBook_field&)field(DLG_MAIN); - bf.set_page_caption(page, caption); + bf.set_page_caption(page, caption, icon); } bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) @@ -325,11 +345,11 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll } else { + TBook_field& bf = (TBook_field&)field(DLG_MAIN); // ba1 e ba2 sono programmi di manutenzione da eseguire in modo esclusivo const bool manu = mi.run_modal(); if (manu) { - TBook_field& bf = (TBook_field&)field(DLG_MAIN); bf.remove_all_pages(); // Chiude tutti i programmi in corso mi.perform(); // Esegui in sincrono e a tutto schermo if (installing()) // when ba1 -6 @@ -342,8 +362,24 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll if (pg >= 0) { mi.perform(); // Esegui in asincrono in pagina nuova - xvt_sys_sleep(1000); - set_page_caption(pg, mi.caption()); + + for (int i = 0; i < 10; i++) + { + xvt_sys_sleep(500); + if (xvt_win_get_children_count(bf.page_win(pg)) != 0) + break; + } + + int ico = mi.icon(); + if (ico <= 0 || ico == ICON_RSRC) + { + const int area = get_int(DLG_LOOK); + if (area >= 0 && area < 16) + ico = _icon[area]; + else + ico = ICON_RSRC; + set_page_caption(pg, mi.caption(), ico); + } } } } @@ -379,7 +415,7 @@ TOutlook_mask::TOutlook_mask(TMenu& menu) : _tree(menu) menu.set_mask_mode(3); // Outlook mode - const int w = 28; + const int w = 24; const int h = rows() / 2; TTree_field& trifola = add_tree(DLG_TREE, 0, 0, 0, w, h); @@ -394,12 +430,14 @@ TOutlook_mask::TOutlook_mask(TMenu& menu) : _tree(menu) add_field(cf); TString caption; + int i = 0; for (bool ok = _tree.goto_root(); ok; ok = _tree.goto_rbrother()) { _tree.get_description(caption); const TMenuitem& mi = _tree.curr_item(); const int ico = mi.enabled() ? mi.icon() : 10203; of->add_item(ico, caption, 0); + _icon[i++] = ico; // Memorizza icona per orecchie } xvt_pane_add(panel, dlg2win(DLG_TREE), "Menu", 1, 0); // Left upper pane diff --git a/ba/ba0103.h b/ba/ba0103.h index 9d14a6cdb..8cf84913d 100755 --- a/ba/ba0103.h +++ b/ba/ba0103.h @@ -16,11 +16,12 @@ class TOutlook_mask : public TSpidey_mask { TMenu_tree _tree; + int _icon[16]; protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); short add_page(const TString& caption); - void set_page_caption(short page, const TString& caption); + void set_page_caption(short page, const TString& caption, int icon); public: TOutlook_mask(TMenu& menu); diff --git a/ba/ba0200a.uml b/ba/ba0200a.uml index 9c097ec66..9218ae549 100755 --- a/ba/ba0200a.uml +++ b/ba/ba0200a.uml @@ -1,4 +1,4 @@ -PAGE "Colori" -1 -1 54 17 +PAGE "Colori" -1 -1 54 19 GROUPBOX DLG_NULL 16 5 BEGIN @@ -92,17 +92,17 @@ END GROUPBOX DLG_NULL 32 3 BEGIN - PROMPT 1 12 "@bTemi predefiniti" + PROMPT 1 14 "@bTemi predefiniti" END BUTTON 211 12 BEGIN - PROMPT 2 13 "Campo" + PROMPT 2 15 "Campo" END BUTTON 212 12 BEGIN - PROMPT 18 13 "Sistema" + PROMPT 18 15 "Sistema" END BUTTON DLG_USER 12 2 @@ -144,6 +144,11 @@ BEGIN PROMPT 1 4 "Griglie a lettura facilitata" END +BOOLEAN 219 +BEGIN + PROMPT 1 5 "Visualizza il testo negli strumenti della barra" +END + RADIOBUTTON 216 1 16 BEGIN PROMPT 32 0 "Tipo di Menu" diff --git a/ba/ba1100.cpp b/ba/ba1100.cpp index 9305c3e6f..d7d54ebc4 100755 --- a/ba/ba1100.cpp +++ b/ba/ba1100.cpp @@ -913,9 +913,9 @@ void TManutenzione_app::update_dir() n.ext("cdx"); remove(n); n.ext("fpt"); remove(n); - TString s(_MAX_PATH); - s.format(FR("File n. %d - %s : eliminato file non utilizzato"), i, (const char *)d.filename()); - write_log(s); + TString msg(_MAX_PATH); + msg.format(FR("File n. %d - %s : eliminato file non utilizzato"), i, (const char *)d.filename()); + write_log(msg); } } if (i > 2 && is_firm == old_is_firm) @@ -950,9 +950,9 @@ void TManutenzione_app::update_dir() { if (!recover(b, err)) { - TString s(_MAX_PATH); - s.format(TR("File n. %d - %s : errore n.ro %d"), i, (const char *)d.filename(), err); - write_log(s); + TString msg(_MAX_PATH); + msg.format(TR("File n. %d - %s : errore n.ro %d"), i, (const char *)d.filename(), err); + write_log(msg); } } } @@ -1189,10 +1189,10 @@ void TManutenzione_app::convert_dir() if (to_create && has_module(module, CHK_DONGLE)) { TDir df; df.get(i); - const TFilename s(df.filename()); + const TFilename fname(df.filename()); //crea il nuovo file in base al tracciato record nuovo! - if (!s.exist() && ds.len() > 0) + if (!fname.exist() && ds.len() > 0) { set_autoload_new_files(false); f.build(0L,rs); diff --git a/ba/ba1101.cpp b/ba/ba1101.cpp index ff3d6ff30..6cec88280 100755 --- a/ba/ba1101.cpp +++ b/ba/ba1101.cpp @@ -11,7 +11,7 @@ TMask* TRec_sheet::_mask = NULL; -void TDir_sheet::add () +void TDir_sheet::add() { _dir->get(LF_DIR, _lock, _nordir, _sysdirop); const int nitems = (int)_dir->eod() + 1; @@ -30,7 +30,7 @@ void TDir_sheet::add () TDir_sheet::TDir_sheet(const char* title, bool superprassi, const char* colonne) : TSheet(0, 0, 0, 0, title, colonne, superprassi ? 0xC : 0x8) { - add_button(DLG_PRINT, TR("Stampa Tracciati"), K_F3, BMP_PRINT); + add_button(DLG_PRINT, TR("Tracciati"), K_F3, BMP_PRINT); add_button(-1, "", 0, 1); // Separatore if (superprassi) @@ -42,7 +42,7 @@ TDir_sheet::TDir_sheet(const char* title, bool superprassi, const char* colonne) add_button(-1, "", 0, 1); // Separatore } - add_button(DLG_INFO, TR("Informazioni"), K_F2, BMP_INFO); + add_button(DLG_INFO, TR("Info"), K_F2, BMP_INFO); add_button(DLG_HELP, TR("Help"), K_F1, BMP_HELP); xvt_toolbar_set_last_tool(toolbar(), DLG_QUIT); @@ -73,7 +73,7 @@ void TDir_sheet::get_row(long n, TToken_string& l) TRec_sheet::TRec_sheet(int logicnum, const char * tab) -: _descr(NULL), _tab(tab) + : _descr(NULL), _tab(tab) { _external = FALSE; _dir = new TDir; @@ -107,8 +107,7 @@ TRec_sheet::TRec_sheet(int logicnum, const char * tab) } TRec_sheet::TRec_sheet(TExternisamfile* file) -: _descr(NULL), _tab("") - + : _descr(NULL), _tab("") { _external = TRUE; _dir = new TDir; @@ -173,7 +172,6 @@ HIDDEN bool len_handler(TMask_field& f, KEY key) return TRUE; } - bool TRec_sheet::fld_notify(TSheet_field& f, int r, KEY k) { if (k == K_CTRL + K_INS) @@ -244,9 +242,7 @@ void TRec_sheet::save() out << *_dir; } - void TRec_sheet::edit() - { bool import_dirty = FALSE; TSheet_field& f1 = (TSheet_field&) _mask->field(F_FIELDS); @@ -395,9 +391,7 @@ void TRec_sheet::edit() fcopy(_descfname,"des.xxx"); // salva il vecchio file di descrizioni f1.destroy(-1); - int i; - - for (i = 0; i < nfields; i++) + for (int i = 0; i < nfields; i++) { f1.row(i) = _rec->fielddef(i); if (_descr) @@ -425,7 +419,8 @@ void TRec_sheet::edit() } nkeys = _rec->keys(); f2.reset(); - for (i = 0; i < nkeys; i++) f2.row(i) = _rec->keydef(i); + for (int i = 0; i < nkeys; i++) + f2.row(i) = _rec->keydef(i); f2.disable_cell(0, 1); } } diff --git a/ba/ba1102.cpp b/ba/ba1102.cpp index a0b5a5ad3..de6c373cd 100755 --- a/ba/ba1102.cpp +++ b/ba/ba1102.cpp @@ -57,7 +57,7 @@ static int fill_fields(int logicnum, TString_array& flds, bool keys_only = false return flds.items(); } -bool TEdit_file::browse_cursor(TCursor& cursor, const TFilename& name) +bool TEdit_file::browse_cursor(TCursor& cursor, const TFilename& fname) { TRectype& curr = cursor.curr(); TRectype svrec(cursor.curr()); @@ -94,7 +94,7 @@ bool TEdit_file::browse_cursor(TCursor& cursor, const TFilename& name) const bool superprassi = user() == ::dongle().administrator(); - TCursor_sheet sheet(&cursor, trac, name, head, superprassi ? 6 : 0); + TCursor_sheet sheet(&cursor, trac, fname, head, superprassi ? 6 : 0); KEY ch; while ((ch = sheet.run()) != K_ESC) { @@ -290,10 +290,10 @@ void TEdit_file::edit_record(TRectype& rec) { const TRectype svrec(rec); // Salva record originale const TString svkey = svrec.key(1); - FOR_EACH_ARRAY_ROW(flds, i, row) + FOR_EACH_ARRAY_ROW(flds, j, frow) { - const char* cp = row->get(0); - rec.put(cp, m.get(100+i)); + const char* cp = frow->get(0); + rec.put(cp, m.get(100+j)); } if (svkey != rec.key(1)) { diff --git a/ba/ba1200.cpp b/ba/ba1200.cpp index 6e6b7307a..96beee8bc 100755 --- a/ba/ba1200.cpp +++ b/ba/ba1200.cpp @@ -37,6 +37,13 @@ TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 12) class TTest_application : public TSkeleton_application { + TProgind* _pi; + + clock_t start_timer() const; + + clock_t start_progind(const long items, const char* prompt); + clock_t stop_progind(); + protected: bool test1(TLog_report& log); bool test2(TLog_report& log); @@ -44,10 +51,12 @@ protected: bool test4(TLog_report& log); bool test5(TLog_report& log); - clock_t start_timer() const; + public: bool test(int n, TLog_report& log); virtual void main_loop(); + + TTest_application() : _pi(NULL) { } }; clock_t TTest_application::start_timer() const @@ -58,35 +67,52 @@ clock_t TTest_application::start_timer() const return t; } +clock_t TTest_application::start_progind(const long items, const char* prompt) +{ + CHECK(_pi == NULL, "Double progress indicator"); + _pi = new TProgind(items, prompt, true, true); + return start_timer(); +} + +clock_t TTest_application::stop_progind() +{ + clock_t t = clock(); + if (_pi != NULL) + { + delete _pi; + _pi = NULL; + } + return t; +} + + bool TTest_application::test1(TLog_report& log) { bool ok = true; TLocalisamfile tab(LF_COMUNI); - clock_t start; TRecnotype r = 0; TString80 msg; - { - const int times = 10; - TProgind p(times, TR("Lettura file comuni"), TRUE, TRUE); - start = start_timer(); - for (int i = 0; i < times; i++) - { - for (tab.first(); tab.good(); tab.next()) - r++; + + const int times = 10; + const clock_t start = start_progind(times, TR("Lettura file comuni")); + for (int i = 0; i < times; i++) + { + for (tab.first(); tab.good(); tab.next()) + r++; - msg.format("%ld records %ld msec", r, clock() - start); - - p.set_text(msg); - if (!p.addstatus(1)) - { - log.log(1, TR("Interrotto dall'utente")); - ok = false; - break; - } + msg.format("%ld records %ld msec", r, clock() - start); + + _pi->set_text(msg); + if (!_pi->addstatus(1)) + { + log.log(1, TR("Interrotto dall'utente")); + ok = false; + break; } - } - const clock_t t = clock() - start; + } + + const clock_t t = stop_progind() - start; msg.format("Lettura file comuni - " "%ld records in %ld msec - %lg records per sec", r, t, 1000.0*r/t); log.log(0, msg); @@ -216,27 +242,27 @@ bool TTest_application::test5(TLog_report& log) { bool ok = true; TString msg; - TRecnotype n = 100; + TRecnotype n = 200; if (n > 0) { TTable tab("CZZ"); msg.format("Creazione di %ld records", n); - TProgind p(n, msg, true, true); - clock_t start = start_timer(); - for (int i = 1; i <= n; i++) + const clock_t start = start_progind(n, msg); + int i; + for (i = 0; i < n; i++) { - if ((i % 10) == 0 && !p.setstatus(i)) + tab.put("CODTAB", i+1); + tab.write(); + if (!_pi->addstatus(1)) { log.log(1, TR("Interrotto dall'utente")); ok = false; break; } - tab.put("CODTAB", i); - tab.write(); } - const clock_t t = clock() - start; - msg.format("Scritti %ld records in %ld msec - %lg records per sec", n, t, 1000.0*n/t); + const clock_t t = stop_progind() - start; + msg.format("Scritti %ld records in %ld msec - %lg records per sec", i, t, 1000.0*i/t); log.log(0, msg); } @@ -248,20 +274,18 @@ bool TTest_application::test5(TLog_report& log) cur.freeze(); msg.format("Cancellazione %ld records", n); - TProgind p(n, msg, true, true); - clock_t start = start_timer(); + const clock_t start = start_progind(n, msg); for (cur = 0; cur.pos() < n; ++cur) { - const int i = cur.pos()+1; - if ((i % 10) == 0 && !p.setstatus(i)) + cur.file().remove(); + if (!_pi->addstatus(1)) { log.log(1, TR("Interrotto dall'utente")); ok = false; break; } - cur.file().remove(); } - const clock_t t = clock() - start; + const clock_t t = stop_progind() - start; msg.format("Cancellati %ld records in %ld msec - %lg records per sec", n, t, 1000.0*n/t); log.log(0, msg); } diff --git a/ba/ba1400.cpp b/ba/ba1400.cpp index b824f6873..84ade10f1 100755 --- a/ba/ba1400.cpp +++ b/ba/ba1400.cpp @@ -315,51 +315,57 @@ void TMenu::import(const char* filename, TString& first) if (first.empty()) first = line; sub = &get_submenu(line); - } else - if (line.starts_with("Caption", true)) - { - CHECK(sub, "Invalid menu file"); - const int equal = line.find('='); - CHECK(equal > 0, "Invalid menu Caption"); - line.ltrim(equal+1); - line.strip("\""); - *sub = line; - } else - if (line.starts_with("Module", true)) - { - CHECK(sub, "Invalid menu file"); - const int equal = line.find('='); - CHECK(equal > 0, "Invalid menu Module"); - const word mod = atoi(line.mid(equal+1)); - sub->set_module(mod); - } else - if (line.starts_with("Item", true)) - { - CHECK(sub, "Invalid menu file"); - const int equal = line.find('='); - CHECK(equal > 0, "Invalid menu Item"); - line.ltrim(equal+1); - line.trim(); - const int bracket = line.rfind('<'); - if (bracket > 0) - { - const int endbracket = line.find('>', bracket); - TFilename name = line.sub(bracket+1, endbracket); - if (name.custom_path()) - { - bool proceed = true; - if (line.find('E', endbracket+1) > 0) - proceed = dongle().active(EEAUT); - if (proceed) - { - import(name, name); - TMenu_item& child = sub->add_child(line); - child.cmd() = name; - } - } - } - else - sub->add_child(line); + } + else + { + if (sub != NULL) + { + if (line.starts_with("Caption", true)) + { + CHECK(sub, "Invalid menu file"); + const int equal = line.find('='); + CHECK(equal > 0, "Invalid menu Caption"); + line.ltrim(equal+1); + line.strip("\""); + *sub = line; + } else + if (line.starts_with("Module", true)) + { + CHECK(sub, "Invalid menu file"); + const int equal = line.find('='); + CHECK(equal > 0, "Invalid menu Module"); + const word mod = atoi(line.mid(equal+1)); + sub->set_module(mod); + } else + if (line.starts_with("Item", true)) + { + CHECK(sub, "Invalid menu file"); + const int equal = line.find('='); + CHECK(equal > 0, "Invalid menu Item"); + line.ltrim(equal+1); + line.trim(); + const int bracket = line.rfind('<'); + if (bracket > 0) + { + const int endbracket = line.find('>', bracket); + TFilename name = line.sub(bracket+1, endbracket); + if (name.custom_path()) + { + bool proceed = true; + if (line.find('E', endbracket+1) > 0) + proceed = dongle().active(EEAUT); + if (proceed) + { + import(name, name); + TMenu_item& child = sub->add_child(line); + child.cmd() = name; + } + } + } + else + sub->add_child(line); + } + } } } } @@ -738,7 +744,7 @@ void TSet_users::put_in_record(const TMask& m) TString_array& arr = *(TString_array*)obj; prg = key; prg << m.sfield(F_PROPERTIES).separator(); - FOR_EACH_ARRAY_ROW(arr, r, row) + FOR_EACH_ARRAY_ROW(arr, i, row) { row->insert(prg, 0); prop_field.add(*row);