Some ideas that didnt work...
- A timer. Very iffy. On different systems, keyMacro could get through multiple times.
- Play back only once. Ok, how do you play it next time? What would clear the "I just played that" status?
this sounds like a handy macro.No, the loop does not occur on paste. Only when invoked via the keyboard.
some thoughts/questions:
* would you have the same problem if someone pasted text containing "{"?
* it seems that you need some way to distinguish typed input from inserted input. failing that you could require all key assignments use a CTRL or ALT modifier.Indeed. But the macroText is not inserted. It's actually pushed onto the keyboard queue. Thus there is no distinction between chars originating from the macro and those typed at the keyboard by the user.
* are you trapping the "changed" status of the cbEditor rather than the "keystroke" status?KeyMacs is not trapping any status at all right now. It's invoked by the menu system, looks up the menu name, matches that to a keyMacro of the same name, translates its menuText to keystrokes and pushes 'em into the keyboard queue.
* does the plugin operate only when focus is in the editor window or on all C::B windows?I have restricted the macro to execute only when invoke from a CBeditor window. However, the macroText can open/close/switch/start pgms/invoke other menus etc. eg. "{Ctrl}fFIXME{ENTER}" opens the find dialog, types FIXME into the find control and executes the find.
* it would be nice if this plugin was integrated with "Keyboard shortcuts"I suspect that in future, the KeyBinder plugin will be deprecated. So integration might not be forthcoming.
hope to see it working soon :)
I think I'm misunderstanding this loop.
...
However, the loop problem still exists. macroA contains command keys that invoke macroB which contains command key that invokes macroA again.
The loop still lives.
// ----------------------------------------------------------------------------
// Commit 0.3.3 2007/01/17 Published
// 1) Escaped recorded user {}!^+ chars in KeyEvtLogr::RecordEvent()
// 2) reverse refactored change header to version.h
// 3) Set recorded macro to Scratch at "stop recording" as well as "play macro"
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Commit 0.3.5 2007/01/23 Publish
// 4) version.h/cpp rework and editor spelling corrections
// 5) Fixes for crashes when enabled/disabled by Plugin Manager
// ----------------------------------------------------------------------------
:: === KeyMacs-MSW-plugin, default === D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:35: error: `VK_SHIFT' was not declared in this scope D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:35: error: `MapVirtualKey' was not declared in this scope D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:36: error: `VK_CONTROL' was not declared in this scope D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:37: error: `VK_MENU' was not declared in this scope .... D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:298: error: `byte' was not declared in this scope D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:298: error: expected `)' before "scCode" :: More errors follow but not being shown. :: Edit the max errors limit in compiler options... :: === Build finished: 50 errors, 0 warnings === |
Hello,
I've been downloading the KeyMacs 0.3.5 plugin. I've been lacking
macro support in CB. But... when compiling in CB (3521), I receive
a bunch of preprocessor errors, see below.
They all relate to Windows preprocessor symbols, so they are
nowhere defined, neither in CB source folder nor in wxWidgets one.
How should this be compiled?
Thanks,
Arst
:: === KeyMacs-MSW-plugin, default ===
D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:35: error: `VK_SHIFT' was not declared in this scope
D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:35: error: `MapVirtualKey' was not declared in this scope
D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:36: error: `VK_CONTROL' was not declared in this scope
D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:37: error: `VK_MENU' was not declared in this scope
....
D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:298: error: `byte' was not declared in this scope
D:\Proj\Ext\CB\src\plugins\contrib\KeyMacs\MSWrunmacro.cpp:298: error: expected `)' before "scCode"
:: More errors follow but not being shown.
:: Edit the max errors limit in compiler options...
:: === Build finished: 50 errors, 0 warnings ===
// ---------------------------------------------------------------------------- // MSWrunmacro.cpp // ---------------------------------------------------------------------------- // RCS-ID: $Id: MSWrunmacro.cpp 15 2007-01-14 05:32:30Z Pecan $ #if defined(__WXMSW__) // headers for MSW here #ifdef wxUSE_UNICODE #define _UNICODE #define UNICODE #endif #include <windows.h> |
:: === KeyMacs-MSW-plugin, default === C:\wxWidgets-2.8.0\include\wx\wxprec.h:28: warning: "WX_PRECOMP" redefined :9:1: warning: this is the location of the previous definition cmdkeytextctrl.cpp:236: error: duplicate case value cmdkeytextctrl.cpp:221: error: previously used here cmdkeytextctrl.cpp:237: error: duplicate case value cmdkeytextctrl.cpp:222: error: previously used here cmdkeytextctrl.cpp:321: error: duplicate case value cmdkeytextctrl.cpp:320: error: previously used here cmdkeytextctrl.cpp:323: error: duplicate case value cmdkeytextctrl.cpp:322: error: previously used here :: === Build finished: 8 errors, 2 warnings === |
Hello,
Yes, I'm using the supplied KeyMacs project. On reading your reply,
I worked a bit with it again and got past the Windows preproc
problems. I had to do this (including windows.h and a couple of defines:Also I had to add the search path to MinGw/Include to the project.
// ----------------------------------------------------------------------------
// MSWrunmacro.cpp
// ----------------------------------------------------------------------------
// RCS-ID: $Id: MSWrunmacro.cpp 15 2007-01-14 05:32:30Z Pecan $
#if defined(__WXMSW__)
// headers for MSW here
#ifdef wxUSE_UNICODE
#define _UNICODE
#define UNICODE
#endif
#include <windows.h>
However... I think we get a very direct dependence on MinGw (going
past the wxW layer).
When the compiler continues, I get some other errors (below). They
all concern the PageUp and PageDown keys, where different defines
have the same value, in the switch case.OK
:: === KeyMacs-MSW-plugin, default ===
C:\wxWidgets-2.8.0\include\wx\wxprec.h:28: warning: "WX_PRECOMP" redefined
:9:1: warning: this is the location of the previous definition
cmdkeytextctrl.cpp:236: error: duplicate case value
cmdkeytextctrl.cpp:221: error: previously used here
cmdkeytextctrl.cpp:237: error: duplicate case value
cmdkeytextctrl.cpp:222: error: previously used here
cmdkeytextctrl.cpp:321: error: duplicate case value
cmdkeytextctrl.cpp:320: error: previously used here
cmdkeytextctrl.cpp:323: error: duplicate case value
cmdkeytextctrl.cpp:322: error: previously used here
:: === Build finished: 8 errors, 2 warnings ===
// Arst
#if not wxCHECK_VERSION(2, 8, 0)
case WXK_PRIOR: res << wxT("PgUp"); break;
case WXK_NEXT: res << wxT("PgDn"); break;
#endif
Hello again,
Now I've compiled it and ran it too. It goes OK, the submenu showed
up under Plugins and I recorded some macros. Some problems with
quote key (Shift+2) generating @ instead after a while.
I had to modify a couple of extra files in the same manner (defining
UNICODE, includingwindows.h and the gueards for wxw 2.8.0).
See attached file.
OK,
Ats
// ----------------------------------------------------------------------------
// Commit 0.3.8 2007/01/25 Publish
// 6) Scroll listCtrl "New" Untitled item into view.
// 7) Fixes by arst for wxWidgets 2.8.0
// 8) Disallowed Shift-singleChar as command key. Must start with
// Ctrl- or Alt- if Shift- is used.
// ----------------------------------------------------------------------------
// Commit 0.3.12 2007/01/31 Publish
// 9) Automatically paste keymac to edit window when user double
// clicks on canned {keymac} in help window.
// 10) Re-instated "force mouse back into window" for context menu
// Removed braces from around incorrect help caned keymacs
// Correct some spelling errors in help entry
// 11) Fixed: When another plugin is disabled, menu rebuild is Disconnecting event hooks.
// 12) Fixed: StopRecording event not creating the Scratch macro for playback.
I will work on getting it to compile with wxWidgets 2.8, and try to do the precomp stuff also.
But, I won't be doing any testing of it, past compile and link.
Tim S
// ----------------------------------------------------------------------------
// Commit 0.3.15 2007/02/8 Publish
// 13) Fixed GTK secondary crash when CB thinks there's no BuildMenu implemented.
// Don't know why menu appears twice after a prior CB crash. But this occurs
// only after a testing or debugging crash.
// 14) Fixed GTK KeyMacs rename crash, and GTK listCtrl focus/selection
// 15) Lost fixed item 0.3.12 above. Fixed it again.
// ----------------------------------------------------------------------------
*how about an option to enable or disable macros from activating other macros
*also changing it so when modifier keys are used to activate a plugin they do not need to be released for the macro to be used
eg currently if you use Alt - 0 you must release both the alt key and the '0' key where from what I have seen with linux and windows when a modifier key is pressed it does not need to be released eg you press down Alt - 0 and release '0' to activate the key. This would be nice for macros to be done quickly in succession.
Otherwise great plugin should nvr have a missing ")" or "}" again :D
*how about an option to enable or disable macros from activating other macrosI'd have to parse the user's keymac text to determine if it's invoking another keymac, a menu item, a secondary KeyBinding, etc. That's a big piece of work. I'll see what can be done though.
I was just thinking if you can send it you could use a null character( '\0' ) to signify the end of a macro and have it removed after it is detected.
Also I was trying to do this macro:{ENTER}{{}{ENTER}{ENTER}}{}{UP}{SPACE 2} but every 4th line it adds a tab in when used multiple times in a row and I can't figure out why.
I was just thinking if you can send it you could use a null character( '\0' ) to signify the end of a macro and have it removed after it is detected.
Also I was trying to do this macro:{ENTER}{{}{ENTER}{ENTER}}{}{UP}{SPACE 2} but every 4th line it adds a tab in when used multiple times in a row and I can't figure out why.
{ENTER}{{}{ENTER}+{TAB}{ENTER}{}}{UP}{SPACE 2}
Code// MSWrunmacro.cpp
// ----------------------------------------------------------------------------
// RCS-ID: $Id: MSWrunmacro.cpp 15 2007-01-14 05:32:30Z Pecan $
// ----------------------------------------------------------------------------
// MSWrunmacro.cpp
// ----------------------------------------------------------------------------
// RCS-ID: $Id: MSWrunmacro.cpp 19 2007-01-26 02:23:50Z Pecan $
{
{
{
{
{
{
{
{
{
{
}
}
}
}
}
}
}
}
}
}
I found what was causing the extra tabs was the Smart Indent option. Turned it off and the macro worked fine.
Could we include KeyMacs in the contribs?
It works for both MSW and GTK. The contribs seems to be the only way to get more users and feedback for any bugs and suggestions.
KeyMacs seems pretty soldid to me. I've been using it for about 2-3 weeks now.
thanks
pecan
Reference:
http://wiki.codeblocks.org/index.php?title=KeyMacs_plugin
http://forums.codeblocks.org/index.php?topic=4681.0
I tried this. On Fedora 16. But when I try to open KeyMacs-unix.cbp with Code::Blocks 10.05 I get a message saying "The project file does not exist". Then I notice that the size of every file in the Code::Blocks open dialog is 0 bytes. So I went to Terminal and did "ls -la KeyMacs-unix.cbp" and it shows that it is 2553 bytes.Code::Blocks uses wxWidgets, so it could be abug there, but I never mentioned it, when I was on fc16.
Does anyone know what may be going on?