static bool get_drop_command(const char *filename, int flags) { char buffer[MAX_PATH + 100]; const char *e = strrchr(filename, '.'); if (e && stristr(".bmp.gif.png.jpg.jpeg", e)) { unsigned modkey = get_modkeys(); const char *mode; if (MK_SHIFT == modkey) mode = "center"; else if (MK_CONTROL == modkey) mode = "tile"; else mode = "full"; if (0 == (flags & 1)) { sprintf(buffer, "@BBCore.rootCommand bsetroot -%s \"%s\"", mode, filename); post_command(buffer); } return true; } if (flags & 2) { if (0 == (flags & 1)) { sprintf(buffer, "@BBCore.style %s", filename); post_command(buffer); } return true; } return false; }
bool Desk_mousebutton_event(LPARAM button) { char rc_key[80] = "blackbox.desktop."; const char (*modkey_strings)[6] = GetSystemMetrics(SM_SWAPBUTTON) ? &modkey_strings_l[0] : &modkey_strings_r[0]; unsigned modkey = get_modkeys(); for (int i = 0; i < (int)(sizeof(mk_mods)/sizeof(mk_mods[0])); i++){ if (mk_mods[i] & modkey) strcat(rc_key, modkey_strings[i]); } if (button >= (int)(sizeof(button_strings)/sizeof(button_strings[0]))) return false; if (button >= 7){ sprintf(strchr(rc_key, 0), "%s:", button_strings[button]); // WheelUp/WheelDown } else{ sprintf(strchr(rc_key, 0), "%sClick:", button_strings[button]); } const char *broam = ReadString(extensionsrcPath(), rc_key, NULL); if (broam) post_command(broam); else if (1 == button && 0 == modkey) PostMessage(BBhwnd, BB_MENU, BB_MENU_ROOT, 0); else if ((2 == button && 0 == modkey) || (1 == button && MK_SHIFT == modkey)) PostMessage(BBhwnd, BB_MENU, BB_MENU_TASKS, 0); else return false; return true; }
//================================================ void exec_folder_click(const struct _ITEMIDLIST * pidl) { const TCHAR *p = ReadString(extensionsrcPath(), _T("blackbox.options.openFolderCommand:"), NULL); if (p) { TCHAR path[MAX_PATH]; TCHAR buffer[MAX_PATH*2]; if (sh_get_displayname(NULL, pidl, SHGDN_FORPARSING, path)) { post_command(replace_argument1(buffer, MAX_PATH*2, p, path)); return; } } exec_pidl(pidl, _T("explore"), NULL); }
void FolderItem::Invoke(int button) { if (INVOKE_LEFT == button) { if (m_pszCommand) { m_pMenu->hide_on_click(); post_command(m_pszCommand); return; } if (m_pSubMenu) m_pSubMenu->SetPinned(false); ShowSubMenu(); } }
bool Desk_mousebutton_event(int button) { char rc_key[100]; unsigned modkey; int i; const char *broam; if (button < 1 || button > array_count(button_strings)) return false; modkey = get_modkeys(); if (button == 1 && 0 == modkey) return false; strcpy(rc_key, "blackbox.desktop."); for (i = 0; i < array_count(mk_mods); ++i) if (mk_mods[i] & modkey) strcat(rc_key, modkey_strings[i]); sprintf(strchr(rc_key, 0), "%sClick", button_strings[button-1]); broam = ReadString(extensionsrcPath(NULL), rc_key, NULL); // dbg_printf("%s - %s", rc_key, broam); if (broam) { post_command(broam); return true; } if (2 == button && 0 == modkey) { PostMessage(BBhwnd, BB_MENU, BB_MENU_ROOT, 0); return true; } if ((3 == button && 0 == modkey) || (2 == button && MK_SHIFT == modkey)) { PostMessage(BBhwnd, BB_MENU, BB_MENU_TASKS, 0); return true; } return false; }
//==================== void CommandItem::Invoke(int button) { LPCITEMIDLIST pidl = GetPidl(); if (INVOKE_PROP & button) { show_props(pidl); return; } /*BlackboxZero 1.7.2012 */ char szPath[MAX_PATH]; szPath[0] = '\0'; if (INVOKE_LEFT & button) { m_pMenu->hide_on_click(); if (m_pszCommand) { /*BlackboxZero 1.7.2012 */ //if (const char *p = strstr(m_pszCommand, "%b")) { // post_command_fmt(m_pszCommand, false == m_bChecked); if (const char *p = stristr(m_pszCommand, "@BBCore.exec ")) { _strcpy(szPath, p+13); post_command(m_pszCommand); } else post_command(m_pszCommand); } else if (pidl) { char buf[MAX_PATH]; /*BlackboxZero 1.7.2012 */ char szMenuPath[MAX_PATH]; szMenuPath[0] = '\0'; if (SHGetPathFromIDList(pidl, buf)) sprintf(szPath, "\"%s\"", buf); /*BlackboxZero 1.7.2012 */ BBExecute_pidl(NULL, pidl); /*BlackboxZero 1.7.2012 */ strcpy(szMenuPath, unquote(Settings_recentMenu)); int nKeep = Settings_recentItemKeepSize; int nSort = Settings_recentItemSortSize; bool bBeginEnd = Settings_recentBeginEnd; if (szPath[0] && szMenuPath[0] && (nKeep || nSort)) CreateRecentItemMenu(szMenuPath, szPath, m_pszTitle, m_pszIcon, nKeep, nSort, bBeginEnd); /*BlackboxZero 1.7.2012 */ } return; } if (INVOKE_RIGHT & button) { if (m_pszRightCommand) post_command(m_pszRightCommand); else if (m_pRightmenu) m_pRightmenu->incref(), ShowRightMenu(m_pRightmenu); else if ((GetAsyncKeyState (VK_SHIFT) & 0x8000)) { char buffer[MAX_PATH], param[MAX_PATH]; char *tokens[1]; tokens[0] = param; BBTokenize((const char*)m_pszCommand, tokens, 1, param); if (0 == _memicmp(m_pszCommand, "@BBCfg.plugin", 12)) { if ((GetAsyncKeyState (VK_CONTROL) & 0x8000)) sprintf(buffer, "@BBCfg.plugin.remove %s", param); else sprintf(buffer, "@BBCfg.plugin.edit %s", param); post_command(buffer); } else if (0 == _memicmp(m_pszCommand, "@BBCore.style", 12)) { sprintf(buffer, "@BBCore.edit %s", param); post_command(buffer); } } else ShowContextMenu(m_pszCommand, pidl); return; } if (INVOKE_MID & button) { if (0 == _memicmp(m_pszCommand, "@BBCfg.plugin", 12)) { char buffer[MAX_PATH], param[MAX_PATH]; char *tokens[1]; tokens[0] = param; BBTokenize((const char*)m_pszCommand, tokens, 1, param); sprintf(buffer, "@BBCfg.plugin.docs %s", param); post_command(buffer); } return; } if (INVOKE_DRAG & button) { m_pMenu->start_drag(m_pszCommand, pidl); return; } }