Пример #1
0
 /// <summary>
 /// Recreates the interface, usually called when something like Caption is changed. Use UpdateLocation for position only changes
 ///
 /// DO NOT CALL THIS FROM EDITING PROPERTIES!
 /// </summary>
 /// <param name='Layout'>
 /// Layout.
 /// </param>
 public virtual void Update(LayoutPanelBase Layout)
 {
     Save();
     ParentNotePanel.Dispose();
     //Parent = null;
     CreateParent(Layout);
 }
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);
            CaptionLabel.Dock = DockStyle.Top;

            StoryBoard      = new Storyboard();
            StoryBoard.Dock = DockStyle.Fill;



            ParentNotePanel.Controls.Add(StoryBoard);
            StoryBoard.BringToFront();
            StoryBoard.Enter += (object sender, EventArgs e) => BringToFrontAndShow();;


            StoryBoard.FactMode(this.Factmode);
//
//			//moved to end to handle refersh issues
            StoryBoard.Source = this.GuidForNote;            //((NotePanelStoryboard)note).groupEms1.Source = note.appearance.GUID;

            // We do not need to call the SetTable function because this is handled when a table isc reated
            StoryBoard.StickyTable = this.Layout.GetLinkTable();
            StoryBoard.NeedSave   += HandleNeedSave;

            StoryBoard.ViewStyle = this.ViewStyle;
            /*here*/
            if (this.Storyboard_ShowPreview == true)
            {
                StoryBoard.ShowPreview();
            }
            if (this.Storyboard_SplitterSetting > 0)
            {
                // make it run through autmoated test
                if (true == StoryBoard.Visible)
                {
                    StoryBoard.SplitterPosition = this.Storyboard_SplitterSetting;
                }
            }


            StoryBoard.GetNoteForGroupEmPreview += HandleGetNoteForGroupEmPreview;
            StoryBoard.GroupNameTruncateLength   = 15;
            StoryBoard.ShowToolbar      = true;
            StoryBoard.AddItemFromMenu += HandleAddItemFromMenu;
            StoryBoard.ClickItem       += HandleStoryBoardClickItem;
            StoryBoard.InitializeGroupEmFromExternal();

            // trying to get htis to work better
            LayoutDetails.Instance.UpdateAfterLoadList.Add(this);

            // will not add these unless I NEED them (I'm assuming some of this is for selecting things?
//			((NotePanelStoryboard)note).groupEms1.DragNote += new GroupEm.groupEms.CustomEventHandler2(groupEms1_DragNote);
//			((NotePanelStoryboard)note).groupEms1.listView.MouseDown += new MouseEventHandler(listView_MouseDown);
//			((NotePanelStoryboard)note).groupEms1.listView.onScroll += new ScrollEventHandler(listView_onScroll);
//     ((NotePanelStoryboard)note).groupEms1.listView.MouseDown += findBar_MouseDown;
//
        }
Пример #3
0
        public FindBarStatusStrip GetFindbar()
        {
            if (GetIsChild)
            {
                LayoutPanelBase absoluteParent = (LayoutPanelBase)GetAbsoluteParent();
                if (absoluteParent != null)
                {
                    return(absoluteParent.GetFindbar());
                }
            }

            return(FindBar);
        }
Пример #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();
        }
Пример #5
0
        public string GetAbsoluteParent()
        {
            string result = Constants.BLANK;

            if (Layout != null)
            {
                LayoutPanelBase lp = Layout.GetAbsoluteParent();
                if (lp != null)
                {
                    result = lp.GUID;
                }
            }
            return(result);
        }
