public DocPage() { this.Height = 0; this.Width = 0; this.NativeHeight = 0; this.NativeWidth = 0; this.Zoom = 0; this.BitMap = null; this.TextBox = null; this.LinkBox = null; this.Content = Page_Content_t.NOTSET; this.PageNum = -1; this.PageName = ""; this.TextBlocks = null; this.AA = AA_t.HIGH; }
public DocPage(int Height, int Width, double Zoom, BitmapSource BitMap, List <RectList> TextBox, List <RectList> LinkBox, Page_Content_t Content, int PageNum, BlocksText TextBlocks, AA_t AA) { this.Height = Height; this.Width = Width; this.Zoom = Zoom; this.BitMap = BitMap; this.TextBox = TextBox; this.LinkBox = LinkBox; this.Content = Content; this.PageNum = PageNum; this.PageName = ("Page " + (PageNum + 1)); this.TextBlocks = TextBlocks; this.AA = AA; }
/* Set the page with the new raster information */ private void UpdatePage(int page_num, Byte[] bitmap, Point ras_size, Page_Content_t content, double zoom_in, AA_t AA) { DocPage doc_page = this.m_docPages[page_num]; doc_page.Width = (int)ras_size.X; doc_page.Height = (int)ras_size.Y; doc_page.Content = content; doc_page.Zoom = zoom_in; int stride = doc_page.Width * 4; doc_page.BitMap = BitmapSource.Create(doc_page.Width, doc_page.Height, 72, 72, PixelFormats.Pbgra32, BitmapPalettes.Halftone256, bitmap, stride); doc_page.PageNum = page_num; doc_page.AA = AA; if (content == Page_Content_t.THUMBNAIL) { doc_page.Width = (int)(ras_size.X / Constants.SCALE_THUMB); doc_page.Height = (int)(ras_size.Y / Constants.SCALE_THUMB); } }
/* Initialize from registry */ private void InitFromRegistry() { RegistryKey key = Registry.CurrentUser.CreateSubKey("Software"); RegistryKey keyA = key.CreateSubKey("Artifex Software"); RegistryKey keygs = keyA.CreateSubKey("GSview 6.0"); String filepath = null; Int32 page; AA_t aa = AA_t.HIGH; try { filepath = (String)keygs.GetValue("File", null); aa = (AA_t)keygs.GetValue("AA"); page = (Int32)keygs.GetValue("Page"); } catch { return; } keygs.Close(); keyA.Close(); key.Close(); SetAA(aa); m_AA = aa; if (filepath != null && File.Exists(filepath)) { m_initpage = page; ProcessFile(filepath); } else m_initpage = 0; }
private status_t CleanUp() { m_init_done = false; this.Cursor = System.Windows.Input.Cursors.Arrow; /* Collapse this stuff since it is going to be released */ xaml_ThumbGrid.Visibility = System.Windows.Visibility.Collapsed; xaml_ContentGrid.Visibility = System.Windows.Visibility.Collapsed; xaml_VerticalScroll.Visibility = System.Windows.Visibility.Collapsed; /* Clear out everything */ if (m_docPages != null && m_docPages.Count > 0) m_docPages.Clear(); if (m_textSelect != null) m_textSelect.Clear(); if (m_textset != null) m_textset.Clear(); if (m_lineptrs != null && m_lineptrs.Count > 0) m_lineptrs.Clear(); if (m_thumbnails != null && m_thumbnails.Count > 0) m_thumbnails.Clear(); if (m_textptrs != null && m_textptrs.Count > 0) m_textptrs.Clear(); if (m_page_link_list != null && m_page_link_list.Count > 0) { m_page_link_list.Clear(); m_page_link_list = null; } if (m_text_list != null && m_text_list.Count > 0) { m_text_list.Clear(); m_text_list = null; } if (mu_doc != null) mu_doc.CleanUp(); try { mu_doc = new mudocument(); } catch (OutOfMemoryException e) { Console.WriteLine("Memory allocation failed during clean up\n"); ShowMessage(NotifyType_t.MESS_ERROR, "Out of memory: " + e.Message); } mu_doc.mupdfDLLProblemMain += new mudocument.mupdfDLLProblem(muDLL); status_t result = mu_doc.Initialize(); mu_doc.mupdfUpdateMain += new mudocument.mupdfCallBackMain(mupdfUpdate); if (result != status_t.S_ISOK) { Console.WriteLine("Library allocation failed during clean up\n"); ShowMessage(NotifyType_t.MESS_ERROR, "Library allocation failed!"); return result; } m_have_thumbs = false; m_file_open = false; m_num_pages = -1; m_links_on = false; m_doczoom = 1.0; m_isXPS = false; //xaml_CancelThumb.IsEnabled = true; m_currpage = 0; m_ignorescrollchange = false; m_document_type = DocumentTypes.UNKNOWN; EnabletoPDF(); m_clipboardset = false; m_doscroll = false; m_intxtselect = false; m_textselected = false; m_currpassword = null; CloseExtraWindows(false); ResetScroll(); m_totalpageheight = 0; m_AA = GetAA(); m_origfile = null; m_initpage = 0; xaml_Zoomsize.Text = "100"; m_selectall = false; return result; }
private void SetAA(AA_t aa) { xaml_AA_High.IsChecked = false; xaml_AA_MedHigh.IsChecked = false; xaml_AA_Med.IsChecked = false; xaml_AA_Low.IsChecked = false; xaml_AA_None.IsChecked = false; switch (aa) { case AA_t.HIGH: xaml_AA_High.IsChecked = true; break; case AA_t.MEDHIGH: xaml_AA_MedHigh.IsChecked = true; break; case AA_t.MED: xaml_AA_High.IsChecked = true; break; case AA_t.LOW: xaml_AA_High.IsChecked = true; break; case AA_t.NONE: xaml_AA_High.IsChecked = true; break; } }
private void OnAAChecked(object sender, RoutedEventArgs e) { var control = sender as System.Windows.Controls.Control; string Name = control.Name; /* It would be nice to uncheck all and then recheck the one * that we want to avoid the repeated code below, but that puts * us in a infinite recursion with the call from the xaml Checked * call */ switch (Name) { case "xaml_AA_High": m_AA = AA_t.HIGH; if (xaml_AA_MedHigh != null) xaml_AA_MedHigh.IsChecked = false; if (xaml_AA_Med != null) xaml_AA_Med.IsChecked = false; if (xaml_AA_Low != null) xaml_AA_Low.IsChecked = false; if (xaml_AA_None != null) xaml_AA_None.IsChecked = false; break; case "xaml_AA_MedHigh": m_AA = AA_t.MEDHIGH; if (xaml_AA_High != null) xaml_AA_High.IsChecked = false; if (xaml_AA_Med != null) xaml_AA_Med.IsChecked = false; if (xaml_AA_Low != null) xaml_AA_Low.IsChecked = false; if (xaml_AA_None != null) xaml_AA_None.IsChecked = false; break; case "xaml_AA_Med": m_AA = AA_t.MED; if (xaml_AA_High != null) xaml_AA_High.IsChecked = false; if (xaml_AA_MedHigh != null) xaml_AA_MedHigh.IsChecked = false; if (xaml_AA_Low != null) xaml_AA_Low.IsChecked = false; if (xaml_AA_None != null) xaml_AA_None.IsChecked = false; break; case "xaml_AA_Low": m_AA = AA_t.LOW; if (xaml_AA_High != null) xaml_AA_High.IsChecked = false; if (xaml_AA_MedHigh != null) xaml_AA_MedHigh.IsChecked = false; if (xaml_AA_Med != null) xaml_AA_Med.IsChecked = false; if (xaml_AA_None != null) xaml_AA_None.IsChecked = false; break; case "xaml_AA_None": m_AA = AA_t.NONE; if (xaml_AA_High != null) xaml_AA_High.IsChecked = false; if (xaml_AA_MedHigh != null) xaml_AA_MedHigh.IsChecked = false; if (xaml_AA_Med != null) xaml_AA_Med.IsChecked = false; if (xaml_AA_Low != null) xaml_AA_Low.IsChecked = false; break; } if (mu_doc != null) mu_doc.SetAA(m_AA); if (m_init_done) RenderRange(m_currpage, false, zoom_t.NO_ZOOM, 0); }
public void SetAA(AA_t AAlevel) { lock (m_lock) { tc_mSetAA(mu_object, (int)AAlevel); } }