void CInformationBarSettingsDialog::SetItemInfo()
	{
		LRESULT Sel=::SendDlgItemMessage(m_hDlg,IDC_SETTINGS_INFORMATION_BAR_ITEM_LIST,LB_GETCURSEL,0,0);
		LRESULT ItemCount=::SendDlgItemMessage(m_hDlg,IDC_SETTINGS_INFORMATION_BAR_ITEM_LIST,LB_GETCOUNT,0,0);

		EnableItem(IDC_SETTINGS_INFORMATION_BAR_DELETE_ITEM,Sel>=0);
		EnableItem(IDC_SETTINGS_INFORMATION_BAR_MOVE_UP_ITEM,Sel>0);
		EnableItem(IDC_SETTINGS_INFORMATION_BAR_MOVE_DOWN_ITEM,Sel>=0 && Sel+1<ItemCount);
		EnableItems(IDC_SETTINGS_INFORMATION_BAR_FORMAT_LABEL,
					IDC_SETTINGS_INFORMATION_BAR_ITEM_WIDTH_SPIN,
					Sel>=0);
		if (Sel>=0) {
			const CMainBoardSettings::InformationBarItemInfo *pItem=
				reinterpret_cast<const CMainBoardSettings::InformationBarItemInfo*>(
					::SendDlgItemMessage(m_hDlg,IDC_SETTINGS_INFORMATION_BAR_ITEM_LIST,LB_GETITEMDATA,Sel,0));

			SetItemString(IDC_SETTINGS_INFORMATION_BAR_FORMAT,pItem->Format);
			::SendDlgItemMessage(m_hDlg,IDC_SETTINGS_INFORMATION_BAR_TEXT_ALIGN,
								 CB_SETCURSEL,pItem->TextAlign,0);
			SetItemInt(IDC_SETTINGS_INFORMATION_BAR_ITEM_WIDTH,
					   pItem->Width<0?CInformationBar::CItem::DEFAULT_WIDTH:pItem->Width);
		} else {
			SetItemText(IDC_SETTINGS_INFORMATION_BAR_FORMAT,TEXT(""));
			::SendDlgItemMessage(m_hDlg,IDC_SETTINGS_INFORMATION_BAR_TEXT_ALIGN,
								 CB_SETCURSEL,-1,0);
			SetItemText(IDC_SETTINGS_INFORMATION_BAR_ITEM_WIDTH,TEXT(""));
		}
	}