Пример #6
0
        public static string LookupFilter(string filter, LayoutPanelBase OverridePanelToUse)
        {
            LayoutPanelBase LayoutToUse = LayoutDetails.Instance.TableLayout;

            if (null != OverridePanelToUse)
            {
                LayoutToUse = OverridePanelToUse;
            }
            if (filter != Constants.BLANK)
            {
                List <string> results = LayoutToUse.GetListOfStringsFromSystemTable(LayoutDetails.SYSTEM_QUERIES, 2, String.Format("1|{0}", filter));
                if (results != null && results.Count > 0)
                {
                    return(results [0]);
                }
            }
            return(Constants.BLANK);
        }
        /// <summary>
        /// Updates the list of layouts.
        /// </summary>
        /// <param name='_CurrentFilter'>
        /// _ current filter.
        /// </param>
        void UpdateListOfLayouts(string _CurrentFilter)
        {
            this.list.DataSource = null;
            this.list.Items.Clear();

//			MasterOfLayouts master = new MasterOfLayouts ();
//			this.list.DataSource = master.GetListOfLayouts ("filternotdone");
            //DataView view = new DataView(MasterOfLayouts.GetListOfLayouts (CurrentFilterName));

            // if we are the system note we need to override this
            // to use ourself because the table lookup is not yet loaded
            LayoutPanelBase OverridePanelToUse = null;            //LayoutDetails.Instance.TableLayout;

            if (LayoutDetails.Instance.TableLayout == null)
            {
                OverridePanelToUse = Layout;
            }

            List <MasterOfLayouts.NameAndGuid> ListOfItems = MasterOfLayouts.GetListOfLayouts(_CurrentFilter, TextEditor.Text, FullTextSearch.Checked, OverridePanelToUse);

//			for (int i = ListOfItems.Count - 1; i >= 0; i--)
//			{
//				if (TextEditor.Text != Constants.BLANK)
//				{
//					if (ListOfItems[i].Caption.IndexOf(TextEditor.Text) > -1)
//					{
//
//					}
//					else
//					{
//						ListOfItems.Remove (ListOfItems[i]);
//					}
//				}
//			}
            this.list.DataSource = ListOfItems;

            this.list.DisplayMember = "Caption";
            this.list.ValueMember   = "Guid";


            ///master.Dispose ();

            count.Text = Loc.Instance.GetStringFmt("Count = {0}", this.list.Items.Count);
        }
Пример #8
0
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            //Width = 500;
            base.DoBuildChildren(Layout);
            //	GetChildLayout().SystemNote = true;
            CaptionLabel.Dock = System.Windows.Forms.DockStyle.Top;
            //CaptionLabel.Visible = false;

            //	Maximize(true);
            ParentNotePanel.Leave += HandleLeave;
            //Parent.Enter+= HandleEnter;
            //ParentNotePanel.GotFocus+= HandleGotFocus;
            //ParentNotePanel.MouseEnter+= HandleMouseEnter;
            ParentNotePanel.BringToFront();
            //Parent.Dock = System.Windows.Forms.DockStyle.Left;
            Dock = DockStyle.Fill;
            UpdateLocation();
            //	Parent.BringToFront();
        }
Пример #9
0
        //	public abstract void SystemNoteHasClosedDown (bool closed);

        /// <summary>
        /// Gets the absolute parent (the LayoutPanel that contains me or the subpanels I am inside)
        /// </summary>
        /// <returns>
        /// The absolute parent.
        /// </returns>
        public LayoutPanelBase GetAbsoluteParent()
        {
            LayoutPanelBase layoutParent = null;

            if (this.Parent != null)
            {
                //	NewMessage.Show (this.Parent.Name);

                Control looker = this.Parent;
                if (looker != null)
                {
                    while ((layoutParent == null || layoutParent.GetIsChild == true) && (looker != null) /*not sure&& (looker != null)*/)
                    {
                        if (looker is LayoutPanelBase)
                        {
                            layoutParent = (looker as LayoutPanelBase);

                            //NewMessage.Show ("Setting Absolute to " + layoutParent.GUID);
                        }
                        else
                        {
                        }
                        // because we want to go all the way to the top we keep looking

                        if (null == looker.Parent)
                        {
                            looker = null;
                        }
                        else
                        {
                            looker = looker.Parent;
                        }
                    }
                }                //if looker not null
            }
            else
            {
                NewMessage.Show(Loc.Instance.GetStringFmt("No parent for this layout {0} with ParentGUID = {1}", GUID, this.ParentGUID));
            }
            return(layoutParent);
        }
