bool TTreeView::Drop(Point where, long modifiers, long /* itemRef */, long flavor, void *dataptr, long datalen) { TreeDropRecord d; long retval; if (!FindDropPoint(where)) return false; // don't do it! d.tree = this; d.dropID = flavor; d.parent = fDropParent; d.child = fDropChild; d.modifiers = modifiers; d.len = datalen; d.data = dataptr; retval = DoDispatch(KEventTreeDoDrop,GetViewID(),(void *)&d); InvalView(); // redraw me regardless if (1 == retval) return true; return false; }
void TTreeView::Enter(Point where, long mods, bool hilite) { // First, draw the view hilite XGDropper::Enter(where,mods,hilite); // second, find where this is going and draw the appropriate hilite FindDropPoint(where); }
void TTreeView::Track(Point where, long) { FindDropPoint(where); }
SignalHandlerResult DTreePlanter::mouseDown(const WindowVector& position, ButtonIdentifier button, ModifierFlags modifiers) { if(button != c_buttonLeft) { return SIGNAL_CONTINUE_EMISSION; } VIEWTYPE vt = GlobalRadiant().XYWindow_getViewType(); switch(vt) { case XY: break; case YZ: case XZ: default: return SIGNAL_CONTINUE_EMISSION; } Vector3 pt, vhit; pt = vector3_snapped(GlobalRadiant().XYWindow_windowToWorld(position), GlobalRadiant().getGridSize()); if(FindDropPoint(vector3_to_array(pt), vector3_to_array(vhit))) { vhit[2] += m_offset; char buffer[128]; DEntity e(m_entType); sprintf(buffer, "%i %i %i", (int)vhit[0], (int)vhit[1], (int)vhit[2]); e.AddEPair("origin", buffer); if(m_autoLink) { const scene::Path* pLastEntity = NULL; const scene::Path* pThisEntity = NULL; int entpos; for(int i = 0; i < 256; i++) { sprintf(buffer, m_linkName, i); pThisEntity = FindEntityFromTargetname( buffer ); if(pThisEntity) { entpos = i; pLastEntity = pThisEntity; } } if(!pLastEntity) { sprintf(buffer, m_linkName, 0); } else { sprintf(buffer, m_linkName, entpos + 1); } e.AddEPair( "targetname", buffer ); if(pLastEntity) { DEntity e2; e2.LoadFromEntity(pLastEntity->top(), true); e2.AddEPair("target", buffer); e2.RemoveFromRadiant(); e2.BuildInRadiant(false); } } if(m_setAngles) { int angleYaw = (rand() % (m_maxYaw - m_minYaw + 1)) + m_minYaw; int anglePitch = (rand() % (m_maxPitch - m_minPitch + 1)) + m_minPitch; sprintf(buffer, "%i %i 0", anglePitch, angleYaw); e.AddEPair("angles", buffer); } if(m_numModels) { int treetype = rand() % m_numModels; e.AddEPair("model", m_trees[treetype].name); } if(m_useScale) { float scale = (((rand()%1000)*0.001f) * (m_maxScale - m_minScale)) + m_minScale; sprintf(buffer, "%f", scale ); e.AddEPair("modelscale", buffer); } e.BuildInRadiant( false ); } if(m_autoLink) { DoTrainPathPlot(); } return SIGNAL_STOP_EMISSION; }