Exemplo n.º 1
0
void COrderManageDlg::OnGroupBuyEditReturn()
{
	//获取选中的分组
	set<CCodeGroup> groupSet;
	DuiLib::CContainerUI* pGroupContainer[]= {m_pCodeGroupContainer, m_pLastCodeGroupContainer, m_pRecentGroupContainer};
	for (int j=0; j<sizeof(pGroupContainer)/sizeof(DuiLib::CContainerUI*); j++)
	{
		for (int i=0; i<pGroupContainer[j]->GetCount(); i++)
		{		
			DuiLib::COptionUI* pOption = dynamic_cast<DuiLib::COptionUI*>(pGroupContainer[j]->GetItemAt(i));
			if (pOption && pOption->IsSelected())
			{
				CCodeGroup group((int)(pOption->GetTag()));  //group id
				groupSet.insert(group);
				pOption->Selected(false, false);  //现在就取消选中状态,避免后面还要查找控件遍历取消
			}		
		}
	}

	if (groupSet.size() <= 0)
	{
		return;
	}

	//不是一个数,不继续
	CStringUtil strUtil(m_pGroupBuyEdit->GetText().GetData());
	if (!strUtil.IsNumber())
	{
		return;
	}

	//购买失败,不处理
	__int64 nBuyMoney = _ttoi64(m_pGroupBuyEdit->GetText().GetData());	
	CGroupBuyMethod buyMethod(groupSet, nBuyMoney);
	vector<CCode> buyVec = buyMethod.Buy();
	if (!COrderManager::Instance()->OrderAppend(m_pCustomerCombo->GetText().GetData(), buyVec))
	{
		return;
	}

	//记日志
	AddBuyLog(buyMethod.Log());		

	//初始化最近使用分组
	m_pRecentContainer->SetVisible(true);
	vector<CCodeGroup> groupVec(groupSet.begin(), groupSet.end());  //set会进行排序,所以用vector存储
	for (int i=0; i<m_pRecentGroupContainer->GetCount(); i++)  //将当前最近使用列表也认为是刚购买的
	{		
		DuiLib::COptionUI* pOption = dynamic_cast<DuiLib::COptionUI*>(m_pRecentGroupContainer->GetItemAt(i));
		if (pOption)
		{
			bool bHasInVector =false;
			for (vector<CCodeGroup>::const_iterator it=groupVec.begin(); it!=groupVec.end(); it++)
			{
				if (it->ID() == pOption->GetTag())
				{
					bHasInVector = true;
					break;
				}
			}

			if (!bHasInVector)
			{
				CCodeGroup group((int)(pOption->GetTag()));  //group id
				groupVec.push_back(group);
			}			
		}		
	}

	m_pRecentGroupContainer->RemoveAll();
	int nAlreadyInsertCount = 0;
	int nMaxCount = _ttoi((LPCTSTR)(m_pRecentGroupContainer->GetUserData()));  //最多个数存放在此
	for (vector<CCodeGroup>::const_iterator it=groupVec.begin(); it!=groupVec.end(); it++)
	{
		AddGroup(m_pRecentGroupContainer, it->ID());
		nAlreadyInsertCount++;
		if (nAlreadyInsertCount >= nMaxCount)
		{
			break;
		}
	}

	//删除购买金额	
	m_pGroupBuyEdit->SetText(_T(""));

	//去除提示
	//m_pGroupBuyEdit->SetExampleText(_T(""));
}
Exemplo n.º 2
0
void CGUIDialogVideoSettings::InitializeSettings()
{
  CGUIDialogSettingsManualBase::InitializeSettings();

  CSettingCategory *category = AddCategory("videosettings", -1);
  if (category == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }

  // get all necessary setting groups
  CSettingGroup *groupVideoStream = AddGroup(category);
  if (groupVideoStream == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }
  CSettingGroup *groupVideo = AddGroup(category);
  if (groupVideo == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }
  CSettingGroup *groupVideoPlayback = AddGroup(category);
  if (groupVideoPlayback == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }
  CSettingGroup *groupStereoscopic = AddGroup(category);
  if (groupStereoscopic == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }
  CSettingGroup *groupSaveAsDefault = AddGroup(category);
  if (groupSaveAsDefault == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }

  bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml");

  CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
  
  StaticIntegerSettingOptions entries;
  if (g_application.m_pPlayer->Supports(VS_DEINTERLACEMODE_OFF))
    entries.push_back(std::make_pair(16039, VS_DEINTERLACEMODE_OFF));
  if (g_application.m_pPlayer->Supports(VS_DEINTERLACEMODE_AUTO))
    entries.push_back(std::make_pair(16040, VS_DEINTERLACEMODE_AUTO));
  if (g_application.m_pPlayer->Supports(VS_DEINTERLACEMODE_FORCE))
    entries.push_back(std::make_pair(16041, VS_DEINTERLACEMODE_FORCE));
  if (!entries.empty())
    AddSpinner(groupVideo, SETTING_VIDEO_DEINTERLACEMODE, 16037, 0, static_cast<int>(videoSettings.m_DeinterlaceMode), entries);

  entries.clear();
  entries.push_back(std::make_pair(16019, VS_INTERLACEMETHOD_AUTO));
  entries.push_back(std::make_pair(20131, VS_INTERLACEMETHOD_RENDER_BLEND));
  entries.push_back(std::make_pair(20130, VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED));
  entries.push_back(std::make_pair(20129, VS_INTERLACEMETHOD_RENDER_WEAVE));
  entries.push_back(std::make_pair(16022, VS_INTERLACEMETHOD_RENDER_BOB_INVERTED));
  entries.push_back(std::make_pair(16021, VS_INTERLACEMETHOD_RENDER_BOB));
  entries.push_back(std::make_pair(16020, VS_INTERLACEMETHOD_DEINTERLACE));
  entries.push_back(std::make_pair(16036, VS_INTERLACEMETHOD_DEINTERLACE_HALF));
  entries.push_back(std::make_pair(16314, VS_INTERLACEMETHOD_INVERSE_TELECINE));
  entries.push_back(std::make_pair(16311, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL));
  entries.push_back(std::make_pair(16310, VS_INTERLACEMETHOD_VDPAU_TEMPORAL));
  entries.push_back(std::make_pair(16325, VS_INTERLACEMETHOD_VDPAU_BOB));
  entries.push_back(std::make_pair(16318, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF));
  entries.push_back(std::make_pair(16317, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF));
  entries.push_back(std::make_pair(16314, VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE));
  entries.push_back(std::make_pair(16325, VS_INTERLACEMETHOD_AUTO_ION));
  entries.push_back(std::make_pair(16327, VS_INTERLACEMETHOD_VAAPI_BOB));
  entries.push_back(std::make_pair(16328, VS_INTERLACEMETHOD_VAAPI_MADI));
  entries.push_back(std::make_pair(16329, VS_INTERLACEMETHOD_VAAPI_MACI));
  entries.push_back(std::make_pair(16330, VS_INTERLACEMETHOD_MMAL_ADVANCED));
  entries.push_back(std::make_pair(16331, VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF));
  entries.push_back(std::make_pair(16332, VS_INTERLACEMETHOD_MMAL_BOB));
  entries.push_back(std::make_pair(16333, VS_INTERLACEMETHOD_MMAL_BOB_HALF));
  entries.push_back(std::make_pair(16334, VS_INTERLACEMETHOD_IMX_FASTMOTION));
  entries.push_back(std::make_pair(16335, VS_INTERLACEMETHOD_IMX_FASTMOTION_DOUBLE));

  /* remove unsupported methods */
  for (StaticIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); )
  {
    if (g_application.m_pPlayer->Supports((EINTERLACEMETHOD)it->second))
      ++it;
    else
      it = entries.erase(it);
  }

  if (!entries.empty())
  {
    CSettingInt *settingInterlaceMethod = AddSpinner(groupVideo, SETTING_VIDEO_INTERLACEMETHOD, 16038, 0, static_cast<int>(videoSettings.m_InterlaceMethod), entries);

    CSettingDependency dependencyDeinterlaceModeOff(SettingDependencyTypeEnable, m_settingsManager);
    dependencyDeinterlaceModeOff.And()
      ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_DEINTERLACEMODE, "0", SettingDependencyOperatorEquals, true, m_settingsManager)));
    SettingDependencies depsDeinterlaceModeOff;
    depsDeinterlaceModeOff.push_back(dependencyDeinterlaceModeOff);
    settingInterlaceMethod->SetDependencies(depsDeinterlaceModeOff);
  }

  entries.clear();
  entries.push_back(std::make_pair(16301, VS_SCALINGMETHOD_NEAREST));
  entries.push_back(std::make_pair(16302, VS_SCALINGMETHOD_LINEAR));
  entries.push_back(std::make_pair(16303, VS_SCALINGMETHOD_CUBIC ));
  entries.push_back(std::make_pair(16304, VS_SCALINGMETHOD_LANCZOS2));
  entries.push_back(std::make_pair(16323, VS_SCALINGMETHOD_SPLINE36_FAST));
  entries.push_back(std::make_pair(16315, VS_SCALINGMETHOD_LANCZOS3_FAST));
  entries.push_back(std::make_pair(16322, VS_SCALINGMETHOD_SPLINE36));
  entries.push_back(std::make_pair(16305, VS_SCALINGMETHOD_LANCZOS3));
  entries.push_back(std::make_pair(16306, VS_SCALINGMETHOD_SINC8));
//  entries.push_back(make_pair(?????, VS_SCALINGMETHOD_NEDI));
  entries.push_back(std::make_pair(16307, VS_SCALINGMETHOD_BICUBIC_SOFTWARE));
  entries.push_back(std::make_pair(16308, VS_SCALINGMETHOD_LANCZOS_SOFTWARE));
  entries.push_back(std::make_pair(16309, VS_SCALINGMETHOD_SINC_SOFTWARE));
  entries.push_back(std::make_pair(13120, VS_SCALINGMETHOD_VDPAU_HARDWARE));
  entries.push_back(std::make_pair(16319, VS_SCALINGMETHOD_DXVA_HARDWARE));
  entries.push_back(std::make_pair(16316, VS_SCALINGMETHOD_AUTO));

  /* remove unsupported methods */
  for(StaticIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); )
  {
    if (g_application.m_pPlayer->Supports((ESCALINGMETHOD)it->second))
      ++it;
    else
      it = entries.erase(it);
  }

  AddSpinner(groupVideo, SETTING_VIDEO_SCALINGMETHOD, 16300, 0, static_cast<int>(videoSettings.m_ScalingMethod), entries);

#ifdef HAS_VIDEO_PLAYBACK
  AddVideoStreams(groupVideoStream, SETTING_VIDEO_STREAM);

  if (g_application.m_pPlayer->Supports(RENDERFEATURE_STRETCH) || g_application.m_pPlayer->Supports(RENDERFEATURE_PIXEL_RATIO))
  {
    entries.clear();
    for (int i = 0; i < 7; ++i)
      entries.push_back(std::make_pair(630 + i, i));
    AddSpinner(groupVideo, SETTING_VIDEO_VIEW_MODE, 629, 0, videoSettings.m_ViewMode, entries);
  }
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_ZOOM))
    AddSlider(groupVideo, SETTING_VIDEO_ZOOM, 216, 0, videoSettings.m_CustomZoomAmount, "%2.2f", 0.5f, 0.01f, 2.0f, 216, usePopup);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_VERTICAL_SHIFT))
    AddSlider(groupVideo, SETTING_VIDEO_VERTICAL_SHIFT, 225, 0, videoSettings.m_CustomVerticalShift, "%2.2f", -2.0f, 0.01f, 2.0f, 225, usePopup);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_PIXEL_RATIO))
    AddSlider(groupVideo, SETTING_VIDEO_PIXEL_RATIO, 217, 0, videoSettings.m_CustomPixelRatio, "%2.2f", 0.5f, 0.01f, 2.0f, 217, usePopup);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_POSTPROCESS))
    AddToggle(groupVideo, SETTING_VIDEO_POSTPROCESS, 16400, 0, videoSettings.m_PostProcess);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_BRIGHTNESS))
    AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_BRIGHTNESS, 464, 0, static_cast<int>(videoSettings.m_Brightness), 14047, 1, 464, usePopup);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_CONTRAST))
    AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_CONTRAST, 465, 0, static_cast<int>(videoSettings.m_Contrast), 14047, 1, 465, usePopup);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_GAMMA))
    AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_GAMMA, 466, 0, static_cast<int>(videoSettings.m_Gamma), 14047, 1, 466, usePopup);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_NOISE))
    AddSlider(groupVideoPlayback, SETTING_VIDEO_VDPAU_NOISE, 16312, 0, videoSettings.m_NoiseReduction, "%2.2f", 0.0f, 0.01f, 1.0f, 16312, usePopup);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_SHARPNESS))
    AddSlider(groupVideoPlayback, SETTING_VIDEO_VDPAU_SHARPNESS, 16313, 0, videoSettings.m_Sharpness, "%2.2f", -1.0f, 0.02f, 1.0f, 16313, usePopup);
  if (g_application.m_pPlayer->Supports(RENDERFEATURE_NONLINSTRETCH))
    AddToggle(groupVideoPlayback, SETTING_VIDEO_NONLIN_STRETCH, 659, 0, videoSettings.m_CustomNonLinStretch);
#endif

  // stereoscopic settings
  entries.clear();
  entries.push_back(std::make_pair(16316, RENDER_STEREO_MODE_OFF));
  entries.push_back(std::make_pair(36503, RENDER_STEREO_MODE_SPLIT_HORIZONTAL));
  entries.push_back(std::make_pair(36504, RENDER_STEREO_MODE_SPLIT_VERTICAL));
  AddSpinner(groupStereoscopic, SETTING_VIDEO_STEREOSCOPICMODE  , 36535, 0, videoSettings.m_StereoMode, entries);
  AddToggle(groupStereoscopic, SETTING_VIDEO_STEREOSCOPICINVERT, 36536, 0, videoSettings.m_StereoInvert);

  // general settings
  AddButton(groupSaveAsDefault, SETTING_VIDEO_MAKE_DEFAULT, 12376, 0);
  AddButton(groupSaveAsDefault, SETTING_VIDEO_CALIBRATION, 214, 0);
}
Exemplo n.º 3
0
void CSametimeProto::ImportContactsFromList(mwSametimeList* user_list, bool temporary)
{
	debugLog(_T("CSametimeProto::ImportContactsFromList() start"));
	// add contacts
	mwSametimeGroup* stgroup;
	mwSametimeUser* stuser;
	GList *gl, *gtl, *ul, *utl;
	const char* group_name;
	const char* group_alias;
	mwSametimeGroupType group_type;
	bool group_open;

	gl = gtl = mwSametimeList_getGroups(user_list);
	for (; gl; gl = gl->next) {
		char buff[256];
		stgroup = (mwSametimeGroup*)gl->data;

		group_name = mwSametimeGroup_getName(stgroup);
		group_alias = mwSametimeGroup_getAlias(stgroup);
		if (!group_alias) group_alias = group_name;

		group_type = mwSametimeGroup_getType(stgroup);
		group_open = (mwSametimeGroup_isOpen(stgroup) != 0);

		mir_snprintf(buff, "GN_%s", group_alias);
		db_set_utf(0, szProtoGroups, buff, group_name);
		mir_snprintf(buff, "GT_%s", group_alias);
		db_set_b(0, szProtoGroups, buff, (BYTE)group_type);
		mir_snprintf(buff, "GO_%s", group_alias);
		db_set_b(0, szProtoGroups, buff, (BYTE)(group_open ? 1 : 0));

		// inverse mapping
		mir_snprintf(buff, "GA_%s", group_name);
		db_set_utf(0, szProtoGroups, buff, group_alias);

		AddGroup(group_alias, group_open);

		if (group_type == mwSametimeGroup_DYNAMIC) {
			mwAwareIdBlock id_block;
			id_block.type = mwAware_GROUP;
			id_block.user = (char*)group_name;
			id_block.community = 0;

			GList* gl = g_list_prepend(NULL, &id_block);
			mwAwareList_addAware(aware_list, gl);
			g_list_free(gl);
		}

		ul = utl = mwSametimeGroup_getUsers(stgroup);
		for (; ul; ul = ul->next) {
			stuser = (mwSametimeUser*)ul->data;
			MCONTACT hContact = AddContact(stuser, temporary);
			if (hContact && group_alias && mir_strcmp(group_alias, Translate("None")) != 0 && mir_strcmp(group_alias, "MetaContacts Hidden Group") != 0) {
				SetContactGroup(hContact, group_alias);
				// mark contact as belonging to dynamic group
			}
		}
		g_list_free(utl);
	}
	g_list_free(gtl);
}
Exemplo n.º 4
0
void RBACData::LoadFromDB()
{
    TC_LOG_INFO(LOG_FILTER_RBAC, "RBACData::LoadFromDB [Id: %u Name: %s]", GetId(), GetName().c_str());
    TC_LOG_DEBUG(LOG_FILTER_RBAC, "RBACData::LoadFromDB [Id: %u Name: %s]: Loading groups", GetId(), GetName().c_str());

    // Load account group that affect current realm
    PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_GROUPS);
    stmt->setUInt32(0, GetId());
    stmt->setInt32(1, GetRealmId());
    PreparedQueryResult result = LoginDatabase.Query(stmt);

    if (result)
    {
        do
        {
            Field* fields = result->Fetch();
            AddGroup(fields[0].GetUInt32());
        }
        while (result->NextRow());
    }

    TC_LOG_DEBUG(LOG_FILTER_RBAC, "RBACData::LoadFromDB [Id: %u Name: %s]: Loading roles", GetId(), GetName().c_str());
    // Load account roles (granted and denied) that affect current realm
    stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_ROLES);
    stmt->setUInt32(0, GetId());
    stmt->setInt32(1, GetRealmId());
    result = LoginDatabase.Query(stmt);

    if (result)
    {
        do
        {
            Field* fields = result->Fetch();
            if (fields[1].GetBool())
                GrantRole(fields[0].GetUInt32());
            else
                DenyRole(fields[0].GetUInt32());
        }
        while (result->NextRow());
    }

    TC_LOG_DEBUG(LOG_FILTER_RBAC, "RBACData::LoadFromDB [Id: %u Name: %s]: Loading permissions", GetId(), GetName().c_str());
    // Load account permissions (granted and denied) that affect current realm
    stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS);
    stmt->setUInt32(0, GetId());
    stmt->setInt32(1, GetRealmId());

    result = LoginDatabase.Query(stmt);
    if (result)
    {
        do
        {
            Field* fields = result->Fetch();
            if (fields[1].GetBool())
                GrantPermission(fields[0].GetUInt32());
            else
                DenyPermission(fields[0].GetUInt32());
        }
        while (result->NextRow());
    }

    TC_LOG_DEBUG(LOG_FILTER_RBAC, "RBACData::LoadFromDB [Id: %u Name: %s]: Adding default groups", GetId(), GetName().c_str());
    // Add default groups
    RBACGroupContainer const& groups = sAccountMgr->GetRBACDefaultGroups();
    for (RBACGroupContainer::const_iterator itr = groups.begin(); itr != groups.end(); ++itr)
        AddGroup(*itr);

    TC_LOG_DEBUG(LOG_FILTER_RBAC, "RBACData::LoadFromDB [Id: %u Name: %s]: Calculating global permissions", GetId(), GetName().c_str());
    // Force calculation of permissions, it wasn't performed at load time
    // while adding groups, roles and permissions
    CalculateNewPermissions();
}
Exemplo n.º 5
0
/**
 *  Konstruktor von @p dskOptions.
 *
 *  @author OLiver
 *  @author FloSoft
 */
