Subversion Repositories Filer-Free

Compare Revisions

Ignore whitespace Rev 34 → Rev 35

7,6 → 7,7
#include "directory.h"
#include "auto_pos.h"
#include "window.h"
#include "filer_options.h"
42,6 → 43,10
/** The index of the cell temporarily selected while a menu is open,
* or directory::npos if none. */
directory::size_type _temp_selection;
/** The position at which a filer window for a subdirectory will be
* opened. */
auto_pos _auto_pos;
/** Construct filer window.
* @param app the application to which this filer window belongs
143,6 → 148,17
* corner of this one
void open_parent(const os_coord& offset) const;
/** Run object
* Note that setting the close parameter does not actually cause
* the parent window to be closed, however the information is
* needed because it affected the location at which a child
* directory is opened.
* @param info the directory entry for the object to be run
* @param close true if the parent window is to be closed, otherwise false
* @param shift true if shift was pressed, otherwise false
void run(osgbpb_info& info,int close,int shift);
4,13 → 4,39
// GNU General Public License (version 2 or any later version).
#include <cstring>
#include <cstdio>
#include "oslib/osbyte.h"
#include "oslib/wimp.h"
#include "template_loader.h"
#include "layout_method.h"
#include "filer_menu.h"
#include "filer_window.h"
#include "filer_application.h"
namespace {
/** The maximum length of a leafname. */
const size_t max_name_length=256;
/** The initial horizontal offset for opening a subdirectory. */
const int open_xstart=20;
/** The initial vertical offset for opening a subdirectory. */
const int open_ystart=-32;
/** The horizontal offset between subdirectories. */
const int open_xstep=20;
/** The vertical offset between subdirectories. */
const int open_ystep=0;
/** The number of distinct subdirectory offsets. */
const unsigned int open_count=8;
}; /* anonymous namespace */
filer_window::filer_window(filer_application* app,const char* pathname,
const os_box& box,const filer_options& options):
21,7 → 47,8
// Copy pathname into buffer owned by this object.
169,9 → 196,15
// Fetch layout.
layout_method& layout=options().layout();
// Read shift state.
int shift_state=0;
int shift=(shift_state&0x08)!=0;
// Find cell under pointer.
unsigned int index=find_cell(block.pos);
bool close=false;
if (block.buttons==wimp_CLICK_MENU)
// Any existing menu will be deleted by this action.
197,6 → 230,17
else if (block.buttons&(wimp_DOUBLE_ADJUST|wimp_DOUBLE_SELECT))
// If double click within a cell then run that object.
if (index!=directory::npos)
if (close) close_window();
else if (block.buttons&(wimp_SINGLE_SELECT|wimp_SINGLE_ADJUST))
// If single select click then first de-select everything.
209,6 → 253,10
// If this window has closed as a result of the mouse event
// then delete it.
if (close) delete this;
void filer_window::handle_menus_deleted()
409,3 → 457,47
void filer_window::run(osgbpb_info& info,int close,int shift)
// Need to at least partially handle shift key here, because
// Filer_Run does not allow coordinates to be specified when
// shift-clicking an application directory.
// (... unless there is an alternative way to invoke Filer_Run?)
static char buffer[12+max_name_length];
if ((info.obj_type&fileswitch_IS_DIR)&&(([0]!='!')||shift))
// Get dimensions of this window.
wimp_window_state state;
// Choose coordinates for new window.
// If closing this window then open in same position,
// otherwise open below and to the right.
os_coord offset=_auto_pos();
os_box box;
// Open new window.
if (std::strlen(_pathname)+std::strlen(<max_name_length)
window* w=new filer_window(
// Run object.
if (std::strlen(_pathname)+std::strlen(<max_name_length)
std::sprintf(buffer,"Run %s.%s",_pathname,;