예제 #1
0
        public static AppearanceClass SetAsClassic()
        {
            AppearanceClass newApp = new AppearanceClass();

            newApp.Name = "classic";
            // doing this inside the class to have access to private members to set them to numbers
            newApp.mcaptionFont = "Times New Roman, 10pt, style=Bold";

            newApp.mnHeaderHeight       = 20;
            newApp.HeaderBorderStyle    = BorderStyle.FixedSingle;
            newApp.mainPanelBorderStyle = BorderStyle.FixedSingle;
            newApp.mcaptionBackground   = -2987746;
            newApp.mcaptionForeground   = -16777216;
            newApp.mmainBackground      = Color.White.ToArgb();

            newApp.UseBackgroundColor  = true;
            newApp.SecondaryForeground = newApp.mcaptionForeground;
            return(newApp);

            // February 2013

            // I removed the timeline colors from this because it does not make sense
            // what should be happening with timelines is that they instead take the base
            // colors and apply them to the timeline in some way

//			monthFont = new Font("Georgia", 20.0);
//			mtimelineZoomOutPanelBackground = -5383962;
//			mmonthFontColor = -65536;
//			timelineGradient.Color1 = -7876885;
//			timelineGradient .Color2 = -657931;
//			timelineGradient.GradientMode =System.Drawing.Drawing2D.LinearGradientMode.Horizontal;
        }
예제 #2
0
        /// <summary>
        /// Gets the appearance by key. Called from the main form in respond to a callback from LayoutDetails. Will also be used internall
        /// </summary>
        /// <returns>
        /// The appearance by key.
        /// </returns>
        /// <param name='Key'>
        /// Key.
        /// </param>
        public Layout.AppearanceClass GetAppearanceByKey(string Key)
        {
            Layout.AppearanceClass app = null;
            BaseDatabase           db  = CreateDatabase();

            if (db.Exists(TableName, columnKey, Key))
            {
                // put from database
                System.Collections.Generic.List <object[]> values = db.GetValues(TableName, new string[1] {
                    columnValue
                }, columnKey, Key);
                if (values != null && values.Count > 0)
                {
                    if (values[0] != null && values[0].Length > 0)
                    {
                        string xml = values[0][0].ToString();

                        // now deserialize the object

                        XmlSerializer serializer = new XmlSerializer(typeof(Layout.AppearanceClass));

                        System.IO.StringReader reader = new System.IO.StringReader(xml);
                        app = (Layout.AppearanceClass)serializer.Deserialize(reader);
                    }
                }
            }

            return(app);
        }
