public void SelectByPoint(int left, int top) { IMLCharGenEdit cgedit = (IMLCharGenEdit)CGObject; string strItemID; cgedit.EditSelectionRemove(""); foreach (CGBaseItem item in CGItems) { item.isSelected = false; } if (CurrGroupID != null && CurrGroupID != string.Empty) { cgedit.EditSelectionAdd(CurrGroupID, "lime", 0); } cgedit.EditItemGetByPoint(m_strCurrGroupID, left, top, out strItemID); cgedit.EditSelectionAdd(strItemID, "red", 0); foreach (CGBaseItem item in CGItems) { if (item.ID == strItemID) { item.isSelected = true; } } if (ItemSelected != null) { ItemSelected(this, new EventArgs()); } }
public void SelectItems(string[] ids, bool clearSelection) { IMLCharGenEdit cgedit = (IMLCharGenEdit)CGObject; if (clearSelection) { cgedit.EditSelectionRemove(""); foreach (CGBaseItem item in CGItems) { item.isSelected = false; } } if (CurrGroupID != null && CurrGroupID != string.Empty) { cgedit.EditSelectionAdd(CurrGroupID, "lime", 0); } foreach (string id in ids) { cgedit.EditSelectionAdd(id, "red", 0); foreach (CGBaseItem item in CGItems) { if (item.ID == id) { item.isSelected = true; } } } if (ItemSelected != null) { ItemSelected(this, new EventArgs()); } }
protected Rectangle GetAbsoluteRect() { Rectangle res = new Rectangle(); IMLCharGenEdit cgedit = (IMLCharGenEdit)m_objCG; tagRECT rect; cgedit.EditItemAbsoluteRectGet(ID, out rect); res.X = rect.left; res.Y = rect.top; res.Width = rect.left + rect.right; res.Height = rect.top + rect.bottom; return(res); }
public void SelectGroup(string groupId) { IMLCharGenEdit cgedit = (IMLCharGenEdit)CGObject; cgedit.EditSelectionAdd(groupId, "lime", 0); foreach (CGBaseItem item in CGItems) { if (item.ID == groupId) { item.isSelected = true; break; } } if (ItemSelected != null) { ItemSelected(this, new EventArgs()); } }
public void SelectByRectangle(int left, int top, int right, int bottom) { IMLCharGenEdit cgedit = (IMLCharGenEdit)CGObject; string strItemIDs; cgedit.EditSelectionRemove(""); foreach (CGBaseItem item in CGItems) { item.isSelected = false; } if (!string.IsNullOrEmpty(CurrGroupID)) { cgedit.EditSelectionAdd(CurrGroupID, "lime", 0); } cgedit.EditItemsGetByRect(CurrGroupID, left, top, right, bottom, out strItemIDs); if (!string.IsNullOrEmpty(strItemIDs)) { string[] strSplit = strItemIDs.Split(','); foreach (string s in strSplit) { string strTrimmed = s.Trim(); cgedit.EditSelectionAdd(strTrimmed, "red", 0); foreach (CGBaseItem item in CGItems) { if (item.ID == strTrimmed) { item.isSelected = true; //break; } } } } if (ItemSelected != null) { ItemSelected(this, new EventArgs()); } }
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()); } }