Exemplo n.º 2
0
void toggle_menus(
	boolean game_started)
{
	MenuHandle menu_interface, menu_game;
	short item;
	static boolean first_time= TRUE;

	/* First time, we insert the menus... */	
	if(first_time)
	{
		MenuHandle menu;

		/* Insert our fake menu */
		menu= GetMenu(mFakeEmptyMenu);
		assert(menu);
		InsertMenu(menu, 0);

		menu= GetMenu(mInterface);
		assert(menu);
		InsertMenu(menu, -1);

		menu= GetMenu(mGame);
		assert(menu);
		InsertMenu(menu, -1);

		first_time= FALSE;
	}
	
	menu_interface= GetMenuHandle(mInterface);
	menu_game= GetMenuHandle(mGame);
	assert(menu_game && menu_interface);

	if(game_started)
	{
		DisableItem(menu_interface, 0);
		EnableItem(menu_game, 0);
	} else {
		DisableItem(menu_game, 0);
		EnableItem(menu_interface, 0);
	}

	/* Handle enabling/disabling everything.. */
	for(item= iNewGame; item<=iCenterButton; ++item)
	{
		if(enabled_item(item))
		{
			EnableItem(menu_interface, item);
		} else {
			DisableItem(menu_interface, item);
		}
	}

	return;
}
Exemplo n.º 3
0
static void mac_AdjustMenus(short modifiers)
{
	MenuHandle	filenemu=GetMenu(mFile),
				synthemu=GetMenu(mSynth);
	
	
	//CheckItem(filenemu, iLogWindow  & 0xFFFF, gShowMsg);
	//CheckItem(filenemu, iListWindow & 0xFFFF, gShowList);
	//CheckItem(filenemu, iWrdWindow  & 0xFFFF, gShowWrd);
	if( modifiers & optionKey ){
		//EnableItem(filenemu, iSkinWindow);
		EnableItem(synthemu, iQuickTime);
		EnableItem(synthemu, iOMS);
	}
}
Exemplo n.º 4
0
void modify_menu_item(
	short menu,
	short item,
	boolean status,
	short check)
{
	MenuHandle menu_handle;
	
	menu_handle= GetMHandle(menu);
	assert(menu_handle);

	if (menu_handle)
	{
		if (status)
		{
			EnableItem(menu_handle, item);
		}
		else
		{
			DisableItem(menu_handle, item);
		}
		
		if (check!=NONE)
		{
			CheckItem(menu_handle, item, check);
		}
	}
	
	return;
}
Exemplo n.º 5
0
/* ------- Miscellaneous Menu Commands -------------- */
void set_menu_enabled(
	short menu_id,
	short item,
	NMBoolean enabled)
{
#if defined(OP_PLATFORM_MAC_CFM) || defined(OP_PLATFORM_MAC_MACHO)
	MenuHandle menu= GetMenuHandle(menu_id);

#ifndef OP_PLATFORM_MAC_CARBON_FLAG
	if (enabled)
	{
		EnableItem(menu, item);
	} else {
		DisableItem(menu, item);
	}
#else
	if (enabled) {
		EnableMenuItem(menu, item);
	} else {
		DisableMenuItem(menu, item);
	}
#endif // OP_PLATFORM_MAC_CARBON_FLAG

#elif defined(OP_PLATFORM_WINDOWS)
	HMENU menu= GetMenu(screen_window);

	op_assert(menu);
	EnableMenuItem(menu, MAKE_MENU_COMMAND(menu_id, item), 
		enabled ? MF_ENABLED : MF_GRAYED);
#endif

	return;
}
Exemplo n.º 6
0
bool GUIEnableMenuItem( gui_window *wnd, gui_ctl_id id, bool enable, bool floating )
{
    HMENU       hmenu, popup, parent;
    gui_ctl_idx position;
    hint_type   type;

    if( floating ) {
        type = FLOAT_HINT;
    } else {
        type = MENU_HINT;
    }
    hmenu = GetOrMakeHMENU( wnd, floating, NULL );
    if( hmenu == NULLHANDLE ) {
        return( false );
    }

    popup = GetPopupHMENU( wnd, hmenu, id, &parent, &position, MENU_HINT );

    if( popup != NULLHANDLE ) {
        EnablePopup( parent, position, enable );
    } else {
        EnableItem( hmenu, id, enable );
    }

    if( hmenu == parent ) {
        GUIDrawMenuBar( wnd );
    }

    return( true );
}
Exemplo n.º 7
0
void
JXMenuData::EnableAll()
{
	const JSize count = GetElementCount();
	for (JIndex i=1; i<=count; i++)
		{
		EnableItem(i);
		}
}
Exemplo n.º 8
0
void CBeikeSoftMgrPowerSweepDlg::OnDelSelected()
{
	//显示进度
	SetItemVisible(IDC_TEXT_TIP_POWERSWEEP, FALSE);
	SetItemVisible(IDC_PROG_POWERSWEEP, TRUE);

	HTREEITEM	hRoot = m_Tree.GetRootItem();

	m_nCheckNum			= GetTreeCheckedCount( hRoot, TRUE );
	m_nSweepedNumber	= 0;

	if ( m_nCheckNum > 0 )
	{
		KillTimer( 1 );
		EnableItem( IDC_BTN_DEL_SELECTED, FALSE );
		EnableItem( IDCANCEL, FALSE);
		m_Tree.EnableWindow(FALSE);

		m_bSweeping = TRUE;

		//强力清扫行为统计
		int nReportFlag = 0;
		if ( m_bDeleteReg && m_bDeleteFile )
		{
			nReportFlag = 3;
		}
		else if ( m_bDeleteFile && !m_bDeleteReg )
		{
			nReportFlag = 1;
		}
		else if ( !m_bDeleteFile && m_bDeleteReg )
		{
			nReportFlag = 2;
		}


		_PowerSweepThread();

		m_bDeleteReg = FALSE;
		m_bDeleteFile = FALSE;
		m_bHasClearAction = TRUE;
	}

}
Exemplo n.º 9
0
bool GUIEnableSysMenuItem( gui_window *wnd, gui_ctl_id id, bool enable )
{
    HMENU       hmenu;

    hmenu = _wpi_getsystemmenu( GUIGetParentFrameHWND( wnd ) );
    if( hmenu != (HMENU)NULL ) {
        EnableItem( hmenu, id, enable );
    }
    return( true );
}
Exemplo n.º 10
0
    BOOL OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam*/)
    {
		EnableItem( 102,0 );
        m_wndCboxxx.Create(GetViewHWND(), 0, 0, WS_CHILD | WS_VISIBLE | WS_BORDER | CBS_DROPDOWNLIST, 0, 543);
        m_wndCboxxx.SetFont(BkFontPool::GetFont(BKF_DEFAULTFONT));
        m_wndCboxxx.AddString(L"第一项");
        m_wndCboxxx.AddString(L"第二项");

        return TRUE;
    }