dskOptions::dskOptions(void) : Desktop(LOADER.GetImageN("setup013", 0))
{
    // Zurück
    AddTextButton(0, 300, 550, 200, 22,   TC_RED1, _("Back"), NormalFont);

    // "Optionen"
    AddText(1, 400, 10, _("Options"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER, LargeFont);

    ctrlOptionGroup* optiongroup = AddOptionGroup(10, ctrlOptionGroup::CHECK, scale_);

    AddTextButton(14, 520, 550, 200, 22, TC_GREEN2, _("Addons"), NormalFont);

    // "Allgemein"
    optiongroup->AddTextButton(11,  80, 510, 200, 22, TC_GREEN2, _("Common"), NormalFont);
    // "Grafik"
    optiongroup->AddTextButton(12, 300, 510, 200, 22, TC_GREEN2, _("Graphics"), NormalFont);
    // "Sound"
    optiongroup->AddTextButton(13, 520, 510, 200, 22, TC_GREEN2, _("Sound/Music"), NormalFont);

    ctrlGroup* groupAllgemein = AddGroup(21, scale_);
    ctrlGroup* groupGrafik = AddGroup(22, scale_);
    ctrlGroup* groupSound = AddGroup(23, scale_);
    ctrlComboBox* combo;

    // Allgemein
    // {

    // "Name"
    groupAllgemein->AddText(30, 80, 80, _("Name in Game:"), COLOR_YELLOW, 0, NormalFont);
    ctrlEdit* name = groupAllgemein->AddEdit(31, 280, 75, 190, 22, TC_GREY, NormalFont, 15);
    name->SetText(SETTINGS.lobby.name);

    // "Sprache"
    groupAllgemein->AddText(32, 80, 130, _("Language:"), COLOR_YELLOW, 0, NormalFont);
    combo = groupAllgemein->AddComboBox(33, 280, 125, 190, 20, TC_GREY, NormalFont, 100);

    bool selected = false;
    for(unsigned i = 0 ; i < LANGUAGES.getCount(); ++i)
    {
        const Languages::Language l = LANGUAGES.getLanguage(i);

        combo->AddString(_(l.name));
        if(SETTINGS.language.language == l.code )
        {
            combo->SetSelection(static_cast<unsigned short>(i));
            selected = true;
        }
    }
    if(!selected)
        combo->SetSelection(0);

    // Tastaturlayout
    groupAllgemein->AddText(34, 80, 180, _("Keyboard layout:"), COLOR_YELLOW, 0, NormalFont);
    groupAllgemein->AddTextButton(35, 280, 175, 120, 22, TC_GREY, _("Readme"), NormalFont);

    // IPv4/6
    groupAllgemein->AddText(300, 80, 230, _("Use IPv6:"), COLOR_YELLOW, 0, NormalFont);

    ctrlOptionGroup* ipv6 = groupAllgemein->AddOptionGroup(301, ctrlOptionGroup::CHECK, scale_);
    ipv6->AddTextButton(302, 480, 225, 190, 22, TC_GREY, _("IPv6"), NormalFont);
    ipv6->AddTextButton(303, 280, 225, 190, 22, TC_GREY, _("IPv4"), NormalFont);
    ipv6->SetSelection( (SETTINGS.server.ipv6 ? 302 : 303) );

    // ipv6-feld ggf (de-)aktivieren
    ipv6->GetCtrl<ctrlTextButton>(302)->Enable( (SETTINGS.proxy.typ != 4 && SETTINGS.proxy.typ != 40) ); //-V807

    // Proxyserver
    groupAllgemein->AddText(36, 80, 280, _("Proxyserver:"), COLOR_YELLOW, 0, NormalFont);
    ctrlEdit* proxy = groupAllgemein->AddEdit(37, 280, 275, 190, 22, TC_GREY, NormalFont);
    proxy->SetText(SETTINGS.proxy.proxy);
    proxy = groupAllgemein->AddEdit(371, 480, 275, 50, 22, TC_GREY, NormalFont, 5);
    proxy->SetText(SETTINGS.proxy.port);

    // Proxytyp
    groupAllgemein->AddText(38, 80, 310, _("Proxytyp:"), COLOR_YELLOW, 0, NormalFont);
    combo = groupAllgemein->AddComboBox(39, 280, 305, 390, 20, TC_GREY, NormalFont, 100);
    combo->AddString(_("No Proxy"));
    combo->AddString(_("Socks v4"));

    // TODO: not implemented
    //combo->AddString(_("Socks v5"));

    // und auswählen
    switch(SETTINGS.proxy.typ)
    {
        default:    {   combo->SetSelection(0); } break;
        case 4:     {   combo->SetSelection(1); } break;
        case 5:     {   combo->SetSelection(2); } break;
    }

    // }

    groupAllgemein->AddText(  70,  80, 360, _("Submit debug data:"), COLOR_YELLOW, 0, NormalFont);
    optiongroup = groupAllgemein->AddOptionGroup(71, ctrlOptionGroup::CHECK, scale_);
    optiongroup->AddTextButton(72, 480, 355, 190, 22, TC_GREY, _("On"), NormalFont);
    optiongroup->AddTextButton(73, 280, 355, 190, 22, TC_GREY, _("Off"), NormalFont);

    optiongroup->SetSelection( ((SETTINGS.global.submit_debug_data == 1) ? 72 : 73) );

    // qx:upnp switch
    groupAllgemein->AddText(9999, 80, 390, _("Use UPnP"), COLOR_YELLOW, 0, NormalFont);
    ctrlOptionGroup* upnp = groupAllgemein->AddOptionGroup(9998, ctrlOptionGroup::CHECK, scale_);
    upnp->AddTextButton(10002, 280, 385, 190, 22, TC_GREY, _("Off"), NormalFont);
    upnp->AddTextButton(10001, 480, 385, 190, 22, TC_GREY, _("On"), NormalFont);
    upnp->SetSelection( (SETTINGS.global.use_upnp == 1) ? 10001 : 10002 );


    if(!GLOBALVARS.ext_vbo) // VBO unterstützt?
        optiongroup->AddText(  56, 280, 230, _("not supported"), COLOR_YELLOW, 0, NormalFont);
    else
        optiongroup->AddTextButton(56, 280, 225, 190, 22, TC_GREY, _("On"), NormalFont);
    optiongroup->AddTextButton(57, 480, 225, 190, 22, TC_GREY, _("Off"), NormalFont);

    // "Auflösung"
    groupGrafik->AddText(  40,  80, 80, _("Fullscreen resolution:"), COLOR_YELLOW, 0, NormalFont);
    groupGrafik->AddComboBox(41, 280, 75, 120, 22, TC_GREY, NormalFont, 150);

    // "Vollbild"
    groupGrafik->AddText(  46,  80, 130, _("Mode:"), COLOR_YELLOW, 0, NormalFont);
    optiongroup = groupGrafik->AddOptionGroup(47, ctrlOptionGroup::CHECK, scale_);
    optiongroup->AddTextButton(48, 480, 125, 190, 22, TC_GREY, _("Fullscreen"), NormalFont);
    optiongroup->AddTextButton(49, 280, 125, 190, 22, TC_GREY, _("Windowed"), NormalFont);

    // "VSync"
    groupGrafik->AddText(  50,  80, 180, _("Limit Framerate:"), COLOR_YELLOW, 0, NormalFont);
    groupGrafik->AddComboBox(51, 280, 175, 390, 22, TC_GREY, NormalFont, 150);

    // "VBO"
    groupGrafik->AddText(  54,  80, 230, _("Vertex Buffer Objects:"), COLOR_YELLOW, 0, NormalFont);
    optiongroup = groupGrafik->AddOptionGroup(55, ctrlOptionGroup::CHECK, scale_);

    if(!GLOBALVARS.ext_vbo) // VBO unterstützt?
        optiongroup->AddText(  56, 280, 230, _("not supported"), COLOR_YELLOW, 0, NormalFont);
    else
        optiongroup->AddTextButton(56, 280, 225, 190, 22, TC_GREY, _("On"), NormalFont);
    optiongroup->AddTextButton(57, 480, 225, 190, 22, TC_GREY, _("Off"), NormalFont);

    // "Grafiktreiber"
    groupGrafik->AddText(58, 80, 275, _("Graphics Driver"), COLOR_YELLOW, 0, NormalFont);
    combo = groupGrafik->AddComboBox(59, 280, 275, 390, 20, TC_GREY, NormalFont, 100);

    std::vector<DriverWrapper::DriverItem> video_drivers = DriverWrapper::LoadDriverList(DriverWrapper::DT_VIDEO);

    for(std::vector<DriverWrapper::DriverItem>::iterator it = video_drivers.begin(); it != video_drivers.end(); ++it)
    {
        combo->AddString(it->GetName());
        if(it->GetName() == SETTINGS.driver.video)
            combo->SetSelection(combo->GetCount() - 1);
    }

    groupGrafik->AddText(  74,  80, 320, _("Optimized Textures:"), COLOR_YELLOW, 0, NormalFont);
    optiongroup = groupGrafik->AddOptionGroup(75, ctrlOptionGroup::CHECK, scale_);

    optiongroup->AddTextButton(76, 280, 315, 190, 22, TC_GREY, _("On"), NormalFont);
    optiongroup->AddTextButton(77, 480, 315, 190, 22, TC_GREY, _("Off"), NormalFont);


    // "Audiotreiber"
    groupSound->AddText(60,  80, 230, _("Sounddriver"), COLOR_YELLOW, 0, NormalFont);
    combo = groupSound->AddComboBox(61, 280, 225, 390, 20, TC_GREY, NormalFont, 100);

    std::vector<DriverWrapper::DriverItem> audio_drivers = DriverWrapper::LoadDriverList(DriverWrapper::DT_AUDIO);

    for(std::vector<DriverWrapper::DriverItem>::iterator it = audio_drivers.begin(); it != audio_drivers.end(); ++it)
    {
        combo->AddString(it->GetName());
        if(it->GetName() == SETTINGS.driver.audio)
            combo->SetSelection(combo->GetCount() - 1);
    }

    // Musik
    groupSound->AddText(  62,  80, 80, _("Music"), COLOR_YELLOW, 0, NormalFont);
    optiongroup = groupSound->AddOptionGroup(63, ctrlOptionGroup::CHECK, scale_);
    optiongroup->AddTextButton(64, 280, 75, 90, 22, TC_GREY, _("On"), NormalFont);
    optiongroup->AddTextButton(65, 380, 75, 90, 22, TC_GREY, _("Off"), NormalFont);

    ctrlProgress* Mvolume = groupSound->AddProgress(72, 480, 75, 190, 22, TC_GREY, 139, 138, 10);
    Mvolume->SetPosition(SETTINGS.sound.musik_volume * 10 / 255); //-V807

    // Effekte
    groupSound->AddText(  66,  80, 130, _("Effects"), COLOR_YELLOW, 0, NormalFont);
    optiongroup = groupSound->AddOptionGroup(67, ctrlOptionGroup::CHECK, scale_);
    optiongroup->AddTextButton(68, 280, 125, 90, 22, TC_GREY, _("On"), NormalFont);
    optiongroup->AddTextButton(69, 380, 125, 90, 22, TC_GREY, _("Off"), NormalFont);

    ctrlProgress* FXvolume = groupSound->AddProgress(70, 480, 125, 190, 22, TC_GREY, 139, 138, 10);
    FXvolume->SetPosition(SETTINGS.sound.effekte_volume * 10 / 255);

    // Musicplayer-Button
    groupSound->AddTextButton(71, 280, 175, 190, 22, TC_GREY, _("Music player"), NormalFont);

    // "Allgemein" auswählen
    optiongroup = GetCtrl<ctrlOptionGroup>(10);
    optiongroup->SetSelection(11, true);


    // Grafik
    // {

    // Videomodi auflisten
    VIDEODRIVER.ListVideoModes(video_modes);

    // Und zu der Combobox hinzufügen
    for(unsigned i = 0; i < video_modes.size(); ++i)
    {
        // >=800x600, alles andere macht keinen Sinn
        if(video_modes[i].width >= 800 && video_modes[i].height >= 600)
        {
            char str[64];
            sprintf(str, "%ux%u", video_modes[i].width, video_modes[i].height);

            groupGrafik->GetCtrl<ctrlComboBox>(41)->AddString(str);

            // Ist das die aktuelle Auflösung? Dann selektieren
            if(video_modes[i].width == SETTINGS.video.fullscreen_width &&
                    video_modes[i].height == SETTINGS.video.fullscreen_height)
                groupGrafik->GetCtrl<ctrlComboBox>(41)->SetSelection(i);
        }
        else
        {
            video_modes.erase(video_modes.begin() + i);
            --i;
        }
    }

    // "Vollbild" setzen
    optiongroup = groupGrafik->GetCtrl<ctrlOptionGroup>(47);
    optiongroup->SetSelection( (SETTINGS.video.fullscreen ? 48 : 49) ); //-V807

    // "Limit Framerate" füllen
    optiongroup = groupGrafik->GetCtrl<ctrlOptionGroup>(51);
    for(unsigned char i = 0; i < Settings::SCREEN_REFRESH_RATES_COUNT; ++i)
    {
        switch(Settings::SCREEN_REFRESH_RATES[i])
        {
            case 0:
            {
                groupGrafik->GetCtrl<ctrlComboBox>(51)->AddString(_("Disabled"));
                groupGrafik->GetCtrl<ctrlComboBox>(51)->SetSelection(0);
            } break;
            case 1:
            {
                if(GLOBALVARS.ext_swapcontrol)
                    groupGrafik->GetCtrl<ctrlComboBox>(51)->AddString(_("Dynamic (Limits to display refresh rate, works with most drivers)"));
                if(SETTINGS.video.vsync == 1)
                    groupGrafik->GetCtrl<ctrlComboBox>(51)->SetSelection(1);
            } break;
            default:
            {
                // frameratebegrenzungen mit Bildabstand kleiner 13ms
                // wird unter windows nicht mehr aufgelöst
#ifdef _WIN32
                if(960 / Settings::SCREEN_REFRESH_RATES[i] > 13)
#endif // _WIN32
                {
                    std::stringstream rrate;
                    rrate << Settings::SCREEN_REFRESH_RATES[i] << " fps";
                    groupGrafik->GetCtrl<ctrlComboBox>(51)->AddString(rrate.str());
                }

                if(SETTINGS.video.vsync == Settings::SCREEN_REFRESH_RATES[i])
                    groupGrafik->GetCtrl<ctrlComboBox>(51)->SetSelection(i - (GLOBALVARS.ext_swapcontrol ? 0 : 1));
            } break;
        }
    }

    // "VBO" setzen
    optiongroup = groupGrafik->GetCtrl<ctrlOptionGroup>(55);
    if(GLOBALVARS.ext_vbo)
        optiongroup->SetSelection( (SETTINGS.video.vbo ? 56 : 57) );
    else
        optiongroup->SetSelection(57);

    optiongroup = groupGrafik->GetCtrl<ctrlOptionGroup>(75);
    optiongroup->SetSelection( (SETTINGS.video.shared_textures ? 76 : 77) );
    // }

    // Sound
    // {

    // "Musik" setzen
    optiongroup = groupSound->GetCtrl<ctrlOptionGroup>(63);
    optiongroup->SetSelection( (SETTINGS.sound.musik ? 64 : 65) );

    // "Effekte" setzen
    optiongroup = groupSound->GetCtrl<ctrlOptionGroup>(67);
    optiongroup->SetSelection( (SETTINGS.sound.effekte ? 68 : 69) );

    // }
}
Exemplo n.º 6
0
BOOL CCfgFile::AddLine(LPSTR pLine)
{_STTEX();
	DWORD	i = 0, p, size, type;
	char	*start, *buf;
	char	name[ MAX_PATH * 3 ];
	BOOL	data = FALSE;

	// Find start of data
	while ( pLine[ i ] != 0 && ( pLine[ i ] <= ' ' || pLine[ i ] > '~' ) ) i++;
	if ( pLine[ i ] == 0 ) return FALSE;

	// Skip comments
	if ( pLine[ i ] == ';' ) return TRUE;

	// Is it a group name?
	if ( pLine[ i ] == '[' )
	{
		DWORD	g = 0;
		char	group[ MAX_PATH ];

		// Copy group name
		i++;
		while ( g < sizeof( group ) - 1 && 
				pLine[ i ] >= ' ' && 
				pLine[ i ] <= '~' && 
				pLine[ i ] != ']' )
			group[ g++ ] = pLine[ i++ ];

		// Terminate group name
		group[ g ] = 0;

		// Add a group
		m_hCurGroup = AddGroup( group );

		return TRUE;
	} // end if

	// Read in type
	DWORD ignore = i;
	if ( pLine[ i ] >= '0' && pLine[ i ] <= '9' )
	{
		// Read in type
		type = strtoul( &pLine[ i ], NULL, 10 );
		
		// Find start of name
		while ( pLine[ i ] != 0 && 
				pLine[ i ] != '=' && 
				pLine[ i ] != ':' ) i++;
		if ( pLine[ i ] == ':' ) i++;
		else { type = CFG_VOID; i = ignore; }

	} // end if
	else type = CFG_VOID;

	// Capture the name string
	start = &pLine[ i ];
	DWORD x = 0;
	while ( pLine[ i ] >= ' ' && pLine[ i ] <= '~' && pLine[ i ] != '=' ) 
		x++, i++;
	data = ( pLine[ i ] == '=' ); 
	if ( data ) i++;

	// Decanonicalize buffer
 	if ( !DeCanonicalizeBuffer( start, (LPBYTE)name, x, &size ) ) return FALSE;

	// Convert data
	if( !data )
	{
		size = 0;
		buf = NULL;
	} // end if

	else if ( pLine[ i ] == '#' )
	{	i++;
		size = 0;
		buf = (LPSTR)strtoul( &pLine[ i ], NULL, 10 );
	} // end if
	else
	{
		// Skip string marker
		if ( pLine[ i ] == '>' ) i++;

		// Capture the data string
		start = &pLine[ i ];
		p = 0; 
		while ( pLine[ i ] >= ' ' && pLine[ i ] <= '~' && pLine[ i ] != m_ucTerm ) 
			i++, p++;

		if ( p != 0 )
		{
			// DeCanonicalize data
			DWORD a = GetMinDeCanonicalizeBufferSize( p );

			buf = new char[ a ];
			if ( buf == NULL ) return FALSE;

			// Do it
			if ( !DeCanonicalizeBuffer( start, (LPBYTE)buf, p, &size ) ) return FALSE;

		} // end if

		// NULL data
		else buf = NULL, size = 0;

	} // end else

	// Now we have all the data, so add it
	BOOL ret = AddElement( m_hCurGroup, name, type, size, buf );

	// Lose the data buffer
	if ( size != 0 ) delete [] buf;

	return ret;

}
DWORD
LsaAddGroupMain(
    int argc,
    char* argv[]
    )
{
    DWORD dwError = 0;
    PSTR  pszGid = NULL;
    PSTR  pszGroup = NULL;
    size_t dwErrorBufferSize = 0;
    BOOLEAN bPrintOrigError = TRUE;

    if (geteuid() != 0) {
        fprintf(stderr, "This program requires super-user privileges.\n");
        dwError = LW_ERROR_ACCESS_DENIED;
        BAIL_ON_LSA_ERROR(dwError);
    }

    dwError = ParseArgs(
                    argc,
                    argv,
                    &pszGid,
                    &pszGroup);
    BAIL_ON_LSA_ERROR(dwError);

    dwError = AddGroup(
                    pszGid,
                    pszGroup);
    BAIL_ON_LSA_ERROR(dwError);

    fprintf(stdout, "Successfully added group %s\n", pszGroup);

cleanup:

    LW_SAFE_FREE_STRING(pszGid);
    LW_SAFE_FREE_STRING(pszGroup);

    return dwError;

error:

    dwError = MapErrorCode(dwError);

    dwErrorBufferSize = LwGetErrorString(dwError, NULL, 0);

    if (dwErrorBufferSize > 0)
    {
        DWORD dwError2 = 0;
        PSTR   pszErrorBuffer = NULL;

        dwError2 = LwAllocateMemory(
                    dwErrorBufferSize,
                    (PVOID*)&pszErrorBuffer);

        if (!dwError2)
        {
            DWORD dwLen = LwGetErrorString(dwError, pszErrorBuffer, dwErrorBufferSize);

            if ((dwLen == dwErrorBufferSize) && !LW_IS_NULL_OR_EMPTY_STR(pszErrorBuffer))
            {
                fprintf(stderr,
                        "Failed to add group.  Error code %u (%s).\n%s\n",
                        dwError,
                        LW_PRINTF_STRING(LwWin32ExtErrorToName(dwError)),
                        pszErrorBuffer);
                bPrintOrigError = FALSE;
            }
        }

        LW_SAFE_FREE_STRING(pszErrorBuffer);
    }

    if (bPrintOrigError)
    {
        fprintf(stderr,
                "Failed to add group.  Error code %u (%s).\n",
                dwError,
                LW_PRINTF_STRING(LwWin32ExtErrorToName(dwError)));
    }

    goto cleanup;
}
Exemplo n.º 8
0
void CGUIDialogCMSSettings::InitializeSettings()
{
  CGUIDialogSettingsManualBase::InitializeSettings();

  const std::shared_ptr<CSettingCategory> category = AddCategory("cms", -1);
  if (category == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogCMSSettings: unable to setup settings");
    return;
  }

  // get all necessary setting groups
  const std::shared_ptr<CSettingGroup> groupColorManagement = AddGroup(category);
  if (groupColorManagement == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogCMSSettings: unable to setup settings");
    return;
  }

  bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml");

  TranslatableIntegerSettingOptions entries;

  // create "depsCmsEnabled" for settings depending on CMS being enabled
  CSettingDependency dependencyCmsEnabled(SettingDependencyType::Enable, GetSettingsManager());
  dependencyCmsEnabled.Or()
    ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_CMSENABLE, "true", SettingDependencyOperator::Equals, false, GetSettingsManager())));
  SettingDependencies depsCmsEnabled;
  depsCmsEnabled.push_back(dependencyCmsEnabled);

  // create "depsCms3dlut" for 3dlut settings
  CSettingDependency dependencyCms3dlut(SettingDependencyType::Visible, GetSettingsManager());
  dependencyCms3dlut.And()
    ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_CMSMODE, std::to_string(CMS_MODE_3DLUT), SettingDependencyOperator::Equals, false, GetSettingsManager())));
  SettingDependencies depsCms3dlut;
  depsCms3dlut.push_back(dependencyCmsEnabled);
  depsCms3dlut.push_back(dependencyCms3dlut);

  // create "depsCmsIcc" for display settings with icc profile
  CSettingDependency dependencyCmsIcc(SettingDependencyType::Visible, GetSettingsManager());
  dependencyCmsIcc.And()
    ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_CMSMODE, std::to_string(CMS_MODE_PROFILE), SettingDependencyOperator::Equals, false, GetSettingsManager())));
  SettingDependencies depsCmsIcc;
  depsCmsIcc.push_back(dependencyCmsEnabled);
  depsCmsIcc.push_back(dependencyCmsIcc);

  // create "depsCmsGamma" for effective gamma adjustment (not available with bt.1886)
  CSettingDependency dependencyCmsGamma(SettingDependencyType::Visible, GetSettingsManager());
  dependencyCmsGamma.And()
    ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_VIDEO_CMSGAMMAMODE, std::to_string(CMS_TRC_BT1886), SettingDependencyOperator::Equals, true, GetSettingsManager())));
  SettingDependencies depsCmsGamma;
  depsCmsGamma.push_back(dependencyCmsEnabled);
  depsCmsGamma.push_back(dependencyCmsIcc);
  depsCmsGamma.push_back(dependencyCmsGamma);

  // color management settings
  AddToggle(groupColorManagement, SETTING_VIDEO_CMSENABLE, 36560, SettingLevel::Basic, CServiceBroker::GetSettings().GetBool(SETTING_VIDEO_CMSENABLE));

  int currentMode = CServiceBroker::GetSettings().GetInt(SETTING_VIDEO_CMSMODE);
  entries.clear();
  // entries.push_back(std::make_pair(16039, CMS_MODE_OFF)); // FIXME: get from CMS class
  entries.push_back(std::make_pair(36580, CMS_MODE_3DLUT));
