HRESULT CMenuToolbarBase::ProcessClick(INT iItem) { if (m_disableMouseTrack) { TRACE("Item click prevented by DisableMouseTrack\n"); return S_OK; } // If a button is clicked while a submenu was open, cancel the submenu. if (!(m_initFlags & SMINIT_VERTICAL) && m_isTrackingPopup) { TRACE("OnCommand cancelled because it was tracking submenu.\n"); return S_FALSE; } if (PopupItem(iItem, FALSE) == S_OK) { TRACE("PopupItem returned S_OK\n"); return S_FALSE; } TRACE("Executing...\n"); return m_menuBand->_MenuItemSelect(MPOS_EXECUTE); }
HRESULT CMenuToolbarBase::OnPopupTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (wParam != TIMERID_HOTTRACK) { bHandled = FALSE; return 0; } KillTimer(TIMERID_HOTTRACK); if (!m_timerEnabled) return 0; m_timerEnabled = FALSE; if (m_hotItem < 0) return 0; // Returns S_FALSE if the current item did not show a submenu HRESULT hr = PopupItem(m_hotItem, FALSE); if (hr != S_FALSE) return 0; // If we didn't switch submenus, cancel the current popup regardless if (m_popupBar) { HRESULT hr = CancelCurrentPopup(); if (FAILED_UNEXPECTEDLY(hr)) return 0; } return 0; }
HRESULT CMenuToolbarBase::ChangeHotItem(CMenuToolbarBase * toolbar, INT item, DWORD dwFlags) { // Ignore the change if it already matches the stored info if (m_hotBar == toolbar && m_hotItem == item) return S_FALSE; // Prevent a change of hot item if the change was triggered by the mouse, // and mouse tracking is disabled. if (m_disableMouseTrack && dwFlags & HICF_MOUSE) { TRACE("Hot item change prevented by DisableMouseTrack\n"); return S_OK; } // Notify the toolbar if the hot-tracking left this toolbar if (m_hotBar == this && toolbar != this) { SetHotItem(-1); } TRACE("Hot item changed from %p %p, to %p %p\n", m_hotBar, m_hotItem, toolbar, item); m_hotBar = toolbar; m_hotItem = item; if (m_hotBar == this) { if (m_isTrackingPopup && !(m_initFlags & SMINIT_VERTICAL)) { // If the menubar has an open submenu, switch to the new item's submenu immediately PopupItem(m_hotItem, FALSE); } else if (dwFlags & HICF_MOUSE) { // Vertical menus show/hide the submenu after a delay, // but only with the mouse. if (m_initFlags & SMINIT_VERTICAL) { DWORD elapsed = 0; SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0); SetTimer(TIMERID_HOTTRACK, elapsed); m_timerEnabled = TRUE; TRACE("SetTimer called with m_hotItem=%d\n", m_hotItem); } } else { TBBUTTONINFO info; info.cbSize = sizeof(info); info.dwMask = 0; int index = GetButtonInfo(item, &info); SetHotItem(index); } } InvalidateDraw(); return S_OK; }
static void /*FCN*/FillFeatPopup ( Boolean needHide ){ Int2 i; CharPtr name; if ( needHide ){ Hide( featPopup ); Reset ( featPopup ); } for ( i=1; i<=totalGroups; i++ ){ if ( i== groupAr[curGroupInd] ) continue; name = (CharPtr)Nlm_GetMuskCParamEd(MSM_GROUPS, i, MSM_STRING); if ( (name == NULL) || (*name == 0) ) PopupItem ( featPopup,unknownName ); else PopupItem ( featPopup, name ); } SetValue ( featPopup, 1 ); if ( needHide ) { Show ( featPopup ); } }
extern void ShowNetConfigForm (WndActnProc activate, FormMessageFunc messages, VoidProc accepted, VoidProc cancelled, VoidProc turnedOff, Boolean netCurrentlyOn) { ButtoN b; GrouP c; GrouP g; GrouP h; GrouP j; Int2 len; NetConfigPtr ncp; PrompT ppt0, ppt1; ButtoN rb; Char str [256]; WindoW w; GrouP x; GrouP z; w = NULL; ncp = (NetConfigPtr) MemNew (sizeof (NetConfigData)); if (ncp != NULL) { w = FixedWindow (-50, -33, -10, -10, "Network Configuration", StdSendCloseWindowMessageProc); SetObjectExtra (w, ncp, StdCleanupFormProc); ncp->form = (ForM) w; ncp->formmessage = ConfigMessageProc; ncp->appmessage = messages; ncp->activate = activate; SetActivate (w, ConfigFormActivate); ncp->accepted = accepted; ncp->cancelled = cancelled; ncp->turnedOff = turnedOff; h = HiddenGroup (w, -1, 0, NULL); SetGroupSpacing (h, 5, 10); j = HiddenGroup (h, 2, 0, NULL); ppt0 = StaticPrompt (j, "Connection", 0, 0, programFont, 'l'); ncp->srvConnMode = HiddenGroup (j, 4, 0, ChangeConnection); SetObjectExtra (ncp->srvConnMode, ncp, NULL); rb = RadioButton (ncp->srvConnMode, "None"); RadioButton (ncp->srvConnMode, "Normal"); RadioButton (ncp->srvConnMode, "Firewall"); /* RadioButton (ncp->srvConnMode, "Stateless"); */ SetValue (ncp->srvConnMode, 2); if (turnedOff == NULL) { Disable (rb); } AlignObjects (ALIGN_MIDDLE, (HANDLE) ppt0, (HANDLE) ncp->srvConnMode, NULL); ncp->netGroup = HiddenGroup (h, -1, 0, NULL); SetGroupSpacing (ncp->netGroup, 5, 10); SelectFont (programFont); len = StringWidth ("HTTP Proxy Server ") + 2; SelectFont (systemFont); z = HiddenGroup (ncp->netGroup, -2, 0, NULL); StaticPrompt (z, "HTTP Proxy Server", len, dialogTextHeight, programFont, 'l'); ncp->proxyHost = DialogText (z, "", 12, ChangeProxy); SetObjectExtra (ncp->proxyHost, ncp, NULL); /* StaticPrompt (z, "", 0, 0, programFont, 'l'); StaticPrompt (z, "", 0, 0, programFont, 'l'); */ ppt0 = StaticPrompt (z, "HTTP Proxy Port ", len, dialogTextHeight, programFont, 'l'); ncp->proxyPort = DialogText (z, "", 3, NULL); x = MultiLinePrompt (z, "Non-transparent Proxy Server", len, programFont); ncp->firewallProxy = DialogText (z, "", 12, NULL); AlignObjects (ALIGN_MIDDLE, (HANDLE) x, (HANDLE) ncp->firewallProxy, NULL); /* AlignObjects (ALIGN_MIDDLE, (HANDLE) ppt0, (HANDLE) ncp->proxyPort, (HANDLE) ncp->firewallProxy, NULL); */ AlignObjects (ALIGN_RIGHT, (HANDLE) ncp->proxyHost, (HANDLE) ncp->firewallProxy, NULL); AlignObjects (ALIGN_LEFT, (HANDLE) ncp->proxyHost, (HANDLE) ncp->firewallProxy, NULL); g = HiddenGroup (ncp->netGroup, 5, 0, NULL); /* ppt0 = StaticPrompt (g, "Domain name server", 0, 0, programFont, 'l'); ncp->dnsAvailable = CheckBox (g, "Available", NULL); */ ncp->dnsAvailable = CheckBox (g, "Domain Name Server", NULL); SetStatus (ncp->dnsAvailable, TRUE); /* StaticPrompt (g, " ", 0, 0, programFont, 'l'); */ ppt1 = StaticPrompt (g, "Timeout", 0, popupMenuHeight, programFont, 'l'); ncp->timeOut = PopupList (g, TRUE, NULL); PopupItem (ncp->timeOut, "10 seconds"); PopupItem (ncp->timeOut, "30 seconds"); PopupItem (ncp->timeOut, "60 seconds"); PopupItem (ncp->timeOut, " 5 minutes"); SetValue (ncp->timeOut, 2); AlignObjects (ALIGN_MIDDLE, /* (HANDLE) ppt0, */ (HANDLE) ncp->dnsAvailable, (HANDLE) ppt1, (HANDLE) ncp->timeOut, NULL); c = HiddenGroup (w, 4, 0, NULL); SetGroupSpacing (c, 10, 2); ncp->accept = PushButton (c, "Accept", AcceptNetConfigForm); SetObjectExtra (ncp->accept, ncp, NULL); b = PushButton (c, "Cancel", StdSendCancelButtonMessageProc); SetObjectExtra (b, ncp, NULL); /* AlignObjects (ALIGN_CENTER, (HANDLE) h, (HANDLE) c, NULL); */ AlignObjects (ALIGN_CENTER, (HANDLE) j, (HANDLE) z, (HANDLE) g, (HANDLE) c, NULL); RealizeWindow (w); if (! netCurrentlyOn) { SafeSetValue (ncp->srvConnMode, 1); Hide (ncp->netGroup); } else if (GetAppParam ("NCBI", "CONN", "FIREWALL", NULL, str, sizeof (str))) { if (StringICmp (str, "TRUE") == 0) { SafeSetValue (ncp->srvConnMode, 3); } } if (GetAppParam ("NCBI", "CONN", "HTTP_PROXY_HOST", NULL, str, sizeof (str))) { if (! StringHasNoText (str)) { SafeSetTitle (ncp->proxyHost, str); if (GetValue (ncp->srvConnMode) == 2) { SafeSetValue (ncp->srvConnMode, 3); } } } if (GetAppParam ("NCBI", "CONN", "HTTP_PROXY_PORT", NULL, str, sizeof (str))) { if (! StringHasNoText (str)) { SafeSetTitle (ncp->proxyPort, str); } } if (GetAppParam ("NCBI", "CONN", "PROXY_HOST", NULL, str, sizeof (str))) { if (! StringHasNoText (str)) { SafeSetTitle (ncp->firewallProxy, str); } } if (GetAppParam ("NCBI", "CONN", "HOST", NULL, str, sizeof (str))) { if (StringICmp (str, "130.14.29.110") == 0) { SafeSetStatus (ncp->dnsAvailable, FALSE); } } if (GetAppParam ("NCBI", "CONN", "TIMEOUT", "30", str, sizeof (str))) { if (StringICmp (str, "10") == 0) { SafeSetValue (ncp->timeOut, 1); } else if (StringICmp (str, "60") == 0) { SafeSetValue (ncp->timeOut, 3); } else if (StringICmp (str, "300") == 0) { SafeSetValue (ncp->timeOut, 4); } else { SafeSetValue (ncp->timeOut, 2); } } ChangeConfigControls (ncp); Show (w); Select (w); Select (ncp->proxyHost); } }
Int2 LIBCALLBACK VSMGenericBinAsnOpen ( Pointer data ) { Char filename[255]; AsnIoPtr aip; Pointer ptr; Uint2 entityID; Int2 ct, i, retval = OM_MSG_RET_OK; ObjMgrPtr omp; ObjMgrTypePtr omtp = NULL; OMProcControlPtr ompcp; WindoW w; GrouP g; ButtoN b; VSMReadBinStr vrb; VSeqMgrPtr vsmp; ompcp = (OMProcControlPtr)data; vsmp = VSeqMgrGet(); omp = vsmp->omp; filename[0] = '\0'; if (GetInputFileName(filename, (size_t)254, NULL, NULL)) { vrb.do_it = FALSE; vrb.window_done = FALSE; vrb.the_type = 0; w = ModalWindow (-50, -33, -10, -10, NULL); SetWindowExtra(w, &vrb, NULL); g = HiddenGroup(w, 0, 2, NULL); StaticPrompt(g, "Select ASN.1 type:", 0,0,systemFont,'l'); vrb.p = PopupList(g, TRUE, NULL); i = 0; ct = 0; omtp = NULL; while ((omtp = ObjMgrTypeFindNext(omp, omtp)) != NULL) { if (omtp->asnname != NULL) { i++; PopupItem(vrb.p, omtp->asnname); if (! StringCmp(vsmp->lastASNtype, omtp->asnname)) ct = i; } } if (! i) { ErrPostEx(SEV_ERROR,0,0, "No ASN.1 types are registered"); Remove(w); return OM_MSG_RET_ERROR; } if (! ct) ct = 1; SetValue(vrb.p, ct); g = HiddenGroup(w, 2, 0, NULL); DefaultButton(g, "Accept", AsnBinAcceptProc); b = PushButton(g, "Cancel", AsnBinCancelProc); Show(w); Nlm_WaitForCondition (! vrb.window_done); ProcessAnEvent(); if (! vrb.do_it) return retval; i = 0; omtp = NULL; while ((omtp = ObjMgrTypeFindNext(omp, omtp)) != NULL) { i++; if (i == vrb.the_type) break; } if (omtp == NULL) { ErrPostEx(SEV_ERROR,0,0,"Couldn't find vrb.the_type"); return OM_MSG_RET_ERROR; } StringMove(vsmp->lastASNtype, omtp->asnname); WatchCursor(); aip = AsnIoOpen(filename, "rb"); ptr = (*(omtp->asnread))(aip, NULL); AsnIoClose(aip); if (ptr == NULL) { ErrPostEx(SEV_ERROR,0,0,"Couldn't read [%s], type [%s]", filename, omtp->asnname); retval = OM_MSG_RET_ERROR; } else { entityID = ObjMgrRegister(omtp->datatype, ptr); ompcp->output_data = ptr; ompcp->output_entityID = entityID; PromoteToSeqEntry (entityID, omtp->datatype, ptr); retval = OM_MSG_RET_DONE; } ArrowCursor(); } else retval = OM_MSG_RET_OK; return retval; }