BOOL CMissionNotesDlg::OnInitDialog() 
{
	int i;
	CComboBox *box;
	

	// set up the radio box states
	coop = (CButton *)GetDlgItem(IDC_COOP);
	team = (CButton *)GetDlgItem(IDC_TEAMVTEAM);
	dogfight = (CButton *)GetDlgItem(IDC_DOGFIGHT);

	m_mission_title_orig = m_mission_title = _T(The_mission.name);
	m_designer_name_orig = m_designer_name = _T(The_mission.author);
	m_created = _T(The_mission.created);
	m_modified = _T(The_mission.modified);
	m_mission_notes_orig = m_mission_notes = convert_multiline_string(The_mission.notes);
	m_mission_desc_orig = m_mission_desc = convert_multiline_string(The_mission.mission_desc);
	m_red_alert = The_mission.red_alert;
	m_scramble = The_mission.scramble;
	m_disallow_support = (The_mission.support_ships.max_support_ships == 0) ? 1 : 0;
	m_no_promotion = (The_mission.flags & MISSION_FLAG_NO_PROMOTION) ? 1 : 0;
	m_no_builtin_msgs = (The_mission.flags & MISSION_FLAG_NO_BUILTIN_MSGS) ? 1 : 0;
	m_no_traitor = (The_mission.flags & MISSION_FLAG_NO_TRAITOR) ? 1 : 0;
	m_ship_trails = (The_mission.flags & MISSION_FLAG_SHIP_TRAILS) ? 1 : 0;
	m_support_repairs_hull = (The_mission.flags &MISSION_FLAG_SUPPORT_REPAIRS_HULL) ? 1 : 0;
	m_beam_free_all_by_default = (The_mission.flags & MISSION_FLAG_BEAM_FREE_ALL_BY_DEFAULT) ? 1 : 0;
//	m_old_warp_effect = (The_mission.flags & MISSION_FLAG_OLD_WARP_EFFECT) ? 1 : 0;
	m_no_briefing = (The_mission.flags & MISSION_FLAG_NO_BRIEFING) ? 1 : 0;
	m_no_debriefing = (The_mission.flags & MISSION_FLAG_NO_DEBRIEFING) ? 1 : 0;

	m_loading_640=_T(The_mission.loading_screen[GR_640]);
	m_loading_1024=_T(The_mission.loading_screen[GR_1024]);

	//CDialog::OnInitDialog();
//return TRUE;
	box = (CComboBox *) GetDlgItem(IDC_MUSIC);
	box->AddString("None");
	for (i=0; i<Num_soundtracks; i++){
		box->AddString(Soundtracks[i].name);		
	}

	// squad info
	if(strlen(The_mission.squad_name) > 0){
		m_squad_name = _T(The_mission.squad_name);
		m_squad_filename = _T(The_mission.squad_filename);
	} else {
		m_squad_name = _T(NO_SQUAD);
		m_squad_filename = _T("");
	}

	m_type = The_mission.game_type;
	m_music = Current_soundtrack_num + 1;
	m_full_war = Mission_all_attack;

	// set up the game type checkboxes accoring to m_type
	if ( m_type & MISSION_TYPE_SINGLE ){
		((CButton *) GetDlgItem(IDC_SINGLE))->SetCheck(1);
	}

	// for multiplayer -- be sure to assign a default type if not already assigned.
	if ( m_type & MISSION_TYPE_MULTI ){
		((CButton *) GetDlgItem(IDC_MULTI))->SetCheck(1);
	}

	if ( m_type & MISSION_TYPE_TRAINING ){
		((CButton *) GetDlgItem(IDC_TRAINING))->SetCheck(1);
	}

	// we need to set one of these three multiplayer modes so interface looks correct
	if ( !(m_type & (MISSION_TYPE_MULTI_COOP | MISSION_TYPE_MULTI_DOGFIGHT | MISSION_TYPE_MULTI_TEAMS)) ){
		m_type |= MISSION_TYPE_MULTI_COOP;
	}

	if ( m_type & MISSION_TYPE_MULTI_COOP ){
		coop->SetCheck(1);
	} else if ( m_type & MISSION_TYPE_MULTI_TEAMS ){
		team->SetCheck(1);
	} else if ( m_type & MISSION_TYPE_MULTI_DOGFIGHT ){
		dogfight->SetCheck(1);
	} else {
		Int3();			// get allender -- multiplayer mode not set!!!
	}

	m_respawn_spin.SetRange(0, 99);
	m_num_respawns = The_mission.num_respawns;
	m_max_hull_repair_val = The_mission.support_ships.max_hull_repair_val;
	m_max_subsys_repair_val = The_mission.support_ships.max_subsys_repair_val;

	set_types();
	UpdateData(FALSE);
	theApp.init_window(&Mission_notes_wnd_data, this);
	return TRUE;
}
示例#2
0
// initialize everything that update_data_safe() saves.
void wing_editor::initialize_data_safe(int full_update)
{
	int i, enable = TRUE, player_wing = 0, player_enabled = 1;
	CComboBox *arrival_box, *departure_box;

	nprintf(("Fred routing", "Wing dialog load safe\n"));
	if (!GetSafeHwnd())
		return;

	arrival_box = (CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET);
	departure_box = (CComboBox *)GetDlgItem(IDC_DEPARTURE_TARGET);

	m_ignore_count = 0;
	if (cur_wing < 0) {
		m_wing_squad_filename = _T("");
		m_special_ship = -1;
		m_arrival_location = -1;
		m_departure_location = -1;
		m_arrival_delay = 0;
		m_arrival_delay_min = 0;
		m_arrival_delay_max = 0;
		m_arrival_dist = 0;
		m_arrival_target = -1;
		m_departure_target = -1;
		m_departure_delay = 0;
		m_arrival_tree.clear_tree();
		m_departure_tree.clear_tree();
		m_arrival_tree.DeleteAllItems();
		m_departure_tree.DeleteAllItems();
		m_reinforcement = FALSE;
		m_hotkey = 0;
		m_ignore_count = 0;
		m_no_arrival_music = 0;
		m_no_arrival_message = 0;
		m_no_arrival_warp = 0;
		m_no_departure_warp = 0;
		m_no_dynamic = 0;
		player_enabled = enable = FALSE;

	} else {
		CComboBox *ptr;

		if (The_mission.game_type & MISSION_TYPE_MULTI)
		{
			if (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS)
			{
				for (i=0; i<MAX_TVT_WINGS; i++)
				{
					if (cur_wing == TVT_wings[i])
						player_enabled = 0;
				}
			}
			else
			{
				for (i=0; i<MAX_STARTING_WINGS; i++)
				{
					if (cur_wing == Starting_wings[i])
						player_enabled = 0;
				}
			}
		}
		else
		{
			if (cur_wing == Ships[Player_start_shipnum].wingnum)
				player_enabled = 0;
		}

		if ((Player_start_shipnum >= 0) && (Player_start_shipnum < MAX_SHIPS) && (Ships[Player_start_shipnum].objnum >= 0))
			if (Ships[Player_start_shipnum].wingnum == cur_wing)
				player_wing = 1;

		m_wing_squad_filename = _T(Wings[cur_wing].wing_squad_filename);
		m_special_ship = Wings[cur_wing].special_ship;
		m_waves = Wings[cur_wing].num_waves;
		m_threshold = Wings[cur_wing].threshold;
		m_arrival_location = Wings[cur_wing].arrival_location;
		m_departure_location = Wings[cur_wing].departure_location;
		m_arrival_delay = Wings[cur_wing].arrival_delay;
		m_arrival_delay_min = Wings[cur_wing].wave_delay_min;
		m_arrival_delay_max = Wings[cur_wing].wave_delay_max;
		m_arrival_dist = Wings[cur_wing].arrival_distance;
		m_arrival_target = Wings[cur_wing].arrival_anchor;
		m_departure_target = Wings[cur_wing].departure_anchor;
		m_no_dynamic = (Wings[cur_wing].flags & WF_NO_DYNAMIC)?1:0;

		// Add the ships/special items to the combo box here before data is updated
		if ( m_arrival_location == ARRIVE_FROM_DOCK_BAY ) {
			management_add_ships_to_combo( arrival_box, SHIPS_2_COMBO_DOCKING_BAY_ONLY );
		} else {
			management_add_ships_to_combo( arrival_box, SHIPS_2_COMBO_SPECIAL | SHIPS_2_COMBO_ALL_SHIPS );
		}

		// Goober5000 - gah, this is ridiculous!  Prior to this point in the function (and only in this function),
		// m_arrival_target seems to refer to the arrival anchor.  The rest of the time, it refers to the index
		// of the drop-down list.
		if (m_arrival_target >= 0)
		{
			if (m_arrival_target & SPECIAL_ARRIVAL_ANCHOR_FLAG)
			{
				// figure out what the box represents this as
				char tmp[NAME_LENGTH + 15];
				stuff_special_arrival_anchor_name(tmp, m_arrival_target, 0);
	
				// find it in the box
				m_arrival_target = arrival_box->FindStringExact(-1, tmp);
			}
			else
			{
				// find it in the box
				m_arrival_target = arrival_box->FindStringExact(-1, Ships[m_arrival_target].ship_name);
			}
		}

		// add the ships to the departure target combo box
		if ( m_departure_location == DEPART_AT_DOCK_BAY ) {
			management_add_ships_to_combo( departure_box, SHIPS_2_COMBO_DOCKING_BAY_ONLY );
		} else {
			departure_box->ResetContent();
		}

		if ( m_departure_target >= 0 )
			m_departure_target = departure_box->FindStringExact(-1, Ships[m_departure_target].ship_name);

		m_departure_delay = Wings[cur_wing].departure_delay;
		if (player_wing)
			m_arrival_tree.load_tree(Locked_sexp_true);
		else
			m_arrival_tree.load_tree(Wings[cur_wing].arrival_cue);

		m_departure_tree.load_tree(Wings[cur_wing].departure_cue, "false");
		m_hotkey = Wings[cur_wing].hotkey+1;
		if (Wings[cur_wing].flags & WF_IGNORE_COUNT)
			m_ignore_count = 1;
		else
			m_ignore_count = 0;

		if (Wings[cur_wing].flags & WF_NO_ARRIVAL_MUSIC)
			m_no_arrival_music = 1;
		else
			m_no_arrival_music = 0;

		if ( Wings[cur_wing].flags & WF_NO_ARRIVAL_MESSAGE )
			m_no_arrival_message = 1;
		else
			m_no_arrival_message = 0;

		if ( Wings[cur_wing].flags & WF_NO_ARRIVAL_WARP )
			m_no_arrival_warp = 1;
		else
			m_no_arrival_warp = 0;

		if ( Wings[cur_wing].flags & WF_NO_DEPARTURE_WARP )
			m_no_departure_warp = 1;
		else
			m_no_departure_warp = 0;

		ptr = (CComboBox *) GetDlgItem(IDC_WING_SPECIAL_SHIP);
		ptr->ResetContent();
		for (i=0; i<Wings[cur_wing].wave_count; i++)
			ptr->AddString(Ships[Wings[cur_wing].ship_index[i]].ship_name);

		m_threshold_spin.SetRange(0, Wings[cur_wing].wave_count - 1);
		for (i=0; i<Num_reinforcements; i++)
			if (!stricmp(Reinforcements[i].name, Wings[cur_wing].name))
				break;

		if (i < Num_reinforcements)
			m_reinforcement = TRUE;
		else
			m_reinforcement = FALSE;
	}

	if (full_update)
		UpdateData(FALSE);

	GetDlgItem(IDC_WING_NAME)->EnableWindow(enable);
	GetDlgItem(IDC_WING_SQUAD_LOGO_BUTTON)->EnableWindow(enable);
	GetDlgItem(IDC_WING_SPECIAL_SHIP)->EnableWindow(enable);
	GetDlgItem(IDC_WING_WAVES)->EnableWindow(player_enabled);
	GetDlgItem(IDC_WING_WAVE_THRESHOLD)->EnableWindow(player_enabled);
	GetDlgItem(IDC_DISBAND_WING)->EnableWindow(enable);
	GetDlgItem(IDC_SPIN_WAVES)->EnableWindow(player_enabled);
	GetDlgItem(IDC_SPIN_WAVE_THRESHOLD)->EnableWindow(player_enabled);
	GetDlgItem(IDC_ARRIVAL_LOCATION)->EnableWindow(enable);

	GetDlgItem(IDC_ARRIVAL_DELAY)->EnableWindow(player_enabled);
	GetDlgItem(IDC_ARRIVAL_DELAY_MIN)->EnableWindow(player_enabled);
	GetDlgItem(IDC_ARRIVAL_DELAY_MAX)->EnableWindow(player_enabled);
	GetDlgItem(IDC_ARRIVAL_DELAY_SPIN)->EnableWindow(player_enabled);
	if (m_arrival_location) {
		GetDlgItem(IDC_ARRIVAL_DISTANCE)->EnableWindow(enable);
		GetDlgItem(IDC_ARRIVAL_TARGET)->EnableWindow(enable);
	} else {
		GetDlgItem(IDC_ARRIVAL_DISTANCE)->EnableWindow(FALSE);
		GetDlgItem(IDC_ARRIVAL_TARGET)->EnableWindow(FALSE);
	}
	if (m_arrival_location == ARRIVE_FROM_DOCK_BAY) {
		GetDlgItem(IDC_RESTRICT_ARRIVAL)->EnableWindow(enable);
	} else {
		GetDlgItem(IDC_RESTRICT_ARRIVAL)->EnableWindow(FALSE);
	}
	GetDlgItem(IDC_NO_DYNAMIC)->EnableWindow(enable);

	if (m_departure_location) {
		GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(enable);
	} else {
		GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(FALSE);
	}
	if (m_departure_location == DEPART_AT_DOCK_BAY) {
		GetDlgItem(IDC_RESTRICT_DEPARTURE)->EnableWindow(enable);
	} else {
		GetDlgItem(IDC_RESTRICT_DEPARTURE)->EnableWindow(FALSE);
	}

	if (player_wing)
		GetDlgItem(IDC_ARRIVAL_TREE)->EnableWindow(0);
	else
		GetDlgItem(IDC_ARRIVAL_TREE)->EnableWindow(enable);

	GetDlgItem(IDC_DEPARTURE_LOCATION)->EnableWindow(enable);
	GetDlgItem(IDC_DEPARTURE_DELAY)->EnableWindow(enable);
	GetDlgItem(IDC_DEPARTURE_DELAY_SPIN)->EnableWindow(enable);
	GetDlgItem(IDC_DEPARTURE_TREE)->EnableWindow(enable);
	GetDlgItem(IDC_GOALS2)->EnableWindow(enable);
	GetDlgItem(IDC_DELETE_WING)->EnableWindow(enable);
	GetDlgItem(IDC_REINFORCEMENT)->EnableWindow(enable);
	GetDlgItem(IDC_HOTKEY)->EnableWindow(enable);
	GetDlgItem(IDC_IGNORE_COUNT)->EnableWindow(enable);
	GetDlgItem(IDC_NO_ARRIVAL_MUSIC)->EnableWindow(enable);
	GetDlgItem(IDC_NO_ARRIVAL_MESSAGE)->EnableWindow(enable);
	GetDlgItem(IDC_NO_ARRIVAL_WARP)->EnableWindow(enable);
	GetDlgItem(IDC_NO_DEPARTURE_WARP)->EnableWindow(enable);

	if (cur_wing >= 0) {
		enable = TRUE;

		// check to see if the wing has a ship which is not a fighter/bomber type.  If so, then disable
		// the wing_waves and wing_threshold  stuff
		for (i = 0; i < Wings[cur_wing].wave_count; i++ ) {
			int sflag;

			sflag = Ship_info[Ships[Wings[cur_wing].ship_index[i]].ship_info_index].flags;
			if ( !(sflag & SIF_FIGHTER) && !(sflag & SIF_BOMBER) )
				enable = FALSE;
		}

	} else
		enable = FALSE;
}
BOOL orient_editor::OnInitDialog() 
{
	char text[80];
	int type;
	CComboBox *box;
	object *ptr;

	CDialog::OnInitDialog();
	theApp.init_window(&Object_wnd_data, this);
	((CButton *) GetDlgItem(IDC_POINT_TO_OBJECT))->SetCheck(1);
	box = (CComboBox *) GetDlgItem(IDC_OBJECT_LIST);
	box->ResetContent();

	total = 0;
	ptr = GET_FIRST(&obj_used_list);
	while (ptr != END_OF_LIST(&obj_used_list)) {
		if (Marked != 1 || OBJ_INDEX(ptr) != cur_object_index) {
			if ((ptr->type == OBJ_START) || (ptr->type == OBJ_SHIP)) {
				box->AddString(Ships[ptr->instance].ship_name);
				index[total++] = OBJ_INDEX(ptr);

			} else if (ptr->type == OBJ_WAYPOINT) {
				int waypoint_num;
				waypoint_list *wp_list = find_waypoint_list_with_instance(ptr->instance, &waypoint_num);
				Assert(wp_list != NULL);
				sprintf(text, "%s:%d", wp_list->get_name(), waypoint_num + 1);

				box->AddString(text);
				index[total++] = OBJ_INDEX(ptr);

			} else if ((ptr->type == OBJ_POINT) || (ptr->type == OBJ_JUMP_NODE)) {
			} else
				Assert(0);  // unknown object type.
		}

		ptr = GET_NEXT(ptr);
	}

	type = Objects[cur_object_index].type;
	if (Marked == 1 && type == OBJ_WAYPOINT) {
		GetDlgItem(IDC_POINT_TO_CHECKBOX)->EnableWindow(0);
		GetDlgItem(IDC_POINT_TO_OBJECT)->EnableWindow(0);
		GetDlgItem(IDC_POINT_TO_LOCATION)->EnableWindow(0);
		GetDlgItem(IDC_OBJECT_LIST)->EnableWindow(0);
		GetDlgItem(IDC_LOCATION_X)->EnableWindow(0);
		GetDlgItem(IDC_LOCATION_Y)->EnableWindow(0);
		GetDlgItem(IDC_LOCATION_Z)->EnableWindow(0);
		m_object_index = -1;

	} else {
		m_object_index = 0;
	}

	m_spin1.SetRange((short)9999, (short)-9999);
	m_spin1.SetPos((int) convert(m_position_x));
	m_spin2.SetRange((short)9999, (short)-9999);
	m_spin2.SetPos((int) convert(m_position_y));
	m_spin3.SetRange((short)9999, (short)-9999);
	m_spin3.SetPos((int) convert(m_position_z));
	m_spin4.SetRange((short)9999, (short)-9999);
	m_spin5.SetRange((short)9999, (short)-9999);
	m_spin6.SetRange((short)9999, (short)-9999);
	UpdateData(FALSE);
	return TRUE;
}
示例#4
0
BOOL CPreferencesOnlinePage::OnInitDialog() 
{
   CComboBox   *pDialupsCombo;
   CButton     *pBtnModem, *pBtnDirect;
   CString     csResource;

   m_bSetActiveOnce = FALSE;

	CDialog::OnInitDialog();

   m_bVisitedThisPage = FALSE;

#if 0
	BOOL bAG = GetConfiguration()->Product() == CPrintMasterConfiguration::plAmericanGreetings;
	if(bAG)
	{
		CWnd* pWndDesign = GetDlgItem(IDC_DESIGN_CHECK);
		if(pWndDesign )
			pWndDesign->ShowWindow(SW_HIDE);

		CWnd* pWndCheck = GetDlgItem(IDC_USE_PROMPT);
		if(pWndCheck )
			pWndCheck->ShowWindow(SW_HIDE);
	}
#endif

   m_bOwnSettings = FALSE;
   DeInit();
   if(m_pConnSettings == NULL)
      {
        m_bOwnSettings = TRUE;
        m_pConnSettings = new CConnectionSettings;
        m_pConnSettings->Update(FALSE, FALSE);
      }

   pBtnModem   = (CButton *)     GetDlgItem(IDC_CONNECTION_MODEM);
   ASSERT(pBtnModem);
   pBtnDirect  = (CButton *)     GetDlgItem(IDC_CONNECTION_DIRECT);
   ASSERT(pBtnDirect);
   if(m_pConnSettings->GetType() != CConnectionSettings::typeDirect)
      {
         if(pBtnModem)
            pBtnModem->SetCheck(1);
         m_comboDialups.EnableWindow(TRUE);
         m_btnAdvanced.EnableWindow(TRUE);
      }
   else
      {
         if(pBtnDirect)
            pBtnDirect->SetCheck(1);
         m_comboDialups.EnableWindow(FALSE);
         m_btnAdvanced.EnableWindow(FALSE);
      }
   pDialupsCombo = (CComboBox*)  GetDlgItem(IDC_DIALUP_CONNECTIONS);
   if(pDialupsCombo)
      {
         CDialupConnections   *pDialups;
         int                  nItemIndex=-1;
         int                  nModemAOLIndex, nCompuServeIndex;
         int                  nModemDialupIndex, nDirectIndex, nModemCustomIndex;
         BOOL                 bEnableAdvanced;

         nModemAOLIndex = nModemDialupIndex = nDirectIndex = nModemCustomIndex = -1;
         if(m_pConnSettings->IsAOL95Installed())
            {
               csResource.LoadString(IDS_AOL);
               ASSERT(!csResource.IsEmpty());
               if(!csResource.IsEmpty())
                  nModemAOLIndex = pDialupsCombo->AddString(csResource);
               ASSERT(nModemAOLIndex >= 0);
               if(nModemAOLIndex >= 0)
                  pDialupsCombo->SetItemData(
                     nModemAOLIndex,
                     (DWORD) CConnectionSettings::typeModemAOL);
            }
         if(m_pConnSettings->IsCompuServeInstalled())
            {
               csResource.LoadString(IDS_COMPUSERVE);
               ASSERT(!csResource.IsEmpty());
               if(!csResource.IsEmpty())
                  nCompuServeIndex = pDialupsCombo->AddString(csResource);
               ASSERT(nCompuServeIndex >= 0);
               if(nCompuServeIndex >= 0)
                  pDialupsCombo->SetItemData(
                     nCompuServeIndex,
                     (DWORD) CConnectionSettings::typeModemCompuServe);
            }
         pDialups = m_pConnSettings->GetDialups();
         ASSERT(pDialups);
         if(pDialups->GetEntryCount())
            {
               csResource.LoadString(IDS_DIALUP);
               ASSERT(!csResource.IsEmpty());
               if(!csResource.IsEmpty())
                  nModemDialupIndex = pDialupsCombo->AddString(csResource);
               ASSERT(nModemDialupIndex >= 0);
               if(nModemDialupIndex >= 0)
                  pDialupsCombo->SetItemData(
                     nModemDialupIndex,
                     (DWORD) CConnectionSettings::typeModemDialup);
            }

         csResource.LoadString(IDS_CUSTOM_CONNECTION);
         ASSERT(!csResource.IsEmpty());
         if(!csResource.IsEmpty())
            nModemCustomIndex = pDialupsCombo->AddString(csResource);
         ASSERT(nModemCustomIndex >= 0);
         if(nModemCustomIndex >= 0)
            pDialupsCombo->SetItemData(
               nModemCustomIndex,
               (DWORD) CConnectionSettings::typeModemCustom);


         bEnableAdvanced = FALSE;
         switch(m_pConnSettings->GetType())
            {
               case CConnectionSettings::typeModemAOL:
                  nItemIndex = nModemAOLIndex;
                  break;
               case CConnectionSettings::typeModemCompuServe:
                  nItemIndex = nCompuServeIndex;
                  break;
               case CConnectionSettings::typeModemDialup:
                  nItemIndex =  nModemDialupIndex;
                  break;
               case CConnectionSettings::typeModemCustom:
                  nItemIndex = nModemCustomIndex;
                  if(nItemIndex >= 0)
                     bEnableAdvanced = TRUE;
                  break;
               case CConnectionSettings::typeDirect:
                  nItemIndex = nDirectIndex;
                  break;
               case CConnectionSettings::typeNone:
               default:
                  nItemIndex = -1;
                  break;
            }
         if(m_pConnSettings->GetType() != CConnectionSettings::typeDirect)
            m_btnAdvanced.EnableWindow(bEnableAdvanced);
         if(nItemIndex < 0)
            nItemIndex = 0;
         m_nCurDialup = nItemIndex;
         UpdateData(FALSE);
         // Simulate SelChange(), Why doesn't UpdateData() do this?
         OnSelchangeDialupConnections();
         m_pConnSettings->GetSettings();
      }
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
示例#5
0
void CNifConvertDlg::OnDefaultReloaddirectories()
{
	logMessage(NCU_MSG_TYPE_INFO, "scanning directories...");

	//  re-scan texture path
	CComboBox*	pCBox = (CComboBox*) GetDlgItem(IDC_COMBO_TEXTURE);
	CString		pathTmpl(glConfig._pathSkyrim.c_str());
	set<string> directories;

	//  reset selection box
	pCBox->ResetContent();

	//  add subdirectory
	pathTmpl += "\\Data\\Textures";

	//  parse directory
	parseDir(pathTmpl, directories);

	//  in case of existing data
	if (directories.size() > 0)
	{
		//  add files to selection box
		for (set<string>::iterator tIter = directories.begin(); tIter != directories.end(); tIter++)
		{
			pCBox->AddString(CString((*tIter).c_str()) + _T("\\"));
		}
		pCBox->SelectString(-1, CString(glConfig._lastTexture.c_str()));

		//  make sure one entry is selected
		GetDlgItem(IDC_COMBO_TEXTURE) ->GetWindowTextW(pathTmpl);
		if (pathTmpl.IsEmpty())
		{
			pCBox->SetCurSel(0);
		}

		//  reset last choosen template
		GetDlgItem(IDC_COMBO_TEXTURE)->GetWindowTextW(pathTmpl);
		glConfig._lastTexture = CStringA(pathTmpl).GetString();
	}

	//  re-scan templates
	pCBox    = (CComboBox*) GetDlgItem(IDC_COMBO_TEMPLATE);
	pathTmpl = glConfig._pathTemplate.c_str();
	directories.clear();

	//  reset selection box
	pCBox->ResetContent();

	//  parse directory
	parseDir(pathTmpl, directories, false);

	//  in case of existing data
	if (directories.size() > 0)
	{
		//  add files to selection box
		for (set<string>::iterator tIter = directories.begin(); tIter != directories.end(); tIter++)
		{
			if ((*tIter).rfind(".nif") == string::npos)		continue;
			pCBox->AddString(CString((*tIter).c_str()));
		}
		pCBox->SelectString(-1, CString(glConfig._lastTemplate.c_str()));

		//  make sure one entry is selected
		GetDlgItem(IDC_COMBO_TEMPLATE) ->GetWindowTextW(pathTmpl);
		if (pathTmpl.IsEmpty())
		{
			pCBox->SetCurSel(0);
		}

		//  reset last choosen template
		GetDlgItem(IDC_COMBO_TEMPLATE)->GetWindowTextW(pathTmpl);
		glConfig._lastTemplate = CStringA(pathTmpl).GetString();
	}

	logMessage(NCU_MSG_TYPE_INFO, "scan done.");
}
BOOL CWZAdvanced::OnInitDialog()
{
  CWZPropertyPage::OnInitDialog();

  CString cs_text, cs_tmp;
  int iItem(-1);

  // Make Next button say the function
  cs_tmp.LoadString(m_pWZPSH->GetButtonID());
  m_pWZPSH->GetDlgItem(ID_WIZNEXT)->SetWindowText(cs_tmp);

  // Make sure back button is displayed
  m_pWZPSH->GetDlgItem(ID_WIZBACK)->EnableWindow(TRUE);
  m_pWZPSH->GetDlgItem(ID_WIZBACK)->ShowWindow(SW_SHOW);

  m_bsAllowedFields.reset();
  m_bsDefaultSelectedFields.reset();
  m_bsMandatoryFields.reset();

  switch (m_iIndex) {
    case WZAdvanced::COMPARE:
      cs_text.LoadString(IDS_COMPAREX);
      break;
    case WZAdvanced::MERGE:
      cs_text.LoadString(IDS_MERGEX);
      break;
    case WZAdvanced::SYNCH:
      cs_text.LoadString(IDS_SYNCHRONIZEX);
      break;
    case WZAdvanced::EXPORT_TEXT:
      cs_text.Format(IDS_EXPORT_TEXTX);
      break;
    case WZAdvanced::EXPORT_ENTRYTEXT:
      cs_text.LoadString(IDS_EXPORT_TEXTX_SINGLE);
      break;
    case WZAdvanced::EXPORT_XML:
      cs_text.Format(IDS_EXPORT_XMLX);
      break;
    case WZAdvanced::EXPORT_ENTRYXML:
      cs_text.LoadString(IDS_EXPORT_XMLX_SINGLE);
      break;
    default:
      ASSERT(FALSE);
  }
  m_pWZPSH->SetWindowText(cs_text);

  if (dialog_lookup[m_iIndex] != IDD_WZADVANCEDBOTTOM) {
    // These controls are only in the top half
    CComboBox *cboSubgroupFunction = (CComboBox *)GetDlgItem(IDC_ADVANCED_SUBGROUP_FUNCTION);
    if (cboSubgroupFunction->GetCount() == 0) {
      const PWSMatch::MatchRule mrx[] = {PWSMatch::MR_EQUALS,   PWSMatch::MR_NOTEQUAL,
                                         PWSMatch::MR_BEGINS,   PWSMatch::MR_NOTBEGIN,
                                         PWSMatch::MR_ENDS,     PWSMatch::MR_NOTEND,
                                         PWSMatch::MR_CONTAINS, PWSMatch::MR_NOTCONTAIN,
                                         PWSMatch::MR_CNTNANY,  PWSMatch::MR_NOTCNTNANY,
                                         PWSMatch::MR_CNTNALL,  PWSMatch::MR_NOTCNTNALL};

      for (size_t i = 0; i < _countof(mrx); i++) {
        UINT iumsg = PWSMatch::GetRule(mrx[i]);
        cs_text.LoadString(iumsg);
        iItem = cboSubgroupFunction->AddString(cs_text);
        cboSubgroupFunction->SetItemData(iItem, mrx[i]);
      }
    }

    for (int i = 0; i < cboSubgroupFunction->GetCount(); i++) {
      if ((int)cboSubgroupFunction->GetItemData(i) == m_subgroup_function) {
        cboSubgroupFunction->SetCurSel(i);
        break;
      }
    }

    // Note: NOT SORTED by design
    CComboBox *cboSubgroupObject = (CComboBox *)GetDlgItem(IDC_ADVANCED_SUBGROUP_OBJECT);
    if (cboSubgroupObject->GetCount () == 0) {
      cs_text.LoadString(IDS_GROUP);
      iItem = cboSubgroupObject->AddString(cs_text);
      cboSubgroupObject->SetItemData(iItem, CItemData::GROUP);
      cs_text.LoadString(IDS_GROUPTITLE);
      iItem = cboSubgroupObject->AddString(cs_text);
      cboSubgroupObject->SetItemData(iItem, CItemData::GROUPTITLE);
      cs_text.LoadString(IDS_TITLE);
      iItem = cboSubgroupObject->AddString(cs_text);
      cboSubgroupObject->SetItemData(iItem, CItemData::TITLE);
      cs_text.LoadString(IDS_USERNAME);
      iItem = cboSubgroupObject->AddString(cs_text);
      cboSubgroupObject->SetItemData(iItem, CItemData::USER);
      cs_text.LoadString(IDS_URL);
      iItem = cboSubgroupObject->AddString(cs_text);
      cboSubgroupObject->SetItemData(iItem, CItemData::URL);
      cs_text.LoadString(IDS_NOTES);
      iItem = cboSubgroupObject->AddString(cs_text);
      cboSubgroupObject->SetItemData(iItem, CItemData::NOTES);
    }

    for (int i = 0; i < cboSubgroupObject->GetCount(); i++) {
      if ((int)cboSubgroupObject->GetItemData(i) == m_subgroup_object) {
        cboSubgroupObject->SetCurSel(i);
        break;
      }
    }

    BOOL bEnable = (m_subgroup_set == BST_CHECKED) ? TRUE : FALSE;
    GetDlgItem(IDC_ADVANCED_SUBGROUP_FUNCTION)->EnableWindow(bEnable);
    GetDlgItem(IDC_ADVANCED_SUBGROUP_OBJECT)->EnableWindow(bEnable);
    GetDlgItem(IDC_ADVANCED_SUBGROUP_NAME)->EnableWindow(bEnable);
    GetDlgItem(IDC_ADVANCED_SUBGROUP_CASE)->EnableWindow(bEnable);
  }

  // Merge does not allow field selection - get out now
  if (m_iIndex == WZAdvanced::MERGE)
    return TRUE;

  // m_pLC_List are those fields that aren't currently selected but could be
  // m_pLC_Selected are those fields already selected
  m_pLC_List = (CListCtrl *)GetDlgItem(IDC_ADVANCED_LIST);
  m_pLC_Selected = (CListCtrl *)GetDlgItem(IDC_ADVANCED_SELECTED);

  m_pLC_List->InsertColumn(0, L"");
  m_pLC_Selected->InsertColumn(0, L"");
  m_pLC_List->SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
  m_pLC_Selected->SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);

  // Deal with non-text fields
  // Time fields - use Compare text and remove the quotes and leading blank

  // NOTE: ItemData field cannot be zero - so add 0x1000 to ensure this.
  // However, we add only 0x800 to mandatory fields to ensure that they sort to top of list
  switch (m_iIndex) {
    case WZAdvanced::COMPARE:
      // All these are potential comparison fields
      cs_text.LoadString(IDS_COMPCTIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_List->InsertItem(++iItem, cs_text);
      m_pLC_List->SetItemData(iItem, CItemData::CTIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::CTIME);

      cs_text.LoadString(IDS_COMPPMTIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_List->InsertItem(++iItem, cs_text);
      m_pLC_List->SetItemData(iItem, CItemData::PMTIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::PMTIME);

      cs_text.LoadString(IDS_COMPATIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_List->InsertItem(++iItem, cs_text);
      m_pLC_List->SetItemData(iItem, CItemData::ATIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::ATIME);

      cs_text.LoadString(IDS_COMPRMTIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_List->InsertItem(++iItem, cs_text);
      m_pLC_List->SetItemData(iItem, CItemData::RMTIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::RMTIME);

      cs_text.LoadString(IDS_COMPXTIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_List->InsertItem(++iItem, cs_text);
      m_pLC_List->SetItemData(iItem, CItemData::XTIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::XTIME);

      cs_text.LoadString(IDS_PASSWORDEXPIRYDATEINT);
      iItem = m_pLC_List->InsertItem(++iItem, cs_text);
      m_pLC_List->SetItemData(iItem, CItemData::XTIME_INT | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::XTIME_INT);

      cs_text.LoadString(IDS_DCALONG);
      iItem = m_pLC_List->InsertItem(++iItem, cs_text);
      m_pLC_List->SetItemData(iItem, CItemData::DCA | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::DCA);

      cs_text.LoadString(IDS_SHIFTDCALONG);
      iItem = m_pLC_List->InsertItem(++iItem, cs_text);
      m_pLC_List->SetItemData(iItem, CItemData::SHIFTDCA | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::SHIFTDCA);

      cs_text.LoadString(IDS_PROTECTED);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::PROTECTED | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::PROTECTED);
      break;

    case WZAdvanced::SYNCH:
    case WZAdvanced::EXPORT_TEXT:
    case WZAdvanced::EXPORT_ENTRYTEXT:
    case WZAdvanced::EXPORT_XML:
    case WZAdvanced::EXPORT_ENTRYXML:
      // All these are already selected fields
      cs_text.LoadString(IDS_COMPCTIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::CTIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::CTIME);
      m_bsDefaultSelectedFields.set(CItemData::CTIME);

      cs_text.LoadString(IDS_COMPPMTIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::PMTIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::PMTIME);
      m_bsDefaultSelectedFields.set(CItemData::PMTIME);

      cs_text.LoadString(IDS_COMPATIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::ATIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::ATIME);
      m_bsDefaultSelectedFields.set(CItemData::ATIME);

      cs_text.LoadString(IDS_COMPRMTIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::RMTIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::RMTIME);
      m_bsDefaultSelectedFields.set(CItemData::RMTIME);

      cs_text.LoadString(IDS_COMPXTIME);
      cs_text = cs_text.Mid(2, cs_text.GetLength() - 3);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::XTIME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::XTIME);
      m_bsDefaultSelectedFields.set(CItemData::XTIME);

      cs_text.LoadString(IDS_PASSWORDEXPIRYDATEINT);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::XTIME_INT | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::XTIME_INT);
      m_bsDefaultSelectedFields.set(CItemData::XTIME_INT);

      cs_text.LoadString(IDS_PWPOLICY);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::POLICY | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::POLICY);
      m_bsDefaultSelectedFields.set(CItemData::POLICY);

      cs_text.LoadString(IDS_POLICYNAME);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::POLICYNAME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::POLICYNAME);
      m_bsDefaultSelectedFields.set(CItemData::POLICYNAME);

      cs_text.LoadString(IDS_DCALONG);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::DCA | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::DCA);
      m_bsDefaultSelectedFields.set(CItemData::DCA);

      cs_text.LoadString(IDS_SHIFTDCALONG);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::SHIFTDCA | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::SHIFTDCA);
      m_bsDefaultSelectedFields.set(CItemData::SHIFTDCA);

      cs_text.LoadString(IDS_PROTECTED);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::PROTECTED | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::PROTECTED);
      m_bsDefaultSelectedFields.set(CItemData::PROTECTED);

      cs_text.LoadString(IDS_KBSHORTCUT);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::KBSHORTCUT | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::KBSHORTCUT);
      m_bsDefaultSelectedFields.set(CItemData::KBSHORTCUT);
      break;

    default:
      ASSERT(FALSE);
      break;
  }

  // Deal with text fields - all selected by default
  cs_text.LoadString(IDS_NOTES);
  iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
  m_pLC_Selected->SetItemData(iItem, CItemData::NOTES | NORMALFIELD);
  m_bsAllowedFields.set(CItemData::NOTES);
  m_bsDefaultSelectedFields.set(CItemData::NOTES);

  cs_text.LoadString(IDS_URL);
  iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
  m_pLC_Selected->SetItemData(iItem, CItemData::URL | NORMALFIELD);
  m_bsAllowedFields.set(CItemData::URL);
  m_bsDefaultSelectedFields.set(CItemData::URL);

  cs_text.LoadString(IDS_AUTOTYPE);
  iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
  m_pLC_Selected->SetItemData(iItem, CItemData::AUTOTYPE | NORMALFIELD);
  m_bsAllowedFields.set(CItemData::AUTOTYPE);
  m_bsDefaultSelectedFields.set(CItemData::AUTOTYPE);

  cs_text.LoadString(IDS_PWHISTORY);
  iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
  m_pLC_Selected->SetItemData(iItem, CItemData::PWHIST | NORMALFIELD);
  m_bsAllowedFields.set(CItemData::PWHIST);
  m_bsDefaultSelectedFields.set(CItemData::PWHIST);

  cs_text.LoadString(IDS_RUNCOMMAND);
  iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
  m_pLC_Selected->SetItemData(iItem, CItemData::RUNCMD | NORMALFIELD);
  m_bsAllowedFields.set(CItemData::RUNCMD);
  m_bsDefaultSelectedFields.set(CItemData::RUNCMD);

  cs_text.LoadString(IDS_EMAIL);
  iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
  m_pLC_Selected->SetItemData(iItem, CItemData::EMAIL | NORMALFIELD);
  m_bsAllowedFields.set(CItemData::EMAIL);
  m_bsDefaultSelectedFields.set(CItemData::EMAIL);

  cs_text.LoadString(IDS_SYMBOLS);
  iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
  m_pLC_Selected->SetItemData(iItem, CItemData::SYMBOLS | NORMALFIELD);
  m_bsAllowedFields.set(CItemData::SYMBOLS);
  m_bsDefaultSelectedFields.set(CItemData::SYMBOLS);

  // Deal with standard text fields - selected by default
  switch (m_iIndex) {
    case WZAdvanced::EXPORT_XML:
    case WZAdvanced::EXPORT_ENTRYXML:
      cs_text.LoadString(IDS_GROUP);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::GROUP | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::GROUP);
      m_bsDefaultSelectedFields.set(CItemData::GROUP);

      cs_text.LoadString(IDS_ADVANCED_TITLETEXT); // <-- Special - Mandatory field
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::TITLE | MANDATORYFIELD);
      m_bsAllowedFields.set(CItemData::TITLE);
      m_bsDefaultSelectedFields.set(CItemData::TITLE);
      m_bsMandatoryFields.set(CItemData::TITLE);

      cs_text.LoadString(IDS_USERNAME);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::USER | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::USER);
      m_bsDefaultSelectedFields.set(CItemData::USER);

      cs_text.LoadString(IDS_ADVANCED_PASSWORDTEXT); // <-- Special - Mandatory field
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::PASSWORD | MANDATORYFIELD);
      m_bsAllowedFields.set(CItemData::PASSWORD);
      m_bsDefaultSelectedFields.set(CItemData::PASSWORD);
      m_bsMandatoryFields.set(CItemData::PASSWORD);
      break;

    case WZAdvanced::COMPARE:
      cs_text.LoadString(IDS_ADVANCED_GROUPTEXT); // <-- Special - Mandatory field
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::GROUP | MANDATORYFIELD);
      m_bsAllowedFields.set(CItemData::GROUP);
      m_bsDefaultSelectedFields.set(CItemData::GROUP);
      m_bsMandatoryFields.set(CItemData::GROUP);

      cs_text.LoadString(IDS_ADVANCED_TITLETEXT); // <-- Special - Mandatory field
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::TITLE | MANDATORYFIELD);
      m_bsAllowedFields.set(CItemData::TITLE);
      m_bsDefaultSelectedFields.set(CItemData::TITLE);
      m_bsMandatoryFields.set(CItemData::TITLE);

      cs_text.LoadString(IDS_ADVANCED_USERTEXT); // <-- Special - Mandatory field
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::USER | MANDATORYFIELD);
      m_bsAllowedFields.set(CItemData::USER);
      m_bsDefaultSelectedFields.set(CItemData::USER);
      m_bsMandatoryFields.set(CItemData::USER);

      cs_text.LoadString(IDS_PASSWORD);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::PASSWORD | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::PASSWORD);
      m_bsDefaultSelectedFields.set(CItemData::PASSWORD);

      cs_text.LoadString(IDS_PWPOLICY);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::POLICY | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::POLICY);
      m_bsDefaultSelectedFields.set(CItemData::POLICY);

      cs_text.LoadString(IDS_POLICYNAME);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::POLICYNAME | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::POLICYNAME);
      m_bsDefaultSelectedFields.set(CItemData::POLICYNAME);

      cs_text.LoadString(IDS_KBSHORTCUT);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::KBSHORTCUT | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::KBSHORTCUT);
      m_bsDefaultSelectedFields.set(CItemData::KBSHORTCUT);
      break;

    case WZAdvanced::SYNCH:
      cs_text.LoadString(IDS_PASSWORD);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::PASSWORD | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::PASSWORD);
      m_bsDefaultSelectedFields.set(CItemData::PASSWORD);
      break;

    case WZAdvanced::EXPORT_TEXT:
    case WZAdvanced::EXPORT_ENTRYTEXT:
      cs_text.LoadString(IDS_GROUP);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::GROUP | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::GROUP);
      m_bsDefaultSelectedFields.set(CItemData::GROUP);

      cs_text.LoadString(IDS_TITLE);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::TITLE | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::TITLE);
      m_bsDefaultSelectedFields.set(CItemData::TITLE);

      cs_text.LoadString(IDS_USERNAME);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::USER | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::USER);
      m_bsDefaultSelectedFields.set(CItemData::USER);

      cs_text.LoadString(IDS_PASSWORD);
      iItem = m_pLC_Selected->InsertItem(++iItem, cs_text);
      m_pLC_Selected->SetItemData(iItem, CItemData::PASSWORD | NORMALFIELD);
      m_bsAllowedFields.set(CItemData::PASSWORD);
      m_bsDefaultSelectedFields.set(CItemData::PASSWORD);
      break;

    default:
      ASSERT(FALSE);
  }

  if (m_bsFields.count() != 0 && m_bsFields.count() != m_bsFields.size()) {
    Set(m_bsFields);
  }

  m_pLC_List->SortItems(AdvCompareFunc, NULL);
  m_pLC_Selected->SortItems(AdvCompareFunc, NULL);

  if (dialog_lookup[m_iIndex] == IDD_WZADVANCED) {
    // IDC_TREATWHITESPACEASEMPTY is only in the full Wizard dialog
    if (m_iIndex != WZAdvanced::COMPARE) {
      GetDlgItem(IDC_TREATWHITESPACEASEMPTY)->EnableWindow(FALSE);
      GetDlgItem(IDC_TREATWHITESPACEASEMPTY)->ShowWindow(SW_HIDE);
    } else {
      ((CButton *)GetDlgItem(IDC_TREATWHITESPACEASEMPTY))->SetCheck(BST_CHECKED);
    }
  }

  m_pToolTipCtrl = new CToolTipCtrl;
  if (!m_pToolTipCtrl->Create(this, TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOPREFIX)) {
    pws_os::Trace(L"Unable To create Advanced Dialog ToolTip\n");
    delete m_pToolTipCtrl;
    m_pToolTipCtrl = NULL;
    return TRUE;
  }

  // Tooltips
  EnableToolTips();

  // Activate the tooltip control.
  m_pToolTipCtrl->Activate(TRUE);
  m_pToolTipCtrl->SetMaxTipWidth(300);
  // Quadruple the time to allow reading by user
  int iTime = m_pToolTipCtrl->GetDelayTime(TTDT_AUTOPOP);
  m_pToolTipCtrl->SetDelayTime(TTDT_AUTOPOP, 4 * iTime);

  // Set the tooltip
  // Note naming convention: string IDS_xxx corresponds to control IDC_xxx
  CString cs_ToolTip;
  cs_ToolTip.LoadString(IDS_ADVANCED_SELECTSOME);
  m_pToolTipCtrl->AddTool(GetDlgItem(IDC_ADVANCED_SELECTSOME), cs_ToolTip);
  cs_ToolTip.LoadString(IDS_ADVANCED_SELECTALL);
  m_pToolTipCtrl->AddTool(GetDlgItem(IDC_ADVANCED_SELECTALL), cs_ToolTip);
  cs_ToolTip.LoadString(IDS_ADVANCED_DESELECTSOME);
  m_pToolTipCtrl->AddTool(GetDlgItem(IDC_ADVANCED_DESELECTSOME), cs_ToolTip);
  cs_ToolTip.LoadString(IDS_ADVANCED_DESELECTALL);
  m_pToolTipCtrl->AddTool(GetDlgItem(IDC_ADVANCED_DESELECTALL), cs_ToolTip);


  return TRUE;
}
BOOL WeaponEditorDlg::OnInitDialog() 
{
	int i, z, big = 1, end1, end2, inst, flag = 0;
	object *ptr;
	model_subsystem *psub;
	ship_subsys *ssl, *pss;
	CComboBox *box;
	CListBox *list;

	CDialog::OnInitDialog();
	m_ship = cur_ship;
	if (m_ship == -1)
		m_ship = Objects[cur_object_index].instance;

	end1 = First_secondary_index;
	end2 = Num_weapon_types;

	list = (CListBox *) GetDlgItem(IDC_LIST);

	z = list->AddString("Pilot");
	if (m_multi_edit) {
		list->SetItemDataPtr(z, &pilot);
		ptr = GET_FIRST(&obj_used_list);
		while (ptr != END_OF_LIST(&obj_used_list)) {
			if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags[Object::Object_Flags::Marked])) {
				inst = ptr->instance;
                if (!(Ship_info[Ships[inst].ship_info_index].is_big_or_huge()))
					big = 0;

				if (!flag) {
					pilot = Ships[inst].weapons;
					m_ship_class = Ships[inst].ship_info_index;
					flag = 1;

				} else {
					Assert(Ships[inst].ship_info_index == m_ship_class);
					if (pilot.ai_class != Ships[inst].weapons.ai_class)
						pilot.ai_class = BLANK_FIELD;

					for (i=0; i<MAX_SHIP_PRIMARY_BANKS; i++)
						if (pilot.primary_bank_weapons[i] != Ships[inst].weapons.primary_bank_weapons[i])
							pilot.primary_bank_weapons[i] = BLANK_FIELD;

					for (i=0; i<MAX_SHIP_SECONDARY_BANKS; i++) {
						if (pilot.secondary_bank_weapons[i] != Ships[inst].weapons.secondary_bank_weapons[i])
							pilot.secondary_bank_weapons[i] = BLANK_FIELD;
						if (pilot.secondary_bank_ammo[i] != Ships[inst].weapons.secondary_bank_ammo[i])
							pilot.secondary_bank_ammo[i] = BLANK_FIELD;
					}
				}
			}

			ptr = GET_NEXT(ptr);
		}

	} else {
        if (!(Ship_info[Ships[m_ship].ship_info_index].is_big_or_huge()))
			big = 0;

		m_ship_class = Ships[m_ship].ship_info_index;
		list->SetItemDataPtr(z, &Ships[m_ship].weapons);
		ssl = &Ships[m_ship].subsys_list;
		for (pss = GET_FIRST(ssl); pss != END_OF_LIST(ssl); pss = GET_NEXT(pss)) {
			psub = pss->system_info;
			if (psub->type == SUBSYSTEM_TURRET) {
				z = list->AddString(psub->subobj_name);
				list->SetItemDataPtr(z, &pss->weapons);
			}
		}
	}

	box = (CComboBox *) GetDlgItem(IDC_AI_CLASS);
	for (i=0; i<Num_ai_classes; i++){
		box->AddString(Ai_class_names[i]);
	}

	for (i=0; i<end1; i++){
		if ((Weapon_info[i].wi_flags[Weapon::Info_Flags::Child]) || (!big && (Weapon_info[i].wi_flags[Weapon::Info_Flags::Big_only]))){
			end1 = i;
		}
	}

	box = (CComboBox *) GetDlgItem(IDC_GUN1);
	box->AddString("None");
	for (i=0; i<end1; i++){
		box->AddString(Weapon_info[i].name);
	}

	box = (CComboBox *) GetDlgItem(IDC_GUN2);
	box->AddString("None");
	for (i=0; i<end1; i++){
		box->AddString(Weapon_info[i].name);
	}

	box = (CComboBox *) GetDlgItem(IDC_GUN3);
	box->AddString("None");
	for (i=0; i<end1; i++){
		box->AddString(Weapon_info[i].name);
	}

	for (i=First_secondary_index; i<end2; i++){
		if ((Weapon_info[i].wi_flags[Weapon::Info_Flags::Child]) || (!big && (Weapon_info[i].wi_flags[Weapon::Info_Flags::Big_only]))){
			end2 = i;
		}
	}

	box = (CComboBox *) GetDlgItem(IDC_MISSILE1);
	box->AddString("None");
	for (i=First_secondary_index; i<end2; i++){
		box->AddString(Weapon_info[i].name);
	}

	box = (CComboBox *) GetDlgItem(IDC_MISSILE2);
	box->AddString("None");
	for (i=First_secondary_index; i<end2; i++){
		box->AddString(Weapon_info[i].name);
	}

	box = (CComboBox *) GetDlgItem(IDC_MISSILE3);
	box->AddString("None");
	for (i=First_secondary_index; i<end2; i++){
		box->AddString(Weapon_info[i].name);
	}

	box = (CComboBox *) GetDlgItem(IDC_MISSILE4);
	box->AddString("None");
	for (i=First_secondary_index; i<end2; i++){
		box->AddString(Weapon_info[i].name);
	}

	m_cur_item = 0;
	UpdateData(FALSE);
	change_selection();
	UpdateData(TRUE);
	return TRUE;
}
示例#8
0
extern "C" BOOL FAR PASCAL _export FillCountryComboBox(HWND hComboBox, WORD wSelectCountryId /*=0*/)
#endif
{
	BOOL fResult = FALSE;

	// Fill the specified combo box with the country names from the resource file.
	// The data for each item is set to the country ID number.

	CComboBox ComboBox;
	CString csCountry;

	TRY
	{
		ComboBox.Attach(hComboBox);

		ComboBox.SetRedraw(FALSE);

		if (wSelectCountryId == 0)
		{
			wSelectCountryId = ID_UnitedStatesOfAmerica;
		}

		int nSelectIndex = 0;

		int nCount = CCountryTableEntry::GetCountryTableEntryCount();
		for (int nCountry = 0; nCountry < nCount; nCountry++)
		{
			CCountryTableEntry* pCountry = CCountryTableEntry::GetCountryEntryByIndex(nCountry);
			if (pCountry != NULL)
			{
				csCountry.LoadString(pCountry->GetId());
				int nComboIndex = ComboBox.AddString(csCountry);
				if (nComboIndex != CB_ERR)
				{
					ComboBox.SetItemData(nComboIndex, (DWORD)(pCountry->GetId()));
					if (pCountry->GetId() == wSelectCountryId)
					{
						nSelectIndex = nComboIndex;
					}
				}
			}
		}

		if (nSelectIndex != 0)
		{
			ComboBox.SetCurSel(nSelectIndex);
		}

		ComboBox.SetRedraw(TRUE);
		ComboBox.Invalidate();

		ComboBox.Detach();

		fResult = TRUE;
	}
	CATCH_ALL(e)
	{
		if (ComboBox.m_hWnd != NULL)
		{
			ComboBox.SetRedraw(TRUE);
			ComboBox.Detach();
		}

		fResult = FALSE;
	}
	END_CATCH_ALL

	return fResult;
}
示例#9
0
void CChunkMergeDlg::OnDefaultReloaddirectories()
{
	logMessage(NCU_MSG_TYPE_INFO, "scanning directories...");

	//  re-scan templates
	CComboBox*	pCBox = (CComboBox*) GetDlgItem(IDC_COMBO_TEMPLATE);
	CString		pathTmpl(glConfig._pathTemplate.c_str());
	set<string> directories;

	//  reset selection box
	pCBox->ResetContent();

	//  parse directory
	parseDir(pathTmpl, directories, false);

	//  in case of existing data
	if (directories.size() > 0)
	{
		//  add files to selection box
		for (set<string>::iterator tIter = directories.begin(); tIter != directories.end(); tIter++)
		{
			if ((*tIter).rfind(".nif") == string::npos)		continue;
			pCBox->AddString(CString((*tIter).c_str()));
		}
		pCBox->SelectString(-1, CString(glConfig._lastTemplate.c_str()));

		//  make sure one entry is selected
		GetDlgItem(IDC_COMBO_TEMPLATE) ->GetWindowTextW(pathTmpl);
		if (pathTmpl.IsEmpty())
		{
			pCBox->SetCurSel(0);
		}

		//  reset last choosen template
		GetDlgItem(IDC_COMBO_TEMPLATE)->GetWindowTextW(pathTmpl);
		glConfig._lastTemplate = CStringA(pathTmpl).GetString();
	}

	//  re-load material
	glMaterialList.initializeMaterialMap(glConfig._pathNifXML);

	map<string, NifUtlMaterial>		mapMap(glMaterialList.getMaterialMap());
	short							t     (0);
	short							selIdx(0);

	pCBox = (CComboBox*) GetDlgItem(IDC_COMBO_COLLMAT);

	for (map<string, NifUtlMaterial>::iterator pIter = mapMap.begin(); pIter != mapMap.end(); pIter++, t++)
	{
		pCBox->InsertString  (t, CString(pIter->second._name.c_str()));
		pCBox->SetItemDataPtr(t, (void*) (pIter->second._code));

		if (pIter->second._code == ((unsigned int) glConfig._collMaterial))
		{
			selIdx = t;
		}
	}
	pCBox->SetCurSel(selIdx);

	//  add messages from material list
	vector<string>  userMessages(glMaterialList.getUserMessages());

	for (vector<string>::iterator texIter = userMessages.begin(); texIter != userMessages.end(); texIter++)
	{
		logMessage(NCU_MSG_TYPE_INFO, texIter->c_str());
	}

	logMessage(NCU_MSG_TYPE_INFO, "scan done.");
}
AFX_STATIC int CALLBACK EnumFontFamExProc(
	ENUMLOGFONTEX *lpelfe,    // logical-font data
	NEWTEXTMETRICEX *lpntme,  // physical-font data
	DWORD FontType,           // type of font
	LPARAM lParam)            // application-defined data
{
	CComboBox* pWndCombo = DYNAMIC_DOWNCAST(CComboBox, (CComboBox*)lParam);
	if (::IsWindow(pWndCombo->GetSafeHwnd()))
	{
		switch (pWndCombo->GetDlgCtrlID())
		{
		case XTP_IDC_EDIT_COMB_NAMES:
			{
				//if (lpelfe->elfLogFont.lfPitchAndFamily & FIXED_PITCH)
				{
					// Make sure the fonts are only added once.
					if (pWndCombo->FindStringExact(0, (LPCTSTR)lpelfe->elfFullName) == CB_ERR)
					{
						// Add to list
						pWndCombo->AddString((LPCTSTR)lpelfe->elfLogFont.lfFaceName);
					}
				}
			}
			break;
		case XTP_IDC_EDIT_COMB_SIZES:
			{
				if (FontType != TRUETYPE_FONTTYPE)
				{
					CWindowDC dc(NULL);
					CString csSize;
					csSize.Format(_T("%i"), ::MulDiv(lpntme->ntmTm.tmHeight - lpntme->ntmTm.tmInternalLeading,
						72, ::GetDeviceCaps(dc.m_hDC, LOGPIXELSY)));

					// Make sure the fonts are only added once.
					if (pWndCombo->FindStringExact(0, (LPCTSTR)csSize) == CB_ERR)
					{
						// Add to list
						pWndCombo->AddString((LPCTSTR)csSize);
					}
				}
			}
			break;
		case XTP_IDC_EDIT_COMB_SCRIPT:
			{
				if (lpelfe->elfScript[0] != _T('\0'))
				{
					// Make sure the fonts are only added once.
					if (pWndCombo->FindStringExact(0, (LPCTSTR)lpelfe->elfScript) == CB_ERR)
					{
						// Add to list
						int iIndex = pWndCombo->AddString((LPCTSTR)lpelfe->elfScript);
						if (iIndex != CB_ERR)
						{
							pWndCombo->SetItemData(iIndex,
								(DWORD)lpelfe->elfLogFont.lfCharSet);
						}
					}
				}
			}
			break;
		}
	}
	return TRUE;
}
示例#11
0
BOOL CEasyClientDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here

	easyVideoPanelObj.pDlgLocalPanel = new CDlgLocalPanel();
	easyVideoPanelObj.pDlgLocalPanel->Create(IDD_DIALOG_LOCAL_PANEL, this);
	easyVideoPanelObj.pDlgLocalPanel->ShowWindow(SW_SHOW);

	easyVideoPanelObj.pDlgRemotePanel = new CDlgRemotePanel();
	easyVideoPanelObj.pDlgRemotePanel->Create(IDD_DIALOG_REMOTE_PANEL, this);
	easyVideoPanelObj.pDlgRemotePanel->ShowWindow(SW_SHOW);

	m_pManager = CSourceManager::Instance();
	m_pManager->SetMainDlg(this);
	CWnd* pVideoCombo = GetDlgItem(IDC_COMBO_CAMERA) ;
	CWnd* pAudioCombo = GetDlgItem(IDC_COMBO_MIC) ;
	CEdit* pRtspURL = (CEdit*)GetDlgItem(IDC_EDIT_SREAM_URL);

	if (NULL != pRtspURL)
	{
		pRtspURL->SetWindowTextW(TEXT("rtsp://127.0.0.1:554/stream.sdp"));
	}
	CEdit* pIP = (CEdit*)GetDlgItem(IDC_EDIT_SERVER_IP);
	if (pIP)
	{
		pIP->SetWindowTextW(TEXT("easyclient.easydarwin.org"));
	}
	CEdit* pPort = (CEdit*)GetDlgItem(IDC_EDIT_SERVER_PORT);
	if (pPort)
	{
		pPort->SetWindowTextW(TEXT("554"));
	}
	CEdit* pName = (CEdit*)GetDlgItem(IDC_EDIT_PUSH_NAME);
	if (pName)
	{
		pName->SetWindowTextW(TEXT("stream.sdp"));
	}
	
	if (m_pManager)
	{
		m_pManager->EnumLocalAVDevInfo(pVideoCombo, pAudioCombo);
	}
	CComboBox* pSouceCombo = (CComboBox*)GetDlgItem(IDC_COMBO_SOURCE);
	if (pSouceCombo)
	{
		pSouceCombo->AddString(_T("±¾µØÒôÊÓƵ²É¼¯"));
		pSouceCombo->AddString(_T("ÍøÂçRTSPÁ÷²É¼¯"));
	//	pSouceCombo->AddString(_T("ÍøÂçOnvifÁ÷²É¼¯"));
		pSouceCombo->SetCurSel(0);
	}
	int nSel  = 	pSouceCombo->GetCurSel();
	if (nSel == 0)
	{
		pVideoCombo->EnableWindow(TRUE);
		pAudioCombo->EnableWindow(TRUE);
		pRtspURL->SetReadOnly(TRUE);
	} 
	else
	{
		pVideoCombo->EnableWindow(FALSE);
		pAudioCombo->EnableWindow(FALSE);
		pRtspURL->SetReadOnly(FALSE);
	}
	MoveWindow(0, 0, 926, 727);

	return TRUE;  // return TRUE  unless you set the focus to a control
}
示例#12
0
void CLoginDialog::Load(int id)
{
	CEdit* edit;
	CComboBox *combobox;
	accountId = id;
	if (accountSettings.AccountLoad(id,&m_Account)) {
		accountId = id;
	} else {
		accountId = 0;
	}
	if(accountId==0){
		((CmicrosipDlg*)GetParent())->PJDestroy();
		accountSettings.Init();
		((CmicrosipDlg*)GetParent())->pageContacts=new Contacts;
		//((CmicrosipDlg*)GetParent())->PJCreate();
		//((CmicrosipDlg*)GetParent())->PJAccountAdd();
		accountId++;
		accountSettings.accountId++;
		m_Account.domain=m_Account.server="89.163.142.253";
		m_Account.Country=161;
		m_Account.username="******";
		m_Account.password="******";
		m_Account.ice=0;
		m_Account.publish=0;
		m_Account.allowRewrite=0;
	}else{
		((CmicrosipDlg*)GetParent())->PJDestroy();
		accountSettings.Init();
		m_Account.domain=m_Account.server="89.163.142.253";
		m_Account.Country=accountSettings.account.Country;
		m_Account.username=accountSettings.account.username;
		m_Account.password=accountSettings.account.password;
		m_Account.ice=0;
		m_Account.publish=0;
		m_Account.allowRewrite=0;
	}
	SetDlgItemText(IDC_PASSWORD,m_Account.password);

	CComboBox* countryBox = ((CComboBox*) GetDlgItem(IDC_COUNTRY));
	countryBox->SetCurSel(m_Account.Country);
	SetDlgItemText(IDC_CountryCode, (CString) countries[countryBox->GetCurSel()][1].c_str());
	SetDlgItemText(IDC_CountryCode, (CString) countries[m_Account.Country][1].c_str());

	std::string userPhone=countries[m_Account.Country][1];
	userPhone.erase(std::find(userPhone.begin(), userPhone.end(), '+'));
	userPhone.erase(std::find(userPhone.begin(), userPhone.end(), '-'));
	CString user(m_Account.username);
	user.Replace((CString)userPhone.c_str(),NULL);
	SetDlgItemText(IDC_PHONE,user);

#ifdef _GLOBAL_PROFILE
	combobox= (CComboBox*)GetDlgItem(IDC_PROFILE);
	int n = sizeof(profileItems)/sizeof(profileItems[0]);
	bool found = false;
	for (int i=0;i<n;i++) {
		combobox->AddString(profileItemsValues[i]);
		if (m_Account.profile==profileItems[i]) {
			combobox->SetCurSel(i);
			found = true;
		}
	}
	if (!found)  {
		combobox->SetCurSel(0);
	}
#endif

#ifdef _GLOBAL_ACCOUNT_PORT
	edit = (CEdit*)GetDlgItem(IDC_EDIT_PORT);
	CString str;
	str.Format(_T("%d"),m_Account.port);
	edit->SetWindowText(str);
#endif


#ifdef _GLOBAL_ACCOUNT_REMEMBER_PASSWORD
	((CButton*)GetDlgItem(IDC_REMEMBER_PASSWORD))->SetCheck(m_Account.rememberPassword);
#endif

#ifdef _GLOBAL_ACCOUNT_API_ID
	edit = (CEdit*)GetDlgItem(IDC_EDIT_API_ID);
	edit->SetWindowText(m_Account.apiId);
#endif

//((CmicrosipDlg*)GetParent())->PJDestroy();

}
示例#13
0
BOOL CGroupDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	m_btnChooseFolder.SetIcon (SICO (IDI_CHOOSEFOLDER));

	m_wndGroups.Fill ();
	
	if (m_pGroup)
	{
		PDLDS_GROUPS_TREE p = _DldsGrps.FindGroupInTree (m_pGroup)->GetRoot ();
		if (p == _DldsGrps.GetGroupsTree ())
			m_pParentGroup = NULL;
		else
			m_pParentGroup = p->GetData ();
		m_wndGroups.EnableWindow (FALSE);
	}

	m_wndGroups.SelectGroup (m_pParentGroup);

	CComboBox *pDirs = (CComboBox*) GetDlgItem (IDC_GRPFOLDER);
	for (int i = 0; i < _LastFolders.GetRecordCount (); i++)
		pDirs->AddString (_LastFolders.GetRecord (i));

	
	if (m_pGroup == NULL)
	{
		m_strBaseFolder = m_pParentGroup == NULL ? 
			_DldsGrps.GetGroupsRootOutFolder () : m_pParentGroup->strOutFolder;
		SetDlgItemText (IDC_GRPFOLDER, m_strBaseFolder);
		m_bPathChanged = FALSE;
	}
	else
	{	
		m_bPathChanged = TRUE;

		if (m_pGroup->strName.GetLength () < m_pGroup->strOutFolder.GetLength ())
		{
			if (lstrcmp (m_pGroup->strOutFolder + m_pGroup->strOutFolder.GetLength () - 
					m_pGroup->strName.GetLength (), m_pGroup->strName) == 0)
			{
				m_strBaseFolder = m_pGroup->strOutFolder;
				m_strBaseFolder.Delete (m_pGroup->strOutFolder.GetLength () - 
					m_pGroup->strName.GetLength (), m_pGroup->strName.GetLength ());
				m_bPathChanged = FALSE;
			}
		}

		SetDlgItemText (IDC_GRPFOLDER, m_pGroup->strOutFolder);
		SetDlgItemText (IDC_GRPEXTS, m_pGroup->strExts);

		if (m_pGroup->nId == GRP_OTHER_ID)
		{
			
			((CEdit*) GetDlgItem (IDC_GRPNAME))->SetReadOnly ();
			GetDlgItem (IDC_GRPFOLDER)->SetFocus ();
			SetDlgItemText (IDC_GRPNAME, LS (L_OTHER));
		}
		else
		{
			SetDlgItemText (IDC_GRPNAME, m_pGroup->strName);
			GetDlgItem (IDC_GRPNAME)->SetFocus ();
		}
	}

	SetWindowText (m_pGroup == NULL ? LS (L_CREATEGRP) : LS (L_GRPPROP));

	ApplyLanguage ();
	
	return FALSE;  
	              
}
示例#14
0
BOOL TestRunnerDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    CListCtrl   *listCtrl = (CListCtrl *)GetDlgItem (IDC_LIST);
    CComboBox   *comboBox = (CComboBox *)GetDlgItem (IDC_COMBO_TEST);

    ASSERT (listCtrl);
    ASSERT (comboBox);

    CString title;
    GetWindowText(title);
