Subversion Repositories Filer-Free

Rev

Rev 45 | Rev 55 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 45 Rev 53
Line 338... Line 338...
338
        // Fetch layout.
338
        // Fetch layout.
339
        layout_method& layout=options().layout();
339
        layout_method& layout=options().layout();
340
        int xgap=layout.xgap();
340
        int xgap=layout.xgap();
341
        int ygap=layout.ygap();
341
        int ygap=layout.ygap();
342
 
342
 
-
 
343
        // Window will automatically resize if visible area matches extent.
-
 
344
        wimp_window_info winfo;
-
 
345
        get_window_info_header(winfo);
-
 
346
        int xauto=(winfo.xscroll==0)&&
-
 
347
                (winfo.visible.x1-winfo.visible.x0==winfo.extent.x1-winfo.extent.x0);
-
 
348
        int yauto=(winfo.yscroll==0)&&
-
 
349
                (winfo.visible.y1-winfo.visible.y0==winfo.extent.y1-winfo.extent.y0);
-
 
350
 
343
        // Calculate cell size.  This must be able to accommodate
351
        // Calculate cell size.  This must be able to accommodate
344
        // - the minimum cell size for the chosen layout, and
352
        // - the minimum cell size for the chosen layout, and
345
        // - the actual size occupied by each file to be listed.
353
        // - the actual size occupied by each file to be listed.
346
        os_coord csize=layout.min_size(_options);
354
        os_coord csize=layout.min_size(_options);
347
        for (unsigned int i=0;i!=_directory.size();++i)
355
        for (unsigned int i=0;i!=_directory.size();++i)
Line 354... Line 362...
354
        // Apply the calculated cell size.
362
        // Apply the calculated cell size.
355
        _xcsize=csize.x;
363
        _xcsize=csize.x;
356
        _ycsize=csize.y;
364
        _ycsize=csize.y;
357
 
365
 
358
        // Determine number of rows and columns.
366
        // Determine number of rows and columns.
-
 
367
        if (xauto&&(_yccount<2))
-
 
368
        {
-
 
369
                _xccount=(_directory.size()<4)?_directory.size():4;
-
 
370
        }
-
 
371
        else
-
 
372
        {
359
        _xccount=xsize/(_xcsize+xgap);
373
                _xccount=xsize/(_xcsize+xgap);
-
 
374
        }
360
        if (_xccount<1) _xccount=1;
375
        if (_xccount<1) _xccount=1;
361
        _yccount=(_directory.size()+_xccount-1)/_xccount;
376
        _yccount=(_directory.size()+_xccount-1)/_xccount;
362
        if (_yccount<1) _yccount=1;
377
        if (_yccount<1) _yccount=1;
363
 
378
 
364
        // Calculate new extent.
379
        // Calculate new extent.
Line 384... Line 399...
384
        extent.x1=extent_xsize;
399
        extent.x1=extent_xsize;
385
        extent.y1=0;
400
        extent.y1=0;
386
        set_extent(extent);
401
        set_extent(extent);
387
}
402
}
388
 
403
 
-
 
404
void filer_window::set_extent(const os_box& extent)
-
 
405
{
-
 
406
        // Window will automatically resize if visible area matches extent.
-
 
407
        wimp_window_info winfo;
-
 
408
        get_window_info_header(winfo);
-
 
409
        int xauto=(winfo.xscroll==0)&&
-
 
410
                (winfo.visible.x1-winfo.visible.x0==winfo.extent.x1-winfo.extent.x0);
-
 
411
        int yauto=(winfo.yscroll==0)&&
-
 
412
                (winfo.visible.y1-winfo.visible.y0==winfo.extent.y1-winfo.extent.y0);
-
 
413
 
-
 
414
        // Set the new extent.
-
 
415
        window::set_extent(extent);
-
 
416
 
-
 
417
        // Open the window.
-
 
418
        wimp_open open;
-
 
419
        open.visible=winfo.visible;
-
 
420
        open.xscroll=winfo.xscroll;
-
 
421
        open.yscroll=winfo.yscroll;
-
 
422
        open.next=winfo.next;
-
 
423
 
-
 
424
        // If automatically resizing then adjust visible area to match extent.
-
 
425
        int reopen=0;
-
 
426
        if (xauto&&(winfo.visible.x1-winfo.visible.x0!=extent.x1-extent.x0))
-
 
427
        {
-
 
428
                open.visible.x1=open.visible.x0+(extent.x1-extent.x0);
-
 
429
                reopen=1;
-
 
430
        }
-
 
431
        if (yauto&&(open.visible.y1-open.visible.y0!=extent.y1-extent.y0))
-
 
432
        {
-
 
433
                open.visible.y0=open.visible.y1-(extent.y1-extent.y0);
-
 
434
                reopen=1;
-
 
435
        }
-
 
436
        if (reopen) open_window(open);
-
 
437
}
-
 
438
 
389
unsigned int filer_window::find_cell(const os_coord& p)
439
unsigned int filer_window::find_cell(const os_coord& p)
390
{
440
{
391
        layout_method& layout=options().layout();
441
        layout_method& layout=options().layout();
392
        int xgap=layout.xgap();
442
        int xgap=layout.xgap();
393
        int ygap=layout.ygap();
443
        int ygap=layout.ygap();