Exemplo n.º 11
0
static void mac_adjustmenus(void) {
    WindowPtr window;
    MenuHandle menu;

    window = FrontWindow();
    menu = GetMenuHandle(mApple);
    EnableItem(menu, 0);
    EnableItem(menu, iAbout);

    menu = GetMenuHandle(mFile);
    EnableItem(menu, 0);
    EnableItem(menu, iNew);
    if (window != NULL)
	EnableItem(menu, iClose);
    else
	DisableItem(menu, iClose);
    EnableItem(menu, iQuit);

    if (mac_wininfo(window)->adjustmenus != NULL)
	(*mac_wininfo(window)->adjustmenus)(window);
    else {
	DisableItem(menu, iSave);
	DisableItem(menu, iSaveAs);
	menu = GetMenuHandle(mEdit);
	DisableItem(menu, 0);
	menu = GetMenuHandle(mWindow);
	DisableItem(menu, 0); /* Until we get more than 1 item on it. */
    }
    DrawMenuBar();
}
void CBeikeSafeInstallKavEngineDlg::OnBkBtnCancel()
{
    if (IsItemEnable(IDC_BTN_INSAVE_CANCEL) && IsItemVisible(IDC_BTN_INSAVE_CANCEL, TRUE))
    {
        m_bCancel = TRUE;

        EnableItem(IDC_BTN_INSAVE_CANCEL, FALSE);
    }
    else
    {
        EndDialog(IDOK);
    }
}
Exemplo n.º 13
0
bool MikeNPopupMenu::EnableList(bool enable, UINT id0, ...)
{
	va_list vap;
	UINT id;

	va_start(vap, enable);		// Point to first omittable argument

	while ((id = va_arg(vap, UINT)) > 0)
		EnableItem(id, enable);

	va_end(vap);

return(enable);
}
Exemplo n.º 14
0
		void DialogLoggedOutSAS::DialogInit()
		{
			if(!m_username.empty()) SetItemText(IDC_USERNAME_TXT, m_username.c_str());
			if(!m_password.empty()) SetItemText(IDC_PASSWORD_TXT, m_password.c_str());
			std::wstring motd = pGina::Transactions::TileUi::GetDynamicLabel(L"MOTD");
			SetItemText(IDC_MOTD, motd.c_str());
			ApplyLogoImage();
			SetFocusItem(IDC_USERNAME_TXT);

			bool specialActionEnabled = pGina::Registry::GetBool(L"EnableSpecialActionButton", false);
			if(specialActionEnabled)
			{
				EnableItem(IDC_SPECIAL);
				SetItemText(IDC_SPECIAL, pGina::Registry::GetString(L"SpecialAction", L"Shutdown").c_str());
			}
			else
				DisableItem(IDC_SPECIAL);			

			SetServiceStatus();

			// Start a timer to update service status
			m_statusTimerId = StartTimer(pGina::Registry::GetDword(L"PingSleepTime", 5000));
		}
Exemplo n.º 15
0
Arquivo: ugView.c Projeto: rolk/ug
static void SetState (int i)
{
  globalState = i;
  switch (i)
  {
  case CLOSED :
    EnableItem(myMenus[fileM],openCommand);
    DisableItem(myMenus[fileM],closeCommand);
    EnableItem(myMenus[fileM],quitCommand);
    DisableItem(myMenus[displayM],refreshCommand);
    DisableItem(myMenus[displayM],hdfCommand);
    DisableItem(myMenus[displayM],pictCommand);
    break;

  case OPENED :
    DisableItem(myMenus[fileM],openCommand);
    EnableItem(myMenus[fileM],closeCommand);
    EnableItem(myMenus[fileM],quitCommand);
    EnableItem(myMenus[displayM],refreshCommand);
    EnableItem(myMenus[displayM],hdfCommand);
    EnableItem(myMenus[displayM],pictCommand);
    break;
  }
}
Exemplo n.º 16
0
/* an edit menu handler for TextEdit
 */
