Example #1
0
        void HandleFactChange(object sender, KeyEventArgs e)
        {
            string tablecaption = FactParseNote;

            LayoutDetails.HandleMenuLabelEdit(sender, e, ref tablecaption, SetSaveRequired);
            FactParseNote = tablecaption;
        }
Example #2
0
        void HandleTokenChange(object sender, KeyEventArgs e)
        {
            string tablecaption = Token;

            LayoutDetails.HandleMenuLabelEdit(sender, e, ref tablecaption, SetSaveRequired);
            Token = tablecaption;
        }
        void HandleSecondaryChange(object sender, KeyEventArgs e)
        {
            string tablecaption = SecondaryDetails[0];

            LayoutDetails.HandleMenuLabelEdit(sender, e, ref tablecaption, SetSaveRequired);
            SecondaryDetails[0] = tablecaption;
        }
Example #4
0
        void HandleBlurbEdit(object sender, KeyEventArgs e)
        {
            string tablecaption = Notes.Blurb;

            LayoutDetails.HandleMenuLabelEdit(sender, e, ref tablecaption, Layout.SetSaveRequired);
            Notes.Blurb = tablecaption;
        }
Example #5
0
        public LayoutForm(LayoutDetails layoutDetails)
        {
            InitializeComponent();

            Icon = Properties.Resources.Icon;

            SetLayout(layoutDetails);
        }
Example #6
0
 public void SetLayout(LayoutDetails layoutDetails)
 {
     // Go through each property and set the value
     foreach (PropertyInfo prop in layoutDetails.GetType().GetProperties()) {
         // Special case for components
         if (prop.Name == "Components") {
             AddComponents((IContainer)prop.GetValue(layoutDetails));
         } else {
             this.SetProperty(prop.Name, prop.GetValue(layoutDetails));
         }
     }
 }
Example #7
0
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);
            try {
                BottomInfo        = new Panel();
                BottomInfo.Dock   = DockStyle.Bottom;
                BottomInfo.Height = 75;


                BottomInfo.AutoScroll = true;

                refreshButton        = new Button();
                refreshButton.Dock   = DockStyle.Left;
                refreshButton.Name   = REFRESH_BUTTON;
                refreshButton.Text   = Loc.Instance.GetString("O");
                refreshButton.Click += (object sender, EventArgs e) => {
                    refreshButton.Cursor  = Cursors.WaitCursor;
                    refreshButton.Enabled = false;
                    ResetBackgroundWorker();
                };

                BottomInfo.Controls.Add(refreshButton);

                ParentNotePanel.Controls.Add(BottomInfo);


                ToolStripMenuItem TokenItem =
                    LayoutDetails.BuildMenuPropertyEdit(Loc.Instance.GetString("Token: [[{0}]]"),
                                                        Token,
                                                        Loc.Instance.GetString("Enter the token you use to annotate facts discussing this topic in the text."),
                                                        HandleTokenChange);

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


                ToolStripMenuItem FactParseNoteItem =
                    LayoutDetails.BuildMenuPropertyEdit(Loc.Instance.GetString("Note With Fact Details: {0}"),
                                                        FactParseNote,
                                                        Loc.Instance.GetString("Indicate a note on this layout that contains fact-parsing instructions."),
                                                        HandleFactChange);


                properties.DropDownItems.Add(FactParseNoteItem);
            } catch (Exception ex) {
                NewMessage.Show(ex.ToString());
            }


            UpdateView();
        }
        public ActionResult GetLayoutDetails(int layoutId)
        {
            Layout layout = db.Layout.Find(layoutId);
            List <LayoutDecorate>       decorateData       = new List <LayoutDecorate>();
            List <LayoutSpotYuanZhuang> spotYuanZhuangData = new List <LayoutSpotYuanZhuang>();
            List <LayoutSpotShiGong>    spotShiGongData    = new List <LayoutSpotShiGong>();
            LayoutDetails layoutData = new LayoutDetails();

            layoutData.LayoutId            = layout.Id;
            layoutData.LayoutName          = layout.LayoutName;
            layoutData.LayoutPic           = ConfigurationManager.AppSettings["ResourceUrl"] + layout.LayoutPic;
            layoutData.LayoutAdvantages    = layout.Advantage;
            layoutData.LayoutDisadvantages = layout.Disadvantage;

            List <Decorate>    decorateList   = db.Decorate.Where(item => item.LayoutId == layout.Id).ToList();
            List <SpotPics>    spotPicsList   = db.SpotPics.Where(item => item.LayoutId == layout.Id).ToList();
            SpotYuanZhuangData yuanZhuangData = new SpotYuanZhuangData();
            SpotShiGongData    shiGongData    = new SpotShiGongData();

            foreach (Decorate decorate in decorateList)
            {
                LayoutDecorate decoratedata = new LayoutDecorate();
                decoratedata.DecorateId    = decorate.Id;
                decoratedata.DecorateIndex = ConfigurationManager.AppSettings["ResourceUrl"] + decorate.DecorateIndex;
                decoratedata.Is360         = (decorate.Decorate360 == null) ? 0 : 1;
                decorateData.Add(decoratedata);
            }
            foreach (SpotPics spotPic in spotPicsList.Where(item => item.Category == 1))
            {
                LayoutSpotYuanZhuang yuanzhuangdata = new LayoutSpotYuanZhuang();
                yuanzhuangdata.SpotId    = spotPic.Id;
                yuanzhuangdata.SpotIndex = ConfigurationManager.AppSettings["ResourceUrl"] + spotPic.SpotIndex;
                //yuanzhuangdata.SpotPics = spotPic.SpotDetails;
                spotYuanZhuangData.Add(yuanzhuangdata);
            }
            foreach (SpotPics spotPic in spotPicsList.Where(item => item.Category == 2))
            {
                LayoutSpotShiGong shigongdata = new LayoutSpotShiGong();
                shigongdata.SpotId    = spotPic.Id;
                shigongdata.SpotIndex = ConfigurationManager.AppSettings["ResourceUrl"] + spotPic.SpotIndex;
                //shigongdata.SpotPics = spotPic.SpotDetails;
                spotShiGongData.Add(shigongdata);
            }
            layoutData.Decotate           = decorateData;
            layoutData.SpotYuanZhuangData = spotYuanZhuangData;
            layoutData.SpotShiGongData    = spotShiGongData;
            return(Json(new { data = layoutData }, JsonRequestBehavior.AllowGet));
        }
