예제 #1
0
        public picHeader()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            fbrshHeader = new SolidBrush(Color.FromArgb(40, 85, 51));
            fbrshBar = new SolidBrush(Color.FromArgb(26, 54, 26));
            fbrshText = new SolidBrush(Color.White);
            Font = new Font("Haettenschweiler", 30);
            Icon = eQuran.Properties.Resources.header_icon;

            fIdentity = IdentityEnum.Quran;
            frectIdentity = new Rectangle[2];
            Graphics g = CreateGraphics();
            textWidth[0] = (int)g.MeasureString(text[0], ffontIdentity).Width;
            textWidth[1] = (int)g.MeasureString(text[1], ffontIdentity).Width;
        }
예제 #2
0
파일: picHeader.cs 프로젝트: sunsiz/equran
        protected override void OnMouseClick(MouseEventArgs e)
        {
            if (frectIdentity[0].Contains(e.Location))
            {
                fIdentity = IdentityEnum.Quran;
                SelectedIdentityChanged(this, new EventArgs());
                Invalidate();
            }
            else if (frectIdentity[1].Contains(e.Location))
            {
                fIdentity = IdentityEnum.Hadeeth;
                SelectedIdentityChanged(this, new EventArgs());
                Invalidate();
            }

            base.OnMouseClick(e);
        }
예제 #3
0
파일: picHeader.cs 프로젝트: sunsiz/equran
        public picHeader()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            fbrshHeader = new SolidBrush(Color.FromArgb(40, 85, 51));
            fbrshBar    = new SolidBrush(Color.FromArgb(26, 54, 26));
            fbrshText   = new SolidBrush(Color.White);
            Font        = new Font("Haettenschweiler", 30);
            Icon        = eQuran.Properties.Resources.header_icon;

            fIdentity     = IdentityEnum.Quran;
            frectIdentity = new Rectangle[2];
            Graphics g = CreateGraphics();

            textWidth[0] = (int)g.MeasureString(text[0], ffontIdentity).Width;
            textWidth[1] = (int)g.MeasureString(text[1], ffontIdentity).Width;
        }
