internal static void UpdateUIState(EditModes editMode) { if (_timelineDock != null) { if (Plugin.UpdateMode == UpdateModes.Continue) { _timelineDock.playButton.Image = Resources.Pause; _timelineDock.toolTip.SetToolTip(_timelineDock.playButton, "Pause"); _timelineDock.numericUpDownFPS.Visible = false; _timelineDock.effectTimer.Enabled = true; _timelineDock.checkBoxBreakCPP.Visible = true; _timelineDock.checkBoxBreakCPP.Checked = Settings.Default.BreakAPP; //_timelineDock.playButton.Enabled = !Settings.Default.BreakAPP; } else { _timelineDock.playButton.Image = Resources.Play; _timelineDock.toolTip.SetToolTip(_timelineDock.playButton, "Continue (F5)"); _timelineDock.numericUpDownFPS.Visible = true; _timelineDock.effectTimer.Enabled = false; _timelineDock.checkBoxBreakCPP.Visible = false; } if (editMode != EditModes.Connect) { MessageQueue.IsConnected = false; } _currentFrame = AgentDataPool.TotalFrames; } }
private void btnProfileSave_Click(object sender, EventArgs e) { if (this.Profiles.Any(p => p != SelectedProfile && p.Name == txtProfileName.Text)) { MessageBox.Show("Duplicate Profile Name"); return; } if (this.ProfileEditMode == EditModes.Add) { this.SelectedProfile = new Profile(txtProfileName.Text); this.Profiles.Add(SelectedProfile); } this.SelectedProfile.Name = txtProfileName.Text; if (this.SelectedProfile == CurrentProfile) { this.Text = string.Format("VisualME7Logger - {0}", this.CurrentProfile.Name); } lstProfiles.DataSource = null; lstProfiles.DataSource = this.Profiles; lstProfiles.SelectedItem = this.SelectedProfile; this.ProfileEditMode = EditModes.View; SwitchUI(); }
private void btnAddGraphVariable_Click(object sender, EventArgs e) { this.GraphVariableEditMode = EditModes.Add; this.SelectedGraphVariable = new GraphVariable(); LoadSelectedGraphVariable(); this.SwitchUI(); }
private void btnExpressionSave_Click(object sender, EventArgs e) { if (this.CurrentProfile.DisplayOptions.Expressions.Any(p => p != SelectedExpression && p.Name == txtExpressionName.Text)) { MessageBox.Show("Duplicate Expression Name"); return; } if (this.CurrentProfile.ECUFile.Measurements.Values.Any(m => m.Name == txtExpressionName.Text)) { MessageBox.Show("Invalid Expression Name"); return; } if (this.ExpressionEditMode == EditModes.Add) { this.SelectedExpression = new Session.ExpressionVariable(txtExpressionName.Text, txtExpressionUnit.Text, txtExpressionExpression.Text); this.CurrentProfile.DisplayOptions.Expressions.Add(SelectedExpression); } this.SelectedExpression.Name = txtExpressionName.Text; this.SelectedExpression.Unit = txtExpressionUnit.Text; this.SelectedExpression.Expression = txtExpressionExpression.Text; lstExpressions.DataSource = null; lstExpressions.DataSource = this.CurrentProfile.DisplayOptions.Expressions; lstExpressions.SelectedItem = this.SelectedExpression; this.ExpressionEditMode = EditModes.View; SwitchUI(); }
public override void OnKeyPress(KeyPressEventArgs keyPressEvent) { // this must be called first to ensure we get the correct Handled state base.OnKeyPress(keyPressEvent); if (!keyPressEvent.Handled) { if (keyPressEvent.KeyChar < 32 && keyPressEvent.KeyChar != 13 && keyPressEvent.KeyChar != 9) { return; } if (EditMode == EditModes.Unknown) { EditMode = EditModes.QuickText; this.content.Text = ""; } this.content.Text += keyPressEvent.KeyChar.ToString(); keyPressEvent.Handled = true; UpdateSheetEditField(); } }
internal static void UpdateUIState(EditModes editMode) { if (_timelineDock != null) { if (Plugin.UpdateMode == UpdateModes.Continue) { _timelineDock.playButton.Image = Resources.Pause; _timelineDock.toolTip.SetToolTip(_timelineDock.playButton, "Pause"); _timelineDock.numericUpDownFPS.Visible = false; _timelineDock.effectTimer.Enabled = true; //_timelineDock.playButton.Enabled = !Settings.Default.BreakAPP; } else { _timelineDock.playButton.Image = Resources.Play; _timelineDock.toolTip.SetToolTip(_timelineDock.playButton, "Continue (F5)"); _timelineDock.numericUpDownFPS.Visible = true; _timelineDock.effectTimer.Enabled = false; } bool isAnalyzeMode = (Plugin.EditMode == EditModes.Analyze); _timelineDock.startButton.Visible = isAnalyzeMode; _timelineDock.backwardButton.Visible = isAnalyzeMode; _timelineDock.forwardButton.Visible = isAnalyzeMode; _timelineDock.endButton.Visible = isAnalyzeMode; _timelineDock.zoomOutButton.Enabled = isAnalyzeMode; _timelineDock.zoomInButton.Enabled = isAnalyzeMode; if (editMode != EditModes.Connect) { MessageQueue.IsConnected = false; } _currentFrame = AgentDataPool.TotalFrames; } }
public frmEdit(object o, EditModes em, List <string> s) { InitializeComponent(); editMode = em; txtValue.Visible = (em == EditModes.TextBox); cbValue.Visible = (em == EditModes.ComboBox); switch (editMode) { case EditModes.TextBox: txtValue.Text = (string)o; txtValue.Select(); txtValue.Focus(); if ((txtValue.Text != "")) { txtValue.SelectionStart = txtValue.Text.Length - 1; } break; case EditModes.ComboBox: foreach (object str in s) { cbValue.Items.Add(str); } o = (int)o + 1; cbValue.SelectedIndex = (int)o; break; } }
private void StartReplaceClick(object sender, EventArgs e) { if (AreFilesSelected()) { EditResult result = null; switch (cmbReplaceAction.SelectedIndex) { case 0: result = FolderEdit.Edit.FolderEdit.INSTANCE.SearchText( editableFolder, EditModes.GetModeByName(cmbEditMode.Text), txtSearch.Text, chbCaseSens.Checked, chbRegex.Checked); break; case 1: result = FolderEdit.Edit.FolderEdit.INSTANCE.ReplaceText( editableFolder, EditModes.GetModeByName(cmbEditMode.Text), txtSearch.Text, txtReplace.Text, chbCaseSens.Checked, chbRegex.Checked); break; case 2: result = FolderEdit.Edit.FolderEdit.INSTANCE.DeleteFiles( editableFolder, EditModes.GetModeByName(cmbEditMode.Text), txtSearch.Text, chbCaseSens.Checked, chbRegex.Checked); break; } if (result != null) { FormSearchResult.ShowResult(result); } } }
private void ChangeTool(object sender, RoutedEventArgs e) { if (sender.Equals(line)) { selectedToolLabel.Content = "Linia"; SelectedShape = Shapes.Line; SelectedEditMode = EditModes.Draw; } else if (sender.Equals(square)) { selectedToolLabel.Content = "Prostokąt"; SelectedShape = Shapes.Rectangle; SelectedEditMode = EditModes.Draw; } else if (sender.Equals(elipsys)) { selectedToolLabel.Content = "Koło"; SelectedShape = Shapes.Circle; SelectedEditMode = EditModes.Draw; } else if (sender.Equals(edit)) { selectedToolLabel.Content = "Edycja"; SelectedEditMode = EditModes.Resize; } else if (sender.Equals(drag)) { selectedToolLabel.Content = "Suwanie"; SelectedEditMode = EditModes.Drag; } }
public frmViewCompany(EditModes editMode) { InitializeComponent(); _editMode = editMode; _formCompany = new company(); _formContactInfo = new company_contact_info(); }
private void btnEditGraphVariable_Click(object sender, EventArgs e) { if (this.SelectedGraphVariable != null) { this.GraphVariableEditMode = EditModes.Edit; this.SwitchUI(); } }
public void InitForm(MethodDefinition md, int varIndex, EditModes mode) { if (_method == md && _varIndex == varIndex) { return; } _method = md; _varIndex = varIndex; _mode = mode; Collection <VariableDefinition> vdc = _method.Body.Variables; VariableDefinition vd = null; InitTypeSpecification(); if (_varIndex >= 0 && _varIndex < vdc.Count) { vd = vdc[_varIndex]; cboType.Items.Add(vd.VariableType); if (vd.VariableType.IsArray) { cboSpecification.SelectedItem = "Array"; } else if (vd.VariableType.IsByReference) { cboSpecification.SelectedItem = "Reference"; } else if (vd.VariableType.IsPointer) { cboSpecification.SelectedItem = "Pointer"; } } switch (mode) { case EditModes.Edit: if (vd != null) { txtIndex.Text = vd.Index.ToString(); txtName.Text = vd.ToString(); cboType.SelectedItem = vd.VariableType; } break; case EditModes.Duplicate: if (vd != null) { cboType.SelectedItem = vd.VariableType; } break; default: break; } }
private void btnCancelGraphVariable_Click(object sender, EventArgs e) { if (lstGraphVariables.Items.Count > 0) { lstGraphVariables.SelectedIndex = 0; } this.GraphVariableEditMode = EditModes.View; this.LoadSelectedGraphVariable(); this.SwitchUI(); }
private void EditComplete() { if (this.content.Text != undoContent) { // make sure the is a sheet update SheetData[x, y].Expression = this.content.Text; SheetData.Recalculate(); } EditMode = EditModes.Unknown; undoContent = this.content.Text; }
public void InitForm(MethodDefinition md, int varIndex, EditModes mode) { if (_method == md && _varIndex == varIndex) return; _method = md; _varIndex = varIndex; _mode = mode; Collection<VariableDefinition> vdc = _method.Body.Variables; VariableDefinition vd = null; InitTypeSpecification(); if (_varIndex >= 0 && _varIndex < vdc.Count) { vd = vdc[_varIndex]; cboType.Items.Add(vd.VariableType); if (vd.VariableType.IsArray) { cboSpecification.SelectedItem = "Array"; } else if (vd.VariableType.IsByReference) { cboSpecification.SelectedItem = "Reference"; } else if (vd.VariableType.IsPointer) { cboSpecification.SelectedItem = "Pointer"; } } switch (mode) { case EditModes.Edit: if (vd != null) { txtIndex.Text = vd.Index.ToString(); txtName.Text = vd.ToString(); cboType.SelectedItem = vd.VariableType; } break; case EditModes.Duplicate: if (vd != null) { cboType.SelectedItem = vd.VariableType; } break; default: break; } }
public static void InspectorGUI(BuildrEditMode _editMode, BuildrData _data) { editMode = _editMode; data = _data; constraints = data.generatorConstraints; EditModes newmode = (EditModes)EditorGUILayout.EnumPopup(mode); if (newmode != mode) { mode = newmode; switch (mode) { case EditModes.general: editMode.stage = BuildrEditMode.stages.building; break; case EditModes.floorplan: editMode.stage = BuildrEditMode.stages.floorplan; editMode.SetMode(BuildrEditMode.modes.floorplan); break; } } switch (mode) { case EditModes.general: GeneralOptionsInspector(); break; case EditModes.floorplan: EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Constrain Building Generation to Floorplan", GUILayout.Width(280)); constraints.constrainPlanByPlan = EditorGUILayout.Toggle(constraints.constrainPlanByPlan); EditorGUILayout.EndHorizontal(); EditorGUI.BeginDisabledGroup(!constraints.constrainPlanByPlan); BuildrEditModeFloorplan.InspectorGUI(editMode, _data.plan); EditorGUI.EndDisabledGroup(); if (data.plan != null) { constraints.plan = data.plan.Duplicate(); } break; } if (GUI.changed) { EditorUtility.SetDirty(_editMode); EditorUtility.SetDirty(_data); _editMode.UpdateRender(); } }
public void SaveTeamViewModel(TeamEntityViewModel teamEntityViewModel, EditModes editMode) { switch (editMode) { case EditModes.Insert: SaveOnInsert(teamEntityViewModel); break; case EditModes.Update: SaveOnUpdate(teamEntityViewModel); break; } InitializeViewModel(teamEntityViewModel); }
public InformationListDialog(EditModes editMode, ObjectComboList avaiableCombos, BehaviorInfoList avaiableBehaviors) { this.avaiableCombos = avaiableCombos; this.avaiableBehaviors = avaiableBehaviors; InitializeComponent(); SetUpPropertyGrid(); this.editMode = editMode; General.LoadObjectCombosIfEmpty(); General.LoadBehaviorInfosIfEmpty(); SetUI(); TextBoxX_Search.Select(); base.UpdateAmbientColors(); }
public override void OnFocusChanged(System.EventArgs e) { base.OnFocusChanged(e); if (this.Focused) { undoContent = this.content.Text; EditMode = EditModes.Unknown; } else { EditComplete(); } }
/// <summary> /// Note that form is automatically treated as a dialog /// </summary> /// <param name="activeCompany"></param> public frmViewCompany(company activeCompany, company_contact_info activeInfo) { InitializeComponent(); _editMode = EditModes.Edit; _formCompany = activeCompany; _formContactInfo = activeInfo; txtName.Text = _formCompany.name; txtPhone.Text = activeInfo.phone_Object.FormattedPhone; txtAddress.Text = activeInfo.address; txtAddress2.Text = activeInfo.address2; txtCity.Text = activeInfo.city; txtState.Text = activeInfo.state; txtZip.Text = activeInfo.zip; }
public frmEdit(object o, EditModes em) { InitializeComponent(); editMode = em; txtValue.Visible = (em == EditModes.TextBox); cbValue.Visible = (em == EditModes.ComboBox); switch (editMode) { case EditModes.TextBox: txtValue.Text = (string)o; txtValue.Select(); txtValue.Focus(); if ((txtValue.Text != "")) txtValue.SelectionStart = txtValue.Text.Length - 1; break; case EditModes.ComboBox: cbValue.SelectedIndex = (int)o; break; } }
private void btnSaveGraphVariable_Click(object sender, EventArgs e) { this.SelectedGraphVariable.Variable = cmbGraphVariableVariable.Text; this.SelectedGraphVariable.Name = txtGraphVariableName.Text; this.SelectedGraphVariable.Min = nudGraphVariableMin.Value; this.SelectedGraphVariable.Max = nudGraphVariableMax.Value; this.SelectedGraphVariable.LineColor = txtGraphVariableColor.BackColor; this.SelectedGraphVariable.LineThickness = (int)nudGraphVariableThickness.Value; this.SelectedGraphVariable.Active = chkGraphVariableActive.Checked; this.SelectedGraphVariable.LineStyle = (ChartDashStyle)cmbGraphVariableStyle.SelectedItem; if (this.GraphVariableEditMode == EditModes.Add) { this.CurrentProfile.DisplayOptions.GraphVariables.Add(this.SelectedGraphVariable); } this.lstGraphVariables.DataSource = null; this.lstGraphVariables.DataSource = this.CurrentProfile.DisplayOptions.GraphVariables; this.GraphVariableEditMode = EditModes.View; this.SwitchUI(); }
void PasEditModeToe(EditModes editMode) { WijzigBruikbaarheidControls(grdKleur); switch (editMode) { case EditModes.editing: btnOpslaan.IsEnabled = false; break; case EditModes.readOnly: WijzigBruikbaarheidControls(grdKleur, false); btnNieuw.IsEnabled = true; break; case EditModes.canSave: break; default: break; } }
internal void UpdateUIState(EditModes editMode) { bool enabled = (editMode == EditModes.Design); this.toolStripButton_workspace.Enabled = enabled; this.refreshButton.Enabled = enabled; this.newBehaviorButton.Enabled = enabled; this.createGroupButton.Enabled = enabled; this.deleteButton.Enabled = enabled; this.exportAllButton.Enabled = enabled; //this.treeView.Enabled = enabled; switch (editMode) { case EditModes.Design: this.connectButton.Text = Resources.ConnectServer + " (Ctrl+L)"; this.connectButton.Enabled = true; this.analyzeDumpButton.Text = Resources.AnalyzeDump; this.analyzeDumpButton.Image = Resources.File_Open; this.analyzeDumpButton.Enabled = true; break; case EditModes.Connect: this.connectButton.Text = Resources.DisconnectServer + " (Ctrl+L)"; this.connectButton.Image = Resources.disconnect; this.connectButton.Enabled = true; this.analyzeDumpButton.Image = Resources.File_Open; this.analyzeDumpButton.Enabled = false; break; case EditModes.Analyze: this.connectButton.Enabled = false; this.analyzeDumpButton.Text = Resources.StopAnalyzingDump; this.analyzeDumpButton.Image = Resources.File_Delete; this.analyzeDumpButton.Enabled = true; break; } }
internal static void UpdateUIState(EditModes editMode) { _currentFrame = -1; if (_timelineDock != null) { if (Plugin.UpdateMode == UpdateModes.Continue) { _timelineDock.playButton.Image = Resources.Pause; _timelineDock.toolTip.SetToolTip(_timelineDock.playButton, "Pause"); _timelineDock.numericUpDownFPS.Visible = false; _timelineDock.effectTimer.Enabled = true; //_timelineDock.playButton.Enabled = !Settings.Default.BreakAPP; } else { _timelineDock.playButton.Image = Resources.Play; _timelineDock.toolTip.SetToolTip(_timelineDock.playButton, "Continue (F5)"); _timelineDock.numericUpDownFPS.Visible = true; _timelineDock.effectTimer.Enabled = false; } bool isAnalyzeMode = (Plugin.EditMode == EditModes.Analyze); _timelineDock.startButton.Visible = isAnalyzeMode; _timelineDock.backwardButton.Visible = isAnalyzeMode; _timelineDock.forwardButton.Visible = isAnalyzeMode; _timelineDock.endButton.Visible = isAnalyzeMode; _timelineDock.zoomOutButton.Enabled = isAnalyzeMode; _timelineDock.zoomInButton.Enabled = isAnalyzeMode; if (editMode != EditModes.Connect) { MessageQueue.IsConnected = false; } } }
public void InitForm(frmClassEdit mainForm, MethodDefinition md, int insIndex, EditModes mode) { if (_method == md && _insIndex == insIndex) return; _mainForm = mainForm; _method = md; _ilp = md.Body.GetILProcessor(); _insIndex = insIndex; _mode = mode; Collection<Instruction> ic = _method.Body.Instructions; switch (mode) { case EditModes.Edit: _ins = ic[_insIndex]; if (_ins.Previous == null) { txtPrevIns.Text = String.Empty; } else { txtPrevIns.Text = InsUtils.GetInstructionText(ic, ic.IndexOf(_ins.Previous)); } if (_ins.Next == null) { txtNextIns.Text = String.Empty; } else { txtNextIns.Text = InsUtils.GetInstructionText(ic, ic.IndexOf(_ins.Next)); } break; case EditModes.InsertAfter: _ins = _ilp.Create(OpCodes.Nop); txtPrevIns.Text = InsUtils.GetInstructionText(ic, _insIndex); if (ic[_insIndex].Next == null) { txtNextIns.Text = String.Empty; } else { txtNextIns.Text = InsUtils.GetInstructionText(ic, ic.IndexOf(ic[_insIndex].Next)); } break; case EditModes.InsertBefore: _ins = _ilp.Create(OpCodes.Nop); txtNextIns.Text = InsUtils.GetInstructionText(ic, _insIndex); if (ic[_insIndex].Previous == null) { txtPrevIns.Text = String.Empty; } else { txtPrevIns.Text = InsUtils.GetInstructionText(ic, ic.IndexOf(ic[_insIndex].Previous)); } break; } InitOpCodes(cboOpCode); }
private void btSave_Click(object sender, EventArgs e) { if (noFilterIsSelected()) editMode = EditModes.CreateNew; save(); }
public frmClassEditInstruction(frmClassEdit mainForm, MethodDefinition md, int insIndex, EditModes mode) { InitializeComponent(); InitForm(mainForm, md, insIndex, mode); }
private void SetCursor(EditModes mode) { switch (mode) { case EditModes.Move: case EditModes.Scale: m_activeCursor = m_cursors[CursorType.Selection]; break; case EditModes.AddPoint: case EditModes.InsertPoint: m_activeCursor = m_cursors[CursorType.AddPoint]; break; default: m_activeCursor = m_cursors[CursorType.Default]; break; } Cursor = m_activeCursor; }
public static void OnEnable() { ScrapeXMLFilenames(); ScrapeXMLTextureFilenames(); mode = EditModes.general; }
public void FillModelStateErrors(ModelStateDictionary modelState, TeamEntityViewModel teamEntityViewModel, EditModes insert) { modelState.AddModelErrors(_teamValidator.GetInsertValidationErrors()); modelState.AddModelErrors(_userValidator.GetInsertValidationErrors()); }
//Вставить private void menupaste_Click(object sender, EventArgs e) { if (Selected) //Вот здесь надо сделать по умному, если выделение уже есть, вставлить в левый верхний угол { SelectFix(); if (PKursorX > SelectX1) PKursorX = SelectX1; if (PKursorY > SelectY1) PKursorY = SelectY1; } if (Clipboard == null) return; for (int i = 0; i < Clipboard.GetLength(0); i++) for (int j = 0; j < Clipboard.GetLength(1); j++) try { CurrentProject.Patterns[CurrentProject.Track[TKursor]].Note[PKursorX + i, PKursorY + j] = Clipboard[i, j]; } catch { } Selected = false; EditMode = 0; DrawPattern(); pictureBox1.Image = TXT.Screen; HistoryChange(); }
private void Plugin_EditModeHandler(EditModes preEditMode, EditModes curEditMode) { try { // Clear data MessageQueue.Clear(); UndoManager.ClearAll(); if (curEditMode == EditModes.Design) { saveLayout(preEditMode, __layoutDebugFile); if (this.WindowState != FormWindowState.Normal) { this.Hide(); this.WindowState = FormWindowState.Normal; } loadLayout(curEditMode, __layoutDesignFile, true); } else { saveLayout(preEditMode, __layoutDesignFile); if (this.WindowState != FormWindowState.Normal) { this.Hide(); this.WindowState = FormWindowState.Normal; } loadLayout(curEditMode, __layoutDebugFile, true); // Create the log related folders if not existed string logFileDir = Utilities.GetLogFileDirectory(); if (!Directory.Exists(logFileDir)) { Directory.CreateDirectory(logFileDir); } if (curEditMode == EditModes.Connect) { // Clear the log related folders Utilities.ClearDirectory(logFileDir); } } } catch { } Update(); this.Show(); }
private void saveLayout(EditModes editMode, string layoutFile, bool isClosing) { // store GUI related stuff if (Workspace.Current != null) { // Save the debug info. DebugDataPool.Save(Workspace.Current.FileName); } if (!isClosing) { preSaveLayout(editMode); } // store the layout and ensure the folder exists string dir = System.IO.Path.GetDirectoryName(layoutFile); if (!System.IO.Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } dockPanel.SaveAsXml(layoutFile); // store the application's settings if (this.WindowState == FormWindowState.Normal) { Settings.Default.MainWindowLocation = Location; Settings.Default.MainWindowSize = Size; Settings.Default.MainWindowState = FormWindowState.Normal; } else if (this.WindowState == FormWindowState.Maximized) { Settings.Default.MainWindowState = FormWindowState.Maximized; } Settings.Default.Save(); }
private void btnEditFilter_Click(object sender, EventArgs e) { foreach (FilterBriefInfo filterInfo in arrFilterInfo) { if (filterInfo.IsSelected) { this.editedFilter = filterInfo.Filter; editMode = EditModes.EditOld; this.txtFilterName.Text = filterInfo.Name; if (filterInfo.Filter.GetType() == typeof(Filter_NOT)) { //load selected NOT FILTER rbNotFilter.Checked = true; //show details of this filter foreach (FilterBriefInfoForCmb o in arrFilterInfoOfNotFilter) { if (o.getFilter().Name == ((Filter_NOT)filterInfo.Filter).Filter.Name) cmbFilterOfNotFilter.SelectedItem = o; } } else if (filterInfo.Filter.GetType() == typeof(BasicFilter)) { radioBasicFilter.Checked = true; //show details of this filter5 foreach (TagBriefInfoForCmb o in arrTagsOfCmb) { if (o.Name == ((BasicFilter)editedFilter).Tag.Name) { cmbTag.SelectedItem = o; } } foreach (OperationBriefInfo o in arrOperatorOfCmb) { if (o.Name == ((BasicFilter)editedFilter).Operator.Name) { cmbOperator.SelectedItem = o; } } txtValue.Text = ((BasicFilter)editedFilter).Criteria; } else if (filterInfo.Filter.GetType() == typeof(CombinedFilter_AND) || filterInfo.Filter.GetType() == typeof(CombinedFilter_OR)) { rbCombinedFilter.Checked = true; //show details of this filter foreach (FilterBriefInfoForCmb o in arrFilterInfo1OfCombinedFilter) { if (o.getFilter().Name == ((CombinedFilter)filterInfo.Filter).Filter1.Name) cmbFilter1OfCombinedFilter.SelectedItem = o; } foreach (FilterBriefInfoForCmb o in arrFilterInfo2OfCombinedFilter) { if (o.getFilter().Name == ((CombinedFilter)filterInfo.Filter).Filter2.Name) cmbFilter2OfCombinedFilter.SelectedItem = o; } if (filterInfo.Filter.GetType() == typeof(CombinedFilter_AND)) cmbOperatorOfCombinedFilter.Text = "AND"; else cmbOperatorOfCombinedFilter.Text = "OR"; } } } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (!Actived) return; if (!IsActive) return; Tool t = ToolL; int l = Editor.Layer; if (EditMode == EditModes.Carcase) { t = ToolC; l = 0; } //Возвращаем мышку в полном экране, если она убежала за границу видимого if (graphics.IsFullScreen) { int x = Mouse.GetState().X; int y = Mouse.GetState().Y; bool ch = false; if (x >= Project.ScreenWidth) { x = Project.ScreenWidth - 1; ch = true; } if (y >= Project.ScreenHeight) { y = Project.ScreenHeight - 1; ch = true; } if (ch) Mouse.SetPosition(x, y); } //Вычисляем какая ячейка находится под мышкой int cx = (int)(Mouse.GetState().X + Editor.X * Project.Px[l].X) / Project.ScaledSize; int cy = (int)(Mouse.GetState().Y + Editor.Y * Project.Px[l].Y) / Project.ScaledSize; //Узнаём, свободна ли клавиатура, нажат ли какой-нибудь Alt, Ctrl Или Shift bool AltKey = Keyboard.GetState().IsKeyDown(Keys.LeftAlt) | Keyboard.GetState().IsKeyDown(Keys.RightAlt); bool ControlKey = Keyboard.GetState().IsKeyDown(Keys.LeftControl) | Keyboard.GetState().IsKeyDown(Keys.RightControl); bool ShiftKey = Keyboard.GetState().IsKeyDown(Keys.LeftShift) | Keyboard.GetState().IsKeyDown(Keys.RightShift); if (Keyboard.GetState().GetPressedKeys().Length == 0) KeyHold = false; if (Keyboard.GetState().IsKeyUp(Keys.Z)) ZHold = false; if (Keyboard.GetState().IsKeyUp(Keys.Y)) YHold = false; //Переключение в полный экран и обратно if (AltKey & Keyboard.GetState().IsKeyDown(Keys.Enter)) { graphics.ToggleFullScreen(); IsMouseVisible = !graphics.IsFullScreen; //Чтоб небыло нежелательного скролла помешаем мышку в центр if (graphics.IsFullScreen) Mouse.SetPosition(Project.ScreenWidth / 2, Project.ScreenHeight / 2); } //Обрабатываем анимацию if (Animation.Enable) foreach (Animation anim in Project.Animations) anim.Action(); //Переход в главное меню if (Keyboard.GetState().IsKeyDown(Keys.Escape) & !KeyHold) { if (graphics.IsFullScreen) { graphics.ToggleFullScreen(); IsMouseVisible = true; } KeyHold = true; Actived = false; TimerLayers = 0; form.ShowDialog(); Actived = true; } //Обработка режимов редактирования if (Mode == Modes.Edit) { //Движение мышкой средней кнопкой if (MoveMode) //Кнопка уже была нажата перемешаем экран на разницу мышки от старого положения { Editor.X += (int)OldMouse.X - Mouse.GetState().Position.X; Editor.Y += (int)OldMouse.Y - Mouse.GetState().Position.Y; } OldMouse = Mouse.GetState().Position.ToVector2(); if (Mouse.GetState().MiddleButton == ButtonState.Pressed) { MoveMode = true; if (!graphics.IsFullScreen) IsMouseVisible = false; //OldMouse = Mouse.GetState().Position.ToVector2(); } else { MoveMode = false; if (!graphics.IsFullScreen) IsMouseVisible = true; } //Проверка на тыканье мышкой if (Mouse.GetState().LeftButton == ButtonState.Pressed & !MoveMode) { for (int i = 0; i < t.Width; i++) for (int j = 0; j < t.Height; j++) Project.Put(l, cx + i, cy + j, t.M[i, j]); Hystory.AddRecord(); } int inc = 16; if (ControlKey) inc = 128; //Прочие способы скола, если средняя кнопка не нажата if (!MoveMode) { //Движение карты клавишами if (Keyboard.GetState().IsKeyUp(Keys.LeftShift) & Keyboard.GetState().IsKeyUp(Keys.RightShift) & Keyboard.GetState().IsKeyDown(Keys.Right)) Editor.X += inc; if (Keyboard.GetState().IsKeyUp(Keys.LeftShift) & Keyboard.GetState().IsKeyUp(Keys.RightShift) & Keyboard.GetState().IsKeyDown(Keys.Left)) Editor.X -= inc; if (Keyboard.GetState().IsKeyUp(Keys.LeftShift) & Keyboard.GetState().IsKeyUp(Keys.RightShift) & Keyboard.GetState().IsKeyDown(Keys.Down)) Editor.Y += inc; if (Keyboard.GetState().IsKeyUp(Keys.LeftShift) & Keyboard.GetState().IsKeyUp(Keys.RightShift) & Keyboard.GetState().IsKeyDown(Keys.Up)) Editor.Y -= inc; //Движение карты мышкой у края экрана if (Mouse.GetState().Position.X < 3 & Mouse.GetState().Position.X > -20 & Mouse.GetState().Position.Y >= 0 & Mouse.GetState().Position.Y <= Project.ScreenHeight) Editor.X -= inc / 2; if (Mouse.GetState().Position.Y < 3 & Mouse.GetState().Position.Y > -20 & Mouse.GetState().Position.X >= 0 & Mouse.GetState().Position.X <= Project.ScreenWidth) Editor.Y -= inc / 2; if (Mouse.GetState().Position.X > Project.ScreenWidth - 3 & Mouse.GetState().Position.X < Project.ScreenWidth + 20 & Mouse.GetState().Position.Y >= 0 & Mouse.GetState().Position.Y <= Project.ScreenHeight) Editor.X += inc / 2; if (Mouse.GetState().Position.Y > Project.ScreenHeight - 3 & Mouse.GetState().Position.Y < Project.ScreenHeight + 20 & Mouse.GetState().Position.X >= 0 & Mouse.GetState().Position.X <= Project.ScreenWidth) Editor.Y += inc / 2; } //Переход в режим выбора инструмента if (Mouse.GetState().RightButton != ButtonState.Pressed) RightClickHold = false; if (Mouse.GetState().RightButton == ButtonState.Pressed & !RightClickHold & !MoveMode) { TimerLayers = 0; RightClickHold = true; Mode = Modes.SelectTool; TimerLabels = 0; } //Переключение слоёв if (Keyboard.GetState().IsKeyDown(Keys.PageUp) & !KeyHold && Editor.Layer > 1) { Editor.Layer--; TimerLayer = 16; PopUp(); } if (Keyboard.GetState().IsKeyDown(Keys.PageDown) & !KeyHold && Editor.Layer < Project.Layers) { Editor.Layer++; TimerLayer = 16; PopUp(); } //Переключение видимости слоёв if (Keyboard.GetState().IsKeyDown(Keys.Enter) & !KeyHold) { Editor.ShowOnlyCurrentLayer ^= true; if (!Editor.ShowOnlyCurrentLayer) PopUp("Отображаются все слои", 320); else PopUp("Отображается только текущий слой", 320); TimerLayers = 255; KeyHold = true; } //Включение/выключение каркаса if (Keyboard.GetState().IsKeyDown(Keys.Space) & !KeyHold) { if (EditMode == EditModes.Layers) EditMode = EditModes.Carcase; else EditMode = EditModes.Layers; PopUp(); } //Переключение в режим выбора штампа if (AltKey & !KeyHold) { Mode = Modes.SelectStamp; PopUp("Выберите область для создания штампа", 360); TimerLayers = 0; } //Переключение в режим тайлинга if (ShiftKey & !KeyHold) { Mode = Modes.Tiling; Select.Active = false; PopUp("Режим тайлинга", 140); TimerLayers = 0; } //Вызов штампа if (!ControlKey & EditMode == EditModes.Layers) { bool load = false; if (Keyboard.GetState().IsKeyDown(Keys.D1)) { StampNum = 1; t.CopyBy(Project.Stamps[1]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D2)) { StampNum = 2; t.CopyBy(Project.Stamps[2]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D3)) { StampNum = 3; t.CopyBy(Project.Stamps[3]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D4)) { StampNum = 4; t.CopyBy(Project.Stamps[4]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D5)) { StampNum = 5; t.CopyBy(Project.Stamps[5]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D6)) { StampNum = 6; t.CopyBy(Project.Stamps[6]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D7)) { StampNum = 7; t.CopyBy(Project.Stamps[7]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D8)) { StampNum = 8; t.CopyBy(Project.Stamps[8]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D9)) { StampNum = 9; t.CopyBy(Project.Stamps[9]); load = true; } if (Keyboard.GetState().IsKeyDown(Keys.D0)) { StampNum = 0; t.Reset(); } if (load) if (StampNum > 0) PopUp("Выбран штамп " + StampNum, 150); else PopUp("Инструмент сброшен", 200); } //Включение/выключение показа кодов if (Keyboard.GetState().IsKeyDown(Keys.C) & !KeyHold) { Editor.Codes ^= true; if (Editor.Codes) PopUp("Отображение кодов включено", 300); else PopUp("Отображение кодов выключено", 300); KeyHold = true; } //Включение/выключение анимации if (Keyboard.GetState().IsKeyDown(Keys.A) & !KeyHold) { Animation.Enable ^= true; if (Animation.Enable) PopUp("Анимация включена", 190); else PopUp("Анимация выключена", 190); KeyHold = true; } //Включение/выключение рандома if (Keyboard.GetState().IsKeyDown(Keys.R) & !KeyHold) { RandomTile.Enable ^= true; if (RandomTile.Enable) PopUp("Рандом включен", 160); else PopUp("Рандом выключен", 160); KeyHold = true; } //Включение/выключение автозаполнения if (Keyboard.GetState().IsKeyDown(Keys.K) & !KeyHold) { AutoRule.Enable ^= true; KeyHold = true; if (AutoRule.Enable) PopUp("Автозаполнение включено", 250); else PopUp("Автозаполнение выключено", 250); } //Переключение режима отображения фантомного слоя if (Keyboard.GetState().IsKeyDown(Keys.F) & !KeyHold) { Editor.Phantom++; if (Editor.Phantom > 2) Editor.Phantom = 0; PopUp("Видимость фантомного слоя: " + Editor.Phantom * 50 + "%", 310); KeyHold = true; } //Быстрый доступ к слоям if (Keyboard.GetState().IsKeyDown(Keys.NumPad0) & !KeyHold) { EditMode = EditModes.Carcase; PopUp(); } if (Keyboard.GetState().IsKeyDown(Keys.NumPad1) & !KeyHold) { EditMode = EditModes.Layers; Editor.Layer = 1; PopUp(); TimerLayer = 16; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad2) & !KeyHold & Project.Layers >= 2) { EditMode = EditModes.Layers; Editor.Layer = 2; PopUp(); TimerLayer = 16; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad3) & !KeyHold & Project.Layers >= 3) { EditMode = EditModes.Layers; Editor.Layer = 3; PopUp(); TimerLayer = 16; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad4) & !KeyHold & Project.Layers >= 4) { EditMode = EditModes.Layers; Editor.Layer = 4; PopUp(); TimerLayer = 16; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad5) & !KeyHold & Project.Layers >= 5) { EditMode = EditModes.Layers; Editor.Layer = 5; PopUp(); TimerLayer = 16; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad6) & !KeyHold & Project.Layers >= 6) { EditMode = EditModes.Layers; Editor.Layer = 6; PopUp(); TimerLayer = 16; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad7) & !KeyHold & Project.Layers >= 7) { EditMode = EditModes.Layers; Editor.Layer = 7; PopUp(); TimerLayer = 16; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad8) & !KeyHold & Project.Layers >= 8) { EditMode = EditModes.Layers; Editor.Layer = 8; PopUp(); TimerLayer = 16; } //Изменением масштаба float oldscale = Editor.Scale; float x = (Mouse.GetState().X + Editor.X) / Project.ScaledSize; float y = (Mouse.GetState().Y + Editor.Y) / Project.ScaledSize; if ((Wheel - Mouse.GetState().ScrollWheelValue > 0 | Keyboard.GetState().IsKeyDown(Keys.Subtract)) && Editor.Scale>0.1f) Editor.Scale -= 0.1f; if ((Wheel - Mouse.GetState().ScrollWheelValue < 0 | Keyboard.GetState().IsKeyDown(Keys.Add)) && Editor.Scale<2) Editor.Scale += 0.1f; if (Keyboard.GetState().IsKeyDown(Keys.Multiply)) Editor.Scale = 1; if (oldscale != Editor.Scale) { PopUp("Масштаб " + (Editor.Scale).ToString("0%"), 130); Editor.X = (int)x * Project.ScaledSize - Mouse.GetState().X; Editor.Y = (int)y * Project.ScaledSize - Mouse.GetState().Y; } //Корректируем позицию камеры на карте if (Editor.X > Project.Width * Project.ScaledSize - Project.ScreenWidth) Editor.X = Project.Width * Project.ScaledSize - Project.ScreenWidth; if (Editor.X < 0) Editor.X = 0; if (Editor.Y > Project.Height * Project.ScaledSize - Project.ScreenHeight) Editor.Y = Project.Height * Project.ScaledSize - Project.ScreenHeight; if (Editor.Y < 0) Editor.Y = 0; //Сохранение штампа if (ControlKey) { bool sav = false; if (Keyboard.GetState().IsKeyDown(Keys.D1)) { StampNum = 1; Project.Stamps[1].CopyBy(t); sav = true; } if (Keyboard.GetState().IsKeyDown(Keys.D2)) { StampNum = 2; Project.Stamps[2].CopyBy(t); sav = true; } if (Keyboard.GetState().IsKeyDown(Keys.D3)) { StampNum = 3; Project.Stamps[3].CopyBy(t); sav = true; } if (Keyboard.GetState().IsKeyDown(Keys.D4)) { StampNum = 4; Project.Stamps[4].CopyBy(t); sav = true; } if (Keyboard.GetState().IsKeyDown(Keys.D5)) { StampNum = 5; Project.Stamps[5].CopyBy(t); sav = true; } if (Keyboard.GetState().IsKeyDown(Keys.D6)) { StampNum = 6; Project.Stamps[6].CopyBy(t); sav = true; } if (Keyboard.GetState().IsKeyDown(Keys.D7)) { StampNum = 7; Project.Stamps[7].CopyBy(t); sav = true; } if (Keyboard.GetState().IsKeyDown(Keys.D8)) { StampNum = 8; Project.Stamps[8].CopyBy(t); sav = true; } if (Keyboard.GetState().IsKeyDown(Keys.D9)) { StampNum = 9; Project.Stamps[9].CopyBy(t); sav = true; } if (sav) PopUp("Штамп сохранен в ячейку " + StampNum, 240); } //Правка if (ControlKey & Keyboard.GetState().IsKeyDown(Keys.Z) & !ZHold) { Hystory.Undo(); ZHold = true; } if (ControlKey & Keyboard.GetState().IsKeyDown(Keys.Y) & !YHold) { Hystory.Redo(); YHold = true; } } //Режим выбора инструмента if (Mode == Modes.SelectTool) //Тут только для выбора большого инструмента { Select.End(Tool.Xcalc(Mouse.GetState().X), Mouse.GetState().Y / Project.TileSize); //Выход из режима выбора спрайта if (Mouse.GetState().RightButton != ButtonState.Pressed) RightClickHold = false; if (Mouse.GetState().RightButton == ButtonState.Pressed & !RightClickHold) { RightClickHold = true; Mode = Modes.Edit; } if (Mouse.GetState().LeftButton == ButtonState.Pressed & !Select.Active) Select.Start(Tool.Xcalc(Mouse.GetState().X), Mouse.GetState().Y / Project.TileSize); if (Mouse.GetState().LeftButton != ButtonState.Pressed & Select.Active) { //Высчитываем выделение t.Width = Select.Width; t.Height = Select.Height; for (int i = 0; i < Select.Width; i++) for (int j = 0; j < Select.Height; j++) t.M[i, j] = (ushort)(Select.Left + i + (Select.Top + j + t.Scroll) * (Project.ScreenWidth / Project.TileSize)); Select.Active = false; Mode = Modes.Edit; StampNum = 0; } //Прокрутка t.Scroll += (Wheel - Mouse.GetState().ScrollWheelValue) / 40; if (Mouse.GetState().Position.Y < 3 & Mouse.GetState().Position.Y > -20 & Mouse.GetState().Position.X >= 0 & Mouse.GetState().Position.X <= Project.ScreenWidth) { ScrollSlowDown++; if (ScrollSlowDown > 5) { t.Scroll--; ScrollSlowDown = 0; } } if (Mouse.GetState().Position.Y > Project.ScreenHeight - 3 & Mouse.GetState().Position.Y < Project.ScreenHeight + 20 & Mouse.GetState().Position.X >= 0 & Mouse.GetState().Position.X <= Project.ScreenWidth) { ScrollSlowDown++; if (ScrollSlowDown > 5) { t.Scroll++; ScrollSlowDown = 0; } } if (Keyboard.GetState().IsKeyDown(Keys.Up)) t.Scroll--; if (Keyboard.GetState().IsKeyDown(Keys.Down)) t.Scroll++; //Скорректируем, если надо курсор int Rows = SpritesCount() / (Project.ScreenWidth / Project.TileSize); if (t.Scroll > Rows - (Project.ScreenHeight / Project.TileSize)) t.Scroll = Rows - (Project.ScreenHeight / Project.TileSize); if (t.Scroll < 0) t.Scroll = 0; //Смена фона if (Keyboard.GetState().IsKeyDown(Keys.Space) & !KeyHold) { KeyHold = true; Project.ToolBackground++; if (Project.ToolBackground > 2) Project.ToolBackground = 0; Project.Saved = false; } } //Режим выбора штампа if (Mode == Modes.SelectStamp) { Select.End(cx, cy); if (!AltKey) Mode = Modes.Edit; if (Mouse.GetState().LeftButton == ButtonState.Pressed & !Select.Active) Select.Start(cx, cy); if (Mouse.GetState().LeftButton != ButtonState.Pressed & Select.Active) { Select.End(cx, cy); //Создаём штамп с имеющейся карты t.Width = Select.Width; t.Height = Select.Height; for (int i = 0; i < t.Width; i++) for (int j = 0; j < t.Height; j++) t.M[i, j] = Project.Get(l, Select.Left + i, Select.Top + j); Select.Active = false; Mode = Modes.Edit; KeyHold = true; StampNum = 0; } } //Режим тайлинга if (Mode == Modes.Tiling) { Select.End(cx, cy); if (!Keyboard.GetState().IsKeyDown(Keys.LeftShift) & !Keyboard.GetState().IsKeyDown(Keys.RightShift)) Mode = Modes.Edit; if (Mouse.GetState().LeftButton == ButtonState.Pressed & !Select.Active) Select.Start(cx, cy); if (Mouse.GetState().LeftButton != ButtonState.Pressed & Select.Active) { Select.End(cx, cy); //Тайлим выделенную область int ti = 0; for (int i = 0; i < Select.Width; i++) { int tj = 0; for (int j = 0; j < Select.Height; j++) { Project.Put(l, Select.Left + i, Select.Top + j, t.M[ti, tj]); tj++; if (tj >= t.Height) tj = 0; } ti++; if (ti >= t.Width) ti = 0; } Select.Active = false; KeyHold = true; Hystory.AddRecord(); } } base.Update(gameTime); Wheel = Mouse.GetState().ScrollWheelValue; //Делаем это независимо от режима, а то получается что прокрутка работает даже при другом режиме }
private void DrawGUILayout() { Handles.BeginGUI(); GUILayout.BeginArea(new Rect(10.0f, 10.0f, 150.0f, 400.0f)); GUIStyle newStyle = GUI.skin.GetStyle("Button"); newStyle.stretchWidth = true; newStyle.fixedWidth = 100.0f; m_mode = (EditModes) GUILayout.SelectionGrid((int)m_mode, labels, 1); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(10.0f, Screen.height - 100.0f, 150.0f, 90.0f)); if(GUILayout.Button("Add Node")) { UnityEngine.Camera currentCamera = UnityEngine.Camera.current; Vector3 placePoint = currentCamera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 1.0f)); Level editorLevel = (Level) target; WallLayoutNode newNode = ScriptableObject.CreateInstance<WallLayoutNode>(); newNode.m_position.x = placePoint.x; newNode.m_position.y = placePoint.y; editorLevel.AddNode(newNode); } GUILayout.EndArea(); Handles.EndGUI(); }
public frmClassEditVariable(MethodDefinition md, int varIndex, EditModes mode) { InitializeComponent(); InitForm(md, varIndex, mode); }
void BoneEditor_KeyDown(object sender, KeyEventArgs e) { if (picLostFocus) return; uint key = (uint)e.KeyCode; if (key == Properties.Settings.Default.HotKeys_Bone_Rotate) { editMode = EditModes.BONE_ROTATE; } if (key == Properties.Settings.Default.HotKeys_Bone_Shift) { editMode = EditModes.BONE_SHIFT; } if (key == Properties.Settings.Default.HotKeys_Bone_Stretch) { editMode = EditModes.BONE_STRETCH; } if (key == Properties.Settings.Default.HotKeys_Bone_FreeEdit) { editMode = EditModes.BONE_STRETCH_ROTATE; } if (key == Properties.Settings.Default.HotKeys_Cancel) { editMode = EditModes.None; } if (e.KeyCode == Keys.T) { drawDistanceTestPoints = true; } Redraw(); }
internal void UpdateUIState(EditModes editMode) { bool enabled = (editMode == EditModes.Design); this.saveBehaviorMenuItem.Enabled = enabled; this.saveAsBehaviorMenuItem.Enabled = enabled; this.saveAllMenuItem.Enabled = enabled; this.exportBehaviorMenuItem.Enabled = enabled; this.exportAllMenuItem.Enabled = enabled; this.dumpMenuItem.Visible = (editMode == EditModes.Connect); this.newWorkspaceMenuItem.Enabled = enabled; this.openWorkspaceMenuItem.Enabled = enabled; this.editWorkspaceMenuItem.Enabled = enabled; this.reloadWorkspaceMenuItem.Enabled = enabled; this.timelineMenuItem.Enabled = !enabled; this.recentFilesMenuItem.Enabled = enabled; this.recentWorkspacesMenuItem.Enabled = enabled; this.debugMenuButton.Enabled = !enabled; this.newBehaviorMenuItem.Enabled = enabled; this.createGroupMenuItem.Enabled = enabled; //this.deleteSelectedMenuItem.ShortcutKeys = Keys.Delete; //this.deleteTreeMenuItem.ShortcutKeys = Keys.Shift | Keys.Delete; this.cutSelectedMenuItem.Enabled = enabled; this.cutTreeMenuItem.Enabled = enabled; this.copySelectedMenuItem.Enabled = enabled; this.pasteSelectedMenuItem.Enabled = enabled; this.deleteSelectedMenuItem.Enabled = enabled; this.deleteTreeMenuItem.Enabled = enabled; this.showProfilingToolStripMenuItem.Enabled = !enabled; this.showProfilingToolStripMenuItem.Checked = Settings.Default.ShowProfilingInfo; this.showNodeIdToolStripMenuItem.Checked = NodeViewData.ShowNodeId; switch (editMode) { case EditModes.Design: this.connectMenuItem.Text = Resources.ConnectServer; this.connectMenuItem.Image = Resources.connect; this.analyzeDumpMenuItem.Text = Resources.AnalyzeDump; this.connectMenuItem.Enabled = true; this.analyzeDumpMenuItem.Enabled = true; this.connectMenuItem.Image = Resources.connect; break; case EditModes.Connect: this.connectMenuItem.Image = Resources.disconnect; this.connectMenuItem.Text = Resources.DisconnectServer; this.connectMenuItem.Enabled = true; this.analyzeDumpMenuItem.Enabled = false; break; case EditModes.Analyze: this.connectMenuItem.Enabled = false; this.analyzeDumpMenuItem.Text = Resources.StopAnalyzingDump; this.analyzeDumpMenuItem.Enabled = true; break; } }
public void SaveUserViewModel(int? userId, UserEntityViewModel userEntityViewModel, EditModes editMode) { _userValidator.EntityViewModel = userEntityViewModel; bool passwordChanged = !String.IsNullOrEmpty(userEntityViewModel.Password); bool isValid = false; switch (editMode) { case EditModes.Insert: isValid = _userValidator.IsInsertValid(); break; case EditModes.Update: isValid = _userValidator.IsUpdateValid(passwordChanged); break; } if (isValid) { User user = null; if (userId == null) user = new User(); else user = _userRepository.GetByID((int) userId); if(user == null) throw new EntityException("User does not exist."); _userMapper.MapToModel(userEntityViewModel, user, passwordChanged); switch (userEntityViewModel.UserInsertScenario) { case UserInsertScenario.WorkshopMember: _userService.AddToWorkshop((int)userEntityViewModel.OrganizationID, user); break; case UserInsertScenario.WorkshopManager: _userService.ChangeWorkshopManager((int)userEntityViewModel.OrganizationID, user); break; case UserInsertScenario.TeamManager: _userService.ChangeTeamManager((int)userEntityViewModel.OrganizationID, user); break; case UserInsertScenario.Manager: _userService.AddToManagementTeam(user); break; case UserInsertScenario.Director: _userService.ChangeDirector(user); break; case UserInsertScenario.Unassigned: default: _userService.SaveUser(user); break; } } else { throw new ValidationException(); } }
private void preLoadLayout(EditModes editMode) { BehaviorTreeViewDock.CloseAll(); BreakPointsDock.CloseAll(); ConsoleDock.CloseAll(); ErrorInfoDock.CloseAll(); ParametersDock.CloseAll(); ParSettingsDock.CloseAll(); PropertiesDock.CloseAll(); TimelineDock.CloseAll(); }
public void InitForm(frmClassEdit mainForm, MethodDefinition md, int insIndex, EditModes mode) { if (_method == md && _insIndex == insIndex) { return; } _mainForm = mainForm; _method = md; _ilp = md.Body.GetILProcessor(); _insIndex = insIndex; _mode = mode; Collection <Instruction> ic = _method.Body.Instructions; switch (mode) { case EditModes.Edit: _ins = ic[_insIndex]; if (_ins.Previous == null) { txtPrevIns.Text = String.Empty; } else { txtPrevIns.Text = InsUtils.GetInstructionText(ic, ic.IndexOf(_ins.Previous)); } if (_ins.Next == null) { txtNextIns.Text = String.Empty; } else { txtNextIns.Text = InsUtils.GetInstructionText(ic, ic.IndexOf(_ins.Next)); } break; case EditModes.InsertAfter: _ins = _ilp.Create(OpCodes.Nop); txtPrevIns.Text = InsUtils.GetInstructionText(ic, _insIndex); if (ic[_insIndex].Next == null) { txtNextIns.Text = String.Empty; } else { txtNextIns.Text = InsUtils.GetInstructionText(ic, ic.IndexOf(ic[_insIndex].Next)); } break; case EditModes.InsertBefore: _ins = _ilp.Create(OpCodes.Nop); txtNextIns.Text = InsUtils.GetInstructionText(ic, _insIndex); if (ic[_insIndex].Previous == null) { txtPrevIns.Text = String.Empty; } else { txtPrevIns.Text = InsUtils.GetInstructionText(ic, ic.IndexOf(ic[_insIndex].Previous)); } break; } InitOpCodes(cboOpCode); }
public ValidationError[] GetUserViewModelErrors(EditModes editModes) { switch (editModes) { case EditModes.Insert: return _userValidator.GetInsertValidationErrors(); case EditModes.Update: return _userValidator.GetUpdateValidationErrors(); default: return null; } }
private FileManagers.SaveResult saveLayout(EditModes editMode, string layoutFile, bool isClosing = false) { FileManagers.SaveResult saveres = FileManagers.SaveResult.Cancelled; if (behaviorTreeList != null) { // add all the new behaviours to the list of unsaved ones List<BehaviorNode> behaviorsToSave = new List<BehaviorNode>(); behaviorsToSave.AddRange(behaviorTreeList.NewBehaviors); // add all loaded and modified behaviours to the unsaved ones foreach (BehaviorNode node in behaviorTreeList.LoadedBehaviors) { if (node.IsModified) behaviorsToSave.Add(node); } // ask the user what to do with them bool[] result; saveres = SaveBehaviors(behaviorsToSave, out result); } // store GUI related stuff if (saveres == FileManagers.SaveResult.Succeeded) { if (Workspace.Current != null) { // Save the debug info. DebugDataPool.Save(Workspace.Current.FileName); } if (!isClosing) preSaveLayout(editMode); // store the layout and ensure the folder exists string dir = System.IO.Path.GetDirectoryName(layoutFile); if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir); dockPanel.SaveAsXml(layoutFile); // store the application's settings if (this.WindowState == FormWindowState.Normal) { Settings.Default.MainWindowLocation = Location; Settings.Default.MainWindowSize = Size; Settings.Default.MainWindowState = FormWindowState.Normal; } else if (this.WindowState == FormWindowState.Maximized) { Settings.Default.MainWindowState = FormWindowState.Maximized; } Settings.Default.Save(); } return saveres; }
private void FilterManager_Load(object sender, EventArgs e) { Data.ActionHandler = actionHandlerOfFilterManager; updateScreen(); editMode = EditModes.CreateNew; }
private void btnExpressionEdit_Click(object sender, EventArgs e) { this.ExpressionEditMode = EditModes.Edit; SwitchUI(); }
private void btnExpressionCancel_Click(object sender, EventArgs e) { this.ExpressionEditMode = EditModes.View; this.SwitchUI(); }
public void SetEditLayer(int layer) { this.curEditMode = EditModes.Tiles; if (layer == -3) { this.curEditMode = EditModes.Chests; } if (layer == -2) { this.curEditMode = EditModes.Doors; } if (layer == -1) { this.curEditMode = EditModes.Objects; } if (layer == 0) { this.editLayer = TileLayer.Back2; } if (layer == 1) { this.editLayer = TileLayer.Back1; } if (layer == 2) { this.editLayer = TileLayer.Fore; } }
// C O N S T R U C T O R S public InformationListDialog(EditModes editMode) : this(editMode, null, null) { }
private void loadLayout(EditModes editMode, string layoutFile, bool bLoadWks) { preLoadLayout(editMode); __layoutFile = layoutFile; // Remove all controls and create a new dockPanel. this.Controls.Clear(); InitializeComponent(); this.RecentWorkspacesMenu = new RecentMenu(this.recentWorkspacesMenuItem, new RecentMenu.ClickedHandler(OnMenuRecentWorkspaces), "SOFTWARE\\Tencent\\Tag\\Behaviac\\MRU"); this.FormClosed -= this.MainWindow_FormClosed; this.FormClosed += this.MainWindow_FormClosed; this.KeyDown -= this.MainWindow_KeyDown; this.KeyDown += this.MainWindow_KeyDown; // Display the file version this.Text = "BehaviacDesigner " + this.ProductVersion; // Set the stored settings for the window this.WindowState = Settings.Default.MainWindowState; if (this.WindowState == FormWindowState.Normal) { this.Size = Settings.Default.MainWindowSize; this.Location = Settings.Default.MainWindowLocation; this.PerformLayout(); } // If we have no stored layout, generate a default one if (behaviorTreeListDock != null) { nodeTreeList.Dispose(); nodeTreeList = null; behaviorTreeList.Dispose(); behaviorTreeList = null; behaviorTreeListDock.Close(); behaviorTreeListDock = null; } bool layoutFileExisting = System.IO.File.Exists(layoutFile); if (layoutFileExisting) { // Add child controls for the dockPanel from the layout file. dockPanel.LoadFromXml(layoutFile, new WeifenLuo.WinFormsUI.Docking.DeserializeDockContent(GetContentFromPersistString)); if (this.behaviorTreeList == null) { //the corrupt layout file was deleted layoutFileExisting = false; } } if (!layoutFileExisting) { BehaviorTreeListDock btlDock = new BehaviorTreeListDock(); RegisterBehaviorTreeList(btlDock); btlDock.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockLeft); PropertiesDock dock = new PropertiesDock(); dock.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockRight); } if (this.WindowState == FormWindowState.Maximized) { this.Hide(); this.WindowState = FormWindowState.Minimized; this.WindowState = FormWindowState.Maximized; this.Show(); if (!layoutFileExisting) { this.dockPanel.Size = new Size(this.Size.Width - 20, this.Size.Height - 68); } } postLoadLayout(editMode, bLoadWks); // Make sure the window is focused Focus(); }
private void btnProfileEdit_Click(object sender, EventArgs e) { this.ProfileEditMode = EditModes.Edit; SwitchUI(); }
private void postLoadLayout(EditModes editMode, bool bLoadWks) { if (Workspace.Current != null) { if (!SetWorkspace(Workspace.Current.FileName, false)) { this.RecentWorkspacesMenu.RemoveFile(Workspace.Current.FileName); } } else { if (bLoadWks) { string wksFile = this.RecentWorkspacesMenu.GetFileAt(0); if (!SetWorkspace(wksFile, false)) { this.RecentWorkspacesMenu.RemoveFile(wksFile); } } } if (Workspace.Current != null) { int index = MainWindow.Instance.RecentWorkspacesMenu.FindFilenameNumber(Workspace.Current.FileName); if (index < 0) { MainWindow.Instance.RecentWorkspacesMenu.AddFile(Workspace.Current.FileName); index = MainWindow.Instance.RecentWorkspacesMenu.FindFilenameNumber(Workspace.Current.FileName); } MainWindow.Instance.RecentWorkspacesMenu.SetFirstFile(index); } if (editMode != EditModes.Design) { BreakPointsDock.Inspect(); ConsoleDock.Inspect(); ErrorInfoDock.Inspect(); TimelineDock.Inspect(); MessageHandler.Init(); } UpdateUIState(editMode); behaviorTreeList.UpdateUIState(editMode); TimelineDock.UpdateUIState(editMode); bool isDesignMode = (editMode == EditModes.Design); BehaviorTreeViewDock.ReadOnly = !isDesignMode; PropertiesDock.ReadOnly = !isDesignMode; ParSettingsDock.ReadOnly = !isDesignMode; }
private void btnProfileCancel_Click(object sender, EventArgs e) { this.ProfileEditMode = EditModes.View; this.SwitchUI(); }
private void preSaveLayout(EditModes editMode) { BehaviorTreeViewDock.CloseAll(); if (editMode == EditModes.Design) { ConsoleDock.CloseAll(); ErrorInfoDock.CloseAll(); TimelineDock.CloseAll(); } else { ParametersDock.CloseAll(); ParSettingsDock.CloseAll(); } }
internal void UpdateUIState(EditModes editMode) { bool enabled = (editMode == EditModes.Design); this.saveBehaviorMenuItem.Enabled = enabled; this.saveAsBehaviorMenuItem.Enabled = enabled; this.saveAllMenuItem.Enabled = enabled; this.exportBehaviorMenuItem.Enabled = enabled; this.exportAllMenuItem.Enabled = enabled; this.dumpToolStripMenuItem.Visible = (editMode == EditModes.Connect); this.newWorkspaceMenuItem.Enabled = enabled; this.openWorkspaceMenuItem.Enabled = enabled; this.editWorkspaceToolStripMenuItem.Enabled = enabled; this.timelineMenuItem.Enabled = !enabled; this.recentFilesMenuItem.Enabled = enabled; this.recentWorkspacesMenuItem.Enabled = enabled; this.parMenuItem.Enabled = enabled; this.debugMenuButton.Enabled = !enabled; //this.deleteSelectedMenuItem.ShortcutKeys = Keys.Delete; //this.deleteTreeMenuItem.ShortcutKeys = Keys.Shift | Keys.Delete; this.cutSelectedMenuItem.Enabled = enabled; this.cutTreeMenuItem.Enabled = enabled; this.copySelectedMenuItem.Enabled = enabled; this.deleteSelectedMenuItem.Enabled = enabled; this.deleteTreeMenuItem.Enabled = enabled; switch (editMode) { case EditModes.Design: this.connectMenuItem.Text = Resources.ConnectServer; this.connectMenuItem.Image = Resources.connect; this.debugMenuItem.Text = Resources.AnalyzeDump; this.connectMenuItem.Enabled = true; this.debugMenuItem.Enabled = true; this.connectMenuItem.Image = Resources.connect; break; case EditModes.Connect: this.connectMenuItem.Image = Resources.disconnect; this.connectMenuItem.Text = Resources.DisconnectServer; this.connectMenuItem.Enabled = true; this.debugMenuItem.Enabled = false; break; case EditModes.Analyze: this.debugMenuItem.Text = Resources.StopAnalyzing; this.connectMenuItem.Enabled = false; this.debugMenuItem.Enabled = true; break; } }
public void SetRiverMode(int mode) => _riverMode = (EditModes)mode;