Exemple #1
0
        private void newPage()
        {
            TabPageEx tp = new TabPageEx();

            tp.Text = "new file";

            tp.ImageIndex = 0;
            krbTabControl1.TabPages.Add(tp);
            FastColoredTextBox tb = new FastColoredTextBox();

            tb.Language         = FastColoredTextBoxNS.Language.Lua;
            tb.AutoIndentChars  = false;
            tb.Parent           = tp;
            tb.ShowFoldingLines = true;
            tb.ContextMenuStrip = contextMenuStrip1;
            this.autocompleteMenu1.SetAutocompleteMenu(tb, this.autocompleteMenu1);
            tb.TextChanged      += new System.EventHandler <TextChangedEventArgs>(this.fastColoredTextBox1_TextChanged);
            tb.SelectionChanged += new System.EventHandler(this.fastColoredTextBox1_SelectionChanged);
            tb.Dock              = DockStyle.Fill;
            tb.CurrentLineColor  = Color.FromArgb(199, 220, 83);

            tb.ReadOnly = false;

            krbTabControl1.SelectedTab = tp;
        }
Exemple #2
0
        private void zDesignSequence(Sequence sequence)
        {
            if (sequence != null)
            {
                string sequenceTabKey = zGetSequenceTabKey(sequence);
                if (tabControl1.TabPages.ContainsKey(sequenceTabKey))
                {
                    tabControl1.SelectTab(sequenceTabKey);
                }
                else
                {
                    SequenceDetail sequenceDetail = WebHawkAppContext.AutomationController.GetSequenceDetail(sequence.SequenceId);

                    TabPageEx tpEditSequence = new TabPageEx(sequence.Name);
                    tpEditSequence.Name             = sequenceTabKey;
                    tpEditSequence.Tag              = sequence;
                    tpEditSequence.ContextMenuStrip = tabMenu;
                    SequenceRecorder recorder = new SequenceRecorder(sequenceDetail.SequenceSteps);
                    recorder.Dock = DockStyle.Fill;
                    tpEditSequence.Controls.Add(recorder);

                    recorder.SequenceChanged += recorder_SequenceChanged;
                    recorder.ExecutionStart  += recorder_ExecutionStart;
                    recorder.ExecutionStop   += recorder_ExecutionStop;

                    tabControl1.TabPages.Add(tpEditSequence);
                    tabControl1.SelectedTab = tpEditSequence;

                    recorder.ExecuteSequence(1);
                }
            }
        }
Exemple #3
0
        //*************************************************************************************************************
        private void ServerTabs_TabClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            TabPageEx tab = ((TabPageEx)ServerTabs.SelectedTab);

            if (tab == null)
            {
                return;
            }

            Server server = (Server)((TabPageEx)tab).SomeUserObject;

            if (server == null)
            {
                return;
            }

            if (tryCloseTab == null) //first try to close?
            {
                if (MessageBox.Show("You are about to close a server tab?", "Close?",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No)
                {
                    e.Cancel = true;
                    return;
                }
            }

            server.OnTabClose();

            Focus();
            FocusSelectedTab();
        }
Exemple #4
0
        /// <summary>
        /// Function to add a category tab.
        /// </summary>
        /// <param name="category">Category to use.</param>
        /// <returns>The panel that will contain the example panels.</returns>
        private Panel AddCategory(Category category)
        {
            if ((category.Examples == null) ||
                (category.Examples.Count == 0))
            {
                return(null);
            }

            var page = new TabPageEx(category.Name)
            {
                IsClosable = false,
                Name       = "page" + category.Name
            };

            var panel = new Panel
            {
                Name        = "panel" + category.Name,
                BackColor   = Color.White,
                Dock        = DockStyle.Fill,
                BorderStyle = BorderStyle.FixedSingle,
                AutoScroll  = true
            };

            page.Controls.Add(panel);
            tabCategories.TabPages.Add(page);

            return(panel);
        }
Exemple #5
0
        private IList <PreferencePanel> _prefPanels;               // A list of our loaded preference panels.
        #endregion

        #region Methods.
        /// <summary>
        /// Function to populate the values for tabs.
        /// </summary>
        private void PopulateTabValues()
        {
            foreach (PreferencePanel panel in _prefPanels.Where(item => item.CanAddAsTab()))
            {
                panel.LocalizeControls();

                var page = new TabPageEx(panel.Text)
                {
                    BackColor  = DarkFormsRenderer.WindowBackground,
                    ForeColor  = Color.White,
                    Text       = panel.Text,
                    Font       = tabPrefs.Font,
                    IsClosable = false
                };

                tabPrefs.TabPages.Add(page);

                page.Controls.Add(panel);

                if (panel.Height > page.ClientSize.Height)
                {
                    panel.Width            = page.ClientSize.Width - (SystemInformation.VerticalScrollBarWidth + 2);
                    page.AutoScrollMinSize = new Size(panel.Width, panel.Height);
                }
                else
                {
                    panel.Width  = page.ClientSize.Width;
                    panel.Height = page.ClientSize.Height;
                }

                panel.InitializeSettings();
            }
        }
 public bool Contains(TabPageEx TabPage)
 {
     if (List.Contains(TabPage))
         return true;
     else
         return false;
 }
 public void Add(TabPageEx TabPage)
 {
     if (List.Contains(TabPage))
         throw new ArgumentException("Bu tab zaten var.");
     else
         List.Add(TabPage);
 }
Exemple #8
0
        private void ChatControl_WindowModeChange(object sender, ChatControl.WindowModeArgs e)
        {
            ChatControl control = (ChatControl)sender;

            control.Parent = null;
            string key     = e.Key;
            string text    = string.Empty;
            bool   enabled = true;

            if (e.Event == ChatControl.WindowModeEvents.PopIn)
            {
                foreach (ChatForm chatForm in windowList)
                {
                    if (chatForm.Name.Equals(key))
                    {
                        text    = chatForm.Text;
                        enabled = chatForm.Enabled;
                        windowList.Remove(chatForm);
                        chatForm.Dispose();
                        break;
                    }
                }
                TabPageEx newTabPage = CreateChatTab(key, text);
                if (newTabPage != null)
                {
                    newTabPage.Enabled = enabled;
                    newTabPage.Controls.Add(control);
                    control.Windowed = false;
                }
            }
            else
            {
                if (tabControlChat.TabPages.ContainsKey(key))
                {
                    tabControlChat.TabPages.RemoveByKey(key);
                }
                foreach (TabPageEx tabPage in tabList)
                {
                    if (tabPage.Name.Equals(key))
                    {
                        text    = tabPage.Text;
                        enabled = tabPage.Enabled;
                        tabList.Remove(tabPage);
                        tabPage.Dispose();
                        break;
                    }
                }
                ChatForm newChatForm = CreateChatForm(key, text, true);
                if (newChatForm != null)
                {
                    newChatForm.Enabled = enabled;
                    newChatForm.Controls.Add(control);
                    control.Windowed = true;
                }
            }
            tabControlChat.Visible = (tabControlChat.TabCount > 0);
        }
