예제 #1
0
void CommodityTradeWidget::ShowAll()
{
	DeleteAllChildren();
	m_stockLabels.clear();
	m_cargoLabels.clear();

	SetTransparency(true);

	Gui::VScrollBar *scroll = new Gui::VScrollBar();
	Gui::VScrollPortal *portal = new Gui::VScrollPortal(450);
	scroll->SetAdjustment(&portal->vscrollAdjust);
	//int GetStock(Equip::Type t) const { return m_equipmentStock[t]; }

	int NUM_ITEMS = 0;
	const float YSEP = floor(Gui::Screen::GetFontHeight() * 2.5f);
	for (int i=Equip::FIRST_COMMODITY; i<=Equip::LAST_COMMODITY; i++) {
		assert(Equip::types[i].slot == Equip::SLOT_CARGO);

		if (m_seller->DoesSell(Equip::Type(i))) {
				NUM_ITEMS++;
		}
	}
	Gui::Fixed *innerbox = new Gui::Fixed(450, NUM_ITEMS*YSEP);
	innerbox->SetTransparency(true);

	const float iconOffset = 8.0f;
	for (int i=Equip::FIRST_COMMODITY, num=0; i<=Equip::LAST_COMMODITY; i++) {
		assert(Equip::types[i].slot == Equip::SLOT_CARGO);

		if (!m_seller->DoesSell(Equip::Type(i))) continue;
		int stock = m_seller->GetStock(static_cast<Equip::Type>(i));

        std::map<Equip::Type,std::string>::iterator icon_iter = s_iconMap.find(Equip::Type(i));
		if (icon_iter != s_iconMap.end()) {
			Gui::Image *icon = new Gui::Image(("icons/goods/" + (*icon_iter).second + ".png").c_str());
			// this forces the on-screen rendering to fit within (rescale) to these dimensions
			icon->SetRenderDimensions(38.0f, 32.0f);
			innerbox->Add(icon, 0, num*YSEP);
		}

		Gui::Label *l = new Gui::Label(Equip::types[i].name);
		if (Equip::types[i].description)
			l->SetToolTip(Equip::types[i].description);
		innerbox->Add(l,42,num*YSEP+iconOffset);
		Gui::RepeaterButton *b = new Gui::RepeaterButton(RBUTTON_DELAY, RBUTTON_REPEAT);
		sigc::slot<void> func = sigc::bind(sigc::mem_fun(this, &CommodityTradeWidget::OnClickBuy), i);
		b->onClick.connect(sigc::bind(sigc::mem_fun(this, &CommodityTradeWidget::ManageRButton), b, func));
		innerbox->Add(b, 380, num*YSEP+iconOffset);
		b = new Gui::RepeaterButton(RBUTTON_DELAY, RBUTTON_REPEAT);
		func = sigc::bind(sigc::mem_fun(this, &CommodityTradeWidget::OnClickSell), i);
		b->onClick.connect(sigc::bind(sigc::mem_fun(this, &CommodityTradeWidget::ManageRButton), b, func));
		innerbox->Add(b, 415, num*YSEP+iconOffset);
		char buf[128];
		innerbox->Add(new Gui::Label(
					format_money(m_seller->GetPrice(static_cast<Equip::Type>(i)))
					), 200, num*YSEP+iconOffset);

		snprintf(buf, sizeof(buf), "%dt", stock*Equip::types[i].mass);
		Gui::Label *stocklabel = new Gui::Label(buf);
		m_stockLabels[i] = stocklabel;
		innerbox->Add(stocklabel, 275, num*YSEP+iconOffset);

		snprintf(buf, sizeof(buf), "%dt", Pi::player->m_equipment.Count(Equip::SLOT_CARGO, static_cast<Equip::Type>(i))*Equip::types[i].mass);
		Gui::Label *cargolabel = new Gui::Label(buf);
		m_cargoLabels[i] = cargolabel;
		innerbox->Add(cargolabel, 325, num*YSEP+iconOffset);
		num++;
	}
	innerbox->ShowAll();

	portal->Add(innerbox);
	portal->ShowAll();

	Gui::Fixed *heading = new Gui::Fixed(470, Gui::Screen::GetFontHeight());
	const Color &col = Gui::Theme::Colors::tableHeading;
	heading->Add((new Gui::Label(Lang::ITEM))->Color(col), 0, 0);
	heading->Add((new Gui::Label(Lang::PRICE))->Color(col), 200, 0);
	heading->Add((new Gui::Label(Lang::BUY))->Color(col), 380, 0);
	heading->Add((new Gui::Label(Lang::SELL))->Color(col), 415, 0);
	heading->Add((new Gui::Label(Lang::STOCK))->Color(col), 275, 0);
	heading->Add((new Gui::Label(Lang::CARGO))->Color(col), 325, 0);
	PackEnd(heading);

	Gui::HBox *body = new Gui::HBox();
	body->PackEnd(portal);
	body->PackEnd(scroll);
	PackEnd(body);

	SetSpacing(YSEP-Gui::Screen::GetFontHeight());

	Gui::VBox::ShowAll();
}
예제 #2
0
void ShipCpanel::InitObject()
{
	SetTransparency(true);

	Gui::Image *img = new Gui::Image("icons/cpanel.png");
	img->SetRenderDimensions(800, 80);
	Add(img, 0, 0);

	m_currentMapView = MAP_SECTOR;
	m_useEquipWidget = new UseEquipWidget();
	m_msglog = new MsgLogWidget();

	m_userSelectedMfuncWidget = MFUNC_SCANNER;

	m_scanner->onGrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncGrabFocus), MFUNC_SCANNER));
	m_useEquipWidget->onGrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncGrabFocus), MFUNC_EQUIPMENT));
	m_msglog->onGrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncGrabFocus), MFUNC_MSGLOG));

	m_scanner->onUngrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncUngrabFocus), MFUNC_SCANNER));
	m_useEquipWidget->onUngrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncUngrabFocus), MFUNC_EQUIPMENT));
	m_msglog->onUngrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncUngrabFocus), MFUNC_MSGLOG));

	// where the scanner is
	m_mfsel = new MultiFuncSelectorWidget();
	m_mfsel->onSelect.connect(sigc::mem_fun(this, &ShipCpanel::OnUserChangeMultiFunctionDisplay));
	Add(m_mfsel, 656, 18);
	ChangeMultiFunctionDisplay(MFUNC_SCANNER);

