SlickEdit Community
SlickEdit Product Discussion => SlickEdit® => Topic started by: Graeme on November 13, 2014, 11:20:14 AM
-
I opened a new workspace and found all my floating toolwindows disappeared. I don't particularly want to have to re-open, re-size and re-position all my floating toolwindows every time I create a new workspace or open one that I haven't opened with slick V19 before. In my opinion this should be optional or slick should allow you to save and restore toolwindow layouts.
-
Can't reproduce this problem now. Opening "legacy" workspaces or creating a new one leaves the toolwindows as they are which is exactly what I want. What I would also like is the ability to hide all my floating toolwindows with a single command, and another command to bring them all back. "Hide when application is inactive" doesn't solve this because I sometimes want all my toolwindows hidden when slick has the focus.
...Later - looks like the commands save_named_state and load_named_state can be adapted to do this, just need to make load_named_state not restore buffers. The code below seems to (mostly) work - but has to be added to restore.e because there's no access to the restore2 function. If you have any floating edit windows there are some problems - they reappear with no buffer open, you can open one but the slick command line window won't open at the bottom and if you have a floating edit window already open it gets hidden behind the toolwindows. save_named_state and load_named_state don't have these problems.
static _str _load_named_layout_callback(int reason, var result, _str key)
{
_nocheck _control _sellist;
_nocheck _control _sellistok;
if (key == 4) {
item := _sellist._lbget_text();
filename := _ConfigPath():+'windowstate_nobuffers.slk';
status := _ini_delete_section(filename,item);
if ( !status ) {
_sellist._lbdelete_item();
}
}
return "";
}
_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);
}
_command void save_named_layout(_str sectionName="") name_info(',')
{
filename := _ConfigPath():+'windowstate_nobuffers.slk';
if ( sectionName=="" ) {
_ini_get_sections_list(filename,auto sectionList);
result := "";
if ( sectionList==null ) {
// If there are no section names stored already,
// just prompt for a name.
result = textBoxDialog("Save Named State",
0,
0,
"Save Named State",
"",
"",
"Save Named State");
if ( result==COMMAND_CANCELLED_RC ) {
return;
}
result = _param1;
} else {
// If there are names, show the list with a combobox
// so they can pick or type a new name.
result = show('-modal _sellist_form',
"Save Named State",
SL_SELECTCLINE|SL_COMBO,
sectionList,
"Save,&Delete", // Buttons
"Save Named State", // Help Item
"", // Font
_load_named_layout_callback
);
}
if ( result=="" ) return;
sectionName = result;
}
int orig_view_id=_create_temp_view(auto state_view_id);
p_window_id=orig_view_id;
save_window_config(true,state_view_id);
p_window_id=orig_view_id;
int status=_ini_put_section(filename,sectionName,state_view_id);
}