// // DisplayTip // // Display custom tool tips (TRUE if handled) // Bool UnitContextButton::DisplayTip() { switch (primary.crc) { case 0xE1977EAE: // "Upgrade" case 0xE5CA04D2: // "UpgradeAvailable" { // Is there a unit selected if (UnitObj *unit = FirstSelected()) { // Is there an upgrade for this unit if (UnitObjType *upgrade = unit->GetNextUpgrade()) { Common::PrereqList *pt = IFace::Promote<Common::PrereqList> ( IFace::CreateControl("", "Common::PrereqList", IFace::OverlaysWindow()) ); if (pt) { pt->Setup ( ClientToScreen(Point<S32>(0, 0)), Team::GetDisplayTeam(), upgrade, unit ); pt->Activate(); IFace::SetTipControl(pt); return (TRUE); } } } break; } } return (FALSE); }
EFFECT *HandleFilterIDCMP( EXTBASE *PPTBase, struct EffectWindow *fw, ULONG rc ) { APTR entry; EFFECT *f = NULL; APTR func; struct IntuitionBase *IntuitionBase = PPTBase->lb_Intuition; struct Library *UtilityBase = PPTBase->lb_Utility; struct ExecBase *SysBase = PPTBase->lb_Sys; ULONG clicked, secs, ms; switch(rc) { case WMHI_CLOSEWINDOW: case GID_FW_CANCEL: D(bug("User wanted to quit filtering\n")); f = NEGNUL; break; case GID_FW_INFO: if( entry = (APTR) FirstSelected( fw->GO_List ) ) { SHLOCKGLOB(); f = (EFFECT *) FindName( &globals->effects, entry ); UNLOCKGLOB(); ShowExtInfo( PPTBase, &(f->info), fw->win ); f = NULL; /* We don't want to quit, however */ } break; case GID_FW_EXEC: /* * Read the current listview object. If you change, change the code * below (doubleclick) as well. */ if( entry = (APTR) FirstSelected( fw->GO_List ) ) { LOCKGLOB(); f = (EFFECT *) FindName( &globals->effects, entry ); if(f) { f->info.usecount++; } else { D(bug("FATAL: FindName() failed!\n")); } UNLOCKGLOB(); } break; case GID_FW_LIST: /* * Update gadgets. If the corresponding function can be found * from effect's tag array, then the gadget is activated, otherwise * it is disabled. */ if( entry = (APTR) FirstSelected( fw->GO_List ) ) { SHLOCKGLOB(); f = (EFFECT *) FindName( &globals->effects, entry ); if( !f->info.islibrary ) { func = (APTR) GetTagData( PPTX_EasyExec, NULL, f->info.tags ); } else { func = (APTR) TRUE; } XSetGadgetAttrs( PPTBase,(struct Gadget *)fw->GO_Exec, fw->win, NULL, GA_Disabled, !func, TAG_END ); XSetGadgetAttrs( PPTBase,(struct Gadget *)fw->GO_Info, fw->win, NULL, GA_Disabled, FALSE, TAG_END ); UNLOCKGLOB(); f = NULL; } /* * Check for a double click */ GetAttr( LISTV_LastClicked, fw->GO_List, &clicked ); if(clicked == fw->lastclicked) { CurrentTime( &secs, &ms ); if( DoubleClick( fw->lcs, fw->lcm, secs, ms )) { LOCKGLOB(); f = (EFFECT *) FindName( &globals->effects, entry ); f->info.usecount++; UNLOCKGLOB(); } } CurrentTime( &fw->lcs, &fw->lcm ); fw->lastclicked = clicked; break; default: break; } return f; }