Ok, here's what will be in 12.02. I opted for a single command called new_window_size which allows you to configure the size of newly created windows. It will be accessible from the Window menu since that seemed like the most logical place for it to go.
As a test, I wrote a sample callback which is a complete replacement for the C code which handles custom settings. If you want to enhance how the custom settings work, this will probably be helpful:
#include "slick.sh"
void _cbget_new_window_size(int &x,int &y,int &width,int &height) {
/*
Warning: p_window_id is set to the instance of the new window. However,
most window properties are not set yet. This is because select_edit_mode
has not been called yet. The p_buf_name and p_buf_id are set.
IMPORTANT: At the time of this call the system window (HWND or X Window)
has NOT been created yet. Therefore you can not do any font calculations
against the current window. Creating temp views does not help either
because no system window is created.
Doing font calculations is not yet supported. The #if zero'd code below
is pretty close to getting the right font all the time.
*/
// IF there are now previous values
if (x<0) {
x=0;y=0; // Start at the top left corner.
} else {
// Choose some system metrics for cascading the windows.
int adjust_x=GetSystemMetrics(VSM_CXVSCROLL)+GetSystemMetrics(VSM_CXDLGFRAME);
int adjust_y=GetSystemMetrics(VSM_CYCAPTION)+GetSystemMetrics(VSM_CYDLGFRAME);
x+=adjust_x;
y+=adjust_y;
}
// A negative width or height means use as must space as possible.
// No need to handle negative values here. Just return them.
// No need to worry about with or height larger than client area.
// This will be adjust if necessary later.
width=_default_option(VSOPTION_NEW_WINDOW_WIDTH);
height=_default_option(VSOPTION_NEW_WINDOW_HEIGHT);
#if 0
int orig_wid=p_window_id;
// Carefully use the hidden window
_safe_hidden_window();
// To attempt to determine whether this file is a SBCS/DBCS or
// Unicode file, jump through some hoops. This code won't work
// if the user overrided the default mode selection code.
int temp_wid;
boolean utf8;
_create_temp_view(temp_wid,'',orig_wid.p_buf_name,true);
utf8=p_UTF8;
//say('utf8='utf8);
_delete_temp_view(temp_wid);
// This code assumes the font being used is for SBCS/DBCS mode source and
// will not work for Unicode/Xml files.
_str font_info=utf8?_default_font(CFG_UNICODE_SOURCE_WINDOW):_default_font(CFG_SBCS_DBCS_SOURCE_WINDOW);
parse font_info with font_name ',' font_size ',' font_flags ','charset ',' ;
if (!isinteger(charset)) charset=VSCHARSET_DEFAULT;
p_redraw=0;
p_font_name=font_name;p_font_size=font_size;
p_font_bold=font_flags & F_BOLD;p_font_italic= font_flags & F_ITALIC;
p_font_underline= font_flags & F_UNDERLINE;p_font_strike_thru=font_flags&F_STRIKE_THRU;
p_font_charset=charset;
p_redraw=1;
width=_default_option('R');
if (!width) {
width=700; // user can set this if not using Vertical
// line column
} else {
//We need to convert the columns to p_xyscale_mode
width+=4; // This is to accomodate for the width of the window.
width+=8; // Make a bit wider, adjust extra columns to taste.
col=width*p_font_width;
width=col;
}
activate_window(orig_wid);
//say('width='width);
#endif
}