static bool ami_menu_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder) { UBYTE type; char *icon; struct gui_window_2 *gw = (struct gui_window_2 *)userdata; if(item >= AMI_MENU_HOTLIST_MAX) return false; switch(level) { case 1: type = NM_ITEM; break; case 2: type = NM_SUB; break; default: /* entries not at level 1 or 2 are not able to be added */ return false; break; } if(is_folder == true) { icon = "icons/directory.png"; } else { icon = "icons/content.png"; } ami_menu_alloc_item(gw, item, type, title, 0, icon, ami_menu_item_hotlist_entries, (void *)url); if((is_folder == true) && (type == NM_SUB)) gw->menu[item].nm_Flags = NM_ITEMDISABLED; return true; }
void ami_menu_arexx_scan(struct gui_window_2 *gwin) { int item = AMI_MENU_AREXX; BPTR lock = 0; UBYTE *buffer; struct ExAllControl *ctrl; char matchpatt[16]; LONG cont; struct ExAllData *ead; char *menu_lab; if(lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK)) { if(buffer = AllocVecTagList(1024, NULL)) { if(ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL)) { ctrl->eac_LastKey = 0; if(ParsePatternNoCase("#?.nsrx",(char *)&matchpatt,16) != -1) { ctrl->eac_MatchString = (char *)&matchpatt; } do { cont = ExAll(lock,(struct ExAllData *)buffer,1024,ED_COMMENT,ctrl); if((!cont) && (IoErr() != ERROR_NO_MORE_ENTRIES)) break; if(!ctrl->eac_Entries) continue; for(ead = (struct ExAllData *)buffer; ead; ead = ead->ed_Next) { if(item >= AMI_MENU_AREXX_MAX) continue; if(EAD_IS_FILE(ead)) { gwin->menu[item].nm_Type = NM_ITEM; if(ead->ed_Comment[0] != '\0') menu_lab = ead->ed_Comment; else menu_lab = ead->ed_Name; ami_menu_alloc_item(gwin, item, NM_ITEM, menu_lab, 0, NULL, ami_menu_item_arexx_entries, (void *)strdup(ead->ed_Name)); item++; } } }while(cont); FreeDosObject(DOS_EXALLCONTROL,ctrl); } FreeVec(buffer); } UnLock(lock); } gwin->menu[item].nm_Type = NM_END; gwin->menu[item].nm_Label = NULL; }
void ami_init_menulabs(struct gui_window_2 *gwin) { int i; gwin->menutype = AllocVecTags(AMI_MENU_AREXX_MAX + 1, AVT_ClearWithValue, 0, TAG_DONE); for(i=0;i <= AMI_MENU_AREXX_MAX;i++) { gwin->menutype[i] = NM_IGNORE; gwin->menulab[i] = NULL; gwin->menuobj[i] = NULL; } ami_menu_alloc_item(gwin, M_PROJECT, NM_TITLE, "Project", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_NEWWIN, NM_ITEM, "NewWindowNS", 'N', NULL, ami_menu_item_project_newwin, NULL); ami_menu_alloc_item(gwin, M_NEWTAB, NM_ITEM, "NewTab", 'T', NULL, ami_menu_item_project_newtab, NULL); ami_menu_alloc_item(gwin, M_BAR_P1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_OPEN, NM_ITEM, "OpenFile", 'O', NULL, ami_menu_item_project_open, NULL); ami_menu_alloc_item(gwin, M_SAVEAS, NM_ITEM, "SaveAsNS", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_SAVESRC, NM_SUB, "Source", 'S', NULL, ami_menu_item_project_save, (void *)AMINS_SAVE_SOURCE); ami_menu_alloc_item(gwin, M_SAVETXT, NM_SUB, "TextNS", 0, NULL, ami_menu_item_project_save, (void *)AMINS_SAVE_TEXT); ami_menu_alloc_item(gwin, M_SAVECOMP, NM_SUB, "SaveCompNS", 0, NULL, ami_menu_item_project_save, (void *)AMINS_SAVE_COMPLETE); #ifdef WITH_PDF_EXPORT ami_menu_alloc_item(gwin, M_SAVEPDF, NM_SUB, "PDFNS", 0, NULL, ami_menu_item_project_save, (void *)AMINS_SAVE_PDF); #endif ami_menu_alloc_item(gwin, M_SAVEIFF, NM_SUB, "IFF", 0, NULL, ami_menu_item_project_save, (void *)AMINS_SAVE_IFF); ami_menu_alloc_item(gwin, M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_PRINT, NM_ITEM, "PrintNS", 'P', NULL, ami_menu_item_project_print, NULL); ami_menu_alloc_item(gwin, M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_CLOSETAB, NM_ITEM, "CloseTab", 'K', NULL, ami_menu_item_project_closetab, NULL); ami_menu_alloc_item(gwin, M_CLOSEWIN, NM_ITEM, "CloseWindow", 0, NULL, ami_menu_item_project_closewin, NULL); ami_menu_alloc_item(gwin, M_BAR_P4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_ABOUT, NM_ITEM, "About", '?', NULL, ami_menu_item_project_about, NULL); ami_menu_alloc_item(gwin, M_BAR_P5, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_QUIT, NM_ITEM, "Quit", 'Q', NULL, ami_menu_item_project_quit, NULL); ami_menu_alloc_item(gwin, M_EDIT, NM_TITLE, "Edit", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_CUT, NM_ITEM, "CutNS", 'X', NULL, ami_menu_item_edit_cut, NULL); ami_menu_alloc_item(gwin, M_COPY, NM_ITEM, "CopyNS", 'C', NULL, ami_menu_item_edit_copy, NULL); ami_menu_alloc_item(gwin, M_PASTE, NM_ITEM, "PasteNS", 'V', NULL, ami_menu_item_edit_paste, NULL); ami_menu_alloc_item(gwin, M_BAR_E1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_SELALL, NM_ITEM, "SelectAllNS", 'A', NULL, ami_menu_item_edit_selectall, NULL); ami_menu_alloc_item(gwin, M_CLEAR, NM_ITEM, "ClearNS", 0, NULL, ami_menu_item_edit_clearsel, NULL); ami_menu_alloc_item(gwin, M_BAR_E2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_UNDO, NM_ITEM, "Undo", 'Z', NULL, ami_menu_item_edit_undo, NULL); ami_menu_alloc_item(gwin, M_REDO, NM_ITEM, "Redo", 'Y', NULL, ami_menu_item_edit_redo, NULL); ami_menu_alloc_item(gwin, M_BROWSER, NM_TITLE, "Browser", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_FIND, NM_ITEM, "FindTextNS", 'F', NULL, ami_menu_item_browser_find, NULL); ami_menu_alloc_item(gwin, M_BAR_B1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_HISTLOCL, NM_ITEM, "HistLocalNS", 0, NULL, ami_menu_item_browser_localhistory, NULL); ami_menu_alloc_item(gwin, M_HISTGLBL, NM_ITEM, "HistGlobalNS", 0, NULL, ami_menu_item_browser_globalhistory, NULL); ami_menu_alloc_item(gwin, M_BAR_B2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_COOKIES, NM_ITEM, "ShowCookiesNS", 0, NULL, ami_menu_item_browser_cookies, NULL); ami_menu_alloc_item(gwin, M_BAR_B3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_SCALE, NM_ITEM, "ScaleNS", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_SCALEDEC, NM_SUB, "ScaleDec", '-', NULL, ami_menu_item_browser_scale_decrease, NULL); ami_menu_alloc_item(gwin, M_SCALENRM, NM_SUB, "ScaleNorm", '=', NULL, ami_menu_item_browser_scale_normal, NULL); ami_menu_alloc_item(gwin, M_SCALEDEC, NM_SUB, "ScaleDec", '-', NULL, ami_menu_item_browser_scale_decrease, NULL); ami_menu_alloc_item(gwin, M_SCALEINC, NM_SUB, "ScaleInc", '+', NULL, ami_menu_item_browser_scale_increase, NULL); ami_menu_alloc_item(gwin, M_IMAGES, NM_ITEM, "Images", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_IMGFORE, NM_SUB, "ForeImg", 0, NULL, ami_menu_item_browser_foreimg, NULL); ami_menu_alloc_item(gwin, M_IMGBACK, NM_SUB, "BackImg", 0, NULL, ami_menu_item_browser_backimg, NULL); #if defined(WITH_JS) || defined(WITH_MOZJS) ami_menu_alloc_item(gwin, M_JS, NM_ITEM, "EnableJS", 0, NULL, ami_menu_item_browser_enablejs, NULL); #endif ami_menu_alloc_item(gwin, M_BAR_B4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_REDRAW, NM_ITEM, "Redraw", 0, NULL, ami_menu_item_browser_redraw, NULL); ami_menu_alloc_item(gwin, M_HOTLIST, NM_TITLE, "Hotlist", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_HLADD, NM_ITEM, "HotlistAdd", 'B', NULL, ami_menu_item_hotlist_add, NULL); ami_menu_alloc_item(gwin, M_HLSHOW, NM_ITEM,"HotlistShowNS",'H', NULL, ami_menu_item_hotlist_show, NULL); ami_menu_alloc_item(gwin, M_BAR_H1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_PREFS, NM_TITLE, "Settings", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_PREDIT, NM_ITEM, "SettingsEdit", 0, NULL, ami_menu_item_settings_edit, NULL); ami_menu_alloc_item(gwin, M_BAR_S1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_SNAPSHOT, NM_ITEM, "SnapshotWindow",0, NULL, ami_menu_item_settings_snapshot, NULL); ami_menu_alloc_item(gwin, M_PRSAVE, NM_ITEM, "SettingsSave", 0, NULL, ami_menu_item_settings_save, NULL); ami_menu_alloc_item(gwin, M_AREXX, NM_TITLE, "ARexx", 0, NULL, NULL, NULL); ami_menu_alloc_item(gwin, M_AREXXEX, NM_ITEM, "ARexxExecute",'E', NULL, ami_menu_item_arexx_execute, NULL); ami_menu_alloc_item(gwin, M_BAR_A1, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL); gwin->menutype[AMI_MENU_AREXX_MAX] = NM_END; }
static void ami_history_global_menulabs(struct ami_menu_data **md) { ami_menu_alloc_item(md, AMI_HISTORY_M_PROJECT, NM_TITLE, "Tree", NULL, NULL, NULL, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_EXPORT, NM_ITEM, "TreeExport", "S", "TBImages:list_save", ami_history_global_menu_item_project_export, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND, NM_ITEM, "Expand", NULL, "TBImages:list_folderunfold", NULL, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_ALL, NM_SUB, "All", "+", NULL, ami_history_global_menu_item_project_expand_all, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_FOLDERS, NM_SUB, "Folders", NULL, NULL, ami_history_global_menu_item_project_expand_folders, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_EXPAND_LINKS, NM_SUB, "Links", NULL, NULL, ami_history_global_menu_item_project_expand_links, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE, NM_ITEM, "Collapse", NULL, "TBImages:list_folderfold", NULL, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_ALL, NM_SUB, "All", "-", NULL, ami_history_global_menu_item_project_collapse_all, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_FOLDERS, NM_SUB, "Folders", NULL, NULL, ami_history_global_menu_item_project_collapse_folders, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_COLLAPSE_LINKS, NM_SUB, "Links", NULL, NULL, ami_history_global_menu_item_project_collapse_links, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P2, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_SNAPSHOT, NM_ITEM, "SnapshotWindow", NULL, "TBImages:list_hold", ami_history_global_menu_item_project_snapshot, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_P3, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_CLOSE, NM_ITEM, "CloseWindow", "K", "TBImages:list_cancel", ami_history_global_menu_item_project_close, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_EDIT, NM_TITLE, "Edit", NULL, NULL, NULL, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_SELECTALL, NM_ITEM, "SelectAllNS", "A", NSA_SPACE, ami_history_global_menu_item_edit_select_all, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_CLEAR, NM_ITEM, "ClearNS", NULL, NSA_SPACE, ami_history_global_menu_item_edit_clear, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_BAR_E1, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_DELETE, NM_ITEM, "TreeDelete", "Del", "TBImages:list_delete", ami_history_global_menu_item_edit_delete, NULL, 0); ami_menu_alloc_item(md, AMI_HISTORY_M_LAST, NM_END, NULL, NULL, NULL, NULL, NULL, 0); }