private void ToggleRewind_Click(object sender, EventArgs e) { MLCHARGENLib.CoMLCharGen cg = CGBaseItem.m_objCG; CGBaseItem baseItem = (CGBaseItem)m_Item; cg.RewindItem(baseItem.ID); }
private void imageCtrl_MouseDoubleClick(object sender, MouseEventArgs e) { if (PreviewDoubleClick != null) { PreviewDoubleClick(this, new EventArgs()); return; } if (PreviewItemDoubleClick != null) { CGBaseItem item = m_Editor.SelectedtItems[0]; PreviewItemDoubleClick(item, new EventArgs()); isDoubleClick = true; return; } }
public void SetControlledObject(object item) { try { if (item != null && item is CGBaseItem) { m_Item = (CGBaseItem)item; FillControls(); if (item is IChangeNotify) { ((IChangeNotify)item).ItemChanged += External_ItemChanged; } this.Enabled = true; } else { ClearControls(); m_Item = null; this.Enabled = false; } } catch (System.Exception) { } }
public void UpdateItemsList() { CGItems.Clear(); int nItems = 0; if (!string.IsNullOrEmpty(CurrGroupID)) { CGObject.GroupItemsCount(CurrGroupID, out nItems); } else { CGObject.GetItemsCount(out nItems); } for (int i = 0; i < nItems; i++) { string strId = ""; if (!string.IsNullOrEmpty(CurrGroupID)) { CGObject.GroupGetItem(CurrGroupID, i, out strId); } else { CGObject.GetItem(i, out strId); } string strNameDesc; CG_ITEM_PROPS itemProps; CGObject.GetItemBaseProps(strId, out strNameDesc, out itemProps); string strXMLDesc; CGObject.GetItemProperties(strId, "", out strXMLDesc); CGBaseItem itemToAdd = null; if (itemProps.eType == eCG_ItemType.eCGIT_Text) { CGTextItem text = new CGTextItem(strId); if (text.FontFamily == "") { text.FontFamily = "Arial"; } itemToAdd = text; CGItems.Add(text); } if (itemProps.eType == eCG_ItemType.eCGIT_Flash) { CGFlashItem flash = new CGFlashItem(strId); itemToAdd = flash; CGItems.Add(flash); } if (itemProps.eType == eCG_ItemType.eCGIT_Image) { CGImageItem img = new CGImageItem(strId); itemToAdd = img; CGItems.Add(img); } if (itemProps.eType == eCG_ItemType.eCGIT_MediaFile) { CGVideoItem img = new CGVideoItem(strId); itemToAdd = img; CGItems.Add(img); } if (itemProps.eType == eCG_ItemType.eCGIT_Graphics) { CGGraphicsItem gr = new CGGraphicsItem(strId); itemToAdd = gr; CGItems.Add(gr); } if (strXMLDesc.Contains("<ticker")) { CGTickerItem tkr = new CGTickerItem(strId); itemToAdd = tkr; CGItems.Add(tkr); } if ((itemProps.eType & eCG_ItemType.eCGIT_Group) != 0 && strXMLDesc.Contains(@"group-type='line'") && strXMLDesc.Contains(@"<text")) { CGTickerLine line = new CGTickerLine(strId); itemToAdd = line; CGItems.Add(line); } if ((itemProps.eType & eCG_ItemType.eCGIT_Group) != 0 && !strXMLDesc.Contains("<ticker") && !strXMLDesc.Contains(@"group-type='line'")) { CGGroupItem group = new CGGroupItem(strId); itemToAdd = group; CGItems.Add(group); } if (itemToAdd != null) { IMLCharGenEdit cgEdit = (IMLCharGenEdit)CGObject; int nCount; cgEdit.EditSelectionGetCount(out nCount); for (int j = 0; j < nCount; j++) { string strID, strColor; cgEdit.EditSelectionGetByIndex(j, out strID, out strColor); { if (strID == itemToAdd.ID) { itemToAdd.isSelected = true; } } } } } if (ItemsListUpdated != null) { ItemsListUpdated(this, new EventArgs()); } }
public void RibbonSetControlledObject(CGBaseItem cgItem) { try { m_BaseItem = cgItem; if (m_BaseItem != null) { BasicVisibilityEditor.SetControlledObject(cgItem); BasicVisibilityEditor.SetEditor(m_Editor); BasicPositionEditor.SetControlledObject(cgItem); BasicPositionEditor.SetEditor(m_Editor); BasicColorEditor.SetControlledObject(cgItem); BasicColorEditor.SetEditor(m_Editor); BasicMiscEditor.SetControlledObject(cgItem); BasicMiscEditor.SetEditor(m_Editor); EffectsSpeedEditor.SetControlledObject(cgItem); EffectsSpeedEditor.SetEditor(m_Editor); EffectsShadowEditor.SetControlledObject(cgItem); EffectsShadowEditor.SetEditor(m_Editor); EffectsBlurEditor.SetControlledObject(cgItem); EffectsBlurEditor.SetEditor(m_Editor); EffectsGlowEditor.SetControlledObject(cgItem); EffectsGlowEditor.SetEditor(m_Editor); if (m_BaseItem is CGTextItem || m_BaseItem is CGTickerLine) { TextContEditor.SetControlledObject(cgItem); TextContEditor.SetEditor(m_Editor); TextColorEditor.SetControlledObject(cgItem); TextColorEditor.SetEditor(m_Editor); TextOutlineEditor.SetControlledObject(cgItem); TextOutlineEditor.SetEditor(m_Editor); TextFontEditor.SetControlledObject(cgItem); TextFontEditor.SetEditor(m_Editor); ShowTab(PageText); } if (m_BaseItem is CGGraphicsItem) { GraphicsShapeEditor.SetControlledObject(cgItem); GraphicsShapeEditor.SetEditor(m_Editor); GraphicsColorEditor.SetControlledObject(cgItem); GraphicsColorEditor.SetEditor(m_Editor); GraphicsOutlineEditor.SetControlledObject(cgItem); GraphicsOutlineEditor.SetEditor(m_Editor); ShowTab(PageGraphics); } if (m_BaseItem is CGTickerItem) { TickerNewContentEditor.SetControlledObject(cgItem); TickerNewContentEditor.SetEditor(m_Editor); TickerPropsEditor.SetControlledObject(cgItem); TickerPropsEditor.SetEditor(m_Editor); TickerShapeEditor.SetControlledObject(cgItem); TickerShapeEditor.SetEditor(m_Editor); TickerColorEditor.SetControlledObject(cgItem); TickerColorEditor.SetEditor(m_Editor); TickerOutlineEditor.SetControlledObject(cgItem); TickerOutlineEditor.SetEditor(m_Editor); TickerTextColorEditor.SetControlledObject(cgItem); TickerTextColorEditor.SetEditor(m_Editor); TickerTextOutlineEditor.SetControlledObject(cgItem); TickerTextOutlineEditor.SetEditor(m_Editor); TickerTextFontEditor.SetControlledObject(cgItem); TickerTextFontEditor.SetEditor(m_Editor); ShowTab(PageTickerContent); } if (m_BaseItem is CGImageItem) { ImageEditor.SetControlledObject(cgItem); ImageEditor.SetEditor(m_Editor); ShowTab(PageImage); } if (m_BaseItem is CGVideoItem) { openVideoEditor1.SetControlledObject(cgItem); openVideoEditor1.SetEditor(m_Editor); ShowTab(PageVideo); } if (m_BaseItem is CGFlashItem) { FlashEditor.SetControlledObject(cgItem); FlashEditor.SetEditor(m_Editor); ShowTab(PageFlash); } } else { ClearControls(); HideTabs(); } } catch (System.Exception) { } }
private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { MouseEventArgs mouse = e as MouseEventArgs; if (mouse.Button == MouseButtons.Left) { if (PreviewLeftButtonDown != null) { //Point previewPt = e.Location; Point previewPt = new Point(e.X - imgx, e.Y - imgy); Point cgPt = GetCGPoint(previewPt); PreviewLeftButtonDown(this, new PreviewClickArgs(cgPt)); } if (m_eMode == eMode.eM_Default) { if (imageCtrl.Focused) { return; } imageCtrl.Focus(); isMooving = false; isRectSelecting = false; isResizingFromTop = false; isResizingFromBottom = false; isResizingFromLeft = false; isResizingFromRight = false; isDoubleClick = false; double previewScaleFactor = GetPreviewScaleFactor(); double transformScaleFactor = GetTransformScaleFactor(); double selStartX = e.X / zoom - imgx; double selStartY = e.Y / zoom - imgy; m_ptRectSelStartPoint = new Point((int)selStartX, (int)selStartY); Point pt = new Point((int)selStartX, (int)selStartY); m_ptImgStartPoint = m_ptRectSelStartPoint; //for (int i = m_Editor.CGItems.Count ; i > 0; i-- ) for (int i = 0; i < m_Editor.CGItems.Count; i++) { //CGBaseItem item = m_Editor.CGItems[i-1]; CGBaseItem item = m_Editor.CGItems[i]; double recalcX = item.PosX; // * previewScaleFactor; double recalcY = item.PosY; // * previewScaleFactor; double recalcWidth = item.Width; // * previewScaleFactor; double recalcHeight = item.Height; // * previewScaleFactor; double resizeWidth = 8; //recalcWidth * m_dblResizeAreaWidth; double resizeHeight = 8; // recalcHeight * m_dblResizeAreaWidth; Rectangle rectInner = new Rectangle(); rectInner.X = (int)(recalcX + resizeWidth); rectInner.Y = (int)(recalcY + resizeHeight); rectInner.Width = (int)(recalcWidth - 2 * resizeWidth); rectInner.Height = (int)(recalcHeight - 2 * resizeHeight); item.StartLocation = new Point((int)item.PosX, (int)item.PosY); item.StartWidth = item.Width; item.StartHeight = item.Height; if (rectInner.Contains(pt)) { if (ModifierKeys.HasFlag(Keys.Control)) { m_Editor.SelectItem(item.ID, false); } else if (item.isSelected == false) { m_Editor.SelectItem(item.ID, true); } if (PreviewItemDoubleClick != null && e.Clicks == 2) { PreviewItemDoubleClick(item, new EventArgs()); isDoubleClick = true; return; } isMooving = true; } } if (isMooving) { UndoRedoManager.UndoRedoManager.Instance().Push <HistoryItem>(m_Editor.UndoAction, new HistoryItem(m_Editor.CurrentState, "")); return; } if (m_Editor.SelectedtItems.Count == 1) { CGBaseItem item = m_Editor.SelectedtItems[0]; double recalcX = item.PosX; // * previewScaleFactor;// *transformScaleFactor; double recalcY = item.PosY; // * previewScaleFactor;// *transformScaleFactor; double recalcWidth = item.Width; // * previewScaleFactor;// *transformScaleFactor; double recalcHeight = item.Height; // * previewScaleFactor;// *transformScaleFactor; double resizeWidth = 8; //recalcWidth * m_dblResizeAreaWidth; double resizeHeight = 8; //recalcHeight * m_dblResizeAreaWidth; Rectangle rectOuterTop = new Rectangle(); rectOuterTop.X = (int)(recalcX + resizeWidth); rectOuterTop.Y = (int)(recalcY - resizeHeight); rectOuterTop.Width = (int)(recalcWidth - 2 * resizeWidth); rectOuterTop.Height = (int)(2 * resizeHeight); Rectangle rectOuterBottom = new Rectangle(); rectOuterBottom.X = (int)(recalcX + resizeWidth); rectOuterBottom.Y = (int)(recalcY + recalcHeight - resizeHeight); rectOuterBottom.Width = (int)(recalcWidth - 2 * resizeWidth); rectOuterBottom.Height = (int)(2 * resizeHeight); Rectangle rectOuterLeft = new Rectangle(); rectOuterLeft.X = (int)(recalcX - resizeWidth); rectOuterLeft.Y = (int)(recalcY + resizeHeight); rectOuterLeft.Width = (int)(2 * resizeWidth); rectOuterLeft.Height = (int)(recalcHeight - 2 * resizeHeight); Rectangle rectOuterRight = new Rectangle(); rectOuterRight.X = (int)(recalcX + recalcWidth - resizeWidth); rectOuterRight.Y = (int)(recalcY + resizeHeight); rectOuterRight.Width = (int)(2 * resizeWidth); rectOuterRight.Height = (int)(recalcHeight - 2 * resizeHeight); item.StartLocation = new Point((int)item.PosX, (int)item.PosY); item.StartWidth = item.Width; item.StartHeight = item.Height; if (rectOuterTop.Contains(pt)) { isResizingFromTop = true; UndoRedoManager.UndoRedoManager.Instance().Push <HistoryItem>(m_Editor.UndoAction, new HistoryItem(m_Editor.CurrentState, "")); return; } if (rectOuterBottom.Contains(pt)) { isResizingFromBottom = true; UndoRedoManager.UndoRedoManager.Instance().Push <HistoryItem>(m_Editor.UndoAction, new HistoryItem(m_Editor.CurrentState, "")); return; } if (rectOuterLeft.Contains(pt)) { isResizingFromLeft = true; UndoRedoManager.UndoRedoManager.Instance().Push <HistoryItem>(m_Editor.UndoAction, new HistoryItem(m_Editor.CurrentState, "")); return; } if (rectOuterRight.Contains(pt)) { isResizingFromRight = true; UndoRedoManager.UndoRedoManager.Instance().Push <HistoryItem>(m_Editor.UndoAction, new HistoryItem(m_Editor.CurrentState, "")); return; } } if (PreviewDoubleClick != null && e.Clicks == 2) { PreviewDoubleClick(this, new EventArgs()); return; } //if (!isMooving && !isDoubleClick) isRectSelecting = true; } } if (mouse.Button == MouseButtons.Right) { if (!isPanning) { isPanning = true; mouseDown = mouse.Location; m_ptImgStartPoint = mouse.Location;; startx = imgx; starty = imgy; isPanning = true; } } }