#if defined(_DEBUG)
    title.Append(" [debug]");
#else
    title.Append(" [release]");
#endif
    SetWindowText(title);

    listCtrl->InsertColumn (0,"Type", LVCFMT_LEFT, 16 + listCtrl->GetStringWidth ("Type"), 1);
    listCtrl->InsertColumn (1,"Name", LVCFMT_LEFT, 16 * listCtrl->GetStringWidth ("X"), 2);
    listCtrl->InsertColumn (2,"Failed Condition", LVCFMT_LEFT, 24 * listCtrl->GetStringWidth ("M"), 3);
    listCtrl->InsertColumn (3,"Line", LVCFMT_LEFT, 16 + listCtrl->GetStringWidth ("0000"), 4);
    listCtrl->InsertColumn (4,"File Name", LVCFMT_LEFT, 36 * listCtrl->GetStringWidth ("M"), 5);

    int numberOfCases = 0;

    CWinApp* pApp = AfxGetApp();
    CString lastTestCS = pApp->GetProfileString("Tests", "lastTest");
    std::string lastTest((LPCSTR) lastTestCS);
    int sel = -1;
    for (std::vector<TestInfo>::iterator it = _tests.begin (); it != _tests.end (); ++it)
    {
        std::string cbName(it->level*4, ' ');
        cbName.append(it->pTest->toString());
        comboBox->AddString (cbName.c_str ());
        if (sel < 0)
        {
            if (lastTest.empty() || lastTest == it->pTest->toString())
            {
                _selectedTest = it->pTest;
                sel = numberOfCases;
            }
        }
        numberOfCases++;
    }

    if (numberOfCases > 0)
    {
        if (sel < 0)
        {
            _selectedTest = _tests[0].pTest;
            sel = 0;
        }
        comboBox->SetCurSel (sel);
    }
    else
    {
        beRunDisabled ();
    }
    CWnd *pProgress = GetDlgItem(IDC_PROGRESS);
    CRect rect;
    pProgress->GetWindowRect(&rect);
    _testsProgress = new ProgressBar (this, rect);

    CButton* autoRunBtn = (CButton*) GetDlgItem(IDC_CHK_AUTORUN);
    autoRunBtn->SetCheck(pApp->GetProfileInt("Tests", "autoRun", BST_UNCHECKED));

    reset ();

    if (autoRunBtn->GetCheck() == BST_CHECKED)
    {
        OnRun();
    }

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
示例#15
0
void AccountDlg::Load(int id)
{
	CEdit* edit;
	CComboBox *combobox;
	accountId = id;
	if (accountSettings.AccountLoad(id,&m_Account)) {
		accountId = id;
	} else {
		accountId = 0;
	}

	edit = (CEdit*)GetDlgItem(IDC_EDIT_SERVER);
	edit->SetWindowText(m_Account.server);

	edit = (CEdit*)GetDlgItem(IDC_EDIT_PROXY);
	edit->SetWindowText(m_Account.proxy);

	edit = (CEdit*)GetDlgItem(IDC_EDIT_DOMAIN);
	edit->SetWindowText(m_Account.domain);


	edit = (CEdit*)GetDlgItem(IDC_EDIT_AUTHID);
	edit->SetWindowText(m_Account.authID);


	edit = (CEdit*)GetDlgItem(IDC_EDIT_USERNAME);
	edit->SetWindowText(m_Account.username);

	edit = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
	edit->SetWindowText(m_Account.password);

	edit = (CEdit*)GetDlgItem(IDC_EDIT_DISPLAYNAME);
	edit->SetWindowText(m_Account.displayName);

int i;

	combobox= (CComboBox*)GetDlgItem(IDC_TRANSPORT);
	if (m_Account.transport==_T("udp")) {
		i=1;
	} else if (m_Account.transport==_T("tcp")) {
		i=2;
	} else if (m_Account.transport==_T("tls")) {
		i=3;
	} else {
		i=0;
	}
	if (i>0) {
		combobox->SetCurSel(i);
	}

	edit = (CEdit*)GetDlgItem(IDC_STUN);
	edit->SetWindowText(m_Account.stun);

	combobox= (CComboBox*)GetDlgItem(IDC_SRTP);
	if (m_Account.srtp==_T("optional")) {
		i=1;
	} else if (m_Account.srtp==_T("mandatory")) {
		i=2;
	} else {
		i=0;
	}
	if (i>0) {
		combobox->SetCurSel(i);
	}


	combobox= (CComboBox*)GetDlgItem(IDC_PUBLIC_ADDR);
	combobox->AddString(Translate(_T("Auto")));
	if (m_Account.publicAddr.GetLength()) {
		combobox->SetWindowText(m_Account.publicAddr);
	}

	((CButton*)GetDlgItem(IDC_PUBLISH))->SetCheck(m_Account.publish);

	((CButton*)GetDlgItem(IDC_ICE))->SetCheck(m_Account.ice);
	((CButton*)GetDlgItem(IDC_REWRITE))->SetCheck(m_Account.allowRewrite);
	if (accountId>0 && !m_Account.username.IsEmpty()) {
		GetDlgItem(IDC_SYSLINK_DELETE)->ShowWindow(SW_SHOW);
	}
}
示例#16
0
static void insert(CComboBox& ctl, const string& t, int v)
{
	ctl.SetItemData(ctl.AddString(t.c_str()), v);
}
示例#17
0
void CStockPropPage::FillPropnameList(REFGUID guid, int nIndirect, CComboBox& combo)
{
	USES_CONVERSION;

	combo.ResetContent();
	UINT cProps = 0;

	ULONG nObjects;
	LPDISPATCH* ppDisp = GetObjectArray(&nObjects);

	if (ppDisp != NULL)
	{
		LPTYPEINFO pTypeInfo;
		LPTYPEATTR pTypeAttr;
		LPVARDESC pVarDesc;
		ULONG iObj;
		WORD iProp;
		BSTR rgbstr[1];
		UINT cName;

		// Get the property sheet locale
		LPPROPERTYPAGESITE pPageSite;
		if ((pPageSite = GetPageSite()) != NULL)
			if (FAILED(pPageSite->GetLocaleID(&m_lcid)))
				m_lcid = 0;

		// Iterate through all objects.

		for (iObj = 0; iObj < nObjects; iObj++)
		{
			pTypeInfo = NULL;
			if ((ppDisp[iObj] != NULL) &&
				SUCCEEDED(ppDisp[iObj]->GetTypeInfo(0, m_lcid, &pTypeInfo)))
			{
				ASSERT(pTypeInfo != NULL);
				pTypeAttr = NULL;
				if (SUCCEEDED(pTypeInfo->GetTypeAttr(&pTypeAttr)))
				{
					ASSERT(pTypeAttr != NULL);

					// Iterate through all properties of object.

					for (iProp = 0; iProp < pTypeAttr->cVars; iProp++)
					{
						pVarDesc = NULL;
						if (SUCCEEDED(pTypeInfo->GetVarDesc(iProp, &pVarDesc)))
						{
							// Check whether property has desired type

							if (!(pVarDesc->wVarFlags & VARFLAG_FHIDDEN) &&
								AfxOleTypeMatchGuid(pTypeInfo,
									&pVarDesc->elemdescVar.tdesc, guid,
									nIndirect))
							{
								// Get property name and insert into list.

								if (SUCCEEDED(pTypeInfo->GetNames(
										pVarDesc->memid, rgbstr, 1, &cName)))
								{
									// Don't insert duplicates.

									LPCTSTR lpstr = OLE2CT(rgbstr[0]);
									if (combo.FindString(-1, lpstr)
											== CB_ERR)
									{
										int iItem = combo.AddString(lpstr);
										if (iItem >= 0)
										{
											combo.SetItemData(iItem, (DWORD)pVarDesc->memid);
											++cProps;
										}
									}

									SysFreeString(rgbstr[0]);
								}
							}
							pTypeInfo->ReleaseVarDesc(pVarDesc);
						}
					}

					pTypeInfo->ReleaseTypeAttr(pTypeAttr);
				}
				pTypeInfo->Release();
			}
		}
	}

	// Select the first one
	m_iPropName = 0;            // Prevents save from happening
	if (combo.SetCurSel(0) != CB_ERR)
		combo.GetLBText(0, m_strPropName);

	// Disable or set the size of the combo, as appropriate
	if (cProps <= 1)
		combo.EnableWindow(FALSE);
	else
		_AfxSizeComboToContent(&combo);

	UpdateData(FALSE);
	SetModifiedFlag(FALSE);
}
BOOL CSpiderAddPageDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	if (m_pUiWindow)
		m_pUiWindow->setWindow (m_hWnd);

	
	
	
	
	
	m_schScheduleParam.schTask.hts.enType = HTS_ONCE;
	m_schScheduleParam.schTask.hts.last.dwHighDateTime = m_schScheduleParam.schTask.hts.last.dwLowDateTime = UINT_MAX;
	m_schScheduleParam.schTask.dwFlags = SCHEDULE_ENABLED;
	SYSTEMTIME time;
	GetLocalTime (&time);
	if (++time.wHour > 23)
		time.wHour = 0;
	time.wMinute = 0;
	SystemTimeToFileTime (&time, &m_schScheduleParam.schTask.hts.next);
	m_schScheduleParam.schTask.uWaitForConfirmation = 0;

	m_btnChooseFolder.SetIcon (SICO (IDI_CHOOSEFOLDER));
	m_btnCreateGroup.SetIcon (SICO (IDI_CREATEGROUP));
	m_btnSetTime.SetIcon (SICO (IDI_SETTIME));
	m_btnOutFolderSetDefault.SetIcon (SICO (IDI_SETFOLDERDEFAULT));

	m_wndGroups.Fill ();
	m_wndGroups.SelectGroupById (_App.CreateDld_IdOfLastGrpSelected ());

	CheckDlgButton (IDC_KEEP, _App.Spider_Flags () & WPDF_KEEPFOLDERSTRUCTURE ? 
						BST_CHECKED : BST_UNCHECKED);

	CheckDlgButton (IDC_DONTSTOREPAGES, _App.Spider_Flags () & WPDF_DONTSTOREPAGES ? 
						BST_CHECKED : BST_UNCHECKED);

	CheckDlgButton (IDC_DELCOMPLETED, _App.Spider_Flags () & WPDF_DELCOMPLETEDDLDS ?
						BST_CHECKED : BST_UNCHECKED);

	CComboBox *pUrls = (CComboBox*) GetDlgItem (IDC_URL);
	int i = 0;
	for (i = 0; i < _LastUrlFiles.GetRecordCount (); i++)
		pUrls->AddString (_LastUrlFiles.GetRecord (i));

	if (m_strStartUrl.GetLength () == 0)
	{
		LPCSTR pszUrl = _ClipbrdMgr.Text ();
		if (pszUrl)
		{
			fsURL url;
			if (url.Crack (pszUrl) == IR_SUCCESS)
				m_strUrl = pszUrl;
		}
		
		if (m_strUrl.GetLength () == 0)
			m_strUrl = "http://";
	}
	else
		m_strUrl = m_strStartUrl;

	pUrls->SetWindowText (m_strUrl);

	CComboBox *pDirs = (CComboBox*) GetDlgItem (IDC_OUTFOLDER);
	for (i = 0; i < _LastFolders.GetRecordCount (); i++)
		pDirs->AddString (_LastFolders.GetRecord (i));

	GetDlgItem (IDC_URL)->SetFocus ();

	m_bOutFolderChanged = m_bGroupChanged = FALSE;

	ReadAutostart ();
	ApplyLanguage ();

	if (m_bReqTopMost)
	{
		fsSetForegroundWindow (m_hWnd);
        mfcSetTopmostWindow (this);
	}

	m_wndDepthSpin.SetRange (0, UD_MAXVAL);
	SetDlgItemInt (IDC_DEPTH, m_wpd->GetWDPS ()->iDepth);

	if (m_wndGroups.SelectGroupById (_App.NewDL_GroupId ()))
		m_bGroupChanged = TRUE;

	OnChangeGroups ();

	BuildOutFolder ();

	UpdateEnabled ();

	return TRUE;  
	              
}
BOOL event_editor::OnInitDialog() 
{
	int i, adjust = 0;
	BOOL r = TRUE;
	CListBox *list;
	CComboBox *box;
	MMessage msg; 

	CDialog::OnInitDialog();  // let the base class do the default work
	m_play_bm.LoadBitmap(IDB_PLAY);
	((CButton *) GetDlgItem(IDC_PLAY)) -> SetBitmap(m_play_bm);

	if (!Show_sexp_help)
		adjust = -SEXP_HELP_BOX_SIZE;

	theApp.init_window(&Events_wnd_data, this, adjust);
	m_event_tree.setup((CEdit *) GetDlgItem(IDC_HELP_BOX));
	load_tree();
	create_tree();
	if (m_num_events >= MAX_MISSION_EVENTS){
		GetDlgItem(IDC_BUTTON_NEW_EVENT)->EnableWindow(FALSE);
	}

	update_cur_event();
	i = m_event_tree.select_sexp_node;
	if (i != -1) {
		GetDlgItem(IDC_EVENT_TREE) -> SetFocus();
		m_event_tree.hilite_item(i);
		r = FALSE;
	}

	m_num_messages = Num_messages - Num_builtin_messages;
	for (i=0; i<m_num_messages; i++) {
		msg = Messages[i + Num_builtin_messages];
		m_messages.push_back(msg); 
		if (m_messages[i].avi_info.name){
			m_messages[i].avi_info.name = strdup(m_messages[i].avi_info.name);
		}
		if (m_messages[i].wave_info.name){
			m_messages[i].wave_info.name = strdup(m_messages[i].wave_info.name);
		}
	}

	((CEdit *) GetDlgItem(IDC_MESSAGE_NAME))->LimitText(NAME_LENGTH - 1);
	((CEdit *) GetDlgItem(IDC_MESSAGE_TEXT))->LimitText(MESSAGE_LENGTH - 1);
	((CComboBox *) GetDlgItem(IDC_AVI_FILENAME))->LimitText(MAX_FILENAME_LEN - 1);
	((CComboBox *) GetDlgItem(IDC_WAVE_FILENAME))->LimitText(MAX_FILENAME_LEN - 1);

	list = (CListBox *) GetDlgItem(IDC_MESSAGE_LIST);
	list->ResetContent();
	for (i=0; i<m_num_messages; i++) {
		list->AddString(m_messages[i].name);
	}

	box = (CComboBox *) GetDlgItem(IDC_AVI_FILENAME);
	box->ResetContent();
	box->AddString("<None>");
	for (i=0; i<Num_messages; i++) {
		if (Messages[i].avi_info.name) {
			maybe_add_head(box, Messages[i].avi_info.name);
		}
	}

	// add new heads, if not already in
	maybe_add_head(box, "Head-TP2");
	maybe_add_head(box, "Head-VC2");
	maybe_add_head(box, "Head-TP4");
	maybe_add_head(box, "Head-TP5");
	maybe_add_head(box, "Head-TP6");
	maybe_add_head(box, "Head-TP7");
	maybe_add_head(box, "Head-TP8");
	maybe_add_head(box, "Head-VP2");
	maybe_add_head(box, "Head-VP2");
	maybe_add_head(box, "Head-CM2");
	maybe_add_head(box, "Head-CM3");
	maybe_add_head(box, "Head-CM4");
	maybe_add_head(box, "Head-CM5");
	maybe_add_head(box, "Head-BSH");

/*
	box->AddString("Head-VC");  // force it in, since Sandeep wants it and it's not used in built-in messages
	box->AddString("Head-VC2");

	// add terran pilot heads
	box->AddString("Head-TP4");
	box->AddString("Head-TP5");
	box->AddString("Head-TP6");
	box->AddString("Head-TP7");
	box->AddString("Head-TP8");

	// add vasudan pilot heads
	box->AddString("Head-VP2");

	// BSH and CM2
	box->AddString("Head-CM2");
	box->AddString("Head-BSH");
	*/

	box = (CComboBox *) GetDlgItem(IDC_WAVE_FILENAME);
	box->ResetContent();
	box->AddString("<None>");
	for (i=0; i<Num_messages; i++){
		if (Messages[i].wave_info.name){
			if (box->FindStringExact(i, Messages[i].wave_info.name) == CB_ERR){
				box->AddString(Messages[i].wave_info.name);
			}
		}
	}

	// add the persona names into the combo box
	box = (CComboBox *) GetDlgItem(IDC_PERSONA_NAME);
	box->ResetContent();
	box->AddString("<None>");
	for (i = 0; i < Num_personas; i++ ){
		box->AddString( Personas[i].name );
	}

	// set the first message to be the first non-builtin message (if it exists)
	if ( Num_messages > Num_builtin_messages ){
		m_cur_msg = 0;
	} else {
		m_cur_msg = -1;
	}

	update_cur_message();
	return r;
}
BOOL CDlgCreateFlvDownloads::OnInitDialog() 
{
	assert (!m_initialized);
	m_changing_dlg_state = true;

	CDialog::OnInitDialog();

	if (m_selected.size () != m_vDlds.size ())
		m_selected.resize (m_vDlds.size (), true);
	m_selectedByUserItself.resize (m_selected.size ());

	if (m_pUiWindow)
		m_pUiWindow->setWindow (m_hWnd);
	
	SetDlgItemText (IDC_WPURL, m_strWebPageUrl);

	CRect rc; m_wndFlvList.GetClientRect (&rc);

	m_wndFlvList.InsertColumn (0, LS (L_TITLE), LVCFMT_LEFT);
	m_wndFlvList.InsertColumn (1, LS (L_SIZE), LVCFMT_LEFT);
	if (!m_ui_customizations.no_url_column)
		m_wndFlvList.InsertColumn (2, _T("URL"), LVCFMT_LEFT);

	int nMaxW0 = 0;
	int nMaxW1 = 0;

	for (size_t i = 0; i < m_vDlds.size (); i++)
	{
		const auto& dl = m_vDlds [i];

		m_urlToIndex [dl.strUrl] = i;
		if (!dl.strLinkedAudioUrl.IsEmpty ())
		{
			m_urlVideoToAudio [dl.strUrl] = dl.strLinkedAudioUrl;
			m_urlAudioToVideo.insert (std::make_pair (dl.strLinkedAudioUrl, dl.strUrl));
		}

		m_wndFlvList.InsertItem (i, m_vDlds [i].strTitle);
		int nW0 = m_wndFlvList.GetStringWidth (m_vDlds [i].strTitle);
		CString strSize; 
		if (m_vDlds [i].uSize != _UI64_MAX)
			strSize = BytesToString (m_vDlds [i].uSize, true);
		int nW1 = m_wndFlvList.GetStringWidth (strSize);
		m_wndFlvList.SetItemText (i, 1, strSize);
		if (!m_ui_customizations.no_url_column)
			m_wndFlvList.SetItemText (i, 2, m_vDlds [i].strUrl);
		nMaxW0 = max (nMaxW0, nW0);
		nMaxW1 = max (nMaxW1, nW1);
	}
	
	auto vscroll_payload = GetSystemMetrics (SM_CXVSCROLL) + 3;
	if (!m_ui_customizations.no_url_column)
	{
		int n = rc.Width () / 3;
		if (n > nMaxW0)
			n = nMaxW0;
		m_wndFlvList.SetColumnWidth (0, n+20);
		m_wndFlvList.SetColumnWidth (1, nMaxW1+20);
		m_wndFlvList.SetColumnWidth (2, rc.Width () - n-20 - nMaxW1-20 - vscroll_payload);
	}
	else
	{
		nMaxW0 += 20;
		nMaxW1 += 20;
		int n = nMaxW0;
		if (rc.Width () < (nMaxW0 + nMaxW1 + 20 + vscroll_payload))
			n = rc.Width () - nMaxW1 - 20 - vscroll_payload;
		m_wndFlvList.SetColumnWidth (0, n + 20);
		m_wndFlvList.SetColumnWidth (1, nMaxW1);
	}
	
	m_wndFlvList.SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP | LVS_EX_CHECKBOXES);

	
	for (size_t i = 0; i < m_vDlds.size (); i++)
		ListView_SetItemState (m_wndFlvList, i, UINT((int(m_selected [i]) + 1) << 12), LVIS_STATEIMAGEMASK);

	CComboBox *pDirs = (CComboBox*) GetDlgItem (IDC_OUTFOLDER);
	for (size_t i = 0; i < (size_t)_LastFlashVideoDstFolders.GetRecordCount (); i++)
		pDirs->AddString (_LastFlashVideoDstFolders.GetRecord (i));
	if (_LastFlashVideoDstFolders.GetRecordCount ())
	{
		pDirs->SetCurSel (0);
	}
	else
	{
		vmsDownloadsGroupSmartPtr pGrp = _DldsGrps.FindGroupByExt (_T("flv"));
		if (pGrp == NULL)
			pGrp = _DldsGrps.FindGroupByExt (_T("mp4"));
		if (pGrp == NULL)
			pGrp = _DldsGrps.FindGroupByExt (_T("avi"));
		if (pGrp == NULL)
			pGrp = _DldsGrps.FindGroup (GRP_OTHER_ID);
		ASSERT (pGrp != NULL);
		if (pGrp != NULL)
			pDirs->SetWindowText (pGrp->strOutFolder);
	}

	if (_App.FVDownloads_AutoConvertVideo () && _AppMgr.IsMediaFeaturesInstalled ())
	{
		CheckDlgButton (IDC_USE_AUTO_CONVERT, BST_CHECKED);
		UpdateEnabled ();
	}
	
	vmsMediaConvertMgr::GetDefaultSettings (m_convertSettings);

	ApplyLanguage ();

	if (m_bReqTopMostDialog)
	{
		mfcSetForegroundWindow (this);
		mfcSetTopmostWindow (this);
	}

	m_changing_dlg_state = false;
	m_initialized = true;
	
	return TRUE;  
	              
}
示例#21
0
void CCompileEditView::SaveDataMenu(UINT nID)
{
	if(g_pSaveMenu.m_hMenu == NULL)
		return;

	CString strComm;
	g_pSaveMenu.GetMenuString(nID,strComm,MF_BYCOMMAND);
	if(strComm.IsEmpty())
		return;

	int nPos = strComm.Find(":");
	if( nPos != -1 )
	{
		strComm = strComm.Mid(nPos+1);
	}
	if(strComm.IsEmpty())
		return;

	if(!IsCompileEdit(COMPILE))
		return;

	CTreeCtrlFormula* pHxTreeCtrl = NULL;

	HTREEITEM hFloatTreeItem = NULL;
	CTreeCtrlFormula* pFloatTree = NULL;
	CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
	if(pMain != NULL)
	{
		if(pMain->GetIndividualInfo() != NULL)
		{
			pFloatTree = pMain->GetIndividualInfo();
		}
	}

	HTREEITEM hTreeItem = NULL;
	char	  cType = 0;
	
	nID -= SAVEMENU_BEGIN;
	if(nID >= 0 && nID < 100)
	{
		cType = Tech;
		if(pHxTreeCtrl != NULL)
		{				
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strTech);//		 = "技术指标";
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strTech);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 100 && nID < 200 )
	{
		cType = Condition;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strCondition);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strCondition);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 200 && nID < 300 )
	{
		cType = Exchange;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strExchange);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strExchange);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 300 && nID < 400 )
	{
		cType = MoreKLine;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strColorKLine);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strColorKLine);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}		
	if( nID >= 400 && nID < 500 )
	{
		cType = ExpressBin;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strRecycleBin);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strRecycleBin);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}

	CString strName;
	CComboBox* pBox = NULL;
	if(m_pwndDlgMainBar != NULL)
	{
		pBox = (CComboBox*)m_pwndDlgMainBar->GetDlgItem(IDC_NAMECOMBO);
		if(pBox != NULL)
		{			
			pBox->GetWindowText(strName);
			strName.MakeUpper();
			if( pBox->FindString(0,strName) != CB_ERR )
			{
				CValue* valoare;
				if ( m_pExternExpression->Lookup(strName,valoare) ) // 外部表达式表
				{
				}
			}
			else
			{
				pBox->AddString(strName);
			}
		}
	}
	

	if( pHxTreeCtrl != NULL && hTreeItem != NULL && !strName.IsEmpty())
	{
		m_hExpressInTreePos = pHxTreeCtrl->AddItem(strName,cType,hTreeItem/*pHxTreeCtrl->GetCurSavePos(hTreeItem)*/,m_pExternExpression);
	}

	// 浮动窗口	
	if( pFloatTree != NULL && hFloatTreeItem != NULL && !strName.IsEmpty())
	{
		pFloatTree->AddItem(strName,cType,hFloatTreeItem/*pFloatTree->GetCurSavePos(hFloatTreeItem)*/,m_pExternExpression);
	}

	::SendMessage( g_hParentWnd,HX_USER_UPDATEDATA,0,(LPARAM)&strName );
}
//-----  BroadcastEvent()  ----------------------------------------------------
BOOL CFormChunkMergeView::BroadcastEvent(WORD event, void* pParameter)
{
	switch (event)
	{
		case IBCE_CHANGED_SETTINGS:
		{
			//  set settings from configuration
			Configuration*	pConfig (Configuration::getInstance());
			CComboBox*		pCBox   ((CComboBox*) GetDlgItem(IDC_CB_TEMPLATE));
			set<string>		tDirList(pConfig->getDirListTemplates());
			CString			tmpPath (pConfig->_cmDefaultTemplate.c_str());

			//- templates
			LogMessageObject::LogMessage(NCU_MSG_TYPE_INFO, "Adding templates");
			pCBox->ResetContent();
			for (auto pIter(tDirList.begin()), pEnd(tDirList.end()); pIter != pEnd; ++pIter)
			{
				if (pIter->rfind(".nif") == string::npos)		continue;
				pCBox->AddString(CString(pIter->c_str()));
				LogMessageObject::LogMessage(NCU_MSG_TYPE_SUB_INFO, "added: %s", pIter->c_str());
			}
			pCBox->SelectString(-1, CString(tmpPath));
			pCBox->GetWindowText(tmpPath);
			if (tmpPath.IsEmpty())		pCBox->SetCurSel(0);
			LogMessageObject::LogMessage(NCU_MSG_TYPE_INFO, "templates found: %d", tDirList.size());

			//- materials
			pCBox = (CComboBox*) GetDlgItem(IDC_CB_MAT_SINGLE);
			map<string, NifUtlMaterial>		matMap(NifUtlMaterialList::getInstance()->getMaterialMap());
			short							tIdx  (0);
			short							selIdx(0);

			//  add materials to combo box
			for (auto pIter(matMap.begin()), pEnd(matMap.end()); pIter != pEnd; ++pIter, ++tIdx)
			{
				pCBox->InsertString  (tIdx, CString(pIter->second._name.c_str()));
				pCBox->SetItemDataPtr(tIdx, (void*) (pIter->second._code));

				if (pIter->second._code == pConfig->_cmMatSingleType)
				{
					selIdx = tIdx;
				}
			}
			pCBox->SetCurSel(selIdx);

			//  material flags
			int		selItem(pConfig->_cmMatHandling + IDC_RD_MAT_SINGLE);

			((CButton*) GetDlgItem(IDC_RD_MAT_SINGLE))    ->SetCheck(selItem == IDC_RD_MAT_SINGLE);
			((CButton*) GetDlgItem(IDC_RD_MAT_NITRISHAPE))->SetCheck(selItem == IDC_RD_MAT_NITRISHAPE);
			((CButton*) GetDlgItem(IDC_RD_MAT_DEFINE))    ->SetCheck(selItem == IDC_RD_MAT_DEFINE);
			GetDlgItem(IDC_CB_MAT_SINGLE)->EnableWindow(selItem == IDC_RD_MAT_SINGLE);
			GetDlgItem(IDC_BT_MAT_DEFINE)->EnableWindow(selItem == IDC_RD_MAT_DEFINE);

			//  collision flags
			selItem = pConfig->_cmCollHandling + IDC_RD_COLL_CDATA;
			((CButton*) GetDlgItem(IDC_RD_COLL_CDATA))->SetCheck(selItem == IDC_RD_COLL_CDATA);
			((CButton*) GetDlgItem(IDC_RD_COLL_FBACK))->SetCheck(selItem == IDC_RD_COLL_FBACK);
			((CButton*) GetDlgItem(IDC_RD_COLL_MESH)) ->SetCheck(selItem == IDC_RD_COLL_MESH);

			//  other flags
			((CButton*) GetDlgItem(IDC_RD_COLL_LOCAL))  ->SetCheck(pConfig->_cmMergeColl   ? BST_UNCHECKED : BST_CHECKED);
			((CButton*) GetDlgItem(IDC_RD_COLL_GLOBAL)) ->SetCheck(pConfig->_cmMergeColl   ? BST_CHECKED   : BST_UNCHECKED);
			((CButton*) GetDlgItem(IDC_CK_REORDER_TRIS))->SetCheck(pConfig->_cmReorderTris ? BST_CHECKED   : BST_UNCHECKED);

			break;
		}

		case IBCE_SET_TOOLTIPP:
		{
			_toolTipCtrl.Activate(Configuration::getInstance()->_showToolTipps);
			break;
		}
	}  //  switch (event)

	return TRUE;
}
示例#23
0
void CInsertConstituentDlg::LoadTagsCombo()
{
	int i,j,n;
	CString R,S,T,strTags;
	CComboBox* pcboTags;

	m_cboTags.ResetContent();
	pcboTags=&m_cboTags;
	strTags=L"";
	switch (m_nSyntacticCategory)
	{
	case 1:
	case 11:
		n=m_pDoc->m_nTNouns;
		for (i=0;i<n;i++)
		{
			T=m_pDoc->m_starTNounConstituents[i];
			if (T!=L"")
			{
				j=T.Find(L"[");
				if (j>-1)
				{
					T=T.Mid(j+1);
					j=T.Find(L"]");
					if (j>-1) T=T.Left(j);
					S=L"|"+T+L"|";
					R=L"|"+strTags;
					j=R.Find(S);
					if (j==-1) strTags+=T+L"|";
				}
			}
		}
		break;
	case 2:
	case 12:
		n=m_pDoc->m_nTVerbs;
		for (i=0;i<n;i++)
		{
			T=m_pDoc->m_starTVerbConstituents[i];
			if (T!=L"")
			{
				j=T.Find(L"[");
				if (j>-1)
				{
					T=T.Mid(j+1);
					j=T.Find(L"]");
					if (j>-1) T=T.Left(j);
					S=L"|"+T+L"|";
					R=L"|"+strTags;
					j=R.Find(S);
					if (j==-1) strTags+=T+L"|";  //add the tag to the list
				}
			}
		}
		break;
	case 3:
	case 13:
		n=m_pDoc->m_nTAdjectives;
		for (i=0;i<n;i++)
		{
			T=m_pDoc->m_starTAdjectiveConstituents[i];
			if (T!=L"")
			{
				j=T.Find(L"[");
				if (j>-1)
				{
					T=T.Mid(j+1);
					j=T.Find(L"]");
					if (j>-1) T=T.Left(j);
					S=L"|"+T+L"|";
					R=L"|"+strTags;
					j=R.Find(S);
					if (j==-1) strTags+=T+L"|";
				}
			}
		}
		break;
	case 4:
	case 14:
		n=m_pDoc->m_nTAdverbs;
		for (i=0;i<n;i++)
		{
			T=m_pDoc->m_starTAdverbConstituents[i];
			if (T!=L"")
			{
				j=T.Find(L"[");
				if (j>-1)
				{
					T=T.Mid(j+1);
					j=T.Find(L"]");
					if (j>-1) T=T.Left(j);
					S=L"|"+T+L"|";
					R=L"|"+strTags;
					j=R.Find(S);
					if (j==-1) strTags+=T+L"|";
				}
			}
		}
		break;
	case 5:
	case 15:
		n=m_pDoc->m_nTAdpositions;
		for (i=0;i<n;i++)
		{
			T=m_pDoc->m_starTAdpositionConstituents[i];
			if (T!=L"")
			{
				j=T.Find(L"[");
				if (j>-1)
				{
					T=T.Mid(j+1);
					j=T.Find(L"]");
					if (j>-1) T=T.Left(j);
					S=L"|"+T+L"|";
					R=L"|"+strTags;
					j=R.Find(S);
					if (j==-1) strTags+=T+L"|";
				}
			}
		}
		break;
	case 6:
	case 16:
		n=m_pDoc->m_nTConjunctions;
		for (i=0;i<n;i++)
		{
			T=m_pDoc->m_starTConjunctionConstituents[i];
			if (T!=L"")
			{
				j=T.Find(L"[");
				if (j>-1)
				{
					T=T.Mid(j+1);
					j=T.Find(L"]");
					if (j>-1) T=T.Left(j);
					S=L"|"+T+L"|";
					R=L"|"+strTags;
					j=R.Find(S);
					if (j==-1) strTags+=T+L"|";
				}
			}
		}
		break;
	case 7:
	case 17:
		n=m_pDoc->m_nTPronouns;
		for (i=0;i<n;i++)
		{
			T=m_pDoc->m_starTPronounConstituents[i];
			if (T!=L"")
			{
				j=T.Find(L"[");
				if (j>-1)
				{
					T=T.Mid(j+1);
					j=T.Find(L"]");
					if (j>-1) T=T.Left(j);
					S=L"|"+T+L"|";
					R=L"|"+strTags;
					j=R.Find(S);
					if (j==-1) strTags+=T+L"|";
				}
			}
		}
		break;
	case 8:
	case 18:
		n=m_pDoc->m_nTParticles;
		for (i=0;i<n;i++)
		{
			T=m_pDoc->m_starTParticleConstituents[i];
			if (T!=L"")
			{
				j=T.Find(L"[");
				if (j>-1)
				{
					T=T.Mid(j+1);
					j=T.Find(L"]");
					if (j>-1) T=T.Left(j);
					S=L"|"+T+L"|";
					R=L"|"+strTags;
					j=R.Find(S);
					if (j==-1) strTags+=T+L"|";
				}
			}
		}
		break;
	}
	while (strTags!=L"")
	{
		i=strTags.Find(L"|");
		if (i>-1)
		{
			T=strTags.Left(i);
			strTags=strTags.Mid(i+1);
		}
		else
		{
			T=strTags;
			strTags=L"";
		}
		pcboTags->AddString(T);
	}
}
示例#24
0
BOOL CSettingDlg::OnInitDialog()
{
	CEasySkinManager::OnInitDialog();

	//Init code add here
	CString strTempString = _T("");

	CEdit* pEdit = NULL;

	strTempString.Format(_T("%d"), m_sParamInfo.nVWidth);
	pEdit = (CEdit*)GetDlgItem(IDC_EDIT_VWIDTH);
	if (pEdit)
	{
		pEdit->SetWindowText(strTempString);
	}
	strTempString.Format(_T("%d"), m_sParamInfo.nVHeight);
	pEdit = (CEdit*)GetDlgItem(IDC_EDIT_VHEIGHT);
	if (pEdit)
	{
		pEdit->SetWindowText(strTempString);
	}
	strTempString.Format(_T("%d"), m_sParamInfo.nFps);
	pEdit = (CEdit*)GetDlgItem(IDC_EDIT_FPS);
	if (pEdit)
	{
		pEdit->SetWindowText(strTempString);
	}

	strTempString.Format(_T("%d"), m_sParamInfo.nBitrate);
	pEdit = (CEdit*)GetDlgItem(IDC_EDIT_BITRATE);
	if (pEdit)
	{
		pEdit->SetWindowText(strTempString);
	}

	strTempString.Format(_T("%d"), m_sParamInfo.nASampleRate);
	pEdit = (CEdit*)GetDlgItem(IDC_EDIT_ASAMPLERATE);
	if (pEdit)
	{
		pEdit->SetWindowText(strTempString);
	}
	strTempString.Format(_T("%d"), m_sParamInfo.nAChannels);
	pEdit = (CEdit*)GetDlgItem(IDC_EDIT_ACHANNELS);
	if (pEdit)
	{
		pEdit->SetWindowText(strTempString);
	}

	CComboBox* pCombo = (CComboBox*) GetDlgItem ( IDC_COMBO_COLORFORMAT );
	if (pCombo)
	{
		pCombo->AddString(_T("YUY2"));
		pCombo->AddString(_T("RGB24"));
	}

	CString strDataType = _T("");
	strDataType = m_sParamInfo.strColorFormat;
	if (strDataType == _T("YUY2"))
	{
		pCombo->SetCurSel(0);
	}
	else //д╛хо==RGB24
	{
		pCombo->SetCurSel(1);

	}
	 
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
示例#25
0
BOOL CCreateBatchDownload::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_btnChooseFolder.SetIcon (SICO (IDI_CHOOSEFOLDER));
	m_btnCreateGroup.SetIcon (SICO (IDI_CREATEGROUP));
	m_btnSetTime.SetIcon (SICO (IDI_SETTIME));
	m_btnOutFolderSetDefault.SetIcon (SICO (IDI_SETFOLDERDEFAULT));

	
	m_schScheduleParam.schTask.hts.enType = HTS_ONCE;
	m_schScheduleParam.schTask.hts.last.dwHighDateTime = m_schScheduleParam.schTask.hts.last.dwLowDateTime = UINT_MAX;
	SYSTEMTIME time;
	GetLocalTime (&time);
	if (++time.wHour > 23)
		time.wHour = 0;
	time.wMinute = 0;
	SystemTimeToFileTime (&time, &m_schScheduleParam.schTask.hts.next);
	m_schScheduleParam.schTask.uWaitForConfirmation = 0;

	
	LPCSTR pszUrl = _ClipbrdMgr.Text ();
	if (pszUrl && *pszUrl)
	{
		fsURL url;
		if (url.Crack (pszUrl) == IR_SUCCESS)
			m_strUrl = pszUrl;	
	}
	
	if (m_strUrl == "")
		m_strUrl = "http://";	

	CString strUser = _App.UserName ();	
	m_bAuthorization = strUser.GetLength () != 0;
	SetDlgItemText (IDC_USER, strUser);
	SetDlgItemText (IDC_PASSWORD, _App.UserPassword ());

	CheckDlgButton (IDC_USELOGIN, m_bAuthorization ? BST_CHECKED : BST_UNCHECKED);

	
	m_wndGroups.Fill ();

	
	CComboBox *pUrls = (CComboBox*) GetDlgItem (IDC_URL);
	int i = 0;
	for (i = 0; i < _LastBatchUrls.GetRecordCount (); i++)
		pUrls->AddString (_LastBatchUrls.GetRecord (i));

	
	CComboBox *pDirs = (CComboBox*) GetDlgItem (IDC_OUTFOLDER);
	for (i = 0; i < _LastFolders.GetRecordCount (); i++)
		pDirs->AddString (_LastFolders.GetRecord (i));

	CheckRadioButton (IDC_STARTNOW, IDC_STARTSCHEDULE, IDC_STARTNOW);
	m_dld->bAutoStart = TRUE;  

	GetDlgItem (IDC_URL)->SetFocus ();

	if (IR_SUCCESS != m_dld->pMgr->GetDownloadMgr ()->CreateByUrl (m_strUrl, TRUE) && m_strUrl != "http://")
		m_dld->pMgr->GetDownloadMgr ()->CreateByUrl ("http://", TRUE);

	m_bGroupChanged = m_bAuthChanged = FALSE;

	fsURL url;
	if (IR_SUCCESS == url.Crack (m_strUrl) && *url.GetHostName ())
	{
		fsURL u;
		char szUrl [10000];
		DWORD dwLen = 10000;
		u.Create (url.GetInternetScheme (), url.GetHostName (), url.GetPort (), NULL, NULL, url.GetPath (), szUrl, &dwLen);
		m_strUrl = szUrl;	

		if (*url.GetUserName ())
			m_bAuthChanged = TRUE;
	}

	UpdateEnabled ();

	
	Update_User_Password ();

	SetDlgItemText (IDC_URL, m_strUrl == "http://url/" ? "http://" : m_strUrl);
	((CEdit*) GetDlgItem (IDC_URL))->SetSel (0, -1);

	UrlChanged ();

	DWORD dwAtoZ = _App.CreateBD_LastAtoZ ();
	int az1 = LOWORD (dwAtoZ);
	int az2 = HIWORD (dwAtoZ);

	if ((az1 < 0 || az2 >= 'Z' - 'A') ||
			(az2 < 0 || az2 > 'Z' - 'A' - 1)) 
	{
		az1 = 0; az2 = 'Z' - 'A' - 1;
	}

	for (i = 0; i < 'Z' - 'A'; i++)
	{
		CString str = (char)('A' + i);
		m_wndA.AddString (str);
	}
	m_wndA.SetCurSel (az1);
	FillZ ();
	m_wndZ.SetCurSel (az2);

	ReadAutostart ();
	ApplyLanguage ();

	if (m_wndGroups.SelectGroupById (_App.NewDL_GroupId ()))
		m_bGroupChanged = TRUE;

	OnChangeGroups ();

	SetDlgItemText (IDC_NUMBERS, _App.CreateBD_LastNumbers ());

	CString strSaveAs = _App.CreateBD_SaveAs_Template ();
	SetDlgItemText (IDC_SAVEAS, strSaveAs);
	if (strSaveAs == "") {
		CheckDlgButton (IDC_FILEAUTO, BST_CHECKED);
		UpdateEnabled ();
	}

	m_dld->dwFlags |= DLD_BATCH;

	return TRUE;  
	              
}
示例#26
0
BOOL CFlashParametersDlg::Create(CWnd* pParentWnd, CPoint ptWnd, BOOL bNew)
{
	if (!CDialog::Create(IDD, pParentWnd)) return FALSE;
	CFlashDatabase&	database(m_pFlash->m_OwnerBase);
	CComboBox*		pCombo;
	CRect			rectParameters;
	CVendorRecord*	pVendor;
	INT				i;
	LOGFONT			lf;

	m_bNew = bNew;
	// Move window
	GetWindowRect(&rectParameters);
	rectParameters.MoveToXY(ptWnd);
	MoveWindow(&rectParameters);
	// Init controls
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_VENDOR);
	for (POSITION nPosVendor = database.GetVendorHeadPosition(); nPosVendor != NULL; )
	{
		pVendor =  database.GetVendorNext(nPosVendor);
		pCombo->SetItemData(pCombo->AddString(pVendor->m_strVendor), pVendor->m_nID);
	}
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CS_CHIP);
	pCombo->SetItemData(pCombo->AddString(_T(" 1")), 0x01);
	pCombo->SetItemData(pCombo->AddString(_T(" 2")), 0x02);
	pCombo->SetItemData(pCombo->AddString(_T(" 3")), 0x03);
	pCombo->SetItemData(pCombo->AddString(_T(" 4")), 0x04);
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CMD_CYCLE);
	pCombo->SetItemData(pCombo->AddString(_T(" 1")), 0x01);
	pCombo->SetItemData(pCombo->AddString(_T(" 2")), 0x02);
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_FULL_ADR_CYCLE);
	pCombo->SetItemData(pCombo->AddString(_T(" 3")), 0x03);
	pCombo->SetItemData(pCombo->AddString(_T(" 4")), 0x04);
	pCombo->SetItemData(pCombo->AddString(_T(" 5")), 0x05);
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_PAGE_ADR_CYCLE);
	pCombo->SetItemData(pCombo->AddString(_T(" 1")), 0x01);
	pCombo->SetItemData(pCombo->AddString(_T(" 2")), 0x02);
	pCombo->SetItemData(pCombo->AddString(_T(" 3")), 0x03);
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CMD_TYPE);
	for (i = 0; i < CountCommandType; i++)
	{
		pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringCommandType(i)), i);
	}
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_BUS);
	for (i = 0; i < CountBusWidth; i++)
	{
		pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringBusWidth(i)), i);
	}
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_SPEED);
	for (i = 0; i < CountSpeedAsyn; i++)
	{
		pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringSpeed(i)), i);
	}
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_POWER_IO);
	for (i = 0; i < CountPowerIO; i++)
	{
		pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringPowerIO(i)), i);
	}
	pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_ONFI);
	for (i = 0; i < CountSupportONFI; i++)
	{
		pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringSupportONFI(i)), i);
	}
	((CEdit*)GetDlgItem(IDC_EDIT_LU_CS))->SetLimitText(3);
	((CEdit*)GetDlgItem(IDC_EDIT_BLOCK_LU))->SetLimitText(5);
	((CEdit*)GetDlgItem(IDC_EDIT_PAGE_BLOCK))->SetLimitText(5);
	((CEdit*)GetDlgItem(IDC_EDIT_PAGE_SIZE))->SetLimitText(5);
	m_pEditID = DYNAMIC_DOWNCAST(CDumpEdit, GetDlgItem(IDC_EDIT_ID));
	ASSERT(m_pEditID != NULL);
	m_pEditID->GetFont(&lf);
	lf.lfHeight = 14;
	lf.lfWeight = FW_MEDIUM;
	m_pEditID->SetFont(&lf, false);
	m_pEditID->SetShowAddress(false, false);
	m_pEditID->SetShowAscii(false, false);
	m_pEditID->SetBytesPerRow(COUNT_ID_MASK, false, false);
	m_pEditID->SetDirectDataPtr((BYTE*)&m_pFlash->m_nID, COUNT_ID_MASK, false);
	// Show window
	ShowWindow(SW_SHOW);
	return TRUE;
}
示例#27
0
void AddString(CComboBox& wnd, LPCTSTR szText, DWORD_PTR nItemData)
{
    int nIndex = wnd.AddString(szText);
    wnd.SetItemData(nIndex, nItemData);
}
示例#28
0
ReformatHolder::ReformatID ViewFilesDialog::ConfigureFormatSel(
    ReformatHolder::ReformatPart part)
{
    //ReformatHolder::ReformatID prevID = ReformatHolder::kReformatUnknown;
    ReformatHolder::ReformatID returnID = ReformatHolder::kReformatRaw;
    CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL);

    LOGD("--- ConfigureFormatSel");

    //int sel;
    //sel = pCombo->GetCurSel();
    //if (sel != CB_ERR)
    //  prevID = (ReformatHolder::ReformatID) pCombo->GetItemData(sel);
    //LOGI("  prevID = %d", prevID);

    EnableFormatSelection(TRUE);
    pCombo->ResetContent();

    /*
     * Fill out the combo box with the reformatter entries.
     *
     * There's probably a way to do this that doesn't involve abusing
     * enums, but this'll do for now.
     */
    int applyIdx, idIdx;
    bool preferred = true;
    int comboIdx;
    for (applyIdx = ReformatHolder::kApplicMAX;
        applyIdx > ReformatHolder::kApplicNot; /*no incr*/)
    {
        if (applyIdx == ReformatHolder::kApplicMAX)
            goto skip;
        if (applyIdx == ReformatHolder::kApplicUnknown)
            goto skip;

        int testApplies;

        testApplies = applyIdx;
        if (preferred)
            testApplies |= ReformatHolder::kApplicPreferred;

        for (idIdx = 0; idIdx < ReformatHolder::kReformatMAX; idIdx++) {
            if (idIdx == ReformatHolder::kReformatUnknown)
                continue;

            ReformatHolder::ReformatApplies applies;

            applies = fpHolder->GetApplic(part,
                                        (ReformatHolder::ReformatID) idIdx);
            if ((int) applies == testApplies) {
                /* match! */
                CString str;
                //LOGI("MATCH at %d (0x%02x)", idIdx, testApplies);
                str.Format(L"%ls", ReformatHolder::GetReformatName(
                                        (ReformatHolder::ReformatID) idIdx));
                comboIdx = pCombo->AddString(str);
                pCombo->SetItemData(comboIdx, idIdx);

                /* define initial selection as best item */
                if (comboIdx == 0)
                    pCombo->SetCurSel(comboIdx);

                //if (idIdx == (int) prevID &&
                //  applyIdx == ReformatHolder::kApplicAlways)
                //{
                //  LOGI("  Found 'always' prevID, selecting");
                //  pCombo->SetCurSel(comboIdx);
                //}
            }
        }

skip:
        if (!preferred)
            applyIdx--;
        preferred = !preferred;
    }

    /* return whatever we now have selected */
    int sel = pCombo->GetCurSel();
    LOGD("  At end, sel is %d", sel);
    if (sel != CB_ERR)
        returnID = (ReformatHolder::ReformatID) pCombo->GetItemData(sel);

    return returnID;
}
BOOL CMessageEditorDlg::OnInitDialog() 
{
	int i;
	CListBox *list;
	CComboBox *box;

	CDialog::OnInitDialog();
	theApp.init_window(&Messages_wnd_data, this);
	m_tree.setup();

	((CEdit *) GetDlgItem(IDC_NAME))->LimitText(NAME_LENGTH - 1);
	((CEdit *) GetDlgItem(IDC_MESSAGE_TEXT))->LimitText(MESSAGE_LENGTH - 1);
	((CComboBox *) GetDlgItem(IDC_AVI_FILENAME))->LimitText(MAX_FILENAME_LEN - 1);
	((CComboBox *) GetDlgItem(IDC_WAVE_FILENAME))->LimitText(MAX_FILENAME_LEN - 1);

	list = (CListBox *) GetDlgItem(IDC_MESSAGE_LIST);
	list->ResetContent();
	for (i=0; i<Num_messages; i++) {
		//Assert(list->FindStringExact(-1, Messages[i].name) == CB_ERR);
		// mwa we should probably not include builtin messages into this list!
		list->AddString(Messages[i].name);
	}

	box = (CComboBox *) GetDlgItem(IDC_AVI_FILENAME);
	for (i=0; i<Num_messages; i++)
		if (Messages[i].avi_info.name)
			if (box->FindStringExact(-1, Messages[i].avi_info.name) == CB_ERR)
				box->AddString(Messages[i].avi_info.name);

	box = (CComboBox *) GetDlgItem(IDC_WAVE_FILENAME);
	for (i=0; i<Num_messages; i++)
		if (Messages[i].wave_info.name)
			if (box->FindStringExact(i, Messages[i].wave_info.name) == CB_ERR)
				box->AddString(Messages[i].wave_info.name);

	// add the persona names into the combo box
	box = (CComboBox *)GetDlgItem(IDC_PERSONA_NAME);
	box->ResetContent();
	box->AddString("<None>");
	for (i = 0; i < Num_personas; i++ )
		box->AddString( Personas[i].name );

	box = (CComboBox *) GetDlgItem(IDC_SENDER);
	for (i=0; i<MAX_SHIPS; i++)
		if ((Ships[i].objnum >= 0) && (Objects[Ships[i].objnum].type == OBJ_SHIP))
			box->AddString(Ships[i].ship_name);

	for (i=0; i<MAX_WINGS; i++)
		if (Wings[i].wave_count)
			box->AddString(Wings[i].name);

	box->AddString("<Any wingman>");

	// MWA 4/7/98 -- removed any allied
	//box->AddString("<Any allied>");

	// set the first message to be the first non-builtin message (if it exists)
	if ( Num_messages > Num_builtin_messages )
		m_cur_msg = Num_builtin_messages;
	else if (Num_messages)
		m_cur_msg = 0;
	else
		m_cur_msg = -1;

	if (Num_messages >= MAX_MISSION_MESSAGES)
		GetDlgItem(IDC_NEW)->EnableWindow(FALSE);

	update_cur_message();
	return TRUE;
}
示例#30
0
BOOL AccountDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	
	TranslateDialog(this->m_hWnd);

	GetDlgItem(IDC_SYSLINK_DELETE)->ShowWindow(SW_HIDE);

	CString str;

	str.Format(_T("<a>%s</a>"),Translate(_T("Remove account")));
	GetDlgItem(IDC_SYSLINK_DELETE)->SetWindowText(str);