Exemple #9
0
 private void tabControlChat_Selected(object sender, TabControlEventArgs e)
 {
     if (e.TabPage != null && e.Action == TabControlAction.Selected)
     {
         TabPageEx   tabPage     = (TabPageEx)e.TabPage;
         ChatControl chatControl = (ChatControl)tabPage.Controls["ChatControl"];
         chatControl.SetFocus();
     }
 }
        /// <summary>
        /// Updates an existing conversation with a new incoming message.
        /// </summary>
        /// <param name="key">Unique key of the sender.</param>
        /// <param name="messageType">Type of the message.</param>
        /// <param name="timeStamp">Time stamp of the message.</param>
        /// <param name="userName">Name of the sender.</param>
        /// <param name="messageText">The message text.</param>
        private void UpdateConversation(string key, MessageTypes messageType, string timeStamp, string userName, string messageText)
        {
            //  Start a new conversation if a conversation with this user does not exist.
            switch (messageType)
            {
            case MessageTypes.Message:
                StartConversation(key, userName, false);
                PlaySound(NotifyEvents.NewMessage);
                break;

            case MessageTypes.Online:
                if (this.WindowState == FormWindowState.Minimized && bShowNotifications)
                {
                    if (key.Equals(localUserKey))
                    {
                        DisplayAlert(AppInfo.Title, "You are online.");
                    }
                    else
                    {
                        DisplayAlert(AppInfo.Title, userName + " is online.");
                    }
                }
                if (!key.Equals(localUserKey))
                {
                    PlaySound(NotifyEvents.Online);
                }
                break;

            case MessageTypes.Offline:
                if (this.WindowState == FormWindowState.Minimized && bShowNotifications)
                {
                    if (key.Equals(localUserKey))
                    {
                        DisplayAlert(AppInfo.Title, "You are offline.");
                    }
                    else
                    {
                        DisplayAlert(AppInfo.Title, userName + " is offline.");
                    }
                }
                break;
            }

            if (tabList.ContainsKey(key))
            {
                TabPageEx   tabPage     = tabList[key];
                ChatControl chatControl = (ChatControl)tabPage.Controls["ChatControl"];
                chatControl.ReceiveMessage(messageType, timeStamp, userName, messageText);
            }
            else if (windowList.ContainsKey(key))
            {
                ChatForm    chatForm    = windowList[key];
                ChatControl chatControl = (ChatControl)chatForm.Controls["ChatControl"];
                chatControl.ReceiveMessage(messageType, timeStamp, userName, messageText);
            }
        }
Exemple #11
0
        private void newFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Files f = new Files();


            using (NewProject form2 = new NewProject())
            {
                form2.StartPosition = FormStartPosition.CenterParent;
                form2.ShowDialog();
                f.name      = form2.textbox1value;
                f.baseClass = form2.textbox2value;
                f.path      = form2.textbox3value;
            }

            TabPageEx tp = new TabPageEx();

            tp.Text = f.name;

            tp.ImageIndex = 0;
            krbTabControl1.TabPages.Add(tp);
            FastColoredTextBox tb = new FastColoredTextBox();

            tb.Language         = FastColoredTextBoxNS.Language.Lua;
            tb.AutoIndentChars  = false;
            tb.Parent           = tp;
            tb.ShowFoldingLines = true;
            tb.ContextMenuStrip = contextMenuStrip1;
            this.autocompleteMenu1.SetAutocompleteMenu(tb, this.autocompleteMenu1);
            tb.TextChanged      += new System.EventHandler <TextChangedEventArgs>(this.fastColoredTextBox1_TextChanged);
            tb.SelectionChanged += new System.EventHandler(this.fastColoredTextBox1_SelectionChanged);
            tb.Dock              = DockStyle.Fill;
            tb.CurrentLineColor  = Color.FromArgb(199, 220, 83);

            tb.ReadOnly = false;
            tb.Text     =
                @"function OnLoad()
    " + f.baseClass + @"()
end

class """ + f.baseClass + @"""
function " + f.baseClass + @":__init()
    AddDrawCallback(function() self:OnDraw() end)
    AddTickCallback(function() self:OnTick() end)
end

function " + f.baseClass + @":OnDraw()
    
end

function " + f.baseClass + @":OnTick()
    
end";

            krbTabControl1.SelectedTab = tp;
        }
Exemple #12
0
        //*************************************************************************************************************
        public void ConnectToServer(Server server)
        {
            TabPageEx tab = new TabPageEx(server.Name);

            tab.Tag = server;
            ServerTabs._tabCloseBtn = KRBTabControlNS.CustomTab.KRBTabControl.TabCloseImage.Normal;
            ServerTabs.TabPages.Add(tab);
            tab.ImageIndex     = (int)server.Type;
            tab.SomeUserObject = server;
            server.Open(tab);
            ServerTabs.SelectTab(ServerTabs.TabPages.Count - 1);
            FocusSelectedTab();
        }
 private void SetTheme(bool bUseThemes, string themeFile)
 {
     if (bUseThemes)
     {
         this.BackColor = Theme.GetThemeColor(themeFile, "Main", null, "BackColor");
         tableLayoutPanelUserHeader.UseSystemStyle   = false;
         tableLayoutPanelUserHeader.SelectedColor    = Theme.GetThemeColor(themeFile, "Main", "PresencePane", "BackColor");
         tableLayoutPanelUserHeader.ColorGradientMax = Theme.GetThemeValue(themeFile, "Main", "PresencePane", "GradientMax", typeof(float));
         tableLayoutPanelUserHeader.ColorGradientMin = Theme.GetThemeValue(themeFile, "Main", "PresencePane", "GradientMin", typeof(float));
         lblUserName.ForeColor         = Theme.GetThemeColor(themeFile, "Main", "PresencePane", "TextColor");
         lblUserStatus.ForeColor       = Theme.GetThemeColor(themeFile, "Main", "PresencePane", "TextColor");
         lblContactsHeader.BackColor   = Theme.GetThemeColor(themeFile, "Main", "PresencePane", "HeaderColor");
         lblContactsHeader.BorderColor = Theme.GetThemeColor(themeFile, "Main", "PresencePane", "HeaderColor");
         lblContactsHeader.ForeColor   = Theme.GetThemeColor(themeFile, "Main", "PresencePane", "HeaderTextColor");
         tabControlChat.UseSystemStyle = false;
         for (int index = 0; index < tabList.Count; index++)
         {
             TabPageEx tabPage = tabList[index];
             SetTabLook(tabPage);
         }
         tabControlChat.ColorGradientMax = Theme.GetThemeValue(themeFile, "Main", "ChatPane", "GradientMax", typeof(float));
         tabControlChat.ColorGradientMin = Theme.GetThemeValue(themeFile, "Main", "ChatPane", "GradientMin", typeof(float));
         tvUsers.UseSystemStyle          = false;
         tvUsers.BackColor        = Theme.GetThemeColor(themeFile, "Main", "ContactList", "BackColor");
         tvUsers.ForeColor        = Theme.GetThemeColor(themeFile, "Main", "ContactList", "TextColor");
         tvUsers.SelectedColor    = Theme.GetThemeColor(themeFile, "Main", "ContactList", "SelectedColor");
         tvUsers.HighlightColor   = Theme.GetThemeColor(themeFile, "Main", "ContactList", "HighlightColor");
         tvUsers.HeaderColor      = Theme.GetThemeColor(themeFile, "Main", "ContactList", "HeaderColor");
         tvUsers.ColorGradientMax = Theme.GetThemeValue(themeFile, "Main", "ContactList", "GradientMax", typeof(float));
         tvUsers.ColorGradientMin = Theme.GetThemeValue(themeFile, "Main", "ContactList", "GradientMin", typeof(float));
         tvUsers.ItemHeight       = 24;
     }
     else
     {
         this.BackColor = SystemColors.Control;
         tableLayoutPanelUserHeader.UseSystemStyle = true;
         label_SystemColorsChanged(lblUserName, null);
         label_SystemColorsChanged(lblUserStatus, null);
         lblContactsHeader.BackColor   = SystemColors.ActiveCaption;
         lblContactsHeader.BorderColor = SystemColors.ActiveCaption;
         lblContactsHeader.ForeColor   = SystemColors.ActiveCaptionText;
         tabControlChat.UseSystemStyle = true;
         tvUsers.UseSystemStyle        = true;
         tvUsers.BackColor             = SystemColors.Window;
         tvUsers.ForeColor             = SystemColors.WindowText;
         tvUsers.ItemHeight            = 22;
     }
     //  Cause form and child controls to redraw.
     this.Invalidate(true);
 }
        /// <summary>
        /// Creates a chat tab and adds it to the tab control based on the parameter value.
        /// </summary>
        /// <param name="key">Unique key of user.</param>
        /// <param name="text">Title of tab.</param>
        /// <param name="show">Whether to show tab or not.</param>
        /// <param name="retries">Number of retry.</param>
        /// <returns></returns>
        private TabPageEx CreateChatTab(string key, string text, bool show, int retries)
        {
            TabPageEx newTabPage = null;

            try {
                newTabPage             = new TabPageEx(text);
                newTabPage.Name        = key;
                newTabPage.ImageKey    = "Blank";
                newTabPage.ToolTipText = text;
                SetTabLook(newTabPage);

                //  Add tab page to the tab list.
                tabList.Add(newTabPage);
                //  Set correct status images.
                UpdateUserStatusImages(key);
                //  Set correct tab look.
                UpdateTabWindowStatusLook(key);

                if (show)
                {
                    //  Add tab page to tab control.
                    tabControlChat.TabPages.Add(newTabPage);
                    // Make the new tab the selected tab.
                    tabControlChat.SelectedTab = newTabPage;
                }

                return(newTabPage);
            }
            catch {
                if (newTabPage != null)
                {
                    if (tabList.Contains(newTabPage))
                    {
                        tabList.Remove(newTabPage);
                    }
                    newTabPage.Dispose();
                }
                //  If this is first attempt to create tab, try again.
                //  Else give up and return null.
                if (retries == 0)
                {
                    return(CreateChatTab(key, text, show, ++retries));
                }
                else
                {
                    return(null);
                }
            }
        }