#ifdef HAVE_LCMS2
  entries.push_back(std::make_pair(36581, CMS_MODE_PROFILE));
#endif
  std::shared_ptr<CSettingInt> settingCmsMode = AddSpinner(groupColorManagement, SETTING_VIDEO_CMSMODE, 36562, SettingLevel::Basic, currentMode, entries);
  settingCmsMode->SetDependencies(depsCmsEnabled);

  std::string current3dLUT = CServiceBroker::GetSettings().GetString(SETTING_VIDEO_CMS3DLUT);
  std::shared_ptr<CSettingString> settingCms3dlut = AddList(groupColorManagement, SETTING_VIDEO_CMS3DLUT, 36564, SettingLevel::Basic, current3dLUT, Cms3dLutsFiller, 36564);
  settingCms3dlut->SetDependencies(depsCms3dlut);

  // display settings
  int currentWhitepoint = CServiceBroker::GetSettings().GetInt(SETTING_VIDEO_CMSWHITEPOINT);
  entries.clear();
  entries.push_back(std::make_pair(36586, CMS_WHITEPOINT_D65));
  entries.push_back(std::make_pair(36587, CMS_WHITEPOINT_D93));
  std::shared_ptr<CSettingInt> settingCmsWhitepoint = AddSpinner(groupColorManagement, SETTING_VIDEO_CMSWHITEPOINT, 36568, SettingLevel::Basic, currentWhitepoint, entries);
  settingCmsWhitepoint->SetDependencies(depsCmsIcc);

  int currentPrimaries = CServiceBroker::GetSettings().GetInt(SETTING_VIDEO_CMSPRIMARIES);
  entries.clear();
  entries.push_back(std::make_pair(36588, CMS_PRIMARIES_AUTO));
  entries.push_back(std::make_pair(36589, CMS_PRIMARIES_BT709));
  entries.push_back(std::make_pair(36579, CMS_PRIMARIES_BT2020));
  entries.push_back(std::make_pair(36590, CMS_PRIMARIES_170M));
  entries.push_back(std::make_pair(36591, CMS_PRIMARIES_BT470M));
  entries.push_back(std::make_pair(36592, CMS_PRIMARIES_BT470BG));
  entries.push_back(std::make_pair(36593, CMS_PRIMARIES_240M));
  std::shared_ptr<CSettingInt> settingCmsPrimaries = AddSpinner(groupColorManagement, SETTING_VIDEO_CMSPRIMARIES, 36570, SettingLevel::Basic, currentPrimaries, entries);
  settingCmsPrimaries->SetDependencies(depsCmsIcc);

  int currentGammaMode = CServiceBroker::GetSettings().GetInt(SETTING_VIDEO_CMSGAMMAMODE);
  entries.clear();
  entries.push_back(std::make_pair(36582, CMS_TRC_BT1886));
  entries.push_back(std::make_pair(36583, CMS_TRC_INPUT_OFFSET));
  entries.push_back(std::make_pair(36584, CMS_TRC_OUTPUT_OFFSET));
  entries.push_back(std::make_pair(36585, CMS_TRC_ABSOLUTE));
  std::shared_ptr<CSettingInt> settingCmsGammaMode = AddSpinner(groupColorManagement, SETTING_VIDEO_CMSGAMMAMODE, 36572, SettingLevel::Basic, currentGammaMode, entries);
  settingCmsGammaMode->SetDependencies(depsCmsIcc);

  float currentGamma = CServiceBroker::GetSettings().GetInt(SETTING_VIDEO_CMSGAMMA)/100.0f;
  if (currentGamma == 0.0) currentGamma = 2.20;
  std::shared_ptr<CSettingNumber> settingCmsGamma = AddSlider(groupColorManagement, SETTING_VIDEO_CMSGAMMA, 36574, SettingLevel::Basic, currentGamma, 36597, 1.6, 0.05, 2.8, 36574, usePopup);
  settingCmsGamma->SetDependencies(depsCmsGamma);

  int currentLutSize = CServiceBroker::GetSettings().GetInt(SETTING_VIDEO_CMSLUTSIZE);
  entries.clear();
  entries.push_back(std::make_pair(36594, 4));
  entries.push_back(std::make_pair(36595, 6));
  entries.push_back(std::make_pair(36596, 8));
  std::shared_ptr<CSettingInt> settingCmsLutSize = AddSpinner(groupColorManagement, SETTING_VIDEO_CMSLUTSIZE, 36576, SettingLevel::Basic, currentLutSize, entries);
  settingCmsLutSize->SetDependencies(depsCmsIcc);
}
Exemplo n.º 9
0
	//167, 416
