public ChangeDocumentNVBDelayAction(TDocument doc, FrmMainContainer mainForm, int oldNVBDelay, int newNVBDelay) { this.document = doc; this.mainForm = mainForm; this.oldNVBDelay = oldNVBDelay; this.newNVBDelay = newNVBDelay; }
public ReorderSceneAction(TDocument doc, FrmMainContainer mainForm, int oldIndex, int newIndex) { this.document = doc; this.mainForm = mainForm; this.oldIndex = oldIndex; this.newIndex = newIndex; }
public ChangeDocumentBGMVolumeAction(TDocument doc, FrmMainContainer mainForm, int oldBGMVolume, int newBGMVolume) { this.document = doc; this.mainForm = mainForm; this.oldBGMVolume = oldBGMVolume; this.newBGMVolume = newBGMVolume; }
public DeleteAnimationAction(FrmMainContainer mainForm, TLayer layer, int index) { this.mainForm = mainForm; this.layer = layer; this.index = index; this.animation = layer.animations[index]; }
public DeleteSceneAction(TDocument doc, FrmMainContainer mainForm, int sceneIndex, TScene scene) { this.document = doc; this.mainForm = mainForm; this.sceneIndex = sceneIndex; this.scene = scene; }
public ChangeDocumentBGMAction(TDocument doc, FrmMainContainer mainForm, string oldBGM, string newBGM) { this.document = doc; this.mainForm = mainForm; this.oldBGM = oldBGM; this.newBGM = newBGM; }
public ChangeDocumentNVBRightRenderAction(TDocument doc, FrmMainContainer mainForm, bool oldRenderButton, bool newRenderButton) { this.document = doc; this.mainForm = mainForm; this.oldRenderButton = oldRenderButton; this.newRenderButton = newRenderButton; }
public ChangeDocumentNextSceneButton(TDocument doc, FrmMainContainer mainForm, string oldButton, string newButton) { this.document = doc; this.mainForm = mainForm; this.oldButton = oldButton; this.newButton = newButton; }
private void pnlWorkspace_DragDrop(object sender, DragEventArgs e) { if (this.document.currentScene() == null) { return; } if (e.Data.GetDataPresent(DataFormats.Serializable, true) == true) { // dragging item ListViewItem item = (ListViewItem)e.Data.GetData(DataFormats.Serializable); // convert screen coordinate to client coordinate Point pt = this.pnlWorkspace.PointToClient(new Point(e.X, e.Y)); // item to current scene TImageActor actor = this.document.currentScene().pushImage(this.document.libraryManager.imageFileName(item.Index), pt.X, pt.Y); this.document.actionManager.RecordAction(new AddActorAction(this.document, actor)); // set the document modified flag this.document.modified = true; // redraw scene this.pnlWorkspace.Refresh(); // update panels FrmMainContainer mainForm = (FrmMainContainer)this.MdiParent; mainForm.updateScenesPanel(this.document.sceneManager.currentSceneIndex); mainForm.updateOutlinePanel(); mainForm.updateHistoryPanel(); } }
public ChangeDocumentAvatarMask(TDocument doc, FrmMainContainer mainForm, string oldImage, string newImage) { this.document = doc; this.mainForm = mainForm; this.oldImage = oldImage; this.newImage = newImage; }
public ChangeAnimationStateAction(FrmMainContainer mainForm, int index, TAnimation animation, string newState) { this.mainForm = mainForm; this.index = index; this.animation = animation; this.oldState = animation.state; this.newState = newState; }
public ChangeAnimationEventAction(FrmMainContainer mainForm, int index, TAnimation animation, string newEvent) { this.mainForm = mainForm; this.index = index; this.animation = animation; this.oldEvent = animation.eventu; this.newEvent = newEvent; }
public ChangeAnimationAction(FrmMainContainer mainForm, TLayer layer, TAnimation oldAnimation, TAnimation newAnimation) { this.mainForm = mainForm; this.layer = layer; this.oldAnimation = oldAnimation; this.newAnimation = newAnimation; this.index = layer.animations.IndexOf(oldAnimation); }
public bool saveDocument(bool showDialog) { bool ret; if (showDialog || this.document.directory == null) { SaveFileDialog dlg = new SaveFileDialog(); dlg.FileName = this.document.filename; if (this.document.directory != null) { dlg.InitialDirectory = this.document.directory; } dlg.Filter = String.Format("Tata Builder Project File (*.{0})|*.{0}", Program.DOC_EXTENSION); DialogResult dr = dlg.ShowDialog(); if (dr == DialogResult.Cancel) { return(false); } if (dr != DialogResult.OK) { throw new ApplicationException(); } ret = this.document.save(dlg.FileName); } else { ret = this.document.save(); } if (ret) { this.document.modified = false; FrmMainContainer mainForm = (FrmMainContainer)this.MdiParent; mainForm.updateRecentDocument(this.document.filepath); } return(ret); }
private void pnlWorkspace_MouseWheel(object sender, MouseEventArgs e) { if (this.document.currentScene() == null) { return; } // change zoom float newZoom = this.document.zoom + (float)e.Delta / 1000; if (newZoom >= 0.25 && newZoom <= 4) { this.document.zoom = newZoom; this.pnlWorkspace.Refresh(); // main form FrmMainContainer mainForm = (FrmMainContainer)this.MdiParent; mainForm.updateToolbarSceneSettings(); } }
private void pnlWorkspace_MouseUp(object sender, MouseEventArgs e) { if (this.document.currentScene() == null) { return; } // main form FrmMainContainer mainForm = (FrmMainContainer)this.MdiParent; if (e.Button == MouseButtons.Left && MousePressed) { if (MouseDownTool == TDocument.TOOL_TEXT) { if (this.document.haveSelection() && MouseDownPart == 0) { mainForm.focusTextActorContent(); } else if (!this.document.haveSelection() || MouseDownPart == -1) { // positivation RectangleF bound = TUtil.positiveRectangle(SelectRegion); if (bound.Width > 1 && bound.Height > 1) { // item to current scene TTextActor actor = this.document.currentScene().pushText("", bound); this.document.actionManager.RecordAction(new AddActorAction(this.document, actor)); // set the document modified flag this.document.modified = true; // select new added text actor this.document.clearSelectedItems(); this.document.toggleSelectedItem(actor); // update panels mainForm.updateScenesPanel(this.document.sceneManager.currentSceneIndex); mainForm.updateOutlinePanel(); mainForm.updateHistoryPanel(); // fire mainform's selected item changed event mainForm.selectedItemChanged(); // show textbox of ribbon bar and make let user to edit content mainForm.focusTextActorContent(); // record modify action modifyActorAction = new ModifyActorAction(document, actor); } } else if (this.document.haveSelection() && modifyActorAction != null) { // this is the case when text box was resized with text tool modifyActorAction.setFinalData(this.document.selectedActor()); if (modifyActorAction.isModified()) { this.document.actionManager.RecordAction(modifyActorAction); // set the document modified flag this.document.modified = true; // ready to new modification action modifyActorAction = new ModifyActorAction(document, document.selectedActor()); // update history mainForm.updateHistoryPanel(); } // update panels this.document.sceneManager.updateThumbnail(this.document.sceneManager.currentSceneIndex); mainForm.updateScenesPanel(this.document.sceneManager.currentSceneIndex); mainForm.updateToolbarSceneSettings(); mainForm.updateOutlinePanel(); } } else if (MouseDownTool == TDocument.TOOL_AVATAR) { if (!this.document.haveSelection() || MouseDownPart == -1) { // positivation RectangleF bound = TUtil.positiveRectangle(SelectRegion); if (bound.Width > 1 && bound.Height > 1) { // item to current scene TAvatarActor actor = this.document.currentScene().pushAvatar(bound); this.document.actionManager.RecordAction(new AddActorAction(this.document, actor)); // set the document modified flag this.document.modified = true; // select new added avatar actor this.document.clearSelectedItems(); this.document.toggleSelectedItem(actor); // update panels mainForm.updateScenesPanel(this.document.sceneManager.currentSceneIndex); mainForm.updateOutlinePanel(); mainForm.updateHistoryPanel(); // fire mainform's selected item changed event mainForm.selectedItemChanged(); // record modify action modifyActorAction = new ModifyActorAction(document, actor); } } } else { if (this.document.haveSelection() && modifyActorAction != null) { // this is the case when text box was resized with text tool modifyActorAction.setFinalData(this.document.selectedActor()); if (modifyActorAction.isModified()) { this.document.actionManager.RecordAction(modifyActorAction); // set the document modified flag this.document.modified = true; // ready to new modification action modifyActorAction = new ModifyActorAction(document, document.selectedActor()); // update history mainForm.updateHistoryPanel(); } } // update panels this.document.sceneManager.updateThumbnail(this.document.sceneManager.currentSceneIndex); mainForm.updateScenesPanel(this.document.sceneManager.currentSceneIndex); mainForm.updateToolbarSceneSettings(); mainForm.updateOutlinePanel(); } foreach (TActor actor in this.document.selectedItems) { actor.deleteBackup(); } MousePressed = false; MouseDownTool = TDocument.TOOL_NONE; MouseDownPart = -1; SelectRegion = RectangleF.Empty; // reset cursor this.updateCursor(); // redraw workspace this.pnlWorkspace.Refresh(); } }
private void pnlWorkspace_MouseDown(object sender, MouseEventArgs e) { if (this.document.currentScene() == null) { return; } FrmMainContainer mainForm = (FrmMainContainer)this.MdiParent; if (e.Button == MouseButtons.Left) { // set flag that mouse is pressed and store position MousePressed = true; MouseDownPos = new PointF(e.X, e.Y); MouseDownTool = this.document.activeTool(); if (MouseDownTool == TDocument.TOOL_SELECT || MouseDownTool == TDocument.TOOL_BOUNDING || MouseDownTool == TDocument.TOOL_PUZZLE) { // if no current selection, create new selection if (!this.document.haveSelection()) { // target item TActor target = this.document.actorAtPosition(e.X, e.Y, (MouseDownTool == TDocument.TOOL_BOUNDING)); if (target != null && (MouseDownTool != TDocument.TOOL_PUZZLE || target.puzzle)) { // add target item to selection stack this.document.toggleSelectedItem(target); if (target.locked) { MousePressed = false; MouseDownTool = TDocument.TOOL_NONE; MouseDownPart = -1; SelectRegion = RectangleF.Empty; } else { // record modify action modifyActorAction = new ModifyActorAction(document, target); // calc which part of selection is mouse position MouseDownPart = 0; target.createBackup(); // when moving actor, need the original state before moving this.Cursor = Cursors.SizeAll; } } else { // this.SelectRegion = new RectangleF(e.X, e.Y, 0, 0); } } else { // calc which part of selection is mouse position int cursor; MouseDownPart = this.document.partOfSelection(e.X, e.Y, out cursor); if (MouseDownPart == -1) // if click at outside of selection bound, deselect current selection. // clear selection stack { this.document.clearSelectedItems(); // clear modify action modifyActorAction = null; // target item TActor target = this.document.actorAtPosition(e.X, e.Y, MouseDownTool == TDocument.TOOL_BOUNDING); if (target != null) { // add target item to selection stack this.document.toggleSelectedItem(target); if (target.locked) { MousePressed = false; MouseDownTool = TDocument.TOOL_NONE; MouseDownPart = -1; SelectRegion = RectangleF.Empty; } else { // record modify action modifyActorAction = new ModifyActorAction(document, target); MouseDownPart = 0; this.Cursor = Cursors.SizeAll; } } else { // this.SelectRegion = new RectangleF(e.X, e.Y, 0, 0); } } else { if (this.document.selectedActor().locked) { MousePressed = false; MouseDownTool = TDocument.TOOL_NONE; MouseDownPart = -1; SelectRegion = RectangleF.Empty; } else { if (MouseDownPart == 0) { // record modify action modifyActorAction = new ModifyActorAction(document, this.document.selectedActor()); } } } if (MouseDownPart != -1) { foreach (TActor actor in this.document.selectedItems) { actor.createBackup(); } } } // redraw workspace this.pnlWorkspace.Refresh(); // fire mainform's selected item changed event mainForm.selectedItemChanged(); } else if (MouseDownTool == TDocument.TOOL_TEXT || MouseDownTool == TDocument.TOOL_AVATAR) { // if no current selection, create new selection if (!this.document.haveSelection()) { // start selection this.SelectRegion = new RectangleF(e.X, e.Y, 0, 0); } else { // calc which part of selection is mouse position int cursor; MouseDownPart = this.document.partOfSelection(e.X, e.Y, out cursor); if (MouseDownPart == -1 || MouseDownPart == 9 || MouseDownTool == TDocument.TOOL_AVATAR) // if click at outside of selection bound, deselect current selection. // start selection { this.SelectRegion = new RectangleF(e.X, e.Y, 0, 0); MouseDownPart = -1; } } // redraw workspace this.pnlWorkspace.Refresh(); } } // for moving by space key, set focus the control in the workspace form lblFocusTarget.Focus(); }
public AddSceneAction(TDocument doc, FrmMainContainer mainForm, TScene scene) { this.document = doc; this.mainForm = mainForm; this.scene = scene; }
public AddAnimationAction(FrmMainContainer mainForm, TLayer layer, TAnimation animation) { this.mainForm = mainForm; this.layer = layer; this.animation = animation; }