Subversion Repositories Filer-Free

Compare Revisions

Ignore whitespace Rev 52 → Rev 53

/trunk/filer/filer_window.h
120,6 → 120,14
*/
void reformat(int xsize);
 
/** Set extent of work area.
* If the extent of the visible area matches the extent of the work
* area (in one or both directions) then the visible area is resized
* automatically to match the work area (in the directions that match).
* @param extent the required extent
*/
void set_extent(const os_box& extent);
 
/** Find the cell which contains a given point.
* @param p the point to be found
* @return the cell index if found, otherwise npos
/trunk/filer/filer_window.cc
340,6 → 340,14
int xgap=layout.xgap();
int ygap=layout.ygap();
 
// Window will automatically resize if visible area matches extent.
wimp_window_info winfo;
get_window_info_header(winfo);
int xauto=(winfo.xscroll==0)&&
(winfo.visible.x1-winfo.visible.x0==winfo.extent.x1-winfo.extent.x0);
int yauto=(winfo.yscroll==0)&&
(winfo.visible.y1-winfo.visible.y0==winfo.extent.y1-winfo.extent.y0);
 
// Calculate cell size. This must be able to accommodate
// - the minimum cell size for the chosen layout, and
// - the actual size occupied by each file to be listed.
356,7 → 364,14
_ycsize=csize.y;
 
// Determine number of rows and columns.
_xccount=xsize/(_xcsize+xgap);
if (xauto&&(_yccount<2))
{
_xccount=(_directory.size()<4)?_directory.size():4;
}
else
{
_xccount=xsize/(_xcsize+xgap);
}
if (_xccount<1) _xccount=1;
_yccount=(_directory.size()+_xccount-1)/_xccount;
if (_yccount<1) _yccount=1;
386,6 → 401,41
set_extent(extent);
}
 
void filer_window::set_extent(const os_box& extent)
{
// Window will automatically resize if visible area matches extent.
wimp_window_info winfo;
get_window_info_header(winfo);
int xauto=(winfo.xscroll==0)&&
(winfo.visible.x1-winfo.visible.x0==winfo.extent.x1-winfo.extent.x0);
int yauto=(winfo.yscroll==0)&&
(winfo.visible.y1-winfo.visible.y0==winfo.extent.y1-winfo.extent.y0);
 
// Set the new extent.
window::set_extent(extent);
 
// Open the window.
wimp_open open;
open.visible=winfo.visible;
open.xscroll=winfo.xscroll;
open.yscroll=winfo.yscroll;
open.next=winfo.next;
 
// If automatically resizing then adjust visible area to match extent.
int reopen=0;
if (xauto&&(winfo.visible.x1-winfo.visible.x0!=extent.x1-extent.x0))
{
open.visible.x1=open.visible.x0+(extent.x1-extent.x0);
reopen=1;
}
if (yauto&&(open.visible.y1-open.visible.y0!=extent.y1-extent.y0))
{
open.visible.y0=open.visible.y1-(extent.y1-extent.y0);
reopen=1;
}
if (reopen) open_window(open);
}
 
unsigned int filer_window::find_cell(const os_coord& p)
{
layout_method& layout=options().layout();