예제 #4
0
파일: Form1.cs 프로젝트: yehiasalam/equran
        private void LoadIdentity(IdentityEnum Identity)
        {
            switch (Identity) {
                case IdentityEnum.Quran:

                    if (!isIdentityLoaded[0]) {
                        XmlTextReader xmlReader;

                        /* Read the list of all the available fonts */
                        FontFamily[] ff = FontFamily.Families;
                        for (int i = 0; i < ff.Length; i++) {
                            cmbFontName.Items.Add((string)ff[i].Name);
                        }
                        cmbFontName.Text = Properties.Settings.Default.FontName;
                        cmbFontSize.Text = Properties.Settings.Default.FontSize;

                        /* Read and Load Extensions */
                        xmlReader = new XmlTextReader(PATH_APP_DATA + "extensions.xml");
                        tafseerStruct rstruct;
                        xmlReader.ReadToFollowing("extension");
                        do {
                            ToolStripItem rItem;
                            rstruct = new tafseerStruct();
                            rstruct.dir = xmlReader.GetAttribute("dir");
                            rstruct.id = xmlReader.GetAttribute("id");
                            xmlReader.ReadToFollowing("title");
                            rstruct.title = xmlReader.ReadElementString();
                            xmlReader.ReadToFollowing("location");
                            rstruct.location = xmlReader.ReadElementString();

                            rItem = mextension.Items.Add(rstruct.title);
                            rItem.Tag = rstruct;
                            rItem.Click += new EventHandler(rItem_Click);

                        } while (xmlReader.ReadToFollowing("extension"));
                        xmlReader.Close();

                        /* Read all the available recitors */
                        xmlReader = new XmlTextReader(PATH_APP_DATA + "recitations.xml");
                        xmlReader.ReadToFollowing("recitation");
                        do {
                            dctReciters.Add(xmlReader.GetAttribute("name"),
                                            xmlReader.GetAttribute("url"));
                            cmbrecitors.Items.Add(xmlReader.GetAttribute("name"));
                        } while (xmlReader.ReadToNextSibling("recitation"));
                        xmlReader.Close();
                        cmbrecitors.SelectedIndex = Properties.Settings.Default.quranReciter;

                        /* Read all the sowar names from the xml file */
                        xmlReader = new XmlTextReader(PATH_APP_DATA + "quran.xml");
                        xmlReader.ReadToFollowing("SOURA");
                        do {
                            cmbSoura.Items.Add(xmlReader.GetAttribute("id") + "."
                                            + xmlReader.GetAttribute("name"));
                        } while (xmlReader.ReadToNextSibling("SOURA"));
                        xmlReader.Close();

                        /* Load the quran to the viewer */
                        qv.LoadXmlFile(PATH_APP_DATA + "quran.xml");
                        qv.LoadQuranParts(PATH_APP_DATA + "quran_parts.xml");

                        /* Read other UI elements settings for the quran identity*/
                        cntright.Panel2Collapsed = Properties.Settings.Default.SearchState;
                        chkSearch.Checked = !cntright.Panel2Collapsed;
                        pnla.SelectedText = Properties.Settings.Default.pnlaSelected;
                        pnlb.SelectedText = Properties.Settings.Default.pnlbSelected;
                        QuranVolume.Position = Properties.Settings.Default.VolumeLevel;

                        xmlpnla = new XmlDocument(); xmlpnlb = new XmlDocument();
                        if (!wc.Contains(GettafseerFromTitle(pnla.SelectedText).id))
                            xmlpnla.Load(GettafseerFromTitle(pnla.SelectedText).location);
                        if (!wc.Contains(GettafseerFromTitle(pnlb.SelectedText).id))
                            xmlpnlb.Load(GettafseerFromTitle(pnlb.SelectedText).location);

                        if (Properties.Settings.Default.ViewMode == 0) {
                            qv.ViewMode = qViewer.ViewModeFlags.SingleLine;
                            chkSingleline.Checked = true;
                        }
                        else {
                            qv.ViewMode = qViewer.ViewModeFlags.MultiLine;
                            chkMultiline.Checked = true;
                        }
                        cmbSoura.SelectedIndex = Properties.Settings.Default.CurrentSoura;
                        qv.SelectedIndex = Properties.Settings.Default.CurrentAya;
                        qv.ScrollPosition = Properties.Settings.Default.CurrentScrollValue;

                    }
                    spcHadeeth.Visible = false;
                    spcQuran.Visible = true;
                    pnlQuranTools.Show();
                    pnlHadeethTools.Hide();
                    isIdentityLoaded[0] = true;

                    break;
                case IdentityEnum.Hadeeth:

                    string hadeethSelected = Properties.Settings.Default.hadeethSelected;
                    StringCollection hadeethSearchHistory = Properties.Settings.Default.hadeethSearchHistory;

                    if (!isIdentityLoaded[1]) { /* Identity is loaded for the first time */
                        LoadHadeethTree();

                        if (hadeethSearchHistory != null)
                            foreach (string rItem in hadeethSearchHistory)
                                cmbhdtSearch.Items.Add(rItem);

                        cmbhdtSearchScope.Items.Add("جميع الكتب");
                        cmbhdtSearchScope.SelectedIndex = 0;
                        for (int i = 0; i < 6; i++)
                            cmbhdtSearchScope.Items.Add(trvHadeeth.Nodes[i].Text);

                        trvHadeeth.SelectedNode = NodeFromIndex(trvHadeeth ,hadeethSelected);
                        trvHadeeth.Select();

                    }
                    spcHadeeth.Visible = true;
                    spcQuran.Visible = false;
                    pnlQuranTools.Hide();
                    pnlHadeethTools.Show();
                    isIdentityLoaded[1] = true;
                    break;

            }
        }
