void HandleRowFilterChange(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                string rowfilter = RowFilter;
                LayoutDetails.HandleMenuLabelEdit(sender, e, ref rowfilter, SetSaveRequired);
                RowFilter = rowfilter;

                // update based on filter setting
                Timeline.Refresh();

                // add it to menu
                ToolStripMenuItem test = new ToolStripMenuItem(rowfilter);
                test.Click += delegate(object sender2, EventArgs e2) { RowFilter = RowFilterStrip.Text = test.Text; Timeline.Refresh(); };
                RowFilterStrip.DropDownItems.Add(test);


                // now add it to underlyin gdata
                if (RowHistory != null)
                {
                    if (RowHistory.Count == 5)
                    {
                        RowHistory.Insert(0, rowfilter);
                        // we know we have one at position 5 because count was 5 before (which meant position 4) and we added one
                        RowHistory.RemoveAt(5);
                    }
                    else
                    {
                        RowHistory.Insert(0, rowfilter);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void HandleNoteLinkNameChange(object sender, KeyEventArgs e)
        {
            string tablecaption = TableCaption;

            LayoutDetails.HandleMenuLabelEdit(sender, e, ref tablecaption, SetSaveRequired);
            TableCaption = tablecaption;
        }
 void HandleTextEditKeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         Refresh();
         LayoutDetails.SupressBeep(e);
     }
 }
Ejemplo n.º 4
0
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);
            CaptionLabel.Dock = DockStyle.Top;
            CaptionLabel.SuspendLayout();

            if (null != dataSource)
            {
            }
            else
            {
                NewMessage.Show(Loc.Instance.GetString("CreateParent: You have a null datasource"));
                lg.Instance.Line("NoteDataXML_Table->CreateParent", ProblemType.WARNING, Loc.Instance.GetString("You have a null table which should not happen. This usually occurs only during UNIT TESTING because proper create constructor is not used"));
                BuildDefaultColumns();
            }
            lg.Instance.Line("NoteDataXML_Table-CreateParent", ProblemType.MESSAGE, String.Format("Passing {0} columns into new TablePanel", Columns.Length));
            Table = new TablePanel(dataSource, HandleCellBeginEdit, Columns, GoToNote, this.Caption, GetRandomTableResults);
            lg.Instance.Line("NoteDataXML_Table->CreateParent", ProblemType.MESSAGE, String.Format("Before HANDLEDATABINING my name is {0}", this.Caption));
            Table.Parent = ParentNotePanel;
            Table.Dock   = DockStyle.Fill;
            Table.BringToFront();
            Table.ReadOnly = this.ReadOnly;



            ToolStripMenuItem TableCaptionLabel =
                LayoutDetails.BuildMenuPropertyEdit(Loc.Instance.GetString("Table Caption: {0}"), TableCaption, Loc.Instance.GetString("When generating random data this caption will be used to present the results."), HandleNoteLinkNameChange);



            ToolStripMenuItem NextTableLabel =
                LayoutDetails.BuildMenuPropertyEdit(Loc.Instance.GetString("Next Table: {0}"), NextTable, Loc.Instance.GetString("Set a value here and if the random results of this table resolve without finding a 'NextTable' in the table itself, it will proceed with randomization on the table specified here."), HandleNextTableKeyDown);

            useHeadingStyleOption              = new ToolStripButton();
            useHeadingStyleOption.Text         = Loc.Instance.GetString("Use Heading Styled Captions");
            useHeadingStyleOption.CheckOnClick = true;
            useHeadingStyleOption.Checked      = useHeadingStyleForCaption;
            useHeadingStyleOption.Click       += (object sender, EventArgs e) =>
            {
                SetSaveRequired(true);
                useHeadingStyleForCaption = useHeadingStyleOption.Checked;
            };



            properties.DropDownItems.Add(new ToolStripSeparator());
            properties.DropDownItems.Add(TableCaptionLabel);
            properties.DropDownItems.Add(NextTableLabel);
            properties.DropDownItems.Add(useHeadingStyleOption);
            CaptionLabel.ResumeLayout();
        }
