From 4cf9a3b8fe91cc0b43d0cbab51cf02c7b1f8d60d Mon Sep 17 00:00:00 2001 From: qwertfisch Date: Mon, 19 Nov 2012 21:25:24 +0000 Subject: KeyBuddy2: ein neuer Ansatz eines Layouttools, ähnlich zu NeoVars, aber in C++ geschrieben MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.neo-layout.org@2431 b9310e46-f624-0410-8ea1-cfbb3a30dc96 --- windows/keybuddy2/src/hotstrings.h | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 windows/keybuddy2/src/hotstrings.h (limited to 'windows/keybuddy2/src/hotstrings.h') diff --git a/windows/keybuddy2/src/hotstrings.h b/windows/keybuddy2/src/hotstrings.h new file mode 100644 index 0000000..0ec6bf8 --- /dev/null +++ b/windows/keybuddy2/src/hotstrings.h @@ -0,0 +1,53 @@ +#ifndef _KeyBuddy2_hotstrings_h_ +#define _KeyBuddy2_hotstrings_h_ + +#include "includes.h" + +// when certain strings are typed ("hotstrings"), they get replaced or they launch programs + +class hotString{ + public: + WString hs; // string that activates this hotstring when typed + WString winTitle; // only if the window that has the focus contains this string + WString winClass; // only if the window that has the focus is of this class + WString value; // string that is to be sent / program that is to be launched + bool launch; // false = send the string in value, true = launch program with name value + //launching: "xxx|yyy|zzz" will run program yyy with parameters zzz in working directory xxx + + static hotString* pHotStrings; // pointer to the array of hotstrings + static int numHotStrings; // number of hotstrings + static WString hsBuffer; // the buffer that is filled with letters while typing + // after each sent character, the end of the buffer is compared to all the hotstrings in the list + // if there is a match, the hotstring is activated + static int bufferLen; // number of letters in the buffer + static long lastFocusPtr; // the window that had the focus while the last character was typed + // if the window changes, the hotstring buffer is cleared + + static void loadHotStrings(); + static void clearBuffer(){hsBuffer = WString(0,bufferLen);}; + static void appendBuffer(wchar c){ // appends one character to the buffer + int i; + for(i=0;ihs.GetLength() - a->hs.GetLength(); + } + // the list needs to be sorted: if the user types "abcde" and both "cde" and "de" are hotstrings, + // always the longer one is to be used and will be picked when the list is checked from long to short + + static void checkHotStrings(); // check if the typed characters activate a hotstring and activates it + static long getFocusWindowPtr(); // get the pointer to the object that has the focus + static void getFocusInfo(WString& objectClass, WString& parentTitle); // get classname of this object + // and the title of its parent window + +}; + +#endif -- cgit v1.2.3