Author Topic: EnhProj - Enhanced Open File dialog (fast even for large workspaces)  (Read 19448 times)

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
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 5 tabs:  Smart (combine the lists from the Any and Workspace tabs), Any (list files relative to current working directory), Project (list files from the current project), Workspace (list files from the current workspace), and History (list the recently opened files).
  • There is only one column, which allows the list to show as much of the path as possible.
  • Shows the OS file icons for each file, and the icons are retrieved on a background thread for optimal performance.
  • The list is automatically filtered as you type:  by default it performs a sub-string match for the filename.  If you type a path portion as well as a filename portion, then a suffix match is used for the path portion and a prefix match is used for the filename portion.  See the Readme file for some examples.
  • Filtering allows * and ? wildcards.  Star (*) matches any number of characters, and question mark (?) matches any one character.  No need to learn a special syntax, it just uses normal file system wildcards.

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, but I'm starting a new topic in the new "SlickEdit User Macros" forum).
« Last Edit: June 28, 2009, 07:10:42 PM by chrisant »

mikesart

  • Community Member
  • Posts: 56
  • Hero Points: 11
Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
« Reply #1 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.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
« Reply #2 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.

mikesart

  • Community Member
  • Posts: 56
  • Hero Points: 11
Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
« Reply #3 on: March 30, 2009, 08:37:19 PM »
Ah, ok. Gotcha. I'm an idiot. set-var works great.

Thanks a ton Chrisant.

mikesart

  • Community Member
  • Posts: 56
  • Hero Points: 11
Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
« Reply #4 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.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
« Reply #5 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.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Update:
  • Fixed refreshing the project file list when changing projects.
  • Added a History tab that lists the most recently opened files.
  • Added Ctrl+O shortcut to open the GUI file open dialog.
  • Added configuration setting for paths to default to sub-string searches (normally the file part uses a sub-string search, and the path part uses a suffix search).
  • Minor internal changes.

The updated version is available in the first post here.

flash392

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
« Reply #7 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

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
« Reply #8 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.

flash392

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: EnhProj - Enhanced Open File dialog (fast even for large workspaces)
« Reply #9 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.