iwWares::iwWares(unsigned int id, unsigned short x , unsigned short y, 
				 const unsigned short width, const unsigned short height,
				 const std::string& title, unsigned char page_count,
		bool allow_outhousing, glArchivItem_Font *font, const Goods *inventory)
	: IngameWindow(id, x, y, width, height, title, LOADER.GetImageN("io", 5)),
	inventory(inventory), page(0), page_count(page_count)
{
	if(!font)
		font = SmallFont;

	// Zuordnungs-IDs
	const unsigned short INVENTORY_IDS[2][31] =
	{
		{ // Waren
			22, 23, 24, 33,
			27, 18, 19, 32, 20,
			11,  0, 31, 30,
			29, 17, 28,  1,  3,
			 4,  5,  2,  6,
			 7,  8,  9, 12, 13,
			14, 16, GD_SHIELDROMANS, 15
		}, // GD_SHIELDROMANS = Völkerspezifisches Schild

		{ // Figuren
			 0, 19, 20,  1,
			 3,  5,  2,  6,  4,
			 7, 13, 14,  8,
			 9, 10, 12, 11, 15,
			18, 16, 17, 27,
			26, 28, 29, JOB_CHARBURNER, 21, 
			22, 23, 24, 25
		}, // 0xFFFF = unused
	};

	static const unsigned short shield_INVENTORY_IDS[4] = {GD_SHIELDAFRICANS, GD_SHIELDJAPANESE, GD_SHIELDROMANS, GD_SHIELDVIKINGS };

	// Warenseite hinzufügen
	ctrlGroup *wares = AddGroup(100);
	// Figurenseite hinzufügen
	ctrlGroup *figures = AddGroup(101);

	GameClientPlayer *player = GAMECLIENT.GetLocalPlayer();
	bool four = true;
	unsigned short ware_id = 0;
	for(int x = 0, y = 0; y < 7; ++x, ++ware_id)
	{
		// 4er und 5er Block abwechselnd
		if(x >= (four ? 4 : 5))
		{
			x = 0;
			++y;
			if(y == 7)
				continue;

			four = !four;
		}


		// Hintergrundbutton oder -bild hinter Ware, nur beim Auslagern ein Button
		if(allow_outhousing)
		{
			ctrlButton * b =wares->AddImageButton(100+INVENTORY_IDS[0][ware_id], (four ? 27 : 13)+x*28, 21+y*42, 26, 26, TC_GREY, LOADER.GetMapImageN(2298), _(WARE_NAMES[INVENTORY_IDS[0][ware_id]]));
			b->SetBorder(false);
		}
		else
			wares->AddImage(100+INVENTORY_IDS[0][ware_id], (four ? 27 : 13)+x*28+13, 21+y*42+13, LOADER.GetMapImageN(2298), _(WARE_NAMES[INVENTORY_IDS[0][ware_id]]));

		if(INVENTORY_IDS[1][ware_id] != 0xFFFF)
		{
			if(allow_outhousing)
			{
				ctrlButton * b = figures->AddImageButton(100+INVENTORY_IDS[1][ware_id], (four ? 27 : 13)+x*28, 21+y*42, 26, 26, TC_GREY, LOADER.GetMapImageN(2298), _(JOB_NAMES[INVENTORY_IDS[1][ware_id]]));
				b->SetBorder(false);
			}
			else
			{
				
				figures->AddImage(100+INVENTORY_IDS[1][ware_id], (four ? 27 : 13)+x*28+13, 21+y*42+13, LOADER.GetMapImageN(2298),_(JOB_NAMES[INVENTORY_IDS[1][ware_id]]));
			}
		}

		// Hintergrundbild hinter Anzahl
		wares->AddImage(200+INVENTORY_IDS[0][ware_id], (four ? 40 : 26)+x*28, 53+y*42, LOADER.GetMapImageN(2299));
		if(INVENTORY_IDS[1][ware_id] != 0xFFFF)
			figures->AddImage(200+INVENTORY_IDS[1][ware_id], (four ? 40 : 26)+x*28, 53+y*42, LOADER.GetMapImageN(2299));

		// die jeweilige Ware
		wares->AddImage(300+INVENTORY_IDS[0][ware_id], (four ? 40 : 26)+x*28, 34+y*42, LOADER.GetMapImageN(2250 + (INVENTORY_IDS[0][ware_id] == GD_SHIELDROMANS ? shield_INVENTORY_IDS[player->nation] : INVENTORY_IDS[0][ware_id])));
		if(INVENTORY_IDS[1][ware_id] != 0xFFFF)
		{
			glArchivItem_Bitmap * image;
			// Exception: charburner
			if(INVENTORY_IDS[1][ware_id] != JOB_CHARBURNER)
				image = LOADER.GetMapImageN(2300 + INVENTORY_IDS[1][ware_id]);
			else
				image = LOADER.GetImageN("charburner",51);

			figures->AddImage(300+INVENTORY_IDS[1][ware_id], (four ? 40 : 26)+x*28, 34+y*42, image);
		}

		// Overlay für "Nicht Einlagern"
		
		ctrlImage *image = wares->AddImage(400+INVENTORY_IDS[0][ware_id], (four ? 40 : 26)+x*28, 30+y*42, LOADER.GetImageN("io", 222));
		image->SetVisible(false);
		if(INVENTORY_IDS[1][ware_id] != 0xFFFF)
		{
			image = figures->AddImage(400+INVENTORY_IDS[1][ware_id], (four ? 40 : 26)+x*28, 30+y*42, LOADER.GetImageN("io", 222));
			image->SetVisible(false);
		}

		// Overlay für "Auslagern"
		image = wares->AddImage(500+INVENTORY_IDS[0][ware_id], (four ? 40 : 26)+x*28, 44+y*42, LOADER.GetImageN("io", 221));
		image->SetVisible(false);
		if(INVENTORY_IDS[1][ware_id] != 0xFFFF)
		{
			image = figures->AddImage(500+INVENTORY_IDS[1][ware_id], (four ? 40 : 26)+x*28, 44+y*42, LOADER.GetImageN("io", 221));
			image->SetVisible(false);
		}

		// die jeweilige Anzahl (Texte)
		wares->AddVarText(600+INVENTORY_IDS[0][ware_id], (four ? 53 : 39)+x*28, 61+y*42, _("%d"), COLOR_YELLOW,
			glArchivItem_Font::DF_BOTTOM | glArchivItem_Font::DF_RIGHT, font, 1,
			&inventory->goods[INVENTORY_IDS[0][ware_id]]);
		if(INVENTORY_IDS[1][ware_id] != 0xFFFF)
			figures->AddVarText(600+INVENTORY_IDS[1][ware_id], (four ? 53 : 39)+x*28, 61+y*42, _("%d"), COLOR_YELLOW, 
			glArchivItem_Font::DF_BOTTOM | glArchivItem_Font::DF_RIGHT, font, 1,
			&inventory->people[INVENTORY_IDS[1][ware_id]]);

		// Overlay für "Einlagern"
		image = wares->AddImage(700+INVENTORY_IDS[0][ware_id], (four ? 40 : 26)+x*28, 44+y*42, LOADER.GetImageN("io_new", 3));
		image->SetVisible(false);
		if(INVENTORY_IDS[1][ware_id] != 0xFFFF)
		{
			image = figures->AddImage(700+INVENTORY_IDS[1][ware_id], (four ? 40 : 26)+x*28, 44+y*42, LOADER.GetImageN("io_new", 3));
			image->SetVisible(false);
		}
	}

	wares->SetVisible(true);
	figures->SetVisible(false);

	// "Blättern"
	AddImageButton(0, 52, height-47, 66, 32, TC_GREY, LOADER.GetImageN("io", 84), _("Next page"));
	// Hilfe
	AddImageButton(12,  16, height-47, 32, 32,TC_GREY, LOADER.GetImageN("io", 21), _("Help"));
}
Exemplo n.º 10
0
int readOBJ(struct OBJ_Model * obj)
{

  if (obj->filename == 0 ) { fprintf(stderr,"readOBJ called with a null filename , cannot continue \n"); return 0; }
  /* Read the .obj model from file FILENAME */
  /* All faces are converted to be triangles */
  FILE *file=0;
  char buf[128];
  char buf1[128];
  unsigned int wrongDecimalSeperatorBug=0;
  long unsigned int    numvertices;		/* number of vertices in model */
  long unsigned int    numnormals;                 /* number of normals in model */
  long unsigned int    numcolors;
  long unsigned int    numtexs;                 /* number of normals in texture coordintaes */
  long unsigned int    numfaces;			/* number of faces in model */
  long unsigned int    numgroups;			/* number of groups in model */
  GLuint cur_group,material, mat;
  long unsigned int v,n,t,i;
  int grp;

  fprintf(stderr,"TODO : proper string allocation here for filename %s \n",obj->filename);
  char fname[2*MAX_MODEL_PATHS+1]={0};
  snprintf(fname,2*MAX_MODEL_PATHS,"%s/%s.obj",obj->directory , obj->filename);

  fprintf(stderr,"Opening File %s ..\n",fname);
  file=fopen(fname,"r");
  if(file==0) { fprintf(stderr,"Could not open file %s for reading Object\n",fname); return 0;  }
 // strcpy(name,filename);
  strcpy(obj->matLib,"");
  //Group Pass
  rewind(file);
  numgroups = 1;
  while(fscanf(file, "%s", buf) != EOF)
  {
	  if(buf[0]=='g')
		  numgroups++;
	  else
		  fgets(buf, sizeof(buf), file); // eat up rest of line
  }
  if(numgroups==0) { numgroups=1; }
  obj->groups = (Group*) malloc(sizeof(Group)* numgroups);
  if (obj->groups == 0) { fprintf(stderr,"Could not make enough space for %lu groups \n",numgroups); fclose(file); return 0; }
  obj->numGroups = 0;
  obj->numFaces =0;

  // 1st Pass
  rewind(file);
  numtexs = 0;
  numvertices = 0;
  numnormals = 0;
  numcolors = 0;
  numfaces = 0;
  cur_group = AddGroup(obj,"default");
  obj->groups[0].material=0;
  while(fscanf(file, "%s", buf) != EOF)
  {

	  if(strcmp(buf, "mtllib")==0)
	  {
		  fscanf(file, "%s", buf1);
		  strcpy(obj->matLib,  buf1);
		  loadMTL(obj,obj->directory ,buf1);
		  printf("loadmtl %s survived\n", obj->matLib);
	  }
    switch(buf[0])
    {
    case '#':	fgets(buf, sizeof(buf), file);	 break;		// comment   eat up rest of line

    // v, vn, vt
    case 'v':
               switch(buf[1])
               {
                  case '\0': // vertex  eat up rest of line
	                         fgets(buf, sizeof(buf), file);
	                         numvertices++;
	                         if (floatingPointCheck(buf,strlen(buf)) ) { ++wrongDecimalSeperatorBug; }
	                         if (countChar(buf,strlen(buf),' ',buf[1])==6) { numcolors++ ; } //meshlab extension for colors on obj files
	              break;
                  case 'n': // normal  eat up rest of line
	                         fgets(buf, sizeof(buf), file);
	                         numnormals++;
                  break;
                  case 't':	//texture coordinate  eat up rest of line
	                         fgets(buf, sizeof(buf), file);
	                         numtexs ++;
	              break;
                  default:
	                         fprintf(stderr,"Unexpected characters  ( \"%s\" ) while waiting for v, vn ,vt .\n", buf);
	                         return 0;
	              break;
                }
     break;

     case 'm': fgets(buf, sizeof(buf), file);  break;
     case 'u': fgets(buf, sizeof(buf), file);  break;// eat up rest of line

     case 'g': //group eat up rest of line
               fgets(buf, sizeof(buf), file);
               sscanf(buf, "%s", buf);
	           cur_group = AddGroup(obj,buf);
     break;

     case 'f':	// face
                v =0; n = 0; t = 0;
                fscanf(file, "%s", buf); // can be one of %d, %d//%d, %d/%d, %d/%d/%d
                if (strstr(buf, "//"))
                  { //        v//n
	                sscanf(buf, "%d//%d", &v, &n);
	                fscanf(file, "%d//%d", &v, &n);
	                fscanf(file, "%d//%d", &v, &n);
	                obj->numFaces++;
	                while(fscanf(file, "%d//%d", &v, &n) > 0) { obj->numFaces++; }
	              } else
                if (sscanf(buf, "%d/%d/%d", &v, &t, &n) == 3)
                  { //        v/t/n
	                fscanf(file, "%d/%d/%d", &v, &t, &n);
	                fscanf(file, "%d/%d/%d", &v, &t, &n);
	                obj->numFaces++;
	                while(fscanf(file, "%d/%d/%d", &v, &t, &n) > 0) { obj->numFaces++; }
	               } else
                if (sscanf(buf, "%d/%d", &v, &t) == 2)
                  { //        v/t
	                fscanf(file, "%d/%d", &v, &t);
	                fscanf(file, "%d/%d", &v, &t);
	                obj->numFaces++;
	                while(fscanf(file, "%d/%d", &v, &t) > 0) { obj->numFaces++; }
	              } else
	              { //        v
	                fscanf(file, "%d", &v);
	                fscanf(file, "%d", &v);
	                obj->numFaces++;
	                while(fscanf(file, "%d", &v) > 0)  { obj->numFaces++; }
	              }
      break; //end of face case

    default: fgets(buf, sizeof(buf), file); break; // eat up rest of line


    }
  }





  // set the stats in the model structure
  obj->numVertices  = numvertices;
  obj->numNormals   = numnormals;
  obj->numTexs = numtexs;
  obj->numColors = numcolors;

  printf("Vertices : %ld\n",obj->numVertices);
  printf("Normals  : %ld\n",obj->numNormals);
  printf("Faces    : %ld\n",obj->numFaces);
  printf("Groups   : %ld\n",obj->numGroups);
  printf("Texes   : %ld\n",obj->numTexs);
  printf("Colors   : %ld\n",obj->numColors);

  if (wrongDecimalSeperatorBug)
  {
      fprintf(stderr,RED "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !\n");
      fprintf(stderr,RED "\n\n\n\nThis OBJ file has a wrong seperator for floating point numbers \n");
      fprintf(stderr,"         please use    sed -i 's/,/./g' %s         \n\n\n" NORMAL,obj->filename);
      fprintf(stderr,RED "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !\n");
  }

  for(i=0; i<obj->numGroups; i++)
  {
	  obj->groups[i].numFaces=0;
	  printf("%d\n", obj->groups[i].hasNormals);//0, 0
  }

  // Allocating memory
  fprintf(stderr,"Allocating memory for faces\n");
  obj->faceList = (Face*) malloc(sizeof(Face)*(obj->numFaces+2));
  if (obj->faceList == 0) { fprintf(stderr,"Could not allocate enough memory for face struct\n"); }
  memset (obj->faceList,0,sizeof(Face)*(obj->numFaces+2));

  fprintf(stderr,"Allocating memory for vertices\n");
  obj->vertexList = (Vertex*) malloc(sizeof(Vertex)*(obj->numVertices+2));
  if (obj->vertexList == 0) { fprintf(stderr,"Could not allocate enough memory for vertex struct\n"); }
  memset (obj->vertexList,0,sizeof(Vertex)*(obj->numVertices+2));

  if(obj->numNormals!=0)
  {
    fprintf(stderr,"Allocating memory for normals\n");
    obj->normalList=(Normal*)malloc(sizeof(Normal)*(obj->numNormals+2));
    if (obj->normalList == 0) { fprintf(stderr,"Could not allocate enough memory for normal struct\n"); }
    memset (obj->normalList,0,sizeof(Normal)*(obj->numNormals+2));
  }

  if(obj->numTexs!=0)
  {
    fprintf(stderr,"Allocating memory for textures\n");
    obj->texList=(TexCoords*)malloc(sizeof(TexCoords)*(obj->numTexs+2));
    if (obj->texList == 0) { fprintf(stderr,"Could not allocate enough memory for texture struct\n"); }
    memset (obj->texList,0,sizeof(TexCoords)*(obj->numTexs+2));
  }


  if(obj->numColors!=0)
  {
    fprintf(stderr,"Allocating memory for colors\n");
    obj->colorList=(RGBColors*)malloc(sizeof(RGBColors)*(obj->numColors+2));
    if (obj->colorList == 0) { fprintf(stderr,"Could not allocate enough memory for colors struct\n"); }
    memset (obj->colorList,0,sizeof(RGBColors)*(obj->numColors+2));
  }

  // Second Pass
  rewind(file);

  //These dont work if they become 0 :P
  obj->numVertices = 1;
  obj->numNormals = 1;
  obj->numTexs = 1;
  obj->numColors = 1;
  obj->customColor =( obj->numColors > 0 );
  obj->numFaces = 0;
  material = 0;
  grp = 0;

  while(!feof(file))
  {
    fscanf(file, "%s", buf);

	if(!strcmp(buf, "usemtl"))
	{
		  fscanf(file, "%s", buf1);
		  unsigned int foundMaterial;
		  if ( FindMaterial( obj, buf1 , &foundMaterial) )
          {
		    mat = foundMaterial;
		    obj->groups[grp].material = mat;
		    strcpy(obj->matLib, buf1);
		    printf("loadmtl %s\n", obj->matLib);
          }
    }
	switch(buf[0])
	{
      case '#':	fgets(buf, sizeof(buf), file);	break;		// comment  eat up rest of line

      case 'v':	 // v, vn, vt
                  switch(buf[1])
                  {
                       case '\0': //  vertex
                                  if ( obj->customColor )
                                    {
	                                 fscanf(file, "%f %f %f %f %f %f",
	                                 &obj->vertexList[obj->numVertices].x,
	                                 &obj->vertexList[obj->numVertices].y,
	                                 &obj->vertexList[obj->numVertices].z,
	                                 &obj->colorList[obj->numColors].r,
	                                 &obj->colorList[obj->numColors].g,
	                                 &obj->colorList[obj->numColors].b
	                                 );

	                                  obj->numVertices++;
	                                  obj->numColors++;

                                    } else
                                    {
	                                 fscanf(file, "%f %f %f",
	                                 &obj->vertexList[obj->numVertices].x,
	                                 &obj->vertexList[obj->numVertices].y,
	                                 &obj->vertexList[obj->numVertices].z);
	                                 obj->numVertices++;
                                    }


	                   break;
                       case 'n': // normal
	                             fscanf(file, "%f %f %f",
	                             &obj->normalList[obj->numNormals].n1,
	                             &obj->normalList[obj->numNormals].n2,
	                             &obj->normalList[obj->numNormals].n3);
	                             obj->numNormals++;
	                   break;

	                   case 't': // normal
	                             fscanf(file, "%f %f",
	                             &obj->texList[obj->numTexs].u,
	                             &obj->texList[obj->numTexs].v);
	                             obj->numTexs++;
	                   break;
                  }
      break;

      case 'u': fgets(buf, sizeof(buf), file);  break; // eat up rest of line

      case 'g': // group eat up rest of line
                fgets(buf, sizeof(buf), file);
	            sscanf(buf, "%s", buf);
	            grp = FindGroup(obj,buf);
                obj->groups[grp].material = material;
	  break;

      case 'f': //face
                v = 0;  n = 0; t = 0;
                fscanf(file, "%s", buf);
                // can be one of %d, %d//%d, %d/%d, %d/%d/%d
                if (strstr(buf, "//"))
                { //  v//n
	              sscanf(buf, "%d//%d", &v, &n);
	              obj->faceList[obj->numFaces].v[0] = v;
	              obj->faceList[obj->numFaces].n[0] = n;
	              fscanf(file, "%d//%d", &v, &n);
	              obj->faceList[obj->numFaces].v[1] = v;
	              obj->faceList[obj->numFaces].n[1] = n;
	              fscanf(file, "%d//%d", &v, &n);
	              obj->faceList[obj->numFaces].v[2] = v;
	              obj->faceList[obj->numFaces].n[2] = n;
	              AddFacetoG(&obj->groups[grp],obj->numFaces);
	              obj->numFaces++;
	              obj->groups[grp].hasNormals = 1;
	              obj->groups[grp].hasTex = 0;
	              while(fscanf(file, "%d//%d", &v, &n) > 0)
	               {
	                 obj->faceList[obj->numFaces].v[0] = obj->faceList[obj->numFaces-1].v[0];
	                 obj->faceList[obj->numFaces].n[0] = obj->faceList[obj->numFaces-1].n[0];
	                 obj->faceList[obj->numFaces].v[1] = obj->faceList[obj->numFaces-1].v[2];
	                 obj->faceList[obj->numFaces].n[1] = obj->faceList[obj->numFaces-1].n[2];
	                 obj->faceList[obj->numFaces].v[2] = v;
	                 obj->faceList[obj->numFaces].n[2] = n;
	                 AddFacetoG(&obj->groups[grp],obj->numFaces);
	                 obj->numFaces++;
	               }
	             } else
	             if (sscanf(buf, "%d/%d/%d", &v, &t, &n) == 3)
	             { // v/t/n
	                obj->faceList[obj->numFaces].v[0] = v;
	                obj->faceList[obj->numFaces].n[0] = n;
	                obj->faceList[obj->numFaces].t[0] = t;
	                fscanf(file, "%d/%d/%d", &v, &t, &n);
	                obj->faceList[obj->numFaces].v[1] = v;
	                obj->faceList[obj->numFaces].n[1] = n;
	                obj->faceList[obj->numFaces].t[1] = t;
	                fscanf(file, "%d/%d/%d", &v, &t, &n);
	                obj->faceList[obj->numFaces].v[2] = v;
	                obj->faceList[obj->numFaces].n[2] = n;
	                obj->faceList[obj->numFaces].t[2] = t;
	                AddFacetoG(&obj->groups[grp],obj->numFaces);
	                obj->numFaces++;
	                obj->groups[grp].hasNormals = 1;
	                obj->groups[grp].hasTex = 1;

	                while(fscanf(file, "%d/%d/%d", &v, &t, &n) > 0)
	                  {
	                    obj->faceList[obj->numFaces].v[0] = obj->faceList[obj->numFaces-1].v[0];
	                    obj->faceList[obj->numFaces].n[0] = obj->faceList[obj->numFaces-1].n[0];
	                    obj->faceList[obj->numFaces].t[0] = obj->faceList[obj->numFaces-1].t[0];
	                    obj->faceList[obj->numFaces].v[1] = obj->faceList[obj->numFaces-1].v[2];
	                    obj->faceList[obj->numFaces].n[1] = obj->faceList[obj->numFaces-1].n[2];
	                    obj->faceList[obj->numFaces].t[1] = obj->faceList[obj->numFaces-1].t[2];
	                    obj->faceList[obj->numFaces].v[2] = v;
	                    obj->faceList[obj->numFaces].n[2] = n;
	                    obj->faceList[obj->numFaces].t[2] = t;
	                    AddFacetoG(&obj->groups[grp],obj->numFaces);
	                    obj->numFaces++;
	                  }
                } else
                if (sscanf(buf, "%d/%d", &v, &t) == 2)
                { // v/t
		          obj->groups[grp].hasTex = 1;
		          obj->faceList[obj->numFaces].v[0] = v;
		          obj->faceList[obj->numFaces].t[0] = t;
		          fscanf(file, "%d/%d", &v, &t);
		          obj->faceList[obj->numFaces].v[1] = v;
		          obj->faceList[obj->numFaces].t[1] = t;
		          fscanf(file, "%d/%d", &v, &t);
		          obj->faceList[obj->numFaces].v[2] = v;
		          obj->faceList[obj->numFaces].t[2] = t;
		          AddFacetoG(&obj->groups[grp],obj->numFaces);
		          obj->numFaces++;
		          while(fscanf(file, "%d/%d", &v, &t) > 0)
		          {
	  	           obj->faceList[obj->numFaces].v[0] = obj->faceList[obj->numFaces-1].v[0];
	  	           obj->faceList[obj->numFaces].t[0] = obj->faceList[obj->numFaces-1].t[0];
	  	           obj->faceList[obj->numFaces].v[1] = obj->faceList[obj->numFaces-1].v[2];
	  	           obj->faceList[obj->numFaces].t[1] = obj->faceList[obj->numFaces-1].t[2];
	  	           obj->faceList[obj->numFaces].v[2] = v;
	  	           obj->faceList[obj->numFaces].t[2] = t;
	  	           AddFacetoG(&obj->groups[grp],obj->numFaces);
	  	           obj->numFaces++;
		          }//while
               } else
               { // v
	             sscanf(buf, "%d", &v);
	             obj->faceList[obj->numFaces].v[0] = v;
	             fscanf(file, "%d", &v);
	             obj->faceList[obj->numFaces].v[1] = v;
	             fscanf(file, "%d", &v);
	             obj->faceList[obj->numFaces].v[2] = v;
	             obj->groups[grp].hasNormals = 0;
	             obj->groups[grp].hasTex = 0;
	             AddFacetoG(&obj->groups[grp],obj->numFaces);
	             obj->numFaces++;
	             while(fscanf(file, "%d", &v) == 1)
	              {
	               obj->faceList[obj->numFaces].v[0] = obj->faceList[obj->numFaces-1].v[0];
	               obj->faceList[obj->numFaces].v[1] = obj->faceList[obj->numFaces-1].v[2];
	               obj->faceList[obj->numFaces].v[2] = v;
	               AddFacetoG(&obj->groups[grp],obj->numFaces);
	               obj->numFaces++;
	              }
                }
      break;

     default: fgets(buf, sizeof(buf), file); break; // eat up rest of line
    }
  }
  fclose(file);
  printf("Model has %ld faces %u colors \n",obj->numFaces, obj->numColors);
  for(i=0; i<obj->numGroups; i++)
  {
	 // fprintf(stderr,"Group %s has %ld faces and material %s, \t \n",obj->groups[i].name,obj->groups[i].numFaces,obj->matList[obj->groups[i].material].name);
  }


#if CALCULATE_3D_BOUNDING_BOX
  calculateOBJBBox(obj);
#endif // CALCULATE_3D_BOUNDING_BOX

 return 1;
}
Exemplo n.º 11
0
void CGUIDialogVideoSettings::InitializeSettings()
{
  CGUIDialogSettingsManualBase::InitializeSettings();

  const std::shared_ptr<CSettingCategory> category = AddCategory("videosettings", -1);
  if (category == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }

  // get all necessary setting groups
  const std::shared_ptr<CSettingGroup> groupVideoStream = AddGroup(category);
  if (groupVideoStream == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }
  const std::shared_ptr<CSettingGroup> groupVideo = AddGroup(category);
  if (groupVideo == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }
  const std::shared_ptr<CSettingGroup> groupVideoPlayback = AddGroup(category);
  if (groupVideoPlayback == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }
  const std::shared_ptr<CSettingGroup> groupStereoscopic = AddGroup(category);
  if (groupStereoscopic == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }
  const std::shared_ptr<CSettingGroup> groupSaveAsDefault = AddGroup(category);
  if (groupSaveAsDefault == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogVideoSettings: unable to setup settings");
    return;
  }

  bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml");

  const CVideoSettings videoSettings = g_application.GetAppPlayer().GetVideoSettings();

  TranslatableIntegerSettingOptions entries;

  entries.clear();
  entries.push_back(std::make_pair(16039, VS_INTERLACEMETHOD_NONE));
  entries.push_back(std::make_pair(16019, VS_INTERLACEMETHOD_AUTO));
  entries.push_back(std::make_pair(20131, VS_INTERLACEMETHOD_RENDER_BLEND));
  entries.push_back(std::make_pair(20129, VS_INTERLACEMETHOD_RENDER_WEAVE));
  entries.push_back(std::make_pair(16021, VS_INTERLACEMETHOD_RENDER_BOB));
  entries.push_back(std::make_pair(16020, VS_INTERLACEMETHOD_DEINTERLACE));
  entries.push_back(std::make_pair(16036, VS_INTERLACEMETHOD_DEINTERLACE_HALF));
  entries.push_back(std::make_pair(16311, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL));
  entries.push_back(std::make_pair(16310, VS_INTERLACEMETHOD_VDPAU_TEMPORAL));
  entries.push_back(std::make_pair(16325, VS_INTERLACEMETHOD_VDPAU_BOB));
  entries.push_back(std::make_pair(16318, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF));
  entries.push_back(std::make_pair(16317, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF));
  entries.push_back(std::make_pair(16327, VS_INTERLACEMETHOD_VAAPI_BOB));
  entries.push_back(std::make_pair(16328, VS_INTERLACEMETHOD_VAAPI_MADI));
  entries.push_back(std::make_pair(16329, VS_INTERLACEMETHOD_VAAPI_MACI));
  entries.push_back(std::make_pair(16330, VS_INTERLACEMETHOD_MMAL_ADVANCED));
  entries.push_back(std::make_pair(16331, VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF));
  entries.push_back(std::make_pair(16332, VS_INTERLACEMETHOD_MMAL_BOB));
  entries.push_back(std::make_pair(16333, VS_INTERLACEMETHOD_MMAL_BOB_HALF));
  entries.push_back(std::make_pair(16320, VS_INTERLACEMETHOD_DXVA_AUTO));

  /* remove unsupported methods */
  for (TranslatableIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); )
  {
    if (g_application.GetAppPlayer().Supports((EINTERLACEMETHOD)it->second))
      ++it;
    else
      it = entries.erase(it);
  }

  if (!entries.empty())
  {
    EINTERLACEMETHOD method = videoSettings.m_InterlaceMethod;
    if (!g_application.GetAppPlayer().Supports(method))
    {
      method = g_application.GetAppPlayer().GetDeinterlacingMethodDefault();
    }
    AddSpinner(groupVideo, SETTING_VIDEO_INTERLACEMETHOD, 16038, SettingLevel::Basic, static_cast<int>(method), entries);
  }

  entries.clear();
  entries.push_back(std::make_pair(16301, VS_SCALINGMETHOD_NEAREST));
  entries.push_back(std::make_pair(16302, VS_SCALINGMETHOD_LINEAR));
  entries.push_back(std::make_pair(16303, VS_SCALINGMETHOD_CUBIC ));
  entries.push_back(std::make_pair(16304, VS_SCALINGMETHOD_LANCZOS2));
  entries.push_back(std::make_pair(16323, VS_SCALINGMETHOD_SPLINE36_FAST));
  entries.push_back(std::make_pair(16315, VS_SCALINGMETHOD_LANCZOS3_FAST));
  entries.push_back(std::make_pair(16322, VS_SCALINGMETHOD_SPLINE36));
  entries.push_back(std::make_pair(16305, VS_SCALINGMETHOD_LANCZOS3));
  entries.push_back(std::make_pair(16306, VS_SCALINGMETHOD_SINC8));
