public TreeSelectionData(TreeViewController<DTreeItem> tvController, SelectionType selectionType) { MethodName = string.Empty; TypeName = string.Empty; NameSpace = string.Empty; AssemblyName = string.Empty; if (tvController.SelectedNode != null) { this.SelectionType = selectionType; switch (selectionType) { case SelectionType.ASSEMBLY: this.AssemblyName = tvController.SelectedNode.Value.Text; break; case SelectionType.NAMESPACE: this.NameSpace = tvController.SelectedNode.Value.Text; this.AssemblyName = tvController.SelectedNode.Parent.Value.Text; break; case SelectionType.TYPE: this.TypeName = tvController.SelectedNode.Value.Text; this.NameSpace = tvController.SelectedNode.Parent.Value.Text; this.AssemblyName = tvController.SelectedNode.Parent.Parent.Value.Text; break; case SelectionType.METHOD: this.MethodName = tvController.SelectedNode.Value.Text; this.TypeName = tvController.SelectedNode.Parent.Value.Text; this.NameSpace = tvController.SelectedNode.Parent.Parent.Value.Text; this.AssemblyName = tvController.SelectedNode.Parent.Parent.Parent.Value.Text; break; default: break; } } }
/// <summary>Base constructor for classes that inherit <see cref="MultipleSelectionCommand" />.</summary> /// <param name="description">The description of the command.</param> /// <param name="canGroup">Whether to possibly group the command with the previous command.</param> /// <param name="selectionIntended">The intended selection.</param> /// <param name="paths">The paths to select, or null to use auto selection if setPaths is enabled.</param> /// <param name="setPaths">Whether to set the paths based on the current selection and the selectionType</param> public MultipleSelectionCommand (string description, bool canGroup, SelectionIntended selectionIntended, TreePath[] paths, bool setPaths) : base(description, canGroup) { if (setPaths) { switch (selectionIntended) { case SelectionIntended.Simple: this.paths = (paths != null ? paths : Base.Ui.View.Selection.Paths); this.focus = Base.Ui.View.Selection.Focus; break; case SelectionIntended.Range: this.paths = (paths != null ? paths : Base.Ui.View.Selection.Range); this.focus = Base.Ui.View.Selection.Focus; break; case SelectionIntended.SimpleToFirst: this.paths = (paths != null ? paths : Base.Ui.View.Selection.PathsToFirst); this.focus = Base.Ui.View.Selection.Focus; break; case SelectionIntended.SimpleToLast: this.paths = (paths != null ? paths : Base.Ui.View.Selection.PathsToLast); this.focus = Base.Ui.View.Selection.Focus; break; default: if (paths != null) this.paths = paths; break; } } this.selectionType = GetSelectionType(selectionIntended); }
internal CurveSelection(int curveID, CurveEditor host, int keyIndex, SelectionType t) { this.m_Key = -1; this.m_CurveID = curveID; this.m_Host = host; this.m_Key = keyIndex; this.type = t; }
internal CurveSelection(int curveID, int key, SelectionType type) { this.curveID = 0; this.key = -1; this.semiSelected = false; this.curveID = curveID; this.key = key; this.type = type; }
public Selection () { selectedToken = BuildProperty<Token> ("SelectedToken"); position = BuildProperty<int> ("Position"); type = BuildProperty<SelectionType> ("Type"); selectedToken.DependencyPropertyValueChanged += HandleSelectedTokenChanged; Type = SelectionType.Left; }
public PromptType GetPromptType(SelectionType selectionType) { switch (selectionType) { case SelectionType.SingleSelect: return PromptType.DropDown; default: return PromptType.ShoppingCart; } }
public PromptType GetPromptType(SelectionType selectionType) { switch (selectionType) { case SelectionType.MultiSelect: return PromptType.CasscadingSearch; default: throw new PromptTypeProviderException("A casscading search prompt must be multi-select"); } }
public PromptType GetPromptType(SelectionType selectionType) { switch (selectionType) { case SelectionType.MultiSelect: return PromptType.RecursiveTree; default: return PromptType.RecursiveSingleSelectTree; } }
public GlobalPromptBaseReportInfo( string name, string label, string[] valueParameterDefaults, string[] labelParameterDefaults, SelectionType selectionType) { _selectionType = selectionType; _labelParameterDefaults = labelParameterDefaults; _valueParameterDefaults = valueParameterDefaults; _label = label; _name = name; }
public Range(Loc start, Loc end, SelectionType type = SelectionType.Normal) { if (start < end) { this.start = start; this.end = end; } else { this.start = end; this.end = start; } this.type = type; }
private void radioButton_CheckedChanged(object sender, EventArgs e) { RadioButton r = sender as RadioButton; if (r != null) { if (r.Checked) { if (r == this.radioButton4) this._SelectionType = SelectionType.XAML; this.updateEnabled(); } } }
public static void DrawCrossHair(SelectionType mode) { int cursorSizeX = 5; int cursorSizeY = 5; Color col = Color.green; Color tra = new Color(0.0f, 0.0f, 0.0f, 0.0f); // Initialize crosshair texture Texture2D tex = new Texture2D(cursorSizeX, cursorSizeY); for (int x = 0; x < cursorSizeX; x++) { for (int y = 0; y < cursorSizeY; y++) { if (x == 2 || y == 2) tex.SetPixel(x, y, col); else tex.SetPixel(x, y, tra); } } tex.SetPixel(2, 2, col); tex.Apply(); // Determine where to draw crosshair Rect finalPos = new Rect(); switch(mode) { case SelectionType.MIDDLE_SCREEN: finalPos.Set( (Screen.width/2) - (cursorSizeX/2), (Screen.height/2) - (cursorSizeY/2), cursorSizeX, cursorSizeY ); break; case SelectionType.MOUSE: finalPos.Set( Event.current.mousePosition.x - (cursorSizeX/2), Event.current.mousePosition.y - (cursorSizeY/2), cursorSizeX, cursorSizeY ); break; } // Draw crosshair GUI.DrawTexture (finalPos, tex); }
internal void SelectTilesInRange(Vector2 vector, int range, SelectionType selectionType, bool queryPassable, bool selectOrigin = true) { GameBoardTile tile = GetTileByVector(vector); if (tile != null) { ClearCurrentSelections(); m_SelectionType = selectionType; if (selectOrigin) { SelectTile(tile, selectionType); } SelectTiles (GetTilesInRange(tile, range, queryPassable), selectionType); } }
void OnSceneGUI() { if (Toolbar.Instance) { if (selectionType != Toolbar.Instance.MeshSelection) { selectionType = Toolbar.Instance.MeshSelection; OnSelectionChanged(); } } UpdateSceneViewGUI(); UpdateMouseEditing(); grid.Draw(); HandleUtility.Repaint(); }
private List <Element> ProcSelectedIds(Document doc, UIDocument uidoc, SelectionType type) { List <ElementId> ids = uidoc.Selection.GetElementIds().ToList(); List <Element> retList = new List <Element>(); foreach (ElementId id in ids) { Element el = doc.GetElement(id); if (el.Category.Name == null) { continue; } if (el.Category.Name == "Conduits") { retList.Add(el); } } return(retList); }
public InputType Selection(SelectionType selectionType) { var input = Console.ReadKey(true); switch (selectionType) { case SelectionType.TaskPageSelection: return(TaskSelect(input.Key)); case SelectionType.TaskActionSelection: return(ActionSelect(input.Key)); case SelectionType.YesNoSubSelection: return(YesNoSelect(input.Key)); default: return(InputType.Invalid); } }
// 绘制 Node 控件 void DrawNodeControls(bool edit) { _count = nodeCount; for (int i = 0; i < _count; i++) { // 获取 Node 位置 _node = GetNodePosition(i); // 绘制 Node EditorGUI.BeginChangeCheck(); EditorKit.BeginHotControlChangeCheck(); if (_selectionType == SelectionType.Node && _selectedItem == i) { Handles.color = _capSelectedColor; } else { Handles.color = _capNormalColor; } _handleSize = HandleUtility.GetHandleSize(_node) * _controlPointCapSize; _node = Handles.FreeMoveHandle(_node, _identityQuaternion, _handleSize, _zeroVector3, Handles.DotCap); // 更新选择 if (EditorKit.EndHotControlChangeCheck() == HotControlEvent.MouseDown) { _selectionType = SelectionType.Node; _selectedItem = i; } // 修改 Node if (EditorGUI.EndChangeCheck() && edit) { Undo.RecordObject(this, undoNode); SetNodePosition(i, _node); EditorUtility.SetDirty(this); } } }
public MeshSelection(MeshSelection original) { this.selectedVertices = new List <int>(original.selectedVertices); if (original.vertCheck != null) { this.vertCheck = new Dictionary <int, bool>(original.vertCheck); } else { this.vertCheck = new Dictionary <int, bool>(); } this.selectedTriangles = new List <int>(original.selectedTriangles); if (original.triCheck != null) { this.triCheck = new Dictionary <int, bool>(original.triCheck); } else { this.triCheck = new Dictionary <int, bool>(); } this.selectedEdges = new List <int>(original.selectedEdges); if (original.edgeCheck != null) { this.edgeCheck = new Dictionary <int, bool>(original.edgeCheck); } else { this.edgeCheck = new Dictionary <int, bool>(); } this.halfEdges = new List <int>(original.halfEdges); this.selectedVerticesIDs = new List <int>(original.selectedVerticesIDs); this.selectedElements = new List <int>(original.selectedElements); if (original.elementCheck != null) { this.elementCheck = new Dictionary <int, bool>(original.elementCheck); } else { this.elementCheck = new Dictionary <int, bool>(); } this.selectionType = original.selectionType; }
private static bool SurfaceMoveTool(SelectionType selectionType, Rect dragArea) { var id = GUIUtility.GetControlID(kSurfaceMoveHash, FocusType.Keyboard, dragArea); if (!ChiselUVToolCommon.SurfaceToolBase(id, selectionType, dragArea)) { return(false); } bool needRepaint = false; switch (Event.current.GetTypeForControl(id)) { // TODO: support moving texture using keyboard case EventType.Repaint: { if (!ChiselUVToolCommon.ToolIsDragging) { break; } ChiselUVToolCommon.RenderIntersectionPoint(); ChiselUVToolCommon.RenderSnapEvent(); // TODO: show delta movement of uv break; } case EventType.MouseDrag: { if (!ChiselUVToolCommon.IsToolEnabled(id)) { break; } ChiselUVToolCommon.StartToolDragging(); TranslateSurfacesInWorldSpace(-ChiselUVToolCommon.worldDragDeltaVector); // TODO: figure out why this is reversed break; } } return(needRepaint); }
void handle_Extrude(Vector3 _direction, SelectionType _selectionType, bool _singleAction, bool _bWithAttachment) { Vector3 _lastPos = _tile_Scene.coordinates._xyz; List <GameObject> _newTileObjects = new List <GameObject>(); IsoTile _newTile = null; if (_singleAction) { if ((_newTile = tile_Extrude(_tile_Scene, _direction, _bWithAttachment)) != null) { _newTileObjects.Add(_newTile.gameObject); } } else { foreach (var obj in Selection.gameObjects) { if ((_newTile = tile_Extrude(obj.GetComponent <IsoTile>(), _direction, _bWithAttachment)) != null) { _newTileObjects.Add(_newTile.gameObject); } } } if (_newTileObjects.Count > 0) { Undo.IncrementCurrentGroup(); switch (_selectionType) { case SelectionType.LastTile: Selection.objects = _newTileObjects.ToArray(); break; case SelectionType.NewTile: break; case SelectionType.AllTile: Selection.objects = Selection.objects.Concat(_newTileObjects.ToArray()).ToArray(); break; } edgeUpdate(); } }
private void UpdateHover(Vec2 mouseScreenPos) { hoverType = SelectionType.None; hoverBranch = null; float bestDistSq = 10.0f * 10.0f; //If there's a selected branch, check it first so it gets precedence over the others if (FractalManager.SelectedBranch != null) { CheckBranchHover(FractalManager.SelectedBranch, mouseScreenPos, ref bestDistSq); } foreach (Branch branch in FractalManager.Branches) { if (branch != FractalManager.SelectedBranch) { CheckBranchHover(branch, mouseScreenPos, ref bestDistSq); } } }
private void OnTagSelectionRequested(TagBase source, SelectionType selectionType) { if (selectionType == SelectionType.Close) { HideSearchResults(); } else { if (this.searchResultsListBox.SelectedIndex == -1 && this.searchResultsListBox.Items.Count > 0) { this.searchResultsListBox.SelectedIndex = 0; } if (this.searchResultsListBox.SelectedItem != null && this.searchResultsPopup.IsOpen) { AddSelectedItem(this.searchResultsListBox.SelectedItem); HideSearchResults(); } } }
public SelectorParser(QueryModel query) { if (query.HasOperator <AsJsonResultOperator>()) { _selectionType = SelectionType.AsJson; } if (query.SelectClause.Selector is MethodCallExpression) { var method = query.SelectClause.Selector.As <MethodCallExpression>().Method; _selectionType = DetermineSelectionType(method); } if (query.HasOperator <DistinctResultOperator>()) { _distinct = true; } }
public int CountInputFeatures(ProcessingDataset dataset, Geometry extent = null) { if (SelectionType.IsWithinEditPerimeter()) { var perimeter = GetProcessingPerimeter(); extent = GeometryUtils.Intersection(extent, perimeter); } if (SelectionType.IsSelectedFeatures()) { if (dataset.Selection.SelectionCount < 1) { return(0); } var filter = ProcessingUtils.CreateFilter(dataset.WhereClause, extent); return(dataset.Selection.CountSelection(filter)); } return(CountOtherFeatures(dataset, extent)); }
/*x * public static AxWindowsMediaPlayer InitializeWindowsMediaPlayer(AxWindowsMediaPlayer axWindowsMediaPlayer, bool editable) * { * axWindowsMediaPlayer.Enabled = false; * axWindowsMediaPlayer.stretchToFit = true; * axWindowsMediaPlayer.settings.setMode("loop", true); * axWindowsMediaPlayer.PlayStateChange += (s, e) => * { * // ensures that the video auto-starts, some video types fail to do so regularly, such as .webm (They generally take longer to load too) * //if (axWindowsMediaPlayer.playState == WMPPlayState.wmppsReady) * if (e.newState == 10) // ready state * { * try // this may sometimes cause an error however this doesn't break the program so just ignore it, the video should eventually play * { * Action playInvoker = () => axWindowsMediaPlayer.Ctlcontrols.play(); * * axWindowsMediaPlayer.BeginInvoke(playInvoker); // ensures that the program waits for the media to load before playing it * Debug.WriteLine("Playing: " + axWindowsMediaPlayer.URL); * } * catch (Exception exception) * { * Debug.WriteLine(exception); * } * } * * Debug.WriteLine(axWindowsMediaPlayer.playState.ToString() + '[' + axWindowsMediaPlayer.URL + ']'); * }; * * if (editable) // If editable, allow the volume slider to be saved * { * //? The MouseDownEvent will only save the volume at the time of clicking while the MouseUpEvent won't work while using the slider * //TODO To improve this you'll need to make your own slider and attach it to the control * axWindowsMediaPlayer.MouseMoveEvent += (s, e) => * { * //! This event should only be added once!!! * WallpaperData.GetImageData(axWindowsMediaPlayer.URL).VideoSettings.volume = axWindowsMediaPlayer.settings.volume; * }; * } * else // Not editable, disable UI * { * axWindowsMediaPlayer.uiMode = "none"; * } * * return axWindowsMediaPlayer; * } * * public static AxWindowsMediaPlayer UpdateWindowsMediaPlayer(AxWindowsMediaPlayer axWindowsMediaPlayer, string videoPath) * { * axWindowsMediaPlayer.URL = videoPath; * * WallpaperData.VideoSettings VideoSettings = WallpaperData.GetImageData(videoPath).VideoSettings; * axWindowsMediaPlayer.settings.volume = VideoSettings.volume; * axWindowsMediaPlayer.settings.rate = VideoSettings.playbackSpeed; * axWindowsMediaPlayer.Enabled = true; * axWindowsMediaPlayer.settings.autoStart = true; * * // these two lines force the video to autoplay regardless of its video type, I hope * axWindowsMediaPlayer.Ctlcontrols.currentPosition = 0; * axWindowsMediaPlayer.Ctlcontrols.play(); * * return axWindowsMediaPlayer; * } */ public static SelectionType ChooseSelectionType() { SelectionType selectionType = SelectionType.None; Button selectedImageButton = new Button(); selectedImageButton.AutoSize = true; selectedImageButton.Text = "Active Selected Image"; selectedImageButton.Click += (o, i) => { selectionType = SelectionType.Active; }; Button allImagesButton = new Button(); allImagesButton.AutoSize = true; allImagesButton.Text = "All Selected Images"; allImagesButton.Click += (o, i) => { selectionType = SelectionType.All; }; MessageBoxDynamic.Show("Choose a selection type", "Choose an option", new Button[] { selectedImageButton, allImagesButton }, true); return(selectionType); }
private void SetSelected(TreeNode ParentNode, SelectionType Type) { TreeNodeData ParentNodeData = (TreeNodeData)ParentNode.Tag; int PrevNumSelectedFiles = ParentNodeData.NumSelectedFiles; SetSelectedOnChildren(ParentNode, Type); int DeltaNumSelectedFiles = ParentNodeData.NumSelectedFiles - PrevNumSelectedFiles; if (DeltaNumSelectedFiles != 0) { for (TreeNode NextParentNode = ParentNode.Parent; NextParentNode != null; NextParentNode = NextParentNode.Parent) { TreeNodeData NextParentNodeData = (TreeNodeData)NextParentNode.Tag; NextParentNodeData.NumSelectedFiles += DeltaNumSelectedFiles; UpdateImage(NextParentNode); } } }
protected SelectionBase( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; OutPortData.Add(new PortData("Elements", Resources.SelectionPortDataResultToolTip)); RegisterAllPorts(); Prefix = prefix; State = ElementState.Warning; ShouldDisplayPreviewCore = false; }
protected SelectionBase(WorkspaceModel workspaceModel, SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base(workspaceModel) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; OutPortData.Add(new PortData("Elements", "The selected elements.")); RegisterAllPorts(); SelectCommand = new DelegateCommand(Select, CanBeginSelect); Prefix = prefix; State = ElementState.Warning; }
public void OnSelect(SelectInfo selectInfo) { ISelectable[] selectionChanged; SelectionType selectionType = SelectionType.None; //! 選択を反転 if (Keyboard.Modifiers == ModifierKeys.Control) { selectionChanged = SelectHelper.ToggleSelect(selectInfo.AllNodes.Concat(selectInfo.Connections), selectInfo.NewSelectNodes.Concat(selectInfo.NewConnections)); selectionType = SelectionType.Toggle; } //! 追加選択 else if (Keyboard.Modifiers == ModifierKeys.Shift) { selectionChanged = SelectHelper.AddSelect(selectInfo.AllNodes.Concat(selectInfo.Connections), selectInfo.NewSelectNodes.Concat(selectInfo.NewConnections)); if (selectionChanged.Any()) { selectionType = SelectionType.Single; } } //! 選択されたものだけを選択するが、既に選択済みの場合は何もしない(Nodeをまとめてドラッグする際にこのモードを利用する) else if (selectInfo.NewSelectNodes.Any()) { selectionChanged = SelectHelper.SingleSelect(selectInfo.AllNodes.Concat(selectInfo.Connections), selectInfo.NewSelectNodes); selectionType = SelectionType.Single; } //! 選択されたものだけを選択状態とする else { selectionChanged = SelectHelper.OnlySelect(selectInfo.AllNodes.Concat(selectInfo.Connections), selectInfo.NewConnections); selectionType = SelectionType.Single; } //! 選択が変更されたことをイベントで通知する(undo / redo 等に使用) if (selectionChanged.Any()) { SelectionChanged?.Execute(new SelectionChangedEventArgs(selectionChanged, selectionType)); } }
/// <summary> /// Handles the Click event of the mnuSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void mnuSave_Click(object sender, EventArgs e) { if (status == SelectionType.NONE) { currentItem = new DriveMap(); } WriteCurrentItem(currentItem); if (status == SelectionType.SELECTED) { listView.RefreshObject(currentItem); } else { listView.AddObject(currentItem); status = SelectionType.SELECTED; listView.SelectObject(currentItem); listView.RefreshSelectedObjects(); } }
public Algorithm(Random r, StopCondition stopCondition, SelectionType selectionType, Crossover crossover, Mutation mutation, Cities TSPcities, int populationSize = 20, bool verbose = true, bool verbose2 = false) { this.r = r; population = new Organism[populationSize]; this.verbose = verbose; this.verbose2 = verbose2; currentEpoch = 0; stats = new Stats(this); this.stopCondition = stopCondition; stopCondition.Initialize(this); this.selectionType = selectionType; this.crossover = crossover; this.mutation = mutation; this.TSPcities = TSPcities; }
public ListView(List <T> items, CellView <T> cellView, IComparer <T> comparer, SelectionType selectionType, bool autoSort = false) { this.items = items; this.cellView = cellView; this.selectionType = selectionType; dataViewPairs = new List <DataViewPair>(); pairsPool = new List <DataViewPair>(); this.comparer = comparer; foreach (var item in items) { dataViewPairs.Add(new DataViewPair(item, cellView.Clone(), comparer)); } CellClicked += OnCellClickedHandler; CellDoubleClicked += OnCellDoubleClickedHandler; if (autoSort) { SortListViewCells(); } }
protected SelectionBase( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; OutPortData.Add(new PortData("Elements", "The selected elements.")); RegisterAllPorts(); SelectCommand = new DelegateCommand(Select, CanBeginSelect); Prefix = prefix; State = ElementState.Warning; ShouldDisplayPreviewCore = false; }
// Set the selection of object. public override void SetSelection(SelectionType selType) { base.SetSelection(selType); if (_owner != null) { var flag = _owner.RallyPoint; if (selType == SelectionType.Command) { if (flag != null && _owner.playerType == PlayerType.Current && HasSpawnPoint()) { flag.transform.localPosition = _rallyPoint; flag.transform.forward = transform.forward; flag.Enable(); } } else if (flag != null && _owner.playerType == PlayerType.Current) { flag.Disable(); } } }
//------------------------------------------------------------------------/ // Methods //------------------------------------------------------------------------/ /// <summary> /// Constructs a proxy in order to observe a given Selectable's selection messages /// </summary> /// <param name="target"></param> /// <param name="type"></param> /// <param name="onCollision"></param> /// <param name="persistent"></param> /// <returns></returns> public static SelectableProxy Construct(Selectable target, SelectionType type, OnSelectionMessage callback, bool persistent = true) { var proxy = target.gameObject.GetOrAddComponent <SelectableProxy>(); proxy.persistent = persistent; if (type == SelectionType.Selected) { proxy.onSelect += callback; } else if (type == SelectionType.Highlighted) { proxy.onHighlighted += callback; } else if (type == SelectionType.Pressed) { proxy.onPressed += callback; } return(proxy); }
public static ChromosomePair GetPair(List<Chromosome> chromosomes, SelectionType selectionType) { ChromosomePair pair = null; switch (selectionType) { case SelectionType.Random: { pair = GetPairRandom(chromosomes); break; } case SelectionType.Roulette: { pair = GetPairRoulette(chromosomes); break; } default: { throw new ArgumentException("unknonw selection type", "selectionType"); } } return pair; }
/// <summary> /// Do stuff when a player character is clicked /// </summary> /// <param name="player"></param> /// <param name="selectionType"></param> private void Select(PlayerFacade player, SelectionType selectionType) { if (player == null) { return; } switch (selectionType) { case SelectionType.Select: ReplaceSelected(player); break; case SelectionType.ControlSelect: player.Select(); break; default: throw new ArgumentOutOfRangeException(nameof(selectionType), selectionType, null); } }
/// <summary> /// Find the first selection node in a graph, run the graph /// and assert that the returned object is valid. Then /// clear the selection and re-run, ensuring that the result /// is null. /// </summary> /// <typeparam name="T1">The type parameter for the selector method.</typeparam> /// <typeparam name="T2">The expected return type for elements in the selection.</typeparam> /// <param name="selectionType"></param> private void TestSelection <T1, T2>(SelectionType selectionType) { RunCurrentModel(); // Find the first node of the specified selection type var selectNode = ViewModel.Model.HomeSpace.FirstNodeFromWorkspace <RevitSelection <T1, T2> >(); Assert.NotNull(selectNode); switch (selectionType) { case SelectionType.One: TestSingleSelection(selectNode); break; case SelectionType.Many: TestMultipleSelection(selectNode); break; } }
private void CheckBranchHover(Branch branch, Vec2 mouseScreenPos, ref float bestDistSq) { Vec2 pos; Vec2 screenPos; float distSq = 0.0f; pos = branch.Transform.Translation; screenPos = WorldToScreen(pos); distSq = (screenPos - mouseScreenPos).LengthSq; if (distSq < bestDistSq) { bestDistSq = distSq; hoverType = SelectionType.Translation; hoverBranch = branch; hoverHandlePos = pos; } pos = branch.Transform.Translation + branch.Transform.XAxis; screenPos = WorldToScreen(pos); distSq = (screenPos - mouseScreenPos).LengthSq; if (distSq < bestDistSq) { bestDistSq = distSq; hoverType = SelectionType.XAxis; hoverBranch = branch; hoverHandlePos = pos; } pos = branch.Transform.Translation + branch.Transform.YAxis; screenPos = WorldToScreen(pos); distSq = (screenPos - mouseScreenPos).LengthSq; if (distSq < bestDistSq) { bestDistSq = distSq; hoverType = SelectionType.YAxis; hoverBranch = branch; hoverHandlePos = pos; } }
/// <summary> /// Actions to take when tile t is clicked on /// </summary> /// <param name="t">tile clicked on</param> public void tileClicked(Tile t) { if (tileSelectionActive == SelectionType.INACTIVE) { return; } if (selectedUnit == null && t.occupied()) { selectUnit(t); } else if (selectedUnit != null) { // if current unit is set to move if (tileSelectionActive == SelectionType.MOVE && inRangeTiles.Contains(t)) { if (unitManager.tileAvailable(selectedUnit, t)) { Unit u = selectedUnit.currentUnit; previousTile = selectedUnit; unitManager.moveUnit(u, t, (() => selectUnit(t))); tileSelectionActive = SelectionType.INACTIVE; } } else { if (inRangeTiles.Contains(t) && !unitManager.tileAvailable(selectedUnit, t) && (t.currentUnit is EnemyUnit)) { Unit u = selectedUnit.currentUnit; unitManager.attackUnit(u, t.currentUnit, (() => { selectUnit(t); endUnitTurn(); })); GridManager.instance.resetTiles(); tileSelectionActive = SelectionType.INACTIVE; } } } }
public FeesViewModel GetFull4Student(int student) { List <FeesViewModel> list = new List <FeesViewModel>(); // main course var _student = _repos.Students.GetWith(student, "Course", "Course.Units", "Course.FeesStructures"); if (_student == null) { _selection = _student.Selection; if (_student.Course != null) { list.Add(ToFormat(_student.Course)); } } // other courses var courses = _repos.StudentCourses .ListWith("Course", "Course.Units", "Course.FeeStructures") .Where(x => x.StudentId == student) .Select(x => x.Course) .ToList(); foreach (var item in courses) { list.Add(ToFormat(item)); } if (list.Count > 0) { return(Aggregate(list)); } else { return(null); } }
public ListView() { selectionType = SelectionType.Single; m_ScrollOffset = 0.0f; m_ScrollView = new ScrollView(); m_ScrollView.StretchToParentSize(); m_ScrollView.verticalScroller.valueChanged += OnScroll; shadow.Add(m_ScrollView); RegisterCallback <GeometryChangedEvent>(OnSizeChanged); m_ScrollView.contentContainer.RegisterCallback <MouseDownEvent>(OnClick); m_ScrollView.contentContainer.RegisterCallback <KeyDownEvent>(OnKeyDown); m_ScrollView.contentContainer.focusIndex = 0; schedule.Execute(() => { Dirty(ChangeType.Layout); m_ScrollView.Focus(); }).StartingIn(1); }
private void SetSelectedOnChildren(TreeNode ParentNode, SelectionType Type) { TreeNodeData ParentNodeData = (TreeNodeData)ParentNode.Tag; int NewNumSelectedFiles = 0; switch (Type) { case SelectionType.All: NewNumSelectedFiles = ParentNodeData.NumFiles; break; case SelectionType.Empty: NewNumSelectedFiles = ParentNodeData.NumEmptySelectedFiles; break; case SelectionType.Missing: NewNumSelectedFiles = ParentNodeData.NumMissingSelectedFiles; break; case SelectionType.SafeToDelete: NewNumSelectedFiles = ParentNodeData.NumDefaultSelectedFiles; break; case SelectionType.None: NewNumSelectedFiles = 0; break; } if (NewNumSelectedFiles != ParentNodeData.NumSelectedFiles) { foreach (TreeNode ChildNode in ParentNode.Nodes) { SetSelectedOnChildren(ChildNode, Type); } ParentNodeData.NumSelectedFiles = NewNumSelectedFiles; UpdateImage(ParentNode); } }
private void graphPanel_MouseMove(object sender, MouseEventArgs e) { if (e != null) { float blockAtCursor = BlockAtPoint(e.X); if (e.Location != lastLocation) { lastLocation = e.Location; String label = ""; label += TimeString(TimeForBlock(blockAtCursor)); //if (checkBoxX.Checked) { label = label + "\r\nX: " + AggregateForBlock(blockAtCursor).Avg.X.ToString("+0.00;-0.00") + " g"; } //if (checkBoxY.Checked) { label = label + "\r\nY: " + AggregateForBlock(blockAtCursor).Avg.Y.ToString("+0.00;-0.00") + " g"; } //if (checkBoxZ.Checked) { label = label + "\r\nZ: " + AggregateForBlock(blockAtCursor).Avg.Z.ToString("+0.00;-0.00") + " g"; } //if (checkBoxAccel.Checked) { label = label + "\r\nAccel: " + AggregateForBlock(blockAtCursor).Avg.Amplitude.ToString("+0.00;-0.00") + " g"; } if (checkBoxLight.Checked) { label = label + "\r\nLight: " + AggregateForBlock(blockAtCursor).Avg.Light + ""; } if (checkBoxTemp.Checked) { label = label + "\r\nTemp: " + (AggregateForBlock(blockAtCursor).Avg.Temp / 1000).ToString("0.00") + " ^C"; } if (checkBoxBattPercent.Checked) { label = label + "\r\nBatt: " + AggregateForBlock(blockAtCursor).Avg.BattPercent + " %"; } if (checkBoxBattRaw.Checked) { label = label + "\r\nBatt: " + (AggregateForBlock(blockAtCursor).Avg.BattRaw / 1000).ToString("0.000") + " V"; } graphPanel.SetCursor(e.X, label); /* if (aggregate.Min.T > DateTime.MinValue) { toolTip.SetToolTip(graphPanel, String.Format("{0:yyyy-MM-dd HH:mm:ss}", aggregate.Min.T)); toolTip.IsBalloon = true; toolTip.ReshowDelay = 250; toolTip.Active = true; } else { toolTip.Active = false; } */ } // Operation preview cursor if (selectionType == SelectionType.SelectionNone) { SelectionType over = GetSelectionTypeAtPoint(e.X); if (over == SelectionType.SelectionNone && Mode == ModeType.Selection){ graphPanel.Cursor = Cursors.IBeam; } else if (over == SelectionType.SelectionBegin) { graphPanel.Cursor = Cursors.SizeWE; } else if (over == SelectionType.SelectionEnd) { graphPanel.Cursor = Cursors.SizeWE; } else if (over == SelectionType.SelectionMove && Mode == ModeType.Selection) { graphPanel.Cursor = Cursors.SizeAll; } else { using (System.IO.MemoryStream ms = new System.IO.MemoryStream(OmGui.Properties.Resources.zoom)) { graphPanel.Cursor = new Cursor(ms); } } return; } // Selection manipulation if (selectionType == SelectionType.SelectionBegin) { beginBlock = BlockAtPoint(e.X - mouseOffsetX); if (beginBlock > endBlock) { float t = endBlock; endBlock = beginBlock; beginBlock = t; // swap selectionType = SelectionType.SelectionEnd; } } else if (selectionType == SelectionType.SelectionEnd) { endBlock = BlockAtPoint(e.X - mouseOffsetX); if (beginBlock > endBlock) { float t = endBlock; endBlock = beginBlock; beginBlock = t; // swap selectionType = SelectionType.SelectionBegin; } } else if (selectionType == SelectionType.SelectionMove) { float span = endBlock - beginBlock; beginBlock = BlockAtPoint(e.X - mouseOffsetX); endBlock = beginBlock + span; } } Refresh(); //if (endBlock == beginBlock) //{ // graphPanel.SetSelection(-1, -1, ""); //} //else //{ // graphPanel.SetSelection(PointForBlock(beginBlock), PointForBlock(endBlock), TimeForBlock(beginBlock) + " - " + TimeForBlock(endBlock)); //} }
private void graphPanel_MouseDown(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { SelectionType over = GetSelectionTypeAtPoint(e.X); if (over == SelectionType.SelectionNone && Mode == ModeType.Selection) { selectionType = SelectionType.SelectionEnd; graphPanel.Cursor = Cursors.IBeam; beginBlock = BlockAtPoint(e.X); endBlock = beginBlock; mouseOffsetX = 0; } else if (over == SelectionType.SelectionBegin) { selectionType = SelectionType.SelectionBegin; mouseOffsetX = e.X - PointForBlock(beginBlock); } else if (over == SelectionType.SelectionEnd) { selectionType = SelectionType.SelectionEnd; mouseOffsetX = e.X - PointForBlock(endBlock); } else if (over == SelectionType.SelectionMove && Mode == ModeType.Selection) { selectionType = SelectionType.SelectionMove; mouseOffsetX = e.X - PointForBlock(beginBlock); } graphPanel.Capture = true; graphPanel_MouseMove(sender, e); // Update display } }
private void graphPanel_DoubleClick(object sender, EventArgs ea) { MouseEventArgs e = (MouseEventArgs)ea; if (e.Button == System.Windows.Forms.MouseButtons.Left && HasSelection && GetSelectionTypeAtPoint(e.X) != SelectionType.SelectionNone) { selectionType = SelectionType.SelectionNone; graphPanel.Capture = false; ZoomRange(beginBlock, endBlock); } }
private void SetSelected(TreeNode ParentNode, SelectionType Type) { TreeNodeData ParentNodeData = (TreeNodeData)ParentNode.Tag; int PrevNumSelectedFiles = ParentNodeData.NumSelectedFiles; SetSelectedOnChildren(ParentNode, Type); int DeltaNumSelectedFiles = ParentNodeData.NumSelectedFiles - PrevNumSelectedFiles; if(DeltaNumSelectedFiles != 0) { for(TreeNode NextParentNode = ParentNode.Parent; NextParentNode != null; NextParentNode = NextParentNode.Parent) { TreeNodeData NextParentNodeData = (TreeNodeData)NextParentNode.Tag; NextParentNodeData.NumSelectedFiles += DeltaNumSelectedFiles; UpdateImage(NextParentNode); } } }
private void viewRB_Checked(object sender, RoutedEventArgs e) { m_selectionType = SelectionType.Views; setParamNames(); }
private void sheetRB_Checked(object sender, RoutedEventArgs e) { m_selectionType = SelectionType.Sheets; setParamNames(); }
private void allRB_Checked(object sender, RoutedEventArgs e) { m_selectionType = SelectionType.All; setParamNames(); }
public DTreeItem(string text, SelectionType sType) { this.Text = text; this.SelectionType = sType; }
private void graphPanel_MouseUp(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { graphPanel.Capture = false; selectionType = SelectionType.SelectionNone; if (reader != null) { if (beginBlock < 0.0f) { beginBlock = 0.0f; } if (beginBlock > reader.DataNumBlocks) { beginBlock = reader.DataNumBlocks; } if (endBlock < 0.0f) { endBlock = 0.0f; } if (endBlock > reader.DataNumBlocks) { endBlock = reader.DataNumBlocks; } } graphPanel_MouseMove(sender, e); // Update cursor type and display } }
public Selection(SelectionType selectionType, int id) { SelectionType = selectionType; ID = id; }
/// <summary> /// Updates the selection state based on the selection states of the constituent atoms. /// </summary> internal void UpdateForAtomSelectionChange() { if (this.updatingSelectionProperty) return; bool dirty = false; bool fullSelected = true; bool partialSelected = false; foreach (Atom atom in this.atoms) { if (atom.IsSelected) partialSelected = true; else fullSelected = false; } if (fullSelected && this.selection != SelectionType.Full) { this.selection = SelectionType.Full; dirty = true; } else if (!fullSelected && partialSelected && this.selection != SelectionType.Partial) { this.selection = SelectionType.Partial; dirty = true; } else if (!partialSelected && this.selection != SelectionType.None) { this.selection = SelectionType.None; dirty = true; } bool fullShowAsSelected = true; bool partialShowAsSelected = false; foreach (Atom atom in this.atoms) { if (atom.ShowAsSelected) partialShowAsSelected = true; else fullShowAsSelected = false; } if (fullShowAsSelected && this.showAsSelection != SelectionType.Full) { this.showAsSelection = SelectionType.Full; dirty = true; } else if (!fullShowAsSelected && partialShowAsSelected && this.showAsSelection != SelectionType.Partial) { this.showAsSelection = SelectionType.Partial; dirty = true; } else if (!partialShowAsSelected && this.showAsSelection != SelectionType.None) { this.showAsSelection = SelectionType.None; dirty = true; } if (dirty) this.UpdateView(); }
private void SetSelectedOnChildren(TreeNode ParentNode, SelectionType Type) { TreeNodeData ParentNodeData = (TreeNodeData)ParentNode.Tag; int NewNumSelectedFiles = 0; switch(Type) { case SelectionType.All: NewNumSelectedFiles = ParentNodeData.NumFiles; break; case SelectionType.Empty: NewNumSelectedFiles = ParentNodeData.NumEmptySelectedFiles; break; case SelectionType.SafeToDelete: NewNumSelectedFiles = ParentNodeData.NumDefaultSelectedFiles; break; case SelectionType.None: NewNumSelectedFiles = 0; break; } if(NewNumSelectedFiles != ParentNodeData.NumSelectedFiles) { foreach(TreeNode ChildNode in ParentNode.Nodes) { SetSelectedOnChildren(ChildNode, Type); } ParentNodeData.NumSelectedFiles = NewNumSelectedFiles; UpdateImage(ParentNode); } }
protected override void OnMouseDown(MouseEventArgs e) { // Capture focus this.Focus(); if (selectedAppointmentIsNew) { RaiseNewAppointment(); } ITool newTool = null; Appointment appointment = GetAppointmentAt(e.X, e.Y); if (appointment == null) { if (selectedAppointment != null) { SelectedAppointment = null; Invalidate(); } newTool = drawTool; selection = SelectionType.DateRange; } else { newTool = selectionTool; SelectedAppointment = appointment; selection = SelectionType.Appointment; Invalidate(); } if (activeTool != null) { activeTool.MouseDown(e); } if ((activeTool != newTool) && (newTool != null)) { newTool.Reset(); newTool.MouseDown(e); } activeTool = newTool; base.OnMouseDown(e); }
private void TsbNewLevel_Click(object sender, EventArgs e) { SelectionType prevType = SelectionType; SelectionType = SelectionType.Level; New(); SelectionType = prevType; }
private void TsbNewWorld_Click(object sender, EventArgs e) { SelectionType prevType = SelectionType; SelectionType = SelectionType.World; New(); SelectionType = prevType; }
void Storyboard_Completed_1(object sender, object e) { StackSizeChangeCompleted(this, 0.0); if (_proportion > 1.0) { StackSizeAnimationCompleted(this, true); //show the text of every item stack for (int i = 0; i < _itemsvector.Count; i++) _itemsvector[i].ShowText(); } else { StackSizeAnimationCompleted(this, false); } this.Width = _currentstackwidth; _selectiontype = SelectionType.StackType; _touches = 0; Canvas.SetZIndex(this, 0); _itemslocked = false; }
private void newWorldToolStripMenuItem_Click(object sender, EventArgs e) { SelectionType prevType = SelectionType; SelectionType = SelectionType.World; New(); SelectionType = prevType; }