public XmlControl(FileTabItem parent, OpenedFile fileDef, string skinName = "") { m_curSearchIndex = 0; InitializeComponent(); m_parent = parent; m_showGL = false; m_openedFile = fileDef; m_openedFile.m_frame = this; try { m_xmlDoc = new XmlDocument(); m_xmlDoc.Load(m_openedFile.m_path); } catch { return; } m_openedFile.m_lstOpt = new XmlOperation.HistoryList(MainWindow.s_pW, this, 65535); refreshControl(skinName); refreshXmlText(); }
public UnknownControl(FileTabItem parent, OpenedFile fileDef) { InitializeComponent(); m_parent = parent; m_openedFile = fileDef; m_openedFile.m_frame = this; }
public PngControl(FileTabItem parent, OpenedFile fileDef) { InitializeComponent(); m_parent = parent; m_openedFile = fileDef; m_openedFile.m_frame = this; string path = this.m_parent.m_filePath; if(System.IO.File.Exists(path)) { m_Bitmap = DevIL.DevIL.LoadBitmap(path); try { IntPtr ip = m_Bitmap.GetHbitmap(); m_imgSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( ip, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); MainWindow.DeleteObject(ip); m_imgHeight = m_imgSource.PixelHeight; m_imgWidth = m_imgSource.PixelWidth; m_parent.itemFrame.Height = m_imgHeight; m_parent.itemFrame.Width = m_imgWidth; mx_image.Source = m_imgSource; mx_image.Stretch = Stretch.Uniform; } catch { Public.ResultLink.createResult("这不是一个合法的png文件(虽然后缀名是png)。"); } } }
public HtmlControl(FileTabItem tabItem, OpenedFile fileDef) { m_tabItem = tabItem; m_openedFile = fileDef; InitializeComponent(); //mx_browser.Source = new Uri(tabItem.m_filePath, UriKind.Relative); string path = System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location); mx_browser.Source = new Uri("file:///" + path + "\\" + m_tabItem.m_filePath); }
public PngControl(string path) { InitializeComponent(); m_parent = null; m_openedFile = null; if (System.IO.File.Exists(path)) { m_Bitmap = DevIL.DevIL.LoadBitmap(path); IntPtr ip = m_Bitmap.GetHbitmap(); m_imgSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( ip, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); MainWindow.DeleteObject(ip); m_imgHeight = m_imgSource.PixelHeight; m_imgWidth = m_imgSource.PixelWidth; mx_image.Source = m_imgSource; mx_image.Stretch = Stretch.Uniform; } }
public OpenedFile(string path, string skinName = "", bool isShowTabItem = true) { Public.ErrorInfo.clearErrorInfo(); MainWindow pW = MainWindow.s_pW; MainWindow.s_pW.m_mapOpenedFiles[path] = this; m_path = path; m_paraResult = new Paragraph(); m_lstResult = new List<ResultLink>(); Public.ResultLink.s_curResultFrame = m_paraResult; if(File.Exists(m_path)) { FileInfo fi = new FileInfo(m_path); m_lastWriteTime = fi.LastWriteTime; } m_fileType = StringDic.getFileType(m_path); m_tab = new TabItem(); m_curViewSkin = skinName; pW.mx_workTabs.Items.Add(m_tab); pW.mx_workTabs.SelectedItem = m_tab; m_tab.Unloaded += new RoutedEventHandler(pW.eventCloseFile); ToolTip tabTip = new ToolTip(); tabTip.Content = m_path; m_tab.Header = "_" + StringDic.getFileNameWithoutPath(path); m_tab.ToolTip = tabTip; m_tab.MouseRightButtonDown += fileTabItem_MouseRightButtonDown; if(isShowTabItem) { UserControl tabContent = new UIEditor.FileTabItem(this, skinName); m_tab.Content = tabContent; m_tabItem = (FileTabItem)tabContent; } else { m_tabItem = null; } Public.ErrorInfo.showErrorInfo(); }