Пример #10
0
 public void LoadFrom(LayoutPanelBase Layout)
 {
     throw new Exception("not done");
 }
Пример #11
0
 /// <summary>
 /// Adds A layout reference. This is set in the mainform when a layout is loaded.
 /// We hold the LayoutPanel for the situation when the user CLICKS on the note
 /// (instead of moving between notes via a menu
 /// </summary>
 public void AddALayout(LayoutPanelBase _LayoutAssociatedWithThisSystemNote)
 {
     LayoutAssociatedWithThisSystemNote = _LayoutAssociatedWithThisSystemNote;
     ParentNotePanel.Controls.Add(LayoutAssociatedWithThisSystemNote);
 }
Пример #12
0
        /// <summary>
        /// will go through each "next" table from the source one
        /// the calling object
        /// and generateresults
        ///
        ///
        ///
        ///
        /// </summary>
        /// <returns></returns>
        public static string GenerateAllResults(ref string nextTable, DataTable currentTable, string Title, string Core_Table, LayoutPanelBase Layout, bool useHeadingStyle)
        {
            // probably should save first too but not sure
            // how to integrate that

            string sOriginalNextTable = nextTable;

            if (null == Layout)
            {
                throw new Exception("You must have a valid Layout loaded when doing a random table traversal.");
            }
            // do first table
            System.Collections.ArrayList notelist = Layout.GetAllNotes();
            NoteDataInterface[]          notes    = new NoteDataInterface[notelist.Count];
            notelist.CopyTo(notes);

            resultReturn sResult = GenerateResult(0, currentTable, ref nextTable, Title, notes, useHeadingStyle);



            // now, if there are more tables
            //classPageTable tables = this;



            if (sResult.sResult == " \n")
            {
                sResult.sResult = Constants.BLANK;
            }


            while (nextTable != null && nextTable != Constants.BLANK)
            {
                // looks for the note called start
                NoteDataXML_Table table = null;
                bool LINEAR_MODE        = false;

                if (nextTable[0] == '-')
                {
                    // Linear table system.
                    // a -X (any number, with a minus preceding it) represents a row

                    // basically we want to stay on the current table but go to the next row
                    table       = (NoteDataXML_Table)Layout.FindNoteByName(Core_Table);
                    LINEAR_MODE = true;
                }
                else
                {
                    // Grab the next table
                    NoteDataInterface potentialTable = Layout.FindNoteByName(nextTable);
                    if (potentialTable is NoteDataXML_Table)
                    {
                        table = (NoteDataXML_Table)potentialTable;
                        // sep 28 2011
                        // linear table system
                        // if we encounter a 'real table' reference that means
                        // to set the Core Table to that
                        Core_Table = nextTable;
                    }
                }



                //NotePanelTable table = (NotePanelTable)desktop.GetPanelByName(nextTable);

                resultReturn newResult;

                if (table != null)
                {
                    string old_next_table = nextTable;
                    string _caption       = "";              // table.Caption;
                    if (table.TableCaption != "")
                    {
                        _caption = table.TableCaption;
                    }

                    // see note A below for why we have this check
                    if (LINEAR_MODE == true && table.NextTable == "")
                    {
                        // leave nextable alone in Lienar mode
                        // needed for when we call a linear table from another table (instead of calling the linear table directly)
                    }
                    else
                    {
                        nextTable = table.NextTable;                         // this is clearing the row field!
                    }
                    newResult = GenerateResult(sResult.nModifier, (DataTable)table.dataSource, ref nextTable, _caption, notes, useHeadingStyle);



                    /* NOTE A September 28 2011
                     * There is a WEIRD pointer thing happening and working in my favor
                     * Basically because AppearanceClass.NextTable is passed as a ref into GenerateAllResults it is modified directly
                     * when we set Generate the next result
                     * basically we continue to setting this value (not sure why the breakpoint never succeeded though)
                     *
                     * So... I don't want to mess everything, so if we are in LINEAR mode then we
                     * manualy set the table.
                     */


                    // if (nextTable == old_next_table)
                    //{
                    //     nextTable = Header.Blank;
                    // }
                    //  nextTable = table.NextTable;
                    if (newResult.sResult == " \n")
                    {
                        newResult.sResult = Constants.BLANK;
                    }
                    sResult.sResult   = sResult.sResult + newResult.sResult;
                    sResult.nModifier = newResult.nModifier;
                }
                else
                {
                    // if we hit a null then we hit user error
                    // abort
                    nextTable = Constants.BLANK;
                }
            }


            nextTable = sOriginalNextTable;
            return(sResult.sResult);
        }
        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);
        }