Example #9
0
        public LayoutBuilder(string layoutPath)
        {
            LayoutDetails = new LayoutDetails();

            // Create layout json file if it does not exist
            if (!File.Exists(layoutPath)) {
                File.WriteAllText(DefaultLayoutPath, "{}");
            }

            // Parse layout json file
            string content = Regex.Replace(File.ReadAllText(layoutPath), @"\\", @"\\");
            JObject obj = JsonConvert.DeserializeObject<JObject>(content);
            // Go through each property and set the value
            foreach (JProperty property in obj.Properties()) {
                // Special case for components
                if (property.Name == "Components") {
                    AddComponents(property.Value);
                } else {
                    LayoutDetails.SetProperty(property);
                }
            }
        }
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);

            if (PrimaryDetails.Count == 0)
            {
                PrimaryDetails.Add("beep");
            }
            if (SecondaryDetails.Count == 0)
            {
                SecondaryDetails.Add(Constants.BLANK);
            }


            ParentNotePanel.Height      = this.CaptionLabel.Height;
            this.MaximizeButton.Visible = false;
            this.MinimizeButton.Visible = false;
            this.captionLabel.Visible   = false;
            ActionButton        = new ToolStripButton();
            ActionButton.Text   = this.captionLabel.Text;
            ActionButton.Click += HandleActionButtonClick;
            CaptionLabel.Items.Insert(0, ActionButton);

            ToolStripMenuItem PrimaryDetailLink =
                LayoutDetails.BuildMenuPropertyEdit(Loc.Instance.GetString("Primary: {0}"),
                                                    PrimaryDetails[0],
                                                    Loc.Instance.GetString("Enter main action (Beep, evenwindows_alpha)."), HandlePrimaryChange);

            ToolStripMenuItem SecondaryDetailLink =
                LayoutDetails.BuildMenuPropertyEdit(Loc.Instance.GetString("Secondary: {0}"),
                                                    SecondaryDetails[0],
                                                    Loc.Instance.GetString("Enter secondary action (Comma delimited list of notes for evenwindows_alpha)."),
                                                    HandleSecondaryChange);

            properties.DropDownItems.Add(new ToolStripSeparator());
            properties.DropDownItems.Add(PrimaryDetailLink);
            properties.DropDownItems.Add(SecondaryDetailLink);
        }
Example #11
0
        public JsonResult GetPushNotification()
        {
            LayoutDetails layoutDetails = new LayoutDetails();

            return(Json(layoutDetails.GetPushNotification(), JsonRequestBehavior.AllowGet));
        }