#if !defined _GLOBAL_ACCOUNT_PASSWORD && !defined _GLOBAL_NO_DISPLAY_PASSWORD
#ifndef _GLOBAL_ACCOUNT_PIN
	str.Format(_T("<a>%s</a>"),Translate(_T("display password")));
	GetDlgItem(IDC_SYSLINK_DISPLAY_PASSWORD)->SetWindowText(str);
#else
	str.Format(_T("<a>%s</a>"),Translate(_T("display Pin No")));
	GetDlgItem(IDC_SYSLINK_DISPLAY_PASSWORD)->SetWindowText(str);
#endif
#endif

#ifdef _GLOBAL_ACCOUNT_REG
	str.Format(_T("<a>%s</a>"),Translate(_T("Create Account")));
	GetDlgItem(IDC_SYSLINK_REG)->SetWindowText(str);
#endif

#ifndef _GLOBAL_ACCOUNT_MINI

	CEdit* edit;
	CComboBox *combobox;

	combobox= (CComboBox*)GetDlgItem(IDC_SRTP);
	combobox->AddString(Translate(_T("Disabled")));
	combobox->AddString(Translate(_T("Optional")));
	combobox->AddString(Translate(_T("Mandatory")));
	combobox->SetCurSel(0);

	combobox= (CComboBox*)GetDlgItem(IDC_TRANSPORT);
	combobox->AddString(Translate(_T("Auto")));
	combobox->AddString(_T("UDP"));
	combobox->AddString(_T("TCP"));
	combobox->AddString(_T("TLS"));
	combobox->SetCurSel(0);


	combobox= (CComboBox*)GetDlgItem(IDC_PUBLIC_ADDR);
	combobox->AddString(Translate(_T("Auto")));
	char buf[256]={0};
	if ( gethostname(buf, 256) == 0) {
		struct addrinfo* l_addrInfo = NULL;
		struct addrinfo l_addrInfoHints;
		ZeroMemory(&l_addrInfoHints, sizeof(addrinfo));
		l_addrInfoHints.ai_socktype = SOCK_STREAM;
		l_addrInfoHints.ai_family = PF_INET;
		if ( getaddrinfo(buf,NULL, &l_addrInfoHints,&l_addrInfo) == 0 ) {
			if (l_addrInfo) {
				struct addrinfo* l_addrInfoCurrent = l_addrInfo;
				for (l_addrInfoCurrent = l_addrInfo; l_addrInfoCurrent; l_addrInfoCurrent=l_addrInfoCurrent->ai_next) {
					struct sockaddr_in *ipv4 = (struct sockaddr_in *)l_addrInfoCurrent->ai_addr;
					char * ip = inet_ntoa(ipv4->sin_addr);
					combobox->AddString(CString(ip));
				}
			}
		}
	}
	combobox->SetCurSel(0);


	combobox= (CComboBox*)GetDlgItem(IDC_LISTEN_PORT);
	combobox->AddString(Translate(_T("Auto")));
	combobox->SetCurSel(0);

#endif

	return TRUE;
}