short NATEmenup(na_win *winp, WORD menuid, WORD itemno)
{
	MenuHandle	mh = NAmenuh(mEdit);
	TEHandle	hTE = teinfo->hTE;
	TEPtr		pte;
	short		status = NA_NOTPROCESSED;
	
	switch (menuid) {
		case 0:
			pte = *hTE;
			if (pte->selStart != pte->selEnd) {
				EnableItem(mh, iCopy);
				if (!(winp->flags & NATE_READONLY)) {
					EnableItem(mh, iCut);
					EnableItem(mh, iClear);
				}
			} else {
				DisableItem(mh, iCopy);
				if (!(winp->flags & NATE_READONLY)) {
					DisableItem(mh, iCut);
					DisableItem(mh, iClear);
				}
			}
			EnableItem(mh, iSelAll);
			if (!(winp->flags & NATE_READONLY)) {
				EnableItem(mh, iPaste);
			}
			break;

		case mEdit:
			switch (itemno) {
				case iCut:
					TECut(hTE);
					goto DOSCRAP;
					
				case iCopy:
					TECopy(hTE);
				DOSCRAP:
					ZeroScrap();
					TEToScrap();
					goto EDITDONE;
					
				case iPaste:
					TEFromScrap();
					TEPaste(hTE);
					goto EDITDONE;
					
				case iClear:
					TEDelete(hTE);
					goto EDITDONE;
				
				case iSelAll:
					TESetSelect(0, 32767, hTE);
					TESelView(hTE);
				EDITDONE:
					status = NA_PROCESSED;
					NATEsetscroll(winp, false, (Rect*) NULL, (Rect*) NULL);
					break;
			}
		default:
			DisableItem(mh, iSelAll);
			break;
	}
	
	return (status);
}
Exemplo n.º 17
0
void Game::ModifyTablesPerRuleset(void)
{
	if(Globals->APPRENTICES_EXIST)
		EnableSkill(S_MANIPULATE);

	if(!Globals->GATES_EXIST)
		DisableSkill(S_GATE_LORE);

    if (Globals->FULL_TRUESEEING_BONUS) {
		ModifyAttribMod("observation", 1, AttribModItem::SKILL,
				"TRUE", AttribModItem::UNIT_LEVEL, 1);
	}
	if (Globals->IMPROVED_AMTS) {
		ModifyAttribMod("observation", 2, AttribModItem::ITEM,
				"AMTS", AttribModItem::CONSTANT, 3);
	}
	if (Globals->FULL_INVIS_ON_SELF) {
		ModifyAttribMod("stealth", 3, AttribModItem::SKILL,
				"INVI", AttribModItem::UNIT_LEVEL, 1);
	}


	if(Globals->NEXUS_IS_CITY && Globals->TOWNS_EXIST) {
		ClearTerrainRaces(R_NEXUS);
		ModifyTerrainRace(R_NEXUS, 0, I_HIGHELF);
		ModifyTerrainRace(R_NEXUS, 1, I_VIKING);
		ModifyTerrainRace(R_NEXUS, 2, I_PLAINSMAN);
		ClearTerrainItems(R_NEXUS);
		ModifyTerrainItems(R_NEXUS, 0, I_IRON, 100, 10);
		ModifyTerrainItems(R_NEXUS, 1, I_WOOD, 100, 10);
		ModifyTerrainItems(R_NEXUS, 2, I_STONE, 100, 10);

		ModifyTerrainEconomy(R_NEXUS, 1000, 15, 50, 2);
	}

	EnableItem(I_PICK);
	EnableItem(I_SPEAR);
	EnableItem(I_AXE);
	EnableItem(I_HAMMER);
	EnableItem(I_MCROSSBOW);
	EnableItem(I_MWAGON);
	EnableItem(I_GLIDER);
	EnableItem(I_NET);
	EnableItem(I_LASSO);
	EnableItem(I_BAG);
	EnableItem(I_SPINNING);
	EnableItem(I_LEATHERARMOR);
	EnableItem(I_CLOTHARMOR);
	EnableItem(I_BOOTS);

	EnableItem(I_BAXE);
	EnableItem(I_MBAXE);
	EnableItem(I_IMARM);
	EnableItem(I_SUPERBOW);
	EnableItem(I_LANCE);
	EnableItem(I_JAVELIN);
	EnableItem(I_PIKE);
	
	EnableSkill(S_ARMORCRAFT);
	EnableSkill(S_WEAPONCRAFT);

	EnableObject(O_ROADN);
	EnableObject(O_ROADNE);
	EnableObject(O_ROADNW);
	EnableObject(O_ROADS);
	EnableObject(O_ROADSE);
	EnableObject(O_ROADSW);

	EnableObject(O_ISLE);
	EnableObject(O_DERELICT);
	EnableObject(O_OCAVE);
	EnableObject(O_WHIRL);
	EnableItem(I_PIRATES);
	EnableItem(I_KRAKEN);
	EnableItem(I_MERFOLK);
	EnableItem(I_ELEMENTAL);

	if((Globals->UNDERDEEP_LEVELS > 0) || (Globals->UNDERWORLD_LEVELS > 1)) {
		EnableItem(I_MUSHROOM);
		EnableItem(I_HEALPOTION);
		EnableItem(I_ROUGHGEM);
		EnableItem(I_GEMS);
		EnableSkill(S_GEMCUTTING);
	}

	// Modify the various spells which are allowed to cross levels
	if(Globals->EASIER_UNDERWORLD) {
		ModifyRangeFlags("rng_teleport", RangeType::RNG_CROSS_LEVELS);
		ModifyRangeFlags("rng_farsight", RangeType::RNG_CROSS_LEVELS);
		ModifyRangeFlags("rng_clearsky", RangeType::RNG_CROSS_LEVELS);
		ModifyRangeFlags("rng_weather", RangeType::RNG_CROSS_LEVELS);
	}

	if (Globals->TRANSPORT & GameDefs::ALLOW_TRANSPORT) {
		EnableSkill(S_QUARTERMASTER);
		EnableObject(O_CARAVANSERAI);
	}

	// XXX -- This is just here to preserve existing behavior
	ModifyItemProductionBooster(I_AXE, I_HAMMER, 1);
	return;
}
Exemplo n.º 18
0
long CDlgStrategyHQ::LoadCurExp(WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/)
{	
	CDlgFormulaMan* pParentDlg  = (CDlgFormulaMan*)AfxGetMainWnd();
	if( pParentDlg == NULL )
		return 0;

	EnableItem(FALSE);

	if( wParam == CCompileEditView::UpdateExpress )
	{
		CDlgFormulaEdit* pDlg = pParentDlg->GetExpDlg();
		if( pDlg != NULL )
		{
			if(pDlg->SendMessage(HX_USER_LOADCUR,wParam,lParam))
			{
				pParentDlg->Enable(FALSE);
				pDlg->ShowWindow(SW_SHOWNORMAL);
			}
		}
	}
	else if( wParam == HX_EXPRESSSENTENCE )
	{
		//EnableItem(FALSE);

		CExpression* pExpression = (CExpression*)lParam;
		if( pExpression == NULL )
			return 0;
		CString csName = pExpression->GetName();
		CString cExpName = m_pStrategy->m_sExpName;
		if (m_bSetVar && csName == cExpName && m_pStrategy->m_pData->m_pCurVal)
		{
			CExpression *pex = ((CExpValue*)(m_pStrategy->m_pData->m_pCurVal))->GetExp();
			if (pex)//设置参数
			{
				CMapVariabile *pMap = pExpression->GetParamVar();
				CMapVariabile *pMv = pex->GetParamVar();
				//--------------------------------------------------
				if (pMv && pMap)
				{
					CString key;
					CValue *cvalue;
					CValue *pval;
					POSITION pos;
					pos = pMv->GetStartPosition();
					while(pos)
					{
						pMv->GetNextAssoc(pos,key,cvalue);
						if (pMap->Lookup(key,pval))
						{
							((CNumericValue*)pval)->SetValueOnly(cvalue->GetValue());
						}
					}
					//=====================================================================
				}
			}
		}
		CString cs = pExpression->GetName();
		m_EditEidolon.ShowWindow(SW_SHOW);

		CDlgNotesAndEidolon* pDlgNotes = pParentDlg->GetDlgNotes();
		CDlgNotesAndEidolon* pDlgParam = pParentDlg->GetDlgParam();
		if( pDlgNotes != NULL && 
			pDlgNotes->IsWindowVisible() )
		{
			pDlgNotes->SetNotes(pExpression->GetNotes(), pExpression->GetName());
		}

		if( m_EditEidolon.m_hWnd != NULL )
		{		
			CString strText;
			strText.Format("%s",pExpression->GetEidolon());
			if( !strText.IsEmpty() )
			{
				m_EditEidolon.SetText(strText,pExpression->GetParamVar(),FALSE);
			}
			else
			{
				CStringArray* pArray = pExpression->GetDefEidolon();
				if(pArray->GetSize() <= 1)
				{
					pArray = NULL;
				}
				m_EditEidolon.SetText(pArray,pExpression->GetParamVar(),FALSE);
			}
			m_EditEidolon.Invalidate();
		}
	}

	return 0;
}
Exemplo n.º 19
0
static void MenuBarInit(void) {

	Handle		hdl;
	MenuHandle	hmenu;

	hdl = GetNewMBar(IDM_MAINMENU);
	if (hdl == NULL) {
		ExitToShell();
	}
	SetMenuBar(hdl);
	hmenu = GetMenuHandle(IDM_APPLE);
	if (hmenu) {
		AppendResMenu(hmenu, 'DRVR');
	}
#if !defined(SUPPORT_SCSI)
	hmenu = GetMenuHandle(IDM_HARDDISK);
	if (hmenu) {
		DeleteMenuItem(hmenu, 7);
		DeleteMenuItem(hmenu, 6);
		DeleteMenuItem(hmenu, 5);
		DeleteMenuItem(hmenu, 4);
		DeleteMenuItem(hmenu, 3);
	}
#endif
	if (!np2oscfg.I286SAVE) {
		hmenu = GetMenuHandle(IDM_OTHER);
		if (hmenu) {
			DeleteMenuItem(hmenu, 9);
		}
	}
	InsertMenu(GetMenu(IDM_SASI1), -1);
	InsertMenu(GetMenu(IDM_SASI2), -1);
#if defined(SUPPORT_SCSI)
	InsertMenu(GetMenu(IDM_SCSI0), -1);
	InsertMenu(GetMenu(IDM_SCSI1), -1);
	InsertMenu(GetMenu(IDM_SCSI2), -1);
	InsertMenu(GetMenu(IDM_SCSI3), -1);
#endif
	InsertMenu(GetMenu(IDM_KEYBOARD), -1);
	InsertMenu(GetMenu(IDM_SOUND), -1);
	InsertMenu(GetMenu(IDM_MEMORY), -1);

#if TARGET_API_MAC_CARBON
	hmenu = GetMenuHandle(IDM_FDD2);
	SetItemCmd(hmenu, LoWord(IDM_FDD2OPEN), 'D');
	SetMenuItemModifiers(hmenu, LoWord(IDM_FDD2OPEN), kMenuShiftModifier);
	SetItemCmd(hmenu, LoWord(IDM_FDD2EJECT), 'E');
	SetMenuItemModifiers(hmenu, LoWord(IDM_FDD2EJECT), kMenuShiftModifier);
	hmenu = GetMenuHandle(IDM_SASI2);
	SetItemCmd(hmenu, LoWord(IDM_SASI2OPEN), 'O');
	SetMenuItemModifiers(hmenu, LoWord(IDM_SASI2OPEN), kMenuShiftModifier);
#else
	EnableItem(GetMenuHandle(IDM_DEVICE), LoWord(IDM_MOUSE));
	EnableItem(GetMenuHandle(IDM_KEYBOARD), LoWord(IDM_F12MOUSE));
#endif

	if (!(np2cfg.fddequip & 1)) {
		DeleteMenu(IDM_FDD1);
	}
	if (!(np2cfg.fddequip & 2)) {
		DeleteMenu(IDM_FDD2);
	}
	if (!(np2cfg.fddequip & 4)) {
		DeleteMenu(IDM_FDD3);
	}
	if (!(np2cfg.fddequip & 8)) {
		DeleteMenu(IDM_FDD4);
	}

#if defined(SUPPORT_STATSAVE)
	if (!np2oscfg.statsave) {
#endif
		DeleteMenu(IDM_STATSAVE);
#if defined(SUPPORT_STATSAVE)
	}
#endif

	DrawMenuBar();
}
Exemplo n.º 20
0
long CDlgStrategyParamConf::LoadCurExp(WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/)
{	
	m_sSingleSel.m_nType = hx_DefMaxValues;

	CDlgFormulaMan* pParentDlg  = (CDlgFormulaMan*)AfxGetMainWnd();
	if( pParentDlg == NULL )
		return 0;

	EnableItem(FALSE);

	if( wParam == CTreeCtrlFormula::YlsBrowser )
	{
		if(m_nType == 1)
		{
			CTreeGroup* pTreeGroup = (CTreeGroup*)lParam;
			//	CString strItem = *(CString*)lParam;
			/*	if( !strItem.CompareNoCase(CTreeCtrlFormula::g_strUnionCondition) )
			{
			m_sSingleSel.m_nType = CExpression::Union;
			m_sSingleSel.m_strExp.Format("%s",CTreeCtrlFormula::g_strUnionCondition);

			m_wndPeriod.ShowWindow(SW_HIDE);
			m_wndPeriodStc.ShowWindow(SW_HIDE);

			m_wndConNotes.ShowWindow(SW_HIDE);
			m_wndCon.ShowWindow(SW_HIDE);
			m_wndStaticCon.ShowWindow(SW_HIDE);

			m_wndCompare.ShowWindow(SW_HIDE);
			m_wndData1.ShowWindow(SW_HIDE);

			m_wndAndOr.ShowWindow(SW_HIDE);
			m_wndData2.ShowWindow(SW_HIDE);
			m_wndMiddle.ShowWindow(SW_HIDE);

			}*/
			//	else if( !strItem.CompareNoCase(CTreeCtrlFormula::g_strJiben) )
			/*	else*/ if( pTreeGroup->m_dwID == CExpression::JiBenMian )
			{
				m_sSingleSel.m_nType = CExpression::JiBenMian;
				m_sSingleSel.m_strExp.Format("%s",CTreeCtrlFormula::g_strJiben);

				m_wndPeriod.ShowWindow(SW_HIDE);

#ifdef _ONLY_SUPPORT_DAYLINE

				m_wndPeriod.SetCurSel(0);
#else

				m_wndPeriod.SetCurSel(5);
#endif
				m_wndPeriodStc.ShowWindow(SW_HIDE);

 				m_wndConNotes.ShowWindow(SW_SHOW);
 				m_wndConNotes.SetWindowText(HS_LANGUAGE("财务指标"));
				m_wndCon.ShowWindow(SW_SHOW);
				m_wndStaticCon.ShowWindow(SW_SHOW);

				m_wndCompare.ShowWindow(SW_SHOW);
				m_wndData1.ShowWindow(SW_SHOW);

				m_wndAndOr.ShowWindow(SW_HIDE);
				m_wndData2.ShowWindow(SW_HIDE);
				m_wndMiddle.ShowWindow(SW_HIDE);

				m_wndData1.ResetContent();
				m_wndData2.ResetContent();

				m_wndCon.ResetContent();
				CDlgCondition::InitCWData(&m_wndCon,YLS_GB_GUBEN_NAME);
				CDlgCondition::InitCWData(&m_wndCon,YLS_Cj_GUBEN_NAME);

				CDlgCondition::InitCondition(&m_wndCompare,4);
			}
		}
	}
	else if( wParam == CCompileEditView::UpdateExpress )
	{
		CDlgFormulaEdit* pDlg = pParentDlg->GetExpDlg();
		if( pDlg != NULL )
		{
			if(pDlg->SendMessage(HX_USER_LOADCUR,wParam,lParam))
			{
				pParentDlg->Enable(FALSE);
				pDlg->ShowWindowEx(SW_SHOWNORMAL);
			}
		}
	}
	else if( wParam == HX_EXPRESSSENTENCE )
	{
		//EnableItem(FALSE);

		CExpression* pExpression = (CExpression*)lParam;
		if( pExpression == NULL )
			return 0;

		//
		if(m_nType == 1)
		{
			m_sSingleSel.m_nType = pExpression->GetExpressType();
			m_sSingleSel.m_strExp.Format("%s",pExpression->GetName());
			CDlgCondition::InitCondition(&m_wndCompare,-1);

			switch ( m_sSingleSel.m_nType )
			{
			case CExpression::Tech:
				{
					//"选出技术指标数值满足下列条件的股票:");

					m_wndPeriod.ShowWindow(SW_SHOW);
#ifdef _ONLY_SUPPORT_DAYLINE

					m_wndPeriod.SetCurSel(0);
#else

					m_wndPeriod.SetCurSel(5);
#endif
					m_wndPeriodStc.ShowWindow(SW_SHOW);

 					m_wndConNotes.ShowWindow(SW_SHOW);
 					m_wndConNotes.SetWindowText(HS_LANGUAGE("指标线"));
					m_wndCon.ShowWindow(SW_SHOW);
					m_wndCon.ResetContent();
					m_wndStaticCon.ShowWindow(SW_SHOW);

					m_wndCompare.ShowWindow(SW_SHOW);
					m_wndData1.ShowWindow(SW_SHOW);

					CValue* valoare = NULL;
					if( CExpression::m_pExternExpression->Lookup(pExpression->GetName(),pExpression->GetExpressType(),valoare) ) // over
					{
						CExpValue* pExpValue = (CExpValue*)valoare;

						BOOL bFree = FALSE;
						CExpression* pCurExpression = pExpValue->GetExp();
						if( pCurExpression && pCurExpression == pExpression )
						{
							if( !pCurExpression->IsCompile() )
							{
								if( !pCurExpression->Compile() )
								{
									bFree = TRUE;
								}
							}
							CArray<CFormulaDrawParam*,CFormulaDrawParam*> ayDraw;
							CString strParam;
							int nCount = pCurExpression->GetDraw(strParam,ayDraw);
							CFormulaDrawParam* pParam;
							if( nCount > 0 )
							{
								for(int i = 0; i < nCount; i++)
								{
									pParam = ayDraw.GetAt(i);
									if( nCount == 1 && CString(pParam->m_strName).IsEmpty() )
									{
										m_wndCon.AddString(CTreeCtrlFormula::g_strFirstTechLine);
									}
									else
									{
										m_wndCon.AddString(pParam->m_strName);
									}
									delete pParam;
								}
							}
							else
							{
								m_wndCon.AddString(CTreeCtrlFormula::g_strFirstTechLine);
							}
							m_wndCon.SetCurSel(m_wndCon.GetCount()-1);

							OnSelchangeCompare();
						}
						if( bFree )
						{
							pExpValue->Free();
						}
					}

				}
				break;
			case CExpression::Condition:
				{
					//"选出满足下列条件的股票:");

					m_sSingleSel.m_SubData.m_cType = FormulaCompareSubData::Condition;

					m_wndPeriod.ShowWindow(SW_SHOW);

#ifdef _ONLY_SUPPORT_DAYLINE

					m_wndPeriod.SetCurSel(0);
#else

					m_wndPeriod.SetCurSel(5);
#endif
					m_wndPeriodStc.ShowWindow(SW_SHOW);

					m_wndConNotes.ShowWindow(SW_HIDE);
					m_wndCon.ShowWindow(SW_HIDE);
					m_wndStaticCon.ShowWindow(SW_HIDE);

					m_wndCompare.ShowWindow(SW_HIDE);
					m_wndData1.ShowWindow(SW_HIDE);

					m_wndAndOr.ShowWindow(SW_HIDE);
					m_wndData2.ShowWindow(SW_HIDE);
					m_wndMiddle.ShowWindow(SW_HIDE);
				}
				break;
			case CExpression::Exchange:
				{
					//"选出交易系统发出以下信号的股票:");

					m_sSingleSel.m_SubData.m_cType = FormulaCompareSubData::Exchange;

					m_wndPeriod.ShowWindow(SW_SHOW);
#ifdef _ONLY_SUPPORT_DAYLINE

					m_wndPeriod.SetCurSel(0);
#else

					m_wndPeriod.SetCurSel(5);
#endif
					m_wndPeriodStc.ShowWindow(SW_SHOW);

 					m_wndConNotes.ShowWindow(SW_HIDE);
 					m_wndConNotes.SetWindowText(HS_LANGUAGE("发出"));
					m_wndCon.ShowWindow(SW_HIDE);
					m_wndStaticCon.ShowWindow(SW_HIDE);

					m_wndCompare.ShowWindow(SW_HIDE);
					m_wndData1.ShowWindow(SW_HIDE);

					m_wndAndOr.ShowWindow(SW_HIDE);
					m_wndData2.ShowWindow(SW_HIDE);
					m_wndMiddle.ShowWindow(SW_HIDE);
				}
				break;
			case CExpression::MoreKLine:
				{
					//"选出五彩K线发出指示的股票:");

					m_sSingleSel.m_SubData.m_cType = FormulaCompareSubData::MoreKLine;

					m_wndPeriod.ShowWindow(SW_SHOW);
#ifdef _ONLY_SUPPORT_DAYLINE

					m_wndPeriod.SetCurSel(0);
#else

					m_wndPeriod.SetCurSel(5);
#endif
					m_wndPeriodStc.ShowWindow(SW_SHOW);

					m_wndConNotes.ShowWindow(SW_HIDE);
					m_wndCon.ShowWindow(SW_HIDE);
					m_wndStaticCon.ShowWindow(SW_HIDE);

					m_wndCompare.ShowWindow(SW_HIDE);
					m_wndData1.ShowWindow(SW_HIDE);

					m_wndAndOr.ShowWindow(SW_HIDE);
					m_wndData2.ShowWindow(SW_HIDE);
					m_wndMiddle.ShowWindow(SW_HIDE);
				}
				break;
			}
		}

		// 注释/参数修改
// 		CWnd* pWnd = GetDlgItem(IDC_NOTES);
// 		pWnd->ShowWindow(SW_SHOW);
		m_EditEidolon.ShowWindow(SW_SHOW);

		CDlgNotesAndEidolon* pDlgNotes = pParentDlg->GetDlgNotes();
		CDlgNotesAndEidolon* pDlgParam = pParentDlg->GetDlgParam();
		if( pDlgNotes != NULL && 
			pDlgNotes->IsWindowVisible() )
		{
			pDlgNotes->SetNotes(pExpression->GetNotes(), pExpression->GetName());
		}

		if( m_EditEidolon.m_hWnd != NULL )
		{		
			CString strText;
			strText.Format("%s",pExpression->GetEidolon());
			if( !strText.IsEmpty() )
			{
				m_EditEidolon.SetText(strText,pExpression->GetParamVar(),FALSE);
			}
			else
			{
				CStringArray* pArray = pExpression->GetDefEidolon();
				if(pArray->GetSize() <= 1)
				{
					pArray = NULL;
				}
				m_EditEidolon.SetText(pArray,pExpression->GetParamVar(),FALSE);
			}
			m_EditEidolon.Invalidate();
		}
	}

	return 0;
}
Exemplo n.º 21
0
/*	ExecuteMenuXOP1(p)
	
	Executes MenuXOP1 operation.
*/
extern "C" int
ExecuteMenuXOP1(MenuXOP1RuntimeParamsPtr p)
{
	int menuID, itemNumber;
	MenuHandle mHandle;
	int err = 0;

	if (p->enableEncountered) {
		if (err = GetMenuHandleAndItem((int)p->enableMenuID, (int)p->enableItemNumber, &mHandle, &itemNumber))
			return err;

		if (mHandle != NULL)
			EnableItem(mHandle, itemNumber);
	}

	if (p->disableEncountered) {
		if (err = GetMenuHandleAndItem((int)p->disableMenuID, (int)p->disableItemNumber, &mHandle, &itemNumber))
			return err;

		if (mHandle != NULL)
			DisableItem(mHandle, itemNumber);
	}
	
	if (p->hideEncountered) {
		menuID = (int)p->hideMenuID;
		if (menuID != MAINMENU_ID)
			return MAIN_MENU_ONLY;
		
		menuID = ResourceToActualMenuID(menuID);
		mHandle = GetMenuHandle(menuID);
		if (mHandle != NULL) {							// Menu showing ?
			WMDeleteMenu(menuID);
			WMDrawMenuBar();
		}
	}
	
	if (p->showEncountered) {
		menuID = (int)p->showMenuID;
		if (menuID != MAINMENU_ID)
			return MAIN_MENU_ONLY;
		
		menuID = ResourceToActualMenuID(menuID);
		mHandle = GetMenuHandle(menuID);
		if (mHandle == NULL) {							// Menu not already showing ?
			WMInsertMenu(mainMenuHandle, 0);
			WMDrawMenuBar();
		}
	}
	
	if (p->quitEncountered) {
		// If you unload MenuXOP1 while main menu is hidden it will not be retrievable if MenuXOP1 is reloaded.
		menuID = ResourceToActualMenuID(MAINMENU_ID);
		if (GetMenuHandle(menuID) == NULL) {
			WMInsertMenu(mainMenuHandle, 0);
			WMDrawMenuBar();
		}
		SetXOPType(TRANSIENT);							// Tell Igor to unload XOP.
	}

	return err;
}