Пример #14
0
 public ArrayList GetListOfPages(string s, ref bool b, LayoutPanelBase usedLayout)
 {
     b = false;
     return(null);
 }
Пример #15
0
        /// <summary>
        /// Gets the list of layouts.
        /// </summary>
        /// <returns>
        /// The list of layouts.
        /// </returns>
        /// <param name='filter'>
        /// Filter.
        /// </param>
        /// <param name="OverrideLayoutToUseToFindTable">>
        ///
        public static List <NameAndGuid> GetListOfLayouts(string filter, string likename, bool FullTextSearch, LayoutPanelBase OverrideLayoutToUseToFindTable, string OverrideQuery)
        {
            List <NameAndGuid> result = new List <NameAndGuid> ();

            try {
                string test = Constants.BLANK;
                if (filter.IndexOf("CODE_KEYWORD_AUTO") > -1)
                {
                    // a keyword was clicked on the interface
                    // we now extract it from
                    //CODE_KEYWORD_AUTO, KEYWORD
                    string[] items = filter.Split(new char[1] {
                        ','
                    });
                    if (items != null && items.Length == 2)
                    {
                        string value = items [1];

                        test = String.Format("{0} LIKE '%{1}%'", dbConstants.KEYWORDS, value);
                        //NewMessage.Show (test);
                    }
                }


                // cleanup on likename (can't have apostophes
                if (likename.IndexOf("\"") > 0)
                {
                    likename = likename.Replace("\"", "");
                }
                if (likename.IndexOf("'") > 0)
                {
                    likename = likename.Replace("'", "");
                }

                BaseDatabase MyDatabase = CreateDatabase();

                if (MyDatabase == null)
                {
                    throw new Exception("Unable to create database in LoadFrom");
                }



                // it may be blank if we have done a Keyword click filter, from above
                if (Constants.BLANK == test)
                {
                    test = LookupFilter(filter, OverrideLayoutToUseToFindTable);                      //"and notebook='Writing' ";
                }
                if (test != Constants.BLANK)
                {
                    // initial implementation influenced by needs of SUbmission list
                    // always has an existing Where clause (no subpanels) so we need to
                    // predicate with an AND
                    test = String.Format("and {0}", test);
                }
                if (Constants.BLANK == filter)
                {
                    test = "";
                }

                List <object[]> mySubpanellist = null;



                // Add a name filter
                if (false == FullTextSearch && Constants.BLANK != likename)
                {
                    test = String.Format("and name like '%{0}%'", likename);
                }
                else if (true == FullTextSearch)
                {
                    // modify the query to handle full text searching
                    test = String.Format("and xml like '%{0}%'", likename);



                    // 18/06/2014
                    // Override layout query
                    if (OverrideQuery != Constants.BLANK)
                    {
                        test = OverrideQuery;
                    }

                    // we need to find subpanel items too
                    // this is, text stored in subpanel needs to register too, though this will be tricky.
                    mySubpanellist = MyDatabase.GetValues(dbConstants.table_name, new string[4] {
                        dbConstants.GUID, dbConstants.NAME, dbConstants.BLURB
                        , dbConstants.WORDS
                    },
                                                          dbConstants.SUBPANEL, 1, String.Format(" order by {0} COLLATE NOCASE", dbConstants.NAME), test);
                }


                // 18/06/2014
                // Override layout query
                if (OverrideQuery != Constants.BLANK)
                {
                    test = OverrideQuery;
                }


                List <object[]> myList = MyDatabase.GetValues(dbConstants.table_name, new string[4] {
                    dbConstants.GUID, dbConstants.NAME, dbConstants.BLURB
                    , dbConstants.WORDS
                },
                                                              dbConstants.SUBPANEL, 0, String.Format(" order by {0} COLLATE NOCASE", dbConstants.NAME), test);


                if (myList != null && myList.Count > 0)
                {
                    foreach (object[] o in myList)
                    {
                        NameAndGuid record = new NameAndGuid();
                        record.Guid    = o [0].ToString();
                        record.Caption = o [1].ToString();
                        record.Blurb   = o [2].ToString();
                        int Words = 0;
                        Int32.TryParse(o [3].ToString(), out Words);
                        record.Words = Words;
                        lg.Instance.Line("MasterOfLayouts->GetListOfLayouts", ProblemType.MESSAGE, "adding to ListOfLayouts " + record.Caption);
                        result.Add(record);
                    }
                }


                //
                // Search in Subpanels too
                //

                if (mySubpanellist != null && mySubpanellist.Count > 0)
                {
                    //NewMessage.Show ("Some search terms were found on subpanels");
                    foreach (object[] o in mySubpanellist)
                    {
                        if (o [0].ToString() != Constants.BLANK)
                        {
                            NameAndGuid record = new NameAndGuid();
                            record.Guid = GetSubpanelsParent(o [0].ToString());
                            string nameofsubpanel = o [1].ToString();
                            if (record.Guid != Constants.BLANK)
                            {
                                // we look for the master parent,
                                // if we have nested children
                                while (IsSubpanel(record.Guid) == true && Constants.BLANK != record.Guid)
                                {
                                    record.Guid = GetSubpanelsParent(record.Guid);
                                }



                                record.Caption = GetNameFromGuid(record.Guid);
                                if (ExistsByGUID(record.Guid) == false)
                                {
                                    NewMessage.Show(Loc.Instance.GetStringFmt("Does not exist: {0} Name: {1} Name of Subpanel: {2}", record.Guid, record.Caption, nameofsubpanel));
                                }
                                // don't bother adding if blank
                                if (record.Caption != Constants.BLANK)
                                {
                                    // also don't bother adding if already exists
                                    record.Words = 0;
                                    record.Blurb = "";
                                    result.Add(record);
                                }
                            }
                        }
                    }
                }

                MyDatabase.Dispose();
            } catch (Exception ex) {
                NewMessage.Show(ex.ToString());
            }
            return(result);
        }
