DisparityPlugin::DisparityPlugin() : config_widget_(new QWidget()), anchor_(TOP_LEFT), units_(PIXELS), offset_x_(0), offset_y_(0), width_(320), height_(240), has_image_(false), last_width_(0), last_height_(0) { ui_.setupUi(config_widget_); // Set background white QPalette p(config_widget_->palette()); p.setColor(QPalette::Background, Qt::white); config_widget_->setPalette(p); // Set status text red QPalette p3(ui_.status->palette()); p3.setColor(QPalette::Text, Qt::red); ui_.status->setPalette(p3); QObject::connect(ui_.selecttopic, SIGNAL(clicked()), this, SLOT(SelectTopic())); QObject::connect(ui_.topic, SIGNAL(editingFinished()), this, SLOT(TopicEdited())); QObject::connect(ui_.anchor, SIGNAL(activated(QString)), this, SLOT(SetAnchor(QString))); QObject::connect(ui_.units, SIGNAL(activated(QString)), this, SLOT(SetUnits(QString))); QObject::connect(ui_.offsetx, SIGNAL(valueChanged(int)), this, SLOT(SetOffsetX(int))); QObject::connect(ui_.offsety, SIGNAL(valueChanged(int)), this, SLOT(SetOffsetY(int))); QObject::connect(ui_.width, SIGNAL(valueChanged(int)), this, SLOT(SetWidth(int))); QObject::connect(ui_.height, SIGNAL(valueChanged(int)), this, SLOT(SetHeight(int))); }
bool dlgWaypointEditShowModal(Waypoint &way_point) { global_wpt = &way_point; wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, Layout::landscape ? _T("IDR_XML_WAYPOINTEDIT_L") : _T("IDR_XML_WAYPOINTEDIT")); assert(wf != NULL); buttonName = ((WndButton *)wf->FindByName(_T("cmdName"))); assert(buttonName != NULL); buttonName->SetOnClickNotify(OnNameClicked); buttonComment = ((WndButton *)wf->FindByName(_T("cmdComment"))); assert(buttonComment != NULL); buttonComment->SetOnClickNotify(OnCommentClicked); UpdateButtons(); SetUnits(); SetValues(); wf->SetModalResult(mrCancel); bool retval = false; if (wf->ShowModal() == mrOK) { GetValues(); retval = true; } delete wf; return retval; }
void DisparityPlugin::LoadConfig(const YAML::Node& node, const std::string& path) { std::string topic; node["topic"] >> topic; ui_.topic->setText(topic.c_str()); TopicEdited(); std::string anchor; node["anchor"] >> anchor; ui_.anchor->setCurrentIndex(ui_.anchor->findText(anchor.c_str())); SetAnchor(anchor.c_str()); std::string units; node["units"] >> units; ui_.units->setCurrentIndex(ui_.units->findText(units.c_str())); SetUnits(units.c_str()); node["offset_x"] >> offset_x_; ui_.offsetx->setValue(offset_x_); node["offset_y"] >> offset_y_; ui_.offsety->setValue(offset_y_); node["width"] >> width_; ui_.width->setValue(width_); node["height"] >> height_; ui_.height->setValue(height_); }
/////////////////////////////////////////////////////////////////////////////////// //...функци¤ образовани¤ контекста дл¤ базы данных защитного оборудовани¤ проводов; void * CreateFITTINGContext(int N_sm) { if (N_sm < 0 || N_sm >= NUM_FITTING_SAMPLES) N_sm = 0; Context * cont = new_struct<Context>(); if (! cont) return(NULL); cont->N = N_sm+SHIFT_FITTING_SAMPLES; cont->static_char = SPECIAL_STATE; cont->sample_name = GetFITTINGSampleName(N_sm); cont->GOST_name = GetFITTINGGOSTName (N_sm); cont->units = UNIT_WIRE; switch (cont->N-SHIFT_FITTING_SAMPLES) { case _FITTING1: cont->table = fitting_NS (cont->static_char); break; //Ќ—-; case _FITTING2: cont->table = fitting_PS (cont->static_char); break; //ѕ—-; case _FITTING3: cont->table = fitting_PZS(cont->static_char); break; //ѕ«—-; case _FITTING4: cont->table = fitting_GV (cont->static_char); break; //√¬-; } set_default (cont); set_table_units(cont->table, UNIT_WIRE); SetTableIndex(cont, 1); SetUnits (cont, UNIT_WIRE); return (void *)cont; }
void xTEDSOrientationItem::SetOrientation(const orientation* NewOrientation) { if (NewOrientation == NULL) return; SetAxis(NewOrientation->axis_value); SetAngle(NewOrientation->angle_value); SetUnits(NewOrientation->units_value); }
bool dlgWaypointEditShowModal(Waypoint &way_point) { global_wpt = &way_point; wf = LoadDialog(nullptr, UIGlobals::GetMainWindow(), Layout::landscape ? _T("IDR_XML_WAYPOINTEDIT_L") : _T("IDR_XML_WAYPOINTEDIT")); assert(wf != NULL); SetUnits(); SetValues(); if (CommonInterface::GetUISettings().coordinate_format == CoordinateFormat::UTM) { ShowMessageBox( _("Sorry, the waypoint editor is not yet available for the UTM coordinate format."), _("Waypoint Editor"), MB_OK); return false; } wf->SetModalResult(mrCancel); bool retval = false; if (wf->ShowModal() == mrOK) { GetValues(); retval = true; } delete wf; return retval; }
void dlgWaypointEditShowModal(WAYPOINT *wpt) { if (!wpt) { return; } global_wpt = wpt; if (!ScreenLandscape) { char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgWaypointEdit_L.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_WAYPOINTEDIT_L")); } else { char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgWaypointEdit.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_WAYPOINTEDIT")); } if (wf) { buttonName = ((WndButton *)wf->FindByName(TEXT("cmdName"))); if (buttonName) { buttonName->SetOnClickNotify(OnNameClicked); } buttonComment = ((WndButton *)wf->FindByName(TEXT("cmdComment"))); if (buttonComment) { buttonComment->SetOnClickNotify(OnCommentClicked); } UpdateButtons(); SetUnits(); SetValues(); wf->SetModalResult(mrCancle); if (wf->ShowModal()==mrOK) { //// GetValues(); } delete wf; } wf = NULL; }
void CTimeHelper::SetUnits(int nUnits, LPCTSTR szUnits) { // sanity check if (!IsValidUnit(nUnits)) { ASSERT(0); return ; } if (szUnits && *szUnits) SetUnits(nUnits, szUnits[0]); }
TCHAR CTimeHelper::GetUnits(int nUnits) { // sanity check if (!IsValidUnit(nUnits)) { ASSERT(0); return 0; } // handle first time if (MAPUNIT2CH.GetCount() == 0) { SetUnits(THU_MINS, 'm'); SetUnits(THU_HOURS, 'H'); SetUnits(THU_DAYS, 'D'); SetUnits(THU_WEEKS, 'W'); SetUnits(THU_MONTHS, 'M'); SetUnits(THU_YEARS, 'Y'); } TCHAR cUnits = 0; MAPUNIT2CH.Lookup(nUnits, cUnits); return cUnits; }
void CWordPadApp::LoadOptions() { BYTE* pb = NULL; UINT nLen = 0; HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); if (hFont == NULL) hFont = (HFONT)GetStockObject(ANSI_VAR_FONT); VERIFY(::GetObject(hFont, sizeof(LOGFONT), &m_lf)); m_bWordSel = GetProfileInt(szSection, szWordSel, TRUE); TCHAR buf[2]; buf[0] = NULL; GetLocaleInfo(GetUserDefaultLCID(), LOCALE_IMEASURE, buf, 2); int nDefUnits = buf[0] == '1' ? 0 : 1; SetUnits(GetProfileInt(szSection, szUnits, nDefUnits)); m_bMaximized = GetProfileInt(szSection, szMaximized, (int)FALSE); if (GetProfileBinary(szSection, szFrameRect, &pb, &nLen)) { ASSERT(nLen == sizeof(CRect)); memcpy(&m_rectInitialFrame, pb, sizeof(CRect)); delete pb; } else m_rectInitialFrame.SetRect(0,0,0,0); CRect rectScreen(0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); CRect rectInt; rectInt.IntersectRect(&rectScreen, &m_rectInitialFrame); if (rectInt.Width() < 10 || rectInt.Height() < 10) m_rectInitialFrame.SetRect(0, 0, 0, 0); if (GetProfileBinary(szSection, szPageMargin, &pb, &nLen)) { ASSERT(nLen == sizeof(CRect)); memcpy(&m_rectPageMargin, pb, sizeof(CRect)); delete pb; } else m_rectPageMargin.SetRect(1800, 1440, 1800, 1440); m_optionsText.LoadOptions(szTextSection); m_optionsRTF.LoadOptions(szRTFSection); m_optionsWord.LoadOptions(szWordSection); m_optionsWrite.LoadOptions(szWriteSection); m_optionsIP.LoadOptions(szIPSection); }
void TowerDefenseInstanceScript::TowerDefenseMapInstanceScript::SetupEventData() { Player *player = GetPlayer(); if(!player) return; SetEventId(GenerateEventId()); // set the event id SetPlayerGUID(player->GetGUIDLow()); // set the player guid SetCurrentWaveId(0); // set the current wave id to zero SetBaseHealth(100); // set the base health to 100 SetResources(GetStartResources()); // set the resources that the player has to starter resources SetUnits(0); // set the number of spawned attackers to zero SetFinished(false); // set the event to unfinished SetEventStatus(TD_EVENT_STATUS_TELEPORT); // Set the event status to started and not running a wave Events.Reset(); }
void TowerDefenseInstanceScript::TowerDefenseMapInstanceScript::DeleteEventData() { Player *player = GetPlayer(); if(!player) return; SetEventId(0); SetPlayerGUID(0); SetCurrentWaveId(0); SetBaseHealth(0); SetResources(0); SetUnits(0); SetFinished(false); SetEventStatus(TD_EVENT_STATUS_NONE); CountDown = 0; Events.Reset(); RecordLog("TowerDefense: the tower defense event for player %s was deleted", player->GetName()); _player = NULL; }
Area::Area(float NewStandartValue, std::string NewStandartUnits) : ChemistryUnits(NewStandartValue, NewStandartUnits, 0, 100000) { SetUnits(); }
Area::Area() : ChemistryUnits(1, "m2", 0, 1000000) { SetUnits(); }