SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => SlickEdit User Macros => Topic started by: chrisant on March 27, 2009, 08:53:47 AM

Title: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: chrisant on March 27, 2009, 08:53:47 AM
EnhProj is similar to the new smart_open toolbar in SE.

EnhProj is a macro + DLL, so unfortunately it only works on Windows.
EnhProj is compatible with SE12 through SE14.

See the Readme.htm file for installation and usage instructions.

The new enhOpen command pops up an Open File dialog that is similar to the Files toolbar and the Open toolbar, but has some key differences:

There are a few configuration settings available.
See the Readme file in the ZIP file for more information.

Full source code for the DLL is included, but there is no makefile/etc.  If you want to build it, you'll need to set that stuff up yourself (the only slightly atypical thing is that you'll need to preprocess the manifest.xml file to get the version number filled in properly).


(The original posting for the macro was here (http://community.slickedit.com/index.php?topic=3880.0), but I'm starting a new topic in the new "SlickEdit User Macros" forum).
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: mikesart on March 30, 2009, 06:05:16 PM
I'm running into an oddity that I'm not sure is enhProj's issue, but I'll post here because enhProj is what I'm seeing it with. I'm using SlickEdit Version 14.0.0.7 (Windows, obviously).

I changed enhproj_ofd_which_list in enhproj.e to MODE_WORKSPACE as follows:

Code: [Select]
static _str s_fDllLoaded = false;
int enhproj_ofd_which_list = MODE_WORKSPACE;  // -1 = remember across editor sessions, else a MODE_xyz value.
int enhproj_ofd_remembered_list = MODE_WORKSPACE; // a MODE_xyz value

But no matter what I did (hit F12, del enhproj.ex, etc.) enhOpen was still coming up with the project tab. I stuck the following say() command in enhproj.e:

Code: [Select]
   FlatFile_SetMode( mode );
say('mode = ' mode);
   EnhProjDll_SetOfdPos( enhproj_ofd_x, enhproj_ofd_y, enhproj_ofd_cx, enhproj_ofd_cy );

And "mode = 2" is always being spewed. I tried exiting SlickEdit, deleting enhproj.ex, hitting F12 all with the same results. I changed enhproj_ofd_which_list to static:

Code: [Select]
static int enhproj_ofd_which_list = MODE_WORKSPACE;  // -1 = remember across editor sessions, else a MODE_xyz value.
Hit F12, and it is working like I'd expect. Not sure if this is expected behavior or not, but possibly this post might save some other folks a little bit of time.

And I love enhProj Chrisant. Blistering fast, wildcards, partial matching. It rocks. Thank you very much.
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: chrisant on March 30, 2009, 07:49:52 PM
I changed enhproj_ofd_which_list in enhproj.e to MODE_WORKSPACE as follows:

Code: [Select]
static _str s_fDllLoaded = false;
int enhproj_ofd_which_list = MODE_WORKSPACE;  // -1 = remember across editor sessions, else a MODE_xyz value.
int enhproj_ofd_remembered_list = MODE_WORKSPACE; // a MODE_xyz value

But no matter what I did (hit F12, del enhproj.ex, etc.) enhOpen was still coming up with the project tab.
Changing the value there changes the default value that will be used if the macro has never been loaded before.
It does not change the value that's actually remembered in the state file.

To change the value that's being used, use "set-var enhproj_ofd_which_list" and set it to the value you want.
See the comment at the top of the macro, that explains how to use/configure the macro.


I changed enhproj_ofd_which_list to static:

Code: [Select]
static int enhproj_ofd_which_list = MODE_WORKSPACE;  // -1 = remember across editor sessions, else a MODE_xyz value.
Hit F12, and it is working like I'd expect. Not sure if this is expected behavior or not, but possibly this post might save some other folks a little bit of time.
Making the variables static means you can't dynamically configure stuff anymore, you have to recompile to reconfigure.  I really wanted it to be simple, just a "set-var", to configure on the fly.


And I love enhProj Chrisant. Blistering fast, wildcards, partial matching. It rocks. Thank you very much.
Thanks, I'm glad it's being useful to others.
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: mikesart on March 30, 2009, 08:37:19 PM
Ah, ok. Gotcha. I'm an idiot. set-var works great.

Thanks a ton Chrisant.
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: mikesart on April 10, 2009, 05:55:52 PM
I've run into a problem where when I switch workspaces, the workspace file list isn't updated. For example, I have device.cpp in project1/workspace1 and device.cpp in project2/workspace2 and when I switch workspaces and go to open that file, I'll get the device.cpp from the previous workspace. LIST_WORKSPACE is set as my default list. I've worked around this by adding some code to EnhProj_RefreshWorkspaceFiles as follows:

Code: [Select]
_str g_last_workspace_filename = '';

void EnhProj_RefreshWorkspaceFiles()
{
   if ( _workspace_filename != '' )
   {
      int ii;
      _str projects[] = null;
      _str mostRecentProjectFile = '';
      boolean fRefresh = !FlatFile_Count( LIST_WORKSPACE );

      if (!g_last_workspace_filename || (g_last_workspace_filename != _workspace_filename))
      {
         fRefresh = true;
         g_last_workspace_filename = _workspace_filename;
      }

      _GetWorkspaceFiles( _workspace_filename, projects );

Pretty sure that isn't how it should be solved for realsies, but it's going good for me right now.
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: chrisant on April 10, 2009, 06:45:21 PM
Doh!  MarkSun had pointed that out to me in my office the other day (he's on the floor below me) and I took a quick look yesterday but the timestamp checks all seemed correct to me.  Of course, they are, but as you've shown the problem is I was only checking timestamps and not also the project/workspace name.  :-[  Thanks for pointing it out, I'll post an update later.
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: chrisant on May 31, 2009, 12:34:29 AM
Update:

The updated version is available in the first post here (http://community.slickedit.com/index.php?topic=4642.msg19040#msg19040).
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: flash392 on June 28, 2009, 08:51:02 AM
This is really awesome.  Thanks for puttin it together.  I did have one question.  When I first loaded it up it said Identifier 'FILEHIST_CATEGORY' not declared.  So I just added the _str to the file and it works great.  I'm not sure if this is right or should I have this declared elsewhere?  I'm kind of new to slickedit so its quite possible I'm missing something easy.  I'm using version 13.0.2.0.

Thanks,
Bryan
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: chrisant on June 28, 2009, 07:10:58 PM
...  When I first loaded it up it said Identifier 'FILEHIST_CATEGORY' not declared.  So I just added the _str to the file and it works great.  I'm not sure if this is right or should I have this declared elsewhere?  I'm kind of new to slickedit so its quite possible I'm missing something easy.  I'm using version 13.0.2.0.

That will allow it to compile, but naturally it won't work properly (particularly the History tab).  The FILEHIST_CATEGORY identifier gets #import'ed from the "menu.e" file, but it turns out it was introduced in SE14 and doesn't exist in SE13.

Thanks for catching this.  I've posted an update (see post #1) that fixes compatibility with SE13, and also fixes the case insensitive sort.
Title: Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
Post by: flash392 on June 29, 2009, 02:20:58 AM
Thanks for such a fast response and fix.

This is very similar to Visual Assists file opener for Visual Studio. Theres a couple nice features that it has.  If you're open to some suggestions, the two things I really like are:

1. When you open it up again, it has your previous string entered.  Its also highlighted so you wont have to hit any extra keys if you want something completely different.

2. You can add multiple words and the - option.  Like "abc word" would be the equivalent in yours of "abc*word" and also supports "abc -word" so you can exclude words.

Thanks again for this awesome macro.