void CScriptDlg::InitPythonForObjects() { if(pApp == NULL) return; POSITION pos = pApp->object_types.GetStartPosition(); CObjType* oT; long nKey = 0; int objectnumber = 0; while (pos != NULL) { pApp->object_types.GetNextAssoc(pos, nKey, oT); if(oT && !oT->m_bIsGroupType) { CString name = oT->GetName(); name.Replace("&", ""); PyInfoClass* pClass = &m_Intell.classes[name]; InitPythonForObject(oT, pClass); PyInfoMapItem& item = m_IntellMap[name]; item[&m_Intell] = PY_CLASS; } } // System oT = &pApp->m_System; PyInfoClass* pClass = &m_Intell.classes[oT->GetName()]; InitPythonForObject(oT, pClass); PyInfoMapItem& item = m_IntellMap[oT->GetName()]; item[&m_Intell] = PY_CLASS; }
bool CEditorAction::Valid(CApplication* pApp) { // if the user removes an object sometimes the conditions / actions can still refer to the removed object // and this causes a headache // uberhack: set global filter removed if (oid == -1 && actID == 7) return false; CObjType* objecttype = pApp->FindObjTypeFromNumber(oid); if(objecttype ) { if(mid < -1) { //check that the effect still exists if(!objecttype->GetEffect(mid * -1)) return false; } if(mid > -1) { if(!objecttype->GetBehaviorByUniqueID(mid)) return false; } // loop each param; for(int p = 0; p < params.size(); p++) { CEditorParam* param = params.at(p); if(param->m_type == 14) //variable { // lookup the variable if(!objecttype->GetPrivateVariable(atoi(param->CreateParamString(pApp)))) return false; } if(param->m_type == 13) //global { if(!pApp->GetGlobalVariable(atoi(param->CreateParamString(pApp)))) return false; } if(param->m_type == EDITORPARAM_OBJECT) { CString stparam = param->CreateParamString(pApp); int o = atoi(stparam); if(o == 0 && stparam != "0") return true; //attribute if(!pApp->FindObjTypeFromNumber( o)) return false; } if(pApp) param->CreateParamString(pApp); //Calling this function updates valid...terrible design but meh if(param->valid == false) return false; } return true; } return false; }
bool CEditorCondition::IsLoop(CApplication* app) { if(m_Text != "") { return (m_Text.Find("<img>3</img>") != -1); } else { if(!app) return false; CObjType* objectType = app->FindObjTypeFromNumber(oid); if(!objectType) return false; ACESEntry2* acesEntry; if(mid == -1) // ace or custom ace acesEntry = objectType->GetACESEntry(CONDITION, cndID); else // movement { //MovementIterator mi = objectType->m_Movements.begin(); //advance(mi, mid); CBehavior* pMov = objectType->GetBehaviorByUniqueID(mid); if (pMov == NULL) throw; acesEntry = GetOINFO(pMov->BehaviorDLLIndex)->GetACEEntry(CONDITION, cndID); } // effects never have triggers if(!acesEntry) return false; if (acesEntry->aceDisplayText.Find("<img>3</img>") != -1) return true; return false; } }
void CEventWizardDlg::OnPaint() { CPaintDC dc(this); // device context for painting g_PaintManager->PaintDockerBkgnd( true, dc, this ); CRect rect; GetClientRect(&rect); dc.FillSolidRect(0, 0, rect.Width(), 46, RGB(255, 255, 255)); dc.FillSolidRect(0, 46, rect.Width(), 1, RGB(0, 0, 0)); dc.FillSolidRect(0, rect.bottom - 40, rect.Width(), 1, RGB(158, 158, 158)); dc.FillSolidRect(0, rect.bottom - 39, rect.Width(), 1, RGB(255, 255, 255)); CFont* pOldFont = NULL; if (m_iStep == 1) { pOldFont = dc.SelectObject(&m_FontBold); dc.DrawText("Select an object.", CRect(7, 7, 200, 21), 0); } if (m_iStep == 2) { pOldFont = dc.SelectObject(&m_FontBold); CObjType* pType = application->FindObjTypeFromNumber(m_pSelectedObject); CString text; if (m_aceType == CONDITION) text.Format("Conditions for '%s'", pType->GetName()); if (m_aceType == ACTION) text.Format("Actions for '%s'", pType->GetName()); if (m_aceType == EXPRESSION) text.Format("Expressions for '%s'", pType->GetName()); dc.DrawText(text, CRect(7, 7, 200, 21), 0); } if (m_iStep == 3) { pOldFont = dc.SelectObject(&m_FontBold); CObjType* pType = application->FindObjTypeFromNumber(m_pSelectedObject); CString text; text.Format("Parameters for '%s - %s'", pType->GetName(), pAce->aceListName); dc.DrawText(text, CRect(7, 7, 400, 21), 0); } if (pOldFont) dc.SelectObject(pOldFont); }
bool CTypeChecker::PrivateVariableExists(CString objName, CString expName, int paramNum, int numParams, CString varName) { CString actualvarName = varName; objName.MakeLower(); expName.MakeLower(); varName.MakeLower(); if (objName == "<system>") if(exists_element(pApp->global_variables.begin(), pApp->global_variables.end(), varName)) return true; else { // Variable is undefined, add it to our list of undefined variables push_back_unique(m_UndefinedVariables, CUndefinedVariable(true, 0, varName)); return true; } CObjType* oT; POSITION pos = objMap->GetStartPosition(); long mapKey; // Loop through and add the objects while (pos != NULL) { objMap->GetNextAssoc(pos, mapKey, oT); CString Name = oT->GetName(); Name.MakeLower(); if (Name == objName) { if(exists_element(oT->m_PrivateValues.begin(), oT->m_PrivateValues.end(), varName)) return true; else { // Variable undefined, add it to our list of undefined variables push_back_unique(m_UndefinedVariables, CUndefinedVariable(false, oT, actualvarName)); return true; } } } // Check families list<Family>::iterator f = pApp->families.begin(); for ( ; f != pApp->families.end(); f++) { if(f->is_in_use) { CString familyName = f->name; familyName.MakeLower(); f->UpdateFamilyData(); if (objName == familyName) { return f->VariableNameExists(varName); } } } return false; }
void CEditorAction::Render(CRect &Pos, CDC& dc,bool EventSelected, CChronoEventEditor& Ed, int renderType, bool bEnabled) { COLORREF ActionBG =m_select(&Ed)? ACTION_BG_SEL : (EventSelected? ACTION_BG_EVSEL : ACTION_BG); // Animating if(m_Anim.m_bDestroyed) { if(renderType == 3) { Pos.OffsetRect(0,m_Anim.Space); } if(renderType == 1) { Pos.OffsetRect(-30 + m_Anim.Space, 0); } //dc.FillSolidRect(Calc,BG); return; } switch(renderType) { /* case 0: { if(m_select(&Ed)) { dc.FillSolidRect(Pos,ActionBG); dc.Draw3dRect(Pos,ACTION_BG_SEL2,ACTION_BG_SEL2); } HBITMAP load = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_DOT)); HDC hdcScreenCompat = CreateCompatibleDC(dc.m_hDC); HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcScreenCompat, load); BitBlt(dc.m_hDC, Pos.left + 1, Pos.top + 1, 16, 16, hdcScreenCompat, 0, 0, SRCCOPY); SelectObject(hdcScreenCompat, hbmpOld); DeleteDC(hdcScreenCompat); DeleteObject(load); } break;*/ case 1: { if(m_select(&Ed)) { Pos.InflateRect(3,3); dc.FillSolidRect(Pos,ActionBG); dc.Draw3dRect(Pos,ACTION_BG_SEL2,ACTION_BG_SEL2); Pos.DeflateRect(3,3); } int icon = 0; if(m_Family) ((EventSheetEditor*)(&Ed))->m_familyhbitmaps.Lookup(oid, icon); else ((EventSheetEditor*)(&Ed))->m_objecthbitmaps.Lookup(oid, icon); static HDC dcMem = CreateCompatibleDC(dc.m_hDC); HBITMAP old = (HBITMAP)SelectObject(dcMem, Ed.GetIcon(icon)); BitBlt(dc.m_hDC,Pos.left, Pos.top ,16 ,16,dcMem,0,0,SRCCOPY); SelectObject(dcMem, old); //DeleteDC(dcMem); - its static so we cant delete it m_Anim.Space = 30; } break; case 2: { CHTMLFont f; f.SetBold(false); f.SetSize(8); f.SetName("Arial"); f.SetImage(false); if (!bEnabled) f.SetStrike(true); CRect Calc = Pos; Calc.bottom += m_rect(&Ed).Height(); // Draw the action CString Out = m_Text; g_HTMLDraw.DrawText(&dc, Out, f, Calc, 0, &Ed, &m_imgs,¶ms); m_Readable = Out; Pos.bottom = Pos.top + Calc.Height(); Calc = Pos; dc.FillSolidRect(Pos,ActionBG); // We may be hovering over something. CPoint mouse; GetCursorPos(&mouse); Ed.ScreenToClient(&mouse); if(Pos.PtInRect(mouse) && m_select(&Ed)) { for(int p = 0; p < params.size(); p++) for(int d = 0; d < params[p]->displayrects.size(); d++) if(params[p]->displayrects[d].PtInRect(mouse)) { for(int a = 0; a < params[p]->displayrects.size(); a++) dc.FillSolidRect(params[p]->displayrects[a], RGB(100,255,100)); continue; } } // End hover Out = m_Text; g_HTMLDraw.DrawText(&dc, Out, f, Calc, 0, &Ed, &m_imgs,¶ms); m_Readable = Out; if(m_select(&Ed)) dc.Draw3dRect(Calc,ACTION_BG_SEL2,ACTION_BG_SEL2); } break; case 3: { CHTMLFont f; f.SetBold(false); f.SetSize(8); f.SetName("Arial"); f.SetImage(false); if (!bEnabled) f.SetStrike(true); CRect Calc = Pos; Calc.bottom += m_rect(&Ed).Height(); CString newtext; CObjType* objectType = ((EventSheetEditor*)&Ed)->application->FindObjTypeFromNumber(oid); int icon = 0; if(m_Family) ((EventSheetEditor*)(&Ed))->m_familyhbitmaps.Lookup(oid, icon); else ((EventSheetEditor*)(&Ed))->m_objecthbitmaps.Lookup(oid, icon); bool show_name = true; bool show_icon = true; bool show_quotes = true; if (m_Text.Find("#noname") != -1) show_name = false; if (m_Text.Find("#noicon") != -1) show_icon = false; if (m_Text.Find("#noquotes") != -1) show_quotes = false; CString display_text = m_Text; display_text.Replace("#noname", ""); display_text.Replace("#noicon", ""); display_text.Replace("#noquotes", ""); if (!show_quotes) display_text.Replace("\"", ""); if (show_name && show_icon) newtext.Format("<img>%d</img> %s: %s", icon, objectType->GetName(), display_text); else if (show_name && !show_icon) newtext.Format("%s: %s", objectType->GetName(), display_text); else if (!show_name && show_icon) newtext.Format("<img>%d</img> %s", icon, display_text); else newtext.Format("%s", display_text); CString Out = newtext; g_HTMLDraw.DrawText(&dc, Out, f, Calc, 0, &Ed, &m_imgs,¶ms); dc.FillSolidRect(Calc,ActionBG); //We may be hovering over something. CPoint mouse; GetCursorPos(&mouse); Ed.ScreenToClient(&mouse); if(Calc.PtInRect(mouse) && m_select(&Ed)) { for(int p = 0; p < params.size(); p++) for(int d = 0; d < params[p]->displayrects.size(); d++) if(params[p]->displayrects[d].PtInRect(mouse)) { for(int a = 0; a < params[p]->displayrects.size(); a++) dc.FillSolidRect(params[p]->displayrects[a], RGB(100,255,100)); continue; } } // End hover Calc = Pos; Calc.bottom += m_rect(&Ed).Height(); // Get readable text g_HTMLDraw.DrawText(&dc, newtext, f, Calc, 0, &Ed, &m_imgs,¶ms); m_Readable = newtext.Right(newtext.GetLength() - newtext.ReverseFind(':')); Pos.bottom = Pos.top + Calc.Height(); if(m_select(&Ed)) dc.Draw3dRect(Calc,ACTION_BG_SEL2,ACTION_BG_SEL2); m_Anim.Space = Calc.Height(); } break; } m_visible = true; m_rect(&Ed) = Pos; if(renderType == 1) { Pos.InflateRect(3,3); m_rect(&Ed) = Pos; Pos.DeflateRect(3,3); } }
CString CEditorParam::CreateFormattedParamString(EventSheetEditor* pEd, CEditorAction* pAction, CEditorCondition* pCondition) { CApplication* pApp = pEd->application; CObjTypeMap& typemap = pApp->object_types; valid = true; CString ret; for( int a = 0; a < ttokens.size(); a++) { Token& tokenitem = ttokens[a]; if(tokenitem.t == T_IDENTIFIER && tokenitem.tsub == TT_OBJECTNAME) // object param { long number = tokenitem.oidOwner; CObjType* pType = pEd->application->FindObjTypeFromNumber(number); if(pType) { int specialvalue = 0; if(pAction) { pAction->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pAction->m_imgs.back(); image->tok = &tokenitem; specialvalue = pAction->m_imgs.size()-1; } if(pCondition) { pCondition->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pCondition->m_imgs.back(); image->tok = &tokenitem; specialvalue = pCondition->m_imgs.size()-1; } ret += pType->GetName(); ret += " <special_image>"; ret.AppendFormat("%d", specialvalue); ret += "</special_image> "; } else valid = false; //else - we need some sort of tempory name if we cant find one or the user could lose information! } else { CString string = tokenitem.str; string.Replace("&", "&"); string.Replace("<", "<"); string.Replace(">", ">"); if (tokenitem.t == T_STRINGLITERAL) string = CString("\"") + string + "\""; if (tokenitem.t == T_VARIABLENAME) { string = CString("'"); if(tokenitem.oidOwner == -1) { CApplication::GlobalVariable* global = pApp->GetGlobalVariable(tokenitem.id); if(global) string += global->name; else valid = false; } else if(CObjType* pType = pApp->FindObjTypeFromNumber(tokenitem.oidOwner)) { PrivateValue* Private = pType->GetPrivateVariable(tokenitem.id); if(Private) string += Private->name; else { // Not found; look up by name instead (valid expressions sometimes get here for families - AG) vector<PrivateValue>::iterator i = pType->m_PrivateValues.begin(); bool found = false; CString l = tokenitem.str; l.MakeLower(); for ( ; i != pType->m_PrivateValues.end(); i++) { CString r = i->name; r.MakeLower(); if (l == r) { found = true; string += i->name; break; } } if (!found) valid = false; } } else valid = false; //added to prevent family bug where deleting a family wont remove params refering to it string += "'"; } ret += string; } /* if(tokenitem.type == PTOK_COLOR) // for later when we have color tokens { int specialvalue = 0; if(pAction) { pAction->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pAction->m_imgs.back(); image->tok = &tokenitem; specialvalue = pAction->m_imgs.size()-1; } if(pCondition) { pCondition->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pCondition->m_imgs.back(); image->tok = &tokenitem; specialvalue = pCondition->m_imgs.size()-1; } ret += "<special_image>"; ret.AppendFormat("%d", specialvalue); ret += "</special_image> "; } */ } // Okay we have now recreated our token and everything...lets check what type of parameter it is! // Final step: if(m_type == 9 || m_type == 15) { CString formatted; formatted.Format("<b>%s</b>", m_reserved); return formatted; } // Private variable if(m_type == 14) { int varid = atoi(ret); CObjType* pType = pApp->FindObjTypeFromNumber(this->oid); if(pType) { for(vector<PrivateValue>::iterator v = pType->m_PrivateValues.begin(); v!= pType->m_PrivateValues.end(); v++) { if(v->identifier == varid) { CString formatted; formatted.Format("'%s'", v->name); return formatted; } } } } // Global variable if (m_type == 13) { int varid = atoi(ret); for(list<CApplication::GlobalVariable>::iterator v = pApp->global_variables.begin(); v != pApp->global_variables.end(); v++) { if(v->identifier == varid) { CString formatted; formatted.Format("'%s'", v->name); return formatted; } } } if(m_type == 6) // object..translate the parameter to a new number { int id = atoi(ret); CString newstring; newstring.Format("%d", id); if(ret == newstring) // will fail if its an attribute { /* int iconid; if(!pEd->m_familyhbitmaps.Lookup(id, iconid)) pEd->m_objecthbitmaps.Lookup(id, iconid); ret.Format("<img>%d</img>", iconid); */ long number = atol(ret); CObjType* pType; if(pType = pApp->FindObjTypeFromNumber(number)) { int specialvalue = 0; if(ttokens[0].t == T_INTEGER) { // ttokens[0].tsub = TT_OBJECTNAME; // ttokens[0].t = T_IDENTIFIER; ttokens[0].oidOwner = number; ttokens[0].id = number; //ttokens[0].trans = false; } if(pAction) { pAction->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pAction->m_imgs.back(); image->tok = &ttokens[0]; specialvalue = pAction->m_imgs.size()-1; } if(pCondition) { pCondition->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pCondition->m_imgs.back(); image->tok = &ttokens[0]; specialvalue = pCondition->m_imgs.size()-1; } ret = "<b>"; ret += pType->GetName(); ret += "</b>"; ret += " <special_image>"; ret.AppendFormat("%d", specialvalue); ret += "</special_image> "; return ret; } else valid = false; } else { // attribute.. } return ret; } if(m_type == 3) // colors { int id = atoi(ret); CString newstring; newstring.Format("%d", id); ttokens[0].t = T_COLOR; if(ret == newstring) // will fail if its an attribute { int specialvalue = 0; if(pAction) { pAction->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pAction->m_imgs.back(); image->tok = &ttokens[0]; image->tok->id = atoi(image->tok->str); specialvalue = pAction->m_imgs.size()-1; } if(pCondition) { pCondition->m_imgs.push_back(CEditorImage()); CEditorImage* image = &pCondition->m_imgs.back(); image->tok = &ttokens[0]; image->tok->id = atoi(image->tok->str); specialvalue = pCondition->m_imgs.size()-1; } ret = "<special_image>"; ret.AppendFormat("%d", specialvalue); ret += "</special_image> "; return ret; } } // otherwise just return ret ;p CString format; format.Format("<i>%s</i>", ret); return format; }
CString CEditorParam::CreateParamString(CApplication* pApp) { CObjTypeMap& typemap = pApp->object_types; CString ret; valid = true; vector<Token>::iterator i = ttokens.begin(); vector<Token>::iterator ttokens_end = ttokens.end(); ttokens_end = ttokens.end(); for ( ; i != ttokens_end; i++) { switch (i->t) { case T_IDENTIFIER: switch (i->tsub) { case TT_OBJECTNAME: { if(CObjType* pType = pApp->FindObjTypeFromNumber(i->oidOwner)) ret += pType->GetName(); else valid = false; break; } case TT_FAMILYNAME: ret += i->str; break; case TT_MOVEMENTNAME: { CObjType* pType; CBehavior* pMov; if(pType = pApp->FindObjTypeFromNumber(i->oidOwner)) ret += pType->GetName(); else { valid = false; break; } ret += "["; if (pMov = pType->GetBehaviorByUniqueID(i->id)) ret += pMov->Text + "]"; else valid = false; break; } case TT_NORMAL: ret += i->str; break; } break; case T_VARIABLENAME: ret += "'"; if(i->oidOwner == -1) { CApplication::GlobalVariable* pGlobal = pApp->GetGlobalVariable(i->id); if(pGlobal) ret += pGlobal->name; else valid = false; } else if(CObjType* pType = pApp->FindObjTypeFromNumber(i->oidOwner)) { PrivateValue* pValue = pType->GetPrivateVariable(i->id); if(pValue) ret += pValue->name; else valid = false; } ret += "'"; break; case T_STRINGLITERAL: ret += "\""; ret += i->str; ret += "\""; break; default: ret += i->str; break; } } return ret; // Davos code //CString ret; //for( int a = 0; a < tokens.size(); a ++) //{ // CEditorParamToken tokenitem = tokens[a]; // if(tokenitem.trans) // { // if(tokenitem.type == 0) // normal // ret += tokenitem.tok; // else if(tokenitem.type == 1) // object name // { // // long number = atol(tokenitem.tok); // CObjType* pType; // // if(typemap.Lookup(number,pType)) // ret += pType->m_name; // //else - we need some sort of tempory name if we cant find one or the user could lose information! // } // // // // // else if(tokenitem.type == 2) // family // { // ret += tokenitem.tok; // /* // long number = atol(tokenitem.tok); // //list<CFamily>::iterator i = pApp->m_Families.begin(); // //advance(i, number); // CFamily* i = pApp->FindFamilyFromNumber(number); // // TODO error checking...what if a family is removed? // ret += i->m_Name; // */ // } // else // ret += tokenitem.tok; // } // // else // { // ret += tokenitem.tok; // } //} //// TODO: Reform objectID tokens into object name //return ret; }
void ObjectBarDialog::OnDblClickObject(NMHDR *pNMHDR, LRESULT *pResult) { POSITION Pos = objects.GetFirstSelectedItemPosition(); int Item = objects.GetNextSelectedItem(Pos); if (Item == -1) return; CObjType* pType; long ID = objects.GetItemData(Item); if (ID == -1) // object folder { if (folderfilter == -1) //Default folder { for(int i=0; i < application->object_folders.size(); i++) { if (objects.GetItemText(Item,0) == application->object_folders[i].name) { folderfilter=i; break; } } } else //return folder { folderfilter = -1; } Refresh(); return; } application->object_types.Lookup(ID, pType); if (!pType) return; // If layout editor open.. if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2) { POSITION ObjectPos = layout->objects.GetStartPosition(); CObj* pObject; long ID = 0; for (int i = 0; i < layout->objects.GetCount(); i++) { layout->objects.GetNextAssoc(ObjectPos, ID, pObject); CObjType* type = pObject->GetObjectType(application); if (type->ObjectIdentifier == pType->ObjectIdentifier) { OINFO* info = GetOINFO(pType->DLLIndex); if(info->ETOnNotify) info->ETOnNotify(pObject->editObject, 1); return; } } } // If event sheet editor, see if it has conditions. If so, open Event Wizard if ((parent.m_tabs.SelectionGet() == 1) && (parent.m_tabs.ItemGetCount() == 2) || parent.m_tabs.ItemGetCount() == 1) { bool bUse = false; for (int i = 0; i < pType->GetTableCount(CONDITION); i++) { ACESEntry2* pAce = pType->GetACESEntry(CONDITION, i); if(pAce == NULL || pAce->aceListName == "") continue; // Ignore null entries bUse = true; } if (bUse) { parent.m_pEventView[0][0]->m_InitialStage = 2; parent.m_pEventView[0][0]->m_InitialSelect = ID; parent.m_pEventView[0][0]->m_OldName = pType->GetName(); parent.m_pEventView[0][0]->AddCondition(true); } } }
// OnRClick(NMHDR* pNMHDR, LRESULT* pResult) // Handle right clicking an object and inserting an expression. void CParametersDlg::OnDblClick(NMHDR* pNMHDR, LRESULT* pResult) { POSITION listpos = m_Expand.GetFirstSelectedItemPosition(); int item = m_Expand.GetNextSelectedItem(listpos); //if(item == -1) return; CObjType* pObjType = (CObjType*)m_Expand.GetItemData(item); CEventWizardDlg EventWizard; EventWizard.m_aceType = EXPRESSION; EventWizard.layout = layout; EventWizard.application = application; if(pObjType){ EventWizard.m_pSelectedObject = pObjType->ObjectIdentifier; EventWizard.m_iStep = 2; } else EventWizard.m_iStep = 1; EventWizard.SetMap(&application->object_types); if(EventWizard.DoModal() != IDOK) return; // The user can click Back and get a different object's expression, so make sure we're using the current one. pObjType = application->FindObjTypeFromNumber(EventWizard.m_pSelectedObject); int aceIndex = EventWizard.m_aceIndex; int mID = EventWizard.m_childid; CObjType tmp; CObjType *pInfoType = NULL; if(mID == -1) pInfoType = pObjType; CBehavior* pMov = NULL; CEffect* pEffect = NULL; // there are no effect expressions but perhaps in the future... if(mID < -1) { pInfoType = &tmp; pEffect = pObjType->GetEffect(-mID); tmp.CreateFromEffect(pEffect); } if(mID > -1) { pInfoType = &tmp; pMov = pObjType->GetBehaviorByUniqueID(mID); tmp.CreateFromBehavior(pMov); } if(!pInfoType) return; ACESEntry2* pACE = pInfoType->GetACESEntry(EXPRESSION, aceIndex); if (pWndFocusParam == NULL) return; CString Func; if(pObjType->ObjectIdentifier == -1) { Func.Format("%s", pACE->aceDisplayText); if (pACE->auxStr != "") { Func += "("; Func += pACE->auxStr; Func += ")"; } } else { if(pMov) { Func.Format("%s[%s].%s", pObjType->GetName(), pMov->Text, pACE->aceDisplayText); if (pACE->params.size() != 0) { Func += "("; for (int i = 0; i < pACE->params.size(); i++) { Func += pACE->params[i].name; if (i != (pACE->params.size() - 1)) Func += ", "; } Func += ")"; } } else { // Starts with <: interpret as shortcut for other expression eg. <MouseX> if (pACE->aceDisplayText.Left(1) == "<") { Func = pACE->aceDisplayText.Mid(1, pACE->aceDisplayText.GetLength() - 2); } else { Func = pObjType->GetName(); // Allow expressions to specify object name like 'Counter' if (pACE->aceDisplayText != "") { // Allow expressions to specify an ACE name like "(x,y,z)" eg. Array(x,y,z) if (pACE->aceDisplayText.Left(1) != "(") Func += "."; Func += pACE->aceDisplayText; } if (pACE->params.size() != 0) { Func += "("; // okay loop params, add name and , for (int i = 0; i < pACE->params.size(); i++) { Func += pACE->params[i].name; //only add if liek not last 0ne if (i != (pACE->params.size() - 1)) Func += ", "; } Func += ")"; } } } } pWndFocusParam->SendMessage(SCI_REPLACESEL, 0, (LPARAM)(const char*)Func); *pResult = 0; }
// Initialise the dialog // BOOL CEventWizardDlg::OnInitDialog() { // Startup CDialog::OnInitDialog(); int currentPosition = 1; // Create an m_ObjectImages m_ObjectImages.DeleteImageList(); bool bSmallImages = false; // Check what size images we'll need // 32x32 without families or 16x16 with if (application->families.size() == 0) { m_ObjectImages.Create(32, 32, ILC_COLOR24, 3, 3); m_List.SetImageList(&m_ObjectImages, LVSIL_NORMAL); HBITMAP SystemBitmap = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_SYSTEM)); ImageList_Add(m_ObjectImages, SystemBitmap, SystemBitmap); DeleteObject(SystemBitmap); } else { // If it's small, also set the view to small images m_List.SetView(LV_VIEW_SMALLICON); m_ObjectImages.Create(16, 16, ILC_COLOR24, 3, 3); m_List.SetImageList(&m_ObjectImages, LVSIL_SMALL); HBITMAP SystemBitmap = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_SYSTEMC)); ImageList_Add(m_ObjectImages, SystemBitmap, SystemBitmap); DeleteObject(SystemBitmap); bSmallImages = true; } // Prepare to iterate all objects to add icons POSITION pos = objMap->GetStartPosition(); long mapKey; CObjType* ObjectType; // Add '(System)' because system uses it object_folders["(System)"] = 0; // Loop through and add all objects to the otList while (pos != NULL) { objMap->GetNextAssoc(pos, mapKey, ObjectType); if(!ObjectType->m_bIsGroupType) { CObj *o; bool bAdd = false; // If global, its okay to add...if its not global..and we have a layout...we need to check if (ObjectType->m_bGlobal) { bAdd = true; } else if(layout) { POSITION pos = layout->objects.GetStartPosition(); for (int i = 0; i < layout->objects.GetCount(); i++) { long ID; layout->objects.GetNextAssoc(pos, ID, o); if (o->GetGlobalID() == ObjectType->ObjectIdentifier) { bAdd = true; } } } else // we have no layout to this event sheet { bAdd = true; } // Dont add if it doesn't have conditions/actions bool hasAces = false; for (int i = 0; i < ObjectType->GetTableCount(m_aceType); i++) { if (ObjectType->GetACESEntry(m_aceType, i)->aceListName == "") { hasAces = true; break; } if (hasAces) break; } if(!hasAces) bAdd = false; // Okay cool...look like its okay to add...just check if is showabout in the event sheet editor if(bAdd && ObjectType->m_bShowInEventSheetEditor) { // Possibly add a new category if(object_folders.find(ObjectType->GetFolder()) == object_folders.end()) { object_folders[ObjectType->GetFolder()] = object_folders.size(); } m_otList.push_back(ObjectType); } } } // Sort sort(m_otList.begin(), m_otList.end(), ObjTypeSortFunction); // Now loop the otList backwards to display each object icon for(vector<CObjType*>::iterator i = m_otList.begin(); i != m_otList.end(); i++) { HBITMAP Bitmap; if (bSmallImages) Bitmap = (*i)->small_image.MakeBitmap(); else Bitmap = (*i)->m_Image.MakeBitmap(); ImageList_Add(m_ObjectImages, Bitmap, Bitmap); DeleteObject(Bitmap); } pos = objMap->GetStartPosition(); // Family icons list<Family>::iterator f = application->families.begin(); for ( ; f != application->families.end(); f++) { if(f->is_in_use) { HBITMAP Bitmap = f->small_image.MakeBitmap(); ImageList_Add(m_ObjectImages, Bitmap, Bitmap); DeleteObject(Bitmap); } } // Title CString Title; if (m_aceType == CONDITION) Title.Format("Construct : New condition"); else if (m_aceType == ACTION) Title.Format("Construct : New action"); else if (m_aceType == EXPRESSION) Title.Format("Construct : New expression"); SetWindowText(Title); CRect Rect; m_ACEList.GetWindowRect(&Rect); ScreenToClient(&Rect); Rect.top = Rect.bottom - 1; Rect.bottom = Rect.top + 18; m_CategoryTabs.Create(this, Rect, 1001, WS_CHILD | WS_VISIBLE, __ETWS_ORIENT_BOTTOM); m_ACEList.GetWindowRect(&Rect); ScreenToClient(&Rect); Rect.top -= 17; Rect.bottom = Rect.top + 18; m_Tabs.Create(this, Rect, 1002, WS_CHILD | WS_VISIBLE, __ETWS_ORIENT_TOP); GetClientRect(&Rect); Rect.bottom = Rect.top + 22; Rect.right += 48; // Resizing anchors BOOL First = dlgMan.Load(this->m_hWnd, "Software\\Construct\\EventWizardDialogs"); if (!First) { first_run.Attach(this); first_run.SetHighlightOnMouseOver(); first_run.SetResize(); first_run.SetWrapText(); if (m_aceType == ACTION) first_run.SetText("Events are created via this wizard. Choose an object from the list below. A list of actions will then appear, some of which require parameters: for example 'Create object' under System. Once all parameters are filled out, click Finish to insert your action."); if (m_aceType == CONDITION) first_run.SetText("Events are created via this wizard. Choose an object from the list below. A list of conditions will then appear, some of which require parameters: for example 'Compare' under System. Once all parameters are filled out, click Finish to insert your condition."); } dlgAnchor.Init(this->m_hWnd); dlgAnchor.Add(IDC_OBJECTLIST, ANCHOR_TOPLEFT | ANCHOR_BOTTOMRIGHT); dlgAnchor.Add(IDC_ACELIST, ANCHOR_TOPLEFT | ANCHOR_BOTTOMRIGHT); dlgAnchor.Add(IDC_FIND, ANCHOR_TOP | ANCHOR_RIGHT); dlgAnchor.Add(1001, ANCHOR_LEFT | ANCHOR_BOTTOMRIGHT); dlgAnchor.Add(1002, ANCHOR_TOPLEFT | ANCHOR_RIGHT); dlgAnchor.Add(1003, ANCHOR_TOPLEFT | ANCHOR_RIGHT); dlgAnchor.Add(IDC_BACK, ANCHOR_BOTTOM | ANCHOR_RIGHT); dlgAnchor.Add(IDC_CANCEL, ANCHOR_BOTTOM | ANCHOR_LEFT); dlgAnchor.Add(IDC_NEXT, ANCHOR_BOTTOM | ANCHOR_RIGHT); m_Cancel.SetWindowText(CANCEL); // Set ACE margins CRect ListRect; m_ACEList.GetClientRect(&ListRect); ListRect.left += 5; ListRect.top += 5; m_ACEList.SetWorkAreas(1, &ListRect); m_ACEList.SetColumnWidth(0, 200); // Spaces everything out nicely for step 2. int initStep = m_iStep; if (m_InitialStage == 0) { m_iStep = 1; ChangeStep(); } else { // New to 0.96.3 m_pSelectedObject = m_InitialSelect; initStep = 2; } // The below is used so we set the default selected items (eg. if we are editing) if(m_pSelectedObject != -2) { // Have an object already selected for(int i = 0; i < m_List.GetItemCount(); i++) if(m_List.GetItemData(i) == m_pSelectedObject) m_List.SetItemState(i,LVIS_SELECTED, LVIS_SELECTED); } if(m_aceIndex != -1) { PreChangeStep(); m_iStep = 2; int aceIndex = m_aceIndex; ChangeStep(); if(m_childid != 0) { CObjType* pType = application->FindObjTypeFromNumber(m_pSelectedObject); if(pType) { int index = 1; list<CBehavior>::iterator i = pType->behaviors.begin(); list<CBehavior>::iterator end = pType->behaviors.end(); for(; i!= end; i++) { if(i->id == m_childid) { m_Tabs.SelectionSet(index); break; } index ++; } list<CEffect>::iterator e = pType->effects.begin(); for(;e!= pType->effects.end(); e++) { if(e->m_effectID == -m_childid) m_Tabs.SelectionSet(index); index ++; } } ChangeStep(); } m_aceIndex = aceIndex; for(int i = 0; i < m_ACEList.GetItemCount(); i++) { if(m_ACEList.GetItemData(i) == m_aceIndex) m_ACEList.SetItemState(i,LVIS_SELECTED, LVIS_SELECTED); } } if(initStep != m_iStep) { PreChangeStep(); m_iStep = initStep; ChangeStep(); } UpdateButtons(); // Expression dialogs will move slightly to make it clear it's on top of the existing parameters dialog. if (m_aceType == EXPRESSION) { RECT rc; this->GetWindowRect(&rc); rc.left += 50; rc.top += 50; this->SetWindowPos(NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE); } // New drawing code LOGFONT* m_pLF; m_pLF=(LOGFONT*)calloc(1,sizeof(LOGFONT)); strncpy(m_pLF->lfFaceName,"Segoe UI",9); m_pLF->lfHeight=14; m_pLF->lfWeight=600; m_pLF->lfItalic=0; m_pLF->lfUnderline=0; m_FontBold.CreateFontIndirect(m_pLF); m_pLF->lfWeight = 0; m_Font.CreateFontIndirect(m_pLF); m_Find.SetIcon(IDI_SEARCH); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CEventWizardDlg::UpdateButtons() { if(m_iStep == 1) { int sel = m_List.GetSelectedItem(); m_Next.SetWindowText("Next"); if(sel == -1) m_Next.EnableWindow(FALSE); else m_Next.EnableWindow(); m_Back.EnableWindow(FALSE); } if(m_iStep == 2) { int sel = m_ACEList.GetSelectedItem(); if(sel == -1) //nothing selected... { m_Next.SetWindowText("Next"); m_Next.EnableWindow(false); } else { aceIndex = m_ACEList.GetItemData(sel); CObjType* pType = application->FindObjTypeFromNumber(m_pSelectedObject); ACESEntry2* pACE = NULL; if(pType) { int sel = m_Tabs.SelectionGet(); if(sel == 0) // object { m_childid = -1; pACE = pType->GetACESEntry(m_aceType, aceIndex); } else if(sel <= pType->behaviors.size()) { list<CBehavior>::iterator i = pType->behaviors.begin(); advance(i, sel-1); m_childid = i->id; CObjType tmp; tmp.CreateFromBehavior(&*i); pACE = tmp.GetACESEntry(m_aceType, aceIndex); } else { sel -= pType->behaviors.size() + 1; list<CEffect>::iterator i = pType->effects.begin(); advance(i, sel); m_childid = -i->m_effectID; CObjType tmp; tmp.CreateFromEffect(&*i); pACE = tmp.GetACESEntry(m_aceType, aceIndex); } } if (pACE != NULL) { if (pACE->params.size() == 0 || m_aceType == EXPRESSION) m_Next.SetWindowText("Finish"); } else m_Next.SetWindowText("Next"); m_Next.EnableWindow(); } m_Back.EnableWindow(); } if(m_iStep == 3) { m_Next.SetWindowText("Finish"); m_Next.EnableWindow(); m_Back.EnableWindow(); } }
CAction* CLayoutEditor::PerformAction(CAction *action, BOOL bRepeat) { // variables long id, gid, prevObj, objLayer; long i, oid; CLayer *lyr; CObj *o, *o2; CObjType *oT; CObjList objs; CString text; BOOL b, tb; BOOL bMoreInstances; POSITION pos, pos2; g_pLayoutView = this; g_pFrame = layout; g_pApp = application; long tid, tprevObj, tobjLayer, tglobalID; // do stuff CArchive *ar = action->Unprepare1(); CAction *actionNew = new CAction(); if (bRepeat) actionNew->m_bGroup = FALSE; CArchive *arNew = actionNew->Prepare1(); switch (action->m_type) { case ACTION_MOVESIZE: *ar >> id; o = GetObject(id); // START UNDO INFO // actionNew->m_type = ACTION_MOVESIZE; tid = o->GetInstanceID(); *arNew << tid; o->Serialize(*arNew); // END UNDO INFO // o->Serialize(*ar); InitializeObject(o); g_PropertyBar->Update(this, TYPE_OBJECT, &m_sel, layout, &layout->objects, application); // show object props break; case ACTION_CHANGETYPE: *ar >> id; // START UNDO INFO // actionNew->m_type = ACTION_CHANGETYPE; *arNew << id; application->object_types[id]->Serialize(*arNew); // END UNDO INFO // application->object_types[id]->Serialize(*ar); g_PropertyBar->Update(this, TYPE_OBJECT, &m_sel, layout, &layout->objects, application); // show object props break; case ACTION_CHANGELAYER: *ar >> id; pos = layout->layers.GetHeadPosition(); for (i = 0; i < layout->layers.GetCount(); i++) { lyr = layout->layers.GetPrev(pos); if( lyr->m_layerID == id) break; } // START UNDO INFO // actionNew->m_type = ACTION_CHANGELAYER; *arNew << id; lyr->Serialize(*arNew); // END UNDO INFO // lyr->Serialize(*ar); g_PropertyBar->Update(this, TYPE_LAYER, &m_sel, layout, &layout->objects, application, 0, lyr); // show object props break; case ACTION_SETVISIBLE: *ar >> id >> b; o = GetObject(id); // START UNDO INFO // actionNew->m_type = ACTION_SETVISIBLE; tid = o->GetInstanceID(); tb = !b; *arNew << tid << tb; // END UNDO INFO // o->SetVisible(b); break; case ACTION_SETLOCK: *ar >> id >> b; o = GetObject(id); // START UNDO INFO // actionNew->m_type = ACTION_SETLOCK; tid = o->GetInstanceID(); tb = !b; *arNew << tid << tb; // END UNDO INFO // o->SetVisible(b); break; case ACTION_CHANGEZORDER: // START UNDO INFO // actionNew->m_type = ACTION_CHANGEZORDER; this->SerializeAllZLists(arNew); // END UNDO INFO // SerializeAllZLists(ar); g_pLayerBar->m_layerDlg.RefreshLayers(); // we need to tell the layer dlg to refresh or something! break; case ACTION_CREATE: { *ar >> id >> objLayer >> prevObj; o = new CObj(); o->Serialize(*ar); if(objLayer!= -1 && prevObj != -1) //group items dont go into the zorder { if(objLayer >= 0) { pos = layout->layers.GetHeadPosition(); for (i = 0; i < layout->layers.GetCount(); i++) { lyr = layout->layers.GetNext(pos); if (lyr->m_layerID == objLayer) { lyr->m_zOrder.InsertAfter(lyr->m_zOrder.FindIndex(prevObj), id); break; } } } else { CObj* group = layout->GetObj(-objLayer); // layer is negative for object groups group->m_groupObjects.InsertAfter(group->m_groupObjects.FindIndex(prevObj), id); break; } } InitializeObject(o); layout->objects[id] = o; // START UNDO INFO // actionNew->m_type = ACTION_DELETE; tid = o->GetInstanceID(); *arNew << tid; // END UNDO INFO // pMainWnd->ObjectTypesChanged(); g_PropertyBar->Update(this, TYPE_LAYOUT, NULL, layout, NULL, application); } g_pLayerBar->m_layerDlg.RefreshLayers(); break; case ACTION_CREATETYPE:// long ObjectIdentifier, CObjType oT, long id, layer, prevobjid, CObj o { *ar >> gid; oT = new CObjType(); oT->Serialize(*ar); application->object_types[gid] = oT; *ar >> id >> objLayer >> prevObj; o = new CObj(); o->Serialize(*ar); if(objLayer!= -1 && prevObj != -1) //group items dont go into the zorder { if(objLayer >= 0) { pos = layout->layers.GetHeadPosition(); for (i = 0; i < layout->layers.GetCount(); i++) { lyr = layout->layers.GetNext(pos); if (lyr->m_layerID == objLayer) { lyr->m_zOrder.InsertAfter(lyr->m_zOrder.FindIndex(prevObj), id); break; } } } else { CObj* group = layout->GetObj(-objLayer); // layer is negative for object groups group->m_groupObjects.InsertAfter(group->m_groupObjects.FindIndex(prevObj), id); break; } } layout->objects[id] = o; // We need to call initialize! InitializeObject(o); // START UNDO INFO // actionNew->m_type = ACTION_DELETE; tid = o->GetInstanceID(); *arNew << tid; // END UNDO INFO // g_PropertyBar->Update(this, TYPE_LAYOUT, NULL, layout, NULL, application); } pMainWnd->ObjectTypesChanged(); g_pLayerBar->m_layerDlg.RefreshLayers(); break; case ACTION_DELETE: { *ar >> id; o = GetObject(id); if(!o) return 0; // this actually happens in groups sometimes but is now accounted for tglobalID = o->GetGlobalID(); // remove from zorder lyr = GetObjectLayer(id); if(lyr) { pos2 = lyr->m_zOrder.Find(id); tprevObj = lyr->m_zOrder.GetPrev(pos2); tobjLayer = lyr->m_layerID; lyr->m_zOrder.RemoveAt(lyr->m_zOrder.Find(id)); } else if(o->m_bInGroup) { pos2 = o->m_group->m_groupObjects.Find(id); tprevObj = o->m_group->m_groupObjects.GetPrev(pos2); tobjLayer = 0 - o->m_group->GetInstanceID(); // we use negative values of the instance id of objects o->m_group->m_groupObjects.RemoveAt(o->m_group->m_groupObjects.Find(id)); } bMoreInstances = FALSE; // check if any more instances exist pos = layout->objects.GetStartPosition(); long nKey; while (pos != NULL) { layout->objects.GetNextAssoc(pos, nKey, o2); if (o2->GetGlobalID() == tglobalID && o2->GetInstanceID() != id) { bMoreInstances = TRUE; break; } } if (bMoreInstances == FALSE) // no more exist, delete object type { CObjType* oT = application->object_types[tglobalID]; // START UNDO INFO // actionNew->m_type = ACTION_CREATETYPE; *arNew << tglobalID; //object type oT->Serialize(*arNew); long tid = o->GetInstanceID(); //object *arNew << tid << tobjLayer << tprevObj; o->Serialize(*arNew); // END UNDO INFO // //delete oT; application->m_DeletedObjectTypes[tglobalID] = application->object_types[tglobalID]; application->object_types.RemoveKey(tglobalID); if (oT->tree) { pMainWnd->project_bar.tree.DeleteItem(oT->tree); oT->tree = NULL; } } else { // START UNDO INFO // actionNew->m_type = ACTION_CREATE; long tid = o->GetInstanceID(); *arNew << tid << tobjLayer << tprevObj; o->Serialize(*arNew); // END UNDO INFO // } // okay time to recursively kill ! pos = o->m_groupObjects.GetHeadPosition(); //CObj *o2; for (int k = 0; k < o->m_groupObjects.GetCount(); k++) { long groupitemid = o->m_groupObjects.GetNext(pos); DeleteObjectRecursive(groupitemid); // basically the serialization function automatically saves all the children items. We want to // delete them but not back them up...thats where the DeleteOBjectRecursive function is handy :) } delete o; layout->objects.RemoveKey(id); pMainWnd->ObjectTypesChanged(); g_pLayerBar->m_layerDlg.RefreshLayers(); g_PropertyBar->Update(this, TYPE_LAYOUT, NULL, layout, NULL, application); } break; case ACTION_GROUP: *ar >> gid; objs.Serialize(*ar); m_sel.RemoveAll(); pos = objs.GetHeadPosition(); for (i = 0; i < objs.GetCount(); i++) { id = objs.GetNext(pos); m_sel.AddTail(id); } // taken from GroupSel(), penis removed // o2 = GetObject(gid); pos = m_sel.GetHeadPosition(); for (i = 0; i < m_sel.GetCount(); i++) { // loop through selected objects o = GetObject(m_sel.GetNext(pos)); if (o->m_bInGroup == FALSE) { // selected object is not in another [open] group o->m_bInGroup = TRUE; o->m_group = o2; lyr = GetObjectLayer(o->GetInstanceID()); tid = o->GetInstanceID(); if(lyr) { lyr->m_zOrder.RemoveAt(lyr->m_zOrder.Find(tid)); // move object from its layer to the group } o2->m_groupObjects.AddTail(tid); } } // START UNDO INFO // actionNew->m_type = ACTION_UNGROUP; *arNew << gid; // END UNDO INFO // g_pLayerBar->m_layerDlg.RefreshLayers(); break; case ACTION_UNGROUP: *ar >> gid; o = GetObject(gid); // START UNDO INFO // actionNew->m_type = ACTION_GROUP; *arNew << gid; o->m_groupObjects.Serialize(*arNew); // END UNDO INFO // //BLOCK: UNGROUP // remove from zorder // CObj *o2; //POSITION pos2; CLayer *lyr; if (!o->m_bInGroup) { lyr = GetObjectLayer(gid); if(!lyr) { CErrorDlg Error; Error.Error("Error in undo", "In ACTION_UNGROUP we were unable to work out what layer the group was on. Please report this to scirra"); return 0; } pos2 = lyr->m_zOrder.Find(gid); // get location in layer to put group objects } pos = o->m_groupObjects.GetHeadPosition(); for (int j = 0; j < o->m_groupObjects.GetCount(); j++) { o2 = GetObject(o->m_groupObjects.GetNext(pos)); if (o->m_bInGroup) o2->m_group = o->m_group; else { o2->m_bInGroup = FALSE; o2->m_group = NULL; id = o2->GetInstanceID(); lyr->m_zOrder.InsertAfter(pos2, id); } } o->m_groupObjects.RemoveAll(); /* // taken from Ungroup(), penis removed // if (!o->m_bInGroup) { lyr = GetObjectLayer(gid); if(!lyr) { CErrorDlg Error; Error.Error("Error in undo", "In ACTION_UNGROUP we were unable to work out what layer the group was on. Please report this to scirra"); return 0; } pos2 = lyr->m_zOrder.Find(gid); // get location in layer to put group objects } pos = o->m_groupObjects.GetHeadPosition(); for (i = 0; i < o->m_groupObjects.GetCount(); i++) { o2 = GetObject(o->m_groupObjects.GetNext(pos)); if (o->m_bInGroup) o2->m_group = o->m_group; else { o2->m_bInGroup = FALSE; o2->m_group = NULL; id = o2->GetInstanceID(); lyr->m_zOrder.InsertAfter(pos2, id); } } o->m_groupObjects.RemoveAll(); { // this allows us to remove the group type and the group object - davo // CUndo* temp = m_undo; // m_undo = 0; //DeleteObject(gid); // m_undo = temp; }*/ g_pLayerBar->m_layerDlg.RefreshLayers(); break; case ACTION_GROUPOPEN: *ar >> id >> b; o = GetObject(id); // START UNDO INFO // actionNew->m_type = ACTION_GROUPOPEN; tid = o->GetInstanceID(); tb = !b; *arNew << tid << tb; // END UNDO INFO // o->m_bGroupOpen = b; g_pLayerBar->m_layerDlg.RefreshLayers(); break; case ACTION_GROUPREMOVE: *ar >> gid >> oid >> objLayer >> prevObj; // START UNDO INFO // actionNew->m_type = ACTION_GROUPADD; *arNew << gid << oid; // END UNDO INFO // o = GetObject(oid); o2 = GetObject(gid); o->m_groupObjects.RemoveAt(o->m_groupObjects.Find(oid)); o->UpdateGroupInfo(FALSE); o2->m_bInGroup = FALSE; o2->m_group = NULL; for (i = 0; i < layout->layers.GetCount(); i++) { lyr = layout->layers.GetNext(pos); if (lyr->m_layerID == objLayer) { lyr->m_zOrder.InsertAfter(lyr->m_zOrder.FindIndex(prevObj), oid); break; } } g_pLayerBar->m_layerDlg.RefreshLayers(); break; case ACTION_GROUPADD: *ar >> gid >> oid; o = GetObject(oid); o2 = GetObject(gid); o->m_bInGroup = TRUE; o->m_group = o2; lyr = GetObjectLayer(oid); if(!lyr) { CErrorDlg Error; Error.Error("Error", "Unable to work out what layer the object is on in ACTION_GROUPADD, please report this to scirra"); return 0; } pos = lyr->m_zOrder.Find(oid); prevObj = lyr->m_zOrder.GetPrev(pos); // START UNDO INFO // actionNew->m_type = ACTION_GROUPREMOVE; *arNew << gid << oid << lyr->m_layerID << prevObj; // END UNDO INFO // lyr->m_zOrder.RemoveAt(lyr->m_zOrder.Find(oid)); o->m_group->m_groupObjects.AddTail(oid); g_pLayerBar->m_layerDlg.RefreshLayers(); break; } action->Unprepare2(); actionNew->Prepare2(); if(action == 0) { int a = 0; a --; } if(actionNew == 0) { int a = 0; a--; } return actionNew; }
void CParamScintilla::OnChar(NMHDR* pNMHDR, LRESULT* pResult,CScintillaWnd& scintWin, CObjTypeMap* objectMap, CParamTooltipCtrl& m_Tooltip, bool& m_ParameterTooltipIsVisible, bool& m_QuotesOpen, CApplication* pApp, bool bInline) { // This function is only for CScintilla... SCNotification *scn = (SCNotification*)pNMHDR; CString text; scintWin.GetWindowText(text); CString theChar = "a"; theChar.SetAt(0, scn->ch); ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSETSEPARATOR, '|', '|'); int carretPosition = scintWin.GetCurrentPosition(); text = text.Left(carretPosition); // everything to the right is irrelavant // Get last char if (scn->ch=='.') { // Get name of object // First we need to get the current char. text = text.Left(scintWin.GetCurrentPosition()); int pos = 0; char finds[] = " ()+-/*{},"; for(int a = 0; a < strlen(finds); a++) pos = max(pos, text.ReverseFind(finds[a])); CString name = text.Right(text.GetLength() - pos); name = name.Left(name.GetLength() - 1); if(pos!=0) name = name.Right(name.GetLength()-1); bool exists = true; { pApp->m_sort.RemoveAll(); CString intel; if (name != "System") { // Display intellisense // Loop m_TypeCheckerressions CObjType* oT; //POSITION pos = objectMap->GetStartPosition(); //long nKey; //while (pos != NULL) vector<CObjType*> objects; pApp->GetObjectTypes(objects); pApp->GetFamilyObjectTypes(objects); vector<CObjType*>::iterator i = objects.begin(); for(; i != objects.end(); i++) { oT = *i; //objectMap->GetNextAssoc(pos, nKey, oT); CString l = oT->GetName(); CString r = name; l.MakeLower(); r.MakeLower(); if (l == r) { // Enum m_TypeCheckerressions for (int i = 0; i < oT->GetTableCount(2); i++) { ACESEntry2* acesEntry = oT->GetACESEntry(2, i); if(acesEntry->aceDisplayText != "") pApp->m_sort.Add(acesEntry->aceDisplayText); } break; } } } else // System { for (int i = 0; i < GetSystemTableCount(2); i++) { ACESEntry2* ACE; GetSystemExpression(i, ACE); pApp->m_sort.Add(ACE->aceDisplayText); } } pApp->m_sort.Sort(); for (int i = 0; i < pApp->m_sort.GetSize(); i++) { intel += pApp->m_sort.GetAt(i); intel += "|"; } intel = intel.Left(intel.GetLength() - 1); if (intel != "") ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)intel); } } // Add: Check for inline editing, don't handle this if we are. 0.96.2 else if (scn->ch == '(' && !bInline) { if (m_ParameterTooltipIsVisible) { m_Tooltip.ShowWindow(SW_HIDE); m_ParameterTooltipIsVisible = false; } CString m_TypeCheckerressionName, ObjectName; // Get name of m_TypeCheckerression int pos = text.ReverseFind('.'); CString name = text.Right(text.GetLength() - pos - 1); int start = (text.GetLength() - pos) - 1; m_TypeCheckerressionName = name.Left(name.GetLength() - 1); // Get name of object CString object = text.Left(text.GetLength() - start); pos = object.ReverseFind(' '); name = object.Right(object.GetLength() - pos); ObjectName = name.Left(name.GetLength() - 1); ObjectName.Trim(); bool exists = true; bool alsoexists = false; if (ObjectName == "") ObjectName = "System"; if (exists) { vector<CString> setParams; m_Tooltip.FlushMethods(); if (ObjectName != "System") { CObjType* oT; POSITION pos = objectMap->GetStartPosition(); long nKey; while (pos != NULL) { objectMap->GetNextAssoc(pos, nKey, oT); CString l = oT->GetName(); CString r = ObjectName; l.MakeLower(); r.MakeLower(); if (l == r) { // Enum m_TypeCheckerressions for (int i = 0; i < oT->GetTableCount(2); i++) { ACESEntry2* acesEntry = oT->GetACESEntry(2, i); if (acesEntry->aceDisplayText == m_TypeCheckerressionName) { alsoexists = true; for (int x = 0; x < acesEntry->params.size();x++) { CString addParameter; // Check type if (acesEntry->params[x].type == 1) addParameter.Format("%s [number]", acesEntry->params[x].name); if (acesEntry->params[x].type == 2) addParameter.Format("%s [string]", acesEntry->params[x].name); setParams.push_back(addParameter); } } } break; } } } /*else { int numTableEntries = sizeof(SysExpIntellisenseTable) / sizeof(SysExpIntellisenseTable[0]); setParams.resize(0); for (int i = 0; i < numTableEntries; i++) { CString l = m_TypeCheckerressionName; CString r = SysExpIntellisenseTable[i].expname; l.MakeLower(); r.MakeLower(); if (l == r) { alsoexists = true; CString curParam; int paramNum = 0; do { AfxExtractSubString(curParam, SysExpIntellisenseTable[i].params, paramNum, ','); curParam.Trim(); if (curParam != "") setParams.push_back(curParam); paramNum++; } while (curParam != ""); m_Tooltip.AddMethod(m_TypeCheckerressionName, setParams); setParams.resize(0); } } }*/ if (alsoexists && !m_ParameterTooltipIsVisible) { // Get position of caret int currentPosition = scintWin.SendMessage(SCI_GETCURRENTPOS, 0, 0); int caretX = scintWin.SendMessage(SCI_POINTXFROMPOSITION, 0, 0); int caretY = scintWin.SendMessage(SCI_POINTXFROMPOSITION, 0, 0); if (ObjectName != "System") { CString sMethod; m_Tooltip.AddMethod(m_TypeCheckerressionName, setParams); } m_Tooltip.SetCurMethod(0); m_Tooltip.SetCurParam(0); m_Tooltip.ShowTooltip(CPoint(caretX, caretY)); m_ParameterTooltipIsVisible = true; m_QuotesOpen = false; } } } // Increment parameter count else if (scn->ch == ',' && !bInline) { //scintWin.SendMessage(SCI_AUTOCCOMPLETE, 0, 0); if (m_ParameterTooltipIsVisible && !m_QuotesOpen) m_Tooltip.ShowNextParam(); } // Hide parameter tooltip else if (scn->ch == ')' && !bInline) { //scintWin.SendMessage(SCI_AUTOCCOMPLETE, 0, 0); if (m_ParameterTooltipIsVisible) { m_Tooltip.ShowWindow(SW_HIDE); m_ParameterTooltipIsVisible = false; } } // Hide parameter tooltip else if (scn->ch == '"') { if (m_QuotesOpen) m_QuotesOpen = false; else m_QuotesOpen = true; } // Prompt variable names else if (scn->ch == '\'') { // Trim the right two (' chars eg. Sprite(' text = text.Left(text.GetLength() - 2); CString temp = text; temp.MakeReverse(); int index = temp.FindOneOf(" {}()+-*/"); if (index > -1) text = text.Right(index); // Now find if there's a dot to get the object name index = text.Find('.'); if (index > -1) text = text.Left(index); CObjType* pType = GetTypeFromName(pApp, text); if (pType != NULL) { CString varnames; vector<PrivateValue>::iterator i = pType->m_PrivateValues.begin(); vector<PrivateValue>::iterator end = pType->m_PrivateValues.end(); for ( ; i != end; i++) varnames += i->name + "|"; varnames = varnames.Left(varnames.GetLength() - 1); if (varnames != "") ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)varnames); } else{ if(text == "global") { CString varnames; list<CApplication::GlobalVariable>::iterator i = pApp->global_variables.begin(); list<CApplication::GlobalVariable>::iterator end = pApp->global_variables.end(); for ( ; i != end; i++) varnames += i->name + "|"; varnames = varnames.Left(varnames.GetLength() - 1); if (varnames != "") ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)varnames); } } } /*else { if(text.GetLength() == 2) { // Any other type of letter, display intellisense for system expressions and object names CString suggestions; int numTableEntries = sizeof(SysExpIntellisenseTable) / sizeof(SysExpIntellisenseTable[0]); for (int i = 0; i < numTableEntries; i++) { CString expression = SysExpIntellisenseTable[i].expname; suggestions += expression + "|"; } suggestions = suggestions.Left(suggestions.GetLength() - 1); if (suggestions != "") ::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)suggestions); } }*/ }
void CEventWizardDlg::UpdateDisplay(CString Previous, bool addTabs) { if (m_iStep == 1) { // Add objects in LVITEM InsertPlugin; // Mask: TEXT, IMAGE, LPARAM, STATE InsertPlugin.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE | LVIF_GROUPID; InsertPlugin.state = 0; InsertPlugin.stateMask = 0; InsertPlugin.iItem = 0; InsertPlugin.iSubItem = 0; InsertPlugin.iGroupId = 0; // Normal objects int index = 0; for(map<CString, int>::iterator i = object_folders.begin(); i!= object_folders.end(); i++) { m_List.AddGroup(i->second, i->first); index++; } int Icon = 1; // System object if (ApproveItem(SYSTEM)) { InsertPlugin.iImage = 0; InsertPlugin.iGroupId = object_folders["Object"]; InsertPlugin.pszText = new char[SYSTEM.GetLength() + 1]; strcpy(InsertPlugin.pszText, SYSTEM); ListView_InsertItem(m_List.m_hWnd, &InsertPlugin); if(SYSTEM == Previous) m_List.SetItemState(0,LVIS_SELECTED, LVIS_SELECTED); m_List.SetItemData(0, application->m_System.ObjectIdentifier); } // Now loop the otList backwards to display each object icon for(vector<CObjType*>::iterator i = m_otList.begin(); i != m_otList.end(); i++) { CString Name = (*i)->GetName(); if (ApproveItem(Name)) { InsertPlugin.iItem = ListView_GetItemCount(m_List.m_hWnd); InsertPlugin.iImage = Icon; InsertPlugin.pszText = Name.GetBuffer(Name.GetLength()); InsertPlugin.iGroupId = object_folders[(*i)->GetFolder()]; ListView_InsertItem(m_List.m_hWnd, &InsertPlugin); m_List.SetItemData(m_List.GetItemCount() - 1, (*i)->ObjectIdentifier); if((*i)->GetName() == Previous) m_List.SetItemState(m_List.GetItemCount() - 1, LVIS_SELECTED, LVIS_SELECTED); } // Increment icon number Icon++; } // Add families m_List.AddGroup(object_folders.size(), "Families"); bool bFamilies = false; list<Family>::iterator f = application->families.begin(); for ( ; f != application->families.end(); f++) { if(f->is_in_use) { bFamilies = true; if (ApproveItem(f->name)) { InsertPlugin.iItem = ListView_GetItemCount(m_List.m_hWnd); InsertPlugin.iImage = Icon; InsertPlugin.iGroupId = object_folders.size(); InsertPlugin.pszText = f->name.GetBuffer(f->name.GetLength()); ListView_InsertItem(m_List.m_hWnd, &InsertPlugin); m_List.SetItemData(m_List.GetItemCount() - 1, f->identifier); if(f->name == Previous) m_List.SetItemState(m_List.GetItemCount() - 1,LVIS_SELECTED, LVIS_SELECTED); } } Icon++; } if (!bFamilies && object_folders.size() <= 1) m_List.RemoveAllGroups(); else m_List.EnableGroups(); } else if (m_iStep == 2) { if (addTabs) { m_CategoryTabs.ItemInsert("All"); m_bOK = true; m_CategoryTabs.SelectionSet(0); //default m_bOK = false; } int index = 1; for(map<CString, int>::iterator i = categories.begin(); i != categories.end(); i++) { CString tabText = i->first; tabText.Replace("&", "&&"); if (addTabs) m_CategoryTabs.ItemInsert(tabText,0,0,0,index++); m_bOK = true; if(i->first == SelectedCategory && addTabs) m_CategoryTabs.SelectionSet(m_CategoryTabs.ItemGetCount()-1); m_bOK = false; m_ACEList.AddGroup(i->second, i->first); } m_ACEList.bold_items.clear(); // BOOM! The vector element pMov points to is nuked //CObjType* pType = application->FindObjTypeFromNumber(m_pSelectedObject); //pType = application->FindObjTypeFromNumber(m_pSelectedObject); CObjType* pType = step2_type; if(pType) { // Get all categories CObjType temp; if(pMov) { temp.CreateFromBehavior(pMov); pType = &temp; } if(pEff) { temp.CreateFromEffect(pEff); pType = &temp; } vector<SortedACE> aces; for (int i = 0; i < pType->GetTableCount(m_aceType); i++) { ACESEntry2* pAce = pType->GetACESEntry(m_aceType, i); if(pAce == NULL || pAce->aceListName == "") continue; // ignore null entries // Verify it meets the filter if (!ApproveItem(pAce->aceListName)) continue; CString category = pAce->aceCategory; if(SelectedCategory == "Common") { if(i >= 255) i = pType->GetTableCount(m_aceType); //skip anything about the first aces } else if(SelectedCategory != "All" && SelectedCategory != category) continue; // if its not the current category aces.push_back(SortedACE(pAce->aceListName, i, categories[category])); } // now sort sort(aces.begin(), aces.end()); for (int j = 0; j < aces.size(); j++) { // If *, bold it and remove star //MessageBox("fast bullets 3"); CString name = aces[j].name; if (aces[j].name.Left(1) == "*") { name = aces[j].name.Right(aces[j].name.GetLength() - 1); m_ACEList.InsertItem(j, name, NULL, aces[j].category); m_ACEList.bold_items[j] = true; } else { m_ACEList.InsertItem(j, name, NULL, aces[j].category); m_ACEList.bold_items[j] = false; } //MessageBox("fast bullets 4"); m_ACEList.SetItemData(j, aces[j].i); if(name == Previous) { m_ACEList.SetItemState(j, LVIS_SELECTED, LVIS_SELECTED); } //MessageBox("fast bullets 5"); //m_ACEList.SetItemState(j, LVIS_SELECTED, LVIS_SELECTED); } } } }
void ObjectBarDialog::Refresh(bool layer_changed) { // check for unnecessary refresh if (layer_changed && !show_only_selected_layer) return; // clear all lists objects.DeleteAllItems(); for (int i = 0; i < large_images.GetImageCount(); i++) large_images.Remove(0); for (int i = 0; i < small_images.GetImageCount(); i++) small_images.Remove(0); if(folderfilter > -1 && folderfilter >= application->object_folders.size()) folderfilter = -1; CObj* pObject; CObjType* pObjectType; CStringArray List; // Object list //object folders if (folderfilter == -1) { HBITMAP large_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT); HBITMAP small_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT); int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL); ImageList_Add(small_images.m_hImageList, small_image, NULL); DeleteObject(large_image); DeleteObject(small_image); for (int i=0; i<application->object_folders.size(); ++i) { if(application->object_folders[i].name == "Default") continue; int item = objects.InsertItem(objects.GetItemCount(), application->object_folders[i].name, ImageID); objects.SetItemData(item, (DWORD_PTR)(const char*)"-1"); } } // -1 is Default, -2 is disabled else if(folderfilter != -2 && application->object_folders[folderfilter].name != "Default") { HBITMAP large_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT); HBITMAP small_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT); int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL); ImageList_Add(small_images.m_hImageList, small_image, NULL); DeleteObject(large_image); DeleteObject(small_image); int item = objects.InsertItem(0,"...\\"+application->object_folders[folderfilter].name, ImageID); objects.SetItemData(item, (DWORD_PTR)(const char*)"-1"); } if (layout) { POSITION LayerPos = layout->layers.GetHeadPosition(); // For each layer while(LayerPos) { CLayer* pLayer = layout->layers.GetNext(LayerPos); if (show_only_selected_layer && pLayer != layout->current_layer) continue; if (!show_nonlayout_objects && pLayer->m_layerType == LAYER_NONFRAME) continue; // Loop all objects CObjList Objects; pLayer->GetEveryObject(Objects, layout); POSITION ObjectPos = Objects.GetHeadPosition(); for (int i = 0; i < Objects.GetCount(); i++) { long ID = Objects.GetNext(ObjectPos); layout->objects.Lookup(ID, pObject); if (pObject->GetGlobalID() != -1) { pObjectType = pObject->GetObjectType(application); // Failed/invalid object type, for some reason if(!pObjectType) continue; //folder filtering if(folderfilter ==-1 && pObjectType->GetFolder() != "Default") continue; else if(folderfilter > -1 && pObjectType->GetFolder()!=application->object_folders[folderfilter].name) continue; bool bAdd = true; for (int j = 0; j < List.GetSize(); j++) if (List.GetAt(j) == pObjectType->GetName()) bAdd = false; if (bAdd) { HBITMAP large_image = pObjectType->m_Image.MakeBitmap(); HBITMAP small_image = pObjectType->small_image.MakeBitmap(); int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL); ImageList_Add(small_images.m_hImageList, small_image, NULL); DeleteObject(large_image); DeleteObject(small_image); int Item = objects.InsertItem(objects.GetItemCount(), pObjectType->GetName(), ImageID); objects.SetItemData(Item, (LPARAM)((const char*)pObjectType->GetName())); List.Add(pObjectType->GetName()); } } // Iterate each object } // Iterate each layer } } else { POSITION Pos = application->object_types.GetStartPosition(); CObjType* oT; long nKey = 0; while (Pos != NULL) { application->object_types.GetNextAssoc(Pos, nKey, oT); if(oT && !oT->m_bIsGroupType) { int ImageID = ImageList_Add(large_images.m_hImageList, oT->m_Image.MakeBitmap(), NULL); int Item = objects.InsertItem(objects.GetItemCount(), oT->GetName(), ImageID); objects.SetItemData(Item, (DWORD)((LPCSTR)oT->GetName())); List.Add(oT->GetName()); } } } objects.ShowScrollBar(SB_VERT); // Work out if there's a vertical scrollbar. If there is, we'll resize a bit. int iListCount = objects.GetItemCount(); int iListSize = objects.GetCountPerPage(); if(iListCount < iListSize) { // Disable the arrows on the vertical scrollbar objects.EnableScrollBar(SB_VERT, ESB_DISABLE_BOTH); objects.SetScrollRange(SB_VERT, 0, 2); } else { // Enable the vertical scrollbar objects.EnableScrollBar(SB_VERT, ESB_ENABLE_BOTH); } if (sorting == ob_sort_az) objects.SortItems(ObjectCompare, (LPARAM)&objects); if (sorting == ob_sort_za) objects.SortItems(ObjectCompareZA, (LPARAM)&objects); // now replace the ids for (int i = 0; i < objects.GetItemCount(); i++) { if((const char*)objects.GetItemData(i) == "-1") { objects.SetItemData(i, -1); continue; } CObjType* type = GetTypeFromName(application, objects.GetItemText(i, 0)); objects.SetItemData(i, type->ObjectIdentifier); } }
void ProcessEdittimeExpressionInformation(vector<Token>& ttokens, CApplication* pApp, long oid) { // Now process the tokens setting the sub types to find family and object names, and pointing variable names // to their owners. vector<Token>::iterator t = ttokens.begin(); vector<Token>::iterator ttokens_end = ttokens.end(); int index = 0; long lastOidOwner = -1; for ( ; t != ttokens_end; t++, index++) { switch(t->t) { case T_IDENTIFIER: // Identifier is the first token, or not preceded by a dot: looks like an object or family name if (index == 0 || (t - 1)->t != T_DOT) { CString objName = t->str; bool movementIdentifier = false; CString movName; // Look for '[' in identifier: signals a movement identifier eg. Sprite[Movement] int index = t->str.Find('['); // Movement found if (index > -1) { movementIdentifier = true; // Parse the names out of Obj[Mov] movName = objName; objName = objName.Left(index); movName.Delete(0, index+1); movName.Delete(movName.GetLength() - 1); } CObjType* pType = GetTypeFromName(pApp, objName); list<Family>::iterator family = find(pApp->families.begin(), pApp->families.end(), t->str); if (pType) { t->oidOwner = pType->ObjectIdentifier; lastOidOwner = pType->ObjectIdentifier; if (movementIdentifier) { t->tsub = TT_MOVEMENTNAME; t->id = pType->GetBehaviorByName(movName)->id; } else t->tsub = TT_OBJECTNAME; } else if (family != pApp->families.end()) { if(family->is_in_use) { t->tsub = TT_FAMILYNAME; t->oidOwner = family->identifier; lastOidOwner = family->identifier; } } }//identifier break; case T_VARIABLENAME: // Previous token is an open bracket: use the last owner. // Otherwise, for standalone variable names, use the expression owner. bool isStandalone = true; // Looking for pattern <obj name> <open bracket> if (index >= 2) { if ((t - 1)->t == T_LEFTBRACKET && (t - 2)->t == T_IDENTIFIER && ((t - 2)->tsub == TT_OBJECTNAME || (t - 2)->tsub == TT_FAMILYNAME)) { isStandalone = false; } CString n = (t - 2)->str; n.MakeLower(); // Look for a global variable name if ((t - 1)->t == T_LEFTBRACKET && (t - 2)->t == T_IDENTIFIER && n == "global") { t->oidOwner = -1; // now work out the id for(list<CApplication::GlobalVariable>::iterator i = pApp->global_variables.begin(); i!= pApp->global_variables.end(); i++) { CString l = i->name; CString r = t->str; l.MakeLower(); r.MakeLower(); if(l == r) t->id = i->identifier; } break; } } // Looking for pattern <dot> <identifier> <open bracket> var name <close bracket/comma> // eg .Value(...) if (index >= 3) { if ((t - 1)->t == T_LEFTBRACKET && (t - 2)->t == T_IDENTIFIER && (t - 3)->t == T_DOT) { if (t + 1 != ttokens_end && ((t + 1)->t == T_RIGHTBRACKET || (t + 1)->t == T_COMMA)) isStandalone = false; } } // Use action/condition OID for standalones if (isStandalone) t->oidOwner = oid; // Use last OID for object variables eg. Sprite('Rofl') else t->oidOwner = lastOidOwner; // now work out the id CObjType* pType = pApp->FindObjTypeFromNumber(t->oidOwner); if(pType) { for(vector<PrivateValue>::iterator i = pType->m_PrivateValues.begin(); i!= pType->m_PrivateValues.end(); i++) { CString l = i->name; CString r = t->str; l.MakeLower(); r.MakeLower(); if(l == r) { t->id = i->identifier; break; } } } break; } } }