本文整理汇总了C++中IParamBlock2::GetReferenceTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ IParamBlock2::GetReferenceTarget方法的具体用法?C++ IParamBlock2::GetReferenceTarget怎么用?C++ IParamBlock2::GetReferenceTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParamBlock2
的用法示例。
在下文中一共展示了IParamBlock2::GetReferenceTarget方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ICreateCmdRollups
void plResponderProc::ICreateCmdRollups()
{
// Get the index of the current command
HWND hCmds = GetDlgItem(fhDlg, IDC_CMD_LIST);
int cmdIdx = ListBox_GetCurSel(hCmds);
if (cmdIdx != LB_ERR && cmdIdx != fCmdIdx)
{
fCmdIdx = cmdIdx;
fIgnoreNextDrop = true;
// Save the current scroll position and reset it at the end, so the panels
// won't always jerk back up to the top
IRollupWindow *rollup = GetCOREInterface()->GetCommandPanelRollup();
int scrollPos = rollup->GetScrollPos();
// Destroy the last command's rollups
IRemoveCmdRollups();
// Create the rollup for the current command
IParamBlock2 *pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdParams, 0, fCmdIdx);
fCmdMap = ICreateMap(pb);
ResponderWait::InitDlg(fStatePB, fCmdIdx, GetDlgItem(fhDlg, IDC_CMD_LIST));
pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdWait, 0, fCmdIdx);
fWaitMap = ICreateMap(pb);
rollup->SetScrollPos(scrollPos);
}
}
示例2: MoveCommand
void plResponderProc::MoveCommand(int oldIdx, int newIdx)
{
// Move data
int insertIdx = (newIdx > oldIdx) ? newIdx+1 : newIdx;
int deleteIdx = (newIdx < oldIdx) ? oldIdx+1 : oldIdx;
ReferenceTarget *targ = fStatePB->GetReferenceTarget(kStateCmdParams, 0, oldIdx);
fStatePB->Insert(kStateCmdParams, insertIdx, 1, &targ);
fStatePB->Delete(kStateCmdParams, deleteIdx, 1);
ReferenceTarget *wait = fStatePB->GetReferenceTarget(kStateCmdWait, 0, oldIdx);
fStatePB->Insert(kStateCmdWait, insertIdx, 1, &wait);
fStatePB->Delete(kStateCmdWait, deleteIdx, 1);
BOOL oldEnabled = fStatePB->GetInt(kStateCmdEnabled, 0, oldIdx);
BOOL newEnabled = fStatePB->GetInt(kStateCmdEnabled, 0, newIdx);
fStatePB->SetValue(kStateCmdEnabled, 0, oldEnabled, newIdx);
fStatePB->SetValue(kStateCmdEnabled, 0, newEnabled, oldIdx);
ResponderWait::CmdMoved(fStatePB, oldIdx, newIdx);
LoadList();
// Reselect item
// (This doesn't send the LBN_SELCHANGE message so we do that manually)
ListBox_SetCurSel(fhList, newIdx);
ICreateCmdRollups();
}
示例3: GetCommandName
const char* plResponderProc::GetCommandName(int cmdIdx)
{
static char buf[256];
if (fStatePB->Count(kStateCmdParams) > cmdIdx)
{
buf[0] = '\0';
BOOL enabled = fStatePB->GetInt(kStateCmdEnabled, 0, cmdIdx);
if (!enabled)
strcat(buf, "[D]");
IParamBlock2 *cmdPB = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdParams, 0, cmdIdx);
plResponderCmd *cmd = plResponderCmd::Find(cmdPB);
IParamBlock2 *waitPB = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdWait, 0, cmdIdx);
int waitingOn = ResponderWait::GetWaitingOn(waitPB);
if (waitingOn != -1)
{
char num[10];
sprintf(num, "(%d)", waitingOn+1);
strcat(buf, num);
}
strcat(buf, cmd->GetInstanceName(cmdPB));
return buf;
}
hsAssert(0, "Bad index to GetCommandName");
return nil;
}
示例4: ISetupDefaultWait
void plResponderComponent::ISetupDefaultWait(plMaxNode* node, plErrorMsg* pErrMsg,
int state, CmdIdxs& cmdIdxs, int &numCallbacks)
{
IParamBlock2 *statePB = (IParamBlock2*)fCompPB->GetReferenceTarget(kResponderState, 0, state);
plResponderModifier *responder = IGetResponderMod(node);
hsTArray<plResponderModifier::plResponderCmd>& cmds = responder->fStates[state].fCmds;
int numCmds = cmds.Count();
for (int i = 0; i < numCmds; i++)
{
IParamBlock2 *waitPB = GetWaitBlk(statePB, i);
ResponderWait::FixupWaitBlock(waitPB);
// If we're supposed to wait for this command, and it converted, create a callback
if (ResponderWait::GetWaitOnMe(waitPB) && cmdIdxs.find(i) != cmdIdxs.end())
{
int convertedIdx = cmdIdxs[i];
ResponderWaitInfo waitInfo;
waitInfo.responderName = plString::FromUtf8(GetINode()->GetName());
waitInfo.receiver = responder->GetKey();
waitInfo.callbackUser = numCallbacks++;
waitInfo.msg = cmds[convertedIdx].fMsg;
waitInfo.point = plString::Null;
IParamBlock2 *pb = (IParamBlock2*)statePB->GetReferenceTarget(kStateCmdParams, 0, i);
plResponderCmd *cmd = plResponderCmd::Find(pb);
cmd->CreateWait(node, pErrMsg, pb, waitInfo);
}
}
}
示例5: LoadState
void plResponderProc::LoadState()
{
fStatePB = (IParamBlock2*)fPB->GetReferenceTarget(kResponderState, 0, fCurState);
IRemoveCmdRollups();
LoadList();
HWND hSwitchCombo = GetDlgItem(fhDlg, IDC_SWITCH_COMBO);
ComboBox_SetCurSel(hSwitchCombo, fStatePB->GetInt(kStateCmdSwitch));
}
示例6: IConvertCmds
void plResponderComponent::IConvertCmds(plMaxNode* node, plErrorMsg* pErrMsg, int state, CmdIdxs& cmdIdxs)
{
IParamBlock2 *statePB = (IParamBlock2*)fCompPB->GetReferenceTarget(kResponderState, 0, state);
plResponderModifier *responder = IGetResponderMod(node);
// Add the messages to the logic modifier
for (int i = 0; i < statePB->Count(kStateCmdParams); i++)
{
plMessage *msg = nil;
BOOL enabled = statePB->GetInt(kStateCmdEnabled, 0, i);
if (!enabled)
continue;
IParamBlock2 *cmdPB = (IParamBlock2*)statePB->GetReferenceTarget(kStateCmdParams, 0, i);
try
{
plResponderCmd *cmd = plResponderCmd::Find(cmdPB);
if (cmd)
msg = cmd->CreateMsg(node, pErrMsg, cmdPB);
}
catch (char *reason)
{
char buf[512];
char stateName[128];
const char *curStateName = fCompPB->GetStr(kResponderStateName, 0, state);
if (curStateName && *curStateName != '\0')
strcpy(stateName, fCompPB->GetStr(kResponderStateName, 0, state));
else
sprintf(stateName, "State %d", state+1);
sprintf(buf,
"A responder command failed to export.\n\nResponder:\t%s\nState:\t\t%s\nCommand:\t%d\n\nReason: %s",
GetINode()->GetName(), stateName, i+1, reason);
pErrMsg->Set(true, "Responder Warning", buf).Show();
pErrMsg->Set(false);
}
if (msg)
{
msg->SetSender(responder->GetKey());
responder->AddCommand(msg, state);
int idx = responder->fStates[state].fCmds.Count()-1;
cmdIdxs[i] = idx;
}
}
}
示例7: SetupProperties
hsBool plResponderComponent::SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg)
{
int numStates = fCompPB->Count(kResponderState);
for (int i = 0; i < numStates; i++)
{
IParamBlock2 *statePB = (IParamBlock2*)fCompPB->GetReferenceTarget(kResponderState, 0, i);
for (int j = 0; j < statePB->Count(kStateCmdParams); j++)
{
IParamBlock2 *cmdPB = (IParamBlock2*)statePB->GetReferenceTarget(kStateCmdParams, 0, j);
plResponderCmd *cmd = plResponderCmd::Find(cmdPB);
cmd->SetupProperties(node, pErrMsg, cmdPB);
}
}
return true;
}
示例8: IConvertCmdWaits
void plResponderComponent::IConvertCmdWaits(plMaxNode* node, plErrorMsg* pErrMsg,
int state, CmdIdxs& cmdIdxs, int &numCallbacks)
{
IParamBlock2 *statePB = (IParamBlock2*)fCompPB->GetReferenceTarget(kResponderState, 0, state);
plResponderModifier *responder = IGetResponderMod(node);
hsTArray<plResponderModifier::plResponderCmd>& cmds = responder->fStates[state].fCmds;
int numWaits = statePB->Count(kStateCmdWait);
for (int i = 0; i < numWaits; i++)
{
IParamBlock2 *waitPB = GetWaitBlk(statePB, i);
int wait = ResponderWait::GetWaitingOn(waitPB);
// If the waiter and waitee both converted, create the callback
if (cmdIdxs.find(wait) != cmdIdxs.end() && cmdIdxs.find(i) != cmdIdxs.end())
{
int convertedIdx = cmdIdxs[wait];
ResponderWaitInfo waitInfo;
waitInfo.responderName = plString::FromUtf8(GetINode()->GetName());
waitInfo.receiver = responder->GetKey();
waitInfo.callbackUser = numCallbacks++;
waitInfo.msg = cmds[convertedIdx].fMsg;
waitInfo.point = ResponderWait::GetWaitPoint(waitPB);
responder->AddCallback(state, convertedIdx, waitInfo.callbackUser);
cmds[cmdIdxs[i]].fWaitOn = waitInfo.callbackUser;
IParamBlock2 *pb = (IParamBlock2*)statePB->GetReferenceTarget(kStateCmdParams, 0, wait);
plResponderCmd *cmd = plResponderCmd::Find(pb);
cmd->CreateWait(node, pErrMsg, pb, waitInfo);
}
}
}
示例9: LoadPoint
void plResponderWaitProc::LoadPoint(bool force)
{
int who = fWaitPB->GetInt(kWaitWho);
const char *point = fWaitPB->GetStr(kWaitPoint);
if (point && *point == '\0')
point = nil;
CheckRadioButton(fhDlg, IDC_RADIO_FINISH, IDC_RADIO_POINT, point || force ? IDC_RADIO_POINT : IDC_RADIO_FINISH);
BOOL enableAll = (who != -1);
EnableWindow(GetDlgItem(fhDlg, IDC_RADIO_FINISH), enableAll);
EnableWindow(GetDlgItem(fhDlg, IDC_RADIO_POINT), enableAll);
BOOL enablePoint = ((point != nil) || force) && enableAll;
EnableWindow(GetDlgItem(fhDlg, IDC_WAIT_POINT), enablePoint);
ComboBox_ResetContent(GetDlgItem(fhDlg, IDC_WAIT_POINT));
if (enableAll)
{
IParamBlock2 *pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdParams, 0, who);
plResponderCmd *cmd = plResponderCmd::Find(pb);
// KLUDGE - stupid one-shot needs editable box
if (cmd == &(plResponderCmdOneShot::Instance()))
{
ShowWindow(GetDlgItem(fhDlg, IDC_WAIT_POINT), SW_HIDE);
HWND hEdit = GetDlgItem(fhDlg, IDC_MARKER_EDIT);
ShowWindow(hEdit, SW_SHOW);
ICustEdit *custEdit = GetICustEdit(hEdit);
custEdit->SetText(point ? (char*)point : "");
}
else
{
ShowWindow(GetDlgItem(fhDlg, IDC_WAIT_POINT), SW_SHOW);
HWND hEdit = GetDlgItem(fhDlg, IDC_MARKER_EDIT);
ShowWindow(hEdit, SW_HIDE);
plResponderCmd::WaitPoints waitPoints;
cmd->GetWaitPoints(pb, waitPoints);
HWND hCombo = GetDlgItem(fhDlg, IDC_WAIT_POINT);
ComboBox_ResetContent(hCombo);
if (waitPoints.size() == 0)
{
EnableWindow(GetDlgItem(fhDlg, IDC_RADIO_POINT), FALSE);
EnableWindow(GetDlgItem(fhDlg, IDC_WAIT_POINT), FALSE);
}
else
{
for (int i = 0; i < waitPoints.size(); i++)
{
const char *marker = waitPoints[i].c_str();
int idx = ComboBox_AddString(hCombo, marker);
if (point && !strcmp(point, marker))
ComboBox_SetCurSel(hCombo, idx);
}
}
}
}
}
示例10: return
IParamBlock2 *plResponderWaitProc::GetCmdParams(int cmdIdx)
{
return (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdParams, 0, cmdIdx);
}
示例11: DlgProc
//.........这里部分代码省略.........
ComboBox_DeleteString(hCombo, fCurState);
ComboBox_InsertString(hCombo, fCurState, buf);
// ComboBox_SetCurSel(hCombo, fCurState);
}
return TRUE;
}
else if (code == CBN_SELCHANGE)
{
int sel = ComboBox_GetCurSel(hCombo);
int type = ComboBox_GetItemData(hCombo, sel);
if (type == kStateAdd)
{
IParamBlock2 *pb = CreateParameterBlock2(&gStateBlock, nil);
fCurState = AddState(pb);
fCmdIdx = -1;
}
else if (type == kStateRemove)
{
int count = fPB->Count(kResponderState);
// Don't let the user remove the last state
if (count == 1)
{
hsMessageBox("You must have at least one state.", "Error", hsMessageBoxNormal);
ComboBox_SetCurSel(hCombo, fCurState);
return TRUE;
}
// Verify that the user really wants to delete the state
else
{
int ret = hsMessageBox("Are you sure you want to remove this state?", "Verify Remove", hsMessageBoxYesNo);
if (ret == hsMBoxNo)
{
ComboBox_SetCurSel(hCombo, fCurState);
return TRUE;
}
}
fPB->Delete(kResponderState, fCurState, 1);
fPB->Delete(kResponderStateName, fCurState, 1);
ComboBox_DeleteString(hCombo, fCurState);
ComboBox_SetCurSel(hCombo, 0);
HWND hSwitch = GetDlgItem(hWnd, IDC_SWITCH_COMBO);
ComboBox_DeleteString(hSwitch, fCurState);
// If the deleted state was the default, set the default to the first
int defState = fPB->GetInt(kResponderStateDef);
if (fCurState == defState)
fPB->SetValue(kResponderStateDef, 0, 0);
else if (fCurState < defState)
fPB->SetValue(kResponderStateDef, 0, defState-1);
// Patch up the switch commands
for (int i = fCurState; i < fPB->Count(kResponderState); i++)
{
IParamBlock2 *pb = (IParamBlock2*)fPB->GetReferenceTarget(kResponderState, 0, i);
int switchState = pb->GetInt(kStateCmdSwitch);
// TODO: might want to warn about this
if (switchState == fCurState)
pb->SetValue(kStateCmdSwitch, 0, 0);
else if (switchState > fCurState)
pb->SetValue(kStateCmdSwitch, 0, switchState-1);
}
fCurState = 0;
fCmdIdx = -1;
}
else if (type == kStateDefault)
{
// Set the current state as the default
fPB->SetValue(kResponderStateDef, 0, fCurState);
ComboBox_SetCurSel(hCombo, fCurState);
}
else if (type == kStateCopy)
{
// Clone the state PB
IParamBlock2 *origPB = (IParamBlock2*)fPB->GetReferenceTarget(kResponderState, 0, fCurState);
IParamBlock2 *copyPB = (IParamBlock2*)origPB->Clone(gMyRemapDir);
fCurState = AddState(copyPB);
fCmdIdx = -1;
}
else
{
fCurState = sel;
fCmdIdx = -1;
}
LoadState();
return TRUE;
}
}
}
return FALSE;
}