//	Gui::RadioGroup *g = new Gui::RadioGroup();
	Gui::ImageRadioButton *b = new Gui::ImageRadioButton(0, "icons/timeaccel0.png", "icons/timeaccel0_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), Game::TIMEACCEL_PAUSED));
	b->SetShortcut(SDLK_ESCAPE, KMOD_LSHIFT);
	b->SetRenderDimensions(22, 18);
	Add(b, 0, 36);
	m_timeAccelButtons[0] = b;

	b = new Gui::ImageRadioButton(0, "icons/timeaccel1.png", "icons/timeaccel1_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), Game::TIMEACCEL_1X));
	b->SetShortcut(SDLK_F1, KMOD_LSHIFT);
	b->SetSelected(true);
	b->SetRenderDimensions(22, 18);
	Add(b, 22, 36);
	m_timeAccelButtons[1] = b;

	b = new Gui::ImageRadioButton(0, "icons/timeaccel2.png", "icons/timeaccel2_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), Game::TIMEACCEL_10X));
	b->SetShortcut(SDLK_F2, KMOD_LSHIFT);
	b->SetRenderDimensions(22, 18);
	Add(b, 44, 36);
	m_timeAccelButtons[2] = b;

	b = new Gui::ImageRadioButton(0, "icons/timeaccel3.png", "icons/timeaccel3_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), Game::TIMEACCEL_100X));
	b->SetShortcut(SDLK_F3, KMOD_LSHIFT);
	b->SetRenderDimensions(22, 18);
	Add(b, 66, 36);
	m_timeAccelButtons[3] = b;

	b = new Gui::ImageRadioButton(0, "icons/timeaccel4.png", "icons/timeaccel4_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), Game::TIMEACCEL_1000X));
	b->SetShortcut(SDLK_F4, KMOD_LSHIFT);
	b->SetRenderDimensions(22, 18);
	Add(b, 88, 36);
	m_timeAccelButtons[4] = b;

	b = new Gui::ImageRadioButton(0, "icons/timeaccel5.png", "icons/timeaccel5_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), Game::TIMEACCEL_10000X));
	b->SetShortcut(SDLK_F5, KMOD_LSHIFT);
	b->SetRenderDimensions(22, 18);
	Add(b, 110, 36);
	m_timeAccelButtons[5] = b;

	m_leftButtonGroup = new Gui::RadioGroup();
	m_camButton = new Gui::MultiStateImageButton();
	m_leftButtonGroup->Add(m_camButton);
	m_camButton->SetSelected(true);
	m_camButton->AddState(WorldView::CAM_INTERNAL, "icons/cam_internal.png", "icons/cam_internal_on.png", Lang::INTERNAL_VIEW);
	m_camButton->AddState(WorldView::CAM_EXTERNAL, "icons/cam_external.png", "icons/cam_external_on.png", Lang::EXTERNAL_VIEW);
	m_camButton->AddState(WorldView::CAM_SIDEREAL, "icons/cam_sidereal.png", "icons/cam_sidereal_on.png", Lang::SIDEREAL_VIEW);
	m_camButton->SetShortcut(SDLK_F1, KMOD_NONE);
	m_camButton->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeCamView));
	m_camButton->SetRenderDimensions(30, 22);
	Add(m_camButton, 2, 56);

	Gui::MultiStateImageButton *map_button = new Gui::MultiStateImageButton();
	m_leftButtonGroup->Add(map_button);
	map_button->SetSelected(false);
	map_button->SetShortcut(SDLK_F2, KMOD_NONE);
	map_button->AddState(0, "icons/cpan_f2_map.png", "icons/cpan_f2_map_on.png", Lang::NAVIGATION_STAR_MAPS);
	map_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeToMapView));
	map_button->SetRenderDimensions(30, 22);
	Add(map_button, 34, 56);

	Gui::MultiStateImageButton *info_button = new Gui::MultiStateImageButton();
	m_leftButtonGroup->Add(info_button);
	info_button->SetSelected(false);
	info_button->SetShortcut(SDLK_F3, KMOD_NONE);
	info_button->AddState(0, "icons/cpan_f3_shipinfo.png", "icons/cpan_f3_shipinfo_on.png", Lang::SHIP_INFORMATION);
	info_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeInfoView));
	info_button->SetRenderDimensions(30, 22);
	Add(info_button, 66, 56);

	Gui::MultiStateImageButton *comms_button = new Gui::MultiStateImageButton();
	m_leftButtonGroup->Add(comms_button);
	comms_button->SetSelected(false);
	comms_button->SetShortcut(SDLK_F4, KMOD_NONE);
	comms_button->AddState(0, "icons/comms_f4.png", "icons/comms_f4_on.png", Lang::COMMS);
	comms_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnClickComms));
	comms_button->SetRenderDimensions(30, 22);
	Add(comms_button, 98, 56);

	m_clock = (new Gui::Label(""))->Color(255,178,0);
	Add(m_clock, 4, 18);

	m_rightButtonGroup = new Gui::RadioGroup();
	b = new Gui::ImageRadioButton(m_rightButtonGroup, "icons/map_sector_view.png", "icons/map_sector_view_on.png");
	m_rightButtonGroup->SetSelected(0);
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_SECTOR));
	b->SetShortcut(SDLK_F5, KMOD_NONE);
	b->SetToolTip(Lang::GALAXY_SECTOR_VIEW);
	b->SetRenderDimensions(30, 22);
	Add(b, 674, 56);
	m_mapViewButtons[0] = b;
	b = new Gui::ImageRadioButton(m_rightButtonGroup, "icons/map_system_view.png", "icons/map_system_view_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_SYSTEM));
	b->SetShortcut(SDLK_F6, KMOD_NONE);
	b->SetToolTip(Lang::SYSTEM_ORBIT_VIEW);
	b->SetRenderDimensions(30, 22);
	Add(b, 706, 56);
	m_mapViewButtons[1] = b;
	b = new Gui::ImageRadioButton(m_rightButtonGroup, "icons/map_sysinfo_view.png", "icons/map_sysinfo_view_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_INFO));
	b->SetShortcut(SDLK_F7, KMOD_NONE);
	b->SetToolTip(Lang::STAR_SYSTEM_INFORMATION);
	b->SetRenderDimensions(30, 22);
	Add(b, 738, 56);
	m_mapViewButtons[2] = b;
	b = new Gui::ImageRadioButton(m_rightButtonGroup, "icons/map_galactic_view.png", "icons/map_galactic_view_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_GALACTIC));
	b->SetShortcut(SDLK_F8, KMOD_NONE);
	b->SetToolTip(Lang::GALACTIC_VIEW);
	b->SetRenderDimensions(30, 22);
	Add(b, 770, 56);
	m_mapViewButtons[3] = b;

	m_rotationDampingButton = new Gui::MultiStateImageButton();
	m_rotationDampingButton->SetSelected(false);
	m_rotationDampingButton->AddState(0, "icons/rotation_damping_off.png", Lang::ROTATION_DAMPING_OFF);
	m_rotationDampingButton->AddState(1, "icons/rotation_damping_on.png", Lang::ROTATION_DAMPING_ON);
	m_rotationDampingButton->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnClickRotationDamping));
	m_rotationDampingButton->SetRenderDimensions(20, 13);
	m_rotationDampingButton->SetActiveState(Pi::player->GetPlayerController()->GetRotationDamping());
	Add(m_rotationDampingButton, 760, 37);
	m_connOnRotationDampingChanged = Pi::player->GetPlayerController()->onRotationDampingChanged.connect(
			sigc::mem_fun(this, &ShipCpanel::OnRotationDampingChanged));

	img = new Gui::Image("icons/alert_green.png");
	img->SetToolTip(Lang::NO_ALERT);
	img->SetRenderDimensions(20, 13);
	Add(img, 780, 37);
	m_alertLights[0] = img;
	img = new Gui::Image("icons/alert_yellow.png");
	img->SetToolTip(Lang::SHIP_NEARBY);
	img->SetRenderDimensions(20, 13);
	Add(img, 780, 37);
	m_alertLights[1] = img;
	img = new Gui::Image("icons/alert_red.png");
	img->SetToolTip(Lang::LASER_FIRE_DETECTED);
	img->SetRenderDimensions(20, 13);
	Add(img, 780, 37);
	m_alertLights[2] = img;

	m_overlay[OVERLAY_TOP_LEFT]     = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_TOP_RIGHT]    = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_BOTTOM_LEFT]  = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_BOTTOM_RIGHT] = (new Gui::Label(""))->Color(s_hudTextColor);
	Add(m_overlay[OVERLAY_TOP_LEFT],     170.0f, 2.0f);
	Add(m_overlay[OVERLAY_TOP_RIGHT],    500.0f, 2.0f);
	Add(m_overlay[OVERLAY_BOTTOM_LEFT],  150.0f, 62.0f);
	Add(m_overlay[OVERLAY_BOTTOM_RIGHT], 520.0f, 62.0f);

	m_connOnDockingClearanceExpired =
		Pi::onDockingClearanceExpired.connect(sigc::mem_fun(this, &ShipCpanel::OnDockingClearanceExpired));
}
예제 #3
0
void ShipCpanel::InitObject()
{
	SetTransparency(true);

	Gui::Image *img = new Gui::Image("icons/cpanel.png");
	img->SetRenderDimensions(800, 80);
	Add(img, 0, 520);

	m_currentMapView = MAP_SECTOR;
	m_useEquipWidget = new UseEquipWidget();
	//m_msglog = new MsgLogWidget();
	m_inflog = new MsgLogWidget();

	m_userSelectedMfuncWidget = MFUNC_SCANNER;

	m_scanner->onGrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncGrabFocus), MFUNC_SCANNER));
	m_useEquipWidget->onGrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncGrabFocus), MFUNC_EQUIPMENT));
	//m_msglog->onGrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncGrabFocus), MFUNC_MSGLOG));

	m_scanner->onUngrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncUngrabFocus), MFUNC_SCANNER));
	m_useEquipWidget->onUngrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncUngrabFocus), MFUNC_EQUIPMENT));
	//m_msglog->onUngrabFocus.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnMultiFuncUngrabFocus), MFUNC_MSGLOG));

	ChangeMultiFunctionDisplay(MFUNC_SCANNER);

