//------------------ void SinglyLinkedList::Delete(int data) { Node* current = front_; if (current->value == data) { // remove head front_ = front_->next; delete current; cnt_--; ShowAll(); return; } while (current->next != NULL) { if (current->next->value == data) { Node* trash = current->next; current->next = current->next->next; if (rear_ == trash) { rear_ = current; // the last element } delete trash; cnt_--; ShowAll(); return; } current = current->next; } printf("Target not found\n"); }
void avltest<T>::MainMenu(AVLtree<T> & b, menu_choice menu_item) { T v; switch (menu_item) { case add: cout <<"\nEnter value of item to be added! : "; cin >> v; cout <<"\n"; insert(b,v); break; case del: cout <<"\nEnter key of item to be deleted! : "; cin >> v; cout <<"\n"; remove(b,v); break; case showoff: ShowAll(b); cout <<"\n\n"; break; case query: cout <<"\nEnter key to be searched for! : "; cin >> v; cout <<"\n"; if (IsFound(b,v)) cout <<"\nThe key "<< v <<" has been found! \n"; else cout <<"\nThe key "<< v <<" is not in the tree! \n"; break; case quit: cout <<"Test ended. Final traversal of the tree:\n"; break; default: cout <<"\nOperation not supported. Please select again! \n"; } }
ShipInfoPage(InfoView *v) : InfoViewPage(v) { info1 = new Gui::Label(""); info2 = new Gui::Label(""); Add(info1, 40, 40); Add(info2, 250, 40); ShowAll(); };
SourceWindow() { GtkPP::ScrolledWindow::Init(); auto sview = gtk_source_view_new(); Add(sview); ShowAll(); }
//------------------ void SinglyLinkedList::Insert(int data) { if (front_ == NULL) { front_ = new Node(); front_->value = data; front_->next = NULL; rear_ = front_; cnt_++; ShowAll(); return; } Node* newNode = new Node(); newNode->value = data; newNode->next = NULL; rear_->next = newNode; rear_ = rear_->next; cnt_++; ShowAll(); }
avltest<T>::avltest(AVLtree<T> & bst) { int flag = 0; do { clrscr; menu_choice entree=MenuDisplay(); MainMenu(bst,entree); flag = (entree == quit); } while (!flag); ShowAll(bst); }
void DrawWidget::LoadState() { m_framework->LoadBookmarks(); if (!m_framework->LoadState()) ShowAll(); else { UpdateNow(); UpdateScaleControl(); } }
StationShipMarketForm::StationShipMarketForm(FormController *controller) : FaceForm(controller) { m_station = Pi::player->GetDockedWith(); SetTitle(stringf(Lang::SOMEWHERE_SHIP_MARKET, formatarg("station", m_station->GetLabel()))); Gui::VScrollBar *scroll = new Gui::VScrollBar(); Gui::VScrollPortal *portal = new Gui::VScrollPortal(450); scroll->SetAdjustment(&portal->vscrollAdjust); float line_height = Gui::Screen::GetFontHeight(); m_shiplistBox = new Gui::VBox(); m_shiplistBox->SetSpacing(line_height*0.5f); UpdateShipList(); m_shiplistBox->ShowAll(); portal->Add(m_shiplistBox); portal->ShowAll(); Gui::VBox *outerbox = new Gui::VBox(); outerbox->SetSpacing(line_height); Gui::Fixed *heading = new Gui::Fixed(470, Gui::Screen::GetFontHeight()); const float *col = Gui::Theme::Colors::tableHeading; heading->Add((new Gui::Label(Lang::SHIP))->Color(col), 0, 0); heading->Add((new Gui::Label(Lang::PRICE))->Color(col), 200, 0); heading->Add((new Gui::Label(Lang::PART_EX))->Color(col), 275, 0); heading->Add((new Gui::Label(Lang::CAPACITY))->Color(col), 370, 0); heading->Add((new Gui::Label(Lang::VIEW))->Color(col), 430, 0); outerbox->PackEnd(heading); Gui::HBox *body = new Gui::HBox(); body->PackEnd(portal); body->PackEnd(scroll); outerbox->PackEnd(body); Add(outerbox, 0, 0); ShowAll(); m_onShipsForSaleChangedConnection = m_station->onShipsForSaleChanged.connect(sigc::mem_fun(this, &StationShipMarketForm::OnShipsForSaleChanged)); }
void View::Attach() { OnSwitchTo(); const float w = float(Gui::Screen::GetWidth()); const float h = float(Gui::Screen::GetHeight()); Gui::Screen::AddBaseWidget(this, 0, 0); if (Pi::cpan) { Gui::Screen::AddBaseWidget(Pi::cpan, 0, h-80); Gui::Screen::AddBaseWidget(m_rightButtonBar, w-128, h-26); Gui::Screen::AddBaseWidget(m_rightRegion2, w-127, h-45); Gui::Screen::AddBaseWidget(m_rightRegion1, w-123, h-62); m_rightButtonBar->ShowAll(); m_rightRegion2->ShowAll(); m_rightRegion1->ShowAll(); } ShowAll(); }
MultiFuncSelectorWidget::MultiFuncSelectorWidget(): Gui::Fixed(144, 17) { m_active = 0; m_rg = new Gui::RadioGroup(); m_buttons[0] = new Gui::ImageRadioButton(m_rg, PIONEER_DATA_DIR "/icons/multifunc_scanner.png", PIONEER_DATA_DIR "/icons/multifunc_scanner_on.png"); m_buttons[0]->onSelect.connect(sigc::bind(sigc::mem_fun(this, &MultiFuncSelectorWidget::OnClickButton), MFUNC_SCANNER)); m_buttons[0]->SetShortcut(SDLK_F9, KMOD_NONE); m_buttons[0]->SetSelected(true); m_buttons[1] = new Gui::ImageRadioButton(m_rg, PIONEER_DATA_DIR "/icons/multifunc_equip.png", PIONEER_DATA_DIR "/icons/multifunc_equip_on.png"); m_buttons[1]->onSelect.connect(sigc::bind(sigc::mem_fun(this, &MultiFuncSelectorWidget::OnClickButton), MFUNC_EQUIPMENT)); m_buttons[1]->SetShortcut(SDLK_F10, KMOD_NONE); m_buttons[2] = new Gui::ImageRadioButton(m_rg, PIONEER_DATA_DIR "/icons/multifunc_msglog.png", PIONEER_DATA_DIR "/icons/multifunc_msglog_on.png"); m_buttons[2]->onSelect.connect(sigc::bind(sigc::mem_fun(this, &MultiFuncSelectorWidget::OnClickButton), MFUNC_MSGLOG)); m_buttons[2]->SetShortcut(SDLK_F11, KMOD_NONE); UpdateButtons(); ShowAll(); }
// regular view void display() { int i; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport(0, 0, WIDTH, HEIGHT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1, 1, -1, 1, 0.7, 300); gluLookAt(eyex, eyey, eyez, eyex + dirx, eyey - 0.5, eyez + dirz, 0, 1, 0); ShowAll(); // control 1 controlCraneRotate(); // control 2 controlCraneLift(); // control 3 controlCraneMove(); glutSwapBuffers(); }
/*显示主菜单,连接数据库*/ int main() { int n ; //定义变量 存储用户输入的编号 mysql_init(&mysql); //初始化mysql结构 showmenu(); /*显示菜单*/ scanf("%d",&n);/*输入选择功能的编号*/ while(n) { switch(n) { case 1: ShowAll(); /*调用显示所有图书数据的过程*/ break; case 2: AddBook(); /*添加图书信息*/ break; case 3: ModifyBook(); /*修改图书信息*/ break; case 4: DeleteBook(); /*删除图书信息*/ break; case 5: QueryBook(); /*查询图书信息*/ break; case 6: exit(0); /*退出*/ default:break; } scanf("%d",&n); } }
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(); }
void SystemInfoView::SystemChanged(const SystemPath &path) { DeleteAllChildren(); m_tabs = 0; m_bodyIcons.clear(); if (!path.HasValidSystem()) return; m_system = StarSystem::cache->GetCached(path); m_sbodyInfoTab = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-100)); if (m_system->GetUnexplored()) { Add(m_sbodyInfoTab, 0, 0); std::string _info = Lang::UNEXPLORED_SYSTEM_STAR_INFO_ONLY; Gui::Label *l = (new Gui::Label(_info))->Color(255,255,0); m_sbodyInfoTab->Add(l, 35, 300); m_selectedBodyPath = SystemPath(); ShowAll(); return; } Gui::Fixed *demographicsTab = new Gui::Fixed(); m_tabs = new Gui::Tabbed(); m_tabs->AddPage(new Gui::Label(Lang::PLANETARY_INFO), m_sbodyInfoTab); m_tabs->AddPage(new Gui::Label(Lang::DEMOGRAPHICS), demographicsTab); Add(m_tabs, 0, 0); m_sbodyInfoTab->onMouseButtonEvent.connect(sigc::mem_fun(this, &SystemInfoView::OnClickBackground)); int majorBodies, starports, onSurface; { float pos[2] = { 0, 0 }; float psize = -1; majorBodies = starports = onSurface = 0; pos[0] = pos[1] = 0; psize = -1; PutBodies(m_system->GetRootBody().Get(), m_sbodyInfoTab, 1, pos, majorBodies, starports, onSurface, psize); majorBodies = starports = onSurface = 0; pos[0] = pos[1] = 0; psize = -1; PutBodies(m_system->GetRootBody().Get(), demographicsTab, 1, pos, majorBodies, starports, onSurface, psize); } std::string _info = stringf( Lang::STABLE_SYSTEM_WITH_N_MAJOR_BODIES_STARPORTS, formatarg("bodycount", majorBodies), formatarg("body(s)", std::string(majorBodies == 1 ? Lang::BODY : Lang::BODIES)), formatarg("portcount", starports), formatarg("starport(s)", std::string(starports == 1 ? Lang::STARPORT : Lang::COUNT_STARPORTS))); if (starports > 0) _info += stringf(Lang::COUNT_ON_SURFACE, formatarg("surfacecount", onSurface)); _info += ".\n\n"; _info += m_system->GetLongDescription(); { // astronomical body info tab m_infoBox = new Gui::VBox(); Gui::HBox *scrollBox = new Gui::HBox(); scrollBox->SetSpacing(5); m_sbodyInfoTab->Add(scrollBox, 35, 250); Gui::VScrollBar *scroll = new Gui::VScrollBar(); Gui::VScrollPortal *portal = new Gui::VScrollPortal(730); scroll->SetAdjustment(&portal->vscrollAdjust); Gui::Label *l = (new Gui::Label(_info))->Color(255,255,0); m_infoBox->PackStart(l); portal->Add(m_infoBox); scrollBox->PackStart(scroll); scrollBox->PackStart(portal); } { Gui::Fixed *col1 = new Gui::Fixed(); demographicsTab->Add(col1, 200, 300); Gui::Fixed *col2 = new Gui::Fixed(); demographicsTab->Add(col2, 400, 300); const float YSEP = Gui::Screen::GetFontHeight() * 1.2f; col1->Add((new Gui::Label(Lang::SYSTEM_TYPE))->Color(255,255,0), 0, 0); col1->Add((new Gui::Label(Lang::SECTOR_COORDINATES))->Color(255,255,0), 0, 6*YSEP); col2->Add(new Gui::Label(stringf("%0{d}, %1{d}, %2{d}", path.sectorX, path.sectorY, path.sectorZ)), 0, 6*YSEP); col1->Add((new Gui::Label(Lang::SYSTEM_NUMBER))->Color(255,255,0), 0, 7*YSEP); col2->Add(new Gui::Label(stringf("%0", path.systemIndex)), 0, 7*YSEP); } UpdateIconSelections(); ShowAll(); }
void MainWindow::CreateNavigationBar() { QToolBar * pToolBar = new QToolBar(tr("Navigation Bar"), this); pToolBar->setOrientation(Qt::Vertical); pToolBar->setIconSize(QSize(32, 32)); { // Add navigation hot keys. hotkey_t const arr[] = { { Qt::Key_Equal, SLOT(ScalePlus()) }, { Qt::Key_Minus, SLOT(ScaleMinus()) }, { Qt::ALT + Qt::Key_Equal, SLOT(ScalePlusLight()) }, { Qt::ALT + Qt::Key_Minus, SLOT(ScaleMinusLight()) }, { Qt::Key_A, SLOT(ShowAll()) }, // Use CMD+n (New Item hotkey) to activate Create Feature mode. { Qt::Key_Escape, SLOT(ChoosePositionModeDisable()) } }; for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) { QAction * pAct = new QAction(this); pAct->setShortcut(QKeySequence(arr[i].key)); connect(pAct, SIGNAL(triggered()), m_pDrawWidget, arr[i].slot); addAction(pAct); } } { // TODO(AlexZ): Replace icon. m_pCreateFeatureAction = pToolBar->addAction(QIcon(":/navig64/select.png"), tr("Create Feature"), this, SLOT(OnCreateFeatureClicked())); m_pCreateFeatureAction->setCheckable(true); m_pCreateFeatureAction->setToolTip(tr("Please select position on a map.")); m_pCreateFeatureAction->setShortcut(QKeySequence::New); pToolBar->addSeparator(); // Add search button with "checked" behavior. m_pSearchAction = pToolBar->addAction(QIcon(":/navig64/search.png"), tr("Search"), this, SLOT(OnSearchButtonClicked())); m_pSearchAction->setCheckable(true); m_pSearchAction->setToolTip(tr("Offline Search")); m_pSearchAction->setShortcut(QKeySequence::Find); pToolBar->addSeparator(); // #ifndef OMIM_OS_LINUX // add my position button with "checked" behavior m_pMyPositionAction = pToolBar->addAction(QIcon(":/navig64/location.png"), tr("My Position"), this, SLOT(OnMyPosition())); m_pMyPositionAction->setCheckable(true); m_pMyPositionAction->setToolTip(tr("My Position")); // #endif // add view actions 1 button_t arr[] = { { QString(), 0, 0 }, //{ tr("Show all"), ":/navig64/world.png", SLOT(ShowAll()) }, { tr("Scale +"), ":/navig64/plus.png", SLOT(ScalePlus()) } }; add_buttons(pToolBar, arr, ARRAY_SIZE(arr), m_pDrawWidget); } // add scale slider QScaleSlider * pScale = new QScaleSlider(Qt::Vertical, this, 20); pScale->SetRange(2, scales::GetUpperScale()); pScale->setTickPosition(QSlider::TicksRight); pToolBar->addWidget(pScale); m_pDrawWidget->SetScaleControl(pScale); { // add view actions 2 button_t arr[] = { { tr("Scale -"), ":/navig64/minus.png", SLOT(ScaleMinus()) } }; add_buttons(pToolBar, arr, ARRAY_SIZE(arr), m_pDrawWidget); } #ifndef NO_DOWNLOADER { // add mainframe actions button_t arr[] = { { QString(), 0, 0 }, { tr("Download Maps"), ":/navig64/download.png", SLOT(ShowUpdateDialog()) } }; add_buttons(pToolBar, arr, ARRAY_SIZE(arr), this); } #endif // NO_DOWNLOADER addToolBar(Qt::RightToolBarArea, pToolBar); }
void MainWindow::CreateNavigationBar() { QToolBar * pToolBar = new QToolBar(tr("Navigation Bar"), this); pToolBar->setOrientation(Qt::Vertical); pToolBar->setIconSize(QSize(32, 32)); #ifndef USE_DRAPE { // add navigation hot keys hotkey_t arr[] = { { Qt::Key_Left, SLOT(MoveLeft()) }, { Qt::Key_Right, SLOT(MoveRight()) }, { Qt::Key_Up, SLOT(MoveUp()) }, { Qt::Key_Down, SLOT(MoveDown()) }, { Qt::Key_Equal, SLOT(ScalePlus()) }, { Qt::Key_Minus, SLOT(ScaleMinus()) }, { Qt::ALT + Qt::Key_Equal, SLOT(ScalePlusLight()) }, { Qt::ALT + Qt::Key_Minus, SLOT(ScaleMinusLight()) }, { Qt::Key_A, SLOT(ShowAll()) }, { Qt::Key_S, SLOT(QueryMaxScaleMode()) } }; for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) { QAction * pAct = new QAction(this); pAct->setShortcut(QKeySequence(arr[i].key)); connect(pAct, SIGNAL(triggered()), m_pDrawWidget, arr[i].slot); addAction(pAct); } } #endif // USE_DRAPE { // add search button with "checked" behavior m_pSearchAction = pToolBar->addAction(QIcon(":/navig64/search.png"), tr("Search"), this, SLOT(OnSearchButtonClicked())); m_pSearchAction->setCheckable(true); m_pSearchAction->setToolTip(tr("Offline Search")); m_pSearchAction->setShortcut(QKeySequence::Find); pToolBar->addSeparator(); // #ifndef OMIM_OS_LINUX // add my position button with "checked" behavior m_pMyPositionAction = pToolBar->addAction(QIcon(":/navig64/location.png"), tr("My Position"), this, SLOT(OnMyPosition())); m_pMyPositionAction->setCheckable(true); m_pMyPositionAction->setToolTip(tr("My Position")); // #endif #ifndef USE_DRAPE // add view actions 1 button_t arr[] = { { QString(), 0, 0 }, //{ tr("Show all"), ":/navig64/world.png", SLOT(ShowAll()) }, { tr("Scale +"), ":/navig64/plus.png", SLOT(ScalePlus()) } }; add_buttons(pToolBar, arr, ARRAY_SIZE(arr), m_pDrawWidget); #endif // USE_DRAPE } #ifndef USE_DRAPE // add scale slider QScaleSlider * pScale = new QScaleSlider(Qt::Vertical, this, 20); pScale->SetRange(2, scales::GetUpperScale()); pScale->setTickPosition(QSlider::TicksRight); pToolBar->addWidget(pScale); m_pDrawWidget->SetScaleControl(pScale); { // add view actions 2 button_t arr[] = { { tr("Scale -"), ":/navig64/minus.png", SLOT(ScaleMinus()) } }; add_buttons(pToolBar, arr, ARRAY_SIZE(arr), m_pDrawWidget); } #endif // USE_DRAPE #ifndef NO_DOWNLOADER { // add mainframe actions button_t arr[] = { { QString(), 0, 0 }, { tr("Download Maps"), ":/navig64/download.png", SLOT(ShowUpdateDialog()) } }; add_buttons(pToolBar, arr, ARRAY_SIZE(arr), this); } #endif // NO_DOWNLOADER addToolBar(Qt::RightToolBarArea, pToolBar); }
void SystemInfoView::SystemChanged(const SystemPath &path) { DeleteAllChildren(); m_tabs = 0; m_bodyIcons.clear(); if (!path.HasValidSystem()) return; m_system = StarSystemCache::GetCached(path); m_sbodyInfoTab = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-100)); if (m_system->GetUnexplored()) { Add(m_sbodyInfoTab, 0, 0); std::string _info = Lang::UNEXPLORED_SYSTEM_STAR_INFO_ONLY; Gui::Label *l = (new Gui::Label(_info))->Color(255,255,0); m_sbodyInfoTab->Add(l, 35, 300); m_selectedBodyPath = SystemPath(); ShowAll(); return; } m_econInfoTab = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-100)); Gui::Fixed *demographicsTab = new Gui::Fixed(); m_tabs = new Gui::Tabbed(); m_tabs->AddPage(new Gui::Label(Lang::PLANETARY_INFO), m_sbodyInfoTab); m_tabs->AddPage(new Gui::Label(Lang::ECONOMIC_INFO), m_econInfoTab); m_tabs->AddPage(new Gui::Label(Lang::DEMOGRAPHICS), demographicsTab); Add(m_tabs, 0, 0); m_sbodyInfoTab->onMouseButtonEvent.connect(sigc::mem_fun(this, &SystemInfoView::OnClickBackground)); int majorBodies, starports, onSurface; { float pos[2] = { 0, 0 }; float psize = -1; majorBodies = starports = onSurface = 0; PutBodies(m_system->GetRootBody().Get(), m_econInfoTab, 1, pos, majorBodies, starports, onSurface, psize); majorBodies = starports = onSurface = 0; pos[0] = pos[1] = 0; psize = -1; PutBodies(m_system->GetRootBody().Get(), m_sbodyInfoTab, 1, pos, majorBodies, starports, onSurface, psize); majorBodies = starports = onSurface = 0; pos[0] = pos[1] = 0; psize = -1; PutBodies(m_system->GetRootBody().Get(), demographicsTab, 1, pos, majorBodies, starports, onSurface, psize); } std::string _info = stringf( Lang::STABLE_SYSTEM_WITH_N_MAJOR_BODIES_STARPORTS, formatarg("bodycount", majorBodies), formatarg("body(s)", std::string(majorBodies == 1 ? Lang::BODY : Lang::BODIES)), formatarg("portcount", starports), formatarg("starport(s)", std::string(starports == 1 ? Lang::STARPORT : Lang::COUNT_STARPORTS))); if (starports > 0) _info += stringf(Lang::COUNT_ON_SURFACE, formatarg("surfacecount", onSurface)); _info += ".\n\n"; _info += m_system->GetLongDescription(); { // astronomical body info tab m_infoBox = new Gui::VBox(); Gui::HBox *scrollBox = new Gui::HBox(); scrollBox->SetSpacing(5); m_sbodyInfoTab->Add(scrollBox, 35, 250); Gui::VScrollBar *scroll = new Gui::VScrollBar(); Gui::VScrollPortal *portal = new Gui::VScrollPortal(730); scroll->SetAdjustment(&portal->vscrollAdjust); Gui::Label *l = (new Gui::Label(_info))->Color(255,255,0); m_infoBox->PackStart(l); portal->Add(m_infoBox); scrollBox->PackStart(scroll); scrollBox->PackStart(portal); } { // economy tab Gui::HBox *scrollBox2 = new Gui::HBox(); scrollBox2->SetSpacing(5); m_econInfoTab->Add(scrollBox2, 35, 300); Gui::VScrollBar *scroll2 = new Gui::VScrollBar(); Gui::VScrollPortal *portal2 = new Gui::VScrollPortal(730); scroll2->SetAdjustment(&portal2->vscrollAdjust); scrollBox2->PackStart(scroll2); scrollBox2->PackStart(portal2); m_econInfo = new Gui::Label(""); m_econInfoTab->Add(m_econInfo, 35, 250); Gui::Fixed *f = new Gui::Fixed(); m_econMajImport = new Gui::Label(""); m_econMinImport = new Gui::Label(""); m_econMajExport = new Gui::Label(""); m_econMinExport = new Gui::Label(""); m_econIllegal = new Gui::Label(""); m_econMajImport->Color(255,255,0); m_econMinImport->Color(255,255,0); m_econMajExport->Color(255,255,0); m_econMinExport->Color(255,255,0); m_econIllegal->Color(255,255,0); f->Add(m_econMajImport, 0, 0); f->Add(m_econMinImport, 150, 0); f->Add(m_econMajExport, 300, 0); f->Add(m_econMinExport, 450, 0); f->Add(m_econIllegal, 600, 0); portal2->Add(f); UpdateEconomyTab(); } { Gui::Fixed *col1 = new Gui::Fixed(); demographicsTab->Add(col1, 200, 300); Gui::Fixed *col2 = new Gui::Fixed(); demographicsTab->Add(col2, 400, 300); const float YSEP = Gui::Screen::GetFontHeight() * 1.2f; col1->Add((new Gui::Label(Lang::SYSTEM_TYPE))->Color(255,255,0), 0, 0); col2->Add(new Gui::Label(m_system->GetShortDescription()), 0, 0); col1->Add((new Gui::Label(Lang::GOVERNMENT_TYPE))->Color(255,255,0), 0, 2*YSEP); col2->Add(new Gui::Label(m_system->GetSysPolit().GetGovernmentDesc()), 0, 2*YSEP); col1->Add((new Gui::Label(Lang::ECONOMY_TYPE))->Color(255,255,0), 0, 3*YSEP); col2->Add(new Gui::Label(m_system->GetSysPolit().GetEconomicDesc()), 0, 3*YSEP); col1->Add((new Gui::Label(Lang::ALLEGIANCE))->Color(255,255,0), 0, 4*YSEP); col2->Add(new Gui::Label(m_system->GetFaction()->name.c_str()), 0, 4*YSEP); col1->Add((new Gui::Label(Lang::POPULATION))->Color(255,255,0), 0, 5*YSEP); std::string popmsg; fixed pop = m_system->GetTotalPop(); if (pop >= fixed(1,1)) { popmsg = stringf(Lang::OVER_N_BILLION, formatarg("population", pop.ToInt32())); } else if (pop >= fixed(1,1000)) { popmsg = stringf(Lang::OVER_N_MILLION, formatarg("population", (pop*1000).ToInt32())); } else if (pop != fixed(0)) { popmsg = Lang::A_FEW_THOUSAND; } else { popmsg = Lang::NO_REGISTERED_INHABITANTS; } col2->Add(new Gui::Label(popmsg), 0, 5*YSEP); col1->Add((new Gui::Label(Lang::SECTOR_COORDINATES))->Color(255,255,0), 0, 6*YSEP); col2->Add(new Gui::Label(stringf("%0{d}, %1{d}, %2{d}", path.sectorX, path.sectorY, path.sectorZ)), 0, 6*YSEP); col1->Add((new Gui::Label(Lang::SYSTEM_NUMBER))->Color(255,255,0), 0, 7*YSEP); col2->Add(new Gui::Label(stringf("%0", path.systemIndex)), 0, 7*YSEP); } UpdateIconSelections(); ShowAll(); }
void QCSXCAD::BuildToolBar() { QToolBar *mainTB = addToolBar(tr("General")); mainTB->setObjectName("General_ToolBar"); QSize TBIconSize(16,16); mainTB->setIconSize(TBIconSize); if (QCSX_Settings.GetEdit()) mainTB->addAction(QIcon(":/images/filenew.png"),tr("New"),this,SLOT(New())); if (QCSX_Settings.GetEdit()) mainTB->addAction(QIcon(":/images/down.png"),tr("Import"),this,SLOT(ImportGeometry())); mainTB->addAction(QIcon(":/images/up.png"),tr("Export"),this,SLOT(ExportGeometry())); QToolBar *ItemTB = addToolBar(tr("Item View")); ItemTB->setIconSize(TBIconSize); ItemTB->setObjectName("Item_View_ToolBar"); ItemTB->addAction(tr("CollapseAll"),CSTree,SLOT(collapseAll())); ItemTB->addAction(tr("ExpandAll"),CSTree,SLOT(expandAll())); ItemTB->addAction(QIcon(":/images/bulb.png"),tr("ShowAll"),this,SLOT(ShowAll())); ItemTB->addAction(QIcon(":/images/bulb_off.png"),tr("HideAll"),this,SLOT(HideAll())); QToolBar *newObjct = NULL; QAction* newAct = NULL; if (QCSX_Settings.GetEdit()) { newObjct = addToolBar(tr("add new Primitive")); newObjct->setObjectName("New_Primitive_ToolBar"); newAct = newObjct->addAction(tr("Box"),this,SLOT(NewBox())); newAct->setToolTip(tr("add new Box")); newAct = newObjct->addAction(tr("MultiBox"),this,SLOT(NewMultiBox())); newAct->setToolTip(tr("add new Multi-Box")); newAct = newObjct->addAction(tr("Sphere"),this,SLOT(NewSphere())); newAct->setToolTip(tr("add new Sphere")); newAct = newObjct->addAction(tr("Cylinder"),this,SLOT(NewCylinder())); newAct->setToolTip(tr("add new Cylinder")); newAct = newObjct->addAction(tr("Polygon"),this,SLOT(NewPolygon())); newAct->setToolTip(tr("add new Polygon")); newAct = newObjct->addAction(tr("User Defined"),this,SLOT(NewUserDefined())); newAct->setToolTip(tr("add new User Definied Primitive")); newObjct = addToolBar(tr("add new Property")); newObjct->setObjectName("New_Property_ToolBar"); newAct = newObjct->addAction(tr("Material"),this,SLOT(NewMaterial())); newAct->setToolTip(tr("add new Material-Property")); newAct = newObjct->addAction(tr("Metal"),this,SLOT(NewMetal())); newAct->setToolTip(tr("add new Metal-Property")); newAct = newObjct->addAction(tr("Excitation"),this,SLOT(NewExcitation())); newAct->setToolTip(tr("add new Excitation-Property")); newAct = newObjct->addAction(tr("ProbeBox"),this,SLOT(NewChargeBox())); newAct->setToolTip(tr("add new Probe-Box-Property")); newAct = newObjct->addAction(tr("ResBox"),this,SLOT(NewResBox())); newAct->setToolTip(tr("add new Res-Box-Property")); newAct = newObjct->addAction(tr("DumpBox"),this,SLOT(NewDumpBox())); newAct->setToolTip(tr("add new Dump-Box-Property")); } newObjct = addToolBar(tr("Zoom")); newObjct->setIconSize(TBIconSize); newObjct->setObjectName("Zoom_ToolBar"); newAct = newObjct->addAction(QIcon(":/images/viewmagfit.png"),tr("Zoom fit"),this,SLOT(BestView())); newAct->setToolTip("Zoom to best fit all objects"); viewPlane[0] = newObjct->addAction(GridEditor->GetNormName(0),this,SLOT(setYZ())); viewPlane[0]->setToolTip(tr("Switch to y-z-plane view (x-normal)")); viewPlane[1] = newObjct->addAction(GridEditor->GetNormName(1),this,SLOT(setZX())); viewPlane[1]->setToolTip(tr("Switch to z-x-plane view (y-normal)")); viewPlane[2] = newObjct->addAction(GridEditor->GetNormName(2),this,SLOT(setXY())); viewPlane[2]->setToolTip(tr("Switch to x-y-plane view (z-normal)")); addToolBarBreak(); QActionGroup* ActViewGrp = new QActionGroup(this); newAct = newObjct->addAction(tr("2D"),this,SLOT(View2D())); newAct->setToolTip(tr("Switch to 2D view mode")); ActViewGrp->addAction(newAct); newAct->setCheckable(true); newAct = newObjct->addAction(tr("3D"),this,SLOT(View3D())); newAct->setToolTip(tr("Switch to 3D view mode")); ActViewGrp->addAction(newAct); newAct->setCheckable(true); m_PPview = newObjct->addAction(tr("PP")); m_PPview->setToolTip(tr("Toggle parallel projection view mode")); QObject::connect(m_PPview,SIGNAL(toggled(bool)),this,SLOT(SetParallelProjection(bool))); m_PPview->setCheckable(true); if (QCSX_Settings.GetEdit()) addToolBar(GridEditor->BuildToolbar()); }