Exemple #15
0
 /// <summary>
 /// Load chat settings and apply to all the Chat controls inside inside tab pages and chat windows.
 /// </summary>
 private void LoadChatSettings()
 {
     for (int index = 0; index < tabList.Count; index++)
     {
         TabPageEx   tabPage     = tabList[index];
         ChatControl chatControl = (ChatControl)tabPage.Controls["ChatControl"];
         LoadChatControlSettings(chatControl);
     }
     for (int index = 0; index < windowList.Count; index++)
     {
         ChatForm    chatForm    = windowList[index];
         ChatControl chatControl = (ChatControl)chatForm.Controls["ChatControl"];
         LoadChatControlSettings(chatControl);
     }
 }
Exemple #16
0
 private void UpdateChatSettings(string propertyName)
 {
     for (int index = 0; index < tabList.Count; index++)
     {
         TabPageEx   tabPage     = tabList[index];
         ChatControl chatControl = (ChatControl)tabPage.Controls["ChatControl"];
         UpdateChatControlSettings(chatControl, propertyName);
     }
     for (int index = 0; index < windowList.Count; index++)
     {
         ChatForm    chatForm    = windowList[index];
         ChatControl chatControl = (ChatControl)chatForm.Controls["ChatControl"];
         UpdateChatControlSettings(chatControl, propertyName);
     }
 }
        private void SetTabLook(TabPageEx tabPage)
        {
            string themeFile = Properties.Settings.Default.ThemeFile;

            tabPage.BackColor           = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "BackColor");
            tabPage.DefaultTabColor     = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "DefaultTabColor");
            tabPage.DefaultBorderColor  = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "DefaultBorderColor");
            tabPage.DefaultForeColor    = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "DefaultTextColor");
            tabPage.SelectedTabColor    = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "SelectedTabColor");
            tabPage.SelectedBorderColor = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "SelectedBorderColor");
            tabPage.SelectedForeColor   = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "SelectedTextColor");
            tabPage.DisabledTabColor    = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "DisabledTabColor");
            tabPage.DisabledBorderColor = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "DisabledBorderColor");
            tabPage.DisabledForeColor   = Theme.GetThemeColor(themeFile, "Main", "ChatPane", "DisabledTextColor");
            tabPage.Enabled             = tabPage.Enabled; //  To force correct repainting.
        }
Exemple #18
0
        //*************************************************************************************************************
        private void toolFullScreen_Click(object sender, EventArgs e)
        {
            TabPageEx tab = ((TabPageEx)ServerTabs.SelectedTab);

            if (tab == null)
            {
                return;
            }

            Server server = (Server)((TabPageEx)tab).SomeUserObject;

            if (server == null)
            {
                return;
            }

            server.FullScreen();
        }
Exemple #19
0
        private void SaveHistory()
        {
            //  Save history if that option is selected.
            if (Properties.Settings.Default.SaveHistory)
            {
                string path = AppInfo.LogPath;
                if (!System.IO.Directory.Exists(path))
                {
                    System.IO.Directory.CreateDirectory(path);
                }

                for (int index = 0; index < tabList.Count; index++)
                {
                    TabPageEx   tabPage     = tabList[index];
                    ChatControl chatControl = (ChatControl)tabPage.Controls["ChatControl"];
                    chatControl.SaveHistory(path);
                }
            }
        }
