diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2014-09-09 16:31:31 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2014-09-09 16:39:41 -0700 |
commit | 7ea99e3a8951e265d1437a77dcfee069de0edf76 (patch) | |
tree | 8e113fea67931064e2a9338d67b26aaabab27512 /platform/winrt/gsview/Convert.xaml.cs | |
parent | 8a9519f2183b64fe220bcb1f6acedbe6acc190cd (diff) | |
download | mupdf-7ea99e3a8951e265d1437a77dcfee069de0edf76.tar.xz |
Rename of winrt to windows due to presence on gsview in this folder.
The contents of this folder will contain both winrt and gsview projects
which are shared in a common visual studio 2013 solution.
Diffstat (limited to 'platform/winrt/gsview/Convert.xaml.cs')
-rw-r--r-- | platform/winrt/gsview/Convert.xaml.cs | 214 |
1 files changed, 0 insertions, 214 deletions
diff --git a/platform/winrt/gsview/Convert.xaml.cs b/platform/winrt/gsview/Convert.xaml.cs deleted file mode 100644 index c2c3ec65..00000000 --- a/platform/winrt/gsview/Convert.xaml.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -using System.ComponentModel; -using System.Collections.ObjectModel; -using System.Text.RegularExpressions; - -namespace gsview -{ - public class Device : INotifyPropertyChanged - { - public String DeviceName - { - get; - internal set; - } - - public gsDevice_t DeviceType - { - get; - internal set; - } - - public bool SupportsMultiPage - { - get; - internal set; - } - - public bool MuPDFDevice - { - get; - internal set; - } - - public event PropertyChangedEventHandler PropertyChanged; - - public void PageRefresh() - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs("DeviceName")); - } - } - - public Device() - { - this.DeviceName = ""; - } - }; - - public class SelectPage : INotifyPropertyChanged - { - public int Page - { - get; - internal set; - } - - public int PageString - { - get; - internal set; - } - - public event PropertyChangedEventHandler PropertyChanged; - - public void PageRefresh() - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs("Page")); - PropertyChanged(this, new PropertyChangedEventArgs("PageString")); - } - } - }; - - /// <summary> - /// Interaction logic for Convert.xaml - /// </summary> - public partial class Convert : Window - { - List<Device> GSDevices; - List<SelectPage> ConvertPages; - - /* Callback to Main */ - internal delegate void ConvertCallBackMain(object gsObject); - internal event ConvertCallBackMain ConvertUpdateMain; - - public Convert(int num_pages) - { - InitializeComponent(); - GSDevices = new List<Device>(); - ConvertPages = new List<SelectPage>(); - SetDeviceList(); - SetPageList(num_pages); - xaml_DeviceList.ItemsSource = GSDevices; - xaml_PageList.ItemsSource = ConvertPages; - } - - public void SetDeviceList() - { - foreach (gsDevice_t device in Enum.GetValues(typeof(gsDevice_t))) - { - Device device_t = new Device(); - device_t.DeviceName = Enum.GetName(typeof(gsDevice_t), device); - device_t.DeviceType = device; - if (device > gsDevice_t.psdrgb) - device_t.SupportsMultiPage = true; - else - device_t.SupportsMultiPage = false; - if (device < gsDevice_t.bmp16) - device_t.MuPDFDevice = true; - else - device_t.MuPDFDevice = false; - GSDevices.Add(device_t); - } - } - - public void SetPageList(int num_pages) - { - for (int k = 1; k < num_pages + 1; k++ ) - { - SelectPage Spage = new SelectPage(); - Spage.Page = k; - Spage.PageString = k; - ConvertPages.Add(Spage); - } - } - - private void ConvertClick(object sender, RoutedEventArgs e) - { - ConvertUpdateMain(this); - } - - private void ConvertCancel(object sender, RoutedEventArgs e) - { - this.Close(); - } - - private void HelpConvert(object sender, RoutedEventArgs e) - { - - } - - private void AllPages(object sender, RoutedEventArgs e) - { - xaml_PageList.SelectAll(); - } - - private void EvenPages(object sender, RoutedEventArgs e) - { - /* First check if any are selected */ - var item = xaml_PageList.SelectedItem; - - /* If none are selected then get all the evens. otherwise just get - * all the evens of the pages that have been selected */ - if (item == null) - { - /* Turn on the evens */ - for (int kk = 1; kk < ConvertPages.Count; kk = kk + 2) - (xaml_PageList.ItemContainerGenerator.ContainerFromIndex(kk) as ListViewItem).IsSelected = true; - } - else - { - /* Turn off any odds */ - for (int kk = 0; kk < ConvertPages.Count; kk = kk + 2) - (xaml_PageList.ItemContainerGenerator.ContainerFromIndex(kk) as ListViewItem).IsSelected = false; - } - } - - private void OddPages(object sender, RoutedEventArgs e) - { - /* First check if any are selected */ - var item = xaml_PageList.SelectedItem; - - /* If none are selected then get all the odds. otherwise just get - all the odds of the pages that have been selected */ - if (item == null) - { - /* Turn on the odds */ - for (int kk = 0; kk < ConvertPages.Count; kk = kk + 2) - (xaml_PageList.ItemContainerGenerator.ContainerFromIndex(kk) as ListViewItem).IsSelected = true; - } - else - { - /* Turn off any evens */ - for (int kk = 1; kk < ConvertPages.Count; kk = kk + 2) - (xaml_PageList.ItemContainerGenerator.ContainerFromIndex(kk) as ListViewItem).IsSelected = false; - } - } - - /* Allow only numbers */ - private void PreviewInput(object sender, TextCompositionEventArgs e) - { - e.Handled = !IsTextAllowed(e.Text); - } - - private static bool IsTextAllowed(string text) - { - Regex regex = new Regex("[^0-9]+"); - return !regex.IsMatch(text); - } - } -} |