SlickEdit Product Discussion > SlickEditĀ®

Question about auto restore of files

<< < (3/3)


--- Quote from: ScottW, Dir of Development on July 26, 2006, 06:31:04 pm --- ...

* Optionally, add a checkbox labelled, "Keep files open during editing session". When checked, all files open during that session will be open until closed, even if you switch workspaces. Would anyone ever use this? I wouldn't....

--- End quote ---
Yes, I would. For some larger projects I have two different workspaces, both with two projects. The smallest contains my current module(s) in one project, to be able to limit search-and-replace to just my module. The rest of my team's work is in another project for tagging purposes. The complete system is out of sight.
The other workspace contains one project with my team's work, including my newest module(s), and the full system in a second project.
Regularly, I switch between the two workspaces, but not between two sets of assignments. I'd be very happy if my workspace files (or any open file for that matter) would remain open when switching, since I only need to switch workspaces to enlarge or reduce the scope of global operations (a regular expression search in the complete system takes several minutes at best, in my team's software a few seconds...).

I've tried several combinations of options already, but couldn't find a satisfactory solution. And since you asked for feedback...



Was a nice little challenge - especially to find out the proper Slick-callbacks ;)
Try this, should work and hope it helps a bit.
(It's more or less derived from list_buffers().)


--- Code: ---static typeless prj_buflist[];

void _sr_jbezem()
   // just as an example ('Cancel' button allows ESC to bail out)
   int result=_message_box(nls("\nDo you want to restore curr. open files later on ?\n\n"), nls("Closing workspace '%s' ?" ,strip_filename (_workspace_filename, 'PD')),MB_YESNOCANCEL|MB_ICONQUESTION);
   if (result == IDYES) save_buflist();
   else prj_buflist._makeempty();
void _prjopen_jbezem ()

void save_buflist()
   int width = 0;
   _str result = '';

   int temp_view_id=0;
   int orig_view_id=_create_temp_view(temp_view_id);


   for (;;)
      get_line (result);
      prj_buflist [ prj_buflist._length() ] = result;

      if (down()) break;

void restore_buflist()
   typeless status=0;
   typeless buf_id=0;
   _str result = '';
   int i;
   for ( i = prj_buflist._length() -1; i >= 0; i-- )
      result = _buflist_name( prj_buflist [ i ] );

      if ( _isno_name(result) )
         parse result with '<' buf_id'>';
         _macro_call('edit','+li 'buf_id);
         status=edit('+li 'buf_id);
         _macro_call('edit','+l 'result);
         status=edit('+l 'result);
      if ( ! status )
         p_buf_flags=p_buf_flags & (~VSBUFFLAG_HIDDEN);
         if ( p_window_state=='I' ) p_window_state='N';

--- End code ---


[0] Message Index

[*] Previous page

Go to full version