private void ClickGridViewItem(int colIndex, SelectionInfo selInfo) { if (selInfo == null) { return; } var nodeGlobalIndex = selInfo.TargetIndex; var filePath = selInfo.FilePath; var skylineWindow = Program.MainWindow; var document = skylineWindow.DocumentUI; if (colIndex > 0) { int groupIndex = document.MoleculeTransitionGroups.ToArray() .IndexOf(g => g.TransitionGroup.GlobalIndex == nodeGlobalIndex); if (groupIndex == -1) { MessageDlg.Show(this, string.Format(Resources.ComparePeakPickingDlg_ClickGridViewItem_Unable_to_find_the_peptide__0__with_charge_state__1_, selInfo.Sequence, selInfo.Charge)); return; } skylineWindow.SelectedPath = document.GetPathTo((int)SrmDocument.Level.TransitionGroups, groupIndex); } var resultMatch = document.Settings.MeasuredResults.FindMatchingMSDataFile(filePath); if (resultMatch != null) { skylineWindow.SelectedResultsIndex = resultMatch.FileOrder; } }
/// <summary> /// 用于显示查询后的信息 /// </summary> /// <param name="lvi">绑定控件</param> /// <param name="info">返回信息</param> /// <param name="Ip">对于Ip</param> public void ShwStuatsforView(ListView lvi, SelectionInfo info, string Ip) { if (lvi.InvokeRequired) { ShwStuatsforViewCallBack shwStuatsforViewCallBack = ShwStuatsforView; lvi.Invoke(shwStuatsforViewCallBack, new object[] { lvi, info, Ip }); int rownum = IsExistsItem(Ip, lvi); if (info != null) { if (rownum >= 0) { lvi.BeginUpdate(); lvi.Items[rownum].SubItems[3].Text = Convert.ToString(CheckIsNull(info.Address, lvi.Items[rownum].SubItems[3].Text)); lvi.Items[rownum].SubItems[5].Text = Convert.ToString(CheckIsNull(info.Temperature, lvi.Items[rownum].SubItems[5].Text)); lvi.Items[rownum].SubItems[6].Text = Convert.ToString(CheckIsNull(info.Temperaturealarm, lvi.Items[rownum].SubItems[6].Text)); lvi.Items[rownum].SubItems[7].Text = Convert.ToString(CheckIsNull(info.Leaves, lvi.Items[rownum].SubItems[7].Text)); lvi.Items[rownum].SubItems[8].Text = Convert.ToString(CheckIsNull(info.Smoke, lvi.Items[rownum].SubItems[8].Text)); lvi.Items[rownum].SubItems[9].Text = Convert.ToString(CheckIsNull(info.Rf, lvi.Items[rownum].SubItems[9].Text)); lvi.Items[rownum].SubItems[10].Text = Convert.ToString(CheckIsNull(info.Video, lvi.Items[rownum].SubItems[10].Text)); lvi.Items[rownum].SubItems[11].Text = Convert.ToString(CheckIsNull(info.Electric, lvi.Items[rownum].SubItems[11].Text)); lvi.Items[rownum].SubItems[12].Text = Convert.ToString(CheckIsNull(info.Dooralarm, lvi.Items[rownum].SubItems[12].Text)); lvi.Items[rownum].SubItems[13].Text = Convert.ToString(CheckIsNull(info.Alaremtime, lvi.Items[rownum].SubItems[13].Text)); lvi.Items[rownum].SubItems[14].Text = Convert.ToString(CheckIsNull(info.Alarmdalay, lvi.Items[rownum].SubItems[14].Text)); lvi.Items[rownum].SubItems[15].Text = Convert.ToString(CheckIsNull(info.Effective, lvi.Items[rownum].SubItems[15].Text)); lvi.Items[rownum].SubItems[16].Text = Convert.ToString(CheckIsNull(info.Status, lvi.Items[rownum].SubItems[16].Text)); lvi.Items[rownum].SubItems[17].Text = Convert.ToString("OK"); lvi.EndUpdate(); Led_XianShiGngXin(rownum, lvi);//向LED屏发送数据 } } } else { } }
private void OnEnable() { _path = target as PolygonPath; _handleTransform = _path.transform; _selectionInfo = new SelectionInfo(); _lineTexture = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Faktori/Path/Editor/Icons/line-texture.png"); }
void IView.HScrollToSelectedText(SelectionInfo selection) { if (selection.First.Message == null) { return; } int pixelThatMustBeVisible = (int)(selection.First.LineCharIndex * drawContext.CharSize.Width); if (drawContext.ShowTime) { pixelThatMustBeVisible += drawContext.TimeAreaSize; } int currentVisibleLeft = scrollBarsInfo.scrollPos.X; int currentVisibleRight = scrollBarsInfo.scrollPos.X + drawContext.ViewWidth - scrollBarsInfo.scrollBarsSize.Width; int extraPixelsAroundSelection = 30; if (pixelThatMustBeVisible < scrollBarsInfo.scrollPos.X) { SetScrollPos(posX: pixelThatMustBeVisible - extraPixelsAroundSelection); } if (pixelThatMustBeVisible >= currentVisibleRight) { SetScrollPos(posX: scrollBarsInfo.scrollPos.X + (pixelThatMustBeVisible - currentVisibleRight + extraPixelsAroundSelection)); } }
void OnEnable() { shapeCreator = target as CustomPolyPrimitive; proceduralMesh = shapeCreator; selectionInfo = new SelectionInfo(); SceneView.onSceneGUIDelegate += OnSceneGUI; }
void IView.HScrollToSelectedText(SelectionInfo selection) { if (selection.First.Message == null) { return; } int pixelThatMustBeVisible = (int)(selection.First.LineCharIndex * drawContext.CharSize.Width); if (drawContext.ShowTime) { pixelThatMustBeVisible += drawContext.TimeAreaSize; } var pos = ScrollView.ContentView.Bounds.Location.ToPointF().ToPoint(); int currentVisibleLeft = pos.X; int VerticalScrollBarWidth = 50; // todo: how to know it on mac? int currentVisibleRight = pos.X + (int)ScrollView.Frame.Width - VerticalScrollBarWidth; int extraPixelsAroundSelection = 20; if (pixelThatMustBeVisible < pos.X) { InnerView.ScrollPoint(new CoreGraphics.CGPoint(pixelThatMustBeVisible - extraPixelsAroundSelection, pos.Y)); } if (pixelThatMustBeVisible >= currentVisibleRight) { InnerView.ScrollPoint(new CoreGraphics.CGPoint(pos.X + (pixelThatMustBeVisible - currentVisibleRight + extraPixelsAroundSelection), pos.Y)); } }
private SelectionInfo ApplySpecialCases(SelectionInfo selectionInfo, SourceText text, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion() || !selectionInfo.SelectionInExpression) { return(selectionInfo); } var expressionNode = selectionInfo.FirstTokenInFinalSpan.GetCommonRoot(selectionInfo.LastTokenInFinalSpan); if (!expressionNode.IsAnyAssignExpression()) { return(selectionInfo); } var assign = (AssignmentExpressionSyntax)expressionNode; // make sure there is a visible token at right side expression if (assign.Right.GetLastToken().Kind() == SyntaxKind.None) { return(selectionInfo); } return(AssignFinalSpan(selectionInfo.With(s => s.FirstTokenInFinalSpan = assign.Right.GetFirstToken(includeZeroWidth: true)) .With(s => s.LastTokenInFinalSpan = assign.Right.GetLastToken(includeZeroWidth: true)), text, cancellationToken)); }
private static SelectionInfo AdjustFinalTokensBasedOnContext( SelectionInfo selectionInfo, SemanticModel semanticModel, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion()) { return(selectionInfo); } // don't need to adjust anything if it is multi-statements case if (!selectionInfo.SelectionInExpression && !selectionInfo.SelectionInSingleStatement) { return(selectionInfo); } // get the node that covers the selection var node = selectionInfo.FirstTokenInFinalSpan.GetCommonRoot(selectionInfo.LastTokenInFinalSpan); var validNode = Check(semanticModel, node, cancellationToken); if (validNode) { return(selectionInfo); } var firstValidNode = node.GetAncestors <SyntaxNode>().FirstOrDefault(n => Check(semanticModel, n, cancellationToken)); if (firstValidNode == null) { // couldn't find any valid node return(selectionInfo.WithStatus(s => new OperationStatus(OperationStatusFlag.None, CSharpFeaturesResources.Selection_does_not_contain_a_valid_node)) .With(s => s.FirstTokenInFinalSpan = default)
private void UpdateSelection() { // This handles us left-clicking on furniture or characters to set a selection. if (Input.GetKeyUp(KeyCode.Escape)) { mySelection = null; } if (currentMode != MouseMode.SELECT) { return; } // If we're over a UI element, then bail out from this. if (EventSystem.current.IsPointerOverGameObject()) { return; } if (Input.GetMouseButtonUp(0)) { if (contextMenu != null) { contextMenu.Close(); } // We just release the mouse button, so that's our queue to update our selection. Tile tileUnderMouse = GetMouseOverTile(); if (tileUnderMouse == null) { // No valid tile under mouse. return; } if (mySelection == null || mySelection.Tile != tileUnderMouse) { if (mySelection != null) { mySelection.GetSelectedStuff().IsSelected = false; } // We have just selected a brand new tile, reset the info. mySelection = new SelectionInfo(tileUnderMouse); mySelection.GetSelectedStuff().IsSelected = true; } else { // This is the same tile we already have selected, so cycle the subSelection to the next non-null item. // Not that the tile sub selection can NEVER be null, so we know we'll always find something. // Rebuild the array of possible sub-selection in case characters moved in or out of the tile. // [IsSelected] Set our last stuff to be not selected because were selecting the next stuff mySelection.GetSelectedStuff().IsSelected = false; mySelection.BuildStuffInTile(); mySelection.SelectNextStuff(); mySelection.GetSelectedStuff().IsSelected = true; } } }
public virtual void Draw(SpriteBatch sprite, int xShift, int yShift, SelectionInfo sel) { XNA.Color lineColor = ab.GetColor(sel); int x, y; if (a.X < b.X) { x = a.X + xShift; } else { x = b.X + xShift; } if (b.Y < c.Y) { y = b.Y + yShift; } else { y = c.Y + yShift; } ab.Draw(sprite, lineColor, xShift, yShift); bc.Draw(sprite, lineColor, xShift, yShift); cd.Draw(sprite, lineColor, xShift, yShift); da.Draw(sprite, lineColor, xShift, yShift); }
protected ComplexOutputTypeModel CreateClassModel( IDocumentAnalyzerContext context, IFragmentNode returnTypeFragment, ComplexOutputTypeModel returnType, SelectionInfo selection, Path path) { var fieldNames = new HashSet <string>( selection.Fields.Select(t => GetPropertyName(t.ResponseName))); string className = context.GetOrCreateName( returnTypeFragment.Fragment.SelectionSet, GetClassName(returnTypeFragment.Name), fieldNames); var modelClass = new ComplexOutputTypeModel( className, returnTypeFragment.Fragment.TypeCondition.Description, false, returnTypeFragment.Fragment.TypeCondition, returnTypeFragment.Fragment.SelectionSet, new[] { returnType }, CreateFields( (IComplexOutputType)returnTypeFragment.Fragment.TypeCondition, selection.SelectionSet.Selections, n => true, path)); context.Register(modelClass); return(modelClass); }
void OnEnable() { shapeChangedSinceLastRepaint = true; shapeCreator = target as ShapeCreator; selectionInfo = new SelectionInfo(); Undo.undoRedoPerformed += OnUndoOrRedo; Tools.hidden = true; }
private void OnEnable() { needsRepaint = true; shapeCreator = (ShapeCreator)target; selectionInfo = new SelectionInfo(); Undo.undoRedoPerformed += onUndo; Tools.hidden = true; }
private SelectionInfo CheckErrorCasesAndAppendDescriptions(SelectionInfo selectionInfo, SyntaxNode root, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion()) { return(selectionInfo); } if (selectionInfo.FirstTokenInFinalSpan.IsMissing || selectionInfo.LastTokenInFinalSpan.IsMissing) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.ContainsInvalidSelection)); } // get the node that covers the selection var commonNode = selectionInfo.FirstTokenInFinalSpan.GetCommonRoot(selectionInfo.LastTokenInFinalSpan); if ((selectionInfo.SelectionInExpression || selectionInfo.SelectionInSingleStatement) && commonNode.HasDiagnostics()) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.TheSelectionContainsSyntacticErrors)); } var tokens = root.DescendantTokens(selectionInfo.FinalSpan); if (tokens.ContainPreprocessorCrossOver(selectionInfo.FinalSpan)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.SelectionCanNotCrossOverPreprocessorDirectives)); } // TODO : check whether this can be handled by control flow analysis engine if (tokens.Any(t => t.Kind() == SyntaxKind.YieldKeyword)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.SelectionCanNotContainAYieldStatement)); } // TODO : check behavior of control flow analysis engine around exception and exception handling. if (tokens.ContainArgumentlessThrowWithoutEnclosingCatch(selectionInfo.FinalSpan)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.SelectionCanNotContainThrowStatement)); } if (selectionInfo.SelectionInExpression && commonNode.PartOfConstantInitializerExpression()) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.SelectionCanNotBePartOfConstInitializerExpr)); } if (commonNode.IsUnsafeContext()) { selectionInfo = selectionInfo.WithStatus(s => s.With(s.Flag, CSharpFeaturesResources.TheSelectedCodeIsInsideAnUnsafeContext)); } var selectionChanged = selectionInfo.FirstTokenInOriginalSpan != selectionInfo.FirstTokenInFinalSpan || selectionInfo.LastTokenInOriginalSpan != selectionInfo.LastTokenInFinalSpan; if (selectionChanged) { selectionInfo = selectionInfo.WithStatus(s => s.MarkSuggestion()); } return(selectionInfo); }
private void OnEnable() { m_Target = target as Area2D; m_SelectionInfo = new SelectionInfo(); m_Offset = serializedObject.FindProperty("m_Offset"); m_Extents = serializedObject.FindProperty("m_Extents"); m_Bounds = serializedObject.FindProperty("m_Bounds"); }
public override XNA.Color GetColor(SelectionInfo sel, bool selected) { XNA.Color c = base.GetColor(sel, selected); if (hide == true) { c.R = (byte)UserSettings.HiddenLifeR; } return(c); }
public string GenerateDataScripts(SchemaInfo schemaInfo) { SelectionInfo selectionInfo = new SelectionInfo() { TableNames = schemaInfo.Tables.Select(item => item.Name).ToArray() }; return(Interpreter.GenerateDataScripts(Interpreter.GetSchemaInfo(selectionInfo, false))); }
void OnEnable() { shapeChangedSinceLastRepaint = true; patrolManager = target as PatrolManager; selectionInfo = new SelectionInfo(); Undo.undoRedoPerformed += OnUndoOrRedo; //Tools.hidden = true; }
private void OnEnable() { addMode = false; moveMode = false; graphManager = (GraphManager)target; selectionInfo = new SelectionInfo(); graphManager.nodes.RemoveAll(x => x == null); graphManager.links.RemoveAll(x => x == null); }
public string GetWhereString(SelectionInfo selection) { var whereList = WhereAndBySelection(selection); var where = string.Empty; if (whereList != null && whereList.Any()) { where = string.Join(" AND", whereList.Select(x => $"({x})")); } return(where); }
public void HandleSelectionChanged( ) { if (IsUndoOrRedo) { return; } var td = Rtb.GetTextData("\n"); PreviousSelection = new SelectionInfo(td.SelectionStart, td.SelectionEnd); }
public static void SelectedTileInfo(SelectionInfo selection) { Debug.WriteLine(selection.Tile.Position); if (selection.Entities.Count != 0) { foreach (ISelectableInterface entity in selection.Entities) { Debug.WriteLine(entity.GetName()); } } }
public async Task <string> GenerateSchemaScriptsAsync(SchemaInfo schemaInfo) { SelectionInfo selectionInfo = new SelectionInfo() { TableNames = schemaInfo.Tables.Select(item => item.Name).ToArray(), ViewNames = schemaInfo.Views.Select(item => item.Name).ToArray(), TriggerNames = schemaInfo.Triggers.Select(item => item.Name).ToArray() }; return(this.interpreter.GenerateSchemaScripts(await this.Interpreter.GetSchemaInfoAsync(selectionInfo))); }
public virtual XNA.Color GetColor(SelectionInfo sel) { if ((sel.editedTypes & Type) == Type && firstDot.CheckIfLayerSelected(sel)) { return(Selected ? UserSettings.SelectedColor : Color); } else { return(InactiveColor); } }
private void Start() { cam = Camera.main; gridManager = FindObjectOfType <GridManager>(); rotateState = FindObjectOfType <RotateState>(); hexFallSpeed = 1f / hexFallTime; hexCreatingSpeed = 1f / hexCreatingTime; Info = new SelectionInfo(); _input = inputObject as IInput; state = null; }
public override XNA.Color GetColor(SelectionInfo sel, bool selected) { if ((sel.editedTypes & Type) == Type && CheckIfLayerSelected(sel)) { return(selected ? UserSettings.SelectedColor : Color); } else { return(InactiveColor); } }
private static SelectionInfo ApplySpecialCases(SelectionInfo selectionInfo, SourceText text, ParseOptions options, bool localFunction) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion()) { return(selectionInfo); } if (selectionInfo.CommonRootFromOriginalSpan.IsKind(SyntaxKind.CompilationUnit) || selectionInfo.CommonRootFromOriginalSpan.IsParentKind(SyntaxKind.GlobalStatement)) { // Cannot extract a local function from a global statement in script code if (localFunction && options is { Kind : SourceCodeKind.Script })
private void Awake() { Resources = (startingResources = Random.Range(harvestableProperties.capacityBounds.x, harvestableProperties.capacityBounds.y)); selectionInfo = new SelectionInfo() { Icon = harvestableProperties.icon, CurrentHitpoints = Resources, MaxHitpoints = startingResources, Name = harvestableProperties.name }; }
private void OnEnable() { m_ShapeBuidler = target as ShapeBuilder; m_SelectionInfo = new SelectionInfo(); m_ShapePreset = serializedObject.FindProperty("ShapePreset"); m_RectangleWidth = serializedObject.FindProperty("RectangleWidth"); m_RectangleDepth = serializedObject.FindProperty("RectangleDepth"); m_CircleRadius = serializedObject.FindProperty("CircleRadius"); m_CirclePoints = serializedObject.FindProperty("CirclePoints"); m_RoundCoordinates = serializedObject.FindProperty("RoundCoordinates"); }
public static void btnOK_OnClickStep(IQuickInsertAccountContact form, EventArgs args) { IUser currentUser = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser; IContact contact = form.CurrentEntity as IContact; IAccount account = Sage.Platform.EntityFactory.Create <IAccount>(); IAddress ad = Sage.Platform.EntityFactory.Create <IAddress>(); ad.Description = contact.Address.Description; ad.Address1 = contact.Address.Address1; ad.Address2 = contact.Address.Address2; ad.Address3 = contact.Address.Address3; ad.Address4 = contact.Address.Address4; ad.City = contact.Address.City; ad.State = contact.Address.State; ad.PostalCode = contact.Address.PostalCode; ad.Country = contact.Address.Country; ad.County = contact.Address.County; ad.Salutation = contact.Address.Salutation; account.Address = ad; account.AccountName = form.txtAccount.Text; account.AccountManager = currentUser; account.Owner = currentUser.DefaultOwner; account.Type = form.pklType.PickListValue; account.MainPhone = form.phAccountMain.Text; //if ((string.IsNullOrEmpty(contact.LastName)&&(string.IsNullOrEmpty(contact.FirstName)))) //{ // contact.LastName = string.Format("New Contact for {0}",currentUser.UserInfo.UserName ); //} contact.Account = account; contact.AccountManager = currentUser; contact.Owner = currentUser.DefaultOwner; contact.SaveContactAccount(account); ISelectionService srv = ApplicationContext.Current.Services.Get <ISelectionService>(true); ISelectionContext sc = new SimpleSelectionContext(); SelectionInfo selInfo = new SelectionInfo(); SelectionItem item = new SelectionItem(); item.Id = contact.Id.ToString(); selInfo.Selections.Add(item); sc.Key = "QuickInsertAccountContact"; sc.SelectionInfo = selInfo; srv.SetSelectionContext(sc.Key, sc); Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>(); if (refresher != null) { refresher.RefreshAll(); } }
public static void btnOK_OnClickStep( IQuickInsertAccountContact form, EventArgs args) { IUser currentUser = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser; IContact contact = form.CurrentEntity as IContact; IAccount account = Sage.Platform.EntityFactory.Create<IAccount>(); IAddress ad = Sage.Platform.EntityFactory.Create<IAddress>(); ad.Description = contact.Address.Description; ad.Address1 = contact.Address.Address1; ad.Address2 = contact.Address.Address2; ad.Address3 = contact.Address.Address3; ad.Address4 = contact.Address.Address4; ad.City = contact.Address.City; ad.State = contact.Address.State; ad.PostalCode = contact.Address.PostalCode; ad.Country = contact.Address.Country; ad.County = contact.Address.County; ad.Salutation = contact.Address.Salutation; account.Address = ad; account.AccountName = form.txtAccount.Text; account.AccountManager = currentUser; account.Owner = currentUser.DefaultOwner; account.Type = form.pklType.PickListValue; account.MainPhone = form.phAccountMain.Text; //if ((string.IsNullOrEmpty(contact.LastName)&&(string.IsNullOrEmpty(contact.FirstName)))) //{ // contact.LastName = string.Format("New Contact for {0}",currentUser.UserInfo.UserName ); //} contact.Account = account; contact.AccountManager = currentUser; contact.Owner = currentUser.DefaultOwner; contact.SaveContactAccount(account); ISelectionService srv = ApplicationContext.Current.Services.Get<ISelectionService>(true); ISelectionContext sc = new SimpleSelectionContext(); SelectionInfo selInfo = new SelectionInfo(); SelectionItem item = new SelectionItem(); item.Id = contact.Id.ToString(); selInfo.Selections.Add(item); sc.Key = "QuickInsertAccountContact"; sc.SelectionInfo = selInfo; srv.SetSelectionContext(sc.Key,sc); Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get<Sage.Platform.WebPortal.Services.IPanelRefreshService>(); if (refresher != null) { refresher.RefreshAll(); } }
private void UpdateSelectionState() { SelectionInfo[] newSelection = new SelectionInfo[this.Columns.Count]; for (int i = 0; i < this.Columns.Count; i++) newSelection[this.Columns[i].DisplayIndex].ColumnIndex = i; int columnCount = this.Columns.Count; if (this.SelectionMode == DataGridViewSelectionMode.FullRowSelect) { if (this.CurrentCell != null) { int displayIndex = this.Columns[this.CurrentCell.ColumnIndex].DisplayIndex; newSelection[displayIndex].Selected = true; newSelection[displayIndex].ColumnIndex = this.CurrentCell.ColumnIndex; } } else { foreach (DataGridViewCell cell in this.SelectedCells) { if (cell.ColumnIndex == -1) continue; int displayIndex = this.Columns[cell.ColumnIndex].DisplayIndex; if (!newSelection[displayIndex].Selected) { columnCount--; newSelection[displayIndex].Selected = true; newSelection[displayIndex].ColumnIndex = cell.ColumnIndex; if (columnCount == 0) break; } } } for (int i = 0; i < newSelection.Length; i++) { if (m_ColumnSelectionState.Length > i && newSelection[i].Selected != m_ColumnSelectionState[i].Selected) { int ci = m_ColumnSelectionState[i].ColumnIndex; if (!(ci < 0 || ci >= this.Columns.Count)) { this.InvalidateColumn(ci); if (ci > 0) this.InvalidateColumn(ci - 1); } } } if (m_SelectedRowIndex > 0 && m_SelectedRowIndex < this.Rows.Count) this.InvalidateRow(m_SelectedRowIndex - 1); if (this.CurrentCell != null && this.CurrentCell.RowIndex > 0) { m_SelectedRowIndex = this.CurrentCell.RowIndex; this.InvalidateRow(m_SelectedRowIndex - 1); } else m_SelectedRowIndex = -2; m_ColumnSelectionState = newSelection; }
private SelectionInfo ApplySpecialCases(SelectionInfo selectionInfo, SourceText text, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion() || !selectionInfo.SelectionInExpression) { return selectionInfo; } var expressionNode = selectionInfo.FirstTokenInFinalSpan.GetCommonRoot(selectionInfo.LastTokenInFinalSpan); if (!expressionNode.IsAnyAssignExpression()) { return selectionInfo; } var assign = (AssignmentExpressionSyntax)expressionNode; // make sure there is a visible token at right side expression if (assign.Right.GetLastToken().Kind() == SyntaxKind.None) { return selectionInfo; } return AssignFinalSpan(selectionInfo.With(s => s.FirstTokenInFinalSpan = assign.Right.GetFirstToken(includeZeroWidth: true)) .With(s => s.LastTokenInFinalSpan = assign.Right.GetLastToken(includeZeroWidth: true)), text, cancellationToken); }
public virtual void Draw(SpriteBatch sprite, int xShift, int yShift, SelectionInfo sel) { XNA.Color lineColor = ab.GetColor(sel); int x, y; if (a.X < b.X) x = a.X + xShift; else x = b.X + xShift; if (b.Y < c.Y) y = b.Y + yShift; else y = c.Y + yShift; ab.Draw(sprite, lineColor, xShift, yShift); bc.Draw(sprite, lineColor, xShift, yShift); cd.Draw(sprite, lineColor, xShift, yShift); da.Draw(sprite, lineColor, xShift, yShift); }
private SelectionInfo AssignInitialFinalTokens(SelectionInfo selectionInfo, SyntaxNode root, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion()) { return selectionInfo; } if (selectionInfo.SelectionInExpression) { // simple expression case return selectionInfo.With(s => s.FirstTokenInFinalSpan = s.CommonRootFromOriginalSpan.GetFirstToken(includeZeroWidth: true)) .With(s => s.LastTokenInFinalSpan = s.CommonRootFromOriginalSpan.GetLastToken(includeZeroWidth: true)); } var range = GetStatementRangeContainingSpan<StatementSyntax>( root, TextSpan.FromBounds(selectionInfo.FirstTokenInOriginalSpan.SpanStart, selectionInfo.LastTokenInOriginalSpan.Span.End), cancellationToken); if (range == null) { return selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.NoValidStatementRangeToExtractOut)); } var statement1 = (StatementSyntax)range.Item1; var statement2 = (StatementSyntax)range.Item2; if (statement1 == statement2) { // check one more time to see whether it is an expression case var expression = selectionInfo.CommonRootFromOriginalSpan.GetAncestor<ExpressionSyntax>(); if (expression != null && statement1.Span.Contains(expression.Span)) { return selectionInfo.With(s => s.SelectionInExpression = true) .With(s => s.FirstTokenInFinalSpan = expression.GetFirstToken(includeZeroWidth: true)) .With(s => s.LastTokenInFinalSpan = expression.GetLastToken(includeZeroWidth: true)); } // single statement case return selectionInfo.With(s => s.SelectionInSingleStatement = true) .With(s => s.FirstTokenInFinalSpan = statement1.GetFirstToken(includeZeroWidth: true)) .With(s => s.LastTokenInFinalSpan = statement1.GetLastToken(includeZeroWidth: true)); } // move only statements inside of the block return selectionInfo.With(s => s.FirstTokenInFinalSpan = statement1.GetFirstToken(includeZeroWidth: true)) .With(s => s.LastTokenInFinalSpan = statement2.GetLastToken(includeZeroWidth: true)); }
private SelectionInfo AssignFinalSpan(SelectionInfo selectionInfo, SourceText text, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion()) { return selectionInfo; } // set final span var start = (selectionInfo.FirstTokenInOriginalSpan == selectionInfo.FirstTokenInFinalSpan) ? Math.Min(selectionInfo.FirstTokenInOriginalSpan.SpanStart, selectionInfo.OriginalSpan.Start) : selectionInfo.FirstTokenInFinalSpan.FullSpan.Start; var end = (selectionInfo.LastTokenInOriginalSpan == selectionInfo.LastTokenInFinalSpan) ? Math.Max(selectionInfo.LastTokenInOriginalSpan.Span.End, selectionInfo.OriginalSpan.End) : selectionInfo.LastTokenInFinalSpan.FullSpan.End; return selectionInfo.With(s => s.FinalSpan = GetAdjustedSpan(text, TextSpan.FromBounds(start, end))); }
private SelectionInfo CheckErrorCasesAndAppendDescriptions(SelectionInfo selectionInfo, SyntaxNode root, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion()) { return selectionInfo; } if (selectionInfo.FirstTokenInFinalSpan.IsMissing || selectionInfo.LastTokenInFinalSpan.IsMissing) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.ContainsInvalidSelection)); } // get the node that covers the selection var commonNode = selectionInfo.FirstTokenInFinalSpan.GetCommonRoot(selectionInfo.LastTokenInFinalSpan); if ((selectionInfo.SelectionInExpression || selectionInfo.SelectionInSingleStatement) && commonNode.HasDiagnostics()) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.TheSelectionContainsSyntacticErrors)); } var tokens = root.DescendantTokens(selectionInfo.FinalSpan); if (tokens.ContainPreprocessorCrossOver(selectionInfo.FinalSpan)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.SelectionCanNotCrossOverPreprocessorDirectives)); } // TODO : check whether this can be handled by control flow analysis engine if (tokens.Any(t => t.Kind() == SyntaxKind.YieldKeyword)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.SelectionCanNotContainAYieldStatement)); } // TODO : check behavior of control flow analysis engine around exception and exception handling. if (tokens.ContainArgumentlessThrowWithoutEnclosingCatch(selectionInfo.FinalSpan)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.SelectionCanNotContainThrowStatement)); } if (selectionInfo.SelectionInExpression && commonNode.PartOfConstantInitializerExpression()) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.SelectionCanNotBePartOfConstInitializerExpr)); } if (commonNode.IsUnsafeContext()) { selectionInfo = selectionInfo.WithStatus(s => s.With(s.Flag, CSharpFeaturesResources.TheSelectedCodeIsInsideAnUnsafeContext)); } var selectionChanged = selectionInfo.FirstTokenInOriginalSpan != selectionInfo.FirstTokenInFinalSpan || selectionInfo.LastTokenInOriginalSpan != selectionInfo.LastTokenInFinalSpan; if (selectionChanged) { selectionInfo = selectionInfo.WithStatus(s => s.MarkSuggestion()); } return selectionInfo; }
public override bool CheckIfLayerSelected(SelectionInfo sel) { return (sel.selectedLayer == -1 || sel.selectedLayer == layer) && (sel.selectedPlatform == -1 || sel.selectedPlatform == zm); }
public override XNA.Color GetColor(SelectionInfo sel, bool selected) { XNA.Color c = base.GetColor(sel, selected); return c; }
private SelectionInfo CheckErrorCasesAndAppendDescriptions(SelectionInfo selectionInfo, SyntaxNode root, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion()) { return selectionInfo; } if (selectionInfo.FirstTokenInFinalSpan.IsMissing || selectionInfo.LastTokenInFinalSpan.IsMissing) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.Contains_invalid_selection)); } // get the node that covers the selection var commonNode = selectionInfo.FirstTokenInFinalSpan.GetCommonRoot(selectionInfo.LastTokenInFinalSpan); if ((selectionInfo.SelectionInExpression || selectionInfo.SelectionInSingleStatement) && commonNode.HasDiagnostics()) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.The_selection_contains_syntactic_errors)); } var tokens = root.DescendantTokens(selectionInfo.FinalSpan); if (tokens.ContainPreprocessorCrossOver(selectionInfo.FinalSpan)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.Selection_can_not_cross_over_preprocessor_directives)); } // TODO : check whether this can be handled by control flow analysis engine if (tokens.Any(t => t.Kind() == SyntaxKind.YieldKeyword)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.Selection_can_not_contain_a_yield_statement)); } // TODO : check behavior of control flow analysis engine around exception and exception handling. if (tokens.ContainArgumentlessThrowWithoutEnclosingCatch(selectionInfo.FinalSpan)) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.BestEffort, CSharpFeaturesResources.Selection_can_not_contain_throw_statement)); } if (selectionInfo.SelectionInExpression && commonNode.PartOfConstantInitializerExpression()) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.Selection_can_not_be_part_of_constant_initializer_expression)); } if (commonNode.IsUnsafeContext()) { selectionInfo = selectionInfo.WithStatus(s => s.With(s.Flag, CSharpFeaturesResources.The_selected_code_is_inside_an_unsafe_context)); } // For now patterns are being blanket disabled for extract method. This issue covers designing extractions for them // and re-enabling this. // https://github.com/dotnet/roslyn/issues/9244 if (commonNode.Kind() == SyntaxKind.IsPatternExpression) { selectionInfo = selectionInfo.WithStatus(s => s.With(OperationStatusFlag.None, CSharpFeaturesResources.Selection_can_not_contain_a_pattern_expression)); } var selectionChanged = selectionInfo.FirstTokenInOriginalSpan != selectionInfo.FirstTokenInFinalSpan || selectionInfo.LastTokenInOriginalSpan != selectionInfo.LastTokenInFinalSpan; if (selectionChanged) { selectionInfo = selectionInfo.WithStatus(s => s.MarkSuggestion()); } return selectionInfo; }
public override bool CheckIfLayerSelected(SelectionInfo sel) { // Ropes have no zM return (sel.selectedLayer == -1 || sel.selectedLayer == parentRope.LayerNumber); }
public override bool CheckIfLayerSelected(SelectionInfo sel) { return (sel.selectedLayer == -1 || Layer.LayerNumber == sel.selectedLayer) && (sel.selectedPlatform == -1 || PlatformNumber == sel.selectedPlatform); }
private TextSpan GetControlFlowSpan(SelectionInfo selectionInfo) { return TextSpan.FromBounds(selectionInfo.FirstTokenInFinalSpan.SpanStart, selectionInfo.LastTokenInFinalSpan.Span.End); }
public override XNA.Color GetColor(SelectionInfo sel, bool selected) { XNA.Color c = base.GetColor(sel, selected); if (_hide) c.R = (byte)UserSettings.HiddenLifeR; return c; }
private SelectionInfo AdjustFinalTokensBasedOnContext( SelectionInfo selectionInfo, SemanticModel semanticModel, CancellationToken cancellationToken) { if (selectionInfo.Status.FailedWithNoBestEffortSuggestion()) { return selectionInfo; } // don't need to adjust anything if it is multi-statements case if (!selectionInfo.SelectionInExpression && !selectionInfo.SelectionInSingleStatement) { return selectionInfo; } // get the node that covers the selection var node = selectionInfo.FirstTokenInFinalSpan.GetCommonRoot(selectionInfo.LastTokenInFinalSpan); var validNode = Check(semanticModel, node, cancellationToken); if (validNode) { return selectionInfo; } var firstValidNode = node.GetAncestors<SyntaxNode>().FirstOrDefault(n => Check(semanticModel, n, cancellationToken)); if (firstValidNode == null) { // couldn't find any valid node return selectionInfo.WithStatus(s => new OperationStatus(OperationStatusFlag.None, CSharpFeaturesResources.SelectionDoesNotContainAValidNode)) .With(s => s.FirstTokenInFinalSpan = default(SyntaxToken)) .With(s => s.LastTokenInFinalSpan = default(SyntaxToken)); } firstValidNode = (firstValidNode.Parent is ExpressionStatementSyntax) ? firstValidNode.Parent : firstValidNode; return selectionInfo.With(s => s.SelectionInExpression = firstValidNode is ExpressionSyntax) .With(s => s.SelectionInSingleStatement = firstValidNode is StatementSyntax) .With(s => s.FirstTokenInFinalSpan = firstValidNode.GetFirstToken(includeZeroWidth: true)) .With(s => s.LastTokenInFinalSpan = firstValidNode.GetLastToken(includeZeroWidth: true)); }
public virtual XNA.Color GetColor(SelectionInfo sel) { if ((sel.editedTypes & Type) == Type && firstDot.CheckIfLayerSelected(sel)) return Selected ? UserSettings.SelectedColor : Color; else return InactiveColor; }
public override bool CheckIfLayerSelected(SelectionInfo sel) { return true; }