//  entries.push_back(make_pair(?????, VS_SCALINGMETHOD_NEDI));
  entries.push_back(std::make_pair(16307, VS_SCALINGMETHOD_BICUBIC_SOFTWARE));
  entries.push_back(std::make_pair(16308, VS_SCALINGMETHOD_LANCZOS_SOFTWARE));
  entries.push_back(std::make_pair(16309, VS_SCALINGMETHOD_SINC_SOFTWARE));
  entries.push_back(std::make_pair(13120, VS_SCALINGMETHOD_VDPAU_HARDWARE));
  entries.push_back(std::make_pair(16319, VS_SCALINGMETHOD_DXVA_HARDWARE));
  entries.push_back(std::make_pair(16316, VS_SCALINGMETHOD_AUTO));

  /* remove unsupported methods */
  for(TranslatableIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); )
  {
    if (g_application.GetAppPlayer().Supports((ESCALINGMETHOD)it->second))
      ++it;
    else
      it = entries.erase(it);
  }

  AddSpinner(groupVideo, SETTING_VIDEO_SCALINGMETHOD, 16300, SettingLevel::Basic, static_cast<int>(videoSettings.m_ScalingMethod), entries);

  AddVideoStreams(groupVideoStream, SETTING_VIDEO_STREAM);

  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_STRETCH) || g_application.GetAppPlayer().Supports(RENDERFEATURE_PIXEL_RATIO))
  {
    AddList(groupVideo, SETTING_VIDEO_VIEW_MODE, 629, SettingLevel::Basic, videoSettings.m_ViewMode, CViewModeSettings::ViewModesFiller, 629);
  }
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_ZOOM))
    AddSlider(groupVideo, SETTING_VIDEO_ZOOM, 216, SettingLevel::Basic, videoSettings.m_CustomZoomAmount, "%2.2f", 0.5f, 0.01f, 2.0f, 216, usePopup);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_VERTICAL_SHIFT))
    AddSlider(groupVideo, SETTING_VIDEO_VERTICAL_SHIFT, 225, SettingLevel::Basic, videoSettings.m_CustomVerticalShift, "%2.2f", -2.0f, 0.01f, 2.0f, 225, usePopup);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_PIXEL_RATIO))
    AddSlider(groupVideo, SETTING_VIDEO_PIXEL_RATIO, 217, SettingLevel::Basic, videoSettings.m_CustomPixelRatio, "%2.2f", 0.5f, 0.01f, 2.0f, 217, usePopup);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_POSTPROCESS))
    AddToggle(groupVideo, SETTING_VIDEO_POSTPROCESS, 16400, SettingLevel::Basic, videoSettings.m_PostProcess);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_BRIGHTNESS))
    AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_BRIGHTNESS, 464, SettingLevel::Basic, static_cast<int>(videoSettings.m_Brightness), 14047, 1, 464, usePopup);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_CONTRAST))
    AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_CONTRAST, 465, SettingLevel::Basic, static_cast<int>(videoSettings.m_Contrast), 14047, 1, 465, usePopup);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_GAMMA))
    AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_GAMMA, 466, SettingLevel::Basic, static_cast<int>(videoSettings.m_Gamma), 14047, 1, 466, usePopup);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_NOISE))
    AddSlider(groupVideoPlayback, SETTING_VIDEO_VDPAU_NOISE, 16312, SettingLevel::Basic, videoSettings.m_NoiseReduction, "%2.2f", 0.0f, 0.01f, 1.0f, 16312, usePopup);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_SHARPNESS))
    AddSlider(groupVideoPlayback, SETTING_VIDEO_VDPAU_SHARPNESS, 16313, SettingLevel::Basic, videoSettings.m_Sharpness, "%2.2f", -1.0f, 0.02f, 1.0f, 16313, usePopup);
  if (g_application.GetAppPlayer().Supports(RENDERFEATURE_NONLINSTRETCH))
    AddToggle(groupVideoPlayback, SETTING_VIDEO_NONLIN_STRETCH, 659, SettingLevel::Basic, videoSettings.m_CustomNonLinStretch);

  // stereoscopic settings
  entries.clear();
  entries.push_back(std::make_pair(16316, RENDER_STEREO_MODE_OFF));
  entries.push_back(std::make_pair(36503, RENDER_STEREO_MODE_SPLIT_HORIZONTAL));
  entries.push_back(std::make_pair(36504, RENDER_STEREO_MODE_SPLIT_VERTICAL));
  AddSpinner(groupStereoscopic, SETTING_VIDEO_STEREOSCOPICMODE, 36535, SettingLevel::Basic, videoSettings.m_StereoMode, entries);
  AddToggle(groupStereoscopic, SETTING_VIDEO_STEREOSCOPICINVERT, 36536, SettingLevel::Basic, videoSettings.m_StereoInvert);

  // general settings
  AddButton(groupSaveAsDefault, SETTING_VIDEO_MAKE_DEFAULT, 12376, SettingLevel::Basic);
  AddButton(groupSaveAsDefault, SETTING_VIDEO_CALIBRATION, 214, SettingLevel::Basic);
}
Exemplo n.º 12
0
void RenderState::OnShowProperty( CMFCPropertyGridProperty* pGroup )
{
	__super::OnShowProperty(pGroup);

	switch(info.type){
	case Air::Client::enRST_RS:{
		AddCombo( pGroup, _T("FillMode"), strFillMode,strFillModeCount,info.rs.FillMode, _T("Note"),TRUE );
		AddCombo( pGroup, _T("CullMode"),strCullMode,strCullModeCount, info.rs.CullMode, _T("Note"),TRUE );
		AddMember( pGroup, _T("FrontCounterClockwise"), info.rs.FrontCounterClockwise, _T("Note"), TRUE );
		AddMember( pGroup, _T("DepthBias"), info.rs.DepthBias, _T("Note"), TRUE );
		AddMember( pGroup, _T("DepthBiasClamp"), info.rs.DepthBiasClamp, _T("Note"), TRUE );
		AddMember( pGroup, _T("SlopeScaledDepthBias"), info.rs.SlopeScaledDepthBias, _T("Note"), TRUE );
		AddMember( pGroup, _T("DepthClipEnable"), info.rs.DepthClipEnable, _T("Note"), TRUE );
		AddCombo( pGroup, _T("ScissorEnable"), strEnable,2,info.rs.ScissorEnable, _T("Note"), TRUE );
		AddMember( pGroup, _T("MultisampleEnable"), info.rs.MultisampleEnable, _T("Note"), TRUE );
		AddMember( pGroup, _T("AntialiasedLineEnable"), info.rs.AntialiasedLineEnable, _T("Note"), TRUE );
		break;}
	case	Air::Client::enRST_DS:{
		AddCombo( pGroup, _T("DepthEnable"), strEnable,2,info.ds.DepthEnable, _T("Note"), TRUE );
		AddCombo( pGroup, _T("DepthWriteMask"), strEnable,2,info.ds.DepthWriteMask, _T("Note"), TRUE );
		AddCombo( pGroup, _T("DepthFunc"), strCompare,strCompareCount,info.ds.DepthFunc, _T("Note"), TRUE );
		AddCombo( pGroup, _T("StencilEnable"), strEnable,2,(BOOL)info.ds.StencilEnable, _T("Note"), TRUE );
		AddMember( pGroup, _T("StencilReadMask"), (UINT)info.ds.StencilReadMask, _T("Note"), TRUE );
		AddMember( pGroup, _T("StencilWriteMask"), (UINT)info.ds.StencilWriteMask, _T("Note"), TRUE );
		CMFCPropertyGridProperty*	pFront	=	AddGroup(pGroup,_T("FrontFace"));

		AddCombo( pFront, _T("StencilFailOp"),			strStencilOP,9,info.ds.FrontFace.StencilFailOp,		_T("Note"), TRUE );
		AddCombo( pFront, _T("StencilDepthFailOp"),		strStencilOP,9,info.ds.FrontFace.StencilDepthFailOp,	_T("Note"), TRUE );
		AddCombo( pFront, _T("StencilPassOp"),			strStencilOP,9,info.ds.FrontFace.StencilPassOp,		_T("Note"), TRUE );
		AddCombo( pFront, _T("StencilFunc"),			strCompare,strCompareCount,info.ds.FrontFace.StencilFunc,			_T("Note"), TRUE );

		CMFCPropertyGridProperty*	pBack	=	AddGroup(pGroup,_T("BackFace"));

		AddCombo( pBack, _T("StencilFailOp"),			strStencilOP,9,info.ds.BackFace.StencilFailOp,		_T("Note"), TRUE );
		AddCombo( pBack, _T("StencilDepthFailOp"),		strStencilOP,9,info.ds.BackFace.StencilDepthFailOp,	_T("Note"), TRUE );
		AddCombo( pBack, _T("StencilPassOp"),			strStencilOP,9,info.ds.BackFace.StencilPassOp,		_T("Note"), TRUE );
		AddCombo( pBack, _T("StencilFunc"),				strCompare,strCompareCount,info.ds.BackFace.StencilFunc,			_T("Note"), TRUE );

		break;}
	case	Air::Client::enRST_BS:{
		AddCombo( pGroup, _T("AlphaToCoverageEnable"), strEnable,2,info.bs.AlphaToCoverageEnable, _T("Note"), TRUE );
		AddCombo( pGroup, _T("IndependentBlendEnable"), strEnable,2,info.bs.AlphaToCoverageEnable, _T("Note"), TRUE );

		for(unsigned long	i=0;i<8;i++){
			
			CMFCPropertyGridProperty*	pRTB	=	AddGroup(pGroup,strRTB[i]);
			AddCombo( pRTB, _T("BlendEnable"),				strEnable,2,info.bs.Blend[i].BlendEnable, _T("Note"), TRUE );
			AddCombo( pRTB, _T("SrcBlend"),					strBlend,20,info.bs.Blend[i].SrcBlend, _T("Note"), TRUE );
			AddCombo( pRTB, _T("DestBlend"),					strBlend,20,info.bs.Blend[i].DestBlend, _T("Note"), TRUE );
			AddCombo( pRTB, _T("BlendOp"),					strBlendOP,6,info.bs.Blend[i].BlendOp, _T("Note"), TRUE );
			AddCombo( pRTB, _T("SrcBlendAlpha"),				strBlend,20,info.bs.Blend[i].SrcBlendAlpha, _T("Note"), TRUE );
			AddCombo( pRTB, _T("DestBlendAlpha"),				strBlend,20,info.bs.Blend[i].DestBlendAlpha, _T("Note"), TRUE );
			AddCombo( pRTB, _T("BlendOpAlpha"),				strBlendOP,6,info.bs.Blend[i].BlendOpAlpha, _T("Note"), TRUE );
			AddMember( pRTB, _T("RenderTargetWriteMask"),		 (UINT)info.bs.Blend[i].RenderTargetWriteMask, _T("Note"), TRUE );
		}
		break;}
	case	Air::Client::enRST_SS:{

		break;}
	}
}
Exemplo n.º 13
0
    /**
     * Load an instrument from a .sf2 file. PrepareLoadInstrument() has to
     * be called first to provide the information which instrument to load.
     * This method will then actually start to load the instrument and block
     * the calling thread until loading was completed.
     *
     * @see PrepareLoadInstrument()
     */
    void EngineChannel::LoadInstrument() {
        InstrumentResourceManager* pInstrumentManager = dynamic_cast<InstrumentResourceManager*>(pEngine->GetInstrumentManager());

        // make sure we don't trigger any new notes with an old
        // instrument
        InstrumentChangeCmd< ::sf2::Region, ::sf2::Preset>& cmd = ChangeInstrument(0);
        if (cmd.pInstrument) {
            // give old instrument back to instrument manager, but
            // keep the dimension regions and samples that are in use
            pInstrumentManager->HandBackInstrument(cmd.pInstrument, this, cmd.pRegionsInUse);
        }
        cmd.pRegionsInUse->clear();

        // delete all key groups
        DeleteGroupEventLists();

        // request sf2 instrument from instrument manager
        ::sf2::Preset* newInstrument;
        try {
            InstrumentManager::instrument_id_t instrid;
            instrid.FileName  = InstrumentFile;
            instrid.Index     = InstrumentIdx;

            newInstrument = pInstrumentManager->Borrow(instrid, this);
            if (!newInstrument) {
                throw InstrumentManagerException("resource was not created");
            }
        }
        catch (InstrumentManagerException e) {
            InstrumentStat = -3;
            StatusChanged(true);
            String msg = "sf2::Engine error: Failed to load instrument, cause: " + e.Message();
            throw Exception(msg);
        }
        catch (::sf2::Exception e) {
            InstrumentStat = -3;
            StatusChanged(true);
            String msg = "sf2::Engine error: Failed to load instrument, cause: " + e.Message;
            throw Exception(msg);
        }
        catch (::std::runtime_error e) {
            InstrumentStat = -3;
            StatusChanged(true);
            String msg = "sf2::Engine error: Failed to load instrument, cause: ";
            msg += e.what();
            throw Exception(msg);
        }
        catch (...) {
            InstrumentStat = -4;
            StatusChanged(true);
            throw Exception("sf2::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse sf2 file.");
        }

        // rebuild ActiveKeyGroups map with key groups of current instrument
        for (int i = 0 ; i < newInstrument->GetRegionCount() ; i++) {
            ::sf2::Region* pRegion = newInstrument->GetRegion(i);
            for (int j = 0 ; j < pRegion->pInstrument->GetRegionCount() ; j++) {
                ::sf2::Region* pSubRegion = pRegion->pInstrument->GetRegion(j);
                AddGroup(pSubRegion->exclusiveClass);
            }
        }

        InstrumentIdxName = newInstrument->GetName();
        InstrumentStat = 100;

        ChangeInstrument(newInstrument);

        StatusChanged(true);
    }
