Ejemplo n.º 1
0
        public static void AddNoteRtf(StringBuilder str)
        {
            str.AppendLine("\\par\\par{\\fs16\\cf10");
            str.Append(gpszSeparator);
            str.Append("\\par {\\b ");
            str.Append(getSharedStringRtf(978));
            str.Append("}");
            str.AppendLine("\\par\\pard");
            str.AppendLine();
            str.Append("\\tab ");
            str.Append(getSharedStringRtf(979));
            str.AppendLine("\\par");
            str.Append("\\tab ");
            str.Append(getSharedStringRtf(980));
            str.AppendLine("\\par");

            if (GPDisplays.Calendar.JulianDayVisible() ||
                GPDisplays.Calendar.AyanamsaValueVisible() ||
                GPDisplays.Calendar.SunLongitudeVisible() ||
                GPDisplays.Calendar.MoonLongitudeVisible())
            {
                str.Append("\\tab ");
                str.Append(getSharedStringRtf(981));
                str.AppendLine("\\par");
            }

            // last line
            str.AppendLine("\\par");
            str.Append("\\tab ");
            str.AppendFormat("{0} {1}", getSharedStringRtf(982), GPAppHelper.getShortVersionText());
            str.AppendLine("}");
        }
Ejemplo n.º 2
0
        public static int FormatCalendarPlain(GPCalendarResults daybuff, StringBuilder m_text)
        {
            int           k, nMasaHeader;
            String        str;
            StringBuilder dayText = new StringBuilder();

            GPCalendarDay pvd, prevd, nextd;
            int           lastmasa  = -1;
            int           lastmonth = -1;
            int           tp1;
            bool          bCalcMoon = (getShowSettingsValue(4) > 0 || getShowSettingsValue(5) > 0);

            GPStrings.pushRich(false);

            m_text.Remove(0, m_text.Length);

            for (k = 0; k < daybuff.m_vcCount; k++)
            {
                prevd = daybuff.get(k - 1);
                pvd   = daybuff.get(k);
                nextd = daybuff.get(k + 1);

                if (pvd != null)
                {
                    nMasaHeader = 0;
                    if (GPDisplays.Calendar.MasaHeader() && (pvd.astrodata.nMasa != lastmasa))
                    {
                        nMasaHeader = 1;
                        m_text.AppendLine();
                        str = string.Format("{0}, {1}", pvd.getMasaLongName(), pvd.getGaurabdaYearLongString());
                        tp1 = (80 - str.Length) / 2;
                        m_text.Append(string.Empty.PadLeft(tp1));
                        m_text.Append(str);
                        m_text.Append(string.Empty.PadLeft(tp1 - GPAppHelper.getShortVersionText().Length));
                        m_text.AppendLine(GPAppHelper.getShortVersionText());
                        if ((pvd.astrodata.nMasa == GPMasa.ADHIKA_MASA) && ((lastmasa >= GPMasa.SRIDHARA_MASA) && (lastmasa <= GPMasa.DAMODARA_MASA)))
                        {
                            AddListText(m_text, getSharedStringPlain(128));
                        }
                        m_text.AppendLine();
                        m_text.AppendLine(GPAppHelper.CenterString(daybuff.CurrentLocation.getLocation(pvd.date.getJulianGreenwichTime()).getFullName(), 80));
                        m_text.AppendLine();
                        lastmasa = pvd.astrodata.nMasa;
                    }

                    if (GPDisplays.Calendar.MonthHeader() && (pvd.date.getMonth() != lastmonth))
                    {
                        nMasaHeader = 1;
                        m_text.AppendLine();
                        str = string.Format("{0} {1}", getSharedStringPlain(759 + pvd.date.getMonth()), pvd.date.getYear());
                        tp1 = (80 - str.Length) / 2;
                        m_text.Append(string.Empty.PadLeft(tp1));
                        m_text.Append(str);
                        string tmpString = GPAppHelper.getShortVersionText();
                        if (tmpString.Length < tp1)
                        {
                            m_text.Append(string.Empty.PadLeft(tp1 - tmpString.Length));
                        }
                        m_text.AppendLine(GPAppHelper.getShortVersionText());
                        m_text.AppendLine(GPAppHelper.CenterString(daybuff.CurrentLocation.getLocation(pvd.date.getJulianGreenwichTime()).getFullName(), 80));
                        m_text.AppendLine();
                        lastmonth = pvd.date.getMonth();
                    }

                    else if (pvd.Travelling != null)
                    {
                        m_text.AppendLine(GPAppHelper.CenterString(GPStrings.getString(1030), 80));
                        GPLocationChange lastLocChange = null;
                        foreach (GPLocationChange lc in pvd.Travelling)
                        {
                            if (lastLocChange != lc)
                            {
                                m_text.AppendLine(GPAppHelper.CenterString(String.Format("{0} -> {1}", lc.LocationA.getFullName(), lc.LocationB.getFullName()), 80));
                                lastLocChange = lc;
                            }
                        }
                        m_text.AppendLine();

                        nMasaHeader = 1;
                    }
                    else if (pvd.FlagNewLocation)
                    {
                        m_text.AppendLine(GPAppHelper.CenterString(GPStrings.getString(9), 80));
                        m_text.AppendLine(GPAppHelper.CenterString(daybuff.CurrentLocation.getLocation(pvd.date.getJulianGreenwichTime()).getFullName(), 80));
                        m_text.AppendLine();

                        nMasaHeader = 1;
                    }

                    if (nMasaHeader == 1)
                    {
                        nMasaHeader = m_text.Length;
                        m_text.Append(" ");
                        m_text.Append(getSharedStringPlain(985).ToUpper().PadRight(16));
                        m_text.Append(getSharedStringPlain(986).ToUpper().PadRight(30));
                        if (GPDisplays.Calendar.PaksaInfoVisible())
                        {
                            m_text.Append(getSharedStringPlain(20).ToUpper().PadRight(6));
                        }
                        else
                        {
                            m_text.Append(string.Empty.PadRight(6));
                        }
                        if (GPDisplays.Calendar.YogaVisible())
                        {
                            m_text.Append(getSharedStringPlain(104).ToUpper().PadRight(10));
                        }
                        if (GPDisplays.Calendar.NaksatraVisible())
                        {
                            m_text.Append(getSharedStringPlain(15).ToUpper().PadRight(15));
                        }
                        if (GPDisplays.Calendar.FastingFlagVisible())
                        {
                            m_text.Append(getSharedStringPlain(987).ToUpper().PadRight(5));
                        }
                        if (GPDisplays.Calendar.RasiVisible())
                        {
                            m_text.Append(getSharedStringPlain(105).ToUpper().PadRight(15));
                        }
                        nMasaHeader = m_text.Length - nMasaHeader;
                        m_text.AppendLine();
                        m_text.AppendLine(string.Empty.PadRight(nMasaHeader, '-'));
                    }

                    AvcGetOldCalendarDayText(pvd, dayText, prevd, nextd);

                    if (!GPDisplays.Calendar.HideEmptyDays() || dayText.Length > 90)
                    {
                        m_text.Append(dayText);
                    }
                }
            }

            AddNoteText(m_text);

            GPStrings.popRich();
            return(1);
        }