Hi All,
Have made some progress on these. Here are my macros for anyone interested.
I've attached the reload to the F5 key, and the delete/rename to the right-click menu items. The error marker only engages when the full path to an error is listed in the error output, not a relative path.
The only remaining gripes are to insert files and folders under the current folder node, and then everything looks ready to go!
Something useful to newcomers would be a "hacker's guide" to macros, that explains:
* Macros need to be compiled into .ex files, then reloaded using the Load Macros command every time they are changed. This took a bit of fiddling.
* Some entry points -- _message_box, get_string(), getting current filename, project name, workspace name etc.
Regards,
Matthew Herrmann
/**
*
* Reloads the current project to reflect any
* new or removed files.
*
*/
_command reload_current_project() name_info(','VSARG2_MACRO|VSARG2_MARK)
{
_str cur_project_name='';
status=_ini_get_value(VSEWorkspaceStateFilename(_workspace_filename),"Global","CurrentProject",cur_project_name);
cur_project_name=absolute(cur_project_name,strip_filename(_workspace_filename,'N'));
workspace_insert(cur_project_name, true, true, true);
}
/**
* Deletes the currently selected file in the tree view.
*/
_command delete_current_file() name_info(','VSARG2_MACRO|VSARG2_MARK)
{
int ff=1;
int currIndex;
_str name='', fullPath='';
int treeWid=p_window_id;
for (;;ff=0)
{
int index=_TreeFindSelected(ff);
if (index<0) break;
if (getTreeFile(treeWid, index, name, fullPath))
{
continue;
}
if (_message_box(nls("Delete %s?", fullPath), "SlickEdit", MB_OKCANCEL|MB_ICONQUESTION) == IDOK)
{
edit(fullPath);
if (close_buffer() == 0)
{
delete_file(fullPath);
reload_current_project();
}
}
break;
}
}
/**
* Renames the currently selected file in the tree view.
*/
_command rename_current_file() name_info(','VSARG2_MACRO|VSARG2_MARK)
{
int ff=1;
int currIndex;
_str name='', fullPath='';
int treeWid=p_window_id;
for (;;ff=0)
{
int index=_TreeFindSelected(ff);
if (index<0) break;
if (getTreeFile(treeWid, index, name, fullPath))
{
continue;
}
_str new_filename;
if (get_string(new_filename, "Enter a filename", "", fullPath) == 0)
{
edit(fullPath);
if (close_buffer() == 0)
{
if (copy_file(fullPath, new_filename) == 0)
{
delete_file(fullPath);
}
reload_current_project();
}
}
break;
}
}