public void ShowDocument(TRibbonDocument document)
        {
            int index;

            _document        = document;
            _newCommandIndex = 0;
            ListViewCommands.ListViewItemSorter = null;
            ListViewCommands.Sorting            = SortOrder.None; //@ added
            _listViewColumnSorter.Order         = SortOrder.None;
            ListViewCommands.Items.Clear();
            ListViewCommands.BeginUpdate();
            try
            {
                foreach (TRibbonCommand command in _document.Application.Commands)
                {
                    AddCommand(command);
                    int commandNameMinLength = DefaultCommandNameAtBeginning.Length;
                    if (command.Name.Length >= commandNameMinLength && command.Name.Substring(0, commandNameMinLength).Equals(DefaultCommandNameAtBeginning))
                    //@ changed
                    //if (SameText(string.Copy(Command.Name, 1, 7), "Command"))
                    {
                        if (!int.TryParse(command.Name.Substring(commandNameMinLength), out index))
                        {
                            index = -1;
                        }
                        //index = StrToIntDef(string.Copy(Command.Name, 8, int.MaxValue), -1);
                        if (index > _newCommandIndex)
                        {
                            _newCommandIndex = index;
                        }
                    }
                }
                if (ListViewCommands.Items.Count > 0)
                {
                    ListViewCommands.Items[0].Selected = true;
                }
                else
                {
                    ShowSelection();
                }
            }
            finally
            {
                ListViewCommands.EndUpdate();
                ListViewCommands.ListViewItemSorter = _listViewColumnSorter;
            }
        }
Ejemplo n.º 2
0
        public MainForm()
        {
#if Core
            this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f);
#endif
            InitializeComponent();
            _commandsFrame.SetBoldFonts();
            _viewsFrame.SetBoldFonts();

#if SegoeFont
            this.Font = SystemFonts.MessageBoxFont;
#endif
#if Core && SegoeFont
            //@ maybe this is a bug in Core because we have to set the Font to the UserControls
            _commandsFrame.SetFonts(this.Font);
            _viewsFrame.SetFonts(this.Font);
            _xmlSourceFrame.SetFonts(this.Font);
#endif
            if (components == null)
            {
                components = new Container();
            }
            this.Text = RS_RIBBON_TOOLS;
            this.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
            FormMain  = this;
            CreateMainBitmaps();

            Settings.Instance.Read(this.MinimumSize);
            this.Size = Settings.Instance.ApplicationSize;

            _buildPreviewHelper = BuildPreviewHelper.Instance;
            _buildPreviewHelper.SetActions(null, SetPreviewEnabled, Log, SetLanguages);
            toolPreviewLanguageCombo.Enabled       = false;
            toolPreviewLanguageCombo.SelectedIndex = 0;
            InitEvents();
            InitActions();
            toolVersion.Text = "Version: " + Application.ProductVersion;


            //    constructor Create()
            //{

            _document = new TRibbonDocument();

            //_compiler = new RibbonCompiler();
            //_compiler.OnMessage = RibbonCompilerMessage;

            //// Handle command line options
            //if ((ParamCount > 0) && File.Exists(ParamStr(1)))  // File passed at the command line?
            //    OpenFile(ParamStr(1));
            //if (FindCmdLineSwitch("BUILD"))
            //{
            //    ActionBuild.Execute();
            //    Application.ShowMainForm = false;
            //    Application.Terminate();
            //}// if /BUILD
            //else
            //{
            //    NewFile(true);
            //}//else

            //UpdateControls(); //@ added why?
            _commandsFrame.RefreshSelection(); //@ added

            ShortCutKeysHandler = new ShortCutKeysHandler(base.ProcessCmdKey);
        }
Ejemplo n.º 3
0
 public void ShowDocument(TRibbonDocument document)
 {
     _document = document;
 }