Example #12
0
        private void ReLayout( bool forceInvalidate )
        {
            if( _layingOutFlag.IsActive )
            {
                return;
            }
            if( !IsHandleCreated )
            {
                return;
            }

            using( _layingOutFlag.Apply() )
            {
                int oldLevelOfDetail = _levelOfDetail;

                List<LayoutDetails> listLayoutDetails;
                Utility.Collections.ComparativeTuple visiblesKey = GetSectionsVisibleKey();

                if( !_mapLevelOfDetails.TryGetValue( visiblesKey, out listLayoutDetails ) )
                {
                    using( Graphics g = CreateGraphics() )
                    {
                        listLayoutDetails = new List<LayoutDetails>();

                        for( int lod = Item.BestLevelOfDetail; lod <= Item.WorstLevelOfDetail; ++lod )
                        {
                            LayoutDetails layoutDetails = new LayoutDetails();

                            int widthRequired;
                            int ribbonHeight;
                            bool success = _renderer.Layout
                                ( g, this, _sections.ToArray(), lod, _leftOffset, _rightOffset
                                , out layoutDetails.MapSectionToRectangle, out layoutDetails.MapItemToRectangle, out ribbonHeight, out widthRequired );

                            layoutDetails.MaxWidth = widthRequired;
                            layoutDetails.LevelOfDetail = lod;
                            layoutDetails.RibbonHeight = ribbonHeight;

                            listLayoutDetails.Add( layoutDetails );
                        }
                    }

                    listLayoutDetails.Reverse();

                    _mapLevelOfDetails.Add( visiblesKey, listLayoutDetails );
                }

                int newRibbonHeight = 0;

                foreach( LayoutDetails layoutDetails in listLayoutDetails )
                {
                    if( layoutDetails.MaxWidth > ClientRectangle.Width )
                    {
                        break;
                    }

                    newRibbonHeight = layoutDetails.RibbonHeight;
                    _mapItemToRectangle = layoutDetails.MapItemToRectangle;
                    _mapSectionToRectangle = layoutDetails.MapSectionToRectangle;
                    _levelOfDetail = layoutDetails.LevelOfDetail;
                }

                if( forceInvalidate || _levelOfDetail != oldLevelOfDetail )
                {
                    Invalidate( true );
                }

                if( Height != newRibbonHeight )
                {
                    SetHeight( newRibbonHeight );
                }
            }
        }
Example #13
0
        void HandlePropertiesDropDownOpening(object sender, EventArgs e)
        {
            (sender as ToolStripDropDownButton).DropDownItems.Clear();
            changeName              = new ToolStripTextBox();
            changeName.Font         = new Font(changeName.Font.FontFamily, 12);
            changeName.Text         = Notes.Name;
            changeName.KeyDown     += HandleChangeNameKeyDown;
            changeName.TextChanged += HandleChangeNameClick;
            ////////////////////////////


            ToolStripMenuItem Blurb = LayoutDetails.BuildMenuPropertyEdit(Loc.Instance.GetString("Blurb: {0}"), Notes.Blurb,
                                                                          Loc.Instance.GetString("A brief blurb discussing the purpose of this layout."),
                                                                          HandleBlurbEdit);



            ///////////////////////////
            SourceItem = new ToolStripMenuItem();
            if (Notes.Source == Constants.BLANK)
            {
                Notes.Source = Loc.Instance.GetString("none");
            }
            SourceItem.Text        = Notes.Source;
            SourceItem.ToolTipText = Loc.Instance.GetString("Source: If a reference, indicate where the reference originated.");


            Source = new ContextMenuStrip();
            ToolStripTextBox sourceText = new ToolStripTextBox();

            sourceText.Text     = Notes.Source;
            sourceText.KeyDown += HandleSourceKeyDown;;
            Source.Items.Add(sourceText);


            // - words
            WordItem = new ToolStripMenuItem();

            WordItem.Text        = Loc.Instance.GetStringFmt("Words: {0}", Notes.Words.ToString());
            WordItem.ToolTipText = Loc.Instance.GetString("Indicate the length of this piece, in words.");


            Words = new ContextMenuStrip();
            ToolStripTextBox sourceWords = new ToolStripTextBox();

            sourceWords.Text     = Notes.Words.ToString();
            sourceWords.KeyDown += HandleWordsKeyDown;;
            Words.Items.Add(sourceWords);

            //tabMenu.DropDownItems.Remove (tabMenu.DropDownItems.Add ("empty"));


            //////////
            ToolStripButton backColor = new ToolStripButton();

            backColor.Text              = Loc.Instance.GetString("Background Color");
            backColor.BackColorChanged += HandleBackColorChanged;
            backColor.BackColor         = Notes.BackgroundColor;
            backColor.Click            += HandleBackGroundColorClick;



            //////////

            // setup contextmenus
            SourceItem.DropDown = Source;
            WordItem.DropDown   = Words;

            (sender as ToolStripDropDownButton).DropDownItems.Add(changeName);
            (sender as ToolStripDropDownButton).DropDownItems.Add(Blurb);
            (sender as ToolStripDropDownButton).DropDownItems.Add(SourceItem);
            (sender as ToolStripDropDownButton).DropDownItems.Add(WordItem);
            (sender as ToolStripDropDownButton).DropDownItems.Add(backColor);
            //(sender as ToolStripDropDownButton).DropDownItems.Add (tabMenu);
        }