Hi,
in one very big project I'm using Visual C only for debugging, and of course SE for editing, and I found a simple way to sync SE from VC using bellow macros. I placed them in my vusrmacs.e (I tested with 12.0.2 and latest hotfixes):
_command int my_GoTo(...) name_info(','VSARG2_CMDLINE|VSARG2_REQUIRES_EDITORCTL|VSARG2_MARK|VSARG2_READ_ONLY)
{
typeless nLineNr = 0;
typeless nColNr = 0;
_str strFileName = '';
_str param = arg(1);
if (param=="") {
message('Please specify file name and line number');
return 1;
}
parse param with strFileName nLineNr nColNr;
_str sourceFile = _ProjectWorkspaceFindFile(strFileName);
if (sourceFile == '') {
//File doesn't exist. Pop up a notification to let the user know.
message('Could not find 'strFileName);
return 2;
}
if(file_exists(sourceFile)) {
// HS2-ADD: save window id before edit and push_bookmark
int twid; get_window_id( twid );
if ( !_no_child_windows() ) {
_mdi.p_child.push_bookmark();
}
int status = edit(maybe_quote_filename(sourceFile), EDIT_DEFAULT_FLAGS);
goto_line(nLineNr);
p_col=nColNr;
//p_RLine = nLineNr;
// HS2-ADD: restore window id
//activate_window(twid);
}
else {
message('Could not find 'sourceFile);
return 3;
}
return 0;
}
#include 'tagsdb.sh'
_command int my_GoToPreview(...) name_info(','VSARG2_CMDLINE|VSARG2_REQUIRES_EDITORCTL|VSARG2_MARK|VSARG2_READ_ONLY)
{
typeless nLineNr = 0;
typeless nColNr = 0;
_str strFileName = '';
_str param = arg(1);
if (param=="") {
message('Please specify file name and line number');
return 1;
}
parse param with strFileName nLineNr nColNr;
_str sourceFile = _ProjectWorkspaceFindFile(strFileName);
if (sourceFile == '') {
//File doesn't exist. Pop up a notification to let the user know.
message('Could not find 'strFileName);
return 2;
}
if(file_exists(sourceFile)) {
// find the output tagwin and update it
struct VS_TAG_BROWSE_INFO cm;
tag_browse_info_init(cm);
cm.member_name = sourceFile;
cm.file_name=sourceFile;
cm.line_no=nLineNr;
cm.column_no=nColNr;
cb_refresh_output_tab(cm, true, true);
}
else {
message('Could not find 'sourceFile);
return 3;
}
return 0;
}
Then for example from Visual C++ Express -> Tools -> External Tools menu I have a tool with:
- title:
SlickEdit synchro- command:
C:\Program Files\SlickEdit 2007\win\vs.exe - arguments:
"-# my-Goto $(ItemFileName)$(ItemExt) $(CurLine) $(CurCol)"The second macro my-GotoPreview can be used if you have an external TraceMonitor (and if you have its sources) and you want to quick Preview where an ASSERT occurred for example.
And because I started this post I have 3 minor patches:
- into
tagfind.e,
ctl_search_for.on_got_focus() added first line
_set_sel(1, length(p_text)+1);
- same for
tbfilelist.e,
ctl_filter.on_got_focus():
_set_sel(1, length(p_text)+1);
-
tagwin.e,
_tbtagwin_form.on_got_focus:
commented last line
//_UpdateTagWindow(true);
First two are because I mainly use Files and FindSymbols tabs, and it's annoying when you have first to delete the old text and then to type the new one.
The third patch is because every time clicking into the Preview it gets resynchronized with the current buffer, which I don't want, especially when it shows code related to References or SearchResults.