예제 #5
0
파일: Form1.cs 프로젝트: sunsiz/equran
        private void LoadIdentity(IdentityEnum Identity)
        {
            switch (Identity)
            {
            case IdentityEnum.Quran:

                if (!isIdentityLoaded[0])
                {
                    XmlTextReader xmlReader;

                    /* Read the list of all the available fonts */
                    FontFamily[] ff = FontFamily.Families;
                    for (int i = 0; i < ff.Length; i++)
                    {
                        cmbFontName.Items.Add((string)ff[i].Name);
                    }
                    cmbFontName.Text = Properties.Settings.Default.FontName;
                    cmbFontSize.Text = Properties.Settings.Default.FontSize;


                    /* Read and Load Extensions */
                    xmlReader = new XmlTextReader(PATH_APP_DATA + "extensions.xml");
                    tafseerStruct rstruct;
                    xmlReader.ReadToFollowing("extension");
                    do
                    {
                        ToolStripItem rItem;
                        rstruct     = new tafseerStruct();
                        rstruct.dir = xmlReader.GetAttribute("dir");
                        rstruct.id  = xmlReader.GetAttribute("id");
                        xmlReader.ReadToFollowing("title");
                        rstruct.title = xmlReader.ReadElementString();
                        xmlReader.ReadToFollowing("location");
                        rstruct.location = xmlReader.ReadElementString();

                        rItem        = mextension.Items.Add(rstruct.title);
                        rItem.Tag    = rstruct;
                        rItem.Click += new EventHandler(rItem_Click);
                    } while (xmlReader.ReadToFollowing("extension"));
                    xmlReader.Close();

                    /* Read all the available recitors */
                    xmlReader = new XmlTextReader(PATH_APP_DATA + "recitations.xml");
                    xmlReader.ReadToFollowing("recitation");
                    do
                    {
                        dctReciters.Add(xmlReader.GetAttribute("name"),
                                        xmlReader.GetAttribute("url"));
                        cmbrecitors.Items.Add(xmlReader.GetAttribute("name"));
                    } while (xmlReader.ReadToNextSibling("recitation"));
                    xmlReader.Close();
                    cmbrecitors.SelectedIndex = Properties.Settings.Default.quranReciter;

                    /* Read all the sowar names from the xml file */
                    xmlReader = new XmlTextReader(PATH_APP_DATA + "quran.xml");
                    xmlReader.ReadToFollowing("SOURA");
                    do
                    {
                        cmbSoura.Items.Add(xmlReader.GetAttribute("id") + "."
                                           + xmlReader.GetAttribute("name"));
                    } while (xmlReader.ReadToNextSibling("SOURA"));
                    xmlReader.Close();


                    /* Load the quran to the viewer */
                    qv.LoadXmlFile(PATH_APP_DATA + "quran.xml");
                    qv.LoadQuranParts(PATH_APP_DATA + "quran_parts.xml");

                    /* Read other UI elements settings for the quran identity*/
                    cntright.Panel2Collapsed = Properties.Settings.Default.SearchState;
                    chkSearch.Checked        = !cntright.Panel2Collapsed;
                    pnla.SelectedText        = Properties.Settings.Default.pnlaSelected;
                    pnlb.SelectedText        = Properties.Settings.Default.pnlbSelected;
                    QuranVolume.Position     = Properties.Settings.Default.VolumeLevel;


                    xmlpnla = new XmlDocument(); xmlpnlb = new XmlDocument();
                    if (!wc.Contains(GettafseerFromTitle(pnla.SelectedText).id))
                    {
                        xmlpnla.Load(GettafseerFromTitle(pnla.SelectedText).location);
                    }
                    if (!wc.Contains(GettafseerFromTitle(pnlb.SelectedText).id))
                    {
                        xmlpnlb.Load(GettafseerFromTitle(pnlb.SelectedText).location);
                    }

                    if (Properties.Settings.Default.ViewMode == 0)
                    {
                        qv.ViewMode           = qViewer.ViewModeFlags.SingleLine;
                        chkSingleline.Checked = true;
                    }
                    else
                    {
                        qv.ViewMode          = qViewer.ViewModeFlags.MultiLine;
                        chkMultiline.Checked = true;
                    }
                    cmbSoura.SelectedIndex = Properties.Settings.Default.CurrentSoura;
                    qv.SelectedIndex       = Properties.Settings.Default.CurrentAya;
                    qv.ScrollPosition      = Properties.Settings.Default.CurrentScrollValue;
                }
                spcHadeeth.Visible = false;
                spcQuran.Visible   = true;
                pnlQuranTools.Show();
                pnlHadeethTools.Hide();
                isIdentityLoaded[0] = true;

                break;

            case IdentityEnum.Hadeeth:

                string           hadeethSelected      = Properties.Settings.Default.hadeethSelected;
                StringCollection hadeethSearchHistory = Properties.Settings.Default.hadeethSearchHistory;

                if (!isIdentityLoaded[1])       /* Identity is loaded for the first time */
                {
                    LoadHadeethTree();

                    if (hadeethSearchHistory != null)
                    {
                        foreach (string rItem in hadeethSearchHistory)
                        {
                            cmbhdtSearch.Items.Add(rItem);
                        }
                    }

                    cmbhdtSearchScope.Items.Add("جميع الكتب");
                    cmbhdtSearchScope.SelectedIndex = 0;
                    for (int i = 0; i < 6; i++)
                    {
                        cmbhdtSearchScope.Items.Add(trvHadeeth.Nodes[i].Text);
                    }

                    trvHadeeth.SelectedNode = NodeFromIndex(trvHadeeth, hadeethSelected);
                    trvHadeeth.Select();
                }
                spcHadeeth.Visible = true;
                spcQuran.Visible   = false;
                pnlQuranTools.Hide();
                pnlHadeethTools.Show();
                isIdentityLoaded[1] = true;
                break;
            }
        }
예제 #6
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            if (frectIdentity[0].Contains(e.Location)) {

                fIdentity = IdentityEnum.Quran;
                SelectedIdentityChanged(this, new EventArgs());
                Invalidate();
            }
            else if (frectIdentity[1].Contains(e.Location)) {
                fIdentity = IdentityEnum.Hadeeth;
                SelectedIdentityChanged(this, new EventArgs());
                Invalidate();
            }

            base.OnMouseClick(e);
        }