Пример #16
0
 public static List <NameAndGuid> GetListOfLayouts(string filter, string likename, bool FullTextSearch, LayoutPanelBase OverrideLayoutToUseToFindTable)
 {
     return(GetListOfLayouts(filter, likename, FullTextSearch, OverrideLayoutToUseToFindTable, Constants.BLANK));
 }
Пример #17
0
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);
            CaptionLabel.Dock        = DockStyle.Top;
            richBox                  = new RichTextExtended();
            richBox.ContextMenuStrip = Layout.GetLayoutTextEditContextStrip();
            richBox.Enter           += HandleRichBoxEnter;
            richBox.Parent           = ParentNotePanel;
            richBox.Dock             = DockStyle.Fill;
            richBox.BringToFront();
            richBox.Rtf = this.Data1;
            richBox.SelectionChanged += HandleRichTextSelectionChanged;
            richBox.TextChanged      += HandleTextChanged;
            richBox.ReadOnly          = this.ReadOnly;
            richBox.HideSelection     = false;         // must be able to see focus form other controls
            captionLabel.MouseDown   += HandleMouseDownOnCaptionLabel;
            //CaptionLabel.MouseHover += HandleCaptionMouseHover;
            MarkupCombo             = new ToolStripComboBox();
            MarkupCombo.ToolTipText = Loc.Instance.GetString("AddIns allow text notes to format text. A global option controls the default markup to use on notes but this may be overridden here.");
            //	LayoutDetails.Instance.BuildMarkupComboBox (MarkupCombo);

            BuildDropDownList();

            properties.DropDownItems.Add(new ToolStripSeparator());

            ToolStripButton fullScreen = new ToolStripButton();

            fullScreen.Text   = Loc.GetStr("Fullscreen");
            fullScreen.Click += HandleFullScreenClick;
            properties.DropDown.Items.Add(fullScreen);

            properties.DropDownItems.Add(MarkupCombo);
            MarkupCombo.SelectedIndexChanged += HandleSelectedIndexChanged;
            MarkupCombo.DropDownStyle         = ComboBoxStyle.DropDownList;
            MarkupCombo.DropDown             += HandleDropDown;
            loadingcombo = true;
            // just show default if we have not overridden this
            if (Markuplanguage == defaultmarkup)
            {
                MarkupCombo.Text = defaultmarkup;
            }
            else
            if (SelectedMarkup != null)
            {
                for (int i = 0; i < MarkupCombo.Items.Count; i++)
                {
                    if (MarkupCombo.Items [i].GetType() == SelectedMarkup.GetType())
                    {
                        MarkupCombo.SelectedIndex = i;
                        break;
                    }
                }
                richBox.MarkupOverride = (iMarkupLanguage)MarkupCombo.SelectedItem;
            }


            extraItemsToShow = new ToolStripComboBox();
            extraItemsToShow.Items.AddRange(Enum.GetNames(typeof(ExtraItemsToShow)));
            extraItemsToShow.DropDownStyle = ComboBoxStyle.DropDownList;
            properties.DropDownItems.Add(extraItemsToShow);

            extraItemsToShow.SelectedIndex         = (int)extraItemsToShow_value;
            extraItemsToShow.ToolTipText           = Loc.Instance.GetString("Reselect this to refresh after editing text.");
            extraItemsToShow.SelectedIndexChanged += (object sender, EventArgs e) => {
                extraItemsToShow_value = (ExtraItemsToShow)extraItemsToShow.SelectedIndex;
                SetSaveRequired(true);
                UpdateExtraView();
            };

            // we use markup tag to indicate whether the data on the markup combo has changed to avoid slowness in save
            MarkupCombo.Tag = false;
            loadingcombo    = false;

            tabView         = new TabNavigation(richBox);
            tabView.Visible = false;
            tabView.Parent  = ParentNotePanel;
            tabView.Dock    = DockStyle.Top;
            //tabView.SendToBack();
            tabView.BringToFront();

            if (null == bookMarkView)
            {
                bookMarkView = new NoteNavigation(this);
            }
            bookMarkView.Visible = false;
            AddBookmarkView();

            UpdateExtraView();
            richBox.BringToFront();
            //CaptionLabel.BringToFront();
        }
        /// <summary>
        /// Handles the get note for group em preview. (Is how we grab the required text or whatever from the preview
        /// </summary>
        /// <param name='sender'>
        /// Sender.
        /// </param>
        string HandleGetNoteForGroupEmPreview(object sender)
        {
            string sResult = "";
            string sGUID   = sender.ToString();

            if (sGUID != null && sGUID != "")
            {
                LayoutPanelBase SuperParent = null;
                if (Layout.GetIsChild == true)
                {
                    SuperParent = Layout.GetAbsoluteParent();
                }
                else
                {
                    SuperParent = Layout;
                }

                NoteDataInterface note = SuperParent.GetNoteOnSameLayout(sGUID, false);
                //NoteDataInterface note = SuperParent.FindNoteByGuid(sGUID);

                if (note != null)
                {
                    if (note is NoteDataXML_LinkNote)
                    {
                        // because the text is stored this should just work
                        sResult = note.GetStoryboardPreview;
//						if (File.Exists(panel.appearance.File) == true)
//						{
//
//							Worgan2006.classPageMiddle importPage =
//								(Worgan2006.classPageMiddle)CoreUtilities.General.DeSerialize(panel.appearance.File, typeof(Worgan2006.classPageMiddle));
//
//
//
//
//							if (importPage != null)
//							{
//								if (importPage.PageType == _Header.pagetype.VISUAL)
//								{
//									System.Type t = _Header.GetClassTypeByPageType(importPage.PageType);
//									importPage =
//										(Worgan2006.classPageMiddle)CoreUtilities.General.DeSerialize(panel.appearance.File, t);
//
//								}
//
//								sResult = importPage.GetBrainstormText;
//								if (sResult.IndexOf("rtf") == -1) sResult = "";
//								importPage = null;
//							}
//						}
                    }
                    else
                    {
                        sResult = note.GetStoryboardPreview;
                    }
                }
            }

            //  Message Box.Show(myAppearance.Caption);
            return(sResult);
        }
