Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

Pane Struct Reference

child window pane for displaying file lists More...

#include <pane.h>

Inheritance diagram for Pane:
Inheritance graph
[legend]
Collaboration diagram for Pane:
Collaboration graph
[legend]

List of all members.

Public Types

typedef SubclassedWindow super

Public Member Functions

 Pane (HWND hparent, int id, int id_header, Entry *rool, bool treePane, int visible_cols)
 ~Pane ()
void init ()
void set_header ()
bool create_header (HWND parent, int id)
bool calc_widths (bool anyway)
void calc_single_width (int col)
void draw_item (LPDRAWITEMSTRUCT dis, Entry *entry, int calcWidthCol=-1)
int insert_entries (Entry *dir, int idx=-1)
BOOL command (UINT cmd)
virtual int Notify (int id, NMHDR *pnmh)

Public Attributes

int _widths [COLUMNS]
int _positions [COLUMNS+1]
WindowHandle _hwndHeader
Entry_root
Entry_cur
COLORREF _clrCompressed
int _visible_cols
bool _treePane

Protected Member Functions

virtual LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
void calc_width (LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
void calc_tabbed_width (LPDRAWITEMSTRUCT dis, int col, LPCTSTR str)
struct MainFrameBaseget_frame ()

Protected Attributes

HIMAGELIST _himl
OutputWorker _out_wrkr

Detailed Description

child window pane for displaying file lists

Definition at line 66 of file pane.h.


Member Typedef Documentation

Reimplemented from SubclassedWindow.

Definition at line 68 of file pane.h.


Constructor & Destructor Documentation

Pane::Pane ( HWND  hparent,
int  id,
int  id_header,
Entry rool,
bool  treePane,
int  visible_cols 
)

Definition at line 76 of file pane.cpp.

References _root, create_header(), init(), and insert_entries().

 :  super(CreateWindow(TEXT("ListBox"), TEXT(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
            LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
            0, 0, 0, 0, hparent, (HMENU)id, g_Globals._hInstance, 0)),
    _root(root),
    _visible_cols(visible_cols),
    _treePane(treePane)
{
     // insert entries into listbox
    Entry* entry = _root;

    if (entry)
        insert_entries(entry);

    init();

    create_header(hparent, id_header);
}

Here is the call graph for this function:

Pane::~Pane (  )

Definition at line 95 of file pane.cpp.

References _himl.

{
    ImageList_Destroy(_himl);
}

Member Function Documentation

void Pane::calc_single_width ( int  col )

Definition at line 726 of file pane.cpp.

References OutputWorker::_hfont, WindowHandle::_hwnd, _out_wrkr, _positions, OutputWorker::_spaceSize, _widths, COLUMNS, draw_item(), and IMAGE_WIDTH.

Referenced by Notify().

{
    HFONT hfontOld;
    int x, cx;
    int cnt;
    HDC hdc;

    int entries = ListBox_GetCount(_hwnd);

    _widths[col] = 0;

    hdc = GetDC(_hwnd);
    hfontOld = SelectFont(hdc, _out_wrkr._hfont);

    for(cnt=0; cnt<entries; cnt++) {
        Entry* entry = (Entry*) ListBox_GetItemData(_hwnd, cnt);

        DRAWITEMSTRUCT dis;

        dis.CtlType       = 0;
        dis.CtlID         = 0;
        dis.itemID        = 0;
        dis.itemAction    = 0;
        dis.itemState     = 0;
        dis.hwndItem      = _hwnd;
        dis.hDC           = hdc;
        dis.rcItem.left   = 0;
        dis.rcItem.top    = 0;
        dis.rcItem.right  = 0;
        dis.rcItem.bottom = 0;
        /*dis.itemData    = 0; */

        draw_item(&dis, entry, col);
    }

    SelectObject(hdc, hfontOld);
    ReleaseDC(_hwnd, hdc);

    cx = _widths[col];

    if (cx) {
        cx += 3*_out_wrkr._spaceSize.cx;

        if (cx < IMAGE_WIDTH)
            cx = IMAGE_WIDTH;
    }

    _widths[col] = cx;

    x = _positions[col] + cx;

    for(; col<COLUMNS; ) {
        _positions[++col] = x;
        x += _widths[col];
    }

    ListBox_SetHorizontalExtent(_hwnd, x);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Pane::calc_tabbed_width ( LPDRAWITEMSTRUCT  dis,
int  col,
LPCTSTR  str 
) [protected]

Definition at line 645 of file pane.cpp.

References _widths.

Referenced by draw_item().

{
    RECT rt = {0, 0, 0, 0};

/*  DRAWTEXTPARAMS dtp = {sizeof(DRAWTEXTPARAMS), 2};
    DrawTextEx(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX|DT_EXPANDTABS|DT_TABSTOP, &dtp);*/

    DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_EXPANDTABS|DT_TABSTOP|(2<<8));

    if (rt.right > _widths[col])
        _widths[col] = rt.right;
}

Here is the caller graph for this function:

void Pane::calc_width ( LPDRAWITEMSTRUCT  dis,
int  col,
LPCTSTR  str 
) [protected]

Definition at line 635 of file pane.cpp.

References _widths.

Referenced by draw_item().

{
    RECT rt = {0, 0, 0, 0};

    DrawText(dis->hDC, (LPTSTR)str, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX);

    if (rt.right > _widths[col])
        _widths[col] = rt.right;
}

Here is the caller graph for this function:

bool Pane::calc_widths ( bool  anyway )

Definition at line 181 of file pane.cpp.

References OutputWorker::_hfont, WindowHandle::_hwnd, _out_wrkr, _positions, OutputWorker::_spaceSize, _widths, COLUMNS, draw_item(), and IMAGE_WIDTH.

Referenced by FileChildWindow::activate_entry(), command(), FileChildWindow::expand_entry(), init(), FileChildWindow::jump_to_int(), FileChildWindow::scan_entry(), and FileChildWindow::set_curdir().

{
    int col, x, cx, spc=3*_out_wrkr._spaceSize.cx;
    int entries = ListBox_GetCount(_hwnd);
    int orgWidths[COLUMNS];
    int orgPositions[COLUMNS+1];
    HFONT hfontOld;
    HDC hdc;
    int cnt;

    if (!anyway) {
        memcpy(orgWidths, _widths, sizeof(orgWidths));
        memcpy(orgPositions, _positions, sizeof(orgPositions));
    }

    for(col=0; col<COLUMNS; col++)
        _widths[col] = 0;

    hdc = GetDC(_hwnd);
    hfontOld = SelectFont(hdc, _out_wrkr._hfont);

    for(cnt=0; cnt<entries; cnt++) {
        Entry* entry = (Entry*) ListBox_GetItemData(_hwnd, cnt);

        DRAWITEMSTRUCT dis;

        dis.CtlType       = 0;
        dis.CtlID         = 0;
        dis.itemID        = 0;
        dis.itemAction    = 0;
        dis.itemState     = 0;
        dis.hwndItem      = _hwnd;
        dis.hDC           = hdc;
        dis.rcItem.left   = 0;
        dis.rcItem.top    = 0;
        dis.rcItem.right  = 0;
        dis.rcItem.bottom = 0;
        /*dis.itemData    = 0; */

        draw_item(&dis, entry, COLUMNS);
    }

    SelectObject(hdc, hfontOld);
    ReleaseDC(_hwnd, hdc);

    x = 0;
    for(col=0; col<COLUMNS; col++) {
        _positions[col] = x;
        cx = _widths[col];

        if (cx) {
            cx += spc;

            if (cx < IMAGE_WIDTH)
                cx = IMAGE_WIDTH;

            _widths[col] = cx;
        }

        x += cx;
    }

    _positions[COLUMNS] = x;

    ListBox_SetHorizontalExtent(_hwnd, x);

     // no change?
    if (!memcmp(orgWidths, _widths, sizeof(orgWidths)))
        return FALSE;

     // don't move, if only collapsing an entry
    if (!anyway && _widths[0]<orgWidths[0] &&
        !memcmp(orgWidths+1, _widths+1, sizeof(orgWidths)-sizeof(int))) {
        _widths[0] = orgWidths[0];
        memcpy(_positions, orgPositions, sizeof(orgPositions));

        return FALSE;
    }

    InvalidateRect(_hwnd, 0, TRUE);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL Pane::command ( UINT  cmd )

Definition at line 942 of file pane.cpp.

References MenuInfo::_hMenuView, WindowHandle::_hwnd, _visible_cols, calc_widths(), COL_ALL, Frame_GetMenuInfo, ID_PREFERED_SIZES, ID_VIEW_ALL_ATTRIBUTES, ID_VIEW_NAME, ID_VIEW_SELECTED_ATTRIBUTES, and set_header().

Referenced by FileChildWindow::WndProc().

{
    switch(cmd) {
        case ID_VIEW_NAME:
            if (_visible_cols) {
                _visible_cols = 0;
                calc_widths(true);
                set_header();
                InvalidateRect(_hwnd, 0, TRUE);
                MenuInfo* menu_info = Frame_GetMenuInfo(GetParent(_hwnd));
                if (menu_info) {
                    CheckMenuItem(menu_info->_hMenuView, ID_VIEW_NAME, MF_BYCOMMAND|MF_CHECKED);
                    CheckMenuItem(menu_info->_hMenuView, ID_VIEW_ALL_ATTRIBUTES, MF_BYCOMMAND);
                    CheckMenuItem(menu_info->_hMenuView, ID_VIEW_SELECTED_ATTRIBUTES, MF_BYCOMMAND);
                }
            }
            break;

        case ID_VIEW_ALL_ATTRIBUTES:
            if (_visible_cols != COL_ALL) {
                _visible_cols = COL_ALL;
                calc_widths(true);
                set_header();
                InvalidateRect(_hwnd, 0, TRUE);
                MenuInfo* menu_info = Frame_GetMenuInfo(GetParent(_hwnd));
                if (menu_info) {
                    CheckMenuItem(menu_info->_hMenuView, ID_VIEW_NAME, MF_BYCOMMAND);
                    CheckMenuItem(menu_info->_hMenuView, ID_VIEW_ALL_ATTRIBUTES, MF_BYCOMMAND|MF_CHECKED);
                    CheckMenuItem(menu_info->_hMenuView, ID_VIEW_SELECTED_ATTRIBUTES, MF_BYCOMMAND);
                }
            }
            break;

        case ID_PREFERED_SIZES: {
            calc_widths(true);
            set_header();
            InvalidateRect(_hwnd, 0, TRUE);
            break;}

                /*@todo more command ids... */

        default:
            return FALSE;
    }

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Pane::create_header ( HWND  parent,
int  id 
)

Definition at line 130 of file pane.cpp.

References ExplorerGlobals::_hInstance, _hwndHeader, _widths, COLUMNS, g_Globals, and HWND.

Referenced by Pane().

{
    HWND hwnd = CreateWindow(WC_HEADER, 0, WS_CHILD|WS_VISIBLE|HDS_HORZ/*@todo |HDS_BUTTONS + sort orders*/,
                                0, 0, 0, 0, hparent, (HMENU)id, g_Globals._hInstance, 0);
    if (!hwnd)
        return false;

    SetWindowFont(hwnd, GetStockFont(DEFAULT_GUI_FONT), FALSE);

    HD_ITEM hdi;

    hdi.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;

    for(int idx=0; idx<COLUMNS; idx++) {
        hdi.pszText = g_pos_names[idx];
        hdi.fmt = HDF_STRING | g_pos_align[idx];
        hdi.cxy = _widths[idx];
        Header_InsertItem(hwnd, idx, &hdi);
    }

    _hwndHeader = hwnd;

    return true;
}

Here is the caller graph for this function:

void Pane::draw_item ( LPDRAWITEMSTRUCT  dis,
Entry entry,
int  calcWidthCol = -1 
)

Todo:
not in every case time enough

Definition at line 301 of file pane.cpp.

References Entry::_bhfi, Entry::_bhfi_valid, _clrCompressed, Entry::_content, Entry::_data, Entry::_display_name, Entry::_down, Entry::_expanded, _himl, ExplorerGlobals::_icon_cache, Entry::_icon_id, Entry::_level, Entry::_next, _out_wrkr, _positions, OutputWorker::_spaceSize, _stprintf, _treePane, Entry::_type_name, Entry::_up, _visible_cols, _widths, ATTRIBUTE_EXECUTABLE, ATTRIBUTE_SYMBOLIC_LINK, BUFFER_LEN, calc_tabbed_width(), calc_width(), COL_ATTRIBUTES, COL_CONTENT, COL_INDEX, COL_LINKS, COL_SIZE, COL_TYPE, COLUMNS, Icon::draw(), FILE_ATTRIBUTE_ENCRYPTED, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, FILE_ATTRIBUTE_REPARSE_POINT, FILE_ATTRIBUTE_SPARSE_FILE, g_Globals, IconCache::get_icon(), ICID_NONE, IMAGE_HEIGHT, IMAGE_WIDTH, IMG_DOCUMENT, IMG_EXECUTABLE, IMG_FILE, IMG_FOLDER, IMG_FOLDER_CUR, IMG_FOLDER_UP, IMG_NONE, IMG_OPEN_FOLDER, LONGLONGARG, OutputWorker::output_number(), OutputWorker::output_tabbed_text(), OutputWorker::output_text(), and TEXT.

Referenced by calc_single_width(), calc_widths(), and FileChildWindow::WndProc().

{
    TCHAR buffer[BUFFER_LEN];
    DWORD attrs;
    int visible_cols = _visible_cols;
    COLORREF bkcolor, textcolor;
    RECT focusRect = dis->rcItem;
    enum IMAGE img;
    int img_pos, cx;
    int col = 0;

    if (entry) {
        attrs = entry->_data.dwFileAttributes;

        if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
            if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('.')
                    && entry->_data.cFileName[2]==TEXT('\0'))
                img = IMG_FOLDER_UP;
            else if (entry->_data.cFileName[0]==TEXT('.') && entry->_data.cFileName[1]==TEXT('\0'))
                img = IMG_FOLDER_CUR;
            else if ((_treePane && (dis->itemState&ODS_FOCUS)))
                img = IMG_OPEN_FOLDER;
            else
                img = IMG_FOLDER;
        } else {
            if (attrs & ATTRIBUTE_EXECUTABLE)
                img = IMG_EXECUTABLE;
            else if (entry->_type_name)
                img = IMG_DOCUMENT;
            else
                img = IMG_FILE;
        }
    } else {
        attrs = 0;
        img = IMG_NONE;
    }

    if (_treePane) {
        if (entry) {
            img_pos = dis->rcItem.left + entry->_level*(IMAGE_WIDTH+_out_wrkr._spaceSize.cx);

            if (calcWidthCol == -1) {
                int x;
                int y = dis->rcItem.top + IMAGE_HEIGHT/2;
                Entry* up;
                RECT rt_clip;
                HRGN hrgn_org = CreateRectRgn(0, 0, 0, 0);
                HRGN hrgn;

                rt_clip.left   = dis->rcItem.left;
                rt_clip.top    = dis->rcItem.top;
                rt_clip.right  = dis->rcItem.left+_widths[col];
                rt_clip.bottom = dis->rcItem.bottom;

                hrgn = CreateRectRgnIndirect(&rt_clip);

                if (!GetClipRgn(dis->hDC, hrgn_org)) {
                    DeleteObject(hrgn_org);
                    hrgn_org = 0;
                }

                //HGDIOBJ holdPen = SelectObject(dis->hDC, GetStockObject(BLACK_PEN));
                ExtSelectClipRgn(dis->hDC, hrgn, RGN_AND);
                DeleteObject(hrgn);

                if ((up=entry->_up) != NULL) {
                    MoveToEx(dis->hDC, img_pos-IMAGE_WIDTH/2, y, 0);
                    LineTo(dis->hDC, img_pos-2, y);

                    x = img_pos - IMAGE_WIDTH/2;

                    do {
                        x -= IMAGE_WIDTH+_out_wrkr._spaceSize.cx;

                        if (up->_next) {
#ifndef _LEFT_FILES
                            bool following_child = (up->_next->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0; // a directory?

                            if (!following_child) {
                                for(Entry*n=up->_next; n; n=n->_next)
                                    if (n->_down) { // any file with NTFS sub-streams?
                                        following_child = true;
                                        break;
                                    }
                            }

                            if (following_child)
#endif
                            {
                                MoveToEx(dis->hDC, x, dis->rcItem.top, 0);
                                LineTo(dis->hDC, x, dis->rcItem.bottom);
                            }
                        }
                    } while((up=up->_up) != NULL);
                }

                x = img_pos - IMAGE_WIDTH/2;

                MoveToEx(dis->hDC, x, dis->rcItem.top, 0);
                LineTo(dis->hDC, x, y);

                if (entry->_next) {
#ifndef _LEFT_FILES
                    bool following_child = (entry->_next->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0;  // a directory?

                    if (!following_child) {
                        for(Entry*n=entry->_next; n; n=n->_next)
                            if (n->_down) { // any file with NTFS sub-streams?
                                following_child = true;
                                break;
                            }
                    }

                    if (following_child)
#endif
                        LineTo(dis->hDC, x, dis->rcItem.bottom);
                }

                if (entry->_down && entry->_expanded) {
                    x += IMAGE_WIDTH + _out_wrkr._spaceSize.cx;
                    MoveToEx(dis->hDC, x, dis->rcItem.top+IMAGE_HEIGHT, 0);
                    LineTo(dis->hDC, x, dis->rcItem.bottom);
                }

                SelectClipRgn(dis->hDC, hrgn_org);
                if (hrgn_org) DeleteObject(hrgn_org);
                //SelectObject(dis->hDC, holdPen);
            } else if (calcWidthCol==col || calcWidthCol==COLUMNS) {
                int right = img_pos + IMAGE_WIDTH - _out_wrkr._spaceSize.cx;

                if (right > _widths[col])
                    _widths[col] = right;
            }
        } else  {
            img_pos = dis->rcItem.left;
        }
    } else {
        img_pos = dis->rcItem.left;

        if (calcWidthCol==col || calcWidthCol==COLUMNS)
            _widths[col] = IMAGE_WIDTH;
    }

    if (calcWidthCol == -1) {
        focusRect.left = img_pos -2;

        if (attrs & FILE_ATTRIBUTE_COMPRESSED)
            textcolor = _clrCompressed;
        else
            textcolor = RGB(0,0,0);

        if (dis->itemState & ODS_FOCUS) {
            textcolor = GetSysColor(COLOR_HIGHLIGHTTEXT);
            bkcolor = GetSysColor(COLOR_HIGHLIGHT);
        } else {
            bkcolor = GetSysColor(COLOR_WINDOW);
        }

        HBRUSH hbrush = CreateSolidBrush(bkcolor);
        FillRect(dis->hDC, &focusRect, hbrush);
        DeleteObject(hbrush);

        SetBkMode(dis->hDC, TRANSPARENT);
        SetTextColor(dis->hDC, textcolor);

        cx = _widths[col];

        if (cx && img!=IMG_NONE) {
            if (cx > IMAGE_WIDTH)
                cx = IMAGE_WIDTH;

            if (entry->_icon_id > ICID_NONE)
                g_Globals._icon_cache.get_icon(entry->_icon_id).draw(dis->hDC, img_pos, dis->rcItem.top, cx, GetSystemMetrics(SM_CYSMICON), bkcolor, 0);
            else
                ImageList_DrawEx(_himl, img, dis->hDC,
                                 img_pos, dis->rcItem.top, cx,
                                 IMAGE_HEIGHT, bkcolor, CLR_DEFAULT, ILD_NORMAL);
        }
    }

    if (!entry)
        return;

    ++col;

     // output file name
    if (calcWidthCol == -1)
        _out_wrkr.output_text(dis, _positions, col, entry->_display_name, 0);
    else if (calcWidthCol==col || calcWidthCol==COLUMNS)
        calc_width(dis, col, entry->_display_name);
    ++col;

     // output type/class name
    if (visible_cols & COL_TYPE) {
        if (calcWidthCol == -1)
            _out_wrkr.output_text(dis, _positions, col, entry->_type_name? entry->_type_name: TEXT(""), 0);
        else if (calcWidthCol==col || calcWidthCol==COLUMNS)
            calc_width(dis, col, entry->_type_name? entry->_type_name: TEXT(""));
    }
    ++col;

     // display file size
    if (visible_cols & COL_SIZE) {
        ULONGLONG size = ((ULONGLONG)entry->_data.nFileSizeHigh << 32) | entry->_data.nFileSizeLow;

        _stprintf(buffer, TEXT("%") LONGLONGARG TEXT("d"), size);

        if (calcWidthCol == -1)
            _out_wrkr.output_number(dis, _positions, col, buffer);
        else if (calcWidthCol==col || calcWidthCol==COLUMNS)
            calc_width(dis, col, buffer);   ///@todo not in every case time enough
    }
    ++col;

     // display file date
    if (visible_cols & (COL_DATE|COL_TIME)) {
        format_date(&entry->_data.ftCreationTime, buffer, visible_cols);
        if (calcWidthCol == -1)
            _out_wrkr.output_text(dis, _positions, col, buffer, 0);
        else if (calcWidthCol==col || calcWidthCol==COLUMNS)
            calc_width(dis, col, buffer);
        ++col;

        format_date(&entry->_data.ftLastAccessTime, buffer, visible_cols);
        if (calcWidthCol == -1)
            _out_wrkr.output_text(dis,_positions,  col, buffer, 0);
        else if (calcWidthCol==col || calcWidthCol==COLUMNS)
            calc_width(dis, col, buffer);
        ++col;

        format_date(&entry->_data.ftLastWriteTime, buffer, visible_cols);
        if (calcWidthCol == -1)
            _out_wrkr.output_text(dis, _positions, col, buffer, 0);
        else if (calcWidthCol==col || calcWidthCol==COLUMNS)
            calc_width(dis, col, buffer);
        ++col;
    } else
        col += 3;

    if (entry->_bhfi_valid) {
        ULONGLONG index = ((ULONGLONG)entry->_bhfi.nFileIndexHigh << 32) | entry->_bhfi.nFileIndexLow;

        if (visible_cols & COL_INDEX) {
            _stprintf(buffer, TEXT("%") LONGLONGARG TEXT("X"), index);

            if (calcWidthCol == -1)
                _out_wrkr.output_text(dis, _positions, col, buffer, DT_RIGHT);
            else if (calcWidthCol==col || calcWidthCol==COLUMNS)
                calc_width(dis, col, buffer);

            ++col;
        }

        if (visible_cols & COL_LINKS) {
            wsprintf(buffer, TEXT("%d"), entry->_bhfi.nNumberOfLinks);

            if (calcWidthCol == -1)
                _out_wrkr.output_text(dis, _positions, col, buffer, DT_RIGHT);
            else if (calcWidthCol==col || calcWidthCol==COLUMNS)
                calc_width(dis, col, buffer);

            ++col;
        }
    } else
        col += 2;

     // show file attributes
    if (visible_cols & COL_ATTRIBUTES) {
        lstrcpy(buffer, TEXT(" \t \t \t \t \t \t \t \t \t \t \t \t \t \t "));

        if (attrs & FILE_ATTRIBUTE_NORMAL)                  buffer[ 0] = 'N';
        else {
            if (attrs & FILE_ATTRIBUTE_READONLY)            buffer[ 2] = 'R';
            if (attrs & FILE_ATTRIBUTE_HIDDEN)              buffer[ 4] = 'H';
            if (attrs & FILE_ATTRIBUTE_SYSTEM)              buffer[ 6] = 'S';
            if (attrs & FILE_ATTRIBUTE_ARCHIVE)             buffer[ 8] = 'A';
            if (attrs & FILE_ATTRIBUTE_COMPRESSED)          buffer[10] = 'C';
            if (attrs & FILE_ATTRIBUTE_DIRECTORY)           buffer[12] = 'D';
            if (attrs & FILE_ATTRIBUTE_ENCRYPTED)           buffer[14] = 'E';
            if (attrs & FILE_ATTRIBUTE_TEMPORARY)           buffer[16] = 'T';
            if (attrs & FILE_ATTRIBUTE_SPARSE_FILE)         buffer[18] = 'P';
            if (attrs & FILE_ATTRIBUTE_REPARSE_POINT)       buffer[20] = 'Q';
            if (attrs & FILE_ATTRIBUTE_OFFLINE)             buffer[22] = 'O';
            if (attrs & FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) buffer[24] = 'X';
            if (attrs & ATTRIBUTE_EXECUTABLE)               buffer[26] = 'x';
            if (attrs & ATTRIBUTE_SYMBOLIC_LINK)            buffer[28] = 'L';
        }

        if (calcWidthCol == -1)
            _out_wrkr.output_tabbed_text(dis, _positions, col, buffer);
        else if (calcWidthCol==col || calcWidthCol==COLUMNS)
            calc_tabbed_width(dis, col, buffer);
    }
    ++col;

/*TODO
    if (flags.security) {
        DWORD rights = get_access_mask();

        tcscpy(buffer, TEXT(" \t \t \t  \t  \t \t \t  \t  \t \t \t "));

        if (rights & FILE_READ_DATA)            buffer[ 0] = 'R';
        if (rights & FILE_WRITE_DATA)           buffer[ 2] = 'W';
        if (rights & FILE_APPEND_DATA)          buffer[ 4] = 'A';
        if (rights & FILE_READ_EA)              {buffer[6] = 'entry'; buffer[ 7] = 'R';}
        if (rights & FILE_WRITE_EA)             {buffer[9] = 'entry'; buffer[10] = 'W';}
        if (rights & FILE_EXECUTE)              buffer[12] = 'X';
        if (rights & FILE_DELETE_CHILD)         buffer[14] = 'D';
        if (rights & FILE_READ_ATTRIBUTES)      {buffer[16] = 'a'; buffer[17] = 'R';}
        if (rights & FILE_WRITE_ATTRIBUTES)     {buffer[19] = 'a'; buffer[20] = 'W';}
        if (rights & WRITE_DAC)                 buffer[22] = 'C';
        if (rights & WRITE_OWNER)               buffer[24] = 'O';
        if (rights & SYNCHRONIZE)               buffer[26] = 'S';

        output_text(dis, col++, buffer, DT_LEFT, 3, psize);
    }

    if (flags.description) {
        get_description(buffer);
        output_text(dis, col++, buffer, 0, psize);
    }
*/
    ++col;

     // output content / symbolic link target / comment
    if (visible_cols & COL_CONTENT) {
        if (calcWidthCol == -1)
            _out_wrkr.output_text(dis, _positions, col, entry->_content? entry->_content: TEXT(""), 0);
        else if (calcWidthCol==col || calcWidthCol==COLUMNS)
            calc_width(dis, col, entry->_content? entry->_content: TEXT(""));
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

MainFrameBase * Pane::get_frame (  ) [read, protected]

Definition at line 990 of file pane.cpp.

References WindowHandle::_hwnd, and HWND.

{
    HWND owner = GetParent(_hwnd);

    return (MainFrameBase*)owner;
}
void Pane::init (  )

Definition at line 156 of file pane.cpp.

References _clrCompressed, OutputWorker::_hfont, _himl, ExplorerGlobals::_hInstance, WindowHandle::_hwnd, _out_wrkr, calc_widths(), g_Globals, IDB_IMAGES, OutputWorker::init_output(), and TEXT.

Referenced by Pane().

{
    _himl = ImageList_LoadBitmap(g_Globals._hInstance, MAKEINTRESOURCE(IDB_IMAGES), 16, 0, RGB(0,255,0));

    SetWindowFont(_hwnd, _out_wrkr._hfont, FALSE);

     // read the color for compressed files from registry
    HKEY hkeyExplorer = 0;
    DWORD len = sizeof(_clrCompressed);

    if (RegOpenKey(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer"), &hkeyExplorer) ||
        RegQueryValueEx(hkeyExplorer, TEXT("AltColor"), 0, NULL, (LPBYTE)&_clrCompressed, &len) || len!=sizeof(_clrCompressed))
        _clrCompressed = RGB(0,0,255);

    if (hkeyExplorer)
        RegCloseKey(hkeyExplorer);

     // calculate column widths
    _out_wrkr.init_output(_hwnd);
    calc_widths(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int Pane::insert_entries ( Entry dir,
int  idx = -1 
)

Definition at line 661 of file pane.cpp.

References Entry::_data, Entry::_down, Entry::_expanded, WindowHandle::_hwnd, Entry::_next, _treePane, and TEXT.

Referenced by FileChildWindow::expand_entry(), FileChildWindow::jump_to_int(), Pane(), FileChildWindow::scan_entry(), and FileChildWindow::set_curdir().

{
    Entry* entry = dir;

    if (!entry)
        return idx;

    for(; entry; entry=entry->_next) {
#ifndef _LEFT_FILES
        if (_treePane &&
            !(entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) &&    // not a directory?
            !entry->_down)  // not a file with NTFS sub-streams?
            continue;
#endif

         // don't display entries "." and ".." in the left pane
        if (_treePane && (entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
                && entry->_data.cFileName[0]==TEXT('.'))
            if (entry->_data.cFileName[1]==TEXT('\0') ||
                (entry->_data.cFileName[1]==TEXT('.') && entry->_data.cFileName[2]==TEXT('\0')))
                continue;

        if (idx != -1)
            ++idx;

        ListBox_InsertItemData(_hwnd, idx, entry);

        if (_treePane && entry->_expanded)
            idx = insert_entries(entry->_down, idx);
    }

    return idx;
}

Here is the caller graph for this function:

int Pane::Notify ( int  id,
NMHDR *  pnmh 
) [virtual]

Reimplemented from SubclassedWindow.

Definition at line 786 of file pane.cpp.

References WindowHandle::_hwnd, _hwndHeader, _positions, _widths, calc_single_width(), COLUMNS, SubclassedWindow::Notify(), and set_header().

{
    switch(pnmh->code) {
        case HDN_TRACK:
        case HDN_ENDTRACK: {
            HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh;
            int idx = phdn->iItem;
            int dx = phdn->pitem->cxy - _widths[idx];
            int i;

            ClientRect clnt(_hwnd);

             // move immediate to simulate HDS_FULLDRAG (for now [04/2000] not realy needed with WINELIB)
            Header_SetItem(_hwndHeader, idx, phdn->pitem);

            _widths[idx] += dx;

            for(i=idx; ++i<=COLUMNS; )
                _positions[i] += dx;

            {
                int scroll_pos = GetScrollPos(_hwnd, SB_HORZ);
                RECT rt_scr;
                RECT rt_clip;

                rt_scr.left   = _positions[idx+1]-scroll_pos;
                rt_scr.top    = 0;
                rt_scr.right  = clnt.right;
                rt_scr.bottom = clnt.bottom;

                rt_clip.left   = _positions[idx]-scroll_pos;
                rt_clip.top    = 0;
                rt_clip.right  = clnt.right;
                rt_clip.bottom = clnt.bottom;

                if (rt_scr.left < 0) rt_scr.left = 0;
                if (rt_clip.left < 0) rt_clip.left = 0;

                ScrollWindowEx(_hwnd, dx, 0, &rt_scr, &rt_clip, 0, 0, SW_INVALIDATE);

                rt_clip.right = _positions[idx+1];
                RedrawWindow(_hwnd, &rt_clip, 0, RDW_INVALIDATE|RDW_UPDATENOW);

                if (pnmh->code == HDN_ENDTRACK) {
                    ListBox_SetHorizontalExtent(_hwnd, _positions[COLUMNS]);

                    if (GetScrollPos(_hwnd, SB_HORZ) != scroll_pos)
                        set_header();
                }
            }

            return 0;
        }

        case HDN_DIVIDERDBLCLICK: {
            HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh;
            HD_ITEM item;

            calc_single_width(phdn->iItem);
            item.mask = HDI_WIDTH;
            item.cxy = _widths[phdn->iItem];

            Header_SetItem(_hwndHeader, phdn->iItem, &item);
            InvalidateRect(_hwnd, 0, TRUE);
            break;}

        default:
            return super::Notify(id, pnmh);
    }

    return 0;
}

Here is the call graph for this function:

void Pane::set_header (  )

Definition at line 696 of file pane.cpp.

References WindowHandle::_hwnd, _hwndHeader, _widths, and COLUMNS.

Referenced by FileChildWindow::activate_entry(), command(), FileChildWindow::expand_entry(), FileChildWindow::jump_to_int(), Notify(), FileChildWindow::scan_entry(), FileChildWindow::set_curdir(), and WndProc().

{
    HD_ITEM item;
    int scroll_pos = GetScrollPos(_hwnd, SB_HORZ);
    int i=0, x=0;

    item.mask = HDI_WIDTH;
    item.cxy = 0;

    for(; x+_widths[i]<scroll_pos && i<COLUMNS; i++) {
        x += _widths[i];
        Header_SetItem(_hwndHeader, i, &item);
    }

    if (i < COLUMNS) {
        x += _widths[i];
        item.cxy = x - scroll_pos;
        Header_SetItem(_hwndHeader, i++, &item);

        for(; i<COLUMNS; i++) {
            item.cxy = _widths[i];
            x += _widths[i];
            Header_SetItem(_hwndHeader, i, &item);
        }
    }
}

Here is the caller graph for this function:

LRESULT Pane::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
) [protected, virtual]

Reimplemented from SubclassedWindow.

Definition at line 101 of file pane.cpp.

References WindowHandle::_hwnd, PM_GET_FILEWND_PTR, FileChildWindow::set_focus_pane(), set_header(), FileChildWindow::switch_focus_pane(), and SubclassedWindow::WndProc().

{
    switch(nmsg) {
      case WM_HSCROLL:
        set_header();
        break;

      case WM_SETFOCUS: {
        FileChildWindow* child = (FileChildWindow*) SendMessage(GetParent(_hwnd), PM_GET_FILEWND_PTR, 0, 0);

        child->set_focus_pane(this);
        ListBox_SetSel(_hwnd, TRUE, 1);
        /*@todo check menu items */
        break;}

      case WM_KEYDOWN: {
        FileChildWindow* child = (FileChildWindow*) SendMessage(GetParent(_hwnd), PM_GET_FILEWND_PTR, 0, 0);

        if (wparam == VK_TAB) {
            /*@todo SetFocus(g_Globals.hdrivebar) */
            child->switch_focus_pane();
        }
        break;}
    }

    return super::WndProc(nmsg, wparam, lparam);
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 82 of file pane.h.

Referenced by draw_item(), and init().

HIMAGELIST Pane::_himl [protected]

Definition at line 107 of file pane.h.

Referenced by draw_item(), init(), and ~Pane().

Definition at line 77 of file pane.h.

Referenced by create_header(), Notify(), FileChildWindow::resize_children(), and set_header().

Definition at line 108 of file pane.h.

Referenced by calc_single_width(), calc_widths(), draw_item(), and init().

int Pane::_positions[COLUMNS+1]

Definition at line 75 of file pane.h.

Referenced by calc_single_width(), calc_widths(), draw_item(), and Notify().

Definition at line 79 of file pane.h.

Referenced by Pane(), and FileChildWindow::set_curdir().

Definition at line 85 of file pane.h.

Referenced by FileChildWindow::activate_entry(), draw_item(), and insert_entries().

Definition at line 84 of file pane.h.

Referenced by command(), and draw_item().

int Pane::_widths[COLUMNS]

The documentation for this struct was generated from the following files:

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage