If you have the preview tool-window sharing the screen with other toolwindows (or on auto-hide) you can use this code to make the preview toolwindow visible using Ctrl-dot. The usual keybinding for Ctrl-dot is push-tag. If instead you bind preview_push_tag to Ctrl-dot, when you use ctrl-dot, if the preview toolwindow isn't visible, it makes it visible and doesn't go to the symbol, otherwise it just goes to the symbol.
If you have the preview toolwindow set to auto-hide then you probably don't want to use this code, but if you do, it will always just do push-tag because you can't show an auto-hide window as well as keep focus in the editor window. Alternatively you can use the second function below - preview_push_tag2().
#include "slick.sh"
#pragma option(strictsemicolons,on)
#pragma option(strict,on)
#pragma option(autodecl,off)
#pragma option(strictparens,on)
#include 'C:\Program Files\Slick\Pro-23-0-0-11\macros\se\ui\toolwindow.sh'
_command void show_preview() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
int window_id = p_window_id;
activate_preview();
p_window_id = window_id;
window_id._set_focus();
}
_command void preview_push_tag() name_info(TAG_ARG','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL|VSARG2_REQUIRES_MDI|VSARG2_READ_ONLY)
{
int wid = tw_find_form('_tbtagwin_form');
if ( wid > 0 && tw_is_auto(wid) ) {
push_tag();
return;
}
if ( wid <= 0 || !tw_is_wid_active(wid) ) {
show_preview();
return;
}
push_tag();
}
If you have the preview toolwindow set to auto hide, you can bind ctrl-dot to preview_push_tag2 and when you use ctrl-dot it will activate the preview toolwindow and give it the focus without going to the tag (use escape to close). If you then use ctrl-dot while it still has the focus, it will go to the relevant tag using the second function below which uses call-event. Never used call-event before, dunno if I got it right, but it seems to work (on Windows). Uncomment the line that calls toggle-preview if you want to force the preview window to close/hide. If you have more than one auto-hide "mdi" editor window it will only look in the current mdi window for the preview toolwindow.
#include "slick.sh"
#pragma option(strictsemicolons,on)
#pragma option(strict,on)
#pragma option(autodecl,off)
#pragma option(strictparens,on)
#include 'C:\Program Files\Slick\Pro-23-0-0-11\macros\se\ui\toolwindow.sh'
_command void preview_push_tag2() name_info(TAG_ARG','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL|VSARG2_REQUIRES_MDI|VSARG2_READ_ONLY)
{
int wid = tw_find_form('_tbtagwin_form');
if ( wid > 0 && tw_is_auto(wid) ) {
if ( !tw_is_auto_raised(wid) ) {
activate_preview();
return;
}
push_tag();
return;
}
if ( wid <= 0 || !tw_is_wid_active(wid) ) {
show_preview();
return;
}
push_tag();
}
defeventtab _tbtagwin_form;
_tbtagwin_form."C-."()
{
_control ctl_push_tag;
ctl_push_tag.call_event(_control ctl_push_tag,LBUTTON_UP);
// uncomment the next line if you want the preview window to close when you use Ctrl-dot
// regardless of where the mouse cursor is
// toggle_preview();
}