本文整理汇总了C++中GetControl函数的典型用法代码示例。如果您正苦于以下问题:C++ GetControl函数的具体用法?C++ GetControl怎么用?C++ GetControl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetControl函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetControl
void
DeviceEditWidget::SetConfig(const DeviceConfig &_config)
{
config = _config;
if (config.port_type == DeviceConfig::PortType::DISABLED)
/* if the user configures a new device, forget the old "enabled"
flag and re-enable the device */
config.enabled = true;
WndProperty &port_control = GetControl(Port);
DataFieldEnum &port_df = *(DataFieldEnum *)port_control.GetDataField();
SetPort(port_df, config);
port_control.RefreshDisplay();
WndProperty &baud_control = GetControl(BaudRate);
DataFieldEnum &baud_df = *(DataFieldEnum *)baud_control.GetDataField();
baud_df.Set(config.baud_rate);
baud_control.RefreshDisplay();
WndProperty &bulk_baud_control = GetControl(BulkBaudRate);
DataFieldEnum &bulk_baud_df = *(DataFieldEnum *)
bulk_baud_control.GetDataField();
bulk_baud_df.Set(config.bulk_baud_rate);
bulk_baud_control.RefreshDisplay();
WndProperty &ip_address_control = GetControl(IP_ADDRESS);
DataFieldEnum &ip_address_df = *(DataFieldEnum *)
ip_address_control.GetDataField();
ip_address_df.Set(config.ip_address);
ip_address_control.RefreshDisplay();
WndProperty &tcp_port_control = GetControl(TCPPort);
DataFieldEnum &tcp_port_df = *(DataFieldEnum *)
tcp_port_control.GetDataField();
tcp_port_df.Set(config.tcp_port);
tcp_port_control.RefreshDisplay();
WndProperty &i2c_bus_control = GetControl(I2CBus);
DataFieldEnum &i2c_bus_df = *(DataFieldEnum *)
i2c_bus_control.GetDataField();
i2c_bus_df.Set(config.i2c_bus);
i2c_bus_control.RefreshDisplay();
WndProperty &i2c_addr_control = GetControl(I2CAddr);
DataFieldEnum &i2c_addr_df = *(DataFieldEnum *)
i2c_addr_control.GetDataField();
i2c_addr_df.Set(config.i2c_addr);
i2c_addr_control.RefreshDisplay();
WndProperty &press_control = GetControl(PressureUsage);
DataFieldEnum &press_df = *(DataFieldEnum *)
press_control.GetDataField();
press_df.Set((unsigned)config.press_use);
press_control.RefreshDisplay();
WndProperty &driver_control = GetControl(Driver);
DataFieldEnum &driver_df = *(DataFieldEnum *)driver_control.GetDataField();
driver_df.Set(config.driver_name);
driver_control.RefreshDisplay();
WndProperty &sync_from_control = GetControl(SyncFromDevice);
DataFieldBoolean &sync_from_df =
*(DataFieldBoolean *)sync_from_control.GetDataField();
sync_from_df.Set(config.sync_from_device);
sync_from_control.RefreshDisplay();
WndProperty &sync_to_control = GetControl(SyncToDevice);
DataFieldBoolean &sync_to_df =
*(DataFieldBoolean *)sync_to_control.GetDataField();
sync_to_df.Set(config.sync_to_device);
sync_to_control.RefreshDisplay();
WndProperty &k6bt_control = GetControl(K6Bt);
DataFieldBoolean &k6bt_df =
*(DataFieldBoolean *)k6bt_control.GetDataField();
k6bt_df.Set(config.k6bt);
k6bt_control.RefreshDisplay();
UpdateVisibilities();
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:81,代码来源:DeviceEditWidget.cpp
示例2: GetControl
void* Interface_GUIWindow::get_control_spin(void* kodiBase, void* handle, int control_id)
{
return GetControl(kodiBase, handle, control_id, __FUNCTION__, CGUIControl::GUICONTROL_SPINEX, "spin");
}
开发者ID:totesmuhgoats,项目名称:xbmc,代码行数:4,代码来源:Window.cpp
示例3: switch
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
switch (iControl)
{
case CTL_BUTTON_DONE:
OnOK();
break;
case CTL_BUTTON_CANCEL:
Close();
break;
case CTL_BUTTON_SHIFT:
OnShift();
break;
case CTL_BUTTON_CAPS:
if (m_keyType == LOWER)
m_keyType = CAPS;
else if (m_keyType == CAPS)
m_keyType = LOWER;
UpdateButtons();
break;
case CTL_BUTTON_LAYOUT:
OnLayout();
break;
case CTL_BUTTON_SYMBOLS:
OnSymbols();
break;
case CTL_BUTTON_LEFT:
MoveCursor( -1);
break;
case CTL_BUTTON_RIGHT:
MoveCursor(1);
break;
case CTL_BUTTON_IP_ADDRESS:
OnIPAddress();
break;
case CTL_BUTTON_CLEAR:
SetEditText("");
break;
case CTL_EDIT:
{
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CTL_EDIT);
OnMessage(msg);
// update callback I guess?
if (m_pCharCallback)
{ // we did _something_, so make sure our search message filter is reset
m_pCharCallback(this, msg.GetLabel());
}
m_text = msg.GetLabel();
return true;
}
default:
OnClickButton(iControl);
break;
}
}
break;
case GUI_MSG_SET_TEXT:
case GUI_MSG_INPUT_TEXT_EDIT:
{
// the edit control only handles these messages if it is either focues
// or its specific control ID is set in the message. As neither is the
// case here (focus is on one of the keyboard buttons) we have to force
// the control ID of the message to the control ID of the edit control
// (unfortunately we have to create a whole copy of the message object for that)
CGUIMessage messageCopy(message.GetMessage(), message.GetSenderId(), CTL_EDIT, message.GetParam1(), message.GetParam2(), message.GetItem());
messageCopy.SetLabel(message.GetLabel());
// ensure this goes to the edit control
CGUIControl *edit = GetControl(CTL_EDIT);
if (edit)
edit->OnMessage(messageCopy);
// close the dialog if requested
if (message.GetMessage() == GUI_MSG_SET_TEXT && message.GetParam1() > 0)
OnOK();
return true;
}
}
return CGUIDialog::OnMessage(message);
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:88,代码来源:GUIDialogKeyboardGeneric.cpp
示例4: GetControl
void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
{
std::string strStatus;
RESOLUTION_INFO info = g_graphicsContext.GetResInfo(m_Res[m_iCurRes]);
if (iControl == CONTROL_PIXEL_RATIO)
{
CGUIControl *pControl = GetControl(CONTROL_PIXEL_RATIO);
if (pControl)
{
float fWidth = (float)pControl->GetWidth();
float fHeight = (float)pControl->GetHeight();
info.fPixelRatio = fHeight / fWidth;
// recenter our control...
pControl->SetPosition((info.iWidth - pControl->GetWidth()) / 2,
(info.iHeight - pControl->GetHeight()) / 2);
strStatus = StringUtils::Format("%s (%5.3f)", g_localizeStrings.Get(275).c_str(), info.fPixelRatio);
SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 278);
}
}
else
{
const CGUIMoverControl *pControl = dynamic_cast<const CGUIMoverControl*>(GetControl(iControl));
if (pControl)
{
switch (iControl)
{
case CONTROL_TOP_LEFT:
{
info.Overscan.left = pControl->GetXLocation();
info.Overscan.top = pControl->GetYLocation();
strStatus = StringUtils::Format("%s (%i,%i)", g_localizeStrings.Get(272).c_str(), pControl->GetXLocation(), pControl->GetYLocation());
SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
}
break;
case CONTROL_BOTTOM_RIGHT:
{
info.Overscan.right = pControl->GetXLocation();
info.Overscan.bottom = pControl->GetYLocation();
int iXOff1 = info.iWidth - pControl->GetXLocation();
int iYOff1 = info.iHeight - pControl->GetYLocation();
strStatus = StringUtils::Format("%s (%i,%i)", g_localizeStrings.Get(273).c_str(), iXOff1, iYOff1);
SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
}
break;
case CONTROL_SUBTITLES:
{
info.iSubtitles = pControl->GetYLocation();
strStatus = StringUtils::Format("%s (%i)", g_localizeStrings.Get(274).c_str(), pControl->GetYLocation());
SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 277);
}
break;
}
}
}
g_graphicsContext.SetResInfo(m_Res[m_iCurRes], info);
// set the label control correctly
std::string strText;
if (g_Windowing.IsFullScreen())
strText = StringUtils::Format("%ix%[email protected]%.2f - %s | %s",
info.iScreenWidth,
info.iScreenHeight,
info.fRefreshRate,
g_localizeStrings.Get(244).c_str(),
strStatus.c_str());
else
strText = StringUtils::Format("%ix%i - %s | %s",
info.iScreenWidth,
info.iScreenHeight,
g_localizeStrings.Get(242).c_str(),
strStatus.c_str());
SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, strText);
}
开发者ID:EsMaSol,项目名称:xbmc,代码行数:78,代码来源:GUIWindowSettingsScreenCalibration.cpp
示例5: GetWindow
void
RowFormWidget::UpdateLayout()
{
PixelRect current_rect = GetWindow()->GetClientRect();
const unsigned total_width = current_rect.right - current_rect.left;
const unsigned total_height = current_rect.bottom - current_rect.top;
current_rect.bottom = current_rect.top;
const bool expert = UIGlobals::GetDialogSettings().expert;
/* first row traversal: count the number of "elastic" rows and
determine the minimum total height */
unsigned min_height = 0;
unsigned n_elastic = 0;
unsigned caption_width = 0;
for (auto i = rows.begin(), end = rows.end(); i != end; ++i) {
if (!i->available || (i->expert && !expert))
continue;
min_height += i->GetMinimumHeight();
if (i->IsElastic())
++n_elastic;
if (i->type == Row::Type::EDIT) {
unsigned cw = i->GetControl().GetRecommendedCaptionWidth();
if (cw > caption_width)
caption_width = cw;
}
}
if (caption_width * 3 > total_width * 2)
caption_width = total_width * 2 / 3;
/* how much excess height in addition to the minimum height? */
unsigned excess_height = min_height < total_height
? total_height - min_height
: 0;
/* second row traversal: now move and resize the rows */
for (auto i = rows.begin(), end = rows.end(); i != end; ++i) {
if (i->type == Row::Type::DUMMY)
continue;
Window &window = i->GetWindow();
if (!i->available) {
window.Hide();
continue;
}
if (i->expert) {
if (!expert) {
window.Hide();
continue;
}
if (i->visible)
window.Show();
}
if (caption_width > 0 && i->type == Row::Type::EDIT &&
i->GetControl().HasCaption())
i->GetControl().SetCaptionWidth(caption_width);
/* determine this row's height */
UPixelScalar height = i->GetMinimumHeight();
if (excess_height > 0 && i->IsElastic()) {
assert(n_elastic > 0);
/* distribute excess height among all elastic rows */
unsigned grow_height = excess_height / n_elastic;
if (grow_height > 0) {
height += grow_height;
const UPixelScalar max_height = i->GetMaximumHeight();
if (height > max_height) {
/* never grow beyond declared maximum height */
height = max_height;
grow_height = max_height - height;
}
excess_height -= grow_height;
}
--n_elastic;
}
/* finally move and resize */
NextControlRect(current_rect, height);
window.Move(current_rect);
}
assert(excess_height == 0 || n_elastic == 0);
}
开发者ID:damianob,项目名称:xcsoar,代码行数:93,代码来源:RowFormWidget.cpp
示例6: CGUIButtonControl
void CGUIDialogContextMenu::SetupButtons()
{
if (!m_buttons.size())
return;
// disable the template button control
CGUIButtonControl *pButtonTemplate = dynamic_cast<CGUIButtonControl *>(GetFirstFocusableControl(BUTTON_TEMPLATE));
if (!pButtonTemplate)
pButtonTemplate = dynamic_cast<CGUIButtonControl *>(GetControl(BUTTON_TEMPLATE));
if (!pButtonTemplate)
return;
pButtonTemplate->SetVisible(false);
CGUIControlGroupList* pGroupList = dynamic_cast<CGUIControlGroupList *>(GetControl(GROUP_LIST));
// add our buttons
for (unsigned int i = 0; i < m_buttons.size(); i++)
{
CGUIButtonControl *pButton = new CGUIButtonControl(*pButtonTemplate);
if (pButton)
{ // set the button's ID and position
int id = BUTTON_START + i;
pButton->SetID(id);
pButton->SetVisible(true);
pButton->SetLabel(m_buttons[i].second);
if (pGroupList)
{
pButton->SetPosition(pButtonTemplate->GetXPosition(), pButtonTemplate->GetYPosition());
// try inserting context buttons at position specified by template
// button, if template button is not in grouplist fallback to adding
// new buttons at the end of grouplist
if (!pGroupList->InsertControl(pButton, pButtonTemplate))
pGroupList->AddControl(pButton);
}
}
}
// fix up background images placement and size
CGUIControl *pControl = GetControl(BACKGROUND_IMAGE);
if (pControl)
{
// first set size of background image
if (pGroupList)
{
if (pGroupList->GetOrientation() == VERTICAL)
{
// keep gap between bottom edges of grouplist and background image
pControl->SetHeight(m_backgroundImageSize - pGroupList->Size() + pGroupList->GetHeight());
}
else
{
// keep gap between right edges of grouplist and background image
pControl->SetWidth(m_backgroundImageSize - pGroupList->Size() + pGroupList->GetWidth());
}
}
}
// update our default control
if (pGroupList)
m_defaultControl = pGroupList->GetID();
}
开发者ID:idekker,项目名称:xbmc,代码行数:61,代码来源:GUIDialogContextMenu.cpp
示例7: GetControl
void CXTPReportColumn::EnsureVisible()
{
CXTPReportControl* pControl = GetControl();
if (pControl)
pControl->EnsureVisible(this);
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:6,代码来源:XTPReportColumn.cpp
示例8: ASSERT
FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
bool bChecked,
bool bNotify) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CPDF_FormControl* pControl = GetControl(iControlIndex);
if (!pControl) {
return FALSE;
}
if (!bChecked && pControl->IsChecked() == bChecked) {
return FALSE;
}
CFX_WideString csWExport = pControl->GetExportValue();
CFX_ByteString csBExport = PDF_EncodeText(csWExport);
int iCount = CountControls();
FX_BOOL bUnison = PDF_FormField_IsUnison(this);
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pCtrl = GetControl(i);
if (bUnison) {
CFX_WideString csEValue = pCtrl->GetExportValue();
if (csEValue == csWExport) {
if (pCtrl->GetOnStateName() == pControl->GetOnStateName()) {
pCtrl->CheckControl(bChecked);
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
} else {
if (i == iControlIndex) {
pCtrl->CheckControl(bChecked);
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
}
}
CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pDict, "Opt");
if (!ToArray(pOpt)) {
if (bChecked) {
m_pDict->SetAtName("V", csBExport);
} else {
CFX_ByteString csV;
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
if (pV) {
csV = pV->GetString();
}
if (csV == csBExport) {
m_pDict->SetAtName("V", "Off");
}
}
} else if (bChecked) {
CFX_ByteString csIndex;
csIndex.Format("%d", iControlIndex);
m_pDict->SetAtName("V", csIndex);
}
if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
}
m_pForm->m_bUpdated = TRUE;
return TRUE;
}
开发者ID:andoma,项目名称:pdfium,代码行数:61,代码来源:doc_formfield.cpp
示例9: switch
FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
switch (m_Type) {
case CPDF_FormField::CheckBox:
case CPDF_FormField::RadioButton: {
int iCount = CountControls();
if (iCount) {
if (PDF_FormField_IsUnison(this)) {
for (int i = 0; i < iCount; i++) {
CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
}
} else {
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pControl = GetControl(i);
FX_BOOL bChecked = pControl->IsDefaultChecked();
CheckControl(i, bChecked, FALSE);
}
}
}
if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
}
} break;
case CPDF_FormField::ComboBox: {
CFX_WideString csValue;
ClearSelection();
int iIndex = GetDefaultSelectedItem();
if (iIndex >= 0) {
csValue = GetOptionLabel(iIndex);
}
if (bNotify && m_pForm->m_pFormNotify) {
int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
if (iRet < 0) {
return FALSE;
}
}
SetItemSelection(iIndex, TRUE);
if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
} break;
case CPDF_FormField::ListBox: {
CFX_WideString csValue;
ClearSelection();
int iIndex = GetDefaultSelectedItem();
if (iIndex >= 0) {
csValue = GetOptionLabel(iIndex);
}
if (bNotify && m_pForm->m_pFormNotify) {
int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
if (iRet < 0) {
return FALSE;
}
}
SetItemSelection(iIndex, TRUE);
if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
} break;
case CPDF_FormField::Text:
case CPDF_FormField::RichText:
case CPDF_FormField::File:
default: {
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pDict, "DV");
CFX_WideString csDValue;
if (pDV) {
csDValue = pDV->GetUnicodeText();
}
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
CFX_WideString csValue;
if (pV) {
csValue = pV->GetUnicodeText();
}
CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV");
if (!pRV && (csDValue == csValue)) {
return FALSE;
}
if (bNotify && m_pForm->m_pFormNotify) {
int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csDValue);
if (iRet < 0) {
return FALSE;
}
}
if (pDV) {
CPDF_Object* pClone = pDV->Clone();
if (!pClone) {
return FALSE;
}
m_pDict->SetAt("V", pClone);
if (pRV) {
CPDF_Object* pCloneR = pDV->Clone();
m_pDict->SetAt("RV", pCloneR);
}
} else {
m_pDict->RemoveAt("V");
m_pDict->RemoveAt("RV");
}
if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
m_pForm->m_bUpdated = TRUE;
//.........这里部分代码省略.........
开发者ID:andoma,项目名称:pdfium,代码行数:101,代码来源:doc_formfield.cpp
示例10: switch
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_CLICKED:
{
int iControl = message.GetSenderId();
switch (iControl)
{
case CTL_BUTTON_DONE:
OnOK();
break;
case CTL_BUTTON_CANCEL:
Close();
break;
case CTL_BUTTON_SHIFT:
OnShift();
break;
case CTL_BUTTON_CAPS:
if (m_keyType == LOWER)
m_keyType = CAPS;
else if (m_keyType == CAPS)
m_keyType = LOWER;
UpdateButtons();
break;
case CTL_BUTTON_SYMBOLS:
OnSymbols();
break;
case CTL_BUTTON_LEFT:
MoveCursor( -1);
break;
case CTL_BUTTON_RIGHT:
MoveCursor(1);
break;
case CTL_BUTTON_IP_ADDRESS:
OnIPAddress();
break;
case CTL_BUTTON_CLEAR:
SetEditText("");
break;
case CTL_EDIT:
{
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CTL_EDIT);
OnMessage(msg);
// update callback I guess?
if (m_pCharCallback)
{ // we did _something_, so make sure our search message filter is reset
m_pCharCallback(this, msg.GetLabel());
}
m_text = msg.GetLabel();
return true;
}
default:
OnClickButton(iControl);
break;
}
}
break;
case GUI_MSG_SET_TEXT:
case GUI_MSG_INPUT_TEXT:
case GUI_MSG_INPUT_TEXT_EDIT:
{
// ensure this goes to the edit control
CGUIControl *edit = GetControl(CTL_EDIT);
if (edit)
edit->OnMessage(message);
// close the dialog if requested
if (message.GetMessage() == GUI_MSG_SET_TEXT && message.GetParam1() > 0)
OnOK();
return true;
}
}
return CGUIDialog::OnMessage(message);
}
开发者ID:cg110,项目名称:xbmc,代码行数:78,代码来源:GUIDialogKeyboardGeneric.cpp
示例11: switch
FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
switch (m_Type) {
case CPDF_FormField::CheckBox:
case CPDF_FormField::RadioButton: {
int iCount = CountControls();
if (iCount) {
// TODO(weili): Check whether anything special needs to be done for
// unison field. Otherwise, merge these branches.
if (PDF_FormField_IsUnison(this)) {
for (int i = 0; i < iCount; i++) {
CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
}
} else {
for (int i = 0; i < iCount; i++) {
CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
}
}
}
if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
}
} break;
case CPDF_FormField::ComboBox:
case CPDF_FormField::ListBox: {
CFX_WideString csValue;
ClearSelection();
int iIndex = GetDefaultSelectedItem();
if (iIndex >= 0)
csValue = GetOptionLabel(iIndex);
if (bNotify && !NotifyListOrComboBoxBeforeChange(csValue))
return FALSE;
SetItemSelection(iIndex, TRUE);
if (bNotify)
NotifyListOrComboBoxAfterChange();
} break;
case CPDF_FormField::Text:
case CPDF_FormField::RichText:
case CPDF_FormField::File:
default: {
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pDict, "DV");
CFX_WideString csDValue;
if (pDV)
csDValue = pDV->GetUnicodeText();
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
CFX_WideString csValue;
if (pV)
csValue = pV->GetUnicodeText();
CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV");
if (!pRV && (csDValue == csValue))
return FALSE;
if (bNotify && !NotifyBeforeValueChange(csDValue))
return FALSE;
if (pDV) {
CPDF_Object* pClone = pDV->Clone();
if (!pClone)
return FALSE;
m_pDict->SetAt("V", pClone);
if (pRV) {
CPDF_Object* pCloneR = pDV->Clone();
m_pDict->SetAt("RV", pCloneR);
}
} else {
m_pDict->RemoveAt("V");
m_pDict->RemoveAt("RV");
}
if (bNotify)
NotifyAfterValueChange();
} break;
}
return TRUE;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:78,代码来源:doc_formfield.cpp
示例12: InitializeState
Eigen::VectorXi TvlqrControl::GetControl(const mav_pose_t *msg) {
if (current_trajectory_ == NULL) {
cerr << "Warning: NULL trajectory in GetControl." << endl;
return converter_->GetTrimCommands();
}
//std::cout << "in GetControl" << std::endl;
// check to see if this is the first state we've gotten along this trajectory
if (state_initialized_ == false) {
InitializeState(msg);
}
Eigen::VectorXd state_minus_init = GetStateMinusInit(msg);
/*
printf("BEFORE\troll: %f\tpitch: %f\tyaw: %f\n", state_minus_init(3), state_minus_init(4), state_minus_init(5));
// unwrap angles
state_minus_init(3) = AngleUnwrap(state_minus_init(3), last_state_(3));
state_minus_init(4) = AngleUnwrap(state_minus_init(4), last_state_(4));
state_minus_init(5) = AngleUnwrap(state_minus_init(5), last_state_(5));
printf("AFTER\troll: %f\tpitch: %f\tyaw: %f\n", state_minus_init(3), state_minus_init(4), state_minus_init(5));
last_state_ = state_minus_init;
*/
double t_along_trajectory;
// check for TILQR case
if (current_trajectory_->IsTimeInvariant()) {
t_along_trajectory = 0;
} else {
t_along_trajectory = GetTNow();
}
if (t_along_trajectory <= current_trajectory_->GetMaxTime()) {
Eigen::VectorXd x0 = current_trajectory_->GetState(t_along_trajectory);
Eigen::MatrixXd gain_matrix = current_trajectory_->GetGainMatrix(t_along_trajectory);
Eigen::VectorXd state_error = state_minus_init - x0;
//cout << "state error = " << endl << state_error << endl;
Eigen::VectorXd additional_control_action = gain_matrix * state_error;
//cout << "additional control action = " << endl << additional_control_action << endl;
//cout << "t = " << t_along_trajectory << endl;
//cout << "gain" << endl << gain_matrix << endl << "state_error" << endl << state_error << endl << "additional" << endl << additional_control_action << endl;
Eigen::VectorXd command_in_rad = current_trajectory_->GetUCommand(t_along_trajectory) + additional_control_action;
//cout << "command_in_rad" << endl << command_in_rad << endl;
return converter_->RadiansToServoCommands(command_in_rad);
} else {
// we are past the max time, return stabilizing controller
SetTrajectory(stable_controller_);
return GetControl(msg);
//return converter_->GetTrimCommands();
}
}
开发者ID:fengmushu,项目名称:flight,代码行数:68,代码来源:TvlqrControl.cpp
示例13: SaveValue
bool
InterfaceConfigPanel::Save(bool &_changed)
{
UISettings &settings = CommonInterface::SetUISettings();
bool changed = false;;
#ifdef HAVE_BLANK
changed |= SaveValue(AutoBlank, ProfileKeys::AutoBlank,
settings.display.enable_auto_blank);
#endif
if (SaveValueFileReader(InputFile, ProfileKeys::InputFile))
require_restart = changed = true;
#ifndef HAVE_NATIVE_GETTEXT
WndProperty *wp = (WndProperty *)&GetControl(LanguageFile);
if (wp != NULL) {
DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField();
TCHAR old_value[MAX_PATH];
if (!Profile::GetPath(ProfileKeys::LanguageFile, old_value))
old_value[0] = _T('\0');
const TCHAR *old_base = BaseName(old_value);
if (old_base == NULL)
old_base = old_value;
TCHAR buffer[MAX_PATH];
const TCHAR *new_value, *new_base;
switch (df.GetValue()) {
case 0:
new_value = new_base = _T("auto");
break;
case 1:
new_value = new_base = _T("none");
break;
default:
_tcscpy(buffer, df.GetAsString());
ContractLocalPath(buffer);
new_value = buffer;
new_base = BaseName(new_value);
if (new_base == NULL)
new_base = new_value;
break;
}
if (_tcscmp(old_value, new_value) != 0 &&
_tcscmp(old_base, new_base) != 0) {
Profile::Set(ProfileKeys::LanguageFile, new_value);
LanguageChanged = changed = true;
}
}
#endif
if (SaveValueFileReader(StatusFile, ProfileKeys::StatusFile))
require_restart = changed = true;
unsigned menu_timeout = GetValueInteger(MenuTimeout) * 2;
if (settings.menu_timeout != menu_timeout) {
settings.menu_timeout = menu_timeout;
Profile::Set(ProfileKeys::MenuTimeout, menu_timeout);
changed = true;
}
#ifdef HAVE_VIBRATOR
changed |= SaveValueEnum(HapticFeedback, ProfileKeys::HapticFeedback, settings.haptic_feedback);
#endif
_changed |= changed;
return true;
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:74,代码来源:InterfaceConfigPanel.cpp
示例14: InternalHandleMessage
BOOL CEventPropertiesFireTriggerDialog::HandleMessage( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
m_hDialog = hwndDlg;
bool handled = false;
BOOL bret = InternalHandleMessage( &g_Params, hwndDlg, uMsg, wParam, lParam, handled );
if ( handled )
return bret;
switch(uMsg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
hdc = BeginPaint(hwndDlg, &ps);
DrawSpline( hdc, GetControl( IDC_STATIC_SPLINE ), g_Params.m_pEvent );
EndPaint(hwndDlg, &ps);
return FALSE;
}
break;
case WM_VSCROLL:
{
RECT rcOut;
GetSplineRect( GetControl( IDC_STATIC_SPLINE ), rcOut );
InvalidateRect( hwndDlg, &rcOut, TRUE );
UpdateWindow( hwndDlg );
return FALSE;
}
break;
case WM_INITDIALOG:
{
InitDialog( hwndDlg );
}
return FALSE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
{
HWND control = GetControl( IDC_EVENTCHOICES );
if ( control )
{
SendMessage( control, WM_GETTEXT, (WPARAM)sizeof( g_Params.m_szParameters ), (LPARAM)g_Params.m_szParameters );
}
GetDlgItemText( m_hDialog, IDC_EVENTNAME, g_Params.m_szName, sizeof( g_Params.m_szName ) );
if ( !g_Params.m_szName[ 0 ] )
{
Q_snprintf( g_Params.m_szName, sizeof( g_Params.m_szName ), "Firetrigger %s", g_Params.m_szParameters );
}
char szTime[ 32 ];
GetDlgItemText( m_hDialog, IDC_STARTTIME, szTime, sizeof( szTime ) );
g_Params.m_flStartTime = atof( szTime );
GetDlgItemText( m_hDialog, IDC_ENDTIME, szTime, sizeof( szTime ) );
g_Params.m_flEndTime = atof( szTime );
// Parse tokens from tags
ParseTags( &g_Params );
EndDialog( hwndDlg, 1 );
}
break;
case IDCANCEL:
EndDialog( hwndDlg, 0 );
break;
case IDC_CHECK_ENDTIME:
{
g_Params.m_bHasEndTime = SendMessage( GetControl( IDC_CHECK_ENDTIME ), BM_GETCHECK, 0, 0 ) == BST_CHECKED ? true : false;
if ( !g_Params.m_bHasEndTime )
{
ShowWindow( GetControl( IDC_ENDTIME ), SW_HIDE );
}
else
{
ShowWindow( GetControl( IDC_ENDTIME ), SW_RESTORE );
}
}
break;
case IDC_CHECK_RESUMECONDITION:
{
g_Params.m_bResumeCondition = SendMessage( GetControl( IDC_CHECK_RESUMECONDITION ), BM_GETCHECK, 0, 0 ) == BST_CHECKED ? true : false;
}
break;
case IDC_EVENTCHOICES:
{
HWND control = (HWND)lParam;
if ( control )
{
SendMessage( control, WM_GETTEXT, (WPARAM)sizeof( g_Params.m_szParameters ), (LPARAM)g_Params.m_szParameters );
}
}
break;
case IDC_ABSOLUTESTART:
{
//.........这里部分代码省略.........
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:101,代码来源:eventproperties_firetrigger.cpp
示例15: DialogProc
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
// handle notifications
case WM_COMMAND:
{
HWND hwCtl = GetDlgItem(hwndDlg, LOWORD(wParam));
struct nsControl* ctl = GetControl(hwCtl);
if (ctl == NULL)
break;
if (HIWORD(wParam) == BN_CLICKED && (ctl->type == NSCTL_BUTTON || ctl->type == NSCTL_LINK))
{
if (ctl->callbacks.onClick)
{
pushint((int) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onClick - 1, 0);
}
}
else if (HIWORD(wParam) == EN_CHANGE && ctl->type == NSCTL_EDIT)
{
if (ctl->callbacks.onChange)
{
pushint((int) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onChange - 1, 0);
}
}
else if (HIWORD(wParam) == LBN_SELCHANGE && ctl->type == NSCTL_LISTBOX)
{
if (ctl->callbacks.onChange)
{
pushint((int) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onChange - 1, 0);
}
}
else if ((HIWORD(wParam) == CBN_EDITUPDATE || HIWORD(wParam) == CBN_SELCHANGE)
&& ctl->type == NSCTL_COMBOBOX)
{
if (ctl->callbacks.onChange)
{
pushint((int) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onChange - 1, 0);
}
}
else if (HIWORD(wParam) == STN_CLICKED && ctl->type == NSCTL_STATIC)
{
if (ctl->callbacks.onClick)
{
pushint((int) hwCtl);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onClick - 1, 0);
}
}
break;
}
case WM_NOTIFY:
{
LPNMHDR nmhdr = (LPNMHDR) lParam;
struct nsControl* ctl = GetControl(nmhdr->hwndFrom);
if (ctl == NULL)
break;
if (!ctl->callbacks.onNotify)
break;
pushint((int) nmhdr);
pushint(nmhdr->code);
pushint((int) nmhdr->hwndFrom);
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onNotify - 1, 0);
}
// handle links
case WM_DRAWITEM:
{
DRAWITEMSTRUCT* lpdis = (DRAWITEMSTRUCT*)lParam;
RECT rc;
TCHAR text[1024];
// http://blogs.msdn.com/oldnewthing/archive/2005/05/03/414317.aspx#414357
// says we should call SystemParametersInfo(SPI_GETKEYBOARDCUES,...) to make
// sure, does not seem to be required, might be a win2k bug, or it might
// only apply to menus
BOOL hideFocus = (lpdis->itemState & ODS_NOFOCUSRECT);
BOOL hideAccel = (lpdis->itemState & ODS_NOACCEL);
struct nsControl* ctl = GetControl(lpdis->hwndItem);
if (ctl == NULL)
break;
// We need lpdis->rcItem later
rc = lpdis->rcItem;
// Get button's text
text[0] = _T('\0');
GetWindowText(lpdis->hwndItem, text, 1024);
//.........这里部分代码省略.........
开发者ID:kichik,项目名称:nsis-1,代码行数:101,代码来源:nsDialogs.c
示例16: switch
bool CGUIDialogFileStacking::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_WINDOW_DEINIT:
CGUIDialog::OnMessage(message);
if (m_stackItems)
m_stackItems->Clear();
return true;
case GUI_MSG_WINDOW_INIT:
{
CGUIDialog::OnMessage(message);
m_iSelectedFile = -1;
#ifdef PRE_SKIN_VERSION_2_1_COMPATIBILITY
m_iFrames = 0;
// enable the CD's
for (int i = 1; i <= m_iNumberOfFiles; ++i)
{
CONTROL_ENABLE(i);
SET_CONTROL_VISIBLE(i);
}
// disable CD's we dont use
for (int i = m_iNumberOfFiles + 1; i <= 40; ++i)
{
SET_CONTROL_HIDDEN(i);
CONTROL_DISABLE(i);
}
#endif
if (GetControl(STACK_LIST))
{ // have the new stack list instead - fill it up
CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), STACK_LIST);
OnMessage(msg);
for (int i = 0; i < m_iNumberOfFiles; i++)
{
CStdString label;
label.Format("Part %i", i+1);
CFileItem *item = new CFileItem(label);
m_stackItems->Add(item);
CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), STACK_LIST, 0, 0, item);
OnMessage(msg);
}
}
return true;
}
break;
case GUI_MSG_CLICKED:
{
#ifdef PRE_SKIN_VERSION_2_1_COMPATIBILITY
if (message.GetSenderId() != STACK_LIST)
m_iSelectedFile = message.GetSenderId();
else if (message.GetParam1() == ACTION_SELECT_ITEM)
{
// grab the selected item
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), STACK_LIST);
OnMessage(msg);
m_iSelectedFile = msg.GetParam1() + 1;
}
#endif
Close();
return true;
}
break;
}
return CGUIDialog::OnMessage(message);
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:68,代码来源:GUIDialogFileStacking.cpp
示例17: GetControl
void CGUIDialogKeyboardGeneric::MoveCursor(int iAmount)
{
CGUIControl *edit = GetControl(CTL_EDIT);
if (edit)
edit->OnAction(CAction(iAmount < 0 ? ACTION_CURSOR_LEFT : ACTION_CURSOR_RIGHT));
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:6,代码来源:GUIDialogKeyboardGeneric.cpp
示例18: GetControl
void DialogAbout::TabPlugins::Initialize()
{
// Add columns to the list view
HWND item = GetControl(Id_ItemsListView);
LVCOLUMN lvc;
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.fmt = LVCFMT_LEFT; // left-aligned column
lvc.iSubItem = 0;
lvc.cx = 140;
lvc.pszText = GetString(ID_STR_NAME);
ListView_InsertColumn(item, 0, &lvc);
lvc.iSubItem = 1;
lvc.cx = 80;
lvc.pszText = GetString(ID_STR_VERSION);
ListView_InsertColumn(item, 1, &lvc);
lvc.iSubItem = 2;
// Start 3rd column at max width
RECT rect;
lvc.cx = GetWindowRect(item, &rect) ? (rect.right - rect.left - 193) : 290;
lvc.pszText = GetString(ID_STR_AUTHOR);
ListView_InsertColumn(item, 2, &lvc);
LVITEM vitem;
vitem.mask = LVIF_TEXT;
vitem.iItem = 0;
vitem.iSubItem = 0;
auto findPlugins = [&](const std::wstring& path)
{
std::wstring filter = path + L"*.dll";
WIN32_FIND_DATA fd;
HANDLE hSearch = FindFirstFile(filter.c_str(), &fd);
if (hSearch == INVALID_HANDLE_VALUE)
{
return;
}
int index = 0;
do
{
// Try to get the version and author
std::wstring tmpSz = path + fd.cFileName;
const WCHAR* path = tmpSz.c_str();
LOADED_IMAGE* loadedImage = ImageLoad(StringUtil::Narrow(path).c_str(), nullptr);
if (!loadedImage)
{
LogErrorF(L"About Dialog - Unable to load plugin: %s", fd.cFileName);
continue;
}
const WORD imageBitness = loadedImage->FileHeader->FileHeader.Machine;
ImageUnload(loadedImage);
#ifdef _WIN64
const WORD rainmeterBitness = IMAGE_FILE_MACHINE_AMD64;
#elif _WIN32
const WORD rainmeterBitness = IMAGE_FILE_MACHINE_I386;
#endif
if (rainmeterBitness != imageBitness)
{
LogErrorF(L"About Dialog - Incorrect bitness of plugin: %s", fd.cFileName);
continue;
}
vitem.iItem = index;
vitem.pszText = fd.cFileName;
// Try to get version and author from file resources first
DWORD handle;
DWORD versionSize = GetFileVersionInfoSize(path, &handle);
if (versionSize)
{
bool found = false;
void* data = new BYTE[versionSize];
if (GetFileVersionInfo(path, 0, versionSize, data))
{
UINT len;
struct LANGCODEPAGE
{
WORD wLanguage;
WORD wCodePage;
} *lcp;
if (VerQueryValue(data, L"\\VarFileInfo\\Translation", (LPVOID*)&lcp, &len))
{
WCHAR key[64];
LPWSTR value;
_snwprintf_s(key, _TRUNCATE, L"\\StringFileInfo\\%04x%04x\\ProductName", lcp[0].wLanguage, lcp[0].wCodePage);
if (VerQueryValue(data, (LPTSTR)(LPCTSTR)key, (void**)&value, &len) &&
wcscmp(value, L"Rainmeter") == 0)
{
ListView_InsertItem(item, &vitem);
++index;
found = true;
//.........这里部分代码省略.........
开发者ID:AlonTzarafi,项目名称:rainmeter,代码行数:101,代码来源:DialogAbout.cpp
注:本文中的GetControl函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论