Exemplo n.º 14
0
//(1)支持and与or以构建复杂的条件
//(2)支持=与!=操作
//(3)值用单引号扩起(两个连续单引号表示一个单引号值)
//(4)日期的值格式为:[a,b];[a,b);(a,b];(a,b);
//(5)Host,Date,App,Module,Func,File,Key,Level,DMN,AIN,Line
bool CLogChooser::AddChooser(const char* sCond)
{
	bool bFirst = true;
	const char* sWhere = sCond;
	m_oMutex.Leave();
	AddGroup();
	if(sCond)while(sCond[0])
		{
			bool bNot, bIncBeg, bIncEnd;
			CString oName, oVal1, oVal2;
			if(!sCond[0])
				break;
			if(GetIdentifier(sCond, oName))
			{
				RemoveEmptyGroup();
				m_oMutex.Leave();
				FocpError(("CLogChooser::AddChooser(%u:%s): get compare item failure", sCond-sWhere, sWhere));
				return false;
			}
			if(!bFirst)
			{
				if(!oName.Compare("and", false))
					continue;
				if(!oName.Compare("or", false))
				{
					AddGroup();
					continue;
				}
			}
			bFirst = false;
			uint32 nRet, nType = GetItemType(oName);
			if(nType >= 11)
			{
				RemoveEmptyGroup();
				m_oMutex.Leave();
				FocpError(("CLogChooser::AddChooser(%u:%s): the item '%s' is invalid", sCond-sWhere, sWhere, oName.GetStr()));
				return false;
			}
			if(GetOperator(sCond, bNot))
			{
				RemoveEmptyGroup();
				m_oMutex.Leave();
				FocpError(("CLogChooser::AddChooser(%u:%s): get oprand failure", sCond-sWhere, sWhere));
				return false;
			}
			if(nType == 1)
				nRet = GetDateTime(sCond, oVal1, oVal2, bIncBeg, bIncEnd);
			else if(nType >= 7)
				nRet = GetInt(sCond, oVal1);
			else
				nRet = GetString(sCond, oVal1);
			if(nRet)
			{
				RemoveEmptyGroup();
				m_oMutex.Leave();
				FocpError(("CLogChooser::AddChooser(%u:%s): get value failure", sCond-sWhere, sWhere));
				return false;
			}
			AddCond(nType, bNot, oVal1, oVal2, bIncBeg, bIncEnd);
		}
	RemoveEmptyGroup();
	m_oMutex.Leave();
	return true;
}
Exemplo n.º 15
0
status_t
Project::Load(const char *path)
{
	BEntry entry(path,true);
	status_t status = entry.InitCheck();
	if (status != B_OK)
		return status;
	
	entry_ref ref;
	entry.GetRef(&ref);
	
	fReadOnly = BVolume(ref.device).IsReadOnly();
	
	TextFile file(ref,B_READ_ONLY);
	status = file.InitCheck();
	if (status != B_OK)
		return status;
	
	fGroupList.MakeEmpty();
	
	fPath = path;
	fName = fPath.GetBaseName();
	
	platform_t actualPlatform = DetectPlatform();
	
	STRACE(2,("Loading project %s\n",path));
	
	// Set this to an out-of-bounds value to detect if
	// there is no SCM entry in the project
	fSCMType = SCM_INIT;
	
	SourceGroup *srcgroup = NULL;
	SourceFile *srcfile = NULL;
	BString line = file.ReadLine();
	while (line.CountChars() > 0)
	{
		int32 pos = line.FindFirst("=");
		if (pos < 0)
		{
			line = file.ReadLine();
			continue;
		}
		
		BString entry = line;
		entry.Truncate(pos);
		
		BString value = line.String() + pos + 1;
		
		STRACE(2,("Load Project: %s=%s\n",entry.String(),value.String()));
		
		if (value.CountChars() > 0)
		{
			if (entry[0] == '#')
				continue;
			else
			if (entry == "SOURCEFILE")
			{
				if (value.String()[0] != '/')
				{
					value.Prepend("/");
					value.Prepend(fPath.GetFolder());
				}
				srcfile = gFileFactory.CreateSourceFileItem(value.String());
				AddFile(srcfile, srcgroup);
			}
			else if (entry == "DEPENDENCY")
			{
				if (srcfile)
					srcfile->fDependencies = value;
			}
			else if (entry == "LOCALINCLUDE")
			{
				ProjectPath include(fPath.GetFolder(), value.String());
				AddLocalInclude(include.Absolute().String());
			}
			else if (entry == "SYSTEMINCLUDE")
				AddSystemInclude(value.String());
			else if (entry == "LIBRARY")
			{
				if (actualPlatform == fPlatform)
					AddLibrary(value.String());
				else
					ImportLibrary(value.String(),actualPlatform);
			}
			else if (entry == "GROUP")
				srcgroup = AddGroup(value.String());
			else if (entry == "EXPANDGROUP")
			{
				if (srcgroup)
					srcgroup->expanded = value == "yes" ? true : false;
			}
			else if (entry == "TARGETNAME")
				fTargetName = value;
			else if (entry == "CCDEBUG")
				fDebug = value == "yes" ? true : false;
			else if (entry == "CCPROFILE")
				fProfile = value == "yes" ? true : false;
			else if (entry == "CCOPSIZE")
				fOpSize = value == "yes" ? true : false;
			else if (entry == "CCOPLEVEL")
				fOpLevel = atoi(value.String());
			else if (entry == "CCTARGETTYPE")
				fTargetType = atoi(value.String());
			else if (entry == "CCEXTRA")
				fExtraCompilerOptions = value;
			else if (entry == "LDEXTRA")
				fExtraLinkerOptions = value;
			else if (entry == "RUNARGS")
				fRunArgs = value;
			else if (entry == "SCM")
			{
				if (value.ICompare("hg") == 0)
					fSCMType = SCM_HG;
				else if (value.ICompare("git") == 0)
					fSCMType = SCM_GIT;
				else if (value.ICompare("svn") == 0)
					fSCMType = SCM_SVN;
				else
					fSCMType = SCM_NONE;
			}
			else if (entry == "PLATFORM")
			{
				if (value.ICompare("Haiku") == 0)
					fPlatform = PLATFORM_HAIKU;
				else if (value.ICompare("HaikuGCC4") == 0)
					fPlatform = PLATFORM_HAIKU_GCC4;
				else if (value.ICompare("Zeta") == 0)
					fPlatform = PLATFORM_ZETA;
				else
					fPlatform = PLATFORM_R5;
			}
				
		}
		
		line = file.ReadLine();
	}
	
	// Fix one of my pet peeves when changing platforms: having to add libsupc++.so whenever
	// I change to Haiku GCC4 or GCC4hybrid from any other platform
	if (actualPlatform == PLATFORM_HAIKU_GCC4 && actualPlatform != fPlatform)
	{
		BPath libpath;
		find_directory(B_USER_DEVELOP_DIRECTORY,&libpath);
		libpath.Append("lib/x86/libsupc++.so");
		AddLibrary(libpath.Path());
	}
	
	fObjectPath = fPath.GetFolder();
	
	BString objfolder("(Objects.");
	objfolder << GetName() << ")";
	fObjectPath.Append(objfolder.String());
	
	UpdateBuildInfo();
	
	// We now set the platform to whatever we're building on. fPlatform is only used
	// in the project loading code to be able to help cover over issues with changing platforms.
	// Most of the time this is just the differences in libraries, but there may be other
	// unforeseen issues that will come to light in the future.
	fPlatform = actualPlatform;
	
	return B_OK;
}
Exemplo n.º 16
0
// Build the folder
LTBOOL CFolderPlayer::Build()
{

	CreateTitle(IDS_TITLE_PLAYER_SETUP);

    g_vtPlayerModel.Init(g_pLTClient, "NetPlayerModel", "Hero,action", 0.0f);
    g_vtPlayerTeam.Init(g_pLTClient, "NetPlayerTeam", LTNULL, 0.0f);
    g_vtTargetNameTransparency.Init(g_pLTClient, "TargetNameTransparency", LTNULL, 1.0f);
    g_vtTargetNameSize.Init(g_pLTClient, "TargetNameSize", LTNULL, 0.0f);

	m_pLabel = CreateTextItem(IDS_PLAYER_NAME, CMD_EDIT_NAME, IDS_HELP_PLAYER_NAME);

    m_pEdit = CreateEditCtrl(" ", CMD_EDIT_NAME, LTNULL, m_szPlayerName, sizeof(m_szPlayerName), 25, LTTRUE, GetMediumFont());
	m_pEdit->EnableCursor();
    m_pEdit->Enable(LTFALSE);
	m_pEdit->SetAlignment(LTF_JUSTIFY_CENTER);

	m_pNameGroup = AddGroup(640,m_pLabel->GetHeight(),IDS_HELP_PLAYER_NAME);

    LTIntPt offset(0,0);
    m_pNameGroup->AddControl(m_pLabel,offset,LTTRUE);
	offset.x = 200;
    m_pNameGroup->AddControl(m_pEdit,offset,LTFALSE);

	AddBlankLine();

	CToggleCtrl* pToggle = AddToggle(IDS_AUTOSWITCH_WEAPONS, IDS_HELP_AUTOSWITCH_WEAPONS, 225, &m_bAutoSwitchWeapons );
	pToggle->SetOnString(IDS_ON);
	pToggle->SetOffString(IDS_OFF);

	pToggle = AddToggle(IDS_AUTOSWITCH_AMMO, IDS_HELP_AUTOSWITCH_AMMO, 225, &m_bAutoSwitchAmmo );
	pToggle->SetOnString(IDS_ON);
	pToggle->SetOffString(IDS_OFF);

	pToggle = AddToggle(IDS_IGNORE_TAUNTS, IDS_HELP_IGNORE_TAUNTS, 225, &m_bIgnoreTaunts );
	pToggle->SetOnString(IDS_YES);
	pToggle->SetOffString(IDS_NO);

	CCycleCtrl *pCycle = AddCycleItem(IDS_CONNECT_SPEED,IDS_CONNECT_SPEED,200,25,&m_nConnect);
	pCycle->AddString(IDS_CONNECT_VSLOW);
	pCycle->AddString(IDS_CONNECT_SLOW);
	pCycle->AddString(IDS_CONNECT_MEDIUM);
	pCycle->AddString(IDS_CONNECT_FAST);

	pCycle = AddCycleItem(IDS_PLAYER_TEAM,IDS_HELP_PLAYER_TEAM,200,25,&m_nTeam);
	pCycle->AddString(IDS_PLAYER_EITHER);
	pCycle->AddString(IDS_PLAYER_UNITY);
	pCycle->AddString(IDS_PLAYER_HARM);

	CSliderCtrl* pSlider = AddSlider(IDS_TARGETNAMETRANSPARENCY, IDS_TARGETNAMETRANSPARENCY_HELP, 225, 200, &m_nTargetNameTransparency);
	pSlider->SetSliderRange(0, 100);
	pSlider->SetSliderIncrement(5);

	pCycle = AddCycleItem(IDS_TARGETNAMESIZE,IDS_TARGETNAMESIZE_HELP,200,25,&m_nTargetNameSize);
	pCycle->AddString(IDS_SMALL);
	pCycle->AddString(IDS_MEDIUM);
	pCycle->AddString(IDS_LARGE);

	m_pModelCtrl = AddCycleItem(IDS_PLAYER_MODEL,IDS_HELP_PLAYER_MODEL,200,25,&m_nModNum);
	m_pModelCtrl->NotifyOnChange(CMD_MODEL_CHANGE,this);

	m_pSkinCtrl = AddCycleItem(IDS_PLAYER_SKIN,IDS_HELP_PLAYER_SKIN,200,25,&m_nSkinNum);
	m_pSkinCtrl->NotifyOnChange(CMD_SKIN_CHANGE,this);

	m_pHeadCtrl = AddCycleItem(IDS_PLAYER_HEAD,IDS_HELP_PLAYER_HEAD,200,25,&m_nHeadNum);
	m_pHeadCtrl->NotifyOnChange(CMD_HEAD_CHANGE,this);

	// Make sure to call the base class
	if (! CBaseFolder::Build()) return LTFALSE;

	UseBack(LTTRUE,LTTRUE);
	return LTTRUE;
}
Exemplo n.º 17
0
BOOL CCfgFile::AddElement( HGROUP hGroup, LPCTSTR name, DWORD type, DWORD size, LPVOID value )
{_STTEX();
	BOOL	bNew = FALSE;
	LPCFGELEMENTINFO node = FindElement( hGroup, name );

	// Find the NULL group
	if ( hGroup == NULL )
	{	hGroup = VerifyGroup( NULL );
		if ( hGroup == NULL ) hGroup = AddGroup( NULL );
		if ( hGroup == NULL ) return FALSE;
	} // end if

	// Does it already exist
	if ( node == NULL ) 
	{	bNew = TRUE;
		node = new CFGELEMENTINFO;
		if ( node == NULL ) return FALSE;
	} // end if

	// Lose previous memory
	else if ( node->size != 0 && node->value != NULL ) 
		delete[] node->value;

	// Save element name
	if ( name != NULL ) { strcpy_sz( node->name, name ); }
	else *node->name = NULL;

	// Save type and size information
	node->type = type;
	node->size = size;

	// Just store value if size is zero
	if ( size == 0 ) node->value = value;

	// Allocate memory if needed
	else
	{
		// Allocate memory for user information
		node->value = new BYTE[ size + 1 ];

		// Punt if no memory
		if ( node->value == NULL ) { delete node; return FALSE; }

		// Copy user data
		if ( value != NULL ) memcpy( node->value, value, size );
		else { ZeroMemory( node->value, size ); }

		// NULL terminate data
		( (LPBYTE)node->value )[ size ] = 0;

	} // end else

	// Don't add if not new
	if ( !bNew ) return TRUE;

	// Add this node to the list
	node->pNext = NULL;
	node->pPrev = hGroup->tail;
	if ( hGroup->tail == NULL ) hGroup->head = node;
	else hGroup->tail->pNext = node;
	hGroup->tail = node;
	hGroup->size++;	

	return TRUE;
}
Exemplo n.º 18
0
void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline)
{
	struct ClcGroup *group;
	struct ClcContact * cont;
	pdisplayNameCacheEntry cacheEntry;
	DWORD style=GetWindowLong(hwnd,GWL_STYLE);
	WORD status;
	char *szProto;
	
	if (FindItem(hwnd,dat,hContact,NULL,NULL,NULL,FALSE)==1){return;};	
	cacheEntry=GetContactFullCacheEntry(hContact);
	if (cacheEntry==NULL) return;
    if (dat->IsMetaContactsEnabled && cacheEntry->HiddenSubcontact) return;   ///-----
	szProto=cacheEntry->szProto;


	//char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
	
	dat->NeedResort=1;
	ClearRowByIndexCache();
	ClearClcContactCache(dat,hContact);
	
	if(style&CLS_NOHIDEOFFLINE) checkHideOffline=0;
	if(checkHideOffline) {
		if(szProto==NULL) status=ID_STATUS_OFFLINE;
		else status=cacheEntry->status;
	}

	if(lstrlen(cacheEntry->szGroup)==0)
		group=&dat->list;
	else {
		group=AddGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0);
		if(group==NULL) {
			int i,len;
			DWORD groupFlags;
			TCHAR *szGroupName;
			if(!(style&CLS_HIDEEMPTYGROUPS)) {
			//	/*mir_free(dbv.pszVal);*/AddTempGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0);
				return;
			}
			if(checkHideOffline && IsHiddenMode(dat,status)) {
				for(i=1;;i++) {
					szGroupName=(TCHAR*)CallService(MS_CLIST_GROUPGETNAMET,i,(LPARAM)&groupFlags); //UNICODE
					if(szGroupName==NULL) {/*mir_free(dbv.pszVal);*/ return;}   //never happens
					if(!lstrcmp(szGroupName,cacheEntry->szGroup)) break;
				}
				if(groupFlags&GROUPF_HIDEOFFLINE) {/*mir_free(dbv.pszVal);*/ return;}
			}
			for(i=1;;i++) {
				szGroupName=(TCHAR*)CallService(MS_CLIST_GROUPGETNAMET,i,(LPARAM)&groupFlags); //UNICODE
				if(szGroupName==NULL) {/*mir_free(dbv.pszVal);*/ return;}   //never happens
				if(!lstrcmp(szGroupName,cacheEntry->szGroup)) break;
				len=lstrlen(szGroupName);
				if(!_tcsncmp(szGroupName,cacheEntry->szGroup,len) && cacheEntry->szGroup[len]=='\\')
					AddGroup(hwnd,dat,szGroupName,groupFlags,i,1);
			}
			group=AddGroup(hwnd,dat,cacheEntry->szGroup,groupFlags,i,1);
		}
	//	mir_free(dbv.pszVal);
	}
    if (cacheEntry->status==ID_STATUS_OFFLINE)
           if (DBGetContactSettingByte(NULL,"CList","PlaceOfflineToRoot",0))
                        group=&dat->list;
	if(checkHideOffline) {
		if(IsHiddenMode(dat,status) && (style&CLS_HIDEOFFLINE || group->hideOffline)) {
			if(updateTotalCount) group->totalMembers++;
			return;
		}
	}
    if(dat->IsMetaContactsEnabled &&  cacheEntry->HiddenSubcontact) return;
    if(!dat->IsMetaContactsEnabled && !MyStrCmp(cacheEntry->szProto,"MetaContacts")) return;
	cont=AddContactToGroup(dat,group,cacheEntry);
	if (cont)	
			if (cont->proto)
		{	
			cont->SubAllocated=0;
			if (MyStrCmp(cont->proto,"MetaContacts")==0)
				AddSubcontacts(dat,cont);
		}
	if(updateTotalCount && group) group->totalMembers++;
	ClearRowByIndexCache();
}
Exemplo n.º 19
0
void EventList::RefreshEventList()
{
	InitNames();
	InitFilters();

	if (useImportedMessages) {
		std::vector<IImport::ExternalMessage> messages;
		{
			mir_cslock lck(csEventList);
			std::map<MCONTACT, EventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
			if (it != contactFileMap.end()) {
				ExportManager imp(hWnd, hContact, 1);
				imp.SetAutoImport(it->second.file);
				if (!imp.Import(it->second.type, messages, NULL))
					messages.clear();
			}
		}
		ImportMessages(messages);
	}

	std::list<EventTempIndex> tempList;
	GetTempList(tempList, false, false, hContact);
	std::list<EventTempIndex> revTempList;
	std::list<EventTempIndex>& nrTempList = tempList;
	bool isNewOnTop = Options::instance->groupNewOnTop;
	if (isNewOnTop) {
		revTempList.insert(revTempList.begin(), tempList.rbegin(), tempList.rend());
		nrTempList = revTempList;
	}

	eventList.clear();
	eventList.push_back(std::deque<EventIndex>());
	DWORD lastTime = MAXDWORD;
	DWORD groupTime = Options::instance->groupTime * 60 * 60;
	int maxMess = Options::instance->groupMessagesNumber;
	int limitator = 0;
	EventIndex ei;
	for (std::list<EventTempIndex>::iterator itL = nrTempList.begin(); itL != nrTempList.end(); ++itL) {
		DWORD tm = isNewOnTop ? lastTime - itL->timestamp : itL->timestamp - lastTime;
		if (isFlat || tm < groupTime && limitator < maxMess) {
			lastTime = itL->timestamp;
			ei.isExternal = itL->isExternal;
			ei.hEvent = itL->hEvent;
			if (isNewOnTop)
				eventList.back().push_front(ei);
			else
				eventList.back().push_back(ei);
			++limitator;
		}
		else {
			limitator = 0;
			lastTime = itL->timestamp;
			if (!eventList.back().empty()) {
				ei = eventList.back().front();
				AddGroup(ei);
				eventList.push_back(std::deque<EventIndex>());
			}
			ei.isExternal = itL->isExternal;
			ei.hEvent = itL->hEvent;
			eventList.back().push_front(ei);
		}
	}

	if (!eventList.back().empty()) {
		ei = eventList.back().front();
		AddGroup(ei);
	}
}
Exemplo n.º 20
0
void RebuildEntireList(HWND hwnd,struct ClcData *dat)
{
//	char *szProto;
	DWORD style=GetWindowLong(hwnd,GWL_STYLE);
	HANDLE hContact;
	struct ClcContact * cont;
	struct ClcGroup *group;
	//DBVARIANT dbv;
	int tick=GetTickCount();
    KillTimer(hwnd,TIMERID_REBUILDAFTER);
    
    //EnterCriticalSection(&(dat->lockitemCS));
//ShowTracePopup("RebuildEntireList");

#ifdef _DEBUG
	{
		static int num_calls = 0;
		char tmp[128];
		mir_snprintf(tmp, sizeof(tmp), "*********************   RebuildEntireList (%d)\r\n", num_calls);
		num_calls++;
		TRACE(tmp);
	}
#endif 

	ClearRowByIndexCache();
	ClearClcContactCache(dat,INVALID_HANDLE_VALUE);
	ImageArray_Clear(&dat->avatar_cache);
	RowHeights_Clear(dat);
	RowHeights_GetMaxRowHeight(dat, hwnd);

	dat->list.expanded=1;
	dat->list.hideOffline=DBGetContactSettingByte(NULL,"CLC","HideOfflineRoot",0);
	dat->list.contactCount=0;
	dat->list.totalMembers=0;
	dat->NeedResort=1;
	dat->selection=-1;
	dat->HiLightMode=DBGetContactSettingByte(NULL,"CLC","HiLightMode",0);
	{
		int i;
		TCHAR *szGroupName;
		DWORD groupFlags;

		for(i=1;;i++) {
			szGroupName=(TCHAR*)CallService(MS_CLIST_GROUPGETNAMET,i,(LPARAM)&groupFlags); //UNICODE
			if(szGroupName==NULL) break;
			AddGroup(hwnd,dat,szGroupName,groupFlags,i,0);
		}
        lastGroupId=i;
        
	}

	hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
	while(hContact) {
		
		pdisplayNameCacheEntry cacheEntry;
		cont=NULL;
		cacheEntry=GetContactFullCacheEntry(hContact);
		//cacheEntry->ClcContact=NULL;
		ClearClcContactCache(dat,hContact);

		

		if((dat->IsMetaContactsEnabled||MyStrCmp(cacheEntry->szProto,"MetaContacts"))&&(style&CLS_SHOWHIDDEN || !cacheEntry->Hidden) && (!cacheEntry->HiddenSubcontact || !dat->IsMetaContactsEnabled )) {
			if(lstrlen(cacheEntry->szGroup)==0)
				group=&dat->list;
			else {
				group=AddGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0);
//                if (!group) group=AddTempGroup(hwnd,dat,cacheEntry->szGroup,(DWORD)-1,0,0);
				//mir_free(dbv.pszVal);
			}
            if(group!=NULL) {
                if (cacheEntry->status==ID_STATUS_OFFLINE)
                    if (DBGetContactSettingByte(NULL,"CList","PlaceOfflineToRoot",0))
                        group=&dat->list;
				group->totalMembers++;
				if(!(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) {
					//szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
					if(cacheEntry->szProto==NULL) {
						if(!IsHiddenMode(dat,ID_STATUS_OFFLINE)||cacheEntry->noHiddenOffline)
							cont=AddContactToGroup(dat,group,cacheEntry);
					}
					else
						if(!IsHiddenMode(dat,cacheEntry->status)||cacheEntry->noHiddenOffline)
							cont=AddContactToGroup(dat,group,cacheEntry);
				}
				else cont=AddContactToGroup(dat,group,cacheEntry);
			}
		}
		if (cont)	
		{	
			cont->SubAllocated=0;
			if (cont->proto && strcmp(cont->proto,"MetaContacts")==0)
				AddSubcontacts(dat,cont);
		}
		hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0);
	}

	if(style&CLS_HIDEEMPTYGROUPS) {
		group=&dat->list;
		group->scanIndex=0;
		for(;;) {
			if(group->scanIndex==group->contactCount) {
				group=group->parent;
				if(group==NULL) break;
			}
			else if(group->contact[group->scanIndex].type==CLCIT_GROUP) {
				if(group->contact[group->scanIndex].group->contactCount==0) {
					group=RemoveItemFromGroup(hwnd,group,&group->contact[group->scanIndex],0);
				}
				else {
					group=group->contact[group->scanIndex].group;
					group->scanIndex=0;
				}
				continue;
			}
			group->scanIndex++;
		}
	}

	SortCLC(hwnd,dat,0);
  // LOCK_IMAGE_UPDATING=0;
  //LeaveCriticalSection(&(dat->lockitemCS));
#ifdef _DEBUG
	tick=GetTickCount()-tick;
	{
	char buf[255];
	//sprintf(buf,"%s %s took %i ms",__FILE__,__LINE__,tick);
	sprintf(buf,"RebuildEntireList %d \r\n",tick);

	TRACE(buf);
	DBWriteContactSettingDword((HANDLE)0,"CLUI","PF:Last RebuildEntireList Time:",tick);
	}	