예제 #3
0
        void HandleAppearanceSelectedIndexChanged(object sender, EventArgs e)
        {
            // we always get rid of the control, when deselecting the list item too.

            if (null != lastAppPanel)
            {
                AppearanceGroup.Controls.Remove(lastAppPanel);
            }

            if ((sender as ListBox).SelectedItem != null)
            {
                //GetRidOfMe should be picked from the list we fill instead
                Layout.AppearanceClass App = GetAppearanceByKey((sender as ListBox).SelectedItem.ToString());
                if (App != null)
                {
                    AppearancePanel appPanel = new AppearancePanel(true, App, SaveAppearance, null, false);

                    appPanel.Dock = DockStyle.Fill;
                    AppearanceGroup.Controls.Add(appPanel);
                    appPanel.BringToFront();

                    // store this so we can delete it next time
                    lastAppPanel = appPanel;
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Saves the appearance. Triggered from callback in AppearancePanel itself, passing itself back to be stored in the database.
        /// </summary>
        /// <param name='obj'>
        /// Object.
        /// </param>
        void SaveAppearance(Layout.AppearanceClass obj)
        {
            if (null == obj)
            {
                throw new Exception("A null appearance was passed into save routine.");
            }
            if (obj.Name == Constants.BLANK)
            {
                throw new Exception("A name must be assigned to any new Appearance that is created!");
            }
            BaseDatabase db = CreateDatabase();

            Store(db, obj.Name, obj.GetAppearanceXML(), 1);
            db.Dispose();

            // the moment we save an appearance I think we need to PURGE the Cahce in LayoutDetails
            // so that the NEXT time a page is loaded, it benefits from the new appearnces (likewise if a new note is created).
            LayoutDetails.Instance.PurgeAppearanceCache();
            if (null != Appearances)
            {
                // deselect on the list
                Appearances.SelectedIndex = -1;

                // we rebuild the list in case we added a new one
                BuildAppearanceListBox(Appearances);
            }
        }
예제 #5
0
        protected override void DoChildAppearance(AppearanceClass app)
        {
            base.DoChildAppearance(app);


            richBox.BackColor = app.mainBackground;
            richBox.ForeColor = app.secondaryForeground;
        }
예제 #6
0
 private void TestExistence(BaseDatabase db, string key, Func <Layout.AppearanceClass> Setup)
 {
     if (!db.Exists(TableName, columnKey, key))
     {
         Layout.AppearanceClass default1 = Setup();
         //Setup();
         SaveAppearance(default1);
     }
 }
        protected override AppearanceClass UpdateAppearance()
        {
            AppearanceClass app = base.UpdateAppearance();

            if (app != null)
            {
                ParentNotePanel.BackColor = app.mainBackground;
                StoryBoard.ColorControls(app);
            }
            return(app);
        }
예제 #8
0
        protected override AppearanceClass UpdateAppearance()
        {
            AppearanceClass app = base.UpdateAppearance();

            if (app != null)
            {
                ParentNotePanel.BackColor = app.mainBackground;
                Table.SetupColors(app.captionBackground, app.captionForeground, app.mainBackground, app.secondaryForeground, app.captionFont);
            }
            return(app);
        }
        protected override AppearanceClass UpdateAppearance()
        {
            AppearanceClass app = base.UpdateAppearance();

            if (Timeline != null)
            {
                Timeline.GradientColor1 = app.captionBackground;
                Timeline.GradientColor2 = app.captionForeground;
                Timeline.GradientMode   = System.Drawing.Drawing2D.LinearGradientMode.Horizontal;
            }
            return(app);
        }
예제 #10
0
        void HandleClick(object sender, EventArgs e)
        {
            if (null == SaveAppearance)
            {
                throw new Exception("No proper save method for appearances has been initalized");
            }
            AppearancePanelForm form = new AppearancePanelForm(App);

            if (DialogResult.OK == form.ShowDialog())
            {
                AppearanceClass ThisAppearance = form.GetAppearance();


                SaveAppearance(ThisAppearance);
            }
        }
예제 #11
0
        public AppearancePanelForm(AppearanceClass app)
        {
            this.Icon = LayoutDetails.Instance.MainFormIcon;
            FormUtils.SizeFormsForAccessibility(this, LayoutDetails.Instance.MainFormFontSize);

            Panel bottom = new Panel();

            bottom.Dock   = DockStyle.Bottom;
            bottom.Height = LayoutDetails.ButtonHeight;
            ok            = new Button();



            ok.Text         = Loc.Instance.GetString("OK");
            ok.DialogResult = DialogResult.OK;
            ok.Dock         = DockStyle.Left;


            Button Cancel = new Button();

            Cancel.Text         = Loc.Instance.GetString("Cancel");
            Cancel.Dock         = DockStyle.Right;
            Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            bottom.Controls.Add(ok);
            bottom.Controls.Add(Cancel);


            if (app == null)
            {
                // we are in build mode. So we create a classic note
                app = AppearanceClass.SetAsClassic();

                app.Name   = "Choose A Unique Name For Your New Appearance";
                ok.Enabled = false;
            }



            appearancePanel = new AppearancePanel(false, app, null, ValidData, true);

            appearancePanel.Dock = DockStyle.Fill;
            this.Controls.Add(bottom);
            this.Controls.Add(appearancePanel);
            appearancePanel.BringToFront();
        }
예제 #12
0
        public static AppearanceClass SetAsFantasy()
        {
            AppearanceClass newApp = new AppearanceClass();

            newApp.Name         = "fantasy";
            newApp.mcaptionFont = "Georgia, 12pt";                 //1

            newApp.mnHeaderHeight       = 28;                      //2
            newApp.HeaderBorderStyle    = BorderStyle.FixedSingle; //3
            newApp.mainPanelBorderStyle = BorderStyle.None;        //4
            newApp.mcaptionBackground   = -663885;                 //5
            newApp.mcaptionForeground   = -16777216;               //6
            newApp.mmainBackground      = -663885;                 //7

            newApp.UseBackgroundColor  = true;
            newApp.SecondaryForeground = newApp.mcaptionForeground;
            return(newApp);
        }
예제 #13
0
        public static AppearanceClass SetAsModern()
        {
            AppearanceClass newApp = new AppearanceClass();

            newApp.Name = "modern";
            // doing this inside the class to have access to private members to set them to numbers
            newApp.mcaptionFont = "Arial Black, 12pt, style=Bold";

            newApp.mnHeaderHeight       = 28;
            newApp.HeaderBorderStyle    = BorderStyle.None;
            newApp.mainPanelBorderStyle = BorderStyle.None;
            newApp.mcaptionBackground   = -6972;
            newApp.mcaptionForeground   = -16777216;
            newApp.mmainBackground      = -1468806;

            newApp.UseBackgroundColor  = true;
            newApp.SecondaryForeground = newApp.mcaptionForeground;
            return(newApp);
        }
예제 #14
0
        public static AppearanceClass SetAsResearch()
        {
            AppearanceClass newApp = new AppearanceClass();

            newApp.Name = "research";
            // doing this inside the class to have access to private members to set them to numbers
            newApp.mcaptionFont = "Times New Roman, 10pt, style=Bold";

            newApp.mnHeaderHeight       = 20;
            newApp.HeaderBorderStyle    = BorderStyle.FixedSingle;
            newApp.mainPanelBorderStyle = BorderStyle.FixedSingle;
            newApp.mcaptionBackground   = -12490271;
            newApp.mcaptionForeground   = -16777216;
            newApp.mmainBackground      = -984833;

            newApp.UseBackgroundColor  = true;
            newApp.SecondaryForeground = newApp.mcaptionForeground;
            return(newApp);
        }
예제 #15
0
        public static AppearanceClass SetAsNote()
        {
            AppearanceClass newApp = new AppearanceClass();

            newApp.Name = "note";
            // doing this inside the class to have access to private members to set them to numbers
            newApp.mcaptionFont = "Verdana, 10pt, style=Bold";

            newApp.mnHeaderHeight       = 20;
            newApp.HeaderBorderStyle    = BorderStyle.None;
            newApp.mainPanelBorderStyle = BorderStyle.None;
            newApp.mcaptionBackground   = -128;
            newApp.mcaptionForeground   = -16777216;
            newApp.mmainBackground      = -128;

            newApp.UseBackgroundColor  = true;
            newApp.SecondaryForeground = newApp.mcaptionForeground;
            return(newApp);
        }
예제 #16
0
        void HandleAddAppearanceClick1(object sender, EventArgs e)
        {
            if (null == SaveAppearance)
            {
                throw new Exception("No proper save method for appearances has been initalized");
            }

            // Add options
            // We build off the selected Appearance Type but will rename it [No. We do not. Don't want to mess up an existing object]

            AppearancePanelForm form = new AppearancePanelForm(null);

            if (DialogResult.OK == form.ShowDialog())
            {
                AppearanceClass ThisAppearance = form.GetAppearance();


                SaveAppearance(ThisAppearance);
            }
        }
예제 #17
0
        public static AppearanceClass SetAsSciFI()
        {
            AppearanceClass newApp = new AppearanceClass();

            newApp.Name = "scifi";
            // doing this inside the class to have access to private members to set them to numbers
            newApp.mcaptionFont = "Verdana, 18pt, style=Bold";

            newApp.mnHeaderHeight       = 28;
            newApp.HeaderBorderStyle    = BorderStyle.None;
            newApp.mainPanelBorderStyle = BorderStyle.None;
            newApp.mcaptionBackground   = -12156236;
            //newApp.mcaptionForeground = -2894893;
            newApp.mcaptionForeground = Color.DarkGray.ToArgb();            //-2894893;
            newApp.mmainBackground    = -2894893;

            newApp.UseBackgroundColor  = true;
            newApp.SecondaryForeground = newApp.mcaptionForeground;
            return(newApp);
        }
예제 #18
0
        public AppearanceClass GetAppearanceSelected()
        {
            // This is caused only from the FORM version of this control, see below, the HandleClick routine
            AppearanceClass ThisAppearance = new  AppearanceClass();

            // grab name from TextField (which will remain in readonly mode WHEN editing existing but is rightable
            ThisAppearance.Name = NameField.Text;


            ThisAppearance.captionFont          = CaptionBar.Font;
            ThisAppearance.nHeaderHeight        = CaptionBar.Height;
            ThisAppearance.mainPanelBorderStyle = this.BorderStyle;
            ThisAppearance.captionBackground    = CaptionBar.BackColor;
            ThisAppearance.captionForeground    = CaptionBar.ForeColor;

            ThisAppearance.mainBackground      = NameField.BackColor;
            ThisAppearance.secondaryForeground = NameField.ForeColor;
            //this.CaptionLabel.Bord = app.HeaderBorderStyle;  //6



            return(ThisAppearance);
        }
        protected override AppearanceClass UpdateAppearance()
        {
            AppearanceClass app = base.UpdateAppearance();

            if (null != app)
            {
                ParentNotePanel.BackColor = app.mainBackground;
                count.ForeColor           = app.secondaryForeground;
                blurb.ForeColor           = app.secondaryForeground;
                refresh.ForeColor         = app.secondaryForeground;
                FullTextSearch.ForeColor  = app.secondaryForeground;


                count.Font          = app.captionFont;
                blurb.Font          = app.captionFont;
                refresh.Font        = app.captionFont;
                FullTextSearch.Font = app.captionFont;

                list.BackColor = app.mainBackground;
                list.ForeColor = app.secondaryForeground;
                list.Font      = app.captionFont;
            }
            return(app);
        }
예제 #20
0
        // This panel is used in read-only mode to show what a particular appearance looks like
        // It can also be used in edit mode
        public AppearancePanel(bool ShowEditButton, AppearanceClass app, Action <AppearanceClass> _SaveAppearance, Action <bool> validDataToSave, bool AllowNameEdit)
        {
            if (app == null)
            {
                throw new Exception("An invalid appearance was passed into AppearancePanel");
            }
            ValidDataToSave = validDataToSave;

            App            = app;
            SaveAppearance = _SaveAppearance;

            CaptionBar          = new ToolStrip();
            CaptionBar.AutoSize = false;
            ToolStripLabel CaptionLabel = new ToolStripLabel();

            CaptionLabel.Text    = Loc.Instance.GetString("EXAMPLE");
            CaptionBar.GripStyle = ToolStripGripStyle.Hidden;

            //(readonlyunlessvalidtext
            NameField = new TextBox();

            NameField.Text         = app.Name;
            NameField.TextChanged += HandleTextChanged;
            NameField.Dock         = DockStyle.Top;
            NameField.ReadOnly     = !AllowNameEdit;

            this.Controls.Add(NameField);
            this.Controls.Add(CaptionBar);


            CaptionBar.Items.Add(CaptionLabel);



            //
            // THE SETTINGS
            //

            CaptionBar.Font   = app.captionFont;           //[x]
            CaptionBar.Height = app.nHeaderHeight;         //[x]
            //this.CaptionLabel.Bord = app.HeaderBorderStyle;
            this.BorderStyle = app.mainPanelBorderStyle;   //[x]

            CaptionBar.BackColor = app.captionBackground;  //[x]
            CaptionBar.ForeColor = app.captionForeground;  //[x]

            NameField.ForeColor = app.secondaryForeground;
            try {
                NameField.BackColor = app.mainBackground;                 //[x]
            } catch (Exception) {
                NewMessage.Show("The Main Background color is invalid. Try choosing another.");
                NameField.BackColor = this.BackColor;                 //[x]
            }


            if (true == ShowEditButton)
            {
                Button EditBut = new Button();
                EditBut.Text   = Loc.Instance.GetString("Edit");
                EditBut.Click += HandleClick;
                this.Controls.Add(EditBut);
                EditBut.Dock = DockStyle.Bottom;

                Button AddBut = new Button();
                AddBut.Text   = Loc.Instance.GetString("New");
                AddBut.Click += HandleAddAppearanceClick1;
                AddBut.Dock   = DockStyle.Bottom;
                this.Controls.Add(AddBut);
            }
            else
            {
                // when we show the EditButton that means we are in READ ONLY MODE
                // when do do not show the EditButton that means we are in Edit Mode

                // setup the clicks
                ToolStripButton CaptionForeColor = new ToolStripButton();
                CaptionForeColor.Text   = Loc.Instance.GetString("Forecolor");
                CaptionForeColor.Click += HandleForeColorClick;


                ToolStripButton CaptionBackColor = new ToolStripButton();
                CaptionBackColor.Text   = Loc.Instance.GetString("Backcolor");
                CaptionBackColor.Click += HandleBackColorClick1;

                ToolStripButton CaptionFont = new ToolStripButton();
                CaptionFont.Text   = Loc.Instance.GetString("Font");
                CaptionFont.Click += HandleFontClick1;

                ToolStripButton OtherBackColor = new ToolStripButton();
                OtherBackColor.Text   = Loc.Instance.GetString("Secondary Back Color");
                OtherBackColor.Click += HandleSecondaryBackColorClick1;

                ToolStripButton OtherForeColor = new ToolStripButton();
                OtherForeColor.Text   = Loc.Instance.GetString("Secondary Fore Color");
                OtherForeColor.Click += HandleSecondaryForeColorClick;;

                ToolStripComboBox BorderStyleSet = new ToolStripComboBox();
                BorderStyleSet.DropDownStyle = ComboBoxStyle.DropDownList;
                int count = 0;
                int match = 0;
                foreach (string s in Enum.GetNames(typeof(BorderStyle)))
                {
                    BorderStyleSet.Items.Add(s);
                    string name = Enum.GetName(typeof(BorderStyle), app.mainPanelBorderStyle);
                    if (s == name)
                    {
                        match = count;
                    }
                    count++;
                }
                BorderStyleSet.SelectedIndex         = match;
                BorderStyleSet.SelectedIndexChanged += HandleMainBorderSelectedIndexChanged;

                NumericUpDown numbers = new NumericUpDown();


                numbers.Value         = app.nHeaderHeight;
                numbers.ValueChanged += HandleIconsPerColumnValueChanged;
                numbers.Minimum       = 1;
                numbers.Maximum       = 50;
                ToolStripControlHost numbersHost = new ToolStripControlHost(numbers);
                numbersHost.ToolTipText = Loc.Instance.GetString("Adjust this number to change caption height");

                CaptionBar.Items.Add(CaptionForeColor);
                CaptionBar.Items.Add(CaptionBackColor);
                CaptionBar.Items.Add(CaptionFont);
                CaptionBar.Items.Add(OtherBackColor);
                CaptionBar.Items.Add(OtherForeColor);
                CaptionBar.Items.Add(BorderStyleSet);
                CaptionBar.Items.Add(numbersHost);
            }
        }
예제 #21
0
        //	System.Collections.SortedList  AppearanceCache = new SortedList();
        //List<Appearance> AppearanceCache = new List<Appearance>();
        public AppearanceClass GetAppearanceByName(string classic)
        {
            if (null == GetAppearanceFromStorage)
            {
                throw new Exception("A callback to GetAppearanceFromStorage needs to be defined when application initalizes");
            }


            //Hashtable attempt 6.7 seconds to 6.4 on second attempt

            AppearanceClass app = (AppearanceClass)AppearanceCache [classic];

            if (app != null)
            {
            }
            else
            {
                app = GetAppearanceFromStorage(classic);

                if (app == null)
                {
                    NewMessage.Show(Loc.Instance.GetStringFmt("The appearance {0} no longer exists, reverting to default.", classic));
                    // somehow we have lost an appearance then we just use clasic
                    app = AppearanceClass.SetAsClassic();
                }
                //app = new Appearance();
                //app.SetAsClassic();

                AppearanceCache.Add(classic, app);
            }

            //6.4 seconds to 6.9
//			Appearance app = (Appearance)AppearanceCache [classic];
//			if (app != null) {
//			} else {
//				NewMessage.Show ("Hack : 'grabbing app from database. Should see this only once a session");
//							app = new Appearance();
//							app.SetAsClassic();
//
//								AppearanceCache.Add (classic, app);
//			}
//



            // 1. Look to see if it already exist. If so, retrieve it. about 6.6 seconds on zombie
            //    IF NOT, load from database

            /* This seemed faster than Sorted list
             *
             * Appearance app = AppearanceCache.Find (Appearance => Appearance.Name == classic);
             * if (app != null) {
             *
             * }
             * else
             * {
             *      NewMessage.Show ("Hack : 'grabbing app from database. Should see this only once a session");
             * app = new Appearance();
             * app.SetAsClassic();
             *
             *      AppearanceCache.Add (app);
             * }
             */
            return(app);
        }
예제 #22
0
 public Layout.AppearanceClass GetAppearanceFromStorage(string Key)
 {
     Layout.AppearanceClass fake = AppearanceClass.SetAsClassic();
     //fake.SetAsClassic();
     return(fake);
 }
예제 #23
0
 public abstract void ColorToolBars(AppearanceClass app);