Ejemplo n.º 5
0
        //This is just proves a deeper system. Will need to be done properly, probably via an AddIn
        //right now the context is GetLayoutBy("section", "writing")
        //returns a random NOTE  matching context INCLUDING notes on subpanels
        public static string GetRandomNoteBy(string typeofsearch, string param)
        {
            typeofsearch = dbConstants.NOTEBOOK;

            BaseDatabase    MyDatabase = CreateDatabase();
            List <object[]> results    = MyDatabase.GetValues(dbConstants.table_name, new string[2] {
                dbConstants.NAME, dbConstants.GUID
            }, typeofsearch, param);
            // Do a query on the database
            // then process, grabbing first ONE Layout out of the mix
            //

            string temp = "";
            string guid = Constants.BLANK;

            if (results != null && results.Count > 0)
            {
                int pickme = LayoutDetails.Instance.RandomNumbers.Next(1, results.Count + 1);
                temp = results [pickme - 1] [0].ToString();
                guid = results [pickme - 1] [1].ToString();
            }



            if (Constants.BLANK != guid)
            {
                // we load it
                LayoutInterface layoutdata = LayoutDetails.DATA_Layout(guid);
                //	LayoutPanelBase panel = new Layout.LayoutPanel();
                layoutdata.LoadFrom(null);
                System.Collections.ObjectModel.ReadOnlyCollection <NoteDataInterface> listofnotes = layoutdata.GetNotes();
                if (listofnotes != null && listofnotes.Count > 0)
                {
                    int pickme = LayoutDetails.Instance.RandomNumbers.Next(1, listofnotes.Count + 1);
                    NoteDataInterface randomNote = (NoteDataInterface)listofnotes[pickme - 1];
                    temp = String.Format("Layout: {0} Note Caption: {1}", temp, randomNote.Caption);
                }
            }
            MyDatabase.Dispose();
            // additional hack is just to return the CAPTION, not the GUID, else I won't know if it worked!
            return(temp);
        }