#endif
}
Exemplo n.º 21
0
void CGUIDialogAudioSubtitleSettings::InitializeSettings()
{
  CGUIDialogSettingsManualBase::InitializeSettings();

  CSettingCategory *category = AddCategory("audiosubtitlesettings", -1);
  if (category == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings");
    return;
  }

  // get all necessary setting groups
  CSettingGroup *groupAudio = AddGroup(category);
  if (groupAudio == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings");
    return;
  }
  CSettingGroup *groupSubtitles = AddGroup(category);
  if (groupSubtitles == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings");
    return;
  }
  CSettingGroup *groupSaveAsDefault = AddGroup(category);
  if (groupSaveAsDefault == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings");
    return;
  }

  bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml");

  CVideoSettings &videoSettings = CMediaSettings::Get().GetCurrentVideoSettings();
  
  if (g_application.m_pPlayer->HasPlayer())
  {
    g_application.m_pPlayer->GetAudioCapabilities(m_audioCaps);
    g_application.m_pPlayer->GetSubtitleCapabilities(m_subCaps);
  }

  // register IsPlayingPassthrough condition
  m_settingsManager->AddCondition("IsPlayingPassthrough", IsPlayingPassthrough);

  CSettingDependency dependencyAudioOutputPassthroughDisabled(SettingDependencyTypeEnable, m_settingsManager);
  dependencyAudioOutputPassthroughDisabled.Or()
    ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_AUDIO_PASSTHROUGH, "false", SettingDependencyOperatorEquals, false, m_settingsManager)))
    ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition("IsPlayingPassthrough", "", "", true, m_settingsManager)));
  SettingDependencies depsAudioOutputPassthroughDisabled;
  depsAudioOutputPassthroughDisabled.push_back(dependencyAudioOutputPassthroughDisabled);
  
  // audio settings
  // audio volume setting
  m_volume = g_application.GetVolume(false);
  CSettingNumber *settingAudioVolume = AddSlider(groupAudio, SETTING_AUDIO_VOLUME, 13376, 0, m_volume, 14054, VOLUME_MINIMUM, VOLUME_MAXIMUM / 100.0f, VOLUME_MAXIMUM);
  settingAudioVolume->SetDependencies(depsAudioOutputPassthroughDisabled);
  static_cast<CSettingControlSlider*>(settingAudioVolume->GetControl())->SetFormatter(SettingFormatterPercentAsDecibel);

  // audio volume amplification setting
  if (SupportsAudioFeature(IPC_AUD_AMP))
  {
    CSettingNumber *settingAudioVolumeAmplification = AddSlider(groupAudio, SETTING_AUDIO_VOLUME_AMPLIFICATION, 660, 0, videoSettings.m_VolumeAmplification, 14054, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f);
    settingAudioVolumeAmplification->SetDependencies(depsAudioOutputPassthroughDisabled);
  }

  // audio delay setting
  if (SupportsAudioFeature(IPC_AUD_OFFSET))
  {
    CSettingNumber *settingAudioDelay = AddSlider(groupAudio, SETTING_AUDIO_DELAY, 297, 0, videoSettings.m_AudioDelay, 0, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, 297, usePopup);
    static_cast<CSettingControlSlider*>(settingAudioDelay->GetControl())->SetFormatter(SettingFormatterDelay);
  }
  
  // audio stream setting
  if (SupportsAudioFeature(IPC_AUD_SELECT_STREAM))
    AddAudioStreams(groupAudio, SETTING_AUDIO_STREAM);

  // audio output to all speakers setting
  // TODO: remove this setting
  if (SupportsAudioFeature(IPC_AUD_OUTPUT_STEREO))
    AddToggle(groupAudio, SETTING_AUDIO_OUTPUT_TO_ALL_SPEAKERS, 252, 0, videoSettings.m_OutputToAllSpeakers);

  // audio digital/analog setting
  if (SupportsAudioFeature(IPC_AUD_SELECT_OUTPUT))
  {
    m_passthrough = CSettings::Get().GetBool("audiooutput.passthrough");
    AddToggle(groupAudio, SETTING_AUDIO_PASSTHROUGH, 348, 0, m_passthrough);
  }

  // subitlte settings
  m_subtitleVisible = g_application.m_pPlayer->GetSubtitleVisible();
  // subtitle enabled setting
  AddToggle(groupSubtitles, SETTING_SUBTITLE_ENABLE, 13397, 0, m_subtitleVisible);

  // subtitle delay setting
  if (SupportsSubtitleFeature(IPC_SUBS_OFFSET))
  {
    CSettingNumber *settingSubtitleDelay = AddSlider(groupSubtitles, SETTING_SUBTITLE_DELAY, 22006, 0, videoSettings.m_SubtitleDelay, 0, -g_advancedSettings.m_videoSubsDelayRange, 0.1f, g_advancedSettings.m_videoSubsDelayRange, 22006, usePopup);
    static_cast<CSettingControlSlider*>(settingSubtitleDelay->GetControl())->SetFormatter(SettingFormatterDelay);
  }

  // subtitle stream setting
  if (SupportsSubtitleFeature(IPC_SUBS_SELECT))
    AddSubtitleStreams(groupSubtitles, SETTING_SUBTITLE_STREAM);

  // subtitle browser setting
  if (SupportsSubtitleFeature(IPC_SUBS_EXTERNAL))
    AddButton(groupSubtitles, SETTING_SUBTITLE_BROWSER, 13250, 0);

  // subtitle stream setting
  AddButton(groupSaveAsDefault, SETTING_AUDIO_MAKE_DEFAULT, 12376, 0);
}
Exemplo n.º 22
0
DBOOL CVoiceGroupMgr::Init(CClientDE* pClientDE, char* sDirPrefix, char* sCustomDirPrefix)
{
	// Sanity checks...

	if (!pClientDE) return(DFALSE);
	if (!sDirPrefix) return(DFALSE);


	// Set simple members...

	m_pClientDE = pClientDE;


	// Add all the groups...

	AddGroup(VME_IDLE,     sDirPrefix, sCustomDirPrefix, "Idle");
	AddGroup(VME_BIGGIB,   sDirPrefix, sCustomDirPrefix, "BigGib");
	AddGroup(VME_PAIN,     sDirPrefix, sCustomDirPrefix, "Pain");
	AddGroup(VME_KILL,     sDirPrefix, sCustomDirPrefix, "Kill");
	AddGroup(VME_DEATH,    sDirPrefix, sCustomDirPrefix, "Death");
	AddGroup(VME_BURNING,  sDirPrefix, sCustomDirPrefix, "Burning");
	AddGroup(VME_POWERUP,  sDirPrefix, sCustomDirPrefix, "Powerup");
	AddGroup(VME_SPAWN,    sDirPrefix, sCustomDirPrefix, "Spawn");
	AddGroup(VME_SUICIDE,  sDirPrefix, sCustomDirPrefix, "Suicide");
	AddGroup(VME_WEAPON,   sDirPrefix, sCustomDirPrefix, "Weapon");
	AddGroup(VME_TAUNT,    sDirPrefix, sCustomDirPrefix, "Taunt");
	AddGroup(VME_JUMP,     sDirPrefix, sCustomDirPrefix, "Jump");


	// All done...

	return(DTRUE);
}
Exemplo n.º 23
0
void CPage::Br()
{
	AddGroup();
}
Exemplo n.º 24
0
void UserActions::Init()
{
	m_actionNames.clear();
	m_actionNames.push_back(_("none"));
	m_actionNames.push_back(_("highlight"));
	m_actionNames.push_back(_("notify login/out"));
	m_actionNames.push_back(_("ignore chat"));
	m_actionNames.push_back(_("ignore pm"));
	m_actionNames.push_back(_("autokick"));
	m_actionNames.push_back(_("notify hosted battle"));
	m_actionNames.push_back(_("notify status change"));

	m_configActionNames.clear();
	m_configActionNames.push_back(_T("none"));
	m_configActionNames.push_back(_T("highlight"));
	m_configActionNames.push_back(_T("notify_login"));
	m_configActionNames.push_back(_T("ignore_chat"));
	m_configActionNames.push_back(_T("ignore_pm"));
	m_configActionNames.push_back(_T("autokick"));
	m_configActionNames.push_back(_T("notify_hosted"));
	m_configActionNames.push_back(_T("notify_status"));

	m_actionTooltips.clear();
	m_actionTooltips.push_back(_("no action at all"));
	m_actionTooltips.push_back(_("highlight user in nick list and battles he participates in"));
	m_actionTooltips.push_back(_("popup a message box when user logs in/out from  the server"));
	m_actionTooltips.push_back(_("you won't see message by these users in normal channels"));
	m_actionTooltips.push_back(_("ignore private messages of these users, no pm window will open if any of these try to contact you privately"));
	m_actionTooltips.push_back(_("automatically kick users from battles hosted by yourself"));
	m_actionTooltips.push_back(_("popup a message box when user hosts a new battle"));
	m_actionTooltips.push_back(_("popup a message box when user changes away status"));

	// setup if empty
	if (!cfg().Exists(_T( "/Groups"))) {
		AddGroup(_("Default"));
		AddGroup(_("Ignore PM"));
		ChangeAction(_("Ignore PM"), UserActions::ActIgnorePM);
		AddGroup(_("Ignore chat"));
		ChangeAction(_("Ignore chat"), UserActions::ActIgnoreChat);
		AddGroup(_("Battle Autokick"));
		ChangeAction(_("Battle Autokick"), UserActions::ActAutokick);
		AddGroup(_("Friends"));
		ChangeAction(_("Friends"), UserActions::ActNotifBattle);
		ChangeAction(_("Friends"), UserActions::ActHighlight);
		ChangeAction(_("Friends"), UserActions::ActNotifLogin);
		// TODO select better color
		SetGroupColor(_("Friends"), wxColour(0, 0, 255));
	}


	// read
	m_groupNames = GetGroups();
	m_groupMap.clear();
	m_groupActions.clear();
	m_actionsGroups.clear();
	m_actionsPeople.clear();
	m_knownUsers.Clear();
	for (unsigned int i = 0; i < m_groupNames.GetCount(); ++i) {
		wxString name = m_groupNames[i];
		m_groupMap[name] = GetPeopleList(name);
		for (unsigned int k = 0; k < m_groupMap[name].GetCount(); ++k) {
			wxString user = m_groupMap[name][k];
			m_knownUsers.Add(user);
			m_peopleGroup[user] = name;
		}
		m_groupActions[name] = GetGroupActions(name);
	}
	for (size_t i = 0; i < m_actionNames.size(); ++i) {
		UserActions::ActionType cur = (UserActions::ActionType)(1 << i);
		wxArrayString tmp;
		for (unsigned int j = 0; j < m_groupNames.GetCount(); ++j) {
			wxString name = m_groupNames[j];
			if ((m_groupActions[name] & cur) != 0) {
				tmp.Add(name);
				for (unsigned int k = 0; k < m_groupMap[name].GetCount(); ++k) {
					m_actionsPeople[cur].Add((m_groupMap[name])[k]);
				}
			}
		}
		tmp.Sort();
		m_actionsGroups[cur] = tmp;
	}
	m_actionsGroups[ActNone] = m_groupNames;
	m_groupNames.Sort();
	m_knownUsers.Sort();
}
Exemplo n.º 25
0
    /**
     * Load an instrument from a .gig file. PrepareLoadInstrument() has to
     * be called first to provide the information which instrument to load.
     * This method will then actually start to load the instrument and block
     * the calling thread until loading was completed.
     *
     * @see PrepareLoadInstrument()
     */
    void EngineChannel::LoadInstrument() {
        InstrumentResourceManager* pInstrumentManager = dynamic_cast<InstrumentResourceManager*>(pEngine->GetInstrumentManager());

        // make sure we don't trigger any new notes with an old
        // instrument
        InstrumentChangeCmd< ::gig::DimensionRegion, ::gig::Instrument>& cmd = ChangeInstrument(0);
        if (cmd.pInstrument) {
            // give old instrument back to instrument manager, but
            // keep the dimension regions and samples that are in use
            pInstrumentManager->HandBackInstrument(cmd.pInstrument, this, cmd.pRegionsInUse);
        }
        if (cmd.pScript) {
            // give old instrument script back to instrument resource manager
            cmd.pScript->resetAll();
        }
        cmd.pRegionsInUse->clear();

        // delete all key groups
        DeleteGroupEventLists();

        // request gig instrument from instrument manager
        ::gig::Instrument* newInstrument;
        try {
            InstrumentManager::instrument_id_t instrid;
            instrid.FileName  = InstrumentFile;
            instrid.Index     = InstrumentIdx;

            newInstrument = pInstrumentManager->Borrow(instrid, this);
            if (!newInstrument) {
                throw InstrumentManagerException("resource was not created");
            }

            if (newInstrument->ScriptSlotCount() > 1) {
                std::cerr << "WARNING: Executing more than one real-time instrument script slot is not implemented yet!\n";
            }
            ::gig::Script* script = newInstrument->GetScriptOfSlot(0);
            if (script) {
                String sourceCode = script->GetScriptAsText();
                LoadInstrumentScript(sourceCode);
            }
        }
        catch (RIFF::Exception e) {
            InstrumentStat = -2;
            StatusChanged(true);
            String msg = "gig::Engine error: Failed to load instrument, cause: " + e.Message;
            throw Exception(msg);
        }
        catch (InstrumentManagerException e) {
            InstrumentStat = -3;
            StatusChanged(true);
            String msg = "gig::Engine error: Failed to load instrument, cause: " + e.Message();
            throw Exception(msg);
        }
        catch (...) {
            InstrumentStat = -4;
            StatusChanged(true);
            throw Exception("gig::Engine error: Failed to load instrument, cause: Unknown exception while trying to parse gig file.");
        }

        RoundRobinIndex = 0;
        for (int i = 0 ; i < 128 ; i++) pMIDIKeyInfo[i].pRoundRobinIndex = NULL;

        // rebuild ActiveKeyGroups map with key groups of current
        // instrument and set the round robin pointers to use one
        // counter for each region
        int region = 0;
        for (::gig::Region* pRegion = newInstrument->GetFirstRegion(); pRegion; pRegion = newInstrument->GetNextRegion()) {
            AddGroup(pRegion->KeyGroup);

            RoundRobinIndexes[region] = 0;
            for (int iKey = pRegion->KeyRange.low; iKey <= pRegion->KeyRange.high; iKey++) {
                pMIDIKeyInfo[iKey].pRoundRobinIndex = &RoundRobinIndexes[region];
            }
            region++;
        }

        InstrumentIdxName = newInstrument->pInfo->Name;
        InstrumentStat = 100;

        {
            InstrumentChangeCmd< ::gig::DimensionRegion, ::gig::Instrument>& cmd =
                ChangeInstrument(newInstrument);
            if (cmd.pScript) {
                // give old instrument script back to instrument resource manager
                cmd.pScript->resetAll();
            }
        }

        StatusChanged(true);
    }
