BOOL ami_history_event(struct history_window *hw) { /* return TRUE if window destroyed */ ULONG class,result,relevent = 0; uint16 code; struct MenuItem *item; const char *url; struct IBox *bbox; ULONG xs, ys; while((result = RA_HandleInput(hw->objects[OID_MAIN],&code)) != WMHI_LASTMSG) { switch(result & WMHI_CLASSMASK) // class { /* no menus yet, copied in as will probably need it later case WMHI_MENUPICK: item = ItemAddress(gwin->win->MenuStrip,code); while (code != MENUNULL) { ami_menupick(code,gwin); if(win_destroyed) break; code = item->NextSelect; } break; */ case WMHI_MOUSEMOVE: GetAttr(SPACE_AreaBox, hw->objects[GID_BROWSER], (ULONG *)&bbox); GetAttr(SCROLLER_Top, hw->objects[OID_HSCROLL], (ULONG *)&xs); GetAttr(SCROLLER_Top, hw->objects[OID_VSCROLL], (ULONG *)&ys); url = history_position_url(history_current, hw->win->MouseX - bbox->Left + xs, hw->win->MouseY - bbox->Top + ys); RefreshSetGadgetAttrs((APTR)hw->objects[GID_BROWSER], hw->win, NULL, GA_HintInfo, url, TAG_DONE); break; case WMHI_NEWSIZE: ami_history_redraw(hw); break; case WMHI_MOUSEBUTTONS: ami_history_click(hw,code); break; case WMHI_CLOSEWINDOW: ami_history_close(hw); return TRUE; break; } } return FALSE; }
BOOL ami_print_event(struct ami_print_window *pw) { /* return TRUE if window destroyed */ ULONG result; uint16 code; struct hlcache_handle *c; int copies; int print_scale; int printer_unit; while((result = RA_HandleInput(pw->objects[OID_MAIN],&code)) != WMHI_LASTMSG) { switch(result & WMHI_CLASSMASK) // class { case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { case PGID_PRINT: GetAttr(INTEGER_Number, pw->gadgets[PGID_SCALE], (ULONG *)&print_scale); GetAttr(INTEGER_Number, pw->gadgets[PGID_COPIES], (ULONG *)&copies); GetAttr(CHOOSER_Selected, pw->gadgets[PGID_PRINTER], (ULONG *)&printer_unit); nsoption_set_int(print_scale, print_scale); nsoption_set_int(printer_unit, printer_unit); c = pw->c; ami_print_close(pw); ami_print(c, copies); return TRUE; break; case PGID_CANCEL: ami_print_close(pw); return TRUE; break; } break; case WMHI_CLOSEWINDOW: ami_print_close(pw); return TRUE; break; } } return FALSE; }
/// HandleInput_Edit_FTP_Win void HandleInput_Edit_FTP_Win() { uint32 result = 0; uint16 code = 0; while ((result = RA_HandleInput(edit_ftp_win, &code))) { switch(result & WMHI_CLASSMASK) { case WMHI_CLOSEWINDOW: RA_CloseWindow(edit_ftp_win); edit_ftp_window = NULL; break; case WMHI_GADGETUP: switch (result & WMHI_GADGETMASK) { case OBJ_FTP_USE: gadset(GAD(OBJ_LBROWSER_BROW), window, LISTBROWSER_Labels, ~0); updateFTPNode(); gadset(GAD(OBJ_LBROWSER_BROW), window, LISTBROWSER_Labels, &list_FTPs, LISTBROWSER_AutoFit, TRUE); case OBJ_FTP_CANCEL: RA_CloseWindow(edit_ftp_win); edit_brow_window = NULL; break; case OBJ_FTP_PATH_GET: if (gfRequestFile(OBJ(OBJ_FTP_PATH_GET), edit_ftp_window)) { } break; case OBJ_FTP_PATH_CHOOSE: // set Attrs according to the button clicked on. case OBJ_FTP_OPEN_CHOOSE: case OBJ_FTP_NEW_CHOOSE: iset( OBJ(OBJ_HIDDEN_CHOOSER), CHOOSER_LabelArray, hidden_strings); IIntuition->ActivateGadget(GAD(OBJ_HIDDEN_CHOOSER), edit_ftp_window, NULL); break; case OBJ_FTP_AREXX_CHOOSE: iset( OBJ(OBJ_HIDDEN_CHOOSER), CHOOSER_LabelArray, hidden_strings); IIntuition->ActivateGadget(GAD(OBJ_HIDDEN_CHOOSER), edit_ftp_window, NULL); break; } } } }
BOOL ami_download_window_event(struct gui_download_window *dw) { /* return TRUE if window destroyed */ ULONG result; uint16 code; while((result = RA_HandleInput(dw->objects[OID_MAIN], &code)) != WMHI_LASTMSG) { switch(result & WMHI_CLASSMASK) // class { case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { case GID_CANCEL: ami_download_window_abort(dw); return TRUE; break; } break; } } return FALSE; }
BOOL ami_search_event(void) { /* return TRUE if window destroyed */ ULONG result; uint16 code; search_flags_t flags; while((result = RA_HandleInput(fwin->objects[OID_MAIN],&code)) != WMHI_LASTMSG) { switch(result & WMHI_CLASSMASK) // class { case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { case GID_SEARCHSTRING: browser_window_search_clear(fwin->gwin->bw); RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_PREV], fwin->win, NULL, GA_Disabled, FALSE, TAG_DONE); RefreshSetGadgetAttrs((struct Gadget *)fwin->objects[GID_NEXT], fwin->win, NULL, GA_Disabled, FALSE, TAG_DONE); /* fall through */ case GID_NEXT: search_insert = true; flags = SEARCH_FLAG_FORWARDS | ami_search_flags(); browser_window_search( fwin->gwin->bw, NULL, flags, ami_search_string()); ActivateWindow(fwin->gwin->shared->win); break; case GID_PREV: search_insert = true; flags = ~SEARCH_FLAG_FORWARDS & ami_search_flags(); browser_window_search( fwin->gwin->bw, NULL, flags, ami_search_string()); ActivateWindow(fwin->gwin->shared->win); break; } break; case WMHI_CLOSEWINDOW: ami_search_close(); return TRUE; break; } } return FALSE; }
void main_event_handler() { ULONG result; UWORD Code; static char *strinfo, *args; static char *path; int line=0; int *iptr; struct Node *node; uint32 addr; struct Process *pr; while ((result = RA_HandleInput(MainWinObj, &Code)) != WMHI_LASTMSG && done != TRUE) { switch (result & WMHI_CLASSMASK) { case WMHI_CLOSEWINDOW: done = TRUE; break; case WMHI_ICONIFY: if( RA_Iconify(MainWinObj) ) mainwin = NULL; break; case WMHI_UNICONIFY: mainwin = RA_Uniconify(MainWinObj); if( !mainwin ) done = TRUE; break; case WMHI_MENUPICK: if (Code != MENUNULL) switch (MENUNUM(Code)) { case MENU_FILE: switch(ITEMNUM(Code)) { case MENU_PREFS: preferences_open_window(); break; case MENU_MODULES: modules_open_window(); break; case MENU_ABOUT: show_about(); break; case MENU_QUIT: done = TRUE; break; } } break; case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { case GAD_SELECT_BUTTON: strinfo = request_file(mainwin, &path); if (!strinfo) break; strcpy (filename, strinfo); if (strlen(path) > 0) { strcpy (childpath, path); } if(!request_arguments(&args)) { console_printf(OUTPUT_WARNING, "User aborted!"); break; } main_load (strinfo, path, args); break; case GAD_RELOAD_BUTTON: main_load(strinfo, path, args); break; case GAD_ATTACH_BUTTON: if(!isattached) { pr = attach_select_process(); if(main_attach (pr)) button_set_detach(); } else { console_printf(OUTPUT_SYSTEM, "Detaching from external process..."); detach(); stabs_free_stabs(); button_set_attach(); enable(TRUE, GAD_SELECT_BUTTON, TAG_END); enable(FALSE, GAD_START_BUTTON, GAD_PAUSE_BUTTON, GAD_KILL_BUTTON, GAD_STEPOVER_BUTTON, GAD_STEPINTO_BUTTON, GAD_STEPOUT_BUTTON, GAD_SETBREAK_BUTTON, GAD_HEX_BUTTON, TAG_END); console_printf(OUTPUT_SYSTEM, "Done!"); } break; case GAD_START_BUTTON: main_play(); break; case GAD_PAUSE_BUTTON: main_pause(); break; case GAD_STEPOVER_BUTTON: main_step(); break; case GAD_STEPINTO_BUTTON: main_into(); break; case GAD_STEPOUT_BUTTON: main_out(); break; case GAD_KILL_BUTTON: main_kill(); break; #if 0 case GAD_CRASH_BUTTON: crash(); break; #endif case GAD_SETBREAK_BUTTON: breakpoints_open_window(); break; case GAD_VARIABLES_LISTBROWSER: variables_handle_input(); break; case GAD_SIGNAL_BUTTON: sigwin_open_window(); break; case GAD_IMPORT_BUTTON: import_open_window(); break; case GAD_X_BUTTON: console_clear(); break; case GAD_HEX_BUTTON: hex_open_window(); break; case GAD_DISASSEMBLER_LISTBROWSER: disassembler_show_selected(); break; case GAD_DISASSEMBLER_STEP_BUTTON: asmstep(); should_continue = FALSE; asm_trace = TRUE; break; case GAD_DISASSEMBLER_SKIP_BUTTON: asmskip(); disassembler_makelist(); break; case GAD_SOURCE_LISTBROWSER: source_handle_input(); source_show_currentline(); break; case GAD_SOURCELIST_LISTBROWSER: sourcelist_handle_input(); break; case GAD_AREXX_BUTTON: case GAD_AREXX_STRING: { char *str; IIntuition->GetAttrs( MainObj[GAD_AREXX_STRING], STRINGA_TextVal, &str, TAG_DONE ); strcpy (arexxcommandstring, str); arexxexecute.MethodID = AM_EXECUTE; arexxexecute.ape_CommandString = arexxcommandstring; arexxexecute.ape_PortName = "AREXXDB101"; arexxexecute.ape_IO = (BPTR)NULL; IIntuition->SetAttrs( MainObj[GAD_AREXX_STRING], STRINGA_TextVal, "", TAG_DONE ); IIntuition->RefreshGadgets ((struct Gadget *)MainObj[GAD_AREXX_STRING], mainwin, NULL); console_printf(OUTPUT_AREXX, arexxcommandstring); IIntuition->IDoMethodA(arexx_obj, (Msg)&arexxexecute); //IIntuition->ActivateGadget((struct Gadget *)MainObj[GAD_AREXX_STRING], mainwin, NULL); ILayout->ActivateLayoutGadget((struct Gadget *)MainObj[GAD_TOPLAYOUT], mainwin, NULL, (uint32)MainObj[GAD_AREXX_STRING]); break; } } break; } } return; }
/// HandleInput_Main_Win BOOL HandleInput_Main_Win(void) { uint32 result = 0; uint16 code = 0; BOOL done = FALSE; while ((result = RA_HandleInput(win, &code))) { switch(result & WMHI_CLASSMASK) { case WMHI_CLOSEWINDOW: done = TRUE; break; case WMHI_GADGETUP: switch (result & WMHI_GADGETMASK) { case OBJ_LBROWSER_BROW: { uint32 retval = iget(OBJ(OBJ_LBROWSER_BROW), LISTBROWSER_RelEvent); switch(retval) { case LBRE_CHECKED: case LBRE_UNCHECKED: { struct URL_BrowserNode *bn; bn = (struct URL_BrowserNode *)iget(OBJ(OBJ_LBROWSER_BROW), LISTBROWSER_SelectedNode); if (retval == LBRE_UNCHECKED) SET_FLAG(bn->ubn_Flags,UNF_DISABLED); else CLEAR_FLAG(bn->ubn_Flags,UNF_DISABLED); } } if (retval != LBRE_DOUBLECLICK)break; // we deliberately go on executing following case OBJ_EDIT_BROW // because a double click mean the same as clicking edit button } case OBJ_EDIT_BROW: { struct URL_BrowserNode *bn; bn = (struct URL_BrowserNode *)iget(OBJ(OBJ_LBROWSER_BROW), LISTBROWSER_SelectedNode); updateBrowserWindow(bn); edit_brow_window = RA_OpenWindow(edit_brow_win); break; } case OBJ_LBROWSER_MAIL: { uint32 retval = iget(OBJ(OBJ_LBROWSER_MAIL), LISTBROWSER_RelEvent); switch(retval) { case LBRE_CHECKED: case LBRE_UNCHECKED: { struct URL_MailerNode *mn; mn = (struct URL_MailerNode *)iget(OBJ(OBJ_LBROWSER_MAIL), LISTBROWSER_SelectedNode); if (retval == LBRE_UNCHECKED) SET_FLAG(mn->umn_Flags,UNF_DISABLED); else CLEAR_FLAG(mn->umn_Flags,UNF_DISABLED); } } if (retval != LBRE_DOUBLECLICK) break; // we deliberately go on executing following case OBJ_EDIT_MAIL // because a double click mean the same as clicking edit button } case OBJ_EDIT_MAIL: { struct URL_MailerNode *mn; mn = (struct URL_MailerNode *)iget(OBJ(OBJ_LBROWSER_MAIL), LISTBROWSER_SelectedNode); updateMailerWindow(mn); edit_mail_window = RA_OpenWindow(edit_mail_win); break; } case OBJ_LBROWSER_FTP: { uint32 retval = iget(OBJ(OBJ_LBROWSER_FTP), LISTBROWSER_RelEvent); switch(retval) { case LBRE_CHECKED: case LBRE_UNCHECKED: { struct URL_FTPNode *fn; fn = (struct URL_FTPNode *)iget(OBJ(OBJ_LBROWSER_FTP), LISTBROWSER_SelectedNode); if (retval == LBRE_UNCHECKED) SET_FLAG(fn->ufn_Flags,UNF_DISABLED); else CLEAR_FLAG(fn->ufn_Flags,UNF_DISABLED); } } if (retval != LBRE_DOUBLECLICK) break; // we deliberately go on executing following case OBJ_EDIT_FTP // because a double click mean the same as clicking edit button } case OBJ_EDIT_FTP: { struct URL_FTPNode *fn; fn = (struct URL_FTPNode *)iget(OBJ(OBJ_LBROWSER_FTP), LISTBROWSER_SelectedNode); updateFTPWindow(fn); edit_ftp_window = RA_OpenWindow(edit_ftp_win); break; } case OBJ_USE: case OBJ_SAVE: case OBJ_APPLY: storePrefs((result & WMHI_GADGETMASK)==OBJ_SAVE); if((result & WMHI_GADGETMASK)!=OBJ_APPLY) done=TRUE; break; case OBJ_CANCEL: done=TRUE; break; } break; case WMHI_ICONIFY: if (RA_Iconify(win)) { window = NULL; if (edit_brow_window) { RA_CloseWindow(edit_brow_win); edit_brow_window = NULL; } if (edit_mail_window) { RA_CloseWindow(edit_mail_win); edit_mail_window = NULL; } if (edit_ftp_window) { RA_CloseWindow(edit_ftp_win); edit_ftp_window = NULL; } } break; case WMHI_UNICONIFY: window = RA_OpenWindow(win); break; } } return (done); }
void modules_event_loop() { ULONG wait, signal; ULONG result; BOOL done = FALSE; WORD Code; IIntuition->GetAttr( WINDOW_SigMask, ModObj[MOD_WINDOW], &signal ); while(!done) { wait = IExec->Wait(signal); if(wait & signal) { while ((result = RA_HandleInput(ModObj[MOD_WINDOW], &Code)) != WMHI_LASTMSG) { switch (result & WMHI_CLASSMASK) { case WMHI_CLOSEWINDOW: modules_update(); done = TRUE; break; case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { case MOD_MODULES_LISTBROWSER: modules_update_string(); break; case MOD_PATH_STRING: { struct Node *n; IIntuition->GetAttr(LISTBROWSER_SelectedNode, ModObj[MOD_MODULES_LISTBROWSER], (uint32*)&n); if(n) { struct modules_entry *m; IListBrowser->GetListBrowserNodeAttrs(n, LBNA_UserData, &m); m->sourcepath = freemem_strdup(modules_freemem_hook, mod_string_buffer); } } break; case MOD_PATH_BUTTON: { struct Node *n; IIntuition->GetAttr(LISTBROWSER_SelectedNode, ModObj[MOD_MODULES_LISTBROWSER], (uint32*)&n); if(n) { struct modules_entry *m; IListBrowser->GetListBrowserNodeAttrs(n, LBNA_UserData, &m); char *path = modules_request_path(m->name, m->sourcepath); if(path && strlen(path)) { m->sourcepath = path; IIntuition->SetAttrs(ModObj[MOD_PATH_STRING], STRINGA_TextVal, m->sourcepath, TAG_END); IIntuition->RefreshGadgets((struct Gadget *)ModObj[MOD_PATH_STRING], modwin, NULL); } } } break; case MOD_FLUSH_BUTTON: modules_clear(); modules_update_window(); break; case MOD_DELETE_BUTTON: { struct Node *n; IIntuition->GetAttr(LISTBROWSER_SelectedNode, ModObj[MOD_MODULES_LISTBROWSER], (uint32*)&n); if(n) { struct modules_entry *m; IListBrowser->GetListBrowserNodeAttrs(n, LBNA_UserData, &m); if(m) { IExec->Remove((struct Node *)m); modules_update_window(); } } break; } case MOD_NEW_BUTTON: { char *text = NULL; IIntuition->GetAttr(STRINGA_TextVal, ModObj[MOD_NEW_STRING], (uint32*)&text); if(text && strlen(text)) { struct modules_entry *e = freemem_malloc(modules_freemem_hook, sizeof(struct modules_entry)); e->name = freemem_strdup(modules_freemem_hook, text); e->accessallowed = FALSE; e->hasbeenloaded = FALSE; e->sourcepath = freemem_malloc(modules_freemem_hook, 1024); strcpy(e->sourcepath, ""); IExec->AddTail(&modules_entries, (struct Node *)e); modules_update_window(); } } break; case MOD_SAVE_BUTTON: modules_save_list(); modules_update(); done = TRUE; break; case MOD_USE_BUTTON: modules_update(); done = TRUE; break; } } } } } }
BOOL ami_tree_event(struct treeview_window *twin) { /* return TRUE if window destroyed */ ULONG class,result,relevent = 0; ULONG column; uint16 code; struct MenuItem *item; struct node *treenode; struct Node *lbnode; struct node_element *element; char *text; // ULONG editcols[] = {TREE_ELEMENT_TITLE,TREE_ELEMENT_URL}; static WORD gen=0; while((result = RA_HandleInput(twin->objects[OID_MAIN],&code)) != WMHI_LASTMSG) { switch(result & WMHI_CLASSMASK) // class { case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { case GID_TREEBROWSER: GetAttrs(twin->gadgets[GID_TREEBROWSER], LISTBROWSER_RelEvent,&relevent, TAG_DONE); switch(relevent) { case LBRE_DOUBLECLICK: GetAttr(LISTBROWSER_SelectedNode,twin->gadgets[GID_TREEBROWSER],(ULONG *)&lbnode); GetListBrowserNodeAttrs(lbnode, LBNA_UserData,(ULONG *)&treenode, TAG_DONE); ami_tree_launch_node(twin->tree,treenode); break; case LBRE_EDIT: GetAttrs(twin->gadgets[GID_TREEBROWSER], LISTBROWSER_SelectedNode,(ULONG *)&lbnode, // LISTBROWSER_RelColumn,(ULONG *)&column, TAG_DONE); GetListBrowserNodeAttrs(lbnode, LBNA_UserData,(ULONG *)&treenode, TAG_DONE); element = tree_find_element(treenode,TREE_ELEMENT_TITLE); GetListBrowserNodeAttrs(lbnode, LBNA_Column,column, LBNCA_Text,(ULONG *)&text, TAG_DONE); element->text = (char *)strdup(text); tree_handle_node_element_changed(twin->tree, element); break; case LBRE_HIDECHILDREN: GetAttr(LISTBROWSER_SelectedNode,twin->gadgets[GID_TREEBROWSER],(ULONG *)&lbnode); GetListBrowserNodeAttrs(lbnode, LBNA_UserData,(ULONG *)&treenode, TAG_DONE); tree_set_node_expanded(twin->tree, treenode, false); break; case LBRE_SHOWCHILDREN: GetAttr(LISTBROWSER_SelectedNode,twin->gadgets[GID_TREEBROWSER],(ULONG *)&lbnode); GetListBrowserNodeAttrs(lbnode, LBNA_UserData,(ULONG *)&treenode, TAG_DONE); tree_set_node_expanded(twin->tree, treenode, true); break; } break; case GID_OPEN: GetAttr(LISTBROWSER_SelectedNode,twin->gadgets[GID_TREEBROWSER],(ULONG *)&lbnode); GetListBrowserNodeAttrs(lbnode, LBNA_UserData,(ULONG *)&treenode, TAG_DONE); ami_tree_launch_node(twin->tree,treenode); break; case GID_NEWF: GetAttr(LISTBROWSER_SelectedNode,twin->gadgets[GID_TREEBROWSER],(ULONG *)&lbnode); if(lbnode) { GetListBrowserNodeAttrs(lbnode, LBNA_UserData,(ULONG *)&treenode, TAG_DONE); } else { treenode = twin->tree->root; } tree_create_folder_node(treenode,(char *)messages_get("TreeNewFolder")); ami_recreate_listbrowser(twin); break; case GID_NEWB: ami_new_bookmark(twin); break; case GID_UP: ami_move_node(twin,AMI_MOVE_UP); break; case GID_DOWN: ami_move_node(twin,AMI_MOVE_DOWN); break; case GID_LEFT: ami_move_node(twin,AMI_MOVE_OUT); break; case GID_DEL: GetAttr(LISTBROWSER_SelectedNode,twin->gadgets[GID_TREEBROWSER],(ULONG *)&lbnode); GetListBrowserNodeAttrs(lbnode, LBNA_UserData,(ULONG *)&treenode, TAG_DONE); tree_delete_node(twin->tree, treenode, false); /* We are recreating the list from scratch as there is no obvious easy way to delete children from a listbrowser list */ ami_recreate_listbrowser(twin); break; } break; /* no menus yet, copied in as will probably need it later case WMHI_MENUPICK: item = ItemAddress(gwin->win->MenuStrip,code); while (code != MENUNULL) { ami_menupick(code,gwin); if(win_destroyed) break; code = item->NextSelect; } break; */ case WMHI_CLOSEWINDOW: ami_tree_close(twin); return TRUE; break; } } return FALSE; }
struct Process *attach_select_process() { struct Process * ret = NULL; Object *WinObj, *ButtonObj, *ListBrowserObj; struct Window *win; get_process_list(); struct List attachlist; struct Node *node; IExec->NewList (&attachlist); int i; for (i = 0; i < noprocesses; i++) { if (node = IListBrowser->AllocListBrowserNode(2, LBNA_Column, 0, LBNCA_Text, processnamelist[i], TAG_DONE)) { IExec->AddTail(&attachlist, node); } } /* Create the window object. */ if(( WinObj = WindowObject, WA_ScreenTitle, "Debug 101", WA_Title, "Attach to process", WA_Width, 400, WA_Height, 400, WA_DepthGadget, TRUE, WA_SizeGadget, TRUE, WA_DragBar, TRUE, WA_CloseGadget, TRUE, WA_Activate, TRUE, WINDOW_Position, WPOS_CENTERSCREEN, /* there is no HintInfo array set up here, instead we define the ** strings directly when each gadget is created (OM_NEW) */ WINDOW_GadgetHelp, TRUE, WINDOW_ParentGroup, VLayoutObject, LAYOUT_SpaceOuter, TRUE, LAYOUT_DeferLayout, TRUE, LAYOUT_AddChild, ListBrowserObj = ListBrowserObject, GA_ID, ATTACH_LISTBROWSER, GA_RelVerify, TRUE, GA_TabCycle, TRUE, LISTBROWSER_AutoFit, TRUE, LISTBROWSER_Labels, &attachlist, // LISTBROWSER_ColumnInfo, columninfo, LISTBROWSER_ColumnTitles, TRUE, LISTBROWSER_ShowSelected, TRUE, LISTBROWSER_Striping, LBS_ROWS, ListBrowserEnd, LAYOUT_AddChild, ButtonObj = ButtonObject, GA_ID, ATTACH_BUTTON, GA_RelVerify, TRUE, GA_Text, "Select", ButtonEnd, CHILD_WeightedHeight, 0, EndMember, EndWindow)) { /* Open the window. */ if( win = (struct Window *) RA_OpenWindow(WinObj) ) { ULONG wait, signal, result, done = FALSE; WORD Code; CONST_STRPTR hintinfo; uint32 selected; /* Obtain the window wait signal mask. */ IIntuition->GetAttr( WINDOW_SigMask, WinObj, &signal ); /* Input Event Loop */ while( !done ) { wait = IExec->Wait(signal|SIGBREAKF_CTRL_C); if (wait & SIGBREAKF_CTRL_C) done = TRUE; else while ((result = RA_HandleInput(WinObj, &Code)) != WMHI_LASTMSG) { switch (result & WMHI_CLASSMASK) { case WMHI_CLOSEWINDOW: done = TRUE; break; case WMHI_GADGETUP: switch(result & WMHI_GADGETMASK) { case ATTACH_BUTTON: /* if the user has entered a new text for the buttons ** help text, get it, and set it */ IIntuition->GetAttrs( ListBrowserObj, LISTBROWSER_Selected, &selected, TAG_DONE ); //printf("selected = 0x%x\n", selected); if (selected != 0xffffffff) { ret = processstructlist[selected]; console_printf(OUTPUT_SYSTEM, "attaching to process with name %s\n", processnamelist[selected]); } done = TRUE; break; } break; } } } } /* Disposing of the window object will * also close the window if it is * already opened and it will dispose of * all objects attached to it. */ IIntuition->DisposeObject( WinObj ); IListBrowser->FreeListBrowserList(&attachlist); } //free_process_list(); return ret; }