Exemple #20
0
 private void Initial()
 {
     this.InitializeComponent();
     base.MinimizeBox     = false;
     base.MaximizeBox     = false;
     base.FormBorderStyle = FormBorderStyle.FixedDialog;
     this.tbZp            = this.xmlComponentLoader1.GetControlByName <TabPageEx>("tbZp");
     this.tbHy            = this.xmlComponentLoader1.GetControlByName <TabPageEx>("tbHy");
     this.tbJdc           = this.xmlComponentLoader1.GetControlByName <TabPageEx>("tbJdc");
     this.lblZpT          = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblZpT");
     this.lblHyT          = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblHyT");
     this.lblJdcT         = this.xmlComponentLoader1.GetControlByName <AisinoLBL>("lblJdcT");
     this.pnlZpErr        = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("pnlZpErr");
     this.pnlHyErr        = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("pnlHyErr");
     this.pnlJdcErr       = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("pnlJdcErr");
     this.pnlZpInfo       = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("pnlZpInfo");
     this.pnlHyInfo       = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("pnlHyInfo");
     this.pnlJdcInfo      = this.xmlComponentLoader1.GetControlByName <AisinoPNL>("pnlJdcInfo");
     this.rtbZp           = this.xmlComponentLoader1.GetControlByName <AisinoRTX>("rtbZp");
     this.rtbHy           = this.xmlComponentLoader1.GetControlByName <AisinoRTX>("rtbHy");
     this.rtbJdc          = this.xmlComponentLoader1.GetControlByName <AisinoRTX>("rtbJdc");
     base.Load           += new EventHandler(this.PzxzForm_Load);
 }
        /// <summary>
        /// Adds a new tab page to the Tab Control and specifies the text and
        /// key for the tab. If tab already exists, bring it to top.
        /// </summary>
        /// <param name="text"></param>
        private void StartConversation(string key, string text, bool activated)
        {
            bool tabSelected = false;

            //  Check if tab with given key exists.
            if (tabControlChat.TabPages.ContainsKey(key))
            {
                //  Tab found, make it selected.
                TabPageEx selectedTabPage = (TabPageEx)tabControlChat.TabPages[key];
                tabControlChat.SelectedTab = selectedTabPage;
                tabSelected = true;
            }
            else if (tabList.ContainsKey(key))
            {
                TabPageEx tabPage = tabList[key];
                tabControlChat.TabPages.Add(tabPage);
                tabControlChat.SelectedTab = tabPage;
                tabSelected = true;
            }
            else if (windowList.ContainsKey(key))
            {
                if (activated)
                {
                    ChatForm chatForm = windowList[key];
                    chatForm.ShowWindow(true, true);
                }
            }
            else
            {
                TabPageEx   newTabPage     = null;
                ChatForm    newChatForm    = null;
                ChatControl newChatControl = null;
                try {
                    //  Create a Chat control and set its properties.
                    newChatControl               = new ChatControl();
                    newChatControl.Name          = "ChatControl";
                    newChatControl.Dock          = DockStyle.Fill;
                    newChatControl.LocalUserName = localUserName;
                    newChatControl.LocalAddress  = localAddress.ToString();

                    User remoteUser = GetUser(key);
                    newChatControl.Key                 = key;
                    newChatControl.RemoteUserName      = remoteUser.Name;
                    newChatControl.RemoteAddress       = remoteUser.Address;
                    newChatControl.MessageFont         = defaultFont;
                    newChatControl.MessageFontColor    = defaultFontColor;
                    newChatControl.HotKeyMod           = Properties.Settings.Default.MessageHotKeyMod;
                    newChatControl.MessageToForeground = bMessageToForeground;
                    newChatControl.SilentMode          = bSilentMode;
                    newChatControl.ShowEmoticons       = Properties.Settings.Default.ShowEmoticons;
                    newChatControl.EmotTextToImage     = Properties.Settings.Default.EmotTextToImage;
                    newChatControl.ShowTimeStamp       = Properties.Settings.Default.ShowTimeStamp;
                    newChatControl.AddDateToTimeStamp  = Properties.Settings.Default.AddDateToTimeStamp;
                    newChatControl.Windowed            = bChatWindowed;
                    newChatControl.Sending            += new ChatControl.SendEventHandler(ChatControl_Sending);
                    newChatControl.WindowModeChange   += new ChatControl.WindowModeChangeEventHandler(ChatControl_WindowModeChange);

                    if (Properties.Settings.Default.ChatWindowed == true)
                    {
                        newChatForm = CreateChatForm(key, text, activated);
                        newChatForm.Controls.Add(newChatControl);
                    }
                    else
                    {
                        //  Create a new tab page and add the chat control to it.
                        newTabPage = CreateChatTab(key, text);
                        newTabPage.Controls.Add(newChatControl);
                        tabSelected = true;
                    }
                    //  Display status message.
                    newChatControl.ReceiveMessage(MessageTypes.Status, string.Empty, remoteUser.Name, remoteUser.Status);
                    //  Display a message if remote user's version is older.
                    if (IsVersionOlder(remoteUser.Version, localClientVersion))
                    {
                        newChatControl.ReceiveMessage(MessageTypes.OldVersion, string.Empty, remoteUser.Name, string.Empty);
                    }
                }
                catch {
                    if (newChatControl != null)
                    {
                        newChatControl.Dispose();
                    }
                    if (newTabPage != null)
                    {
                        newTabPage.Dispose();
                    }
                    if (newChatForm != null)
                    {
                        newChatForm.Dispose();
                    }
                    return;
                }
            }
            tabControlChat.Visible = (tabControlChat.TabCount > 0);
            //  Set keyboard focus to the message box inside the chat control.
            //  This is to be done after tab control becomes visible, else focus will not work.
            if (tabSelected && tabControlChat.SelectedIndex >= 0)
            {
                TabPageEx   tabPage     = (TabPageEx)tabControlChat.SelectedTab;
                ChatControl chatControl = (ChatControl)tabPage.Controls["ChatControl"];
                chatControl.SetFocus();
            }
        }
        /// <summary>
        /// This method is called when the user changes tab option in the Options dialog.
        /// All the chat tabs and windows that are currently in the closed state are
        /// switched to the new mode. This is the behaviour a user would expect.
        /// </summary>
        private void SwitchWindowMode(bool value)
        {
            //  This is a rather expensive operation, no need to do it if value
            //  is the same as bChatWindowed.
            if (bChatWindowed == value)
            {
                return;
            }

            bChatWindowed = value;
            if (bChatWindowed)
            {
                List <TabPageEx> remList = new List <TabPageEx>();
                foreach (TabPageEx tabPage in tabList)
                {
                    if (!tabControlChat.TabPages.ContainsKey(tabPage.Name))
                    {
                        ChatControl chatControl = (ChatControl)tabPage.Controls["ChatControl"];
                        chatControl.Parent = null;
                        string   key         = chatControl.Key;
                        string   text        = tabPage.Text;
                        ChatForm newChatForm = CreateChatForm(key, text, false, false);
                        newChatForm.Enabled = chatControl.Enabled;
                        newChatForm.Controls.Add(chatControl);
                        chatControl.Windowed = true;
                        remList.Add(tabPage);
                    }
                }
                //  Remove all tabpages that were added to rem list from tab list.
                tabList.RemoveAll(new Predicate <TabPageEx>(delegate(TabPageEx item) {
                    return(remList.Contains(item));
                }));
                //  Dispose all the tab pages that were removed.
                foreach (TabPageEx tabPage in remList)
                {
                    tabPage.Dispose();
                }
            }
            else
            {
                List <ChatForm> remList = new List <ChatForm>();
                foreach (ChatForm chatForm in windowList)
                {
                    if (!chatForm.Visible)
                    {
                        ChatControl chatControl = (ChatControl)chatForm.Controls["ChatControl"];
                        chatControl.Parent = null;
                        string    key        = chatControl.Key;
                        string    text       = chatForm.Text;
                        TabPageEx newTabPage = CreateChatTab(key, text, false);
                        newTabPage.Enabled = chatControl.Enabled;
                        newTabPage.Controls.Add(chatControl);
                        chatControl.Windowed = false;
                        remList.Add(chatForm);
                    }
                }
                //  Remove all chat forms that were added to rem list from window list.
                windowList.RemoveAll(new Predicate <ChatForm>(delegate(ChatForm item) {
                    return(remList.Contains(item));
                }));
                //  Dispose all the chat windows that were removed.
                foreach (ChatForm chatForm in remList)
                {
                    chatForm.Dispose();
                }
            }
        }
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if ((keyData == (Keys.Tab | Keys.Control)) || (keyData == (Keys.Tab | Keys.Shift | Keys.Control)))
            {
                if (!OnNavigateTabPage((keyData & Keys.Shift) != Keys.Shift ? SelectedIndex + 1 : SelectedIndex - 1, true))
                {
                    msg.Result = new IntPtr(1);
                    return true;
                }
                return false;
            }
            switch (keyData)
            {
                // Selects Last TabPage
                case Keys.End:
                    if (!OnNavigateTabPage(TabCount - 1, false))
                    {
                        msg.Result = new IntPtr(1);
                        return true;
                    }
                    break;
                // Selects First TabPage
                case Keys.Home:
                    if (!OnNavigateTabPage(0, false))
                    {
                        msg.Result = new IntPtr(1);
                        return true;
                    }
                    break;
                // Selects the tab on the left side of the currently selected TabPage
                case Keys.Left:
                    if (!OnNavigateTabPage(SelectedIndex - 1, false))
                    {
                        msg.Result = new IntPtr(1);
                        return true;
                    }
                    break;
                // Selects the tab on the right side of the currently selected TabPage
                case Keys.Right:
                    if (!OnNavigateTabPage(SelectedIndex + 1, false))
                    {
                        msg.Result = new IntPtr(1);
                        return true;
                    }
                    break;

                case Keys.Insert:
                    if (_conditionBooleanArray[3] && MessageBox.Show("Do you want to insert a new tab page here?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        var tabPage = new TabPageEx();
                        Controls.Add(tabPage);
                        return true;
                    }
                    break;

                case Keys.Delete:
                    if (_conditionBooleanArray[3] && TabCount > 0)
                    {
                        if (MessageBox.Show("Do you want to remove the selected tab page?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            var removingTabPage = SelectedTab as TabPageEx;
                            if (removingTabPage != null && removingTabPage.IsClosable && removingTabPage.Enabled)
                            {
                                using (var e = new SelectedIndexChangingEventArgs(removingTabPage, SelectedIndex))
                                {
                                    // Fire a Notification Event.
                                    OnTabPageClosing(e);

                                    if (!e.Cancel)
                                    {
                                        TabPages.Remove(removingTabPage);
                                        SelectNextAvailableTabPage();
                                        return true;
                                    }
                                    MessageBox.Show("The operation was canceled by the user.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    return true;
                                }
                            }
                            MessageBox.Show("The selected tab page could not be deleted!!!, it may be due to the following reasons;\r\n\r\n1.Tab page might be null or disposed by the application.\r\n2.Tab page might not be closable.\r\n3.Tab page might be disable.",
                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return true;
                        }
                    }
                    break;

                case Keys.Escape:
                    break;

                case Keys.F1:
                    break;
            }
            return false;
        }
 public int IndexOf(TabPageEx TabPage)
 {
     return this.List.IndexOf(TabPage);
 }
 public SelectedIndexChangingEventArgs(TabPageEx tabPage, int tabPageIndex)
 {
     this.tabPage      = tabPage;
     this.tabPageIndex = tabPageIndex;
 }
Exemple #26
0
 //**********************************************************************************************
 public override void Open(TabPageEx tab)
 {
     form        = new IEForm(this);
     form.Parent = tab;
     form.Show();
 }
        private void OpenExternalProcessTab(ExternalProcessTab panel, bool unique = false, bool autoStart = true)
        {
            if (unique)
            {
                foreach (TabPage page in this.TabControl.TabPages)
                {
                    IEnumerable<ExternalProcessTab> processControls = page.Controls.Cast<Control>().Where(x => x is ExternalProcessTab).Cast<ExternalProcessTab>();

                    if (processControls.Any() && processControls.First().TaskName.IEquals(panel.TaskName))
                    {
                        this.TabControl.SelectTab(page);
                    }
                }
            }

            TabPageEx tab = new TabPageEx()
            {
                Text = panel.TaskName,
                Controls =
                {
                    panel,
                }
            };
            this.AddTabPage(tab);

            if (autoStart)
            {
                panel.StartProcess();
            }
        }
        public void OpenReadTaskTab()
        {
            foreach (TabPageEx page in this.TabControl.TabPages)
            {
                var controls = page.Controls.Cast<Control>().Where(c => c is ReadTaskTab);

                if (controls.Count() == 1)
                {
                    this.TabControl.SelectTab(page);
                    return;
                }
            }

            ReadTaskTab readTab = new ReadTaskTab()
            {
                Owner = this,
                Context = this.Context,
                Dock = DockStyle.Fill,
            };

            readTab.RefreshData();

            TabPageEx tab = new TabPageEx()
            {
                Text = "Read Task",
                Controls =
                {
                    readTab
                }
            };

            this.AddTabPage(tab);
        }
 public SelectedIndexChangingEventArgs(TabPageEx tabPage, int tabPageIndex)
 {
     this.tabPage = tabPage;
     this.tabPageIndex = tabPageIndex;
 }
 public void Remove(TabPageEx TabPage)
 {
     if (this.List.Contains(TabPage))
         this.List.Remove(TabPage);
 }
Exemple #31
0
        //-------------------------------------------------------------------------------
        /// <summary>
        /// <para>タブとその内部の作成と設定を行います。</para>
        /// <para>SettingsDataへの辞書項目追加を行ってからこのメソッドを行えばタブ作成が完了します。</para>
        /// </summary>
        /// <param name="tabdata"></param>
        /// <param name="selectTab">タブを選択するか</param>
        private void MakeTab(TabData tabdata, bool selectTab)
        {
            TabPageEx newtabpg = new TabPageEx(tabdata.TabName) {
                Tag = tabdata.TabName
            };
            UctlDispTwit newDispTwit = new UctlDispTwit() {
                AutoScroll = true,
                BorderStyle = BorderStyle.FixedSingle,
                Dock = DockStyle.Fill,
                Tag = tabdata.TabName
            };
            newtabpg.Controls.Add(newDispTwit);
            tabTwitDisp.TabPages.Add(newtabpg);

            lock (SettingsData.TabDataDic) { newtabpg.ToolTipText = TabDataToString(SettingsData.TabDataDic[(string)newtabpg.Tag]); }

            ConfigTabAndUserDispControl(newtabpg, newDispTwit);

            if (selectTab) { tabTwitDisp.SelectedTab = newtabpg; }
        }
Exemple #32
0
        private void newPage()
        {
            TabPageEx tp = new TabPageEx();
            tp.Text = "new file";

            tp.ImageIndex = 0;
            krbTabControl1.TabPages.Add(tp);
            FastColoredTextBox tb = new FastColoredTextBox();
            tb.Language = FastColoredTextBoxNS.Language.Lua;
            tb.AutoIndentChars = false;
            tb.Parent = tp;
            tb.ShowFoldingLines = true;
            tb.ContextMenuStrip = contextMenuStrip1;
            this.autocompleteMenu1.SetAutocompleteMenu(tb, this.autocompleteMenu1);
            tb.TextChanged += new System.EventHandler<TextChangedEventArgs>(this.fastColoredTextBox1_TextChanged);
            tb.SelectionChanged += new System.EventHandler(this.fastColoredTextBox1_SelectionChanged);
            tb.Dock = DockStyle.Fill;
            tb.CurrentLineColor = Color.FromArgb(199, 220, 83);

            tb.ReadOnly = false;

            krbTabControl1.SelectedTab = tp;
        }
Exemple #33
0
        private void newFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Files f = new Files();

            using (NewProject form2 = new NewProject())
            {
                form2.StartPosition = FormStartPosition.CenterParent;
                form2.ShowDialog();
                f.name = form2.textbox1value;
                f.baseClass = form2.textbox2value;
                f.path = form2.textbox3value;

            }

            TabPageEx tp = new TabPageEx();
            tp.Text = f.name;

            tp.ImageIndex = 0;
            krbTabControl1.TabPages.Add(tp);
            FastColoredTextBox tb = new FastColoredTextBox();
            tb.Language = FastColoredTextBoxNS.Language.Lua;
            tb.AutoIndentChars = false;
            tb.Parent = tp;
            tb.ShowFoldingLines = true;
            tb.ContextMenuStrip = contextMenuStrip1;
            this.autocompleteMenu1.SetAutocompleteMenu(tb, this.autocompleteMenu1);
            tb.TextChanged += new System.EventHandler<TextChangedEventArgs>(this.fastColoredTextBox1_TextChanged);
            tb.SelectionChanged += new System.EventHandler(this.fastColoredTextBox1_SelectionChanged);
            tb.Dock = DockStyle.Fill;
            tb.CurrentLineColor = Color.FromArgb(199,220,83);

            tb.ReadOnly = false;
            tb.Text =
            @"function OnLoad()
            " + f.baseClass + @"()
            end

            class """ + f.baseClass + @"""
            function " + f.baseClass + @":__init()
            AddDrawCallback(function() self:OnDraw() end)
            AddTickCallback(function() self:OnTick() end)
            end

            function " + f.baseClass + @":OnDraw()

            end

            function " + f.baseClass + @":OnTick()

            end";

            krbTabControl1.SelectedTab = tp;
        }
        public void OpenProcessDonationsTaskTab2()
        {
            foreach (TabPageEx page in this.TabControl.TabPages)
            {
                var controls = page.Controls.Cast<Control>().Where(c => c is ProcessDonationsTaskTab2);

                if (controls.Count() == 1)
                {
                    this.TabControl.SelectTab(page);
                    return;
                }
            }

            ProcessDonationsTaskTab2 processTab = new ProcessDonationsTaskTab2()
            {
                Dock = DockStyle.Fill,
            };

            processTab.Initialize(this, this.Context);

            processTab.RefreshData();

            TabPageEx tab = new TabPageEx()
            {
                Text = "Donations Task MK 2",
                Controls =
                {
                    processTab
                }
            };
            this.AddTabPage(tab);
        }
Exemple #35
0
        public MainForm()
        {
            InitializeComponent();
            #region 譜面パネルの初期化
            tabScore.TabPages.Clear();
            tabScore.Font      = new Font("Yu Gothic UI", 9);
            tabNoteButton.Font = tabScore.Font;
            for (int i = 0; i < tabPageCount; ++i)
            {
                TabPageEx tabPageEx = new TabPageEx("NewScore" + (i + 1));
                tabScore.TabPages.Add(tabPageEx);
                // PictureBoxの追加と初期化
                PictureBox pBox = new PictureBox
                {
                    Size = tabScore.TabPages[i].Size
                };
                // TabPageに初期化したPictureBoxを入れる
                tabScore.TabPages[i].Controls.Add(pBox);
                // ScrollBarの追加と初期化
                HScrollBar hScroll = new HScrollBar
                {
                    Size    = new Size(pBox.Width, 17),
                    Value   = 0,
                    Minimum = 0,
                    Dock    = DockStyle.Bottom
                };
                VScrollBar vScroll = new VScrollBar
                {
                    Size    = new Size(17, pBox.Height),
                    Value   = 0,
                    Minimum = 0,
                    Maximum = 0,
                    Dock    = DockStyle.Right,
                    Visible = false
                };
                // HScrollBarをPictureBoxに入れる
                pBox.Controls.Add(hScroll);
                pBox.Controls.Add(vScroll);
                // 初期化したPictureBoxとHScrollBarを使用してScorePanelを追加
                ScorePanel sPanel = new ScorePanel(pBox, hScroll, vScroll);
                sPanel.OperationManager.StatusChanged += (undo, redo) =>
                {
                    tsbUndo.Enabled = tsmiUndo.Enabled = undo;
                    tsbRedo.Enabled = tsmiRedo.Enabled = redo;
                };
                sPanel.OperationManager.Edited += () =>
                {
                    UpdateTextOfTabAndForm(true);
                    sPanel.IsEdited = true;
                };
                Status.CopyChanged  += (b) => tsbCopy.Enabled = tsbCut.Enabled = b;
                Status.PasteChanged += (b) => tsbPaste.Enabled = b;
                tsbCut.Enabled       = tsbCopy.Enabled = tsbPaste.Enabled = false;
                sPanel.SetScore(4, 4, 200);
                tabPageEx.ScorePanel = sPanel;
                // PictureBoxとHScrollBarの各種デリゲートの設定
                pBox.MouseWheel       += Score_MouseWheel;
                pBox.Paint            += Score_Paint;
                pBox.MouseClick       += Score_MouseClick;
                pBox.MouseDoubleClick += Score_MouseDoubleClick;
                pBox.MouseEnter       += Score_MouseEnter;
                pBox.MouseDown        += Score_MouseDown;
                pBox.MouseMove        += Score_MouseMove;
                pBox.MouseUp          += Score_MouseUp;
                hScroll.Scroll        += Score_Scroll;
                vScroll.Scroll        += Score_Scroll;
            }
            #endregion
            InitializeToolStrip();
            #region ノーツボタン追加
            NoteButtonManager noteButtonManager = new NoteButtonManager();
            noteButtonManager.ButtonClicked += (s, e) => SetMode(Mode.Add);
            flpNotePanel.Size     = tabNoteButton.TabPages[0].Size;
            flpNotePanel.Location = new Point();
            foreach (NoteButton noteButton in noteButtonManager)
            {
                flpNotePanel.Controls.Add(noteButton);
            }
            #endregion
            #region 各種ボタンに対するイベント紐づけ
            tabScore.SelectedIndexChanged += (s, e) =>
            {
                Text  = tabScore.SelectedTab.Text;
                Text += " - M4ple Editor";
                ScorePanel selectedPanel = (tabScore.SelectedTab as TabPageEx).ScorePanel;
                selectedPanel.OperationManager.OnStatusChanged();
            };
            #region ToolStripButton
            tsbAdd.Click                  += (s, e) => SetMode(Mode.Add);
            tsbEdit.Click                 += (s, e) => SetMode(Mode.Edit);
            tsbDelete.Click               += (s, e) => SetMode(Mode.Delete);
            tsbInvisibleSlideTap.Click    += TbsInvisibleSlideTap_Click;
            tscbBeat.SelectedIndexChanged += (s, e) => { Status.Beat = int.Parse(tscbBeat.Text); };
            tscbGrid.SelectedIndexChanged += (s, e) => { Status.Grid = int.Parse(tscbGrid.Text); };
            tsbNew.Click                  += New_Click;
            tsbOpen.Click                 += Open_Click;
            tsbSave.Click                 += Save_Click;
            tsbImport.Click               += Import_Click;
            tsbExport.Click               += (s, e) =>
            {
                ScorePanel selectedPanel = (tabScore.SelectedTab as TabPageEx).ScorePanel;
                selectedPanel.Export();
            };
            tsbCopy.Click    += Copy_Click;
            tsbCut.Click     += Cut_Click;
            tsbPaste.Click   += Paste_Click;
            tsbUndo.Click    += Undo_Click;
            tsbRedo.Click    += Redo_Click;
            tsbUndo.Enabled   = tsbRedo.Enabled = false;
            tsbZoomIn.Click  += ZoomIn_Click;
            tsbZoomOut.Click += ZoomOut_Click;
            #endregion
            #region ToolStripMenuItem(表示)
            tsmiIsShortNote.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsShortNoteVisible = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            tsmiIsHold.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsHoldVisible = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            tsmiIsSlide.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsSlideVisible = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            tsmiIsSlideRelay.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsSlideRelayVisible = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            tsmiIsSlideCurve.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsSlideCurveVisible = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            tsmiIsAirHold.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsAirHoldVisible = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            tsmiIsAir.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsAirVisible = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            tsmiIsExTapDistinct.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsExTapDistinct = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            tsmiIsEconomyMode.Click += (s, e) =>
            {
                ToolStripMenuItem menuItem = (ToolStripMenuItem)s;
                Status.IsEconomyMode = menuItem.Checked = !menuItem.Checked;
                Refresh();
            };
            #endregion
            #region ToolStlipMenuItem(ファイル)
            tsmiNew.Click    += New_Click;
            tsmiOpen.Click   += Open_Click;
            tsmiSave.Click   += Save_Click;
            tsmiSaveAs.Click += (s, e) =>
            {
                ScorePanel selectedPanel = (tabScore.SelectedTab as TabPageEx).ScorePanel;
                bool       isSaved       = selectedPanel.SaveAs();
                UpdateTextOfTabAndForm(!isSaved);
            };
            tsmiImport.Click += Import_Click;
            tsmiExport.Click += (s, e) =>
            {
                ScorePanel selectedPanel = (tabScore.SelectedTab as TabPageEx).ScorePanel;
                selectedPanel.ExportAs();
            };
            tsmiQuit.Click += (s, e) =>
            {
                Close();
            };
            FormClosing += (s, e) =>
            {
                e.Cancel = !IsExit();
                Properties.Settings.Default.Save();
            };
            #endregion
            #region ToolStripMenuItem(編集)
            tsmiUndo.Click         += Undo_Click;
            tsmiRedo.Click         += Redo_Click;
            tsmiUndo.Enabled        = tsmiRedo.Enabled = false;
            tsmiCopy.Click         += Copy_Click;
            tsmiCut.Click          += Cut_Click;
            tsmiPaste.Click        += Paste_Click;
            tsmiPasteReverse.Click += (s, e) =>
            {
                ScorePanel selectedPanel = (tabScore.SelectedTab as TabPageEx).ScorePanel;
                selectedPanel.PasteNotes();
                selectedPanel.ReverseNotes();
                Refresh();
            };
            tsmiDelete.Click += (s, e) =>
            {
                ScorePanel selectedPanel = (tabScore.SelectedTab as TabPageEx).ScorePanel;
                selectedPanel.ClearAreaNotes();
                Refresh();
            };
            tsmiReverse.Click += (s, e) =>
            {
                ScorePanel selectedPanel = (tabScore.SelectedTab as TabPageEx).ScorePanel;
                selectedPanel.ReverseNotes();
                Refresh();
            };
            #endregion
            #region ToolStripMenuItem(ウィンドウ)
            tsmiSizeSmall.Click    += (s, e) => SetPanelSize(PanelSize.Small);
            tsmiSizeMiddle.Click   += (s, e) => SetPanelSize(PanelSize.Middle);
            tsmiSizeBig.Click      += (s, e) => SetPanelSize(PanelSize.Big);
            tsmiScaleHalf.Click    += (s, e) => SetScoreScale(ScoreScale.Half);
            tsmiScaleDefault.Click += (s, e) => SetScoreScale(ScoreScale.Default);
            tsmiScaleDouble.Click  += (s, e) => SetScoreScale(ScoreScale.Double);
            tsmiScaleQuad.Click    += (s, e) => SetScoreScale(ScoreScale.Quad);
            #endregion
            #region ToolStripMenuItem(ヘルプ)
            tsmiShowHelp.Click += (s, e) =>
            {
                System.Diagnostics.Process.Start("https://github.com/TinyTany/M4ple/wiki");
            };
            tsmiVersion.Click += (s, e) =>
            {
                new VersionInfoForm().ShowDialog();
            };
            #endregion
            #endregion
            #region ショートカットキー
            KeyDown += (s, e) =>
            {
                if (ModifierKeys == Keys.Alt)
                {
                    return;
                }
                switch (e.KeyCode)
                {
                case Keys.A:
                    tsbAdd.PerformClick();
                    break;

                case Keys.E:
                    tsbEdit.PerformClick();
                    break;

                case Keys.D:
                    tsbDelete.PerformClick();
                    break;

                case Keys.S:
                    tsbInvisibleSlideTap.PerformClick();
                    break;

                case Keys.B:
                    if (ModifierKeys == Keys.Shift)
                    {
                        tscbBeat.SelectedIndex =
                            tscbBeat.SelectedIndex == 0 ? tscbBeat.Items.Count - 1 : --tscbBeat.SelectedIndex;
                    }
                    else
                    {
                        tscbBeat.SelectedIndex = (tscbBeat.SelectedIndex + 1) % tscbBeat.Items.Count;
                    }
                    break;

                case Keys.G:
                    if (ModifierKeys == Keys.Shift)
                    {
                        tscbGrid.SelectedIndex =
                            tscbGrid.SelectedIndex == 0 ? tscbGrid.Items.Count - 1 : --tscbGrid.SelectedIndex;
                    }
                    else
                    {
                        tscbGrid.SelectedIndex = (tscbGrid.SelectedIndex + 1) % tscbGrid.Items.Count;
                    }
                    break;

                case Keys.OemPeriod:
                    noteButtonManager.SelectedButtonIncrease();
                    break;

                case Keys.Oemcomma:
                    noteButtonManager.SelectedButtonDecrease();
                    break;
                }
            };
            #endregion
            Resize += (s, e) =>
            {
                // HACK: 16と42はマジックナンバー的なもの(なぜかこの値で調整しないと大きさが合わない)
                tabScore.Size = new Size(
                    Width - tabScore.Location.X - tabScore.Margin.Right - 16,
                    Height - tabScore.Location.Y - tabScore.Margin.Bottom - 42);
                foreach (TabPageEx tabPageEx in tabScore.TabPages)
                {
                    tabPageEx.ScorePanel.ReSizePanel(tabScore.SelectedTab.Size);
                }
                tabNoteButton.Height = tabScore.Height;
                flpNotePanel.Height  = tabNoteButton.TabPages[0].Height;
            };

            #region tscbBeatの初期化
            beatItemList = new List <ToolStripValueItem>()
            {
                new ToolStripValueItem(4),
                new ToolStripValueItem(8),
                new ToolStripValueItem(12),
                new ToolStripValueItem(16),
                new ToolStripValueItem(24),
                new ToolStripValueItem(32),
                new ToolStripValueItem(48),
                new ToolStripValueItem(64),
                new ToolStripValueItem(96),
                new ToolStripValueItem(128),
                new ToolStripValueItem(192),
                new ToolStripValueItem(256),
                new ToolStripValueItem(384),
                new ToolStripValueItem(512),
                new ToolStripValueItem(768),
            };

            tscbBeat.Items.Clear();
            beatItemList.ForEach(x => tscbBeat.Items.Add(x));
            // NOTE: StatusでのBeatの初期値が16なのでそれに対応したインデックスにしておく
            var index = beatItemList.FindIndex(x => x.Value == Status.Beat);
            System.Diagnostics.Debug.Assert(index >= 0, "tscbBeatの初期インデックスが正しく設定されていません");
            tscbBeat.SelectedIndex = index;
            #endregion

            SetPanelSize(PanelSize.Big);
            SetScoreScale(ScoreScale.Default);
        }
        public void OpenSearchTab(string model)
        {
            if (!this.IsSearchable(model))
            {
                string message = "Error, cannot open search for " + model + ", no search page for it exists.";
                this.SetStatusMessage(message);
                MessageBox.Show(message);
                return;
            }

            SearchPanel panel = SearchPanelHelpers.CreatePanelForModel(model);

            TabPageEx tab = new TabPageEx()
            {
                Text = model + " Search",
                Controls =
                {
                    new SearchTab(panel)
                    {
                        TrackerContext = this.Context,
                        Owner = this,
                        Dock = DockStyle.Fill,
                    }
                }
            };
            this.AddTabPage(tab);
        }
Exemple #37
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.userControl11 = new MyControlLibrary.TabCtlEx();
            this.tabPage2 = new MyControlLibrary.TabPageEx(this.components);
            this.tabPage3 = new MyControlLibrary.TabPageEx(this.components);
            this.tabPage4 = new MyControlLibrary.TabPageEx(this.components);
            this.tabPage1 = new MyControlLibrary.TabPageEx(this.components);
            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenu();
            this.closeToolStripMenuItem = new System.Windows.Forms.MenuItem();
            this.closeAllButThisToolStripMenuItem = new System.Windows.Forms.MenuItem();
            this.closeTabToolStripMenuItem = new System.Windows.Forms.MenuItem();
            this.userControl11.SuspendLayout();

            this.SuspendLayout();
            //
            // userControl11
            //
            this.userControl11.ConfirmOnClose = true;
            this.userControl11.Controls.Add(this.tabPage2);
            this.userControl11.Controls.Add(this.tabPage3);
            this.userControl11.Controls.Add(this.tabPage4);
            this.userControl11.Controls.Add(this.tabPage1);
            this.userControl11.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
            this.userControl11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.userControl11.ItemSize = new System.Drawing.Size(330, 24);
            this.userControl11.Location = new System.Drawing.Point(8, 40);
            this.userControl11.Name = "userControl11";
            this.userControl11.SelectedIndex = 0;
            this.userControl11.Size = new System.Drawing.Size(824, 320);
            this.userControl11.TabIndex = 0;
            this.userControl11.TabStop = false;
            this.userControl11.OnClose += new MyControlLibrary.TabCtlEx.OnHeaderCloseDelegate(this.userControl11_OnClose);
            //
            // tabPage2
            //
            this.tabPage2.Location = new System.Drawing.Point(4, 28);
            this.tabPage2.Menu = null;
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Size = new System.Drawing.Size(816, 288);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "tabPage2";
            this.tabPage2.Menu = contextMenuStrip1;
            //
            // tabPage3
            //
            this.tabPage3.Location = new System.Drawing.Point(4, 28);
            this.tabPage3.Menu = null;
            this.tabPage3.Name = "tabPage3";
            this.tabPage3.Size = new System.Drawing.Size(816, 288);
            this.tabPage3.TabIndex = 2;
            this.tabPage3.Text = "tabPage3";
            //this.tabPage3.Menu = contextMenuStrip1;
            //
            // tabPage4
            //
            this.tabPage4.Location = new System.Drawing.Point(4, 28);
            this.tabPage4.Menu = null;
            this.tabPage4.Name = "tabPage4";
            this.tabPage4.Size = new System.Drawing.Size(816, 288);
            this.tabPage4.TabIndex = 3;
            this.tabPage4.Text = "tabPage4";
            this.tabPage4.Menu = contextMenuStrip1;
            //
            // tabPage1
            //
            this.tabPage1.Location = new System.Drawing.Point(4, 28);

            this.tabPage1.Menu = null;
            this.tabPage1.Name = "tabPage1";

            this.tabPage1.Size = new System.Drawing.Size(816, 288);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "tabPage1";

            this.tabPage1.Menu = contextMenuStrip1;
            //
            // contextMenuStrip1
            //
            this.contextMenuStrip1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                              this.closeToolStripMenuItem,
                                                                                              this.closeAllButThisToolStripMenuItem,
                                                                                              this.closeTabToolStripMenuItem});

            //
            // closeToolStripMenuItem
            //

            this.closeToolStripMenuItem.Text = "New Tab";
            this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
            //
            // closeAllButThisToolStripMenuItem
            //

            this.closeAllButThisToolStripMenuItem.Text = "Close all other tabs";
            //
            // closeTabToolStripMenuItem
            //

            this.closeTabToolStripMenuItem.Text = "Close tab";
            //
            // Form1
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(856, 382);
            this.Controls.Add(this.userControl11);
            this.Name = "Form1";
            this.Text = "Tab Control Demo";
            this.userControl11.ResumeLayout(false);

            this.ResumeLayout(false);
        }
        public void NavigateTo(string model, int? id)
        {
            if (!this.IsNavigable(model))
            {
                string message = "Error, cannot navigate to " + model + ", no edit page for it exists.";
                this.SetStatusMessage(message);
                MessageBox.Show(message);
                return;
            }

            TabPageEx alreadyExists = null;

            if (id != null)
                alreadyExists = this.FindTabOf(model, id ?? 0);

            // if a tab to the specified entity exists already, simply select that tab rather than create a new one
            if (alreadyExists != null)
            {
                this.TabControl.SelectedTab = alreadyExists;
            }
            else
            {
                EntityTab content = EntityTabHelpers.CreateEntityTab(model, this, this.Context);
                content.Dock = DockStyle.Fill;
                TabPageEx tab = new TabPageEx()
                {
                    Controls =
                    {
                        content,
                    }
                };
                this.AddTabPage(tab);
                content.SetInstanceId(id);
            }
        }
        public void HideTab(TabPageEx TabPage)
        {
            if (_tabPageExPool == null)
                _tabPageExPool = new TabPageExPool();

            if (!TabPages.Contains(TabPage)) return;
            _tabPageExPool.Add(TabPage);
            TabPages.Remove(TabPage);
            SelectNextAvailableTabPage();
        }
 public void Remove(TabPageEx TabPage)
 {
     if (List.Contains(TabPage))
         List.Remove(TabPage);
 }
 public void ShowTab(TabPageEx TabPage)
 {
     if (_tabPageExPool != null)
     {
         if (_tabPageExPool.Contains(TabPage))
         {
             TabPages.Add(TabPage);
             _tabPageExPool.Remove(TabPage);
         }
     }
 }
Exemple #42
0
 //**********************************************************************************************
 // Virtuals, usually empty
 public virtual void Open(TabPageEx tab)
 {
     throw new Exception("'Open' not implementd");
 }
Exemple #43
0
 //-------------------------------------------------------------------------------
 /// <summary>
 /// タブと表示コントロールの設定を行います。SettingsData設定後に行ってください。
 /// </summary>
 /// <param name="tabpage"></param>
 /// <param name="uctlDisp"></param>
 private void ConfigTabAndUserDispControl(TabPageEx tabpage, UctlDispTwit uctlDisp)
 {
     uctlDisp.ImageListWrapper = imageListWrapper;
     uctlDisp.CheckIncludeFollowerFunc = CheckIncludeFollowerIDs;
     _dispTwitDic.Add(tabpage, uctlDisp);
     RegisterUctlDispTwitEvent(uctlDisp);
     SetAutoRenewData(uctlDisp);
 }