Exemplo n.º 26
0
void CGUIDialogSubtitleSettings::InitializeSettings()
{
  CGUIDialogSettingsManualBase::InitializeSettings();

  const std::shared_ptr<CSettingCategory> category = AddCategory("audiosubtitlesettings", -1);
  if (category == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogSubtitleSettings: unable to setup settings");
    return;
  }

  // get all necessary setting groups
  const std::shared_ptr<CSettingGroup> groupAudio = AddGroup(category);
  if (groupAudio == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogSubtitleSettings: unable to setup settings");
    return;
  }
  const std::shared_ptr<CSettingGroup> groupSubtitles = AddGroup(category);
  if (groupSubtitles == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogSubtitleSettings: unable to setup settings");
    return;
  }
  const std::shared_ptr<CSettingGroup> groupSaveAsDefault = AddGroup(category);
  if (groupSaveAsDefault == NULL)
  {
    CLog::Log(LOGERROR, "CGUIDialogSubtitleSettings: unable to setup settings");
    return;
  }

  bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml");

  const CVideoSettings videoSettings = g_application.GetAppPlayer().GetVideoSettings();

  if (g_application.GetAppPlayer().HasPlayer())
  {
    g_application.GetAppPlayer().GetSubtitleCapabilities(m_subtitleCapabilities);
  }

  // subtitle settings
  m_subtitleVisible = g_application.GetAppPlayer().GetSubtitleVisible();

  // subtitle enabled setting
  AddToggle(groupSubtitles, SETTING_SUBTITLE_ENABLE, 13397, SettingLevel::Basic, m_subtitleVisible);

  // subtitle delay setting
  if (SupportsSubtitleFeature(IPC_SUBS_OFFSET))
  {
    std::shared_ptr<CSettingNumber> settingSubtitleDelay = AddSlider(groupSubtitles, SETTING_SUBTITLE_DELAY, 22006, SettingLevel::Basic, videoSettings.m_SubtitleDelay, 0, -CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoSubsDelayRange, 0.1f, CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_videoSubsDelayRange, 22006, usePopup);
    std::static_pointer_cast<CSettingControlSlider>(settingSubtitleDelay->GetControl())->SetFormatter(SettingFormatterDelay);
  }

  // subtitle stream setting
  if (SupportsSubtitleFeature(IPC_SUBS_SELECT))
    AddSubtitleStreams(groupSubtitles, SETTING_SUBTITLE_STREAM);

  // subtitle browser setting
  if (SupportsSubtitleFeature(IPC_SUBS_EXTERNAL))
    AddButton(groupSubtitles, SETTING_SUBTITLE_BROWSER, 13250, SettingLevel::Basic);

  AddButton(groupSubtitles, SETTING_SUBTITLE_SEARCH, 24134, SettingLevel::Basic);

  // subtitle stream setting
  AddButton(groupSaveAsDefault, SETTING_MAKE_DEFAULT, 12376, SettingLevel::Basic);
}
Exemplo n.º 27
0
void GroupMgr::LoadGroups()
{
    {
        uint32 oldMSTime = getMSTime();

        // Delete all groups whose leader does not exist
        CharacterDatabase.DirectExecute("DELETE FROM groups WHERE leaderGuid NOT IN (SELECT guid FROM characters)");
        // Delete all groups with less than 2 members
        CharacterDatabase.DirectExecute("DELETE FROM groups WHERE guid NOT IN (SELECT guid FROM group_member GROUP BY guid HAVING COUNT(guid) > 1)");

        //                                                        0              1           2             3                 4      5          6      7         8       9
        QueryResult result = CharacterDatabase.Query("SELECT g.leaderGuid, g.lootMethod, g.looterGuid, g.lootThreshold, g.icon1, g.icon2, g.icon3, g.icon4, g.icon5, g.icon6"
            //  10         11          12         13              14            15         16           17
            ", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC");
        if (!result)
        {
            sLog->outString(">> Loaded 0 group definitions. DB table `groups` is empty!");
            sLog->outString();
            return;
        }

        uint32 count = 0;
        do
        {
            Field* fields = result->Fetch();
            Group* group = new Group;
            group->LoadGroupFromDB(fields);
            AddGroup(group);

            // Get the ID used for storing the group in the database and register it in the pool.
            uint32 storageId = group->GetDbStoreId();

            RegisterGroupDbStoreId(storageId, group);

            // TODO: Reenable storageId Recycling
            // Increase the next available storage ID
            //if (storageId == NextGroupDbStoreId)
            //    NextGroupDbStoreId++;

            ++count;
        }
        while (result->NextRow());

        sLog->outString(">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
        sLog->outString();
    }

    sLog->outString("Loading Group members...");
    {
        uint32 oldMSTime = getMSTime();

        // Delete all rows from group_member or group_instance with no group
        CharacterDatabase.DirectExecute("DELETE FROM group_member WHERE guid NOT IN (SELECT guid FROM groups)");
        CharacterDatabase.DirectExecute("DELETE FROM group_instance WHERE guid NOT IN (SELECT guid FROM groups)");
        // Delete all members that does not exist
        CharacterDatabase.DirectExecute("DELETE FROM group_member WHERE memberGuid NOT IN (SELECT guid FROM characters)");

        //                                                    0        1           2            3       4
        QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid");
        if (!result)
        {
            sLog->outString(">> Loaded 0 group members. DB table `group_member` is empty!");
            sLog->outString();
            return;
        }

        uint32 count = 0;

        do
        {
            Field* fields = result->Fetch();
            Group* group = GetGroupByDbStoreId(fields[0].GetUInt32());

            if (group)
                group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8());
            else
                sLog->outError("GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32());

            ++count;
        }
        while (result->NextRow());

        sLog->outString(">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
        sLog->outString();
    }

    sLog->outString("Loading Group instance saves...");
    {
        uint32 oldMSTime = getMSTime();
        //                                                   0           1        2              3             4             5            6
        QueryResult result = CharacterDatabase.Query("SELECT gi.guid, i.map, gi.instance, gi.permanent, i.difficulty, i.resettime, COUNT(g.guid) "
            "FROM group_instance gi INNER JOIN instance i ON gi.instance = i.id "
            "LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid");
        if (!result)
        {
            sLog->outString(">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
            sLog->outString();
            return;
        }

        uint32 count = 0;
        do
        {
            Field* fields = result->Fetch();
            Group* group = GetGroupByDbStoreId(fields[0].GetUInt32());
            // group will never be NULL (we have run consistency sql's before loading)

            MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt16());
            if (!mapEntry || !mapEntry->IsDungeon())
            {
                sLog->outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16());
                continue;
            }

            uint32 diff = fields[4].GetUInt8();
            if (diff >= uint32(mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
            {
                sLog->outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
                diff = 0;                                   // default for both difficaly types
            }

            InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt32()), (bool)fields[6].GetUInt64(), true);
            group->BindToInstance(save, fields[3].GetBool(), true);
            ++count;
        }
        while (result->NextRow());

        sLog->outString(">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
        sLog->outString();
    }
}
Exemplo n.º 28
0
CRibbonTableButton::CRibbonTableButton(UINT nID, LPCTSTR lpszText, int nSmallImageIndex, int nLargeImageIndex) :
	CMFCRibbonGallery(nID, lpszText, nSmallImageIndex, nLargeImageIndex, CSize(18, 18), 0, FALSE)
{
	AddGroup(lpszDefaultCaption, CELLS_X * CELLS_Y);
	SetIconsInRow(CELLS_X);
}
Exemplo n.º 29
0
void FTextureManager::AddTexturesForWad(int wadnum)
{
	int firsttexture = Textures.Size();
	int lumpcount = Wads.GetNumLumps();

	FirstTextureForFile.Push(firsttexture);

	// First step: Load sprites
	AddGroup(wadnum, ns_sprites, FTexture::TEX_Sprite);

	// When loading a Zip, all graphics in the patches/ directory should be
	// added as well.
	AddGroup(wadnum, ns_patches, FTexture::TEX_WallPatch);

	// Second step: TEXTUREx lumps
	//LoadTextureX(wadnum);

	// Third step: Flats
	AddGroup(wadnum, ns_flats, FTexture::TEX_Flat);

	// Fourth step: Textures (TX_)
	AddGroup(wadnum, ns_newtextures, FTexture::TEX_Override);

	// Sixth step: Try to find any lump in the WAD that may be a texture and load as a TEX_MiscPatch
	int firsttx = Wads.GetFirstLump(wadnum);
	int lasttx = Wads.GetLastLump(wadnum);

	for (int i= firsttx; i <= lasttx; i++)
	{
		char name[9];
		Wads.GetLumpName(name, i);
		name[8]=0;

		// Ignore anything not in the global namespace
		int ns = Wads.GetLumpNamespace(i);
		if (ns == ns_global)
		{
			// In Zips all graphics must be in a separate namespace.
			if (Wads.GetLumpFlags(i) & LUMPF_ZIPFILE) continue;

			// Ignore lumps with empty names.
			if (Wads.CheckLumpName(i, "")) continue;

			// Ignore anything belonging to a map
			if (Wads.CheckLumpName(i, "PLANES")) continue;

			// Don't bother looking at this lump if something later overrides it.
			if (Wads.CheckNumForName(name, ns_graphics) != i) continue;

			// skip this if it has already been added as a wall patch.
			if (CheckForTexture(name, FTexture::TEX_WallPatch, 0).Exists()) continue;
		}
		else if (ns == ns_graphics)
		{
			// Don't bother looking this lump if something later overrides it.
			if (Wads.CheckNumForName(name, ns_graphics) != i) continue;
		}
		else continue;

		// Try to create a texture from this lump and add it.
		// Unfortunately we have to look at everything that comes through here...
		FTexture *out = FTexture::CreateTexture(i, FTexture::TEX_MiscPatch);

		if (out != NULL) 
		{
			AddTexture (out);
		}
	}

	// Check for text based texture definitions
	LoadTextureDefs(wadnum, "TEXTURES");
	//LoadTextureDefs(wadnum, "HIRESTEX");

	// Seventh step: Check for hires replacements.
	AddHiresTextures(wadnum);

	SortTexturesByType(firsttexture, Textures.Size());
}
Exemplo n.º 30
0
int CDlgEnvSheet::DoModal(int nType) 
{
	int		i, nResult;
	CDlgEnvironment		pageEnv;
	CDlgLyricFile		pageLyric;
	CDlgEnvPlayer		pagePlayer;
	CDlgUserConvFormat	pageConv;
	CDlgConvFormatEx	pageConvEx;
	CDlgMoveFolder		pageMoveFolder;
	CDlgCopyFormat		pageCopyFormat; /* FunnyCorn 175 */
	CDlgKeyConfig		pageKey;
	CDlgEditShowColumn	pageColumn;
	CDlgEnvConf			pageConf;
	CDlgSetClassification	pageClass;
	CDlgReplaceFileName	pageReplace;
	CDlgSetupGenre		pageGenre;
	CDlgFolderSync		pageSync;
	CDlgWriteForm		pageWrite;
	CDlgFileNameMaxCheck	pageFileNameMax;
	//CDlgTeikei			pageTeikei; /* FreeFall 046 */
	CDlgDefaultValue	pageDefaultValue;
	CDlgUserConvFormartTag2Tag	pageConvTag2Tag; /* STEP 032 */
	CDlgFixedUpperLower	pageFixedUpperLower; /* STEP 040 */

	CDlgConv	pageConvTop; /* STEP 026*/
	COptionListBox	listBox;

	SetListControl(&listBox);

	pageGenre.m_genreListUSER = NULL;

	// プロパティーシートのスタイルを変更
	m_psh.dwFlags |= PSH_NOAPPLYNOW;	// [適用]ボタン無し

	// 変数の初期化
	if (true || nType & ENV_NORMAL) {
		// 環境設定
		pageEnv.m_bESCEditCancel		= g_bOptESCEditCancel ? TRUE : FALSE;
		pageEnv.m_bEnableEditCursorExit	= g_bOptEnableEditCursorExit ? TRUE : FALSE;
		pageEnv.m_bEnterBeginEdit	= g_bOptEnterBeginEdit ? TRUE : FALSE;
		pageEnv.m_bEditOkDown		= g_bOptEditOkDown ? TRUE : FALSE;
		pageEnv.m_bKeepTimeStamp	= g_bOptKeepTimeStamp ? TRUE : FALSE;
		pageEnv.m_bSyncCreateTime	= g_bOptSyncCreateTime ? TRUE : FALSE;
		pageEnv.m_bAutoOpenFolder	= g_bOptAutoOpenFolder ? TRUE : FALSE;
		pageEnv.m_bLoadFileAdjustColumn	= g_bOptLoadFileAdjustColumn ? TRUE : FALSE;
		pageEnv.m_bLoadFileChecked	= g_bOptLoadFileChecked ? TRUE : FALSE;
		pageEnv.m_bHideMP3ListFile	= g_bOptHideMP3ListFile ? TRUE : FALSE;
		pageEnv.m_bDropSearchSubFolder	= g_bOptDropSearchSubFolder ? TRUE : FALSE;	/* TyphoonSwell 026 */
		pageEnv.m_bShowZenSpace	= g_bOptShowZenSpace ? TRUE : FALSE;	/* BeachMonster 107 */
		pageEnv.m_bSortIgnoreCase = g_bOptSortIgnoreCase ? TRUE : FALSE;	/* BeachMonster4 114 */
		pageEnv.m_bSortIgnoreZenHan = g_bOptSortIgnoreZenHan ? TRUE : FALSE;	/* BeachMonster4 114 */
		pageEnv.m_bSortIgnoreKataHita = g_bOptSortIgnoreKataHira ? TRUE : FALSE;	/* FunnyCorn 179 */
		pageEnv.m_bShowTotalParent = g_bOptShowTotalParent ? TRUE : FALSE;	/* RockDance 128 */
		pageEnv.m_bShowTips	= g_bOptShowTips ? TRUE : FALSE;	/* Rumble 188 */

		// 歌詞ファイル
		pageLyric.m_bChangeTextFile		= g_bOptChangeTextFile ? TRUE : FALSE;
		pageLyric.m_bSetLyricsDir		= g_bOptSetLyricsDir ? TRUE : FALSE;
		pageLyric.m_bSearchLyricsSubDir	= g_bOptSearchLyricsSubDir ? TRUE : FALSE;
		pageLyric.m_strLyricsPath		= g_strOptLyricsPath;

		// プレイヤー
		pagePlayer.m_nPlayerType	= g_nOptPlayerType;
		pagePlayer.m_strWinAmpPath	= g_sOptWinAmpPath;

		// 確認メッセージ
		pageConf.m_bConfDeleteFile	= g_bConfDeleteFile ? TRUE : FALSE;
		pageConf.m_bConfDeleteList	= g_bConfDeleteList ? TRUE : FALSE;
		pageConf.m_bConfEditModify	= g_bConfEditModify ? TRUE : FALSE;
		pageConf.m_bConfFolderSync	= g_bConfFolderSync ? TRUE : FALSE;

		// キー割り当て
		// 現在のキー割り当てをレジストリに保存
		((CSuperTagEditorApp *)AfxGetApp())->WriteKeyConfig();

		// ファイル名最大文字数
		pageFileNameMax.m_bFileNameMaxCheck = g_bConfFileNameMaxCheck ? TRUE : FALSE;
		pageFileNameMax.m_nFileNameMaxChar = g_nConfFileNameMaxChar;
		pageFileNameMax.m_bFileNameMaxCellColor = g_bFileNameMaxCellColor ? TRUE : FALSE; /* SeaKnows 036 */
	}

	if (true || nType & ENV_CONV) {
		pageConvTop.m_bFirstUpperIgnoreWord = g_bFirstUpperIgnoreWord;
		pageConvTop.m_strFirstUpperIgnoreWords = g_strFirstUpperIgnoreWords;
		pageConvTop.m_strFirstUpperSentenceSeparator = g_strFirstUpperSentenceSeparator;
		pageConvTop.m_bUserConvAddMenu = g_bUserConvAddMenu;
		pageConvTop.m_bZenHanKigouKana = g_bZenHanKigouKana;
		// ファイル名置換
		pageReplace.m_bFileNameReplace = (g_nOptCheckFileName == FILENAME_CONV_MULTIBYTE) ? TRUE : FALSE;
		for (i = 0; i < FILENAME_REPLACE_MAX; i++) {
			FILENAME_REPLACE	*pRep = &g_fileNameReplace[i];
			pageReplace.m_strBefore[i] = pRep->strBefore;
			pageReplace.m_strAfter[i] = pRep->strAfter;
		}
		// ユーザファイル名置換 /* FreeFall 050 */
		for (i = 0; i < USER_FILENAME_REPLACE_MAX; i++) {
			FILENAME_REPLACE	*pRep = &g_userFileNameReplace[i];
			pageReplace.m_strUserBefore[i] = pRep->strBefore;
			pageReplace.m_strUserAfter[i] = pRep->strAfter;
		}
		// ファイル名文字種の統一 /* LastTrain 058 */
		pageReplace.m_nFileUnifyAlpha = g_nFileUnifyAlpha;
		pageReplace.m_nFileUnifyHiraKata = g_nFileUnifyHiraKata;
		pageReplace.m_nFileUnifyKata = g_nFileUnifyKata;
		pageReplace.m_nFileUnifyKigou = g_nFileUnifyKigou;
		pageReplace.m_nFileUnifySuji = g_nFileUnifySuji;
		pageReplace.m_nFileUnifyUpLow = g_nFileUnifyUpLow;

		// 拡張子変換 /* STEP 006 */
		pageReplace.m_nExtChange = g_nFileExtChange;

		// ユーザー変換書式
		pageConv.m_nFormatType	= g_nUserConvFormatType;
		for (i = 0; i < USER_CONV_FORMAT_MAX; i++) {
			pageConv.m_userFormat[i] = g_userConvFormat[i];
		}

		// 拡張ユーザー変換書式
		pageConvEx.m_nFormatType	= 0;
		for (i = 0; i < USER_CONV_FORMAT_EX_MAX; i++) {
			pageConvEx.m_userFormatEx[i] = g_userConvFormatEx[i];
		}

		// 移動先フォルダ書式
		pageMoveFolder.m_nFormatType	= 0;
		for (i = 0; i < USER_MOVE_FODLER_FORMAT_MAX; i++) {
			pageMoveFolder.m_userFormatEx[i] = g_userMoveFolder[i];
		}

		// 書式コピー /* FunnyCorn 175 */
		pageCopyFormat.m_nFormatType	= 0;
		for (i = 0; i < USER_COPY_FORMAT_FORMAT_MAX; i++) {
			pageCopyFormat.m_userFormatEx[i] = g_userCopyFormat[i];
		}

		// タグ情報変換 /* STEP 034 */
		pageConvTag2Tag.m_nFormatType	= 0;
		for (i = 0; i < USER_CONV_FORMAT_TAG2TAG_MAX; i++) {
			pageConvTag2Tag.m_userFormatTag2Tag[i] = g_userConvFormatTag2Tag[i];
		}

		// 大文字小文字固定変換 /* STEP 040 */
		for (i = 0; i<g_arFixedWords.GetSize(); i++) {
			pageFixedUpperLower.m_arFixedWords.Add(g_arFixedWords.GetAt(i));
		}
	}

	if (true || nType & ENV_ADVANCED) {
		// 分類設定
		pageClass.m_nClassType	= g_classInfo.nType;
		pageClass.m_nClass1	= g_classInfo.nColumn[0] + 1;
		pageClass.m_nClass2	= g_classInfo.nColumn[1] + 1;
		pageClass.m_nClass3	= g_classInfo.nColumn[2] + 1;
		pageClass.m_nClass4	= g_classInfo.nColumn[3] + 1;
		pageClass.m_nClass5	= g_classInfo.nColumn[4] + 1;

		// フォルダの同期
		pageSync.m_bEnableFolderSync	= g_bEnableFolderSync ? TRUE : FALSE;
		pageSync.m_strRootFolder		= g_strRootFolder;
		pageSync.m_bSelectAlways		= g_bSyncSelectAlways ? TRUE : FALSE;
		pageSync.m_bDeleteFolder		= g_bSyncDeleteFolder ? TRUE : FALSE;
		pageSync.m_bMoveLyricsFile		= g_bSyncLyricsFileMove ? TRUE : FALSE;

		// リスト出力書式
		pageWrite.m_nFormatType	= 0;
		for (i = 0; i < WRITE_FORMAT_MAX; i++) {
			pageWrite.m_writeFormat[i] = g_writeFormat[i];
		}

		// ユーザ指定ジャンル
		pageGenre.m_genreListUSER = new USER_GENRE_LIST[USER_GENRE_LIST_MAX];
		for (i = 0; i < USER_GENRE_LIST_MAX; i++) {
			pageGenre.m_genreListUSER[i] = g_genreListUSER[i];
		}

		// その他 /* SeaKnows 031,033 */ 
		pageDefaultValue.m_bValidFolderSelect = g_bValidFolderSelect;
		pageDefaultValue.m_bValidDupExec = g_bValidDupExec; /* FreeFall 045 */
		pageDefaultValue.m_nRecentFolder = g_nRecentFolder; /* StartInaction 053 */
		pageDefaultValue.m_bSaveRepDlgPos = g_bSaveRepDlgPos; /* WildCherry4 086 */
		pageDefaultValue.m_bAudioListShow = g_bAudioListShow; /* Conspiracy 199 */
	}

	// ページの追加
	if (true || nType & ENV_NORMAL  ) AddGroup(&pageEnv);
	AddGroup(&pageConvTop);
	AddGroup(&pageDefaultValue);
	if (true || nType & ENV_NORMAL  ) AddPage(&pageLyric, &pageEnv);
	if (true || nType & ENV_NORMAL  ) AddPage(&pagePlayer, &pageEnv);
	if (true || nType & ENV_NORMAL  ) AddPage(&pageFileNameMax, &pageEnv);
	if (true || nType & ENV_CONV    ) AddPage(&pageConv, &pageConvTop);
	if (true || nType & ENV_CONV    ) AddPage(&pageConvEx, &pageConvTop);
	if (true || nType & ENV_CONV    ) AddPage(&pageConvTag2Tag, &pageConvTop);
	if (true || nType & ENV_CONV    ) AddPage(&pageMoveFolder, &pageConvTop);
	if (true || nType & ENV_CONV    ) AddPage(&pageCopyFormat, &pageConvTop);
	if (true || nType & ENV_ADVANCED) AddPage(&pageSync, &pageDefaultValue);
	if (true || nType & ENV_CONV    ) AddPage(&pageReplace, &pageConvTop);
	if (true || nType & ENV_ADVANCED) AddPage(&pageGenre, &pageDefaultValue);
	if (true || nType & ENV_NORMAL  ) AddPage(&pageConf, &pageEnv);
	if (true || nType & ENV_ADVANCED) AddPage(&pageColumn, &pageDefaultValue);
	if (true || nType & ENV_NORMAL  ) AddPage(&pageKey, &pageEnv);
	if (true || nType & ENV_ADVANCED) AddPage(&pageClass, &pageDefaultValue);
	if (true || nType & ENV_ADVANCED) AddPage(&pageWrite, &pageDefaultValue);
	//if (true || nType & ENV_ADVANCED) AddPage(&pageDefaultValue, &pageDefaultValue);
	if (true || nType & ENV_CONV    ) AddPage(&pageFixedUpperLower, &pageConvTop); /* STEP 040 */

	// プロパティシートの実行
	if ((nResult = COptionSheet::DoModal()) == IDOK) {
		if (true || nType & ENV_NORMAL) {
			// 環境設定
			g_bOptESCEditCancel			= pageEnv.m_bESCEditCancel ? true : false;
			g_bOptEnableEditCursorExit	= pageEnv.m_bEnableEditCursorExit ? true : false;
			g_bOptEnterBeginEdit	= pageEnv.m_bEnterBeginEdit ? true : false;
			g_bOptEditOkDown		= pageEnv.m_bEditOkDown ? true : false;
			g_bOptKeepTimeStamp		= pageEnv.m_bKeepTimeStamp ? true : false;
			g_bOptSyncCreateTime	= pageEnv.m_bSyncCreateTime ? true : false;
			g_bOptAutoOpenFolder	= pageEnv.m_bAutoOpenFolder ? true : false;
			g_bOptLoadFileAdjustColumn	= pageEnv.m_bLoadFileAdjustColumn ? true : false;
			g_bOptLoadFileChecked	= pageEnv.m_bLoadFileChecked ? true : false;
			g_bOptHideMP3ListFile	= pageEnv.m_bHideMP3ListFile ? true : false;
			g_bOptDropSearchSubFolder	= pageEnv.m_bDropSearchSubFolder ? true : false; /* TyphoonSwell 026 */
			g_bOptShowZenSpace	= pageEnv.m_bShowZenSpace ? true : false; /* BeachMonster 107 */
			g_bOptSortIgnoreCase =  pageEnv.m_bSortIgnoreCase ? true : false;	/* BeachMonster4 114 */
			g_bOptSortIgnoreZenHan = pageEnv.m_bSortIgnoreZenHan ? true : false;	/* BeachMonster4 114 */
			g_bOptSortIgnoreKataHira = pageEnv.m_bSortIgnoreKataHita ? true : false;	/* FunnyCorn 179 */
			g_bOptShowTotalParent = pageEnv.m_bShowTotalParent ? true : false;	/* RockDance 128 */
			g_bOptShowTips	= pageEnv.m_bShowTips ? true : false; /* Rumble 188 */

			// 歌詞ファイル
			g_bOptChangeTextFile		= pageLyric.m_bChangeTextFile ? true : false;
			g_bOptSetLyricsDir			= pageLyric.m_bSetLyricsDir ? true : false;
			g_bOptSearchLyricsSubDir	= pageLyric.m_bSearchLyricsSubDir ? true : false;
			g_strOptLyricsPath			= pageLyric.m_strLyricsPath;

			// プレイヤー
			g_nOptPlayerType	= pagePlayer.m_nPlayerType;
			g_sOptWinAmpPath	= pagePlayer.m_strWinAmpPath;

			// 確認メッセージ
			g_bConfDeleteFile		= pageConf.m_bConfDeleteFile ? true : false;
			g_bConfDeleteList		= pageConf.m_bConfDeleteList ? true : false;
			g_bConfEditModify		= pageConf.m_bConfEditModify ? true : false;
			g_bConfFolderSync		= pageConf.m_bConfFolderSync ? true : false;

			// ファイル名最大文字数
			g_bConfFileNameMaxCheck	= pageFileNameMax.m_bFileNameMaxCheck ? true : false;
			g_nConfFileNameMaxChar	= pageFileNameMax.m_nFileNameMaxChar;
			g_bFileNameMaxCellColor = pageFileNameMax.m_bFileNameMaxCellColor ? true : false; /* SeaKnows 036 */
		}

		if (true || nType & ENV_CONV) {
			g_bFirstUpperIgnoreWord = pageConvTop.m_bFirstUpperIgnoreWord ? true : false;
			g_strFirstUpperIgnoreWords = pageConvTop.m_strFirstUpperIgnoreWords;
			g_strFirstUpperSentenceSeparator = pageConvTop.m_strFirstUpperSentenceSeparator;
			g_bUserConvAddMenu = pageConvTop.m_bUserConvAddMenu ? true : false;
			g_bZenHanKigouKana = pageConvTop.m_bZenHanKigouKana ? true : false;
			// ファイル名置換
			g_nOptCheckFileName = pageReplace.m_bFileNameReplace ? FILENAME_CONV_MULTIBYTE : FILENAME_NO_CHECK;
			for (i = 0; i < FILENAME_REPLACE_MAX; i++) {
				FILENAME_REPLACE	*pRep = &g_fileNameReplace[i];
				pRep->strAfter = pageReplace.m_strAfter[i];
			}
			// ユーザファイル名置換 /* FreeFall 050 */
			for (i = 0; i < USER_FILENAME_REPLACE_MAX; i++) {
				FILENAME_REPLACE	*pRep = &g_userFileNameReplace[i];
				pRep->strBefore = pageReplace.m_strUserBefore[i];
				pRep->strAfter = pageReplace.m_strUserAfter[i];
			}
			// ファイル名文字種の統一 /* LastTrain 058 */
			g_nFileUnifyAlpha = pageReplace.m_nFileUnifyAlpha;
			g_nFileUnifyHiraKata = pageReplace.m_nFileUnifyHiraKata;
			g_nFileUnifyKata = pageReplace.m_nFileUnifyKata;
			g_nFileUnifyKigou = pageReplace.m_nFileUnifyKigou;
			g_nFileUnifySuji = pageReplace.m_nFileUnifySuji;
			g_nFileUnifyUpLow = pageReplace.m_nFileUnifyUpLow;

			// 拡張子変換 /* STEP 006 */
			g_nFileExtChange = pageReplace.m_nExtChange;

			// ユーザー変換書式
			g_nUserConvFormatType	= pageConv.m_nFormatType;
			for (i = 0; i < USER_CONV_FORMAT_MAX; i++) {
				g_userConvFormat[i] = pageConv.m_userFormat[i];
			}

			// 拡張ユーザー変換書式
			for (i = 0; i < USER_CONV_FORMAT_EX_MAX; i++) {
				g_userConvFormatEx[i] = pageConvEx.m_userFormatEx[i];
			}

			// 移動先フォルダ書式
			for (i = 0; i < USER_MOVE_FODLER_FORMAT_MAX; i++) {
				g_userMoveFolder[i] = pageMoveFolder.m_userFormatEx[i];
			}

			// 書式コピー /* FunnyCorn 175 */
			for (i = 0; i < USER_COPY_FORMAT_FORMAT_MAX; i++) {
				g_userCopyFormat[i] = pageCopyFormat.m_userFormatEx[i];
			}

			// タグ情報変換 /* STEP 034 */
			for (i = 0; i < USER_CONV_FORMAT_TAG2TAG_MAX; i++) {
				g_userConvFormatTag2Tag[i] = pageConvTag2Tag.m_userFormatTag2Tag[i];
			}

			// 大文字小文字固定変換 /* STEP 040 */
			if (pageFixedUpperLower.m_bModify) {
				g_arFixedWords.RemoveAll();
				for (i = 0; i<pageFixedUpperLower.m_arFixedWords.GetSize(); i++) {
					g_arFixedWords.Add(pageFixedUpperLower.m_arFixedWords.GetAt(i));
				}
				((CSuperTagEditorApp *)AfxGetApp())->WriteFixedWordList();
			}
		}

		if (true || nType & ENV_ADVANCED) {
			// 分類設定
			g_classInfo.nType		= pageClass.m_nClassType;
			g_classInfo.nColumn[0]	= pageClass.m_nClass1 - 1;
			g_classInfo.nColumn[1]	= pageClass.m_nClass2 - 1;
			g_classInfo.nColumn[2]	= pageClass.m_nClass3 - 1;
			g_classInfo.nColumn[3]	= pageClass.m_nClass4 - 1;
			g_classInfo.nColumn[4]	= pageClass.m_nClass5 - 1;

			// フォルダの同期
			g_bEnableFolderSync		= pageSync.m_bEnableFolderSync ? true : false;
			g_strRootFolder			= pageSync.m_strRootFolder;
			g_bSyncSelectAlways		= pageSync.m_bSelectAlways ? true : false;
			g_bSyncDeleteFolder		= pageSync.m_bDeleteFolder ? true : false;
			g_bSyncLyricsFileMove	= pageSync.m_bMoveLyricsFile ? true : false;

			// 分類表示を更新
			if (pageClass.m_nClassType != 0
			&&  pageClass.m_bExecClassification) {
				m_pDoc->ExecClassification();
			}

			// リスト出力書式
			for (i = 0; i < WRITE_FORMAT_MAX; i++) {
				g_writeFormat[i] = pageWrite.m_writeFormat[i];
			}

			// ジャンルはダイアログのOnOK()でレジストリに書き込むのでダイアログ側で処理する

			// その他 /* SeaKnows 031,033 */
			g_bValidFolderSelect = pageDefaultValue.m_bValidFolderSelect ? true : false;
			g_bValidDupExec = pageDefaultValue.m_bValidDupExec ? true : false; /* FreeFall 045 */
			g_nRecentFolder = pageDefaultValue.m_nRecentFolder; /* StartInaction 053 */
			g_bSaveRepDlgPos = pageDefaultValue.m_bSaveRepDlgPos ? true : false; /* WildCherry4 086 */
			g_bAudioListShow = pageDefaultValue.m_bAudioListShow ? true : false; /* Conspiracy 199 */
		}

		// キー割り当て
		// 現在のキー割り当てをレジストリに保存
		((CSuperTagEditorApp *)AfxGetApp())->WriteKeyConfig(true);

		((CSuperTagEditorApp *)AfxGetApp())->WriteRegistry();
	} else {
		if (true || nType & ENV_NORMAL) {
			// 変更前のキー割り当てをレジストリから読み込む
			((CSuperTagEditorApp *)AfxGetApp())->ReadKeyConfig();
		}
	}
	delete [] pageGenre.m_genreListUSER;

	return(nResult);
}