Ejemplo n.º 6
0
        void HandleNextTableKeyDown(object sender, KeyEventArgs e)
        {
            string nextTable = NextTable;

            LayoutDetails.HandleMenuLabelEdit(sender, e, ref nextTable, SetSaveRequired);
            NextTable = nextTable;


//			if (e.KeyData == Keys.Enter) {
//				// the header is not updated unti enter pressed but the NAME is being updated
//				NextTable = (sender as ToolStripTextBox).Text;
//				if ( (sender as ToolStripTextBox).Tag != null && ((sender as ToolStripTextBox).Tag is ToolStripMenuItem))
//				{
//					((sender as ToolStripTextBox).Tag as ToolStripMenuItem).Text = NextTable;
//				}
//
//				// silenece beep
//				e.SuppressKeyPress = true;
//				SetSaveRequired(true);
//
//			}
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the note from inside layout. Called from the LinkNote note type
        /// </summary>
        /// <returns>
        /// The note from inside layout.
        /// </returns>
        /// <param name='ParentGuid'>
        /// Parent GUID.
        /// </param>
        /// <param name='NoteGuid'>
        /// Note GUID.
        /// </param>
        public static NoteDataInterface GetNoteFromInsideLayout(string ParentGuid, string NoteGuid)
        {
            if (ParentGuid == Constants.BLANK || NoteGuid == Constants.BLANK)
            {
                throw new Exception("Must define valid GUIDs for the Layout and the Note");
            }


            BaseDatabase MyDatabase = CreateDatabase();



            {
                // we load it
                LayoutInterface layoutdata = LayoutDetails.DATA_Layout(ParentGuid);
                //	LayoutPanelBase panel = new Layout.LayoutPanel();
                layoutdata.LoadFrom(null);
                System.Collections.ObjectModel.ReadOnlyCollection <NoteDataInterface> listofnotes = layoutdata.GetNotes();
                if (listofnotes != null && listofnotes.Count > 0)
                {
                    foreach (NoteDataInterface note in listofnotes)
                    {
                        if (NoteGuid == note.GuidForNote)
                        {
                            // we found the note we search for
                            return(note);
                        }
                    }
//					int pickme = LayoutDetails.Instance.RandomNumbers.Next (1, listofnotes.Count + 1);
//					NoteDataInterface randomNote = (NoteDataInterface)listofnotes[pickme-1];
                    //temp = String.Format ("Layout: {0} Note Caption: {1}", temp, randomNote.Caption);
                }
            }

            return(null);
        }
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);
            CaptionLabel.Dock = DockStyle.Top;


            if (TableCreated == false)
            {
                Width  = 500;
                Height = 200;
                ParentNotePanel.Width  = Width;
                ParentNotePanel.Height = Height;

                TimelineStartDate = DateTime.Today;

                // A. Create the Table
                NoteDataXML_Table myTable = new NoteDataXML_Table(100, 100, new ColumnDetails[7] {
                    new ColumnDetails("Date", 50),
                    new ColumnDetails("Type", 50),
                    new ColumnDetails("Data", 50),
                    new ColumnDetails("Data2", 50),
                    new ColumnDetails("Data3", 50),
                    new ColumnDetails("Data4", 50),
                    new ColumnDetails("icon", 50)
                });
                string GuidOfTable = this.GuidForNote + "table";
                myTable.GuidForNote = GuidOfTable;

                myTable.Caption = Loc.Instance.GetStringFmt("Table for Timeline");



                Layout.AddNote(myTable);

                // we do not need to call CreateParent because AddNote does it for us
                //myTable.CreateParent (Layout);
                Save();
                myTable.AddRow(new object[7] {
                    DateTime.Today.ToString(), "100", "Example Description", "Example Title", "", "", 2
                });
                TableCreated = true;
                Save();
                // B. Populate it with example Row
            }
            Timeline      = new NotePanelTimeline(this);
            Timeline.Dock = DockStyle.Fill;
            ParentNotePanel.Controls.Add(Timeline);
            Timeline.dayPanelWidth = DayPanelWidth;
            Timeline.BringToFront();

            RowFilterStrip =
                LayoutDetails.BuildMenuPropertyEdit(Loc.Instance.GetString("Row Filter: {0}"), RowFilter, Loc.Instance.GetString("Filter via the columns on the table associated with this timeline."), HandleRowFilterChange);



            ToolStripSeparator sep = new ToolStripSeparator();


            ToolStripComboBox dropper = new ToolStripComboBox();



            dropper.ToolTipText   = Loc.Instance.GetString("Set the type of timeline you want by selecting an appropriate calendar.");
            dropper.DropDownStyle = ComboBoxStyle.DropDownList;
            foreach (Calendar.calendertype calendertype in Enum.GetValues(typeof(Calendar.calendertype)))
            {
                dropper.Items.Add(calendertype.ToString());
            }
            dropper.Text = MCalendarType.ToString();
            dropper.SelectedIndexChanged += HandleSelectedIndexCalendarPickerChanged;



            // Icons Per Column. We had the edit to a ToolStrip Host and add the Host to the toolstrip
            NumericUpDown numbers = new NumericUpDown();


            Panel numbersPanel = new Panel();

            numbersPanel.BackColor = dropper.BackColor;
            Label numbersLabel = new Label();

            numbersLabel.Left = 0;
            //numbersLabel.Dock = DockStyle.Left;
            numbersLabel.Text     = Loc.Instance.GetString("Icons/Column: ");
            numbersLabel.AutoSize = false;
            numbersLabel.Width    = 85;
            numbers.Left          = 90;
            numbers.Width         = 45;
            //numbersLabel.AutoSize = true;
            //numbers.Dock = DockStyle.Right;

            numbersPanel.Controls.Add(numbersLabel);
            numbersPanel.Controls.Add(numbers);
            numbersLabel.BringToFront();
            //numbersPanel.Dock = DockStyle.Fill;


            numbers.Value         = IconsPerColumn;
            numbers.ValueChanged += HandleIconsPerColumnValueChanged;
            numbers.Minimum       = 1;
            numbers.Maximum       = 20;
            ToolStripControlHost iconsPerColumn = new ToolStripControlHost(numbersPanel);


            // Day Width
            ToolStripControlHost setDayWidth = BuildDayWidth(dropper.BackColor);


            DateTimePicker dates = new DateTimePicker();

            dates.Width = 125;
            try {
                dates.Value = this.TimelineStartDate;
            } catch (Exception) {
                dates.Value = DateTime.Today;
            }
            dates.ValueChanged += HandleValueCurrentdateChanged;
            ToolStripControlHost dateToolStrip = new ToolStripControlHost(dates);

            dateToolStrip.ToolTipText = Loc.Instance.GetString("Select a date to center the timeline on that date.");



            properties.DropDownItems.Add(sep);
            properties.DropDownItems.Add(dropper);
            properties.DropDownItems.Add(iconsPerColumn);
            properties.DropDownItems.Add(setDayWidth);
            properties.DropDownItems.Add(RowFilterStrip);
            properties.DropDownItems.Add(dateToolStrip);


            // add hjistory to RowFilterStrip
            foreach (string history in RowHistory)
            {
                ToolStripMenuItem test = new ToolStripMenuItem(history);
                test.Click += delegate(object sender, EventArgs e){ RowFilter = RowFilterStrip.Text = test.Text; Timeline.Refresh(); };
                RowFilterStrip.DropDownItems.Add(test);
            }

            //
            //
            // Hide ZOom Panel
            //
            //
            ToolStripButton HideMonths = new ToolStripButton();

            HideMonths.Text         = Loc.Instance.GetString("Hide Months Panel");
            HideMonths.CheckOnClick = true;
            HideMonths.Checked      = this.HideZoomOutPanel;
            HideMonths.Click       += HandleHideMonthsClick;

            properties.DropDownItems.Add(HideMonths);
            // Adjust panel as needed; also add this to the menu too
            Timeline.HideZoomPanel(this.HideZoomOutPanel);
        }