internal void BindGesture(InputPlaybleGesture ip, BindAction ba) { if (ba == BindAction.ADD) { addedgesture = true; if(_gestureMapper.ContainsKey(ip.GestureType)) { _gestureMapper[ip.GestureType].Add(ip); } else { TouchPanel.EnabledGestures = TouchPanel.EnabledGestures | ip.GestureType; List<InputPlaybleGesture> gest = new List<InputPlaybleGesture>(); gest.Add(ip); _gestureMapper.Add(ip.GestureType, gest); } } else if (ba == BindAction.REMOVE) { List<InputPlaybleGesture> gest = _gestureMapper[ip.GestureType]; gest.Remove(ip); } }
private static int ActionToResx(BindAction ba) { int i = (int)ba; return(i < (int)BindAction.KEYBOARD_ACTION_COUNT ? i : i + (int)BindAction.KEYBOARD_ACTION_COUNT - QTUtility.FIRST_MOUSE_ONLY_ACTION); }
internal void BindMousePosition(InputPlaybleMousePosition ip, BindAction ba) { if (ba == BindAction.ADD) { _mouseMapperPosition.Add(ip); } else if (ba == BindAction.REMOVE) { _mouseMapperPosition.Remove(ip); } }
/// <summary> /// Binds the value of the property with name <see cref="PropertyName"/> from the specified item to the specified view with ID <see cref="ViewID"/>. /// </summary> /// <param name="item">The item to bind.</param> /// <param name="view">The view to bind to.</param> public void Bind(T item, View view) { var pInfo = typeof(T).GetProperty(PropertyName); if (pInfo == null) { throw new ArgumentException($"Type {typeof(T)} does not contain a property named {PropertyName}"); } var pValue = pInfo.GetValue(item); BindAction.DynamicInvoke(pValue, view); }
internal void BindMouseBottom(InputPlaybleMouseBottom ip, BindAction ba) { if (ba == BindAction.ADD) { if (ip.StateKey == StateKey.DOWN) { _mouseMapperDown.Add(ip); } else if (ip.StateKey == StateKey.PRESS) { _mouseMapperPress.Add(ip); } else if (ip.StateKey == StateKey.RELEASE) { _mouseMapperRelease.Add(ip); } else if (ip.StateKey == StateKey.UP) { _mouseMapperUp.Add(ip); } } else if (ba == BindAction.REMOVE) { if (ip.StateKey == StateKey.DOWN) { _mouseMapperDown.Remove(ip); } else if (ip.StateKey == StateKey.PRESS) { _mouseMapperPress.Remove(ip); } else if (ip.StateKey == StateKey.RELEASE) { _mouseMapperRelease.Remove(ip); } else if (ip.StateKey == StateKey.UP) { _mouseMapperUp.Remove(ip); } } }
internal void BindKey(InputPlayableKeyBoard ip, BindAction ba) { if (ba == BindAction.ADD) { if (ip.StateKey == StateKey.DOWN) { _keysMapperDown.Add(ip); } else if (ip.StateKey == StateKey.PRESS) { _keysMapperPress.Add(ip); } else if (ip.StateKey == StateKey.RELEASE) { _keysMapperRelease.Add(ip); } else if (ip.StateKey == StateKey.UP) { _keysMapperUp.Add(ip); } } else if (ba == BindAction.REMOVE) { if (ip.StateKey == StateKey.DOWN) { _keysMapperDown.Remove(ip); } else if (ip.StateKey == StateKey.PRESS) { _keysMapperPress.Remove(ip); } else if (ip.StateKey == StateKey.RELEASE) { _keysMapperRelease.Remove(ip); } else if (ip.StateKey == StateKey.UP) { _keysMapperUp.Remove(ip); } } }
internal void BindGesture(InputPlaybleGesture ip, BindAction ba) { if (ba == BindAction.ADD) { addedgesture = true; if (_gestureMapper.ContainsKey(ip.GestureType)) { _gestureMapper[ip.GestureType].Add(ip); } else { TouchPanel.EnabledGestures = TouchPanel.EnabledGestures | ip.GestureType; List <InputPlaybleGesture> gest = new List <InputPlaybleGesture>(); gest.Add(ip); _gestureMapper.Add(ip.GestureType, gest); } } else if (ba == BindAction.REMOVE) { List <InputPlaybleGesture> gest = _gestureMapper[ip.GestureType]; gest.Remove(ip); } }
public BindMouseCommand(InputPlaybleMousePosition ipx, BindAction ba) { this.ipx = ipx; this.ba = ba; type = POSITION; }
public BindGestureCommand(InputPlaybleGesture ip, BindAction ba) { this.ip = ip; this.ba = ba; }
public BindMouseCommand(InputPlaybleMouseBottom ip, BindAction ba) { this.ip = ip; this.ba = ba; type = BOTTOM; }
protected void RaiseBindFailEvent(BindAction Action, String PropertyName) { BindFail?.Invoke(Action, PropertyName); }
public MouseEntry(MouseTarget target, MouseChord chord, BindAction action) { Target = target; Action = action; Chord = chord; }
private bool DoBindAction(BindAction action, bool fRepeat = false, QTabItem tab = null, IDLWrapper item = null) { if(fRepeat && !( action == BindAction.GoBack || action == BindAction.GoForward || action == BindAction.TransparencyPlus || action == BindAction.TransparencyMinus)) { return false; } if(tab == null) tab = CurrentTab; IntPtr ptr; switch(action) { case BindAction.GoBack: NavigateCurrentTab(true); break; case BindAction.GoForward: NavigateCurrentTab(false); break; case BindAction.GoFirst: NavigateToFirstOrLast(true); break; case BindAction.GoLast: NavigateToFirstOrLast(false); break; case BindAction.NextTab: if(tabControl1.SelectedIndex == tabControl1.TabCount - 1) { tabControl1.SelectedIndex = 0; } else { tabControl1.SelectedIndex++; } break; case BindAction.PreviousTab: if(tabControl1.SelectedIndex == 0) { tabControl1.SelectedIndex = tabControl1.TabCount - 1; } else { tabControl1.SelectedIndex--; } break; case BindAction.FirstTab: tabControl1.SelectedIndex = 0; break; case BindAction.LastTab: tabControl1.SelectedIndex = tabControl1.TabCount - 1; break; case BindAction.CloseCurrent: case BindAction.CloseTab: NowTabDragging = false; if(!tab.TabLocked) { if(tabControl1.TabCount > 1) { CloseTab(tab); } else { WindowUtils.CloseExplorer(ExplorerHandle, 1); } } break; case BindAction.CloseAllButCurrent: case BindAction.CloseAllButThis: CloseAllTabsExcept(tab); break; case BindAction.CloseLeft: case BindAction.CloseLeftTab: CloseLeftRight(true, tab.Index); break; case BindAction.CloseRight: case BindAction.CloseRightTab: CloseLeftRight(false, tab.Index); break; case BindAction.CloseWindow: WindowUtils.CloseExplorer(ExplorerHandle, 1); break; case BindAction.RestoreLastClosed: RestoreLastClosed(); break; case BindAction.CloneCurrent: case BindAction.CloneTab: CloneTabButton(tab, null, true, -1); break; case BindAction.TearOffCurrent: case BindAction.TearOffTab: if(tabControl1.TabCount > 1) { using(IDLWrapper wrapper = new IDLWrapper(tab.CurrentIDL)) { OpenNewWindow(wrapper); } CloseTab(tab); } break; case BindAction.LockCurrent: case BindAction.LockTab: tab.TabLocked = !tab.TabLocked; break; case BindAction.LockAll: bool lockState = tabControl1.TabPages.Any(t => t.TabLocked); tabControl1.TabPages.ForEach(t => t.TabLocked = !lockState); break; case BindAction.BrowseFolder: ChooseNewDirectory(); break; case BindAction.CreateNewGroup: CreateGroup(tab); break; case BindAction.ShowOptions: OptionsDialog.Open(); break; case BindAction.ShowToolbarMenu: // hmm. Rectangle tabRect = tabControl1.GetTabRect(tabControl1.TabCount - 1, true); contextMenuSys.Show(PointToScreen(new Point(tabRect.Right + 10, tabRect.Bottom - 10))); break; case BindAction.ShowTabMenuCurrent: if(tab.Index != -1) { ContextMenuedTab = tab; Rectangle rect = tabControl1.GetTabRect(tab.Index, true); contextMenuTab.Show(PointToScreen(new Point(rect.Right + 10, rect.Bottom - 10))); } break; case BindAction.ShowTabMenu: ContextMenuedTab = tab; contextMenuTab.Show(MousePosition); break; case BindAction.ShowGroupMenu: TryCallButtonBar(bbar => bbar.ClickItem(QTButtonBar.BII_GROUP)); break; case BindAction.ShowRecentTabsMenu: TryCallButtonBar(bbar => bbar.ClickItem(QTButtonBar.BII_RECENTTAB)); break; case BindAction.ShowUserAppsMenu: TryCallButtonBar(bbar => bbar.ClickItem(QTButtonBar.BII_APPLICATIONLAUNCHER)); break; case BindAction.CopySelectedPaths: if(listView.SubDirTipMenuIsShowing() || (subDirTip_Tab != null && subDirTip_Tab.MenuIsShowing)) { return false; } DoFileTools(0); break; case BindAction.CopySelectedNames: if(listView.SubDirTipMenuIsShowing() || (subDirTip_Tab != null && subDirTip_Tab.MenuIsShowing)) { return false; } DoFileTools(1); break; case BindAction.CopyCurrentFolderPath: DoFileTools(2); break; case BindAction.CopyCurrentFolderName: DoFileTools(3); break; case BindAction.ChecksumSelected: DoFileTools(4); break; case BindAction.ToggleTopMost: ToggleTopMost(); // todo: move v to < ? TryCallButtonBar(bbar => bbar.RefreshButtons()); break; case BindAction.TransparencyPlus: case BindAction.TransparencyMinus: { // TODO!!! int num9; int num10; byte num11; if(0x80000 != ((int)PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000))) { if(action == BindAction.TransparencyPlus) { return true; } PInvoke.SetWindowLongPtr(ExplorerHandle, -20, PInvoke.Ptr_OP_OR(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0x80000)); PInvoke.SetLayeredWindowAttributes(ExplorerHandle, 0, 0xff, 2); } if(PInvoke.GetLayeredWindowAttributes(ExplorerHandle, out num9, out num11, out num10)) { IntPtr ptr3; if(action == BindAction.TransparencyPlus) { if(num11 > 0xf3) { num11 = 0xff; } else { num11 = (byte)(num11 + 12); } } else if(num11 < 0x20) { num11 = 20; } else { num11 = (byte)(num11 - 12); } PInvoke.SetLayeredWindowAttributes(ExplorerHandle, 0, num11, 2); // IM! //if(InstanceManager.TryGetButtonBarHandle(ExplorerHandle, out ptr3)) { // QTUtility2.SendCOPYDATASTRUCT(ptr3, (IntPtr)7, "track", (IntPtr)num11); //} if(num11 == 0xff) { PInvoke.SetWindowLongPtr(ExplorerHandle, -20, PInvoke.Ptr_OP_AND(PInvoke.GetWindowLongPtr(ExplorerHandle, -20), 0xfff7ffff)); } } } break; case BindAction.FocusFileList: listView.SetFocus(); break; case BindAction.FocusSearchBarReal: if(QTUtility.IsXP) return false; // todo, I don't think this works PInvoke.SetFocus(GetSearchBand_Edit()); break; case BindAction.FocusSearchBarBBar: TryCallButtonBar(bbar => bbar.FocusSearchBox()); break; case BindAction.ShowSDTSelected: if(!Config.Tips.ShowSubDirTips) return false; listView.ShowAndClickSubDirTip(); break; case BindAction.SendToTray: MinimizeToTray(); break; case BindAction.FocusTabBar: tabControl1.Focus(); tabControl1.FocusNextTab(false, true, false); break; case BindAction.NewTab: using(IDLWrapper wrapper = new IDLWrapper(Config.Window.DefaultLocation)) { OpenNewTab(wrapper, false, true); } break; case BindAction.NewWindow: using(IDLWrapper wrapper = new IDLWrapper(Config.Window.DefaultLocation)) { OpenNewWindow(wrapper); } break; // TODO all the blank ones case BindAction.NewFolder: break; case BindAction.NewFile: break; case BindAction.SwitchToLastActivated: if(lstActivatedTabs.Count > 1 && tabControl1.TabPages.Contains(lstActivatedTabs[lstActivatedTabs.Count - 2])) { try { tabControl1.SelectTab(lstActivatedTabs[lstActivatedTabs.Count - 2]); } catch(ArgumentException) { } } break; case BindAction.MergeWindows: MergeAllWindows(); break; case BindAction.ShowRecentFilesMenu: break; case BindAction.SortTabsByName: break; case BindAction.SortTabsByPath: break; case BindAction.SortTabsByActive: break; case BindAction.UpOneLevelTab: case BindAction.UpOneLevel: UpOneLevel(); // Hmm... break; case BindAction.Refresh: break; case BindAction.Paste: break; case BindAction.Maximize: break; case BindAction.Minimize: break; case BindAction.CopyTabPath: string currentPath = tab.CurrentPath; if(currentPath.IndexOf("???") != -1) { currentPath = currentPath.Substring(0, currentPath.IndexOf("???")); } QTUtility2.SetStringClipboard(currentPath); break; case BindAction.TabProperties: ShellMethods.ShowProperties(tab.CurrentIDL); break; case BindAction.ShowTabSubfolderMenu: break; case BindAction.ItemOpenInNewTab: case BindAction.ItemOpenInNewTabNoSel: case BindAction.ItemOpenInNewWindow: if(item.Available && item.HasPath && item.IsReadyIfDrive && !item.IsLinkToDeadFolder) { using(IDLWrapper linkWrapper = item.ResolveTargetIfLink()) { IDLWrapper actualItem = linkWrapper ?? item; if(actualItem.IsFolder) { if(action == BindAction.ItemOpenInNewWindow) { OpenNewWindow(actualItem); } else { OpenNewTab(actualItem, action == BindAction.ItemOpenInNewTabNoSel); } } } } break; case BindAction.ItemCut: case BindAction.ItemCopy: case BindAction.ItemDelete: break; case BindAction.ItemProperties: ShellMethods.ShowProperties(item.IDL); break; case BindAction.CopyItemPath: case BindAction.CopyItemName: case BindAction.ChecksumItem: break; } return true; }
// this method will be marked as private in the future private void Initialize(IFileSystem fileSystem, IPathResolver resolver, IAsyncManager asyncManager, IScriptLogger logger, IO.IByteBufferAllocator byteBufferAllocator, BindAction binder) { if (fileSystem == null) { throw new NullReferenceException(nameof(fileSystem)); } asyncManager.Initialize(_mainThreadId); _isValid = true; _isRunning = true; _logger = logger; // _rwlock = new ReaderWriterLockSlim(); _rt = JSApi.JS_NewRuntime(); JSApi.JS_SetHostPromiseRejectionTracker(_rt, JSApi.PromiseRejectionTracker, IntPtr.Zero); #if UNITY_EDITOR JSApi.JS_SetInterruptHandler(_rt, _InterruptHandler, IntPtr.Zero); #else if (isWorker) { JSApi.JS_SetInterruptHandler(_rt, _InterruptHandler, IntPtr.Zero); } #endif JSApi.JS_SetRuntimeOpaque(_rt, (IntPtr)_runtimeId); JSApi.JS_SetModuleLoaderFunc(_rt, module_normalize, module_loader, IntPtr.Zero); CreateContext(); JSApi.JS_NewClass(_rt, JSApi.class_finalizer); _pathResolver = resolver; _asyncManager = asyncManager; _byteBufferAllocator = byteBufferAllocator; _autorelease = new Utils.AutoReleasePool(); _fileSystem = fileSystem; _objectCache = new ObjectCache(_logger); _timerManager = new TimerManager(_logger); _typeDB = new TypeDB(this, _mainContext); #if !JSB_UNITYLESS _typeDB.AddType(typeof(Unity.JSBehaviour), JSApi.JS_UNDEFINED); _typeDB.AddType(typeof(Unity.JSScriptableObject), JSApi.JS_UNDEFINED); #endif #if UNITY_EDITOR _typeDB.AddType(Values.FindType("QuickJS.Unity.JSEditorWindow"), JSApi.JS_UNDEFINED); _typeDB.AddType(Values.FindType("QuickJS.Unity.JSBehaviourInspector"), JSApi.JS_UNDEFINED); #endif // await Task.Run(() => runner.OnBind(this, register)); try { binder?.Invoke(this); } catch (Exception exception) { _logger?.WriteException(exception); } var register = _mainContext.CreateTypeRegister(); if (!_isWorker) { JSWorker.Bind(register); } TimerManager.Bind(register); extraBinding?.Invoke(this, register); register.Finish(); AddStaticModule("jsb", ScriptContext.Bind); // FindModuleResolver<StaticModuleResolver>().Warmup(_mainContext); _isInitialized = true; OnInitialized?.Invoke(this); }
public BindKeyCommand(InputPlayableKeyBoard ip, BindAction ba) { this.ip = ip; this.ba = ba; }
private static int ActionToResx(BindAction ba) { int i = (int)ba; return i < (int)BindAction.KEYBOARD_ACTION_COUNT ? i : i + (int)BindAction.KEYBOARD_ACTION_COUNT - QTUtility.FIRST_MOUSE_ONLY_ACTION; }