//	Gui::RadioGroup *g = new Gui::RadioGroup();
	float ui_width = static_cast<float>(Gui::Screen::GetWidth());
	const float pp_margin = 40.0f, clock_margin = 145.0f;

	Gui::ImageRadioButton *b;

	m_leftButtonGroup = new Gui::RadioGroup();
	m_camButton = new Gui::MultiStateImageButton();
	m_leftButtonGroup->Add(m_camButton);
	m_camButton->SetSelected(true);
	m_camButton->AddState(WorldView::CAM_INTERNAL, "icons/cam_internal.png", "icons/cam_internal_on.png", Lang::INTERNAL_VIEW);
	m_camButton->AddState(WorldView::CAM_EXTERNAL, "icons/cam_external.png", "icons/cam_external_on.png", Lang::EXTERNAL_VIEW);
	m_camButton->AddState(WorldView::CAM_SIDEREAL, "icons/cam_sidereal.png", "icons/cam_sidereal_on.png", Lang::SIDEREAL_VIEW);
	m_camButton->SetShortcut(SDLK_F1, KMOD_NONE);
	m_camButton->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeCamView));
	m_camButton->SetRenderDimensions(30, 22);
	Add(m_camButton, 214, 56 + 520);

	Gui::MultiStateImageButton *map_button = new Gui::MultiStateImageButton();
	m_leftButtonGroup->Add(map_button);
	map_button->SetSelected(false);
	map_button->SetShortcut(SDLK_F2, KMOD_NONE);
	map_button->AddState(0, "icons/cpan_f2_map.png", "icons/cpan_f2_map_on.png", Lang::NAVIGATION_STAR_MAPS);
	map_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeToMapView));
	map_button->SetRenderDimensions(30, 22);
	Add(map_button, 247, 56 + 520);

	Gui::MultiStateImageButton *info_button = new Gui::MultiStateImageButton();
	m_leftButtonGroup->Add(info_button);
	info_button->SetSelected(false);
	info_button->SetShortcut(SDLK_F3, KMOD_NONE);
	info_button->AddState(0, "icons/cpan_f3_shipinfo.png", "icons/cpan_f3_shipinfo_on.png", Lang::SHIP_INFORMATION);
	info_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeInfoView));
	info_button->SetRenderDimensions(30, 22);
	Add(info_button, 279, 56 + 520);

	m_commsButton = new Gui::MultiStateImageButton();
	m_leftButtonGroup->Add(m_commsButton);
	m_commsButton->SetSelected(false);
	m_commsButton->SetShortcut(SDLK_F4, KMOD_NONE);
	m_commsButton->AddState(FLIGHT_BUTTON_UNAVAILABLE, "icons/comms_unavailable.png", Lang::COMMS);
	m_commsButton->AddState(FLIGHT_BUTTON_OFF, "icons/comms_off.png", Lang::COMMS);
	m_commsButton->AddState(FLIGHT_BUTTON_ON, "icons/comms_on.png", Lang::COMMS);
	m_commsButton->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnClickComms));
	m_commsButton->SetRenderDimensions(30, 22);
	m_commsButton->SetEnabled(false);
	Add(m_commsButton, 312, 56 + 520);

	Gui::Screen::PushFont("OverlayFont");
	m_clock = (new Gui::Label(""))->Color(Color::PARAGON_GREEN);
	Add(m_clock, ui_width - clock_margin, 64 + 520);
	Gui::Screen::PopFont();

	m_rightButtonGroup = new Gui::RadioGroup();
	b = new Gui::ImageRadioButton(m_rightButtonGroup, "icons/map_sector_view.png", "icons/map_sector_view_on.png");
	m_rightButtonGroup->SetSelected(0);
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_SECTOR));
	b->SetShortcut(SDLK_F5, KMOD_NONE);
	b->SetToolTip(Lang::GALAXY_SECTOR_VIEW);
	b->SetRenderDimensions(30, 22);
	Add(b, 459, 56 + 520);
	m_mapViewButtons[0] = b;
	b = new Gui::ImageRadioButton(m_rightButtonGroup, "icons/map_system_view.png", "icons/map_system_view_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_SYSTEM));
	b->SetShortcut(SDLK_F6, KMOD_NONE);
	b->SetToolTip(Lang::SYSTEM_ORBIT_VIEW);
	b->SetRenderDimensions(30, 22);
	Add(b, 491, 56 + 520);
	m_mapViewButtons[1] = b;
	b = new Gui::ImageRadioButton(m_rightButtonGroup, "icons/map_sysinfo_view.png", "icons/map_sysinfo_view_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_INFO));
	b->SetShortcut(SDLK_F7, KMOD_NONE);
	b->SetToolTip(Lang::STAR_SYSTEM_INFORMATION);
	b->SetRenderDimensions(30, 22);
	Add(b, 524, 56 + 520);
	m_mapViewButtons[2] = b;
	b = new Gui::ImageRadioButton(m_rightButtonGroup, "icons/map_galactic_view.png", "icons/map_galactic_view_on.png");
	b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_GALACTIC));
	b->SetShortcut(SDLK_F8, KMOD_NONE);
	b->SetToolTip(Lang::GALACTIC_VIEW);
	b->SetRenderDimensions(30, 22);
	Add(b, 556, 56 + 520);
	m_mapViewButtons[3] = b;

	img = new Gui::Image("icons/alert_green.png");
	img->SetToolTip(Lang::NO_ALERT);
	img->SetRenderDimensions(20, 13);
	Add(img, 388, 5 + 520);
	m_alertLights[0] = img;
	img = new Gui::Image("icons/alert_yellow.png");
	img->SetToolTip(Lang::SHIP_NEARBY);
	img->SetRenderDimensions(20, 13);
	Add(img, 388, 5 + 520);
	m_alertLights[1] = img;
	img = new Gui::Image("icons/alert_red.png");
	img->SetToolTip(Lang::LASER_FIRE_DETECTED);
	img->SetRenderDimensions(20, 13);
	Add(img, 388, 5 + 520);
	m_alertLights[2] = img;

	float cursor = 23.0f + 520, cursor_inc = 8.0f;
	const float hh = static_cast<float>(Gui::Screen::GetHeight() / 2) + 3;
	const float hw = static_cast<float>(Gui::Screen::GetWidth() / 2);
	const float top = hh - (s_centerCircleSize.y / 2.0f);
	const float bottom = top + s_centerCircleSize.y;
	const float left = hw - (s_centerCircleSize.x / 2.0f);
	const float right = left + s_centerCircleSize.x;

	Gui::Screen::PushFont("HudFont");
	m_overlay[OVERLAY_TOP_LEFT]     = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_TOP_RIGHT]    = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_BOTTOM_LEFT]  = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_BOTTOM_RIGHT] = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_HUD2_LEFT] = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_HUD2_LEFT_2] = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_HUD2_LEFT_3] = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_HUD2_LEFT_4] = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_HUD2_LEFT_5] = (new Gui::Label(""))->Color(s_hudTextColor);
	m_overlay[OVERLAY_DEV] = (new Gui::Label(""))->Color(Color::WHITE);
	Gui::Screen::PopFont();

	Gui::Screen::PushFont("SmallHudFont");
	m_overlay[OVERLAY_CIRCLE_TOP_1] = (new Gui::Label(""))->Color(Color::PARAGON_BLUE);
	m_overlay[OVERLAY_CIRCLE_TOP_2] = (new Gui::Label(""))->Color(Color::PARAGON_GREEN);
	m_overlay[OVERLAY_CIRCLE_TOP_1]->SetAlignment(Gui::Alignment::ALIGN_CENTER);
	m_overlay[OVERLAY_CIRCLE_TOP_2]->SetAlignment(Gui::Alignment::ALIGN_CENTER);

	m_overlay[OVERLAY_CIRCLE_LEFT_1] = (new Gui::Label(""))->Color(Color::PARAGON_BLUE);
	m_overlay[OVERLAY_CIRCLE_LEFT_2] = (new Gui::Label(""))->Color(Color::PARAGON_GREEN);
	m_overlay[OVERLAY_CIRCLE_LEFT_1]->SetAlignment(Gui::Alignment::ALIGN_RIGHT);
	m_overlay[OVERLAY_CIRCLE_LEFT_2]->SetAlignment(Gui::Alignment::ALIGN_RIGHT);

	m_overlay[OVERLAY_CIRCLE_RIGHT_1] = (new Gui::Label(""))->Color(Color::PARAGON_BLUE);
	m_overlay[OVERLAY_CIRCLE_RIGHT_2] = (new Gui::Label(""))->Color(Color::PARAGON_GREEN);
	m_overlay[OVERLAY_CIRCLE_RIGHT_1]->SetAlignment(Gui::Alignment::ALIGN_LEFT);
	m_overlay[OVERLAY_CIRCLE_RIGHT_2]->SetAlignment(Gui::Alignment::ALIGN_LEFT);

	m_overlay[OVERLAY_CIRCLE_BOTTOM_1] = (new Gui::Label(""))->Color(Color::PARAGON_BLUE);
	m_overlay[OVERLAY_CIRCLE_BOTTOM_2] = (new Gui::Label(""))->Color(Color::PARAGON_GREEN);
	m_overlay[OVERLAY_CIRCLE_BOTTOM_1]->SetAlignment(Gui::Alignment::ALIGN_CENTER);
	m_overlay[OVERLAY_CIRCLE_BOTTOM_2]->SetAlignment(Gui::Alignment::ALIGN_CENTER);


	Add(m_overlay[OVERLAY_TOP_LEFT], 214.0f, 22.0f + 520);
	Add(m_overlay[OVERLAY_TOP_RIGHT], 460.0f, 22.0f + 520);
	Add(m_overlay[OVERLAY_BOTTOM_LEFT], 214.0f, 34.0f + 520);
	Add(m_overlay[OVERLAY_BOTTOM_RIGHT], 460.0f, 34.0f + 520);
	
	//Add(m_overlay[OVERLAY_HUD2_LEFT], 2.0f, cursor); cursor += cursor_inc;
	//Add(m_overlay[OVERLAY_HUD2_LEFT_2], 2.0f, cursor); cursor += cursor_inc;
	//Add(m_overlay[OVERLAY_HUD2_LEFT_3], 2.0f, cursor); cursor += cursor_inc;
	//Add(m_overlay[OVERLAY_HUD2_LEFT_4], 2.0f, cursor); cursor += cursor_inc;
	//Add(m_overlay[OVERLAY_HUD2_LEFT_5], 2.0f, cursor); //cursor += cursor_inc;
	Add(m_overlay[OVERLAY_DEV],			2.0f, cursor); cursor += cursor_inc;

	Add(m_overlay[OVERLAY_CIRCLE_TOP_1], hw, top - cursor_inc);
	Add(m_overlay[OVERLAY_CIRCLE_TOP_2], hw, top - (cursor_inc * 2.0f));
	Add(m_overlay[OVERLAY_CIRCLE_LEFT_1], left - 100.0f, hh - cursor_inc);
	m_overlay[OVERLAY_CIRCLE_LEFT_1]->SetRightMargin(100.0f);
	Add(m_overlay[OVERLAY_CIRCLE_LEFT_2], left - 100.0f, hh);
	m_overlay[OVERLAY_CIRCLE_LEFT_2]->SetRightMargin(100.0f);
	Add(m_overlay[OVERLAY_CIRCLE_RIGHT_1], right, hh - cursor_inc);
	Add(m_overlay[OVERLAY_CIRCLE_RIGHT_2], right, hh);
	Add(m_overlay[OVERLAY_CIRCLE_BOTTOM_1], hw, bottom);
	Add(m_overlay[OVERLAY_CIRCLE_BOTTOM_2], hw, bottom + cursor_inc);

	Gui::Screen::PopFont();

	m_connOnDockingClearanceExpired =
		Pi::onDockingClearanceExpired.connect(sigc::mem_fun(this, &ShipCpanel::OnDockingClearanceExpired));
}