Пример #19
0
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);
            ReadOnlyButton.CheckOnClick = false;
            string linkfile = GetLink();


            ToolStripButton SetupLinkButton = new ToolStripButton();

            SetupLinkButton.Text   = Loc.Instance.GetString("Paste Link");
            SetupLinkButton.Click += HandleSetupLinkClick;

            ToolStripButton RefreshLinkButton = new ToolStripButton();

            RefreshLinkButton.Text   = Loc.Instance.GetString("Refresh Link");
            RefreshLinkButton.Click += HandleRefreshLinkClick;


            properties.DropDownItems.Add(SetupLinkButton);
            properties.DropDownItems.Add(RefreshLinkButton);



            if (linkfile != Constants.BLANK)
            {
                if (this.richBox.Text == Constants.BLANK)
                {
                    string[] links = linkfile.Split(new char[1] {
                        '.'
                    });
                    if (links.Length == 2)
                    {
                        // we have a valid link
                        LayoutGuid = links[0];
                        ChildGuid  = links[1];
                        if (LayoutGuid != Constants.BLANK && ChildGuid != Constants.BLANK)
                        {
                            // now retrieve parent
                            NoteDataInterface note = MasterOfLayouts.GetNoteFromInsideLayout(LayoutGuid, ChildGuid);

                            // TODO: if null then iterate through all CHILDREN PANELS???
                            if (null == note)
                            {
                                System.Collections.Generic.List <string> children = MasterOfLayouts.GetListOfChildren(LayoutGuid);
                                foreach (string child in children)
                                {
                                    note = MasterOfLayouts.GetNoteFromInsideLayout(child, ChildGuid);
                                    if (note != null)
                                    {
                                        break;
                                    }
                                }
                            }


                            if (note != null)
                            {
                                if (true == note.IsLinkable)
                                {
                                    SetData(note);
                                }
                            }
                            else
                            {
                                string name = MasterOfLayouts.GetNameFromGuid(LayoutGuid);
                                if (Constants.BLANK != name)
                                {
                                    this.richBox.Text = name;
                                }
                                else
                                {
                                    this.richBox.Text = Loc.Instance.GetStringFmt("There is a link but the target does not appear to be imported yet. Guid is {0}", linkfile);
                                }
                            }



                            // now grab child text
                        }
                    }

                    else
                    {
                        this.richBox.Text = Loc.Instance.GetStringFmt("There is a link but the target does not appear to be imported yet. Guid is {0}", linkfile);
                    }
                }
            }
            else
            {
                this.richBox.Text = Loc.Instance.GetString("Start a link by selecting the note you want to link to and select the Link option. Then return here to set the link up");
            }

            Button GoToLayout = new Button();

            GoToLayout.Dock    = DockStyle.Top;
            GoToLayout.Text    = Loc.Instance.GetString("Go To Link");
            GoToLayout.Enabled = false;
            GoToLayout.Click  += HandleGoToLayoutClick;
            if (LayoutGuid != Constants.BLANK)
            {
                GoToLayout.Enabled = true;
            }

            ParentNotePanel.Controls.Add(GoToLayout);
            GoToLayout.BringToFront();
            richBox.BringToFront();
        }
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);
            CaptionLabel.Dock = DockStyle.Top;

            mode               = new ComboBox();
            mode.Parent        = ParentNotePanel;
            mode.DropDownStyle = ComboBoxStyle.DropDownList;
            mode.Dock          = DockStyle.Top;
            mode.BringToFront();

            mode.Items.Add(Loc.Instance.GetString("Notes on This Layout"));
            mode.Items.Add(Loc.Instance.GetString("All Layouts"));
            mode.Items.Add(Loc.Instance.GetString("Notes on Current Layout"));


            mode.SelectedIndexChanged += HandleDropDownSelectedIndexChanged;


            SearchDetails = new Panel();

            AdjustDockingOfSearchPanel();



            CurrentFilterDropDown      = new ComboBox();
            CurrentFilterDropDown.Dock = DockStyle.Bottom;

            // because we need the tables to be loaded we CANNOT load this data now
            LayoutDetails.Instance.UpdateAfterLoadList.Add(this);



            TextEditor           = new ComboBox();
            TextEditor.Dock      = DockStyle.Bottom;
            TextEditor.KeyPress += HandleTextEditKeyPress;
            TextEditor.KeyUp    += HandleKeyUp;

            // Do some cleanup on history item to keep the list reasonable.
            // This happens only on load to keep things simple
            if (History.Count > 10)
            {
                History.RemoveRange(9, (History.Count) - 9);
            }


            foreach (string s in History)
            {
                TextEditor.Items.Add(s);
            }


            TextEditor.SelectedIndexChanged += (object sender, EventArgs e) => Refresh();;

            FullTextSearch         = new CheckBox();
            FullTextSearch.Checked = false;
            FullTextSearch.Text    = Loc.Instance.GetString("Search All Text Fields");
            FullTextSearch.Dock    = DockStyle.Bottom;

            SearchDetails.Controls.Add(TextEditor);
            SearchDetails.Controls.Add(CurrentFilterDropDown);
            SearchDetails.Controls.Add(FullTextSearch);

            list = new ListBox();
            //list.SelectedIndexChanged += HandleDropDownSelectedIndexChanged;
            list.Parent = ParentNotePanel;
            list.Width  = 125;
            list.Dock   = DockStyle.Fill;
            list.BringToFront();
            list.BindingContextChanged += HandleBindingContextChanged;
            list.DoubleClick           += HandleListBoxDoubleClick;
            list.Click += HandleNoteListClick;

            ParentNotePanel.Controls.Add(SearchDetails);

            count        = new Label();
            count.Parent = ParentNotePanel;
            count.Dock   = DockStyle.Bottom;


            blurb        = new Label();
            blurb.Parent = ParentNotePanel;
            blurb.Dock   = DockStyle.Bottom;


            refresh        = new Button();
            refresh.Text   = Loc.Instance.GetString("Refresh");
            refresh.Dock   = DockStyle.Bottom;
            refresh.Parent = ParentNotePanel;
            refresh.Click += HandleRefreshClick;


            //Menu Stuff

            TokenItem = new ToolStripMenuItem(Loc.Instance.GetString("Dock on Bottom?"));
            TokenItem.CheckOnClick = true;
            TokenItem.Click       += (object sender, EventArgs e) => {
                searchDetailsDock = (sender as ToolStripMenuItem).Checked;
                AdjustDockingOfSearchPanel();
                this.SetSaveRequired(true);
            };
            if (searchDetailsDock)
            {
                TokenItem.Checked = true;
            }
            else
            {
                TokenItem.Checked = false;
            }


            properties.DropDownItems.Add(new ToolStripSeparator());
            properties.DropDownItems.Add(TokenItem);


            //	AdjustHeightOfLayoutSearchPanel (); This already gets called when the note type is chosen
        }