Author Topic: Addition of save_named_layout, load_named_layout commands  (Read 1582 times)

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Addition of save_named_layout, load_named_layout commands
« on: September 05, 2015, 06:39:29 AM »
I'd like to request the addition of save_named_layout, load_named_layout functions along the lines of the existing macros save_named_state and load_named_state.  I use a version of save_named_layout as below which differs from save_named_state only in the call to restore2 (plus the .slk filename)which sets the third argument false to stop files/buffers from being restored.
Also it would be useful to have some comments added to save_named_state to explain what it does ... plus, it doesn't restore a docked defs tool-window correctly for me.  It's still useful though.

Code: [Select]
_command void load_named_layout(_str sectionName="") name_info(',')
{
   filename := _ConfigPath():+'windowstate_nobuffers.slk';
   if ( sectionName=="" ) {
      _ini_get_sections_list(filename,auto sectionList);
      result := show('-modal _sellist_form',
                     "Load Named State",
                     SL_SELECTCLINE,
                     sectionList,
                     "Load,&Delete",     // Buttons
                     "Load Named State", // Help Item
                     "",                 // Font
                     _load_named_layout_callback
                     );
      if ( result=="" ) {
         return;
      }
      sectionName = result;
   }
   status := _ini_get_section(filename,sectionName,auto tempWID);
   if ( status ) return ;
   origWID := p_window_id;
   p_window_id = tempWID;
   //_close_all2();
   //p_window_id = tempWID;
   restore2('', '', false, true, true);
   if ( _iswindow_valid(origWID) ) {
      p_window_id = origWID;
   }
   _delete_temp_view(tempWID);
}