//=========================================================================== ST void Toolbar_set_pos() { if (false == Toolbar_hidden) SetTransparency(Toolbar_hwnd, Settings_toolbarAlpha); SetWindowPos(Toolbar_hwnd, TBInfo.onTop ? HWND_TOPMOST : HWND_NOTOPMOST, TBInfo.xpos, TBInfo.autohidden ? Toolbar_HideY : TBInfo.ypos, TBInfo.width, TBInfo.height, Toolbar_hidden ? SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOSENDCHANGING : SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOSENDCHANGING ); if (TBInfo.bbsb_hwnd) PostMessage(TBInfo.bbsb_hwnd, BB_TOOLBARUPDATE, 0, 0); }
/* open named BMP file */ GUI_Font::GUI_Font(char *name) { fontStore=SDL_LoadBMP(name); if (fontStore!=NULL) { charh = fontStore->h/16; charw = fontStore->w/16; freefont=1; } else { freefont=0; DEBUG(0,LEVEL_EMERGENCY,"Could not load font.\n"); exit(1); } SetTransparency(1); w_data = NULL; }
void BeliefCollisionChecker::PlotSigmaHull(btCollisionShape* shape, const vector<btTransform>& tfi, CollisionObjectWrapper* cow, vector<OpenRAVE::GraphHandlePtr>& handles, OR::RaveVector<float> color) { if (btConvexShape* convex = dynamic_cast<btConvexShape*>(shape)) { vector<btTransform> t0i(tfi.size()); // transform all the points with respect to the first transform for (int i=0; i<tfi.size(); i++) t0i[i] = tfi[0].inverseTimes(tfi[i]); SigmaHullShape* shape = new SigmaHullShape(convex, t0i); RenderCollisionShape(shape, tfi[0], *boost::const_pointer_cast<OpenRAVE::EnvironmentBase>(m_env), handles, color); SetTransparency(handles.back(), 0.2); delete shape; } else if (btCompoundShape* compound = dynamic_cast<btCompoundShape*>(shape)) { for (int child_ind = 0; child_ind < compound->getNumChildShapes(); ++child_ind) { vector<btTransform> tfi_child(tfi.size()); for (int i=0; i<tfi.size(); i++) tfi_child[i] = tfi[i]*compound->getChildTransform(child_ind); PlotSigmaHull(compound->getChildShape(child_ind), tfi_child, cow, handles, color); } } else { throw std::runtime_error("I can only plot convex shapes and compound shapes made of convex shapes"); } }
void SaveSubWindowAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("SaveSubWindowAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("position")) != 0) SetPosition(node->AsIntArray()); if((node = searchNode->GetNode("size")) != 0) SetSize(node->AsIntArray()); if((node = searchNode->GetNode("layer")) != 0) SetLayer(node->AsInt()); if((node = searchNode->GetNode("transparency")) != 0) SetTransparency(node->AsDouble()); if((node = searchNode->GetNode("omitWindow")) != 0) SetOmitWindow(node->AsBool()); }
LuaConsole::LuaConsole(int displayedOutputLines): m_maxOutputLines(displayedOutputLines) { m_historyPosition = -1; SetTransparency(false); SetBgColor(0.6f, 0.1f, 0.0f, 0.6f); Gui::Screen::PushFont("ConsoleFont"); m_entryField = new Gui::TextEntry(); Gui::Screen::PopFont(); m_entryField->SetNewlineMode(Gui::TextEntry::AcceptCtrlNewline); m_outputLines.reserve(displayedOutputLines); m_nextOutputLine = 0; // XXX HACK: bypassing TextEntry::Show, because it grabs focus m_entryField->Gui::Widget::Show(); m_entryField->onFilterKeys.connect(sigc::mem_fun(this, &LuaConsole::OnFilterKeys)); m_entryField->onKeyPress.connect(sigc::mem_fun(this, &LuaConsole::OnKeyPressed)); PackEnd(m_entryField); }
LuaConsole::LuaConsole(int displayedOutputLines): m_maxOutputLines(displayedOutputLines), m_precompletionStatement(), m_completionList() { m_historyPosition = -1; SetTransparency(false); SetBgColor(0.6f, 0.1f, 0.0f, 0.6f); Gui::Screen::PushFont("ConsoleFont"); m_entryField = new Gui::TextEntry(); Gui::Screen::PopFont(); m_entryField->SetNewlineMode(Gui::TextEntry::AcceptCtrlNewline); m_outputLines.reserve(displayedOutputLines); m_nextOutputLine = 0; // XXX HACK: bypassing TextEntry::Show, because it grabs focus m_entryField->Gui::Widget::Show(); m_entryField->onFilterKeys.connect(sigc::mem_fun(this, &LuaConsole::OnFilterKeys)); m_entryField->onKeyPress.connect(sigc::mem_fun(this, &LuaConsole::OnKeyPressed)); PackEnd(m_entryField); // prepare the global table lua_State *l = Lua::manager->GetLuaState(); LUA_DEBUG_START(l); lua_newtable(l); lua_newtable(l); lua_pushliteral(l, "__index"); lua_getglobal(l, "_G"); lua_rawset(l, -3); lua_setmetatable(l, -2); lua_setfield(l, LUA_REGISTRYINDEX, "ConsoleGlobal"); LUA_DEBUG_END(l, 0); }
/* use default 8x8 font */ GUI_Font::GUI_Font(Uint8 fontType) { SDL_Surface *temp; w_data = NULL; if(fontType == GUI_FONT_6X8) temp = GUI_Font6x8(); else if(fontType == GUI_FONT_GUMP) { temp = GUI_FontGump(); w_data = GUI_FontGumpWData(); } else temp = GUI_DefaultFont(); fontStore=SDL_ConvertSurface(temp,temp->format,SDL_SWSURFACE); charh = fontStore->h/16; charw = fontStore->w/16; freefont=1; SetTransparency(1); }
Panel::Panel(const gedString spriteName, int x, int y, int width, int height, Actor *parent, bool _bInvertBevel, bool bDrag, bool bPanel, bool _bShadows) : Actor(spriteName, parent, CANVAS, _bShadows?(width + SHADOW_THICKNESS):width, _bShadows?(height + SHADOW_THICKNESS):height, bPanel) { flags.Clear(FLAG_ENABLECOLLISIONDETECTION); this->bDrag = bDrag; confirmButton = cancelButton = NULL; firstHorizontalLine = -1; result = -1; flags.Set(FLAG_HASSHADOWS, _bShadows); bInvertBevel = _bInvertBevel; getImage()->SetPos(x,y); getImage()->SetZDepth(++depth); ColorScheme* cs = get_color_scheme(); colorUp = KrRGBA(cs->editor_top_r, cs->editor_top_g, cs->editor_top_b, cs->editor_top_a); colorDown = KrRGBA(cs->editor_bot_r, cs->editor_bot_g, cs->editor_bot_b, cs->editor_bot_a); colorHighLight = KrRGBA(cs->editor_highlight_r, cs->editor_highlight_g, cs->editor_highlight_b, cs->editor_highlight_a); colorBack = KrRGBA(cs->editor_scroll_r, cs->editor_scroll_g, cs->editor_scroll_b, cs->editor_scroll_a); Draw(); SetTransparency(.1); panelColor = getImage()->CTransform(); listPanel.PushBack(this); if(flags.IsSet(FLAG_HASSHADOWS)) { //Only get focus if have shadows //Avoid get focus for slides... GetFocus(this); } //Don't call SetFocus here, there is no edit box yet }
ShipCpanel::ShipCpanel(): Gui::Fixed((float)Gui::Screen::GetWidth(), 80) { Gui::Screen::AddBaseWidget(this, 0, Gui::Screen::GetHeight()-80); SetTransparency(true); Gui::Image *img = new Gui::Image(PIONEER_DATA_DIR "/icons/cpanel.png"); Add(img, 0, 0); m_currentMapView = MAP_SECTOR; m_scanner = new ScannerWidget(); 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, PIONEER_DATA_DIR "/icons/timeaccel0.png", PIONEER_DATA_DIR "/icons/timeaccel0_on.png"); b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), 0)); b->SetShortcut(SDLK_ESCAPE, KMOD_LSHIFT); Add(b, 0, 36); m_timeAccelButtons[0] = b; b = new Gui::ImageRadioButton(0, PIONEER_DATA_DIR "/icons/timeaccel1.png", PIONEER_DATA_DIR "/icons/timeaccel1_on.png"); b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), 1)); b->SetShortcut(SDLK_F1, KMOD_LSHIFT); b->SetSelected(true); Add(b, 22, 36); m_timeAccelButtons[1] = b; b = new Gui::ImageRadioButton(0, PIONEER_DATA_DIR "/icons/timeaccel2.png", PIONEER_DATA_DIR "/icons/timeaccel2_on.png"); b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), 2)); b->SetShortcut(SDLK_F2, KMOD_LSHIFT); Add(b, 44, 36); m_timeAccelButtons[2] = b; b = new Gui::ImageRadioButton(0, PIONEER_DATA_DIR "/icons/timeaccel3.png", PIONEER_DATA_DIR "/icons/timeaccel3_on.png"); b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), 3)); b->SetShortcut(SDLK_F3, KMOD_LSHIFT); Add(b, 66, 36); m_timeAccelButtons[3] = b; b = new Gui::ImageRadioButton(0, PIONEER_DATA_DIR "/icons/timeaccel4.png", PIONEER_DATA_DIR "/icons/timeaccel4_on.png"); b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), 4)); b->SetShortcut(SDLK_F4, KMOD_LSHIFT); Add(b, 88, 36); m_timeAccelButtons[4] = b; b = new Gui::ImageRadioButton(0, PIONEER_DATA_DIR "/icons/timeaccel5.png", PIONEER_DATA_DIR "/icons/timeaccel5_on.png"); b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnClickTimeaccel), 5)); b->SetShortcut(SDLK_F5, KMOD_LSHIFT); Add(b, 110, 36); m_timeAccelButtons[5] = b; Gui::RadioGroup *g = new Gui::RadioGroup(); Gui::MultiStateImageButton *cam_button = new Gui::MultiStateImageButton(); g->Add(cam_button); cam_button->SetSelected(true); cam_button->AddState(WorldView::CAM_FRONT, PIONEER_DATA_DIR "/icons/cam_front.png", PIONEER_DATA_DIR "/icons/cam_front_on.png", "Front view"); cam_button->AddState(WorldView::CAM_REAR, PIONEER_DATA_DIR "/icons/cam_rear.png", PIONEER_DATA_DIR "/icons/cam_rear_on.png", "Rear view"); cam_button->AddState(WorldView::CAM_EXTERNAL, PIONEER_DATA_DIR "/icons/cam_external.png", PIONEER_DATA_DIR "/icons/cam_external_on.png", "External view"); cam_button->SetShortcut(SDLK_F1, KMOD_NONE); cam_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeCamView)); Add(cam_button, 2, 56); Gui::MultiStateImageButton *map_button = new Gui::MultiStateImageButton(); g->Add(map_button); map_button->SetSelected(false); map_button->SetShortcut(SDLK_F2, KMOD_NONE); map_button->AddState(0, PIONEER_DATA_DIR "/icons/cpan_f2_map.png", PIONEER_DATA_DIR "/icons/cpan_f2_map_on.png", "Navigation and star maps"); map_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeToMapView)); Add(map_button, 34, 56); Gui::MultiStateImageButton *info_button = new Gui::MultiStateImageButton(); g->Add(info_button); info_button->SetSelected(false); info_button->SetShortcut(SDLK_F3, KMOD_NONE); info_button->AddState(0, PIONEER_DATA_DIR "/icons/cpan_f3_shipinfo.png", PIONEER_DATA_DIR "/icons/cpan_f3_shipinfo_on.png", "Ship information"); info_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnChangeInfoView)); Add(info_button, 66, 56); Gui::MultiStateImageButton *comms_button = new Gui::MultiStateImageButton(); g->Add(comms_button); comms_button->SetSelected(false); comms_button->SetShortcut(SDLK_F4, KMOD_NONE); comms_button->AddState(0, PIONEER_DATA_DIR "/icons/comms_f4.png", PIONEER_DATA_DIR "/icons/comms_f4_on.png", "Comms"); comms_button->onClick.connect(sigc::mem_fun(this, &ShipCpanel::OnClickComms)); Add(comms_button, 98, 56); m_clock = (new Gui::Label(""))->Color(1.0f,0.7f,0.0f); Add(m_clock, 4, 18); g = new Gui::RadioGroup(); b = new Gui::ImageRadioButton(g, PIONEER_DATA_DIR "/icons/map_sector_view.png", PIONEER_DATA_DIR "/icons/map_sector_view_on.png"); g->SetSelected(0); b->onSelect.connect(sigc::bind(sigc::mem_fun(this, &ShipCpanel::OnChangeMapView), MAP_SECTOR)); b->SetShortcut(SDLK_F5, KMOD_NONE); b->SetToolTip("Galaxy sector view"); Add(b, 674, 56); m_mapViewButtons[0] = b; b = new Gui::ImageRadioButton(g, PIONEER_DATA_DIR "/icons/map_system_view.png", PIONEER_DATA_DIR "/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("System orbit view"); Add(b, 706, 56); m_mapViewButtons[1] = b; b = new Gui::ImageRadioButton(g, PIONEER_DATA_DIR "/icons/map_sysinfo_view.png", PIONEER_DATA_DIR "/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("Star system information"); Add(b, 738, 56); m_mapViewButtons[2] = b; b = new Gui::ImageRadioButton(g, PIONEER_DATA_DIR "/icons/map_galactic_view.png", PIONEER_DATA_DIR "/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("Galactic view"); Add(b, 770, 56); m_mapViewButtons[3] = b; m_connOnDockingClearanceExpired = Pi::onDockingClearanceExpired.connect(sigc::mem_fun(this, &ShipCpanel::OnDockingClearanceExpired)); }
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(); }
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)); }
CMyWindow::CMyWindow(PG_Widget *parent,const PG_Rect& r,char *text, WindowFlags flags,const std::string& style) : PG_Window(parent,r,text,flags,style) { mywidget = new CMyWidget(this, PG_Rect(5, 30, r.w-10, r.h-35)); SetDirtyUpdate(false); SetTransparency(100); }
void BBP_set_window_modes(plugin_info *PI) { bool useslit = PI->useSlit && PI->hSlit; bool visible = PI->visible && (false == PI->toggled_hidden || useslit); bool updateslit = false; BYTE trans = 255; PI->auto_hidden = false; if (visible != PI->is_visible) { ShowWindow(PI->hwnd, visible ? SW_SHOWNA : SW_HIDE); PI->is_visible = visible; updateslit = true; } if (useslit)// && false == hidden) { RECT r; int w, h; bool update_size; GetWindowRect(PI->hwnd, &r); w = r.right - r.left; h = r.bottom - r.top; update_size = (w != PI->width || h != PI->height); if (update_size) { SetWindowPos( PI->hwnd, NULL, 0, 0, PI->width, PI->height, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER ); updateslit = true; } if (false == PI->inSlit) { if (PI->is_alpha != trans) { SetTransparency(PI->hwnd, trans); PI->is_alpha = trans; } PI->inSlit = true; SendMessage(PI->hSlit, SLIT_ADD, (WPARAM)PI->broam_key, (LPARAM)PI->hwnd); } else if (updateslit) { SendMessage(PI->hSlit, SLIT_UPDATE, 0, (LPARAM)PI->hwnd); } } else { int x, y, w, h; HWND hwnd_after; UINT flags = SWP_NOACTIVATE; if (PI->inSlit) { SendMessage(PI->hSlit, SLIT_REMOVE, 0, (LPARAM)PI->hwnd); PI->inSlit = false; } set_place(PI); x = PI->xpos; y = PI->ypos; w = PI->width; h = PI->height; if (PI->autoHide && false == PI->auto_shown) { int hangout = 3; int place = PI->place; if ((false == PI->orient_vertical && (place == POS_TopLeft || place == POS_BottomLeft)) || place == POS_CenterLeft || place == POS_Left) { x = PI->mon_rect.left, w = hangout; PI->auto_hidden = true; } else if ((false == PI->orient_vertical && (place == POS_TopRight || place == POS_BottomRight)) || place == POS_CenterRight || place == POS_Right) { x = PI->mon_rect.right - hangout, w = hangout; PI->auto_hidden = true; } else if (place == POS_TopLeft || place == POS_TopCenter || place == POS_TopRight || place == POS_Top) { y = PI->mon_rect.top, h = hangout; PI->auto_hidden = true; } else if (place == POS_BottomLeft || place == POS_BottomCenter || place == POS_BottomRight || place == POS_Bottom) { y = PI->mon_rect.bottom - hangout, h = hangout; PI->auto_hidden = true; } } if (WS_CHILD & GetWindowLong(PI->hwnd, GWL_STYLE)) { flags |= SWP_NOZORDER; hwnd_after = NULL; } else { if (PI->alwaysOnTop || PI->auto_shown || PI->auto_hidden) hwnd_after = HWND_TOPMOST; else hwnd_after = HWND_NOTOPMOST; } SetWindowPos(PI->hwnd, hwnd_after, x, y, w, h, flags); trans = PI->auto_hidden ? 255 : PI->alphaValue; if (PI->is_alpha != trans) { if (PI->transparent) SetFullTransparency(PI->hwnd, trans); else SetTransparency(PI->hwnd, trans); PI->is_alpha = trans; } } PI->pos_changed(_THIS); }
void Layer::Merge(Layer* top_layer) { int32 top_bpr = top_layer->Bitmap()->BytesPerRow()/4; int32 bottom_bpr = Bitmap()->BytesPerRow()/4; uint32* top_bits = (uint32*)top_layer->Bitmap()->Bits(); uint32* bottom_bits = (uint32*)Bitmap()->Bits(); int32 height = (int32)min_c(top_layer->Bitmap()->Bounds().Height()+1, Bitmap()->Bounds().Height()+1); int32 width = (int32)min_c(top_layer->Bitmap()->Bounds().Width()+1, Bitmap()->Bounds().Width()+1); union { uint8 bytes[4]; uint32 word; } top,bottom,target; float alpha; float beta; float top_coefficient; float bottom_coefficient; float new_alpha; float* alphas = float_alpha_table; float* betas = top_layer->float_alpha_table; for (register int32 y=0; y<height; ++y) { for (register int32 x=0; x<width; ++x) { top.word = *(top_bits + x + y*top_bpr); bottom.word = *(bottom_bits + x + y*bottom_bpr); alpha = alphas[bottom.bytes[3]]; beta = betas[top.bytes[3]]; new_alpha = (alpha + beta - alpha*beta); if (new_alpha > 0) { bottom_coefficient = (alpha - alpha*beta)/new_alpha; top_coefficient = beta/new_alpha; } else { // If both layers are fully transparent, the new color will // be fully transparent average of the two colors. bottom_coefficient = 0.5; top_coefficient = 0.5; } target.bytes[0] = (uint8)max_c(0,min_c(255, bottom_coefficient*bottom.bytes[0]+top_coefficient*top.bytes[0])); target.bytes[1] = (uint8)max_c(0,min_c(255, bottom_coefficient*bottom.bytes[1]+top_coefficient*top.bytes[1])); target.bytes[2] = (uint8)max_c(0,min_c(255, bottom_coefficient*bottom.bytes[2]+top_coefficient*top.bytes[2])); target.bytes[3] = (uint8)(255*new_alpha); *(bottom_bits + x + y*bottom_bpr) = target.word; } } // Change the transparency to 1.0 SetTransparency(1.0); }
FileSelectorWidget::FileSelectorWidget(Type type, const std::string &title) : Gui::VBox(), m_type(type), m_title(title) { SetTransparency(false); SetSpacing(5.0f); SetSizeRequest(FLT_MAX, FLT_MAX); }
SystemInfoView::SystemInfoView() { SetTransparency(true); m_refresh = false; }
void ShipCpanel::InitObject() { Gui::Screen::AddBaseWidget(this, 0, Gui::Screen::GetHeight()-80); SetTransparency(true); Gui::Image *img = new Gui::Image("icons/cpanel.png"); 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); 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); 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); 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); 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); 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); 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_FRONT, "icons/cam_front.png", "icons/cam_front_on.png", Lang::FRONT_VIEW); m_camButton->AddState(WorldView::CAM_REAR, "icons/cam_rear.png", "icons/cam_rear_on.png", Lang::REAR_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)); 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)); 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)); 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)); Add(comms_button, 98, 56); m_clock = (new Gui::Label(""))->Color(1.0f,0.7f,0.0f); 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); 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); 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); 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); Add(b, 770, 56); m_mapViewButtons[3] = b; img = new Gui::Image("icons/alert_green.png"); img->SetToolTip(Lang::NO_ALERT); Add(img, 780, 37); m_alertLights[0] = img; img = new Gui::Image("icons/alert_yellow.png"); img->SetToolTip(Lang::SHIP_NEARBY); Add(img, 780, 37); m_alertLights[1] = img; img = new Gui::Image("icons/alert_red.png"); img->SetToolTip(Lang::LASER_FIRE_DETECTED); Add(img, 780, 37); m_alertLights[2] = img; CameraSwitchWidget *camSwitcher = new CameraSwitchWidget(this, WorldView::CAM_FRONT); camSwitcher->SetShortcut(SDLK_1, KMOD_LSHIFT); Add(camSwitcher,0,0); camSwitcher = new CameraSwitchWidget(this, WorldView::CAM_REAR); camSwitcher->SetShortcut(SDLK_2, KMOD_LSHIFT); Add(camSwitcher,0,0); camSwitcher = new CameraSwitchWidget(this, WorldView::CAM_EXTERNAL); camSwitcher->SetShortcut(SDLK_3, KMOD_LSHIFT); Add(camSwitcher,0,0); camSwitcher = new CameraSwitchWidget(this, WorldView::CAM_SIDEREAL); camSwitcher->SetShortcut(SDLK_4, KMOD_LSHIFT); Add(camSwitcher,0,0); m_connOnDockingClearanceExpired = Pi::onDockingClearanceExpired.connect(sigc::mem_fun(this, &ShipCpanel::OnDockingClearanceExpired)); }
GameMenuView::GameMenuView(): View() { Gui::Tabbed *tabs = new Gui::Tabbed(); Add(tabs, 0, 0); Gui::Fixed *mainTab = new Gui::Fixed(800, 600); tabs->AddPage(new Gui::Label(Lang::SIGHTS_SOUNDS_SAVES), mainTab); mainTab->Add((new Gui::Label(Lang::PIONEER))->Shadow(true), 350, 10); SetTransparency(false); Gui::Label *l = new Gui::Label(Lang::PIONEER); l->Color(1,.7f,0); m_rightRegion2->Add(l, 10, 0); { Gui::Box *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); mainTab->Add(hbox, 20, 30); m_saveButton = new Gui::LabelButton(new Gui::Label(Lang::SAVE_THE_GAME)); m_saveButton->SetShortcut(SDLK_s, KMOD_NONE); m_saveButton->onClick.connect(sigc::mem_fun(this, &GameMenuView::OpenSaveDialog)); hbox->PackEnd(m_saveButton); m_loadButton = new Gui::LabelButton(new Gui::Label(Lang::LOAD_A_GAME)); m_loadButton->onClick.connect(sigc::mem_fun(this, &GameMenuView::OpenLoadDialog)); m_loadButton->SetShortcut(SDLK_l, KMOD_NONE); hbox->PackEnd(m_loadButton); m_exitButton = new Gui::LabelButton(new Gui::Label(Lang::EXIT_THIS_GAME)); m_exitButton->onClick.connect(sigc::mem_fun(this, &GameMenuView::HideAll)); m_exitButton->onClick.connect(sigc::ptr_fun(&Pi::EndGame)); hbox->PackEnd(m_exitButton); m_menuButton = new Gui::LabelButton(new Gui::Label(Lang::RETURN_TO_MENU)); m_menuButton->onClick.connect(sigc::bind(sigc::ptr_fun(&Pi::SetView), static_cast<View*>(0))); mainTab->Add(m_menuButton, 20, 30); } Gui::Box *vbox = new Gui::VBox(); vbox->SetSizeRequest(300, 440); vbox->SetSpacing(5.0); mainTab->Add(vbox, 20, 60); { vbox->PackEnd((new Gui::Label(Lang::WINDOW_OR_FULLSCREEN))->Color(1.0f,1.0f,0.0f)); m_toggleFullscreen = new Gui::ToggleButton(); m_toggleFullscreen->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleFullscreen)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(m_toggleFullscreen); hbox->PackEnd(new Gui::Label(Lang::FULL_SCREEN)); vbox->PackEnd(hbox); vbox->PackEnd((new Gui::Label(Lang::OTHER_GRAPHICS_SETTINGS))->Color(1.0f,1.0f,0.0f)); m_toggleShaders = new Gui::ToggleButton(); m_toggleShaders->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleShaders)); hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(m_toggleShaders); hbox->PackEnd(new Gui::Label(Lang::USE_SHADERS)); m_toggleCompressTextures = new Gui::ToggleButton(); m_toggleCompressTextures->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleCompressTextures)); hbox->PackEnd(m_toggleCompressTextures); hbox->PackEnd(new Gui::Label(Lang::COMPRESS_TEXTURES)); vbox->PackEnd(hbox); vbox->PackEnd((new Gui::Label(Lang::SOUND_SETTINGS))->Color(1.0f,1.0f,0.0f)); m_masterVolume = new VolumeControl(Lang::VOL_MASTER, Pi::config->Float("MasterVolume"), Pi::config->Int("MasterMuted")); vbox->PackEnd(m_masterVolume); m_sfxVolume = new VolumeControl(Lang::VOL_EFFECTS, Pi::config->Float("SfxVolume"), Pi::config->Int("SfxMuted")); vbox->PackEnd(m_sfxVolume); m_musicVolume = new VolumeControl(Lang::VOL_MUSIC, Pi::config->Float("MusicVolume"), Pi::config->Int("MusicMuted")); vbox->PackEnd(m_musicVolume); m_masterVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume)); m_sfxVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume)); m_musicVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume)); } // Video mode selector { m_videoModes = Graphics::GetAvailableVideoModes(); vbox->PackEnd((new Gui::Label(Lang::VIDEO_RESOLUTION))->Color(1.0f,1.0f,0.0f)); m_screenModesGroup = new Gui::RadioGroup(); // box to put the scroll portal and its scroll bar into Gui::HBox *scrollHBox = new Gui::HBox(); vbox->PackEnd(scrollHBox); Gui::VScrollBar *scroll = new Gui::VScrollBar(); Gui::VScrollPortal *portal = new Gui::VScrollPortal(280); scroll->SetAdjustment(&portal->vscrollAdjust); scrollHBox->PackEnd(portal); scrollHBox->PackEnd(scroll); Gui::VBox *vbox2 = new Gui::VBox(); portal->Add(vbox2); for (std::vector<Graphics::VideoMode>::const_iterator it = m_videoModes.begin(); it != m_videoModes.end(); ++it) { Gui::RadioButton *temp = new Gui::RadioButton(m_screenModesGroup); temp->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeVideoResolution), it - m_videoModes.begin())); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(temp); hbox->PackEnd(new Gui::Label(stringf(Lang::X_BY_X, formatarg("x", int(it->width)), formatarg("y", int(it->height))))); vbox2->PackEnd(hbox); //mark the current video mode if ((Pi::GetScrWidth() == it->width) && (Pi::GetScrHeight() == it->height)) { temp->SetSelected(true); } } } //Graphical detail settings { Gui::HBox *detailBox = new Gui::HBox(); detailBox->SetSpacing(20.0f); mainTab->Add(detailBox, 350, 60); vbox = new Gui::VBox(); vbox->SetSpacing(5.0f); detailBox->PackEnd(vbox); vbox->PackEnd((new Gui::Label(Lang::CITY_DETAIL_LEVEL))->Color(1.0f,1.0f,0.0f)); m_cityDetailGroup = new Gui::RadioGroup(); for (int i=0; i<5; i++) { Gui::RadioButton *rb = new Gui::RadioButton(m_cityDetailGroup); rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeCityDetail), i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(rb); hbox->PackEnd(new Gui::Label(planet_detail_desc[i])); vbox->PackEnd(hbox); } vbox = new Gui::VBox(); vbox->SetSpacing(5.0f); detailBox->PackEnd(vbox); vbox->PackEnd((new Gui::Label(Lang::PLANET_DETAIL_DISTANCE))->Color(1.0f,1.0f,0.0f)); m_planetDetailGroup = new Gui::RadioGroup(); for (int i=0; i<5; i++) { Gui::RadioButton *rb = new Gui::RadioButton(m_planetDetailGroup); rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangePlanetDetail), i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(rb); hbox->PackEnd(new Gui::Label(planet_detail_desc[i])); vbox->PackEnd(hbox); } vbox = new Gui::VBox(); vbox->SetSpacing(5.0f); detailBox->PackEnd(vbox); vbox->PackEnd((new Gui::Label(Lang::PLANET_TEXTURES))->Color(1.0f,1.0f,0.0f)); m_planetTextureGroup = new Gui::RadioGroup(); for (int i=0; i<2; i++) { Gui::RadioButton *rb = new Gui::RadioButton(m_planetTextureGroup); rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangePlanetTextures), i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(rb); hbox->PackEnd(new Gui::Label(planet_textures_desc[i])); vbox->PackEnd(hbox); } vbox = new Gui::VBox(); vbox->SetSpacing(5.0f); detailBox->PackEnd(vbox); vbox->PackEnd((new Gui::Label(Lang::FRACTAL_DETAIL))->Color(1.0f,1.0f,0.0f)); m_planetFractalGroup = new Gui::RadioGroup(); for (int i=0; i<5; i++) { Gui::RadioButton *rb = new Gui::RadioButton(m_planetFractalGroup); rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeFractalMultiple), i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(rb); hbox->PackEnd(new Gui::Label(planet_fractal_desc[i])); vbox->PackEnd(hbox); } } // language vbox = new Gui::VBox(); vbox->SetSizeRequest(300, 200); mainTab->Add(vbox, 400, 250); vbox->PackEnd((new Gui::Label(Lang::LANGUAGE_SELECTION))->Color(1.0f,1.0f,0.0f)); m_languageGroup = new Gui::RadioGroup(); const std::vector<std::string> &availableLanguages = Lang::GetAvailableLanguages(); { // box to put the scroll portal and its scroll bar into Gui::HBox *scrollHBox = new Gui::HBox(); vbox->PackEnd(scrollHBox); Gui::VScrollBar *scroll = new Gui::VScrollBar(); Gui::VScrollPortal *portal = new Gui::VScrollPortal(280); scroll->SetAdjustment(&portal->vscrollAdjust); scrollHBox->PackEnd(portal); scrollHBox->PackEnd(scroll); Gui::VBox *vbox2 = new Gui::VBox(); portal->Add(vbox2); for (std::vector<std::string>::const_iterator i = availableLanguages.begin(); i != availableLanguages.end(); ++i) { Gui::RadioButton *temp = new Gui::RadioButton(m_languageGroup); temp->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeLanguage), *i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(temp); hbox->PackEnd(new Gui::Label(*i)); vbox2->PackEnd(hbox); if ((*i) == Pi::config->String("Lang")) temp->SetSelected(true); } } // key binding tab 1 { Gui::Fixed *keybindingTab = new Gui::Fixed(800, 600); tabs->AddPage(new Gui::Label(Lang::CONTROLS), keybindingTab); Gui::VBox *box1 = new Gui::VBox(); box1->SetSpacing(5.0f); keybindingTab->Add(box1, 10, 10); Gui::VBox *box2 = new Gui::VBox(); box2->SetSpacing(5.0f); keybindingTab->Add(box2, 400, 10); Gui::VBox *box = box1; KeyGetter *keyg; for (int i=0; KeyBindings::bindingProtos[i].label; i++) { const char *label = KeyBindings::bindingProtos[i].label; const char *function = KeyBindings::bindingProtos[i].function; if (function) { KeyBindings::KeyBinding kb = KeyBindings::KeyBindingFromString(Pi::config->String(function)); keyg = new KeyGetter(label, kb); keyg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeKeyBinding), function)); box->PackEnd(keyg); } else { // section box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f)); } /* 2nd column */ if (i == 20) { box = box2; } } for (int i=0; KeyBindings::axisBindingProtos[i].label; i++) { AxisGetter *axisg; const char *label = KeyBindings::axisBindingProtos[i].label; const char *function = KeyBindings::axisBindingProtos[i].function; if (function) { KeyBindings::AxisBinding ab = KeyBindings::AxisBindingFromString(Pi::config->String(function).c_str()); axisg = new AxisGetter(label, ab); axisg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeAxisBinding), function)); box->PackEnd(axisg); } else { // section box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f)); } /* 2nd column */ if (i == 20) { box = box2; } } m_toggleJoystick = new Gui::ToggleButton(); m_toggleJoystick->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleJoystick)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(m_toggleJoystick); hbox->PackEnd(new Gui::Label(Lang::ENABLE_JOYSTICK)); box->PackEnd(hbox); // Invert Mouse m_toggleMouseYInvert = new Gui::ToggleButton(); m_toggleMouseYInvert->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleMouseYInvert)); box->PackEnd((new Gui::Label(Lang::MOUSE_INPUT))->Color(1.0f,1.0f,0.0f)); Gui::HBox *mybox = new Gui::HBox(); mybox->SetSpacing(5.0f); mybox->PackEnd(m_toggleMouseYInvert); mybox->PackEnd(new Gui::Label(Lang::INVERT_MOUSE_Y)); box->PackEnd(mybox); // Toggle nav tunnel m_toggleNavTunnel = new Gui::ToggleButton(); m_toggleNavTunnel->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleNavTunnel)); box->PackEnd((new Gui::Label(Lang::HUD))->Color(1.0f,1.0f,0.0f)); Gui::HBox *guibox = new Gui::HBox(); guibox->SetSpacing(5.0f); guibox->PackEnd(m_toggleNavTunnel); guibox->PackEnd(new Gui::Label(Lang::DISPLAY_NAV_TUNNEL)); box->PackEnd(guibox); } // key binding tab 2 { Gui::Fixed *keybindingTab = new Gui::Fixed(800, 600); tabs->AddPage(new Gui::Label(Lang::VIEW), keybindingTab); Gui::VBox *box1 = new Gui::VBox(); box1->SetSpacing(5.0f); keybindingTab->Add(box1, 10, 10); Gui::VBox *box = box1; KeyGetter *keyg; for (int i=0; KeyBindings::camBindingProtos[i].label; i++) { const char *label = KeyBindings::camBindingProtos[i].label; const char *function = KeyBindings::camBindingProtos[i].function; if (function) { KeyBindings::KeyBinding kb = KeyBindings::KeyBindingFromString(Pi::config->String(function)); keyg = new KeyGetter(label, kb); keyg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeKeyBinding), function)); box->PackEnd(keyg); } else { // section box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f)); } } } }
LRESULT CResizableGrip::CSizeGrip::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_GETDLGCODE: // fix to prevent the control to gain focus, using arrow keys // (standard grip returns DLGC_WANTARROWS, like any standard scrollbar) return DLGC_STATIC; case WM_SETFOCUS: // fix to prevent the control to gain focus, if set directly // (for example when it's the only one control in a dialog) return 0; case WM_NCHITTEST: // choose proper cursor shape if (IsRTL()) return HTBOTTOMLEFT; else return HTBOTTOMRIGHT; break; case WM_SETTINGCHANGE: { // update grip's size CSize sizeOld = m_size; m_size.cx = GetSystemMetrics(SM_CXVSCROLL); m_size.cy = GetSystemMetrics(SM_CYHSCROLL); // resize transparency bitmaps if (m_bTransparent) { CClientDC dc(this); // destroy bitmaps m_bmGrip.DeleteObject(); m_bmMask.DeleteObject(); // re-create bitmaps m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy); m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL); } // re-calc shape if (m_bTriangular) SetTriangularShape(m_bTriangular); // reposition the grip CRect rect; GetWindowRect(rect); rect.InflateRect(m_size.cx - sizeOld.cx, m_size.cy - sizeOld.cy, 0, 0); ::MapWindowPoints(NULL, GetParent()->GetSafeHwnd(), (LPPOINT)&rect, 2); MoveWindow(rect, TRUE); } break; case WM_DESTROY: // perform clean up if (m_bTransparent) SetTransparency(FALSE); break; case WM_PAINT: case WM_PRINTCLIENT: if (m_bTransparent) { PAINTSTRUCT ps; CDC* pDC = (message == WM_PAINT && wParam == 0) ? BeginPaint(&ps) : CDC::FromHandle((HDC)wParam); // select bitmaps CBitmap *pOldGrip, *pOldMask; pOldGrip = m_dcGrip.SelectObject(&m_bmGrip); pOldMask = m_dcMask.SelectObject(&m_bmMask); // obtain original grip bitmap, make the mask and prepare masked bitmap CScrollBar::WindowProc(message, (WPARAM)m_dcGrip.GetSafeHdc(), lParam); m_dcGrip.SetBkColor(m_dcGrip.GetPixel(0, 0)); m_dcMask.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCCOPY); m_dcGrip.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, 0x00220326); // draw transparently pDC->BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, SRCAND); pDC->BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCPAINT); // unselect bitmaps m_dcGrip.SelectObject(pOldGrip); m_dcMask.SelectObject(pOldMask); if (message == WM_PAINT && wParam == 0) EndPaint(&ps); return 0; } break; } return CScrollBar::WindowProc(message, wParam, lParam); }
SystemView::SystemView() { SetTransparency(true); Gui::Screen::PushFont("OverlayFont"); m_objectLabels = new Gui::LabelSet(); Add(m_objectLabels, 0, 0); Gui::Screen::PopFont(); m_timePoint = (new Gui::Label(""))->Color(0.7f, 0.7f, 0.7f); Add(m_timePoint, 2, Gui::Screen::GetHeight()-Gui::Screen::GetFontHeight()-66); m_infoLabel = (new Gui::Label(""))->Color(0.7f, 0.7f, 0.7f); Add(m_infoLabel, 2, 0); m_infoText = (new Gui::Label(""))->Color(0.7f, 0.7f, 0.7f); Add(m_infoText, 200, 0); m_zoomInButton = new Gui::ImageButton(PIONEER_DATA_DIR "/icons/zoom_in.png"); m_zoomInButton->SetToolTip(Lang::ZOOM_IN); Add(m_zoomInButton, 700, 5); m_zoomOutButton = new Gui::ImageButton(PIONEER_DATA_DIR "/icons/zoom_out.png"); m_zoomOutButton->SetToolTip(Lang::ZOOM_OUT); Add(m_zoomOutButton, 732, 5); Gui::ImageButton *b = new Gui::ImageButton(PIONEER_DATA_DIR "/icons/sysview_accel_r3.png", PIONEER_DATA_DIR "/icons/sysview_accel_r3_on.png"); b->onPress.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), -10000000.0)); b->onRelease.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 0.0)); m_rightRegion2->Add(b, 0, 0); b = new Gui::ImageButton(PIONEER_DATA_DIR "/icons/sysview_accel_r2.png", PIONEER_DATA_DIR "/icons/sysview_accel_r2_on.png"); b->onPress.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), -1000000.0)); b->onRelease.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 0.0)); m_rightRegion2->Add(b, 26, 0); b = new Gui::ImageButton(PIONEER_DATA_DIR "/icons/sysview_accel_r1.png", PIONEER_DATA_DIR "/icons/sysview_accel_r1_on.png"); b->onPress.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), -100000.0)); b->onRelease.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 0.0)); m_rightRegion2->Add(b, 45, 0); b = new Gui::ImageButton(PIONEER_DATA_DIR "/icons/sysview_accel_f1.png", PIONEER_DATA_DIR "/icons/sysview_accel_f1_on.png"); b->onPress.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 100000.0)); b->onRelease.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 0.0)); m_rightRegion2->Add(b, 64, 0); b = new Gui::ImageButton(PIONEER_DATA_DIR "/icons/sysview_accel_f2.png", PIONEER_DATA_DIR "/icons/sysview_accel_f2_on.png"); b->onPress.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 1000000.0)); b->onRelease.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 0.0)); m_rightRegion2->Add(b, 83, 0); b = new Gui::ImageButton(PIONEER_DATA_DIR "/icons/sysview_accel_f3.png", PIONEER_DATA_DIR "/icons/sysview_accel_f3_on.png"); b->onPress.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 10000000.0)); b->onRelease.connect(sigc::bind(sigc::mem_fun(this, &SystemView::OnClickAccel), 0.0)); m_rightRegion2->Add(b, 102, 0); m_onMouseButtonDown = Pi::onMouseButtonDown.connect(sigc::mem_fun(this, &SystemView::MouseButtonDown)); ResetViewpoint(); }
HRESULT MAPIAppointment::SetMAPIAppointmentValues() { SizedSPropTagArray(C_NUMALLAPPTPROPS, appointmentProps) = { C_NUMALLAPPTPROPS, { PR_MESSAGE_FLAGS, PR_SUBJECT, PR_BODY, PR_HTML, pr_clean_global_objid, pr_appt_start, pr_appt_end, pr_location, pr_busystatus, pr_allday, pr_isrecurring, pr_recurstream, pr_timezoneid, pr_responsestatus, PR_RESPONSE_REQUESTED,pr_exceptionreplacetime, pr_reminderminutes, pr_private, pr_reminderset } }; HRESULT hr = S_OK; ULONG cVals = 0; bool bAllday = false; m_bHasAttachments = false; m_bIsRecurring = false; // get the zimbra appt wrapper around the mapi message Zimbra::Mapi::Appt appt(m_pMessage, m_mapiStore->GetInternalMAPIStore()); // save off the default timezone info for this appointment try { hr = appt.GetTimezone(_olkTz, &_pTzString); } catch(...) { hr=E_FAIL; } if (SUCCEEDED(hr)) { // get the timezone info for this appt pInvTz= new Zimbra::Mail::TimeZone(_pTzString); pInvTz->Initialize(_olkTz, _pTzString); } if (FAILED(hr = m_pMessage->GetProps((LPSPropTagArray) & appointmentProps, fMapiUnicode, &cVals, &m_pPropVals))) throw MAPIAppointmentException(hr, L"SetMAPIAppointmentValues(): GetProps Failed.", ERR_MAPI_APPOINTMENT, __LINE__, __FILE__); if (m_pPropVals[C_MESSAGE_FLAGS].ulPropTag == appointmentProps.aulPropTag[C_MESSAGE_FLAGS]) { m_bHasAttachments = (m_pPropVals[C_MESSAGE_FLAGS].Value.l & MSGFLAG_HASATTACH) != 0; } if (m_pPropVals[C_ISRECUR].ulPropTag == appointmentProps.aulPropTag[C_ISRECUR]) // do this first to set dates correctly { m_bIsRecurring = (m_pPropVals[C_ISRECUR].Value.b == 1); } if (m_pPropVals[C_ALLDAY].ulPropTag == appointmentProps.aulPropTag[C_ALLDAY]) { SetAllday(m_pPropVals[C_ALLDAY].Value.b); bAllday = (m_pPropVals[C_ALLDAY].Value.b == 1); } if (m_pPropVals[C_SUBJECT].ulPropTag == appointmentProps.aulPropTag[C_SUBJECT]) { SetSubject(m_pPropVals[C_SUBJECT].Value.lpszW); } if (m_pPropVals[C_UID].ulPropTag == appointmentProps.aulPropTag[C_UID]) { SetInstanceUID(&m_pPropVals[C_UID].Value.bin); } if (m_pPropVals[C_START].ulPropTag == appointmentProps.aulPropTag[C_START]) { SetStartDate(m_pPropVals[C_START].Value.ft); } if (m_pPropVals[C_END].ulPropTag == appointmentProps.aulPropTag[C_END]) { SetEndDate(m_pPropVals[C_END].Value.ft, bAllday); } if (m_pPropVals[C_LOCATION].ulPropTag == appointmentProps.aulPropTag[C_LOCATION]) { SetLocation(m_pPropVals[C_LOCATION].Value.lpszW); } if (m_pPropVals[C_BUSYSTATUS].ulPropTag == appointmentProps.aulPropTag[C_BUSYSTATUS]) { SetBusyStatus(m_pPropVals[C_BUSYSTATUS].Value.l); } if (m_pPropVals[C_RESPONSESTATUS].ulPropTag == appointmentProps.aulPropTag[C_RESPONSESTATUS]) { SetResponseStatus(m_pPropVals[C_RESPONSESTATUS].Value.l); } if (m_pPropVals[C_RESPONSEREQUESTED].ulPropTag == appointmentProps.aulPropTag[C_RESPONSEREQUESTED]) { SetResponseRequested(m_pPropVals[C_RESPONSEREQUESTED].Value.b); } unsigned short usReminderSet=1; if (m_pPropVals[C_REMINDERSET].ulPropTag == appointmentProps.aulPropTag[C_REMINDERSET]) { usReminderSet= m_pPropVals[C_REMINDERSET].Value.b; } if(usReminderSet) { if (m_pPropVals[C_REMINDERMINUTES].ulPropTag == appointmentProps.aulPropTag[C_REMINDERMINUTES]) { SetReminderMinutes(m_pPropVals[C_REMINDERMINUTES].Value.l); } } if (m_pPropVals[C_PRIVATE].ulPropTag == appointmentProps.aulPropTag[C_PRIVATE]) { SetPrivate(m_pPropVals[C_PRIVATE].Value.b); } SetTransparency(L"O"); SetPlainTextFileAndContent(); SetHtmlFileAndContent(); if (m_bHasAttachments) { if (FAILED(ExtractAttachments())) { dlogw(L"Could not extract attachments"); } } hr = SetOrganizerAndAttendees(); if(FAILED(hr)) { dlogw(L"SetOrganizerAndAttendees failed"); } if ((m_bIsRecurring) && (m_iExceptionType != CANCEL_EXCEPTION)) { if (m_pPropVals[C_RECURSTREAM].ulPropTag == appointmentProps.aulPropTag[C_RECURSTREAM]) { // special case for timezone id if (m_pPropVals[C_TIMEZONEID].ulPropTag == appointmentProps.aulPropTag[C_TIMEZONEID]) { SetTimezoneId(m_pPropVals[C_TIMEZONEID].Value.lpszW); } // int numExceptions = SetRecurValues(); // returns null if no exceptions if (numExceptions > 0) { SetExceptions(); } } } return hr; }
ObjectViewerView::ObjectViewerView(): View() { SetTransparency(true); viewingDist = 1000.0f; m_camRot = matrix4x4d::Identity(); m_infoLabel = new Gui::Label(""); Add(m_infoLabel, 2, Gui::Screen::GetHeight()-66-Gui::Screen::GetFontHeight()); m_vbox = new Gui::VBox(); Add(m_vbox, 580, 2); m_vbox->PackEnd(new Gui::Label("Mass (earths):")); m_sbodyMass = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyMass); m_vbox->PackEnd(new Gui::Label("Radius (earths):")); m_sbodyRadius = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyRadius); m_vbox->PackEnd(new Gui::Label("Integer seed:")); m_sbodySeed = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodySeed); m_vbox->PackEnd(new Gui::Label("Volatile gases (>= 0):")); m_sbodyVolatileGas = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyVolatileGas); m_vbox->PackEnd(new Gui::Label("Volatile liquid (0-1):")); m_sbodyVolatileLiquid = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyVolatileLiquid); m_vbox->PackEnd(new Gui::Label("Volatile ices (0-1):")); m_sbodyVolatileIces = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyVolatileIces); m_vbox->PackEnd(new Gui::Label("Life (0-1):")); m_sbodyLife = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyLife); m_vbox->PackEnd(new Gui::Label("Volcanicity (0-1):")); m_sbodyVolcanicity = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyVolcanicity); m_vbox->PackEnd(new Gui::Label("Crust metallicity (0-1):")); m_sbodyMetallicity = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyMetallicity); Gui::LabelButton *b = new Gui::LabelButton(new Gui::Label("Change planet terrain type")); b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnChangeTerrain)); m_vbox->PackEnd(b); Gui::HBox *hbox = new Gui::HBox(); b = new Gui::LabelButton(new Gui::Label("Prev Seed")); b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnPrevSeed)); hbox->PackEnd(b); b = new Gui::LabelButton(new Gui::Label("Random Seed")); b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnRandomSeed)); hbox->PackEnd(b); b = new Gui::LabelButton(new Gui::Label("Next Seed")); b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnNextSeed)); hbox->PackEnd(b); m_vbox->PackEnd(hbox); }
GameMenuView::GameMenuView(): View() { m_subview = 0; Gui::Tabbed *tabs = new Gui::Tabbed(); Add(tabs, 0, 0); Gui::Fixed *mainTab = new Gui::Fixed(800, 600); tabs->AddPage(new Gui::Label(Lang::SIGHTS_SOUNDS_SAVES), mainTab); mainTab->Add((new Gui::Label(Lang::PIONEER))->Shadow(true), 350, 10); SetTransparency(false); Gui::Label *l = new Gui::Label(Lang::PIONEER); l->Color(1,.7,0); m_rightRegion2->Add(l, 10, 0); { Gui::LabelButton *b; Gui::Box *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); mainTab->Add(hbox, 20, 30); b = new Gui::LabelButton(new Gui::Label(Lang::SAVE_THE_GAME)); b->SetShortcut(SDLK_s, KMOD_NONE); b->onClick.connect(sigc::mem_fun(this, &GameMenuView::OpenSaveDialog)); hbox->PackEnd(b); b = new Gui::LabelButton(new Gui::Label(Lang::LOAD_A_GAME)); b->onClick.connect(sigc::mem_fun(this, &GameMenuView::OpenLoadDialog)); b->SetShortcut(SDLK_l, KMOD_NONE); hbox->PackEnd(b); b = new Gui::LabelButton(new Gui::Label(Lang::EXIT_THIS_GAME)); b->onClick.connect(sigc::mem_fun(this, &GameMenuView::HideAll)); b->onClick.connect(sigc::ptr_fun(&Pi::EndGame)); hbox->PackEnd(b); } Gui::Box *vbox = new Gui::VBox(); vbox->SetSizeRequest(300, 440); vbox->SetSpacing(5.0); mainTab->Add(vbox, 20, 60); { vbox->PackEnd((new Gui::Label(Lang::WINDOW_OR_FULLSCREEN))->Color(1.0f,1.0f,0.0f)); m_toggleFullscreen = new Gui::ToggleButton(); m_toggleFullscreen->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleFullscreen)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(m_toggleFullscreen); hbox->PackEnd(new Gui::Label(Lang::FULL_SCREEN)); vbox->PackEnd(hbox); vbox->PackEnd((new Gui::Label(Lang::OTHER_GRAPHICS_SETTINGS))->Color(1.0f,1.0f,0.0f)); m_toggleShaders = new Gui::ToggleButton(); m_toggleShaders->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleShaders)); hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(m_toggleShaders); hbox->PackEnd(new Gui::Label(Lang::USE_SHADERS)); vbox->PackEnd(hbox); m_toggleHDR = new Gui::ToggleButton(); m_toggleHDR->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleHDR)); hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(m_toggleHDR); hbox->PackEnd(new Gui::Label(Lang::USE_HDR)); vbox->PackEnd(hbox); if (!Render::IsHDRAvailable()) m_toggleHDR->SetEnabled(false); vbox->PackEnd((new Gui::Label(Lang::SOUND_SETTINGS))->Color(1.0f,1.0f,0.0f)); m_masterVolume = new VolumeControl(Lang::VOL_MASTER, Pi::config.Float("MasterVolume"), Pi::config.Int("MasterMuted")); vbox->PackEnd(m_masterVolume); m_sfxVolume = new VolumeControl(Lang::VOL_EFFECTS, Pi::config.Float("SfxVolume"), Pi::config.Int("SfxMuted")); vbox->PackEnd(m_sfxVolume); m_musicVolume = new VolumeControl(Lang::VOL_MUSIC, Pi::config.Float("MusicVolume"), Pi::config.Int("MusicMuted")); vbox->PackEnd(m_musicVolume); m_masterVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume)); m_sfxVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume)); m_musicVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume)); } vbox->PackEnd((new Gui::Label(Lang::VIDEO_RESOLUTION))->Color(1.0f,1.0f,0.0f)); Gui::RadioGroup *g = new Gui::RadioGroup(); SDL_Rect **modes; modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); if ((modes!=0) && (modes != reinterpret_cast<SDL_Rect**>(-1))) { // box to put the scroll portal and its scroll bar into Gui::HBox *scrollHBox = new Gui::HBox(); vbox->PackEnd(scrollHBox); Gui::VScrollBar *scroll = new Gui::VScrollBar(); Gui::VScrollPortal *portal = new Gui::VScrollPortal(280); scroll->SetAdjustment(&portal->vscrollAdjust); scrollHBox->PackEnd(portal); scrollHBox->PackEnd(scroll); Gui::VBox *vbox2 = new Gui::VBox(); portal->Add(vbox2); for (int i=0; modes[i]; ++i) { Gui::RadioButton *temp = new Gui::RadioButton(g); temp->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeVideoResolution), i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(temp); hbox->PackEnd(new Gui::Label(stringf(256, Lang::X_BY_X, modes[i]->w, modes[i]->h))); vbox2->PackEnd(hbox); if ((Pi::GetScrWidth() == modes[i]->w) && (Pi::GetScrHeight() == modes[i]->h)) { temp->SetSelected(true); } } } Gui::HBox *detailBox = new Gui::HBox(); detailBox->SetSpacing(60.0f); mainTab->Add(detailBox, 400, 60); vbox = new Gui::VBox(); vbox->SetSpacing(5.0f); detailBox->PackEnd(vbox); vbox->PackEnd((new Gui::Label(Lang::PLANET_DETAIL_LEVEL))->Color(1.0f,1.0f,0.0f)); m_planetDetailGroup = new Gui::RadioGroup(); for (int i=0; i<5; i++) { Gui::RadioButton *rb = new Gui::RadioButton(m_planetDetailGroup); rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangePlanetDetail), i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(rb); hbox->PackEnd(new Gui::Label(planet_detail_desc[i])); vbox->PackEnd(hbox); } vbox = new Gui::VBox(); vbox->SetSpacing(5.0f); detailBox->PackEnd(vbox); vbox->PackEnd((new Gui::Label(Lang::CITY_DETAIL_LEVEL))->Color(1.0f,1.0f,0.0f)); m_cityDetailGroup = new Gui::RadioGroup(); for (int i=0; i<5; i++) { Gui::RadioButton *rb = new Gui::RadioButton(m_cityDetailGroup); rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeCityDetail), i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(rb); hbox->PackEnd(new Gui::Label(planet_detail_desc[i])); vbox->PackEnd(hbox); } // language vbox = new Gui::VBox(); vbox->SetSizeRequest(300, 200); mainTab->Add(vbox, 400, 250); vbox->PackEnd((new Gui::Label(Lang::LANGUAGE_SELECTION))->Color(1.0f,1.0f,0.0f)); g = new Gui::RadioGroup(); const std::list<std::string> availableLanguages = Lang::GetAvailableLanguages(); { // box to put the scroll portal and its scroll bar into Gui::HBox *scrollHBox = new Gui::HBox(); vbox->PackEnd(scrollHBox); Gui::VScrollBar *scroll = new Gui::VScrollBar(); Gui::VScrollPortal *portal = new Gui::VScrollPortal(280); scroll->SetAdjustment(&portal->vscrollAdjust); scrollHBox->PackEnd(portal); scrollHBox->PackEnd(scroll); Gui::VBox *vbox2 = new Gui::VBox(); portal->Add(vbox2); for (std::list<std::string>::const_iterator i = availableLanguages.begin(); i != availableLanguages.end(); i++) { Gui::RadioButton *temp = new Gui::RadioButton(g); temp->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeLanguage), *i)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(temp); hbox->PackEnd(new Gui::Label(*i)); vbox2->PackEnd(hbox); if ((*i) == Pi::config.String("Lang")) temp->SetSelected(true); } } // key binding tab { Gui::Fixed *keybindingTab = new Gui::Fixed(800, 600); tabs->AddPage(new Gui::Label(Lang::CONTROLS), keybindingTab); Gui::VBox *box1 = new Gui::VBox(); box1->SetSpacing(5.0f); keybindingTab->Add(box1, 10, 10); Gui::VBox *box2 = new Gui::VBox(); box2->SetSpacing(5.0f); keybindingTab->Add(box2, 400, 10); Gui::VBox *box = box1; KeyGetter *keyg; for (int i=0; KeyBindings::bindingProtos[i].label; i++) { const char *label = KeyBindings::bindingProtos[i].label; const char *function = KeyBindings::bindingProtos[i].function; if (function) { KeyBindings::KeyBinding kb = KeyBindings::KeyBindingFromString(Pi::config.String(function)); keyg = new KeyGetter(label, kb); keyg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeKeyBinding), function)); box->PackEnd(keyg); } else { // section box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f)); } /* 2nd column */ if (i == 20) { box = box2; } } for (int i=0; KeyBindings::axisBindingProtos[i].label; i++) { AxisGetter *axisg; const char *label = KeyBindings::axisBindingProtos[i].label; const char *function = KeyBindings::axisBindingProtos[i].function; if (function) { KeyBindings::AxisBinding ab = KeyBindings::AxisBindingFromString(Pi::config.String(function).c_str()); axisg = new AxisGetter(label, ab); axisg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeAxisBinding), function)); box->PackEnd(axisg); } else { // section box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f)); } /* 2nd column */ if (i == 20) { box = box2; } } m_toggleJoystick = new Gui::ToggleButton(); m_toggleJoystick->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleJoystick)); Gui::HBox *hbox = new Gui::HBox(); hbox->SetSpacing(5.0f); hbox->PackEnd(m_toggleJoystick); hbox->PackEnd(new Gui::Label(Lang::ENABLE_JOYSTICK)); box->PackEnd(hbox); // Invert Mouse m_toggleMouseYInvert = new Gui::ToggleButton(); m_toggleMouseYInvert->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleMouseYInvert)); box->PackEnd((new Gui::Label(Lang::MOUSE_INPUT))->Color(1.0f,1.0f,0.0f)); Gui::HBox *mybox = new Gui::HBox(); mybox->SetSpacing(5.0f); mybox->PackEnd(m_toggleMouseYInvert); mybox->PackEnd(new Gui::Label(Lang::INVERT_MOUSE_Y)); box->PackEnd(mybox); } }
SystemInfoView::SystemInfoView() : UIView() { SetTransparency(true); m_refresh = REFRESH_NONE; }
SpaceStationView::SpaceStationView(): View() { Gui::Label *l = new Gui::Label(Lang::COMMS_LINK); l->Color(1,.7f,0); m_rightRegion2->Add(l, 10, 0); SetTransparency(false); m_title = new Gui::Label(""); Add(m_title, 10, 10); m_statusBox = new Gui::Fixed(300, 300); Add(m_statusBox, 10, 350); const float YSEP = Gui::Screen::GetFontHeight() * 1.2f; m_statusBox->Add(new Gui::Label(std::string("#007")+std::string(Lang::CASH)), 0, 0); m_statusBox->Add(new Gui::Label(std::string("#007")+std::string(Lang::LEGAL_STATUS)), 0, 2*YSEP); m_statusBox->Add(new Gui::Label(std::string("#007")+std::string(Lang::USED)), 130, 4*YSEP); m_statusBox->Add(new Gui::Label(std::string("#007")+std::string(Lang::FREE)), 210, 4*YSEP); m_statusBox->Add(new Gui::Label(std::string("#007")+std::string(Lang::CARGO_SPACE)), 0, 5*YSEP); m_statusBox->Add(new Gui::Label(std::string("#007")+std::string(Lang::SHIP_EQUIPMENT)), 0, 6*YSEP); m_statusBox->Add(new Gui::Label(std::string("#007")+std::string(Lang::CABINS)), 0, 7*YSEP); m_money = new Gui::Label(""); m_statusBox->Add(m_money, 210, 0); m_cargoSpaceUsed = new Gui::Label(""); m_statusBox->Add(m_cargoSpaceUsed, 130, 5*YSEP); m_cargoSpaceFree = new Gui::Label(""); m_statusBox->Add(m_cargoSpaceFree, 210, 5*YSEP); m_equipmentMass = new Gui::Label(""); m_statusBox->Add(m_equipmentMass, 130, 6*YSEP); m_cabinsUsed = new Gui::Label(""); m_statusBox->Add(m_cabinsUsed, 130, 7*YSEP); m_cabinsFree = new Gui::Label(""); m_statusBox->Add(m_cabinsFree, 210, 7*YSEP); m_legalstatus = new Gui::Label(Lang::CLEAN); m_statusBox->Add(m_legalstatus, 210, 2*YSEP); m_formStack = new Gui::Stack(); m_formController = new FormController(m_formStack); m_formController->onRefresh.connect(sigc::mem_fun(this, &SpaceStationView::RefreshForForm)); m_backButtonBox = new Gui::HBox(); m_backButtonBox->SetSpacing(4.0f); Add(m_backButtonBox, 680, 470); Gui::SolidButton *b = new Gui::SolidButton(); b->onClick.connect(sigc::mem_fun(m_formController, &FormController::CloseForm)); m_backButtonBox->PackEnd(b); m_backButtonBox->PackEnd(new Gui::Label(Lang::GO_BACK)); m_videoLink = 0; m_undockConnection = Pi::player->onUndock.connect(sigc::mem_fun(m_formStack, &Gui::Stack::Clear)); }
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)); }
ObjectViewerView::ObjectViewerView(): UIView() { SetTransparency(true); viewingDist = 1000.0f; m_camRot = matrix4x4d::Identity(); float size[2]; GetSizeRequested(size); SetTransparency(true); float znear; float zfar; Pi::renderer->GetNearFarRange(znear, zfar); const float fovY = Pi::config->Float("FOVVertical"); m_cameraContext.Reset(new CameraContext(Graphics::GetScreenWidth(), Graphics::GetScreenHeight(), fovY, znear, zfar)); m_camera.reset(new Camera(m_cameraContext, Pi::renderer)); m_cameraContext->SetFrame(Pi::player->GetFrame()); m_cameraContext->SetPosition(Pi::player->GetInterpPosition() + vector3d(0, 0, viewingDist)); m_cameraContext->SetOrient(matrix3x3d::Identity()); m_infoLabel = new Gui::Label(""); Add(m_infoLabel, 2, Gui::Screen::GetHeight()-66-Gui::Screen::GetFontHeight()); m_vbox = new Gui::VBox(); Add(m_vbox, 580, 2); m_vbox->PackEnd(new Gui::Label("Mass (earths):")); m_sbodyMass = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyMass); m_vbox->PackEnd(new Gui::Label("Radius (earths):")); m_sbodyRadius = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyRadius); m_vbox->PackEnd(new Gui::Label("Integer seed:")); m_sbodySeed = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodySeed); m_vbox->PackEnd(new Gui::Label("Volatile gases (>= 0):")); m_sbodyVolatileGas = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyVolatileGas); m_vbox->PackEnd(new Gui::Label("Volatile liquid (0-1):")); m_sbodyVolatileLiquid = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyVolatileLiquid); m_vbox->PackEnd(new Gui::Label("Volatile ices (0-1):")); m_sbodyVolatileIces = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyVolatileIces); m_vbox->PackEnd(new Gui::Label("Life (0-1):")); m_sbodyLife = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyLife); m_vbox->PackEnd(new Gui::Label("Volcanicity (0-1):")); m_sbodyVolcanicity = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyVolcanicity); m_vbox->PackEnd(new Gui::Label("Crust metallicity (0-1):")); m_sbodyMetallicity = new Gui::TextEntry(); m_vbox->PackEnd(m_sbodyMetallicity); Gui::LabelButton *b = new Gui::LabelButton(new Gui::Label("Change planet terrain type")); b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnChangeTerrain)); m_vbox->PackEnd(b); Gui::HBox *hbox = new Gui::HBox(); b = new Gui::LabelButton(new Gui::Label("Prev Seed")); b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnPrevSeed)); hbox->PackEnd(b); b = new Gui::LabelButton(new Gui::Label("Random Seed")); b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnRandomSeed)); hbox->PackEnd(b); b = new Gui::LabelButton(new Gui::Label("Next Seed")); b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnNextSeed)); hbox->PackEnd(b); m_vbox->PackEnd(hbox); }
Viewer(): Gui::Fixed(float(g_width), float(g_height)) { m_model = 0; m_cmesh = 0; m_geom = 0; m_space = new CollisionSpace(); m_showBoundingRadius = false; Gui::Screen::AddBaseWidget(this, 0, 0); SetTransparency(true); m_trisReadout = new Gui::Label(""); Add(m_trisReadout, 500, 0); { Gui::Button *b = new Gui::SolidButton(); b->SetShortcut(SDLK_c, KMOD_NONE); b->onClick.connect(sigc::mem_fun(*this, &Viewer::OnClickChangeView)); Add(b, 10, 10); Add(new Gui::Label("[c] Change view (normal, collision mesh"), 30, 10); } { Gui::Button *b = new Gui::SolidButton(); b->SetShortcut(SDLK_r, KMOD_NONE); b->onClick.connect(sigc::mem_fun(*this, &Viewer::OnResetAdjustments)); Add(b, 10, 30); Add(new Gui::Label("[r] Reset thruster and anim sliders"), 30, 30); } { Gui::Button *b = new Gui::SolidButton(); b->SetShortcut(SDLK_m, KMOD_NONE); b->onClick.connect(sigc::mem_fun(*this, &Viewer::OnClickRebuildCollMesh)); Add(b, 10, 50); Add(new Gui::Label("[m] Rebuild collision mesh"), 30, 50); } { Gui::Button *b = new Gui::SolidButton(); b->SetShortcut(SDLK_p, KMOD_NONE); b->onClick.connect(sigc::mem_fun(*this, &Viewer::OnClickToggleBenchmark)); Add(b, 10, 70); Add(new Gui::Label("[p] Toggle performance test (renders models 1000 times per frame)"), 30, 70); } { Gui::Button *b = new Gui::SolidButton(); b->SetShortcut(SDLK_b, KMOD_LSHIFT); b->onClick.connect(sigc::mem_fun(*this, &Viewer::OnToggleBoundingRadius)); Add(b, 10, 90); Add(new Gui::Label("[shift-b] Visualize bounding radius"), 30, 90); } #if 0 { Gui::Button *b = new Gui::SolidButton(); b->SetShortcut(SDLK_g, KMOD_NONE); b->onClick.connect(sigc::mem_fun(*this, &Viewer::OnToggleGearState)); Add(b, 10, 30); Add(new Gui::Label("[g] Toggle gear state"), 30, 30); } #endif /* 0 */ { Add(new Gui::Label("Linear thrust"), 0, Gui::Screen::GetHeight()-140.0f); for (int i=0; i<3; i++) { m_linthrust[i] = new Gui::Adjustment(); m_linthrust[i]->SetValue(0.5); Gui::VScrollBar *v = new Gui::VScrollBar(); v->SetAdjustment(m_linthrust[i]); Add(v, float(i*25), Gui::Screen::GetHeight()-120.0f); } Add(new Gui::Label("Angular thrust"), 100, Gui::Screen::GetHeight()-140.0f); for (int i=0; i<3; i++) { m_angthrust[i] = new Gui::Adjustment(); m_angthrust[i]->SetValue(0.5); Gui::VScrollBar *v = new Gui::VScrollBar(); v->SetAdjustment(m_angthrust[i]); Add(v, float(100 + i*25), Gui::Screen::GetHeight()-120.0f); } Add(new Gui::Label("Animations (0 gear, 1-4 are time - ignore them comrade)"), 200, Gui::Screen::GetHeight()-140.0f); for (int i=0; i<LMR_ARG_MAX; i++) { Gui::Fixed *box = new Gui::Fixed(32.0f, 120.0f); Add(box, float(200 + i*25), Gui::Screen::GetHeight()-120.0f); m_anim[i] = new Gui::Adjustment(); m_anim[i]->SetValue(0); Gui::VScrollBar *v = new Gui::VScrollBar(); v->SetAdjustment(m_anim[i]); box->Add(v, 0, 42.0f); char buf[32]; snprintf(buf, sizeof(buf), "%d", i); box->Add(new Gui::Label(buf), 0, 0); m_animEntry[i] = new Gui::TextEntry(); box->Add(m_animEntry[i], 0, 16.0f); m_anim[i]->onValueChanged.connect(sigc::bind(sigc::mem_fun(this, &Viewer::OnAnimChange), m_anim[i], m_animEntry[i])); OnAnimChange(m_anim[i], m_animEntry[i]); } } ShowAll(); Show(); }
Layer::Layer(BRect frame, int32 id, ImageView* imageView, layer_type type, BBitmap* bitmap) : fLayerData(NULL) , fLayerPreview(NULL) , fLayerId(id) , fLayerPreviewSem(-1) , fLayerPreviewThreads(0) , fLayerVisible(true) , fLayerActive(false) , fLayerType(type) , fImage(NULL) , fImageView(imageView) , fLayerView(NULL) { frame.OffsetTo(B_ORIGIN); fLayerName << "Layer " << fLayerId; if (fLayerType == HS_NORMAL_LAYER) { BRect sourceRect; if (bitmap && bitmap->IsValid()) sourceRect = bitmap->Bounds(); fLayerData = new BBitmap(BRect(frame.LeftTop(), BPoint(max_c(frame.right, sourceRect.right), max_c(frame.bottom, sourceRect.bottom))), B_RGB_32_BIT); if (!fLayerData->IsValid()) throw std::bad_alloc(); union { char bytes[4]; uint32 word; } color; color.bytes[0] = 0xFF; color.bytes[1] = 0xFF; color.bytes[2] = 0xFF; color.bytes[3] = 0x00; int32 bits_length = fLayerData->BitsLength() / 4; uint32* target_bits = (uint32*)fLayerData->Bits(); // Fill the layer data with initial color. for (int32 i = 0; i < bits_length; ++i) *target_bits++ = color.word; if (bitmap && bitmap->IsValid()) { fLayerData->ImportBits(bitmap, BPoint(B_ORIGIN), BPoint(B_ORIGIN), int32(min_c(frame.Width(), sourceRect.Width())), int32(min_c(frame.Height(), sourceRect.Height()))); } // create the miniature image for this layer and a semaphore for it fLayerPreview = new BBitmap(BRect(0, 0, HS_MINIATURE_IMAGE_WIDTH - 1, HS_MINIATURE_IMAGE_HEIGHT - 1), B_RGB_32_BIT); fLayerPreviewSem = create_sem(1, "mini image semaphore"); } fLayerView = new LayerView(fLayerPreview, this); SetTransparency(1.0); }