Exemplo n.º 1
0
void CMainFrame::init_tools()
{
	int i;
	//int highest_terran_index;
	//char ship_name[256];
	//int ship_index;

	// some bizarre Volition check:
	static int count = 0;
	count++;
	if (count == 1) {
		return;
	} else if (count >= 3) {
		Warning(LOCATION, "CMainFrame::init_tools was called more than twice!  Trace out and fix.");
		return;
	}

	for (i=0; i<Num_ship_classes; i++){
		// don't add the pirate ship
		if(Ship_info[i].flags & SIF_NO_FRED){
			m_new_ship_type_combo_box.AddString("");
			continue;
		}

		m_new_ship_type_combo_box.AddString(Ship_info[i].name);
	}

//	m_new_ship_type_combo_box.AddString("Player Start");		
	m_new_ship_type_combo_box.AddString("Jump Node");
	m_new_ship_type_combo_box.AddString("Waypoint");		

	/*
	// now we want to sort special ships (mission disk) ----------------------
	highest_terran_index = 0;
	memset(ship_name, 0, 256);
	while(m_new_ship_type_combo_box.GetLBText(highest_terran_index, ship_name) != CB_ERR){
		ship_index = ship_info_lookup(ship_name);
		if((ship_index < 0) || (ship_index >= Num_ship_classes) || (Ship_info[ship_index].species != 0)){
			break;
		}
		highest_terran_index++;
	}		
	*/
	m_new_ship_type_combo_box.SetCurSel(0);
}
Exemplo n.º 2
0
void CMainFrame::init_tools()
{
	static int count = 0;
	int i;
	//int highest_terran_index;
	//char ship_name[256];
	//int ship_index;

	Assert(count < 2);

	// add 
	if (count++) {
		for (i=0; i<Num_ship_types; i++){
			// don't add the pirate ship
			if(Ship_info[i].flags & SIF_NO_FRED){
				m_new_ship_type_combo_box.AddString("");
				continue;
			}

			m_new_ship_type_combo_box.AddString(Ship_info[i].name);
		}

//		m_new_ship_type_combo_box.AddString("Player Start");		
		m_new_ship_type_combo_box.AddString("Jump Node");
		m_new_ship_type_combo_box.AddString("Waypoint");		

		/*
		// now we want to sort special ships (mission disk) ----------------------
		highest_terran_index = 0;
		memset(ship_name, 0, 256);
		while(m_new_ship_type_combo_box.GetLBText(highest_terran_index, ship_name) != CB_ERR){
			ship_index = ship_info_lookup(ship_name);
			if((ship_index < 0) || (ship_index >= Num_ship_types) || (Ship_info[ship_index].species != SPECIES_TERRAN)){
				break;
			}
			highest_terran_index++;
		}		
		*/
	}	
}
Exemplo n.º 3
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	int z;
	CRect rect;

	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.Create(this) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	// Create the combo box
	z = m_wndToolBar.CommandToIndex(ID_NEW_SHIP_TYPE);
	Assert(z != -1);
	m_wndToolBar.SetButtonInfo(z, ID_NEW_SHIP_TYPE, TBBS_SEPARATOR, 230);

	// Design guide advises 12 pixel gap between combos and buttons
//	m_wndToolBar.SetButtonInfo(1, ID_SEPARATOR, TBBS_SEPARATOR, 12);
	m_wndToolBar.GetItemRect(z, &rect);
	rect.top = 3;
	rect.bottom = rect.top + 550;
	if (!m_new_ship_type_combo_box.Create(CBS_DROPDOWNLIST | WS_VISIBLE | WS_VSCROLL | CBS_HASSTRINGS | LBS_OWNERDRAWFIXED,
		rect, &m_wndToolBar, ID_NEW_SHIP_TYPE))
	{
		TRACE0("Failed to create new ship type combo-box\n");
		return FALSE;
	}

/*	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
*/

/*	if (!m_wndStatusBar.Create(this,
		WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, ID_MY_STATUS_BAR) ||
		!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))*/

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;

	} else {
		m_wndStatusBar.SetPaneInfo(0, 0, SBPS_STRETCH, 0);
		m_wndStatusBar.SetPaneInfo(1, 0, SBPS_NORMAL, 80);
		m_wndStatusBar.SetPaneInfo(2, 0, SBPS_NORMAL, 180);
//		m_wndStatusBar.SetPaneInfo(3, 0, SBPS_NORMAL, 100);
		m_wndStatusBar.SetPaneInfo(4, 0, SBPS_NORMAL, 130);
	}

	// TODO: Remove this if you don't want tool tips or a resizeable toolbar
	m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	Fred_main_wnd = this;
	Ship_editor_dialog.Create();
	Wing_editor_dialog.Create();
	Waypoint_editor_dialog.Create();
	init_tools();
	LoadBarState("Tools state");
	return 0;
}