public bool ProcessMessage(IntPtr hwnd, UInt32 message, UInt32 wParam, UInt32 lParam, UInt32 time, Int32 xPos, Int32 yPos) { const int WM_KEYDOWN = 0x0100; const int WM_SYSKEYDOWN = 0x0104; switch (message) { case WM_KEYDOWN: case WM_SYSKEYDOWN: if (CurrentWorksheet.IsEditing && (wParam == (UInt32)Keys.Escape)) { CurrentWorksheet.EndEdit(EndEditReason.Cancel); return(true); } else if (!CurrentWorksheet.IsEditing && (wParam == (UInt32)Keys.F2)) { CurrentWorksheet.StartEdit(); return(true); } // else return(CommandHandling.ProcessMenuShortcut(wParam, MenuBar.Items)); } return(false); }
private void InitialiseFeatures() { // Hide unwanted menubar options CommandHandling.RemoveCommand("scriptToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("toolsToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("printPreviewToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("printSettingsToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("printToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("exitToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("componentsToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("visibleToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("newWindowToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("exportAsHtmlToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("editXMLToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("exportAsCSVToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("saveToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("focusCellStyleToolStripMenuItem", this.MenuBar.Items); CommandHandling.RemoveCommand("selectionToolStripMenuItem", this.MenuBar.Items); //CommandHandling.RemoveCommand("", this.MenuBar.Items); // Hide unwanted toolbar options CommandHandling.RemoveCommand("printPreviewToolStripButton", this.ToolBar.Items); CommandHandling.RemoveCommand("saveToolStripButton", this.ToolBar.Items); CommandHandling.RemoveCommand("showDebugFormToolStripButton", this.ToolBar.Items); CommandHandling.RemoveCommand("slashLeftSolidToolStripButton", this.ToolBar.Items); CommandHandling.RemoveCommand("slashRightSolidToolStripButton", this.ToolBar.Items); CommandHandling.RemoveCommand("zoomToolStripDropDownButton", this.FontBar.Items); //CommandHandling.RemoveCommand("", this.ToolBar.Items); }
public bool ProcessMessage(IntPtr hwnd, UInt32 message, UInt32 wParam, UInt32 lParam, UInt32 time, Int32 xPos, Int32 yPos) { // Handle keyboard shortcuts if ((message == 0x0100) || (message == 0x0104) && (Control.ModifierKeys != Keys.None)) { Keys keyPress = (Keys)wParam; if (keyPress == Keys.ControlKey) { return(false); } var modifiers = Control.ModifierKeys; if ((modifiers & Keys.Control) == Keys.Control) { keyPress |= Keys.Control; } if ((modifiers & Keys.Shift) == Keys.Shift) { keyPress |= Keys.Shift; } if ((modifiers & Keys.Alt) == Keys.Alt) { keyPress |= Keys.Alt; } return(CommandHandling.ProcessMenuShortcut(keyPress, ContextMenu.Items)); } return(false); }
protected override void OnSelectionChange() { base.OnSelectionChange(); if (m_ToolStripAttributeLevelMenu != null) { // Enable 'attribute level' if placeholder is selected var selText = GetTextRange(); string placeholderText; int level; if (HtmlReportUtils.ParsePlaceholder(selText, out placeholderText, out level) && !placeholderText.Equals("indent")) { m_ToolStripAttributeLevelMenu.Enabled = true; CommandHandling.ClearChecked(m_ToolStripAttributeLevelMenu.DropDownItems); ToolStripItem item = m_ToolStripAttributeLevelMenu.DropDownItems[level.ToString()]; if (item != null && item is ToolStripMenuItem) (item as ToolStripMenuItem).Checked = true; } else { m_ToolStripAttributeLevelMenu.Enabled = false; } } }
public static void HandleChat(Character chr, Packet packet) { string what = packet.ReadString(); if (chr.IsGM == false && CheatInspector.CheckTextSpam(what)) { log.Error("Disconnecting player for chat spam"); chr.Player.Socket.Disconnect(); return; } if (//!MainCommandHandler.HandleCommand(chr, new CommandHandling.CommandArgs(what)) && !CommandHandling.HandleChat(chr, what)) { if (ShowMuteMessage(chr)) { log.Info("[MUTED] " + chr.Name + ": " + what); return; } log.Info(chr.Name + ": " + what); if (chr.Field.ChatEnabled) { MapPacket.SendChatMessage(chr, what); } } else { commandLog.Info(chr.Name + ": " + what); } }
public bool ProcessMessage(IntPtr hwnd, UInt32 message, UInt32 wParam, UInt32 lParam, UInt32 time, Int32 xPos, Int32 yPos) { switch (message) { case WM_KEYDOWN: case WM_SYSKEYDOWN: { Keys keyPress = CommandHandling.GetMenuShortcutFromVirtualKey(wParam); if (keyPress == Keys.Return) { // Handle <enter> manually because the default handling // appears to fail when we are hosted in a win32 modal dialog IntPtr hwndFind = FindWindowEx(WebBrowser.Handle, IntPtr.Zero, "Shell Embedding", ""); hwndFind = FindWindowEx(hwndFind, IntPtr.Zero, "Shell DocObject View", ""); hwndFind = FindWindowEx(hwndFind, IntPtr.Zero, "Internet Explorer_Server", ""); if (hwndFind != null) { SendMessage(hwndFind, WM_CHAR, VK_RETURN, 0); } return(true); } else if (keyPress != Keys.None) { return(base.OnDocumentKeyPress(keyPress)); } } break; } return(false); }
override protected void InitialiseFeatures() { base.InitialiseFeatures(); CommandHandling.HideCommand("toolstripListOrdered", ToolBar.Items); CommandHandling.HideCommand("toolstripListUnordered", ToolBar.Items); CommandHandling.HideCommand("toolstripInsertTable", ToolBar.Items); }
private void InitialiseFeatures() { // remove whole 'Document' submenu base.InitialiseFeatures(true); // Don't need the Enable Edit because we implement Ctrl+Click CommandHandling.RemoveCommand("toolstripEnableEditing", ToolBar.Items); }
private void InitialiseFeatures() { // remove whole 'Document' submenu CommandHandling.HideCommand("contextDocument", ContextMenu.Items); CommandHandling.HideCommand("contextDocumentPrint", ContextMenu.Items); CommandHandling.HideCommand("toolstripDocumentPrint", ToolBar.Items); // // CommandHandling.SetMenuShortcut("contextFormatStrikeout", Keys.Control | Keys.Subtract, ContextMenu.Items); // CommandHandling.SetMenuShortcut("contextFormatIncrease", Keys.Control | Keys.Decimal, ContextMenu.Items); // CommandHandling.SetMenuShortcut("contextFormatDecrease", Keys.Control | Keys.Oemcomma, ContextMenu.Items); // TODO }
virtual protected void InitialiseFeatures() { // remove whole 'Document' submenu base.InitialiseFeatures(true); // extras CommandHandling.HideCommand("contextInsertLink", ContextMenu.Items); CommandHandling.HideCommand("toolstripEnableEditing", ToolBar.Items); CommandHandling.HideCommand("toolstripInsertLink", ToolBar.Items); //CommandHandling.HideCommand("", ToolBar.Items); //CommandHandling.HideCommand("", ToolBar.Items); //CommandHandling.HideCommand("", ToolBar.Items); }
virtual protected void InitialiseFeatures() { // remove whole 'Document' submenu CommandHandling.HideCommand("contextDocument", ContextMenu.Items); CommandHandling.HideCommand("contextDocumentPrint", ContextMenu.Items); CommandHandling.HideCommand("toolstripDocumentPrint", ToolBar.Items); CommandHandling.HideCommand("toolstripEnableEditing", ToolBar.Items); CommandHandling.HideCommand("toolstripFindReplace", ToolBar.Items); CommandHandling.HideCommand("toolstripInsertLink", ToolBar.Items); CommandHandling.HideCommand("", ToolBar.Items); CommandHandling.HideCommand("", ToolBar.Items); CommandHandling.HideCommand("", ToolBar.Items); }
public void Test_Constructor() { Socket socket = null; string command = "DB_INSERT_REGISTRATE:FirstName/LastName/01_01_2001/[email protected]/password/Rachelsmolen_1_0000NN_Eindhoven_Netherlands;"; CommandHandling handling = new CommandHandling(command, socket); string[] expectedData = { "FirstName", "LastName", "01_01_2001", "*****@*****.**", "password", "Rachelsmolen_1_0000NN_Eindhoven_Netherlands" }; Database expectedDatabase = new Database(); Assert.AreEqual(expectedData[0], handling.Data[0]); Assert.AreEqual(expectedData[1], handling.Data[1]); Assert.AreEqual(expectedData[2], handling.Data[2]); Assert.AreEqual(expectedData[3], handling.Data[3]); Assert.AreEqual(expectedData[4], handling.Data[4]); Assert.AreEqual(expectedData[5], handling.Data[5]); Assert.AreEqual(command, handling.Command); Assert.AreEqual(socket, handling.ClientSocket); Assert.AreEqual(expectedDatabase, handling.Database); }
protected override void OnSelectionChange() { base.OnSelectionChange(); // update menu check-state CommandHandling.ClearChecked(m_ToolStripAttributeMenu.DropDownItems); var selText = GetTextRange(); string basePlaceholder; int level; if (HtmlReportUtils.ParsePlaceholder(selText, out basePlaceholder, out level)) { ToolStripItem item = m_ToolStripAttributeMenu.DropDownItems[HtmlReportUtils.FormatPlaceholder(basePlaceholder)]; if ((item != null) && (item is ToolStripMenuItem)) (item as ToolStripMenuItem).Checked = true; } }
public bool ProcessMessage(IntPtr hwnd, UInt32 message, UInt32 wParam, UInt32 lParam, UInt32 time, Int32 xPos, Int32 yPos) { // Handle keyboard shortcuts if ((message == 0x0100) || (message == 0x0104) && (Control.ModifierKeys != Keys.None)) { Keys keyPress = (Keys)wParam; if (keyPress == Keys.ControlKey) { return(false); } var modifiers = Control.ModifierKeys; if ((modifiers & Keys.Control) == Keys.Control) { keyPress |= Keys.Control; } if ((modifiers & Keys.Shift) == Keys.Shift) { keyPress |= Keys.Shift; } if ((modifiers & Keys.Alt) == Keys.Alt) { keyPress |= Keys.Alt; } if (CommandHandling.ProcessMenuShortcut(keyPress, ContextMenu.Items)) { return(true); } // Pick up any stragglers switch (keyPress) { case Keys.Tab: SelectedHtml = " "; return(true); case Keys.Left | Keys.Control: { var range = GetTextRange(); if (range != null) { range.move("word", -1); range.collapse(); range.select(); } } return(true); case Keys.Right | Keys.Control: { var range = GetTextRange(); if (range != null) { range.move("word", 1); range.collapse(); range.select(); } } return(true); case Keys.Oemcomma | Keys.Control: FormatFontDecrease(); return(true); case Keys.OemPeriod | Keys.Control: FormatFontIncrease(); return(true); } } return(false); }
public bool ProcessMessage(IntPtr hwnd, UInt32 message, UInt32 wParam, UInt32 lParam, UInt32 time, Int32 xPos, Int32 yPos) { if (!ReadOnly) { switch (message) { case WM_KEYDOWN: case WM_SYSKEYDOWN: { Keys keyPress = CommandHandling.GetMenuShortcutFromVirtualKey(wParam); if (keyPress == Keys.Return) { // Handle <enter> manually because the default handling // appears to fail when we are hosted in a win32 modal dialog IntPtr hwndFind = FindWindowEx(WebBrowser.Handle, IntPtr.Zero, "Shell Embedding", ""); hwndFind = FindWindowEx(hwndFind, IntPtr.Zero, "Shell DocObject View", ""); hwndFind = FindWindowEx(hwndFind, IntPtr.Zero, "Internet Explorer_Server", ""); if (hwndFind != null) { SendMessage(hwndFind, WM_CHAR, VK_RETURN, 0); } return(true); } else if (keyPress != Keys.None) { return(OnDocumentKeyPress(keyPress)); } } break; case WM_CHAR: if ((wParam == '@') && (NeedAttributeValues != null)) { // Can't handle this with WM_KEYDOWN because different // keyboard layouts place '@' in different locations var items = GetPopupListBoxItems(); if (items.Count() > 0) { // Insert the '@' first and select it SelectedHtml = "@"; SelectCharacterAtCaret(false); var popup = new PopupListBox(); popup.ListBox.Items.AddRange(items); popup.ListBox.Font = m_ControlsFont; popup.Closed += new ToolStripDropDownClosedEventHandler(OnAttributeListBoxClosed); var pos = GetPopupListBoxLocation(); popup.Show(pos.X, pos.Y); return(true); // we already added the '@' } } break; } } return(false); }