[med-svn] [hyphy] 02/03: Imported Upstream version 2.2.4+dfsg

Andreas Tille tille at debian.org
Fri Jul 10 10:34:36 UTC 2015


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository hyphy.

commit 248b8de590b3d1b24845bbfa9f9384f797198034
Author: Andreas Tille <tille at debian.org>
Date:   Fri Jul 10 12:11:29 2015 +0200

    Imported Upstream version 2.2.4+dfsg
---
 src/gui/mac/Components/HYPlatformButton.cpp        |    1 -
 src/gui/mac/Components/HYPlatformButtonBar.cpp     |    1 -
 src/gui/mac/Components/HYPlatformCheckBox.cpp      |    1 -
 src/gui/mac/Components/HYPlatformLabel.cpp         |    1 -
 src/gui/mac/Components/HYPlatformList.cpp          |    1 -
 src/gui/mac/Components/HYPlatformPullDown.cpp      |    1 -
 src/gui/mac/Components/HYPlatformSequencePane.cpp  |    1 -
 src/gui/mac/Components/HYPlatformTable.cpp         |    1 -
 src/gui/mac/Components/HYPlatformTextBox.cpp       | 1241 --------------
 src/gui/mac/Docs.icns                              |  Bin 169303 -> 0 bytes
 src/gui/mac/HYPHY.icns                             |  Bin 169303 -> 0 bytes
 src/gui/mac/HYPHYMP.icns                           |  Bin 169303 -> 0 bytes
 src/gui/mac/HYPlatformComponent.cpp                |    1 -
 src/gui/mac/HYPlatformGraphicPane.cpp              |  607 -------
 src/gui/mac/HYPlatformUtils.cpp                    |    1 -
 src/gui/mac/HYPlatformWindow.cpp                   | 1118 ------------
 src/gui/mac/HyPhy.rsrc                             |  Bin 388670 -> 0 bytes
 src/gui/mac/Info.plist                             |   58 -
 .../mac/WindowClasses/HYPlatformBootsrapWindow.cpp |    1 -
 .../mac/WindowClasses/HYPlatformChartWindow.cpp    |    1 -
 .../mac/WindowClasses/HYPlatformConsoleWindow.cpp  |  394 -----
 src/gui/mac/WindowClasses/HYPlatformDBWindow.cpp   |    1 -
 src/gui/mac/WindowClasses/HYPlatformDataPanel.cpp  | 1100 ------------
 src/gui/mac/WindowClasses/HYPlatformGWindow.cpp    |    1 -
 .../mac/WindowClasses/HYPlatformModelWindow.cpp    |    1 -
 src/gui/mac/WindowClasses/HYPlatformPWindow.cpp    |    1 -
 .../mac/WindowClasses/HYPlatformParameterTable.cpp |    1 -
 src/gui/mac/WindowClasses/HYPlatformTWindow.cpp    |    1 -
 src/gui/mac/WindowClasses/HYPlatformTreePanel.cpp  |    1 -
 src/gui/mac/hydialogs.cpp                          |  774 ---------
 src/gui/mac/iHyPhyDebug.rsrc                       |  Bin 388670 -> 0 bytes
 src/gui/mac/include/Components/HYPlatformButton.h  |   92 -
 .../mac/include/Components/HYPlatformButtonBar.h   |  118 --
 .../mac/include/Components/HYPlatformCheckbox.h    |   78 -
 src/gui/mac/include/Components/HYPlatformLabel.h   |   88 -
 src/gui/mac/include/Components/HYPlatformList.h    |   94 --
 .../mac/include/Components/HYPlatformPullDown.h    |  120 --
 src/gui/mac/include/Components/HYPlatformTable.h   |  112 --
 src/gui/mac/include/Components/HYPlatformTextbox.h |  152 --
 src/gui/mac/include/HYPlatformButtonMenu.h         |  196 ---
 src/gui/mac/include/HYPlatformComponent.h          |   77 -
 src/gui/mac/include/HYPlatformGraphicPane.h        |   90 -
 src/gui/mac/include/HYPlatformWindow.h             |  160 --
 src/gui/mac/plist.r                                |    3 -
 src/gui/mac/plist.xml                              |   36 -
 src/gui/mac/plistmp.r                              |    1 -
 src/gui/res/Windows/128.cur                        |  Bin 2238 -> 0 bytes
 src/gui/res/Windows/129.cur                        |  Bin 2238 -> 0 bytes
 src/gui/res/Windows/130.bmp                        |  Bin 12342 -> 0 bytes
 src/gui/res/Windows/131.bmp                        |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/132.bmp                        |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/132.cur                        |  Bin 2238 -> 0 bytes
 src/gui/res/Windows/133.bmp                        |  Bin 11958 -> 0 bytes
 src/gui/res/Windows/3000.bmp                       |  Bin 1110 -> 0 bytes
 src/gui/res/Windows/333.bmp                        |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/400.bmp                        |  Bin 38454 -> 0 bytes
 src/gui/res/Windows/4000.bmp                       |  Bin 1224 -> 0 bytes
 src/gui/res/Windows/4001.bmp                       |  Bin 1222 -> 0 bytes
 src/gui/res/Windows/4002.bmp                       |  Bin 1222 -> 0 bytes
 src/gui/res/Windows/4003.bmp                       |  Bin 1222 -> 0 bytes
 src/gui/res/Windows/401.bmp                        |  Bin 38454 -> 0 bytes
 src/gui/res/Windows/4011.bmp                       |  Bin 1286 -> 0 bytes
 src/gui/res/Windows/402.bmp                        |  Bin 38454 -> 0 bytes
 src/gui/res/Windows/4020.bmp                       |  Bin 1222 -> 0 bytes
 src/gui/res/Windows/5000.bmp                       |  Bin 1466 -> 0 bytes
 src/gui/res/Windows/5001.bmp                       |  Bin 1478 -> 0 bytes
 src/gui/res/Windows/5002.bmp                       |  Bin 1466 -> 0 bytes
 src/gui/res/Windows/5003.bmp                       |  Bin 1478 -> 0 bytes
 src/gui/res/Windows/5004.bmp                       |  Bin 1464 -> 0 bytes
 src/gui/res/Windows/5005.bmp                       |  Bin 1432 -> 0 bytes
 src/gui/res/Windows/5006.bmp                       |  Bin 1314 -> 0 bytes
 src/gui/res/Windows/5007.bmp                       |  Bin 1464 -> 0 bytes
 src/gui/res/Windows/6000.bmp                       |  Bin 1266 -> 0 bytes
 src/gui/res/Windows/6001.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/6002.bmp                       |  Bin 1178 -> 0 bytes
 src/gui/res/Windows/6003.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/6004.bmp                       |  Bin 1310 -> 0 bytes
 src/gui/res/Windows/6005.bmp                       |  Bin 1304 -> 0 bytes
 src/gui/res/Windows/6006.bmp                       |  Bin 1324 -> 0 bytes
 src/gui/res/Windows/6007.bmp                       |  Bin 1298 -> 0 bytes
 src/gui/res/Windows/6008.bmp                       |  Bin 1312 -> 0 bytes
 src/gui/res/Windows/6009.bmp                       |  Bin 1246 -> 0 bytes
 src/gui/res/Windows/6010.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/6011.bmp                       |  Bin 1308 -> 0 bytes
 src/gui/res/Windows/6012.bmp                       |  Bin 1226 -> 0 bytes
 src/gui/res/Windows/6013.bmp                       |  Bin 246 -> 0 bytes
 src/gui/res/Windows/6014.bmp                       |  Bin 246 -> 0 bytes
 src/gui/res/Windows/6016.bmp                       |  Bin 1336 -> 0 bytes
 src/gui/res/Windows/6017.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/6018.bmp                       |  Bin 1258 -> 0 bytes
 src/gui/res/Windows/6019.bmp                       |  Bin 1314 -> 0 bytes
 src/gui/res/Windows/6020.bmp                       |  Bin 1294 -> 0 bytes
 src/gui/res/Windows/6021.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/6022.bmp                       |  Bin 1314 -> 0 bytes
 src/gui/res/Windows/6030.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/6031.bmp                       |  Bin 1260 -> 0 bytes
 src/gui/res/Windows/6032.bmp                       |  Bin 1318 -> 0 bytes
 src/gui/res/Windows/6033.bmp                       |  Bin 1330 -> 0 bytes
 src/gui/res/Windows/6034.bmp                       |  Bin 1318 -> 0 bytes
 src/gui/res/Windows/6035.bmp                       |  Bin 1314 -> 0 bytes
 src/gui/res/Windows/6036.bmp                       |  Bin 1282 -> 0 bytes
 src/gui/res/Windows/6040.bmp                       |  Bin 1282 -> 0 bytes
 src/gui/res/Windows/6041.bmp                       |  Bin 1316 -> 0 bytes
 src/gui/res/Windows/6042.bmp                       |  Bin 1226 -> 0 bytes
 src/gui/res/Windows/7000.bmp                       |  Bin 1326 -> 0 bytes
 src/gui/res/Windows/7001.bmp                       |  Bin 1308 -> 0 bytes
 src/gui/res/Windows/7002.bmp                       |  Bin 1296 -> 0 bytes
 src/gui/res/Windows/7003.bmp                       |  Bin 1286 -> 0 bytes
 src/gui/res/Windows/7004.bmp                       |  Bin 1294 -> 0 bytes
 src/gui/res/Windows/7005.bmp                       |  Bin 1300 -> 0 bytes
 src/gui/res/Windows/7010.bmp                       |  Bin 1270 -> 0 bytes
 src/gui/res/Windows/7011.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/7012.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/7013.bmp                       |  Bin 1258 -> 0 bytes
 src/gui/res/Windows/7014.bmp                       |  Bin 1246 -> 0 bytes
 src/gui/res/Windows/7020.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/7050.bmp                       |  Bin 1334 -> 0 bytes
 src/gui/res/Windows/Win.rc                         |    1 -
 src/gui/res/Windows/desk.ico                       |  Bin 204862 -> 0 bytes
 src/gui/res/Windows/hyphy.bmp                      |  Bin 91880 -> 0 bytes
 src/gui/res/Windows/pthreadGC2.dll                 |  Bin 69088 -> 0 bytes
 src/gui/res/Windows/pthreadVC2.dll                 |  Bin 86070 -> 0 bytes
 src/gui/win/Components/HYPlatformButton.cpp        |    1 -
 src/gui/win/Components/HYPlatformButtonBar.cpp     |    1 -
 src/gui/win/Components/HYPlatformCheckBox.cpp      |    1 -
 src/gui/win/Components/HYPlatformLabel.cpp         |    1 -
 src/gui/win/Components/HYPlatformPullDown.cpp      |    1 -
 src/gui/win/Components/HYPlatformSequencePane.cpp  |  249 ---
 src/gui/win/Components/HYPlatformTable.cpp         | 1771 --------------------
 src/gui/win/Components/HYPlatformTextBox.cpp       |  740 --------
 src/gui/win/HYPlatformComponent.cpp                |  672 --------
 src/gui/win/HYPlatformGraphicPane.cpp              |    1 -
 src/gui/win/HYPlatformWindow.cpp                   |  863 ----------
 src/gui/win/HYPlatfromUtils.cpp                    |  773 ---------
 .../win/WindowClasses/HYPlatformBootsrapWindow.cpp |    1 -
 .../win/WindowClasses/HYPlatformChartWindow.cpp    |    1 -
 .../win/WindowClasses/HYPlatformConsoleWindow.cpp  |  584 -------
 src/gui/win/WindowClasses/HYPlatformDBWindow.cpp   |    1 -
 src/gui/win/WindowClasses/HYPlatformDataPanel.cpp  |    1 -
 src/gui/win/WindowClasses/HYPlatformGWindow.cpp    |    1 -
 .../win/WindowClasses/HYPlatformModelWindow.cpp    |    1 -
 src/gui/win/WindowClasses/HYPlatformPWindow.cpp    |    1 -
 .../win/WindowClasses/HYPlatformParameterTable.cpp |    1 -
 src/gui/win/WindowClasses/HYPlatformTWindow.cpp    |    1 -
 src/gui/win/WindowClasses/HYPlatformTreePanel.cpp  | 1328 ---------------
 src/gui/win/include/Components/HYPlatformButton.h  |    1 -
 .../win/include/Components/HYPlatformButtonBar.h   |    1 -
 .../win/include/Components/HYPlatformCheckbox.h    |    1 -
 src/gui/win/include/Components/HYPlatformLabel.h   |    1 -
 .../win/include/Components/HYPlatformPullDown.h    |    1 -
 src/gui/win/include/Components/HYPlatformTable.h   |    1 -
 src/gui/win/include/Components/HYPlatformTextbox.h |    1 -
 src/gui/win/include/HYPlatformButtonMenu.h         |    1 -
 src/gui/win/include/HYPlatformComponent.h          |    1 -
 src/gui/win/include/HYPlatformGraphicPane.h        |    1 -
 src/gui/win/include/HYPlatformWindow.h             |    1 -
 src/gui/win/include/pthread.h                      | 1363 ---------------
 src/gui/win/include/sched.h                        |  178 --
 src/gui/win/include/semaphore.h                    |  166 --
 159 files changed, 15442 deletions(-)

diff --git a/src/gui/mac/Components/HYPlatformButton.cpp b/src/gui/mac/Components/HYPlatformButton.cpp
deleted file mode 100644
index 17ce146..0000000
--- a/src/gui/mac/Components/HYPlatformButton.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Button component for Mac OS.

    Sergei L. Kosakovsky Pond, May 2000 - December 2002
*/

#include "errorfns.h"
#include "HYButton.h"
#include "HYUtils.h"
#include "HYEventTypes.h"

#include <ControlDefinitions.h>

//__________________________________________________________________

_HYPlatformButton::_HYPlatformButton    (void)
{
    backFill = NewPixPat();

    if (!backFill) {
        warnError (-108);
    }

    RGBColor    wht = {0xffff,0xffff,0xffff};
    fontID          = 0;
    buttonControl   = nil;
    buttonRect      = (Rect) {
        0,0,100,100
    };

    MakeRGBPat (backFill,&wht);
}

//__________________________________________________________________

_HYPlatformButton::~_HYPlatformButton   (void)
{
    if (backFill) {
        DisposePixPat (backFill);
    }

    if (buttonControl) {
        DisposeControl(buttonControl);
    }
}

//__________________________________________________________________

void    _HYPlatformButton::_SetBackColor (_HYColor& c)
{
    RGBColor newBG;
    newBG.red = c.R*256;
    newBG.blue = c.B*256;
    newBG.green = c.G*256;
    MakeRGBPat (backFill,&newBG);
}

//__________________________________________________________________

void        _HYPlatformButton::_SetFont (_HYFont& f)
{
    Str255 fName;
    StringToStr255 (f.face,fName);
    short fNum=0;
    GetFNum (fName,&fNum);
    fontID = fNum;
    if (buttonControl) {
        _ApplyFont ();
    }
}

//__________________________________________________________________

void        _HYPlatformButton::_ApplyFont(void)
{
#ifdef TARGET_API_MAC_CARBON
    ControlFontStyleRec fontData;
    fontData.flags = kControlUseFontMask|kControlUseFaceMask|kControlUseSizeMask;
    fontData.font  = fontID;
    fontData.style  = ((_HYButton*)this)->buttonFont.style;
    fontData.size   = ((_HYButton*)this)->buttonFont.size;
    SetControlFontStyle (buttonControl, &fontData);
#endif
}
//__________________________________________________________________
void        _HYPlatformButton::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformButton::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYButton* theParent = (_HYButton *) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}

//__________________________________________________________________
void        _HYPlatformButton::_EnableButton (bool e)
{
    if (buttonControl) {
        HiliteControl (buttonControl,e?kControlNoPart:kControlInactivePart);
    }
}

//__________________________________________________________________
void        _HYPlatformButton::_SetButtonKind (unsigned char k)
{
    if (buttonControl) {
        //_HYButton * theParent = (_HYButton*) this;
        Boolean     onOff = (k==HY_BUTTON_OK);

        SetControlData (buttonControl,
                        kControlNoPart,
                        kControlPushButtonDefaultTag,
                        sizeof(Boolean),
                        (Ptr)&onOff);

    }
}

//__________________________________________________________________
void        _HYPlatformButton::_SetVisibleSize (_HYRect rel)
{
    _HYButton * theParent = (_HYButton*) this;

    buttonRect.left=rel.left;
    buttonRect.top = rel.top;

    _HYRect s = theParent->_SuggestDimensions();

    buttonRect.right =  buttonRect.left+s.right;
    buttonRect.bottom = buttonRect.top+s.bottom;

    AlignRectangle (rel, buttonRect, theParent->GetAlignFlags());

    if (buttonControl) {
        SizeControl (buttonControl,buttonRect.right-buttonRect.left+1,buttonRect.bottom-buttonRect.top+1);
        MoveControl (buttonControl,buttonRect.left,buttonRect.top);
    }
}


//__________________________________________________________________
void        _HYPlatformButton::_Paint (Ptr p)
{
    _HYButton * theParent = (_HYButton*)this;
    _HYRect   * relRect   = (_HYRect*)p;
    Rect        cRect;

    cRect.left   = relRect->left;
    cRect.right  = relRect->right;
    cRect.top    = relRect->top;
    cRect.bottom = relRect->bottom;

    bool         drawBk = (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG));

    if (drawBk) {
        FillCRect (&cRect,backFill);
    } else {
        EraseRect (&cRect);
    }

    if (buttonControl) {
        _PaintMe();
    }

    (*theParent)._HYPlatformComponent::_Paint(p);
}

//__________________________________________________________________
void        _HYPlatformButton::_PaintMe (void)
{
    _HYButton * theParent = (_HYButton*)this;
    bool        drawBk = (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG));

    GrafPtr     thisPort;
    GetPort     (&thisPort);

#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort   (GetWindowPort(theParent->parentWindow));
#else
    SetPort   (theParent->parentWindow);
#endif

    RGBColor newBG,
             saveColor;

    if (drawBk) {
        GetBackColor (&saveColor);
        newBG.red = theParent->backColor.R*256;
        newBG.blue = theParent->backColor.B*256;
        newBG.green = theParent->backColor.G*256;
        RGBBackColor (&newBG);
    }

    Draw1Control (buttonControl);
    if (drawBk) {
        RGBBackColor (&saveColor);
    }

    SetPort     (thisPort);
}
//__________________________________________________________________

_HYRect _HYButton::_SuggestDimensions (void)
{
    _HYRect res = {10,100,10,100,HY_COMPONENT_NO_SCROLL};
    GrafPtr thisPort;
    GetPort (&thisPort);

#ifdef OPAQUE_TOOLBOX_STRUCTS
    short   savedFace = GetPortTextFont (thisPort),
            savedSize = GetPortTextSize (thisPort);

    Style   savedStyle = GetPortTextFace (thisPort);
#else
    short   savedFace = thisPort->txFont,
            savedSize = thisPort->txSize;

    Style   savedStyle = thisPort->txFace;
#endif


    TextFont (fontID);
    TextSize (buttonFont.size);
    TextFace (buttonFont.style);

    res.top = res.bottom = buttonFont.size+8;
    res.left= res.right  = TextWidth (buttonText.sData,0,buttonText.sLength) + 15;

    TextFont (savedFace);
    TextSize (savedSize);
    TextFace (savedStyle);

    return res;
}

//__________________________________________________________________

void        _HYButton::_Activate (void)
{
    if (!activationFlag)
        if (buttonControl&&isEnabled) {
            HiliteControl (buttonControl,0);
            _PaintMe();
            //Draw1Control (buttonControl);
        }

    _HYPlatformComponent::_Activate();
}

//__________________________________________________________________

void        _HYButton::_Deactivate (void)
{
    if (activationFlag)
        if (buttonControl&&isEnabled) {
            HiliteControl (buttonControl, kControlInactivePart);
            _PaintMe();
            //Draw1Control (buttonControl);
        }

    _HYPlatformComponent::_Deactivate();
}

//__________________________________________________________________

void        _HYPlatformButton::_SetText (void)
{
    _HYButton *parent = (_HYButton*)this;

    Str255 buffer;
    StringToStr255 (parent->buttonText, buffer);
    if (buttonControl) {
        SetControlTitle (buttonControl,buffer);
    } else {
        GrafPtr      savePort;
        GetPort (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort (GetWindowPort(parent->parentWindow));
#else
        SetPort (parent->parentWindow);
#endif

        buttonControl = NewControl (parent->parentWindow,&buttonRect,buffer,true,0,0,0,
                                    kControlPushButtonProc /*+(1<<3)*/ ,0);

        checkPointer ((Ptr)buttonControl);
        _ApplyFont ();
        SetPort (savePort);
    }
}

//__________________________________________________________________

bool _HYButton::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord*    theEvent = (EventRecord*)vEvent;
    WindowPtr       dummy;
    if(buttonControl&&isEnabled)
        switch (theEvent->what) {
        case mouseDown: {
            long evtType = FindWindow (theEvent->where,&dummy);
            if (evtType == inContent) {
                Point localClick = theEvent->where;
                GlobalToLocal (&localClick);
                if (buttonControl&&PtInRect (localClick,&buttonRect))
                    if (TrackControl (buttonControl,localClick,nil))
                        if (messageRecipient) {
                            messageRecipient->ProcessEvent (generateButtonPushEvent (GetID(),0));
                        }
            }
            return true;
        }
        case keyDown:
        case autoKey: {
            int     keyCode = (theEvent->message&keyCodeMask)>>8;
            bool    good    = false;

            if (buttonKind == HY_BUTTON_OK) {
                good = ((keyCode==0x24) || (keyCode==0x4C));
            } else if (buttonKind == HY_BUTTON_CANCEL) {
                good = ((keyCode==0x35) || ((keyCode==0x2F)&&(theEvent->modifiers&cmdKey)));
            }

            if (good) {
                HiliteControl (buttonControl, kControlButtonPart);
                _PaintMe();
                //Draw1Control (buttonControl);
                if (messageRecipient) {
                    messageRecipient->ProcessEvent (generateButtonPushEvent (GetID(),0));
                }
                _PaintMe();
                //Draw1Control (buttonControl);
            }
            if (good) {
                return true;
            }
        }
        }

    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}
// EOF
\ No newline at end of file
diff --git a/src/gui/mac/Components/HYPlatformButtonBar.cpp b/src/gui/mac/Components/HYPlatformButtonBar.cpp
deleted file mode 100644
index 514f9b0..0000000
--- a/src/gui/mac/Components/HYPlatformButtonBar.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Toolbar component for Mac OS API

    Sergei L. Kosakovsky Pond, May 2000-December 2002
*/

#include "HYPlatformGraphicPane.h"

#include "errorfns.h"
#include "HYButtonBar.h"
#include "HYUtils.h"
#include "HYEventTypes.h"

#include "ToolUtils.h"
#include "Appearance.h"
#include "string.h"


//__________________________________________________________________

RGBColor
buttonBorder1 = {0,0,0},
buttonBorder2 = {0x3fff,0x3fff,0x3fff};

//__________________________________________________________________

_HYPlatformButtonBar::_HYPlatformButtonBar(void)
{
    backFill = NewPixPat();
    if (!backFill) {
        warnError (-108);
    }
    RGBColor  wht = {0xffff,0xffff,0xffff};
    MakeRGBPat (backFill,&wht);
    pushed = -1;
    saveMousePosH = -1;
    saveMousePosV = -1;
    lastSave = 0;
    toolTipBounds.left = 0;
#ifdef TARGET_API_MAC_CARBON
    //EventLoopRef    mainLoop;
    //mainLoop = GetMainEventLoop();
    timerUPP = NewEventLoopTimerUPP(ButtonBarTimer);
    //InstallEventLoopTimer (mainLoop,0,1.5*kEventDurationSecond,timerUPP,this,&theTimer);
    theTimer = nil;
#endif
}

//__________________________________________________________________

_HYPlatformButtonBar::~_HYPlatformButtonBar(void)
{
    if (backFill) {
        DisposePixPat (backFill);
    }
#ifdef TARGET_API_MAC_CARBON
    if (theTimer) {
        RemoveEventLoopTimer (theTimer);
    }
    DisposeEventLoopTimerUPP (timerUPP);
#endif
}

//__________________________________________________________________

void    _HYPlatformButtonBar::_DisposeButtons(void)
{
    _HYButtonBar* theParent = (_HYButtonBar*)this;
    for (long i=0; i<theParent->ButtonCount(); i++) {
        CIconHandle thisIcon = (CIconHandle)theParent->buttons.lData[i];
        DisposeCIcon (thisIcon);
    }
}

//__________________________________________________________________

void    _HYPlatformButtonBar::_DisposeButton(long k)
{
    _HYButtonBar* theParent = (_HYButtonBar*)this;
    if ((k<theParent->ButtonCount())&&(k>=0)) {
        CIconHandle thisIcon = (CIconHandle)theParent->buttons.lData[k];
        DisposeCIcon (thisIcon);
    }
}




//__________________________________________________________________

void        _HYPlatformButtonBar::_SetBackColor (_HYColor& c)
{
    RGBColor newBG;
    newBG.red = c.R*256;
    newBG.blue = c.B*256;
    newBG.green = c.G*256;
    MakeRGBPat (backFill,&newBG);

}

//__________________________________________________________________
void        _HYPlatformButtonBar::_SetVisibleSize (_HYRect rel)
{
    _HYButtonBar* theParent = (_HYButtonBar*) this;
    buttonRect.left=rel.left;
    buttonRect.top = rel.top;
    _HYRect s = theParent->_SuggestDimensions();
    buttonRect.right = buttonRect.left+s.right;
    buttonRect.bottom = buttonRect.top+s.bottom;
    AlignRectangle (rel, buttonRect, theParent->GetAlignFlags());
}

//__________________________________________________________________

void        _HYButtonBar::_Activate (void)
{
    if (!activationFlag)
        for (long k=0; k<enabledButtons.lLength; k++) {
            _MarkButtonForUpdate (enabledButtons.lData[k]);
        }
    if (!theTimer) {
        EventLoopRef      mainLoop;
        mainLoop = GetMainEventLoop();
        InstallEventLoopTimer (mainLoop,0,.5*kEventDurationSecond,timerUPP,this,&theTimer);
    }
    _HYPlatformComponent::_Activate();
}

//__________________________________________________________________

void        _HYButtonBar::_Deactivate (void)
{
    if (activationFlag) {
        for (long k=0; k<enabledButtons.lLength; k++) {
            _MarkButtonForUpdate (enabledButtons.lData[k]);
        }
        if (toolTipBounds.left) {
#ifdef TARGET_API_MAC_CARBON
            InvalWindowRect (parentWindow,&toolTipBounds);
            //HMHideTag ();
#else
            InvalRect (&toolTipBounds);
#endif
            toolTipBounds.left = 0;

        }
    }

#ifdef TARGET_API_MAC_CARBON
    if (theTimer) {
        RemoveEventLoopTimer(theTimer);
        theTimer = nil;
    }
#endif
    _HYPlatformComponent::_Deactivate();
}

//__________________________________________________________________

void        _HYButtonBar::_ComponentMouseExit (void)
{
    if (toolTipBounds.left) {
#ifdef TARGET_API_MAC_CARBON
        InvalWindowRect (parentWindow,&toolTipBounds);
        //HMHideTag ();
#else
        InvalRect (&toolTipBounds);
#endif
        toolTipBounds.left = 0;
    }
#ifdef TARGET_API_MAC_CARBON
    if (theTimer) {
        RemoveEventLoopTimer(theTimer);
        theTimer = nil;
    }
#endif
}


//__________________________________________________________________
void        _HYPlatformButtonBar::_Paint (Ptr p)
{

    _HYButtonBar * theParent = (_HYButtonBar*)this;
    _HYRect * relRect = (_HYRect*)p;
    Rect    cRect,iRect;
    cRect.left = relRect->left;
    cRect.right = relRect->right;
    cRect.top = relRect->top;
    cRect.bottom = relRect->bottom;
    if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
        FillCRect (&cRect,backFill);
    } else {
        EraseRect (&cRect);
    }
    RgnHandle saveRgn = NewRgn();

    if (!saveRgn) {
        warnError(-108);
    }

    GetClip (saveRgn);
    ClipRect (&cRect);
    cRect.left = buttonRect.left;
    cRect.top = buttonRect.top;
    int   step = theParent->GetButtonDim()+2*HY_BUTTONBAR_BORDER;
    cRect.right = cRect.left+step;
    cRect.bottom = cRect.top+step;
    RGBColor saveColor;
    GetForeColor (&saveColor);
    RGBForeColor (&buttonBorder1);
    PenSize (1,1);
    for (long i=0; i<theParent->ButtonCount(); i++) {
        if (i&&(i%theParent->BarWidth()==0)) {
            cRect.left = buttonRect.left;
            cRect.top +=step;
            cRect.bottom +=step;
            cRect.right = cRect.left+step;
        }
        iRect = cRect;
        //ThemeButtonDrawInfo binfo = {theParent->activationFlag?kThemeStateActive:kThemeStateInactive,kThemeButtonOff,kThemeAdornmentNone};
        //DrawThemeButton (&iRect,kThemeBevelButton,&binfo,nil,nil,nil,0);
        InsetRect (&iRect,HY_BUTTONBAR_BORDER,HY_BUTTONBAR_BORDER);
        if (theParent->activationFlag)
            if (i==pushed) {
                PlotCIconHandle (&iRect,atNone,ttSelected,(CIconHandle)theParent->buttons.lData[i]);
            } else {
                if (theParent->enabledButtons.Find(i)>=0) {
                    PlotCIcon (&iRect,(CIconHandle)theParent->buttons.lData[i]);
                } else {
                    PlotCIconHandle (&iRect,atNone,ttDisabled,(CIconHandle)theParent->buttons.lData[i]);
                }
            }
        else {
            PlotCIconHandle (&iRect,atNone,ttDisabled,(CIconHandle)theParent->buttons.lData[i]);
        }

        MoveTo (iRect.left-1,iRect.top-1);
        LineTo (iRect.right+1,iRect.top-1);
        LineTo (iRect.right+1,iRect.bottom+1);
        LineTo (iRect.left-1,iRect.bottom+1);
        LineTo (iRect.left-1,iRect.top-1);

        cRect.left +=step;
        cRect.right +=step;
    }

    RGBForeColor (&saveColor);

    SetClip    (saveRgn);
    DisposeRgn (saveRgn);

    (*theParent)._HYPlatformComponent::_Paint(p);
}
//__________________________________________________________________
_HYRect _HYPlatformButtonBar::_GetButtonRect (bool conv)
{
    _HYRect res;
    res.left   = buttonRect.left;
    res.right  = buttonRect.right;
    res.top    = buttonRect.top;
    res.bottom = buttonRect.bottom;
    if (conv) {
        GrafPtr thisPort;
        GetPort (&thisPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort (GetWindowPort(((_HYButtonBar*)this)->parentWindow));
#else
        SetPort (((_HYButtonBar*)this)->parentWindow);
#endif
        Point   c;
        c.v = res.top;
        c.h = res.left;
        LocalToGlobal(&c);
        res.top = c.v;
        res.left = c.h;
        c.v = res.bottom;
        c.h = res.right;
        LocalToGlobal(&c);
        res.bottom = c.v;
        res.right = c.h;
        SetPort (thisPort);
    }
    return res;
}


//__________________________________________________________________
void        _HYPlatformButtonBar::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformButtonBar::_MarkButtonForUpdate (int i)
{
    _HYButtonBar* theParent = (_HYButtonBar*)this;
    if ((i>=0)&&(i<theParent->ButtonCount())) {
        int hR = i%theParent->BarWidth(),
            vR = i/theParent->BarWidth(),
            step = 2*HY_BUTTONBAR_BORDER+theParent->GetButtonDim();

        Rect invRect;
        invRect.left  = buttonRect.left+hR*step;
        invRect.right = invRect.left+step;
        invRect.top   = buttonRect.top+vR*step;
        invRect.bottom= invRect.top+step;
        GrafPtr savePort;
        GetPort (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort (GetWindowPort(theParent->parentWindow));
#else
        SetPort (theParent->parentWindow);
#endif
#ifdef TARGET_API_MAC_CARBON
        InvalWindowRect (theParent->parentWindow,&invRect);
#else
        InvalRect (&invRect);
#endif

        if (forceUpdateForScrolling) {
            Rect    rel = HYRect2Rect (theParent->rel);
            SectRect (&rel,&invRect,&invRect);
            _HYRect br = {invRect.top,invRect.left,invRect.bottom,invRect.right,0};
            theParent->Paint((Ptr)&br);
        }
        SetPort (savePort);
    }
}

//__________________________________________________________________
void        _HYPlatformButtonBar::_UnpushButton (void)
{
    if (pushed>=0) {
        _MarkButtonForUpdate(pushed);
        pushed = -1;
    }
}


//__________________________________________________________________
void        _HYPlatformButtonBar::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYButtonBar* theParent = (_HYButtonBar*) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}

//__________________________________________________________________
int         _HYPlatformButtonBar::_FindClickedButton (int h, int v)
{
    Point localClick = {v,h};
    _HYButtonBar * parent = (_HYButtonBar*)this;
    if (PtInRect (localClick,&buttonRect)) {
        int v = localClick.v-buttonRect.top,
            h = localClick.h-buttonRect.left,
            step = 2*HY_BUTTONBAR_BORDER+parent->buttonDim,
            hR = h/step,
            vR = v/step;

        v-=vR*step;
        h-=hR*step;
        if ((v>HY_BUTTONBAR_BORDER)&&(v<step-HY_BUTTONBAR_BORDER)&&
                (h>HY_BUTTONBAR_BORDER)&&(h<step-HY_BUTTONBAR_BORDER)) {
            return hR+vR*parent->barW;
        }
    }
    return -1;

}

//__________________________________________________________________

#ifdef TARGET_API_MAC_CARBON
pascal void ButtonBarTimer (EventLoopTimerRef ,void* userData)
{
    Point    curMouse;
    GetGlobalMouse (&curMouse);
    //LocalToGlobal (&curMouse);
    _HYButtonBar * myBB = (_HYButtonBar*)userData;
    unsigned long t;
    GetDateTime(&t);

    if ((curMouse.h==myBB->saveMousePosH)
            &&(curMouse.v==myBB->saveMousePosV)) {
        if (!myBB->toolTipBounds.left) {
            GrafPtr curPort;
            GetPort (&curPort);
            SetPort (GetWindowPort (myBB->parentWindow));
            myBB->_DisplayToolTip();
            SetPort (curPort);
        }
    }

    myBB->saveMousePosH = curMouse.h;
    myBB->saveMousePosV = curMouse.v;
    myBB->lastSave      = t;
}

#endif

//__________________________________________________________________
void        _HYButtonBar::_DisplayToolTip      (void)
{
    Point p = {saveMousePosV,saveMousePosH};
    GlobalToLocal (&p);
    int h = _FindClickedButton (p.h,p.v);

    /*#ifdef TARGET_API_MAC_CARBON
    if (h>-1)
    {
        _String* toolTip = (_String*)toolTips(h);
        if (toolTip->sLength)
        {
            int x,
                y;

            GetButtonLoc (h,x,y,true);
            HMHelpContentRec hmr;

            hmr.absHotRect.left  = x;
            hmr.absHotRect.top   = y;
            hmr.absHotRect.right = x+GetButtonDim();
            hmr.absHotRect.bottom= y+GetButtonDim();

            hmr.version = kMacHelpVersion;
            hmr.tagSide = kHMDefaultSide;

            hmr.content[0].contentType = kHMPascalStrContent;
            hmr.content[1].contentType = kHMPascalStrContent;
            StringToStr255 (*toolTip,hmr.content[0].u.tagString);
            StringToStr255 (*toolTip,hmr.content[1].u.tagString);

            HMDisplayTag (&hmr);
            toolTipBounds.left = 1;
        }
    }
    #else*/
    if ((h>-1)&&(h<toolTips.lLength)) {
        _String* toolTip = (_String*)toolTips(h);
        if (toolTip->sLength) {
            //RGBColor      toolTipColor = {0x0000,0x3A00,0x8A00};
            RGBColor      toolTipColor = {0xFFFF,0xCCFF,0x6600};
            PixPatHandle  toolTipPixPat = NewPixPat();
            MakeRGBPat (toolTipPixPat,&toolTipColor);
            int        bL,bT;
            GetButtonLoc (h,bL,bT,false);
            GrafPtr thisPort;
            GetPort (&thisPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
            short   savedFace = GetPortTextFont (thisPort),
                    savedSize = GetPortTextSize (thisPort);

            Style   savedStyle = GetPortTextFace (thisPort);
#else
            short   savedFace = thisPort->txFont,
                    savedSize = thisPort->txSize;

            Style   savedStyle = thisPort->txFace;
#endif
            TextFont (kFontIDHelvetica);
            TextSize (12);
            TextFace (0);
            toolTipBounds.bottom = bT-1;
            toolTipBounds.top = toolTipBounds.bottom - 15;
            if (toolTipBounds.top<0) {
                toolTipBounds.top = bT+buttonDim+1;
                toolTipBounds.bottom = toolTipBounds.top+15;
            }
            h = GetVisibleStringWidth (*toolTip)+4;
            toolTipBounds.left = bL+(buttonDim-h-1)/2;
            if (toolTipBounds.left<=0) {
                toolTipBounds.left = 1;
            }
            toolTipBounds.right = toolTipBounds.left+h+2;
#ifdef OPAQUE_TOOLBOX_STRUCTS
            Rect portRect;
            GetPortBounds (thisPort,&portRect);
            h = toolTipBounds.right-portRect.right+portRect.left;
#else
            h = toolTipBounds.right-thisPort->portRect.right+thisPort->portRect.left;
#endif
            if (h>0) {
                if (h>=toolTipBounds.left) {
                    h = toolTipBounds.left-1;
                }
                toolTipBounds.left -= h;
                toolTipBounds.right-= h;
            }
            RGBColor oldColor;
            GetForeColor (&oldColor);
            toolTipColor.red = toolTipColor.blue = toolTipColor.green = 0x0000;
            RGBForeColor (&toolTipColor);
            FillCRect  (&toolTipBounds,toolTipPixPat);
            FrameRect  (&toolTipBounds);
            MoveTo (toolTipBounds.left+3,toolTipBounds.bottom-3);
            DrawText (toolTip->sData,0,toolTip->sLength);
            RGBForeColor (&oldColor);
            TextFont (savedFace);
            TextSize (savedSize);
            TextFace (savedStyle);
            DisposePixPat (toolTipPixPat);
        }
    }
    //#endif
}


//__________________________________________________________________

bool _HYButtonBar::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord*    theEvent = (EventRecord*)vEvent;
    WindowPtr       dummy;
#ifdef          TARGET_API_MAC_CARBON
    if (!theTimer) {
        EventLoopRef      mainLoop;
        mainLoop = GetMainEventLoop();
        InstallEventLoopTimer (mainLoop,0,.5*kEventDurationSecond,timerUPP,this,&theTimer);
    }
#endif
    if (buttons.lLength)
        switch (theEvent->what) {
        case mouseDown: {
            if (toolTipBounds.left) {
#ifdef TARGET_API_MAC_CARBON
                InvalWindowRect (parentWindow,&toolTipBounds);
                //HMHideTag ();
#else
                InvalRect (&toolTipBounds);
#endif
                toolTipBounds.left = 0;
                GetDateTime (&lastSave);
            }
            long evtType = FindWindow (theEvent->where,&dummy);
            switch (evtType) {
            case inContent: {
                Point localClick = theEvent->where;
                GlobalToLocal (&localClick);
                int h = _FindClickedButton (localClick.h,localClick.v);
                if ((h>=0)&&(enabledButtons.Find(h)>=0)) {
                    if (pullDownButtons.Find(h)<0) {
                        long lastFound = h,
                             cf;
                        forceUpdateForScrolling = true;
                        pushed = h;
                        _MarkButtonForUpdate (h);
#ifdef TARGET_API_MAC_CARBON
                        MouseTrackingResult  trackingResult = kMouseTrackingMousePressed;
                        GetMouse (&localClick);
                        while (trackingResult != kMouseTrackingMouseReleased) {
                            TrackMouseLocation (NULL, &localClick, &trackingResult);
                            cf = _FindClickedButton(localClick.h,localClick.v);
                            if (cf!=lastFound) {
                                if (lastFound==h) {
                                    pushed = -1;
                                    _MarkButtonForUpdate (h);
                                } else if (cf==h) {
                                    pushed = h;
                                    _MarkButtonForUpdate (h);
                                }

                                lastFound = cf;
                            }
                        }
#else
                        while (WaitMouseUp()) {
                            GetMouse (&localClick);
                            cf = _FindClickedButton(localClick.h,localClick.v);
                            if (cf!=lastFound) {
                                if (lastFound==h) {
                                    pushed = -1;
                                    _MarkButtonForUpdate (h);
                                } else if (cf==h) {
                                    pushed = h;
                                    _MarkButtonForUpdate (h);
                                }

                                lastFound = cf;
                            }
                        }
#endif
                        pushed = -1;
                        forceUpdateForScrolling = false;
                    }
                    if (_FindClickedButton(localClick.h,localClick.v)==h) {
                        //pushed = h;
                        pushed = -1;
                        forceUpdateForScrolling = true;
                        _MarkButtonForUpdate (h);
                        forceUpdateForScrolling = false;
                        SendButtonPush(h);
                    }
                }
                return true;
            }
            }
            break;
        }
        default: {
            if (!StillDown()) {
                if (pushed>=0) {
                    _MarkButtonForUpdate (pushed);
                    pushed = -1;
                    return true;
                }
                if (theEvent->what == osEvt) {
                    unsigned long t;
                    GetDateTime(&t);
                    if ((theEvent->where.h==saveMousePosH)
                            &&(theEvent->where.v==saveMousePosV)) {
                        if ((t-lastSave>1)&&(!toolTipBounds.left)) {
                            _DisplayToolTip();
                            lastSave = t;
                        }
                    } else {
                        if (toolTipBounds.left) {
#ifdef TARGET_API_MAC_CARBON
                            InvalWindowRect (parentWindow,&toolTipBounds);
                            //HMHideTag ();
#else
                            InvalRect (&toolTipBounds);
#endif
                            toolTipBounds.left = 0;
                        }
                        saveMousePosH = theEvent->where.h;
                        saveMousePosV = theEvent->where.v;
                        lastSave = t;
                    }
                    return true;
                }
            }
        }
        }
    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}

//EOF
\ No newline at end of file
diff --git a/src/gui/mac/Components/HYPlatformCheckBox.cpp b/src/gui/mac/Components/HYPlatformCheckBox.cpp
deleted file mode 100644
index 041eddc..0000000
--- a/src/gui/mac/Components/HYPlatformCheckBox.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Check box for Mac OS.

    Sergei L. Kosakovsky Pond, May 2000-December 2002
*/

#include "HYLabel.h"
#include <ControlDefinitions.h>


//__________________________________________________________________

void        _HYCheckbox::_Activate (void)
{
    if (!activationFlag)
        if (isEnabled&&checkboxControl) {
            HiliteControl (checkboxControl,0);
            //Draw1Control  (checkboxControl);
            _PaintMe();
        }

    _HYPlatformComponent::_Activate();
}

//__________________________________________________________________

void        _HYCheckbox::_Deactivate (void)
{
    if (activationFlag)
        if (isEnabled&&checkboxControl) {
            HiliteControl (checkboxControl, kControlInactivePart);
            //Draw1Control  (checkboxControl);
            _PaintMe();
        }

    _HYPlatformComponent::_Deactivate();
}

//__________________________________________________________________

bool _HYCheckbox::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord*    theEvent = (EventRecord*)vEvent;
    WindowPtr       dummy;
    if (checkboxControl)
        switch (theEvent->what) {
        case mouseDown: {
            long evtType = FindWindow (theEvent->where,&dummy);
            if ((evtType == inContent)&&(isEnabled)) {
                Point localClick = theEvent->where;
                GlobalToLocal (&localClick);
                if (checkboxControl&&(PtInRect (localClick,&checkboxRect)))
                    if (!(isRadio&&checkState))
                        if (TrackControl (checkboxControl,localClick,nil)) {
                            SetState (!checkState, true);
                        }
            }
            return true;
        }
        }

    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}

//__________________________________________________________________

_HYRect     _HYCheckbox::_SuggestDimensions (void)
{
    _HYRect res = _HYLabel::_SuggestDimensions();
    if (aquaInterfaceOn) {
        res.left += checkSpacing*2 + 16;
    } else {
        res.left += checkSpacing*2 + 15;
    }

    res.right = res.left;
    return res;
}

//__________________________________________________________________
void        _HYPlatformCheckbox::_SetVisibleSize (_HYRect rel)
{
    _HYCheckbox * theParent = (_HYCheckbox*) this;

    theParent->labelRect.left= rel.left;
    theParent->labelRect.top = rel.top;

    _HYRect s = theParent->_SuggestDimensions();

    theParent->labelRect.right =  theParent->labelRect.left+s.right;
    theParent->labelRect.bottom = theParent->labelRect.top+s.bottom;

    AlignRectangle (rel, theParent->labelRect, theParent->GetAlignFlags());

    checkboxRect.left = theParent->labelRect.left + theParent->checkSpacing;
    checkboxRect.bottom = theParent->labelRect.bottom;
    if (aquaInterfaceOn) {
        checkboxRect.right = checkboxRect.left+16;
        checkboxRect.top = checkboxRect.bottom-15;

    } else {
        checkboxRect.right = checkboxRect.left+15;
        checkboxRect.top = checkboxRect.bottom-15;
    }

    if (aquaInterfaceOn) {
        theParent->labelRect.left += 16+2*theParent->checkSpacing;
    } else {
        theParent->labelRect.left += 15+2*theParent->checkSpacing;
    }

    if (checkboxControl) {
        MoveControl (checkboxControl,checkboxRect.left,checkboxRect.top);
    } else {
        GrafPtr      savePort;
        GetPort (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort (GetWindowPort(theParent->parentWindow));
#else
        SetPort (theParent->parentWindow);
#endif
        checkboxControl = NewControl (theParent->parentWindow,&checkboxRect,"\p",true,theParent->checkState,0,1,
                                      isRadio?kControlRadioButtonProc:kControlCheckBoxProc,0);
        SetPort (savePort);
    }
}

//__________________________________________________________________

void        _HYPlatformCheckbox::_Enable (bool e)
{
    if (checkboxControl) {
        if (e) {
            HiliteControl (checkboxControl,0);
        } else {
            HiliteControl (checkboxControl,kControlInactivePart);
        }

        _HYCheckbox * theParent = (_HYCheckbox*) this;
        if (e&&theParent->activationFlag)
            //Draw1Control  (checkboxControl);
        {
            _PaintMe();
        }
    }
}

//__________________________________________________________________
void        _HYPlatformCheckbox::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformCheckbox::_Paint (Ptr p)
{
    _HYCheckbox *theParent = (_HYCheckbox*) this;
    theParent->_HYPlatformLabel::_Paint(p);
    if (checkboxControl) {
        _PaintMe();
    }
}

//__________________________________________________________________
void        _HYPlatformCheckbox::_PaintMe (void)
{
    _HYCheckbox * theParent = (_HYCheckbox*)this;
    bool        drawBk = (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG));

    GrafPtr     thisPort;
    GetPort     (&thisPort);

#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort   (GetWindowPort(theParent->parentWindow));
#else
    SetPort   (theParent->parentWindow);
#endif

    RGBColor newBG,
             saveColor;

    if (drawBk) {
        GetBackColor (&saveColor);
        newBG.red = theParent->GetBackColor().R*256;
        newBG.blue = theParent->GetBackColor().B*256;
        newBG.green = theParent->GetBackColor().G*256;
        RGBBackColor (&newBG);
    }

    Draw1Control (checkboxControl);
    if (drawBk) {
        RGBBackColor (&saveColor);
    }

    SetPort     (thisPort);
}

//__________________________________________________________________
_HYPlatformCheckbox::_HYPlatformCheckbox (bool isR)
{
    checkboxControl = nil;
    isRadio = isR;
    checkboxRect = (Rect) {
        0,0,100,100
    };
}

//__________________________________________________________________
_HYPlatformCheckbox::~_HYPlatformCheckbox (void)
{
    if (checkboxControl) {
        DisposeControl (checkboxControl);
        checkboxControl = nil;
    }
}

//__________________________________________________________________
void    _HYPlatformCheckbox::_SetState (bool v)
{
    if (checkboxControl) {
        SetControlValue (checkboxControl, v);
    }
}


//EOF
\ No newline at end of file
diff --git a/src/gui/mac/Components/HYPlatformLabel.cpp b/src/gui/mac/Components/HYPlatformLabel.cpp
deleted file mode 100644
index 38a33e7..0000000
--- a/src/gui/mac/Components/HYPlatformLabel.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Button component for Mac OS.

    Sergei L. Kosakovsky Pond, May 2000 - December 2002
*/

#include "HYLabel.h"
#include "HYUtils.h"

//__________________________________________________________________

_HYPlatformLabel::_HYPlatformLabel(void)
{
    backFill = NewPixPat();
    if (!backFill) {
        warnError (-108);
    }
    RGBColor  wht = {0xffff,0xffff,0xffff};
    MakeRGBPat (backFill,&wht);
    fontID = 0;
    fc.red = fc.blue = fc.green = 0;
}

//__________________________________________________________________

_HYPlatformLabel::~_HYPlatformLabel(void)
{
    if (backFill) {
        DisposePixPat (backFill);
    }

}

//__________________________________________________________________

void        _HYPlatformLabel::_SetBackColor (_HYColor& c)
{
    RGBColor newBG;
    newBG.red = c.R*256;
    newBG.blue = c.B*256;
    newBG.green = c.G*256;
    MakeRGBPat (backFill,&newBG);

}

//__________________________________________________________________

void        _HYPlatformLabel::_SetFont (_HYFont& f)
{
    Str255 fName;
    StringToStr255 (f.face,fName);
    short fNum=0;
    GetFNum (fName,&fNum);
    fontID = fNum;
}
//__________________________________________________________________

void        _HYPlatformLabel::_SetForeColor (_HYColor& c)
{
    fc.red = c.R*256;
    fc.green = c.G*256;
    fc.blue = c.B*256;
}

//__________________________________________________________________
void        _HYPlatformLabel::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformLabel::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYLabel* theParent = (_HYLabel*) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}

//__________________________________________________________________
void        _HYPlatformLabel::_SetVisibleSize (_HYRect rel)
{
    _HYLabel* theParent = (_HYLabel*) this;
    labelRect.left=rel.left;
    labelRect.top = rel.top;
    _HYRect s = theParent->_SuggestDimensions();
    labelRect.right = labelRect.left+s.right;
    labelRect.bottom = labelRect.top+s.bottom;

    AlignRectangle (rel, labelRect, theParent->GetAlignFlags());
}


//__________________________________________________________________
void        _HYPlatformLabel::_Paint (Ptr p)
{

    _HYLabel * theParent = (_HYLabel*)this;

    _HYRect * relRect = (_HYRect*)p;
    Rect    cRect;
    cRect.left = relRect->left;
    cRect.right = relRect->right;
    cRect.top = relRect->top;
    cRect.bottom = relRect->bottom;

    if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
        FillCRect (&cRect,backFill);
    } else {
        EraseRect (&cRect);
    }

    if (!(theParent->settings.width&HY_COMPONENT_WELL)) {
        InsetRect (&cRect,2,2);
    }

    GrafPtr thisPort;
    GetPort (&thisPort);

#ifdef OPAQUE_TOOLBOX_STRUCTS
    short   savedFace = GetPortTextFont (thisPort),
            savedSize = GetPortTextSize (thisPort);

    Style   savedStyle = GetPortTextFace (thisPort);
#else
    short   savedFace = thisPort->txFont,
            savedSize = thisPort->txSize;

    Style   savedStyle = thisPort->txFace;
#endif


    TextFont (fontID);
    TextSize (theParent->GetFont().size);
    TextFace (theParent->GetFont().style);
    RgnHandle saveRgn = NewRgn();
    GetClip (saveRgn);
    ClipRect (&cRect);
    RGBColor oldColor;
    GetForeColor (&oldColor);
    if (theParent->HasShadow()) {
        MoveTo (labelRect.left+3,labelRect.bottom-3);
        RGBColor sc = fc;
        sc.red = fc.red/4;
        sc.blue  = fc.blue/4;
        sc.green = fc.green/4;
        RGBForeColor (&sc);
        DrawText (theParent->GetText().sData,0,theParent->GetText().sLength);
        MoveTo (labelRect.left+1,labelRect.bottom-1);
        sc.red = fc.red/2;
        sc.blue  = fc.blue/2;
        sc.green = fc.green/2;
        RGBForeColor (&sc);
        DrawText (theParent->GetText().sData,0,theParent->GetText().sLength);/*
        MoveTo (labelRect.left+1,labelRect.bottom-3);
        RGBColor sc = fc;
        sc.red = fc.red>127?255:fc.red*2;
        sc.blue  = fc.blue>127?255:fc.blue*2;
        sc.green = fc.green>127?255:fc.green*2;
        RGBForeColor (&sc);
        DrawText (theParent->GetText().sData,0,theParent->GetText().sLength);
        MoveTo (labelRect.left+3,labelRect.bottom-1);
        sc.red = fc.red/2;
        sc.blue  = fc.blue/2;
        sc.green = fc.green/2;
        RGBForeColor (&sc);
        DrawText (theParent->GetText().sData,0,theParent->GetText().sLength);*/

    }
    RGBForeColor (&fc);
    MoveTo (labelRect.left+2,labelRect.bottom-2);
    DrawText (theParent->GetText().sData,0,theParent->GetText().sLength);

    RGBForeColor (&oldColor);
    SetClip (saveRgn);
    DisposeRgn (saveRgn);
    TextFont (savedFace);
    TextSize (savedSize);
    TextFace (savedStyle);

    (*theParent)._HYPlatformComponent::_Paint(p);
}

//__________________________________________________________________
_HYRect _HYLabel::_SuggestDimensions (void)
{
    _HYRect res = {10,100,10,100,HY_COMPONENT_NO_SCROLL};
    GrafPtr thisPort;
    GetPort (&thisPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    short   savedFace = GetPortTextFont (thisPort),
            savedSize = GetPortTextSize (thisPort);

    Style   savedStyle = GetPortTextFace (thisPort);
#else
    short   savedFace = thisPort->txFont,
            savedSize = thisPort->txSize;

    Style   savedStyle = thisPort->txFace;
#endif
    TextFont (fontID);
    TextSize (labelFont.size);
    TextFace (labelFont.style);
    res.top = res.bottom = labelFont.size+4;
    res.left = res.right = TextWidth (labelText.sData,0,labelText.sLength) + 5;
    TextFont (savedFace);
    TextSize (savedSize);
    TextFace (savedStyle);
    return res;
}

// EOF
\ No newline at end of file
diff --git a/src/gui/mac/Components/HYPlatformList.cpp b/src/gui/mac/Components/HYPlatformList.cpp
deleted file mode 100644
index d16d76c..0000000
--- a/src/gui/mac/Components/HYPlatformList.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    List component for Mac OS API

    Sergei L. Kosakovsky Pond, May 2000-December 2002
*/

#include "errorfns.h"
#include "HYList.h"
#include "HYUtils.h"
#include "HYEventTypes.h"

#include "ToolUtils.h"
#include "Appearance.h"



_HYPlatformList::_HYPlatformList(void)
{
    listData = nil;
}

//__________________________________________________________________

_HYPlatformList::~_HYPlatformList(void)
{
    if (listData) {
        LDispose (listData);
    }
}

//__________________________________________________________________

void    _HYList::_Activate(void)
{
    if (listData) {
        LActivate (true, listData);
    }
    _HYPlatformComponent::_Activate();
}

//__________________________________________________________________

void    _HYList::_Deactivate(void)
{
    if (listData) {
        LActivate (false, listData);
    }
    _HYPlatformComponent::_Deactivate();
}

//__________________________________________________________________
void        _HYPlatformList::_SetVisibleSize (_HYRect rel)
{
    _HYList* theParent = (_HYList*) this;
    if (listData) {
        LDispose(listData);
    }

    SetWindowFont (fontID, theParent->GetFont().size, theParent->GetFont().style, true);
    Rect     listBox = {rel.top+1,rel.left,rel.bottom,rel.right-HY_SCROLLER_WIDTH},
             listDim = {0,0,theParent->ItemCount(),1};
    Point    cellSize = {0,0};
    listData = LNew(&listBox,&listDim,cellSize,0,(WindowPtr)theParent->parentWindow,true,false,false,true);
    checkPointer ((Ptr)listData);
    (*listData)->selFlags = lNoNilHilite|lUseSense;
    for (long k=0; k<theParent->ItemCount(); k++) {
        _SetItem (*theParent->GetItem(k),k);
    }

    SetWindowFont (0,0,0,false);
}

//__________________________________________________________________
void        _HYPlatformList::_Paint (Ptr p)
{
    _HYRect * relRec = (_HYRect*)p;
    Rect r;
    r.left = relRec->left;
    r.right = relRec->right;
    r.top = relRec->top;
    r.bottom = relRec->bottom;
    EraseRect (&r);
    if (listData) {
        _HYList* theParent = (_HYList*)this;
        SetWindowFont (fontID, theParent->GetFont().size, theParent->GetFont().style, true);
        LActivate (true,listData);
        LUpdate (GetGrayRgn(),listData);
        SetWindowFont (0,0,0,false);
    }
}

//__________________________________________________________________
void        _HYList::_EraseRect (_HYRect relRec)
{
    Rect r;
    r.left = relRec.left;
    r.right = relRec.right;
    r.top = relRec.top;
    r.bottom = relRec.bottom;
    EraseRect (&r);
}

//__________________________________________________________________
void        _HYPlatformList::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformList::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYList* theParent = (_HYList*) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}

//__________________________________________________________________
void        _HYPlatformList::_SetFont (void)
{
    _HYList* theParent = (_HYList*)this;
    Str255 fName;
    StringToStr255 (theParent->GetFont().face,fName);
    GetFNum (fName,&fontID);
}

//__________________________________________________________________

bool _HYList::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord*    theEvent = (EventRecord*)vEvent;

    if (listData) {
        if(theEvent->what==mouseDown) {
            Point localClick = theEvent->where;
            GlobalToLocal (&localClick);
            if (LClick (localClick,theEvent->modifiers,listData)) {
                _CheckSelection();
                if (selection.lLength==1) {
                    SendDblClickEvent(selection.lData[0]);
                    return true;
                }
            } else {
                _CheckSelection();
            }
            if (messageRecipient) {
                messageRecipient->ProcessEvent(generateKeyboardFocusEvent(GetID()));
            }
            return true;
        } else if((theEvent->what==keyDown)||(theEvent->what==autoKey)) {
            unsigned char keyCode = (theEvent->message&keyCodeMask)>>8;
            Cell     thisCell= {0,0};
            if (selection.lLength==1) {
                if (keyCode==0x7E) { // up arrow
                    if (selection.lData[0]) {
                        thisCell.v = selection.lData[0];
                        LSetSelect (false,thisCell,listData);
                        selection.lData[0]--;
                        thisCell.v--;
                        LSetSelect (true,thisCell,listData);
                        LAutoScroll(listData);
                        _MarkForUpdate();
                        SendSelectionChange();
                        return true;
                    }
                } else if (keyCode==0x7D) { // down arrow
                    if (selection.lData[0]<items.lLength-1) {
                        thisCell.v = selection.lData[0];
                        LSetSelect (false,thisCell,listData);
                        selection.lData[0]++;
                        thisCell.v++;
                        LSetSelect (true,thisCell,listData);
                        LAutoScroll(listData);
                        _MarkForUpdate();
                        SendSelectionChange();
                        return true;
                    }
                }

            }
        }
    }
    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}

//__________________________________________________________________

void _HYPlatformList::_ToggleMultSelection (bool flag)
{
    if (listData) {
        if (flag) {
            (*listData)->selFlags&=0x7F;
        } else {
            (*listData)->selFlags|=0x80;
        }
    }
}

//__________________________________________________________________

void _HYPlatformList::_CheckSelection (void)
{
    if (listData) {
        _HYList * theParent = (_HYList*)this;
        _SimpleList newSelection;
        Cell        scrollCell = {0,0};
        while (LGetSelect (true,&scrollCell,listData)) {
            newSelection<<scrollCell.v;
            scrollCell.v++;
        }
        if (!theParent->GetSelection().Equal(newSelection)) {
            theParent->GetSelection().Clear();
            theParent->GetSelection().Duplicate (&newSelection);
            theParent->SendSelectionChange();
        }
    }
}

//__________________________________________________________________

void _HYPlatformList::_SetSelection (_SimpleList& nSel)
{
    if (listData) {
        _KillSelection();
        if (nSel.lLength) {
            Cell scrollCell = {0,0};
            for (long k=0; k<nSel.lLength; k++) {
                scrollCell.v = nSel.lData[k];
                LSetSelect (true,scrollCell,listData);
            }
            LAutoScroll (listData);
        }
    }
}

//__________________________________________________________________

void _HYPlatformList::_KillSelection (void)
{
    if (listData) {
        Cell        scrollCell = {0,0};
        while (LGetSelect (true,&scrollCell,listData)) {
            LSetSelect (false,scrollCell,listData);
            scrollCell.v++;
        }
    }
}

//__________________________________________________________________

void _HYPlatformList::_InsertItem (_String& item, long index)
{
    if (listData) {
        if (index<0) {
            index = 10000;
        }
        index = LAddRow(1,index,listData);
        Cell    thisCell = {index,0};
        LSetCell(item.sData,item.sLength,thisCell,listData);
    }
}

//__________________________________________________________________

void _HYPlatformList::_SetItem (_String& item, long index)
{
    if (listData) {
        Cell    thisCell = {index,0};
        LSetCell(item.sData,item.sLength,thisCell,listData);
    }
}

//__________________________________________________________________

void _HYList::_ToggleDrawing (bool onOff)
{
    if (listData) {
        LSetDrawingMode (onOff,listData);
    }
}

//__________________________________________________________________

void _HYPlatformList::_DeleteItem (long index)
{
    if (listData) {
        LDelRow(1,index,listData);
    }
    //_CheckSelection();
}


//EOF
\ No newline at end of file
diff --git a/src/gui/mac/Components/HYPlatformPullDown.cpp b/src/gui/mac/Components/HYPlatformPullDown.cpp
deleted file mode 100644
index 9d157e3..0000000
--- a/src/gui/mac/Components/HYPlatformPullDown.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Button component for Mac OS.

    Sergei L. Kosakovsky Pond, May 2000.
*/

#include "errorfns.h"
#include "HYPullDown.h"
#include "HYUtils.h"
#include "HYEventTypes.h"

#include "ToolUtils.h"


long    menuIDCounter = 20000;


//__________________________________________________________________

_HYPlatformPullDown::_HYPlatformPullDown(void)
{
    myID = menuIDCounter++;
    myMenu = NewMenu(myID,"\p");
    backFill = NewPixPat();
    if ((!backFill)||(!myMenu)) {
        warnError (-108);
    }
    InsertMenu (myMenu,hierMenu);
    RGBColor  wht = {0xffff,0xffff,0xffff};
#ifdef TARGET_API_MAC_CARBON
    EnableMenuItem (myMenu,0);
#else
    EnableItem (myMenu,0);
#endif
    MakeRGBPat (backFill,&wht);
    selection = 0;

}

//__________________________________________________________________

_HYPlatformPullDown::~_HYPlatformPullDown(void)
{
    if (myMenu) {
        DeleteMenu (myID);
        DisposeMenu (myMenu);
    }
    if (backFill) {
        DisposePixPat (backFill);
    }
}

//__________________________________________________________________
void        _HYPlatformPullDown::_AddMenuItem   (_String& newItem, long index)
{
    if (!myMenu) {
        return;
    }

    if (index<=0) {
        index = 10000;
    }

    if (!newItem.Equal(&menuSeparator)) {
        Str255          menuText;
        bool            disableMe = false;
        if (newItem.sLength && newItem.sData[0] == '(') {
            _String         skipString (newItem,1,-1);
            StringToStr255  (skipString,menuText);
            disableMe = true;
        } else {
            StringToStr255 (newItem,menuText);
        }

        InsertMenuItem (myMenu,"\pa",index);

        long            mc = ((_HYPullDown*)this)->MenuItemCount();

        if (index<mc-1) {
            index++;
        } else {
            index = mc;
        }

        if (menuText[0]>250) {
            menuText[0] = 250;
        }

        SetMenuItemText (myMenu, index, menuText);
        if (disableMe) {
            DisableMenuItem (myMenu, index);
        }
    } else {
        InsertMenuItem (myMenu,"\p(-",index);
    }
}

//__________________________________________________________________
void        _HYPlatformPullDown::_SetMenuItem   (_String& newItem, long index)
{
    if (!myMenu) {
        return;
    }
    index++;
    if (!newItem.Equal(&menuSeparator)) {
        Str255 menuText;
        StringToStr255 (newItem,menuText);
        SetMenuItemText (myMenu,index,menuText);
    } else {
        SetMenuItemText (myMenu,index,"\p(-");
    }
}

//__________________________________________________________________
void        _HYPlatformPullDown::_MarkItem      (long index, char mark)
{
    if (!myMenu) {
        return;
    }

    switch (mark) {
    case HY_PULLDOWN_CHECK_MARK:
        mark = checkMark;
        break;

    case HY_PULLDOWN_DIAMOND_MARK:
        mark = diamondMark;
        break;

    case HY_PULLDOWN_BULLET_MARK:
        mark = 0xA5;
        break;

    default:
        mark = noMark;
    }
    SetItemMark (myMenu,index+1,mark);
}

//__________________________________________________________________
char        _HYPlatformPullDown::_ItemMark      (long index)
{
    if (!myMenu) {
        return 0;
    }

    short   mark;
    GetItemMark (myMenu, index+1,&mark);

    switch (mark) {
    case checkMark:
        return HY_PULLDOWN_CHECK_MARK;

    case diamondMark:
        return HY_PULLDOWN_DIAMOND_MARK;

    case 0xA5:
        return HY_PULLDOWN_BULLET_MARK;

    }
    return HY_PULLDOWN_NO_MARK;
}

//__________________________________________________________________
void        _HYPlatformPullDown::_DeleteMenuItem  (long index)
{
    if (!myMenu) {
        return;
    }
    DeleteMenuItem (myMenu,index+1);
}

//__________________________________________________________________

void        _HYPlatformPullDown::_SetBackColor (_HYColor& c)
{
    RGBColor newBG;
    newBG.red = c.R*256;
    newBG.blue = c.B*256;
    newBG.green = c.G*256;
    MakeRGBPat (backFill,&newBG);

}

//__________________________________________________________________
long        _HYPlatformPullDown::_GetSelection (void)
{
    return selection;
}

//__________________________________________________________________
void        _HYPlatformPullDown::_Duplicate (Ptr p)
{
    _HYPullDown * theSource = (_HYPullDown*) p;
    myMenu                  = theSource->myMenu;
    myID                    = theSource->myID;
    selection               = theSource->selection;
    backFill                = theSource->backFill;
    theSource->backFill     = nil;
    theSource->myMenu       = nil;
}

//__________________________________________________________________
void        _HYPlatformPullDown::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformPullDown::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYPullDown* theParent = (_HYPullDown*) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}

//__________________________________________________________________
void        _HYPlatformPullDown::_SetVisibleSize (_HYRect rel)
{
    _HYPullDown* theParent = (_HYPullDown*) this;
    menuRect.left   = rel.left+3;
    menuRect.bottom = rel.bottom;
    menuRect.right  = rel.right-3;
    menuRect.top    = rel.top;
    if (myMenu) {
        CalcMenuSize (myMenu);
        if (menuRect.bottom-menuRect.top>20) {
            menuRect.bottom = menuRect.top+20;
        }
#ifdef OPAQUE_TOOLBOX_STRUCTS
        if (menuRect.right-menuRect.left>GetMenuWidth (myMenu)+22) {
            menuRect.right = menuRect.left+GetMenuWidth (myMenu) +22;
        }
#else
        if (menuRect.right-menuRect.left>(*myMenu)->menuWidth+22) {
            menuRect.right = menuRect.left+(*myMenu)->menuWidth+22;
        }
#endif
    }

    AlignRectangle (rel, menuRect, theParent->GetAlignFlags());
}
//__________________________________________________________________
void        _HYPlatformPullDown::_EnableItem (long theItem, bool toggle)
{
    if (myMenu)
        if (toggle)
#ifdef TARGET_API_MAC_CARBON
            EnableMenuItem (myMenu,theItem+1);
#else
            EnableItem (myMenu,theItem+1);
#endif
        else
#ifdef TARGET_API_MAC_CARBON
            DisableMenuItem (myMenu,theItem+1);
#else
            DisableItem (myMenu,theItem+1);
#endif
}

//__________________________________________________________________
void        _HYPlatformPullDown::_Paint (Ptr p)
{
    _HYPullDown * theParent = (_HYPullDown*)this;

    _HYRect * relRect = (_HYRect*)p;
    Rect    cRect;
    cRect.left = relRect->left;
    cRect.right = relRect->right;
    cRect.top = relRect->top;
    cRect.bottom = relRect->bottom;
    if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
        FillCRect (&cRect,backFill);
    } else {
        EraseRect (&cRect);
    }

    if (theParent->MenuItemCount()) {
        DrawMenuPlaceHolder (menuRect,*theParent->GetMenuItem(selection),theParent->IsEnabled()&&theParent->activationFlag);
    }

    (*theParent)._HYPlatformComponent::_Paint(p);
}

//__________________________________________________________________
_HYRect _HYPullDown::_SuggestDimensions (void)
{
    _HYRect res = {25,100,25,100,HY_COMPONENT_NO_SCROLL};
#ifdef OPAQUE_TOOLBOX_STRUCTS
    if (myMenu) {
        res.right = GetMenuWidth (myMenu)+22;
    }
#else
    if (myMenu) {
        res.right = (*myMenu)->menuWidth+22;
    }
#endif
    return res;
}

//__________________________________________________________________

void    _HYPullDown::_SetMenuItemTextStyle (long ID, char style)
{
    if (myMenu) {
        SetItemStyle (myMenu,ID+1,style);
    }
}

//__________________________________________________________________

bool _HYPullDown::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord*    theEvent = (EventRecord*)vEvent;
    if (myMenu)
        switch (theEvent->what) {
        case mouseDown: {
            if (enabledFlag) {
                Point localClick = theEvent->where;
                GlobalToLocal (&localClick);
                if (PtInRect(localClick,&menuRect)) {
                    if (messageRecipient) {
                        messageRecipient->ProcessEvent (generateMenuOpenEvent (GetID()));
                    }

                    localClick.v = menuRect.top;
                    localClick.h = menuRect.left;
                    LocalToGlobal(&localClick);
                    SetItemMark (myMenu,selection+1,checkMark);
                    unsigned long res = PopUpMenuSelect (myMenu,localClick.v, localClick.h, selection+1);
                    SetItemMark (myMenu,selection+1,noMark);
                    if (HiWord(res)!=0) {
                        selection = LoWord(res)-1;
                        SendSelectionChange();
                        _MarkForUpdate();
                    }
                }
            }
            return true;
        }
        }
    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}

//EOF
\ No newline at end of file
diff --git a/src/gui/mac/Components/HYPlatformSequencePane.cpp b/src/gui/mac/Components/HYPlatformSequencePane.cpp
deleted file mode 100644
index a89b945..0000000
--- a/src/gui/mac/Components/HYPlatformSequencePane.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Sequence Panel for Mac OS API

    Sergei L. Kosakovsky Pond, May 2000-December 2002
*/

#include "errorfns.h"
#include "HYSequencePanel.h"
#include "HYUtils.h"
#include "HYEventTypes.h"
#include "HYPlatformWindow.h"

#include "ToolUtils.h"
#include "Appearance.h"


//__________________________________________________________________

void    _HYSequencePane::_Paint (Ptr p)
{
    long        saveBorder = settings.width & HY_COMPONENT_BORDER;
    settings.width -= saveBorder;
    _HYPlatformComponent::_Paint(p);
    settings.width += saveBorder;
    _HYRect*    destR = (_HYRect*)p;

    Rect        srcRect,
                destRect;

    destRect.right      = destR->right;
    destRect.bottom     = destR->bottom;
    if (HasHScroll()) {
        destRect.bottom-= HY_SCROLLER_WIDTH;
    }

    if (HasVScroll()) {
        destRect.right -= HY_SCROLLER_WIDTH;
    }

    destRect.left       = destR->left;
    destRect.top        = destR->top;
    _HYRect srcR        = _VisibleContents (p);
    srcRect.right       = srcR.right-srcR.left;
    srcRect.left        = 0;
    srcRect.bottom      = srcR.bottom-srcR.top;
    srcRect.top         = 0;

    RGBColor         white = {0xffff,0xffff,0xffff};
    RGBBackColor (&white);
    white.red = white.green = white.blue = 0;
    RGBForeColor (&white);
    LockPixels (GetGWorldPixMap(thePane));
#ifdef OPAQUE_TOOLBOX_STRUCTS
    CopyBits (GetPortBitMapForCopyBits(thePane),GetPortBitMapForCopyBits(GetWindowPort(parentWindow)),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#else
    CopyBits (&(GrafPtr(thePane)->portBits),&(parentWindow->portBits),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#endif
    UnlockPixels (GetGWorldPixMap(thePane));
}

//__________________________________________________________________

bool _HYSequencePane::_ProcessOSEvent (Ptr vEvent)
{
    if (_HYPlatformComponent::_ProcessOSEvent (vEvent)) {
        return true;
    }
    EventRecord*    theEvent = (EventRecord*)vEvent;

    if (!active) {
        return false;
    }

    static  UInt32  lastClick = 0;

    static  int     lastH = 0,
                    lastV = 0;

    switch (theEvent->what) {
    case mouseDown: {
        Point p = theEvent->where;
        GlobalToLocal (&p);
        bool    dblClick = (theEvent->when-lastClick<GetDblTime())&&
                           (abs(p.h-lastH)<5)&&
                           (abs(p.v-lastV)<5);
        lastClick = theEvent->when;
        lastH = p.h;
        lastV = p.v;


        Point localClick = theEvent->where;
        bool  vertical;
        GlobalToLocal (&localClick);
        if ((!(theEvent->modifiers&shiftKey)||(theEvent->modifiers&cmdKey))) {
            forceUpdateForScrolling = true;
        }
        localClick.h -= rel.left;
        localClick.v -= rel.top;
        vertical = (localClick.h<headerWidth)&&(localClick.v>=(GetSlotHeight()+1));
        if (theEvent->modifiers&controlKey) {
            if ((vertical&&vselection.lLength)||((!vertical)&&selection.lLength)) {
                ProcessContextualPopUp (theEvent->where.h, theEvent->where.v);
                return true;
            }
        }
        if (vertical) {
            ProcessVSelectionChange (localClick.h,localClick.v,theEvent->modifiers&shiftKey,theEvent->modifiers&cmdKey, false, dblClick);
        } else {
            ProcessSelectionChange (localClick.h,localClick.v,theEvent->modifiers&shiftKey,theEvent->modifiers&cmdKey);
        }

        if (((vertical&&(vselection.lLength==1))||((!vertical)&&(selection.lLength==1)))&&StillDown()) {
            Point localClick = theEvent->where;
            GlobalToLocal (&localClick);
            localClick.h -= rel.left;
            localClick.v -= rel.top;
            long  lastClick = -2, slotHeight = GetSlotHeight(),
                  firstClick = (localClick.v-(GetSlotHeight()+1))/slotHeight,
                  wHeight = rel.bottom-rel.top-HY_SCROLLER_WIDTH,
                  originalStart = startRow,
                  originalSpan  = endRow-startRow;

            if (vertical) {
                PenMode (patXor);
            }
            forceUpdateForScrolling = true;

            while (WaitMouseUp()) {
                Point mousePos;
                GetMouse (&mousePos);
                mousePos.h -= rel.left;
                mousePos.v -= rel.top;
                if (vertical) {
                    if ((mousePos.v<(GetSlotHeight()+1))||(localClick.v!=mousePos.v)||(mousePos.v>wHeight)) {
                        localClick = mousePos;
                        if (mousePos.v>wHeight) {
                            // scroll down
                            if ((endRow<=speciesIndex.lLength)&&(vselection.lData[0]!=speciesIndex.lLength-1)) {
                                if (endRow-startRow<originalSpan) {
                                    continue;
                                }
                                startRow++;
                                endRow++;
                                _SetVScrollerPos(((double)MAX_CONTROL_VALUE*startRow)/
                                                 (speciesIndex.lLength-endRow+startRow+1));
                                BuildPane();
                                _MarkForUpdate();
                                lastClick = -2;
                            }
                            continue;
                        } else {
                            mousePos.v-=(GetSlotHeight()+1);
                            if (mousePos.v<=slotHeight) {
                                if (mousePos.v>=0) {
                                    if (mousePos.v<slotHeight/2) {
                                        mousePos.v = -1;
                                    } else {
                                        mousePos.v = 0;
                                    }
                                } else {
                                    // scroll up
                                    if (startRow>0) {
                                        startRow--;
                                        endRow--;
                                        _SetVScrollerPos(((double)MAX_CONTROL_VALUE*startRow)/(speciesIndex.lLength-endRow+startRow+1));
                                        BuildPane();
                                        _MarkForUpdate();
                                        lastClick = -2;
                                    }
                                    continue;
                                }
                            } else {
                                mousePos.v=(mousePos.v-(GetSlotHeight()+1))/slotHeight;
                            }
                        }

                        if ((mousePos.v<-1)||(mousePos.v>=(endRow-startRow))) {
                            continue;
                        }
                        if (mousePos.v!=lastClick) {
                            if (lastClick>=-1) {
                                lastClick = (GetSlotHeight()+1)+slotHeight*(lastClick+1)+rel.top+1;
                                MoveTo(rel.left+1,lastClick);
                                LineTo(rel.left+headerWidth-1,lastClick);
                            }
                            lastClick = mousePos.v;
                            if (lastClick+startRow!=firstClick+originalStart) {
                                mousePos.v = (GetSlotHeight()+1)+slotHeight*(lastClick+1)+rel.top+1;
                                MoveTo(rel.left+1,mousePos.v);
                                LineTo(rel.left+headerWidth-1,mousePos.v);
                            }
                        }
                    }
                } else {
                    if ((mousePos.h<headerWidth)||(localClick.h!=mousePos.h)||(mousePos.h>_HYCanvas::GetMaxW()-5)) {
                        ProcessSelectionChange (mousePos.h,mousePos.v,true,true,true);
                        localClick = mousePos;
                    }
                }
            }
            if  (vertical) {
                Rect invalRect = {rel.top+(GetSlotHeight()+1)+1,rel.left,rel.bottom-HY_SCROLLER_WIDTH,rel.left+headerWidth};
#ifdef TARGET_API_MAC_CARBON
                InvalWindowRect (parentWindow,&invalRect);
#else
                InvalRect (&invalRect);
#endif
                if ((localClick.h<headerWidth)&&(localClick.h>0)&&(lastClick>-2)) {
                    MoveSpecies (firstClick+originalStart,lastClick+startRow);
                }
                PenMode (patCopy);
            }
        }
        forceUpdateForScrolling = false;
        return true;
    }
    }
    return false;
}


//EOF
\ No newline at end of file
diff --git a/src/gui/mac/Components/HYPlatformTable.cpp b/src/gui/mac/Components/HYPlatformTable.cpp
deleted file mode 100644
index 8f66c9c..0000000
--- a/src/gui/mac/Components/HYPlatformTable.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Table component for Mac OS API

    Sergei L. Kosakovsky Pond, May 2000-December 2002
*/

#include "errorfns.h"
#include "HYTableComponent.h"
#include "HYUtils.h"
#include "HYEventTypes.h"
#include "HYPlatformWindow.h"
#include "HYPlatformGraphicPane.h"

#include "ToolUtils.h"
#include "Appearance.h"

//__________________________________________________________________

#if TARGET_API_MAC_CARBON
#include <PMApplication.h>
extern PMPageFormat     gPageFormat;
extern PMPrintSettings  gPrintSettings;
extern Handle           gFlattenedFormat;
extern Handle           gFlattenedSettings;
#else
#include <Printing.h>
extern THPrint prRecHdl;
#endif


//__________________________________________________________________

extern      Cursor      hSizeCursor,
            editStateCursor;

extern      CCrsrHandle pickUpCursor,
            dropOffCursor;

extern      Pattern     penHatchPattern,
            vertPenHatchPattern;

extern      RGBColor    menuLine1,
            menuLine2;

extern      CIconHandle tablePDMenuIcon;


//__________________________________________________________________

_HYPlatformTable::_HYPlatformTable(void)
{
    fontID = 0;
    backPattern  = NewPixPat();
    backPattern2 = NewPixPat();
    cursorState  = false;
    editBox      = nil;
}

//__________________________________________________________________

_HYPlatformTable::~_HYPlatformTable(void)
{
    DisposePixPat (backPattern);
    DisposePixPat (backPattern2);
}

//__________________________________________________________________

void        _HYPlatformTable::_SetFont (void)
{
    _HYTable* parent = (_HYTable*)this;
    Str255 fName;
    StringToStr255 (parent->textFont.face,fName);
    short fNum=0;
    GetFNum (fName,&fNum);
    fontID = fNum;
}

//__________________________________________________________________
void        _HYTable::_HScrollTable (long h)
{
    if (h) {
        GrafPtr   savePort;
        GetPort   (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort   (GetWindowPort(parentWindow));
#else
        SetPort   (parentWindow);
#endif
        long        vsShift = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0),
                    hsShift = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);
        EditBoxHandler  (-1,rel);
        if (abs(h)>(rel.right-rel.left)/2) {
            _Paint((Ptr)&rel);
        } else {
            RgnHandle updateRgn = NewRgn();
            checkPointer (updateRgn);
            Rect      scrollRect;
            _HYRect   paintRect;
            scrollRect.top = rel.top;
            scrollRect.bottom = rel.bottom-vsShift;
            scrollRect.right = rel.right-hsShift-1;
            scrollRect.left  = rel.left;
            paintRect.top = scrollRect.top;
            paintRect.bottom = rel.bottom;
            if (h>0) {
                ScrollRect (&scrollRect,-h,0,updateRgn);
                paintRect.right = scrollRect.right+hsShift;
                paintRect.left = scrollRect.right-h;
                hOrigin+=paintRect.left-rel.left;
                Paint((Ptr)&paintRect);
                hOrigin-=paintRect.left-rel.left;
            } else {
                ScrollRect (&scrollRect,-h,0,updateRgn);
                paintRect.left = scrollRect.left;
                paintRect.right = paintRect.left-h+hsShift;
                Paint((Ptr)&paintRect);
            }
            DisposeRgn (updateRgn);
        }
        SetPort (savePort);
    }
}

//__________________________________________________________________
void        _HYTable::_VScrollTable (long v)
{
    if (v) {
        GrafPtr   savePort;
        GetPort   (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort   (GetWindowPort(parentWindow));
#else
        SetPort   (parentWindow);
#endif
        long        vsShift = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0),
                    hsShift = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);
        EditBoxHandler  (-1,rel);
        if (abs(v)>(rel.bottom-rel.top)/2) {
            _Paint((Ptr)&rel);
        } else {
            RgnHandle updateRgn = NewRgn();
            checkPointer (updateRgn);
            Rect      scrollRect;
            _HYRect   paintRect;
            scrollRect.left = rel.left;
            scrollRect.right = rel.right-hsShift;
            paintRect.left = scrollRect.left;
            paintRect.right = rel.right;
            scrollRect.top = rel.top;
            scrollRect.bottom  = rel.bottom-vsShift;
            if (v>0) {
                ScrollRect (&scrollRect,0,-v,updateRgn);
                paintRect.top = rel.bottom-vsShift-v-1;
                paintRect.bottom = rel.bottom;
                vOrigin+=paintRect.top-rel.top;
                Paint((Ptr)&paintRect);
                vOrigin-=paintRect.top-rel.top;
            } else {
                ScrollRect (&scrollRect,0,-v,updateRgn);
                paintRect.top = rel.top;
                paintRect.bottom = rel.top-v+vsShift+2;
                Paint((Ptr)&paintRect);
            }
            DisposeRgn (updateRgn);
        }
        SetPort (savePort);
    }
}


//__________________________________________________________________

void        _HYTable::_ComponentMouseExit (void)
{
    if (cursorState) {
        cursorState = 0;
#ifdef TARGET_API_MAC_CARBON
        Cursor arrow;
        SetCursor(GetQDGlobalsArrow(&arrow));
#else
        SetCursor (&qd.arrow);
#endif
    }
}
//__________________________________________________________________

bool        _HYTable::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord*    theEvent = (EventRecord*)vEvent;
    WindowPtr       dummy;

    static  UInt32  lastClick = 0;
    static  int     lastH = 0, lastV = 0;

    long            k,h,v,
                    vsShift = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0),
                    hsShift = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);

    switch (theEvent->what) {
    case mouseDown: {
        Point p = theEvent->where;
        GlobalToLocal (&p);
        bool    dblClick = (theEvent->when-lastClick<GetDblTime())&&
                           (abs(p.h-lastH)<5)&&
                           (abs(p.v-lastV)<5);
        lastClick = theEvent->when;
        lastH = p.h;
        lastV = p.v;

        if ((selectionType&HY_TABLE_FOCUSABLE)&&messageRecipient&&((selectionType&HY_TABLE_IS_FOCUSED)==0)) {
            messageRecipient->ProcessEvent(generateKeyboardFocusEvent (GetID()));
            //return true;
        }

        long evtType = FindWindow (theEvent->where,&dummy);
        switch (evtType) {
        case inContent: {
            if (cursorState == HY_TABLE_SIZE_CURSOR) {
                EditBoxHandler (-1,rel);
                RgnHandle       dragRgn = NewRgn();
                checkPointer    (dragRgn);
                Rect  limits;
                limits.left = p.h;
                limits.right = limits.left+1;
                limits.top = rel.top;
                limits.bottom = rel.bottom-vsShift;
                RectRgn       (dragRgn, &limits);
                limits.right = rel.right-hsShift;

                p.h+=hOrigin;
                for (evtType = 0; evtType<horizontalSpaces.lLength-1; evtType++)
                    if (horizontalSpaces.lData[evtType]>p.h-2-rel.left) {
                        break;
                    }
                if (evtType) {
                    limits.left = rel.left+horizontalSpaces.lData[evtType-1]+3-hOrigin;
                } else {
                    limits.left = rel.left+3;
                }

                long dragRes = horizontalSpaces.lData[horizontalSpaces.lLength-1]-
                               rel.right+rel.left-hOrigin+hsShift;

                if (dragRes<p.h-limits.left) {
                    limits.left = p.h-dragRes;
                }
                p.h-=hOrigin;
                dragRes = DragGrayRgn(dragRgn,p,&limits,&limits,hAxisOnly,nil);
                DisposeRgn (dragRgn);
                cursorState = false;
#ifdef TARGET_API_MAC_CARBON
                Cursor arrow;
                SetCursor(GetQDGlobalsArrow(&arrow));
#else
                SetCursor (&qd.arrow);
#endif
                if (dragRes!=kMouseUpOutOfSlop) {
                    SetColumnSpacing (evtType,(short)(dragRes&0x0000ffff),true);
                    if (messageRecipient)
                        messageRecipient->ProcessEvent (generateTableResizeCEvent(GetID(),
                                                        evtType,(short)(dragRes&0x0000ffff)));
                }
            } else {
                if (editBox&&PtInRect (p,&textBoxRect)) {
                    TEClick (p,theEvent->modifiers&shiftKey, editBox);
                } else {
                    if (((k=FindClickedTableCell (p.h-rel.left,p.v-rel.top,h,v))>-1)&&
                            (p.v<rel.bottom-vsShift)&&(p.h<rel.right-hsShift)) {
                        if (dblClick) {
                            if (cellTypes.lData[k]&HY_TABLE_EDIT_TEXT) {
                                EditBoxHandler (k,rel);
                            } else if (messageRecipient) {
                                messageRecipient->ProcessEvent (generateTableDblClickEvent(GetID()));
                            }
                            break;
                        }
                        ModifySelection (h,v,theEvent->modifiers&shiftKey,theEvent->modifiers&controlKey, true);
                    }

                    if (k==-2)
                        // process pull-down
                    {
                        if (messageRecipient) {
                            messageRecipient->ProcessEvent (generateTablePullDownEvent(GetID(),v*horizontalSpaces.lLength+h,
                                                            (((long)theEvent->where.h)<<16)+theEvent->where.v));
                        }
                        //_HandlePullDown (sampleMenu,theEvent->where.h,theEvent->where.v,2);
                        break;
                    }

                    if ((p.h<rel.right-hsShift)&&(p.v<rel.bottom-vsShift))
                        if (StillDown()) {
                            PenState    savePen;
                            GetPenState (&savePen);
                            bool    first = true;
                            Point   newPt, oldPt = p;
                            long    t,t2 = -1;
                            FindClickedTableCell(p.h-rel.left,p.v-rel.top,h,t);

                            if (cursorState == HY_TABLE_DRAG_CURSOR) {
                                SetCCursor (dropOffCursor);
                                //PenMode      (patXor);
                                PenSize    (1,1);
                                while ( WaitMouseUp() ) {
                                    GetMouse(&newPt);
                                    if ((newPt.v>rel.bottom-vsShift)||(newPt.v<rel.top)) {
                                        if (t2>=0) {
                                            _HiliteRowForDrag (t2,t);
                                            t2 = -1;
                                        }
                                        h = verticalSpaces.lData[verticalSpaces.lLength-1]/verticalSpaces.lLength;
                                        _ScrollVPixels ((newPt.v<rel.top)?-h:h);
                                        continue;
                                    }
                                    if (newPt.h>rel.right-hsShift) {
                                        newPt.h=rel.right-hsShift;
                                    }
                                    if ( DeltaPoint(oldPt, newPt) ) {
                                        k = FindClickedTableCell(newPt.h-rel.left,newPt.v-rel.top,h,v);
                                        if ((v!=t2)&&(k>-1)) {
                                            if (t2>=0) {
                                                _HiliteRowForDrag (t2,t);
                                            }
                                            if ((v!=t)&&(!(cellTypes.lData[k]&HY_TABLE_CANTSELECT))) {
                                                _HiliteRowForDrag (v,t);
                                                t2 = v;
                                            } else {
                                                t2 = -1;
                                            }
                                        }
                                        oldPt = newPt;
                                    }
                                }
                                if (t2>=0) {
                                    _HiliteRowForDrag (t2,t);
                                }

                                SetCCursor (pickUpCursor);
                                if (t!=t2) {
                                    EditBoxHandler (-1,rel);
                                    DragRow (t,t2);
                                }
                            } else {
                                if (((selectionType&HY_TABLE_SINGLE_SELECTION)==0)
                                        &&((selectionType&HY_TABLE_NODRAG_SELECTION)==0)) {
                                    PenSize (3,3);
                                    PenMode (patXor);
                                    Pattern pPat;
                                    GetIndPattern (&pPat,0,4);
                                    PenPat  (&pPat);

                                    Rect    outlineRect,
                                            paintRect,
                                            clippingRect;

                                    clippingRect = HYRect2Rect (rel);

                                    outlineRect.right  = outlineRect.left = p.h;
                                    outlineRect.bottom = outlineRect.top  = p.v;

                                    while ( WaitMouseUp() ) {
                                        GetMouse(&newPt);
                                        if (newPt.v>rel.bottom-vsShift) {
                                            if (rel.bottom-rel.top-vsShift+vOrigin <  verticalSpaces.lData[verticalSpaces.lLength-1]-1) {
                                                long h = verticalSpaces.lData[verticalSpaces.lLength-1]/verticalSpaces.lLength;
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                                PenMode (patCopy);
                                                SetPenState (&savePen);
                                                _ScrollVPixels (h);
                                                PenSize (3,3);
                                                PenMode (patXor);
                                                PenPat  (&pPat);
                                                outlineRect.top -= h;
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                                p.v -= h;
                                                oldPt.v -= h;
                                                continue;
                                            }
                                            newPt.v=rel.bottom-vsShift;
                                        }
                                        if (newPt.h>rel.right-hsShift) {
                                            if (rel.right-rel.left-hsShift+hOrigin <  horizontalSpaces.lData[horizontalSpaces.lLength-1]-1) {
                                                long h = horizontalSpaces.lData[horizontalSpaces.lLength-1]/horizontalSpaces.lLength;
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                                PenMode (patCopy);
                                                SetPenState (&savePen);
                                                _ScrollHPixels (h);
                                                PenSize (3,3);
                                                PenMode (patXor);
                                                PenPat  (&pPat);
                                                outlineRect.left -= h;
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                                p.h -= h;
                                                oldPt.h -= h;
                                                continue;
                                            }
                                            newPt.h=rel.right-hsShift;
                                        }
                                        if (newPt.v<rel.top) {
                                            if (vOrigin>0) {
                                                long h = verticalSpaces.lData[verticalSpaces.lLength-1]/verticalSpaces.lLength;
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                                PenMode (patCopy);
                                                SetPenState (&savePen);
                                                _ScrollVPixels (-h);
                                                PenSize (3,3);
                                                PenMode (patXor);
                                                PenPat  (&pPat);
                                                outlineRect.top += h;
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                                p.v += h;
                                                oldPt.v += h;
                                                continue;
                                            }
                                            newPt.v=rel.top;
                                        }
                                        if (newPt.h<rel.left) {
                                            if (hOrigin>0) {
                                                long h = horizontalSpaces.lData[horizontalSpaces.lLength-1]/horizontalSpaces.lLength;
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                                PenMode (patCopy);
                                                SetPenState (&savePen);
                                                _ScrollHPixels (-h);
                                                PenSize (3,3);
                                                PenMode (patXor);
                                                PenPat  (&pPat);
                                                outlineRect.left += h;
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                                p.h += h;
                                                oldPt.h += h;
                                                continue;
                                            }
                                            newPt.h=rel.left;
                                        }

                                        if ( DeltaPoint(oldPt, newPt) ) {
                                            if (!first) {
                                                SectRect (&outlineRect,&clippingRect,&paintRect);
                                                FrameRect (&paintRect);
                                            }

                                            if (newPt.h > p.h) {
                                                outlineRect.right = newPt.h;
                                            } else {
                                                outlineRect.right = p.h;
                                                outlineRect.left = newPt.h;
                                            }
                                            if (newPt.v > p.v) {
                                                outlineRect.bottom = newPt.v;
                                            } else {
                                                outlineRect.bottom = p.v;
                                                outlineRect.top = newPt.v;
                                            }
                                            SectRect (&outlineRect,&clippingRect,&paintRect);
                                            FrameRect (&paintRect);
                                            first = false;
                                            oldPt = newPt;
                                        }
                                    }

                                    if (!first) {
                                        SectRect (&outlineRect,&clippingRect,&paintRect);
                                        FrameRect (&paintRect);
                                        _HYRect     outlineHRect;
                                        outlineHRect.left   = outlineRect.left;
                                        outlineHRect.right  = outlineRect.right+hsShift;
                                        outlineHRect.top    = outlineRect.top;
                                        outlineHRect.bottom = outlineRect.bottom+vsShift;
                                        long    hs,hf,vs,vf;
                                        hOrigin += outlineRect.left-rel.left;
                                        vOrigin += outlineRect.top-rel.top;
                                        GetDisplayRange (&outlineHRect,hs,hf,vs,vf);
                                        hOrigin -= outlineRect.left-rel.left;
                                        vOrigin -= outlineRect.top-rel.top;
                                        ExpungeSelection();
                                        if ((hf>=hs)||(vs>=vf)) {
                                            _SimpleList sel;
                                            if (selectionType&HY_TABLE_SEL_ROWS) {
                                                sel.RequestSpace (vf-vs+1);
                                                for (h=vs; h<=vf; h++) {
                                                    sel<<h;
                                                }
                                                SetRowSelection (sel);
                                            } else if (selectionType&HY_TABLE_SEL_COLS) {
                                                sel.RequestSpace (hf-hs+1);
                                                for (v=hs; v<=hf; h++) {
                                                    sel<<v;
                                                }
                                                SetColumnSelection(sel);

                                            } else {
                                                sel.RequestSpace ((vf-vs+1)*(hf-hs+1));
                                                for (h=hs; h<=hf; h++)
                                                    for (v=vs; v<=vf; v++) {
                                                        sel << v*horizontalSpaces.lLength + h;
                                                    }
                                                SetSelection (sel,true);
                                                _MarkCellsForUpdate (sel);
                                            }
                                        }
                                    }
                                }
                                SetPenState (&savePen);
                            }
                        }
                }
            }
        }
        }
        break;
    }
    case keyDown:
    case autoKey: {
        char    c = theEvent->message&charCodeMask,
                k = (theEvent->message&keyCodeMask)>>8;

        if (editBox) {
            if (theEvent->modifiers&cmdKey) {
                if ((c=='c')||(c=='C')) {
                    TECopy (editBox);
                } else if ((c=='x')||(c=='X')) {
                    TECut (editBox);
                } else if ((c=='v')||(c=='V')) {
                    TEPaste (editBox);
                }
            } else {
                if ((k==0x24)||(k==0x4C)) {
                    EditBoxHandler (-1,rel);
                } else {
                    TEKey (c,editBox);
                }
            }
            return true;
        } else
            switch (k) {
            case 0x7E: // up
                HandleKeyMove (0,theEvent->modifiers & cmdKey);
                break;
            case 0x7D: // down
                HandleKeyMove (1,theEvent->modifiers & cmdKey);
                break;
            case 0x7B: // left
                HandleKeyMove (2,theEvent->modifiers & cmdKey);
                break;
            case 0x7C: // right
                HandleKeyMove (3,theEvent->modifiers & cmdKey);
                break;
            }

        break;
    }
    default: {
        Point p = theEvent->where;
        GlobalToLocal (&p);
        if (cursorState == HY_TABLE_EDIT_CURSOR) {
            if (!(PtInRect (p,&textBoxRect)&&editBox)) {
#ifdef TARGET_API_MAC_CARBON
                Cursor arrow;
                SetCursor(GetQDGlobalsArrow(&arrow));
#else
                SetCursor (&qd.arrow);
#endif
                cursorState = 0;
            }
        } else {
            if (editBox&&PtInRect (p,&textBoxRect)) {
                SetCursor (&editStateCursor);
                cursorState = HY_TABLE_EDIT_CURSOR;
                break;
            }
        }
        bool  ch = (!(selectionType&HY_TABLE_DONT_SIZE))&&(CheckForHSizeLocation(p.h-rel.left))&&(p.v<rel.bottom-vsShift);
        if (ch&&(cursorState!=HY_TABLE_SIZE_CURSOR)) {
            cursorState = HY_TABLE_SIZE_CURSOR;
            SetCursor (&hSizeCursor);
        } else if ((!ch)&&(cursorState==HY_TABLE_SIZE_CURSOR)) {
            cursorState = 0;
#ifdef TARGET_API_MAC_CARBON
            Cursor arrow;
            SetCursor(GetQDGlobalsArrow(&arrow));
#else
            SetCursor (&qd.arrow);
#endif
        }
        if (selectionType & HY_TABLE_SEL_ROWS) {
            if (!ch) {
                k = FindClickedTableCell(p.h-rel.left,p.v-rel.top,h,v);
                if (k>=0) {
                    if ((cursorState != HY_TABLE_DRAG_CURSOR)&&(cursorState != HY_TABLE_EDIT_CURSOR)&&
                            ((selectionType&HY_TABLE_NODRAG_SELECTION)==0)) {
                        if (cellTypes.lData[k]&HY_TABLE_SELECTED) {
                            if (IsRowSelectionSimple()) {
                                SetCCursor (pickUpCursor);
                                cursorState = HY_TABLE_DRAG_CURSOR;
                            }
                        }
                    } else {
                        if (((selectionType&HY_TABLE_NODRAG_SELECTION)==0)&&(!(cellTypes.lData[k]&HY_TABLE_SELECTED))) {
#ifdef TARGET_API_MAC_CARBON
                            Cursor arrow;
                            SetCursor(GetQDGlobalsArrow(&arrow));
#else
                            SetCursor (&qd.arrow);
#endif
                            cursorState = 0;
                        }
                    }
                }
            }
        }
        //if (editBox)
        //TEIdle (editBox);
        return true;
    }
    }
    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}



//__________________________________________________________________
void        _HYTable::_Paint (Ptr p)
{
    _HYRect         *relRect    = (_HYRect*)p;
    GrafPtr         thisPort;
    RGBColor        oldColor,
                    oldBColor,
                    whiteC = {0xffff,0xffff,0xffff},
                    fillColor = {0x8fff,0x8fff,0x8fff};

    PixPatHandle    themeFill   = nil;
    RgnHandle       saveRgn     = NewRgn();

    checkPointer    (saveRgn);
    GetPort         (&thisPort);
    GetForeColor    (&oldColor);
    GetBackColor    (&oldBColor);
    GetClip         (saveRgn);

#ifdef OPAQUE_TOOLBOX_STRUCTS
    short   savedFace = GetPortTextFont (thisPort),
            savedSize = GetPortTextSize (thisPort);

    Style   savedStyle = GetPortTextFace (thisPort);
#else
    short   savedFace = thisPort->txFont,
            savedSize = thisPort->txSize;

    Style   savedStyle = thisPort->txFace;
#endif


    long    hs, // starting column
            hf, // ending column
            vs, // starting row
            vf, // ending row
            k,  // loop index
            t,  // aux variable
            t2,
            st; // a few more auxs

    bool    chop,
            chopv;

    GetDisplayRange (relRect, hs, hf, vs, vf);

    long            vsShift = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0),
                    hsShift = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);


    _HYRect         saveRel;
    Rect            bRect;

    GWorldPtr       offScreenPtr = nil;
    CGrafPtr        savedCPtr;
    GDHandle        savedDevice;

    if ((vf-vs>2)&&(aquaInterfaceOn==false)) {
        bRect.left    = bRect.top = 0;
        bRect.right   = relRect->right-relRect->left-hsShift;
        bRect.bottom  = relRect->bottom-relRect->top-vsShift;
        short errCode = NewGWorld (&offScreenPtr,0,&bRect,0,GetMainDevice(),noNewDevice);
        if (errCode != noErr) {
            offScreenPtr = nil;
        } else {
            if (!LockPixels (GetGWorldPixMap(offScreenPtr))) {
                ReportWarning ("Failed to lock pixels in _HYTable::_Paint");
                DisposeGWorld (offScreenPtr);
                offScreenPtr = nil;
            } else {
                GetGWorld (&savedCPtr,&savedDevice);
                SetGWorld (offScreenPtr,nil);
                //SetPort    ((GrafPtr)offScreenPtr);
                //SetOrigin (clipRect.left,clipRect.top);
                saveRel = *relRect;
                relRect->bottom -= relRect->top;
                relRect->top = 0;
                relRect->right  -= relRect->left;
                relRect->left = 0;
            }
        }
    }

    Rect clipRect = {relRect->top,relRect->left,
                     relRect->bottom-vsShift,
                     relRect->right-hsShift
                    },
         anotherRect,
         clipRect2,
         clipRect3;

    /*if (settings.width & HY_COMPONENT_BORDER_L)
        clipRect.left ++;
    if (settings.width & HY_COMPONENT_BORDER_T)
        clipRect.top ++;
    if (settings.width & HY_COMPONENT_BORDER_B)
        if (!(settings.width&HY_COMPONENT_H_SCROLL))
            clipRect.bottom--;
    if (settings.width & HY_COMPONENT_BORDER_R)
        if (!(settings.width&HY_COMPONENT_V_SCROLL))
            clipRect.right--;*/

    ClipRect (&clipRect);

    anotherRect = clipRect;
    t = relRect->top-vOrigin;

    RGBForeColor (&whiteC);

    if (verticalSpaces.lLength)
        for (k=vs; k<=vf; k++) {
            anotherRect.top = k?verticalSpaces.lData[k-1]+t:relRect->top;
            anotherRect.bottom = verticalSpaces.lData[k]+t;
            if (cellTypes.lData[k*horizontalSpaces.lLength]&HY_TABLE_BEVELED) {
                FillCRect (&anotherRect,backPattern2);
                if ((k==vs)||(k<vf)) {
                    RGBForeColor (&menuLine2);
                    MoveTo (anotherRect.left,anotherRect.bottom-1);
                    LineTo (anotherRect.right,anotherRect.bottom-1);
                    RGBForeColor (&menuLine1);
                    MoveTo (anotherRect.left,anotherRect.bottom-2);
                    LineTo (anotherRect.right,anotherRect.bottom-2);
                    RGBForeColor (&whiteC);
                }
            } else {
                FillCRect (&anotherRect,backPattern);
                if ((k==vs)||(k<vf)) {
                    MoveTo (anotherRect.left,anotherRect.bottom-1);
                    LineTo (anotherRect.right,anotherRect.bottom-1);
                }
            }
        }


    if (hf<horizontalSpaces.lLength-1) {
        st = hf;
    } else {
        st = hf-1;
    }

    t = relRect->left-hOrigin-2;
    if ((selectionType & HY_TABLE_NO_COLS_LINES) == 0) {
        RGBForeColor (&menuLine1);
        for (k=hs; k<=st; k++) {
            t2 = t+horizontalSpaces.lData[k];
            MoveTo (t2,relRect->top);
            LineTo (t2,relRect->bottom);
        }
        RGBForeColor (&menuLine2);
        t++;
        for (k=hs; k<=st; k++) {
            t2 = t+horizontalSpaces.lData[k];
            MoveTo (t2,relRect->top);
            LineTo (t2,relRect->bottom);
        }
    }


    RGBColor     textRGB = {((long)textColor.R) * 256, ((long)textColor.G) * 256, ((long)textColor.B) * 256};
    RGBForeColor (&textRGB);

    TextFont (fontID);
    TextFace (textFont.style);
    TextSize (textFont.size);
    st = 0;
    if (verticalSpaces.lLength)
        for (k=vs; k<=vf; k++) {
            anotherRect.top = relRect->top-vOrigin+1;
            anotherRect.bottom = anotherRect.top+verticalSpaces.lData[k]-1;
            if (k) {
                anotherRect.top+=verticalSpaces.lData[k-1];
            }
            long    t3,st2,
                    w = anotherRect.bottom-anotherRect.top,
                    w2,
                    shift = (w-textFont.size)/2-1;

            if (anotherRect.bottom>relRect->bottom-vsShift) {
                anotherRect.bottom = relRect->bottom-vsShift;
                chopv = false;
            } else {
                chopv = true;
            }

            for (t2=hs; t2<=hf; t2++) {
                t3 = k*horizontalSpaces.lLength+t2;
                if (t3 == editCellID) {
                    continue;
                }
                anotherRect.left = relRect->left-hOrigin+1;
                anotherRect.right = anotherRect.left+horizontalSpaces.lData[t2]-1;
                if (t2) {
                    anotherRect.left+=horizontalSpaces.lData[t2-1];
                }
                clipRect2 = anotherRect;
                w2= anotherRect.right-anotherRect.left;
                chop = true;
                if (anotherRect.right>relRect->right-hsShift) {
                    anotherRect.right=relRect->right-hsShift;
                    chop = false;
                } else {
                    chop = true;
                }
                if ((t2==hs)||(k==vs)) {
                    SectRect (&anotherRect,&clipRect,&clipRect3);
                    ClipRect (&clipRect3);
                } else {
                    ClipRect (&anotherRect);
                }
                if (cellTypes.lData[t3]&HY_TABLE_SELECTED) {
                    if (!themeFill) {
                        themeFill = NewPixPat ();
                        checkPointer (themeFill);
                        Collection clcn = NewCollection();
                        GetTheme (clcn);
                        SInt32   itemSize = sizeof (RGBColor);
                        GetTaggedCollectionItem (clcn,kThemeHighlightColorTag,1,&itemSize,(void*)&fillColor);
                        //GetThemeBrushAsColor (kThemeBrushFocusHighlight,32,true,&fillColor);
                        MakeRGBPat (themeFill,&fillColor);
                        DisposeCollection (clcn);
                    }
                    if (chopv) {
                        anotherRect.bottom--;
                    }
                    if (chop) {
                        anotherRect.right-=2;
                        FillCRect (&anotherRect,themeFill);
                        anotherRect.right+=2;
                    } else {
                        FillCRect (&anotherRect,themeFill);
                    }
                    if (chopv) {
                        anotherRect.bottom++;
                    }
                }
                if (cellTypes.lData[t3]&HY_TABLE_ICON) {
                    _SimpleList     * cellList = (_SimpleList*)cellData.lData[t3];

                    if (w2-4>cellList->lData[1]) {
                        t3 = (w2-cellList->lData[1])/2;
                        clipRect2.left+=t3;
                    }
                    clipRect2.right = clipRect2.left+cellList->lData[1];
                    if (w-2>cellList->lData[2]) {
                        t3 = (w-cellList->lData[2])/2;
                        clipRect2.top+=t3;
                    }
                    clipRect2.bottom=clipRect2.top+cellList->lData[2];

                    if (cellList->lLength==3) {
                        PlotCIconHandle (&clipRect2, kAlignNone,kTransformNone, (CIconHandle)cellList->lData[0]);
                    } else {
                        if ((cellList->lData[3]==HY_TABLE_COLOR_BOX)||(cellList->lData[3]==HY_TABLE_COLOR_CIRCLE)) {
                            PixPatHandle clr = NewPixPat ();
                            checkPointer (clr);
                            _HYColor      c = LongToHYColor (cellList->lData[0]);
                            RGBColor      sysColor;
                            sysColor.red   = c.R*256;
                            sysColor.green = c.G*256;
                            sysColor.blue  = c.B*256;
                            MakeRGBPat (clr, &sysColor);
                            if (cellList->lData[3]==HY_TABLE_COLOR_BOX) {
                                FillCRect  (&clipRect2,clr);
                            } else {
                                RGBColor        trColor = {0,0,0},
                                                saveFGColor;

                                ::GetForeColor (&saveFGColor);


                                Rect           circRect = clipRect2;

                                RGBForeColor   (&trColor);
                                FrameArc       (&circRect,0,360);


                                InsetRect    (&circRect,1,1);
                                trColor.red = sysColor.red/2;
                                trColor.blue = sysColor.blue/2;
                                trColor.green = sysColor.green/2;
                                RGBForeColor   (&trColor);
                                FrameArc       (&circRect,0,360);

                                InsetRect    (&circRect,1,1);
                                trColor.red = sysColor.red/1.5;
                                trColor.blue = sysColor.blue/1.5;
                                trColor.green = sysColor.green/1.5;
                                RGBForeColor   (&trColor);
                                FrameArc       (&circRect,0,360);

                                InsetRect    (&circRect,1,1);
                                FillCArc     (&circRect,0,360,clr);
                                RGBForeColor   (&saveFGColor);
                            }
                            DisposePixPat (clr);
                        }
                    }

                    //PlotCIcon (&clipRect2, (CIconHandle)cellList->lData[0]);
                } else { // text
                    st2 = cellTypes.lData[t3]&HY_TABLE_STYLEMASK;
                    if (st!=st2) {
                        st = st2;
                        st2 = normal;
                        if (st&HY_TABLE_BOLD) {
                            st2 = bold;
                        }
                        if (st&HY_TABLE_ITALIC) {
                            st2 |= italic;
                        }
                        TextFace (st2);
                    }


                    _String  *thisCell = (_String*)cellData.lData[t3];
                    MoveTo   (anotherRect.left+textFont.size/3, anotherRect.top+shift+textFont.size);
                    DrawText (thisCell->sData,0,thisCell->sLength);

                    if (cellTypes.lData[t3]&HY_TABLE_PULLDOWN) {
                        clipRect2.right-=4;
                        clipRect2.left=clipRect2.right-tPDMw;
                        if (w-2>tPDMh) {
                            t3 = (w-tPDMh)/2;
                            clipRect2.top+=t3;
                        }
                        clipRect2.bottom=clipRect2.top+tPDMh;
                        PlotCIconHandle (&clipRect2, kAlignNone,kTransformNone, tablePDMenuIcon);
                        //PlotCIcon (&clipRect2, tablePDMenuIcon);
                    }
                }
            }
        }
    if (themeFill) {
        DisposePixPat (themeFill);
    }


    if (offScreenPtr) {
        //SetPort     (thisPort);
        SetGWorld (savedCPtr,savedDevice);
        whiteC.red = whiteC.green = whiteC.blue = 0xffff;
        RGBBackColor (&whiteC);
        whiteC.red = whiteC.green = whiteC.blue = 0;
        RGBForeColor (&whiteC);
        *relRect = saveRel;
        OffsetRect   (&clipRect,relRect->left, relRect->top);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        CopyBits (GetPortBitMapForCopyBits(offScreenPtr),GetPortBitMapForCopyBits(GetWindowPort(parentWindow)) ,&bRect,&clipRect,srcCopy,(RgnHandle)nil);
#else
        CopyBits (&(GrafPtr(offScreenPtr)->portBits),&(parentWindow->portBits),&bRect,&clipRect,srcCopy,(RgnHandle)nil);
#endif
        UnlockPixels (GetGWorldPixMap(offScreenPtr));
        DisposeGWorld (offScreenPtr);
    }
    RGBBackColor (&oldBColor);
    RGBForeColor (&oldColor);
    if (editBox) {
        Rect    temp;
        SectRect(&textBoxRect,&clipRect,&temp);
        if (!EmptyRect(&temp)) {
            ClipRect (&clipRect);
            if (settings.width&HY_COMPONENT_TRANSP_BG) {
                SetThemeWindowBackground (parentWindow,kThemeBrushWhite,false);
                TEUpdate (&textBoxRect,editBox);
                SetThemeWindowBackground (parentWindow,kThemeBrushDialogBackgroundActive,false);
            } else {
                TEUpdate (&textBoxRect,editBox);
            }
            InsetRect(&textBoxRect,1,1);
            DrawThemeFocusRect (&textBoxRect,true);
            InsetRect(&textBoxRect,-1,-1);
        }
    }
    SetClip (saveRgn);
    TextFont (savedFace);
    TextSize (savedSize);
    TextFace (savedStyle);
    DisposeRgn (saveRgn);

    _HYPlatformComponent::_Paint(p);
}

//__________________________________________________________________

void        _HYPlatformTable::_SetBackColor (_HYColor& c)
{
    RGBColor newBG;
    newBG.red = c.R*0x00ff;
    newBG.blue = c.B*0x00ff;
    newBG.green = c.G*0x00ff;
    MakeRGBPat (backPattern,&newBG);
}

//__________________________________________________________________

void        _HYPlatformTable::_SetBackColor2 (_HYColor& c)
{
    RGBColor newBG;
    newBG.red = c.R*0x00ff;
    newBG.blue = c.B*0x00ff;
    newBG.green = c.G*0x00ff;
    MakeRGBPat (backPattern2,&newBG);
}



//__________________________________________________________________

void        _HYPlatformTable::_CreateTextBox (_HYRect& tBox,_String& textIn)
{
    Rect      destRect;
    _HYTable* parent = (_HYTable*)this;

    textBoxRect.left    = tBox.left;
    textBoxRect.right   = tBox.right;
    textBoxRect.top     = tBox.top;
    textBoxRect.bottom  = tBox.bottom;
    destRect            = textBoxRect;
    destRect.right      += 10000;
    editBox             = TEStyleNew(&destRect,&textBoxRect);
    checkPointer        ((Ptr)editBox);
    TESetText           (textIn.sData,textIn.sLength,editBox);
    TESetSelect         (0,30000,editBox);
    TextStyle           tStyle;
    tStyle.tsFont       = fontID;
    tStyle.tsFace       = parent->textFont.style;
    tStyle.tsSize       = parent->textFont.size;
    tStyle.tsColor.red  = parent->textColor.R*0x00FF;
    tStyle.tsColor.green= parent->textColor.G*0x00FF;
    tStyle.tsColor.blue = parent->textColor.B*0x00FF;

    TESetStyle          (doAll,&tStyle,false,editBox);
    TEAutoView          (true,editBox);
    TECalText           (editBox);
    TEActivate          (editBox);
    //TEUpdate          (&textBoxRect, editBox);

}

//__________________________________________________________________

_String     _HYPlatformTable::_RetrieveTextValue (void)
{
    if (editBox) {
        long            textLen = (*editBox)->teLength;
        if (textLen) {
            CharsHandle     theText = TEGetText (editBox);
            _String         result  (textLen,false);
            BlockMove       (*theText,result.sData,textLen);
            return          result;
        }
    }
    return      empty;
}

//__________________________________________________________________

void        _HYPlatformTable::_KillTextBox (void)
{
    if (editBox) {
        TEDispose (editBox);
        editBox = nil;
    }
}

//__________________________________________________________________

Rect        _HYPlatformTable::_GetVisibleRowRect (long h)
{
    _HYTable*   parent = (_HYTable*)this;
    Rect        res;

    long        w = (parent->settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0;
    res.left   = parent->rel.left;
    res.right  = (parent->settings.width&HY_COMPONENT_H_SCROLL)?parent->rel.right-HY_SCROLLER_WIDTH:parent->rel.right;

    res.bottom = parent->verticalSpaces.lData[h]-parent->vOrigin+parent->rel.top;
    if (res.bottom>parent->rel.bottom-w) {
        res.bottom=parent->rel.bottom-w;
    }

    if (h) {
        res.top = parent->verticalSpaces.lData[h-1]-parent->vOrigin+parent->rel.top;
    } else {
        res.top = parent->rel.top-parent->vOrigin;
    }

    return res;
}

//__________________________________________________________________

void        _HYPlatformTable::_HiliteRowForDrag (long row, long old)
{
    Rect        cellRect = _GetVisibleRowRect (row);
    if (row<old) {
        cellRect.bottom = cellRect.top+2;
    } else {
        cellRect.top = cellRect.bottom-2;
    }
    InvertRect  (&cellRect);
}

//__________________________________________________________________

void        _HYTable::_MarkCellsForUpdate (_SimpleList& cells)
{
    GrafPtr   savePort;
    GetPort   (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort   (GetWindowPort(parentWindow));
#else
    SetPort   (parentWindow);
#endif
    long hs,hf,vs,vf,t,t2,k;
    GetDisplayRange (&rel, hs, hf, vs, vf);
    Rect  clipRect;

    clipRect.left = rel.left;
    clipRect.right = rel.right;
    if (settings.width&HY_COMPONENT_V_SCROLL) {
        clipRect.right -= HY_SCROLLER_WIDTH;
    }
    clipRect.top = rel.top;
    clipRect.bottom = rel.bottom;
    if (settings.width&HY_COMPONENT_H_SCROLL) {
        clipRect.bottom -= HY_SCROLLER_WIDTH;
    }

    for (k=0; k<cells.lLength; k++) {
        t2 = cells.lData[k]/horizontalSpaces.lLength;
        t = cells.lData[k]%horizontalSpaces.lLength;

        if ((t>=hs)&&(t<=hf)&&(t2<=vf)&&(t2>=vs)) {
            Rect invalRect;
            if (t) {
                invalRect.left = horizontalSpaces.lData[t-1];
            } else {
                invalRect.left = 0;
            }
            invalRect.right = horizontalSpaces.lData[t];
            if (t2) {
                invalRect.top = verticalSpaces.lData[t2-1];
            } else {
                invalRect.top = 0;
            }
            invalRect.bottom = verticalSpaces.lData[t2];
            OffsetRect (&invalRect, rel.left-hOrigin, rel.top-vOrigin);
            SectRect (&invalRect, &clipRect, &invalRect);
            if (!EmptyRect (&invalRect))
#ifdef TARGET_API_MAC_CARBON
                InvalWindowRect (parentWindow,&invalRect);
#else
                InvalRect (&invalRect);
#endif
        }
    }
    SetPort   (savePort);
}

//__________________________________________________________________

void        _HYTable::_MarkColumnForUpdate (long index)
{
    long hs,hf,vs,vf;
    GetDisplayRange (&rel, hs, hf, vs, vf);

    if ((index>=hs)&&(index<=hf)) {
        GrafPtr   savePort;
        GetPort   (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort   (GetWindowPort(parentWindow));
#else
        SetPort   (parentWindow);
#endif
        Rect  clipRect;

        clipRect.left = rel.left;
        clipRect.right = rel.right;
        if (settings.width&HY_COMPONENT_V_SCROLL) {
            clipRect.right -= HY_SCROLLER_WIDTH;
        }
        clipRect.top = rel.top;
        clipRect.bottom = rel.bottom;
        if (settings.width&HY_COMPONENT_H_SCROLL) {
            clipRect.bottom -= HY_SCROLLER_WIDTH;
        }

        Rect  invalRect;
        invalRect.bottom = clipRect.bottom;
        invalRect.top = clipRect.top;
        invalRect.left = index?horizontalSpaces.lData[index-1]:0;
        invalRect.right = horizontalSpaces.lData[index];
        OffsetRect (&invalRect, rel.left-hOrigin,0);
        SectRect (&invalRect, &clipRect, &invalRect);
        if (!EmptyRect (&invalRect))
#ifdef TARGET_API_MAC_CARBON
            InvalWindowRect (parentWindow,&invalRect);
#else
            InvalRect (&invalRect);
#endif
        SetPort   (savePort);
    }
}

//__________________________________________________________________

void        _HYTable::_MarkRowForUpdate (long index)
{
    long hs,hf,vs,vf;
    GetDisplayRange (&rel, hs, hf, vs, vf);

    if ((index>=vs)&&(index<=vf)) {
        GrafPtr   savePort;
        GetPort   (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort   (GetWindowPort(parentWindow));
#else
        SetPort   (parentWindow);
#endif
        Rect  clipRect;

        clipRect.left = rel.left;
        clipRect.right = rel.right;
        if (settings.width&HY_COMPONENT_V_SCROLL) {
            clipRect.right -= HY_SCROLLER_WIDTH;
        }
        clipRect.top = rel.top;
        clipRect.bottom = rel.bottom;
        if (settings.width&HY_COMPONENT_H_SCROLL) {
            clipRect.bottom -= HY_SCROLLER_WIDTH;
        }

        Rect  invalRect;
        invalRect.right = clipRect.right;
        invalRect.left = clipRect.left;
        invalRect.top = index?verticalSpaces.lData[index-1]:0;
        invalRect.bottom = verticalSpaces.lData[index];
        OffsetRect (&invalRect, 0, rel.top-vOrigin);
        SectRect (&invalRect, &clipRect, &invalRect);
#ifdef TARGET_API_MAC_CARBON
        InvalWindowRect (parentWindow,&invalRect);
#else
        InvalRect (&invalRect);
#endif
        SetPort   (savePort);
    }
}

//__________________________________________________________________

void        _HYTable::_MarkCellForUpdate (long index)
{
    _SimpleList     dummy (index);
    _MarkCellsForUpdate (dummy);
}

//__________________________________________________________________

void        _HYTable::_IdleHandler (void)
{
    if (editBox) {
        TEIdle (editBox);
    }
}

//__________________________________________________________________

void        _HYTable::_FocusComponent (void)
{
}

//__________________________________________________________________
long        _HYTable::_HandlePullDown (_List& data, long h, long v, long currentS)
{
    if (data.lLength) {
        return HandlePullDownWithFont (data,h,v,currentS,textFont.face,textFont.size);
    }
    return -1;
}

//__________________________________________________________________

void        _HYTable::_ScrollVPixels (long offset)
{
    long     voff = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0);
    offset = offset/(_Parameter)(GetMaxH()- rel.bottom+rel.top+1-voff)*MAX_CONTROL_VALUE;
    ProcessEvent (generateScrollEvent(0,offset));
    _SetVScrollerPos((double)MAX_CONTROL_VALUE*vOrigin/(verticalSpaces.lData[verticalSpaces.lLength-1]-vSize+voff));
}

//__________________________________________________________________

void        _HYTable::_ScrollHPixels (long offset)
{
    long     hoff = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);
    offset = offset/(_Parameter)(GetMaxW()- rel.right+rel.bottom+1-hoff)*MAX_CONTROL_VALUE;
    ProcessEvent (generateScrollEvent(offset,0));
    _SetHScrollerPos((double)MAX_CONTROL_VALUE*hOrigin/(horizontalSpaces.lData[horizontalSpaces.lLength-1]-hSize+hoff));
}

//__________________________________________________________________

void        _HYTable::_ScrollRowIntoView (long index)
{
    if ((index>=0)&&(index<verticalSpaces.lLength)) {
        long hs, hf, vs, vf;
        GetDisplayRange (&rel,hs,hf,vs,vf);
        if ((index>vf)||(index<vs)) {
            _ScrollVPixels ((index?verticalSpaces.lData[index-1]:0)-vOrigin);
        }
    }
}

//__________________________________________________________________

void        _HYTable::_PrintTable (_SimpleList& columns, _SimpleList& rows, _HYTable* ch)
{

    if ((columns.lLength == 0)||(rows.lLength == 0)) {
        return;
    }

    GrafPtr     savePort;
#ifdef      TARGET_API_MAC_CARBON
    PMRect prRect;
#else
    TPrStatus   prStatus;
    TPPrPort    printPort;
    OSErr       err;
#endif

#ifdef TARGET_API_MAC_CARBON
    OSStatus theStatus;
    Boolean isAccepted;

    PMPrintSession hyPS;
    theStatus = PMCreateSession(&hyPS);
    if (theStatus != noErr) {
        return;
    }
#endif

    if (!InitPrint(hyPS)) {
        _String errMsg ("Could not initialize printing variables.");
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    GetPort(&savePort);

#ifdef TARGET_API_MAC_CARBON
    if (gPrintSettings != kPMNoPrintSettings) {
        theStatus = PMSessionValidatePrintSettings(hyPS,gPrintSettings, kPMDontWantBoolean);
    } else {
        theStatus = PMCreatePrintSettings(&gPrintSettings);

        if ((theStatus == noErr) && (gPrintSettings != kPMNoPrintSettings)) {
            theStatus = PMSessionDefaultPrintSettings(hyPS,gPrintSettings);
        }
    }

    if (theStatus == noErr) {
        theStatus = PMSessionPrintDialog(hyPS,gPrintSettings, gPageFormat, &isAccepted);

        if (isAccepted) {
            theStatus = PMGetAdjustedPageRect(gPageFormat, &prRect);
            if (theStatus != noErr) {
                return;
            }

            theStatus = PMSessionBeginDocument(hyPS,gPrintSettings, gPageFormat);
            if (theStatus != noErr) {
                return;
            }

            long     printW    = prRect.right-prRect.left-2,
                     printH    = prRect.bottom-prRect.top-2;

            UInt32   startPage,
                     endPage;

            PMGetFirstPage (gPrintSettings,&startPage);
            PMGetLastPage  (gPrintSettings,&endPage);
#else
    PrOpen();
    if (err=PrError()) {
        _String errMsg ("Could not print the table. Error Code:");
        errMsg = errMsg & (long)err;
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    if (PrJobDialog(prRecHdl)) {
        printPort = PrOpenDoc(prRecHdl, nil, nil);
        SetPort((GrafPtr)printPort);
        long     printW = (*prRecHdl)->prInfo.rPage.right-2,
                 printH = (*prRecHdl)->prInfo.rPage.bottom-2,
                 startPage = (*prRecHdl)->prJob.iFstPage,
                 endPage = (*prRecHdl)->prJob.iLstPage;
#endif
            long
            tW = 0,
            cC = 0,
            cE = 0,
            cP = 1,
            t,
            i,
            pH = ch?ch->GetRowSpacing (0):0;


            if (ch) {
                printH -= pH;
                if (printH <= 0) {
                    _String errMsg ("Table header is too tall to fit on the page.");
                    WarnError (errMsg);
                    terminateExecution = false;
                    return;
                }
            }

            _HYRect  relDim = {0,0,0,0,HY_COMPONENT_NO_SCROLL};

            if (ch)
                for (i=0; i<columns.lLength; i++) {
                    tW += ch->GetColumnSpacing (columns.lData[i]);
                }
            else
                for (i=0; i<columns.lLength; i++) {
                    tW += GetColumnSpacing (columns.lData[i]);
                }

            relDim.left    = relDim.right   = tW > printW ? printW : tW;

            while (cP < startPage) {
#ifdef TARGET_API_MAC_CARBON
                theStatus = PMSessionBeginPage(hyPS,gPageFormat, NULL);
                if (theStatus != noErr) {
                    break;
                }
#else
                PrOpenPage      (printPort, nil);
#endif

                t = 0;
                while (cC < rows.lLength) {
                    i = GetRowSpacing (rows.lData[cC]);
                    if ( t+i > printH) {
                        cP ++;
                        if (i > printH) {
                            cC++;
                        }
                        break;
                    } else {
                        t += i;
                        cC ++;
                    }
                }
#if TARGET_API_MAC_CARBON
                theStatus = PMSessionEndPage(hyPS);
#else
                PrClosePage(printPort);
#endif
            }

            cE = cC;

            for (long pageCount = startPage; pageCount<=endPage && (cC < rows.lLength); pageCount++) {
                t = 0;
                while (cE < rows.lLength) {
                    i = GetRowSpacing (rows.lData[cE]);
                    if ( t+i > printH) {
                        if (i > printH) {
                            t = printH;
                            cE++;
                        }
                        break;
                    } else {
                        t += i;
                        cE ++;
                    }
                }

                relDim.top = relDim.bottom = t+pH;

#ifndef TARGET_API_MAC_CARBON
                _HYTable        *thisPage = new _HYTable (relDim,(Ptr)printPort, cE-cC+(ch?1:0),columns.lLength,20,20,HY_TABLE_STATIC_TEXT);
#else
                GrafPtr         prPortPtr;
                PMSessionGetGraphicsContext (hyPS,NULL,(void**)&prPortPtr);
                _HYTable        *thisPage = new _HYTable (relDim,(Ptr)prPortPtr, cE-cC+(ch?1:0),columns.lLength,20,20,HY_TABLE_STATIC_TEXT);
#endif
                checkPointer    (thisPage);
#ifdef TARGET_API_MAC_CARBON
                theStatus = PMSessionBeginPage(hyPS,gPageFormat, NULL);
                if (theStatus != noErr) {
                    break;
                }
#else
                PrOpenPage      (printPort, nil);
#endif

                thisPage->SetFont       (textFont);
                thisPage->SetBackColor  (backColor);
                thisPage->SetBackColor2 (backColor2);
                thisPage->SetTextColor  (textColor);

                if (ch)
                    for (i=0; i<columns.lLength; i++) {
                        thisPage->SetColumnSpacing (i,ch->GetColumnSpacing (columns.lData[i])-20, false);
                    }
                else
                    for (i=0; i<columns.lLength; i++) {
                        thisPage->SetColumnSpacing (i,GetColumnSpacing (columns.lData[i])-20, false);
                    }

                t = 0;
                if (ch) {
                    thisPage->SetRowSpacing (0,pH-20,false);
                    for (i=0; i<columns.lLength; i++) {
                        BaseRef cellData = ch->GetCellData(columns.lData[i],0);
                        cellData->nInstances++;
                        thisPage->SetCellData(cellData,0,i,ch->cellTypes.lData[columns.lData[i]]&HY_TABLE_DESELECT,false);
                    }
                    t = 1;
                }

                for (cP = cC; cP < cE; cP++,t++) {
                    long     rI = rows.lData[cP];
                    thisPage->SetRowSpacing (t,GetRowSpacing(rI)-20,false);
                    for (i=0; i<columns.lLength; i++) {
                        BaseRef cellData = GetCellData(columns.lData[i],rI);
                        cellData->nInstances++;
                        thisPage->SetCellData(cellData,t,i,cellTypes.lData[rI*horizontalSpaces.lLength+columns.lData[i]]&HY_TABLE_DESELECT,false);
                    }
                }
                _HYRect relDim2 = relDim;
                relDim2.left = relDim2.top = 1;
                relDim2.right ++;
                relDim2.bottom ++;
                thisPage->_Paint ((Ptr)&relDim2);
                PenSize (1,1);
                RGBColor blk = {0,0,0};
                RGBForeColor (&blk);
                Rect         relDim22 = HYRect2Rect (relDim2);
                FrameRect (&relDim22);
#if TARGET_API_MAC_CARBON
                theStatus = PMSessionEndPage(hyPS);
#else
                PrClosePage(printPort);
#endif
                DeleteObject (thisPage);
                cC = cE;
            }
#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionEndDocument(hyPS);
            SetPort(savePort);
            if (theStatus == noErr) {
                if (gFlattenedFormat != NULL) {
                    DisposeHandle(gFlattenedFormat);
                    gFlattenedFormat = NULL;
                }

                theStatus = PMFlattenPageFormat(gPageFormat, &gFlattenedFormat);
            }

            if (theStatus == noErr) {
                if (gFlattenedSettings != NULL) {
                    DisposeHandle(gFlattenedSettings);
                    gFlattenedSettings = NULL;
                }

                theStatus = PMFlattenPrintSettings(gPrintSettings, &gFlattenedSettings);
            }

            if (gPageFormat != kPMNoPageFormat) {
                theStatus = PMRelease(gPageFormat);
                gPageFormat = kPMNoPageFormat;
            }

            if (gPrintSettings != kPMNoPrintSettings) {
                theStatus = PMRelease(gPrintSettings);
                gPrintSettings = kPMNoPrintSettings;
            }

            theStatus = PMRelease(hyPS);

#else
            PrCloseDoc(printPort);
            if (((*prRecHdl)->prJob.bJDocLoop = bSpoolLoop) && (!PrError() ) ) {
                PrPicFile(prRecHdl, nil, nil, nil, &prStatus);
            }
#endif
        }
#ifdef TARGET_API_MAC_CARBON
        else {
            theStatus = PMRelease(hyPS);
        }
#endif

#ifdef TARGET_API_MAC_CARBON
    }
#else
        PrClose();
        SetPort(savePort);
#endif

}

//EOF
\ No newline at end of file
diff --git a/src/gui/mac/Components/HYPlatformTextBox.cpp b/src/gui/mac/Components/HYPlatformTextBox.cpp
deleted file mode 100644
index 2952703..0000000
--- a/src/gui/mac/Components/HYPlatformTextBox.cpp
+++ /dev/null
@@ -1,1241 +0,0 @@
-/*
-    Text input box for Mac OS API
-
-    Sergei L. Kosakovsky Pond, May 2000-December 2002
-
-    Revised in December 2003 to use MLTE
-*/
-
-#include "errorfns.h"
-#include "HYTextbox.h"
-#include "HYUtils.h"
-#include "HYEventTypes.h"
-#include "HYGraphicPane.h"
-
-#include "ToolUtils.h"
-#include "Appearance.h"
-#include "string.h"
-
-#include "HYDialogs.h"
-
-//#include "MacTextEditor.h"
-
-
-//__________________________________________________________________
-
-_HYPlatformTextBox::_HYPlatformTextBox  (void)
-{
-    backFill  = NewPixPat();
-    backTFill = NewPixPat();
-
-    if (!(backFill&&backTFill)) {
-        warnError (-108);
-    }
-
-#ifdef          _HY_USE_MLTE_
-    txn     = nil;
-#else
-    te      = nil;
-#endif
-
-    RGBColor    wht = {0xffff,0xffff,0xffff};
-    MakeRGBPat (backFill,&wht);
-    MakeRGBPat (backTFill,&wht);
-
-    textBoxRect.left    = textBoxRect.top   = 0;
-    textBoxRect.bottom  = textBoxRect.right = 100;
-
-}
-
-//__________________________________________________________________
-
-_HYPlatformTextBox::~_HYPlatformTextBox (void)
-{
-    if (backFill) {
-        DisposePixPat (backFill);
-    }
-
-    if (backTFill) {
-        DisposePixPat (backTFill);
-    }
-
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        TXNDeleteObject (txn);
-    }
-#else
-    if (te) {
-        TEDispose(te);
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformTextBox::_SetBackColor (_HYColor& c)
-{
-    RGBColor newBG;
-    newBG.red   = c.R*256;
-    newBG.blue  = c.B*256;
-    newBG.green = c.G*256;
-    MakeRGBPat (backFill,&newBG);
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformTextBox::_SetBackTColor (_HYColor& c)
-{
-    RGBColor newBG;
-    newBG.red   = c.R*256;
-    newBG.blue  = c.B*256;
-    newBG.green = c.G*256;
-    MakeRGBPat (backTFill,&newBG);
-}
-
-//__________________________________________________________________
-
-long    _HYPlatformTextBox::_GetCharacterCount (void)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        return TXNDataSize (txn);
-    }
-#endif
-    return 0;
-}
-
-
-//__________________________________________________________________
-
-void    _HYPlatformTextBox::_SetForeColor (_HYColor& c)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        RGBColor newC = {c.R*256,c.B*256,c.G*256};
-
-        TXNTypeAttributes  attr[1];
-
-        attr[0].tag  = kTXNQDFontColorAttribute;
-        attr[0].size = kTXNQDFontColorAttributeSize;
-        attr[0].data.dataPtr = &newC;
-        TXNSetTypeAttributes (txn,1,attr,kTXNStartOffset,kTXNEndOffset);
-
-
-    }
-#else
-    if (te) {
-        _HYTextBox *  parent = (_HYTextBox*)this;
-
-        TextStyle   newStyle;
-        newStyle.tsColor.red   = c.R*256;
-        newStyle.tsColor.blue  = c.B*256;
-        newStyle.tsColor.green = c.G*256;
-
-        if ((*te)->teLength) {
-            short       ss = (*te)->selStart,
-                        se = (*te)->selEnd;
-
-
-            TESetSelect (0,30000,te);
-            TESetStyle  (doColor,&newStyle,true,te);
-            TESetSelect (ss,se,te);
-        } else {
-            TESetStyle  (doColor,&newStyle,true,te);
-        }
-
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformTextBox::_SetFont (_HYFont& f)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        Str255          fName;
-        StringToStr255 (f.face,fName);
-        //short             fNum=0;
-        //GetFNum      (fName,&fNum);
-
-        TXNTypeAttributes  attr[3];
-
-        attr[0].tag  = kTXNQDFontNameAttribute;
-        attr[0].size = kTXNQDFontNameAttributeSize;
-        attr[0].data.dataPtr = (Ptr)fName;
-
-        attr[1].tag  = kTXNQDFontStyleAttribute;
-        attr[1].size = kTXNQDFontStyleAttributeSize;
-        attr[1].data.dataValue = normal;
-        if (f.style & HY_FONT_BOLD) {
-            attr[1].data.dataValue |= bold;
-        }
-        if (f.style & HY_FONT_ITALIC) {
-            attr[1].data.dataValue |= italic;
-        }
-
-
-        attr[2].tag  = kTXNQDFontSizeAttribute;
-        attr[2].size = kTXNFontSizeAttributeSize;
-        attr[2].data.dataValue = f.size<<16;
-
-        TXNSetTypeAttributes (txn,3,attr,kTXNStartOffset,kTXNEndOffset);
-    }
-#else
-    if (te) {
-        Str255 fName;
-        StringToStr255 (f.face,fName);
-        short  fNum=0;
-        GetFNum (fName,&fNum);
-
-        TextStyle   newStyle;
-        newStyle.tsFont = fNum;
-        newStyle.tsFace = f.style;
-        newStyle.tsSize = f.size;
-
-        if ((*te)->teLength) {
-            short       ss = (*te)->selStart,
-                        se = (*te)->selEnd;
-
-            TESetSelect (0,30000,te);
-            TESetStyle  (doFont|doFace|doSize,&newStyle,false,te);
-            TESetSelect (ss,se,te);
-        } else {
-            TESetStyle  (doFont|doFace|doSize,&newStyle,false,te);
-        }
-    }
-#endif
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_Update (Ptr p)
-{
-    _Paint (p);
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_SetDimensions (_HYRect r, _HYRect rel)
-{
-    _HYTextBox* theParent = (_HYTextBox *) this;
-    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
-    _SetVisibleSize (rel);
-}
-
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_SetVisibleSize (_HYRect rel)
-{
-    _HYTextBox *theParent = (_HYTextBox*) this;
-
-    textBoxRect.top     = rel.top   + theParent->margins.top;
-    textBoxRect.left    = rel.left  + theParent->margins.left;
-    textBoxRect.bottom  = rel.bottom- theParent->margins.bottom;
-    textBoxRect.right   = rel.right - theParent->margins.right;
-
-
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        Rect        textBoxRect2 = textBoxRect;
-
-        if (!(theParent->boxFlags & (HY_TB_BIGBOX))) {
-            InsetRect   (&textBoxRect2,1,1);
-        }
-
-        TXNLongRect newLongRect = {textBoxRect2.top, textBoxRect2.left, textBoxRect2.bottom, textBoxRect2.right};
-
-        if (theParent->boxFlags & (HY_TB_BIGBOX|HY_TB_WRAP)) {
-            newLongRect.bottom += 0x0fffffff;
-            newLongRect.right -= HY_SCROLLER_WIDTH;
-        }
-
-        TXNSetRectBounds (txn, &textBoxRect2, &newLongRect, true);
-
-        if (theParent->boxFlags & (HY_TB_BIGBOX|HY_TB_WRAP)) {
-            TXNForceUpdate (txn);
-        }
-    }
-#else
-    if ((textBoxRect.bottom-textBoxRect.top<theParent->editBoxFont.size+4)||
-            (textBoxRect.right-textBoxRect.left<theParent->editBoxFont.size+4)) {
-        if (te) {
-            TEDispose (te);
-            te = nil;
-        }
-        return;
-    }
-
-    if (te) {
-        CharsHandle th  = TEGetText  (te);
-        Rect        textBoxRect2 = textBoxRect;
-        InsetRect   (&textBoxRect2,2,2);
-        Rect        textBoxRect3 = textBoxRect2;
-        if (!theParent->wrapToView) {
-            textBoxRect3.right += 10000;
-        }
-        GrafPtr thisPort;
-        GetPort (&thisPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-        SetPort (GetWindowPort(theParent->parentWindow));
-#else
-        SetPort (theParent->parentWindow);
-#endif
-
-        TEHandle nte = TEStyleNew (&textBoxRect3, &textBoxRect2);
-        checkPointer(nte);
-        SetPort (thisPort);
-        HLock ((Handle)te);
-        HLock (th);
-        short       ss = (*te)->selStart,
-                    se = (*te)->selEnd;
-        TESetText   (*th,(*te)->teLength,nte);
-        TESetSelect (ss,se,nte);
-        HUnlock     (th);
-        HUnlock     ((Handle)te);
-        TEDispose   (te);
-        te = nte;
-        _CreateTE();
-    }
-#endif
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_SetAlignFlags (unsigned char f)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        TXNControlTag  tags[1];
-        TXNControlData td  [1];
-
-        tags[0]  = kTXNJustificationTag;
-
-        if (f&HY_ALIGN_LEFT) {
-            td[0].uValue  = kTXNFlushLeft;
-        } else if (f&HY_ALIGN_RIGHT) {
-            td[0].uValue  = kTXNFlushRight;
-        } else {
-            td[0].uValue  = kTXNCenter;
-        }
-
-        TXNSetTXNObjectControls (txn,false,1,tags,td);
-
-    }
-#else
-    if (te) {
-        if (f&HY_ALIGN_LEFT) {
-            TESetAlignment (teFlushLeft,te);
-        } else if (f&HY_ALIGN_RIGHT) {
-            TESetAlignment (teFlushRight,te);
-        } else {
-            TESetAlignment (teCenter,te);
-        }
-    }
-#endif
-}
-
-//__________________________________________________________________
-_String     _HYPlatformTextBox::_GetText (void)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        if (_GetCharacterCount()) {
-            Handle      th;
-            TXNGetDataEncoded
-            (txn,kTXNStartOffset,kTXNEndOffset,&th,kTXNTextData);
-
-            HLock       (th);
-            _String     result (GetHandleSize(th),false);
-            memcpy      (result.sData, *th, result.sLength);
-            HUnlock     (th);
-            DisposeHandle (th);
-            //printf        ("%s\n", result.sData);
-            return      result;
-        }
-    }
-#else
-    if (te&&(*te)->teLength) {
-        _String     result ((unsigned long)(*te)->teLength,false);
-        CharsHandle th = TEGetText (te);
-        HLock       (th);
-        memcpy      (result.sData, *th, result.sLength);
-        HUnlock     (th);
-        return      result;
-    }
-#endif
-    return empty;
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_StoreText (_String*& res, bool selOnly)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        TXNOffset       s,e;
-        if (selOnly) {
-            TXNGetSelection (txn, &s, &e);
-            if (e<s) {
-                res = new _String;
-                return;
-            }
-        } else if (!_GetCharacterCount()) {
-            res = new _String;
-            return;
-        } else {
-            s = kTXNStartOffset;
-            e = kTXNEndOffset;
-        }
-
-        Handle      th;
-        TXNGetDataEncoded  (txn,s,e,&th,kTXNTextData);
-
-        HLock       (th);
-        res         = new _String (GetHandleSize(th),false);
-        memcpy      (res->sData, *th,res->sLength);
-        res->sData[res->sLength] = 0;
-        HUnlock     (th);
-        DisposeHandle (th);
-    }
-#endif
-}
-//__________________________________________________________________
-void        _HYPlatformTextBox::_CreateTE (void)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        _HYTextBox * theParent = (_HYTextBox*)this;
-
-        _SetFont        (theParent->editBoxFont);
-        _SetForeColor   (theParent->foreColor);
-        //TEAutoView    (true, te);
-        // check this
-        _SetAlignFlags  (theParent->alignFlags);
-        TXNRecalcTextLayout (txn);
-
-        if ((theParent->boxFlags & HY_TB_ENABLED)&&theParent->activationFlag) {
-            TXNActivate (txn,txnFrame,true);
-        }
-
-        TXNDraw   (txn, nil);
-    }
-#else
-    if (te) {
-        _HYTextBox * theParent = (_HYTextBox*)this;
-
-        _SetFont        (theParent->editBoxFont);
-        _SetForeColor   (theParent->foreColor);
-        TEAutoView      (true, te);
-        TECalText       (te);
-        _SetAlignFlags  (theParent->alignFlags);
-        if (theParent->isEnabled&&theParent->activationFlag) {
-            TEActivate (te);
-        }
-        Rect            textBoxRect2 = textBoxRect;
-        InsetRect       (&textBoxRect2,2,2);
-        TEUpdate        (&textBoxRect2,te);
-    }
-#endif
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_SetText (const _String& editBoxText)
-{
-#ifdef          _HY_USE_MLTE_
-    if (!txn) {
-        _HYTextBox * parent = ((_HYTextBox*)this);
-
-        Rect        textBoxRect2 = textBoxRect;
-        if (parent->boxFlags & (HY_TB_BIGBOX|HY_TB_WRAP)) {
-            textBoxRect.right -= HY_SCROLLER_WIDTH;
-        } else {
-            InsetRect   (&textBoxRect2,1,1);
-        }
-
-        Rect        textBoxRect3 = textBoxRect2;
-
-
-        if (!(parent->boxFlags & (HY_TB_BIGBOX|HY_TB_WRAP))) {
-            textBoxRect3.right += 0x0fffffff;
-        }
-
-        OSStatus err;
-
-        if (parent->boxFlags & HY_TB_BIGBOX)
-            err =  TXNNewObject (nil, ((_HYTextBox*)this)->parentWindow, &textBoxRect3,
-                                 kTXNDontDrawCaretWhenInactiveMask|kTXNDontDrawSelectionWhenInactiveMask|kTXNWantVScrollBarMask|kTXNAlwaysWrapAtViewEdgeMask,
-                                 kTXNTextEditStyleFrameType,
-                                 kTXNTextFile,
-                                 kTXNUnicodeEncoding,
-                                 &txn,
-                                 &txnFrame,
-                                 0);
-        else
-            err =  TXNNewObject (nil, ((_HYTextBox*)this)->parentWindow, &textBoxRect3,
-                                 kTXNDontDrawCaretWhenInactiveMask|kTXNDontDrawSelectionWhenInactiveMask|((parent->boxFlags&HY_TB_WRAP)?(kTXNWantVScrollBarMask|kTXNAlwaysWrapAtViewEdgeMask):0),
-                                 kTXNTextEditStyleFrameType,
-                                 kTXNTextFile,
-                                 kTXNUnicodeEncoding,
-                                 &txn,
-                                 &txnFrame,
-                                 0);
-
-
-        if (err!=noErr) {
-            _String errMsg = _String ("System error ") & (long)err & " while trying to create MLTE object";
-            WarnError (errMsg);
-            txn = nil;
-            return;
-        }
-
-
-        TXNCarbonEventInfo      carbonEventInfo;
-        TXNControlTag           iControlTags[] = { kTXNUseCarbonEvents };
-        TXNControlData          iControlData[1];
-        iControlData[0].uValue = (UInt32) &carbonEventInfo;
-
-        carbonEventInfo.useCarbonEvents = false;
-        carbonEventInfo.filler = 0;
-        carbonEventInfo.flags = 0;
-        carbonEventInfo.fDictionary = NULL;
-        iControlData[0].uValue = (UInt32) &carbonEventInfo;
-        TXNSetTXNObjectControls(txn,
-                                false,
-                                1,
-                                iControlTags,
-                                iControlData
-                               );
-
-        TXNBackground    tbg;
-
-        tbg.bgType   = kTXNBackgroundTypeRGB;
-        tbg.bg.color = (RGBColor) {
-            0xffff,0xffff,0xffff
-        };
-
-        err = TXNSetBackground (txn,&tbg);
-
-        TXNSetViewRect (txn, & textBoxRect2);
-    }
-
-    TXNSetData (txn,kTXNTextData,editBoxText.sData,editBoxText.sLength,kTXNStartOffset,kTXNEndOffset);
-
-#else
-    if (!te) {
-        _HYTextBox * theParent = (_HYTextBox*)this;
-        Rect        textBoxRect2 = textBoxRect;
-        InsetRect   (&textBoxRect2,2,2);
-        Rect        textBoxRect3 = textBoxRect2;
-        if (!theParent->wrapToView) {
-            textBoxRect3.right += 10000;
-        }
-        GrafPtr thisPort;
-        GetPort (&thisPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-        SetPort (GetWindowPort(((_HYTextBox*)this)->parentWindow));
-#else
-        SetPort (((_HYTextBox*)this)->parentWindow);
-#endif
-        te = TEStyleNew (&textBoxRect3, &textBoxRect2);
-        checkPointer(te);
-        SetPort (thisPort);
-    }
-    TESetText   (editBoxText.sData,editBoxText.sLength,te);
-#endif
-    _CreateTE();
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_InsertText (const _String& editBoxText, bool append)
-{
-#ifdef          _HY_USE_MLTE_
-    if (!txn) {
-        _SetText (editBoxText);
-    } else {
-        //printf ("Insert text\n");
-        TXNSetData (txn,kTXNTextData,editBoxText.sData,editBoxText.sLength,append?kTXNEndOffset:kTXNUseCurrentSelection,append?kTXNEndOffset:kTXNUseCurrentSelection);
-    }
-#else
-    if (!te) {
-        _SetText (editBoxText);
-    } else {
-        TEInsert    (editBoxText.sData,editBoxText.sLength,te);
-    }
-#endif
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_Paint (Ptr p)
-{
-    _HYTextBox * theParent = (_HYTextBox*)this;
-    _HYRect    * relRect   = (_HYRect*)p;
-    Rect         cRect;
-
-    cRect.left   = relRect->left;
-    cRect.right  = relRect->right;
-    cRect.top    = relRect->top;
-    if (theParent->margins.top) {
-        cRect.bottom = relRect->top+theParent->margins.top;
-        if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
-            FillCRect (&cRect,backFill);
-        } else {
-            EraseRect (&cRect);
-        }
-    }
-    cRect.bottom = relRect->bottom;
-    cRect.top = relRect->bottom-theParent->margins.bottom;
-    if (theParent->margins.bottom) {
-        if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
-            FillCRect (&cRect,backFill);
-        } else {
-            EraseRect (&cRect);
-        }
-    }
-    cRect.top    = relRect->top;
-    cRect.bottom = relRect->bottom;
-
-    if (theParent->margins.left) {
-        cRect.right  = relRect->left+theParent->margins.left;
-        if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
-            FillCRect (&cRect,backFill);
-        } else {
-            EraseRect (&cRect);
-        }
-    }
-
-    if (theParent->margins.right) {
-        cRect.left  = relRect->right-theParent->margins.right;
-        cRect.right  = relRect->right;
-        if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
-            FillCRect (&cRect,backFill);
-        } else {
-            EraseRect (&cRect);
-        }
-    }
-
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        if (theParent->boxFlags & HY_TB_BIGBOX) {
-            //printf ("Text box update\n");
-            TXNDrawObject   (txn, nil, kTXNDrawItemAllMask);
-        } else {
-            Rect        textBoxRect2 = textBoxRect;
-
-            InsetRect   (&textBoxRect2,1,1);
-
-            DrawThemeEditTextFrame (&textBoxRect2,theParent->activationFlag?kThemeStateActive:kThemeStateInactive);
-
-            TXNDraw   (txn, nil);
-
-            if (theParent->activationFlag&&(theParent->boxFlags & HY_TB_FOCUSED)) {
-                //InsetRect          (&textBoxRect2,1,1);
-                DrawThemeFocusRect (&textBoxRect2,true);
-            }
-        }
-    }
-#else
-    if (te) {
-        FillCRect(&textBoxRect,backTFill);
-        Rect        textBoxRect2 = textBoxRect;
-        InsetRect   (&textBoxRect2,1,1);
-        DrawThemeEditTextFrame (&textBoxRect2,theParent->activationFlag?kThemeStateActive:kThemeStateInactive);
-        InsetRect   (&textBoxRect2,1,1);
-        if (theParent->settings.width&HY_COMPONENT_TRANSP_BG) {
-            SetThemeWindowBackground (theParent->parentWindow,kThemeBrushWhite,false);
-            TEUpdate    (&textBoxRect2,te);
-            SetThemeWindowBackground (theParent->parentWindow,kThemeBrushDialogBackgroundActive,false);
-        } else {
-            TEUpdate    (&textBoxRect2,te);
-        }
-
-        if (theParent->activationFlag&&theParent->isFocused) {
-            InsetRect   (&textBoxRect2,1,1);
-            DrawThemeFocusRect (&textBoxRect2,true);
-        }
-    }
-#endif
-
-
-    (*theParent)._HYPlatformComponent::_Paint(p);
-}
-
-
-//__________________________________________________________________
-
-void        _HYPlatformTextBox::_EnableTextBox (bool e)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        TXNActivate (txn,txnFrame,e);
-    }
-
-#else
-    if (te)
-        if (e) {
-            TEActivate (te);
-        } else {
-            TEDeactivate (te);
-        }
-#endif
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTextBox::_FocusComponent (void)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        //_String ac = _String ("Focused ") & (long)((_HYTextBox*)this)->GetID() & '\n';
-        //StringToConsole (ac);
-        TXNFocus    (txn,true);
-        TXNActivate (txn,txnFrame,true);
-    }
-#else
-    if (te) {
-        TEActivate (te);
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTextBox::_UnfocusComponent (void)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn) {
-        //_String ac = _String ("Unfocused ") & (long)((_HYTextBox*)this)->GetID() & '\n';
-        //StringToConsole (ac);
-        TXNFocus    (txn,false);
-        TXNActivate (txn,txnFrame,false);
-    }
-#else
-    if (te) {
-        TEDeactivate (te);
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void        _HYTextBox::_Activate (void)
-{
-    if (!activationFlag)
-#ifdef          _HY_USE_MLTE_
-        if (txn&&(boxFlags & HY_TB_ENABLED)) {
-            //_String ac = _String ("Activated ") & (long)GetID() & '\n';
-            //StringToConsole (ac);
-            TXNActivate (txn,txnFrame,true);
-        }
-#else
-        if (te&&isEnabled) {
-            TEActivate (te);
-        }
-#endif
-
-    _HYPlatformComponent::_Activate();
-}
-
-//__________________________________________________________________
-
-void        _HYTextBox::_IdleHandler (void)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn&&(boxFlags & HY_TB_FOCUSED)) {
-        TXNIdle (txn);
-    }
-#else
-    if (te&&isFocused) {
-        TEIdle (te);
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void        _HYTextBox::_Deactivate (void)
-{
-    if (activationFlag)
-#ifdef          _HY_USE_MLTE_
-        if (txn&&(boxFlags & HY_TB_ENABLED)) {
-            //_String ac = _String ("Deactivated ") & (long)GetID() & '\n';
-            //StringToConsole (ac);
-            TXNActivate (txn,txnFrame,false);
-        }
-#else
-        if (te&&isEnabled) {
-            TEDeactivate (te);
-        }
-#endif
-
-    _HYPlatformComponent::_Deactivate();
-}
-
-//__________________________________________________________________
-
-_String mlteCommandString (TXNObject& txn, bool undoOrRedo)
-{
-    TXNActionKey tak;
-
-    if (undoOrRedo) {
-        if (!TXNCanUndo (txn,&tak)) {
-            return empty;
-        }
-    } else if (!TXNCanRedo (txn,&tak)) {
-        return empty;
-    }
-
-    switch (tak) {
-    case kTXNTypingAction:
-        return "Typing";
-
-    case kTXNCutAction:
-        return "Cut";
-
-    case kTXNPasteAction:
-        return "Paste";
-
-    case kTXNClearAction:
-        return "Clear";
-
-    case kTXNDropAction:
-        return "Drop";
-    }
-
-    return empty;
-}
-
-
-//__________________________________________________________________
-
-void _HYPlatformTextBox::_HandleContextMenu (Point& where)
-{
-    _HYTextBox* parent = (_HYTextBox*)this;
-    _List       menuOptions;
-    _String     command;
-
-    command = mlteCommandString (txn, true);
-    if (command.sLength) {
-        command = _String ("Undo ") & command;
-    } else {
-        command = "(Can't Undo";
-    }
-
-    menuOptions && & command;
-
-    command = mlteCommandString (txn, false);
-    if (command.sLength) {
-        command = _String ("Redo ") & command;
-    } else {
-        command = "(Can't Redo";
-    }
-
-    menuOptions && & command;
-    menuOptions && & menuSeparator;
-
-    if (!TXNIsSelectionEmpty(txn)) {
-        command = "Cut";
-        menuOptions && & command;
-        command = "Copy";
-    } else {
-        command = "(Cut";
-        menuOptions && & command;
-        command = "(Copy";
-    }
-
-    menuOptions && & command;
-
-    if (TXNIsScrapPastable()) {
-        command = "Paste";
-    } else {
-        command = "(Paste";
-    }
-
-    menuOptions && & command;
-
-    if (_GetCharacterCount()) {
-        command = "Select All";
-    } else {
-        command = "(Select All";
-    }
-    menuOptions && & command;
-
-    command = HandlePullDown (menuOptions, where.h, where.v, -1);
-
-    bool      sendMessage = true;
-
-    long      f = menuOptions.Find (&command);
-
-    if (f>=0) {
-        switch (f) {
-        case 0:
-            parent->_DoUndo();
-            break;
-        case 1:
-            parent->_DoRedo();
-            break;
-        case 3:
-            parent->_DoCut();
-            break;
-        case 4:
-            parent->_DoCopy();
-            //sendMessage = false;
-            break;
-        case 5:
-            parent->_DoPaste();
-            break;
-        case 6:
-            parent->_DoSelectAll ();
-            //sendMessage = false;
-            break;
-        default:
-            return;
-
-        }
-
-        if (((_HYTextBox*)this)->messageRecipient&&sendMessage) {
-            ((_HYTextBox*)this)->messageRecipient->ProcessEvent (generateTextEditChangeEvent (((_HYTextBox*)this)->GetID(),1));
-        }
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoUndo (bool m)
-{
-#ifdef          _HY_USE_MLTE_
-    TXNUndo (txn);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoRedo (bool m)
-{
-#ifdef          _HY_USE_MLTE_
-    TXNRedo (txn);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoCut (bool m)
-{
-#ifdef          _HY_USE_MLTE_
-    TXNCut(txn);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoCopy (bool )
-{
-#ifdef          _HY_USE_MLTE_
-    TXNCopy(txn);
-#endif
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoPaste (bool m)
-{
-#ifdef          _HY_USE_MLTE_
-    TXNPaste(txn);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoSelectAll (bool m)
-{
-    ((_HYTextBox*)this)->SetSelection (0,0x7fffffff);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),0));
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoClear (bool doAll, bool m)
-{
-#ifdef          _HY_USE_MLTE_
-    if (doAll) {
-        _DoSelectAll();
-    }
-    TXNClear(txn);
-    if (doAll) {
-        _SetFont (editBoxFont);
-    }
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-
-#endif
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoFind (_String & st)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn && (boxFlags & HY_TB_BIGBOX)) {
-        TXNMatchTextRecord tmr;
-        tmr.iTextPtr            = st.sData;
-        tmr.iTextToMatchLength  = st.sLength;
-        tmr.iTextEncoding       = CreateTextEncoding (kTextEncodingMacRoman,
-                                  kTextEncodingDefaultVariant,
-                                  kTextEncodingDefaultFormat);
-
-        TXNOffset start = 0,
-                  end;
-
-        TXNGetSelection (txn, &start, &end);
-        end   = kTXNEndOffset;
-
-        TXNFind (txn,
-                 &tmr,
-                 kTXNTextData|kTXNUnicodeTextData,
-                 0,
-                 start,
-                 end,
-                 nil,
-                 0,
-                 &start,
-                 &end);
-
-        if ((start == end)&&(start == kTXNUseCurrentSelection)) {
-            _String eMsg = _String ("Could not find '") & st & "'.";
-            ProblemReport (eMsg, (Ptr)this);
-        } else {
-            TXNSetSelection (txn, start, end);
-            TXNShowSelection (txn, false);
-        }
-
-    }
-#endif
-}
-
-
-//__________________________________________________________________
-
-bool _HYTextBox::_ProcessOSEvent (Ptr vEvent)
-{
-    EventRecord*    theEvent = (EventRecord*)vEvent;
-    WindowPtr       dummy;
-#ifdef          _HY_USE_MLTE_
-    //printf ("%d\n",theEvent->what);
-    if (txn) {
-        switch (theEvent->what) {
-        case mouseDown: {
-            long evtType = FindWindow (theEvent->where,&dummy);
-            if (evtType == inContent) {
-                if (boxFlags & HY_TB_FOCUSED) {
-                    Point localClick = theEvent->where;
-                    if (theEvent->modifiers&controlKey) {
-                        _HandleContextMenu (localClick);
-                    } else {
-                        GlobalToLocal (&localClick);
-                        if (PtInRect (localClick,&textBoxRect)) {
-                            TXNClick (txn, theEvent);
-                            if (messageRecipient) {
-                                messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),0));
-                            }
-                        }
-                    }
-                } else if (messageRecipient) {
-                    messageRecipient->ProcessEvent(generateKeyboardFocusEvent(GetID()));
-                }
-            }
-            return true;
-        }
-        case keyDown:
-        case autoKey: {
-            if (boxFlags & HY_TB_FOCUSED) {
-
-                char c = theEvent->message&charCodeMask,
-                     k = (theEvent->message&keyCodeMask)>>8;
-
-                bool sendMessage = true;
-
-                if ((((_HYTextBox*)this)->boxFlags&HY_TB_ARROWS) && messageRecipient) {
-                    if (k==125) {
-                        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),3));
-                        return true;
-                    } else if (k==126) {
-                        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),4));
-                        return true;
-                    }
-                }
-
-                if (!(((_HYTextBox*)this)->boxFlags&HY_TB_BIGBOX)) {
-                    if (theEvent->modifiers&cmdKey) {
-                        bool done = true;
-                        if ((c=='c')||(c=='C')) {
-                            TXNCopy (txn);
-                            sendMessage = false;
-                        } else if ((c=='x')||(c=='X')) {
-                            TXNCut (txn);
-                        } else if ((c=='v')||(c=='V')) {
-                            if (TXNIsScrapPastable()) {
-                                TXNPaste (txn);
-                            }
-                        } else if ((c=='a')||(c=='A')) {
-                            SetSelection (0,0x7fffffff);
-                            sendMessage = false;
-                        } else if ((c=='z')||(c=='Z')) {
-                            if (mlteCommandString (txn,true).sLength) {
-                                TXNUndo (txn);
-                            }
-                        } else if ((c=='y')||(c=='Y')) {
-                            if (mlteCommandString (txn,false).sLength) {
-                                TXNRedo (txn);
-                            }
-                        } else {
-                            done = false;
-                        }
-                    } else {
-                        if ((k==0x24)||(k==0x4C)) {
-                            if (messageRecipient) {
-                                messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),2));
-                            }
-                            return true;
-                        } else {
-                            TXNKeyDown (txn,theEvent);
-                        }
-                    }
-                } else {
-                    if (theEvent->modifiers&cmdKey) {
-                        return false;
-                    }
-
-                    TXNKeyDown (txn,theEvent);
-                }
-                if (messageRecipient&&sendMessage) {
-                    messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-                }
-                return true;
-            }
-        }
-        }
-    }
-#else
-    if (te) {
-        switch (theEvent->what) {
-        case mouseDown: {
-            long evtType = FindWindow (theEvent->where,&dummy);
-            if (evtType == inContent) {
-                if (isFocused) {
-                    Point localClick = theEvent->where;
-                    GlobalToLocal (&localClick);
-                    if (PtInRect (localClick,&textBoxRect)) {
-                        if (settings.width&HY_COMPONENT_TRANSP_BG) {
-                            SetThemeWindowBackground (parentWindow,kThemeBrushWhite,false);
-                        }
-                        TEClick (localClick, theEvent->modifiers&shiftKey, te);
-                        if (settings.width&HY_COMPONENT_TRANSP_BG) {
-                            SetThemeWindowBackground (parentWindow,kThemeBrushDialogBackgroundActive,false);
-                        }
-                        if (messageRecipient) {
-                            messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),0));
-                        }
-                    }
-                } else if (messageRecipient) {
-                    messageRecipient->ProcessEvent(generateKeyboardFocusEvent(GetID()));
-                }
-            }
-            return true;
-        }
-        case keyDown:
-        case autoKey: {
-            if (isFocused) {
-                if (settings.width&HY_COMPONENT_TRANSP_BG) {
-                    SetThemeWindowBackground (parentWindow,kThemeBrushWhite,false);
-                }
-
-                char c = theEvent->message&charCodeMask,
-                     k = (theEvent->message&keyCodeMask)>>8;
-
-                bool sendMessage = true;
-                if (theEvent->modifiers&cmdKey) {
-                    if ((c=='c')||(c=='C')) {
-                        TECopy (te);
-                        sendMessage = false;
-                    } else if ((c=='x')||(c=='X')) {
-                        TECut (te);
-                    } else if ((c=='v')||(c=='V')) {
-                        TEPaste (te);
-                    } else if ((c=='a')||(c=='A')) {
-                        SetSelection (0,30000);
-                        sendMessage = false;
-                    }
-                } else {
-                    if ((k==0x24)||(k==0x4C)) {
-                        if (messageRecipient) {
-                            messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),2));
-                        }
-                        return true;
-                    } else {
-                        TEKey (c,te);
-                    }
-                }
-                if (settings.width&HY_COMPONENT_TRANSP_BG) {
-                    SetThemeWindowBackground (parentWindow,kThemeBrushDialogBackgroundActive,false);
-                }
-                if (messageRecipient&&sendMessage) {
-                    messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-                }
-                return true;
-            }
-        }
-        }
-    }
-#endif
-    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
-}
-
-//__________________________________________________________________
-
-void    _HYTextBox::_SetSelection (long s, long e)
-{
-#ifdef          _HY_USE_MLTE_
-    if (txn&&(s>=0)&&(e>=s)) {
-        TXNSetSelection (txn,s,e);
-    }
-#else
-    if (te&&(s>=0)&&(e>=s)) {
-        TESetSelect (s,e,te);
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-bool    _HYTextBox::_IsEmpty (void)
-{
-#ifdef          _HY_USE_MLTE_
-    return _GetCharacterCount() == 0;
-#else
-    return !_GetText().sLength;
-#endif
-}
-
-//__________________________________________________________________
-
-void    _HYTextBox::_MarkForUpdate(void)
-{
-    _HYPlatformComponent::_MarkForUpdate();
-}
-
-
-
-
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/mac/Docs.icns b/src/gui/mac/Docs.icns
deleted file mode 100644
index c4e583b..0000000
Binary files a/src/gui/mac/Docs.icns and /dev/null differ
diff --git a/src/gui/mac/HYPHY.icns b/src/gui/mac/HYPHY.icns
deleted file mode 100644
index c4e583b..0000000
Binary files a/src/gui/mac/HYPHY.icns and /dev/null differ
diff --git a/src/gui/mac/HYPHYMP.icns b/src/gui/mac/HYPHYMP.icns
deleted file mode 100644
index c4e583b..0000000
Binary files a/src/gui/mac/HYPHYMP.icns and /dev/null differ
diff --git a/src/gui/mac/HYPlatformComponent.cpp b/src/gui/mac/HYPlatformComponent.cpp
deleted file mode 100644
index dc18972..0000000
--- a/src/gui/mac/HYPlatformComponent.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A general composite window component object, MacOS specifics

    Sergei L. Kosakovsky Pond, May 2000.
*/

#include "HYComponent.h"
#include "HYPlatformComponent.h"

#ifndef  TARGET_API_MAC_CARBON
#include "Windows.h"
#endif

#include "HYWindow.h"
#include "Controls.h"
#include "ControlDefinitions.h"
#include "Palettes.h"
#include "HYEventTypes.h"
#include "HYCanvas.h"
#include "HYUtils.h"

#include "QDoffscreen.h"
#include "Quicktime.h"


//__________________________________________________________________________________

extern  long        smallScrollStep,
        scrollStepCounter,
        lastScrollControlValue;

extern  _HYGuiObject *
scrollingWindow;

extern  bool        hScrollingAction;
extern  Point       lastScrollPoint;

bool    forceUpdateForScrolling = false;

extern  RGBColor    menuLine1,
        menuLine2;

//__________________________________________________________________________________

void            AlignRectangle (_HYRect& rel , Rect& target , unsigned char alFlags)
{
    long     temp;
    if (alFlags&HY_ALIGN_RIGHT) {
        temp = target.right-target.left;
        target.right = rel.right;
        target.left = target.right - temp;
    } else if (!(alFlags&HY_ALIGN_LEFT)) {
        temp = (rel.right-rel.left-target.right+target.left)/2;
        target.left+=temp;
        target.right+=temp;
    }

    if (alFlags&HY_ALIGN_BOTTOM) {
        temp = target.bottom-target.top;
        target.bottom = rel.bottom;
        target.top = target.bottom - temp;
    } else if (!(alFlags&HY_ALIGN_TOP)) {
        temp = (rel.bottom-rel.top-target.bottom+target.top)/2;
        target.top+=temp;
        target.bottom+=temp;
    }
}

//__________________________________________________________________

pascal void scrollAction (ControlHandle,ControlPartCode);

/*//__________________________________________________________________

pascal void  controlScrollAction (ControlHandle theControl,ControlPartCode ctlPart)
{
    long   cv  = GetControl32BitValue (theControl),
           cv2 = cv;

    long    smStep,
            invisPixels;

    _HYPlatformComponent*    thisC      = (_HYPlatformComponent*)GetControlReference (theControl);
    _HYComponent*            theParent  = (_HYComponent*)thisC;
    bool                     hScrAction = (thisC->hScroll==theControl);

    if (hScrAction)
        invisPixels = theParent->GetMaxW()-(theParent->GetHSize());
    else
        invisPixels = theParent->GetMaxH()-(theParent->GetVSize());

    smStep = (double)MAX_CONTROL_VALUE/invisPixels;
    if (!smStep)
        smStep = 1;


    switch (ctlPart)
    {
        case kControlDownButtonPart:
            HiliteControl (theControl,kControlDownButtonPart);
            cv2 = cv+smStep;
            if (cv2>MAX_CONTROL_VALUE)
                cv2 = MAX_CONTROL_VALUE;
            break;
        case kControlUpButtonPart:
            HiliteControl (theControl,kControlUpButtonPart);
            cv2 = cv-smStep;
            if (cv2<0)
                cv2 = 0;
            break;
        case kControlPageUpPart:
            HiliteControl (theControl,kControlPageUpPart);
            cv2 = cv-100*smStep;
            if (cv2<0)
                cv2 = 0;
            break;
        case kControlPageDownPart:
            HiliteControl (theControl,kControlPageDownPart);
            cv2 = cv+100*smStep;
            if (cv2>MAX_CONTROL_VALUE)
                cv2 = MAX_CONTROL_VALUE;
            break;
        case kControlIndicatorPart:
            cv2 = cv;
            cv  = hScrAction?thisC->lastHScroll:thisC->lastVScroll;
            printf ("%d %d\n", cv, cv2);
            break;
    }

    if (cv!=cv2)
    {
        SetControl32BitValue (theControl,cv2);
        forceUpdateForScrolling = true;
        if (hScrAction)
        {
            ((_HYComponent*)thisC)->ProcessEvent (generateScrollEvent (cv2-cv,0));
            thisC->lastHScroll = cv2;
        }
        else
        {
            ((_HYComponent*)thisC)->ProcessEvent (generateScrollEvent (0,cv2-cv));
            thisC->lastVScroll = cv2;
        }
        forceUpdateForScrolling = false;
    }
}

//__________________________________________________________________

ControlActionUPP      ctlActionUPP = NewControlActionUPP (controlScrollAction);*/
//__________________________________________________________________

_HYPlatformComponent::_HYPlatformComponent(void)
{
    vScroll = hScroll = nil;
}

//__________________________________________________________________

_HYPlatformComponent::_HYPlatformComponent(_HYRect s,Ptr w)
{
    bool    memError = false;
    vScroll = hScroll = nil;
    WindowPtr theWindow = (WindowPtr)w;
    Rect    cSize;
    if (s.width&HY_COMPONENT_H_SCROLL) {
        cSize.left = cSize.top = 0;
        cSize.right = 100;
        cSize.bottom = 15;
        hScroll = NewControl (theWindow,&cSize,"\p",false,0,0,MAX_CONTROL_VALUE,kControlScrollBarLiveProc,(SInt32)this);
        if (!hScroll) {
            memError = true;
        } else {
            SetControl32BitMinimum (hScroll,0);
            SetControl32BitMaximum (hScroll,MAX_CONTROL_VALUE);
            //SetControlAction     (hScroll, ctlActionUPP);
        }
    }
    if (s.width&HY_COMPONENT_V_SCROLL) {
        cSize.left = cSize.top = 0;
        cSize.bottom = 100;
        cSize.right = 15;
        vScroll = NewControl (theWindow,&cSize,"\p",false,0,0,MAX_CONTROL_VALUE,kControlScrollBarLiveProc,(SInt32)this);
        if (!vScroll) {
            memError = true;
        } else {
            SetControl32BitMinimum (vScroll,0);
            SetControl32BitMaximum (vScroll,MAX_CONTROL_VALUE);
            //SetControlAction     (vScroll, ctlActionUPP);
        }
    }
    if (memError) {
        _String errMsg = "Could not allocate memory for a window component structure.";
        FlagError (errMsg);
    }
    parentWindow = theWindow;
    lastHScroll = 0;
    lastVScroll = 0;
}

//__________________________________________________________________

void _HYPlatformComponent::_CleanUp(void)
{
    if (hScroll) {
        DisposeControl (hScroll);
        hScroll = nil;
    }
    if (vScroll) {
        DisposeControl (vScroll);
        vScroll = nil;
    }
}

//__________________________________________________________________
long        _HYPlatformComponent::_GetHScrollerPos (void)
{
    if (hScroll) {
        return GetControl32BitValue (hScroll);
    } else {
        return 0;
    }
}
//__________________________________________________________________
long        _HYPlatformComponent::_GetVScrollerPos (void)
{
    if (vScroll) {
        return GetControl32BitValue (vScroll);
    } else {
        return 0;
    }
}

//__________________________________________________________________
void        _HYPlatformComponent::_SetHScrollerPos (long nv)
{
    if (hScroll) {
        if (nv<0) {
            nv = 0;
        } else if (nv>MAX_CONTROL_VALUE) {
            nv = MAX_CONTROL_VALUE;
        }
        SetControl32BitValue (hScroll,nv);
    }
}

//__________________________________________________________________
void        _HYPlatformComponent::_SetVScrollerPos (long nv)
{
    if (vScroll) {
        if (nv<0) {
            nv = 0;
        } else if (nv>MAX_CONTROL_VALUE) {
            nv = MAX_CONTROL_VALUE;
        }
        SetControl32BitValue (vScroll,nv);
    }
}


//__________________________________________________________________
void _HYPlatformComponent::Duplicate (BaseRef s)
{
    _HYComponent* theS = (_HYComponent*)s;
    _CleanUp();
    hScroll = theS->hScroll;
    vScroll = theS->vScroll;
}

//__________________________________________________________________
void _HYPlatformComponent::_SetDimensions (_HYRect,_HYRect r)
{
    _SetVisibleSize (r);
}

//__________________________________________________________________
void _HYPlatformComponent::_MarkForUpdate (void)
{
    Rect inv;
    inv.left = rel.left;
    inv.right = rel.right;
    inv.bottom = rel.bottom;
    inv.top = rel.top;
    GrafPtr   savePort;
    GetPort   (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort (GetWindowPort(parentWindow));
#else
    SetPort (parentWindow);
#endif

    if (forceUpdateForScrolling) {
        //BeginUpdate(parentWindow);
        _Paint((Ptr)&rel);
        //EndUpdate(parentWindow);
    } else
#ifdef TARGET_API_MAC_CARBON
        InvalWindowRect (parentWindow,&inv);
#else
        InvalRect (&inv);
#endif

    SetPort   (savePort);
}

//__________________________________________________________________
void _HYPlatformComponent::_MarkContentsForUpdate (void)
{
    Rect inv;
    inv.left = rel.left;
    inv.right = rel.right;
    inv.bottom = rel.bottom;
    inv.top = rel.top;
    if (hScroll) {
        inv.bottom -= HY_SCROLLER_WIDTH;
    }
    if (vScroll) {
        inv.right -= HY_SCROLLER_WIDTH;
    }
    GrafPtr   savePort;
    GetPort   (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort (GetWindowPort(parentWindow));
#else
    SetPort (parentWindow);
#endif
    if (forceUpdateForScrolling) {
        _Paint((Ptr)&rel);
    } else
#ifdef TARGET_API_MAC_CARBON
        InvalWindowRect (parentWindow,&inv);
#else
        InvalRect (&inv);
#endif

    SetPort   (savePort);
}

//__________________________________________________________________

void        _HYPlatformComponent::_SetVisibleSize (_HYRect r)
{
    _HYComponent * theParent = (_HYComponent*)this;
    long        t, v;

    _Parameter  newSize;

    if (hScroll&&!vScroll) { // only horizontal scroll bar
        MoveControl (hScroll,r.left-1,r.bottom-16);
        SizeControl (hScroll,r.right-r.left+1,16);
        t = theParent->GetMaxW();
        v = r.right-r.left+1;
        //char buf[256];
        //sprintf (buf,"%d %d\n",t,v);
        //BufferToConsole (buf);
        if (t>v) {
            if (GetControl32BitMaximum (hScroll)!=MAX_CONTROL_VALUE) {
                lastHScroll = 0;
                SetControl32BitMaximum (hScroll,MAX_CONTROL_VALUE);
            }

            HiliteControl (hScroll,0);
            newSize = MAX_CONTROL_VALUE*(_Parameter)v/(t-v);
            if (newSize>0x6fffffff) {
                newSize = 0x6fffffff;
            }
            SetControlViewSize (hScroll,(long)newSize);
        } else {
            SetControl32BitMaximum (hScroll,0);
            SetControl32BitValue   (hScroll,0);
            HiliteControl (hScroll, kControlInactivePart);
        }
    }
    if (vScroll&&!hScroll) { // only vertical scroll bar
        MoveControl (vScroll,r.right-16,r.top-1);
        SizeControl (vScroll,16,r.bottom-r.top+1);
        t = theParent->GetMaxH();
        v = r.bottom-r.top+1;
        if (t>v) {
            if (GetControl32BitMaximum (vScroll)!=MAX_CONTROL_VALUE) {
                lastVScroll = 0;
                SetControl32BitMaximum (vScroll,MAX_CONTROL_VALUE);
            }

            HiliteControl (vScroll,0);
            newSize = MAX_CONTROL_VALUE*(_Parameter)v/(t-v);
            if (newSize>0x6fffffff) {
                newSize = 0x6fffffff;
            }
            SetControlViewSize (vScroll,(long)newSize);
        } else {
            SetControl32BitMaximum (vScroll,0);
            SetControl32BitValue   (vScroll,0);
            HiliteControl (vScroll, kControlInactivePart);
        }
    }
    if (vScroll&&hScroll) {
        MoveControl (hScroll,r.left-1,r.bottom-16);
        SizeControl (hScroll,r.right-r.left-13,16);
        t = theParent->GetMaxW();
        v = r.right-r.left+1+HY_SCROLLER_WIDTH;
        if (t>v) {
            if (GetControl32BitMaximum (hScroll)!=MAX_CONTROL_VALUE) {
                lastHScroll = 0;
                SetControl32BitMaximum (hScroll,MAX_CONTROL_VALUE);
            }
            HiliteControl (hScroll,0);
            newSize = MAX_CONTROL_VALUE*(_Parameter)v/(t-v);
            if (newSize>0x6fffffff) {
                newSize = 0x6fffffff;
            }
            SetControlViewSize (hScroll,(long)newSize);
        } else {
            SetControl32BitMaximum (hScroll,0);
            SetControl32BitValue   (hScroll,0);
            HiliteControl (hScroll, kControlInactivePart);
        }
        MoveControl (vScroll,r.right-16,r.top-1);
        SizeControl (vScroll,16,r.bottom-r.top+2);
        t = theParent->GetMaxH();
        v = r.bottom-r.top+1+HY_SCROLLER_WIDTH;
        if (t>v) {
            if (GetControl32BitMaximum (vScroll)!=MAX_CONTROL_VALUE) {
                lastVScroll = 0;
                SetControl32BitMaximum (vScroll,MAX_CONTROL_VALUE);
            }
            HiliteControl (vScroll,0);
            newSize = MAX_CONTROL_VALUE*(_Parameter)v/(t-v);
            if (newSize>0x6fffffff) {
                newSize = 0x6fffffff;
            }
            SetControlViewSize (vScroll,(long)newSize);
        } else {
            SetControl32BitMaximum (vScroll,0);
            SetControl32BitValue   (vScroll,0);
            HiliteControl (vScroll, kControlInactivePart);
        }
    }
    rel = r;
}
//__________________________________________________________________

void        _HYPlatformComponent::_Paint (Ptr)
{
    _HYComponent* parent = (_HYComponent*)this;
    if (parent->settings.width&HY_COMPONENT_BORDER) {
        RGBColor saveColor;
        PenState sp;
        GetPenState (&sp);
        GetForeColor (&saveColor);
        RGBForeColor (&menuLine2);
        PenSize (1,1);
        MoveTo (rel.left,rel.top);
        if (parent->settings.width&HY_COMPONENT_BORDER_T) {
            LineTo (rel.right-1,rel.top);
        } else {
            MoveTo (rel.right-1,rel.top);
        }
        if (parent->settings.width&HY_COMPONENT_BORDER_R) {
            LineTo (rel.right-1,rel.bottom-1);
        } else {
            MoveTo (rel.right-1,rel.bottom-1);
        }
        if (parent->settings.width&HY_COMPONENT_BORDER_B) {
            LineTo (rel.left,rel.bottom-1);
        } else {
            MoveTo (rel.left,rel.bottom-1);
        }
        if (parent->settings.width&HY_COMPONENT_BORDER_L) {
            LineTo (rel.left,rel.top);
        }
        SetPenState (&sp);
        RGBForeColor (&saveColor);
    }
    if (parent->settings.width&HY_COMPONENT_WELL) {
        Rect rr = HYRect2Rect (rel);
        InsetRect (&rr,2,2);
        DrawThemeGenericWell (&rr,activationFlag?kThemeStateActive:kThemeStateInactive,false);
    }
    if (hScroll) {
        Draw1Control (hScroll);
    }
    if (vScroll) {
        Draw1Control (vScroll);
    }
}

//__________________________________________________________________

void      _HYPlatformComponent::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________

void        _HYPlatformComponent::_Activate (void)
{
    _HYComponent*   theParent = (_HYComponent*)this;
    if (hScroll) {
        ShowControl (hScroll);
        if (theParent->GetMaxW()>theParent->rel.right-theParent->rel.left+1+HY_SCROLLER_WIDTH) {
            HiliteControl (hScroll,kControlNoPart);
        }
    }
    if (vScroll) {
        ShowControl (vScroll);
        if (theParent->GetMaxH()>theParent->rel.bottom-theParent->rel.top+1+HY_SCROLLER_WIDTH) {
            HiliteControl (vScroll, kControlNoPart );
        }
    }
    activationFlag = true;
}

//__________________________________________________________________

void        _HYPlatformComponent::_Deactivate (void)
{
    if (hScroll) {
        HiliteControl (hScroll, kControlInactivePart);
    }
    if (vScroll) {
        HiliteControl (vScroll, kControlInactivePart);
    }

    activationFlag = false;
}

//__________________________________________________________________

bool _HYPlatformComponent::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord*    theEvent = (EventRecord*)vEvent;
    WindowPtr       dummy;
    _HYComponent*   theParent = (_HYComponent*)this;
    switch (theEvent->what) {
    case mouseDown: {
        long evtType = FindWindow (theEvent->where,&dummy);
        switch (evtType) {
        case inContent: {
            Point localClick = theEvent->where;
            GlobalToLocal (&localClick);
            ControlHandle whichC;
            short f = FindControl (localClick,dummy,&whichC);
            scrollingWindow = theParent;
            if (f) {
                // set scroll step
                long    invisPixels;
                if (whichC==hScroll) {
                    invisPixels = theParent->GetMaxW()-(theParent->GetHSize());
                    hScrollingAction = true;
                } else {
                    if (whichC==vScroll) {
                        invisPixels = theParent->GetMaxH()-(theParent->GetVSize());
                        hScrollingAction = false;
                    } else {
                        return false;
                    }
                }
                scrollStepCounter = 0;
                smallScrollStep = (double)MAX_CONTROL_VALUE/invisPixels;
                if (!smallScrollStep) {
                    smallScrollStep = 1;
                }
#ifdef TARGET_API_MAC_CARBON
                ControlActionUPP myActionProc;
                myActionProc =   NewControlActionUPP(scrollAction);
#else
                UniversalProcPtr myActionProc;
                myActionProc = NewRoutineDescriptor((ProcPtr)scrollAction,
                                                    uppControlActionProcInfo,
                                                    GetCurrentISA());
#endif

                lastScrollControlValue = GetControl32BitValue (whichC);

                switch (f) {
                    /*case kControlIndicatorPart:
                    {
                        long    cv = GetControl32BitValue(whichC),cv2;
                        TrackControl (whichC,localClick,nil);
                        cv2 = GetControl32BitValue(whichC);
                        if (cv!=cv2)
                            if (hScrollingAction)
                                scrollingWindow->ProcessEvent (generateScrollEvent (cv2-cv,0));
                            else
                                scrollingWindow->ProcessEvent (generateScrollEvent (0,cv2-cv));

                        break;
                    }*/
                default: {
                    forceUpdateForScrolling = true;
#ifndef __OLDMAC__
                    TrackControl (whichC,localClick,myActionProc);
#else
#ifdef TARGET_API_MAC_CARBON
                    HandleControlClick (whichC,localClick,theEvent->modifiers,scrollAction);
#else
                    TrackControl (whichC,localClick,scrollAction);
#endif
#endif
                    forceUpdateForScrolling = false;
                }
#ifdef TARGET_API_MAC_CARBON
                DisposeControlActionUPP(myActionProc);
#endif

                }
                return true;
            }
        }
        }
    }
    }
    return false;
}

//__________________________________________________________________


_HYRect _HYPlatformComponent::_VisibleContents (Ptr p)
{
    _HYComponent* theParent = (_HYComponent*)this;
    _HYRect     * r = (_HYRect*)p,
                  res;

    short v;
    short windowW=r->right-r->left,
          windowH=r->bottom-r->top;
    if ((!hScroll)&&(!vScroll)) {
        res.left = theParent->hOrigin;
        res.right = res.left+windowW;
        res.top = theParent->vOrigin;
        res.bottom = res.top+windowH;
        return res;
    }
    if (hScroll) {
        windowH-=HY_SCROLLER_WIDTH;
    }
    if (vScroll) {
        windowW-=HY_SCROLLER_WIDTH;
    }
    if (hScroll) {
        if (windowW>theParent->GetMaxW()) {
            res.left = 0;
            res.right = theParent->GetMaxW();
        } else {
            v = GetControl32BitValue (hScroll);
            res.left = (theParent->GetMaxW()-windowW)*v/(double)MAX_CONTROL_VALUE;
            res.right = res.left+windowW;
        }
    } else {
        res.left = 0;
        res.right = windowW;
    }
    if (vScroll) {
        if (windowH>theParent->GetMaxH()) {
            res.top = 0;
            res.bottom = theParent->GetMaxH();
        } else {
            v = GetControl32BitValue (vScroll);
            res.top = (theParent->GetMaxH()-windowH)*v/(double)MAX_CONTROL_VALUE;
            res.bottom = res.top+windowH;
        }
    } else {
        res.top = 0;
        res.bottom = windowH;
    }
    return res;
}

//__________________________________________________________________

void    _HYCanvas::_Paint (Ptr p)
{
    _HYRect * destR = (_HYRect*)p;
    Rect srcRect,destRect;
    destRect.right = destR->right;
    destRect.bottom = destR->bottom;
    if (HasHScroll()) {
        destRect.bottom-=HY_SCROLLER_WIDTH;
    }
    if (HasVScroll()) {
        destRect.right-=HY_SCROLLER_WIDTH;
    }
//  if (RectInRgn (&destRect,((WindowPeek)parentWindow)->updateRgn))
    {
        _HYPlatformComponent::_Paint(p);
        destRect.left = destR->left;
        destRect.top = destR->top;
        _HYRect srcR = _VisibleContents (p);
        srcRect.right = srcR.right;
        srcRect.left = srcR.left;
        srcRect.top = srcR.top;
        srcRect.bottom = srcR.bottom;
        RGBColor         foreC,
                         backC;
        GetForeColor     (&foreC);
        GetBackColor     (&backC);
        RGBColor         white = {0xffff,0xffff,0xffff};
        RGBBackColor (&white);
        white.red = white.green = white.blue = 0;
        RGBForeColor (&white);
        LockPixels (GetGWorldPixMap(thePane));
#ifdef OPAQUE_TOOLBOX_STRUCTS
        CopyBits (GetPortBitMapForCopyBits(thePane),GetPortBitMapForCopyBits(GetWindowPort(parentWindow)),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#else
        CopyBits (&(GrafPtr(thePane)->portBits),&(parentWindow->portBits),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#endif
        UnlockPixels (GetGWorldPixMap(thePane));
        RGBForeColor     (&foreC);
        RGBBackColor     (&backC);
    }
}

//__________________________________________________________________

void    _HYCanvas::_Update (Ptr p)
{
    _Paint(p);
}

//__________________________________________________________________

_List       exportFormats;
_SimpleList exportOptions;

void        findGraphicsExporterComponents (_List&, _SimpleList&);

//__________________________________________________________________

bool _HYCanvas::_ProcessOSEvent (Ptr vEvent)
{
    if (_HYPlatformComponent::_ProcessOSEvent (vEvent)) {
        return true;
    }

    EventRecord*    theEvent = (EventRecord*)vEvent;
    WindowPtr       dummy;
    _HYComponent*   theParent = (_HYComponent*)this;
    switch (theEvent->what) {
    case mouseDown: {
        long evtType = FindWindow (theEvent->where,&dummy);
        switch (evtType) {
        case inContent: {
            if (theEvent->modifiers&controlKey) {
                if (exportFormats.lLength==0) {
                    findGraphicsExporterComponents (exportFormats,exportOptions);
                }
                _String s1 ("Save as a picture"),
                        s2 ("Save canvas as:"),
                        filePath;
                _List   menuOptions;
                menuOptions && & s1;
                long    menuChoice;
                s1 = HandlePullDown (menuOptions,theEvent->where.h,theEvent->where.v,0);
                menuChoice  = menuOptions.Find (&s1);
                if (menuChoice==0) {
                    s1 = "snapshot";
                    menuChoice = SaveFileWithPopUp (filePath, s2,s1, empty,exportFormats);
                    if (menuChoice>=0) {
                        Str255 buff;
                        ComponentInstance grexc = OpenComponent ((Component)exportOptions(menuChoice));
                        GraphicsExportSetInputGWorld (grexc,thePane);
                        FSSpec  fs;
                        StringToStr255 (filePath,buff);
                        FSMakeFSSpec(0,0,buff,&fs);
                        GraphicsExportSetOutputFile (grexc,&fs);
                        GraphicsExportRequestSettings (grexc,nil,nil);
                        unsigned long dummy;
                        OSType t,c;
                        GraphicsExportGetDefaultFileTypeAndCreator (grexc,&t,&c);
                        GraphicsExportSetOutputFileTypeAndCreator (grexc,t,c);
                        GraphicsExportDoExport (grexc,&dummy);
                        CloseComponent (grexc);
                    }

                }
                return true;
            } else {
                if ((messageRecipient)&&(doMouseClicks)) {
                    GrafPtr curPort;
                    GetPort (&curPort);
#ifdef TARGET_API_MAC_CARBON
                    SetPort (GetWindowPort (theParent->parentWindow));
#else
                    SetPort (theParent->parentWindow);
#endif
                    Point localClick = theEvent->where;
                    GlobalToLocal (&localClick);
                    SetPort (curPort);
                    messageRecipient->ProcessEvent(generateContextPopUpEvent (GetID(),localClick.h-rel.left,localClick.v-rel.top));
                    return true;
                }
            }
        }
        }
    }
    }
    return false;
}



//EOF
\ No newline at end of file
diff --git a/src/gui/mac/HYPlatformGraphicPane.cpp b/src/gui/mac/HYPlatformGraphicPane.cpp
deleted file mode 100644
index b390530..0000000
--- a/src/gui/mac/HYPlatformGraphicPane.cpp
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
-    A painting canvas with double buffer. MacOS.
-
-    Sergei L. Kosakovsky Pond, May 2000.
-*/
-
-#include "HYGraphicPane.h"
-#include "QDOffscreen.h"
-#include "Quickdraw.h"
-//#include "Textedit.h"
-#include "Fonts.h"
-#include "stdlib.h"
-#include "errorfns.h"
-#include "scrap.h"
-#include "QuickTimeComponents.h"
-#include "ImageCompression.h"
-#include "HYUtils.h"
-#include "HYPulldown.h"
-#include "HYPlatformWindow.h"
-#include "Appearance.h"
-#include "Resources.h"
-#include "MacTextEditor.h"
-
-extern      void StringToStr255 (_String&, Str255&);
-
-extern      Pattern penHatchPattern,vertPenHatchPattern;
-
-void        findGraphicsExporterComponents (_List&, _SimpleList&);
-
-_List       graphicsFormats;
-
-_SimpleList qtGrexComponents;
-
-_String     savePicPrompt               ("Save Picture As:"),
-            savePicAs                  ("File Format:");
-
-//__________________________________________________________________
-
-Rect    HYRect2Rect (_HYRect& hr)
-{
-    Rect r;
-    r.left = hr.left;
-    r.right = hr.right;
-    r.top = hr.top;
-    r.bottom = hr.bottom;
-    return r;
-}
-
-//__________________________________________________________________
-
-void findGraphicsExporterComponents(_List& compList, _SimpleList& compIndex)
-{
-    ComponentDescription cd, cd2;
-    Component c = 0;
-
-    cd.componentType            = GraphicsExporterComponentType;
-    cd.componentSubType         = 0;
-    cd.componentManufacturer    = 0;
-    cd.componentFlags           = 0;
-    cd.componentFlagsMask       = graphicsExporterIsBaseExporter;
-
-    _String fileFormat;
-
-    while( ( c = FindNextComponent( c, &cd ) ) != 0 ) {
-        Handle     cInfo = NewHandle(256);
-        GetComponentInfo (c,&cd2,cInfo,nil,nil);
-        (*cInfo)[**cInfo+1] = 0;
-        fileFormat = (char*)(*cInfo+1);
-        if (fileFormat.sLength) {
-            compList&& &fileFormat;
-            compIndex << (long)c;
-        }
-        DisposeHandle(cInfo);
-    }
-}
-
-//__________________________________________________________________
-
-void InitializeQTExporters(void)
-{
-    if (!graphicsFormats.lLength) {
-        qtGrexComponents.Clear();
-        findGraphicsExporterComponents (graphicsFormats, qtGrexComponents);
-    }
-}
-
-//__________________________________________________________________
-
-_HYPlatformGraphicPane::_HYPlatformGraphicPane(int h, int w, int d)
-{
-    Rect  bRect;
-    bRect.left = bRect.top = 0;
-    bRect.right = w;
-    bRect.bottom = h;
-
-    short errCode;
-
-    if (d>1) {
-        errCode = NewGWorld (&thePane,d,&bRect,0,GetMainDevice(),noNewDevice);
-
-        if (errCode == -108) { // no memory
-            errCode = NewGWorld (&thePane,d,&bRect,0,GetMainDevice(),noNewDevice|useTempMem);
-        }
-    } else {
-        errCode = NewGWorld (&thePane,d,&bRect,0,nil,0);
-
-        if (errCode == -108) { // no memory
-            errCode = NewGWorld (&thePane,d,&bRect,0,nil,useTempMem);
-        }
-    }
-
-    fillColor = NewPixPat();
-    //backColor = NewPixPat();
-    if (errCode||(!fillColor)) {
-        _String errMsg ("MacOS Error ");
-        errMsg = errMsg & (long)errCode &" while trying to allocate memory for GraphicPane";
-        FlagError (errMsg);
-    }
-    savedPort = nil;
-}
-
-//__________________________________________________________________
-
-_HYPlatformGraphicPane::~_HYPlatformGraphicPane(void)
-{
-    DisposeGWorld (thePane);
-    DisposePixPat (fillColor);
-    //DisposePixPat (backColor);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_SetPaneSize  (int h,int w, int d)
-{
-    DisposeGWorld (thePane);
-    Rect  bRect;
-    bRect.left = bRect.top = 0;
-    bRect.right = w;
-    bRect.bottom = h;
-    short errCode;
-    if (d>1) {
-        errCode = NewGWorld (&thePane,d,&bRect,0,GetMainDevice(),noNewDevice);
-
-        if (errCode == -108) { // no memory
-            errCode = NewGWorld (&thePane,d,&bRect,0,GetMainDevice(),noNewDevice|useTempMem);
-        }
-    } else {
-        errCode = NewGWorld (&thePane,d,&bRect,0,nil,0);
-
-        if (errCode == -108) { // no memory
-            errCode = NewGWorld (&thePane,d,&bRect,0,nil,useTempMem);
-        }
-    }
-
-    if (errCode) {
-        _String errMsg ("MacOS Error ");
-        errMsg = errMsg & (long)errCode &" while trying to allocate memory for GraphicPane";
-        FlagError (errMsg);
-    }
-}
-
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_DrawLine (_HYRect lineDesc)
-{
-    PenSize (lineDesc.width, lineDesc.width);
-    MoveTo  (lineDesc.left, lineDesc.top);
-    LineTo  (lineDesc.right,lineDesc.bottom);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_DrawHatchedLine (_HYRect lineDesc)
-{
-    PenState savePen;
-    GetPenState (&savePen);
-    if (abs(lineDesc.left-lineDesc.right)>5) {
-        PenPat (&penHatchPattern);
-    } else {
-        PenPat (&vertPenHatchPattern);
-    }
-    PenSize (lineDesc.width, lineDesc.width);
-    MoveTo  (lineDesc.left, lineDesc.top);
-    LineTo  (lineDesc.right,lineDesc.bottom);
-    SetPenState (&savePen);
-}
-
-
-//__________________________________________________________________
-void _HYPlatformGraphicPane::_DisplayText    (_String theText,int t, int l, bool dir)
-{
-    MoveTo (l,t);
-    if (!dir) {
-        _HYGraphicPane* theParent = (_HYGraphicPane*)this;
-        long            fontSize = theParent->font.size+1;
-
-        t+=fontSize;
-        for (long k = 0; k < theText.sLength; k++, t += fontSize) {
-            DrawChar (theText.sData[k]);
-            MoveTo (l, t);
-        }
-    } else {
-        DrawText (theText.sData,0,theText.sLength);
-    }
-}
-
-//__________________________________________________________________
-void _HYPlatformGraphicPane::_DisplayText    (_String& theText,_HYRect& r, char align)
-{
-    _EraseRect (r);
-    Rect    tb = HYRect2Rect (r);
-    CFStringRef cTextRef = CFStringCreateWithCString (nil, theText.sData, kCFStringEncodingMacRoman);
-    TXNTextBoxOptionsData opts;
-    opts.optionTags = kTXNSetFlushnessMask;
-    opts.flushness  = (align==HY_ALIGN_LEFT)?kATSUStartAlignment:(align==HY_ALIGN_RIGHT?kATSUEndAlignment:kATSUCenterAlignment);
-    TXNDrawCFStringTextBox (cTextRef, &tb, nil, &opts);
-    CFRelease (cTextRef);
-    //short saveTextMode = thePane->txMode;
-    //TextMode (srcOr);
-    //TETextBox(theText.sData, theText.sLength, &tb, (align==HY_ALIGN_LEFT)?0:(align==HY_ALIGN_RIGHT?-1:1));
-    //TextMode (saveTextMode);
-}
-
-//__________________________________________________________________
-void _HYPlatformGraphicPane::_DisplayChar  (char c,int t, int l)
-{
-    MoveTo (l,t);
-    DrawChar (c);
-}
-
-//__________________________________________________________________
-void _HYPlatformGraphicPane::_SlidePane  (int dv, int dh)
-{
-    _HYGraphicPane* theParent = (_HYGraphicPane*)this;
-    Rect r = {0,0,theParent->h,theParent->w};
-    RgnHandle dummy = NewRgn();
-    checkPointer (dummy);
-    ScrollRect(&r,dh,dv,dummy);
-    DisposeRgn (dummy);
-}
-
-//__________________________________________________________________
-void _HYPlatformGraphicPane::_SlideRect (_HYRect& rct, int dv, int dh)
-{
-    Rect r;
-    r.left = rct.left;
-    r.top = rct.top;
-    r.bottom = rct.bottom;
-    r.right = rct.right;
-    RgnHandle dummy = NewRgn();
-    checkPointer (dummy);
-    ScrollRect(&r,dh,dv,dummy);
-    DisposeRgn (dummy);
-}
-
-//__________________________________________________________________
-void _HYPlatformGraphicPane::_InvertRect (_HYRect& rct)
-{
-    Rect r = HYRect2Rect (rct);
-    InvertRect (&r);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_DrawRect (_HYRect rectDesc)
-{
-    PenSize (rectDesc.width, rectDesc.width);
-    Rect    r= HYRect2Rect (rectDesc);
-    FrameRect (&r);
-
-}
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_FillRect (_HYRect rectDesc)
-{
-    Rect    r= HYRect2Rect (rectDesc);
-    FillCRect (&r,fillColor);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_EraseRect (_HYRect rectDesc)
-{
-    Rect    r= HYRect2Rect (rectDesc);
-    EraseRect (&r);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_DrawOval (_HYRect rectDesc)
-{
-    PenSize (rectDesc.width, rectDesc.width);
-    Rect    r= HYRect2Rect (rectDesc);
-    FrameOval (&r);
-
-}
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_FillOval (_HYRect rectDesc)
-{
-    Rect    r= HYRect2Rect (rectDesc);
-    FillCOval (&r,fillColor);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_EraseOval (_HYRect rectDesc)
-{
-    Rect    r= HYRect2Rect (rectDesc);
-    EraseOval (&r);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_DrawArc (_HYRect rectDesc, int s, int f)
-{
-    PenSize (rectDesc.width, rectDesc.width);
-    Rect    r= HYRect2Rect (rectDesc);
-    FrameArc (&r,s,f);
-
-}
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_FillArc (_HYRect rectDesc, int s, int f)
-{
-    Rect    r= HYRect2Rect (rectDesc);
-    FillCArc (&r,s,f,fillColor);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_EraseArc (_HYRect rectDesc, int s, int f)
-{
-    Rect    r= HYRect2Rect (rectDesc);
-    EraseArc (&r,s,f);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_SetColor  (_HYColor c)
-{
-    RGBColor      sysColor;
-    sysColor.red   = c.R*256;
-    sysColor.green = c.G*256;
-    sysColor.blue  = c.B*256;
-    MakeRGBPat (fillColor,&sysColor);
-    RGBForeColor (&sysColor);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_SetBColor  (_HYColor c)
-{
-    RGBColor         sysColor;
-    sysColor.red   = c.R*256;
-    sysColor.green = c.G*256;
-    sysColor.blue  = c.B*256;
-
-    if (c.R+c.B+(long)c.G==765)
-        sysColor = (RGBColor) {
-        0xffff,0xffff,0xffff
-    };
-
-    RGBBackColor (&sysColor);
-    //MakeRGBPat (backColor,&sysColor);
-    //BackPat      (backColor);
-}
-
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_SetFont (_HYFont f)
-{
-    Str255  fontFace;
-    StringToStr255 (f.face,fontFace);
-    short fNum;
-    GetFNum (fontFace,&fNum);
-    TextFont (fNum);
-    TextSize (f.size);
-    TextFace (f.style);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_DrawPicRes (_HYRect& r, long id)
-{
-    PicHandle  aPic = GetPicture (id);
-    if (aPic) {
-        Rect        aRect = HYRect2Rect (r);
-        PictInfo    pInfo;
-        GetPictInfo (aPic,&pInfo,0,0,0,0);
-
-        if (aRect.right-aRect.left<=0) {
-            r.right = aRect.right = aRect.left + pInfo.sourceRect.right - pInfo.sourceRect.left;
-        }
-
-        if (aRect.bottom-aRect.top<=0) {
-            r.bottom = aRect.bottom = aRect.top + pInfo.sourceRect.bottom - pInfo.sourceRect.top;
-        }
-
-        DrawPicture (aPic, &aRect);
-
-        ReleaseResource ((Handle)aPic);
-    } else {
-        _String errMsg = _String ("No picture resource with ID ") & id;
-        ReportWarning (errMsg);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_SetFontSize (long s)
-{
-    TextSize (s);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_SetDialogBG (void)
-{
-    if (aquaInterfaceOn) {
-        SetThemeBackground (kThemeBrushDialogBackgroundActive, 32, true);
-    } else {
-        ((_HYGraphicPane*)this)->SetBColor         (GetDialogBackgroundColor());
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_StartDraw  (void)
-{
-    _HYGraphicPane * parent = (_HYGraphicPane*)this;
-    GetGWorld (&savedPort,&savedDevice);
-    ::GetForeColor (&saveFG);
-    ::GetBackColor (&saveBG);
-    SetGWorld (thePane,nil);
-    LockPixels (GetGWorldPixMap(thePane));
-    RGBColor c  = {256*parent->bColor.R,256*parent->bColor.G,256*parent->bColor.B};
-    if (parent->bColor.R+parent->bColor.B+(long)parent->bColor.G==765)
-        c = (RGBColor) {
-        0xffff,0xffff,0xffff
-    };
-    RGBBackColor (&c);
-    c = (RGBColor) {
-        256*parent->color.R,256*parent->color.G,256*parent->color.B
-    };
-    RGBForeColor (&c);
-    //if (parent->depth>1)
-    TextMode     (srcOr);
-    //else
-    //TextMode   (srcCopy);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_EndDraw    (void)
-{
-    UnlockPixels (GetGWorldPixMap(thePane));
-    SetGWorld    (savedPort,savedDevice);
-    RGBForeColor (&saveFG);
-    RGBBackColor (&saveBG);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_SetPort    (Ptr nP)
-{
-    thePane = (GWorldPtr)nP;
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_CopyToClipboard   (void)
-{
-    _HYGraphicPane* parent = (_HYGraphicPane*)this;
-#ifdef TARGET_API_MAC_CARBON
-    ClearCurrentScrap();
-#else
-    ZeroScrap();
-#endif
-    Rect  bRect;
-
-    bRect.left          = bRect.top = 0;
-    bRect.right         = parent->w;
-    bRect.bottom        = parent->h;
-
-    PicHandle    pic    = OpenPicture (&bRect);
-
-    GrafPtr      topPort;
-    GetPort      (&topPort);
-
-    LockPixels (GetGWorldPixMap(thePane));
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    CopyBits (GetPortBitMapForCopyBits(thePane),GetPortBitMapForCopyBits(topPort),
-              &bRect,&bRect,srcCopy,(RgnHandle)nil);
-#else
-    CopyBits ((BitMap*)*GetGWorldPixMap(thePane),
-              (BitMap*)&(topPort->portBits),&bRect,&bRect,
-              srcCopy,(RgnHandle)nil);
-#endif
-    UnlockPixels (GetGWorldPixMap(thePane));
-
-    ClosePicture ();
-    HLock   ((Handle)pic);
-
-#ifdef TARGET_API_MAC_CARBON
-    ScrapRef         theScrapRef;
-    GetCurrentScrap(&theScrapRef);
-    PutScrapFlavor(theScrapRef, 'PICT', kScrapFlavorMaskNone,GetHandleSize((Handle)pic),*pic);
-#else
-    PutScrap (GetHandleSize((Handle)pic),'PICT',*pic);
-#endif
-    KillPicture (pic);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_SavePicture   (_String prompt)
-{
-    InitializeQTExporters  ();
-    if (graphicsFormats.lLength) {
-        _String filePath;
-        long    menuChoice = SaveFileWithPopUp (filePath,
-                                                savePicPrompt,prompt,savePicAs,graphicsFormats);
-
-        if (menuChoice>=0) {
-            ComponentInstance grexc = OpenComponent ((Component)qtGrexComponents(menuChoice));
-            GraphicsExportSetInputGWorld (grexc,thePane);
-            FSSpec  fs;
-            Str255  buff;
-            StringToStr255 (filePath,buff);
-            FSMakeFSSpec(0,0,buff,&fs);
-            GraphicsExportSetOutputFile (grexc,&fs);
-            GraphicsExportRequestSettings (grexc,nil,nil);
-            unsigned long dummy;
-            OSType t,c;
-            GraphicsExportGetDefaultFileTypeAndCreator (grexc,&t,&c);
-            GraphicsExportSetOutputFileTypeAndCreator (grexc,t,c);
-            GraphicsExportDoExport (grexc,&dummy);
-            CloseComponent (grexc);
-        }
-    }
-}
-
-//__________________________________________________________________
-
-Ptr _HYPlatformGraphicPane::_DefinePolygon  (_SimpleList& points)
-{
-    if ((points.lLength>=6)&&(points.lLength%2==0)) {
-        PolyHandle   rgn = OpenPoly  ();
-        checkPointer (rgn);
-
-        MoveTo       (points.lData[0], points.lData[1]);
-
-        for (long k=2; k<points.lLength; k+=2) {
-            LineTo (points.lData[k], points.lData[k+1]);
-        }
-
-        LineTo       (points.lData[0], points.lData[1]);
-        ClosePoly    ();
-        return       (Ptr)rgn;
-
-    }
-    return nil;
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_KillPolygon   (Ptr rgn)
-{
-    if (rgn) {
-        KillPoly ((PolyHandle)rgn);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_DrawPolygon (Ptr rgn, long width)
-{
-    if (rgn) {
-        PenSize (width, width);
-        FramePoly ((PolyHandle)rgn);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_FillPolygon (Ptr rgn)
-{
-    if (rgn) {
-        FillCPoly ((PolyHandle)rgn,fillColor);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformGraphicPane::_ErasePolygon (Ptr rgn)
-{
-    if (rgn) {
-        ErasePoly ((PolyHandle)rgn);
-    }
-}
-
-
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/mac/HYPlatformUtils.cpp b/src/gui/mac/HYPlatformUtils.cpp
deleted file mode 100644
index 4f61e02..0000000
--- a/src/gui/mac/HYPlatformUtils.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "HYUtils.h"
#include "Quickdraw.h"
#include "hy_strings.h"
#include "Icons.h"
#include "Fonts.h"
#include "Dialogs.h"
#include "ColorPicker.h"
#include "HYWindow.h"
#include "errorfns.h"
#include "calcnode.h"
#include "ToolUtils.h"
#include "Navigation.h"
#include "batchlan.h"
#include "Lists.h"
#include "math.h"
#include "string.h"
#include "likefunc.h"
#include "Appearance.h"
#include "HYDialogs.h"
#include "time.h"
#include <URLAccess.h>
#include <Scrap.h>
#include "HYConsoleWindow.h"

#ifndef  TARGET_API_MAC_CARBON
#include "StandardFile.h"
#endif


void    GetFullPathName (FSSpec& theReply, _String& feedback);
void    ListToPopUpMenu (_List& menuOptions, MenuHandle listMenu);
void    SetStatusBarValue (long, _Parameter, _Parameter);

#define LIST_PUTFILE_BOX  200
#define LIST_PUTFILE_MENU 1112
#define GENERIC_POPUP_ID  1123

long    putFileMenuChoice;

extern  bool                updateTimer;

extern  time_t              timerStart,
        lastTimer;


extern  PixPatHandle        whiteFill;

extern  CIconHandle         pullDownArrowsIcon;

RGBColor
blackMenuText = {0,0,0},
grayMenuText  = {0x7fff,0x7fff,0x7fff},
menuLine1     = {0xA000,0xA000,0xA000},
menuLine2   = {0x0400,0x0400,0x0400};


extern _SimpleList windowObjects, windowPtrs;

pascal void     HYSavePopEventProc      (NavEventCallbackMessage ,NavCBRecPtr ,void * );
pascal Boolean  customModalProc         (DialogPtr , EventRecord *, short* );
void            StringToStr63           (_String& , Str63& );
pascal void     PopUpThemeDrawProc      (const Rect *,ThemeButtonKind ,const ThemeButtonDrawInfo *,UInt32 ,SInt16 ,Boolean );
MenuHandle      BuildMenuFromList       (_List& , long , bool );
OSStatus        DownloadPB              (void * , EventRecord * );

extern  _String   VerbosityLevelString;

//________________________________________________________
pascal Boolean  customModalProc (DialogPtr theDialog, EventRecord *theEvent, short* itemHit)
{
    if ((theEvent->what == activateEvt)||(theEvent->what == updateEvt)) {
        if (theEvent->message != (long)theDialog) {
            long k = windowPtrs.Find((long)theEvent->message);
            if (k>=0) {
                _HYPlatformWindow* clickedWindow = (_HYPlatformWindow*)windowObjects (k);
                clickedWindow->_ProcessOSEvent ((Ptr)theEvent);
            }
        }
    } else if ((theEvent->what == keyDown)||(theEvent->what == autoKey)) {
        unsigned char keyCode = (theEvent->message&keyCodeMask)>>8;
        if ((keyCode == 0x4C)||(keyCode == 0x24)) { // return
            *itemHit = kStdOkItemIndex;
            return true;
        }
        if ((keyCode==0x35)||((theEvent->modifiers & cmdKey)&&(keyCode==0x2F))) { // cancel
            *itemHit = kStdCancelItemIndex;
            return true;
        }
        if ((keyCode==0x2D)&&(theEvent->modifiers & cmdKey)) {
            *itemHit = 3;
            return true;
        }
    }
    return FALSE;
}

//________________________________________________________

#ifdef TARGET_API_MAC_CARBON
ModalFilterUPP   myFilterProc = NewModalFilterUPP((ModalFilterProcPtr)customModalProc);
#else
UniversalProcPtr myFilterProc = NewModalFilterUPP((ModalFilterProcPtr)customModalProc);
#endif

//________________________________________________________
void    ToggleAnalysisMenu (bool running)
{
    MenuHandle anMenu = GetMenuHandle (131);
    if (running) {
        EnableMenuItem (anMenu,1);
        EnableMenuItem (anMenu,2);
        DisableMenuItem (anMenu,6);
    } else {
        DisableMenuItem (anMenu,1);
        DisableMenuItem (anMenu,2);
        EnableMenuItem (anMenu,6);
        SetStatusBarValue (-1,1,0);
        SetStatusLine ("Idle");
    }
}

//________________________________________________________
Ptr     ProcureIconResource (long iconID)
{
    return (Ptr)GetCIcon (iconID);
}

//________________________________________________________
long    GetVisibleStringWidth (_String& s, _HYFont& f)
{
    static _String lastFont;
    static short   fontID = -1;
    if (f.face!=lastFont) {
        Str255 fName;
        StringToStr255 (f.face,fName);
        GetFNum (fName,&fontID);
        lastFont = f.face;
    }

    GrafPtr thisPort;
    GetPort (&thisPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    short   savedFace = GetPortTextFont (thisPort),
            savedSize = GetPortTextSize (thisPort);

    Style   savedStyle = GetPortTextFace (thisPort);
#else
    short   savedFace = thisPort->txFont,
            savedSize = thisPort->txSize;

    Style   savedStyle = thisPort->txFace;
#endif
    TextFont (fontID);
    TextSize (f.size);
    TextFace (f.style);
    long res = TextWidth (s.sData,0,s.sLength);
    TextFont (savedFace);
    TextSize (savedSize);
    TextFace (savedStyle);
    return res;
}

//________________________________________________________
long    GetVisibleStringWidth (_String& s)
{
    long res = TextWidth (s.sData,0,s.sLength);
    return res;
}

//________________________________________________________
long    GetMaxCharWidth (_HYFont& f)
{
    static _String lastFont;
    static short   fontID = -1;
    if (f.face!=lastFont) {
        Str255 fName;
        StringToStr255 (f.face,fName);
        GetFNum (fName,&fontID);
        lastFont = f.face;
    }
    GrafPtr thisPort;
    GetPort (&thisPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    short   savedFace = GetPortTextFont (thisPort),
            savedSize = GetPortTextSize (thisPort);

    Style   savedStyle = GetPortTextFace (thisPort);
#else
    short   savedFace = thisPort->txFont,
            savedSize = thisPort->txSize;

    Style   savedStyle = thisPort->txFace;
#endif
    TextFont (fontID);
    TextSize (f.size);
    TextFace (f.style);
    //FontInfo fi;
    //GetFontInfo (&fi);
    //long res = fi.widMax;
    long res = CharWidth ('W');
    //printf ("\n%d\n",CharWidth('W'));
    TextFont (savedFace);
    TextSize (savedSize);
    TextFace (savedStyle);
    return res;
}

//________________________________________________________
/*pascal short  saveDialogProc (short item, DialogPtr theDialog, void* theData)
{
    static Rect putFilePullDownMenu;
    _List*  menuItems = (_List*)theData;
    if (item!=sfHookFirstCall)
    {
        if (putFileMenuChoice<0)
        {
            putFileMenuChoice = 0;
            DrawMenuPlaceHolder (putFilePullDownMenu,*(_String*)(*menuItems)(putFileMenuChoice));
        }
    }
    else
    {
        short   dummy;
        Handle  dummy2;
        GetDialogItem (theDialog,14,&dummy,&dummy2,&putFilePullDownMenu);
    }
    switch (item)
    {
        case 14:
        {
            Point theCoord;
            theCoord.v = putFilePullDownMenu.top;
            theCoord.h = putFilePullDownMenu.left;
            LocalToGlobal (&theCoord);
            long newSel = PopUpMenuSelect (GetMenuHandle(LIST_PUTFILE_MENU),
                                           theCoord.v,
                                           theCoord.h,
                                           putFileMenuChoice+1);
            if (newSel&0xffff0000)
            {
                putFileMenuChoice = (newSel&0x0000ffff)-1;
                DrawMenuPlaceHolder (putFilePullDownMenu,*(_String*)(*menuItems)(putFileMenuChoice));
            }
        }

    }
    return item;
}*/

//________________________________________________________

pascal void HYSavePopEventProc (NavEventCallbackMessage callBackSelector,
                                NavCBRecPtr callBackParms,
                                void *callBackUD )
{
    if (callBackSelector==kNavCBPopupMenuSelect) {
        NavMenuItemSpec* menuItem = (NavMenuItemSpec*)callBackParms->eventData.eventDataParms.param;
        *((long*)callBackUD) = menuItem->menuType;
    } else if (callBackSelector==kNavCBEvent) {
        EventRecord* theEvent = callBackParms->eventData.eventDataParms.event;
        if ((theEvent->what == activateEvt)||(theEvent->what == updateEvt)) {
            if (theEvent->message != (long)callBackParms->window) {
                long k = windowPtrs.Find((long)theEvent->message);
                if (k>=0) {
                    _HYPlatformWindow* clickedWindow = (_HYPlatformWindow*)windowObjects (k);
                    clickedWindow->_ProcessOSEvent ((Ptr)theEvent);
                }
                //else
                //  SIOUXHandleOneEvent (theEvent);
            }
        }
    }
}

extern      Str255   hpName;
extern      _String  menuSeparator;

//________________________________________________________

long    SaveFileWithPopUp (_String& fileName, _String& prompt, _String& defFileName,
                           _String& listLabel, _List& menuOptions)
{
    OSErr               navErr;
    NavReplyRecord      navRR;
    NavDialogOptions    navDO;
#ifdef TARGET_API_MAC_CARBON
    NavEventUPP         navEF = NewNavEventUPP  (HYSavePopEventProc);
#else
    NavEventUPP         navEF = NewNavEventProc (HYSavePopEventProc);
#endif
    Handle              extensionListH = NewHandle (sizeof(NavMenuItemSpec)*menuOptions.lLength);
    checkPointer        (extensionListH);
    long                result;

    HLock (extensionListH);

    NavMenuItemSpec* extensionList = (NavMenuItemSpec*)*extensionListH;

    for (result = 0; result<menuOptions.lLength; result++) {
        extensionList[result].version = kNavMenuItemSpecVersion;
        extensionList[result].menuType = result+20;
        extensionList[result].menuCreator = 'MuSe';
        if (((_String*)menuOptions(result))->Equal(&menuSeparator)) {
            extensionList[result].menuItemName[0]=2;
            extensionList[result].menuItemName[1]='-';
            extensionList[result].menuItemName[2]='-';
        } else {
            StringToStr255 (*(_String*)menuOptions(result),extensionList[result].menuItemName);
        }
    }
    HUnlock (extensionListH);

    navDO.version       =   kNavDialogOptionsVersion;
    navDO.location      =   (Point) {
        -1,-1
    };
    navDO.dialogOptionFlags
        =   kNavDontAddTranslateItems;
    StringToStr255      (prompt,navDO.windowTitle);
    StringToStr255      (defFileName,navDO.savedFileName);
    memcpy (navDO.clientName,hpName,hpName[0]+1);
    navDO.actionButtonLabel[0]
        =   0;
    navDO.cancelButtonLabel[0]
        =   0;
    navDO.preferenceKey =   0;
    navDO.message[0]    =   0;

    if (menuOptions.lLength) {
        navDO.popupExtension=(NavMenuItemSpecHandle)extensionListH;
    } else {
        navDO.popupExtension=nil;
    }

    result              = 0;

    navErr              = NavPutFile (nil,
                                      &navRR,
                                      &navDO,
                                      navEF,
                                      nil,
                                      kNavGenericSignature,
                                      &result);


    if (navErr == noErr) {
        if (navRR.validRecord) {
            long countAED;
            if (noErr==AECountItems(&navRR.selection,&countAED)) {
                if (countAED==1) {
                    char    fileRec [2048];
                    Size    actualSize;
                    AEKeyword   keywd;
                    DescType    returnedType;
                    FSSpec*     fSR;
                    navErr= AEGetNthPtr(&navRR.selection, 1, typeFSS, &keywd,
                                        &returnedType, fileRec,
                                        sizeof(FSSpec), &actualSize);
                    if (navErr==noErr) {
                        fSR = (FSSpec*)fileRec;
                        GetFullPathName (*fSR, fileName);
                        NavDisposeReply (&navRR);
                        DisposeHandle (extensionListH);
#ifdef TARGET_API_MAC_CARBON
                        DisposeNavEventUPP (navEF);
#endif
                        return  result-20;
                    }
                }
            }
        }
        NavDisposeReply (&navRR);
    } else {
        if (navErr !=  userCanceledErr) {

            if (menuOptions.lLength) {
                _SimpleList         all,
                                    std,
                                    r;
                _List               ms;

                std << 0;
                std << 0;

                for (result = 0; result < menuOptions.lLength; result++) {
                    _String* option = (_String*)menuOptions (result);
                    _List    d (option);
                    ms && & d;
                    if (!option->Equal (&menuSeparator)) {
                        all << result;
                    }
                }

                DisposeHandle (extensionListH);
                result = HandleListSelection (ms,std,all,"Choose a file format",r,1);
                if (result>=0) {
                    result = all.lData[result];
                    _List dummy;
                    SaveFileWithPopUp (fileName,prompt,defFileName, listLabel, dummy);
                }
#ifdef TARGET_API_MAC_CARBON
                DisposeNavEventUPP (navEF);
#endif
                return result;
            } else {
                _String      errMsg ("System Error ");
                errMsg = errMsg & (long)navErr & " occured in SaveFileWithPopUp.";
                ProblemReport(errMsg);
            }
        }
    }
    DisposeHandle (extensionListH);
#ifdef TARGET_API_MAC_CARBON
    DisposeNavEventUPP (navEF);
#endif
    return -1;
}

//________________________________________________________
_HYColor        SelectAColor (_HYColor& currentColor, _String& prompt)
{
    RGBColor start, end;
    Point    center = {-1,-1};
    Str255   buffer;
    StringToStr255 (prompt,buffer);
    start.red   = currentColor.R*256;
    start.blue  = currentColor.B*256;
    start.green = currentColor.G*256;
    if (GetColor (center,buffer,&start,&end)) {
        _HYColor res;
        res.R = end.red/256;
        res.G = end.green/256;
        res.B = end.blue/256;
        return res;
    }
    return currentColor;
}


//________________________________________________________
char        YesNoCancelPrompt (_String& prompt)
{
    Str255 buffer;
    StringToStr255(prompt,buffer);
    ParamText(buffer,nil,nil,nil);
    return (Alert (132,myFilterProc));
}


//________________________________________________________
_HYRect     GetScreenDimensions (void)
{

    _HYRect   res = {0,0,0,0,0};

    /*RgnHandle dskRgn = GetGrayRgn();
    #ifdef OPAQUE_TOOLBOX_STRUCTS
        Rect      dskRect;
        GetRegionBounds(dskRgn,&dskRect);
    #else
        Rect      dskRect = (*dskRgn)->rgnBBox;
    #endif*/

    Rect      dskRect;
    GetAvailableWindowPositioningBounds(GetMainDevice(),&dskRect);

    res.right  = dskRect.right-dskRect.left;
    res.bottom = dskRect.bottom-dskRect.top;

    return res;
}

//________________________________________________________
void        CenterWindow (_HYGuiObject* g)
{
    _HYWindow* w = (_HYWindow*)g;

    if (!(w->flags & HY_WINDOW_SHEET)) {
        _HYRect   screen = GetScreenDimensions();

        long      cleft = 0, ctop = 0;

        if (screen.right>w->right) {
            cleft = (screen.right-w->right)/2;
        }
        if (screen.bottom>w->bottom) {
            ctop = (screen.bottom-w->bottom)/2;
        }

        w->_SetPosition (cleft,ctop);
    }
}

//__________________________________________________________________________________
void    StringToStr255 (_String& str, Str255& str255)
{
    long cpData = str.sLength>255?255:str.sLength;
    str255[0] = cpData;
    str255[cpData]=0;
    memcpy(str255+1, str.sData, cpData);

}

//__________________________________________________________________________________
void    StringToStr63 (_String& str, Str63& str63)
{
    long cpData = str.sLength>63?63:str.sLength;
    str63[0] = cpData;
    str63[63]=0;
    memcpy(str63+1, str.sData, cpData);

}

//__________________________________________________________________________________
void    Str255ToStr (_String& str, Str255& str255)
{
    if (str255[0] == 255) {
        str255[0]=254;
    }
    str255[str255[0]+1]=0;
    str = (char*)(str255+1);
}

//__________________________________________________________________________________

void    DrawEmbossedBox (Rect& theBox)
{
    DrawThemeListBoxFrame (&theBox,kThemeStateActive);
}

//__________________________________________________________________________________

pascal void PopUpThemeDrawProc (const Rect *bounds,ThemeButtonKind ,const ThemeButtonDrawInfo *,UInt32 userData,SInt16 ,Boolean )
{
    MoveTo (bounds->left+5, (bounds->top+bounds->bottom)/2+5);
    DrawString ((unsigned char*)userData);
}

ThemeButtonDrawUPP drawPT = NewThemeButtonDrawUPP (PopUpThemeDrawProc);

//__________________________________________________________________________________

void    DrawMenuPlaceHolder (Rect& theBox, _String& menuChoice, bool enabled)
{
    GrafPtr savedPtr;
    Style  savedFF, savedFNT, savedFS, savedMode;
    RGBColor
    savedColor;


    long   stringWidth, avWidth = theBox.right-theBox.left-24;

    GetPort (&savedPtr);
    GetForeColor (&savedColor);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    savedFNT = GetPortTextFont (savedPtr),
    savedFS  = GetPortTextSize  (savedPtr);
    savedFF  = GetPortTextFace (savedPtr);
    savedMode = GetPortTextMode (savedPtr);
#else
    savedFF = savedPtr->txFace;
    savedFNT = savedPtr->txFont;
    savedFS = savedPtr->txSize;
    savedMode = savedPtr->txMode;
#endif

    TextSize (12);
    TextFace (normal);
    TextFont (0);
    TextMode (srcOr);
    Str255          boxTitle;

    RGBColor blackC = {0,0,0};
    RGBForeColor (&blackC);

    boxTitle[0] = menuChoice.sLength>255?255:menuChoice.sLength;
    BlockMove(menuChoice.sData, boxTitle+1,boxTitle[0]);
    stringWidth = StringWidth (boxTitle);
    while (stringWidth>avWidth) {
        boxTitle[0]--;
        stringWidth = StringWidth (boxTitle);
    }

    theBox.right++;
    theBox.bottom++;
    ThemeButtonDrawInfo binfo = {enabled?kThemeStateActive:kThemeStateInactive,kThemeButtonOff,kThemeAdornmentNone};
    DrawThemeButton (&theBox,kThemePopupButton,&binfo,nil,nil,drawPT,(UInt32)boxTitle);
    //FrameRoundRect (&theBox,6,6);
    theBox.right--;
    theBox.bottom--;
    TextFace (savedFF);
    TextFont (savedFNT);
    TextSize (savedFS);
    TextMode (savedMode);
    RGBForeColor(&savedColor);

}

//__________________________________________________________________________________

void    ListToPopUpMenu (_List& menuOptions, MenuHandle listMenu)
{
    Str255 buffer;
    for (long counter=0; counter<menuOptions.lLength; counter++) {
        _String *postItem = (_String*)(menuOptions(counter));
        if (*postItem==_String("SEPARATOR")) {
            AppendMenu (listMenu,"\p(-");
        } else {
            StringToStr255 (*postItem,buffer);
            AppendMenu (listMenu,buffer);
        }
    }
}

//__________________________________________________________________________________

_String HandlePullDown (_List& menuOptions, long l, long t,long startPos)
{
    if (menuOptions.lLength) {
        MenuHandle listMenu = NewMenu (GENERIC_POPUP_ID,"\p");
        ListToPopUpMenu (menuOptions, listMenu);
        InsertMenu(listMenu,hierMenu);

        long    res = PopUpMenuSelect (listMenu,t,l,startPos);
        DeleteMenu (GENERIC_POPUP_ID);
        DisposeMenu(listMenu);

        if (HiWord(res)) {
            return *(_String*)menuOptions (LoWord(res)-1);
        }
    }

    return empty;
}

//__________________________________________________________________________________

long HandlePullDownWithFont (_List& menuOptions, long l, long t,long startPos,_String fName,long fSize)
{
    MenuHandle listMenu = NewMenu (GENERIC_POPUP_ID,"\p");
    ListToPopUpMenu (menuOptions, listMenu);
    short  fontID;
    Str255 fName255;
    StringToStr255 (fName,fName255);
    GetFNum (fName255,&fontID);
    SetMenuFont     (listMenu,fontID,fSize);
    InsertMenu(listMenu,hierMenu);

    if ((startPos<1)||(startPos>menuOptions.lLength)) {
        startPos = 1;
    } else {
        SetItemMark (listMenu,startPos,0xA5);
    }
    long    res = PopUpMenuSelect (listMenu,t,l,startPos);
    DeleteMenu (GENERIC_POPUP_ID);
    DisposeMenu(listMenu);

    if (HiWord(res)) {
        return LoWord(res)-1;
    }
    return -1;

}
//__________________________________________________________________________________
char    ScanDirectoryForFileNames (_String& source, _List& rec, bool recurse)
{
    CInfoPBRec  fileRec;
    Str255 buffer;
    StringToStr255 (source,buffer);
    DirInfo*    dInfo = (DirInfo*)&fileRec;
    HFileInfo*  fInfo = (HFileInfo*)&fileRec;

    dInfo->ioNamePtr = buffer;
    dInfo->ioVRefNum = 0;
    dInfo->ioFDirIndex = 0;
    dInfo->ioDrDirID = 0;
    long  errCode;
    if ((errCode=PBGetCatInfo (&fileRec,false))==noErr)
        /* source directory exists */
    {
        long   counter = 1;
        dInfo->ioFDirIndex = 1;
        long   saveDirID = dInfo->ioDrDirID;
        while ((errCode=PBGetCatInfo (&fileRec,false))==noErr)
            /* index thru the items */
        {
            _String childDir ((unsigned long)dInfo->ioNamePtr[0],true);
            for (long k=1; k<=dInfo->ioNamePtr[0]; k++) {
                childDir << dInfo->ioNamePtr[k];
            }
            childDir.Finalize();
            if (childDir.sData[0] != '.') { // invisible file
                childDir = source & ':' & childDir;
                if (dInfo->ioFlAttrib&0x10)
                    // a directory
                {
                    if (recurse&&(!(dInfo->ioDrUsrWds.frFlags&fInvisible))) {
                        ScanDirectoryForFileNames (childDir,rec,true);
                    }
                } else if (!(fInfo->ioFlFndrInfo.fdFlags&fInvisible)) {
                    rec && & childDir;
                }
            }
            dInfo->ioDrDirID = saveDirID;
            dInfo->ioFDirIndex = ++counter;
        }
    }
    return ':';
}


//_________________________________________________________________________

void    SetWindowFont (short fID, short fSize, Style fStyle, bool onOff)
{
    static short sID, sSize;
    static short sStyle;

    if (onOff) {
        GrafPtr thisPort;
        GetPort (&thisPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        sID = GetPortTextFont (thisPort),
        sSize  = GetPortTextSize    (thisPort);
        sStyle = GetPortTextFace (thisPort);
#else
        sID = thisPort->txFont;
        sSize = thisPort->txSize;
        sStyle = thisPort->txFace;
#endif
        TextFont (fID);
        TextSize (fSize);
        TextFace (fStyle);
    } else {
        TextFont (sID);
        TextSize (sSize);
        TextFace (sStyle);
    }

}

//_________________________________________________________________________

void    GenerateFontList (_List& fonts)
{
    fonts.Clear();
    MenuHandle fts = NewMenu (11111,"\p");
    AppendResMenu (fts,'FONT');
    {
        long icount = CountMenuItems(fts);
        for (long k=0; k<icount; k++) {
            Str255 mItem;
            GetMenuItemText (fts,k+1,mItem);
            _String fontName;
            Str255ToStr (fontName,mItem);
            fonts && & fontName;
        }
    }
    DisposeMenu (fts);
}

//_________________________________________________________________________
_HYColor    GetDialogBackgroundColor (void)
{
    RGBColor    bgc = {0xffff,0xffff,0xffff};
    GetThemeBrushAsColor (kThemeBrushDialogBackgroundActive,24,true,&bgc);

    _HYColor    res = {bgc.red/256,bgc.green/256,bgc.blue/256};
    return      res;
}

//_________________________________________________________________________
void    DelayNMs (long ms)
{
    unsigned long ticks,
             ftick;

    ticks = ms/16.66666667;
    Delay (ticks, &ftick);
}

//_________________________________________________________________________
void    PositionWindow          (_HYGuiObject* twp, _String* args)
{
    _List * argL = args->Tokenize (",");
    _HYWindow*   tw = (_HYWindow*)twp;
    if (argL->lLength>=4) {
        long R[5],
             k;

        for (k=0; k<4; k++) {
            R[k] = ((_String*)(*argL)(k))->toNum();
        }
        if (argL->lLength>4) {
            R[4] = ((_String*)(*argL)(4))->toNum();
        } else {
            R[4] = 0;
        }

        _HYRect   wR = GetScreenDimensions  (),
                  wiR;
        long      W[4] = {wR.left,wR.top, wR.right, wR.bottom};
        for (k=0; k<4; k++)
            if (R[k]<0) {
                R[k] = W[k] + ((k<2)?-1:1)*R[k];
            }

        wiR.left    = R[0];
        wiR.right   = R[2];
        wiR.top     = R[1];
        wiR.bottom  = R[3];

        if (wiR.left>=wiR.right) {
            wiR.right = 1+wiR.left;
        }
        if (wiR.top>=wiR.bottom) {
            wiR.bottom = 1+wiR.top;
        }

        tw->SetPosition        (wiR.left,wiR.top);
        tw->SetWindowRectangle (0,0,wiR.bottom-wiR.top,wiR.right-wiR.left);

        if (R[4]>0) {
            wiR.top         = wiR.bottom+2;
            wiR.bottom      = wR.bottom - 2;
            wiR.left        = 5;
            wiR.right       = wR.right - 2;
            MoveConsoleWindow (wiR);
        }

    }

    DeleteObject (argL);
}

//________________________________________________________

MenuHandle      BuildMenuFromList (_List& menuItems, long menuID, bool )
{
    MenuHandle itemPopUpMenu = NewMenu (menuID, "\p");
    checkPointer ((Ptr)itemPopUpMenu);
    Str255          menuBuffer;
    for (long counter = 0; counter < menuItems.lLength; counter++) {
        if (menuSeparator.Equal((_String*)menuItems.lData[counter])) {
            InsertMenuItem (itemPopUpMenu,"\p(-;",0x6FFF);
        } else {
            StringToStr255 (*((_String*)menuItems.lData[counter]), menuBuffer);
            InsertMenuItem (itemPopUpMenu,menuBuffer,0x6FFF);
        }
    }
    InsertMenu (itemPopUpMenu,hierMenu);
    return itemPopUpMenu;
}

//________________________________________________________

void    UpdateStatusLine(Ptr pW)
{
    WindowPtr  theWindow = (WindowPtr)pW;
    _Parameter verbLevel;
    checkParameter (VerbosityLevelString, verbLevel, 0.0);
    if (verbLevel>=-0.5) {
#ifdef TARGET_API_MAC_CARBON
        if (aquaInterfaceOn) {
            Rect wr,
                 box;
            GetWindowBounds (theWindow, kWindowGlobalPortRgn, &wr);
            OffsetRect (&wr,-wr.left,-wr.top);
            SetRect(&box,0,wr.bottom-15,wr.right - 15,wr.bottom);
            RgnHandle   dirtyRgn = NewRgn ();
            checkPointer (dirtyRgn);
            RectRgn (dirtyRgn, &box);
            QDFlushPortBuffer (GetWindowPort (theWindow), nil);
            DisposeRgn (dirtyRgn);
        }
#endif
    }
}

//________________________________________________________

OSStatus DownloadPB (void * , EventRecord * )
{
    // place holder
    return noErr;
}

//________________________________________________________

bool    Get_a_URL   (_String& urls, _String* fileName)
{
    URLReference    url;
    OSStatus        errCode;


    if ((errCode=URLNewReference (urls.sData, &url)) == noErr) {
        //URLSystemEventUPP gMySystemEventUPP = NewURLSystemEventUPP((URLSystemEventProcPtr)DownloadPB);
        if (fileName == nil) {
            Handle   h = NewHandle (0);

            errCode = URLDownload (url, nil, h,  kURLDisplayProgressFlag | kURLDisplayAuthFlag, nil, nil);

            if (errCode == noErr) {
                long    downloadSize = GetHandleSize(h);
                SetHandleSize(h, (downloadSize+1));
                HLock (h);
                (*h)[downloadSize] = 0;
                urls = (char*)(*h);
                URLDisposeReference (url);
                DisposeHandle (h);
                HUnlock (h);
                //DisposeURLSystemEventUPP(gMySystemEventUPP);
                return true;
            }
        } else {
            long    f = fileName->FindBackwards (":",0,-1);

            _String dirName  = fileName->Cut(0,f-1),
                    fName    = fileName->Cut(f+1,-1);


            if ((f<0 && dirName.sLength==0) || fName.sLength==0) {
                urls = "Invalid file specification";
                //DisposeURLSystemEventUPP(gMySystemEventUPP);
                return false;
            }

            Str255          buffer;
            StringToStr255 (dirName,buffer);
            CInfoPBRec      hfp;

            hfp.dirInfo.ioNamePtr       = buffer;
            hfp.dirInfo.ioVRefNum       = 0;
            hfp.dirInfo.ioFDirIndex     = 0;
            hfp.dirInfo.ioDrDirID       = 0;
            
            union {
                char bytes[4];
                OSType theType;
                
            } ostypeconvertor;
            
            ostypeconvertor.bytes[0] = '?';
            ostypeconvertor.bytes[1] = '?';
            ostypeconvertor.bytes[2] = '?';
            ostypeconvertor.bytes[3] = '?';

            if ((errCode=PBGetCatInfo (&hfp,false))==noErr) {
                FSSpec      fspec;
                StringToStr63 (fName,fspec.name);
                fspec.vRefNum = hfp.dirInfo.ioVRefNum;
                fspec.parID   = hfp.dirInfo.ioDrDirID;

                if (errCode == noErr) {
                    errCode = URLDownload (url, &fspec, nil, kURLReplaceExistingFlag |kURLDisplayProgressFlag | kURLDisplayAuthFlag, nil, nil);
                    if (errCode == noErr) {
                        hfp.hFileInfo.ioFlFndrInfo.fdCreator = ostypeconvertor.theType;
                        hfp.hFileInfo.ioFlFndrInfo.fdType    = ostypeconvertor.theType;
                        errCode = PBSetCatInfo (&hfp,false);
                        if (errCode == noErr)
                            //DisposeURLSystemEventUPP(gMySystemEventUPP);
                        {
                            return true;
                        }
                    }
                }
            }
        }
        //DisposeURLSystemEventUPP(gMySystemEventUPP);
    }
    switch (errCode) {
    case kETIMEDOUTErr:
        urls = "Connection timed out";
        break;
    case kECONNREFUSEDErr:
        urls = "Connection refused";
        break;
    case kEHOSTDOWNErr:
        urls = "Host down";
        break;
    case kEHOSTUNREACHErr:
        urls = "No route to host";
        break;
    case kURLInvalidURLError:
        urls = "The format of the URL is invalid";
        break;
    case kURLUnsupportedSchemeError:
        urls = "The transfer protocol is not supported";
        break;
    case kURLServerBusyError :
        urls = "Failed data transfer operation";
        break;
    default:
        urls = _String ("System error:") & (long)errCode;
    }

    return false;
}

//________________________________________________________

void    StartBarTimer(void)
{
    lastTimer   = time (&timerStart);
    updateTimer = true;
}

//________________________________________________________

void    StopBarTimer(void)
{
    updateTimer = false;
}

//_________________________________________________________________________

void    MoveConsoleWindow (_HYRect& newLoc)
{
    if (newLoc.right&&newLoc.bottom) {
        hyphyConsoleWindow->SetPosition         (newLoc.left, newLoc.top);
        hyphyConsoleWindow->SetWindowRectangle  (newLoc.top,newLoc.left,newLoc.bottom,newLoc.right,true);
    }
}


//__________________________________________________________________________________
void    PlaceStringInClipboard (_String& res,Ptr )
{
#ifdef TARGET_API_MAC_CARBON
    ClearCurrentScrap();
    ScrapRef         theScrapRef;
    GetCurrentScrap(&theScrapRef);
    PutScrapFlavor(theScrapRef, 'TEXT', kScrapFlavorMaskNone,res.sLength,res.sData);
#else
    ZeroScrap();
    PutScrap (res.sLength,'TEXT',res.sData);
#endif
}
\ No newline at end of file
diff --git a/src/gui/mac/HYPlatformWindow.cpp b/src/gui/mac/HYPlatformWindow.cpp
deleted file mode 100644
index b19cfb2..0000000
--- a/src/gui/mac/HYPlatformWindow.cpp
+++ /dev/null
@@ -1,1118 +0,0 @@
-/*
-    A Mac OS window object - a window/title/size-box/scroll-bars handler.
-
-    Sergei L. Kosakovsky Pond, Spring 2000 - Fall 2001.
-*/
-
-#include "HYWindow.h"
-#include "HYGWindow.h"
-#include "HYEventTypes.h"
-#include "HYConsoleWindow.h"
-#include "Controls.h"
-#include "ControlDefinitions.h"
-#include "HYTableWindow.h"
-#include "HYUtils.h"
-#include "Scrap.h"
-
-//__________________________________________________________________
-extern      _SimpleList windowPtrs,
-            windowObjects;
-
-extern      _String     objectInspectorTitle;
-
-long                    smallScrollStep = 5,
-                        scrollStepCounter = 0,
-                        lastScrollControlValue = 0;
-
-_HYGuiObject*           scrollingWindow;
-bool                    hScrollingAction = false;
-
-
-pascal      void        scrollAction                    (ControlHandle,ControlPartCode);
-
-
-#ifdef TARGET_API_MAC_CARBON
-extern  ModalFilterUPP   myFilterProc;
-#else
-extern  UniversalProcPtr myFilterProc;
-#endif
-
-Point                    lastScrollPoint;
-
-
-
-//__________________________________________________________________
-pascal void  scrollAction (ControlHandle theControl,ControlPartCode ctlPart)
-{
-    long   cv  = GetControl32BitValue (theControl),
-           cv2 = cv;
-
-    scrollStepCounter++;
-
-    switch (ctlPart) {
-    case kControlDownButtonPart:
-        HiliteControl (theControl,kControlDownButtonPart);
-        cv2 = cv+smallScrollStep;
-        if (scrollStepCounter>100) {
-            cv2 += 99*smallScrollStep;
-        } else if (scrollStepCounter>10) {
-            cv2 += 9*smallScrollStep;
-        }
-        if (cv2>MAX_CONTROL_VALUE) {
-            cv2 = MAX_CONTROL_VALUE;
-        }
-        break;
-    case kControlUpButtonPart:
-        HiliteControl (theControl,kControlUpButtonPart);
-        cv2 = cv-smallScrollStep;
-        if (scrollStepCounter>100) {
-            cv2 -= 99*smallScrollStep;
-        } else if (scrollStepCounter>10) {
-            cv2 -= 9*smallScrollStep;
-        }
-        if (cv2<0) {
-            cv2 = 0;
-        }
-        break;
-    case kControlPageUpPart:
-        HiliteControl (theControl,kControlPageUpPart);
-        cv2 = cv-100*smallScrollStep;
-        if (cv2<0) {
-            cv2 = 0;
-        }
-        break;
-    case kControlPageDownPart:
-        HiliteControl (theControl,kControlPageDownPart);
-        cv2 = cv+100*smallScrollStep;
-        if (cv2>MAX_CONTROL_VALUE) {
-            cv2 = MAX_CONTROL_VALUE;
-        }
-        break;
-    default:
-        cv2 = cv;
-        cv  = lastScrollControlValue;
-        break;
-    }
-
-    if (cv!=cv2) {
-        SetControl32BitValue (theControl,cv2);
-        if (hScrollingAction) {
-            scrollingWindow->ProcessEvent (generateScrollEvent (cv2-cv,0));
-        } else {
-            scrollingWindow->ProcessEvent (generateScrollEvent (0,cv2-cv));
-        }
-    }
-
-    lastScrollControlValue = GetControl32BitValue (theControl);
-}
-
-#ifdef TARGET_API_MAC_CARBON
-
-
-//__________________________________________________________________
-
-pascal OSStatus wSizeHandler (EventHandlerCallRef, EventRef theEvent, void* userData)
-{
-
-    EventParamType  actType;
-    UInt32          attr = 0;
-    GetEventParameter (theEvent, kEventParamAttributes, typeUInt32, &actType,sizeof(UInt32),nil,&attr);
-
-    if (attr&kWindowBoundsChangeSizeChanged) {
-        Rect       newSize;
-        GetEventParameter (theEvent, kEventParamCurrentBounds, typeQDRectangle, &actType,sizeof(Rect),nil,&newSize);
-
-        _HYWindow* thisWindow = (_HYWindow*)windowObjectRefs(windowPtrs.Find((long)userData));
-        forceUpdateForScrolling = true;
-        //printf ("%d %d %d %d\n", newSize.top,newSize.left,newSize.bottom+1,newSize.right+1);
-        thisWindow->SetWindowRectangle (newSize.top,newSize.left,newSize.bottom+1,newSize.right+1,false);
-        thisWindow->Update(nil);
-        forceUpdateForScrolling = false;
-        return noErr;
-    }
-
-    return eventNotHandledErr;
-}
-
-
-#endif
-
-
-
-//__________________________________________________________________
-void        _PaintTheCircle (CIconHandle c, WindowPtr theWindow)
-{
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    Rect r;
-    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&r);
-    OffsetRect (&r,-r.left,-r.top);
-#else
-    Rect r = theWindow->portRect;
-#endif
-    r.right = r.left+15;
-    r.left  += 3;
-    r.bottom --;
-    r.top = r.bottom-12;
-    PlotCIcon (&r,c);
-}
-
-//__________________________________________________________________
-
-_HYPlatformWindow::_HYPlatformWindow(unsigned char windowFlag,_String windowTitle,bool windowVisibility, Ptr cRef)
-{
-    Rect defRect = {(50+25*windowObjects.lLength)%500,(50+25*windowObjects.lLength)%400,300,350};
-    Str255 theTitle;
-    StringToStr255 (windowTitle,theTitle);
-    long   proc;
-    sheet1st = true;
-    if (cRef) {
-        if (aquaInterfaceOn) {
-            if (IsWindowVisible(((_HYWindow*)cRef)->theWindow)) {
-                containerRef = cRef;
-            } else {
-                containerRef = nil;
-            }
-        } else {
-            windowFlag -= HY_WINDOW_SHEET;
-            windowFlag += HY_WINDOW_DLOG;
-            containerRef = nil;
-        }
-    } else {
-        containerRef = nil;
-    }
-
-#ifdef TARGET_API_MAC_CARBON
-    if (windowFlag&HY_WINDOW_SHEET) {
-        proc = kWindowSheetProc;
-    } else
-#endif
-        if (windowFlag&HY_WINDOW_SIZE) {
-            if (windowFlag&HY_WINDOW_ZOOM) {
-                proc = zoomDocProc;
-            } else if (windowFlag & HY_WINDOW_FLUSHED)
-#ifdef TARGET_API_MAC_CARBON
-                if (aquaInterfaceOn) {
-                    proc =  zoomDocProc;
-                } else {
-                    proc =  kWindowFloatGrowProc;
-                }
-#else
-                proc =  kWindowFloatGrowProc;
-#endif
-            else {
-                proc = documentProc;
-            }
-        } else {
-            if (windowFlag & HY_WINDOW_DLOG) {
-                proc =  kWindowMovableModalDialogProc;
-            } else {
-                proc = noGrowDocProc;
-            }
-        }
-
-    savedLoc = defRect;
-
-    flags = windowFlag;
-
-    if (windowFlag & HY_WINDOW_DLOG) {
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-        DialogPtr temp = NewColorDialog (nil,&defRect,theTitle,windowVisibility,
-                                         proc,(WindowPtr)-1,
-                                         windowFlag&HY_WINDOW_CLOSE ,0, nil);
-        if (temp) {
-            theWindow = GetDialogWindow (temp);
-        } else {
-            theWindow = nil;
-        }
-#else
-        theWindow = NewColorDialog (nil,&defRect,theTitle,windowVisibility,
-                                    proc,(WindowPtr)-1,
-                                    windowFlag&HY_WINDOW_CLOSE ,0, nil);
-#endif
-        if (theWindow) {
-            GrafPtr savePort;
-            GetPort (&savePort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-            SetPort (GetWindowPort(theWindow));
-#else
-            SetPort (theWindow);
-#endif
-            SetThemeWindowBackground (theWindow,kThemeBrushDialogBackgroundActive,false);
-            SetPort (savePort);
-        }
-    } else {
-#ifdef TARGET_API_MAC_CARBON
-        if (cRef) {
-            CreateNewWindow (kSheetWindowClass, kWindowNoAttributes,
-                             &defRect, &theWindow);
-            //if (theWindow)
-            //theWindow = GetDialogWindow (theWindow);
-            if (theWindow) {
-                GrafPtr savePort;
-                GetPort (&savePort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-                SetPort (GetWindowPort(theWindow));
-#else
-                SetPort (theWindow);
-#endif
-                SetThemeWindowBackground (theWindow,kThemeBrushDialogBackgroundActive,false);
-                SetPort (savePort);
-            }
-        } else
-#endif
-            theWindow = NewCWindow (nil,&defRect,theTitle,windowVisibility,
-                                    proc,(WindowPtr)-1,
-                                    windowFlag&HY_WINDOW_CLOSE ,0);
-    }
-
-    if (theWindow) {
-        if ((windowFlag&HY_WINDOW_SCROLL)&&(windowFlag&HY_WINDOW_SIZE)) {
-            Rect cSize = newHRect();
-            hScroll = NewControl (theWindow,&cSize,"\p",true,0,0,MAX_CONTROL_VALUE,kControlScrollBarLiveProc,0);
-            cSize = newVRect();
-            vScroll = NewControl (theWindow,&cSize,"\p",true,0,0,MAX_CONTROL_VALUE,kControlScrollBarLiveProc,0);
-            if (!(hScroll&&vScroll)) {
-                theWindow = nil;
-            } else {
-                SetControl32BitMinimum (hScroll,0);
-                SetControl32BitMaximum (hScroll,MAX_CONTROL_VALUE);
-                SetControl32BitMinimum (vScroll,0);
-                SetControl32BitMaximum (vScroll,MAX_CONTROL_VALUE);
-            }
-        } else {
-            hScroll = vScroll = nil;
-            windowFlag &= 123;
-        }
-    }
-    if (!theWindow) {
-        _String errMsg = "Could not allocate memory for a window structure";
-        FlagError (errMsg);
-    }
-    windowPtrs<<(long)theWindow;
-    windowObjects<<(long)this;
-
-    if (((flags&HY_WINDOW_NOLIST)||(flags&HY_WINDOW_DLOG)||(flags&HY_WINDOW_SHEET))==0) {
-        MenuHandle wMenu = GetMenuHandle(132);
-        AppendMenu (wMenu,"\pa");
-        if (theTitle[0]>250) {
-            theTitle[0] = 250;
-        }
-
-        SetMenuItemText (wMenu, CountMenuItems(wMenu), theTitle);
-    }
-
-#ifdef TARGET_API_MAC_CARBON
-    if (windowFlag&HY_WINDOW_SIZE) {
-        ChangeWindowAttributes (theWindow,kWindowLiveResizeAttribute, kWindowNoAttributes);
-        sizeHandler = NewEventHandlerUPP ((EventHandlerProcPtr)wSizeHandler);
-        checkPointer  ((Ptr)sizeHandler);
-        EventTypeSpec windowSizeEvent;
-        windowSizeEvent.eventClass= kEventClassWindow;
-        windowSizeEvent.eventKind = kEventWindowBoundsChanged;
-        InstallWindowEventHandler (theWindow,sizeHandler,1,&windowSizeEvent,(Ptr)theWindow,NULL);
-    } else {
-        sizeHandler = nil;
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-_HYPlatformWindow::~_HYPlatformWindow(void)
-{
-    if (hScroll) {
-        DisposeControl (hScroll);
-    }
-    if (vScroll) {
-        DisposeControl (vScroll);
-    }
-    if (theWindow) {
-#ifdef TARGET_API_MAC_CARBON
-        if (containerRef) {
-            HideSheetWindow (theWindow);
-        }
-#endif
-        if (flags&HY_WINDOW_DLOG)
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-            DisposeDialog (GetDialogFromWindow(theWindow));
-#else
-            DisposeDialog (theWindow);
-#endif
-        else {
-            DisposeWindow (theWindow);
-        }
-    }
-
-#ifdef TARGET_API_MAC_CARBON
-    if (sizeHandler) {
-        DisposeEventHandlerUPP (sizeHandler);
-    }
-#endif
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SetTitle(_String windowTitle)
-{
-    Str255 theTitle;
-    StringToStr255 (windowTitle,theTitle);
-    SetWTitle (theWindow,theTitle);
-    long f = windowPtrs.Find((long)theWindow);
-    if (f>=0) {
-        long f2 = FindWindowByName (objectInspectorTitle);
-        if((f2>=0)&&(f>=f2)) {
-            f--;
-        }
-        SetMenuItemText (GetMenuHandle(132),f+6,theTitle);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Show(void)
-{
-#ifdef TARGET_API_MAC_CARBON
-    if (containerRef&&sheet1st) {
-        ShowSheetWindow (theWindow, ((_HYWindow*)containerRef)->theWindow);
-        sheet1st = false;
-    } else
-#endif
-
-        ShowHide (theWindow,true);
-}
-
-//__________________________________________________________________
-
-_HYRect _HYPlatformWindow::_GetWindowRect(void)
-{
-    _HYRect res;
-
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    Rect    wr;
-    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&wr);
-#else
-    Rect    wr = (*((WindowPeek)theWindow)->contRgn)->rgnBBox;
-#endif
-
-    res.left    = wr.left;
-    res.top     = wr.top;
-
-    res.right     = wr.right;
-    res.bottom    = wr.bottom;
-
-    res.width     = 0;
-
-    return res;
-}
-
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Hide(void)
-{
-    ShowHide (theWindow,false);
-}
-
-//__________________________________________________________________
-
-long _HYPlatformWindow::_Grow(Ptr theData)
-{
-    EventRecord* theEvent = (EventRecord*)theData;
-    Rect         sizeRect;
-    sizeRect.top = 50;
-    sizeRect.left = 50;
-    _HYWindow* theParent = (_HYWindow*)this;
-    sizeRect.bottom = theParent->contentHeight+15;
-    sizeRect.right  = theParent->contentWidth+15;
-
-    return       GrowWindow  (theWindow,theEvent->where,&sizeRect);
-
-}
-
-//__________________________________________________________________
-
-_String& _HYPlatformWindow::_GetTitle(void)
-{
-    return      ((_HYWindow*)this)->GetTitle();
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Move(Ptr theData)
-{
-    EventRecord* theEvent = (EventRecord*)theData;
-    Rect         allOfIt = {0,0,0x7fff,0x7fff};
-    DragWindow  (theWindow,theEvent->where,&allOfIt);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SetPosition(int l,int t)
-{
-    MoveWindow (theWindow,l,t,false);
-    long deltah = savedLoc.left-l,
-         deltav = savedLoc.top-t;
-    savedLoc.left = l;
-    savedLoc.right -= deltah;
-    savedLoc.top = t;
-    savedLoc.bottom -= deltav;
-}
-
-//__________________________________________________________________
-
-bool _HYPlatformWindow::_Close(Ptr theData)
-{
-    _HYWindow* theParent = (_HYWindow*)this;
-    bool        doit = true;
-
-    if (theData) {
-        EventRecord* theEvent = (EventRecord*)theData;
-        doit = theData?TrackGoAway  (theWindow,theEvent->where):true;
-    }
-    if (doit) {
-        if (theParent->ConfirmClose()) {
-            long f = windowObjects.Find((long)this);
-            if (f>=0) {
-                windowObjects.Delete(f);
-                windowPtrs.Delete(f);
-                windowObjectRefs.Delete(f);
-                if ((flags&HY_WINDOW_NOLIST)==0) {
-                    MenuHandle  windowM = GetMenuHandle(132);
-                    long k = CountMenuItems(windowM);
-                    for (; k>=6; k--) {
-                        Str255 buffer;
-                        _String conv;
-                        GetMenuItemText (windowM,k,buffer);
-                        Str255ToStr (conv,buffer);
-
-                        _String * myTitle = &theParent->GetTitle();
-                        if (conv.Equal (myTitle)) {
-                            DeleteMenuItem (windowM,k);
-                            break;
-                        }
-                    }
-                }
-            }
-            //theWindow = nil;
-            if (FrontWindow() == theWindow) {
-                _UnsetMenuBar ();
-            }
-        } else {
-            doit = false;
-        }
-    }
-    return doit;
-}
-
-//__________________________________________________________________
-
-void _Close2(Ptr p)
-{
-    WindowPtr theWindow = (WindowPtr)p;
-#ifdef TARGET_API_MAC_CARBON
-    DisposeWindow (theWindow);
-#else
-    CloseWindow (theWindow);
-#endif
-}
-//__________________________________________________________________
-void _HYPlatformWindow::drawGrowIcon (void)
-{
-    GrafPtr savedPort;
-    GetPort(&savedPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    SetPort(GetWindowPort(theWindow));
-#else
-    SetPort(theWindow);
-#endif
-    RgnHandle   oldClip;
-    oldClip = NewRgn();
-    Rect r = newSRect();
-    GetClip (oldClip);
-    ClipRect (&r);
-    DrawGrowIcon (theWindow);
-    SetClip (oldClip);
-    DisposeRgn (oldClip);
-    SetPort(savedPort);
-}
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Activate(void)
-{
-    //_String    deAC = _String("Activate ") & (long)((_HYWindow*)this)->GetID() & '\n';
-    //StringToConsole (deAC);
-#ifdef TARGET_API_MAC_CARBON
-    if (containerRef&&sheet1st) {
-        sheet1st = false;
-        ShowSheetWindow (theWindow, ((_HYWindow*)containerRef)->theWindow);
-    }
-
-    else
-#endif
-    {
-        ShowWindow   (theWindow);
-        SelectWindow (theWindow);
-        _SetMenuBar();
-    }
-
-    if (flags&HY_WINDOW_SIZE) {
-        drawGrowIcon();
-    }
-    if (hScroll) {
-        ShowControl (hScroll);
-        ShowControl (vScroll);
-        _HYWindow* theParent = (_HYWindow*)this;
-        int     windowW = theParent->right-theParent->left-13,
-                windowH =  theParent->bottom-theParent->top-13;
-        if (theParent->contentWidth>windowW) {
-            HiliteControl (hScroll,0);
-        }
-        if (theParent->contentHeight>windowH) {
-            HiliteControl (vScroll,0);
-        }
-        DrawControls(theWindow);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_BringWindowToFront(void)
-{
-#ifdef TARGET_API_MAC_CARBON
-    if (containerRef&&sheet1st) {
-        ShowSheetWindow (theWindow, ((_HYWindow*)containerRef)->theWindow);
-        sheet1st = false;
-    }
-
-    else
-#endif
-    {
-        ShowWindow   (theWindow);
-        SelectWindow (theWindow);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Deactivate(void)
-{
-    if (!(flags&HY_WINDOW_SHEET)) {
-
-        //_String    deAC = _String("Deactivate ") & (long)((_HYWindow*)this)->GetID() & '\n';
-        //StringToConsole (deAC);
-        if (flags&HY_WINDOW_SIZE) {
-            drawGrowIcon ();
-        }
-        if (hScroll) {
-            HiliteControl (hScroll, kControlInactivePart);
-            HiliteControl (vScroll, kControlInactivePart);
-            DrawControls(theWindow);
-        }
-        _UnsetMenuBar();
-#ifdef TARGET_API_MAC_CARBON
-        Cursor arrow;
-        SetCursor(GetQDGlobalsArrow(&arrow));
-#else
-        SetCursor (&qd.arrow);
-#endif
-    }
-}
-
-
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SetMenuBar(void)
-{
-    //_String mOut = _String("_SetMenuBar in ") & (long)((_HYWindow*)this)->GetID() & "\n";
-    //StringToConsole (mOut);
-    if (flags& HY_WINDOW_DLOG) {
-        for (long j = 129; j<133; j++) {
-            MenuHandle mh = GetMenuHandle (j);
-            DisableMenuItem (mh,0);
-        }
-    } else {
-        MenuHandle  t = GetMenuHandle (130);
-        DisableMenuItem (t,1);
-        DisableMenuItem (t,3);
-        DisableMenuItem (t,4);
-        DisableMenuItem (t,5);
-        DisableMenuItem (t,6);
-        DisableMenuItem (t,8);
-        DisableMenuItem (t,9);
-
-        EnableMenuItem  (GetMenuHandle (129),5);
-        _HYWindow* theParent = (_HYWindow*)this;
-        if (!theParent->IsSaveEnabled()) {
-            DisableMenuItem (GetMenuHandle (129),4);
-        }
-        if (!theParent->IsPrintEnabled()) {
-            DisableMenuItem (GetMenuHandle (129),8);
-        }
-    }
-
-    InvalMenuBar();
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_UnsetMenuBar(void)
-{
-    //_String mOut = _String("_UnsetMenuBar in ") & (long)((_HYWindow*)this)->GetID() & "\n";
-    //StringToConsole (mOut);
-    if (flags& HY_WINDOW_DLOG) {
-        for (long j = 129; j<133; j++) {
-            MenuHandle mh = GetMenuHandle (j);
-            EnableMenuItem (mh,0);
-        }
-    } else {
-        MenuHandle  t = GetMenuHandle (129);
-        EnableMenuItem (t,1);
-        EnableMenuItem (t,2);
-        EnableMenuItem (t,4);
-        EnableMenuItem (t,8);
-        DisableMenuItem(t,5);
-        t = GetMenuHandle (130);
-        EnableMenuItem (t,8);
-        EnableMenuItem (t,9);
-    }
-    InvalMenuBar();
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Paint(Ptr)
-{
-    if (flags&HY_WINDOW_SIZE) {
-        DrawGrowIcon (theWindow);
-    }
-    if (hScroll) {
-        ShowControl (hScroll);
-        ShowControl (vScroll);
-        DrawControls(theWindow);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Update(Ptr)
-{
-    GrafPtr savedPort;
-    GetPort(&savedPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    SetPort(GetWindowPort(theWindow));
-    Rect    portRect;
-    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&portRect);
-    OffsetRect (&portRect,-portRect.left,-portRect.top);
-    EraseRect (&portRect);
-#else
-    SetPort(theWindow);
-    EraseRect (&theWindow->portRect);
-#endif
-    BeginUpdate(theWindow);
-    EndUpdate(theWindow);
-    if (flags&HY_WINDOW_SIZE) {
-        DrawGrowIcon (theWindow);
-    }
-    if (hScroll) {
-        DrawControls (theWindow);
-    }
-    SetPort(savedPort);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SetWindowRectangle(int top, int left, int bottom, int right, bool ss)
-{
-    if (ss) {
-        SizeWindow (theWindow, right-left, bottom-top, false);
-    }
-    GrafPtr   savePort;
-    GetPort   (&savePort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    SetPort(GetWindowPort(theWindow));
-    Rect    portRect;
-    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&portRect);
-    OffsetRect (&portRect,-portRect.left,-portRect.top);
-    InvalWindowRect (theWindow,&portRect);
-#else
-    SetPort(theWindow);
-    InvalRect (&theWindow->portRect);
-#endif
-    SetPort   (savePort);
-    long      newSize;
-    if (hScroll) {
-        int windowWidth = right-left-13,
-            windowHeight = bottom-top-13;
-
-        _HYWindow* theParent = (_HYWindow*)this;
-
-        if (windowWidth > theParent->contentWidth) {
-            HiliteControl (hScroll,255);
-        } else {
-            HiliteControl (hScroll,0);
-            newSize = MAX_CONTROL_VALUE*(_Parameter)windowWidth/(theParent->contentWidth-windowWidth);
-            if (newSize>0x6fffffff) {
-                newSize = 0x6fffffff;
-            }
-            SetControlViewSize (hScroll,(long)newSize);
-        }
-
-        if (windowHeight > theParent->contentHeight) {
-            HiliteControl (vScroll,255);
-        } else {
-            HiliteControl (vScroll,0);
-            newSize = MAX_CONTROL_VALUE*(_Parameter)windowHeight/(theParent->contentHeight-windowHeight);
-            if (newSize>0x6fffffff) {
-                newSize = 0x6fffffff;
-            }
-            SetControlViewSize (vScroll,(long)newSize);
-        }
-
-        Rect newRect = newVRect();
-        MoveControl (vScroll,newRect.left,newRect.top);
-        SizeControl (vScroll,newRect.right-newRect.left,newRect.bottom-newRect.top);
-        newRect     = newHRect();
-        MoveControl (hScroll,newRect.left,newRect.top);
-        SizeControl (hScroll,newRect.right-newRect.left,newRect.bottom-newRect.top);
-    }
-    savedLoc.bottom=savedLoc.top+bottom-top;
-    savedLoc.right=savedLoc.left+right-left;
-}
-
-//__________________________________________________________________
-
-bool _HYPlatformWindow::_ProcessOSEvent (Ptr vEvent)
-{
-    EventRecord*    theEvent = (EventRecord*)vEvent;
-    WindowPtr       dummy;
-    _HYWindow*      theParent = (_HYWindow*)this;
-    switch (theEvent->what) {
-    case updateEvt:
-        if ((WindowPtr)theEvent->message==theWindow) {
-            theParent->Update(nil);
-            return true;
-        }
-        return false;
-    case activateEvt: {
-        if ((WindowPtr)theEvent->message==theWindow) {
-            if (theEvent->modifiers&activeFlag) {
-                theParent->Activate();
-            } else {
-                theParent->Deactivate();
-            }
-        }
-        return true;
-    }
-    case mouseDown: {
-        long evtType = FindWindow (theEvent->where,&dummy);
-        switch (evtType) {
-        case inDrag:
-            theParent->Move(vEvent);
-            return true;
-        case inGrow:
-            theParent->Grow(vEvent);
-            return true;
-        case inGoAway:
-            theParent->Close(vEvent);
-            return true;
-        case inZoomIn:
-        case inZoomOut:
-            if (TrackBox(theWindow,theEvent->where,evtType)) {
-                theParent->_Zoom(evtType==inZoomIn);
-            }
-            return true;
-
-        case inContent:
-            if (FrontWindow()!=theWindow) {
-                SelectWindow (theParent->theWindow);
-                //theParent->Activate();
-                return true;
-            } else {
-                GrafPtr savedPort;
-                GetPort(&savedPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-                SetPort(GetWindowPort(theWindow));
-#else
-                SetPort(theWindow);
-#endif
-                Point localClick = theEvent->where;
-                GlobalToLocal (&localClick);
-                ControlHandle whichC;
-                short f = FindControl (localClick,theWindow,&whichC);
-                scrollingWindow = theParent;
-                if (f) {
-                    // set scroll step
-                    short   invisPixels;
-                    if ((whichC!=hScroll)&&(whichC!=vScroll)) {
-                        return false;
-                    }
-                    if (whichC==hScroll) {
-                        invisPixels = theParent->contentWidth-(theParent->right-theParent->left-13);
-                        hScrollingAction = true;
-                    } else {
-                        invisPixels = theParent->contentHeight-(theParent->bottom-theParent->top-13);
-                        hScrollingAction = false;
-                    }
-                    scrollStepCounter = 0;
-                    smallScrollStep = (double)MAX_CONTROL_VALUE/invisPixels;
-                    if (!smallScrollStep) {
-                        smallScrollStep = 1;
-                    }
-#ifdef TARGET_API_MAC_CARBON
-                    ControlActionUPP myActionProc;
-                    myActionProc =   NewControlActionUPP(scrollAction);
-#else
-                    UniversalProcPtr myActionProc;
-                    myActionProc = NewRoutineDescriptor((ProcPtr)scrollAction,
-                                                        uppControlActionProcInfo,
-                                                        GetCurrentISA());
-#endif
-
-                    lastScrollControlValue = GetControl32BitValue (whichC);
-
-                    switch (f) {
-                    case kControlIndicatorPart: {
-                        long    cv = GetControl32BitValue(whichC),cv2;
-                        TrackControl (whichC,localClick,nil);
-                        cv2 = GetControl32BitValue(whichC);
-                        if (cv!=cv2)
-                            if (whichC==hScroll) {
-                                scrollingWindow->ProcessEvent (generateScrollEvent (cv2-cv,0));
-                            } else {
-                                scrollingWindow->ProcessEvent (generateScrollEvent (0,cv2-cv));
-                            }
-
-                        break;
-                    }
-                    default:
-                        forceUpdateForScrolling = true;
-#ifndef __OLDMAC__
-                        TrackControl (whichC,localClick,myActionProc);
-#endif
-#ifdef __OLDMAC__
-                        TrackControl (whichC,localClick,scrollAction);
-#endif
-                        forceUpdateForScrolling = false;
-
-                    }
-#ifdef TARGET_API_MAC_CARBON
-                    DisposeControlActionUPP(myActionProc);
-#endif
-                    return true;
-                }
-                SetPort(savedPort);
-            }
-
-        default:
-            return false;
-        }
-    }
-    }
-    return false;
-}
-//__________________________________________________________________
-
-void    _HYPlatformWindow::_SetContentSize (int w, int h)
-{
-    if (!hScroll) {
-        return;
-    }
-    _HYWindow* theParent = (_HYWindow*)this;
-    int     windowW = theParent->right-theParent->left-15,
-            windowH =  theParent->bottom-theParent->top-15;
-    if (w<=windowW) {
-        HiliteControl (hScroll,255);
-    } else {
-        SetControl32BitValue (hScroll, 0);
-        HiliteControl (hScroll,0);
-    }
-    if (h<=windowH) {
-        HiliteControl (vScroll,255);
-    } else {
-        SetControl32BitValue (vScroll, 0);
-        HiliteControl (hScroll,0);
-    }
-
-    DrawControls (theWindow);
-}
-
-//__________________________________________________________________
-
-
-void    _HYPlatformWindow::_VisibleContents (int& t,int& l,int& b,int& r)
-{
-    _HYWindow*
-    theParent = (_HYWindow*)this;
-
-    long  windowH   = theParent->bottom - theParent->top  - HY_SCROLLER_WIDTH,
-          windowW   = theParent->right  - theParent->left - HY_SCROLLER_WIDTH;
-
-    _Parameter v;
-
-    if (hScroll) {
-        if (windowW>theParent->contentWidth) {
-            l = theParent->left;
-            r = theParent->right;
-        } else {
-            v = GetControl32BitValue (hScroll);
-            l = theParent->left+(theParent->contentWidth-windowW)*v/(double)MAX_CONTROL_VALUE;
-            r = l+windowW;
-        }
-        if (windowH>theParent->contentHeight) {
-            t = theParent->top;
-            b = theParent->bottom;
-        } else {
-            v = GetControl32BitValue (vScroll);
-            t = theParent->top+(theParent->contentHeight-windowH)*v/(double)MAX_CONTROL_VALUE;
-            b = t+windowH;
-        }
-    } else {
-        t = theParent->top;
-        l = theParent->left;
-        b = theParent->bottom;
-        r = theParent->right;
-    }
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformWindow::_SetWindowBackColor (_HYColor newColor)
-{
-    GrafPtr         savePort;
-    GetPort         (&savePort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    SetPort(GetWindowPort(theWindow));
-#else
-    SetPort(theWindow);
-#endif
-    RGBColor        c;
-
-    c.red           = newColor.R*256;
-    c.blue          = newColor.B*256;
-    c.green         = newColor.G*256;
-
-    RGBBackColor    (&c);
-    SetPort         (savePort);
-}
-
-//__________________________________________________________________
-
-bool    _HYPlatformWindow::_IsHScroll (ControlHandle ch)
-{
-    return ch == hScroll;
-}
-
-//__________________________________________________________________
-
-Rect    _HYPlatformWindow::newVRect (void)
-{
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    Rect all;
-    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&all);
-    OffsetRect (&all,-all.left,-all.top);
-#else
-    Rect all = theWindow->portRect;
-#endif
-    all.left = all.right-HY_SCROLLER_WIDTH;
-    all.top--;
-    all.right++;
-    all.bottom-=(HY_SCROLLER_WIDTH-1);
-    return all;
-}
-
-//__________________________________________________________________
-
-Rect    _HYPlatformWindow::newHRect (void)
-{
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    Rect all;
-    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&all);
-    OffsetRect (&all,-all.left,-all.top);
-#else
-    Rect all = theWindow->portRect;
-#endif
-    all.right -= (HY_SCROLLER_WIDTH-1);
-    all.left--;
-    all.top = all.bottom-HY_SCROLLER_WIDTH;
-    all.bottom++;
-    return all;
-}
-
-//__________________________________________________________________
-
-Rect    _HYPlatformWindow::newSRect (void)
-{
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    Rect all;
-    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&all);
-    OffsetRect (&all,-all.left,-all.top);
-#else
-    Rect all = theWindow->portRect;
-#endif
-    all.left = all.right-HY_SCROLLER_WIDTH;
-    all.top = all.bottom-HY_SCROLLER_WIDTH;
-    return all;
-}
-
-//__________________________________________________________________
-
-bool        _HYWindow::_ProcessMenuSelection (long msel)
-{
-    long        menuChoice = msel&0x0000ffff;
-
-    switch (msel/0xffff) {
-    case 129: { // file menu
-        if (menuChoice==5) { // close
-            Close(nil);
-            HiliteMenu(0);
-            InvalMenuBar();
-            return true;
-        }
-        if (menuChoice==7)
-            // page setup
-        {
-            OSStatus theStatus;
-            Boolean isAccepted;
-
-            PMPrintSession     hyPrintSession;
-
-            //theStatus = PMBegin();
-            theStatus = PMCreateSession (&hyPrintSession);
-            if (theStatus != noErr) {
-                return true;
-            }
-
-            if (InitPrint(hyPrintSession)) {
-                theStatus = PMSessionPageSetupDialog(hyPrintSession, gPageFormat, &isAccepted);
-            }
-
-            if (theStatus == noErr) {
-                if (gFlattenedFormat != NULL) {
-                    DisposeHandle(gFlattenedFormat);
-                    gFlattenedFormat = NULL;
-                }
-
-                theStatus = PMFlattenPageFormat(gPageFormat, &gFlattenedFormat);
-            }
-
-            if (gPageFormat != kPMNoPageFormat) {
-                theStatus = PMRelease (gPageFormat);
-                gPageFormat = kPMNoPageFormat;
-            }
-
-            theStatus = PMRelease(hyPrintSession);
-        }
-    }
-    }
-    return false;
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SelectWindow (void)
-{
-    SelectWindow (theWindow);
-}
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/mac/HyPhy.rsrc b/src/gui/mac/HyPhy.rsrc
deleted file mode 100644
index 1b76e12..0000000
Binary files a/src/gui/mac/HyPhy.rsrc and /dev/null differ
diff --git a/src/gui/mac/Info.plist b/src/gui/mac/Info.plist
deleted file mode 100644
index a0d60e6..0000000
--- a/src/gui/mac/Info.plist
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDocumentTypes</key>
-	<array>
-		<dict>
-			<key>CFBundleTypeExtensions</key>
-			<array>
-				<string>*</string>
-			</array>
-			<key>CFBundleTypeName</key>
-			<string>All documents</string>
-			<key>CFBundleTypeRole</key>
-			<string>Editor</string>
-			<key>LSTypeIsPackage</key>
-			<false/>
-			<key>NSPersistentStoreTypeKey</key>
-			<string>XML</string>
-		</dict>
-		<dict>
-			<key>CFBundleTypeExtensions</key>
-			<array>
-				<string>txt</string>
-				<string>text</string>
-			</array>
-			<key>CFBundleTypeIconFile</key>
-			<string>Docs</string>
-			<key>CFBundleTypeName</key>
-			<string>Text document</string>
-			<key>CFBundleTypeOSTypes</key>
-			<array>
-				<string>TEXT</string>
-			</array>
-			<key>CFBundleTypeRole</key>
-			<string>Viewer</string>
-		</dict>
-	</array>
-	<key>CFBundleIconFile</key>
-	<string>HYPHYMP</string>
-	<key>CFBundleIdentifier</key>
-	<string>org.hyphy</string>
-	<key>CFBundleLongVersionString</key>
-	<string>1.4, Copyright 1997-2014 by Sergei L Kosakovsky Pond, Art FY Poon, N. Lance Hepler, Steven Weaver, Martin Smith, and Spencer V Muse</string>
-	<key>CFBundleShortVersionString</key>
-	<string>2.10beta</string>
-	<key>CFBundleURLTypes</key>
-	<array/>
-	<key>CFBundleVersion</key>
-	<string>2.2.3</string>
-	<key>NSServices</key>
-	<array/>
-	<key>UTExportedTypeDeclarations</key>
-	<array/>
-	<key>UTImportedTypeDeclarations</key>
-	<array/>
-</dict>
-</plist>
diff --git a/src/gui/mac/WindowClasses/HYPlatformBootsrapWindow.cpp b/src/gui/mac/WindowClasses/HYPlatformBootsrapWindow.cpp
deleted file mode 100644
index 0984711..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformBootsrapWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Mac OS Portions of the bootstrap window class

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYParameterTable.h"


//__________________________________________________________________


bool        _HYBootstrapWindow::_ProcessMenuSelection (long msel)
{
    long        menuChoice = msel&0x0000ffff;

    HiliteMenu(0);
    InvalMenuBar();

    switch (msel/0xffff) {
    case 129: { // file menu
        if (menuChoice==4) { // print
            DoSave ();
            return true;
        } else if (menuChoice==8) { // print
            _HYTable* t =  (_HYTable*)GetCellObject (2,0);
            t->_PrintTable((_HYTable*)GetCellObject (1,0));
            return true;
        }

        break;
    }
    }

    if (_HYTWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    return false;
}




//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformChartWindow.cpp b/src/gui/mac/WindowClasses/HYPlatformChartWindow.cpp
deleted file mode 100644
index 26bcebe..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformChartWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Mac OS Portions of the chart window class

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYChartWindow.h"
#include "HYCanvas.h"
#include "HYUtils.h"
#include "HYPulldown.h"

#include "math.h"
#include "scrap.h"

extern   _Parameter     pi_const;


//__________________________________________________________________

void _HYChartWindow::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();
    MenuHandle  t = GetMenuHandle (130);
    EnableMenuItem (t,4);
    EnableMenuItem (t,5);
    EnableMenuItem (t,8);
    MenuHandle chartMenu = GetMenuHandle (HY_CHART_WINDOW_MENU_ID);
    if (!chartMenu) {
        chartMenu = NewMenu(HY_CHART_WINDOW_MENU_ID,"\pChart");
        if (!chartMenu) {
            warnError (-108);
        }

        MenuHandle saveMenu  =  NewMenu(HY_CHART_WINDOW_HMENU_ID,"\pSave"),
                   printMenu =  NewMenu(HY_CHART_WINDOW_HMENU_ID+1,"\pPrint"),
                   fontMenu  =  NewMenu(HY_CHART_WINDOW_HMENU_ID+2,"\pFonts"),
                   procMenu  =  NewMenu(HY_CHART_WINDOW_HMENU_ID+3,"\pData Processing");

        InsertMenuItem  (saveMenu, "\pSave Chart.../S",10000);
        InsertMenuItem  (saveMenu, "\pSave Graphic...",10000);
        InsertMenuItem  (saveMenu, "\pSave Table...",10000);
        InsertMenuItem  (printMenu,"\pPrint Chart.../P",10000);
        InsertMenuItem  (printMenu,"\pPrint Table...",10000);
        InsertMenuItem  (fontMenu, "\pTickmark  Font...",10000);
        InsertMenuItem  (fontMenu, "\pLegend Font...",10000);
        InsertMenuItem  (fontMenu, "\pAxis Label  Font...",10000);

        InsertMenuItem  (chartMenu,"\pChart Name...",10000);
        InsertMenuItem  (chartMenu,"\pChart Options...",10000);
        InsertMenuItem  (chartMenu, "\pFonts",10000);
        InsertMenuItem  (chartMenu, "\p(-",10000);
        InsertMenuItem  (chartMenu, "\pData Processing",10000);
        InsertMenu      (saveMenu,hierMenu);
        InsertMenu      (printMenu,hierMenu);
        InsertMenu      (fontMenu,hierMenu);
        InsertMenu      (procMenu,hierMenu);
        InsertMenu      (chartMenu,132);

        SetItemCmd (chartMenu,3,hMenuCmd);
        SetItemMark(chartMenu,3,HY_CHART_WINDOW_HMENU_ID+2);
        SetItemCmd (chartMenu,5,hMenuCmd);
        SetItemMark(chartMenu,5,HY_CHART_WINDOW_HMENU_ID+3);
        if (chartProcessors.lLength == 0) {
            DisableMenuItem (chartMenu,5);
        } else {
            Str255    buffer;
            for (long k=0; k<chartProcessors.lLength; k++) {
                _String *thisItem = (_String*)chartProcessors (k),
                         chopped = thisItem->Cut (thisItem->FindBackwards (':',0,-1)+1,-1);
                StringToStr255  (chopped,buffer);
                InsertMenuItem  (procMenu, buffer,10000);
            }
        }

        t = GetMenuHandle (129);
        SetItemCmd (t,4,hMenuCmd);
        SetItemMark(t,4,HY_CHART_WINDOW_HMENU_ID);
        SetItemCmd (t,8,hMenuCmd);
        SetItemMark(t,8,HY_CHART_WINDOW_HMENU_ID+1);
    }
    InvalMenuBar();
}


//__________________________________________________________________

void _HYChartWindow::_UnsetMenuBar(void)
{
    MenuHandle chartMenu    = GetMenuHandle (HY_CHART_WINDOW_MENU_ID),
               saveMenu   = GetMenuHandle (HY_CHART_WINDOW_HMENU_ID),
               printMenu    = GetMenuHandle (HY_CHART_WINDOW_HMENU_ID+1),
               fontMenu        = GetMenuHandle (HY_CHART_WINDOW_HMENU_ID+2),
               procMenu      = GetMenuHandle (HY_CHART_WINDOW_HMENU_ID+3),
               fMenu       = GetMenuHandle (129);

    DeleteMenu (HY_CHART_WINDOW_MENU_ID);
    DeleteMenu (HY_CHART_WINDOW_HMENU_ID);
    DeleteMenu (HY_CHART_WINDOW_HMENU_ID+1);
    DeleteMenu (HY_CHART_WINDOW_HMENU_ID+2);
    DeleteMenu (HY_CHART_WINDOW_HMENU_ID+3);
    DisposeMenu (chartMenu);
    DisposeMenu (printMenu);
    DisposeMenu (saveMenu);
    DisposeMenu (fontMenu);
    DisposeMenu (procMenu);
    SetItemCmd (fMenu,4,'S');
    SetItemCmd (fMenu,8,'P');
    SetItemMark(fMenu,4,noMark);
    SetItemMark(fMenu,8,noMark);
    _HYWindow::_UnsetMenuBar();
}


//__________________________________________________________________

void        _HYChartWindow::_PrintChart(void)
{
    GrafPtr     savePort;
#ifdef      TARGET_API_MAC_CARBON
    PMRect prRect;
#else
    TPrStatus   prStatus;
    TPPrPort    printPort;
    OSErr       err;
#endif

#ifdef TARGET_API_MAC_CARBON
    OSStatus theStatus;
    Boolean isAccepted;

    PMPrintSession hyPC;
    theStatus = PMCreateSession(&hyPC);
    if (theStatus != noErr) {
        return;
    }
#endif

    if (!InitPrint(hyPC)) {
        _String errMsg ("Could not initialize printing variables.");
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    GetPort(&savePort);

#ifdef TARGET_API_MAC_CARBON
    if (gPrintSettings != kPMNoPrintSettings) {
        theStatus = PMSessionValidatePrintSettings(hyPC,gPrintSettings, kPMDontWantBoolean);
    } else {
        theStatus = PMCreatePrintSettings(&gPrintSettings);

        if ((theStatus == noErr) && (gPrintSettings != kPMNoPrintSettings)) {
            theStatus = PMSessionDefaultPrintSettings(hyPC,gPrintSettings);
        }
    }

    if (theStatus == noErr) {
        theStatus = PMSessionPrintDialog(hyPC,gPrintSettings, gPageFormat, &isAccepted);

        if (isAccepted) {
            theStatus = PMGetAdjustedPageRect(gPageFormat, &prRect);
            if (theStatus != noErr) {
                return;
            }

            theStatus = PMSessionBeginDocument(hyPC,gPrintSettings, gPageFormat);
            if (theStatus != noErr) {
                return;
            }

            long     printW    = prRect.right-prRect.left-2,
                     printH    = prRect.bottom-prRect.top-2;

            UInt32   startPage,
                     endPage;

            PMGetFirstPage (gPrintSettings,&startPage);
            PMGetLastPage  (gPrintSettings,&endPage);
#else
    PrOpen();
    if (err=PrError()) {
        _String errMsg ("Could not print the chart. Error Code:");
        errMsg = errMsg & (long)err;
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    if (PrJobDialog(prRecHdl)) {
        printPort = PrOpenDoc(prRecHdl, nil, nil);
        SetPort((GrafPtr)printPort);
        long     printW = (*prRecHdl)->prInfo.rPage.right-2,
                 printH = (*prRecHdl)->prInfo.rPage.bottom-2,
                 startPage = (*prRecHdl)->prJob.iFstPage,
                 endPage = (*prRecHdl)->prJob.iLstPage;
#endif
#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionBeginPage(hyPC, gPageFormat, NULL);
            if (theStatus != noErr) {
                return;
            }
            GrafPtr ppPort;
            PMSessionGetGraphicsContext (hyPC, NULL, (void**)&ppPort);
            SetPort (ppPort);
#else
            PrOpenPage      (printPort, nil);
#endif

            _HYRect     viewRect  = ((_HYStretchCanvas*)GetObject (0))->GetCanvasSize();
            _Parameter  aspectRatio = viewRect.right/(_Parameter)viewRect.bottom;
            _HYRect     printRect = {0,0,printH, printH*aspectRatio,0};

            if (printRect.right > printW) {
                aspectRatio = printW/(_Parameter)printRect.right;
                printRect.right = printW;
                printRect.bottom *= aspectRatio;
            }

            DrawChart   (&printRect);

#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionEndPage(hyPC);
            if (theStatus != noErr) {
                return;
            }
#else
            PrClosePage     (printPort);
#endif


#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionEndDocument(hyPC);
            SetPort(savePort);
            if (theStatus == noErr) {
                if (gFlattenedFormat != NULL) {
                    DisposeHandle(gFlattenedFormat);
                    gFlattenedFormat = NULL;
                }

                theStatus = PMFlattenPageFormat(gPageFormat, &gFlattenedFormat);
            }

            if (theStatus == noErr) {
                if (gFlattenedSettings != NULL) {
                    DisposeHandle(gFlattenedSettings);
                    gFlattenedSettings = NULL;
                }

                theStatus = PMFlattenPrintSettings(gPrintSettings, &gFlattenedSettings);
            }

            if (gPageFormat != kPMNoPageFormat) {
                theStatus = PMRelease(gPageFormat);
                gPageFormat = kPMNoPageFormat;
            }

            if (gPrintSettings != kPMNoPrintSettings) {
                theStatus = PMRelease(gPrintSettings);
                gPrintSettings = kPMNoPrintSettings;
            }

            theStatus = PMRelease(hyPC);

#else
            PrCloseDoc(printPort);
            if (((*prRecHdl)->prJob.bJDocLoop = bSpoolLoop) && (!PrError() ) ) {
                PrPicFile(prRecHdl, nil, nil, nil, &prStatus);
            }
#endif
        }
#ifdef TARGET_API_MAC_CARBON
        else {
            theStatus = PMRelease(hyPC);
        }
#endif

#ifdef TARGET_API_MAC_CARBON
    }
#else
        PrClose();
        SetPort(savePort);
#endif


}

//__________________________________________________________________


bool        _HYChartWindow::_ProcessMenuSelection (long msel)
{
    long        menuChoice = msel&0x0000ffff;

    HiliteMenu(0);
    InvalMenuBar();

    switch (msel/0xffff) {
    case HY_CHART_WINDOW_MENU_ID: { // chart menu
        if (menuChoice==1) {
            RenameChartWindow ();
            return true;
        } else if (menuChoice==2) {
            HandleChartOptions ();
            return true;
        }
    }
    case HY_CHART_WINDOW_HMENU_ID: { // save menu
        DoSave (menuChoice-1);
        return true;
    }
    case HY_CHART_WINDOW_HMENU_ID+1: { // print menu
        DoPrint (menuChoice-1);
        return true;
    }
    case HY_CHART_WINDOW_HMENU_ID+2: { // font menu
        DoChangeFont (menuChoice-1);
        return true;
    }
    case HY_CHART_WINDOW_HMENU_ID+3: { // proc menu
        ExecuteProcessor (menuChoice-1);
        return true;
    }
    }

    return _HYTWindow::_ProcessMenuSelection(msel);
}

//__________________________________________________________________

bool _HYChartWindow::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord*    theEvent = (EventRecord*)vEvent;

    if (!_HYTWindow::_ProcessOSEvent (vEvent)) {
        _HYPullDown *p1 = (_HYPullDown*)GetObject (4);

        if ((theEvent->what==mouseDown)&&(p1->GetSelection()>=8)&&(ySeries.lLength)) {
            Point localClick = theEvent->where;
            GrafPtr savedPort;
            GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
            SetPort(GetWindowPort(theWindow));
#else
            SetPort(theWindow);
#endif
            GlobalToLocal (&localClick);
            int   c = FindClickedCell(localClick.h,localClick.v),ch,cv;
            if (c<0) {
                return false;
            }
            if (c==0) { // the chart
                ch = localClick.h-componentL.lData[0];
                cv = localClick.v-componentT.lData[0];

                Point oldPt = {-1,-1};

                if (StillDown()) {
                    while (WaitMouseUp()) {
                        GetMouse(&localClick);
                        if (oldPt.h==-1) {
                            oldPt = localClick;
                        }
                        if (DeltaPoint (oldPt,localClick)) {
                            bool        redraw = false;

                            _Parameter  stepper = pi_const/180.;

                            if (abs(localClick.h-oldPt.h)>abs(localClick.v-oldPt.v)) {
                                stepper *= 1+log (fabs(localClick.h-oldPt.h))/log(2.0);
                                if (localClick.h-oldPt.h<0) {
                                    if (xyAngle>0.0) {
                                        xyAngle -= stepper;
                                        if (xyAngle<0) {
                                            xyAngle = 0;
                                        }
                                        redraw = true;
                                    }
                                } else if (xyAngle<pi_const/2) {
                                    xyAngle += stepper;
                                    if (xyAngle>pi_const/2) {
                                        xyAngle = pi_const/2;
                                    }
                                    redraw = true;
                                }
                            } else {
                                stepper *= 1+log (fabs(localClick.v-oldPt.v))/log(2.0);
                                if (localClick.v-oldPt.v>0) {
                                    if (zAngle<pi_const/2) {
                                        zAngle += stepper;
                                        if (zAngle>pi_const/2) {
                                            zAngle = pi_const/2;
                                        }
                                        redraw = true;
                                    }
                                } else if (zAngle>0.0) {
                                    zAngle -= stepper;
                                    if (zAngle<0) {
                                        zAngle = 0;
                                    }
                                    redraw = true;
                                }

                            }

                            if (redraw) {
                                ComputeProjectionSettings();
                                projectionMatrix = ComputeProjectionMatrix   ();
                                forceUpdateForScrolling = true;
                                DrawChart();
                                forceUpdateForScrolling = false;
                            }
                        }
                        oldPt = localClick;
                    }
                }
                return true;
            }
        }
        return false;
    }
    return true;
}

//__________________________________________________________________

void _HYChartWindow::_CopyChart (void)
{
#ifdef TARGET_API_MAC_CARBON
    ClearCurrentScrap();
#else
    ZeroScrap();
#endif

    _HYStretchCanvas    *sc = (_HYStretchCanvas*)GetObject (0);
    Rect                bRect;
    _HYRect             bounds;

    bounds.left         = bounds.top =
                              bRect.left            = bRect.top = 0;

    bounds.right        =   bRect.right         = sc->_HYComponent::GetMaxW();
    bounds.bottom       =   bRect.bottom        = sc->_HYComponent::GetMaxH();

    PicHandle    pic    = OpenPicture (&bRect);

    if (pic) {
        PixPatHandle         white = NewPixPat ();
        checkPointer         (white);
        RGBColor             wc = (RGBColor) {
            0xffff,0xffff,0xffff
        };
        MakeRGBPat           (white,&wc);
        FillCRect            (&bRect,white);
        DrawChart            (&bounds);
        DisposePixPat        (white);

        ClosePicture ();
        HLock   ((Handle)pic);
#ifdef TARGET_API_MAC_CARBON
        ClearCurrentScrap();
        ScrapRef         theScrapRef;
        GetCurrentScrap(&theScrapRef);
        PutScrapFlavor(theScrapRef, 'PICT', kScrapFlavorMaskNone,GetHandleSize((Handle)pic),*pic);
#else
        PutScrap (GetHandleSize((Handle)pic),'PICT',*pic);
#endif
        KillPicture (pic);
    } else {
        _String wMsg ("Failed to open a picture in _CopyChart - probably low on memory\n");
        WarnError (wMsg);
        terminateExecution = false;
    }
}

//__________________________________________________________________

void _HYDistributionChartWindow::_SetMenuBar(void)
{
    _HYChartWindow::_SetMenuBar();
    MenuHandle dMenu = GetMenuHandle (HY_CHART_WINDOW_MENU_ID+1);
    if (!dMenu) {
        dMenu = NewMenu(HY_CHART_WINDOW_MENU_ID+1,"\pCategories");
        if (!dMenu) {
            warnError (-108);
        }


        InsertMenuItem  (dMenu, "\pDefine New Variable",10000);
        InsertMenuItem  (dMenu, "\pDelete Variable",  10000);
        InsertMenuItem  (dMenu, "\pConditional Distribution",  10000);

        if (distribProcessors.lLength > 0) {
            InsertMenuItem  (dMenu, "\p(-",10000);
            Str255    buffer;
            for (long k=0; k<distribProcessors.lLength; k++) {
                _String *thisItem = (_String*)distribProcessors (k),
                         chopped = thisItem->Cut (thisItem->FindBackwards (':',0,-1)+1,-1);
                StringToStr255  (chopped,buffer);
                InsertMenuItem  (dMenu, buffer,10000);
            }
        }

        InsertMenu      (dMenu,132);
    }
    InvalMenuBar();
}

//__________________________________________________________________

void _HYDistributionChartWindow::_UnsetMenuBar(void)
{
    MenuHandle dMenu = GetMenuHandle (HY_CHART_WINDOW_MENU_ID+1);

    DeleteMenu (HY_CHART_WINDOW_MENU_ID+1);
    DisposeMenu (dMenu);

    _HYChartWindow::_UnsetMenuBar();
}

//__________________________________________________________________

bool _HYDistributionChartWindow::_ProcessMenuSelection (long msel)
{
    long        menuChoice = msel&0x0000ffff;

    HiliteMenu(0);
    InvalMenuBar();

    switch (msel/0xffff) {
    case HY_CHART_WINDOW_MENU_ID+1: { // chart menu
        if (menuChoice==1) {
            AddVariable ();
            return true;
        } else if (menuChoice==2) {
            RemoveVariable ();
            return true;
        } else if (menuChoice==3) {
            ShowMarginals ();
            return true;
        } else {
            HandleCatPostProcessor (menuChoice-5);
            return true;
        }

        break;
    }
    }

    return _HYChartWindow::_ProcessMenuSelection(msel);
}

//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformConsoleWindow.cpp b/src/gui/mac/WindowClasses/HYPlatformConsoleWindow.cpp
deleted file mode 100644
index e545a52..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformConsoleWindow.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
-    Mac OS Portions of the console window class
-
-    Sergei L. Kosakovsky Pond, December 2003.
-*/
-
-#include "HYConsoleWindow.h"
-#include "HYTextBox.h"
-#include <ControlDefinitions.h>
-#include <MacTextEditor.h>
-#include "HYPlatformGraphicPane.h"
-#include "parser.h"
-#include <Timer.h>
-
-extern   PixPatHandle   whiteFill,
-         blueFill,
-         statusBarFill;
-
-extern   RGBColor       _BLACK_;
-
-extern   CIconHandle    redButtonIcon,
-         orangeButtonIcon,
-         yellowButtonIcon;
-
-extern  _String         VerbosityLevelString;
-
-UnsignedWide            lastMeasure = {0,0};
-
-//__________________________________________________________________
-
-void _HYConsoleWindow::_SetMenuBar(void)
-{
-    //BufferToConsole ("_HYConsoleWindow::_SetMenuBar\n");
-    _HYWindow::_SetMenuBar();
-
-    MenuHandle  editMenuH  = GetMenuHandle (130);
-
-    if (CountMenuItems (editMenuH) < 13) {
-        InsertMenuItem (editMenuH,"\p(-", 6);
-        InsertMenuItem (editMenuH,"\pFind.../F", 7);
-        InsertMenuItem (editMenuH,"\p(Find Again/G", 8);
-
-        InsertMenuItem (editMenuH,"\p(Redo/Y", 1);
-
-        EnableMenuItem (editMenuH,12);
-        EnableMenuItem (editMenuH,13);
-
-        _UpdateEditMenu();
-    }
-    InvalMenuBar();
-}
-
-//__________________________________________________________________
-
-void _HYConsoleWindow::_UnsetMenuBar(void)
-{
-    //BufferToConsole ("_HYConsoleWindow::_UnsetMenuBar\n");
-    MenuHandle      editMenuH  = GetMenuHandle (130);
-    if (CountMenuItems (editMenuH) >= 13) {
-        DeleteMenuItem (editMenuH,8);
-        DeleteMenuItem (editMenuH,8);
-        DeleteMenuItem (editMenuH,8);
-        DeleteMenuItem (editMenuH,2);
-        _HYWindow::_UnsetMenuBar();
-    }
-}
-
-//__________________________________________________________________
-
-void _HYConsoleWindow::_UpdateEditMenu (void)
-{
-
-    _HYTextBox* txb = (_HYTextBox*)GetObject (0);
-
-    bool        haveSelection = !TXNIsSelectionEmpty(txb->txn),
-                canPaste      = TXNIsScrapPastable();
-
-    _String     undoAction (mlteCommandString(txb->txn,true)),
-                redoAction (mlteCommandString(txb->txn,false));
-
-    if ((((bool)editOptions&HY_CONSOLE_CAN_COPY)!=haveSelection)||
-            (((bool)editOptions&HY_CONSOLE_CAN_PASTE)!=canPaste)||
-            (((bool)editOptions&HY_CONSOLE_CAN_UNDO)!=(bool)undoAction.sLength)||
-            (((bool)editOptions&HY_CONSOLE_CAN_REDO)!=(bool)redoAction.sLength)) {
-        MenuHandle  t   = GetMenuHandle (130);
-
-        editOptions = 0;
-        if (haveSelection) {
-            editOptions |= HY_CONSOLE_CAN_COPY;
-            EnableMenuItem (t,4);
-            EnableMenuItem (t,5);
-            EnableMenuItem (t,7);
-        } else {
-            DisableMenuItem (t,4);
-            DisableMenuItem (t,5);
-            DisableMenuItem (t,7);
-        }
-
-        if (canPaste) {
-            EnableMenuItem (t,6);
-            editOptions |= HY_CONSOLE_CAN_PASTE;
-        } else {
-            DisableMenuItem (t,6);
-        }
-
-        if (undoAction.sLength) {
-            editOptions |= HY_CONSOLE_CAN_UNDO;
-            EnableMenuItem (t,1);
-        } else {
-            DisableMenuItem (t,1);
-        }
-
-        if (redoAction.sLength) {
-            editOptions |= HY_CONSOLE_CAN_REDO;
-            EnableMenuItem (t,2);
-        } else {
-            DisableMenuItem (t,2);
-        }
-    }
-}
-
-//__________________________________________________________________
-
-bool _HYConsoleWindow::_Close (Ptr data)
-{
-    return _HYPlatformWindow::_Close(data);
-}
-
-//__________________________________________________________________
-
-bool        _HYConsoleWindow::_ProcessMenuSelection (long msel)
-{
-    long        menuChoice = msel&0x0000ffff;
-
-    HiliteMenu(0);
-    InvalMenuBar();
-
-    switch (msel/0xffff) {
-    case 129: { // undo
-        switch (menuChoice) {
-        case 4:
-            SaveConsole();
-            return true;
-
-        case 7:
-            _DoPageSetup();
-            return true;
-
-        case 8:
-            _DoPrint();
-            return true;
-        }
-        break;
-    }
-    case 130: { //
-        if (menuChoice<14) { //
-            _HYTextBox * ob = (_HYTextBox*) components (0);
-            switch (menuChoice) {
-            case 1:
-                ob->_DoUndo(true);
-                break;
-            case 2:
-                ob->_DoRedo(true);
-                break;
-            case 4:
-                ob->_DoCut(true);
-                break;
-            case 5:
-                ob->_DoCopy(true);
-                break;
-            case 6:
-                ob->_DoPaste(true);
-                break;
-            case 7:
-                ob->_DoClear(false,true);
-                break;
-            case 9:
-                DoFind (true);
-                break;
-            case 10:
-                DoFind (false);
-                break;
-            case 12:
-                ob->_DoSelectAll(true);
-                break;
-            case 13:
-                ob->_DoClear(true,true);
-                break;
-            }
-            return true;
-        }
-    }
-    }
-
-    return _HYTWindow::_ProcessMenuSelection(msel);
-}
-
-//__________________________________________________________________
-
-bool _HYConsoleWindow::_ProcessOSEvent (Ptr vEvent)
-{
-    //EventRecord*  theEvent = (EventRecord*)vEvent;
-
-    return _HYTWindow::_ProcessOSEvent (vEvent);
-}
-
-//__________________________________________________________________
-void    _HYConsoleWindow::_DoPageSetup          (void)
-{
-    TXNPageSetup (((_HYTextBox*)components(0))->txn);
-}
-
-//__________________________________________________________________
-void    _HYConsoleWindow::_DoPrint          (void)
-{
-    Deactivate();
-    TXNPrint (((_HYTextBox*)components(0))->txn);
-}
-
-
-//__________________________________________________________________
-
-void _HYConsoleWindow::_PaintStatusBar(Ptr, bool force)
-{
-    _Parameter      vL;
-    checkParameter (VerbosityLevelString, vL, 0.0);
-    if (vL<-0.5 && !force) {
-        UnsignedWide curMeasure;
-        Microseconds (&curMeasure);
-        _Parameter diff = 0.000001*((curMeasure.hi-lastMeasure.hi)*4294967296.0+(curMeasure.lo-lastMeasure.lo));
-        if (diff < -vL) {
-            return;
-        }
-         lastMeasure = curMeasure;
-    }
-
-    GrafPtr saveport;
-
-    Rect    box,
-            box2,
-            box3;
-
-    static  PixPatHandle    blueFill  = GetPixPat(132),
-                            whiteFill = GetPixPat(128);
-
-
-    GWorldPtr   offScreenMap = nil;
-
-    GetPort(&saveport);
-
-    Rect wr;
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    GetWindowBounds (theWindow, kWindowGlobalPortRgn, &wr);
-    OffsetRect (&wr,-wr.left,-wr.top);
-#else
-    wr = theWindow->portRect;
-#endif
-
-    SetRect(&box,0,wr.bottom-15,wr.right - 15,wr.bottom);
-
-    if (NewGWorld(&offScreenMap,0,&box,0,GetMainDevice(),noNewDevice)!=noErr) {
-        return;
-    }
-
-    LockPixels (GetGWorldPixMap(offScreenMap));
-    box3 = box;
-
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    SetPort (offScreenMap);
-#else
-    SetPort ((GrafPort*)offScreenMap);
-#endif
-
-    box.top = 0;
-    box.bottom = 15;
-    box2 = box;
-    InsetRect(&box, -1, -1);
-    InsetRect(&box, 1, 1);
-    box.right = 30;
-    FillCRect (&box, blueFill);
-    box.left = 30;
-    box.right = box2.right;
-    FillCRect  (&box,statusBarFill);
-
-    TextMode (srcBic);
-    TextFont(kFontIDGeneva );
-    TextSize(9);
-    TextFace(bold);
-
-    MoveTo(4, box.bottom - 3);
-    DrawText(cState.sData,0,cState.sLength);
-
-    MoveTo(32,  box.bottom - 3);
-    TextMode    (srcOr);
-    TextFace    (normal);
-    DrawText    (fileName.getStr(),0,fileName.sLength);
-    box.left  = 150;
-    box.right = 190;
-    FillCRect   (&box, blueFill);
-    TextMode    (srcBic);
-    TextFace    (bold);
-
-    MoveTo(152, box.bottom-3);
-    DrawText(cTask.sData,0,cTask.sLength);
-    box.left = 190;
-    TextMode (srcOr);
-    TextFace(normal);
-    MoveTo(192, box.bottom-3);
-
-    if (inputStatus == 1) {
-        DrawText(cInput.getStr(),0,cInput.sLength);
-    } else {
-        DrawText(action.getStr(),0,action.sLength);
-    }
-
-    box.right = box2.right - 20;
-    box.left  = box.right  - 50;
-    FillCRect (&box, blueFill);
-    TextMode (srcBic);
-    MoveTo(box.left+2, box.bottom-3);
-    DrawText(timer.getStr(),0,timer.sLength);
-
-    if (percentDone >= 0 || percentDone == -HY_SL_DONE) {
-        TextMode (srcOr);
-        box.right = box.left-5;
-        box.left-=75;
-        box.top+=1;
-        box.bottom-=2;
-        FillCRect (&box,whiteFill);
-
-        ThemeTrackDrawInfo  pB;
-        pB.kind     = kThemeProgressBar;
-        pB.bounds   = box;
-        pB.min = 0;
-        pB.max = 100;
-        pB.value                    =  percentDone>=0?percentDone:100;
-        pB.attributes               = kThemeTrackHorizontal;
-        pB.enableState              = kThemeTrackActive;
-        pB.trackInfo.progress.phase = 0;
-        DrawThemeTrack (&pB,nil,nil,0);
-        TextFont(kFontIDTimes);
-        MoveTo(box.left+28, box.bottom-2);
-
-        _String pLine;
-        if (percentDone >= 0) {
-            pLine = _String(percentDone) & "%";
-        } else {
-            pLine = "DONE";
-        }
-        DrawText(pLine.getStr(),0,pLine.sLength);
-    }
-
-    box = box2;
-    box.right -= 3;
-    box.left  = box.right - 12;
-    box.top +=2;
-    box.bottom --;
-
-    CIconHandle cIcon;
-
-    if (echoFileRef) {
-        if (echoStatus == 1) {
-            cIcon = redButtonIcon;
-        } else {
-            cIcon = orangeButtonIcon;
-        }
-    } else {
-        cIcon = yellowButtonIcon;
-    }
-
-    PlotCIcon (&box,cIcon);
-
-
-    MoveTo(0, 0);
-    Line(wr.right - 15, 0);
-
-    SetPortWindowPort(theWindow);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    CopyBits (GetPortBitMapForCopyBits(offScreenMap),GetPortBitMapForCopyBits(GetWindowPort(theWindow)), &box2, &box3, srcCopy,nil);
-    RgnHandle   dirtyRgn = NewRgn ();
-    RectRgn (dirtyRgn, &box3);
-    QDFlushPortBuffer (GetWindowPort (theWindow), nil);
-    DisposeRgn (dirtyRgn);
-#else
-    CopyBits (&(GrafPtr(offScreenMap)->portBits),&(theWindow->portBits), &box2, &box3, srcCopy,nil);
-#endif
-
-    DisposeGWorld (offScreenMap);
-
-    SetPort(saveport);
-    yieldCPUTime();
-}
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformDBWindow.cpp b/src/gui/mac/WindowClasses/HYPlatformDBWindow.cpp
deleted file mode 100644
index 1fee9d8..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformDBWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    MacOS Portions of the DB Window class

    Sergei L. Kosakovsky Pond, Fall 2005.
*/

#include "HYDBWindow.h"

//__________________________________________________________________


bool        _HYDBWindow::_ProcessMenuSelection (long msel)
{
    long        menuChoice = msel&0x0000ffff;
    _HYTable*   table = (_HYTable*)GetObject(0);

    HiliteMenu(0);
    InvalMenuBar();

    switch (msel/0xffff) {
    case 129: { // file menu
        if (menuChoice==8) { // print
            _SimpleList columns (table->horizontalSpaces.lLength,0,1);
            table->_PrintTable(columns,(_HYTable*)GetObject(1));
            return true;
        }
    }
    }
    return _HYTWindow::_ProcessMenuSelection(msel);
}

//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformDataPanel.cpp b/src/gui/mac/WindowClasses/HYPlatformDataPanel.cpp
deleted file mode 100644
index a686194..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformDataPanel.cpp
+++ /dev/null
@@ -1,1100 +0,0 @@
-/*
-    Mac OS Portions of the data panel class
-
-    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
-*/
-
-#include "HYTreePanel.h"
-#include "HYDataPanel.h"
-#include "HYUtils.h"
-
-#include "likefunc.h"
-
-//__________________________________________________________________
-
-
-bool        _HYDataPanel::_ProcessMenuSelection (long msel)
-{
-    if (_HYWindow::_ProcessMenuSelection(msel)) {
-        return true;
-    }
-
-    long        menuChoice = msel&0x0000ffff;
-    MenuHandle  treeMenu;
-    _HYSequencePane* sp = (_HYSequencePane*)GetObject (0);
-    _HYSequencePane* sp2 =(_HYSequencePane*)GetObject (4);
-    _String     prompt;
-    bool        done = false;
-
-    switch (msel/0xffff) {
-    case 129: { // file menu
-        if (menuChoice==4) { // save
-            SaveDataPanel (savePath.sLength);
-            done = true;
-        } else if (menuChoice==8) { // print
-            _PrintData();
-            done = true;
-        }
-        HiliteMenu(0);
-        if (done) {
-            return true;
-        }
-        break;
-    }
-    case 130: { // edit
-        HiliteMenu(0);
-        if (menuChoice==4) { // copy
-            _CopySelectionToClipboard   ();
-        } else if (menuChoice==6) { // delete selection
-            //DeleteCurrentSelection();
-            return true;
-        } else if (menuChoice==3) { // cut selection
-            //CutSelectionToClipboard ();
-            return true;
-        } else if (menuChoice==5) { // paste selection
-            //PasteClipboardTree();
-            return true;
-        } else if (menuChoice==8) { // select all
-            sp->SelectAll(true);
-            return true;
-        } else if (menuChoice==11) { // Find
-            FindFunction();
-            return true;
-        } else if (menuChoice==12) { // Find
-            HandleSearchAndReplace();
-            return true;
-        }
-        return false;
-    }
-    case HY_DATAPANEL_MENU_ID: {
-        switch (menuChoice) {
-        case 1:
-            SelectPartition();
-            break;
-        case 2:
-            if (sp->selection.lLength) {
-                CreatePartition (sp->selection,1,true);
-            }
-            break;
-        case 3:
-            InvertSelection();
-            break;
-        case 11:
-            PartitionPropsMenu ();
-            break;
-        case 12:
-            InputPartitionString ();
-            break;
-        case 15:
-            SimulateDataSet (0,true);
-            break;
-        case 17:
-            HandleFontChange    ();
-            break;
-        }
-        HiliteMenu(0);
-        return true;
-    }
-    case HY_DATAPANEL_MENU_ID+1: {
-        switch (menuChoice) {
-        case 1:
-            BuildLikelihoodFunction();
-            break;
-        case 3:
-            OptimizeLikelihoodFunction();
-            break;
-        case 5:
-            DisplayParameterTable ();
-            break;
-        case 7:
-            OpenGeneralBSWindow ();
-            break;
-        }
-        HiliteMenu(0);
-        return true;
-    }
-    case HY_DATAPANEL_HMENU_ID: {
-        treeMenu = GetMenuHandle (HY_DATAPANEL_HMENU_ID);
-        long             newBlockSize;
-        if (menuChoice==1) {
-            newBlockSize = 9;
-        } else {
-            newBlockSize = 10;
-        }
-
-        if (sp->blockWidth!=newBlockSize) {
-            sp->blockWidth = newBlockSize;
-            sp2->blockWidth = newBlockSize;
-            sp->BuildPane();
-            sp->_MarkForUpdate();
-            sp2->BuildPane();
-            sp2->_MarkForUpdate();
-            SetItemMark(treeMenu,menuChoice==1?2:1,noMark);
-            SetItemMark(treeMenu,menuChoice,checkMark);
-            InvalMenuBar();
-        }
-        HiliteMenu(0);
-        return true;
-    }
-
-    case HY_DATAPANEL_HMENU_ID+1: {
-        treeMenu = GetMenuHandle (HY_DATAPANEL_HMENU_ID+1);
-        bool       newDisplay;
-        if (menuChoice==1) {
-            newDisplay = false;
-        } else {
-            newDisplay = true;
-        }
-
-        if (sp->showDots!=newDisplay) {
-            sp->showDots = newDisplay;
-            sp->BuildPane();
-            sp->_MarkForUpdate();
-            SetItemMark(treeMenu,menuChoice==1?2:1,noMark);
-            SetItemMark(treeMenu,menuChoice,checkMark);
-            InvalMenuBar();
-        }
-        HiliteMenu(0);
-        return true;
-    }
-
-    case HY_DATAPANEL_HMENU_ID+2: {
-        treeMenu = GetMenuHandle (HY_DATAPANEL_HMENU_ID+2);
-        if (menuChoice<=3) {
-            unsigned char newDisplay;
-            switch (menuChoice) {
-            case 1:
-                newDisplay = HY_SEQUENCE_PANE_NAMES_NONE;
-                break;
-            case 2:
-                newDisplay = HY_SEQUENCE_PANE_NAMES_SHORT;
-                break;
-            case 3:
-                newDisplay = HY_SEQUENCE_PANE_NAMES_ALL;
-
-            }
-
-            if ((sp->nameDisplayFlags&HY_SEQUENCE_PANE_NAMES_MASK)!=newDisplay) {
-                SetItemMark(treeMenu,(sp->nameDisplayFlags&HY_SEQUENCE_PANE_NAMES_MASK)+1,noMark);
-                sp->SetNameDisplayMode(newDisplay,true);
-                sp2->SetNameDisplayMode(newDisplay,true);
-                BuildThermometer();
-                BuildMarksPane();
-                SetItemMark(treeMenu,menuChoice,checkMark);
-                InvalMenuBar();
-            }
-        } else {
-            if (menuChoice==5) { // alphabetize
-                sp->AlphabetizeSpecies();
-            } else if (menuChoice==6) {
-                sp->RevertFileOrder();
-            } else if (menuChoice==7) {
-                sp->CleanUpSequenceNames();
-            }
-        }
-        HiliteMenu(0);
-        return true;
-    }
-    case HY_DATAPANEL_HMENU_ID+3: { // omitted sequences
-        RestoreOmittedSequence(menuChoice-3);
-        HiliteMenu(0);
-        return true;
-    }
-
-    case HY_DATAPANEL_HMENU_ID+4: { // status lines
-        if (AdjustStatusLine (menuChoice-1)) {
-            CheckMenuItem(GetMenuHandle (HY_DATAPANEL_HMENU_ID+4),menuChoice,true);
-        } else {
-            CheckMenuItem(GetMenuHandle (HY_DATAPANEL_HMENU_ID+4),menuChoice,false);
-        }
-        HiliteMenu(0);
-        return true;
-    }
-
-    case HY_DATAPANEL_HMENU_ID+5: { // likelihood display
-        ComputeLikelihoodFunction (menuChoice-1);
-        HiliteMenu(0);
-        return true;
-    }
-
-    case HY_DATAPANEL_HMENU_ID+6: { // simulate data set
-        SimulateDataSet (menuChoice-1);
-        HiliteMenu(0);
-        return true;
-    }
-
-    case HY_DATAPANEL_HMENU_ID+7: { // save/save as
-        SaveDataPanel (menuChoice==2);
-        HiliteMenu(0);
-        return true;
-    }
-
-    case HY_DATAPANEL_HMENU_ID+8: { // infer
-        InferTopologies (menuChoice==2);
-        _VerifyInferMenu ();
-        HiliteMenu(0);
-        return true;
-    }
-    case HY_DATAPANEL_HMENU_ID+9: { // dataProcs
-        ExecuteProcessor (menuChoice-1);
-        return true;
-    }
-
-    HiliteMenu(0);
-    InvalMenuBar();
-    }
-
-    return false;
-}
-
-//__________________________________________________________________
-
-void        _HYDataPanel::_PaintThermRect(bool update)
-{
-    navRect = ComputeNavRect();
-    _HYCanvas* theCanvas = (_HYCanvas*)GetObject (1);
-    GrafPtr savedPort;
-    GetPort(&savedPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    SetPort(GetWindowPort(theWindow));
-#else
-    SetPort(theWindow);
-#endif
-    Rect r;
-    r.left      = navRect.left+theCanvas->rel.left+thermRect.left+1;
-    r.right     = navRect.right+theCanvas->rel.left+thermRect.left-1;
-    r.top       = navRect.top+theCanvas->rel.top+thermRect.top+1;
-    r.bottom    = navRect.bottom+theCanvas->rel.top+thermRect.top-1;
-
-    RGBColor    saveColor,
-                newColor = {255*256,151*256,51*256};
-    PenState ps;
-    GetPenState (&ps);
-    GetForeColor (&saveColor);
-    RGBForeColor (&newColor);
-    PenSize (2,2);
-    FrameRect (&r);
-    RGBForeColor (&saveColor);
-
-    if (update) {
-        RgnHandle   oldClip, newClip;
-        oldClip = NewRgn();
-        newClip = NewRgn();
-        RectRgn (oldClip,&r);
-        InsetRect (&r,2,2);
-        RectRgn (newClip,&r);
-        DiffRgn (oldClip,newClip,newClip);
-        GetClip (oldClip);
-        DiffRgn (oldClip,newClip,newClip);
-        SetClip (newClip);
-        _HYRect rect;
-        rect.left = componentL.lData[1];
-        rect.right = componentR.lData[1];
-        rect.top = componentT.lData[1];
-        rect.bottom = componentB.lData[1];
-        theCanvas->_Paint((char*)&rect);
-        SetClip (oldClip);
-        DisposeRgn (oldClip);
-        DisposeRgn (newClip);
-    }
-    SetPenState (&ps);
-    _PaintLFStatus ();
-    SetPort(savedPort);
-}
-
-//__________________________________________________________________
-
-void        _HYDataPanel::_PaintLFStatus(void)
-{
-    GrafPtr savedPort;
-    GetPort(&savedPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    SetPort(GetWindowPort(theWindow));
-#else
-    SetPort(theWindow);
-#endif
-    if (lfID<0) {
-        _SimpleList goodP;
-
-
-        bool    paintOrange = GenerateGoodPartitions (goodP);
-
-
-        if (goodP.lLength) {
-            _PaintTheCircle (paintOrange?orangeButtonIcon:yellowButtonIcon,theWindow);
-        } else {
-            _PaintTheCircle (redButtonIcon,theWindow);
-        }
-    } else {
-        _PaintTheCircle (greenButtonIcon,theWindow);
-    }
-    SetPort(savedPort);
-}
-
-//__________________________________________________________________
-
-void        _HYDataPanel::_PrintData(void)
-{
-    _HYSequencePane* sp = (_HYSequencePane*)GetObject (0);
-
-    GrafPtr     savePort;
-#ifdef      TARGET_API_MAC_CARBON
-    PMRect prRect;
-#else
-    TPrStatus   prStatus;
-    TPPrPort    printPort;
-    OSErr       err;
-#endif
-
-#ifdef TARGET_API_MAC_CARBON
-    OSStatus theStatus;
-    Boolean isAccepted;
-
-    PMPrintSession hyPC;
-    theStatus = PMCreateSession(&hyPC);
-    if (theStatus != noErr) {
-        return;
-    }
-#endif
-
-    if (!InitPrint(hyPC)) {
-        _String errMsg ("Could not initialize printing variables.");
-        WarnError (errMsg);
-        terminateExecution = false;
-        return;
-    }
-
-    GetPort(&savePort);
-
-#ifdef TARGET_API_MAC_CARBON
-    if (gPrintSettings != kPMNoPrintSettings) {
-        theStatus = PMSessionValidatePrintSettings(hyPC,gPrintSettings, kPMDontWantBoolean);
-    } else {
-        theStatus = PMCreatePrintSettings(&gPrintSettings);
-
-        if ((theStatus == noErr) && (gPrintSettings != kPMNoPrintSettings)) {
-            theStatus = PMSessionDefaultPrintSettings(hyPC,gPrintSettings);
-        }
-    }
-
-    if (theStatus == noErr) {
-        theStatus = PMSessionPrintDialog(hyPC,gPrintSettings, gPageFormat, &isAccepted);
-
-        if (isAccepted) {
-            theStatus = PMGetAdjustedPageRect(gPageFormat, &prRect);
-            if (theStatus != noErr) {
-                return;
-            }
-
-            theStatus = PMSessionBeginDocument(hyPC,gPrintSettings, gPageFormat);
-            if (theStatus != noErr) {
-                return;
-            }
-
-            long     printW    = prRect.right-prRect.left-2,
-                     printH    = prRect.bottom-prRect.top-2;
-
-            UInt32   startPage,
-                     endPage;
-
-            PMGetFirstPage (gPrintSettings,&startPage);
-            PMGetLastPage  (gPrintSettings,&endPage);
-#else
-    PrOpen();
-    if (err=PrError()) {
-        _String errMsg ("Could not print the data set. Error Code:");
-        errMsg = errMsg & (long)err;
-        WarnError (errMsg);
-        terminateExecution = false;
-        return;
-    }
-
-    if (PrJobDialog(prRecHdl)) {
-        printPort = PrOpenDoc(prRecHdl, nil, nil);
-        SetPort((GrafPtr)printPort);
-        long     printW = (*prRecHdl)->prInfo.rPage.right-2,
-                 printH = (*prRecHdl)->prInfo.rPage.bottom-2,
-                 startPage = (*prRecHdl)->prJob.iFstPage,
-                 endPage = (*prRecHdl)->prJob.iLstPage;
-#endif
-            long
-            vOffset = sp->GetSlotHeight()*sp->speciesIndex.lLength+sp->GetSlotHeight()*3/2+1+20*(dataPartitions.lLength>0),
-            cOffset = (printW-sp->headerWidth)/sp->charWidth,
-            pageShift = printH/vOffset,
-            sC = sp->startColumn,
-            lC = sp->endColumn,
-            sR = sp->startRow,
-            lR = sp->endRow,
-            sH = sp->settings.bottom,
-            pageCount;
-
-            _HYColor c1 = sp->backColor,
-                     c2 = sp->headerColor,
-                     bc = {0,0,0};
-
-
-            sp->backColor   = (_HYColor) {
-                255,255,255
-            };
-            sp->headerColor = (_HYColor) {
-                255,255,255
-            };
-            cOffset     -= ((cOffset/sp->blockWidth)*2)/sp->charWidth;
-            cOffset     = (cOffset/sp->blockWidth)*sp->blockWidth;
-
-            pageShift   *= cOffset;
-
-            if (sp->columnStrings.lLength%pageShift==0) {
-                pageShift = sp->columnStrings.lLength / pageShift;
-            } else {
-                pageShift = sp->columnStrings.lLength / pageShift + 1;
-            }
-
-            if (endPage > pageShift) {
-                endPage = pageShift;
-            }
-
-            sp->startColumn = 0;
-            sp->endColumn = cOffset;
-            sp->startRow = 0;
-            sp->endRow = sp->speciesIndex.lLength;
-            sp->settings.bottom = vOffset+5+HY_SCROLLER_WIDTH;
-
-            for (pageCount = 1; pageCount<startPage; pageCount++) {
-#ifdef TARGET_API_MAC_CARBON
-                theStatus = PMSessionBeginPage(hyPC,gPageFormat,NULL);
-                if (theStatus != noErr) {
-                    break;
-                }
-                theStatus = PMSessionEndPage(hyPC);
-                if (theStatus != noErr) {
-                    break;
-                }
-#else
-                PrOpenPage      (printPort, nil);
-                PrClosePage     (printPort);
-#endif
-                sp->endColumn       +=  printH/vOffset * cOffset;
-                sp->startColumn     +=  printH/vOffset * cOffset;
-            }
-
-            Rect         hangover = {0,
-                                     sp->headerWidth + cOffset * sp->charWidth + (cOffset * 2)/sp->blockWidth + 1,
-                                     vOffset,
-                                     printW
-                                    },
-
-                         frame = {0,0,vOffset+1,hangover.left};
-
-            if (sp->startColumn< sp->columnStrings.lLength)
-                for (pageCount = startPage; pageCount<=endPage; pageCount++) {
-                    pageShift       = vOffset;
-#ifdef TARGET_API_MAC_CARBON
-                    theStatus = PMSessionBeginPage(hyPC,gPageFormat, NULL);
-                    if (theStatus != noErr) {
-                        break;
-                    }
-                    GrafPtr ppPort;
-                    PMSessionGetGraphicsContext (hyPC, NULL, (void**)&ppPort);
-                    SetPort (ppPort);
-#else
-                    PrOpenPage      (printPort, nil);
-#endif
-                    SetOrigin       (0,0);
-                    sp->_HYGraphicPane::SetFont     (sp->GetFont());
-                    sp->SetColor    (sp->GetColor());
-                    while (pageShift < printH) {
-                        sp->BuildPane   (false);
-                        sp->SetColor (bc);
-                        PenSize (1,1);
-                        //EraseRect (&hangover);
-                        if (dataPartitions.lLength) {
-                            _HYRect          daFrame;
-                            daFrame.top    = frame.bottom;
-                            daFrame.bottom = frame.bottom + 20;
-                            daFrame.left   = frame.left   + HY_SEQUENCE_PANE_CHAR_SPACING/2 + sp->headerWidth;
-                            daFrame.right  = daFrame.left + cOffset*sp->charWidth + 2*(cOffset/sp->blockWidth) - HY_SCROLLER_WIDTH;
-                            BuildThermometer (&daFrame);
-                        }
-                        //FrameRect (&frame);
-                        sp->startColumn  =  sp->endColumn;
-                        sp->endColumn   +=  cOffset;
-                        SetOrigin           (0,-pageShift);
-                        pageShift       +=  vOffset;
-
-                        if (sp->startColumn>=sp->columnStrings.lLength) {
-                            break;
-                        }
-                    }
-#ifdef TARGET_API_MAC_CARBON
-                    theStatus = PMSessionEndPage(hyPC);
-                    if (theStatus != noErr) {
-                        break;
-                    }
-#else
-                    PrClosePage     (printPort);
-#endif
-                }
-
-            sp->startColumn = sC;
-            sp->endColumn   = lC;
-            sp->startRow    = sR;
-            sp->endRow      = lR;
-            sp->backColor   = c1;
-            sp->headerColor = c2;
-            sp->settings.bottom = sH;
-
-
-#ifdef TARGET_API_MAC_CARBON
-            theStatus = PMSessionEndDocument(hyPC);
-            SetPort(savePort);
-            if (theStatus == noErr) {
-                if (gFlattenedFormat != NULL) {
-                    DisposeHandle(gFlattenedFormat);
-                    gFlattenedFormat = NULL;
-                }
-
-                theStatus = PMFlattenPageFormat(gPageFormat, &gFlattenedFormat);
-            }
-
-            if (theStatus == noErr) {
-                if (gFlattenedSettings != NULL) {
-                    DisposeHandle(gFlattenedSettings);
-                    gFlattenedSettings = NULL;
-                }
-
-                theStatus = PMFlattenPrintSettings(gPrintSettings, &gFlattenedSettings);
-            }
-
-            if (gPageFormat != kPMNoPageFormat) {
-                theStatus = PMRelease(gPageFormat);
-                gPageFormat = kPMNoPageFormat;
-            }
-
-            if (gPrintSettings != kPMNoPrintSettings) {
-                theStatus = PMRelease(gPrintSettings);
-                gPrintSettings = kPMNoPrintSettings;
-            }
-
-            theStatus = PMRelease(hyPC);
-
-#else
-            PrCloseDoc(printPort);
-            if (((*prRecHdl)->prJob.bJDocLoop = bSpoolLoop) && (!PrError() ) ) {
-                PrPicFile(prRecHdl, nil, nil, nil, &prStatus);
-            }
-#endif
-        }
-#ifdef TARGET_API_MAC_CARBON
-        else {
-            theStatus = PMRelease(hyPC);
-        }
-#endif
-
-#ifdef TARGET_API_MAC_CARBON
-    }
-#else
-        PrClose();
-        SetPort(savePort);
-#endif
-}
-
-//__________________________________________________________________
-
-void _HYDataPanel::_VerifyInferMenu(void)
-{
-    MenuHandle  lfMenu          = GetMenuHandle (HY_DATAPANEL_MENU_ID+1),
-                inferSubMenu = GetMenuHandle (HY_DATAPANEL_HMENU_ID+8);
-
-    _SimpleList    gp;
-
-    if (GenerateGoodPartitions(gp)) {
-        if (!inferSubMenu) {
-            inferSubMenu        = NewMenu(HY_DATAPANEL_HMENU_ID+8,"\p");
-            InsertMenu (inferSubMenu,hierMenu);
-            SetItemCmd (lfMenu,1,hMenuCmd);
-            SetItemMark(lfMenu,1,HY_DATAPANEL_HMENU_ID+8);
-            InsertMenuItem (inferSubMenu,"\pInfer Topology/L",10000);
-            InsertMenuItem (inferSubMenu,"\pInfer Topology with Constraints",10000);
-            SetMenuItemText (lfMenu,1,"\pInference...");
-        }
-    } else {
-        if (inferSubMenu) {
-            SetItemMark (lfMenu,1,noMark);
-            DeleteMenu  (HY_DATAPANEL_HMENU_ID+8);
-            DisposeMenu (inferSubMenu);
-            SetMenuItemText (lfMenu,1,"\pBuild Function");
-            SetItemCmd (lfMenu,1,'L');
-        }
-    }
-}
-//__________________________________________________________________
-
-void _HYDataPanel::_SetMenuBar(void)
-{
-    //BufferToConsole ("_HYDataPanel::_SetMenuBar\n");
-    _HYWindow::_SetMenuBar();
-
-    MenuHandle  t  = GetMenuHandle (130),
-                dM = GetMenuHandle (HY_DATAPANEL_MENU_ID);
-    _HYWindow::_SetMenuBar();
-    EnableMenuItem (t,4);
-    EnableMenuItem (t,8);
-
-    if (!dM) {
-        MenuHandle dataMenu         = NewMenu(HY_DATAPANEL_MENU_ID,"\pData"),
-                   lfMenu             = NewMenu (HY_DATAPANEL_MENU_ID+1,"\pLikelihood"),
-                   blockMenu       = NewMenu(HY_DATAPANEL_HMENU_ID,"\p"),
-                   repeatCharMenu   = NewMenu(HY_DATAPANEL_HMENU_ID+1,"\p"),
-                   nameDisplayMenu  = NewMenu(HY_DATAPANEL_HMENU_ID+2,"\p"),
-                   omittedSpecies  = NewMenu(HY_DATAPANEL_HMENU_ID+3,"\p"),
-                   additionalInfo  = NewMenu(HY_DATAPANEL_HMENU_ID+4,"\p"),
-                   lfDisplayMode   = NewMenu(HY_DATAPANEL_HMENU_ID+5,"\p"),
-                   simulateData  = NewMenu(HY_DATAPANEL_HMENU_ID+6,"\p"),
-                   saveSubMenu     = NewMenu(HY_DATAPANEL_HMENU_ID+7,"\p"),
-                   dataProcMenu     = NewMenu(HY_DATAPANEL_HMENU_ID+9,"\p");
-
-        if (!(dataMenu&&blockMenu&&repeatCharMenu&&nameDisplayMenu&&omittedSpecies&&additionalInfo)) {
-            warnError (-108);
-        }
-        InsertMenuItem (dataMenu,"\p(Partition->Selection/1",10000); // 1
-        InsertMenuItem (dataMenu,"\p(Selection->Partition/2",10000); // 2
-        InsertMenuItem (dataMenu,"\pInvert Selection/3",10000);      // 3
-        InsertMenuItem (dataMenu,"\p(-",10000);                      // 4
-        InsertMenuItem (dataMenu,"\pBlock Width",10000);             // 5
-        InsertMenuItem (dataMenu,"\pRepeating Characters",10000);    // 6
-        InsertMenuItem (dataMenu,"\pName Display",10000);            // 7
-        InsertMenuItem (dataMenu,"\pOmitted Sequences",10000);       // 8
-        InsertMenuItem (dataMenu,"\pAdditional Info",10000);         // 9
-        InsertMenuItem (dataMenu,"\p(-",10000);                      // 10
-        InsertMenuItem (dataMenu,"\p(Paritition Properties",10000);  // 11
-        InsertMenuItem (dataMenu,"\pInput Partition",10000);         // 12
-        InsertMenuItem (dataMenu,"\p(-",10000);                      // 13
-        InsertMenuItem (dataMenu,"\p(Simulation",10000);             // 14
-        InsertMenuItem (dataMenu,"\p(Ancestors",10000);              // 15
-        InsertMenuItem (dataMenu,"\p(-",10000);                      // 16
-        InsertMenuItem (dataMenu,"\pFont Options",10000);            // 17
-        InsertMenuItem (dataMenu,"\p(-",10000);                      // 18
-        InsertMenuItem (dataMenu,"\pData Processing",10000);         // 19
-
-        InsertMenuItem (blockMenu,"\p9",10000);
-        InsertMenuItem (blockMenu,"\p10",10000);
-
-
-        InsertMenuItem (lfMenu,"\pBuild Function/L",10000);
-
-        InsertMenuItem (lfMenu,"\p(Display",10000);
-        InsertMenuItem (lfMenu,"\p(Optimize/T",10000);
-        InsertMenuItem (lfMenu,"\p(-",10000);
-        InsertMenuItem (lfMenu,"\p(Show Parameters/H",10000);
-        InsertMenuItem (lfMenu,"\p(-",10000);
-        InsertMenuItem (lfMenu,"\p(General Bootstrap/B",10000);
-        InsertMenuItem (lfMenu,"\p(-",10000);
-        InsertMenuItem (lfDisplayMode,"\pLog-Lkhd Only",10000);
-        InsertMenuItem (lfDisplayMode,"\pLog-Lkhd & Parameter Values",10000);
-        InsertMenuItem (lfDisplayMode,"\pLog-Lkhd & Concise Trees",10000);
-        InsertMenuItem (lfDisplayMode,"\pParameter Listing",10000);
-        InsertMenuItem (lfDisplayMode,"\pLog-Lkhd & Complete Trees",10000);
-        InsertMenuItem (simulateData,"\pSimulate 1",10000);
-        InsertMenuItem (simulateData,"\pSimulate 1 To File",10000);
-        InsertMenuItem (simulateData,"\pSimulate Many",10000);
-        //SetItemMark    (blockMenu,2,checkMark);
-        InsertMenuItem (repeatCharMenu,"\pDisplay Actual Character",10000);
-        InsertMenuItem (repeatCharMenu,"\pDisplay '.'",10000);
-        //SetItemMark    (repeatCharMenu,1,checkMark);
-        InsertMenuItem (nameDisplayMenu,"\pNone",10000);
-        InsertMenuItem (nameDisplayMenu,"\pFirst 10 characters",10000);
-        _HYSequencePane *sp = (_HYSequencePane*)GetCellObject(2,0);
-        if (sp->shortHeaderWidth==sp->fullHeaderWidth) {
-            DisableMenuItem (nameDisplayMenu,2);
-        }
-        InsertMenuItem (nameDisplayMenu,"\pFull Names",10000);
-        InsertMenuItem (nameDisplayMenu,"\p(-",10000);
-        InsertMenuItem (nameDisplayMenu,"\pAlphabetize names",10000);
-        InsertMenuItem (nameDisplayMenu,"\pRevert to file order",10000);
-        InsertMenuItem (nameDisplayMenu,"\pClean up sequence names",10000);
-        //SetItemMark    (nameDisplayMenu,3,checkMark);
-        InsertMenuItem (omittedSpecies,"\pRestore All",10000);
-        InsertMenuItem (omittedSpecies,"\p(-",10000);
-        InsertMenuItem (additionalInfo,"\pConsensus Sequence",10000);
-        InsertMenuItem (additionalInfo,"\p(Rate Class",10000);
-        InsertMenuItem (additionalInfo,"\p(Aminoacid Translation",10000);
-        InsertMenuItem (additionalInfo,"\pReference Sequence",10000);
-        InsertMenuItem (saveSubMenu,"\pSave.../S",10000);
-        InsertMenuItem (saveSubMenu,"\pSave As...",10000);
-
-        InsertMenu (dataMenu,132);
-        InsertMenu (lfMenu,132);
-        InsertMenu (blockMenu,hierMenu);
-        InsertMenu (repeatCharMenu,hierMenu);
-        InsertMenu (nameDisplayMenu,hierMenu);
-        InsertMenu (omittedSpecies,hierMenu);
-        InsertMenu (additionalInfo,hierMenu);
-        InsertMenu (lfDisplayMode,hierMenu);
-        InsertMenu (simulateData,hierMenu);
-        InsertMenu (saveSubMenu,hierMenu);
-        InsertMenu (dataProcMenu,hierMenu);
-        SetItemCmd (lfMenu,2,hMenuCmd);
-        SetItemMark(lfMenu,2,HY_DATAPANEL_HMENU_ID+5);
-        SetItemCmd (dataMenu,5,hMenuCmd);
-        SetItemMark(dataMenu,5,HY_DATAPANEL_HMENU_ID);
-        SetItemCmd (dataMenu,6,hMenuCmd);
-        SetItemMark(dataMenu,6,HY_DATAPANEL_HMENU_ID+1);
-        SetItemCmd (dataMenu,7,hMenuCmd);
-        SetItemMark(dataMenu,7,HY_DATAPANEL_HMENU_ID+2);
-        SetItemCmd (dataMenu,8,hMenuCmd);
-        SetItemMark(dataMenu,8,HY_DATAPANEL_HMENU_ID+3);
-        SetItemCmd (dataMenu,9,hMenuCmd);
-        SetItemMark(dataMenu,9,HY_DATAPANEL_HMENU_ID+4);
-        SetItemCmd (dataMenu,14,hMenuCmd);
-        SetItemMark(dataMenu,14,HY_DATAPANEL_HMENU_ID+6);
-        SetItemCmd (dataMenu,19,hMenuCmd);
-        SetItemMark(dataMenu,19,HY_DATAPANEL_HMENU_ID+9);
-        if (omittedSeqs.lLength==0) {
-            DisableMenuItem (dataMenu,8);
-        } else {
-            _OmitSelectedSpecies(omittedSeqs);
-        }
-
-        if (dataPanelProcessors.lLength == 0) {
-            DisableMenuItem (dataMenu,19);
-        } else {
-            Str255    buffer;
-            for (long k=0; k<dataPanelProcessors.lLength; k++) {
-                _String *thisItem = (_String*)dataPanelProcessors (k),
-                         chopped = thisItem->Cut (thisItem->FindBackwards (':',0,-1)+1,-1);
-                StringToStr255  (chopped,buffer);
-                InsertMenuItem  (dataProcMenu, buffer,10000);
-            }
-        }
-
-        CheckMenuItem (additionalInfo,1,addedLines&HY_DATAPANEL_CONSENSUS);
-        CheckMenuItem (additionalInfo,2,addedLines&HY_DATAPANEL_RATECLASS);
-        CheckMenuItem (additionalInfo,3,addedLines&HY_DATAPANEL_TRANSLATION);
-        CheckMenuItem (additionalInfo,4,addedLines&HY_DATAPANEL_REFERENCE);
-        CheckMenuItem (blockMenu,(sp->blockWidth==10)?2:1,true);
-
-        if (sp->nameDisplayFlags&HY_SEQUENCE_PANE_NAMES_ALL) {
-            CheckMenuItem (nameDisplayMenu,3,true);
-        } else if (sp->nameDisplayFlags&HY_SEQUENCE_PANE_NAMES_SHORT) {
-            CheckMenuItem (nameDisplayMenu,2,true);
-        } else {
-            CheckMenuItem (nameDisplayMenu,1,true);
-        }
-        if (sp->showDots) {
-            CheckMenuItem (repeatCharMenu,2,true);
-        } else {
-            CheckMenuItem (repeatCharMenu,1,true);
-        }
-        if (dataType&HY_DATAPANEL_NUCDATA) {
-            EnableMenuItem (additionalInfo,3);
-        }
-
-        _UpdateLFMenu();
-
-        if (aquaInterfaceOn) {
-            InsertMenuItem (t,"\p(-", 9);
-            InsertMenuItem (t,"\pFind.../F", 10);
-            InsertMenuItem (t,"\pSearch and Replace...", 11);
-        } else {
-            InsertMenuItem (t,"\pFind.../F", 10);
-            InsertMenuItem (t,"\pSearch and Replace...", 11);
-            InsertMenuItem (t,"\p(-", 12);
-        }
-    }
-    t = GetMenuHandle (129);
-    SetItemCmd (t,4,hMenuCmd);
-    SetItemMark(t,4,HY_DATAPANEL_HMENU_ID+7);
-    _VerifyInferMenu    ();
-    InvalMenuBar();
-}
-
-//__________________________________________________________________
-
-void _HYDataPanel::_UpdateLFMenu (void)
-{
-    MenuHandle lfMenu = GetMenuHandle (HY_DATAPANEL_MENU_ID+1),
-               dataMenu = GetMenuHandle (HY_DATAPANEL_MENU_ID),
-               addMenu= GetMenuHandle (HY_DATAPANEL_HMENU_ID+4);
-    if (lfMenu && dataMenu && addMenu) {
-        if (lfID>=0) {
-            EnableMenuItem (lfMenu,2);
-            EnableMenuItem (lfMenu,3);
-            EnableMenuItem (lfMenu,5);
-            EnableMenuItem (lfMenu,7);
-            EnableMenuItem (dataMenu,14);
-            EnableMenuItem (dataMenu,15);
-
-            if (((_LikelihoodFunction*)likeFuncList (lfID))->GetCategoryVars().lLength) {
-                EnableMenuItem (addMenu,2);
-                return;
-            }
-        } else {
-            DisableMenuItem (lfMenu,3);
-            DisableMenuItem (lfMenu,2);
-            DisableMenuItem (lfMenu,5);
-            DisableMenuItem (lfMenu,7);
-            DisableMenuItem (dataMenu,14);
-            DisableMenuItem (dataMenu,15);
-        }
-        DisableMenuItem (addMenu,2);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYDataPanel::_UpdateSelectionChoices (bool toggle)
-{
-    MenuHandle dataMenu  = GetMenuHandle (HY_DATAPANEL_MENU_ID);
-
-    if (toggle) {
-        EnableMenuItem(dataMenu,2);
-        //EnableMenuItem(dataMenu,3);
-    } else {
-        DisableMenuItem(dataMenu,2);
-        //DisableMenuItem(dataMenu,3);
-    }
-    InvalMenuBar();
-
-}
-
-//__________________________________________________________________
-
-void _HYDataPanel::_CopySelectionToClipboard (void)
-{
-    _HYSequencePane*    sp = (_HYSequencePane*)GetObject(0);
-    _String             cbStr (128L,true);
-
-    if (sp->selection.lLength) {
-        for (long m=0; m<sp->speciesIndex.lLength; m++) {
-            long idx = sp->speciesIndex.lData[m];
-            for (long k=0; k<sp->selection.lLength; k++) {
-                cbStr << ((_String*)(sp->columnStrings(sp->selection.lData[k])))->sData[idx];
-                if (k&&((k+1)%sp->blockWidth==0)) {
-                    cbStr << ' ';
-                }
-            }
-            cbStr << '\r';
-        }
-    } else if (sp->vselection.lLength)
-        for (long m=0; m<sp->vselection.lLength; m++) {
-            cbStr << (_String*)(sp->rowHeaders(sp->speciesIndex(sp->vselection.lData[m])));
-            cbStr << '\r';
-        }
-
-    cbStr.Finalize();
-
-    if (cbStr.sLength) {
-        PlaceStringInClipboard (cbStr,nil);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYDataPanel::_OmitSelectedSpecies (_SimpleList& idx)
-{
-    MenuHandle dataMenu = GetMenuHandle (HY_DATAPANEL_MENU_ID),
-               omittedSpecies = GetMenuHandle (HY_DATAPANEL_HMENU_ID+3);
-    if (omittedSpecies) {
-        _HYSequencePane*    sp = (_HYSequencePane*)GetObject(0);
-
-        for (long k=0; k<idx.lLength; k++) {
-            Str255   buffer;
-            _String* thisSpec = (_String*)sp->rowHeaders(idx.lData[k]);
-            StringToStr255 (*thisSpec, buffer);
-            InsertMenuItem (omittedSpecies,buffer,10000);
-        }
-
-        EnableMenuItem (dataMenu,8);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYDataPanel::_RestoreOmittedSequence (long index)
-{
-    MenuHandle dataMenu = GetMenuHandle (HY_DATAPANEL_MENU_ID),
-               omittedSpecies = GetMenuHandle (HY_DATAPANEL_HMENU_ID+3);
-
-    if (index>=0) {
-        DeleteMenuItem (omittedSpecies,index+3);
-        if (CountMenuItems(omittedSpecies)==2) {
-            DisableMenuItem (dataMenu,8);
-        }
-    } else {
-        for (long k=0; k< omittedSeqs.lLength; k++) {
-            DeleteMenuItem (omittedSpecies,3);
-        }
-        DisableMenuItem (dataMenu,8);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYDataPanel::_UpdatePartitionOperations (_SimpleList* sl)
-{
-    MenuHandle dataMenu = GetMenuHandle (HY_DATAPANEL_MENU_ID);
-
-    if (sl->lData[0]) {
-        EnableMenuItem (dataMenu,1);
-        EnableMenuItem (dataMenu,11);
-    } else {
-        DisableMenuItem(dataMenu,1);
-        DisableMenuItem(dataMenu,11);
-    }
-
-    InvalMenuBar();
-}
-
-//__________________________________________________________________
-
-void _HYDataPanel::_UnsetMenuBar(void)
-{
-    //BufferToConsole ("_HYDataPanel::_UnsetMenuBar\n");
-
-    MenuHandle treeMenu         = GetMenuHandle (HY_DATAPANEL_MENU_ID),
-               lfMenu             = GetMenuHandle (HY_DATAPANEL_MENU_ID+1),
-               blockMenu        = GetMenuHandle (HY_DATAPANEL_HMENU_ID),
-               repeatCharMenu   = GetMenuHandle (HY_DATAPANEL_HMENU_ID+1),
-               nameDisplayMenu  = GetMenuHandle (HY_DATAPANEL_HMENU_ID+2),
-               omittedSequences = GetMenuHandle (HY_DATAPANEL_HMENU_ID+3),
-               additionalInfo    = GetMenuHandle (HY_DATAPANEL_HMENU_ID+4),
-               lfDisplayOptions = GetMenuHandle (HY_DATAPANEL_HMENU_ID+5),
-               simulateData  = GetMenuHandle (HY_DATAPANEL_HMENU_ID+6),
-               saveSubMenu     = GetMenuHandle (HY_DATAPANEL_HMENU_ID+7),
-               inferSubMenu      = GetMenuHandle (HY_DATAPANEL_HMENU_ID+8),
-               dataPanelProc    = GetMenuHandle (HY_DATAPANEL_HMENU_ID+9),
-               fMenu            = GetMenuHandle (129);
-
-    DeleteMenu (HY_DATAPANEL_MENU_ID);
-    DeleteMenu (HY_DATAPANEL_MENU_ID+1);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID+1);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID+2);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID+3);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID+4);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID+5);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID+6);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID+7);
-    DeleteMenu (HY_DATAPANEL_HMENU_ID+9);
-    DisposeMenu (treeMenu);
-    DisposeMenu (lfMenu);
-    DisposeMenu (blockMenu);
-    DisposeMenu (repeatCharMenu);
-    DisposeMenu (nameDisplayMenu);
-    DisposeMenu (omittedSequences);
-    DisposeMenu (additionalInfo);
-    DisposeMenu (lfDisplayOptions);
-    DisposeMenu (simulateData);
-    DisposeMenu (saveSubMenu);
-    DisposeMenu (dataPanelProc);
-    if (inferSubMenu) {
-        DeleteMenu (HY_DATAPANEL_HMENU_ID+8);
-        DisposeMenu (inferSubMenu);
-    }
-
-    SetItemCmd (fMenu,4,'S');
-    SetItemMark(fMenu,4,noMark);
-
-    fMenu = GetMenuHandle (130);
-
-    if (!aquaInterfaceOn) {
-        DeleteMenuItem (fMenu,13);
-    }
-
-    DeleteMenuItem (fMenu,12);
-    DeleteMenuItem (fMenu,11);
-
-    if (aquaInterfaceOn) {
-        DeleteMenuItem (fMenu,10);
-    }
-
-
-    _HYWindow::_UnsetMenuBar();
-}
-
-//__________________________________________________________________
-bool _HYDataPanel::_ProcessOSEvent (Ptr vEvent)
-{
-    EventRecord* theEvent = (EventRecord*)vEvent;
-    static  UInt32  lastClick = 0;
-    static  int     lastH = 0, lastV = 0;
-    if (!_HYTWindow::_ProcessOSEvent (vEvent)) {
-        if (theEvent->what==mouseDown) {
-            Point localClick = theEvent->where;
-            GrafPtr savedPort;
-            GetPort(&savedPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-            SetPort(GetWindowPort(theWindow));
-#else
-            SetPort(theWindow);
-#endif
-            GlobalToLocal (&localClick);
-            bool    dblClick = (theEvent->when-lastClick<GetDblTime())&&(abs(localClick.h-lastH)<5)&&(abs(localClick.v-lastV)<5);
-
-            lastClick = theEvent->when;
-            lastH = localClick.h;
-            lastV = localClick.v;
-            int   c = FindClickedCell(localClick.h,localClick.v),ch,cv;
-            if (c<0) {
-                return false;
-            }
-
-            if (c==1) { // navBar
-                ch = localClick.h-componentL.lData[1]-thermRect.left;
-                cv = localClick.v-componentT.lData[1]-thermRect.top;
-                if (dblClick) {
-                    NavBarDblClick (ch);
-                    return true;
-                }
-                if (navRect.Contains(ch,cv)) {
-                    Point   oldPt, newPt,deltaPt;
-                    deltaPt.h = (navRect.right+navRect.left)/2-ch;
-                    deltaPt.v = (navRect.top+navRect.bottom)/2-cv;
-                    oldPt=localClick;
-                    if (StillDown()) {
-                        while (WaitMouseUp()) {
-                            GetMouse( &newPt);
-                            //if ( DeltaPoint(oldPt, newPt) )
-                            if ( oldPt.h!=newPt.h ) {
-                                oldPt=newPt;
-                                ch = newPt.h-componentL.lData[1]+deltaPt.h;
-                                cv = newPt.v-componentT.lData[1]+deltaPt.v;
-                                ch-=thermRect.left;
-                                cv-=thermRect.top;
-                                forceUpdateForScrolling = true;
-                                SetNavRectCenter (ch,cv);
-                                forceUpdateForScrolling = false;
-                            }
-                        }
-                    }
-                } else {
-                    SetNavRectCenter (ch,cv);
-                }
-                return true;
-            } else if ((c==4)&&(theEvent->modifiers&controlKey)) {
-                _HYSequencePane* sp2 = (_HYSequencePane*)components (4);
-                sp2->ProcessContextualPopUp (localClick.h,localClick.v);
-                return true;
-            }
-        } else if ((theEvent->what==keyDown) || (theEvent->what==autoKey)) {
-            unsigned char keyCode = (theEvent->message&keyCodeMask)>>8;
-            if ((keyCode==0x7B)||(keyCode==0x7C)) { // left/right arrow
-                _HYSequencePane* sp = (_HYSequencePane*) GetObject (0);
-                if ((keyCode==0x7B)&&(sp->startColumn)) {
-                    sp->HScrollPane (-1);
-                } else if ((keyCode==0x7C)&&(sp->endColumn<sp->columnStrings.lLength)) {
-                    sp->HScrollPane (1);
-                }
-                return true;
-            }
-        }
-    } else {
-        return true;
-    }
-    return false;
-}
-
-
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformGWindow.cpp b/src/gui/mac/WindowClasses/HYPlatformGWindow.cpp
deleted file mode 100644
index 1521f06..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformGWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Mac OS Portions of the graphics window class

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYGWindow.h"

#include "QuickTimeComponents.h"
#include "ImageCompression.h"
#include "Scrap.h"

#include "errorfns.h"


//__________________________________________________________________

void    _HYGWindow::_Paint (Ptr )
{
    GrafPtr savedPort;
    GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort(GetWindowPort(theWindow));
#else
    SetPort(theWindow);
#endif
    Rect srcRect,
#ifdef OPAQUE_TOOLBOX_STRUCTS
         destRect;
    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&destRect);
    OffsetRect (&destRect,-destRect.left,-destRect.top);
#else
         destRect = theWindow->portRect;
#endif
    destRect.right-=15;
    destRect.bottom-=15;
    int a,b,c,d;
    _VisibleContents (a,b,c,d);
    srcRect.top=a;
    srcRect.left=b;
    srcRect.bottom=c;
    srcRect.right=d;
    LockPixels (GetGWorldPixMap(thePane));
#ifdef OPAQUE_TOOLBOX_STRUCTS
    CopyBits (GetPortBitMapForCopyBits(thePane),GetPortBitMapForCopyBits(GetWindowPort(theWindow)),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#else
    CopyBits ((BitMap*)*GetGWorldPixMap(thePane),&theWindow->portBits,&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#endif
    UnlockPixels (GetGWorldPixMap(thePane));
    DrawGrowIcon (theWindow);
    ShowControl (hScroll);
    ShowControl (vScroll);
    DrawControls(theWindow);
    SetPort (savedPort);
}

//__________________________________________________________________

void    _HYGWindow::_Update (Ptr )
{
    Rect srcRect,
#ifdef OPAQUE_TOOLBOX_STRUCTS
         destRect;
    GetWindowBounds (theWindow,kWindowGlobalPortRgn,&destRect);
    OffsetRect (&destRect,-destRect.left,-destRect.top);
#else
         destRect = theWindow->portRect;
#endif
    destRect.right-=15;
    destRect.bottom-=15;
    GrafPtr savedPort;
    GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort(GetWindowPort(theWindow));
    InvalWindowRect(theWindow,&destRect);
#else
    SetPort(theWindow);
    InvalRect(&theWindow->portRect);
#endif
    BeginUpdate(theWindow);
    int     li, ri, ti, bi;
    _VisibleContents (ti,li,bi,ri);
    srcRect.right = ri;
    srcRect.left = li;
    srcRect.top = ti;
    srcRect.bottom = bi;
    LockPixels (GetGWorldPixMap(thePane));
#ifdef OPAQUE_TOOLBOX_STRUCTS
    CopyBits (GetPortBitMapForCopyBits(thePane),GetPortBitMapForCopyBits(GetWindowPort(theWindow)),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#else
    CopyBits (&(GrafPtr(thePane)->portBits),&(theWindow->portBits),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#endif
    UnlockPixels (GetGWorldPixMap(thePane));
    DrawGrowIcon (theWindow);
    DrawControls(theWindow);
    EndUpdate(theWindow);
    SetPort (savedPort);
}


//__________________________________________________________________


bool        _HYGWindow::_ProcessMenuSelection (long msel)
{
    if (_HYWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    long        menuChoice = msel&0x0000ffff;
    bool        done = false;

    switch (msel/0xffff) {
    case 129: { // file menu
        if (menuChoice==4) { // save
            _SaveGWindow ();
            done = true;
        } else if (menuChoice==8) { // print
            _PrintGWindow();
            done = true;
        }
        break;
    }
    case 130: {
        if (menuChoice == 4) {
            done = true;
            _CopyToClipboard();
            break;
        }
    }
    }

    HiliteMenu(0);
    InvalMenuBar();

    return done;
}


//__________________________________________________________________

void        _HYGWindow::_SaveGWindow (void)
{
    _SavePicture(GetTitle());
}

//__________________________________________________________________

void        _HYGWindow::_PrintGWindow (void)
{
    GrafPtr     savePort;
#ifdef      TARGET_API_MAC_CARBON
    PMRect prRect;
#else
    TPrStatus   prStatus;
    TPPrPort    printPort;
    OSErr       err;
#endif

#ifdef TARGET_API_MAC_CARBON
    OSStatus theStatus;
    Boolean isAccepted;

    PMPrintSession hyPC;
    theStatus = PMCreateSession(&hyPC);
    if (theStatus != noErr) {
        return;
    }
#endif

    if (!InitPrint(hyPC)) {
        _String errMsg ("Could not initialize printing variables.");
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    GetPort(&savePort);

#ifdef TARGET_API_MAC_CARBON
    if (gPrintSettings != kPMNoPrintSettings) {
        theStatus = PMSessionValidatePrintSettings(hyPC,gPrintSettings, kPMDontWantBoolean);
    } else {
        theStatus = PMCreatePrintSettings(&gPrintSettings);

        if ((theStatus == noErr) && (gPrintSettings != kPMNoPrintSettings)) {
            theStatus = PMSessionDefaultPrintSettings(hyPC,gPrintSettings);
        }
    }

    if (theStatus == noErr) {
        theStatus = PMSessionPrintDialog(hyPC,gPrintSettings, gPageFormat, &isAccepted);

        if (isAccepted) {
            theStatus = PMGetAdjustedPageRect(gPageFormat, &prRect);
            if (theStatus != noErr) {
                return;
            }

            theStatus = PMSessionBeginDocument(hyPC,gPrintSettings, gPageFormat);
            if (theStatus != noErr) {
                return;
            }

            long     printW    = prRect.right-prRect.left-2,
                     printH    = prRect.bottom-prRect.top-2;

            UInt32   startPage,
                     endPage;

            PMGetFirstPage (gPrintSettings,&startPage);
            PMGetLastPage  (gPrintSettings,&endPage);
#else
    PrOpen();
    if (err=PrError()) {
        _String errMsg ("Could not print the picture. Error Code:");
        errMsg = errMsg & (long)err;
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    if (PrJobDialog(prRecHdl)) {
        printPort = PrOpenDoc(prRecHdl, nil, nil);
        SetPort((GrafPtr)printPort);
        long     printW = (*prRecHdl)->prInfo.rPage.right-2,
                 printH = (*prRecHdl)->prInfo.rPage.bottom-2,
                 startPage = (*prRecHdl)->prJob.iFstPage,
                 endPage = (*prRecHdl)->prJob.iLstPage;
#endif
#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionBeginPage(hyPC,gPageFormat, NULL);
            if (theStatus != noErr) {
                return;
            }
#else
            PrOpenPage      (printPort, nil);
#endif

            Rect    dest,
                    src = {0,0,h,w};

            if (w<printW) {
                dest.left = (printW-w)/2;
                dest.right = dest.left+w;
            } else {
                dest.left = 0;
                dest.right = printW;
            }
            if (h<printH) {
                dest.top = (printH-h)/2;
                dest.bottom = dest.left+h;
            } else {
                dest.top = 0;
                dest.bottom = printH;
            }

            LockPixels (GetGWorldPixMap(thePane));
#ifdef OPAQUE_TOOLBOX_STRUCTS
            GrafPtr         prPortPtr;
            PMSessionGetGraphicsContext (hyPC, NULL, (void**)&prPortPtr);
            CopyBits (GetPortBitMapForCopyBits(thePane),GetPortBitMapForCopyBits(prPortPtr),&src,&dest,srcCopy,(RgnHandle)nil);
#else
            CopyBits (&(GrafPtr(thePane)->portBits),&(printPort->gPort.portBits),&src,&dest,srcCopy,(RgnHandle)nil);
#endif
            UnlockPixels (GetGWorldPixMap(thePane));

#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionEndPage(hyPC);
            if (theStatus != noErr) {
                return;
            }
#else
            PrClosePage     (printPort);
#endif


#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionEndDocument(hyPC);
            SetPort(savePort);
            if (theStatus == noErr) {
                if (gFlattenedFormat != NULL) {
                    DisposeHandle(gFlattenedFormat);
                    gFlattenedFormat = NULL;
                }

                theStatus = PMFlattenPageFormat(gPageFormat, &gFlattenedFormat);
            }

            if (theStatus == noErr) {
                if (gFlattenedSettings != NULL) {
                    DisposeHandle(gFlattenedSettings);
                    gFlattenedSettings = NULL;
                }

                theStatus = PMFlattenPrintSettings(gPrintSettings, &gFlattenedSettings);
            }

            if (gPageFormat != kPMNoPageFormat) {
                theStatus = PMRelease(gPageFormat);
                gPageFormat = kPMNoPageFormat;
            }

            if (gPrintSettings != kPMNoPrintSettings) {
                theStatus = PMRelease(gPrintSettings);
                gPrintSettings = kPMNoPrintSettings;
            }

            theStatus = PMRelease(hyPC);

#else
            PrCloseDoc(printPort);
            if (((*prRecHdl)->prJob.bJDocLoop = bSpoolLoop) && (!PrError() ) ) {
                PrPicFile(prRecHdl, nil, nil, nil, &prStatus);
            }
#endif
        }
#ifdef TARGET_API_MAC_CARBON
        else {
            theStatus = PMRelease(hyPC);
        }
#endif

#ifdef TARGET_API_MAC_CARBON
    }
#else
        PrClose();
        SetPort(savePort);
#endif
}

//__________________________________________________________________

void _HYGWindow::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();
    MenuHandle  t = GetMenuHandle (130);
    EnableMenuItem (t,4);
    InvalMenuBar();
}

//__________________________________________________________________

void _HYGWindow::_UnsetMenuBar(void)
{
    MenuHandle  t = GetMenuHandle (130);
    DisableMenuItem (t,4);
    _HYWindow::_UnsetMenuBar();
}
//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformModelWindow.cpp b/src/gui/mac/WindowClasses/HYPlatformModelWindow.cpp
deleted file mode 100644
index 1c511e2..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformModelWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Mac OS Portions of the model window class

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYModelWindow.h"
#include "HYParameterTable.h"
#include "HYUtils.h"

#include "Scrap.h"


//__________________________________________________________________

void _HYModelWindow::_UnsetMenuBar(void)
{
    MenuHandle lfMenu   = GetMenuHandle (HY_MODEL_WINDOW_MENU_ID),
               saveMenu = GetMenuHandle (HY_PARAMETER_TABLE_HMENU_ID+1),
               rateMenu = GetMenuHandle (HY_PARAMETER_TABLE_HMENU_ID+2),
               fMenu   = GetMenuHandle (129);

    DeleteMenu (HY_MODEL_WINDOW_MENU_ID);
    DeleteMenu (HY_PARAMETER_TABLE_HMENU_ID+1);
    DeleteMenu (HY_PARAMETER_TABLE_HMENU_ID+2);
    DisposeMenu (lfMenu);
    DisposeMenu (saveMenu);
    DisposeMenu (rateMenu);
    SetItemCmd (fMenu,4,'S');
    _HYWindow::_UnsetMenuBar();
}

//__________________________________________________________________


bool        _HYModelWindow::_ProcessMenuSelection (long msel)
{
    long        menuChoice = msel&0x0000ffff;
    MenuHandle  tableMenu;

    HiliteMenu(0);
    InvalMenuBar();

    switch (msel/0xffff) {
    case 129: { // file menu
        if (menuChoice==8) { // print
            _HYTable* t = (_HYTable*)GetCellObject (MODEL_MATRIX_ROW,4);
            t->_PrintTable((_HYTable*)GetCellObject (MODEL_MATRIX_ROW-1,4));
            return true;
        }
        break;
    }
    case 130: { // edit
        if (menuChoice==4) { // copy
            DoCopyCell ();
            return true;
        }
        if (menuChoice==5) { // paste
            DoPasteToCells();
            return true;
        }
        if (menuChoice==8) { // select all
            DoSelectAll();
            return true;
        }
        break;
    }
    case HY_MODEL_WINDOW_MENU_ID: { // model menu
        if (menuChoice==1) { // edit name
            DoEditModelName ();
            return true;
        }
        break;
    }
    case HY_PARAMETER_TABLE_HMENU_ID+1: { // save menu
        DoSave (menuChoice-2);
        return true;
    }
    case HY_PARAMETER_TABLE_HMENU_ID+2: { // rate menu
        if (menuChoice-1!=rateChoice) {
            tableMenu = GetMenuHandle (HY_PARAMETER_TABLE_HMENU_ID+2);
            SetItemMark     (tableMenu,rateChoice+1,noMark);
            rateChoice = menuChoice-1;
            SetItemMark     (tableMenu,rateChoice+1,checkMark);
            taint = true;
        }
        return true;
    }
    }

    if (_HYTWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    return false;
}

//__________________________________________________________________

void _HYModelWindow::_UpdateEditMenu (bool c, bool p)
{
    MenuHandle  t = GetMenuHandle (130);
    if (c) {
        EnableMenuItem (t,4);
    } else {
        DisableMenuItem (t,4);
    }
    if (p) {
        EnableMenuItem (t,5);
    } else {
        DisableMenuItem (t,5);
    }
    InvalMenuBar();
}

//__________________________________________________________________

bool _HYModelWindow::_CheckClipboard (void)
{
    Handle scrapHandle = NewHandle (0);
    clipboardString = empty;
    long   rc;

#ifdef TARGET_API_MAC_CARBON
    ScrapRef theScrapRef;
    if (GetCurrentScrap(&theScrapRef) != noErr) {
        return false;
    }
    if (GetScrapFlavorSize(theScrapRef, 'TEXT', &rc) != noErr) {
        return false;
    }
#else
    long    scrapOffset;
    rc = GetScrap( scrapHandle, 'TEXT', &scrapOffset );
#endif
    if ( rc >= 0 ) {
        SetHandleSize( scrapHandle, rc+1 );
        HLock  (scrapHandle);
#ifdef TARGET_API_MAC_CARBON
        long err = GetScrapFlavorData(theScrapRef, 'TEXT', &rc, *scrapHandle);
#endif
        (*scrapHandle)[rc] = 0;
        if (err == noErr) {
            _String cText ((char*)*scrapHandle);
            skipWarningMessages = true;
            _Formula f (cText,nil,false);
            skipWarningMessages = false;
            if (f.GetList().lLength) {
                clipboardString = cText;
                SyncEditBox ();
            }
        }
        HUnlock (scrapHandle);
    }

    DisposeHandle (scrapHandle);
    return clipboardString.sLength;
}

//__________________________________________________________________

void _HYModelWindow::_SetClipboard (void)
{
    if (clipboardString.sLength) {
#ifdef TARGET_API_MAC_CARBON
        ClearCurrentScrap();
        ScrapRef         theScrapRef;
        GetCurrentScrap(&theScrapRef);
        PutScrapFlavor(theScrapRef, 'TEXT', kScrapFlavorMaskNone,clipboardString.sLength+1,clipboardString.sData);
#else
        ZeroScrap();
        PutScrap (clipboardString.sLength+1,'TEXT',clipboardString.sData);
#endif
    }
}

//__________________________________________________________________

void _HYModelWindow::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();
    MenuHandle  t = GetMenuHandle (130);
    EnableMenuItem (t,4);
    EnableMenuItem (t,8);
    MenuHandle lfMenu = GetMenuHandle (HY_MODEL_WINDOW_MENU_ID);
    if (!lfMenu) {
        lfMenu = NewMenu(HY_MODEL_WINDOW_MENU_ID,"\pModel");
        if (!lfMenu) {
            warnError (-108);
        }

        MenuHandle saveMenu = NewMenu(HY_PARAMETER_TABLE_HMENU_ID+1,"\pSave"),
                   rateMenu = NewMenu(HY_PARAMETER_TABLE_HMENU_ID+2,"\pRate Variation");

        InsertMenu      (rateMenu,hierMenu);
        InsertMenuItem  (lfMenu,"\pModel Name",10000);
        InsertMenuItem  (lfMenu,"\pRate Variation",10000);
        InsertMenuItem  (saveMenu,"\pSave/S",10000);
        InsertMenuItem  (saveMenu,"\pSave As..",10000);
        InsertMenu      (saveMenu,hierMenu);
        SetItemCmd      (lfMenu,2,hMenuCmd);
        SetItemMark     (lfMenu,2,HY_PARAMETER_TABLE_HMENU_ID+2);

        ListToPopUpMenu (rateOptions, rateMenu);

        SetItemMark (rateMenu,rateChoice+1,checkMark);
        InsertMenu (lfMenu,132);

        t = GetMenuHandle (129);
        SetItemCmd (t,4,hMenuCmd);
        SetItemMark(t,4,HY_PARAMETER_TABLE_HMENU_ID+1);
    }
    InvalMenuBar();
}


//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformPWindow.cpp b/src/gui/mac/WindowClasses/HYPlatformPWindow.cpp
deleted file mode 100644
index 425fd56..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformPWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Mac OS Portions of the picture window class

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYGWindow.h"

#include "QuickTimeComponents.h"
#include "ImageCompression.h"
#include "Scrap.h"

#include "errorfns.h"

#define  HY_PWINDOW_MENU_ID 7333
//__________________________________________________________________
// _HYPlatformPWindow
//__________________________________________________________________

_HYPlatformPWindow::_HYPlatformPWindow          (void)
{
    savedPic = nil;
    savedClip = nil;
}

//__________________________________________________________________

_HYPlatformPWindow::~_HYPlatformPWindow         (void)
{
    if (savedPic) {
        KillPicture (savedPic);
    }
    if (savedClip) {
        DisposeRgn (savedClip);
    }
}

//__________________________________________________________________

void    _HYPlatformPWindow::_StartPicture   (void)
{
    _HYPWindow*     theParent = (_HYPWindow*)    this;
    Rect            picDim = {0,0,0,0};
    picDim.right  = theParent->w;
    picDim.bottom = theParent->h;

    if (savedPic) {
        KillPicture (savedPic);
    }

    if (savedClip) {
        DisposeRgn (savedClip);
    }

    savedClip = NewRgn ();
    GetClip      (savedClip);
    ClipRect     (&picDim);
    OpenCPicParams pp;
    pp.srcRect = picDim;
    pp.hRes = pp.vRes = 75;
    pp.version = -2;
    checkPointer (savedPic = OpenPicture (&picDim));
}

//__________________________________________________________________

void    _HYPlatformPWindow::_EndPicture     (void)
{
    if (savedPic) {
        ClosePicture ();
        _HYPWindow*     theParent = (_HYPWindow*)    this;
        Rect            picDim = {0,0,0,0};
        picDim.right  = theParent->w;
        picDim.bottom = theParent->h;
        DrawPicture  (savedPic,&picDim);
    }
    if (savedClip) {
        SetClip (savedClip);
        DisposeRgn (savedClip);
        savedClip = nil;
    }
}

//__________________________________________________________________

void    _HYPlatformPWindow::_DrawPicture    (_HYRect r)
{
    Rect R = HYRect2Rect (r);
    if (savedPic) {
        DrawPicture (savedPic,&R);
    }
}

//__________________________________________________________________
// _HYPWindow
//__________________________________________________________________

void        _HYPWindow::_PrintPWindow(void)
{
    GrafPtr     savePort;
#ifdef      TARGET_API_MAC_CARBON
    PMRect prRect;
#else
    TPrStatus   prStatus;
    TPPrPort    printPort;
    OSErr       err;
#endif

#ifdef TARGET_API_MAC_CARBON
    OSStatus theStatus;
    Boolean isAccepted;

    PMPrintSession hyPC;
    theStatus = PMCreateSession(&hyPC);
    if (theStatus != noErr) {
        return;
    }
#endif

    if (!InitPrint(hyPC)) {
        _String errMsg ("Could not initialize printing variables.");
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    GetPort(&savePort);

#ifdef TARGET_API_MAC_CARBON
    if (gPrintSettings != kPMNoPrintSettings) {
        theStatus = PMSessionValidatePrintSettings(hyPC,gPrintSettings, kPMDontWantBoolean);
    } else {
        theStatus = PMCreatePrintSettings(&gPrintSettings);

        if ((theStatus == noErr) && (gPrintSettings != kPMNoPrintSettings)) {
            theStatus = PMSessionDefaultPrintSettings(hyPC,gPrintSettings);
        }
    }

    if (theStatus == noErr) {
        theStatus = PMSessionPrintDialog(hyPC,gPrintSettings, gPageFormat, &isAccepted);

        if (isAccepted) {
            theStatus = PMGetAdjustedPageRect(gPageFormat, &prRect);
            if (theStatus != noErr) {
                return;
            }

            theStatus = PMSessionBeginDocument(hyPC,gPrintSettings, gPageFormat);
            if (theStatus != noErr) {
                return;
            }

            long     printW    = prRect.right-prRect.left-2,
                     printH    = prRect.bottom-prRect.top-2;

            UInt32   startPage,
                     endPage;

            PMGetFirstPage (gPrintSettings,&startPage);
            PMGetLastPage  (gPrintSettings,&endPage);
#else
    PrOpen();
    if (err=PrError()) {
        _String errMsg ("Could not print the picture. Error Code:");
        errMsg = errMsg & (long)err;
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    if (PrJobDialog(prRecHdl)) {
        printPort = PrOpenDoc(prRecHdl, nil, nil);
        SetPort((GrafPtr)printPort);
        long     printW = (*prRecHdl)->prInfo.rPage.right-2,
                 printH = (*prRecHdl)->prInfo.rPage.bottom-2,
                 startPage = (*prRecHdl)->prJob.iFstPage,
                 endPage = (*prRecHdl)->prJob.iLstPage;
#endif
#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionBeginPage(hyPC,gPageFormat, NULL);
            if (theStatus != noErr) {
                return;
            }
            GrafPtr ppPort;
            PMSessionGetGraphicsContext (hyPC, NULL, (void**)&ppPort);
            SetPort (ppPort);
#else
            PrOpenPage      (printPort, nil);
#endif

            _Parameter sx = 1., sy = 1.;

            if (printW<w) {
                sx = (_Parameter)printW/w;
            }
            if (printH<h) {
                sy = (_Parameter)printH/h;
            }

            if (sx>sy) {
                sx = sy;
            } else {
                sy = sx;
            }

            _HYRect         drect = {0,0,h*sy,w*sx,0};
            drect.left   = (printW-drect.right)/2;
            drect.right += drect.left;
            drect.top    = (printH-drect.bottom)/2;
            drect.bottom+= drect.top;

            _DrawPicture    (drect);

#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionEndPage(hyPC);
            if (theStatus != noErr) {
                return;
            }
#else
            PrClosePage     (printPort);
#endif


#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionEndDocument(hyPC);
            SetPort(savePort);
            if (theStatus == noErr) {
                if (gFlattenedFormat != NULL) {
                    DisposeHandle(gFlattenedFormat);
                    gFlattenedFormat = NULL;
                }

                theStatus = PMFlattenPageFormat(gPageFormat, &gFlattenedFormat);
            }

            if (theStatus == noErr) {
                if (gFlattenedSettings != NULL) {
                    DisposeHandle(gFlattenedSettings);
                    gFlattenedSettings = NULL;
                }

                theStatus = PMFlattenPrintSettings(gPrintSettings, &gFlattenedSettings);
            }

            if (gPageFormat != kPMNoPageFormat) {
                theStatus = PMRelease(gPageFormat);
                gPageFormat = kPMNoPageFormat;
            }

            if (gPrintSettings != kPMNoPrintSettings) {
                theStatus = PMRelease(gPrintSettings);
                gPrintSettings = kPMNoPrintSettings;
            }

            theStatus = PMRelease(hyPC);

#else
            PrCloseDoc(printPort);
            if (((*prRecHdl)->prJob.bJDocLoop = bSpoolLoop) && (!PrError() ) ) {
                PrPicFile(prRecHdl, nil, nil, nil, &prStatus);
            }
#endif
        }
#ifdef TARGET_API_MAC_CARBON
        else {
            theStatus = PMRelease(hyPC);
        }
#endif

#ifdef TARGET_API_MAC_CARBON
    }
#else
        PrClose();
        SetPort(savePort);
#endif
}

//__________________________________________________________________

void _HYPWindow::_SetWindowRectangle(int top, int left, int bottom, int right, bool ss)
{
    _HYPlatformWindow::_SetWindowRectangle (top,left,bottom,right, ss);
    SetPaneSize     (bottom-top,right-left,depth);
    SetContentSize  (right-left,bottom-top);
}

//__________________________________________________________________

void    _HYPWindow::_Paint (Ptr )
{
    GrafPtr savedPort;
    GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort(GetWindowPort(theWindow));
#else
    SetPort(theWindow);
#endif
    Rect srcRect  = {0,0,h,w},
         destRect = srcRect;

    LockPixels (GetGWorldPixMap(thePane));
#ifdef OPAQUE_TOOLBOX_STRUCTS
    CopyBits (GetPortBitMapForCopyBits(thePane),GetPortBitMapForCopyBits(GetWindowPort(theWindow)),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#else
    CopyBits ((BitMap*)*GetGWorldPixMap(thePane),&theWindow->portBits,&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#endif
    UnlockPixels (GetGWorldPixMap(thePane));
    DrawGrowIcon (theWindow);
    SetPort (savedPort);
}

//__________________________________________________________________

void    _HYPWindow::_Update (Ptr )
{
    GrafPtr savedPort;
    GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort(GetWindowPort(theWindow));
#else
    SetPort(theWindow);
#endif
    BeginUpdate(theWindow);

    Rect srcRect  = {0,0,h,w},
         destRect = srcRect;

    LockPixels (GetGWorldPixMap(thePane));
#ifdef OPAQUE_TOOLBOX_STRUCTS
    CopyBits (GetPortBitMapForCopyBits(thePane),GetPortBitMapForCopyBits(GetWindowPort(theWindow)),&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#else
    CopyBits ((BitMap*)*GetGWorldPixMap(thePane),&theWindow->portBits,&srcRect,&destRect,srcCopy,(RgnHandle)nil);
#endif
    UnlockPixels (GetGWorldPixMap(thePane));
    DrawGrowIcon (theWindow);

    EndUpdate(theWindow);
    SetPort (savedPort);
}

//__________________________________________________________________

long _HYPWindow::_Grow(Ptr theData)
{
    EventRecord* theEvent = (EventRecord*)theData;
    Rect         sizeRect;
    sizeRect.top    = 10;
    sizeRect.left   = 10;
    sizeRect.bottom = 0x7fff;
    sizeRect.right  = 0x7fff;

    return       GrowWindow  (theWindow,theEvent->where,&sizeRect);
}

//__________________________________________________________________

bool        _HYPWindow::_ProcessMenuSelection (long msel)
{
    if (_HYWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    long        menuChoice = msel&0x0000ffff;
    bool        done = false;

    switch (msel/0xffff) {
    case 129: { // file menu
        if (menuChoice==8) { // print
            _PrintPWindow();
            done = true;
        }
        break;
    }

    case HY_PWINDOW_MENU_ID: {
        done = true;
        if (menuChoice == 1) {
            Zoom (1.1);
        } else if (menuChoice == 2) {
            Zoom (.9);
        } else if (menuChoice == 3) {
            OriginalSize();
        }
        break;
    }
    }

    if (!done) {
        return _HYGWindow::_ProcessMenuSelection (msel);
    }

    HiliteMenu(0);
    InvalMenuBar();

    return done;
}

//__________________________________________________________________

void _HYPWindow::_SetMenuBar(void)
{
    _HYGWindow::_SetMenuBar();
    MenuHandle pMenu = GetMenuHandle (HY_PWINDOW_MENU_ID);
    if (!pMenu) {
        pMenu = NewMenu(HY_PWINDOW_MENU_ID,"\pImage");
        if (!pMenu) {
            warnError (-108);
        }

        InsertMenuItem (pMenu,"\pEnlarge/1",0);
        InsertMenuItem (pMenu,"\pShrink/2",10000);
        InsertMenuItem (pMenu,"\pOriginal Size/3",10000);
        InsertMenu (pMenu,132);
    }
    InvalMenuBar();
}

//__________________________________________________________________

void _HYPWindow::_UnsetMenuBar(void)
{
    MenuHandle t = GetMenuHandle (HY_PWINDOW_MENU_ID);

    DeleteMenu  (HY_PWINDOW_MENU_ID);
    DisposeMenu (t);

    _HYGWindow::_UnsetMenuBar();
}

//__________________________________________________________________
bool _HYPWindow::_ProcessOSEvent (Ptr vEvent)
{
    return _HYPlatformWindow::_ProcessOSEvent (vEvent);
}

//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformParameterTable.cpp b/src/gui/mac/WindowClasses/HYPlatformParameterTable.cpp
deleted file mode 100644
index 9ca8486..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformParameterTable.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Mac OS Portions of the parameter table class

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYParameterTable.h"
#include "HYUtils.h"

//__________________________________________________________________


bool        _HYParameterTable::_ProcessMenuSelection (long msel)
{
    long        menuChoice = msel&0x0000ffff;
    MenuHandle  tableMenu;
    _HYTable*   table = (_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW,0);

    HiliteMenu(0);
    InvalMenuBar();

    switch (msel/0xffff) {
    case 129: { // file menu
        if (menuChoice==4) { // save
            DoSave ();
            return true;
        }
        if (menuChoice==8) { // print
            _SimpleList columns,
                        sel;
            columns << 0;
            columns << 1;
            columns << 2;
            columns << 3;
            table->GetSelection (sel);
            char    resp = 3;
            if (sel.lLength) {
                _String pr ("Would you like to print only the selected cells? (Click \"No\" to print the entire table).");
                resp = YesNoCancelPrompt (pr);
            }
            if (resp == 3) {
                table->_PrintTable(columns,(_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW-1,0));
            } else if (resp == 1) {
                _SimpleList rows;
                for (long k = 0; k < sel.lLength; k+=4) {
                    rows << sel.lData[k]/4;
                }
                table->_PrintTable(columns,rows,(_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW-1,0));
            }
            return true;
        }
        break;
    }
    case 130: { // edit
        if (menuChoice==1) { // undo
            UndoCommand();
            _UpdateUndoMenu (nil,nil);
            return true;
        }
        if (menuChoice==4) { // copy
            return true;
        }
        if (menuChoice==8) { // select all
            SelectAll();
            return true;
        }
        break;
    }
    case HY_PARAMETER_TABLE_HMENU_ID: {
        tableMenu = GetMenuHandle (HY_PARAMETER_TABLE_HMENU_ID);
        char   toggleFlag;
        switch (menuChoice) {
        case 1:
            toggleFlag = HY_PARAMETER_TABLE_VIEW_LOCAL;
            break;
        case 2:
            toggleFlag = HY_PARAMETER_TABLE_VIEW_GLOBAL;
            break;
        case 3:
            toggleFlag = HY_PARAMETER_TABLE_VIEW_CONSTRAINED;
            break;
        case 4:
            toggleFlag = HY_PARAMETER_TABLE_VIEW_CATEGORY;
            break;

        }
        if (viewOptions&toggleFlag) {
            if (viewOptions-toggleFlag) {
                viewOptions-=toggleFlag;
            } else {
                break;
            }
        } else {
            viewOptions+=toggleFlag;
        }

        SetItemMark (tableMenu,menuChoice,(viewOptions&toggleFlag)?checkMark:noMark);
        ConstructTheTable();
        SetWindowRectangle (top,left,bottom,right);
        return true;
    }
    case HY_PARAMETER_TABLE_MENU_ID: {
        switch (menuChoice) {
        case 4:
            OptimizeLikelihoodFunction();
            break;

        case 6:
            DoEnterConstraint ();
            break;

        case 7:
            DoCleanUp   ();
            break;

        case 9:
            HandleVarianceEstimates ();
            break;

        case 10:
            HandleProfilePlot();
            break;

        case 12:
            HandleCategories();
            break;

        case 14:
            HandleSelectParameters();
            break;

        case 15:
            HandleOpenInChart     ();
            break;
        }
        return true;
    }
    }

    return _HYTWindow::_ProcessMenuSelection(msel);
}

//__________________________________________________________________

void _HYParameterTable::_UpdateViewMenu(void)
{
    MenuHandle viewMenu = GetMenuHandle (HY_PARAMETER_TABLE_HMENU_ID);

    if (!(avViewOptions&HY_PARAMETER_TABLE_VIEW_GLOBAL)) {
        DisableMenuItem (viewMenu,2);
    } else {
        EnableMenuItem (viewMenu,2);
    }


    if (!(avViewOptions&HY_PARAMETER_TABLE_VIEW_CONSTRAINED)) {
        DisableMenuItem (viewMenu,3);
    } else {
        EnableMenuItem (viewMenu,3);
    }

    if (!(avViewOptions&HY_PARAMETER_TABLE_VIEW_CATEGORY)) {
        DisableMenuItem (viewMenu,4);
    } else {
        EnableMenuItem (viewMenu,4);
    }

    if (!(avViewOptions&HY_PARAMETER_TABLE_VIEW_TREES)) {
        DisableMenuItem (viewMenu,5);
    } else {
        EnableMenuItem (viewMenu,5);
    }

    CheckMenuItem (viewMenu,1,viewOptions&HY_PARAMETER_TABLE_VIEW_LOCAL);
    CheckMenuItem (viewMenu,2,viewOptions&HY_PARAMETER_TABLE_VIEW_GLOBAL);
    CheckMenuItem (viewMenu,3,viewOptions&HY_PARAMETER_TABLE_VIEW_CONSTRAINED);
    CheckMenuItem (viewMenu,4,viewOptions&HY_PARAMETER_TABLE_VIEW_CATEGORY);
    CheckMenuItem (viewMenu,5,viewOptions&HY_PARAMETER_TABLE_VIEW_TREES);
    //CheckMenuItem (viewMenu,(viewOptions&HY_PARAMETER_TABLE_VIEW_ALPHABETICAL)?7:6,true);

}

//__________________________________________________________________

void _HYParameterTable::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();

    MenuHandle  t  = GetMenuHandle (130);

    EnableMenuItem (GetMenuHandle (129),1);
    EnableMenuItem (t,8);
    if (undoCommands.lLength) {
        EnableMenuItem (GetMenuHandle (130),1);
    }

    MenuHandle lfMenu = GetMenuHandle (HY_PARAMETER_TABLE_MENU_ID);
    if (!lfMenu) {
        lfMenu = NewMenu(HY_PARAMETER_TABLE_MENU_ID,"\pLikelihood");
        if (!lfMenu) {
            warnError (-108);
        }

        MenuHandle viewMenu = NewMenu(HY_PARAMETER_TABLE_HMENU_ID,"\pView Options");

        InsertMenuItem (viewMenu,"\pLocal Parameters",0);
        InsertMenuItem (viewMenu,"\pGlobal Parameters",10000);
        InsertMenuItem (viewMenu,"\pConstrained Parameters",10000);
        InsertMenuItem (viewMenu,"\pRate Classes",10000);
        InsertMenuItem (viewMenu,"\pTrees",10000);
        InsertMenu (viewMenu,hierMenu);
        InsertMenuItem (lfMenu,"\pView Options",10000);
        SetItemCmd (lfMenu,1,hMenuCmd);
        SetItemMark(lfMenu,1,HY_PARAMETER_TABLE_HMENU_ID);

        InsertMenuItem (lfMenu,"\p(-",10000);
        InsertMenuItem (lfMenu,"\pRecalculate LF/U",10000);
        InsertMenuItem (lfMenu,"\pOptimize LF/T",10000);
        InsertMenuItem (lfMenu,"\p(-",10000);
        InsertMenuItem (lfMenu,"\pEnter Command",10000);
        InsertMenuItem (lfMenu,"\pRemove Unused Parameters",10000);
        InsertMenuItem (lfMenu,"\p(-",10000);
        InsertMenuItem (lfMenu,"\pCovariance, Sampler and CI",10000);
        InsertMenuItem (lfMenu,"\pLikelihood Profile Plot",10000);
        InsertMenuItem (lfMenu,"\p(-",10000);
        InsertMenuItem (lfMenu,"\pCategories Processor",10000);
        InsertMenuItem (lfMenu,"\p(-",10000);
        InsertMenuItem (lfMenu,"\pSelect Parameters",10000);
        InsertMenuItem (lfMenu,"\pOpen Selection in Table",10000);

        InsertMenu (lfMenu,132);
        _UpdateViewMenu();
    }
    InvalMenuBar();
}

//__________________________________________________________________

void _HYParameterTable::_UnsetMenuBar(void)
{
    MenuHandle lfMenu = GetMenuHandle (HY_PARAMETER_TABLE_MENU_ID),
               viewMenu = GetMenuHandle (HY_PARAMETER_TABLE_HMENU_ID);


    DeleteMenu (HY_PARAMETER_TABLE_MENU_ID);
    DeleteMenu (HY_PARAMETER_TABLE_HMENU_ID);
    DisposeMenu (viewMenu);
    DisposeMenu (lfMenu);
    _HYWindow::_UnsetMenuBar();
}

//__________________________________________________________________

void _HYParameterTable::_UpdateUndoMenu(_String* command, _String* desc)
{
    if (command&&desc) {
        EnableMenuItem (GetMenuHandle (130),1);
        undoCommands        &&  command;
        undoDescriptions    &&  desc;
        Str255 s255;
        StringToStr255 (*desc, s255);
        SetMenuItemText (GetMenuHandle (130),1,s255);
    } else {
        if (undoDescriptions.lLength==0) {
            Str255 s255 = "\pCan't Undo";
            SetMenuItemText (GetMenuHandle (130),1,s255);
            DisableMenuItem (GetMenuHandle (130),1);
        } else {
            Str255 s255;
            StringToStr255 (*(_String*)undoDescriptions(undoDescriptions.lLength-1), s255);
            EnableMenuItem (GetMenuHandle (130),1);
            SetMenuItemText (GetMenuHandle (130),1,s255);
        }
    }
    InvalMenuBar();
}

//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformTWindow.cpp b/src/gui/mac/WindowClasses/HYPlatformTWindow.cpp
deleted file mode 100644
index 49e559a..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformTWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Mac OS Portions of the container window

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYTableWindow.h"
#include "Scrap.h"
#include "HYEventTypes.h"
#include "HYUtils.h"
#include "errorfns.h"


//__________________________________________________________________
extern      _SimpleList windowPtrs,
            windowObjects;

RGBColor    _BLACK_ = {0,0,0};

extern      PixPatHandle
statusBarFill;

//__________________________________________________________________


#ifdef TARGET_API_MAC_CARBON
extern  PMPageFormat     gPageFormat;
extern  Handle           gFlattenedFormat;
pascal OSStatus scrollWheelHandler (EventHandlerCallRef , EventRef, void*);
pascal void IdleWindowTimer        (EventLoopTimerRef ,void*);


pascal void IdleWindowTimer (EventLoopTimerRef ,void* userData)
{
    _HYTWindow * myTW = (_HYTWindow*)userData;
    for (long k=0; k<myTW->components.lLength; k++)
        if (myTW->cells.Find(k)>=0) {
            _HYComponent* tC = (_HYComponent*)myTW->components(k);
            tC->IdleHandler();
        }
    myTW->_HandleIdleEvent ();
}

//__________________________________________________________________

pascal OSStatus scrollWheelHandler (EventHandlerCallRef , EventRef theEvent, void* userData)
{
    EventParamType                  actType;
    EventMouseWheelAxis             axis;
    GetEventParameter (theEvent,  kEventParamMouseWheelAxis, typeMouseWheelAxis, &actType,sizeof(EventMouseWheelAxis),nil,&axis);

    if (axis == kEventMouseWheelAxisY) {
        Point              mouseLocation;
        GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, &actType,sizeof(Point),nil,&mouseLocation);

        long               mouseWheelDelta;
        GetEventParameter (theEvent, kEventParamMouseWheelDelta, typeLongInteger, &actType,sizeof(Point),nil,&mouseWheelDelta);

        UInt32 modifiers;
        GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers);

        if (modifiers & optionKey) {
            mouseWheelDelta *= 10;
        }

        /*_HYWindow* thisWindow = (_HYWindow*)windowObjectRefs(windowPtrs.Find((long)userData));
        forceUpdateForScrolling = true;
        thisWindow->SetWindowRectangle (newSize.top,newSize.left,newSize.bottom+1,newSize.right+1,false);
        thisWindow->Update(nil);
        forceUpdateForScrolling = false;*/

        _HYTWindow* thisWindow = (_HYTWindow*)windowObjectRefs(windowPtrs.Find((long)userData));
        GrafPtr savedPort;
        GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort(GetWindowPort(thisWindow->theWindow));
#else
        SetPort(thisWindow->theWindow);
#endif
        GlobalToLocal (&mouseLocation);
        int c = thisWindow->FindClickedCell(mouseLocation.h,mouseLocation.v);
        thisWindow->DoMouseWheel (c, mouseWheelDelta);
        return noErr;
    }

    return eventNotHandledErr;
}

#endif

//__________________________________________________________________


bool        _HYTWindow::_ProcessMenuSelection (long msel)
{
    if (_HYWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    long        menuChoice = msel&0x0000ffff;
    bool        done = false;

    switch (msel/0xffff) {
    case 129:
        if (menuChoice == 7) { // print setup
            OSStatus theStatus;
            Boolean isAccepted;

            PMPrintSession hyPC;

            theStatus = PMCreateSession (&hyPC);
            if (theStatus != noErr) {
                return false;
            }

            if (InitPrint(hyPC)) {
                theStatus = PMSessionPageSetupDialog(hyPC,gPageFormat, &isAccepted);
            }

            if (theStatus == noErr) {
                if (gFlattenedFormat != NULL) {
                    DisposeHandle(gFlattenedFormat);
                    gFlattenedFormat = NULL;
                }

                theStatus = PMFlattenPageFormat(gPageFormat, &gFlattenedFormat);
            }

            if (gPageFormat != kPMNoPageFormat) {
                theStatus = PMRelease(gPageFormat);
                gPageFormat = kPMNoPageFormat;
            }

            theStatus = PMRelease(hyPC);
            return true;
        }

    case 130: {
        if ((menuChoice == 4)||(menuChoice==5)) {
            done = true;
            HandleCopyPaste(menuChoice-4);
            break;
        }
    }
    }

    HiliteMenu(0);
    InvalMenuBar();

    return done;
}

//__________________________________________________________________

long _HYTWindow::_Grow(Ptr theData)
{
    EventRecord* theEvent = (EventRecord*)theData;
    //_HYRect        dynDim = MinMaxWindowDimensions();
    Rect         sizeRect;
    sizeRect.top    = dim.top;
    sizeRect.left   = dim.left;
    sizeRect.bottom = dim.bottom-1;
    sizeRect.right  = dim.right-1;

    return GrowWindow  (theWindow,theEvent->where,&sizeRect);
}

//__________________________________________________________________

void _HYTWindow::_PaintStatusBar(Ptr,bool)
{
    Rect clearRect = newHRect();
    //EraseRect (&clearRect);
    FillCRect (&clearRect, statusBarFill);
    if (hScroll) {
        clearRect = newVRect();
        EraseRect (&clearRect);
    } else {
        RGBColor saveColor;
        GetForeColor (&saveColor);
        RGBForeColor (&_BLACK_);
        MoveTo (clearRect.left,clearRect.top);
        LineTo (clearRect.right,clearRect.top);
        RGBForeColor (&saveColor);
        if (statusBar.sLength) {
#ifdef OPAQUE_TOOLBOX_STRUCTS
            Rect    destRect;
            GetWindowBounds (theWindow,kWindowGlobalPortRgn,&destRect);
            OffsetRect (&destRect,-destRect.left,-destRect.top);
            if (flags&HY_WINDOW_STATUS_BAR_LIGHT_LEFT) {
                MoveTo (20,destRect.bottom-4);
            } else {
                MoveTo (5,destRect.bottom-4);
            }
#else
            if (flags&HY_WINDOW_STATUS_BAR_LIGHT_LEFT) {
                MoveTo (20,theWindow->portRect.bottom-4);
            } else {
                MoveTo (5,theWindow->portRect.bottom-4);
            }
#endif
            TextFont(0);
            TextFace(0);
            TextSize(9);
            DrawText(statusBar.sData,0,statusBar.sLength);
        }
    }
}

//__________________________________________________________________

void _HYTWindow::_Paint(Ptr)
{
    /*if (flags&HY_WINDOW_SIZE)
        DrawGrowIcon (theWindow);*/
    _HYRect  relRect;

    _SimpleList alreadyDone (cells.lLength);

    for (int k=0; k<cells.lLength; k++) {
        long i = cells.lData[k];

        if (alreadyDone.lData[i] == 0) {
            relRect.left = componentL.lData[i];
            relRect.right = componentR.lData[i];
            relRect.top = componentT.lData[i];
            relRect.bottom = componentB.lData[i];
            ((_HYComponent*)components(i))->Update((Ptr)&relRect);
            alreadyDone.lData[i] = 1;
        }
    }
    if (hScroll) {
        ShowControl (hScroll);
        ShowControl (vScroll);
    } else {
        if(flags&HY_WINDOW_SIZE) {
            _PaintStatusBar();
        }
    }

#ifdef TARGET_API_MAC_CARBON
    if (!aquaInterfaceOn) {
        DrawControls(theWindow);
    }
#else
    DrawControls(theWindow);
#endif
}

//__________________________________________________________________

void _HYTWindow::_Update(Ptr)
{
    GrafPtr savedPort;
    GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort(GetWindowPort(theWindow));
#else
    SetPort(theWindow);
#endif
    BeginUpdate(theWindow);
//  PixMapHandle osW,saveMap;
//  SetPort(theWindow);
//  GDHandle     junk;
//  if (NewScreenBuffer (&theWindow->portRect,false,&junk,&osW) != noErr)
//  {
    _Paint(nil);
    /*  }
        else
        {
            HLock ((Handle)osW);
            HLock ((Handle)((CGrafPtr)theWindow)->portPixMap);
            CopyBits ((BitMap*)*(((CGrafPtr)theWindow)->portPixMap),(BitMap*)*osW,&theWindow->portRect,&theWindow->portRect,srcCopy,nil);
            saveMap = ((CGrafPtr)theWindow)->portPixMap;
            SetPortPix (osW);
            _Paint(nil);
            SetPortPix (saveMap);
            CopyBits ((BitMap*)*osW,(BitMap*)*(((CGrafPtr)theWindow)->portPixMap),&theWindow->portRect,&theWindow->portRect,srcCopy,nil);
            HUnlock ((Handle)((CGrafPtr)theWindow)->portPixMap);
            DisposePixMap (osW);
        }*/
    EndUpdate(theWindow);
    SetPort(savedPort);
}

//__________________________________________________________________

void _HYTWindow::_Activate(void)
{
    for (int i=0; i<components.lLength; i++)
        if (cells.Find(i)>=0) {
            ((_HYComponent*)components(i))->Activate();
        }


#ifdef TARGET_API_MAC_CARBON
    if (!theTimer) {
        EventLoopRef      mainLoop;
        mainLoop = GetMainEventLoop();
        InstallEventLoopTimer (mainLoop,0,.5*kEventDurationSecond,timerUPP,this,&theTimer);
    }
#endif

    _HYPlatformWindow::_Activate();

}

//__________________________________________________________________

void _HYTWindow::_Activate2(void)
{
}

//__________________________________________________________________

void _HYTWindow::_Deactivate2(void)
{
}

//__________________________________________________________________

void _HYTWindow::_Zoom(bool inOut)
{
    if ((((savedLoc.right-savedLoc.left!=right-left)||(savedLoc.bottom-savedLoc.top!=bottom-left)))&&(!inOut)) {
        SetPosition (savedLoc.left,savedLoc.top);
        SetWindowRectangle (0,0,savedLoc.bottom-savedLoc.top, savedLoc.right-savedLoc.left);
    } else {
        Rect    sl = savedLoc;
        _HYRect sd = GetScreenDimensions();
        SetPosition (5,42);
        SetWindowRectangle (0,0, sd.bottom-25, sd.right-5);
        savedLoc = sl;
    }
}

//__________________________________________________________________

void _HYTWindow::_Deactivate(void)
{
    for (int i=0; i<components.lLength; i++)
        if (cells.Find(i)>=0) {
            ((_HYComponent*)components(i))->Deactivate();
        }

#ifdef TARGET_API_MAC_CARBON
    if (theTimer) {
        RemoveEventLoopTimer (theTimer);
        theTimer = nil;
    }
#endif
    _HYPlatformWindow::_Deactivate();
}

//__________________________________________________________________
void        _HYTWindow::_SetStatusBar(_String& text)
{
    statusBar = text;
    Rect statusRect = newHRect();
    GrafPtr savePort;
    GetPort (&savePort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort(GetWindowPort(theWindow));
    InvalWindowRect (theWindow,&statusRect);
#else
    SetPort(theWindow);
    InvalRect (&statusRect);
#endif
    SetPort (savePort);
}


//__________________________________________________________________
void        _HYPlatformTWindow::_SetWindowRectangle     (int,int,int,int,bool)
{

}


//__________________________________________________________________

bool _HYTWindow::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord* theEvent = (EventRecord*)vEvent;
    if (!_HYPlatformWindow::_ProcessOSEvent (vEvent)) {
        if ((theEvent->what==keyDown)||(theEvent->what==autoKey)) {
            if (keyboardFocusChain.lLength) {
                int keyCode = (theEvent->message&keyCodeMask)>>8;
                if (keyCode == 0x30) { // tab
                    bool    backwards = theEvent->modifiers & shiftKey;

                    if (keyboardFocus==-1) {
                        keyCode = keyboardFocusChain.lData[backwards?keyboardFocusChain.lLength-1:0];
                    } else if (keyboardFocusChain.lLength>1) {
                        keyCode = keyboardFocusChain.Find (keyboardFocus);
                        keyCode += backwards?(-1):1;
                        if (keyCode<0) {
                            keyCode = keyboardFocusChain.lLength-1;
                        } else if (keyCode >= keyboardFocusChain.lLength) {
                            keyCode = 0;
                        }
                        keyCode = keyboardFocusChain.lData[keyCode];
                    } else {
                        keyCode = -1;
                    }

                    if (keyCode>=0) {
                        ProcessEvent (generateKeyboardFocusEvent (((_HYComponent*)components(keyCode))->GetID()));
                    }
                    return true;
                }
            }

            for (long k=0; k<components.lLength; k++)
                if (cells.Find(k)>=0) {
                    _HYComponent* tC = (_HYComponent*)components(k);
                    if (tC->UnfocusedKeyboardInput())
                        if (tC->_ProcessOSEvent (vEvent)) {
                            return true;
                        }
                }

            if ((keyboardFocus>=0)&&(keyboardFocus<components.lLength))
                if (((_HYComponent*)components(keyboardFocus))->_ProcessOSEvent (vEvent)) {
                    return true;
                }

            return false;
        }
        GrafPtr savedPort;
        GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort(GetWindowPort(theWindow));
#else
        SetPort(theWindow);
#endif
        Point localClick = theEvent->where;
        GlobalToLocal (&localClick);
        int c = FindClickedCell(localClick.h,localClick.v);
        if (c<0) {
            if (lastMouseComponent>=0) {
                ((_HYComponent*)components(lastMouseComponent))->_ComponentMouseExit();
            }
            lastMouseComponent = -1;
            return false;
        } else {
            if ((lastMouseComponent>=0)&&(c!=lastMouseComponent)) {
                ((_HYComponent*)components(lastMouseComponent))->_ComponentMouseExit();
            }
            lastMouseComponent = c;
        }
        bool res = ((_HYComponent*)components(c))->_ProcessOSEvent (vEvent);
        if ((theEvent->what == osEvt)||(theEvent->what == nullEvent))
            for (long k=0; k<components.lLength; k++)
                if (cells.Find(k)>=0) {
                    _HYComponent* tC = (_HYComponent*)components(k);
                    tC->IdleHandler();
                }
        SetPort(savedPort);
        return res;
    } else {
        return true;
    }
    return false;
}

//__________________________________________________________________

void        _HYTWindow::_SetCopyString (_String* str)
{
#ifdef TARGET_API_MAC_CARBON
    ClearCurrentScrap();
    ScrapRef         theScrapRef;
    GetCurrentScrap(&theScrapRef);
    PutScrapFlavor(theScrapRef, 'TEXT', kScrapFlavorMaskNone,str->sLength,str->sData);
#else
    ZeroScrap();
    PutScrap (str->sLength,'TEXT',str->sData);
#endif
}

//__________________________________________________________________

_String*        _HYTWindow::_GetPasteString (void)
{
    Handle  scrapHandle = NewHandle (0);
    long    rc;
    _String *res = nil;

#ifdef TARGET_API_MAC_CARBON
    ScrapRef theScrapRef;
    if (GetCurrentScrap(&theScrapRef) != noErr) {
        return new _String;
    }

    if (GetScrapFlavorSize(theScrapRef, 'TEXT', &rc) != noErr) {
        return new _String;
    }
#else
    long    scrapOffset;
    rc = GetScrap( scrapHandle, 'TEXT', &scrapOffset );
#endif
    if ( rc >= 0 ) {
        SetHandleSize( scrapHandle, rc+1 );
        HLock  (scrapHandle);
#ifdef TARGET_API_MAC_CARBON
        long err = GetScrapFlavorData(theScrapRef, 'TEXT', &rc, *scrapHandle);
#endif
        (*scrapHandle)[rc] = 0;
        HUnlock (scrapHandle);
        if (err == noErr) {
            res = new _String (*scrapHandle);
        } else {
            res = new _String;
        }
    } else {
        res = new _String;
    }

    DisposeHandle (scrapHandle);
    return res;
}

//__________________________________________________________________

_HYPlatformTWindow::_HYPlatformTWindow(Ptr)
{
#ifdef TARGET_API_MAC_CARBON
    theTimer = nil;
    timerUPP = NewEventLoopTimerUPP(IdleWindowTimer);

    scrollWheelH    = NewEventHandlerUPP (scrollWheelHandler);
    checkPointer  ((Ptr)scrollWheelH);
    EventTypeSpec sw;
    sw.eventClass  = kEventClassMouse;
    sw.eventKind   = kEventMouseWheelMoved;
    InstallWindowEventHandler (((_HYTWindow*)this)->theWindow,scrollWheelH,1,&sw,(Ptr)(((_HYTWindow*)this)->theWindow),NULL);
#endif
}

//__________________________________________________________________

_HYPlatformTWindow::~_HYPlatformTWindow(void)
{
#ifdef TARGET_API_MAC_CARBON
    if (theTimer) {
        RemoveEventLoopTimer (theTimer);
    }
    DisposeEventLoopTimerUPP (timerUPP);
    if (scrollWheelH) {
        DisposeEventHandlerUPP (scrollWheelH);
    }
#endif
}




//EOF
\ No newline at end of file
diff --git a/src/gui/mac/WindowClasses/HYPlatformTreePanel.cpp b/src/gui/mac/WindowClasses/HYPlatformTreePanel.cpp
deleted file mode 100644
index a76e1df..0000000
--- a/src/gui/mac/WindowClasses/HYPlatformTreePanel.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Mac OS Portions of the tree panel class

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYTreePanel.h"
#include "HYDataPanel.h"
#include "HYUtils.h"

#include "QuickTimeComponents.h"
#include "ImageCompression.h"
#include "Scrap.h"


//__________________________________________________________________

_String                 saveForTreesPrompt          ("Save Tree As:"),
                        saveFormatsForTreesPrompt   ("File Type:");

//__________________________________________________________________

void _HYTreePanel::_DisplayBranchFloater (void)
{
    long h,v;

#ifdef  TARGET_API_MAC_CARBON
    GrafPtr thisPort = GetWindowPort(theWindow),
            savePort;
#else
    GrafPtr thisPort = (GrafPtr)theWindow,
            savePort;
#endif

    GetPort (&savePort);
    SetPort (thisPort);
    Point p = {saveMouseV,saveMouseH};

    _HYCanvas   *theTree    = (_HYCanvas*)GetObject (0);
    GlobalToLocal (&p);
    if (IsVertical()) {
        v = p.h-componentL.lData[0]+theTree->hOrigin;
        h = p.v-componentT.lData[0]+theTree->vOrigin;
    } else {
        h = p.h-componentL.lData[0]+theTree->hOrigin;
        v = p.v-componentT.lData[0]+theTree->vOrigin;
    }
    _SimpleList   saveSelection;
    saveSelection.Duplicate (&currentSelection);
    v = FindSelectedBranch (h,v);
    if (v) {
        node <nodeCoord>* thisNode = (node <nodeCoord>*) v;
        _String toolTip (thisNode->in_object.branchName);
        if (toolTip.sLength) {
            if (scaleVariable.sLength) {
                toolTip = toolTip & " (" & thisNode->in_object.bL & ')';
            }
            if (toolTip.sLength) {
                RGBColor      toolTipColor = {0xFFFF,0xBFFF,0x4000};
                PixPatHandle  toolTipPixPat = NewPixPat();
                MakeRGBPat (toolTipPixPat,&toolTipColor);
#ifdef OPAQUE_TOOLBOX_STRUCTS
                short   savedFace = GetPortTextFont (thisPort),
                        savedSize = GetPortTextSize (thisPort);

                Style   savedStyle = GetPortTextFace (thisPort);
#else
                short   savedFace = thisPort->txFont,
                        savedSize = thisPort->txSize;

                Style   savedStyle = thisPort->txFace;
#endif
                TextFont (kFontIDHelvetica);
                TextSize (9);
                TextFace (0);
                toolTipBounds.bottom = p.v;
                toolTipBounds.top = toolTipBounds.bottom - 12;
                if (toolTipBounds.top<0) {
                    toolTipBounds.top = p.v;
                    toolTipBounds.bottom = toolTipBounds.top+12;
                }
                h = GetVisibleStringWidth (toolTip);
                toolTipBounds.left = p.h;
                if (toolTipBounds.left<=0) {
                    toolTipBounds.left = 1;
                }
                toolTipBounds.right = toolTipBounds.left+h+2;
#ifdef OPAQUE_TOOLBOX_STRUCTS
                Rect portRect;
                GetPortBounds (thisPort,&portRect);
                h = toolTipBounds.right-portRect.right+portRect.left;
#else
                h = toolTipBounds.right-thisPort->portRect.right+thisPort->portRect.left;
#endif
                if (h>0) {
                    if (h>=toolTipBounds.left) {
                        h = toolTipBounds.left-1;
                    }
                    toolTipBounds.left -= h;
                    toolTipBounds.right-= h;
                }
                toolTipBounds.right += 2;
                Rect tRect = HYRect2Rect (toolTipBounds);
                RGBColor oldColor;
                GetForeColor (&oldColor);
                //toolTipColor.red = toolTipColor.blue = toolTipColor.green = 0;
                //RGBForeColor (&toolTipColor);
                //FrameRect  (&tRect);
                MoveTo (toolTipBounds.left+2,toolTipBounds.bottom-3);
                toolTipColor.red = toolTipColor.blue = toolTipColor.green = 0;
                FillCRect  (&tRect,toolTipPixPat);
                RGBForeColor (&toolTipColor);
                FrameRect (&tRect);
                DrawText (toolTip.sData,0,toolTip.sLength);
                RGBForeColor (&oldColor);
                TextFont (savedFace);
                TextSize (savedSize);
                TextFace (savedStyle);
                DisposePixPat (toolTipPixPat);
                SetPort (savePort);
            }
        }
        SetPort (savePort);
    }
}

//__________________________________________________________________

void _HYTreePanel::_HandleIdleEvent (void)
{
#ifdef TARGET_API_MAC_CARBON
    Point    curMouse;
    GetGlobalMouse (&curMouse);

    unsigned long t;
    GetDateTime(&t);


    if ((abs(curMouse.h-saveMouseH)<=3)
            &&(abs(curMouse.v-saveMouseV)<=3)
            &&(t-lastSave>.5))

    {
        if (!HasToolTip()) {
            GrafPtr curPort;
            GetPort (&curPort);
            SetPort (GetWindowPort (theWindow));
            _DisplayBranchFloater();
            SetPort (curPort);
        }

        lastSave   = t;
    }

    saveMouseH = curMouse.h;
    saveMouseV = curMouse.v;
#endif
}

//__________________________________________________________________

bool _HYTreePanel::_ProcessOSEvent (Ptr vEvent)
{
    EventRecord* theEvent = (EventRecord*)vEvent;
    static  UInt32  lastClick = 0;
    static  int     lastH = 0, lastV = 0;
//  static  long    lastSelection = -1;

    if ((theEvent->what==mouseDown)&&(theEvent->modifiers&controlKey)) {
        Point localClick = theEvent->where;
        GrafPtr savedPort;
        GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
        SetPort(GetWindowPort(theWindow));
#else
        SetPort(theWindow);
#endif
        GlobalToLocal (&localClick);
        SetPort(savedPort);
        if (FindClickedCell(localClick.h,localClick.v) == 0) {
            HandleContextPopup (theEvent->where.h, theEvent->where.v);
            return true;
        }
    }


    if(!_HYTWindow::_ProcessOSEvent (vEvent)) {
        if (theEvent->what==mouseDown) {
            Point localClick = theEvent->where;
            GrafPtr savedPort;
            GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
            SetPort(GetWindowPort(theWindow));
#else
            SetPort(theWindow);
#endif
            GlobalToLocal (&localClick);
            int   c = FindClickedCell(localClick.h,localClick.v),ch,cv;
            if (c<0) {
                return false;
            }
            _HYComponent* thisComponent = (_HYComponent*)components(c);
            if (c==1) { // navBar
                ch = localClick.h-componentL.lData[1];
                cv = localClick.v-componentT.lData[1];
                if (navRect.Contains(ch,cv)) {
                    Point   oldPt, newPt;
                    oldPt=localClick;
                    GlobalToLocal(&oldPt);
                    if (StillDown()) {
                        while (WaitMouseUp()) {
                            GetMouse( &newPt);
                            if ( DeltaPoint(oldPt, newPt) ) {
                                oldPt=newPt;
                                ch = newPt.h-componentL.lData[1];
                                cv = newPt.v-componentT.lData[1];
                                SetNavRectCenter (ch,cv);
                            }
                        }
                    }
                } else {
                    SetNavRectCenter (ch,cv);
                }
                SetPort(savedPort);
                return true;
            } else if (c==0) { // tree panel
                ch = localClick.h-componentL.lData[0];
                cv = localClick.v-componentT.lData[0];

                if ((theEvent->modifiers&cmdKey)&&(theEvent->modifiers&optionKey)) {
                    _HYCanvas   *theTree    = (_HYCanvas*)GetObject (0);
                    _HYCanvas   *viewFinder = (_HYCanvas*)GetObject (1);
                    Point oldPt = {-1,-1};

                    if (StillDown()) {
                        while (WaitMouseUp()) {
                            GetMouse(&localClick);
                            GlobalToLocal (&localClick);
                            if (DeltaPoint (oldPt,localClick)) {
                                if (IsVertical()) {
                                    cv = localClick.h-componentL.lData[0]+theTree->hOrigin;
                                    ch = localClick.v-componentT.lData[0]+theTree->vOrigin;
                                } else {
                                    ch = localClick.h-componentL.lData[0]+theTree->hOrigin;
                                    cv = localClick.v-componentT.lData[0]+theTree->vOrigin;
                                }
                                if ((ch<theTree->_HYComponent::GetMaxW())&&(cv<theTree->_HYComponent::GetMaxH())) {
                                    FishEyeProjection (ch,theTree->_HYComponent::GetMaxH()-cv,theTree->_HYComponent::GetMaxW(),
                                                       theTree->_HYComponent::GetMaxH(),coordTree);
                                    treeFlags |= HY_TREEPANEL_PROJECTION;
                                    forceUpdateForScrolling = true;
                                    RenderTree(false);
                                    forceUpdateForScrolling = false;
                                }
                            }
                            oldPt = localClick;
                        }
                        RenderNavTree();
                        viewFinder->_MarkForUpdate();
                    }
                    SetPort(savedPort);
                    return true;
                }

                char shiftFlag = ((0x0200&theEvent->modifiers)>0);
                if ((0x0800&theEvent->modifiers)>0) {
                    shiftFlag|=0x02;
                }
                if ((cmdKey&theEvent->modifiers)>0) {
                    shiftFlag|=0x04;
                }
                if (IsVertical()) {
                    c = ch;
                    ch = cv+thisComponent->vOrigin;
                    cv = c+thisComponent->hOrigin;
                } else {
                    ch+=thisComponent->hOrigin;
                    cv+=thisComponent->vOrigin;
                }
                if (theEvent->when-lastClick<GetDblTime()) {
                    if ((abs(ch-lastH)<5)&&(abs(cv-lastV)<5)&&(currentSelection.lLength))
                        if (theEvent->modifiers&cmdKey) {
                            DisplayParameterTable();
                        } else {
                            InvokeNodeEditor();
                        }
                    SetPort(savedPort);
                    return true;
                }
                lastH = ch;
                lastV = cv;
                if(FindSelection (ch,cv,shiftFlag)) {
                    _UpdateOperationsMenu();
                    RenderTree();
                }

                lastClick = theEvent->when;
            }
            SetPort(savedPort);
        } else {
            if (theEvent->what == keyDown) {
                unsigned char keyCode = (theEvent->message&keyCodeMask)>>8;

                if (currentSelection.lLength) {
                    if ((keyCode == 0x33)||(keyCode == 0x75)) { // delete
                        DeleteCurrentSelection();
                        _UpdateOperationsMenu();
                        return true;
                    } else if ((keyCode == 0x4C)||(keyCode == 0x24)) { // return
                        InvokeNodeEditor ();
                        _UpdateOperationsMenu();
                        return true;
                    }
                }
            } else if (theEvent->what == osEvt) {
                unsigned long t;
                GetDateTime(&t);
#ifndef TARGET_API_MAC_CARBON
                if ((abs(theEvent->where.h-saveMouseH)<=3)
                        &&(abs(theEvent->where.v-saveMouseV)<=3)) {
                    if ((t-lastSave>=1)&&(!toolTipBounds.left)) {
                        lastSave = t;
                        _DisplayBranchFloater ();
                        return true;

                    }
                    lastSave = t;
                } else
#endif
                {
                    if (toolTipBounds.left) {
                        Rect     tRect;
                        tRect = HYRect2Rect (toolTipBounds);
#ifdef OPAQUE_TOOLBOX_STRUCTS
                        InvalWindowRect (theWindow,&tRect);
#else
                        InvalRect (&tRect);
#endif
                        toolTipBounds.left = 0;
                    }
                    saveMouseH = theEvent->where.h;
                    saveMouseV = theEvent->where.v;
                    lastSave = t;
                }
                return true;
            }
        }
        return false;
    }
    return true;
}


//__________________________________________________________________

bool        _HYTreePanel::_ProcessMenuSelection (long msel)
{
    if (_HYWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    long        menuChoice = msel&0x0000ffff;
    MenuHandle  treeMenu;
    _String     prompt;

    switch (msel/0xffff) {
    case 129: { // file menu
        if (menuChoice==4) { // save
            _String           filePath;
            _List             saveFormatsForTrees;

            long pidOptions = GetUniversalSaveOptions (saveFormatsForTrees)+1;

            InitializeQTExporters ();
            saveFormatsForTrees&& & menuSeparator;
            saveFormatsForTrees << graphicsFormats;

            menuChoice = SaveFileWithPopUp (filePath, saveForTreesPrompt,treeName,
                                            saveFormatsForTreesPrompt,saveFormatsForTrees);
            if (menuChoice>=0) {
                _HYCanvas   *theTree = (_HYCanvas*)GetObject (0);
                Str255 buff;
                {
                    if (menuChoice <  pidOptions) {
                        HandleTreeSave (menuChoice, filePath);
                    } else {
                        menuChoice -= pidOptions;
                        ComponentInstance grexc = OpenComponent ((Component)qtGrexComponents(menuChoice));
                        GWorldPtr         comboGW = nil;
                        if (scaleVariable.sLength&&(!IsVertical())) {
                            Rect  bRect, sRect;
                            bRect.left = bRect.top = 0;
                            bRect.right = theTree->_HYComponent::GetMaxW();
                            bRect.bottom = theTree->_HYComponent::GetMaxH()+HY_TREEPANEL_RULER_EXPANDED;
                            short errCode = NewGWorld (&comboGW,2,&bRect,0,nil,0);
                            if (errCode!=noErr) {
                                _String errMsg ("MacOS Error ");
                                errMsg = errMsg & (long)errCode &" while trying to allocate memory for GraphicPane";
                                WarnError (errMsg);
                                return true;
                            }
                            sRect = bRect;
                            sRect.bottom -= HY_TREEPANEL_RULER_EXPANDED;
                            bRect.top = HY_TREEPANEL_RULER_EXPANDED;
                            LockPixels (GetGWorldPixMap(theTree->thePane));
                            CopyBits ((BitMap*)*GetGWorldPixMap(theTree->thePane),(BitMap*)*GetGWorldPixMap(comboGW),&sRect,&bRect,srcCopy,(RgnHandle)nil);
                            UnlockPixels (GetGWorldPixMap(theTree->thePane));
                            bRect.bottom = bRect.top;
                            bRect.top = 0;
                            sRect.bottom = HY_TREEPANEL_RULER_EXPANDED-1;
                            _HYCanvas   *theRuler = (_HYCanvas*)GetObject (2);
                            LockPixels (GetGWorldPixMap(theRuler->thePane));
                            CopyBits ((BitMap*)*GetGWorldPixMap(theRuler->thePane),(BitMap*)*GetGWorldPixMap(comboGW),&sRect,&bRect,srcCopy,(RgnHandle)nil);
                            UnlockPixels (GetGWorldPixMap(theRuler->thePane));
                            GraphicsExportSetInputGWorld (grexc,comboGW);

                        } else {
                            GraphicsExportSetInputGWorld (grexc,theTree->thePane);
                        }
                        FSSpec  fs;
                        StringToStr255 (filePath,buff);
                        FSMakeFSSpec(0,0,buff,&fs);
                        GraphicsExportSetOutputFile (grexc,&fs);
                        GraphicsExportRequestSettings (grexc,nil,nil);
                        unsigned long dummy;
                        OSType t,c;
                        GraphicsExportGetDefaultFileTypeAndCreator (grexc,&t,&c);
                        GraphicsExportSetOutputFileTypeAndCreator (grexc,t,c);
                        GraphicsExportDoExport (grexc,&dummy);
                        CloseComponent (grexc);
                        if (comboGW) {
                            DisposeGWorld (comboGW);
                        }
                    }
                }
            }
            return true;
        }
        if (menuChoice==8) { // print
            _PrintTree();
            return true;
        }
        break;
    }
    case 130: { // edit
        HiliteMenu(0);
        if (menuChoice==4) { // copy
            if (treeFlags&HY_TREEPANEL_CLIPBOARD_READY) {
                CutSelectionToClipboard (false);
            } else {
#ifdef TARGET_API_MAC_CARBON
                ClearCurrentScrap();
#else
                ZeroScrap();
#endif
                //_String res = GetTreeString();
                //PutScrap (res.sLength,'TEXT',res.sData);
                _HYCanvas   *theTree = (_HYCanvas*)GetObject (0);
                Rect  bRect;
                if (scaleVariable.sLength&&(!IsVertical())) { // have ruler
                    _HYCanvas   *theRuler = (_HYCanvas*)GetObject (2);
                    Rect        bRect2;
                    bRect.left          = bRect.top = 0;
                    bRect.right         = theTree->_HYComponent::GetMaxW();
                    bRect.bottom        = theTree->_HYComponent::GetMaxH();
                    bRect2              = bRect;
                    bRect2.bottom       += theRuler->_HYComponent::GetMaxH();
                    PicHandle    pic    = OpenPicture (&bRect2);

                    /*bRect2.top            = theRuler->_HYComponent::GetMaxH();
                    GrafPtr      topPort;
                    GetPort      (&topPort);

                    LockPixels (GetGWorldPixMap(theTree->thePane));
                    CopyBits ((BitMap*)*GetGWorldPixMap(theTree->thePane),
                              (BitMap*)&(topPort->portBits),&bRect,&bRect2,
                                   srcCopy,(RgnHandle)nil);

                    UnlockPixels (GetGWorldPixMap(theTree->thePane));
                    bRect.bottom = bRect2.top;
                    bRect2.top = 0;
                    bRect2.bottom = bRect.bottom;

                    LockPixels (GetGWorldPixMap(theRuler->thePane));
                    CopyBits ((BitMap*)*GetGWorldPixMap(theRuler->thePane),
                              (BitMap*)&(topPort->portBits),&bRect,&bRect2,
                                   srcCopy,(RgnHandle)nil);
                    UnlockPixels (GetGWorldPixMap(theRuler->thePane));*/

                    ShiftScreenCoordinates (0,theRuler->_HYComponent::GetMaxH(),coordTree);
                    RenderTree (false,true);
                    ShiftScreenCoordinates (0,-theRuler->_HYComponent::GetMaxH(),coordTree);

                    ClosePicture ();
                    HLock   ((Handle)pic);
#ifdef TARGET_API_MAC_CARBON
                    ClearCurrentScrap();
                    ScrapRef         theScrapRef;
                    GetCurrentScrap(&theScrapRef);
                    PutScrapFlavor(theScrapRef, 'PICT', kScrapFlavorMaskNone,GetHandleSize((Handle)pic),*pic);
#else
                    PutScrap (GetHandleSize((Handle)pic),'PICT',*pic);
#endif
                    KillPicture (pic);

                } else {
                    bRect.left = bRect.top = 0;
                    bRect.right = theTree->_HYComponent::GetMaxW();
                    bRect.bottom = theTree->_HYComponent::GetMaxH();
                    PicHandle    pic = OpenPicture (&bRect);
                    GrafPtr      topPort;
                    GetPort      (&topPort);

                    RenderTree  (true,true);
                    /*LockPixels (GetGWorldPixMap(theTree->thePane));
                    CopyBits ((BitMap*)*GetGWorldPixMap(theTree->thePane),
                              (BitMap*)&(topPort->portBits),&bRect,&bRect,
                                   srcCopy,(RgnHandle)nil);
                    UnlockPixels (GetGWorldPixMap(theTree->thePane));*/
                    ClosePicture ();
                    HLock   ((Handle)pic);
#ifdef TARGET_API_MAC_CARBON
                    ClearCurrentScrap();
                    ScrapRef         theScrapRef;
                    GetCurrentScrap(&theScrapRef);
                    PutScrapFlavor(theScrapRef, 'PICT', kScrapFlavorMaskNone,GetHandleSize((Handle)pic),*pic);
#else
                    PutScrap (GetHandleSize((Handle)pic),'PICT',*pic);
#endif
                    KillPicture (pic);
                }
            }
            return true;
        } else if (menuChoice==6) { // delete selection
            DeleteCurrentSelection();
            _UpdateOperationsMenu();
            return true;
        } else if (menuChoice==3) { // cut selection
            CutSelectionToClipboard ();
            _UpdateOperationsMenu();
            return true;
        } else if (menuChoice==5) { // paste selection
            PasteClipboardTree();
            _UpdateOperationsMenu();
            return true;
        } else if (menuChoice==8) { // select all
            SelectAllBranches();
            return true;
        }
        if (menuChoice==1) { // undo
            UndoLastOperation();
            _UpdateOperationsMenu();
            return true;
        } else if (menuChoice==11) { // s&r
            HandleSearchAndReplace(false);
            return true;
        } else if (menuChoice==12) { // s&r in selection
            HandleSearchAndReplace(true);
            return true;
        }
        return false;
    }
    case HY_TREEPANEL_MENU_ID: {
        treeMenu = GetMenuHandle (HY_TREEPANEL_MENU_ID);
        switch (menuChoice) {
            unsigned short newF;
        case 1:
            if (treeFlags&HY_TREEPANEL_TIP_LABELS) {
                newF = treeFlags - HY_TREEPANEL_TIP_LABELS;
                SetFlags (newF);
            } else {
                newF = treeFlags + HY_TREEPANEL_TIP_LABELS;
                SetFlags (newF);
            }
            CheckMenuItem (treeMenu,1,(treeFlags&HY_TREEPANEL_TIP_LABELS));
            break;

        case 2:
            if (treeFlags&HY_TREEPANEL_INT_LABELS) {
                newF = treeFlags - HY_TREEPANEL_INT_LABELS;
                SetFlags (newF);
            } else {
                newF = treeFlags + HY_TREEPANEL_INT_LABELS;
                SetFlags (newF);
            }
            CheckMenuItem (treeMenu,2,(treeFlags&HY_TREEPANEL_INT_LABELS));
            break;

        case 4: { // SWAP SUBTREES
            SwapSelectedSubTrees();
            break;
        }

        case 5: { // COLLAPSE BRANCH
            CollapseSelectedBranch ();
            break;
        }

        case 6: { // COLLAPSE BRANCH
            JoinSelectedBranches();
            break;
        }

        case 7: { // Graft A Tip
            GraftATip();
            break;
        }

        case 8: { // Reroot Tree
            RerootTree();
            break;
        }

        case 9: { // Flip tree
            FlipSelectedBranches();
            break;
        }

        case 13: { // Invoke node editor
            InvokeNodeEditor();
            break;
        }

        case 15: { // Optimize again
            RecalculateLikelihood();
            break;
        }

        case 16: { // Display Parameter Table
            DisplayParameterTable();
            break;
        }

        case 18: {
            HandleViewOptions ();
            break;
        }

        case 21:
        case 22: {
            ShowModelMatrix (menuChoice-21);
            break;
        }

        case 24:
        case 25: {
            GenerateDistanceTable (menuChoice-24);
            break;
        }

        case 28: {
            MatchToDataSet ();
            break;
        }

        }
        if ((menuChoice>2)&&(menuChoice<15)) {
            _UpdateOperationsMenu();
        }
        break;
    }
    case HY_TREEPANEL_HMENU_ID: { // edit
        HandleLabels(menuChoice-1);
        break;
    }
    case HY_TREEPANEL_HMENU_ID+1: { // select
        HandleSelection (menuChoice-1);
        _UpdateOperationsMenu();
        break;
    }
    case HY_TREEPANEL_HMENU_ID+2: { // compare
        HandleComparison (menuChoice-1);
        _UpdateOperationsMenu();
        break;
    }
    case HY_TREEPANEL_HMENU_ID+3: { // compare
        ExecuteProcessor (menuChoice-1);
        _UpdateOperationsMenu();
        break;
    }

    }

    HiliteMenu(0);
    InvalMenuBar();
    return false;
}

//__________________________________________________________________

void        _HYTreePanel::_PaintNavRect(void)
{
    navRect = ComputeNavRect();
    _HYCanvas* theCanvas = (_HYCanvas*)GetObject (1);
    GrafPtr savedPort;
    GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort(GetWindowPort(theWindow));
#else
    SetPort(theWindow);
#endif
    Rect r;
    r.left = navRect.left+theCanvas->rel.left+HY_TREEPANEL_NAVSPACING;
    r.right = navRect.right+theCanvas->rel.left;
    r.top = navRect.top+theCanvas->rel.top+HY_TREEPANEL_NAVSPACING;
    r.bottom = navRect.bottom+theCanvas->rel.top;
    RGBColor saveColor, newColor = {255*256,151*256,51*256};
    PenState ps;
    GetPenState (&ps);
    PenSize (2,2);
    GetForeColor (&saveColor);
    RGBForeColor (&newColor);
    FrameRect (&r);
    _PaintLFStatus ();
    RGBForeColor (&saveColor);
    SetPenState (&ps);
    SetPort(savedPort);
}

//__________________________________________________________________

void        _HYTreePanel::_PaintLFStatus(Ptr)
{
    GrafPtr savedPort;
    GetPort(&savedPort);
#ifdef OPAQUE_TOOLBOX_STRUCTS
    SetPort(GetWindowPort(theWindow));
#else
    SetPort(theWindow);
#endif
    if (likeFuncID<0) {
        _PaintTheCircle (redButtonIcon,theWindow);
    } else {
        if (dubiousNodes.lLength) {
            _PaintTheCircle (yellowButtonIcon,theWindow);
        } else {
            _PaintTheCircle (greenButtonIcon,theWindow);
        }
    }
    SetPort(savedPort);
}

//__________________________________________________________________

void        _HYTreePanel::_PrintTree(long hPages, long vPages)
{
    if ((hPages<0)||(vPages<0)) {
        if (!TreePrintSetup (hPages, vPages, (Ptr)this)) {
            return;
        }
    }

    _HYCanvas* theCanvas = (_HYCanvas*)GetObject (0);

    GrafPtr     savePort;
    GetPort(&savePort);
#ifdef      TARGET_API_MAC_CARBON
    PMRect prRect;
#else
    TPrStatus   prStatus;
    TPPrPort    printPort;
    OSErr       err;
#endif

#ifdef TARGET_API_MAC_CARBON
    OSStatus theStatus;
    Boolean isAccepted;

    PMPrintSession hyPC;
    theStatus = PMCreateSession(&hyPC);
    if (theStatus != noErr) {
        return;
    }

#endif

    if (!InitPrint(hyPC)) {
        _String errMsg ("Could not initialize printing variables.");
        WarnError (errMsg);
        terminateExecution = false;
        return;
    }

    //GetPort(&savePort);

#ifdef TARGET_API_MAC_CARBON
    if (gPrintSettings != kPMNoPrintSettings) {
        theStatus = PMSessionValidatePrintSettings(hyPC,gPrintSettings, kPMDontWantBoolean);
    } else {
        theStatus = PMCreatePrintSettings(&gPrintSettings);

        if ((theStatus == noErr) && (gPrintSettings != kPMNoPrintSettings)) {
            theStatus = PMSessionDefaultPrintSettings(hyPC,gPrintSettings);
        }
    }

    if (theStatus == noErr) {
        theStatus = PMSessionPrintDialog(hyPC,gPrintSettings, gPageFormat, &isAccepted);

        if (isAccepted) {
            theStatus = PMGetAdjustedPageRect(gPageFormat, &prRect);
            if (theStatus != noErr) {
                PMRelease(hyPC);
                return;
            }

            theStatus = PMSessionBeginDocument(hyPC,gPrintSettings, gPageFormat);
            if (theStatus != noErr) {
                PMRelease(hyPC);
                return;
            }

            //GrafPtr  prPortGPTR;
            //PMGetGrafPtr (thePrintingPort,&prPortGPTR);

            long     pageW    = prRect.right-prRect.left-2,
                     pageH    = prRect.bottom-prRect.top-2;

            UInt32   startPage,
                     endPage;

            //SetPort (prPortGPTR);

            PMGetFirstPage (gPrintSettings,&startPage);
            PMGetLastPage  (gPrintSettings,&endPage);
#else
    PrOpen();
    if (err=PrError()) {
        _String errMsg ("Could not print the tree. Error Code:");
        errMsg = errMsg & (long)err;
        WarnError (errMsg);
        terminateExecution = false;
        {
            PrClose();
            return;
        }
    }

    if (PrJobDialog(prRecHdl)) {
        printPort = PrOpenDoc(prRecHdl, nil, nil);
        SetPort((GrafPtr)printPort);
        long    startPage = (*prRecHdl)->prJob.iFstPage,
                endPage = (*prRecHdl)->prJob.iLstPage,
                pageW = (*prRecHdl)->prInfo.rPage.right-2;
        pageH = (*prRecHdl)->prInfo.rPage.bottom-2;
#endif

            long    visW    = theCanvas->_HYComponent::GetMaxW(),
                    visH  = theCanvas->_HYComponent::GetMaxH(),
                    printW  = pageW * hPages,
                    printH  = pageH * vPages;

            if (hPages <= 0) {
                hPages = visW/pageW;
                if (visW%pageW == 0) {
                    hPages ++;
                }

                printW= pageW * hPages;
            }

            if (vPages <= 0) {
                vPages = visH/pageH;
                if (visH%pageH == 0) {
                    vPages ++;
                }

                printH = pageH * vPages;
            }

            bool    hasRuler = (scaleVariable.sLength)&&(!IsVertical());

            _HYFont oldFont  = treeLabelFont,
                    bf1      = branchLabel1,
                    bf2       = branchLabel2;

            _Parameter hsc   = 1.0,
                       vsc   = 1.0;

            if (visW>printW) {
                hsc = (_Parameter)printW/visW;
            }
            if (hasRuler) {
                printH -= HY_TREEPANEL_RULER_EXPANDED;
            }
            if (visH>printH) {
                vsc = (_Parameter)printH/visH;
            }

            if ((hsc<1.0)||(vsc<1.0)) {
                treeLabelFont.size = ((_Parameter)treeLabelFont.size)*MIN(hsc,vsc);
                if (treeLabelFont.size<4) {
                    treeLabelFont.size = 4;
                }

                bf1.size = ((_Parameter)bf1.size)*MIN(hsc,vsc);
                bf2.size = ((_Parameter)bf2.size)*MIN(hsc,vsc);
                ShiftScreenCoordinates  (-windowTextMarginH,-windowTextMarginV,coordTree);
                Convert2ScreenCoordinates (hsc,vsc,0,coordTree);
            }
            if (visW<printW) {
                visW = (printW-visW)/2;
            } else {
                visW = 0;
            }

            if (visH<printH) {
                visH = (printH-visH)/2;
            } else {
                visH = 0;
            }

            if (IsVertical()) {
                long t = visH;
                visH = visW;
                visW = t;
            }

            //theCanvas->SetFont (treeLabelFont);

            for (long hCount = 0; hCount < hPages; hCount ++)
                for (long vCount = 0; vCount < vPages; vCount ++) {
#ifdef TARGET_API_MAC_CARBON
                    theStatus = PMSessionBeginPage(hyPC,gPageFormat,NULL);
                    if (theStatus != noErr) {
                        PMRelease(hyPC);
                        return;
                    }
                    GrafPtr ppPort;
                    PMSessionGetGraphicsContext (hyPC, NULL, (void**)&ppPort);
                    SetPort (ppPort);
#else
                    PrOpenPage      (printPort, nil);
#endif


                    if (visH||visW) {
                        ShiftScreenCoordinates  (visW,hasRuler?visH+HY_TREEPANEL_RULER_EXPANDED-5:visH,coordTree);
                    } else if (hasRuler&&(vCount==0)) {
                        ShiftScreenCoordinates  (0,HY_TREEPANEL_RULER_EXPANDED-5,coordTree);
                    }

                    if (hCount||vCount) {
                        ShiftScreenCoordinates  (-pageW*hCount,-pageH*vCount, coordTree);
                    }


                    if (hasRuler && (vCount == 0)) {
                        RenderRuler (hsc,true,visW,visH);
                    }

                    theCanvas->SetFont (treeLabelFont);

                    if (treeFlags&HY_TREEPANEL_ARCS) {
                        PaintArcs(theCanvas, coordTree);
                    } else if (treeFlags&(HY_TREEPANEL_STRAIGHT|HY_TREEPANEL_CIRCULAR)) {
                        PaintStraight(theCanvas, coordTree);
                    } else {
                        if (IsVertical()) {
                            PaintVSquare(theCanvas, coordTree);
                        } else {
                            PaintSquare(theCanvas, coordTree);
                            if (treeFlags&HY_TREEPANEL_LABEL1) {
                                theCanvas->SetFont(bf1);
                                PaintSquareBranchLabels (theCanvas,coordTree,true);
                            }
                            if (treeFlags&HY_TREEPANEL_LABEL2) {
                                theCanvas->SetFont(bf2);
                                PaintSquareBranchLabels (theCanvas,coordTree,false);
                            }
                        }
                    }

                    if (visH||visW) {
                        ShiftScreenCoordinates  (-visW,hasRuler?-visH-HY_TREEPANEL_RULER_EXPANDED+5:-visH,coordTree);
                    } else if (hasRuler&&(vCount==0)) {
                        ShiftScreenCoordinates  (0,-HY_TREEPANEL_RULER_EXPANDED+5,coordTree);
                    }

                    if (hCount||vCount) {
                        ShiftScreenCoordinates  (pageW*hCount, pageH*vCount,coordTree);
                    }

#ifdef TARGET_API_MAC_CARBON
                    PMSessionEndPage(hyPC);
#else
                    PrClosePage(printPort);
#endif

                }

            if ((hsc<1.0)||(vsc<1.0)) {
                ShiftScreenCoordinates  (-windowTextMarginH,-windowTextMarginV,coordTree);
                Convert2ScreenCoordinates (1.0/hsc,1.0/vsc,0,coordTree);
            }

            treeLabelFont = oldFont;
            theCanvas->SetFont (treeLabelFont);


#ifdef TARGET_API_MAC_CARBON
            theStatus = PMSessionEndDocument(hyPC);
            SetPort(savePort);
            if (theStatus == noErr) {
                if (gFlattenedFormat != NULL) {
                    DisposeHandle(gFlattenedFormat);
                    gFlattenedFormat = NULL;
                }

                theStatus = PMFlattenPageFormat(gPageFormat, &gFlattenedFormat);
            }

            if (theStatus == noErr) {
                if (gFlattenedSettings != NULL) {
                    DisposeHandle(gFlattenedSettings);
                    gFlattenedSettings = NULL;
                }

                theStatus = PMFlattenPrintSettings(gPrintSettings, &gFlattenedSettings);
            }

            if (gPageFormat != kPMNoPageFormat) {
                theStatus = PMRelease(gPageFormat);
                gPageFormat = kPMNoPageFormat;
            }

            if (gPrintSettings != kPMNoPrintSettings) {
                theStatus = PMRelease(gPrintSettings);
                gPrintSettings = kPMNoPrintSettings;
            }

            theStatus = PMRelease(hyPC);

#else
            PrCloseDoc(printPort);
            if (((*prRecHdl)->prJob.bJDocLoop = bSpoolLoop) && (!PrError() ) ) {
                PrPicFile(prRecHdl, nil, nil, nil, &prStatus);
            }
#endif
        }
#ifdef TARGET_API_MAC_CARBON
        else {
            theStatus = PMRelease(hyPC);
        }
#endif

#ifdef TARGET_API_MAC_CARBON
    }
#else
        PrClose();
        SetPort(savePort);
#endif
}

//__________________________________________________________________

void _HYTreePanel::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();
    MenuHandle  t = GetMenuHandle (130);
    EnableMenuItem (t,4);
    EnableMenuItem (t,8);


    MenuHandle treeMenu = GetMenuHandle (HY_TREEPANEL_MENU_ID);
    if (!treeMenu) {
        MenuHandle labelMenu  = NewMenu(HY_TREEPANEL_HMENU_ID,"\pLabels");
        MenuHandle selectMenu = NewMenu(HY_TREEPANEL_HMENU_ID+1,"\pSelect Branches");
        MenuHandle compMenu   = NewMenu(HY_TREEPANEL_HMENU_ID+2,"\pTree comparison");
        MenuHandle procMenu   = NewMenu(HY_TREEPANEL_HMENU_ID+3,"\pAdditional Tools");

        treeMenu = NewMenu(HY_TREEPANEL_MENU_ID,"\pTree");

        if (!(treeMenu&&selectMenu&&labelMenu&&compMenu)) {
            warnError (-108);
        }

        InsertMenuItem (treeMenu,"\pInternal Labels",0);        // 1
        InsertMenuItem (treeMenu,"\pTip Labels",0);             // 2
        CheckMenuItem (treeMenu,1,treeFlags&HY_TREEPANEL_TIP_LABELS);
        CheckMenuItem (treeMenu,2,treeFlags&HY_TREEPANEL_INT_LABELS);
        InsertMenuItem (treeMenu,"\p(-",1000);                  // 3
        InsertMenuItem (treeMenu,"\p(Swap Subtrees/1",1000);    // 4
        InsertMenuItem (treeMenu,"\p(Collapse Branch/2",1000);  // 5
        InsertMenuItem (treeMenu,"\p(Join/3",1000);             // 6
        InsertMenuItem (treeMenu,"\p(Graft A Tip/4",1000);      // 7
        InsertMenuItem (treeMenu,"\p(Reroot/5",1000);           // 8
        InsertMenuItem (treeMenu,"\p(Flip tip ordering/6",1000);// 9
        InsertMenuItem (treeMenu,"\p(-",1000);                  // 10
        InsertMenuItem (treeMenu,"\pSelect Branches",1000);     // 11
        InsertMenuItem (treeMenu,"\p(-",1000);                  // 12
        InsertMenuItem (treeMenu,"\pEdit Properties",1000);     // 13
        InsertMenuItem (treeMenu,"\p(-",1000);                  // 14
        InsertMenuItem (treeMenu,"\p(Optimize Again/T",1000);   // 15
        InsertMenuItem (treeMenu,"\p(Show Parameters in Table/H",1000); // 16
        InsertMenuItem (treeMenu,"\p(-",1000);                         // 17
        InsertMenuItem (treeMenu,"\pTree Display Options...",1000);    // 18
        InsertMenuItem (treeMenu,"\pBranch Labels",1000);              // 19
        InsertMenuItem (treeMenu,"\p(-",1000);                         // 20
        InsertMenuItem (treeMenu,"\p(Show Rate Matrix",1000);          // 21
        InsertMenuItem (treeMenu,"\p(Show Transition Matrix",1000);    // 22
        InsertMenuItem (treeMenu,"\p(-",1000);                         // 23
        InsertMenuItem (treeMenu,"\pPairwise Distances",1000);         // 24
        InsertMenuItem (treeMenu,"\pBranch Length Distribution",1000); // 25

        InsertMenuItem (treeMenu,"\p(-",1000);                         // 26
        InsertMenuItem (treeMenu,"\pTree Comparison",1000);            // 27
        InsertMenuItem (treeMenu,"\pMatch Leaves To Sequence Data",1000); // 28

        InsertMenuItem (treeMenu,"\p(-",1000); // 29
        InsertMenuItem (treeMenu,"\pAdditional Tools",1000); // 30

        InsertMenu      (procMenu,hierMenu);


        InsertMenuItem (labelMenu,"\pAbove Branches.../8",1000);
        InsertMenuItem (labelMenu,"\pBelow Branches.../9",1000);

        InsertMenuItem (selectMenu,"\p(Select Entire Subtree",1000);
        InsertMenuItem (selectMenu,"\pSelect Incomplete Branches/I",1000);
        InsertMenuItem (selectMenu,"\pSelect Branches Without Models",1000);
        InsertMenuItem (selectMenu,"\pSelect Branches By Name",1000);
        InsertMenuItem (selectMenu,"\pSelect Branches By Branch Length",1000);
        InsertMenuItem (selectMenu,"\pInvert Selection",1000);
        InsertMenuItem (selectMenu,"\pExtend Selection",1000);
        InsertMenuItem (selectMenu,"\pMap Selection to Data Panel",1000);
        InsertMenuItem (selectMenu,"\pMap Selection to Another Tree",1000);

        InsertMenuItem (compMenu,"\pTest For Equality",1000);
        InsertMenuItem (compMenu,"\pFind Subtree In Another Tree",1000);
        InsertMenuItem (compMenu,"\pFind Maximal Common Subtree",1000);
        InsertMenuItem (compMenu,"\pFind Maximal Common Forest",1000);
        InsertMenuItem (compMenu,"\pMatch To Tree Pattern",1000);

        InsertMenu (selectMenu,hierMenu);
        InsertMenu (labelMenu, hierMenu);
        InsertMenu (compMenu, hierMenu);

        SetItemCmd (treeMenu,19,hMenuCmd);
        SetItemMark(treeMenu,19,HY_TREEPANEL_HMENU_ID);

        SetItemCmd (treeMenu,11,hMenuCmd);
        SetItemMark(treeMenu,11,HY_TREEPANEL_HMENU_ID+1);

        SetItemCmd (treeMenu,27,hMenuCmd);
        SetItemMark(treeMenu,27,HY_TREEPANEL_HMENU_ID+2);

        SetItemCmd (treeMenu,30,hMenuCmd);
        SetItemMark(treeMenu,30,HY_TREEPANEL_HMENU_ID+3);

        InsertMenu (treeMenu,132);
        t = GetMenuHandle (129);
        EnableMenuItem (t,1);

        t = GetMenuHandle (130);
        InsertMenuItem (t,"\p(-",1000);                              // 10
        InsertMenuItem (t,"\pSearch and Replace/F",1000);            // 11
        InsertMenuItem (t,"\pSearch and Replace in Selection",1000); // 12

        if (treeProcessors.lLength == 0) {
            DisableMenuItem (treeMenu,30);
        } else {
            Str255    buffer;
            for (long k=0; k<treeProcessors.lLength; k++) {
                _String *thisItem = (_String*)treeProcessors (k),
                         chopped = thisItem->Cut (thisItem->FindBackwards (':',0,-1)+1,-1);
                StringToStr255  (chopped,buffer);
                InsertMenuItem  (procMenu, buffer,10000);
            }
        }

    }
    _UpdateOperationsMenu();
    InvalMenuBar();
}

//__________________________________________________________________

void _HYTreePanel::_UpdateOperationsMenu (void)
{
    node<nodeCoord>* node1, *node2, *t;

    MenuHandle      treeMenu   = GetMenuHandle (HY_TREEPANEL_MENU_ID),
                    selectMenu = GetMenuHandle (HY_TREEPANEL_HMENU_ID+1),
                    compMenu   = GetMenuHandle (HY_TREEPANEL_HMENU_ID+2),
                    editMenu   = GetMenuHandle (130);

    DisableMenuItem (treeMenu,4);
    DisableMenuItem (treeMenu,5);
    DisableMenuItem (treeMenu,6);
    DisableMenuItem (treeMenu,7);
    DisableMenuItem (treeMenu,8);
    DisableMenuItem (treeMenu,9);
    //DisableMenuItem (treeMenu,12);
    DisableMenuItem (treeMenu,13);
    DisableMenuItem (treeMenu,21);
    DisableMenuItem (treeMenu,22);
    DisableMenuItem (editMenu,6);
    DisableMenuItem (editMenu,12);


    DisableMenuItem (selectMenu,1);
    DisableMenuItem (selectMenu,7);
    DisableMenuItem (selectMenu,8);
    DisableMenuItem (selectMenu,9);

    DisableMenuItem (compMenu,2);

    bool  good = true;
    long  k,j;
    if (currentSelection.lLength==2) {
        node1 = (node<nodeCoord>*)currentSelection(0);
        node2 = (node<nodeCoord>*)currentSelection(1);
        t = node1->parent;
        while (t) {
            if (t==node2) {
                good = false;
                break;
            }
            t = t->parent;
        }
        if (good) {
            t = node2->parent;
            while (t) {
                if (t==node1) {
                    good = false;
                    break;
                }
                t = t->parent;
            }
        }
        if (good) {
            EnableMenuItem (treeMenu,4);
        }
    }
    if (currentSelection.lLength) {
        EnableMenuItem (treeMenu,7);
        EnableMenuItem (treeMenu,13);
        EnableMenuItem (selectMenu,7);
        EnableMenuItem (selectMenu,8);
        EnableMenuItem (selectMenu,9);
        EnableMenuItem (editMenu,12);
        for (k=0; k<currentSelection.lLength; k++) {
            node1 = (node<nodeCoord>*)currentSelection(k);
            if (node1->get_num_nodes()) {
                EnableMenuItem (treeMenu,5);
                break;
            }
        }
        for (k=0; k<currentSelection.lLength; k++) {
            node1 = (node<nodeCoord>*)currentSelection(k);
            if (!node1->get_num_nodes()) {
                EnableMenuItem (editMenu,6);
                break;
            }
        }
        if (currentSelection.lLength>=2) {
            node1 = (node<nodeCoord>*)currentSelection(0);
            t = node1->parent;
            if (t&&(t->get_num_nodes()>currentSelection.lLength)) {
                for (k=1; k<currentSelection.lLength; k++) {
                    node1 = (node<nodeCoord>*)currentSelection(k);
                    if (node1->parent!=t) {
                        break;
                    }
                }
                if (k==currentSelection.lLength) {
                    EnableMenuItem (treeMenu,6);
                }
            }
        } else {
            node1 = (node<nodeCoord>*)currentSelection(0);
            if (node1->parent) {
                EnableMenuItem(treeMenu,8);
                SetMenuItemText (treeMenu,8,"\pReroot");
            }
            if (node1->get_num_nodes()>0) {
                EnableMenuItem(treeMenu,9);
                EnableMenuItem(selectMenu,1);
            }
            if (node1->in_object.varRef>=0) {
                _CalcNode* thisCNode = (_CalcNode*)LocateVar(node1->in_object.varRef);

                if (thisCNode&&(thisCNode->GetModelIndex() != HY_NO_MODEL)) {
                    EnableMenuItem (treeMenu,21);
                    EnableMenuItem (treeMenu,22);
                }
            }
        }
    } else {
        _TheTree *me = LocateMyTreeVariable();
        if (me) {
            if (me->RootedFlag()==UNROOTED) {
                EnableMenuItem(treeMenu,8);
                SetMenuItemText (treeMenu,8,"\pBalance");
            } else {
                EnableMenuItem(treeMenu,8);
                SetMenuItemText (treeMenu,8,"\pUnroot");
            }
        }
    }
    if (likeFuncID!=-1) {
        EnableMenuItem (treeMenu,15);
        EnableMenuItem (treeMenu,16);
    } else {
        DisableMenuItem (treeMenu,15);
        DisableMenuItem (treeMenu,16);
    }

    treeMenu = GetMenuHandle(130);
    if ((treePanelClipboardRoot)&&(currentSelection.lLength==1)) {
        EnableMenuItem (treeMenu,5);
    } else {
        DisableMenuItem(treeMenu,5);
    }

    DisableMenuItem(treeMenu,3);
    // check if can cut/paste
    t = nil;

    for (k=0; k<currentSelection.lLength; k++) {
        node1 = (node<nodeCoord>*)currentSelection.lData[k];
        if (node1->parent) {
            if (currentSelection.Find((long)node1->parent)<0) {
                if (t) {
                    break;
                } else {
                    t = node1;
                }
            }
            for (j=0; j<node1->nodes.length; j++) {
                if (currentSelection.Find((long)node1->nodes.data[j])<0) {
                    break;
                }
            }
            if (j<node1->nodes.length) {
                break;
            }
        } else {
            if (t) {
                break;
            } else {
                t = node1;
            }
        }
    }
    selectionTop = nil;
    treeFlags &= 0xFF7F;
    if (t&&(t->parent!=coordTree)&&(t->parent)) {
        if (k==currentSelection.lLength) {
            EnableMenuItem(treeMenu,3);
            EnableMenuItem(compMenu,2);

            selectionTop = t;
            treeFlags |= HY_TREEPANEL_CLIPBOARD_READY;
        }
    }
    _String undoMessage;
    EnableMenuItem (treeMenu,1);
    switch (undoCode) {
    case 1:
        undoMessage = "Undo Swap";
        break;
    case 2:
        undoMessage = "Undo Flip";
        break;
    case 3:
        undoMessage = "Undo Collapse";
        break;
    case 4:
        undoMessage = "Undo Delete";
        break;
    case 5:
        undoMessage = "Undo Join";
        break;
    case 6:
        undoMessage = "Undo Cut";
        break;
    case 7:
        undoMessage = "Undo Graft";
        break;
    case 8:
        undoMessage = "Undo Paste";
        break;
    case 9:
        undoMessage = "Undo Subtree Move";
        break;
    default:
        undoMessage = "Can't Undo";
        DisableMenuItem (treeMenu,1);
    }
    Str255 s255;
    StringToStr255 (undoMessage, s255);
    SetMenuItemText (treeMenu,1,s255);
}

//__________________________________________________________________

void _HYTreePanel::_UnsetMenuBar(void)
{
    MenuHandle treeMenu     = GetMenuHandle (HY_TREEPANEL_MENU_ID),
               labelMenu     = GetMenuHandle (HY_TREEPANEL_HMENU_ID),
               selectMenu   = GetMenuHandle (HY_TREEPANEL_HMENU_ID+1),
               compMenu        = GetMenuHandle (HY_TREEPANEL_HMENU_ID+2);


    DeleteMenu (HY_TREEPANEL_MENU_ID);
    DeleteMenu (HY_TREEPANEL_HMENU_ID);
    DeleteMenu (HY_TREEPANEL_HMENU_ID+1);
    DeleteMenu (HY_TREEPANEL_HMENU_ID+2);
    DisposeMenu (treeMenu);
    DisposeMenu (labelMenu);
    DisposeMenu (selectMenu);
    DisposeMenu (compMenu);

    compMenu        = GetMenuHandle (130);
    DeleteMenuItem (compMenu,10);
    DeleteMenuItem (compMenu,10);
    DeleteMenuItem (compMenu,10);

    _HYWindow::_UnsetMenuBar();
}

//EOF
\ No newline at end of file
diff --git a/src/gui/mac/hydialogs.cpp b/src/gui/mac/hydialogs.cpp
deleted file mode 100644
index 7533c40..0000000
--- a/src/gui/mac/hydialogs.cpp
+++ /dev/null
@@ -1,774 +0,0 @@
-
-#include "stdio.h"
-#include "ctype.h"
-#include "string.h"
-#include "batchlan.h"
-#include "HYTreePanel.h"
-#include "HYDataPanel.h"
-#include "HYObjectInspector.h"
-#include "HYUtils.h"
-#ifndef  TARGET_API_MAC_CARBON
-#include <StandardFile.h>
-#endif
-#include "Navigation.h"
-#include "TextEdit.h"
-#include "HYModelWindow.h"
-#include "HYChartWindow.h"
-
-#include "Movies.h"
-#include <QuickTimeComponents.h>
-#include <ImageCompression.h>
-#include "Script.h"
-
-
-extern  _String*  argFileName,
-        dialogPrompt;
-
-extern  _SimpleList
-windowPtrs,
-windowObjects;
-
-extern  bool      echoPaused;
-extern  long      lastMatrixDeclared;
-
-extern  _String   objectInspectorTitle ;
-
-
-_String MacSimpleFileOpen       (void);
-_String MacSimpleFileSave       (void);
-void    GetFullPathName         (FSSpec&, _String&);
-
-
-_List               movieFormats;
-_SimpleList         qtMovieGrexComponents;
-
-
-NavPreviewUPP             previewFunctionHook = nil;
-
-pascal void HYOpenEventProc (NavEventCallbackMessage,NavCBRecPtr,void * );
-pascal Boolean HYOpenTextPreview (NavCBRecPtr , void *);
-void  findMovieExporterComponents(_List& , _SimpleList& );
-
-
-//_________________________________________________________________________
-Str255      hpName = "\pHY-PHY";
-
-pascal void HYOpenEventProc (NavEventCallbackMessage callBackSelector,
-                             NavCBRecPtr callBackParms,
-                             void * )
-{
-    if (callBackSelector==kNavCBEvent) {
-        EventRecord* theEvent = callBackParms->eventData.eventDataParms.event;
-        if ((theEvent->what == activateEvt)||(theEvent->what == updateEvt)) {
-            if (theEvent->message != (long)callBackParms->window) {
-                long k = windowPtrs.Find((long)theEvent->message);
-                if (k>=0) {
-                    _HYPlatformWindow* clickedWindow = (_HYPlatformWindow*)windowObjects (k);
-                    clickedWindow->_ProcessOSEvent ((Ptr)theEvent);
-                }
-            }
-        }
-    }
-}
-
-//_________________________________________________________________________
-
-pascal Boolean HYOpenTextPreview (NavCBRecPtr callBackParms, void *)
-{
-    AEDescList * fdesc = (AEDesc*)callBackParms->eventData.eventDataParms.param,
-                 fspec;
-    OSErr  navErr;
-
-    _String    preview ("No preview available");
-    if ((navErr=AECoerceDesc(fdesc,typeFSS,&fspec))==noErr) {
-        FSSpec*     fSR = (FSSpec*)*(fdesc->dataHandle);
-        _String feedback;
-        GetFullPathName (*fSR, feedback);
-        terminateExecution = false;
-        //printf ("%s\n",feedback.getStr());
-        FILE * F = doFileOpen (feedback.sData,"r");
-        if (F) {
-            char buffer [1024];
-            buffer[fread (buffer,1,1023,F)]=0;
-            fclose (F);
-            preview = buffer;
-            preview = preview.Replace("\n","\r",true);
-        }
-    }
-    AEDisposeDesc (&fspec);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    GrafPtr thisPort = GetWindowPort(callBackParms->window),
-            savePort;
-#else
-    GrafPtr thisPort = (GrafPtr)callBackParms->window,
-            savePort;
-#endif
-    GetPort (&savePort);
-    SetPort (thisPort);
-#ifdef OPAQUE_TOOLBOX_STRUCTS
-    short   savedFace = GetPortTextFont (thisPort),
-            savedSize = GetPortTextSize (thisPort);
-
-    Style   savedStyle = GetPortTextFace (thisPort);
-#else
-    short   savedFace = thisPort->txFont,
-            savedSize = thisPort->txSize;
-
-    Style   savedStyle = thisPort->txFace;
-#endif
-    RGBColor saveColor,
-             black = {0,0,0};
-    GetForeColor (&saveColor);
-    RGBForeColor (&black);
-    TextFont (kFontIDHelvetica);
-    TextSize (9);
-    TextFace (0);
-    TETextBox (preview.sData,preview.sLength,&callBackParms->previewRect,teFlushLeft);
-    TextFont (savedFace);
-    TextSize (savedSize);
-    TextFace (savedStyle);
-    RGBForeColor (&saveColor);
-    SetPort (savePort);
-    return   true;
-}
-
-//_________________________________________________________________________
-
-_String MacSimpleFileOpen (void)
-{
-    if (previewFunctionHook == nil) {
-        previewFunctionHook = NewNavPreviewUPP(HYOpenTextPreview);
-    }
-
-    _String             feedback;
-    OSErr               navErr;
-    NavReplyRecord      navRR;
-    NavDialogOptions    navDO;
-    NavEventUPP         navEF = NewNavEventUPP (HYOpenEventProc);
-    NavPreviewUPP       navPF = previewFunctionHook;
-
-    terminateExecution       = true;
-
-    NavTypeListHandle   navLH =  (NavTypeListHandle)NewHandle(sizeof(NavTypeList) + (3 * sizeof(OSType)));
-
-    (*navLH)->componentSignature = 'MuSe';
-    (*navLH)->osTypeCount = 2;
-    (*navLH)->osType[0] = '****';
-    (*navLH)->osType[1] = 'TEXT';
-
-    navDO.version       =   kNavDialogOptionsVersion;
-    navDO.location      =   (Point) {
-        -1,-1
-    };
-    navDO.dialogOptionFlags
-        =   kNavAllFilesInPopup|kNavSelectAllReadableItem|kNavAllowPreviews|kNavDontAutoTranslate;
-    StringToStr255      (dialogPrompt,navDO.windowTitle);
-    memcpy (navDO.clientName,hpName,hpName[0]+1);
-    navDO.actionButtonLabel[0]
-        =   0;
-    navDO.cancelButtonLabel[0]
-        =   0;
-    navDO.message[0]    =   0;
-    navDO.preferenceKey =   0;
-    navDO.popupExtension=   nil;
-
-    navErr = NavGetFile (nil,
-                         &navRR,
-                         &navDO,
-                         navEF,
-                         navPF,
-                         nil,
-                         navLH,
-                         nil);
-
-    if (navErr == noErr) {
-        if (navRR.validRecord) {
-            long countAED;
-            if (noErr==AECountItems(&navRR.selection,&countAED)) {
-                if (countAED==1) {
-                    char    fileRec [2048];
-                    Size    actualSize;
-                    AEKeyword   keywd;
-                    DescType    returnedType;
-                    FSSpec*     fSR;
-                    navErr= AEGetNthPtr(&navRR.selection, 1, typeFSS, &keywd,
-                                        &returnedType, fileRec,
-                                        sizeof(FSSpec), &actualSize);
-                    if (navErr==noErr) {
-                        fSR = (FSSpec*)fileRec;
-                        GetFullPathName (*fSR, feedback);
-                        terminateExecution = false;
-                    }
-                }
-            }
-        }
-        NavDisposeReply (&navRR);
-    }
-#ifdef TARGET_API_MAC_CARBON
-    DisposeNavEventUPP (navEF);
-#endif
-    DisposeHandle ((Handle)navLH);
-    return      feedback;
-}
-
-//_________________________________________________________________________
-
-_String ChooseAFolder (_String& promptString)
-{
-    _String             feedback;
-    OSErr               navErr;
-    NavReplyRecord      navRR;
-    NavDialogOptions    navDO;
-#ifdef TARGET_API_MAC_CARBON
-    NavEventUPP         navEF = NewNavEventUPP (HYOpenEventProc);
-#else
-    NavEventUPP         navEF = NewNavEventProc (HYOpenEventProc);
-#endif
-
-    terminateExecution       = true;
-
-    navDO.version       =   kNavDialogOptionsVersion;
-    navDO.location      =   (Point) {
-        -1,-1
-    };
-    navDO.dialogOptionFlags
-        =   kNavAllFilesInPopup|kNavSelectAllReadableItem|kNavAllowPreviews;
-    StringToStr255      (promptString,navDO.windowTitle);
-    memcpy (navDO.clientName,hpName,hpName[0]+1);
-
-    navDO.actionButtonLabel[0]
-        =   0;
-    navDO.cancelButtonLabel[0]
-        =   0;
-    navDO.message[0]    =   0;
-    navDO.preferenceKey =   0;
-    navDO.popupExtension=   nil;
-
-    navErr = NavChooseFolder (nil,
-                              &navRR,
-                              &navDO,
-                              navEF,
-                              nil,
-                              nil);
-
-    if (navErr == noErr) {
-        if (navRR.validRecord) {
-            long countAED;
-            if (noErr==AECountItems(&navRR.selection,&countAED)) {
-                if (countAED==1) {
-                    char    fileRec [2048];
-                    Size    actualSize;
-                    AEKeyword   keywd;
-                    DescType    returnedType;
-                    FSSpec*     fSR;
-                    navErr= AEGetNthPtr(&navRR.selection, 1, typeFSS, &keywd,
-                                        &returnedType, fileRec,
-                                        sizeof(FSSpec), &actualSize);
-                    if (navErr==noErr) {
-                        fSR = (FSSpec*)fileRec;
-                        GetFullPathName (*fSR, feedback);
-                        terminateExecution = false;
-                    }
-                }
-            }
-        }
-        NavDisposeReply (&navRR);
-    }
-#ifdef TARGET_API_MAC_CARBON
-    DisposeNavEventUPP (navEF);
-#endif
-    return      feedback;
-}
-
-//_________________________________________________________________________
-
-_String MacSimpleFileSave (void)
-{
-    _String             feedback;
-    OSErr               navErr;
-    NavReplyRecord      navRR;
-    NavDialogOptions    navDO;
-#ifdef TARGET_API_MAC_CARBON
-    NavEventUPP         navEF = NewNavEventUPP (HYOpenEventProc);
-#else
-    NavEventUPP         navEF = NewNavEventProc (HYOpenEventProc);
-#endif
-
-    terminateExecution       = true;
-
-    navDO.version       =   kNavDialogOptionsVersion;
-    navDO.location      =   (Point) {
-        -1,-1
-    };
-    navDO.dialogOptionFlags
-        =   kNavAllFilesInPopup|kNavSelectAllReadableItem|kNavNoTypePopup;
-
-    if (defFileNameValue.sLength) {
-        StringToStr255 (defFileNameValue, navDO.savedFileName);
-    } else {
-        navDO.savedFileName[0]= 0;
-    }
-
-    StringToStr255      (dialogPrompt,navDO.windowTitle);
-    memcpy (navDO.clientName,hpName,hpName[0]+1);
-    navDO.actionButtonLabel[0]
-        =   0;
-    navDO.cancelButtonLabel[0]
-        =   0;
-    navDO.message[0]    =   0;
-    navDO.preferenceKey =   0;
-    navDO.popupExtension=   nil;
-
-    navErr = NavPutFile (nil,
-                         &navRR,
-                         &navDO,
-                         navEF,
-                         'TEXT',
-                         'MuSe',
-                         nil);
-
-    if (navErr == noErr) {
-        if (navRR.validRecord) {
-            long countAED;
-            if (noErr==AECountItems(&navRR.selection,&countAED)) {
-                if (countAED==1) {
-                    char    fileRec [2048];
-                    Size    actualSize;
-                    AEKeyword   keywd;
-                    DescType    returnedType;
-                    FSSpec*     fSR;
-                    navErr= AEGetNthPtr(&navRR.selection, 1, typeFSS, &keywd,
-                                        &returnedType, fileRec,
-                                        sizeof(FSSpec), &actualSize);
-                    if (navErr==noErr) {
-                        fSR = (FSSpec*)fileRec;
-                        GetFullPathName (*fSR, feedback);
-                        terminateExecution = false;
-                    }
-                }
-            }
-        }
-        NavDisposeReply (&navRR);
-    }
-#ifdef TARGET_API_MAC_CARBON
-    DisposeNavEventUPP (navEF);
-#endif
-    return      feedback;
-}
-
-//_________________________________________________________________________
-bool    PopUpFileDialog(_String ps, _String* defaultLocation)
-{
-    Str255 promptS;
-
-    StringToStr255 (ps, promptS);
-
-    previewFunctionHook = NewNavPreviewUPP(HYOpenTextPreview);
-    OSErr               navErr;
-    NavReplyRecord      navRR;
-    NavDialogOptions    navDO;
-    NavEventUPP         navEF = NewNavEventUPP (HYOpenEventProc);
-    NavPreviewUPP       navPF = previewFunctionHook;
-
-    NavTypeListHandle   navLH =  (NavTypeListHandle)NewHandle(sizeof(NavTypeList) + (3 * sizeof(OSType)));
-
-    (*navLH)->componentSignature = kNavGenericSignature;
-    (*navLH)->osTypeCount        = 3;
-    (*navLH)->osType[0]          = kNavGenericSignature;
-    (*navLH)->osType[1]          = 'TEXT';
-    (*navLH)->osType[2]          = 'text';
-
-    navDO.version       =   kNavDialogOptionsVersion;
-    navDO.location      =   (Point) {
-        -1,-1
-    };
-    navDO.dialogOptionFlags
-        =   kNavAllFilesInPopup|kNavAllowPreviews|kNavSelectAllReadableItem|kNavDontAutoTranslate;
-    memcpy (navDO.windowTitle,promptS,promptS[0]+1);
-    memcpy (navDO.clientName,hpName,hpName[0]+1);
-    navDO.actionButtonLabel[0]
-        =   0;
-    navDO.cancelButtonLabel[0]
-        =   0;
-    navDO.message[0]    =   0;
-    navDO.preferenceKey =   0;
-    navDO.popupExtension=   nil;
-
-    FSSpec              defLocFSS;
-
-    if (defaultLocation) {
-        Str255 buffer;
-        StringToStr255 (*defaultLocation, buffer);
-        FSMakeFSSpec (0,0,buffer,&defLocFSS);
-        AEDesc defDesc;
-        AECreateDesc (typeFSS,&defLocFSS,sizeof (FSSpec),&defDesc);
-        navErr = NavGetFile (&defDesc,
-                             &navRR,
-                             &navDO,
-                             navEF,
-                             navPF,
-                             nil,
-                             navLH,
-                             nil);
-        AEDisposeDesc (&defDesc);
-    } else {
-        /*  NavDialogRef           daBox;
-            navErr = NavCreateGetFileDialog (
-                                    &navDO,
-                                    &navRR,
-                                    navLH,
-                                    navEF,
-                                    navPF,
-                                    NULL,
-                                    NULL,
-                                    &daBox
-                                   );*/
-
-        navErr = NavGetFile (nil,
-                             &navRR,
-                             &navDO,
-                             navEF,
-                             navPF,
-                             nil,
-                             navLH,
-                             nil);
-    }
-
-    if (navErr == noErr) {
-        if (navRR.validRecord) {
-            long countAED;
-            if (noErr==AECountItems(&navRR.selection,&countAED)) {
-                if (countAED==1) {
-                    char        fileRec [2048];
-                    Size        actualSize;
-                    AEKeyword   keywd;
-                    DescType    returnedType;
-                    FSSpec*     fSR;
-                    // get the direct parameter--a descriptor list--and put
-                    // it into docList
-                    navErr= AEGetNthPtr(&navRR.selection, 1, typeFSS, &keywd,
-                                        &returnedType, fileRec,
-                                        sizeof(FSSpec), &actualSize);
-                    if (navErr==noErr) {
-                        fSR = (FSSpec*)fileRec;
-                        fSR->name [fSR->name[0]+1]=0;
-                        if (!argFileName) {
-                            argFileName = new _String ((char*)(fSR->name+1));
-                        } else {
-                            *argFileName = _String ((char*)(fSR->name+1));
-                        }
-
-                        long       parentDirID = fSR->parID;
-                        CInfoPBRec infoRec;
-                        HFileInfo* accessInfo = (HFileInfo*)&infoRec;
-                        Str63      fName;
-                        accessInfo->ioVRefNum = fSR->vRefNum;
-                        accessInfo->ioNamePtr = fName;
-                        accessInfo->ioFDirIndex = -1;
-
-
-                        /*FSRefParam             fileBlock;
-                        FSCatalogInfo        catInfo;
-                        fileBlock.ref        = fSR;
-                        fileBlock.whichInfo  =  kFSCatInfoFinderInfo |  kFSCatInfoFinderXInfo;
-                        fileBlock.spec       = nil;
-                        fileBlock.catInfo    = &catInfo;
-
-                        PBGetCatalogInfoSync (&fileBlock);*/
-
-                        while (parentDirID!=fsRtParID) {
-                            accessInfo->ioDirID = parentDirID;
-                            if (PBGetCatInfo (&infoRec,false)) {
-                                NavDisposeReply (&navRR);
-#ifdef TARGET_API_MAC_CARBON
-                                DisposeNavEventUPP (navEF);
-#endif
-                                DisposeHandle ((Handle)navLH);
-                                return false;
-                            }
-                            parentDirID = accessInfo->ioFlParID;
-                            accessInfo->ioNamePtr [accessInfo->ioNamePtr[0]+1]=0;
-                            *argFileName = _String(((char*)(accessInfo->ioNamePtr+1)))&_String(":")&(*argFileName);
-                        }
-                        volumeName =  _String(((char*)(accessInfo->ioNamePtr+1))) & ':';
-                        NavDisposeReply (&navRR);
-#ifdef TARGET_API_MAC_CARBON
-                        DisposeNavEventUPP (navEF);
-#endif
-                        return true;
-                    }
-                }
-            }
-        }
-    }
-    NavDisposeReply (&navRR);
-#ifdef TARGET_API_MAC_CARBON
-    DisposeNavEventUPP (navEF);
-#endif
-    DisposeHandle ((Handle)navLH);
-    return false;
-}
-
-//____________________________________________________________________________________
-
-void    GetFullPathName (FSSpec& theReply, _String& feedback)
-{
-    theReply.name [theReply.name[0]+1]=0;
-    feedback= _String(((char*)(theReply.name+1)));
-    // get full path name
-    long parentDirID = theReply.parID;
-    CInfoPBRec infoRec;
-    HFileInfo* accessInfo = (HFileInfo*)&infoRec;
-    Str63 fName;
-    accessInfo->ioVRefNum = theReply.vRefNum;
-    accessInfo->ioNamePtr = fName;
-    accessInfo->ioFDirIndex = -1;
-    while (parentDirID!=fsRtParID) {
-        accessInfo->ioDirID = parentDirID;
-        if (PBGetCatInfo (&infoRec,false)!=noErr) {
-            //_String warnMsg("Error in file prompt dialog.");
-            //acknError (warnMsg);
-            //return      feedback;
-            feedback = empty;
-            return;
-        }
-        parentDirID = accessInfo->ioFlParID;
-        accessInfo->ioNamePtr [accessInfo->ioNamePtr[0]+1]=0;
-        feedback = _String(((char*)(accessInfo->ioNamePtr+1)))&_String(":")&(feedback);
-    }
-    volumeName =  _String(((char*)(accessInfo->ioNamePtr+1))) & ':';
-}
-
-
-
-//_________________________________________________________________________
-void findMovieExporterComponents(_List& compList, _SimpleList& compIndex)
-{
-    ComponentDescription cd, cd2;
-    Component c = 0;
-
-    cd.componentType            = MovieExportType;
-    cd.componentSubType         = 0;
-    cd.componentManufacturer    = 0;
-    cd.componentFlags           = 0;
-    cd.componentFlagsMask       = 0;
-
-    _String fileFormat;
-
-    while( ( c = FindNextComponent( c, &cd ) ) != 0 ) {
-        Handle     cInfo = NewHandle(256);
-        GetComponentInfo (c,&cd2,cInfo,nil,nil);
-        (*cInfo)[**cInfo+1] = 0;
-        fileFormat = (char*)(*cInfo+1);
-        if (fileFormat.sLength) {
-            compList&& &fileFormat;
-            compIndex << (long)c;
-        }
-        DisposeHandle(cInfo);
-    }
-}
-
-//_________________________________________________________________________
-void    ConvertMovieFile (bool truncate)
-{
-    EnterMovies();
-    OSErr nErr;
-
-    Movie       movie = nil;
-    short       nFileRefNum;
-    char        fileRec [2048];
-    FSSpec*     fSR = nil;
-    Str255      promptS = "\pChoose a movie file to convert";
-
-    OSErr               navErr;
-    NavReplyRecord      navRR;
-    NavDialogOptions    navDO;
-#ifdef TARGET_API_MAC_CARBON
-    NavEventUPP         navEF = NewNavEventUPP (HYOpenEventProc);
-#else
-    NavEventUPP         navEF = NewNavEventProc (HYOpenEventProc);
-#endif
-
-    NavPreviewUPP       navPF = nil;
-    NavTypeList         navTL;
-    NavTypeListPtr      navTP = &navTL;
-    NavTypeListHandle   navLH = &navTP;
-
-    navTL.componentSignature = 'MuSe';
-    navTL.osTypeCount        = 1;
-    navTL.osType[0]          = MovieFileType;
-
-    navDO.version       =   kNavDialogOptionsVersion;
-    navDO.location      =   (Point) {
-        -1,-1
-    };
-    navDO.dialogOptionFlags
-        =   kNavAllFilesInPopup|kNavSelectAllReadableItem|kNavAllowPreviews|kNavDontAutoTranslate;
-
-    memcpy (navDO.windowTitle,promptS,promptS[0]+1);
-    memcpy (navDO.clientName,hpName,hpName[0]+1);
-    navDO.actionButtonLabel[0]
-        =   0;
-    navDO.cancelButtonLabel[0]
-        =   0;
-    navDO.message[0]    =   0;
-    navDO.preferenceKey =   0;
-    navDO.popupExtension=   nil;
-
-    navErr = NavGetFile (nil,
-                         &navRR,
-                         &navDO,
-                         navEF,
-                         navPF,
-                         nil,
-                         navLH,
-                         nil);
-
-    if (navErr == noErr) {
-        if (navRR.validRecord) {
-            long countAED;
-            if (noErr==AECountItems(&navRR.selection,&countAED)) {
-                if (countAED==1) {
-                    Size    actualSize;
-                    AEKeyword   keywd;
-                    DescType    returnedType;
-                    // get the direct parameter--a descriptor list--and put
-                    // it into docList
-                    navErr= AEGetNthPtr(&navRR.selection, 1, typeFSS, &keywd,
-                                        &returnedType, fileRec,
-                                        sizeof(FSSpec), &actualSize);
-                    if (navErr==noErr) {
-                        fSR = (FSSpec*)fileRec;
-                    } else {
-                        WarnError (_String("Error ")& (long)navErr & " in AEGetNthPtr.");
-                    }
-                }
-            } else {
-                WarnError (_String("Error ")& (long)navErr & " in AECountItems.");
-            }
-        }
-    } else {
-        WarnError (_String("Error ")& (long)navErr & " in NavGetFile.");
-    }
-
-
-    if (fSR) {
-        nErr = OpenMovieFile(fSR, &nFileRefNum, fsRdPerm);
-        if (nErr == noErr) {
-            short nResID = 0;
-            Str255 strName;
-            Boolean bWasChanged;
-            nErr = NewMovieFromFile(&movie, nFileRefNum, &nResID, strName,newMovieActive, &bWasChanged);
-            SetMovieProgressProc(movie, (MovieProgressUPP)-1L, 0);
-
-            if (qtMovieGrexComponents.lLength==0) {
-                findMovieExporterComponents (movieFormats,qtMovieGrexComponents);
-            }
-
-            if (qtMovieGrexComponents.lLength==0) {
-                WarnError (_String("Failed to find movie export components."));
-            } else {
-                _String fName,
-                        filePr   = "Export Movie To:",
-                        formatPr = "Target Format:",
-                        movieName(10L,true);
-
-                for (long k = 1; k<=fSR->name[0]; k++) {
-                    movieName << fSR->name[k];
-                }
-
-                movieName.Finalize();
-
-                long    menuChoice = SaveFileWithPopUp (fName, filePr,movieName,formatPr,movieFormats);
-
-                if (menuChoice>=0) {
-                    FSSpec  fs;
-                    Str255  buff;
-                    StringToStr255 (fName,buff);
-                    FSMakeFSSpec(0,0,buff,&fs);
-
-
-                    ComponentInstance grexc = OpenComponent ((Component)qtMovieGrexComponents(menuChoice));
-
-                    Boolean canceled;
-
-                    if (truncate) {
-                        TimeValue maxDuration = GetMovieDuration(movie);
-                        _String chopString,
-                                chopPrompt = _String ("From-to, max value = ") & (long)maxDuration;
-
-                        canceled = 1;
-                        if (EnterStringDialog (chopString, chopPrompt, nil)) {
-                            _List * times = chopString.Tokenize("-");
-                            if (times->lLength==2) {
-                                TimeValue fromMark = ((_String*)(*times)(0))->toNum(),
-                                          toMark = ((_String*)(*times)(1))->toNum();
-
-                                if ((fromMark>=0)&&(toMark>fromMark)&&(toMark<=maxDuration)) {
-                                    MovieExportDoUserDialog (grexc, movie, nil, fromMark,toMark-fromMark, & canceled);
-                                    canceled = 0;
-                                }
-                                if (canceled) {
-                                    WarnError (_String((long)fromMark)&"-"&_String((long)toMark) & " is not a valid segment specification.");
-                                }
-                            }
-                        }
-                    } else {
-                        MovieExportDoUserDialog (grexc, movie, nil, 0, GetMovieDuration(movie), & canceled);
-                    }
-
-                    if (!canceled) {
-                        nErr =  ConvertMovieToFile (movie,0,&fs,'    ','MuSe',smSystemScript,nil,0,grexc);
-                        if ((nErr != noErr)&&(nErr != progressProcAborted)) {
-                            WarnError (_String("Error ")& (long)nErr & " converting movie to file.");
-                        }
-                    }
-                    CloseComponent (grexc);
-                }
-            }
-            CloseMovieFile(nFileRefNum);
-
-        } else {
-            WarnError (_String("Error ")& (long)nErr & " opening movie file.");
-        }
-    }
-    NavDisposeReply (&navRR);
-    ExitMovies();
-}
-
-//_________________________________________________________________________
-
-void    ShowObjectInspector (void)
-{
-    long f = FindWindowByName (objectInspectorTitle);
-    if (f>=0) {
-        ShowWindow ((WindowPtr)windowPtrs (f));
-        SelectWindow ((WindowPtr)windowPtrs (f));
-    } else {
-        _HYObjectInspector* newOI = new _HYObjectInspector ();
-        //newOI->BuildListOfObjects (0);
-        //newOI->_Zoom(true);
-        newOI->Activate       ( );
-        //newOI->Show();
-    }
-}
-
-//_________________________________________________________________________
-
-_String     DoMacToPOSIX (const _String& in)
-{
-    CFStringRef posixPath    = CFStringCreateWithCString (NULL,in.sData,kCFStringEncodingASCII);
-    CFURLRef    convertorURL = CFURLCreateWithFileSystemPath (NULL,posixPath,kCFURLHFSPathStyle,false);
-    CFRelease (posixPath);
-    posixPath = CFURLCopyFileSystemPath (convertorURL, kCFURLPOSIXPathStyle);
-    CFRelease (convertorURL);
-    _String  newFNAME  (CFStringGetLength(posixPath),false);
-    CFStringGetCString (posixPath, newFNAME.sData, newFNAME.sLength+1, kCFStringEncodingASCII);
-    CFRelease (posixPath);
-    return newFNAME;
-}
-
-
-
-
-
diff --git a/src/gui/mac/iHyPhyDebug.rsrc b/src/gui/mac/iHyPhyDebug.rsrc
deleted file mode 100644
index 1b76e12..0000000
Binary files a/src/gui/mac/iHyPhyDebug.rsrc and /dev/null differ
diff --git a/src/gui/mac/include/Components/HYPlatformButton.h b/src/gui/mac/include/Components/HYPlatformButton.h
deleted file mode 100644
index c8b3056..0000000
--- a/src/gui/mac/include/Components/HYPlatformButton.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-
-    A button object for MacOS.
-
-
-
-    Sergei L. Kosakovsky Pond, May 2000.
-
-*/
-
-
-
-#ifndef _HYPBUTTON_
-
-#define _HYPBUTTON_
-
-
-
-#ifdef   TARGET_API_MAC_CARBON
-
-#include "CarbonEvents.h"
-
-#endif
-
-
-
-#include "HYPlatformComponent.h"
-
-
-
-//__________________________________________________________________
-
-
-
-class _HYPlatformButton
-
-{
-
-
-
-public:
-
-
-
-    _HYPlatformButton(void);
-
-
-
-    virtual ~_HYPlatformButton(void);
-
-
-
-    virtual void            _SetBackColor    (_HYColor&);
-
-    virtual void            _SetDimensions   (_HYRect,_HYRect);
-
-    virtual void            _SetVisibleSize  (_HYRect);
-
-    virtual void            _SetFont         (_HYFont&);
-
-    void            _SetText         (void);
-
-    void            _SetButtonKind   (unsigned char);
-
-    void            _EnableButton    (bool);
-
-    void            _ApplyFont       (void);
-
-    void            _PaintMe         (void);
-
-
-
-    virtual void            _Paint (Ptr p);
-
-    virtual void            _Update(Ptr p);
-
-
-
-    PixPatHandle    backFill;
-
-    ControlHandle   buttonControl;
-
-    Rect            buttonRect;
-
-    short           fontID;
-
-};
-
-
-
-#endif
-
diff --git a/src/gui/mac/include/Components/HYPlatformButtonBar.h b/src/gui/mac/include/Components/HYPlatformButtonBar.h
deleted file mode 100644
index 3647226..0000000
--- a/src/gui/mac/include/Components/HYPlatformButtonBar.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-
-    At toolbar menu object for MacOS.
-
-
-
-    Sergei L. Kosakovsky Pond, May 2000.
-
-*/
-
-
-
-#ifndef _HYPBUTTONBAR_
-
-#define _HYPBUTTONBAR_
-
-
-
-#include "HYPlatformComponent.h"
-
-
-
-#ifdef TARGET_API_MAC_CARBON
-
-#include "CarbonEvents.h"
-
-pascal void ButtonBarTimer (EventLoopTimerRef theTimer,void* userData);
-
-#endif
-
-
-
-//__________________________________________________________________
-
-
-
-class _HYPlatformButtonBar
-
-{
-
-
-
-public:
-
-
-
-    _HYPlatformButtonBar(void);
-
-
-
-    virtual ~_HYPlatformButtonBar(void);
-
-
-
-    virtual void        _SetBackColor    (_HYColor&);
-
-    virtual void        _SetDimensions   (_HYRect,_HYRect);
-
-    virtual void        _SetVisibleSize  (_HYRect);
-
-    _HYRect     _GetButtonRect   (bool conv = false);
-
-
-
-    virtual void        _Paint (Ptr p);
-
-    virtual void        _Update(Ptr p);
-
-    void        _DisposeButtons (void);
-
-    void        _DisposeButton  (long);
-
-    void        _MarkButtonForUpdate(int);
-
-    void        _UnpushButton   (void);
-
-    int         _FindClickedButton (int,int);
-
-
-
-
-
-    PixPatHandle backFill;
-
-    Rect         buttonRect,
-
-                 toolTipBounds;
-
-    int          pushed;
-
-    int          saveMousePosH, saveMousePosV;
-
-    unsigned long
-
-    lastSave;
-
-#ifdef      TARGET_API_MAC_CARBON
-
-    EventLoopTimerUPP timerUPP;
-
-    EventLoopTimerRef theTimer;
-
-#endif
-
-};
-
-
-
-//__________________________________________________________________
-
-
-
-
-
-
-
-#endif
-
diff --git a/src/gui/mac/include/Components/HYPlatformCheckbox.h b/src/gui/mac/include/Components/HYPlatformCheckbox.h
deleted file mode 100644
index 172ecb2..0000000
--- a/src/gui/mac/include/Components/HYPlatformCheckbox.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-
-    A checkbox with optional static label object for MacOS.
-
-
-
-    Sergei L. Kosakovsky Pond, May 2000-December 2002.
-
-*/
-
-
-
-#ifndef _HYPLCHECKBOX_
-
-#define _HYPLCHECKBOX_
-
-
-
-#ifdef   TARGET_API_MAC_CARBON
-
-#include "CarbonEvents.h"
-
-#endif
-
-
-
-#include "HYPlatformComponent.h"
-
-
-
-//__________________________________________________________________
-
-
-
-class _HYPlatformCheckbox
-
-{
-
-
-
-public:
-
-
-
-    _HYPlatformCheckbox(bool);
-
-    virtual ~_HYPlatformCheckbox(void);
-
-
-
-    virtual void        _SetVisibleSize     (_HYRect);
-
-    virtual void        _SetState           (bool);
-
-
-
-    virtual void        _Paint (Ptr p);
-
-    virtual void        _Update(Ptr p);
-
-    virtual void        _Enable(bool);
-
-
-
-    void        _PaintMe            (void);
-
-    ControlHandle   checkboxControl;
-
-    Rect            checkboxRect;
-
-    bool            isRadio;
-
-};
-
-
-
-#endif
-
diff --git a/src/gui/mac/include/Components/HYPlatformLabel.h b/src/gui/mac/include/Components/HYPlatformLabel.h
deleted file mode 100644
index 3833aee..0000000
--- a/src/gui/mac/include/Components/HYPlatformLabel.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-
-    A static label object for MacOS.
-
-
-
-    Sergei L. Kosakovsky Pond, May 2000-December 2002.
-
-*/
-
-
-
-#ifndef _HYPLABEL_
-
-#define _HYPLABEL_
-
-
-
-#ifdef   TARGET_API_MAC_CARBON
-
-#include "CarbonEvents.h"
-
-#endif
-
-
-
-#include "HYPlatformComponent.h"
-
-
-
-//__________________________________________________________________
-
-
-
-class _HYPlatformLabel
-
-{
-
-
-
-public:
-
-
-
-    _HYPlatformLabel(void);
-
-    // flags, title, visibility
-
-
-
-    virtual ~_HYPlatformLabel(void);
-
-
-
-    virtual void        _SetBackColor    (_HYColor&);
-
-    virtual void        _SetForeColor    (_HYColor&);
-
-    virtual void        _SetDimensions   (_HYRect,_HYRect);
-
-    virtual void        _SetVisibleSize  (_HYRect);
-
-    virtual void        _SetFont         (_HYFont&);
-
-    virtual void        _SetText         (void) {}
-
-
-
-    virtual void        _Paint (Ptr p);
-
-    virtual void        _Update(Ptr p);
-
-
-
-    PixPatHandle backFill;
-
-    RGBColor     fc;
-
-    long         fontID;
-
-    Rect         labelRect;
-
-};
-
-
-
-#endif
-
diff --git a/src/gui/mac/include/Components/HYPlatformList.h b/src/gui/mac/include/Components/HYPlatformList.h
deleted file mode 100644
index b20c01d..0000000
--- a/src/gui/mac/include/Components/HYPlatformList.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-
-    A text input box object for MacOS.
-
-
-
-    Sergei L. Kosakovsky Pond, May 2000-December 2002.
-
-*/
-
-
-
-#ifndef _HYPLLIST_
-
-#define _HYPLLIST_
-
-
-
-#ifdef   TARGET_API_MAC_CARBON
-
-#include "CarbonEvents.h"
-
-#endif
-
-
-
-#include "HYPlatformComponent.h"
-
-#include "Lists.h"
-
-
-
-//__________________________________________________________________
-
-
-
-class _HYPlatformList
-
-{
-
-
-
-public:
-
-
-
-    _HYPlatformList(void);
-
-
-
-    virtual ~_HYPlatformList(void);
-
-
-
-    virtual void        _SetDimensions   (_HYRect,_HYRect);
-
-    virtual void        _SetVisibleSize  (_HYRect);
-
-
-
-    virtual void        _Paint (Ptr p);
-
-    virtual void        _Update(Ptr p);
-
-
-
-    virtual void        _InsertItem         (_String&, long);
-
-    virtual void        _SetItem            (_String&, long);
-
-    virtual void        _DeleteItem         (long);
-
-    virtual void        _CheckSelection     (void);
-
-    virtual void        _ToggleMultSelection(bool);
-
-    void        _KillSelection  (void);
-
-    void        _SetSelection   (_SimpleList&);
-
-    void        _SetFont        (void);
-
-
-
-    ListHandle      listData;
-
-    short           fontID;
-
-};
-
-
-
-#endif
-
diff --git a/src/gui/mac/include/Components/HYPlatformPullDown.h b/src/gui/mac/include/Components/HYPlatformPullDown.h
deleted file mode 100644
index c0f9925..0000000
--- a/src/gui/mac/include/Components/HYPlatformPullDown.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-
-    A pull down menu object for MacOS.
-
-
-
-    Sergei L. Kosakovsky Pond, May 2000.
-
-*/
-
-
-
-#ifndef _HYPPULLDOWNMENU_
-
-#define _HYPPULLDOWNMENU_
-
-#ifdef   TARGET_API_MAC_CARBON
-
-#include "CarbonEvents.h"
-
-#endif
-
-
-
-#include "HYPlatformComponent.h"
-
-
-
-//__________________________________________________________________
-
-
-
-extern   _String    menuSeparator;
-
-
-
-//__________________________________________________________________
-
-
-
-class _HYPlatformPullDown
-
-{
-
-
-
-public:
-
-
-
-    _HYPlatformPullDown(void);
-
-    // flags, title, visibility
-
-
-
-    virtual ~_HYPlatformPullDown(void);
-
-
-
-    virtual void        _AddMenuItem     (_String&, long);
-
-    virtual void        _SetMenuItem     (_String&, long);
-
-    virtual void        _SetBackColor    (_HYColor&);
-
-    virtual void        _Duplicate       (Ptr);
-
-    virtual void        _DeleteMenuItem  (long);
-
-    virtual long        _GetSelection    (void);
-
-    virtual void        _SetDimensions   (_HYRect,_HYRect);
-
-    virtual void        _SetVisibleSize  (_HYRect);
-
-    virtual void        _EnableItem      (long, bool);
-
-    virtual void        _MarkItem        (long, char);
-
-    virtual char        _ItemMark        (long);
-
-    virtual void        _EnableMenu      (bool) {}
-
-
-
-
-
-    virtual void        _Paint (Ptr p);
-
-    virtual void        _Update(Ptr p);
-
-
-
-    MenuHandle    myMenu;
-
-    PixPatHandle  backFill;
-
-    long          myID, selection;
-
-    Rect          menuRect;
-
-};
-
-
-
-//__________________________________________________________________
-
-
-
-extern  RGBColor    buttonBorder1,
-
-        buttonBorder2;
-
-
-
-
-
-#endif
-
diff --git a/src/gui/mac/include/Components/HYPlatformTable.h b/src/gui/mac/include/Components/HYPlatformTable.h
deleted file mode 100644
index b7ea0d8..0000000
--- a/src/gui/mac/include/Components/HYPlatformTable.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-
-    A text input box object for MacOS.
-
-
-
-    Sergei L. Kosakovsky Pond, May 2000-December 2002.
-
-*/
-
-
-
-#ifndef _HYPLTABLE_
-
-#define _HYPLTABLE_
-
-
-
-#ifdef   TARGET_API_MAC_CARBON
-
-#include "CarbonEvents.h"
-
-#endif
-
-
-
-//__________________________________________________________________
-
-
-
-#include "HYPlatformComponent.h"
-
-
-
-#define     HY_TABLE_SIZE_CURSOR  0x01
-
-#define     HY_TABLE_DRAG_CURSOR  0x02
-
-#define     HY_TABLE_EDIT_CURSOR  0x04
-
-
-
-//__________________________________________________________________
-
-
-
-class _HYPlatformTable
-
-{
-
-
-
-public:
-
-
-
-    _HYPlatformTable        (void);
-
-    virtual             ~_HYPlatformTable       (void);
-
-
-
-    void            _SetFont                (void);
-
-    void            _SetBackColor           (_HYColor&);
-
-    void            _SetBackColor2          (_HYColor&);
-
-
-
-    void            _CreateTextBox          (_HYRect&,_String&);
-
-    _String         _RetrieveTextValue      (void);
-
-    void            _KillTextBox            (void);
-
-    bool            _HasTextBox             (void) {
-
-        return      editBox;
-
-    }
-
-
-
-    Rect            _GetVisibleRowRect      (long);
-
-
-
-    void            _HiliteRowForDrag       (long,long);
-
-
-
-    short           fontID;
-
-    PixPatHandle    backPattern,
-
-                    backPattern2;
-
-    char            cursorState;
-
-
-
-    TEHandle        editBox;
-
-    Rect            textBoxRect;
-
-};
-
-
-
-#endif
-
diff --git a/src/gui/mac/include/Components/HYPlatformTextbox.h b/src/gui/mac/include/Components/HYPlatformTextbox.h
deleted file mode 100644
index f7a86ab..0000000
--- a/src/gui/mac/include/Components/HYPlatformTextbox.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-
-    A text input box object for MacOS.
-
-
-
-    Sergei L. Kosakovsky Pond, May 2000-December 2002.
-
-*/
-
-
-
-#ifndef _HYPLTEXTBOX_
-
-#define _HYPLTEXTBOX_
-
-
-
-#ifdef   TARGET_API_MAC_CARBON
-
-#include "CarbonEvents.h"
-
-#endif
-
-
-
-#include "HYPlatformComponent.h"
-
-#include <MacTextEditor.h>
-
-
-
-#define  _HY_USE_MLTE_
-
-
-
-//__________________________________________________________________
-
-
-
-class _HYPlatformTextBox
-
-{
-
-
-
-public:
-
-
-
-    _HYPlatformTextBox (void);
-
-
-
-    virtual ~_HYPlatformTextBox(void);
-
-
-
-    virtual void            _SetBackColor    (_HYColor&);
-
-    virtual void            _SetBackTColor   (_HYColor&);
-
-    virtual void            _SetForeColor    (_HYColor&);
-
-    virtual void            _SetDimensions   (_HYRect,_HYRect);
-
-    virtual void            _SetVisibleSize  (_HYRect);
-
-    virtual void            _SetFont         (_HYFont&);
-
-    void            _SetText         (const _String&);
-
-    void            _InsertText      (const _String&, bool);
-
-    _String         _GetText         (void);
-
-    void            _StoreText       (_String*&, bool);
-
-    void            _CreateTE        (void);
-
-    void            _EnableTextBox   (bool);
-
-    void            _SetMargins      (_HYRect&);
-
-    void            _SetAlignFlags   (unsigned char);
-
-    long            _GetCharacterCount
-
-    (void);
-
-
-
-    virtual void            _Paint (Ptr p);
-
-    virtual void            _Update(Ptr p);
-
-
-
-    virtual void            _FocusComponent   (void);
-
-    virtual void            _UnfocusComponent (void);
-
-
-
-    PixPatHandle    backFill,
-
-                    backTFill;
-
-
-
-
-
-    Rect            textBoxRect;
-
-#ifdef          _HY_USE_MLTE_
-
-
-
-    virtual void            _HandleContextMenu (Point&);
-
-
-
-    TXNObject       txn;
-
-    TXNFrameID      txnFrame;
-
-#else
-
-    TEHandle        te;
-
-#endif
-
-
-
-};
-
-
-
-#ifdef   _HY_USE_MLTE_
-
-
-
-_String  mlteCommandString (TXNObject&, bool);
-
-
-
-#endif
-
-
-
-#endif
-
diff --git a/src/gui/mac/include/HYPlatformButtonMenu.h b/src/gui/mac/include/HYPlatformButtonMenu.h
deleted file mode 100644
index 5cb2365..0000000
--- a/src/gui/mac/include/HYPlatformButtonMenu.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
-    A pull down menu object for MacOS.
-
-    Sergei L. Kosakovsky Pond, May 2000.
-*/
-
-#ifndef _HYPPULLDOWNMENU_
-#define _HYPPULLDOWNMENU_
-//#pragma once
-#include "HYBaseGUI.h"
-#include "Menus.h"
-#include "Lists.h"
-#include "TextEdit.h"
-#include "strings.h"
-#ifdef   TARGET_API_MAC_CARBON
-#include "CarbonEvents.h"
-#endif
-
-
-
-//__________________________________________________________________
-
-class _HYPlatformCheckbox
-{
-
-public:
-
-    _HYPlatformCheckbox(bool);
-    virtual ~_HYPlatformCheckbox(void);
-
-    virtual void        _SetVisibleSize     (_HYRect);
-    virtual void        _SetState           (bool);
-
-    virtual void        _Paint (Ptr p);
-    virtual void        _Update(Ptr p);
-    virtual void        _Enable(bool);
-
-    ControlHandle   checkboxControl;
-    Rect            checkboxRect;
-    bool            isRadio;
-};
-
-//__________________________________________________________________
-
-class _HYPlatformButtonBar
-{
-
-public:
-
-    _HYPlatformButtonBar(void);
-
-    virtual ~_HYPlatformButtonBar(void);
-
-    virtual void        _SetBackColor    (_HYColor&);
-    virtual void        _SetDimensions   (_HYRect,_HYRect);
-    virtual void        _SetVisibleSize  (_HYRect);
-    _HYRect     _GetButtonRect   (bool conv = false);
-
-    virtual void        _Paint (Ptr p);
-    virtual void        _Update(Ptr p);
-    void        _DisposeButtons (void);
-    void        _DisposeButton  (long);
-    void        _MarkButtonForUpdate(int);
-    void        _UnpushButton   (void);
-    int         _FindClickedButton (int,int);
-
-
-    PixPatHandle backFill;
-    Rect         buttonRect,
-                 toolTipBounds;
-    int          pushed;
-    int          saveMousePosH, saveMousePosV;
-    unsigned long
-    lastSave;
-#ifdef      TARGET_API_MAC_CARBON
-    EventLoopTimerUPP timerUPP;
-    EventLoopTimerRef theTimer;
-#endif
-};
-
-//__________________________________________________________________
-
-class _HYPlatformList
-{
-
-public:
-
-    _HYPlatformList(void);
-
-    virtual ~_HYPlatformList(void);
-
-    virtual void        _SetDimensions   (_HYRect,_HYRect);
-    virtual void        _SetVisibleSize  (_HYRect);
-
-    virtual void        _Paint (Ptr p);
-    virtual void        _Update(Ptr p);
-
-    virtual void        _InsertItem         (_String&, long);
-    virtual void        _SetItem            (_String&, long);
-    virtual void        _DeleteItem         (long);
-    virtual void        _CheckSelection     (void);
-    virtual void        _ToggleMultSelection(bool);
-    void        _KillSelection  (void);
-    void        _SetSelection   (_SimpleList&);
-    void        _SetFont        (void);
-
-    ListHandle      listData;
-    short           fontID;
-};
-
-//__________________________________________________________________
-
-#define     HY_TABLE_SIZE_CURSOR  0x01
-#define     HY_TABLE_DRAG_CURSOR  0x02
-#define     HY_TABLE_EDIT_CURSOR  0x04
-
-//__________________________________________________________________
-
-class _HYPlatformTable
-{
-
-public:
-
-    _HYPlatformTable        (void);
-    virtual             ~_HYPlatformTable       (void);
-
-    void            _SetFont                (void);
-    void            _SetBackColor           (_HYColor&);
-    void            _SetBackColor2          (_HYColor&);
-
-    void            _CreateTextBox          (_HYRect&,_String&);
-    _String         _RetrieveTextValue      (void);
-    void            _KillTextBox            (void);
-    bool            _HasTextBox             (void) {
-        return      editBox;
-    }
-
-    Rect            _GetVisibleRowRect      (long);
-
-    void            _HiliteRowForDrag       (long,long);
-
-    short           fontID;
-    PixPatHandle    backPattern,
-                    backPattern2;
-    char            cursorState;
-
-    TEHandle        editBox;
-    Rect            textBoxRect;
-};
-
-
-
-//__________________________________________________________________
-
-class _HYPlatformTextBox
-{
-
-public:
-
-    _HYPlatformTextBox (void);
-
-    virtual ~_HYPlatformTextBox(void);
-
-    virtual void            _SetBackColor    (_HYColor&);
-    virtual void            _SetBackTColor   (_HYColor&);
-    virtual void            _SetForeColor    (_HYColor&);
-    virtual void            _SetDimensions   (_HYRect,_HYRect);
-    virtual void            _SetVisibleSize  (_HYRect);
-    virtual void            _SetFont         (_HYFont&);
-    void            _SetText         (_String&);
-    void            _InsertText      (_String&);
-    _String         _GetText         (void);
-    void            _CreateTE        (void);
-    void            _EnableTextBox   (bool);
-    void            _SetMargins      (_HYRect&);
-    void            _SetAlignFlags   (unsigned char);
-
-    virtual void            _Paint (Ptr p);
-    virtual void            _Update(Ptr p);
-
-    virtual void            _FocusComponent  (void);
-    virtual void            _UnfocusComponent(void);
-
-    PixPatHandle    backFill,
-                    backTFill;
-    TEHandle        te;
-    Rect            textBoxRect;
-};
-#endif
-
-#ifdef TARGET_API_MAC_CARBON
-pascal void ButtonBarTimer (EventLoopTimerRef theTimer,void* userData);
-#endif
-
-
-//EOF
diff --git a/src/gui/mac/include/HYPlatformComponent.h b/src/gui/mac/include/HYPlatformComponent.h
deleted file mode 100644
index 5efda6e..0000000
--- a/src/gui/mac/include/HYPlatformComponent.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-    A general composite window component object, MacOS specifics
-
-    Sergei L. Kosakovsky Pond, May 2000.
-*/
-
-#ifndef _HYPCOMPONENT_
-#define _HYPCOMPONENT_
-//#pragma once
-#include "HYBaseGUI.h"
-#include "Controls.h"
-//#include <Windows.h>
-
-#define  HY_SCROLLER_WIDTH 15
-
-//__________________________________________________________________
-
-class _HYPlatformComponent
-{
-
-public:
-
-    _HYPlatformComponent(void);
-    _HYPlatformComponent(_HYRect,Ptr);
-    // settings
-
-    virtual ~_HYPlatformComponent() {};
-
-    virtual void        Duplicate (BaseRef);
-
-    virtual void        _CleanUp   (void);
-
-    virtual void        _SetDimensions (_HYRect,_HYRect);
-    virtual void        _SetVisibleSize(_HYRect);
-
-    virtual void        _Paint (Ptr);
-    virtual void        _Update (Ptr);
-    virtual bool        _ProcessOSEvent (Ptr);
-    virtual _HYRect     _VisibleContents(Ptr);
-    virtual void        _MarkForUpdate (void);
-    virtual void        _MarkContentsForUpdate (void);
-    virtual long        _GetHScrollerPos (void);
-    virtual long        _GetVScrollerPos (void);
-    virtual void        _SetHScrollerPos (long);
-    virtual void        _SetVScrollerPos (long);
-    virtual void        _Activate (void);
-    virtual void        _Deactivate(void);
-    virtual void        _ComponentMouseExit (void) {}
-
-
-
-    WindowPtr     parentWindow;
-
-    _HYRect       rel;
-    ControlHandle vScroll, hScroll;
-
-    bool          activationFlag;
-    long          lastHScroll,
-                  lastVScroll;
-};
-
-extern  bool    forceUpdateForScrolling;
-
-void            AlignRectangle (_HYRect& rel , Rect& target , unsigned char alFlags);
-
-
-#ifdef TARGET_API_MAC_CARBON
-
-extern bool aquaInterfaceOn;
-
-#endif
-
-//__________________________________________________________________
-
-#endif
-
-//EOF
diff --git a/src/gui/mac/include/HYPlatformGraphicPane.h b/src/gui/mac/include/HYPlatformGraphicPane.h
deleted file mode 100644
index 53be1e4..0000000
--- a/src/gui/mac/include/HYPlatformGraphicPane.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-    A painting canvas with double buffer. MacOS.
-
-    Sergei L. Kosakovsky Pond, May 2000-May 2002.
-*/
-
-#ifndef _HYPGRAPHICPANE_
-#define _HYPGRAPHICPANE_
-//#pragma once
-
-#include "HYBaseGUI.h"
-#include "QDOffscreen.h"
-#include "QuickDraw.h"
-
-//__________________________________________________________________
-
-class  _HYPlatformGraphicPane
-{
-
-public:
-
-    _HYPlatformGraphicPane(int, int,int);
-    // initial size
-
-    virtual ~_HYPlatformGraphicPane();
-
-    virtual void        _SetPaneSize  (int,int,int);
-    virtual void        _DrawLine     (_HYRect);
-    virtual void        _DrawHatchedLine(_HYRect);
-    // from, to , width
-    virtual void        _DisplayText  (_String,int,int,bool);
-    // text, where, left-right or top-bottom
-    virtual void        _DisplayText  (_String&,_HYRect&, char);
-
-    virtual void        _DisplayChar  (char,int,int);
-    // text, where
-    virtual void        _DrawRect    (_HYRect);
-    virtual void        _FillRect    (_HYRect);
-    virtual void        _EraseRect   (_HYRect);
-    virtual void        _DrawOval    (_HYRect);
-    virtual void        _FillOval    (_HYRect);
-    virtual void        _EraseOval   (_HYRect);
-    virtual void        _DrawArc     (_HYRect,int,int);
-    virtual void        _FillArc     (_HYRect,int,int);
-    virtual void        _EraseArc    (_HYRect,int,int);
-    virtual void        _SetColor    (_HYColor);
-    virtual void        _SetBColor   (_HYColor);
-    virtual void        _SetFont     (_HYFont);
-    virtual void        _SetFontSize (long);
-    virtual void        _StartDraw   (void);
-    virtual void        _EndDraw     (void);
-    virtual void        _SetPort     (Ptr);
-    virtual void        _SlidePane   (int dv, int dh);
-    virtual void        _SlideRect   (_HYRect&r ,int dv, int dh);
-    virtual void        _InvertRect  (_HYRect&);
-    virtual void        _CopyToClipboard
-    (void);
-
-    virtual void        _DrawPicRes  (_HYRect&, long);
-    virtual void        _SavePicture (_String);
-
-    virtual Ptr         _DefinePolygon
-    (_SimpleList&);
-    virtual void        _KillPolygon (Ptr);
-    virtual void        _DrawPolygon (Ptr,long = 1);
-    virtual void        _FillPolygon (Ptr);
-    virtual void        _ErasePolygon(Ptr);
-    virtual void        _SetDialogBG (void);
-
-    GWorldPtr    thePane;
-
-protected:
-
-    CGrafPtr     savedPort;
-    GDHandle     savedDevice;
-    PixPatHandle fillColor;
-    RGBColor     saveFG,
-                 saveBG;
-};
-
-Rect    HYRect2Rect (_HYRect&);
-
-extern  _List       graphicsFormats;
-extern  _SimpleList qtGrexComponents;
-
-void        InitializeQTExporters          (void);
-
-#endif
-
-//EOF
diff --git a/src/gui/mac/include/HYPlatformWindow.h b/src/gui/mac/include/HYPlatformWindow.h
deleted file mode 100644
index 83be2dd..0000000
--- a/src/gui/mac/include/HYPlatformWindow.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-    A Mac OS window object - a window/title/size-box/scroll-bars handler.
-
-    Sergei L. Kosakovsky Pond, May 2000.
-*/
-
-#ifndef _HYPWINDOW_
-#define _HYPWINDOW_
-
-#define  MAX_CONTROL_VALUE 100000000
-#include "hy_strings.h"
-
-#include "Quickdraw.h"
-#include "Controls.h"
-#include "HYBaseGUI.h"
-
-#ifdef   TARGET_API_MAC_CARBON
-#include "CarbonEvents.h"
-#endif
-
-#include "Carbon.h"
-
-//__________________________________________________________________
-
-class _HYPlatformWindow
-{
-
-public:
-
-    _HYPlatformWindow   (unsigned char,_String,bool,Ptr = nil);
-    // flags, title, visibility
-
-    virtual ~_HYPlatformWindow  (void);
-
-    void        _SetTitle               (_String);
-    void        _Show                   (void);
-    void        _Hide                   (void);
-    virtual long        _Grow                   (Ptr);
-    virtual bool        _Close                  (Ptr);
-    virtual void        _Move                   (Ptr);
-    virtual void        _SetPosition            (int,int);
-    void        _SelectWindow           (void);
-    virtual void        _SetWindowRectangle     (int,int,int,int,bool=true);
-    virtual void        _SetContentSize         (int,int);
-    virtual void        _Paint                  (Ptr);
-    virtual void        _Update                 (Ptr);
-    virtual void        _Activate               (void);
-    virtual void        _BringWindowToFront     (void);
-    virtual void        _Deactivate             (void);
-    virtual bool        _ProcessOSEvent         (Ptr);
-    virtual void        _VisibleContents        (int&,int&,int&,int&);
-    virtual _HYRect     _GetWindowRect          (void);
-    bool        _IsHScroll              (ControlHandle);
-    virtual bool        _ProcessMenuSelection   (long) {
-        return false;
-    }
-    virtual void        _SetMenuBar             (void);
-    virtual void        _UnsetMenuBar           (void);
-    virtual _String&    _GetTitle               (void);
-    void        _SetWindowBackColor     (_HYColor);
-
-    Rect        newVRect                (void);
-    Rect        newHRect                (void);
-    Rect        newSRect                (void);
-    void        drawGrowIcon            (void);
-    virtual Ptr         _GetOSWindowData (void) {
-        return (Ptr)theWindow;
-    }
-
-
-    WindowPtr                           theWindow;
-    unsigned char                       flags;
-    ControlHandle                       vScroll,
-                                        hScroll;
-#ifdef  TARGET_API_MAC_CARBON
-    EventHandlerUPP                 sizeHandler;
-#endif
-    Rect                                savedLoc;
-    Ptr                                 containerRef;
-    bool                                sheet1st;
-};
-
-//__________________________________________________________________
-
-class _HYPlatformTWindow
-{
-
-public:
-
-    _HYPlatformTWindow  (Ptr);
-    // flags, title, visibility
-
-    virtual ~_HYPlatformTWindow (void);
-
-    virtual void        _SetWindowRectangle     (int,int,int,int,bool=true);
-
-#ifdef      TARGET_API_MAC_CARBON
-    EventLoopTimerUPP timerUPP;
-    EventLoopTimerRef theTimer;
-    EventHandlerUPP   scrollWheelH;
-#endif
-};
-
-//__________________________________________________________________
-
-class _HYPlatformPWindow
-{
-
-public:
-
-    _HYPlatformPWindow          (void);
-
-    virtual ~_HYPlatformPWindow         (void);
-
-    virtual void _StartPicture          (void);
-    virtual void _EndPicture            (void);
-    virtual void _DrawPicture           (_HYRect);
-
-private:
-
-    PicHandle            savedPic;
-    RgnHandle            savedClip;
-
-};
-
-//__________________________________________________________________
-
-extern   bool   forceUpdateForScrolling,
-         aquaInterfaceOn;
-
-void            _Close2 (Ptr);
-
-extern  Boolean             InitPrint (PMPrintSession);
-
-extern  CIconHandle         redButtonIcon,
-        yellowButtonIcon,
-        greenButtonIcon,
-        orangeButtonIcon;
-
-#ifdef TARGET_API_MAC_CARBON
-#ifndef PM_USE_SESSION_APIS
-#define PM_USE_SESSION_APIS 0
-#endif
-
-#include <PMApplication.h>
-extern PMPageFormat     gPageFormat;
-extern PMPrintSettings  gPrintSettings;
-extern Handle           gFlattenedFormat;
-extern Handle           gFlattenedSettings;
-pascal OSStatus         wSizeHandler (EventHandlerCallRef, EventRef, void*);
-#else
-#include <Printing.h>
-extern THPrint prRecHdl;
-#endif
-
-void                        _PaintTheCircle                 (CIconHandle,WindowPtr);
-
-#endif
-
-//EOF
diff --git a/src/gui/mac/plist.r b/src/gui/mac/plist.r
deleted file mode 100644
index 606a4d7..0000000
--- a/src/gui/mac/plist.r
+++ /dev/null
@@ -1,3 +0,0 @@
-read 'icns' (128) "HYPHY.icns";
-read 'icns' (129) "Docs.icns";
-read 'plst' (0) "plist.xml";
\ No newline at end of file
diff --git a/src/gui/mac/plist.xml b/src/gui/mac/plist.xml
deleted file mode 100644
index 6ed2a74..0000000
--- a/src/gui/mac/plist.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDocumentTypes</key>
-	<array>
-		<dict>
-			<key>CFBundleTypeExtensions</key>
-			<array>
-				<string>txt</string>
-				<string>text</string>
-			</array>
-			<key>CFBundleTypeIconFile</key>
-			<string>129</string>
-			<key>CFBundleTypeName</key>
-			<string>Text document</string>
-			<key>CFBundleTypeOSTypes</key>
-			<array>
-				<string>TEXT</string>
-			</array>
-			<key>CFBundleTypeRole</key>
-			<string>Viewer</string>
-		</dict>
-	</array>
-	<key>CFBundleIconFile</key>
-	<string>128</string>
-	<key>CFBundleIdentifier</key>
-	<string>org.hyphy</string>
-	<key>CFBundleLongVersionString</key>
-	<string>1.4, Copyright 1997-2006 Sergei L Kosakovsky Pond, Simon DW Frost and Spencer V Muse</string>
-	<key>CFBundleShortVersionString</key>
-	<string>1.00beta</string>
-	<key>CFBundleVersion</key>
-	<string>1.00beta</string>
-</dict>
-</plist>
diff --git a/src/gui/mac/plistmp.r b/src/gui/mac/plistmp.r
deleted file mode 100644
index 713af85..0000000
--- a/src/gui/mac/plistmp.r
+++ /dev/null
@@ -1 +0,0 @@
-read 'icns' (128) "HYPHYMP.icns";
read 'icns' (129) "Docs.icns";
read 'plst' (0) "plist.xml";
\ No newline at end of file
diff --git a/src/gui/res/Windows/128.cur b/src/gui/res/Windows/128.cur
deleted file mode 100644
index 50916c8..0000000
Binary files a/src/gui/res/Windows/128.cur and /dev/null differ
diff --git a/src/gui/res/Windows/129.cur b/src/gui/res/Windows/129.cur
deleted file mode 100644
index 6ad8b08..0000000
Binary files a/src/gui/res/Windows/129.cur and /dev/null differ
diff --git a/src/gui/res/Windows/130.bmp b/src/gui/res/Windows/130.bmp
deleted file mode 100644
index b6eccac..0000000
Binary files a/src/gui/res/Windows/130.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/131.bmp b/src/gui/res/Windows/131.bmp
deleted file mode 100644
index 59221ac..0000000
Binary files a/src/gui/res/Windows/131.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/132.bmp b/src/gui/res/Windows/132.bmp
deleted file mode 100644
index a76abd6..0000000
Binary files a/src/gui/res/Windows/132.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/132.cur b/src/gui/res/Windows/132.cur
deleted file mode 100644
index 754f9d5..0000000
Binary files a/src/gui/res/Windows/132.cur and /dev/null differ
diff --git a/src/gui/res/Windows/133.bmp b/src/gui/res/Windows/133.bmp
deleted file mode 100644
index bec9723..0000000
Binary files a/src/gui/res/Windows/133.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/3000.bmp b/src/gui/res/Windows/3000.bmp
deleted file mode 100644
index f15e5d4..0000000
Binary files a/src/gui/res/Windows/3000.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/333.bmp b/src/gui/res/Windows/333.bmp
deleted file mode 100644
index 2b106c5..0000000
Binary files a/src/gui/res/Windows/333.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/400.bmp b/src/gui/res/Windows/400.bmp
deleted file mode 100644
index e65f928..0000000
Binary files a/src/gui/res/Windows/400.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/4000.bmp b/src/gui/res/Windows/4000.bmp
deleted file mode 100644
index a75ad26..0000000
Binary files a/src/gui/res/Windows/4000.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/4001.bmp b/src/gui/res/Windows/4001.bmp
deleted file mode 100644
index 80e84a4..0000000
Binary files a/src/gui/res/Windows/4001.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/4002.bmp b/src/gui/res/Windows/4002.bmp
deleted file mode 100644
index 8623e20..0000000
Binary files a/src/gui/res/Windows/4002.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/4003.bmp b/src/gui/res/Windows/4003.bmp
deleted file mode 100644
index 978be2c..0000000
Binary files a/src/gui/res/Windows/4003.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/401.bmp b/src/gui/res/Windows/401.bmp
deleted file mode 100644
index c56c7ad..0000000
Binary files a/src/gui/res/Windows/401.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/4011.bmp b/src/gui/res/Windows/4011.bmp
deleted file mode 100644
index 896eeb8..0000000
Binary files a/src/gui/res/Windows/4011.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/402.bmp b/src/gui/res/Windows/402.bmp
deleted file mode 100644
index aba1bb8..0000000
Binary files a/src/gui/res/Windows/402.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/4020.bmp b/src/gui/res/Windows/4020.bmp
deleted file mode 100644
index 90bdecb..0000000
Binary files a/src/gui/res/Windows/4020.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/5000.bmp b/src/gui/res/Windows/5000.bmp
deleted file mode 100644
index ed562e5..0000000
Binary files a/src/gui/res/Windows/5000.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/5001.bmp b/src/gui/res/Windows/5001.bmp
deleted file mode 100644
index 1606b1d..0000000
Binary files a/src/gui/res/Windows/5001.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/5002.bmp b/src/gui/res/Windows/5002.bmp
deleted file mode 100644
index 50b26e3..0000000
Binary files a/src/gui/res/Windows/5002.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/5003.bmp b/src/gui/res/Windows/5003.bmp
deleted file mode 100644
index d70ab5a..0000000
Binary files a/src/gui/res/Windows/5003.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/5004.bmp b/src/gui/res/Windows/5004.bmp
deleted file mode 100644
index 980bed0..0000000
Binary files a/src/gui/res/Windows/5004.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/5005.bmp b/src/gui/res/Windows/5005.bmp
deleted file mode 100644
index 63ab8b9..0000000
Binary files a/src/gui/res/Windows/5005.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/5006.bmp b/src/gui/res/Windows/5006.bmp
deleted file mode 100644
index 8d3b949..0000000
Binary files a/src/gui/res/Windows/5006.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/5007.bmp b/src/gui/res/Windows/5007.bmp
deleted file mode 100644
index d94e949..0000000
Binary files a/src/gui/res/Windows/5007.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6000.bmp b/src/gui/res/Windows/6000.bmp
deleted file mode 100644
index 1e526f4..0000000
Binary files a/src/gui/res/Windows/6000.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6001.bmp b/src/gui/res/Windows/6001.bmp
deleted file mode 100644
index 34d20f7..0000000
Binary files a/src/gui/res/Windows/6001.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6002.bmp b/src/gui/res/Windows/6002.bmp
deleted file mode 100644
index 939e9c5..0000000
Binary files a/src/gui/res/Windows/6002.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6003.bmp b/src/gui/res/Windows/6003.bmp
deleted file mode 100644
index fa0025c..0000000
Binary files a/src/gui/res/Windows/6003.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6004.bmp b/src/gui/res/Windows/6004.bmp
deleted file mode 100644
index 62e4e1a..0000000
Binary files a/src/gui/res/Windows/6004.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6005.bmp b/src/gui/res/Windows/6005.bmp
deleted file mode 100644
index b06a34e..0000000
Binary files a/src/gui/res/Windows/6005.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6006.bmp b/src/gui/res/Windows/6006.bmp
deleted file mode 100644
index 95829f8..0000000
Binary files a/src/gui/res/Windows/6006.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6007.bmp b/src/gui/res/Windows/6007.bmp
deleted file mode 100644
index d438889..0000000
Binary files a/src/gui/res/Windows/6007.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6008.bmp b/src/gui/res/Windows/6008.bmp
deleted file mode 100644
index b74c8da..0000000
Binary files a/src/gui/res/Windows/6008.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6009.bmp b/src/gui/res/Windows/6009.bmp
deleted file mode 100644
index 2b95d61..0000000
Binary files a/src/gui/res/Windows/6009.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6010.bmp b/src/gui/res/Windows/6010.bmp
deleted file mode 100644
index 9fc9048..0000000
Binary files a/src/gui/res/Windows/6010.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6011.bmp b/src/gui/res/Windows/6011.bmp
deleted file mode 100644
index 5bfbf96..0000000
Binary files a/src/gui/res/Windows/6011.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6012.bmp b/src/gui/res/Windows/6012.bmp
deleted file mode 100644
index 690d702..0000000
Binary files a/src/gui/res/Windows/6012.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6013.bmp b/src/gui/res/Windows/6013.bmp
deleted file mode 100644
index 825568d..0000000
Binary files a/src/gui/res/Windows/6013.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6014.bmp b/src/gui/res/Windows/6014.bmp
deleted file mode 100644
index f86c2be..0000000
Binary files a/src/gui/res/Windows/6014.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6016.bmp b/src/gui/res/Windows/6016.bmp
deleted file mode 100644
index 557d7cc..0000000
Binary files a/src/gui/res/Windows/6016.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6017.bmp b/src/gui/res/Windows/6017.bmp
deleted file mode 100644
index 6f4a120..0000000
Binary files a/src/gui/res/Windows/6017.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6018.bmp b/src/gui/res/Windows/6018.bmp
deleted file mode 100644
index c15ce17..0000000
Binary files a/src/gui/res/Windows/6018.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6019.bmp b/src/gui/res/Windows/6019.bmp
deleted file mode 100644
index f141875..0000000
Binary files a/src/gui/res/Windows/6019.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6020.bmp b/src/gui/res/Windows/6020.bmp
deleted file mode 100644
index 4f802db..0000000
Binary files a/src/gui/res/Windows/6020.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6021.bmp b/src/gui/res/Windows/6021.bmp
deleted file mode 100644
index fdd576a..0000000
Binary files a/src/gui/res/Windows/6021.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6022.bmp b/src/gui/res/Windows/6022.bmp
deleted file mode 100644
index 7308af5..0000000
Binary files a/src/gui/res/Windows/6022.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6030.bmp b/src/gui/res/Windows/6030.bmp
deleted file mode 100644
index ad60375..0000000
Binary files a/src/gui/res/Windows/6030.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6031.bmp b/src/gui/res/Windows/6031.bmp
deleted file mode 100644
index f1a5c9d..0000000
Binary files a/src/gui/res/Windows/6031.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6032.bmp b/src/gui/res/Windows/6032.bmp
deleted file mode 100644
index 705a854..0000000
Binary files a/src/gui/res/Windows/6032.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6033.bmp b/src/gui/res/Windows/6033.bmp
deleted file mode 100644
index 4c1b1fd..0000000
Binary files a/src/gui/res/Windows/6033.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6034.bmp b/src/gui/res/Windows/6034.bmp
deleted file mode 100644
index ae125d4..0000000
Binary files a/src/gui/res/Windows/6034.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6035.bmp b/src/gui/res/Windows/6035.bmp
deleted file mode 100644
index fc7f38a..0000000
Binary files a/src/gui/res/Windows/6035.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6036.bmp b/src/gui/res/Windows/6036.bmp
deleted file mode 100644
index 0cabbeb..0000000
Binary files a/src/gui/res/Windows/6036.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6040.bmp b/src/gui/res/Windows/6040.bmp
deleted file mode 100644
index b36e96b..0000000
Binary files a/src/gui/res/Windows/6040.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6041.bmp b/src/gui/res/Windows/6041.bmp
deleted file mode 100644
index d7c14ad..0000000
Binary files a/src/gui/res/Windows/6041.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/6042.bmp b/src/gui/res/Windows/6042.bmp
deleted file mode 100644
index 50114dd..0000000
Binary files a/src/gui/res/Windows/6042.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7000.bmp b/src/gui/res/Windows/7000.bmp
deleted file mode 100644
index 0faa2ea..0000000
Binary files a/src/gui/res/Windows/7000.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7001.bmp b/src/gui/res/Windows/7001.bmp
deleted file mode 100644
index b8001bc..0000000
Binary files a/src/gui/res/Windows/7001.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7002.bmp b/src/gui/res/Windows/7002.bmp
deleted file mode 100644
index 5273de3..0000000
Binary files a/src/gui/res/Windows/7002.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7003.bmp b/src/gui/res/Windows/7003.bmp
deleted file mode 100644
index 3f7185c..0000000
Binary files a/src/gui/res/Windows/7003.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7004.bmp b/src/gui/res/Windows/7004.bmp
deleted file mode 100644
index 3ac440f..0000000
Binary files a/src/gui/res/Windows/7004.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7005.bmp b/src/gui/res/Windows/7005.bmp
deleted file mode 100644
index 92e5a71..0000000
Binary files a/src/gui/res/Windows/7005.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7010.bmp b/src/gui/res/Windows/7010.bmp
deleted file mode 100644
index 6b67bce..0000000
Binary files a/src/gui/res/Windows/7010.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7011.bmp b/src/gui/res/Windows/7011.bmp
deleted file mode 100644
index 1492bf5..0000000
Binary files a/src/gui/res/Windows/7011.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7012.bmp b/src/gui/res/Windows/7012.bmp
deleted file mode 100644
index a31b9bd..0000000
Binary files a/src/gui/res/Windows/7012.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7013.bmp b/src/gui/res/Windows/7013.bmp
deleted file mode 100644
index af4c2d4..0000000
Binary files a/src/gui/res/Windows/7013.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7014.bmp b/src/gui/res/Windows/7014.bmp
deleted file mode 100644
index 4ac56eb..0000000
Binary files a/src/gui/res/Windows/7014.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7020.bmp b/src/gui/res/Windows/7020.bmp
deleted file mode 100644
index fe61dc8..0000000
Binary files a/src/gui/res/Windows/7020.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/7050.bmp b/src/gui/res/Windows/7050.bmp
deleted file mode 100644
index c88e0c8..0000000
Binary files a/src/gui/res/Windows/7050.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/Win.rc b/src/gui/res/Windows/Win.rc
deleted file mode 100644
index c75c080..0000000
--- a/src/gui/res/Windows/Win.rc
+++ /dev/null
@@ -1 +0,0 @@
-#define IDM_NEW				10
#define IDM_OPEN			80
#define IDM_CLOSE			12
#define IDM_SAVE			13
#define IDM_PRINT			14
#define IDM_EXIT			15
#define IDM_UNDO			16
#define IDM_CUT				17
#define IDM_COPY			18
#define IDM_PASTE			19
#define IDM_ALL				20

#include <afxres.h>

HYPHY MENU
{
	POPUP "&File"
	{
		POPUP "&New"
		{
			MENUITEM "New &Tree\tCtrl+N", 	     	 70
			MENUITEM "New &Model\tCtrl+Shift+N", 	 71
			MENUITEM "New &Chart\tCtrl+Shift+Alt+N", 72
			MENUITEM "New &Genetic Code", 		 	 73
			MENUITEM "New S&QLite Database", 	 	 74
		}

		POPUP "&Open"
		{
			MENUITEM "Open &Batch File\tCtrl+O", 	     80
			MENUITEM "Open &Data File\tCtrl+Alt+O", 	 81
			MENUITEM "Open &Tree File\tCtrl+Shift+O",    82
			MENUITEM SEPARATOR
			MENUITEM "Open &Recent",					 85
			MENUITEM SEPARATOR
			MENUITEM "Open Text &File",    				 83
			MENUITEM "Open Ta&ble",    					 84
			MENUITEM "Open S&QLite Database",    		 85
		}
		
		MENUITEM SEPARATOR
		MENUITEM "&Save\tCtrl+S",				IDM_SAVE
		MENUITEM SEPARATOR
		MENUITEM "&Print\tCtrl+P",				IDM_PRINT
		MENUITEM SEPARATOR
		MENUITEM "E&xit\tAlt+F4",				IDM_EXIT
	}
	
	POPUP "&Edit"
	{
		MENUITEM "&Undo\tCtrl+Z",				IDM_UNDO, GRAYED
		MENUITEM "&Redo\tCtrl+Y",				31, GRAYED
		MENUITEM SEPARATOR	
		MENUITEM "Cu&t\tCtrl+X",				IDM_CUT, GRAYED
		MENUITEM "&Copy\tCtrl+C",				IDM_COPY, GRAYED
		MENUITEM "&Paste\tCtrl+V",				IDM_PASTE, GRAYED
		MENUITEM SEPARATOR
		MENUITEM "Select A&ll\tCtrl+A",			IDM_ALL
		MENUITEM "Clea&r Console",				26
		MENUITEM SEPARATOR
		POPUP	 "&Settings"
		{
			MENUITEM "&HYPHY Settings",			27
			MENUITEM "&Font Settings",			28
		}
	}
	
	POPUP "&Analyses"
	{
		MENUITEM "&Cancel Execution\tCtrl+.", 	 21,GRAYED
		MENUITEM "&Suspend Execution\tCtrl+;",	 22,GRAYED
		MENUITEM SEPARATOR
		MENUITEM "&View messages.log",		  	 23
		MENUITEM SEPARATOR
		MENUITEM "Standard &Analyses\tCtrl+E",	 24
		MENUITEM "&Results",					 40
		MENUITEM "Rerun &Last Analysis\tCtrl+R", 30, GRAYED
		/*MENUITEM SEPARATOR
		MENUITEM "&Trees",					     40, GRAYED*/
		MENUITEM SEPARATOR
		MENUITEM "C&ompute Expression\tCtrl+K",	 60
		MENUITEM "Execute Se&lection",		     61
	}
	
	POPUP "&Windows"
	{
		MENUITEM "&Console Window\tCtrl+0", 	200
		MENUITEM "Object &Inspector\tCtrl+I", 	201
	}

	POPUP "&Help"
	{
		MENUITEM "&About HYPHY", 				25
		MENUITEM "HYPHY &Help", 				29
	}
}

HYPHY	    ACCELERATORS
{
	"^O",	IDM_OPEN
	"^S",	IDM_SAVE
	"^P",	IDM_PRINT
	"^R",	30
	"^Z",	IDM_UNDO
	"N", 	70, VIRTKEY, CONTROL
	"N", 	71, VIRTKEY, CONTROL, SHIFT
	"N", 	72, VIRTKEY, CONTROL, SHIFT, ALT
	"O", 	80, VIRTKEY, CONTROL
	"O", 	81, VIRTKEY, CONTROL, ALT
	"O", 	82, VIRTKEY, CONTROL, SHIFT
	/* Note ther is no accelerator for Ctrl-C Copy because it is   */
	/* is treated specially under WM_CHAR to resolve the ambiguity */
	/* between Ctrl-C meaning Copy and meaning Interrupt. mm 980421*/
	"^X",	IDM_CUT
	"^V",	IDM_PASTE
	"^A",	IDM_ALL
	"^.",	21
	"^;",	22
	"^E",	24
	"^R",	30
	"^0",	200
	"^I",	201
	"^K",	60
}


101 DIALOG FIXED IMPURE 0, 0, 289, 170
STYLE DS_MODALFRAME | DS_3DLOOK  | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU 
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
   DEFPUSHBUTTON   "OK",1,170,140,50,14,WS_DISABLED
   PUSHBUTTON      "Cancel",2,226,140,50,14
   LISTBOX         1000,15,18,144,135,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | 
                   WS_TABSTOP | LBS_HASSTRINGS
   GROUPBOX        "Item Description",-1,169,18,104,115
   LTEXT           "",65534,175,30,94,98
END

102 DIALOG FIXED IMPURE  0, 0, 169, 170
STYLE DS_MODALFRAME | DS_3DLOOK  | WS_POPUP | WS_CAPTION | DS_CENTER |
   WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
   DEFPUSHBUTTON   "OK",1,29,149,50,14,WS_DISABLED
   PUSHBUTTON      "Cancel",2,87,149,50,14
   LISTBOX         1000,11,7,144,135,LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | 
                   LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
END

200                     BITMAP  DISCARDABLE     "hyphy.bmp"

103 DIALOG FIXED DISCARDABLE  0, 0, 264, 258
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CAPTION | DS_CENTER |
   WS_SYSMENU
CAPTION "About HYPHY"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Sans Serif"
{
 DEFPUSHBUTTON "OK", 1, 107, 238, 50, 14, BS_CENTER | BS_VCENTER
 CONTROL 200, 200, "STATIC", SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE, 0, 0, 264, 137
 LTEXT "", 129, 5, 143, 254, 88, NOT WS_GROUP | WS_BORDER
}


104 DIALOG FIXED DISCARDABLE  0, 0, 288, 172
STYLE DS_MODALFRAME | DS_3DLOOK  | WS_POPUP | WS_CAPTION | DS_CENTER 
CAPTION "HYPHY  Preferences"
FONT 8, "MS Sans Serif"
BEGIN
   DEFPUSHBUTTON   "Done",1,173,144,50,14
   PUSHBUTTON      "Cancel",2,225,144,50,14
   CONTROL         "Tree1",3,"SysTreeView32",WS_BORDER | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_HASLINES | 
                   WS_TABSTOP,13,14,144,144
   GROUPBOX        "Item Description",6,171,12,103,91
   GROUPBOX        "Value",15,171,107,103,30,NOT WS_VISIBLE
   LTEXT           "",7,177,24,92,74
   EDITTEXT        11,177,119,92,13,ES_AUTOHSCROLL | NOT WS_VISIBLE 
   COMBOBOX        12,177,120,92,200,CBS_DROPDOWNLIST | NOT WS_VISIBLE | 
                   WS_VSCROLL | WS_TABSTOP 
END

105 DIALOG FIXED IMPURE 0, 0, 289, 170
STYLE DS_MODALFRAME | DS_3DLOOK  | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU 
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
   DEFPUSHBUTTON   "OK",1,170,140,50,14,WS_DISABLED
   PUSHBUTTON      "Cancel",2,226,140,50,14
   CONTROL         "Tree1",3,"SysTreeView32",WS_BORDER | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_HASLINES | 
                   WS_TABSTOP,13,14,144,144
   GROUPBOX        "Item Description",-1,169,18,104,115
   LTEXT           "",65534,175,30,94,98
END



107 DIALOG FIXED DISCARDABLE   0, 0, 264, 274
STYLE DS_3DLOOK |  DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CAPTION 
CAPTION "Welcome to HyPhy"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Sans Serif"
BEGIN
   DEFPUSHBUTTON   "OK",1,169,257,50,14
   CONTROL         "Do not show again",0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,259,75,10
   CTEXT           "Static",5,51,146,167,11,SS_CENTERIMAGE
   CONTROL         400,2,"Static",SS_BITMAP | SS_NOTIFY ,50,160,172,32
   CONTROL         401,3,"Static",SS_BITMAP | SS_NOTIFY | SS_REALSIZEIMAGE ,50,192,172,32
   CONTROL         402,4,"Static",SS_BITMAP | SS_NOTIFY | SS_REALSIZEIMAGE ,50,224,172,32
   CONTROL         200,6,"Static",SS_BITMAP | SS_NOTIFY | SS_SUNKEN,0,0,274,141
END

110 DIALOG 0, 0, 300, 200 
STYLE DS_MODALFRAME | DS_3DLOOK  | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU 
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
END

1 VERSIONINFO 
BEGIN
	BLOCK "StringFileInfo"
		BEGIN
			BLOCK "0409"
				BEGIN
					VALUE "CompanyName", "Sergei L. Kosakovsky Pond, Spencer V. Muse"
					VALUE "FileDescription", "HYPHY - Hypothesis Testing Using Phylogenies"
					VALUE "FileVesion", "0.99beta"
					VALUE "InternalName", "HYPHY"
					VALUE "OriginalFilename", "HYPHY.EXE"
					VALUE "ProductName", "HYPHY(Win32)"
					VALUE "ProductVesrion", "0.99beta"
				END
		END
END 


STRINGTABLE DISCARDABLE 
BEGIN
   0                       " "
   1                       "_Core Developers:"
   2                       "Sergei L Kosakovsky Pond (spond at ucsd.edu)"
   3                       "Steven Weaver (sweaver at ucsd.edu)"
   4                       "Art FY Poon    (apoon at cfenet.ubc.ca)"
   5                       "_Module Developers:"
   6                       "Lance Hepler (nlhepler at gmail.com)"
   7                       "Martin Smith (martin.audacis at gmail.com)"
   8                       "_Significant contributions from:"
   9                       "Spencer V Muse (muse at stat.ncsu.edu)"
   10                      "Simon DW Frost (sdf22 at cam.ac.uk)"
   11                      " "
   12                       "_Program Resources and Updates:"
   13                       "http://www.hyphy.org/"
   14                      "1998-2013, distributed as freeware."
   15                      "Funded by a mix of NSF/NIH grants."
   16					    " "
   17                      "_Important Note"
   18                      "This program is distributed in the hope  "
   19                      "that it will be useful but WITHOUT ANY WARRANTY;"
   20                      "without even the implied warranty of MERCHANTABILITY"
   21                      "or FITNESS FOR A PARTICULAR PURPOSE."
   22                      "See the website for more details."
END


101	     	 ICON  		"desk.ico"
APPICON  	 ICON  		"desk.ico"

131		 BITMAP  	"131.bmp"
132		     BITMAP  	"132.bmp"

333		     BITMAP  	"333.bmp"

400		     BITMAP  	"400.bmp"
401		     BITMAP  	"401.bmp"
402		     BITMAP  	"402.bmp"

4000		 BITMAP  	"4000.bmp"
4001		 BITMAP  	"4001.bmp"
4002		 BITMAP  	"4002.bmp"
4003		 BITMAP  	"4003.bmp"
4011		 BITMAP  	"4011.bmp"
4020		 BITMAP  	"4020.bmp"

5000     BITMAP  "5000.bmp"
5001     BITMAP  "5001.bmp"
5002     BITMAP  "5002.bmp"
5003     BITMAP  "5003.bmp"
5004     BITMAP  "5004.bmp"
5005     BITMAP  "5005.bmp"
5006     BITMAP  "5006.bmp"
5007     BITMAP  "5007.bmp"

6000     BITMAP  "6000.bmp"
6001     BITMAP  "6001.bmp"
6002     BITMAP  "6002.bmp"
6003     BITMAP  "6003.bmp"
6004     BITMAP  "6004.bmp"
6005     BITMAP  "6005.bmp"
6006     BITMAP  "6006.bmp"
6007     BITMAP  "6007.bmp"
6008     BITMAP  "6008.bmp"
6009     BITMAP  "6009.bmp"

6010     BITMAP  "6010.bmp"
6011     BITMAP  "6011.bmp"
6012     BITMAP  "6012.bmp"
6013     BITMAP  "6013.bmp"
6014     BITMAP  "6014.bmp"

6016     BITMAP  "6016.bmp"
6017     BITMAP  "6017.bmp"
6018     BITMAP  "6018.bmp"
6019     BITMAP  "6019.bmp"
6020     BITMAP  "6020.bmp"
6021     BITMAP  "6021.bmp"
6022     BITMAP  "6022.bmp"

6030     BITMAP  "6030.bmp"
6031     BITMAP  "6031.bmp"
6032     BITMAP  "6032.bmp"
6033     BITMAP  "6033.bmp"
6034     BITMAP  "6034.bmp"
6035     BITMAP  "6035.bmp"
6036     BITMAP  "6036.bmp"

6040     BITMAP  "6040.bmp"
6041     BITMAP  "6041.bmp"
6042     BITMAP  "6042.bmp"

7000     BITMAP  "7000.bmp"
7001     BITMAP  "7001.bmp"
7002     BITMAP  "7002.bmp"
7003     BITMAP  "7003.bmp"
7004     BITMAP  "7004.bmp"
7005     BITMAP  "7005.bmp"

7010     BITMAP  "7010.bmp"
7011     BITMAP  "7011.bmp"
7012     BITMAP  "7012.bmp"
7013     BITMAP  "7013.bmp"
7014     BITMAP  "7014.bmp"
7020     BITMAP  "7020.bmp"

7050     BITMAP  "7050.bmp"

130     BITMAP  "130.bmp"
133     BITMAP  "133.bmp"
3000     BITMAP  "3000.bmp"

\ No newline at end of file
diff --git a/src/gui/res/Windows/desk.ico b/src/gui/res/Windows/desk.ico
deleted file mode 100644
index 59efff0..0000000
Binary files a/src/gui/res/Windows/desk.ico and /dev/null differ
diff --git a/src/gui/res/Windows/hyphy.bmp b/src/gui/res/Windows/hyphy.bmp
deleted file mode 100644
index c8b3475..0000000
Binary files a/src/gui/res/Windows/hyphy.bmp and /dev/null differ
diff --git a/src/gui/res/Windows/pthreadGC2.dll b/src/gui/res/Windows/pthreadGC2.dll
deleted file mode 100644
index 8c5dca6..0000000
Binary files a/src/gui/res/Windows/pthreadGC2.dll and /dev/null differ
diff --git a/src/gui/res/Windows/pthreadVC2.dll b/src/gui/res/Windows/pthreadVC2.dll
deleted file mode 100644
index 0f47a83..0000000
Binary files a/src/gui/res/Windows/pthreadVC2.dll and /dev/null differ
diff --git a/src/gui/win/Components/HYPlatformButton.cpp b/src/gui/win/Components/HYPlatformButton.cpp
deleted file mode 100644
index 5f561b4..0000000
--- a/src/gui/win/Components/HYPlatformButton.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Button component for Win32.

    Sergei L. Kosakovsky Pond, May 2000 - December 2002
*/

#include "errorfns.h"
#include "HYButton.h"
#include "HYUtils.h"
#include "HYEventTypes.h"
#include "HYGraphicPane.h"
#include "HYPlatformWindow.h"


//__________________________________________________________________

_HYPlatformButton::_HYPlatformButton    (void)
{
    backFill = CreateSolidBrush (RGB (255,255,255));
    checkPointer (backFill);

    buttonWindow    = nil;
    buttonRect      = (RECT) {
        0,0,100,100
    };

    pLabelFont      = nil;
    fc              = 0;
}

//__________________________________________________________________

_HYPlatformButton::~_HYPlatformButton   (void)
{
    DeleteObject (backFill);
    if (pLabelFont) {
        DeleteObject (pLabelFont);
    }
}

//__________________________________________________________________

void    _HYPlatformButton::_SetBackColor (_HYColor& c)
{
    DeleteObject (backFill);
    backFill = CreateSolidBrush (RGB(c.R,c.G,c.B));
    checkPointer (backFill);
}

//__________________________________________________________________

void        _HYPlatformButton::_SetFont (_HYFont& f)
{
    if (pLabelFont) {
        DeleteObject(pLabelFont);
    }

    pLabelFont = CreateFont (f.size,0,0,0,(f.style&HY_FONT_BOLD)?FW_BOLD:FW_NORMAL,f.style&HY_FONT_ITALIC,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
                             CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,f.face.sData);

    if (buttonWindow) {
        SendMessage (buttonWindow, WM_SETFONT, (WPARAM)pLabelFont, 1);
    }
}

//__________________________________________________________________
void        _HYPlatformButton::_Update (Ptr p)
{
    _Paint (p);
}


//__________________________________________________________________
void        _HYPlatformButton::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYButton* theParent = (_HYButton *) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}


//__________________________________________________________________
void        _HYPlatformButton::_EnableButton (bool e)
{
    if (buttonWindow) {
        EnableWindow (buttonWindow, e);
    }
}



//__________________________________________________________________
void        _HYPlatformButton::_SetButtonKind (unsigned char k)
{
    if (buttonWindow) {
        bool         onOff = (k==HY_BUTTON_OK);
        SendMessage (buttonWindow,BM_SETSTYLE, onOff?BS_DEFPUSHBUTTON:BS_PUSHBUTTON, 1);
    }
}


//__________________________________________________________________
void        _HYPlatformButton::_SetVisibleSize (_HYRect rel)
{
    _HYButton * theParent = (_HYButton*) this;

    buttonRect.left=rel.left;
    buttonRect.top = rel.top;

    _HYRect s = theParent->_SuggestDimensions();

    buttonRect.right =  buttonRect.left+s.right;
    buttonRect.bottom = buttonRect.top+s.bottom;

    AlignRectangle (rel, buttonRect, theParent->GetAlignFlags());

    if (buttonWindow) {
        SetWindowPos(buttonWindow,nil, buttonRect.left,buttonRect.top,buttonRect.right-buttonRect.left+1,buttonRect.bottom-buttonRect.top+1,SWP_NOZORDER);
    }
}


//__________________________________________________________________
void        _HYPlatformButton::_Paint (Ptr p)
{
    _HYButton * theParent = (_HYButton*) this;
    RECT        notButton,
                clientArea = HYRect2Rect (theParent->rel);
    SubtractRect (&notButton, &clientArea, & buttonRect);

    if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
        FillRect     ((HDC)((_HYRect*)p)->width, &notButton, backFill);
    }

    if (buttonWindow) {
        UpdateWindow (buttonWindow);
    }

    (*theParent)._HYPlatformComponent::_Paint(p);
}

//__________________________________________________________________

_HYRect _HYButton::_SuggestDimensions (void)
{
    _HYRect res = {10,100,10,100,HY_COMPONENT_NO_SCROLL};

    res.top = res.bottom = buttonFont.size+8;
    res.left= res.right  = GetVisibleStringWidth (buttonText,buttonFont) + 15;

    return res;
}

//__________________________________________________________________

void        _HYButton::_Activate (void)
{
    if (!activationFlag)
        if (buttonWindow&&isEnabled) {
            EnableWindow (buttonWindow,true);
        }

    _HYPlatformComponent::_Activate();
}

//__________________________________________________________________

void        _HYButton::_Deactivate (void)
{
    if (activationFlag)
        if (buttonWindow&&isEnabled) {
            EnableWindow (buttonWindow,false);
        }

    _HYPlatformComponent::_Deactivate();
}

//__________________________________________________________________

void        _HYPlatformButton::_SetText (void)
{
    _HYButton *parent = (_HYButton*)this;

    if (buttonWindow) {
        SetWindowText (buttonWindow,parent->buttonText.sData);
    } else {
        buttonWindow = CreateWindow ("BUTTON",parent->buttonText.sData,WS_VISIBLE|WS_CHILD|((parent->buttonKind==HY_BUTTON_OK)?BS_DEFPUSHBUTTON:BS_PUSHBUTTON),
                                     buttonRect.left,buttonRect.right,buttonRect.right-buttonRect.left+1,buttonRect.bottom-buttonRect.top+1
                                     ,((_HYButton*)this)->parentWindow,NULL,GetModuleHandle (NULL), NULL);

        checkPointer   (buttonWindow);

        if (pLabelFont) {
            SendMessage (buttonWindow, WM_SETFONT, (WPARAM)pLabelFont, 1);
        }
    }
}

//__________________________________________________________________

bool _HYButton::_ProcessOSEvent (Ptr vEvent)
{
    _HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;

    switch (theEvent->iMsg) {
    case WM_COMMAND: {
        WORD       wP = HIWORD(theEvent->wParam);
        if ((wP==BN_CLICKED)||(wP==BN_DOUBLECLICKED)) {
            HWND    cbh = (HWND)theEvent->lParam;
            if ((cbh == buttonWindow)&&isEnabled) {
                if (messageRecipient) {
                    messageRecipient->ProcessEvent (generateButtonPushEvent (GetID(),0));
                }
                return true;
            }
        }
        break;
    }
    case WM_CTLCOLORBTN: {
        if ((HWND)theEvent->lParam == buttonWindow) {
            theEvent->res = (LRESULT)backFill;
            return true;
        }
        break;
    }
    case WM_CHAR: {
        bool    good    = false;
        int     keyCode = theEvent->wParam;

        if (buttonKind == HY_BUTTON_OK) {
            good = (keyCode==VK_RETURN);
        } else if (buttonKind == HY_BUTTON_CANCEL) {
            good = (keyCode== VK_ESCAPE);
        }

        if (good) {
            SendMessage (buttonWindow, BM_SETSTATE, true, 0);
            if (messageRecipient) {
                messageRecipient->ProcessEvent (generateButtonPushEvent (GetID(),0));
            }
        }
        if (good) {
            return true;
        }
        break;
    }
    }
    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}
// EOF
\ No newline at end of file
diff --git a/src/gui/win/Components/HYPlatformButtonBar.cpp b/src/gui/win/Components/HYPlatformButtonBar.cpp
deleted file mode 100644
index ac5fdeb..0000000
--- a/src/gui/win/Components/HYPlatformButtonBar.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Toolbar component for Mac OS API

    Sergei L. Kosakovsky Pond, May 2000-December 2002
*/

#include "HYButtonBar.h"
#include "HYPullDown.h"
#include "errorfns.h"
#include "HYPlatformWindow.h"
#include "commctrl.h"
#include "HYGraphicPane.h"


extern bool forceUpdateForScrolling;

//__________________________________________________________________

HBRUSH      blackIconFill = CreateSolidBrush (RGB(0,0,0)),
            dimIconFill   = CreatePatternBrush (LoadBitmap (GetModuleHandle(NULL),MAKEINTRESOURCE(333)));

HPEN        buttonBorder1 = CreatePen        (PS_SOLID, 1, RGB(0,0,0));


//__________________________________________________________________

_HYPlatformButtonBar::_HYPlatformButtonBar(void)
{
    backFill = CreateSolidBrush(RGB(0xff,0xff,0xff));
    if (!backFill) {
        warnError (-108);
    }
    pushed = -1;
    lastMouseDown = -1;
    ttCtl = nil;

}

//__________________________________________________________________

_HYPlatformButtonBar::~_HYPlatformButtonBar(void)
{
    if (backFill) {
        DeleteObject (backFill);
    }
    DestroyWindow (ttCtl);
}


//__________________________________________________________________

void    _HYPlatformButtonBar::_DisposeButtons(void)
{
    _HYButtonBar* theParent = (_HYButtonBar*)this;
    for (long i=0; i<theParent->ButtonCount(); i++) {
        DeleteObject ((HBITMAP)theParent->buttons.lData[i]);
    }
}

//__________________________________________________________________

void    _HYPlatformButtonBar::_DisposeButton(long k)
{
    _HYButtonBar* theParent = (_HYButtonBar*)this;
    if ((k<theParent->ButtonCount())&&(k>=0)) {
        DeleteObject ((HBITMAP)theParent->buttons.lData[k]);
    }
}

//__________________________________________________________________

void        _HYPlatformButtonBar::_SetBackColor (_HYColor& c)
{
    if (backFill)   {
        DeleteObject(backFill);
    }
    backFill = CreateSolidBrush(RGB(c.R,c.G,c.B));
}


//__________________________________________________________________
void        _HYPlatformButtonBar::_SetVisibleSize (_HYRect rel)
{
    _HYButtonBar* theParent = (_HYButtonBar*) this;
    buttonRect.left=rel.left;
    buttonRect.top = rel.top;
    _HYRect s = theParent->_SuggestDimensions();
    buttonRect.right = buttonRect.left+s.right;
    buttonRect.bottom = buttonRect.top+s.bottom;
    AlignRectangle (rel, buttonRect, theParent->GetAlignFlags());
    if (ttCtl) {
        TOOLINFO ti;
        ti.cbSize = sizeof (TOOLINFO);
        ti.uFlags = TTF_SUBCLASS;
        ti.hwnd   = theParent->parentWindow;
        ti.hinst  = ProgramInstance;
        for (long k=0; k<theParent->buttons.lLength; k++) {
            _String * tt = (_String*)theParent->toolTips(k);
            if (tt->sLength) {
                ti.uId = k;
                int    h, v;
                theParent->GetButtonLoc (k,h,v,false);
                ti.rect.left   = h;
                ti.rect.top    = v;
                ti.rect.right  = h+theParent->GetButtonDim();
                ti.rect.bottom = v+theParent->GetButtonDim();
                //printf ("Added: %s %d %d %d %d\n", tt->sData, ti.rect.left, ti.rect.top, ti.rect.right, ti.rect.bottom);
                SendMessage(ttCtl, TTM_NEWTOOLRECT, 0, (LPARAM) (LPTOOLINFO) &ti);
            }
        }
    }
}

//__________________________________________________________________

void        _HYButtonBar::_Activate (void)
{
    if (!activationFlag)
        for (long k=0; k<enabledButtons.lLength; k++) {
            _MarkButtonForUpdate (enabledButtons.lData[k]);
        }

    //SendMessage (ttCtl, TTM_ACTIVATE, 1, 0);
    if (ttCtl) {
        DestroyWindow (ttCtl);
    }

    ttCtl = CreateWindowEx (WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP|TTS_NOPREFIX|TTS_ALWAYSTIP,
                            CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,parentWindow,
                            NULL,ProgramInstance, NULL);

    checkPointer (ttCtl);
    SetWindowPos (ttCtl, HWND_TOPMOST, 0, 0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);

//  if (SendMessage (ttCtl, TTM_GETTOOLCOUNT, 0, 0) == 0)
    {

        TOOLINFO ti;
        ti.cbSize = sizeof (TOOLINFO);
        ti.uFlags = TTF_SUBCLASS;
        ti.hwnd   = parentWindow;
        ti.hinst  = ProgramInstance;

        //long k = 0;
        for (long k=0; k<buttons.lLength; k++) {
            _String * tt = (_String*)toolTips(k);
            if (tt->sLength) {
                ti.uId = k;
                int    h, v;
                GetButtonLoc (k,h,v,false);
                ti.rect.left   = h;
                ti.rect.top    = v;
                ti.rect.right  = h+GetButtonDim();
                ti.rect.bottom = v+GetButtonDim();
                ti.lpszText    = tt->sData;
                //printf ("Added: %s %d %d %d %d\n", tt->sData, ti.rect.left, ti.rect.top, ti.rect.right, ti.rect.bottom);
                SendMessage(ttCtl, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
            }
        }
    }
    _HYPlatformComponent::_Activate();
}

//__________________________________________________________________

void        _HYButtonBar::_Deactivate (void)
{
    if (activationFlag) {
        for (long k=0; k<enabledButtons.lLength; k++) {
            _MarkButtonForUpdate (enabledButtons.lData[k]);
        }
    }
    //SendMessage (ttCtl, TTM_ACTIVATE, 0, 0);
    if (ttCtl) {
        DestroyWindow (ttCtl);
    }
    ttCtl = nil;
    _HYPlatformComponent::_Deactivate();
}

//__________________________________________________________________

void        _HYButtonBar::_ComponentMouseExit (void)
{
    _UnpushButton();
}


//__________________________________________________________________
void        _HYPlatformButtonBar::_Paint (Ptr p)
{
    _HYButtonBar * theParent = (_HYButtonBar*)this;
    _HYRect * relRect = (_HYRect*)p;
    HDC     theContext = (HDC)relRect->width;
    RECT    cRect,iRect;
    cRect.left = relRect->left;
    cRect.right = relRect->right;
    cRect.top = relRect->top;
    cRect.bottom = relRect->bottom;

    if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
        FillRect (theContext,&cRect,backFill);
    }

    HRGN clipRgn   = CreateRectRgn (cRect.left,cRect.top,cRect.right,cRect.bottom);
    HPEN savePen   = (HPEN)SelectObject (theContext,buttonBorder1);

    if (!clipRgn) {
        warnError (-108);
    }
    SelectClipRgn (theContext,clipRgn);
    cRect.left = buttonRect.left;
    cRect.top = buttonRect.top;
    int   step = theParent->GetButtonDim()+2*HY_BUTTONBAR_BORDER;
    cRect.right = cRect.left+step;
    cRect.bottom = cRect.top+step;

    if (theParent->ButtonCount()) {
        if (otherDC) {
            for (long i=0; i<theParent->ButtonCount(); i++) {
                if (i&&(i%theParent->BarWidth()==0)) {
                    cRect.left = buttonRect.left;
                    cRect.top +=step;
                    cRect.bottom +=step;
                    cRect.right = cRect.left+step;
                }
                iRect = cRect;
                InflateRect (&iRect,-HY_BUTTONBAR_BORDER,-HY_BUTTONBAR_BORDER);
                RECT iRect2 = iRect;
                iRect2.right++;
                iRect2.bottom++;

                bool        paintDimmed = false;

                BITMAP    theBM;
                GetObject ((HBITMAP)theParent->buttons(i), sizeof (BITMAP), &theBM);

                SelectObject (otherDC, (HBITMAP)theParent->buttons(i));

                if (theParent->activationFlag) {
                    if (i==pushed) {
                        FillRect (theContext, &iRect2, blackIconFill);

                        //TransparentBlt     (theContext, iRect.left, iRect.top, iRect.right-iRect.left+1, iRect.bottom-iRect.top+1,
                        // otherDC, 0, 0, theBM.bmWidth, theBM.bmHeight, RGB(255,255,255));
                        DrawTransparentBitmap (theContext,(HBITMAP)theParent->buttons(i),iRect.left, iRect.top, iRect.right-iRect.left+1, iRect.bottom-iRect.top+1,RGB(255,255,255));
                    } else {
                        if (theParent->enabledButtons.Find(i)>=0)
                            StretchBlt   (theContext, iRect.left, iRect.top, iRect.right-iRect.left+1, iRect.bottom-iRect.top+1,
                                          otherDC, 0, 0, theBM.bmWidth, theBM.bmHeight, SRCCOPY);
                        else {
                            paintDimmed = true;
                        }
                    }
                } else {
                    paintDimmed = true;
                }

                if (paintDimmed) {

                    FillRect (theContext, &iRect2, dimIconFill);

                    StretchBlt   (theContext, iRect.left, iRect.top, iRect.right-iRect.left+1, iRect.bottom-iRect.top+1,
                                  otherDC, 0, 0, theBM.bmWidth, theBM.bmHeight, SRCPAINT);
                }

                MoveToEx (theContext,iRect.left-1,iRect.top-1,NULL);
                LineTo (theContext,iRect.right+1,iRect.top-1);
                LineTo (theContext,iRect.right+1,iRect.bottom+1);
                LineTo (theContext,iRect.left-1,iRect.bottom+1);
                LineTo (theContext,iRect.left-1,iRect.top-1);

                cRect.left +=step;
                cRect.right +=step;
            }

            SelectObject (otherDC, oDCBM);
        } else {
            _String errMsg = _String ("Failed to make CompatibleDC in _HYPlatformButtonBar::_Paint");
            ReportWarning (errMsg);
        }
    }
    SelectObject (theContext,savePen);
    SelectClipRgn (theContext,NULL);
    DeleteObject (clipRgn);

    (*theParent)._HYPlatformComponent::_Paint(p);
}
//__________________________________________________________________
_HYRect _HYPlatformButtonBar::_GetButtonRect (bool conv)
{
    _HYButtonBar* theParent = (_HYButtonBar*)this;
    _HYRect res;
    res.left   = buttonRect.left;
    res.right  = buttonRect.right;
    res.top    = buttonRect.top;
    res.bottom = buttonRect.bottom;
    if (conv) {
        POINT loc = {res.left, res.top};
        ClientToScreen (theParent->parentWindow, &loc);
        res.right += loc.x-res.left;
        res.bottom += loc.y-res.top;
        res.left   = loc.x;
        res.top    = loc.y;
    }
    return res;
}



//__________________________________________________________________
void        _HYPlatformButtonBar::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformButtonBar::_MarkButtonForUpdate (int i)
{
    _HYButtonBar* theParent = (_HYButtonBar*)this;
    RECT invRect;
    if ((i>=0)&&(i<theParent->ButtonCount())) {
        int hR = i%theParent->BarWidth(),
            vR = i/theParent->BarWidth(),
            step = 2*HY_BUTTONBAR_BORDER+theParent->GetButtonDim();

        invRect.left = buttonRect.left+hR*step;
        invRect.right = invRect.left+step;
        invRect.top = buttonRect.top+vR*step;
        invRect.bottom = invRect.top+step;
        if (forceUpdateForScrolling) {
            RECT    rel = HYRect2Rect (theParent->rel);
            RECT           tempRect;
            IntersectRect (&tempRect,&rel,&invRect);
            RedrawWindow (theParent->parentWindow, &tempRect, nil, RDW_UPDATENOW|RDW_NOCHILDREN);
        } else {
            InvalidateRect (theParent->parentWindow,&invRect,false);
        }
    }
}

//__________________________________________________________________
void        _HYPlatformButtonBar::_UnpushButton (void)
{
    if (pushed>=0) {
        _MarkButtonForUpdate(pushed);
        pushed = -1;
        lastMouseDown = -1;
    }
}


//__________________________________________________________________
void        _HYPlatformButtonBar::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYButtonBar* theParent = (_HYButtonBar*) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}

//__________________________________________________________________
int         _HYPlatformButtonBar::_FindClickedButton (int h, int v)
{
    POINT localClick = {v,h};
    _HYButtonBar * parent = (_HYButtonBar*)this;
    if (PtInRect (&buttonRect, localClick)) {
        int v = localClick.y-buttonRect.top,
            h = localClick.x-buttonRect.left,
            step = 2*HY_BUTTONBAR_BORDER+parent->buttonDim,
            hR = h/step,
            vR = v/step;

        v-=vR*step;
        h-=hR*step;
        if ((v>HY_BUTTONBAR_BORDER)&&(v<step-HY_BUTTONBAR_BORDER)&&
                (h>HY_BUTTONBAR_BORDER)&&(h<step-HY_BUTTONBAR_BORDER)) {
            return hR+vR*parent->barW;
        }
    }
    return -1;

}

//__________________________________________________________________
void        _HYButtonBar::_DisplayToolTip      (void)
{
    //TBI
}


//__________________________________________________________________

bool _HYButtonBar::_ProcessOSEvent (Ptr vEvent)
{
    _HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;
    if (buttons.lLength) {
        switch (theEvent->iMsg) {
        case WM_LBUTTONDOWN: {
            POINT localClick;
            localClick.x = LOWORD (theEvent->lParam);
            localClick.y = HIWORD (theEvent->lParam);
            int h = _FindClickedButton (localClick.y,localClick.x);
            if ((h>=0)&&(enabledButtons.Find(h)>=0)) {
                if (pullDownButtons.Find (h)>=0) {
                    lastMouseDown = -1;
                    SendButtonPush(h);
                } else {
                    pushed = h;
                    lastMouseDown = h;
                    _MarkButtonForUpdate (h);
                }
            }
            return true;
        }
        case WM_LBUTTONUP: {
            if (pushed>=0) {
                POINT localClick;
                localClick.x = LOWORD (theEvent->lParam);
                localClick.y = HIWORD (theEvent->lParam);
                int h = _FindClickedButton (localClick.y,localClick.x);
                if (h==pushed) {
                    _MarkButtonForUpdate (h);
                    SendButtonPush (h);
                    pushed = -1;
                    lastMouseDown = -1;
                    _MarkButtonForUpdate (h);
                }
            }
            return true;
        }
        case WM_MOUSEMOVE : {
            if (lastMouseDown>=0) {
                POINT localClick;
                localClick.x = LOWORD (theEvent->lParam);
                localClick.y = HIWORD (theEvent->lParam);
                int h = _FindClickedButton (localClick.y,localClick.x);
                if (h!=lastMouseDown) {
                    if (pushed>=0) {
                        pushed = -1;
                        _MarkButtonForUpdate (lastMouseDown);
                    }
                } else {
                    if (pushed==-1) {
                        pushed = lastMouseDown;
                        _MarkButtonForUpdate (lastMouseDown);
                    }

                }
            }
            return true;
        }
        }
    }

    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}

//EOF
\ No newline at end of file
diff --git a/src/gui/win/Components/HYPlatformCheckBox.cpp b/src/gui/win/Components/HYPlatformCheckBox.cpp
deleted file mode 100644
index 6ea0128..0000000
--- a/src/gui/win/Components/HYPlatformCheckBox.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Check box for Win32.

    Sergei L. Kosakovsky Pond, May 2000-December 2002
*/

#include "HYLabel.h"
#include "errorfns.h"
#include "HYPlatformWindow.h"
#include "commctrl.h"

//__________________________________________________________________

static LRESULT  CALLBACK checkBoxSubclassHandler (HWND WindowHand, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
    _HYCheckbox * theParent = (_HYCheckbox*)GetWindowLongPtr (WindowHand, GWLP_USERDATA);

    /*switch (iMsg)
    {
        case WM_ERASEBKGND:
        {
            return 1;
        }
    }*/

    return CallWindowProc ((WNDPROC)theParent->mainHandler, WindowHand, iMsg, wParam, lParam);
}

//__________________________________________________________________

_HYPlatformCheckbox::_HYPlatformCheckbox (bool isR)
{
    buttonWindow = nil;
    isRadio      = isR;
    checkboxRect = (RECT) {
        0,0,100,100
    };
}

//__________________________________________________________________
_HYPlatformCheckbox::~_HYPlatformCheckbox (void)
{
}


//__________________________________________________________________

void        _HYCheckbox::_Activate (void)
{
    _HYPlatformComponent::_Activate();
}

//__________________________________________________________________

void        _HYCheckbox::_Deactivate (void)
{
    _HYPlatformComponent::_Deactivate();
}

//__________________________________________________________________

bool _HYCheckbox::_ProcessOSEvent (Ptr vEvent)
{
    _HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;

    switch (theEvent->iMsg) {
    case WM_COMMAND: {
        WORD       wP = HIWORD(theEvent->wParam);
        if ((wP==BN_CLICKED)||(wP==BN_DOUBLECLICKED)) {
            HWND    cbh = (HWND)theEvent->lParam;
            if ((cbh == buttonWindow)&&isEnabled) {
                //printf   ("Button Push\n");
                SetState (!checkState, true);
                return true;
            }
        }
        break;
    }
    case WM_CTLCOLORBTN: {
        if ((HWND)theEvent->lParam == buttonWindow) {
            if (settings.width&HY_COMPONENT_TRANSP_BG) {
                theEvent->res = (LRESULT)defBrush;
            } else {
                theEvent->res = (LRESULT)backFill;
            }
            return true;
        }
        break;
    }
    }
    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}


//__________________________________________________________________

_HYRect     _HYCheckbox::_SuggestDimensions (void)
{
    _HYRect res = _HYLabel::_SuggestDimensions();

    res.left += checkSpacing*2 + 13;
    res.right = res.left;

    return res;
}

//__________________________________________________________________
void        _HYPlatformCheckbox::_SetVisibleSize (_HYRect rel)
{
    _HYCheckbox * theParent = (_HYCheckbox*) this;

    theParent->labelRect.left= rel.left;
    theParent->labelRect.top = rel.top;

    _HYRect s = theParent->_SuggestDimensions();

    theParent->labelRect.right =  theParent->labelRect.left+s.right;
    theParent->labelRect.bottom = theParent->labelRect.top+s.bottom;

    AlignRectangle (rel, theParent->labelRect, theParent->GetAlignFlags());

    checkboxRect.left = theParent->labelRect.left + theParent->checkSpacing;
    checkboxRect.bottom = theParent->labelRect.bottom;

    checkboxRect.right = checkboxRect.left+13;
    checkboxRect.top = checkboxRect.bottom-13;

    theParent->labelRect.left += 13+2*theParent->checkSpacing;

    if (buttonWindow) {
        SetWindowPos (buttonWindow,nil,checkboxRect.left,checkboxRect.top,0,0,SWP_NOSIZE|SWP_NOZORDER);
    } else {
        buttonWindow = CreateWindow ("BUTTON","",WS_VISIBLE|WS_CHILD|(isRadio?BS_RADIOBUTTON:BS_CHECKBOX),checkboxRect.left,checkboxRect.right,checkboxRect.right-checkboxRect.left+1,checkboxRect.bottom-checkboxRect.top+1
                                     ,((_HYCheckbox*)this)->parentWindow,NULL,GetModuleHandle (NULL), NULL);

        checkPointer   (buttonWindow);

        _SetState (theParent->checkState);

        SetWindowLongPtr (buttonWindow,GWLP_USERDATA, (LONG_PTR)theParent);
        mainHandler = SetWindowLongPtr (buttonWindow,GWLP_WNDPROC,(LONG_PTR)checkBoxSubclassHandler);

        char          buffer[256];

        GetClassName (theParent->parentWindow, buffer, 255);
        WNDCLASS      classInfo;
        GetClassInfo (ProgramInstance, buffer, &classInfo);
        defBrush = classInfo.hbrBackground;

        /*
        SIZE           idealSize;
        Button_GetIdealSize         (buttonWindow, idealSize);
        bool           resize = false;
        long           diff = checkBox.Rect.right-checkBox.left+1-idealSize.x;

        if (diff)
        {
            resize = true;
            checkBoxRect.left  -=diff/2;
            checkBoxRect.right -= (diff-diff/2);
        }

        diff = checkBox.Rect.bottom-checkBox.top+1-idealSize.y;

        if (diff)
        {
            resize = true;
            checkBoxRect.top    -= diff/2;
            checkBoxRect.bottom -= (diff-diff/2);
        }

        if (resize)
            SetWindowPos (buttonWindow,NULL,checkboxRect.left,checkboxRect.right,checkboxRect.right-checkboxRect.left+1,checkboxRect.bottom-checkboxRect.top+1,SWP_NOZORDER|SWP_NOMOVE);
        */
    }
}

//__________________________________________________________________

void        _HYPlatformCheckbox::_Enable (bool e)
{
    if (buttonWindow) {
        EnableWindow (buttonWindow, e);
    }
}

//__________________________________________________________________
void        _HYPlatformCheckbox::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformCheckbox::_Paint (Ptr p)
{
    _HYCheckbox *theParent = (_HYCheckbox*) this;
    if (buttonWindow) {
        UpdateWindow (buttonWindow);
    }
    theParent->_HYPlatformLabel::_Paint(p);
}


//__________________________________________________________________
void    _HYPlatformCheckbox::_SetState (bool v)
{
    if (buttonWindow) {
        SendMessage (buttonWindow, BM_SETCHECK, v?BST_CHECKED:BST_UNCHECKED,0);
    }
}


//EOF
\ No newline at end of file
diff --git a/src/gui/win/Components/HYPlatformLabel.cpp b/src/gui/win/Components/HYPlatformLabel.cpp
deleted file mode 100644
index f1b2634..0000000
--- a/src/gui/win/Components/HYPlatformLabel.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Button component for Win32.

    Sergei L. Kosakovsky Pond, May 2000 - December 2002
*/

#include "HYLabel.h"
#include "HYUtils.h"
#include "HYGraphicPane.h"

//__________________________________________________________________

_HYPlatformLabel::_HYPlatformLabel(void)
{

    backFill = CreateSolidBrush(RGB(0xff,0xff,0xff));
    if (!backFill) {
        warnError (-108);
    }
    fc = 0;
    pLabelFont = nil;
    labelPen = nil;
}

//__________________________________________________________________

_HYPlatformLabel::~_HYPlatformLabel(void)
{
    if (backFill) {
        DeleteObject (backFill);
    }

    if (pLabelFont) {
        DeleteObject (pLabelFont);
    }

    if (labelPen) {
        DeleteObject (labelPen);
    }

}

//__________________________________________________________________

void        _HYPlatformLabel::_SetBackColor (_HYColor& c)
{
    if (backFill) {
        DeleteObject(backFill);
    }

    backFill = CreateSolidBrush(RGB(c.R,c.G,c.B));
}

//__________________________________________________________________

void        _HYPlatformLabel::_SetText (void)
{
}


//__________________________________________________________________

void        _HYPlatformLabel::_SetForeColor (_HYColor& c)
{
    HDC  theDC = GetDC(((_HYLabel*)this)->parentWindow);
    fc = HYColor2ColorRef (c,theDC);
    ReleaseDC (((_HYLabel*)this)->parentWindow, theDC);
    if (labelPen) {
        DeleteObject(labelPen);
    }
    labelPen = (HPEN)CreatePen (PS_SOLID,1,fc);
}

//__________________________________________________________________

void        _HYPlatformLabel::_SetFont (_HYFont& f)
{
    if (pLabelFont) {
        DeleteObject(pLabelFont);
    }
    pLabelFont = CreateFont (f.size,0,0,0,(f.style&HY_FONT_BOLD)?FW_BOLD:FW_NORMAL,f.style&HY_FONT_ITALIC,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
                             CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,f.face.sData);
}

//__________________________________________________________________
void        _HYPlatformLabel::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformLabel::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYLabel* theParent = (_HYLabel*) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}

//__________________________________________________________________
void        _HYPlatformLabel::_SetVisibleSize (_HYRect rel)
{
    _HYLabel* theParent = (_HYLabel*) this;
    labelRect.left=rel.left;
    labelRect.top = rel.top;
    _HYRect s = theParent->_SuggestDimensions();
    labelRect.right = labelRect.left+s.right;
    labelRect.bottom = labelRect.top+s.bottom;
    AlignRectangle (rel, labelRect, theParent->GetAlignFlags());
}



//__________________________________________________________________
void        _HYPlatformLabel::_Paint (Ptr p)
{

    _HYLabel * theParent = (_HYLabel*)this;

    _HYRect * relRect = (_HYRect*)p;
    HDC     theContext = (HDC)relRect->width;
    RECT    cRect;
    cRect.left = relRect->left;
    cRect.right = relRect->right;
    cRect.top = relRect->top;
    cRect.bottom = relRect->bottom;

    if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
        FillRect (theContext,&cRect,backFill);
    }

    if (!(theParent->settings.width&HY_COMPONENT_WELL)) {
        InflateRect (&cRect,-2,-2);
    }

    HPEN     savePen = (HPEN)SelectObject (theContext,labelPen);
    HFONT    saveFont = (HFONT)SelectObject (theContext,pLabelFont);
    COLORREF saveColor = GetTextColor (theContext);
    SetBkMode (theContext,TRANSPARENT);
    SetTextAlign (theContext,TA_BASELINE);
    if (theParent->HasShadow()) {
        _HYColor fcc = theParent->GetForeColor(),sc;
        sc.R = fcc.R/4;
        sc.B  = fcc.B/4;
        sc.G = fcc.G/4;
        SetTextColor (theContext,HYColor2ColorRef(sc,theContext));
        ExtTextOut(theContext,labelRect.left+3,labelRect.bottom-3,ETO_CLIPPED,&cRect,theParent->GetText().sData,theParent->GetText().sLength,NULL);
        sc.R = fcc.R/2;
        sc.B  = fcc.B/2;
        sc.G = fcc.G/2;
        SetTextColor (theContext,HYColor2ColorRef(sc,theContext));
        ExtTextOut(theContext,labelRect.left+1,labelRect.bottom-1,ETO_CLIPPED,&cRect,theParent->GetText().sData,theParent->GetText().sLength,NULL);

    }
    SetTextColor (theContext,fc);
    ExtTextOut(theContext,labelRect.left+2,labelRect.bottom-2,ETO_CLIPPED,&cRect,theParent->GetText().sData,theParent->GetText().sLength,NULL);
    SelectObject (theContext,savePen);
    SelectObject (theContext,saveFont);
    SetTextColor (theContext,saveColor);

    (*theParent)._HYPlatformComponent::_Paint(p);
}

//__________________________________________________________________
_HYRect _HYLabel::_SuggestDimensions (void)
{
    _HYRect res = {10,100,10,100,HY_COMPONENT_NO_SCROLL};
    HFONT lF, cF;
    lF = CreateFont (labelFont.size,0,0,0,(labelFont.style&HY_FONT_BOLD)?FW_BOLD:FW_NORMAL,labelFont.style&HY_FONT_ITALIC,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
                     CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,labelFont.face.sData);
    HDC  parentDC = GetDC (parentWindow);
    cF = (HFONT)SelectObject (parentDC,lF);
    SIZE textSize;
    if(GetTextExtentPoint32(parentDC,labelText.sData,labelText.sLength,&textSize)) {
        res.left = res.right = textSize.cx+5;
    }
    if (cF) {
        SelectObject (parentDC,cF);
    }
    DeleteObject(lF);
    ReleaseDC (parentWindow, parentDC);
    return res;
}


// EOF
\ No newline at end of file
diff --git a/src/gui/win/Components/HYPlatformPullDown.cpp b/src/gui/win/Components/HYPlatformPullDown.cpp
deleted file mode 100644
index 6f5a3ab..0000000
--- a/src/gui/win/Components/HYPlatformPullDown.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Button component for Win 32.

    Sergei L. Kosakovsky Pond, May 2000-December 2002.
*/

#include "HYLabel.h"
#include "HYPullDown.h"
#include "errorfns.h"
#include "HYPlatformWindow.h"
#include "HYEventTypes.h"


//__________________________________________________________________

static LRESULT  CALLBACK pullDownSubclassHandler (HWND WindowHand, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
    _HYPullDown * theParent = (_HYPullDown*)GetWindowLongPtr (WindowHand, GWLP_USERDATA);

    switch (iMsg) {
    case WM_LBUTTONDOWN:
    case WM_LBUTTONDBLCLK: {
        if (theParent->IsEnabled()) {

            POINT loc = {theParent->menuRect.left, theParent->menuRect.top};
            ClientToScreen (theParent->parentWindow, &loc);

            if (theParent->messageRecipient) {
                theParent->messageRecipient->ProcessEvent (generateMenuOpenEvent (theParent->GetID()));
            }

            SetMenuDefaultItem (theParent->theMenu, theParent->selection, true);

            long tSel = TrackPopupMenu (theParent->theMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_LEFTBUTTON|TPM_NONOTIFY,
                                        loc.x,
                                        loc.y,
                                        0, theParent->parentWindow, NULL);
            if (tSel) {
                theParent->selection = tSel-1;
                theParent->SendSelectionChange();
                theParent->_RefreshComboBox();
            }
        }
        return 0L;
    }
    }

    return CallWindowProc ((WNDPROC)theParent->mainHandler, WindowHand, iMsg, wParam, lParam);
}

//__________________________________________________________________

_HYPlatformPullDown::_HYPlatformPullDown(void)
{
    myMenu   = CreateWindow ("COMBOBOX","",CBS_DROPDOWNLIST|WS_CHILD,0,0,100,25,((_HYPullDown*)this)->parentWindow,NULL,GetModuleHandle (NULL), NULL);
    backFill = CreateSolidBrush(RGB(0xff,0xff,0xff));
    theMenu  = CreatePopupMenu ();

    if ((!backFill)||(!myMenu)||(!theMenu)) {
        warnError (-108);
    }
    selection      = 0;
    cbSelection    = -1;
    menuWidth      = 100;

    SetWindowLongPtr (myMenu,GWLP_USERDATA, (LONG_PTR)((_HYPullDown*)this));

    mainHandler = SetWindowLongPtr (myMenu,GWLP_WNDPROC,(LONG_PTR)pullDownSubclassHandler);
}


//__________________________________________________________________

_HYPlatformPullDown::~_HYPlatformPullDown(void)
{
    if (backFill) {
        DeleteObject (backFill);
    }
    if (theMenu) {
        DestroyMenu (theMenu);
    }
}

//__________________________________________________________________
void        _HYPlatformPullDown::_AdjustItemIDs  (long from, long to, long shift)
{
    MENUITEMINFO     newItem;
    newItem.cbSize = sizeof (MENUITEMINFO);
    newItem.fMask  = MIIM_ID;
    for (long k=from; k<to; k++) {
        GetMenuItemInfo (theMenu, k, true, &newItem);
        newItem.wID += shift;
        SetMenuItemInfo (theMenu, k, true, &newItem);
    }
}

//__________________________________________________________________
void        _HYPlatformPullDown::_RefreshComboBox  ()
{
    _HYPullDown * theParent = (_HYPullDown*)this;

    if (myMenu&&((cbSelection!=selection)||(!theParent->IsEnabled()))) {

        if (SendMessage (myMenu, CB_GETCOUNT, 0, 0)) {
            SendMessage (myMenu, CB_DELETESTRING, 0, 0);
        }

        if (theParent->MenuItemCount()) {
            if (selection<theParent->MenuItemCount()) {
                _String * mItem = theParent->GetMenuItem (selection);

                if (mItem->Equal(&menuSeparator)) {
                    mItem = ∅
                }

                SendMessage (myMenu, CB_ADDSTRING, 0, (LPARAM)theParent->GetMenuItem (selection)->sData);
                SendMessage (myMenu, CB_SETCURSEL, 0, 0);
                cbSelection = selection;
            }
        }
    }
}

//__________________________________________________________________
void        _HYPlatformPullDown::_AddMenuItem   (_String& newItemText, long index)
{
    _String      newString (newItemText);

    if (!myMenu) {
        return;
    }

    MENUITEMINFO     newItem = {sizeof (MENUITEMINFO),0,0,0,0,nil,nil,nil,nil,0,nil};

    _HYPullDown * theParent = (_HYPullDown*)this;

    if (index<0) {
        index = theParent->MenuItemCount()-1;
    }

    if (newString == menuSeparator) {
        newItem.fMask = MIIM_TYPE;
        newItem.fType = MFT_SEPARATOR;
    } else {
        newItem.fMask = MIIM_TYPE;
        newItem.fType = MFT_STRING;

        if (newString.sData[0] == '(') {
            newString.Trim (1,-1);
            newItem.fState = MFS_GRAYED;
        }

        newItem.dwTypeData = newString.sData;


        SIZE textSize;
        HDC  theDC = GetDC(myMenu);
        if(GetTextExtentPoint32(theDC,newString.sData,newString.sLength,&textSize)) {
            if (textSize.cx+25>menuWidth) {
                menuWidth = textSize.cx+25;
            }
        }
        ReleaseDC (myMenu, theDC);
    }

    newItem.fMask |= MIIM_ID|MIIM_STATE|MIIM_CHECKMARKS;
    newItem.wID = index;

    InsertMenuItem (theMenu, index, true, &newItem);
    _AdjustItemIDs (index, theParent->MenuItemCount(),1);

    if ((theParent->MenuItemCount()==1)||(selection==index)) {
        cbSelection = -1;
        _RefreshComboBox();
    }
}

//__________________________________________________________________
void        _HYPlatformPullDown::_SetMenuItem   (_String& newItem, long index)
{
    if (!myMenu) {
        return;
    }

    if (index==selection) {
        cbSelection = -1;
        _RefreshComboBox();
    }

    _DeleteMenuItem (index);
    _AddMenuItem (newItem, index);
}

//__________________________________________________________________
void        _HYPlatformPullDown::_MarkItem      (long index, char mark)
{
    if (!myMenu) {
        return;
    }

    /*MENUITEMINFO     newItem;
    newItem.cbSize = sizeof (MENUITEMINFO);
    newItem.fMask  = MIIM_STATE|MIIM_TYPE;
    GetMenuItemInfo (theMenu, index, true, &newItem);
    bool set = false;
    if (mark)
    {
        if (!(newItem.fState & MFS_CHECKED))
        {
            newItem.fState |= MFS_CHECKED;
            if (mark==HY_PULLDOWN_BULLET_MARK)
                newItem.fType  |= MFT_RADIOCHECK;
            else
                if (newItem.fType & MFT_RADIOCHECK)
                    newItem.fType  -= MFT_RADIOCHECK;
            set = true;
        }
    }
    else
        if (newItem.fState  & MFS_CHECKED)
        {
            newItem.fState -= MFS_CHECKED;
            if (newItem.fType & MFT_RADIOCHECK)
                newItem.fType  -= MFT_RADIOCHECK;
            set = true;
        }

    if (set)
        SetMenuItemInfo (theMenu, index, true, &newItem);*/
    if (mark==HY_PULLDOWN_BULLET_MARK) {
        CheckMenuRadioItem (theMenu, index, index, index, MF_BYPOSITION);
    } else {
        CheckMenuItem (theMenu, index, MF_BYPOSITION|(mark?MF_CHECKED:MF_UNCHECKED));
    }
}

//__________________________________________________________________
char        _HYPlatformPullDown::_ItemMark      (long index)
{
    if (!myMenu) {
        return 0;
    }

    MENUITEMINFO     newItem;
    newItem.cbSize = sizeof (MENUITEMINFO);
    newItem.fMask  = MIIM_STATE|MIIM_TYPE;
    GetMenuItemInfo (theMenu, index, true, &newItem);
    if (newItem.fState & MFS_CHECKED) {
        return (newItem.fType&MFT_RADIOCHECK)?HY_PULLDOWN_BULLET_MARK:HY_PULLDOWN_CHECK_MARK;
    }

    return HY_PULLDOWN_NO_MARK;
}

//__________________________________________________________________
void        _HYPlatformPullDown::_DeleteMenuItem  (long index)
{
    if (!myMenu) {
        return;
    }

    _HYPullDown * theParent = (_HYPullDown*)this;
    DeleteMenu (theMenu, index, MF_BYPOSITION);


    _AdjustItemIDs (index, theParent->MenuItemCount(),-1);
    if (selection == index) {
        cbSelection = -1;
        _RefreshComboBox ();
    }
}

//__________________________________________________________________

void        _HYPlatformPullDown::_SetBackColor (_HYColor& c)
{
    if (backFill) {
        DeleteObject(backFill);
    }

    backFill = CreateSolidBrush(RGB(c.R,c.G,c.B));
}

//__________________________________________________________________
long        _HYPlatformPullDown::_GetSelection (void)
{
    return selection;
}

//__________________________________________________________________
void        _HYPlatformPullDown::_Duplicate (Ptr p)
{
    // unused
}

//__________________________________________________________________
void        _HYPlatformPullDown::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________
void        _HYPlatformPullDown::_SetDimensions (_HYRect r, _HYRect rel)
{
    _HYPullDown* theParent = (_HYPullDown*) this;
    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
    _SetVisibleSize (rel);
}

//__________________________________________________________________
void        _HYPlatformPullDown::_SetVisibleSize (_HYRect rel)
{
    _HYPullDown* theParent = (_HYPullDown*) this;
    menuRect.left = rel.left+3;
    menuRect.bottom = rel.bottom;
    menuRect.right= rel.right-3;
    menuRect.top = rel.top;
    if (myMenu) {
        if (menuRect.bottom-menuRect.top>25) {
            menuRect.bottom = menuRect.top+25;
        }

        if (menuRect.right-menuRect.left>menuWidth) {
            menuRect.right = menuRect.left+menuWidth;
        }
    }

    AlignRectangle (rel, menuRect, theParent->GetAlignFlags());
    SetWindowPos (myMenu,NULL,menuRect.left,menuRect.top,menuRect.right-menuRect.left+1,(menuRect.bottom-menuRect.top),SWP_NOZORDER);
    SendMessage (myMenu,CB_SETCURSEL,selection,0L);

    //if (theParent->IsEnabled())
    ShowWindow(myMenu,SW_SHOW);
}
//__________________________________________________________________
void        _HYPlatformPullDown::_EnableItem (long index, bool toggle)
{
    EnableMenuItem (theMenu, index, MF_BYPOSITION|(toggle?MF_ENABLED:(MF_GRAYED|MF_DISABLED)));
}

//__________________________________________________________________
void        _HYPlatformPullDown::_Paint (Ptr p)
{
    _HYPullDown * theParent = (_HYPullDown*)this;
    _HYRect * relRect = (_HYRect*)p;
    _RefreshComboBox();
    if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
        RECT    cRect;
        cRect.left = relRect->left;
        cRect.right = relRect->right;
        cRect.top = relRect->top;
        cRect.bottom = relRect->bottom;
        HDC     theContext = (HDC)relRect->width;
        FillRect (theContext,&cRect,backFill);
    }
    UpdateWindow (myMenu);
    theParent->_HYPlatformComponent::_Paint(p);
}

//__________________________________________________________________
void        _HYPlatformPullDown::_EnableMenu     (bool flag)
{
    if (myMenu) {
        EnableWindow (myMenu, flag);
    }
}

//__________________________________________________________________
_HYRect _HYPullDown::_SuggestDimensions (void)
{
    _HYRect res = {25,100,25,100,HY_COMPONENT_NO_SCROLL};
    if (myMenu) {
        res.right = menuWidth;
    }

    return res;
}

//__________________________________________________________________

void    _HYPullDown::_SetMenuItemTextStyle (long ID, char style)
{
    //if (myMenu)
    //SetItemStyle (myMenu,ID+1,style);

    // TBI
}

//__________________________________________________________________

bool _HYPullDown::_ProcessOSEvent (Ptr vEvent)
{
    /*_HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;

    switch (theEvent->iMsg)
    {
        case WM_CTLCOLORLISTBOX:
        {
            if ((HWND)theEvent->lParam == myMenu)
            {
                SetTextColor ((HDC)theEvent->wParam,GetSysColor (COLOR_GRAYTEXT));
                return true;
            }
            break;
        }
    }*/
    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
}



//EOF
\ No newline at end of file
diff --git a/src/gui/win/Components/HYPlatformSequencePane.cpp b/src/gui/win/Components/HYPlatformSequencePane.cpp
deleted file mode 100644
index 6ebad73..0000000
--- a/src/gui/win/Components/HYPlatformSequencePane.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
-    Sequence Panel for Win32 API
-
-    Sergei L. Kosakovsky Pond, May 2000-January 2003
-*/
-
-#include "errorfns.h"
-#include "HYSequencePanel.h"
-#include "HYUtils.h"
-#include "HYEventTypes.h"
-#include "HYPlatformWindow.h"
-#include "HYTableWindow.h"
-
-
-//__________________________________________________________________
-
-void    _HYSequencePane::_Paint (Ptr p)
-{
-    long        saveBorder = settings.width & HY_COMPONENT_BORDER;
-    settings.width -= saveBorder;
-    _HYPlatformComponent::_Paint(p);
-    settings.width += saveBorder;
-    _HYRect*    destR = (_HYRect*)p;
-
-    RECT        srcRect,
-                destRect;
-
-    HDC pDC = (HDC)destR->width;
-
-    destRect.right      = destR->right;
-    destRect.bottom     = destR->bottom;
-    if (HasHScroll()) {
-        destRect.bottom-= HY_SCROLLER_WIDTH;
-    }
-
-    if (HasVScroll()) {
-        destRect.right -= HY_SCROLLER_WIDTH;
-    }
-
-    destRect.left       = destR->left;
-    destRect.top        = destR->top;
-    _HYRect srcR        = _VisibleContents (p);
-    srcRect.right       = srcR.right-srcR.left;
-    srcRect.left        = 0;
-    srcRect.bottom      = srcR.bottom-srcR.top;
-    srcRect.top         = 0;
-
-    BitBlt (pDC,destRect.left,destRect.top,srcRect.right-srcRect.left,srcRect.bottom-srcRect.top,
-            thePane,srcRect.left,srcRect.top,SRCCOPY);
-}
-
-//__________________________________________________________________
-
-bool _HYSequencePane::_ProcessOSEvent (Ptr vEvent)
-{
-    static  bool    amScrolling = false,
-                    vertical;
-
-    static  POINT   localPt;
-
-    static  long    originalStart,
-            originalSpan,
-            lastClick,
-            firstClick;
-
-    if (_HYPlatformComponent::_ProcessOSEvent (vEvent)) {
-        return true;
-    }
-    if (!active) {
-        return false;
-    }
-
-    short lastH, lastV;
-    POINT globalPt;
-
-    _HYWindowsUIMessage*    theEvent = (_HYWindowsUIMessage*)vEvent;
-
-    switch (theEvent->iMsg) {
-    case WM_RBUTTONDOWN:
-    case WM_LBUTTONDOWN:
-    case WM_LBUTTONDBLCLK:
-        {
-
-            lastH = (short)LOWORD (theEvent->lParam),
-            lastV = (short)HIWORD (theEvent->lParam);
-
-            globalPt = (POINT) {
-                lastH, lastV
-            };
-
-            localPt  = (POINT) {
-                lastH - rel.left , lastV - rel.top
-            };
-
-            vertical = (localPt.x<headerWidth)&&(localPt.y>=(GetSlotHeight()+1));
-
-
-            if ((theEvent->iMsg == WM_LBUTTONDOWN)||(theEvent->iMsg == WM_LBUTTONDBLCLK)) {
-                forceUpdateForScrolling = true;
-                if (vertical)
-                    ProcessVSelectionChange (localPt.x,localPt.y,GetAsyncKeyState (VK_SHIFT) & 0x8000,
-                                             GetAsyncKeyState (VK_CONTROL) & 0x8000, false, theEvent->iMsg == WM_LBUTTONDBLCLK);
-                else
-                    ProcessSelectionChange  (localPt.x,localPt.y,GetAsyncKeyState (VK_SHIFT) & 0x8000,
-                                             GetAsyncKeyState (VK_CONTROL) & 0x8000);
-                forceUpdateForScrolling = false;
-
-                ClientToScreen (parentWindow, &globalPt);
-
-                if (DragDetect (parentWindow, globalPt)) {
-                    if (messageRecipient) {
-                        SetCapture (parentWindow);
-                        ((_HYTWindow*)messageRecipient)->trackMouseComponent = this;
-                    }
-                    amScrolling = true;
-                    if (vertical) {
-                        originalStart = startRow,
-                        originalSpan  = endRow-startRow;
-                        lastClick = -2;
-                        firstClick = (localPt.y-(GetSlotHeight()+1))/GetSlotHeight();
-                    }
-                }
-
-                return true;
-            }
-
-            if ((theEvent->iMsg == WM_RBUTTONDOWN)&&(vertical&&vselection.lLength)||((!vertical)&&selection.lLength)) {
-                ClientToScreen (parentWindow, &globalPt);
-                ProcessContextualPopUp (globalPt.x, globalPt.y);
-                return true;
-            }
-        }
-        break;
-
-    case WM_LBUTTONUP:
-        if (amScrolling) {
-            amScrolling = false;
-            if (messageRecipient) {
-                ReleaseCapture ();
-                ((_HYTWindow*)messageRecipient)->trackMouseComponent = nil;
-            }
-            if  (vertical) {
-                RECT invalRect = {rel.left,rel.top+(GetSlotHeight()+1)+1,rel.left+headerWidth,rel.bottom-HY_SCROLLER_WIDTH};
-                InvalidateRect (parentWindow,&invalRect,false);
-                if ((localPt.x<headerWidth)&&(localPt.x>0)&&(lastClick>-2)) {
-                    MoveSpecies (firstClick+originalStart,lastClick+startRow);
-                }
-            }
-        }
-        return true;
-        break;
-
-    case WM_MOUSEMOVE:
-        if ((theEvent->wParam & MK_LBUTTON)&&(amScrolling)) {
-            POINT mousePt = {((short)LOWORD (theEvent->lParam))-rel.left,
-                             ((short)HIWORD (theEvent->lParam))-rel.top
-                            };
-            if (vertical) {
-
-                long  wHeight = rel.bottom-rel.top-HY_SCROLLER_WIDTH,
-                      slotHeight = GetSlotHeight();
-
-
-                forceUpdateForScrolling = true;
-                if ((mousePt.y<(GetSlotHeight()+1))||(localPt.y!=mousePt.y)||(mousePt.y>wHeight)) {
-                    localPt = mousePt;
-                    if (mousePt.y>wHeight) {
-                        // scroll down
-                        if ((endRow<=speciesIndex.lLength)&&(vselection.lData[0]!=speciesIndex.lLength-1)) {
-                            if (endRow-startRow<originalSpan) {
-                                break;
-                            }
-                            startRow++;
-                            endRow++;
-                            _SetVScrollerPos(((double)MAX_CONTROL_VALUE*startRow)/
-                                             (speciesIndex.lLength-endRow+startRow+1));
-                            BuildPane();
-                            _MarkForUpdate();
-                            lastClick = -2;
-                        }
-                        break;
-                    } else {
-                        mousePt.y-=(GetSlotHeight()+1);
-                        if (mousePt.y<=slotHeight) {
-                            if (mousePt.y>=0) {
-                                if (mousePt.y<slotHeight/2) {
-                                    mousePt.y = -1;
-                                } else {
-                                    mousePt.y = 0;
-                                }
-                            } else {
-                                // scroll up
-                                if (startRow>0) {
-                                    startRow--;
-                                    endRow--;
-                                    _SetVScrollerPos(((double)MAX_CONTROL_VALUE*startRow)/(speciesIndex.lLength-endRow+startRow+1));
-                                    BuildPane();
-                                    _MarkForUpdate();
-                                    lastClick = -2;
-                                }
-                                break;
-                            }
-                        } else {
-                            mousePt.y=(mousePt.y-(GetSlotHeight()+1))/slotHeight;
-                        }
-                    }
-
-                    if ((mousePt.y<-1)||(mousePt.y>=(endRow-startRow))) {
-                        break;
-                    }
-                    if (mousePt.y!=lastClick) {
-                        HDC winDC    = GetDC   (parentWindow);
-                        int saveROP2 = GetROP2 (winDC);
-                        SetROP2 (winDC,R2_NOT);
-                        if (lastClick>=-1) {
-                            lastClick = (GetSlotHeight()+1)+slotHeight*(lastClick+1)+rel.top+1;
-                            MoveToEx(winDC,rel.left+1,lastClick,nil);
-                            LineTo  (winDC,rel.left+headerWidth-1,lastClick);
-                        }
-                        lastClick = mousePt.y;
-                        if (lastClick+startRow!=firstClick+originalStart) {
-                            mousePt.y = (GetSlotHeight()+1)+slotHeight*(lastClick+1)+rel.top+1;
-                            MoveToEx (winDC,rel.left+1,mousePt.y,nil);
-                            LineTo   (winDC,rel.left+headerWidth-1,mousePt.y);
-                        }
-                        SetROP2 (winDC,saveROP2);
-                        ReleaseDC (parentWindow,winDC);
-                    }
-                }
-                forceUpdateForScrolling = false;
-                return true;
-            } else {
-                if (((mousePt.x<headerWidth)&&(startColumn>0))||(localPt.x!=mousePt.x)||(mousePt.x>_HYCanvas::GetMaxW()-5)) {
-                    forceUpdateForScrolling = true;
-                    ProcessSelectionChange (mousePt.x,mousePt.y,true,true,true);
-                    forceUpdateForScrolling = false;
-                    localPt = mousePt;
-                }
-                return true;
-            }
-        }
-        break;
-    }
-
-    return false;
-}
-
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/win/Components/HYPlatformTable.cpp b/src/gui/win/Components/HYPlatformTable.cpp
deleted file mode 100644
index a18b175..0000000
--- a/src/gui/win/Components/HYPlatformTable.cpp
+++ /dev/null
@@ -1,1771 +0,0 @@
-/*
-    Table component for Mac OS API
-
-    Sergei L. Kosakovsky Pond, May 2000-December 2002
-*/
-
-#include "errorfns.h"
-#include "HYTableComponent.h"
-#include "HYUtils.h"
-#include "HYEventTypes.h"
-#include "HYWindow.h"
-#include "HYGraphicPane.h"
-#include "HYTextBox.h"
-#include "HYTableWindow.h"
-#include "HYDialogs.h"
-
-//__________________________________________________________________
-
-BOOL CALLBACK                   PrintDialogProc(HWND, UINT, WPARAM, LPARAM);
-BOOL CALLBACK                   AbortProc(HDC, int);
-HDC                             GetPrinterDeviceContext(HWND);
-
-extern  BOOL                    UserAbortFlag;
-extern  HWND                    PrintDialogHandle;
-
-
-extern  HCURSOR                 hSizeCursor,
-        pickUpCursor,
-        dropOffCursor;
-
-HPEN    menuLine1               = CreatePen (PS_SOLID,1,RGB(0xA0,0xA0,0xA0)),
-        menuLine2                = CreatePen (PS_SOLID,1,RGB(0x04,0x04,0x04));
-
-HBRUSH  _BLACKBRUSH_            = CreateSolidBrush (RGB(0,0,0));
-
-extern  HBITMAP                 tablePDMenuIcon;
-
-
-//__________________________________________________________________
-
-static LRESULT  CALLBACK tableEditSubclassHandler (HWND WindowHand, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
-    _HYTable * theParent = (_HYTable*)GetWindowLongPtr (WindowHand, GWLP_USERDATA);
-
-    switch (iMsg) {
-    case WM_CHAR: {
-        int     keyCode = wParam;
-        if (keyCode==VK_RETURN) {
-            theParent->EditBoxHandler (-1,theParent->rel);
-            return true;
-        } else if (keyCode==VK_TAB) {
-            SendMessage (theParent->parentWindow, WM_CHAR, wParam, lParam);
-            return true;
-        }
-
-        break;
-    }
-    }
-
-    return CallWindowProc ((WNDPROC)theParent->defautlTextHandler, WindowHand, iMsg, wParam, lParam);
-}
-
-
-//__________________________________________________________________
-
-_HYPlatformTable::_HYPlatformTable(void)
-{
-    backPattern  = nil;
-    backPattern2 = nil;
-    cursorState  = false;
-    editBox      = nil;
-    tableFont    = nil;
-    activeColumn = -1;
-    activeColumn2= -1;
-}
-
-//__________________________________________________________________
-
-_HYPlatformTable::~_HYPlatformTable(void)
-{
-    if (backPattern) {
-        DeleteObject (backPattern);
-    }
-    if (backPattern2) {
-        DeleteObject (backPattern2);
-    }
-    if (tableFont) {
-        DeleteObject (tableFont);
-    }
-    if (tableFontB) {
-        DeleteObject (tableFontB);
-    }
-    if (tableFontI) {
-        DeleteObject (tableFontI);
-    }
-    if (tableFontBI) {
-        DeleteObject (tableFontBI);
-    }
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTable::_SetFont (void)
-{
-    _HYTable* parent = (_HYTable*)this;
-
-    if (tableFont) {
-        DeleteObject (tableFont);
-    }
-    if (tableFontB) {
-        DeleteObject (tableFontB);
-    }
-    if (tableFontI) {
-        DeleteObject (tableFontI);
-    }
-    if (tableFontBI) {
-        DeleteObject (tableFontBI);
-    }
-
-    tableFont = CreateFont (parent->textFont.size,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
-                            CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,parent->textFont.face.sData);
-
-    checkPointer (tableFont);
-
-    tableFontB = CreateFont (parent->textFont.size,0,0,0,FW_BOLD,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
-                             CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,parent->textFont.face.sData);
-
-    checkPointer (tableFontB);
-
-    tableFontI = CreateFont (parent->textFont.size,0,0,0,FW_NORMAL,TRUE,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
-                             CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,parent->textFont.face.sData);
-
-    checkPointer (tableFontI);
-
-    tableFontBI = CreateFont (parent->textFont.size,0,0,0,FW_BOLD,true,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
-                              CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,parent->textFont.face.sData);
-
-    checkPointer (tableFontBI);
-}
-
-//__________________________________________________________________
-void        _HYTable::_HScrollTable (long h)
-{
-    if (h) {
-        long        vsShift = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0),
-                    hsShift = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);
-
-        EditBoxHandler  (-1,rel);
-
-        _HYRect         paintRect = rel;
-        paintRect.width = (long)GetDC (parentWindow);
-
-        if (abs(h)>(rel.right-rel.left)/2) {
-            _Paint((Ptr)&paintRect);
-        } else {
-            RECT            scrollRect;
-            scrollRect.top = rel.top;
-            scrollRect.bottom = rel.bottom-vsShift;
-            scrollRect.right = rel.right-hsShift;
-            scrollRect.left  = rel.left;
-            paintRect.top = scrollRect.top;
-            paintRect.bottom = rel.bottom;
-            if (h>0) {
-                ScrollWindowEx (parentWindow, -h, 0, &scrollRect, &scrollRect, nil, nil, 0); //?
-                paintRect.right = scrollRect.right+hsShift;
-                paintRect.left = scrollRect.right-h;
-                hOrigin+=paintRect.left-rel.left;
-                Paint((Ptr)&paintRect);
-                hOrigin-=paintRect.left-rel.left;
-            } else {
-                ScrollWindowEx (parentWindow, -h, 0, &scrollRect, &scrollRect, nil, nil, 0); //?
-                paintRect.left = scrollRect.left;
-                paintRect.right = paintRect.left-h+hsShift;
-                Paint((Ptr)&paintRect);
-            }
-        }
-
-        ReleaseDC (parentWindow, (HDC)paintRect.width);
-    }
-}
-
-//__________________________________________________________________
-void        _HYTable::_VScrollTable (long v)
-{
-    if (v) {
-        long        vsShift = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0),
-                    hsShift = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);
-
-        EditBoxHandler  (-1,rel);
-
-        _HYRect         paintRect = rel;
-        paintRect.width = (long)GetDC (parentWindow);
-
-        if (abs(v)>(rel.bottom-rel.top)/2) {
-            _Paint((Ptr)&paintRect);
-        } else {
-            RECT      scrollRect;
-
-            scrollRect.left         = rel.left;
-            scrollRect.right        = rel.right-hsShift;
-            scrollRect.top          = rel.top;
-            scrollRect.bottom       = rel.bottom-vsShift;
-            paintRect.left          = scrollRect.left;
-            paintRect.right         = rel.right;
-            if (v>0) {
-                ScrollWindowEx (parentWindow, 0, -v, &scrollRect, &scrollRect, nil, nil, 0); //?
-                paintRect.top = rel.bottom-vsShift-v-1;
-                paintRect.bottom = rel.bottom-1;
-                vOrigin+=paintRect.top-rel.top;
-                Paint((Ptr)&paintRect);
-                vOrigin-=paintRect.top-rel.top;
-            } else {
-                scrollRect.top --;
-                ScrollWindowEx (parentWindow, 0, -v, &scrollRect, &scrollRect, nil, nil, 0); //?
-                paintRect.top = rel.top;
-                paintRect.bottom = rel.top-v+vsShift+2;
-                paintRect.bottom = rel.bottom;
-                Paint((Ptr)&paintRect);
-            }
-        }
-        ReleaseDC (parentWindow, (HDC)paintRect.width);
-    }
-}
-
-//__________________________________________________________________
-
-void        _HYTable::_ComponentMouseExit (void)
-{
-    if (cursorState) {
-        if ((cursorState == HY_TABLE_DRAG_CURSOR)&&(activeColumn>=0)&&(activeColumn2>=0)) {
-            _HiliteRowForDrag (activeColumn2,activeColumn);
-        }
-
-        _ResetCursorState ();
-    }
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTable::_SetBackColor (_HYColor& c)
-{
-    DeleteObject (backPattern);
-    backPattern = CreateSolidBrush (RGB(c.R,c.G,c.B));
-    checkPointer (backPattern);
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTable::_SetBackColor2 (_HYColor& c)
-{
-    DeleteObject (backPattern2);
-    backPattern2 = CreateSolidBrush (RGB(c.R,c.G,c.B));
-    checkPointer (backPattern2);
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTable::_KillTextBox (void)
-{
-    if (editBox) {
-        DestroyWindow (editBox);
-        editBox = nil;
-        _ResetCursorState ();
-    }
-}
-
-//__________________________________________________________________
-
-_String     _HYPlatformTable::_RetrieveTextValue (void)
-{
-    return retrieveEditControlText(editBox);
-}
-
-
-//__________________________________________________________________
-
-void        _HYPlatformTable::_CreateTextBox (_HYRect& tBox,_String& textIn)
-{
-    textBoxRect = HYRect2Rect(tBox);
-
-    _HYTable * theParent = (_HYTable*)this;
-
-    editBox = CreateWindow ("EDIT",textIn.sData,WS_VISIBLE|WS_CHILD|ES_LEFT| ES_AUTOHSCROLL|WS_BORDER,
-                            textBoxRect.left,textBoxRect.top,textBoxRect.right-textBoxRect.left,textBoxRect.bottom-textBoxRect.top
-                            ,theParent->parentWindow,NULL,ProgramInstance, NULL);
-
-    checkPointer   (editBox);
-
-    SetWindowLongPtr (editBox,GWLP_USERDATA, (LONG_PTR)theParent);
-    defautlTextHandler  = SetWindowLongPtr (editBox,GWLP_WNDPROC,(LONG_PTR)tableEditSubclassHandler);
-
-    if (tableFont) {
-        SendMessage (editBox, WM_SETFONT, (WPARAM)tableFont, 1);
-    }
-
-    SendMessage (editBox, EM_SETMARGINS, EC_LEFTMARGIN, 3);
-    SendMessage (editBox, EM_SETMARGINS, EC_RIGHTMARGIN, 3);
-    SendMessage (editBox, EM_SETSEL, 0, 50000);
-    SetFocus    (editBox);
-
-}
-
-
-//__________________________________________________________________
-
-RECT        _HYPlatformTable::_GetVisibleRowRect (long h)
-{
-    _HYTable*   parent = (_HYTable*)this;
-    RECT        res;
-
-    long        w = (parent->settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0;
-    res.left   = parent->rel.left;
-    res.right  = (parent->settings.width&HY_COMPONENT_H_SCROLL)?parent->rel.right-HY_SCROLLER_WIDTH:parent->rel.right;
-
-    res.bottom = parent->verticalSpaces.lData[h]-parent->vOrigin+parent->rel.top;
-    if (res.bottom>parent->rel.bottom-w) {
-        res.bottom=parent->rel.bottom-w;
-    }
-
-    if (h) {
-        res.top = parent->verticalSpaces.lData[h-1]-parent->vOrigin+parent->rel.top;
-    } else {
-        res.top = parent->rel.top-parent->vOrigin;
-    }
-
-    return res;
-}
-
-
-//__________________________________________________________________
-
-void        _HYPlatformTable::_HiliteRowForDrag (long row, long old)
-{
-    RECT        cellRect = _GetVisibleRowRect (row);
-
-    if (row<old) {
-        cellRect.bottom = cellRect.top+2;
-    } else {
-        cellRect.top = cellRect.bottom-2;
-    }
-
-    HDC         winDC = GetDC (((_HYTable*)this)->parentWindow);
-
-    InvertRect  (winDC, &cellRect);
-
-    ReleaseDC   (((_HYTable*)this)->parentWindow,winDC);
-}
-
-//__________________________________________________________________
-
-void        _HYTable::_MarkCellsForUpdate (_SimpleList& cells)
-{
-    long hs,hf,vs,vf,t,t2,k;
-    GetDisplayRange (&rel, hs, hf, vs, vf);
-    RECT  clipRect;
-
-    clipRect.left = rel.left;
-    clipRect.right = rel.right;
-    if (settings.width&HY_COMPONENT_V_SCROLL) {
-        clipRect.right -= HY_SCROLLER_WIDTH;
-    }
-    clipRect.top = rel.top;
-    clipRect.bottom = rel.bottom;
-    if (settings.width&HY_COMPONENT_H_SCROLL) {
-        clipRect.bottom -= HY_SCROLLER_WIDTH;
-    }
-
-    for (k=0; k<cells.lLength; k++) {
-        t2 = cells.lData[k]/horizontalSpaces.lLength;
-        t = cells.lData[k]%horizontalSpaces.lLength;
-
-        if ((t>=hs)&&(t<=hf)&&(t2<=vf)&&(t2>=vs)) {
-            //printf ("%d %d\n",t,t2);
-            RECT invalRect;
-            if (t) {
-                invalRect.left = horizontalSpaces.lData[t-1];
-            } else {
-                invalRect.left = 0;
-            }
-            invalRect.right = horizontalSpaces.lData[t];
-            if (t2) {
-                invalRect.top = verticalSpaces.lData[t2-1];
-            } else {
-                invalRect.top = 0;
-            }
-            invalRect.bottom = verticalSpaces.lData[t2];
-
-            OffsetRect (&invalRect, rel.left-hOrigin, rel.top-vOrigin);
-
-            RECT           tempRect;
-            IntersectRect (&tempRect, &clipRect, &invalRect); //?
-            if (!IsRectEmpty (&tempRect)) {
-                InvalidateRect (parentWindow,&tempRect,false);
-            }
-        }
-    }
-}
-
-//__________________________________________________________________
-
-void        _HYTable::_MarkColumnForUpdate (long index)
-{
-    long hs,hf,vs,vf;
-    GetDisplayRange (&rel, hs, hf, vs, vf);
-
-    if ((index>=hs)&&(index<=hf)) {
-        RECT  clipRect;
-
-        clipRect.left = rel.left;
-        clipRect.right = rel.right;
-
-        if (settings.width&HY_COMPONENT_V_SCROLL) {
-            clipRect.right -= HY_SCROLLER_WIDTH;
-        }
-        clipRect.top = rel.top;
-        clipRect.bottom = rel.bottom;
-        if (settings.width&HY_COMPONENT_H_SCROLL) {
-            clipRect.bottom -= HY_SCROLLER_WIDTH;
-        }
-
-        RECT  invalRect;
-
-        invalRect.bottom = clipRect.bottom;
-        invalRect.top = clipRect.top;
-        invalRect.left = index?horizontalSpaces.lData[index-1]:0;
-        invalRect.right = horizontalSpaces.lData[index];
-
-        OffsetRect (&invalRect, rel.left-hOrigin, 0);
-
-        RECT           tempRect;
-        IntersectRect (&tempRect, &clipRect, &invalRect); //?
-        if (!IsRectEmpty (&tempRect)) {
-            InvalidateRect (parentWindow,&tempRect,false);
-        }
-    }
-}
-
-
-//__________________________________________________________________
-
-void        _HYTable::_MarkRowForUpdate (long index)
-{
-    long hs,hf,vs,vf;
-    GetDisplayRange (&rel, hs, hf, vs, vf);
-
-    if ((index>=vs)&&(index<=vf)) {
-        RECT  clipRect;
-
-        clipRect.left = rel.left;
-        clipRect.right = rel.right;
-        if (settings.width&HY_COMPONENT_V_SCROLL) {
-            clipRect.right -= HY_SCROLLER_WIDTH;
-        }
-        clipRect.top = rel.top;
-        clipRect.bottom = rel.bottom;
-        if (settings.width&HY_COMPONENT_H_SCROLL) {
-            clipRect.bottom -= HY_SCROLLER_WIDTH;
-        }
-
-        RECT  invalRect;
-        invalRect.right = clipRect.right;
-        invalRect.left = clipRect.left;
-        invalRect.top = index?verticalSpaces.lData[index-1]:0;
-        invalRect.bottom = verticalSpaces.lData[index];
-        OffsetRect (&invalRect, 0, rel.top-vOrigin);
-
-        RECT           tempRect;
-        IntersectRect (&tempRect, &clipRect, &invalRect); //?
-        if (!IsRectEmpty (&tempRect)) {
-            InvalidateRect (parentWindow,&tempRect,false);
-        }
-    }
-}
-
-
-//__________________________________________________________________
-
-void        _HYTable::_MarkCellForUpdate (long index)
-{
-    _SimpleList     dummy (index);
-    _MarkCellsForUpdate (dummy);
-}
-
-//__________________________________________________________________
-
-void        _HYTable::_IdleHandler (void)
-{
-}
-
-//__________________________________________________________________
-
-void        _HYTable::_FocusComponent (void)
-{
-    if (GetFocus()!=parentWindow) {
-        //printf ("Table SetFocus\n");
-        SetFocus (parentWindow);
-    }
-}
-
-
-//__________________________________________________________________
-long        _HYTable::_HandlePullDown (_List& data, long h, long v, long currentS)
-{
-    if (data.lLength) {
-        return HandlePullDownWithFont (data,h,v,currentS,textFont.face,textFont.size);
-    }
-    return -1;
-}
-
-
-//__________________________________________________________________
-
-void        _HYTable::_ScrollVPixels (long offset)
-{
-    long     voff = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0);
-    offset = offset/(_Parameter)(GetMaxH()- rel.bottom+rel.top+1-voff)*MAX_CONTROL_VALUE;
-    ProcessEvent (generateScrollEvent(0,offset));
-    _SetVScrollerPos((double)MAX_CONTROL_VALUE*vOrigin/(verticalSpaces.lData[verticalSpaces.lLength-1]-vSize+voff));
-}
-
-//__________________________________________________________________
-
-void        _HYTable::_ScrollHPixels (long offset)
-{
-    long     hoff = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);
-    offset = offset/(_Parameter)(GetMaxW()- rel.right+rel.bottom+1-hoff)*MAX_CONTROL_VALUE;
-    ProcessEvent (generateScrollEvent(offset,0));
-    _SetHScrollerPos((double)MAX_CONTROL_VALUE*hOrigin/(horizontalSpaces.lData[horizontalSpaces.lLength-1]-hSize+hoff));
-}
-
-
-//__________________________________________________________________
-
-void        _HYTable::_ScrollRowIntoView (long index)
-{
-    if ((index>=0)&&(index<verticalSpaces.lLength)) {
-        long hs, hf, vs, vf;
-        GetDisplayRange (&rel,hs,hf,vs,vf);
-        if ((index>vf)||(index<vs)) {
-            _ScrollVPixels ((index?verticalSpaces.lData[index-1]:0)-vOrigin);
-        }
-    }
-}
-
-//__________________________________________________________________
-void        _HYTable::_Paint (Ptr p)
-{
-
-    _HYRect         *relRect    = (_HYRect*)p;
-
-    bool            isPrinting = relRect->right<0;
-
-    if (isPrinting) {
-        relRect->right = -relRect->right;
-    }
-
-    HDC             dc = (HDC)relRect->width;
-
-    /*RECT          all = HYRect2Rect (*relRect);
-
-    HBRUSH          redFill   = CreateSolidBrush (RGB(255,0,0)); // checked
-    FillRect        (dc, &all, redFill);
-    DeleteObject    (redFill);
-
-    return;
-    */
-    COLORREF        whiteC          = RGB(0xff,0xff,0xff),
-                    fillColor         = GetSysColor(COLOR_HIGHLIGHT),
-                    fillTColor        = GetSysColor(COLOR_HIGHLIGHTTEXT),
-                    tableBkColor    = RGB(backColor.R, backColor.G, backColor.B),
-                    tableBkColor2   = RGB(backColor2.R, backColor2.G, backColor2.B),
-                    saveTextColor;
-
-    HPEN            saveDCPen,
-                    whitePen = CreatePen (PS_SOLID, 1, whiteC); // checked
-
-
-    HFONT           saveDCFont;
-
-
-    HBRUSH          themeFill   = CreateSolidBrush (fillColor); // checked
-    checkPointer    (themeFill);
-
-    HRGN            saveRgn     = CreateRectRgn    (0,0,1,1);   // checked
-    checkPointer    (saveRgn);
-
-    long            hs, // starting column
-                    hf, // ending column
-                    vs, // starting row
-                    vf, // ending row
-                    k,  // loop index
-                    t,  // aux variable
-                    t2,
-                    st; // a few more auxs
-
-    bool            chop,
-                    chopv;
-
-    //printf            ("%d %d %d \n", GetRValue (fillColor), GetGValue (fillColor), GetBValue (fillColor));
-
-
-    GetDisplayRange (relRect, hs, hf, vs, vf);
-
-    long            vsShift = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0),
-                    hsShift = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);
-
-
-    _HYRect         saveRel;
-    RECT            bRect;
-
-    HDC             offScreenPtr = nil;  // checked
-
-    HBITMAP         offBitmap    = nil;
-
-    if ((vf-vs>2)&&(!isPrinting)) {
-        offScreenPtr = CreateCompatibleDC (dc);
-        if (offScreenPtr) {
-            bRect.left           = bRect.top = 0;
-            bRect.right          = relRect->right-relRect->left-hsShift;
-            bRect.bottom         = relRect->bottom-relRect->top-vsShift;
-            offBitmap            = CreateCompatibleBitmap (dc, bRect.right, bRect.bottom);
-
-            if (!offBitmap) {
-                DeleteDC (offScreenPtr);
-                offScreenPtr = nil;
-            } else {
-                DeleteObject (SelectObject (offScreenPtr, offBitmap));
-                dc = offScreenPtr;
-
-                saveRel = *relRect;
-                relRect->bottom -= relRect->top;
-                relRect->top = 0;
-                relRect->right  -= relRect->left;
-                relRect->left = 0;
-            }
-        }
-    }
-
-    st =            GetClipRgn (dc, saveRgn);
-
-    if (st == 0) {
-        DeleteObject (saveRgn);
-        saveRgn = nil;
-    }
-
-    int             saveBackMode  = GetBkMode    (dc);
-    UINT            saveTextAlign = GetTextAlign (dc);
-    COLORREF        saveBkColor   = GetBkColor   (dc);
-
-    SetTextAlign   (dc, TA_BASELINE);
-    SetBkMode      (dc, TRANSPARENT);
-
-    RECT clipRect = {relRect->left,relRect->top,
-                     relRect->right-hsShift,
-                     relRect->bottom-vsShift
-                    },
-
-         anotherRect,
-         clipRect2,
-         clipRect3;
-
-    POINT
-    mapPts[2];
-
-    mapPts[0] = (POINT) {
-        clipRect.left,clipRect.top
-    };
-    mapPts[1] = (POINT) {
-        clipRect.right+1,clipRect.bottom+1
-    };
-
-    LPtoDP (dc, mapPts,2);
-
-    HRGN          tempRgn = CreateRectRgn (mapPts[0].x, mapPts[0].y, mapPts[1].x, mapPts[1].y);
-    checkPointer  (tempRgn);
-
-    SelectClipRgn (dc, tempRgn);
-
-    saveTextColor = GetTextColor (dc);
-
-    ::SetTextColor (dc, RGB(textColor.R, textColor.G, textColor.B));
-
-    anotherRect = clipRect;
-
-    t = relRect->top-vOrigin;
-
-    saveDCPen = (HPEN)SelectObject (dc, whitePen);
-
-    for (k=vs; k<=vf; k++) {
-        anotherRect.top = k?verticalSpaces.lData[k-1]+t:relRect->top;
-        anotherRect.bottom = verticalSpaces.lData[k]+t;
-        if (cellTypes.lData[k*horizontalSpaces.lLength]&HY_TABLE_BEVELED) {
-            FillRect (dc,&anotherRect,backPattern2);
-            if ((k==vs)||(k<vf)) {
-                SelectObject (dc, menuLine2);
-                MoveToEx (dc,anotherRect.left,anotherRect.bottom-1,nil);
-                LineTo (dc,anotherRect.right,anotherRect.bottom-1);
-                SelectObject (dc, menuLine1);
-                MoveToEx (dc,anotherRect.left,anotherRect.bottom-2,nil);
-                LineTo (dc,anotherRect.right,anotherRect.bottom-2);
-                SelectObject (dc, whitePen);
-            }
-        } else {
-            FillRect (dc,&anotherRect,backPattern);
-            if ((k==vs)||(k<vf)) {
-                MoveToEx (dc,anotherRect.left,anotherRect.bottom-1,nil);
-                LineTo (dc,anotherRect.right,anotherRect.bottom-1);
-            }
-        }
-    }
-
-    saveTextColor = GetTextColor (dc);
-    ::SetTextColor (dc, RGB (textColor.R, textColor.G, textColor.B));
-
-    saveDCFont    = (HFONT)SelectObject (dc, tableFont);
-    st = 0;
-
-    if (hf<horizontalSpaces.lLength-1) {
-        st = hf;
-    } else {
-        st = hf-1;
-    }
-    t = relRect->left-hOrigin-2;
-
-    if ((selectionType & HY_TABLE_NO_COLS_LINES) == 0) {
-        SelectObject (dc,menuLine1);
-        for (k=hs; k<=st; k++) {
-            t2 = t+horizontalSpaces.lData[k];
-            MoveToEx (dc,t2,relRect->top,nil);
-            LineTo (dc,t2,relRect->bottom);
-        }
-        SelectObject (dc,menuLine2);
-        t++;
-        for (k=hs; k<=st; k++) {
-            t2 = t+horizontalSpaces.lData[k];
-            MoveToEx (dc,t2,relRect->top,nil);
-            LineTo (dc,t2,relRect->bottom);
-        }
-    }
-
-    bool  highlightColorOn = false;
-
-    for (k=vs; k<=vf; k++) {
-        anotherRect.top = relRect->top-vOrigin+1;
-        anotherRect.bottom = anotherRect.top+verticalSpaces.lData[k]-1;
-        if (k) {
-            anotherRect.top+=verticalSpaces.lData[k-1];
-        }
-
-        long    t3,
-                st2,
-                w = anotherRect.bottom-anotherRect.top,
-                w2,
-                shift = (w-textFont.size)/2-1;
-
-        if (anotherRect.bottom>relRect->bottom-vsShift) {
-            anotherRect.bottom = relRect->bottom-vsShift;
-            chopv = false;
-        } else {
-            chopv = true;
-        }
-
-        for (t2=hs; t2<=hf; t2++) {
-            t3 = k*horizontalSpaces.lLength+t2;
-            if (t3 == editCellID) {
-                continue;
-            }
-            anotherRect.left  = relRect->left-hOrigin+1;
-            anotherRect.right = anotherRect.left+horizontalSpaces.lData[t2]-1;
-
-            if (t2) {
-                anotherRect.left+=horizontalSpaces.lData[t2-1];
-            }
-
-            clipRect2 = anotherRect;
-            w2        = anotherRect.right-anotherRect.left;
-
-            chop = true;
-
-            if (anotherRect.right>relRect->right-hsShift) {
-                anotherRect.right=relRect->right-hsShift;
-                chop = false;
-            } else {
-                chop = true;
-            }
-
-            if ((t2==hs)||(k==vs)) {
-                IntersectRect (&clipRect3,&anotherRect,&clipRect);
-                DeleteObject (tempRgn);
-
-                mapPts[0] = (POINT) {
-                    clipRect3.left,clipRect3.top
-                };
-                mapPts[1] = (POINT) {
-                    clipRect3.right+1,clipRect3.bottom+1
-                };
-
-                LPtoDP (dc, mapPts,2);
-
-                tempRgn = CreateRectRgn (mapPts[0].x, mapPts[0].y, mapPts[1].x, mapPts[1].y);
-                checkPointer  (tempRgn);
-                SelectClipRgn (dc, tempRgn);
-            } else {
-                DeleteObject (tempRgn);
-                mapPts[0] = (POINT) {
-                    anotherRect.left,anotherRect.top
-                };
-                mapPts[1] = (POINT) {
-                    anotherRect.right+1,anotherRect.bottom+1
-                };
-
-                LPtoDP (dc, mapPts,2);
-
-                tempRgn = CreateRectRgn (mapPts[0].x, mapPts[0].y, mapPts[1].x, mapPts[1].y);
-                checkPointer  (tempRgn);
-                SelectClipRgn (dc, tempRgn);
-            }
-
-            if (cellTypes.lData[t3]&HY_TABLE_SELECTED) {
-                if (chopv) {
-                    anotherRect.bottom--;
-                }
-                if (chop) {
-                    anotherRect.right-=2;
-                    FillRect (dc,&anotherRect,themeFill);
-                    anotherRect.right+=2;
-                } else {
-                    FillRect (dc,&anotherRect,themeFill);
-                }
-
-                if (chopv) {
-                    anotherRect.bottom++;
-                }
-            }
-
-
-            if (cellTypes.lData[t3]&HY_TABLE_ICON) {
-                if (!isPrinting) {
-                    _SimpleList     * cellList = (_SimpleList*)cellData.lData[t3];
-
-                    if (w2-4>cellList->lData[1]) {
-                        t3 = (w2-cellList->lData[1])/2;
-                        clipRect2.left+=t3;
-                    }
-                    clipRect2.right = clipRect2.left+cellList->lData[1];
-                    if (w-2>cellList->lData[2]) {
-                        t3 = (w-cellList->lData[2])/2;
-                        clipRect2.top+=t3;
-                    }
-                    clipRect2.bottom=clipRect2.top+cellList->lData[2];
-
-                    if (cellList->lLength==3) {
-
-                        HBITMAP aPic = (HBITMAP)cellList->lData[0];
-                        if (aPic) {
-                            DrawTransparentBitmap (dc, aPic, clipRect2.left, clipRect2.top, clipRect2.right-clipRect2.left+1, clipRect2.bottom-clipRect2.top+1,RGB(255,255,255));
-                        }
-                    } else {
-                        if ((cellList->lData[3]==HY_TABLE_COLOR_BOX)||(cellList->lData[3]==HY_TABLE_COLOR_CIRCLE)) {
-                            _HYColor    c   = LongToHYColor    (cellList->lData[0]);
-                            HBRUSH      clr;
-
-
-                            if (cellList->lData[3]==HY_TABLE_COLOR_BOX) {
-                                clr =  CreateSolidBrush (RGB(c.R,c.G,c.B));
-                                checkPointer (clr);
-                                FillRect  (dc, &clipRect2,clr);
-                                DeleteObject (clr);
-                            } else {
-                                COLORREF        trColor = RGB(0,0,0);
-                                HPEN            trPen   = CreatePen (PS_NULL, 1, trColor),
-                                                saveTPen;
-
-                                checkPointer    (trPen);
-
-                                saveTPen     = (HPEN)SelectObject (dc, trPen);
-                                RECT            circRect = clipRect2;
-                                InflateRect    (&circRect,1,1);
-                                Ellipse        (dc,circRect.left, circRect.top, circRect.right, circRect.bottom);
-
-
-                                clr =  CreateSolidBrush (RGB(c.R/2,c.G/2,c.B/2));
-                                checkPointer (clr);
-
-                                HBRUSH          saveBRUSH = (HBRUSH)SelectObject (dc, clr);
-
-                                InflateRect    (&circRect,-1,-1);
-                                trColor      = RGB(c.R/2,c.G/2,c.B/2);
-                                //trPen      = CreatePen (PS_SOLID, 1, trColor);
-                                //checkPointer   (trPen);
-                                //DeleteObject   (SelectObject   (dc, trPen));
-                                Ellipse        (dc,circRect.left, circRect.top, circRect.right, circRect.bottom);
-
-                                InflateRect    (&circRect,-1,-1);
-                                trColor        = RGB(c.R/1.25,c.G/1.25,c.B/1.25);
-
-                                clr =  CreateSolidBrush (RGB(c.R/1.25,c.G/1.25,c.B/1.25));
-                                checkPointer (clr);
-                                DeleteObject (SelectObject (dc, clr));
-
-                                //trPen = CreatePen (PS_SOLID, 1, trColor);
-                                //checkPointer    (trPen);
-                                //DeleteObject  (SelectObject (dc, trPen));
-
-                                Ellipse        (dc,circRect.left, circRect.top, circRect.right, circRect.bottom);
-
-                                clr =  CreateSolidBrush (RGB(c.R,c.G,c.B));
-                                checkPointer (clr);
-                                DeleteObject (SelectObject (dc, clr));
-
-                                InflateRect    (&circRect,-1,-1);
-                                //trColor      = RGB(c.R,c.G,c.B);
-                                //trPen = CreatePen (PS_SOLID, 1,trColor);
-                                //checkPointer    (trPen);
-
-                                DeleteObject   (SelectObject (dc, trPen));
-                                Ellipse        (dc,circRect.left, circRect.top, circRect.right, circRect.bottom);
-                                DeleteObject   (SelectObject   (dc, saveTPen));
-                                DeleteObject   (SelectObject   (dc, saveBRUSH));
-                            }
-
-                        }
-                    }
-                }
-            } else { // text
-                st2 = cellTypes.lData[t3]&HY_TABLE_STYLEMASK;
-
-                if (st!=st2) {
-                    HFONT      setFont = tableFont;
-                    st = st2;
-                    if (st&HY_TABLE_BOLD) {
-                        if (st&HY_TABLE_ITALIC) {
-                            setFont = tableFontBI;
-                        } else {
-                            setFont = tableFontB;
-                        }
-                    } else if (st&HY_TABLE_ITALIC) {
-                        setFont = tableFontI;
-                    }
-
-                    SelectObject (dc, setFont);
-                }
-
-
-                _String  *thisCell = (_String*)cellData.lData[t3];
-
-                if (cellTypes.lData[t3]&HY_TABLE_SELECTED) {
-                    if (!highlightColorOn) {
-                        ::SetTextColor (dc, fillTColor);
-                        highlightColorOn = true;
-                    }
-                } else {
-                    if (highlightColorOn) {
-                        ::SetTextColor (dc, RGB(textColor.R, textColor.G, textColor.B));
-                        highlightColorOn = false;
-                    }
-                }
-                TextOut (dc,anotherRect.left+textFont.size/3, anotherRect.top+shift+textFont.size, thisCell->sData,thisCell->sLength);
-
-                if (cellTypes.lData[t3]&HY_TABLE_PULLDOWN) {
-                    if (!isPrinting) {
-                        clipRect2.right-=4;
-                        clipRect2.left=clipRect2.right-tPDMw;
-                        if (w-2>tPDMh) {
-                            t3 = (w-tPDMh)/2;
-                            clipRect2.top+=t3;
-                        }
-                        clipRect2.bottom=clipRect2.top+tPDMh;
-
-                        BITMAP theBM;
-                        GetObject (tablePDMenuIcon, sizeof (BITMAP), &theBM);
-
-                        if (otherDC) {
-                            SelectObject         (otherDC, tablePDMenuIcon);
-
-                            StretchBlt           (dc, clipRect2.left, clipRect2.top, clipRect2.right-clipRect2.left+1, clipRect2.bottom-clipRect2.top+1,
-                                                  otherDC, 0, 0, theBM.bmWidth, theBM.bmHeight, SRCCOPY);
-                            SelectObject         (otherDC,oDCBM);
-                        } else {
-                            _String errMsg = _String ("Failed to make CompatibleDC in _HYTable::_Paint");
-                            ReportWarning (errMsg);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-
-    SetBkMode      (dc, saveBackMode);
-    SetTextAlign   (dc, saveTextAlign);
-    SetBkColor     (dc, saveBkColor);
-
-    SelectClipRgn  (dc, saveRgn);
-
-    if (saveRgn) {
-        DeleteObject (saveRgn);
-    }
-
-    ::SetTextColor (dc, saveTextColor);
-
-    SelectObject   (dc, saveDCPen);
-    SelectObject   (dc, saveDCFont);
-    DeleteObject   (whitePen);
-
-    if (themeFill) {
-        DeleteObject (themeFill);
-    }
-
-    if (tempRgn) {
-        DeleteObject (tempRgn);
-    }
-
-    if (offScreenPtr) {
-        *relRect    = saveRel;
-        OffsetRect   (&clipRect,relRect->left, relRect->top);
-
-        dc = (HDC)relRect->width;
-
-        BitBlt   (dc,clipRect.left,clipRect.top, clipRect.right-clipRect.left+1,clipRect.bottom-clipRect.top+1, offScreenPtr, 0,0, SRCCOPY);
-        DeleteDC     (offScreenPtr);
-        DeleteObject (offBitmap);
-    }
-
-    if (editBox) {
-        UpdateWindow (editBox);
-    }
-
-    _HYPlatformComponent::_Paint(p);
-}
-
-
-//__________________________________________________________________
-
-bool        _HYTable::_ProcessOSEvent (Ptr vEvent)
-{
-    _HYWindowsUIMessage*    theEvent = (_HYWindowsUIMessage*)vEvent;
-
-    static  int     lastH = 0,
-                    lastV = 0;
-
-    long            k,
-                    h,
-                    v,
-                    vsShift = ((settings.width&HY_COMPONENT_H_SCROLL)?HY_SCROLLER_WIDTH:0),
-                    hsShift = ((settings.width&HY_COMPONENT_V_SCROLL)?HY_SCROLLER_WIDTH:0);
-
-    switch (theEvent->iMsg) {
-    case WM_LBUTTONUP: {
-        lastH = (short)LOWORD (theEvent->lParam);
-        lastV = (short)HIWORD (theEvent->lParam);
-
-        bool    isInComponent = ((lastH>=rel.left)&&(lastV>=rel.top)&&(lastH<rel.right)&&(lastV<rel.bottom));
-
-        if (cursorState == HY_TABLE_SIZE_CURSOR) {
-            _ResetCursorState ();
-            //ReleaseCapture      ();
-        } else if (cursorState == HY_TABLE_DRAG_CURSOR) {
-            if (activeColumn >= 0) {
-                if (messageRecipient) {
-                    ReleaseCapture ();
-                    ((_HYTWindow*)messageRecipient)->trackMouseComponent = nil;
-                }
-                if (activeColumn2>=0) {
-                    _HiliteRowForDrag (activeColumn2,activeColumn);
-                }
-
-                if (activeColumn!=activeColumn2) {
-                    EditBoxHandler (-1,rel);
-                    if (isInComponent) {
-                        DragRow (activeColumn,activeColumn2);
-                    }
-                }
-
-                activeColumn = -1;
-            }
-            _ResetCursorState ();
-        } else if (cursorState == HY_TABLE_EDIT_CURSOR) {
-            if (messageRecipient) {
-                ReleaseCapture ();
-                ((_HYTWindow*)messageRecipient)->trackMouseComponent = nil;
-            }
-
-            RECT      clippingRect = HYRect2Rect (rel),
-                      paintRect;
-
-            IntersectRect (&paintRect,&limits,&clippingRect);
-            _FrameRect (paintRect);
-
-            _HYRect     outlineHRect;
-            outlineHRect.left   = limits.left;
-            outlineHRect.right  = limits.right+hsShift;
-            outlineHRect.top    = limits.top;
-            outlineHRect.bottom = limits.bottom+vsShift;
-            long    hs,hf,vs,vf;
-            hOrigin += limits.left-rel.left;
-            vOrigin += limits.top-rel.top;
-            GetDisplayRange (&outlineHRect,hs,hf,vs,vf);
-            hOrigin -= limits.left-rel.left;
-            vOrigin -= limits.top-rel.top;
-            ExpungeSelection();
-            if ((hf>=hs)||(vs>=vf)) {
-                _SimpleList sel;
-                if (selectionType&HY_TABLE_SEL_ROWS) {
-                    sel.RequestSpace (vf-vs+1);
-                    for (h=vs; h<=vf; h++) {
-                        sel<<h;
-                    }
-                    SetRowSelection (sel);
-                } else if (selectionType&HY_TABLE_SEL_COLS) {
-                    sel.RequestSpace (hf-hs+1);
-                    for (v=hs; v<=hf; h++) {
-                        sel<<v;
-                    }
-                    SetColumnSelection(sel);
-
-                } else {
-                    sel.RequestSpace ((vf-vs+1)*(hf-hs+1));
-                    for (h=hs; h<=hf; h++)
-                        for (v=vs; v<=vf; v++) {
-                            sel << v*horizontalSpaces.lLength + h;
-                        }
-                    SetSelection (sel,true);
-                    _MarkCellsForUpdate (sel);
-                }
-            }
-
-            if (messageRecipient) {
-                ReleaseCapture ();
-                ((_HYTWindow*)messageRecipient)->trackMouseComponent = nil;
-            }
-
-            _ResetCursorState ();
-        }
-
-        break;
-    }
-
-    case WM_LBUTTONDOWN:
-    case WM_LBUTTONDBLCLK: {
-        lastH = (short)LOWORD (theEvent->lParam);
-        lastV = (short)HIWORD (theEvent->lParam);
-
-        POINT   downWhere = (POINT) {
-            lastH, lastV
-        };
-
-        ClientToScreen (parentWindow, &downWhere);
-
-        if ((selectionType&HY_TABLE_FOCUSABLE)&&messageRecipient&&((selectionType&HY_TABLE_IS_FOCUSED)==0)) {
-            messageRecipient->ProcessEvent(generateKeyboardFocusEvent (GetID()));
-        }
-
-        if ((cursorState == HY_TABLE_SIZE_CURSOR)&&(theEvent->iMsg!= WM_LBUTTONDBLCLK)) {
-            // do drag here
-            EditBoxHandler (-1,rel);
-            if (!DragDetect (parentWindow, downWhere)) {
-                _ResetCursorState ();
-                return    true;
-            }
-
-            //SetCapture      (parentWindow);
-
-            limits.left   = lastH;
-            limits.top    = rel.top;
-            limits.bottom = rel.bottom-vsShift;
-
-            limits.right = rel.right-hsShift;
-
-            lastH += hOrigin;
-
-            for (activeColumn = 0; activeColumn<horizontalSpaces.lLength-1; activeColumn++)
-                if (horizontalSpaces.lData[activeColumn]>lastH-2-rel.left) {
-                    break;
-                }
-
-            if (activeColumn) {
-                limits.left = rel.left+horizontalSpaces.lData[activeColumn-1]+3-hOrigin;
-            } else {
-                limits.left = rel.left+3;
-            }
-
-            long dragRes = horizontalSpaces.lData[horizontalSpaces.lLength-1]-
-                           rel.right+rel.left-hOrigin+hsShift;
-
-            if (dragRes<lastH-limits.left) {
-                limits.left = lastH-dragRes;
-            }
-
-            lastH-=hOrigin;
-
-            return true;
-
-        } else {
-            if (((k=FindClickedTableCell (lastH-rel.left,lastV-rel.top,h,v))>-1)&&
-                    (lastV<rel.bottom-vsShift)&&(lastH<rel.right-hsShift)) {
-                if (theEvent->iMsg== WM_LBUTTONDBLCLK) {
-                    if (cellTypes.lData[k]&HY_TABLE_EDIT_TEXT) {
-                        EditBoxHandler (k,rel);
-                    } else if (messageRecipient) {
-                        messageRecipient->ProcessEvent (generateTableDblClickEvent(GetID()));
-                    }
-                    break;
-                }
-                ModifySelection (h,v,GetAsyncKeyState (VK_SHIFT) & 0x8000, GetAsyncKeyState (VK_CONTROL) & 0x8000, true);
-            }
-
-            if (k==-2)
-                // process pull-down
-            {
-                if (messageRecipient) {
-                    POINT loc = {lastH, lastV};
-                    ClientToScreen (parentWindow, &loc);
-                    messageRecipient->ProcessEvent (generateTablePullDownEvent(GetID(),v*horizontalSpaces.lLength+h,
-                                                    (((long)loc.x)<<16)+loc.y));
-                }
-                break;
-            }
-
-
-            if ((cursorState == HY_TABLE_DRAG_CURSOR)&&(theEvent->iMsg!= WM_LBUTTONDBLCLK)) {
-                SetCursor (dropOffCursor);
-                FindClickedTableCell(lastH-rel.left,lastV-rel.top,k,activeColumn);
-                activeColumn2 = -1;
-                if (messageRecipient) {
-                    SetCapture (parentWindow);
-                    ((_HYTWindow*)messageRecipient)->trackMouseComponent = this;
-                }
-
-                return true;
-            }
-
-            /*  handle row drag here */
-
-            if (((selectionType&HY_TABLE_SINGLE_SELECTION)==0)&&
-                    ((selectionType&HY_TABLE_NODRAG_SELECTION)==0)&&
-                    (lastH<rel.right-hsShift)&&
-                    (lastV<rel.bottom-vsShift)&&
-                    DragDetect (parentWindow, downWhere)) {
-                cursorState = HY_TABLE_EDIT_CURSOR;
-                limits.left = limits.right  = lastH;
-                limits.top  = limits.bottom = lastV;
-
-                textBoxRect.left   = -1;
-                textBoxRect.right  = lastH;
-                textBoxRect.bottom = lastV;
-
-                if (messageRecipient) {
-                    SetCapture (parentWindow);
-                    ((_HYTWindow*)messageRecipient)->trackMouseComponent = this;
-                }
-
-                return true;
-            }
-
-        }
-
-    }
-    break;
-
-    case WM_KEYDOWN: {
-
-        bool    ctlDown = (GetAsyncKeyState (VK_CONTROL) & 0x8000);
-
-        switch (theEvent->wParam) {
-        case VK_UP: // up
-            HandleKeyMove (0,ctlDown);
-            return true;
-        case VK_DOWN: // down
-            HandleKeyMove (1,ctlDown);
-            return true;
-        case VK_LEFT: // left
-            HandleKeyMove (2,ctlDown);
-            return true;
-        case VK_RIGHT: // right
-            HandleKeyMove (3,ctlDown);
-            return true;
-        }
-
-        break;
-    }
-
-    case WM_MOUSEMOVE: {
-        POINT   downWhere = (POINT) {
-            (short)LOWORD (theEvent->lParam), (short)HIWORD (theEvent->lParam)
-        };
-
-        if (theEvent->wParam & MK_LBUTTON) { // left button down
-            if (cursorState == HY_TABLE_SIZE_CURSOR) {
-                POINT   currentPoint = (POINT) {
-                    LOWORD (theEvent->lParam),HIWORD (theEvent->lParam)
-                };
-                if (PtInRect (&limits, currentPoint)) {
-                    if (currentPoint.x-lastH) {
-                        SetColumnSpacing (activeColumn,currentPoint.x-lastH,true);
-                        if (messageRecipient)
-                            messageRecipient->ProcessEvent (generateTableResizeCEvent(GetID(),
-                                                            activeColumn,currentPoint.x-lastH));
-                        lastH = currentPoint.x;
-                    }
-
-                }
-            } else if ((cursorState == HY_TABLE_DRAG_CURSOR)&&(activeColumn>=0)) {
-                long h,v,k;
-
-                if ((downWhere.y>rel.bottom-vsShift)||(downWhere.y<rel.top)) {
-                    if (activeColumn2>=0) {
-                        _HiliteRowForDrag (activeColumn2,activeColumn);
-                        activeColumn2 = -1;
-                    }
-                    h = verticalSpaces.lData[verticalSpaces.lLength-1]/verticalSpaces.lLength;
-                    _ScrollVPixels ((downWhere.y<rel.top)?-h:h);
-                    break;
-                }
-
-                if (downWhere.x>rel.right-hsShift) {
-                    downWhere.x=rel.right-hsShift;
-                }
-
-                if ( (lastH!=downWhere.x)|| (lastV!=downWhere.y)) {
-                    k = FindClickedTableCell(downWhere.x-rel.left,downWhere.y-rel.top,h,v);
-                    if ((v!=activeColumn2)&&(k>-1)) {
-                        if (activeColumn2>=0) {
-                            _HiliteRowForDrag (activeColumn2,activeColumn);
-                        }
-                        if ((v!=activeColumn)&&(!(cellTypes.lData[k]&HY_TABLE_CANTSELECT))) {
-                            _HiliteRowForDrag (v,activeColumn);
-                            activeColumn2 = v;
-                        } else {
-                            activeColumn2 = -1;
-                        }
-                    }
-                    lastH = downWhere.x;
-                    lastV = downWhere.y;
-                }
-            } else if (cursorState == HY_TABLE_EDIT_CURSOR) {
-                RECT      clippingRect = HYRect2Rect (rel),
-                          paintRect;
-
-                while (1) {
-                    if (downWhere.y>rel.bottom-vsShift) {
-                        if (rel.bottom-rel.top-vsShift+vOrigin <  verticalSpaces.lData[verticalSpaces.lLength-1]-1) {
-                            long h = verticalSpaces.lData[verticalSpaces.lLength-1]/verticalSpaces.lLength;
-
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect (paintRect);
-
-                            _ScrollVPixels (h);
-
-                            limits.top -= h;
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect    (paintRect);
-
-                            lastV -= h;
-                            textBoxRect.bottom -= h;
-                            break;
-                        }
-                        downWhere.y=rel.bottom-vsShift;
-                    }
-                    if (downWhere.x>rel.right-hsShift) {
-                        if (rel.right-rel.left-hsShift+hOrigin <  horizontalSpaces.lData[horizontalSpaces.lLength-1]-1) {
-                            long h = horizontalSpaces.lData[horizontalSpaces.lLength-1]/horizontalSpaces.lLength;
-
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect    (paintRect);
-
-                            _ScrollHPixels (h);
-
-                            limits.left -= h;
-
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect    (paintRect);
-
-                            lastH -= h;
-                            textBoxRect.right -= h;
-                            break;
-                        }
-                        downWhere.x=rel.right-hsShift;
-                    }
-                    if (downWhere.y<rel.top) {
-                        if (vOrigin>0) {
-                            long h = verticalSpaces.lData[verticalSpaces.lLength-1]/verticalSpaces.lLength;
-
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect    (paintRect);
-
-                            _ScrollVPixels (-h);
-
-                            limits.top += h;
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect    (paintRect);
-
-                            lastV += h;
-                            textBoxRect.bottom += h;
-                            break;
-                        }
-                        downWhere.y=rel.top;
-                    }
-                    if (downWhere.x<rel.left) {
-                        if (hOrigin>0) {
-                            long h = horizontalSpaces.lData[horizontalSpaces.lLength-1]/horizontalSpaces.lLength;
-
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect    (paintRect);
-
-                            _ScrollHPixels (-h);
-
-                            limits.left += h;
-
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect    (paintRect);
-
-                            lastH += h;
-                            textBoxRect.right += h;
-                            break;
-                        }
-                        downWhere.x=rel.left;
-                    }
-
-                    if ( (lastH!=downWhere.x)|| (lastV!=downWhere.y)) {
-                        if (textBoxRect.left>=0) {
-                            IntersectRect (&paintRect,&limits,&clippingRect);
-                            _FrameRect    (paintRect);
-                        }
-
-                        if (downWhere.x > textBoxRect.right) {
-                            limits.right = downWhere.x;
-                        } else {
-                            limits.right =  textBoxRect.right;
-                            limits.left = downWhere.x;
-                        }
-                        if (downWhere.y >  textBoxRect.bottom) {
-                            limits.bottom = downWhere.y;
-                        } else {
-                            limits.bottom = textBoxRect.bottom;
-                            limits.top = downWhere.y;
-                        }
-
-                        IntersectRect (&paintRect,&limits,&clippingRect);
-                        _FrameRect    (paintRect);
-
-                        lastH = downWhere.x;
-                        lastV = downWhere.y;
-
-                        textBoxRect.left = 1;
-                    }
-                    break;
-                }
-                return true;
-            }
-
-        } else { // treat as plain move
-            bool  ch = (!(selectionType&HY_TABLE_DONT_SIZE))&&(CheckForHSizeLocation(downWhere.x-rel.left))&&(downWhere.y<rel.bottom-vsShift);
-
-            if (ch&&(cursorState!=HY_TABLE_SIZE_CURSOR)) {
-                cursorState = HY_TABLE_SIZE_CURSOR;
-                SetCursor(hSizeCursor);
-            } else if ((!ch)&&(cursorState==HY_TABLE_SIZE_CURSOR)) {
-                SetCursor(LoadCursor (nil, IDC_ARROW));
-                cursorState = 0;
-            }
-
-            if (selectionType & HY_TABLE_SEL_ROWS) {
-                if (!ch) {
-                    k = FindClickedTableCell(downWhere.x-rel.left,downWhere.y-rel.top,h,v);
-                    if (k>=0) {
-                        if ((cursorState != HY_TABLE_DRAG_CURSOR)&&
-                                ((selectionType&HY_TABLE_NODRAG_SELECTION)==0)) {
-                            if (cellTypes.lData[k]&HY_TABLE_SELECTED) {
-                                if (IsRowSelectionSimple()) {
-                                    SetCursor (pickUpCursor);
-                                    cursorState = HY_TABLE_DRAG_CURSOR;
-                                    activeColumn = -1;
-                                }
-                            }
-                        } else {
-                            if (((selectionType&HY_TABLE_NODRAG_SELECTION)==0)&&(!(cellTypes.lData[k]&HY_TABLE_SELECTED))) {
-                                SetCursor(LoadCursor (nil, IDC_ARROW));
-                                cursorState = 0;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return true;
-    }
-    }
-    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
-}
-
-
-
-
-//__________________________________________________________________
-
-void        _HYTable::_PrintTable (_SimpleList& columns, _SimpleList& rows, _HYTable* ch)
-{
-
-    if ((columns.lLength == 0)||(rows.lLength == 0)) {
-        return;
-    }
-
-    DOCINFO                 di = {sizeof(DOCINFO), "HYPHY.out", NULL };
-    PRINTDLG                pd;
-    BOOL                    SuccessFlag;
-
-    pd.lStructSize         = sizeof(PRINTDLG);
-    pd.hwndOwner           = parentWindow;
-    pd.hDevMode            = NULL;
-    pd.hDevNames           = NULL;
-    pd.hDC                 = NULL;
-    pd.Flags               = PD_COLLATE | PD_RETURNDC | PD_NOSELECTION;
-    pd.nFromPage           = 1;
-    pd.nToPage             = 0xffff;
-    pd.nMinPage            = 1;
-    pd.nMaxPage            = 0xffff;
-    pd.nCopies             = 1;
-    pd.hInstance           = NULL;
-    pd.lCustData           = 0L;
-    pd.lpfnPrintHook       = NULL;
-    pd.lpfnSetupHook       = NULL;
-    pd.lpPrintTemplateName = NULL;
-    pd.lpSetupTemplateName = NULL;
-    pd.hPrintTemplate      = NULL;
-    pd.hSetupTemplate      = NULL;
-
-    if (!PrintDlg(&pd)) {
-        return;
-    }
-
-    if (pd.hDC == NULL) {
-        pd.hDC = GetPrinterDeviceContext(parentWindow);
-    }
-
-
-    EnableWindow(parentWindow, FALSE);
-
-    SuccessFlag   = TRUE;
-    UserAbortFlag = FALSE;
-
-    PrintDialogHandle = CreateDialog(GetModuleHandle(NULL), (LPCTSTR)"PrintDlgBox", parentWindow,
-                                     PrintDialogProc);
-    SetDlgItemText(PrintDialogHandle, IDD_FNAME, "Table Printing...");
-
-    SetAbortProc(pd.hDC, AbortProc);
-
-    if (StartDoc(pd.hDC, &di) > 0) {
-        HDC         windowDC = GetDC (parentWindow);
-
-        long        printW = GetDeviceCaps(pd.hDC, HORZRES),
-                    printH = GetDeviceCaps(pd.hDC, VERTRES),
-
-                    hRes = GetDeviceCaps(pd.hDC, LOGPIXELSX),
-                    vRes = GetDeviceCaps(pd.hDC, LOGPIXELSY),
-
-                    screenHRes = GetDeviceCaps(windowDC, LOGPIXELSX),
-                    screenVRes = GetDeviceCaps(windowDC, LOGPIXELSY),
-
-                    tW = 0,
-                    tH = 0,
-                    cC = 0,
-                    cE = 0,
-                    cP = 1,
-                    t,
-                    i,
-                    pH = ch?ch->GetRowSpacing (0):0,
-                    fromPage = pd.nMinPage,
-                    toPage   = pd.nMaxPage;
-
-
-        if (pd.Flags & PD_PAGENUMS) {
-            fromPage = pd.nFromPage;
-            toPage   = pd.nToPage;
-        }
-        ReleaseDC   (parentWindow, windowDC);
-        hRes = printW*((_Parameter)screenHRes/hRes);
-        vRes = printH*((_Parameter)screenVRes/vRes);
-        screenHRes = printW;
-        screenVRes = printH;
-
-        printW = hRes;
-        printH = vRes;
-        if (ch) {
-            printH -= pH;
-            if (printH <= 0) {
-                _String errMsg ("Table header is too tall to fit on the page.");
-                WarnError (errMsg);
-                terminateExecution = false;
-                EndDoc(pd.hDC);
-                DeleteDC (pd.hDC);
-                return;
-            }
-        }
-
-        _HYRect  relDim = {0,0,0,0,HY_COMPONENT_NO_SCROLL};
-
-        if (ch)
-            for (i=0; i<columns.lLength; i++) {
-                tW += ch->GetColumnSpacing (columns.lData[i]);
-            }
-        else
-            for (i=0; i<columns.lLength; i++) {
-                tW += GetColumnSpacing (columns.lData[i]);
-            }
-
-        relDim.left    = relDim.right   = tW > printW ? printW : tW;
-
-        while ((cP < fromPage)&&SuccessFlag&&(!UserAbortFlag)) {
-            t = 0;
-            while (cC < rows.lLength) {
-                i = GetRowSpacing (rows.lData[cC]);
-                if ( t+i > printH) {
-                    cP ++;
-                    if (i > printH) {
-                        cC++;
-                    }
-                    break;
-                } else {
-                    t += i;
-                    cC ++;
-                }
-            }
-        }
-
-        cE = cC;
-
-        for (long pageCount = fromPage; pageCount<=toPage && (cC < rows.lLength); pageCount++) {
-            t = 0;
-            while (cE < rows.lLength) {
-                i = GetRowSpacing (rows.lData[cE]);
-                if ( t+i > printH) {
-                    if (i > printH) {
-                        t = printH;
-                        cE++;
-                    }
-                    break;
-                } else {
-                    t += i;
-                    cE ++;
-                }
-            }
-
-            relDim.top = relDim.bottom = t+pH;
-
-            _HYTable        *thisPage = new _HYTable (relDim,(Ptr)parentWindow,
-                    cE-cC+(ch?1:0),columns.lLength,20,20,HY_TABLE_STATIC_TEXT);
-
-            checkPointer    (thisPage);
-
-
-            if (StartPage (pd.hDC) <= 0) {
-                SuccessFlag = FALSE;
-                break;
-            }
-
-            SetMapMode  (pd.hDC, MM_ISOTROPIC);
-            SetWindowExtEx (pd.hDC, hRes, vRes,nil);
-            SetViewportExtEx (pd.hDC, screenHRes, screenVRes, nil);
-
-            thisPage->SetFont       (textFont);
-            thisPage->SetBackColor  (backColor);
-            thisPage->SetBackColor2 (backColor2);
-            thisPage->SetTextColor  (textColor);
-
-            if (ch)
-                for (i=0; i<columns.lLength; i++) {
-                    thisPage->SetColumnSpacing (i,ch->GetColumnSpacing (columns.lData[i])-20, false);
-                }
-            else
-                for (i=0; i<columns.lLength; i++) {
-                    thisPage->SetColumnSpacing (i,GetColumnSpacing (columns.lData[i])-20, false);
-                }
-
-            t = 0;
-            if (ch) {
-                thisPage->SetRowSpacing (0,pH-20,false);
-                for (i=0; i<columns.lLength; i++) {
-                    BaseRef cellData = ch->GetCellData(columns.lData[i],0);
-                    cellData->nInstances++;
-                    thisPage->SetCellData(cellData,0,i,ch->cellTypes.lData[columns.lData[i]]&HY_TABLE_DESELECT,false);
-                }
-                t = 1;
-            }
-
-            for (cP = cC; cP < cE; cP++,t++) {
-                long     rI = rows.lData[cP];
-                thisPage->SetRowSpacing (t,GetRowSpacing(rI)-20,false);
-                for (i=0; i<columns.lLength; i++) {
-                    BaseRef cellData = GetCellData(columns.lData[i],rI);
-                    cellData->nInstances++;
-                    thisPage->SetCellData(cellData,t,i,cellTypes.lData[rI*horizontalSpaces.lLength+columns.lData[i]]&HY_TABLE_DESELECT,false);
-                }
-            }
-
-            _HYRect relDim2 = relDim;
-            relDim2.left = relDim2.top = 1;
-            relDim2.right = -relDim2.right-1;
-            relDim2.bottom ++;
-
-            relDim2.width = (long)pd.hDC;
-
-            thisPage->_Paint ((Ptr)&relDim2); // may need to disable double buffering
-
-            RECT wrect = HYRect2Rect (relDim2);
-            
-            FrameRect (pd.hDC, &wrect, _BLACKBRUSH_);
-
-            if (EndPage (pd.hDC) <= 0) {
-                SuccessFlag = FALSE;
-            }
-
-            cC = cE;
-        }
-    } else {
-        SuccessFlag = FALSE;
-    }
-
-    if (SuccessFlag) {
-        SuccessFlag = (EndDoc(pd.hDC)>0);
-    }
-
-    if (!UserAbortFlag) {
-        EnableWindow(parentWindow, TRUE);
-        DestroyWindow(PrintDialogHandle);
-    }
-
-    DeleteDC (pd.hDC);
-
-    if (!SuccessFlag && !UserAbortFlag) {
-        _String errMsg = _String("Failed to print the table. Windows Error:") & (long)GetLastError();
-        ProblemReport (errMsg,nil);
-    }
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTable::_ResetCursorState (void)
-{
-    SetCursor (LoadCursor (nil, IDC_ARROW));
-    cursorState = 0;
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTable::_FrameRect        (RECT& theRect)
-{
-    HPEN      aPen = CreatePen (PS_DOT, 1, RGB(0,0,0));
-    HDC       dc   = GetDC (((_HYTable*)this)->parentWindow);
-
-    aPen           = (HPEN)SelectObject (dc, aPen);
-
-    int       saveBkMode = GetBkMode (dc),
-              saveROP2   = GetROP2   (dc);
-
-    SetBkMode (dc, TRANSPARENT);
-    SetROP2   (dc, R2_NOTXORPEN);
-
-
-    Rectangle (dc, theRect.left, theRect.top, theRect.right, theRect.bottom);
-
-    SetBkMode (dc, saveBkMode);
-    SetROP2   (dc, saveROP2);
-
-    DeleteObject (SelectObject (dc, aPen));
-
-    ReleaseDC (((_HYTable*)this)->parentWindow, dc);
-}
-
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/win/Components/HYPlatformTextBox.cpp b/src/gui/win/Components/HYPlatformTextBox.cpp
deleted file mode 100644
index c136e85..0000000
--- a/src/gui/win/Components/HYPlatformTextBox.cpp
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
-    Text input box for Win32 API
-
-    Sergei L. Kosakovsky Pond, May 2000-December 2002
-              Revised in December 2003 to use RichEdit
-*/
-
-#include "errorfns.h"
-#include "HYTextbox.h"
-#include "HYUtils.h"
-#include "HYEventTypes.h"
-#include "HYGraphicPane.h"
-#include "HYPlatformWindow.h"
-
-#include "HYDialogs.h"
-//__________________________________________________________________
-
-static LRESULT  CALLBACK editSubclassHandler (HWND WindowHand, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
-    _HYTextBox * theParent = (_HYTextBox*)GetWindowLongPtr (WindowHand, GWLP_USERDATA);
-
-    if (iMsg == WM_CHAR) {
-        int     keyCode = wParam;
-        if (!(theParent->boxFlags & HY_TB_BIGBOX)) {
-            if ((keyCode==VK_RETURN)||(keyCode==VK_ESCAPE)) {
-                if (theParent->messageRecipient) {
-                    theParent->messageRecipient->ProcessEvent (generateTextEditChangeEvent (theParent->GetID(),2));
-                }
-
-                SendMessage (theParent->parentWindow, WM_CHAR, wParam, lParam);
-                return true;
-            } else if (keyCode==VK_TAB) {
-                SendMessage (theParent->parentWindow, WM_CHAR, wParam, lParam);
-                return true;
-            }
-        }
-    } else if (iMsg == WM_KEYDOWN) {
-        if (theParent->messageRecipient && (theParent->boxFlags & HY_TB_ARROWS)) {
-            if (wParam==VK_DOWN) {
-                theParent->messageRecipient->ProcessEvent (generateTextEditChangeEvent (theParent->GetID(),3));
-                //SendMessage (theParent->parentWindow, WM_CHAR, wParam, lParam);
-                return true;
-            } else if (wParam==VK_UP) {
-                theParent->messageRecipient->ProcessEvent (generateTextEditChangeEvent (theParent->GetID(),4));
-                //SendMessage (theParent->parentWindow, WM_CHAR, wParam, lParam);
-                return true;
-            }
-        }
-    }
-
-    return CallWindowProc ((WNDPROC)theParent->mainHandler, WindowHand, iMsg, wParam, lParam);
-}
-
-//__________________________________________________________________
-
-_HYPlatformTextBox::_HYPlatformTextBox  (void)
-{
-    backFill   = CreateSolidBrush (RGB (255,255,255));
-    checkPointer ((Ptr)backFill);
-    pLabelFont = nil;
-
-
-    textBoxRect.left    = textBoxRect.top   = 0;
-    textBoxRect.bottom  = textBoxRect.right = 100;
-    textColor           = RGB(0,0,0);
-    te                  = nil;
-
-    if (((_HYTextBox*)this)->boxFlags & HY_TB_BIGBOX) {
-        backTFill           = nil;
-        isSingleLine        = false;
-        te = CreateWindowEx (0,RICHEDIT_CLASS,"",ES_MULTILINE|WS_CHILD,30000,30000,100,100,((_HYTextBox*)this)->parentWindow,NULL,ProgramInstance, NULL);
-        if (!te) {
-            long    errCode = GetLastError();
-            LPVOID lpMsgBuf;
-
-            if (FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-                               NULL,errCode,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf,0,NULL )) {
-                FlagError ((LPTSTR) lpMsgBuf);
-            }
-        }
-        SendMessage (te,EM_SETUNDOLIMIT,10,0);
-        SendMessage (te,EM_SETEVENTMASK,0,ENM_CHANGE|ENM_SELCHANGE);
-        SendMessage (te,EM_SETBKGNDCOLOR, 0, (LPARAM)RGB(255,255,255));
-    } else {
-        backTFill  = CreateSolidBrush (RGB (255,255,255));
-        isSingleLine        = true;
-        te = CreateWindow ("EDIT","",/*WS_VISIBLE|*/WS_CHILD,30000,30000,100,100,((_HYTextBox*)this)->parentWindow,NULL,ProgramInstance, NULL);
-    }
-
-    _HYTextBox * theParent = (_HYTextBox*)this;
-    SetWindowLongPtr (te,GWLP_USERDATA, (LONG_PTR)theParent);
-    mainHandler = SetWindowLongPtr (te,GWLP_WNDPROC,(LONG_PTR)editSubclassHandler);
-}
-
-//__________________________________________________________________
-
-_HYPlatformTextBox::~_HYPlatformTextBox (void)
-{
-    DeleteObject (backFill);
-    DeleteObject (backTFill);
-    DeleteObject (pLabelFont);
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformTextBox::_SetBackColor (_HYColor& c)
-{
-    DeleteObject (backFill);
-    backFill = CreateSolidBrush (RGB(c.R,c.G,c.B));
-    checkPointer (backFill);
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformTextBox::_SetBackTColor (_HYColor& c)
-{
-    if (((_HYTextBox*)this)->boxFlags & HY_TB_BIGBOX) {
-        SendMessage (te,EM_SETBKGNDCOLOR,0,(LPARAM)RGB(c.R,c.G,c.B));
-    } else {
-        DeleteObject (backTFill);
-        backTFill = CreateSolidBrush (RGB(c.R,c.G,c.B));
-        checkPointer (backTFill);
-    }
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformTextBox::_SetForeColor (_HYColor& c)
-{
-    textColor = RGB(c.R,c.G,c.B);
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformTextBox::_SetFont (_HYFont& f)
-{
-    if (pLabelFont) {
-        DeleteObject(pLabelFont);
-    }
-
-    pLabelFont = CreateFont (f.size,0,0,0,(f.style&HY_FONT_BOLD)?FW_BOLD:FW_NORMAL,f.style&HY_FONT_ITALIC,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
-                             CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,f.face.sData);
-
-    if (te) {
-        _CreateTE();
-        if (((_HYTextBox *) this)->boxFlags & HY_TB_ENABLED) {
-            ((_HYTextBox *) this)->Activate();
-        }
-    }
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_Update (Ptr p)
-{
-    _Paint (p);
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_SetDimensions (_HYRect r, _HYRect rel)
-{
-    _HYTextBox* theParent = (_HYTextBox *) this;
-    theParent->_HYPlatformComponent::_SetDimensions (r,rel);
-    _SetVisibleSize (rel);
-}
-
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_SetVisibleSize (_HYRect rel)
-{
-    _HYTextBox *theParent = (_HYTextBox*) this;
-
-    textBoxRect.top     = rel.top   + theParent->margins.top;
-    textBoxRect.left    = rel.left  + theParent->margins.left;
-    textBoxRect.bottom  = rel.bottom- theParent->margins.bottom;
-    textBoxRect.right   = rel.right - theParent->margins.right;
-
-    if ((textBoxRect.bottom-textBoxRect.top<theParent->editBoxFont.size+4)||
-            (textBoxRect.right-textBoxRect.left<theParent->editBoxFont.size+4)) {
-        if (te && (! theParent->boxFlags & HY_TB_BIGBOX)) {
-            DestroyWindow (te);
-            te = nil;
-        }
-        return;
-    }
-
-    if (te) {
-        bool          newSL = !_NeedMultiLines ();
-        if (newSL!=isSingleLine) {
-            _CreateTE     ();
-        } else {
-            SetWindowPos(te,nil, textBoxRect.left,textBoxRect.top,textBoxRect.right-textBoxRect.left+1,textBoxRect.bottom-textBoxRect.top+1,SWP_NOZORDER);
-        }
-
-        if (theParent->activationFlag) {
-            ShowWindow(te,SW_SHOWNA);
-        }
-    }
-    //else
-    //_CreateTE ();
-
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_SetAlignFlags (unsigned char f)
-{
-    if (te)
-        if (((_HYTextBox*)this)->boxFlags & HY_TB_BIGBOX) {
-            PARAFORMAT pf;
-            pf.cbSize = sizeof(PARAFORMAT);
-            pf.dwMask = PFM_ALIGNMENT;
-            switch (f) {
-            case HY_ALIGN_LEFT:
-                pf.wAlignment = PFA_LEFT;
-                break;
-
-            case HY_ALIGN_RIGHT:
-                pf.wAlignment = PFA_RIGHT;
-                break;
-
-            default:
-                pf.wAlignment = PFA_CENTER;
-            }
-            SendMessage (te,EM_SETPARAFORMAT,0,(LPARAM)&pf);
-        } else {
-            _CreateTE     ();
-        }
-}
-//__________________________________________________________________
-
-_String                 retrieveEditControlText (HWND te)
-{
-    if (te) {
-        long stringLength = SendMessage (te,WM_GETTEXTLENGTH,0,0);
-        if (stringLength) {
-            _String     res (stringLength, false);
-            SendMessage (te,WM_GETTEXT, stringLength+1,(LPARAM)res.sData);
-            res.sData[stringLength] = 0;
-            return      res;
-        }
-    }
-    return empty;
-
-}
-
-//__________________________________________________________________
-
-void                    retrieveEditControlText (HWND te, _String*& res)
-{
-    if (te) {
-        long stringLength = SendMessage (te,WM_GETTEXTLENGTH,0,0);
-        if (stringLength) {
-            res = new _String(stringLength, false);
-            SendMessage (te,WM_GETTEXT, stringLength+1,(LPARAM)res->sData);
-        } else {
-            res = new _String;
-        }
-    }
-}
-
-
-//__________________________________________________________________
-_String     _HYPlatformTextBox::_GetText (void)
-{
-    if ((((_HYTextBox*)this)->boxFlags & HY_TB_BIGBOX)) {
-        _String * r;
-        _StoreText (r,false);
-        return _String (r);
-    } else {
-        return retrieveEditControlText(te);
-    }
-}
-
-//__________________________________________________________________
-void    _HYPlatformTextBox::_StoreText (_String*& rec, bool selOnly)
-{
-    if ((((_HYTextBox*)this)->boxFlags & HY_TB_BIGBOX)) {
-        if (selOnly) {
-            long        start,
-                        end;
-            SendMessage (te,EM_GETSEL,(WPARAM)&start,(LPARAM)&end);
-            if (end>=start) {
-                rec = new _String (end-start+1,false);
-                checkPointer (rec);
-                rec->sData[SendMessage (te,EM_GETSELTEXT,0,(LPARAM)rec->sData)] = 0;
-            } else {
-                rec = new _String;
-            }
-        } else {
-            GETTEXTLENGTHEX gtl = {GTL_NUMCHARS,CP_ACP};
-            long l = SendMessage (te,EM_GETTEXTLENGTHEX,(WPARAM)&gtl,0);
-            if (l) {
-                rec = new _String (l,false);
-                checkPointer (rec);
-                TEXTRANGE tr = {{0,l},rec->sData};
-                rec->sData[SendMessage (te,EM_GETTEXTRANGE,0,(LPARAM)&tr)] = 0;
-            } else {
-                rec = new _String;
-            }
-        }
-    } else {
-        retrieveEditControlText(te, rec);
-    }
-}
-
-//__________________________________________________________________
-bool        _HYPlatformTextBox::_NeedMultiLines (void)
-{
-    if (((_HYTextBox*)this)->boxFlags & HY_TB_BIGBOX) {
-        return 1;
-    } else {
-        return (textBoxRect.bottom-textBoxRect.top+1>((_HYTextBox*)this)->editBoxFont.size * 2.5);
-    }
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_CreateTE (void)
-{
-    _String      currentText;
-
-    if (te) {
-        currentText   = _GetText ();
-        DestroyWindow (te);
-    }
-
-    _HYTextBox * theParent = (_HYTextBox*)this;
-
-    DWORD        windowStyle = 0;
-
-    if (theParent->alignFlags&HY_ALIGN_LEFT) {
-        windowStyle = ES_LEFT;
-    } else if (theParent->alignFlags&HY_ALIGN_RIGHT) {
-        windowStyle = ES_RIGHT;
-    } else {
-        windowStyle = ES_CENTER;
-    }
-
-    if (_NeedMultiLines ()) {
-        isSingleLine = false;
-        windowStyle |= ES_MULTILINE|ES_WANTRETURN|ES_AUTOVSCROLL;
-        if (!(theParent->boxFlags & (HY_TB_WRAP||HY_TB_BIGBOX))) {
-            windowStyle |= ES_AUTOHSCROLL;
-        }
-        if (theParent->boxFlags & HY_TB_BIGBOX) {
-            windowStyle |= WS_VSCROLL;
-        }
-    } else {
-        isSingleLine = true;
-        windowStyle |= ES_AUTOHSCROLL;
-    }
-
-    if ((theParent->boxFlags & HY_TB_ENABLED) == 0) {
-        windowStyle |= ES_READONLY;
-    }
-
-    if (theParent->boxFlags & HY_TB_BIGBOX) {
-        te = CreateWindowEx (0,RICHEDIT_CLASS,currentText.sData,WS_CHILD|windowStyle,
-                             textBoxRect.left,textBoxRect.top,textBoxRect.right-textBoxRect.left+1,textBoxRect.bottom-textBoxRect.top+1
-                             ,theParent->parentWindow,NULL,ProgramInstance, NULL);
-
-        checkPointer   (te);
-        SetWindowLongPtr (te,GWLP_USERDATA, (LONG_PTR)theParent);
-        mainHandler = SetWindowLongPtr (te,GWLP_WNDPROC,(LONG_PTR)editSubclassHandler);
-
-        SendMessage (te,EM_SETUNDOLIMIT,10,0);
-        SendMessage (te,EM_SETEVENTMASK,0,ENM_CHANGE|ENM_SELCHANGE);
-        SendMessage (te,EM_SETBKGNDCOLOR, 0, (LPARAM)RGB(255,255,255));
-
-    } else {
-
-        te = CreateWindow ("EDIT",currentText.sData,/*WS_VISIBLE|*/WS_CHILD|windowStyle,
-                           textBoxRect.left,textBoxRect.top,textBoxRect.right-textBoxRect.left+1,textBoxRect.bottom-textBoxRect.top+1
-                           ,theParent->parentWindow,NULL,ProgramInstance, NULL);
-
-        checkPointer   (te);
-        SetWindowLongPtr (te,GWLP_USERDATA, (LONG_PTR)theParent);
-        mainHandler = SetWindowLongPtr (te,GWLP_WNDPROC,(LONG_PTR)editSubclassHandler);
-
-
-        SendMessage (te, EM_SETMARGINS, EC_LEFTMARGIN, 3);
-        SendMessage (te, EM_SETMARGINS, EC_RIGHTMARGIN, 3);
-    }
-
-
-    if (pLabelFont) {
-        SendMessage (te, WM_SETFONT, (WPARAM)pLabelFont, 1);
-    }
-
-
-}
-
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_SetText (const _String& editBoxText)
-{
-    _HYTextBox * theParent = (_HYTextBox*)this;
-    if (!te) {
-        _CreateTE();
-    }
-
-    _HYGuiObject* stashRec = theParent->messageRecipient;
-    theParent->SetMessageRecipient (nil);
-    if (theParent->boxFlags & HY_TB_BIGBOX) {
-        SETTEXTEX     stext = {ST_DEFAULT,CP_ACP};
-        SendMessage   (te,EM_SETTEXTEX,(WPARAM)&stext,(LPARAM)editBoxText.sData);
-    } else {
-        SendMessage   (te,WM_SETTEXT,0,(LPARAM)editBoxText.sData);
-    }
-    theParent->SetMessageRecipient (stashRec);
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_InsertText (const _String& editBoxText, bool append)
-{
-    if (!te) {
-        _SetText (editBoxText);
-    } else {
-        if (append) {
-            SendMessage (te, EM_SETSEL, 0x7fffffff, 0x7ffffff);
-        }
-
-        SendMessage (te, EM_REPLACESEL, 0, (LPARAM)editBoxText.sData);
-
-        if (append) {
-            SendMessage (te, WM_VSCROLL, SB_BOTTOM, 0);
-        }
-
-    }
-}
-
-//__________________________________________________________________
-void        _HYPlatformTextBox::_Paint (Ptr p)
-{
-    _HYTextBox * theParent = (_HYTextBox*)this;
-    _HYRect    * relRect   = (_HYRect*)p;
-
-    RECT         cRect;
-    HDC          hdc       = (HDC)relRect->width;
-
-    if (!(theParent->settings.width&HY_COMPONENT_TRANSP_BG)) {
-        cRect.left   = relRect->left;
-        cRect.right  = relRect->right;
-        cRect.top    = relRect->top;
-        cRect.bottom = relRect->top+theParent->margins.top;
-
-        if (theParent->margins.top) {
-            FillRect (hdc,&cRect,backFill);
-        }
-
-
-        cRect.bottom = relRect->bottom;
-        cRect.top = relRect->bottom-theParent->margins.bottom;
-
-        if (theParent->margins.bottom) {
-            FillRect (hdc,&cRect,backFill);
-        }
-
-        cRect.top    = relRect->top;
-        cRect.bottom = relRect->bottom;
-        cRect.right  = relRect->left+theParent->margins.left;
-
-        if (theParent->margins.left) {
-            FillRect (hdc,&cRect,backFill);
-        }
-
-        cRect.left  = relRect->right-theParent->margins.right;
-        cRect.right  = relRect->right;
-
-        if (theParent->margins.right) {
-            FillRect (hdc,&cRect,backFill);
-        }
-    }
-
-    if (te) {
-        if (theParent->boxFlags & HY_TB_ENABLED) {
-            UpdateWindow (te);
-        }
-    }
-
-    if ((theParent->boxFlags & HY_TB_BIGBOX) == 0) {
-        cRect = textBoxRect;
-        InflateRect (&cRect,2,2);
-        DrawEdge (hdc,&cRect,EDGE_BUMP, BF_RECT);
-    }
-
-    (*theParent)._HYPlatformComponent::_Paint(p);
-}
-
-
-//__________________________________________________________________
-
-void        _HYPlatformTextBox::_EnableTextBox (bool e)
-{
-    if (te)
-        if (e) {
-            SendMessage (te, EM_SETREADONLY, 0, 0);
-        } else {
-            SendMessage (te, EM_SETREADONLY, 1, 0);
-        }
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTextBox::_FocusComponent (void)
-{
-    if (te) {
-        SetFocus (te);
-    }
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformTextBox::_UnfocusComponent (void)
-{
-}
-
-//__________________________________________________________________
-
-void        _HYTextBox::_Activate (void)
-{
-    _HYPlatformComponent::_Activate();
-    //ReportWarning (_String ("Activated Component ") & (long)GetID());
-    if (te) {
-        //ReportWarning (_String ("Component Alive "));
-        ShowWindow (te, SW_SHOW);
-    }
-}
-
-//__________________________________________________________________
-
-void        _HYTextBox::_IdleHandler (void)
-{
-}
-
-//__________________________________________________________________
-
-void        _HYTextBox::_Deactivate (void)
-{
-}
-
-//__________________________________________________________________
-
-bool _HYTextBox::_ProcessOSEvent (Ptr vEvent)
-{
-    _HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;
-
-
-    switch (theEvent->iMsg) {
-    case WM_COMMAND: {
-        if ((theEvent->lParam== 0 )&&(boxFlags & HY_TB_FOCUSED)) {
-            switch (LOWORD (theEvent->wParam)) {
-            case HY_WINDOW_MENU_ID_EDIT: { // undo
-                SendMessage (te, EM_UNDO, 0, 0);
-                return true;
-            }
-            case HY_WINDOW_MENU_ID_EDIT+1: { // copy
-                SendMessage (te, WM_COPY, 0, 0);
-                return true;
-            }
-            case HY_WINDOW_MENU_ID_EDIT+2: { // cut
-                SendMessage (te, WM_CUT, 0, 0);
-                return true;
-            }
-            case HY_WINDOW_MENU_ID_EDIT+3: { // cut
-                SendMessage (te, WM_PASTE, 0, 0);
-                return true;
-            }
-            case HY_WINDOW_MENU_ID_EDIT+5: { // select all
-                if (boxFlags & HY_TB_BIGBOX) {
-                    CHARRANGE cr = {0,1};
-                    SendMessage (te, EM_EXSETSEL, 0, (LPARAM)&cr);
-                } else {
-                    SetSelection (0,30000);
-                }
-                return true;
-            }
-            }
-            break;
-        } else {
-            WORD       wP = HIWORD(theEvent->wParam);
-            if ((wP==EN_SETFOCUS)||(wP==EN_CHANGE)) {
-                HWND    cbh = (HWND)theEvent->lParam;
-                if ((cbh == te)&&(boxFlags & HY_TB_ENABLED)) {
-                    if (messageRecipient) {
-                        if (wP==EN_SETFOCUS) {
-                            messageRecipient->ProcessEvent(generateKeyboardFocusEvent(GetID()));
-                        } else {
-                            messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-                        }
-
-                    }
-                    return true;
-                }
-            }
-        }
-        break;
-    }
-
-    case WM_NOTIFY: {
-        NMHDR * nS = (NMHDR*)theEvent->lParam;
-        if (nS->hwndFrom==te && (boxFlags & HY_TB_ENABLED)) {
-            if (messageRecipient && nS->code == EN_SELCHANGE) {
-                messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),0));
-            }
-        }
-        break;
-    }
-
-    case WM_CTLCOLOREDIT:
-    case WM_CTLCOLORSTATIC: {
-        if (((HWND)theEvent->lParam == te) && (boxFlags & HY_TB_BIGBOX == 0)) {
-            HDC         hdc = (HDC)theEvent->wParam;
-            SetTextColor (hdc,textColor);
-            theEvent->res = (LRESULT)backTFill;
-            return true;
-        }
-        break;
-    }
-
-    }
-    return _HYPlatformComponent::_ProcessOSEvent (vEvent);
-}
-
-//__________________________________________________________________
-
-void    _HYTextBox::_SetSelection (long s, long e)
-{
-    if (te&&(s>=0)&&(e>=s)) {
-        SendMessage (te, EM_SETSEL, s, e);
-        SendMessage (te, EM_SCROLLCARET, 0, 0);
-    }
-
-}
-
-//__________________________________________________________________
-
-void    _HYTextBox::_MarkForUpdate (void)
-{
-    if (te) {
-        RECT tR;
-        GetClientRect (te, &tR);
-        InvalidateRect(te, &tR, true);
-    }
-    _HYPlatformComponent::_MarkForUpdate();
-}
-
-
-//__________________________________________________________________
-
-bool    _HYTextBox::_IsEmpty (void)
-{
-    if (te) {
-        return !SendMessage (te,WM_GETTEXTLENGTH,0,0);
-    }
-    return true;
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoUndo (bool m)
-{
-    SendMessage (te, EM_UNDO, 0, 0);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoRedo (bool m)
-{
-    SendMessage (te, EM_REDO, 0, 0);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoCut (bool m)
-{
-    SendMessage (te, WM_CUT, 0, 0);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoCopy (bool )
-{
-    SendMessage (te, WM_COPY, 0, 0);
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoPaste (bool m)
-{
-    SendMessage (te, WM_PASTE, 0, 0);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoSelectAll (bool m)
-{
-    ((_HYTextBox*)this)->SetSelection (0,0x7fffffff);
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),0));
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoClear (bool doAll, bool m)
-{
-    if (doAll) {
-        SendMessage (te,WM_SETTEXT,(WPARAM)0,(LPARAM)empty.sData);
-    } else {
-        SendMessage (te,EM_REPLACESEL,(WPARAM)true,(LPARAM)empty.sData);
-    }
-    if (m&&messageRecipient) {
-        messageRecipient->ProcessEvent (generateTextEditChangeEvent (GetID(),1));
-    }
-
-}
-
-//__________________________________________________________________
-
-void _HYTextBox::_DoFind (_String & st)
-{
-    //if (te && (boxFlags & HY_TB_BIGBOX))
-    //{
-
-    //long match = SendMessage (te,
-}
-
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/win/HYPlatformComponent.cpp b/src/gui/win/HYPlatformComponent.cpp
deleted file mode 100644
index e625a61..0000000
--- a/src/gui/win/HYPlatformComponent.cpp
+++ /dev/null
@@ -1,672 +0,0 @@
-/*
-    A general composite window component object, Windows specifics
-
-    Sergei L. Kosakovsky Pond, June 2000.
-*/
-
-#include "HYComponent.h"
-#include "HYPlatformComponent.h"
-#include "HYPlatformGraphicPane.h"
-#include "HYWindow.h"
-#include "HYEventTypes.h"
-#include "HYCanvas.h"
-#include "HYUtils.h"
-
-#include "Windows.h"
-
-extern  long           smallScrollStep;
-extern  _HYGuiObject * scrollingWindow;
-extern  bool           hScrollingAction;
-
-bool    forceUpdateForScrolling = false;
-
-
-//__________________________________________________________________________________
-
-void            AlignRectangle (_HYRect& rel , RECT& target , unsigned char alFlags)
-{
-    long     temp;
-    if (alFlags&HY_ALIGN_RIGHT) {
-        temp = target.right-target.left;
-        target.right = rel.right;
-        target.left = target.right - temp;
-    } else if (!(alFlags&HY_ALIGN_LEFT)) {
-        temp = (rel.right-rel.left-target.right+target.left)/2;
-        target.left+=temp;
-        target.right+=temp;
-    }
-
-    if (alFlags&HY_ALIGN_BOTTOM) {
-        temp = target.bottom-target.top;
-        target.bottom = rel.bottom;
-        target.top = target.bottom - temp;
-    } else if (!(alFlags&HY_ALIGN_TOP)) {
-        temp = (rel.bottom-rel.top-target.bottom+target.top)/2;
-        target.top+=temp;
-        target.bottom+=temp;
-    }
-}
-
-//__________________________________________________________________
-
-_HYPlatformComponent::_HYPlatformComponent(void)
-{
-    vScroll = hScroll = nil;
-    scrollState = 0;
-}
-
-//__________________________________________________________________
-
-_HYPlatformComponent::_HYPlatformComponent(_HYRect s,Ptr w)
-{
-    bool    memError = false;
-    vScroll = hScroll = nil;
-    parentWindow = (HWND)w;
-    if (s.width&HY_COMPONENT_H_SCROLL) {
-        hScroll = CreateWindow ("SCROLLBAR","",SBS_HORZ|WS_CHILD|WS_VISIBLE,0,0,100,HY_SCROLLER_WIDTH,parentWindow,NULL,GetModuleHandle (NULL), NULL);
-        if (!hScroll) {
-            memError = true;
-        } else {
-            SetScrollRange (hScroll,SB_CTL,0,MAX_CONTROL_VALUE,FALSE);
-        }
-    }
-    if (s.width&HY_COMPONENT_V_SCROLL) {
-        vScroll = CreateWindow ("SCROLLBAR","",SBS_VERT|WS_CHILD|WS_VISIBLE,0,0,HY_SCROLLER_WIDTH,100,parentWindow,NULL,GetModuleHandle (NULL), NULL);
-        if (!vScroll) {
-            memError = true;
-        } else {
-            SetScrollRange (vScroll,SB_CTL,0,MAX_CONTROL_VALUE,FALSE);
-        }
-    }
-    if (memError) {
-        _String errMsg = "Could not allocate memory for a window component structure.";
-        FlagError (errMsg);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformComponent::_CleanUp(void)
-{
-}
-
-//__________________________________________________________________
-long        _HYPlatformComponent::_GetHScrollerPos (void)
-{
-    if (hScroll) {
-        SCROLLINFO  sI;
-        sI.cbSize = sizeof (SCROLLINFO);
-        sI.fMask  = SIF_POS|SIF_PAGE;
-
-        GetScrollInfo (hScroll, SB_CTL, &sI);
-
-        return        (sI.nPos*(_Parameter)MAX_CONTROL_VALUE)/((_Parameter)MAX_CONTROL_VALUE-(_Parameter)sI.nPage);
-    } else {
-        return 0;
-    }
-}
-//__________________________________________________________________
-long        _HYPlatformComponent::_GetVScrollerPos (void)
-{
-    if (vScroll) {
-        SCROLLINFO  sI;
-        sI.cbSize = sizeof (SCROLLINFO);
-        sI.fMask  = SIF_POS|SIF_PAGE;
-
-        GetScrollInfo (vScroll, SB_CTL, &sI);
-
-        return (sI.nPos*(_Parameter)MAX_CONTROL_VALUE)/((_Parameter)MAX_CONTROL_VALUE-sI.nPage);
-        //printf ("%d %d %d\n", sI.nPos, sI.nPage, (long)res);
-
-    } else {
-        return 0;
-    }
-}
-
-//__________________________________________________________________
-void        _HYPlatformComponent::_SetHScrollerPos (long nv)
-{
-    if (hScroll&&(scrollState & HY_COMPONENT_ENABLE_H_SCROLL)) {
-        if (nv<0) {
-            nv = 0;
-        } else if (nv>MAX_CONTROL_VALUE) {
-            nv = MAX_CONTROL_VALUE;
-        }
-
-        SCROLLINFO  sI;
-        sI.cbSize = sizeof (SCROLLINFO);
-        sI.fMask  = SIF_POS|SIF_PAGE;
-
-        GetScrollInfo (hScroll, SB_CTL, &sI);
-
-        sI.nPos = (nv*((_Parameter)MAX_CONTROL_VALUE-(_Parameter)sI.nPage))/(_Parameter)MAX_CONTROL_VALUE;
-
-        //printf (">%d %d %d\n", nv, sI.nPos,sI.nPage);
-
-        sI.fMask  = SIF_POS;
-        SetScrollInfo (hScroll, SB_CTL, &sI, true);
-
-    }
-}
-
-//__________________________________________________________________
-void        _HYPlatformComponent::_SetVScrollerPos (long nv)
-{
-    if (vScroll&&(scrollState & HY_COMPONENT_ENABLE_V_SCROLL)) {
-        if (nv<0) {
-            nv = 0;
-        } else if (nv>MAX_CONTROL_VALUE) {
-            nv = MAX_CONTROL_VALUE;
-        }
-
-        SCROLLINFO  sI;
-        sI.cbSize = sizeof (SCROLLINFO);
-        sI.fMask  = SIF_POS|SIF_PAGE;
-
-        GetScrollInfo (vScroll, SB_CTL, &sI);
-
-        sI.nPos = (nv*((_Parameter)MAX_CONTROL_VALUE-(_Parameter)sI.nPage))/(_Parameter)MAX_CONTROL_VALUE;
-
-        sI.fMask  = SIF_POS;
-        SetScrollInfo (vScroll, SB_CTL, &sI, true);
-        //printf ("%d %d\n", nv, sI.nPos);
-
-    }
-}
-
-//__________________________________________________________________
-void _HYPlatformComponent::Duplicate (BaseRef s)
-{
-    _HYComponent* theS = (_HYComponent*)s;
-    _CleanUp();
-    hScroll = theS->hScroll;
-    vScroll = theS->vScroll;
-}
-
-//__________________________________________________________________
-void _HYPlatformComponent::_SetDimensions (_HYRect d,_HYRect r)
-{
-    _SetVisibleSize (r);
-}
-
-//__________________________________________________________________
-void _HYPlatformComponent::_MarkForUpdate (void)
-{
-    RECT inv;
-    inv.left = rel.left;
-    inv.right = rel.right;
-    inv.bottom = rel.bottom;
-    inv.top = rel.top;
-
-    if (forceUpdateForScrolling) {
-        _HYRect invR = {inv.top, inv.left, inv.bottom, inv.right, (long)GetDC (parentWindow)};
-        ((_HYComponent*)this)->Paint ((Ptr)&invR);
-        ReleaseDC (parentWindow, (HDC)invR.width);
-    } else {
-        InvalidateRect (parentWindow,&inv, ((_HYComponent*)this)->settings.width&HY_COMPONENT_TRANSP_BG);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformComponent::_MarkContentsForUpdate (void)
-{
-    RECT inv;
-    inv.left = rel.left;
-    inv.right = rel.right;
-    inv.bottom = rel.bottom;
-    inv.top = rel.top;
-    if (hScroll) {
-        inv.bottom -= HY_SCROLLER_WIDTH;
-    }
-    if (vScroll) {
-        inv.right -= HY_SCROLLER_WIDTH;
-    }
-    InvalidateRect (parentWindow,&inv, false);
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformComponent::_SetVisibleSize (_HYRect r)
-{
-    _HYComponent * theParent = (_HYComponent*)this;
-    SCROLLINFO     si;
-    long           t,v;
-
-    _Parameter     newSize;
-
-    scrollState = 0;
-
-    si.cbSize = sizeof (SCROLLINFO);
-
-    if (hScroll&&!vScroll) { // only horizontal scroll bar
-        SetWindowPos (hScroll,NULL,r.left,r.bottom-HY_SCROLLER_WIDTH,r.right-r.left+1,HY_SCROLLER_WIDTH,SWP_NOZORDER);
-
-        t = theParent->GetMaxW();
-        v = r.right-r.left+1;
-
-        if (t>v) {
-            si.fMask = SIF_ALL;
-            GetScrollInfo (hScroll, SB_CTL, & si);
-
-            newSize = MAX_CONTROL_VALUE*(_Parameter)v/t;
-            si.nPage = newSize;
-
-            SetScrollInfo  (hScroll,SB_CTL,&si,true);
-            EnableScrollBar(hScroll,SB_CTL,ESB_ENABLE_BOTH);
-            ShowScrollBar  (hScroll,SB_CTL,true);
-            scrollState |= HY_COMPONENT_ENABLE_H_SCROLL;
-
-        } else {
-            EnableScrollBar(hScroll,SB_CTL,ESB_DISABLE_BOTH);
-            ShowScrollBar  (hScroll,SB_CTL,false);
-        }
-
-    }
-    if (vScroll&&!hScroll) { // only vertical scroll bar
-        SetWindowPos (vScroll,NULL,r.right-HY_SCROLLER_WIDTH,r.top,HY_SCROLLER_WIDTH,r.bottom-r.top+1,SWP_NOZORDER);
-
-        t = theParent->GetMaxH();
-        v = r.bottom-r.top+1;
-
-        if (t>v) {
-            si.fMask = SIF_ALL;
-            GetScrollInfo (vScroll, SB_CTL, & si);
-
-            newSize = MAX_CONTROL_VALUE*(_Parameter)v/t;
-            si.nPage = newSize;
-
-            SetScrollInfo  (vScroll,SB_CTL,&si,false);
-            EnableScrollBar(vScroll,SB_CTL,ESB_ENABLE_BOTH);
-            ShowScrollBar  (hScroll,SB_CTL,true);
-            scrollState |= HY_COMPONENT_ENABLE_V_SCROLL;
-        } else {
-            EnableScrollBar(vScroll,SB_CTL,ESB_DISABLE_BOTH);
-            ShowScrollBar  (hScroll,SB_CTL,false);
-        }
-    }
-    if (vScroll&&hScroll) {
-        SetWindowPos (hScroll,NULL,r.left,r.bottom-HY_SCROLLER_WIDTH,r.right-r.left-HY_SCROLLER_WIDTH,HY_SCROLLER_WIDTH,SWP_NOZORDER|SWP_NOACTIVATE);
-
-        t = theParent->GetMaxW();
-        v = r.right-r.left+1+HY_SCROLLER_WIDTH;
-
-        if (t>v) {
-            si.fMask = SIF_ALL;
-            GetScrollInfo (hScroll, SB_CTL, & si);
-
-            newSize = MAX_CONTROL_VALUE*(_Parameter)v/t;
-            si.nPage = newSize;
-
-            SetScrollInfo  (hScroll,SB_CTL,&si,true);
-            EnableScrollBar(hScroll,SB_CTL,ESB_ENABLE_BOTH);
-            ShowScrollBar  (hScroll,SB_CTL,true);
-            scrollState |= HY_COMPONENT_ENABLE_H_SCROLL;
-        } else {
-
-            EnableScrollBar(hScroll,SB_CTL,ESB_DISABLE_BOTH);
-            ShowScrollBar  (hScroll,SB_CTL,false);
-        }
-
-        SetWindowPos (vScroll,NULL,r.right-HY_SCROLLER_WIDTH,r.top,HY_SCROLLER_WIDTH,r.bottom-r.top+1,SWP_NOZORDER);
-
-        t = theParent->GetMaxH();
-        v = r.bottom-r.top+1+HY_SCROLLER_WIDTH;
-
-        if (t>v) {
-            si.fMask = SIF_ALL;
-            GetScrollInfo (vScroll, SB_CTL, & si);
-
-            newSize = MAX_CONTROL_VALUE*(_Parameter)v/t;
-            si.nPage = newSize;
-
-            SetScrollInfo  (vScroll,SB_CTL,&si,false);
-            EnableScrollBar(vScroll,SB_CTL,ESB_ENABLE_BOTH);
-            ShowScrollBar  (hScroll,SB_CTL,true);
-            scrollState |= HY_COMPONENT_ENABLE_V_SCROLL;
-        } else {
-            EnableScrollBar(vScroll,SB_CTL,ESB_DISABLE_BOTH);
-            ShowScrollBar  (vScroll,SB_CTL,false);
-        }
-    }
-    rel = r;
-}
-//__________________________________________________________________
-
-void        _HYPlatformComponent::_Paint (Ptr p)
-{
-    if (hScroll) {
-        ShowScrollBar(hScroll,SB_CTL,TRUE);
-    }
-    if (vScroll) {
-        ShowScrollBar(vScroll,SB_CTL,TRUE);
-    }
-    _HYComponent* parent = (_HYComponent*)this;
-
-    if (parent->settings.width&HY_COMPONENT_BORDER) {
-        HDC      theDC = (HDC)((_HYRect*)p)->width;
-
-        HPEN     blackPen = CreatePen (PS_SOLID, 1, RGB (0,0,0)),
-                 oldPen   = (HPEN)SelectObject (theDC, blackPen);
-
-        MoveToEx (theDC,rel.left,rel.top,nil);
-
-        if (parent->settings.width&HY_COMPONENT_BORDER_T) {
-            LineTo (theDC,rel.right,rel.top);
-        }
-
-        MoveToEx (theDC,rel.right-1,rel.top,nil);
-
-        if (parent->settings.width&HY_COMPONENT_BORDER_R) {
-            LineTo (theDC,rel.right-1,rel.bottom);
-        }
-
-        MoveToEx (theDC,rel.right,rel.bottom-1,nil);
-
-        if (parent->settings.width&HY_COMPONENT_BORDER_B) {
-            LineTo (theDC,rel.left-1,rel.bottom-1);
-        }
-
-        MoveToEx (theDC,rel.left,rel.bottom,nil);
-
-        if (parent->settings.width&HY_COMPONENT_BORDER_L) {
-            LineTo (theDC,rel.left,rel.top-1);
-        }
-
-        SelectObject (theDC, oldPen);
-        DeleteObject (blackPen);
-
-        /*UINT  bFlags = 0;
-
-        if (parent->settings.width&HY_COMPONENT_BORDER_T)
-            bFlags |= BF_TOP;
-
-        if (parent->settings.width&HY_COMPONENT_BORDER_R)
-            bFlags |= BF_RIGHT;
-
-        if (parent->settings.width&HY_COMPONENT_BORDER_B)
-            bFlags |= BF_BOTTOM;
-
-        if (parent->settings.width&HY_COMPONENT_BORDER_L)
-            bFlags |= BF_LEFT;
-
-        RECT     rr    =  HYRect2Rect (rel);
-        DrawEdge (theDC,&rr,EDGE_RAISED, bFlags);*/
-
-    }
-
-    if (parent->settings.width&HY_COMPONENT_WELL) {
-        HDC      theDC = (HDC)((_HYRect*)p)->width;
-
-        RECT     rr    =  HYRect2Rect (rel);
-        InflateRect (&rr,-2,-2);
-        DrawEdge (theDC,&rr,EDGE_SUNKEN, BF_RECT);
-
-    }
-}
-
-//__________________________________________________________________
-
-void      _HYPlatformComponent::_Update (Ptr p)
-{
-    _Paint (p);
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformComponent::_Activate (void)
-{
-    _HYComponent*   theParent = (_HYComponent*)this;
-    if (hScroll) {
-        if (theParent->GetMaxW()>theParent->rel.right-theParent->rel.left+1+HY_SCROLLER_WIDTH) {
-            scrollState |= HY_COMPONENT_ENABLE_H_SCROLL;
-            EnableScrollBar(hScroll,SB_CTL,ESB_ENABLE_BOTH);
-        }
-    }
-    if (vScroll) {
-        if (theParent->GetMaxH()>theParent->rel.bottom-theParent->rel.top+1+HY_SCROLLER_WIDTH) {
-            scrollState |= HY_COMPONENT_ENABLE_V_SCROLL;
-            EnableScrollBar(vScroll,SB_CTL,ESB_ENABLE_BOTH);
-        }
-    }
-    activationFlag = true;
-}
-
-//__________________________________________________________________
-
-void        _HYPlatformComponent::_Deactivate (void)
-{
-    if (hScroll) {
-        EnableScrollBar(hScroll,SB_CTL,ESB_DISABLE_BOTH);
-    }
-    if (vScroll) {
-        EnableScrollBar(vScroll,SB_CTL,ESB_DISABLE_BOTH);
-    }
-
-    scrollState = 0;
-
-    activationFlag = false;
-}
-
-//__________________________________________________________________
-
-bool _HYPlatformComponent::_ProcessOSEvent (Ptr vEvent)
-{
-    _HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;
-    switch (theEvent->iMsg) {
-    case WM_HSCROLL:
-    case WM_VSCROLL: {
-        if((((HWND)(theEvent->lParam))==hScroll)||(((HWND)(theEvent->lParam))==vScroll)) {
-            _HYComponent* theParent = (_HYComponent*)this;
-
-            long       invisPixels,
-                       currentValue,
-                       oldValue;
-
-            if (theEvent->iMsg == WM_HSCROLL) {
-                invisPixels = theParent->GetMaxW()-(theParent->GetHSize());
-                currentValue = _GetHScrollerPos();
-            } else {
-                invisPixels = theParent->GetMaxH()-(theParent->GetVSize());
-                currentValue = _GetVScrollerPos();
-            }
-
-
-            oldValue = currentValue;
-            invisPixels = (_Parameter)MAX_CONTROL_VALUE/invisPixels;
-            if (!invisPixels) {
-                invisPixels = 1;
-            }
-
-            switch (LOWORD(theEvent->wParam)) {
-            case SB_LINEUP:
-                currentValue-=invisPixels;
-                break;
-            case SB_LINEDOWN:
-                currentValue+=invisPixels;
-                break;
-            case SB_PAGEUP:
-                currentValue-=100*invisPixels;
-                break;
-            case SB_PAGEDOWN:
-                currentValue+=100*invisPixels;
-                break;
-            case SB_THUMBPOSITION:
-            case SB_THUMBTRACK: {
-
-                SCROLLINFO  sI;
-                sI.cbSize = sizeof (SCROLLINFO);
-                sI.fMask  = SIF_PAGE|SIF_TRACKPOS;
-                if (theEvent->iMsg == WM_HSCROLL) {
-                    GetScrollInfo (hScroll, SB_CTL, &sI);
-                } else {
-                    GetScrollInfo (vScroll, SB_CTL, &sI);
-                }
-
-                currentValue =  sI.nTrackPos;
-
-                currentValue = (currentValue*(_Parameter)MAX_CONTROL_VALUE)/(MAX_CONTROL_VALUE-(_Parameter)sI.nPage);
-                break;
-            }
-            case SB_TOP:
-                currentValue = 0;
-                break;
-            case  SB_BOTTOM:
-                currentValue = MAX_CONTROL_VALUE;
-                break;
-            default:
-                return true;
-            }
-
-            if (currentValue<0) {
-                currentValue = 0;
-            }
-            if (currentValue>MAX_CONTROL_VALUE) {
-                currentValue = MAX_CONTROL_VALUE;
-            }
-
-            if (currentValue!=oldValue) {
-                if (theEvent->iMsg == WM_HSCROLL) {
-                    _SetHScrollerPos (currentValue);
-                    theParent->ProcessEvent (generateScrollEvent (currentValue-oldValue,0));
-                } else {
-                    _SetVScrollerPos (currentValue);
-                    theParent->ProcessEvent (generateScrollEvent (0,currentValue-oldValue));
-                }
-            }
-            return true;
-        }
-        break;
-    }
-    }
-    return false;
-}
-
-//__________________________________________________________________
-
-
-_HYRect _HYPlatformComponent::_VisibleContents (Ptr p)
-{
-    _HYComponent* theParent = (_HYComponent*)this;
-    _HYRect     * r = (_HYRect*)p,
-                  res;
-
-    short v;
-    short windowW=r->right-r->left,
-          windowH=r->bottom-r->top;
-    if ((!hScroll)&&(!vScroll)) {
-        res.left = theParent->hOrigin;
-        res.right = res.left+windowW;
-        res.top = theParent->vOrigin;
-        res.bottom = res.top+windowH;
-        return res;
-    }
-    if (hScroll) {
-        windowH-=HY_SCROLLER_WIDTH;
-    }
-    if (vScroll) {
-        windowW-=HY_SCROLLER_WIDTH;
-    }
-    if (hScroll) {
-        if (windowW>theParent->GetMaxW()) {
-            res.left = 0;
-            res.right = theParent->GetMaxW();
-        } else {
-            v = GetScrollPos (hScroll,SB_CTL);
-            res.left = (theParent->GetMaxW()-windowW)*v/(_Parameter)MAX_CONTROL_VALUE;
-            res.right = res.left+windowW;
-        }
-    } else {
-        res.left = 0;
-        res.right = windowW;
-    }
-    if (vScroll) {
-        if (windowH>theParent->GetMaxH()) {
-            res.top = 0;
-            res.bottom = theParent->GetMaxH();
-        } else {
-            v = GetScrollPos (vScroll,SB_CTL);
-            res.top = (theParent->GetMaxH()-windowH)*v/(_Parameter)MAX_CONTROL_VALUE;
-            res.bottom = res.top+windowH;
-        }
-    } else {
-        res.top = 0;
-        res.bottom = windowH;
-    }
-    return res;
-}
-
-//__________________________________________________________________
-
-void    _HYCanvas::_Paint (Ptr p)
-{
-    _HYPlatformComponent::_Paint(p);
-    _HYRect * destR = (_HYRect*)p;
-    HDC pDC = (HDC)destR->width;
-    RECT srcRect,destRect;
-    destRect.right = destR->right;
-    destRect.bottom = destR->bottom;
-    if (HasHScroll()) {
-        destRect.bottom-=HY_SCROLLER_WIDTH;
-    }
-    if (HasVScroll()) {
-        destRect.right-=HY_SCROLLER_WIDTH;
-    }
-    destRect.left = destR->left;
-    destRect.top = destR->top;
-    _HYRect srcR = _VisibleContents (p);
-    srcRect.right = srcR.right;
-    srcRect.left = srcR.left;
-    srcRect.top = srcR.top;
-    srcRect.bottom = srcR.bottom;
-//  printf ("\n%d %d %d %d %d %d %d %d\n",srcRect.top, srcRect.left, srcRect.bottom,srcRect.right,
-//                                        destRect.top, destRect.left, destRect.bottom,destRect.right);
-    BitBlt (pDC,destRect.left,destRect.top,srcRect.right-srcRect.left,srcRect.bottom-srcRect.top,
-            thePane,srcRect.left,srcRect.top,SRCCOPY);
-}
-
-//__________________________________________________________________
-
-void    _HYCanvas::_Update (Ptr p)
-{
-    _Paint(p);
-}
-
-//__________________________________________________________________
-
-bool _HYCanvas::_ProcessOSEvent (Ptr vEvent)
-{
-    _HYWindowsUIMessage*    theEvent = (_HYWindowsUIMessage*)vEvent;
-
-    switch (theEvent->iMsg) {
-    case WM_RBUTTONDOWN: {
-        _String s ("Save as picture");
-        _List   l;
-        l && & s;
-
-        POINT loc = {(short)LOWORD (theEvent->lParam),(short)HIWORD (theEvent->lParam)};
-        ClientToScreen (parentWindow, &loc);
-
-        _String pulldownValue = HandlePullDown (l,loc.x,loc.y,0);
-        switch (l.Find(&pulldownValue)) {
-        case 0:
-            s = "Save picture";
-            _SavePicture (s);
-            return true;
-        }
-        break;
-    }
-    case WM_LBUTTONDOWN: {
-        if ((messageRecipient)&&(doMouseClicks)) {
-            messageRecipient->ProcessEvent(generateContextPopUpEvent (GetID(),LOWORD(theEvent->lParam)-rel.left,
-                                           HIWORD(theEvent->lParam)-rel.top));
-            return true;
-        }
-        break;
-    }
-    }
-    return false;
-}
-
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/win/HYPlatformGraphicPane.cpp b/src/gui/win/HYPlatformGraphicPane.cpp
deleted file mode 100644
index a37bebb..0000000
--- a/src/gui/win/HYPlatformGraphicPane.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A painting canvas with double buffer. Windows.

    Sergei L. Kosakovsky Pond, June 2000-June 2002.
*/

#include "HYGraphicPane.h"
#include "HYComponent.h"
//#include "HYPulldown.h"
#include "HYUtils.h"

#include "math.h"

HBRUSH    bgBrush = CreateSolidBrush (GetSysColor (COLOR_WINDOW));
#define   SQR(A) (A)*(A)

//__________________________________________________________________

RECT    HYRect2Rect (_HYRect& hr)
{
    RECT r;
    r.left = hr.left;
    r.right = hr.right;
    r.top = hr.top;
    r.bottom = hr.bottom;
    return r;
}

//__________________________________________________________________

COLORREF  HYColor2ColorRef (_HYColor&hc, HDC thePane)
{
    return GetNearestColor(thePane,RGB(hc.R,hc.G,hc.B));
}
//__________________________________________________________________

_HYPlatformGraphicPane::_HYPlatformGraphicPane(int h, int w, int d)
{
    thePane = CreateCompatibleDC(0);
    if (thePane) {
        if (d<=1) {
            paneBitMap = CreateCompatibleBitmap(thePane,w,h);
        } else {
            paneBitMap = CreateCompatibleBitmap(GetDC(NULL),w,h);
        }

        if (paneBitMap) {
            oldMap = (HBITMAP)SelectObject (thePane,paneBitMap);
        }
    }
    if ((!thePane)||(!paneBitMap)) {
        _String errMsg = _String("Windows Error ") & (long)GetLastError() & (" while trying to allocate memory for GraphicPane");
        FlagError (errMsg);
    }
    fillColor = NULL;
    backColor = NULL;
    oldFont   = NULL;
    oldBrush  = NULL;
    oldPen    = NULL;

    SetBkMode (thePane, TRANSPARENT);
}

//__________________________________________________________________

_HYPlatformGraphicPane::~_HYPlatformGraphicPane(void)
{
    if (oldMap) {
        DeleteObject (SelectObject (thePane,oldMap));
    }
    if (oldFont) {
        DeleteObject (SelectObject (thePane,oldFont));
    }
    if (oldPen) {
        DeleteObject (SelectObject (thePane,oldPen));
    }
    if (oldBrush) {
        DeleteObject (SelectObject (thePane,oldBrush));
    }
    DeleteDC         (thePane);
    if (fillColor) {
        DeleteObject (fillColor);
    }
    if (fillColor) {
        DeleteObject (backColor);
    }
    //DeleteObject   (paneBitMap);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_SetPaneSize  (int h,int w, int d)
{
    SelectObject (thePane,oldBrush);
    //DeleteDC (thePane);
    DeleteObject (paneBitMap);
    if (fillColor) {
        DeleteObject (fillColor);
    }

    //thePane = CreateCompatibleDC(NULL);
    if (thePane) {
        if (d<=1) {
            paneBitMap = CreateCompatibleBitmap(thePane,w,h);
        } else {
            paneBitMap = CreateCompatibleBitmap(GetDC(NULL),w,h);
        }

        /*BITMAPINFOHEADER bih;
        bih.biSize   = sizeof (BITMAPINFOHEADER);
        bih.biWidth  = w;
        bih.biHeight = h;
        bih.biPlanes = 1;
        bih.biBitCount = d;
        bih.biCompression = BI_RGB;
        bih.biSizeImage   = 0;
        bih.biXPelsPerMeter = bih.biYPelsPerMeter = 72 * 100/2.54;
        bih.biClrUsed = 0;
        bih.biClrImportant = 0;

        paneBitMap = CreateDIBitmap (thePane, & bih, 0, nil, nil, DIB_RGB_COLORS);*/

        if (paneBitMap) {
            DeleteObject ((HBITMAP)SelectObject (thePane,paneBitMap));
            fillColor = NULL;
        }
    }

    //printf ("Resize bitmap\n");

    if ((!thePane)||(!paneBitMap)) {
        _String errMsg = _String("Windows Error ") & (long)GetLastError() & (" while trying to resize GraphicPane");

        if (!thePane) {
            errMsg = errMsg & ". Failed to create DC.";
        } else {
            errMsg = errMsg & ". Failed to create bitmap.";
        }

        FlagError (errMsg);
    }
}

//__________________________________________________________________

void _HYPlatformGraphicPane::CheckPen (_HYRect& r, bool force)
{
    _HYGraphicPane * theParent = (_HYGraphicPane*)this;
    if (force||(r.width!=lastPenSize)) {
        lastPenSize = r.width;
        HPEN        newPen = (HPEN)CreatePen (PS_SOLID,lastPenSize,HYColor2ColorRef (theParent->color,thePane));
        if (oldPen) {
            DeleteObject ((HPEN)SelectObject(thePane,newPen));
        } else {
            oldPen = (HPEN)SelectObject(thePane,newPen);
        }
    }
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_DrawLine (_HYRect lineDesc)
{
    CheckPen (lineDesc);
    MoveToEx  (thePane, lineDesc.left, lineDesc.top, NULL);
    LineTo  (thePane,lineDesc.right,lineDesc.bottom);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_DrawHatchedLine (_HYRect lineDesc)
{
    _HYGraphicPane * theParent = (_HYGraphicPane*)this;
    HPEN    newPen = (HPEN)CreatePen (PS_DOT,1,HYColor2ColorRef (theParent->color,thePane));
    HPEN    savePen = ((HPEN)SelectObject(thePane,newPen));
    MoveToEx  (thePane, lineDesc.left, lineDesc.top, NULL);
    LineTo  (thePane,lineDesc.right,lineDesc.bottom);
    DeleteObject (SelectObject (thePane,savePen));
}

//__________________________________________________________________
void _HYPlatformGraphicPane::_DisplayText    (_String theText,int t, int l, bool dir)
{
    SetTextAlign (thePane,TA_BASELINE);
    TextOut(thePane,l,t,theText.sData,theText.sLength);
}

//__________________________________________________________________
void _HYPlatformGraphicPane::_DisplayText    (_String& theText,_HYRect& r, char align)
{
    RECT    tb = HYRect2Rect (r);

    tb.top  += ((_HYGraphicPane*)this)->font.size;
    tb.left += ((_HYGraphicPane*)this)->font.size/3;

    _EraseRect (r);

    DrawText (thePane,
              theText.sData,
              theText.sLength,
              &tb,
              DT_NOCLIP|DT_WORDBREAK|DT_END_ELLIPSIS|
              ((align==HY_ALIGN_LEFT)?DT_LEFT:
               (align==HY_ALIGN_RIGHT?DT_RIGHT:DT_CENTER)));
}

//__________________________________________________________________
void _HYPlatformGraphicPane::_DisplayChar  (char c,int t, int l)
{
    SetTextAlign (thePane,TA_BASELINE);
    TextOut(thePane,l,t,&c,1);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_DrawRect (_HYRect rectDesc)
{
    CheckPen (rectDesc);

    rectDesc.right-=rectDesc.width;
    rectDesc.bottom-=rectDesc.width;
    MoveToEx (thePane,rectDesc.left,rectDesc.top,NULL);
    LineTo(thePane,rectDesc.right,rectDesc.top);
    LineTo(thePane,rectDesc.right,rectDesc.bottom);
    LineTo(thePane,rectDesc.left,rectDesc.bottom);
    LineTo(thePane,rectDesc.left,rectDesc.top);
}
//__________________________________________________________________

void _HYPlatformGraphicPane::_FillRect (_HYRect rectDesc)
{
    RECT    r= HYRect2Rect (rectDesc);
    FillRect (thePane,&r,fillColor);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_EraseRect (_HYRect rectDesc)
{
    RECT    r= HYRect2Rect (rectDesc);
    FillRect (thePane,&r,backColor);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_DrawOval (_HYRect rectDesc)
{
    CheckPen (rectDesc);
    SelectObject (thePane,backColor);
    Ellipse (thePane,rectDesc.left,rectDesc.top,rectDesc.right,rectDesc.bottom);
    SelectObject (thePane,fillColor);
}
//__________________________________________________________________

void _HYPlatformGraphicPane::_FillOval (_HYRect rectDesc)
{
    CheckPen (rectDesc);
    Ellipse (thePane,rectDesc.left,rectDesc.top,rectDesc.right,rectDesc.bottom);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_EraseOval (_HYRect rectDesc)
{
    // TBI
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_DrawArc (_HYRect rectDesc, int s, int f)
{
    CheckPen (rectDesc);
    _Parameter  startA = s*3.1415926/180, endA = (s+f)*3.1415926/180,
                diag = .5*sqrt(SQR(rectDesc.right-rectDesc.left)+
                               SQR(rectDesc.bottom-rectDesc.top));
    int         sX =   (rectDesc.right+rectDesc.left)/2+diag*sin(startA),
                sY =   (rectDesc.bottom+rectDesc.top)/2-diag*cos(startA),
                fX =   (rectDesc.right+rectDesc.left)/2+diag*sin(endA),
                fY =   (rectDesc.bottom+rectDesc.top)/2-diag*cos(endA);

    if (f<0) {
        SetArcDirection (thePane,AD_COUNTERCLOCKWISE);
        Arc (thePane,rectDesc.left,rectDesc.top,rectDesc.right,rectDesc.bottom,
             sX,sY,fX,fY);
    } else {
        SetArcDirection (thePane,AD_CLOCKWISE);
        Arc (thePane,rectDesc.left,rectDesc.top,rectDesc.right,rectDesc.bottom,
             fX,fY,sX,sY);
    }

}
//__________________________________________________________________

void _HYPlatformGraphicPane::_FillArc (_HYRect rectDesc, int s, int f)
{
    CheckPen (rectDesc);

    _Parameter  startA  = (90-s)*3.1415926/180,
                endA    = (90-s-f)*3.1415926/180,
                diag    = .5*sqrt(SQR(rectDesc.right-rectDesc.left)+
                                  SQR(rectDesc.bottom-rectDesc.top));

    int         sX =   (rectDesc.right+rectDesc.left)/2+diag*sin(startA),
                sY =   (rectDesc.bottom+rectDesc.top)/2+diag*cos(startA),
                fX =   (rectDesc.right+rectDesc.left)/2+diag*sin(endA),
                fY =   (rectDesc.bottom+rectDesc.top)/2+diag*cos(endA);

    Pie (thePane,rectDesc.left,rectDesc.top,rectDesc.right,rectDesc.bottom,
         sX,sY,fX,fY);


}

//__________________________________________________________________

void _HYPlatformGraphicPane::_EraseArc (_HYRect rectDesc, int s, int f)
{
    // TBI
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_SetColor  (_HYColor c)
{
    COLORREF theC = HYColor2ColorRef(c,thePane);
    HBRUSH newBrush = (HBRUSH)CreateSolidBrush (theC);

    if (oldBrush) {
        DeleteObject (SelectObject (thePane,newBrush));
    } else {
        oldBrush = (HBRUSH)SelectObject (thePane,newBrush);
    }

    if (fillColor) {
        DeleteObject (fillColor);
    }
    fillColor = newBrush;
    _HYRect pR = {0,0,0,0,0};
    pR.width = lastPenSize;
    CheckPen (pR,true);
    SetTextColor (thePane,theC);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_SetBColor  (_HYColor c)
{
    COLORREF theC = HYColor2ColorRef(c,thePane);
    HBRUSH newBrush = (HBRUSH)CreateSolidBrush (theC);
    if (backColor) {
        DeleteObject (fillColor);
    }
    backColor = newBrush;
    SetBkColor (thePane, theC);
}


//__________________________________________________________________

void _HYPlatformGraphicPane::_SetFont (_HYFont f)
{
    HFONT   newFont = CreateFont (f.size,0,0,0,(f.style&HY_FONT_BOLD)?FW_BOLD:FW_NORMAL,f.style&HY_FONT_ITALIC,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
                                  CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,f.face.sData);
    if (oldFont) {
        DeleteObject (SelectObject (thePane,newFont));
    } else {
        oldFont = (HFONT)SelectObject (thePane, newFont);
    }
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_SetFontSize (long s)
{
    _SetFont (((_HYGraphicPane*)this)->font);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_StartDraw  (void)
{
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_EndDraw    (void)
{
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_SetPort    (Ptr nP)
{
}

//__________________________________________________________________
void _HYPlatformGraphicPane::_SlidePane  (int dv, int dh)
{
    _HYGraphicPane* theParent = (_HYGraphicPane*)this;
    RECT r = {0,0,theParent->h,theParent->w};

    ScrollDC (thePane, dh, dv, &r, &r, NULL, NULL);
}

//__________________________________________________________________
void _HYPlatformGraphicPane::_SlideRect (_HYRect& rct, int dv, int dh)
{
    _HYGraphicPane* theParent = (_HYGraphicPane*)this;

    RECT r = HYRect2Rect (rct);
    ScrollDC (thePane, dh, dv, &r, &r, NULL, NULL);
}

//__________________________________________________________________
void _HYPlatformGraphicPane::_InvertRect (_HYRect& rct)
{
    RECT r = HYRect2Rect (rct);
    InvertRect (thePane,&r);
}


//__________________________________________________________________
void _HYPlatformGraphicPane::_SavePicture   (_String prompt)
{

    _String         initFileName ("untitled.bmp"),
                    bmp          ("Bitmap\0*.bmp\0\0"),
                    fileName;


    if (SaveFileFunction (fileName, prompt, initFileName, bmp.sData, nil) == 0) {

        if (!fileName.endswith (".bmp")) {
            fileName = fileName & ".bmp";
        }

        BITMAP          bmp;
        PBITMAPINFO     pbmi;
        WORD            cClrBits;

        // Retrieve the bitmap color format, width, and height.
        if (GetObject(paneBitMap, sizeof(BITMAP), (LPSTR)&bmp)) {
            cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel);
            if (cClrBits == 1) {
                cClrBits = 1;
            } else if (cClrBits <= 4) {
                cClrBits = 4;
            } else if (cClrBits <= 8) {
                cClrBits = 8;
            } else if (cClrBits <= 16) {
                cClrBits = 16;
            } else if (cClrBits <= 24) {
                cClrBits = 24;
            } else {
                cClrBits = 32;
            }

            // Allocate memory for the BITMAPINFO structure. (This structure
            // contains a BITMAPINFOHEADER structure and an array of RGBQUAD
            // data structures.)

            if (cClrBits != 24)
                pbmi = (PBITMAPINFO) LocalAlloc(LPTR,
                                                sizeof(BITMAPINFOHEADER) +
                                                sizeof(RGBQUAD) * (1<< cClrBits));

            // There is no RGBQUAD array for the 24-bit-per-pixel format.

            else
                pbmi = (PBITMAPINFO) LocalAlloc(LPTR,
                                                sizeof(BITMAPINFOHEADER));

            checkPointer (pbmi);

            // Initialize the fields in the BITMAPINFO structure.

            pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
            pbmi->bmiHeader.biWidth = bmp.bmWidth;
            pbmi->bmiHeader.biHeight = bmp.bmHeight;
            pbmi->bmiHeader.biPlanes = bmp.bmPlanes;
            pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;
            if (cClrBits < 24) {
                pbmi->bmiHeader.biClrUsed = (1<<cClrBits);
            }

            // If the bitmap is not compressed, set the BI_RGB flag.
            pbmi->bmiHeader.biCompression = BI_RGB;

            // Compute the number of bytes in the array of color
            // indices and store the result in biSizeImage.
            // For Windows NT, the width must be DWORD aligned unless
            // the bitmap is RLE compressed. This example shows this.
            // For Windows 95/98/Me, the width must be WORD aligned unless the
            // bitmap is RLE compressed.
            pbmi->bmiHeader.biSizeImage = ((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8
                                          * pbmi->bmiHeader.biHeight;
            // Set biClrImportant to 0, indicating that all of the
            // device colors are important.
            pbmi->bmiHeader.biClrImportant = 0;

            HANDLE            hf;       // file handle
            BITMAPFILEHEADER  hdr;      // bitmap file-header
            PBITMAPINFOHEADER pbih;     // bitmap info-header
            LPBYTE            lpBits;   // memory pointer
            DWORD             dwTotal;  // total count of bytes
            DWORD             cb;       // incremental count of bytes
            BYTE              *hp;      // byte pointer
            DWORD             dwTmp;

            pbih   = (PBITMAPINFOHEADER) pbmi;
            lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage);


            // Retrieve the color table (RGBQUAD array) and the bits
            // (array of palette indices) from the DIB.
            if (!GetDIBits(thePane, paneBitMap, 0, (WORD) pbih->biHeight, lpBits, pbmi,
                           DIB_RGB_COLORS)) {
                LocalFree (pbmi);
                return;
            }

            // Create the .BMP file.
            hf = CreateFile(fileName.sData,
                            GENERIC_READ | GENERIC_WRITE,
                            (DWORD) 0,
                            NULL,
                            CREATE_ALWAYS,
                            FILE_ATTRIBUTE_NORMAL,
                            (HANDLE) NULL);

            if (hf == INVALID_HANDLE_VALUE) {
                LocalFree (pbmi);
                return;
            }

            hdr.bfType = 0x4d42;        // 0x42 = "B" 0x4d = "M"
            // Compute the size of the entire file.
            hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) +
                                  pbih->biSize + pbih->biClrUsed
                                  * sizeof(RGBQUAD) + pbih->biSizeImage);
            hdr.bfReserved1 = 0;
            hdr.bfReserved2 = 0;

            // Compute the offset to the array of color indices.
            hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) +
                            pbih->biSize + pbih->biClrUsed
                            * sizeof (RGBQUAD);

            // Copy the BITMAPFILEHEADER into the .BMP file.
            if (!WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER),
                           (LPDWORD) &dwTmp,  NULL)) {
                LocalFree (pbmi);
                return;
            }

            // Copy the BITMAPINFOHEADER and RGBQUAD array into the file.
            if (!WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER)
                           + pbih->biClrUsed * sizeof (RGBQUAD),
                           (LPDWORD) &dwTmp, ( NULL))) {
                LocalFree (pbmi);
                return;
            }

            // Copy the array of color indices into the .BMP file.
            dwTotal = cb = pbih->biSizeImage;
            hp = lpBits;
            if (!WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp,NULL)) {
                LocalFree (pbmi);
                return;
            }

            // Close the .BMP file.
            if (!CloseHandle(hf)) {
                LocalFree (pbmi);
                return;
            }

            // Free memory.
            GlobalFree((HGLOBAL)lpBits);
            LocalFree (pbmi);
        }
    }
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_DrawPicRes (_HYRect& r, long id)
// id here refers to a bitmap resource
{
    HBITMAP aPic = LoadBitmap (ProgramInstance,MAKEINTRESOURCE(id));
    if (aPic) {
        /*BITMAP theBM;
        GetObject (aPic, sizeof (BITMAP), &theBM);
        if (otherDC)
        {
            if (r.right-r.left<=0)
                r.right = r.right = r.left + theBM.bmWidth;

            if (r.bottom-r.top<=0)
                r.bottom = r.bottom = r.top + theBM.bmHeight;

            SelectObject (otherDC, aPic);

            TransparentBlt   (thePane, r.left, r.top, r.right-r.left+1, r.bottom-r.top+1,
                          otherDC, 0, 0, theBM.bmWidth, theBM.bmHeight, RGB(255,255,255));

            SelectObject (otherDC, oDCBM);
        }
        else
        {
            _String errMsg = _String ("Failed to make CompatibleDC in _DrawPicRes");
            ReportWarning (errMsg);
        }*/

        POINT   bSize = {0,0};

        if (r.right-r.left>0) {
            bSize.x = r.right-r.left+1;
        }

        if (r.bottom-r.top>0) {
            bSize.y = r.bottom-r.top + 1;
        }

        bSize = DrawTransparentBitmap (thePane,aPic,r.left,r.right,bSize.x,bSize.y,RGB(255,255,255));

        if (r.right-r.left<=0) {
            r.right = r.left + bSize.x;
        }

        if (r.bottom-r.top<=0) {
            r.bottom = r.top + bSize.y;
        }

        DeleteObject (aPic);
    } else {
        _String errMsg = _String ("No bitmap resource with ID ") & id;
        ReportWarning (errMsg);
    }
}

//__________________________________________________________________

Ptr _HYPlatformGraphicPane::_DefinePolygon  (_SimpleList& points)
{
    if ((points.lLength>=6)&&(points.lLength%2==0)) {
        POINT* pts = new POINT [points.lLength/2];
        checkPointer (pts);

        for (long k=0; k<points.lLength; k+=2) {
            pts[k/2].x = points.lData[k];
            pts[k/2].y = points.lData[k+1];
        }

        HRGN    rgn = CreatePolygonRgn (pts,points.lLength/2,WINDING);
        checkPointer (rgn);
        delete (pts);
        return (Ptr)rgn;
    }
    return nil;
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_KillPolygon   (Ptr rgn)
{
    if (rgn) {
        DeleteObject (rgn);
    }
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_DrawPolygon (Ptr rgn, long width)
{
    if (rgn) {
        FrameRgn (thePane, (HRGN)rgn, fillColor, width, width);
    }
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_FillPolygon (Ptr rgn)
{
    if (rgn) {
        FillRgn (thePane, (HRGN)rgn, fillColor);
    }
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_ErasePolygon (Ptr rgn)
{
    if (rgn) {
        FillRgn (thePane, (HRGN)rgn, backColor);
    }
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_CopyToClipboard (void)
{
    PlaceBitmapInClipboard (paneBitMap,NULL);
}

//__________________________________________________________________

void _HYPlatformGraphicPane::_SetDialogBG (void)
{
    ((_HYGraphicPane*)this)->SetBColor         (GetDialogBackgroundColor());
}

//___________________________________________________________________

char        isWindows2000orXP = -1;

//__________________________________________________________________
POINT   DrawTransparentBitmap(HDC hdc, HBITMAP hBitmap, short xStart,short yStart,short xSize, short ySize, COLORREF cTransparentColor)
{
    POINT      ptSize;
    if (isWindows2000orXP == -1) {
        OSVERSIONINFO osinfo;
        osinfo.dwOSVersionInfoSize = sizeof (osinfo);
        GetVersionEx (&osinfo);
        isWindows2000orXP = (osinfo.dwMajorVersion > 4);
    }
    if (isWindows2000orXP) {
        BITMAP     bm;;
        GetObject (hBitmap, sizeof (BITMAP), &bm);
        ptSize.x = bm.bmWidth;            // Get width of bitmap
        ptSize.y = bm.bmHeight;           // Get height of bitmap
        HDC        hdcBM   = CreateCompatibleDC(hdc);
        if (hdcBM) {
            if (xSize<=0) {
                xSize = ptSize.x;
            }
            if (ySize<=0) {
                ySize = ptSize.y;
            }

            HBITMAP hdcBMOLD = (HBITMAP)SelectObject (hdcBM, hBitmap);

            TransparentBlt   (hdc, xStart, yStart, xSize, ySize,
                              hdcBM, 0, 0,bm.bmWidth, bm.bmHeight, RGB(255,255,255));

            SelectObject (hdcBM, hdcBMOLD);
            DeleteDC (hdcBM);
        } else {
            _String errMsg = _String ("Failed to make CompatibleDC in _DrawPicRes");
            ReportWarning (errMsg);
        }
    } else {
        BITMAP     bm;
        COLORREF   cColor;
        HBITMAP    bmAndBack, bmAndObject, bmAndMem, bmSave;
        HBITMAP    bmBackOld, bmObjectOld, bmMemOld, bmSaveOld;
        HDC        hdcMem, hdcBack, hdcObject, hdcTemp, hdcSave;

        hdcTemp = CreateCompatibleDC(hdc);
        SelectObject(hdcTemp, hBitmap);   // Select the bitmap

        GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
        ptSize.x = bm.bmWidth;            // Get width of bitmap
        ptSize.y = bm.bmHeight;           // Get height of bitmap
        DPtoLP(hdcTemp, &ptSize, 1);      // Convert from device

        // to logical points

        if (xSize<=0) {
            xSize = ptSize.x;
        }
        if (ySize<=0) {
            ySize = ptSize.y;
        }


        // Create some DCs to hold temporary data.
        hdcBack   = CreateCompatibleDC(hdc);
        hdcObject = CreateCompatibleDC(hdc);
        hdcMem    = CreateCompatibleDC(hdc);
        hdcSave   = CreateCompatibleDC(hdc);

        // Create a bitmap for each DC. DCs are required for a number of
        // GDI functions.

        // Monochrome DC
        bmAndBack   = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);

        // Monochrome DC
        bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);

        bmAndMem    = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
        bmSave      = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);

        // Each DC must select a bitmap object to store pixel data.
        bmBackOld   = (HBITMAP)SelectObject(hdcBack, bmAndBack);
        bmObjectOld = (HBITMAP)SelectObject(hdcObject, bmAndObject);
        bmMemOld    = (HBITMAP)SelectObject(hdcMem, bmAndMem);
        bmSaveOld   = (HBITMAP)SelectObject(hdcSave, bmSave);

        // Set proper mapping mode.
        SetMapMode(hdcTemp, GetMapMode(hdc));

        // Save the bitmap sent here, because it will be overwritten.
        BitBlt(hdcSave, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);

        // Set the background color of the source DC to the color.
        // contained in the parts of the bitmap that should be transparent
        cColor = SetBkColor(hdcTemp, cTransparentColor);

        // Create the object mask for the bitmap by performing a BitBlt
        // from the source bitmap to a monochrome bitmap.
        BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0,
               SRCCOPY);

        // Set the background color of the source DC back to the original
        // color.
        SetBkColor(hdcTemp, cColor);

        // Create the inverse of the object mask.
        BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0,
               NOTSRCCOPY);

        // Copy the background of the main DC to the destination.
        BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdc, xStart, yStart,
               SRCCOPY);

        // Mask out the places where the bitmap will be placed.
        BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);

        // Mask out the transparent colored pixels on the bitmap.
        BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);

        // XOR the bitmap with the background on the destination DC.
        BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);

        // Copy the destination to the screen.
        StretchBlt(hdc, xStart, yStart, xSize, ySize, hdcMem, 0, 0, ptSize.x, ptSize.y,
                   SRCCOPY);

        // Place the original bitmap back into the bitmap sent here.
        BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcSave, 0, 0, SRCCOPY);

        // Delete the memory bitmaps.
        DeleteObject(SelectObject(hdcBack, bmBackOld));
        DeleteObject(SelectObject(hdcObject, bmObjectOld));
        DeleteObject(SelectObject(hdcMem, bmMemOld));
        DeleteObject(SelectObject(hdcSave, bmSaveOld));

        // Delete the memory DCs.
        DeleteDC(hdcMem);
        DeleteDC(hdcBack);
        DeleteDC(hdcObject);
        DeleteDC(hdcSave);
        DeleteDC(hdcTemp);
    }
    return ptSize;
}

//EOF
\ No newline at end of file
diff --git a/src/gui/win/HYPlatformWindow.cpp b/src/gui/win/HYPlatformWindow.cpp
deleted file mode 100644
index 19158e9..0000000
--- a/src/gui/win/HYPlatformWindow.cpp
+++ /dev/null
@@ -1,863 +0,0 @@
-/*
-    A Windows window object - a window/title/size-box/scroll-bars handler.
-
-    Sergei L. Kosakovsky Pond, June 2000.
-*/
-
-#include "HYWindow.h"
-#include "HYGWindow.h"
-#include "HYPlatformComponent.h"
-#include "HYEventTypes.h"
-#include "HYTableWindow.h"
-#include "HYTreePanel.h"
-#include "HYUtils.h"
-#include "HYConsoleWindow.h"
-
-
-extern  _SimpleList             windowPtrs,
-        windowObjects,
-        windowObjectRefs;
-
-extern  _String                 consoleWindowTitle;
-
-/* printing stuff */
-extern                          FILE*       dbgfile;
-
-BOOL CALLBACK                   PrintDialogProc(HWND, UINT, WPARAM, LPARAM);
-BOOL CALLBACK                   AbortProc(HDC, int);
-HDC                             GetPrinterDeviceContext(HWND);
-
-extern  BOOL                    UserAbortFlag;
-extern  HWND                    PrintDialogHandle;
-
-extern                          HFONT           statusBarPlain;
-
-//__________________________________________________________________
-
-LRESULT coreProcessor (HWND WindowHand, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
-    _HYWindow* me = nil;
-
-    long       f  = windowPtrs.Find((long)WindowHand);
-
-    if (f>=0) {
-        me = (_HYWindow*)(windowObjects.lData[f]);
-    }
-
-    switch (iMsg) {
-    case WM_COMMAND:
-        if (!lParam) {
-            if (me->_ProcessMenuSelection(LOWORD(wParam))) {
-                return true;
-            }
-        }
-
-        _HYWindowsUIMessage thisM;
-        thisM.iMsg = iMsg;
-        thisM.wParam = wParam;
-        thisM.lParam = lParam;
-        if (me) {
-            if (((_HYPlatformWindow*)me)->_ProcessOSEvent ((Ptr)&thisM)) {
-                return true;
-            }
-        }
-        return false;
-
-    case WM_CREATE:
-
-        return true ;
-
-    case WM_SIZE:
-
-        me->Grow(nil);
-        return true;
-
-    case WM_PAINT: {
-        if (me) {
-            me->Update(nil);
-        }
-
-        return true;
-    }
-
-    case WM_CLOSE: {
-        //printf ("WM_CLOSE\n");
-        /*f = windowObjects.Find((long)(me));
-        if (f>=0)
-        {
-            windowObjectRefs.Delete(f);
-            windowObjects.Delete(f);
-            windowPtrs.Delete(f);
-        }           */
-        if (((_HYWindow*)windowObjectRefs(f))->Close(nil)) {
-            DestroyWindow (WindowHand);
-            return -2;
-        }
-        return false;
-    }
-
-    case WM_QUERYENDSESSION :
-        return true;
-
-    case WM_DESTROY: {
-        //printf ("WM_DESTOY\n");
-        //printf ("_Close handler %d\n",f);
-        if (f>=0) {
-            //DestroyWindow ((HWND)windowPtrs(f));
-            windowObjects.Delete(f);
-            windowPtrs.Delete(f);
-            windowObjectRefs.Delete(f);
-        }
-        return true;
-    }
-
-    default: {
-
-        //if ((iMsg == WM_ACTIVATE)&&(LOWORD(wParam) != WA_INACTIVE))
-        //me->_SetMenuBar ();
-
-        _HYWindowsUIMessage thisM;
-        thisM.iMsg = iMsg;
-        thisM.wParam = wParam;
-        thisM.lParam = lParam;
-        thisM.res    = nil;
-        if (me) {
-            if (((_HYPlatformWindow*)me)->_ProcessOSEvent ((Ptr)&thisM))
-                if (thisM.res) {
-                    return thisM.res;
-                } else {
-                    return 1L;
-                }
-        }
-    }
-
-    }
-    return false;
-}
-
-//__________________________________________________________________
-
-LRESULT CALLBACK HYWndProc (HWND WindowHand, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
-    LRESULT res = coreProcessor (WindowHand, iMsg, wParam, lParam);
-    if (res) {
-        return res==-2?0:res;
-    }
-
-    /*if (iMsg == WM_ACTIVATE)
-        if (LOWORD (wParam) != WA_INACTIVE)
-        {
-            long f = windowPtrs.Find (lParam);
-            if (f>=0)
-            {
-                _HYWindow * deact = (_HYWindow*)windowObjectRefs (f);
-                if (deact->flags & HY_WINDOW_DLOG)
-                {
-                    if ((deact->parentWindowPtr==nil)||(deact->parentWindowPtr==(Ptr)WindowHand))
-                    {
-                        SetActiveWindow ((HWND)windowPtrs(f));
-                        ReportWarning ("SetActiveWindow");
-                        return 0;
-                    }
-                }
-            }
-        }*/
-    return DefWindowProc(WindowHand, iMsg, wParam, lParam);
-}
-
-//__________________________________________________________________
-
-LRESULT CALLBACK HYDlgProc (HWND WindowHand, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
-
-    if (iMsg == WM_CREATE) {
-        HWND pw = (HWND)((LPCREATESTRUCT)lParam)->lpCreateParams;
-        if (pw) {
-            EnableWindow (pw,false);
-        } else {
-            EnableWindow ((HWND)hyphyConsoleWindow->GetOSWindowData(),false);
-            for (long k = 0; k<windowPtrs.lLength; k++) {
-                EnableWindow ((HWND)windowPtrs(k),false);
-            }
-        }
-    } else {
-        if ((iMsg == WM_CLOSE)||(iMsg == WM_DESTROY)) {
-            long f = windowPtrs.Find ((long)WindowHand);
-            if (f>=0) {
-                _HYWindow * pWindow = (_HYWindow*)windowObjectRefs (f);
-                if (pWindow->parentWindowPtr) {
-                    EnableWindow ((HWND)pWindow->parentWindowPtr,true);
-                } else {
-                    EnableWindow ((HWND)hyphyConsoleWindow->GetOSWindowData(),true);
-                    for (long k = 0; k<windowPtrs.lLength; k++) {
-                        EnableWindow ((HWND)windowPtrs(k),true);
-                    }
-                }
-                SetActiveWindow (pWindow->oldFrontWindow);
-            }
-        }
-    }
-
-    LRESULT res = coreProcessor (WindowHand, iMsg, wParam, lParam);
-
-    if (res!=0) {
-        return res==-2?0L:res;
-    }
-
-    return DefWindowProc(WindowHand, iMsg, wParam, lParam);
-}
-
-//__________________________________________________________________
-
-_HYPlatformWindow::_HYPlatformWindow(unsigned char windowFlag,_String windowTitle,bool windowVisibility,Ptr par)
-{
-    DWORD dwStyle   = WS_CAPTION;
-    DWORD exStyle   = 0;
-    parentWindowPtr = par;
-    oldFrontWindow  = nil;
-
-    bool  isDlg = (windowFlag & HY_WINDOW_DLOG)||par,
-          isConsole = (windowTitle.Equal (&consoleWindowTitle));
-
-    if (isDlg) {
-        windowMenu      = CreateMenu();
-        exStyle         = WS_EX_DLGMODALFRAME;
-        oldFrontWindow  = GetActiveWindow();
-    } else {
-        if (isConsole) {
-            windowMenu = nil;
-            dwStyle |= WS_SYSMENU;
-        } else {
-            windowMenu = CreateMenu();
-            dwStyle |= WS_SYSMENU;
-            HMENU        fileHandle = CreateMenu ();
-            checkPointer (fileHandle);
-            InsertMenu   (windowMenu, 0, MF_BYPOSITION|MF_POPUP, (UINT) fileHandle , "&File");
-        }
-    }
-
-    if (windowFlag&HY_WINDOW_SIZE) {
-        if (windowFlag&HY_WINDOW_ZOOM) {
-            dwStyle = WS_OVERLAPPEDWINDOW;
-        } else {
-            dwStyle |= WS_MINIMIZEBOX|WS_THICKFRAME;
-        }
-
-        if (isConsole) {
-            dwStyle |= WS_MAXIMIZEBOX;
-        }
-
-    } else {
-        if (isDlg)
-            ;
-        else {
-            dwStyle |= WS_MINIMIZEBOX|WS_MAXIMIZEBOX;
-        }
-    }
-
-    menuKeys = NULL;
-
-    HWND        pWnd = NULL;
-
-    if (par) {
-        pWnd = (((_HYWindow*)par)->theWindow);
-        parentWindowPtr = (Ptr)pWnd;
-    }
-
-    theWindow = CreateWindowEx(exStyle,isConsole?"HYPHY":(isDlg?"HPGUIDLG":"HPGUIW"),           /* window class name              */
-                               windowTitle.sData,       /* window caption                 */
-                               dwStyle | (((windowFlag&HY_WINDOW_SCROLL)&&(windowFlag&HY_WINDOW_SIZE))?(WS_HSCROLL|WS_VSCROLL):0)| WS_CLIPCHILDREN ,
-                               CW_USEDEFAULT,          /* initial x position             */
-                               CW_USEDEFAULT,          /* initial y position             */
-                               300,                     /* initial x size                 */
-                               250,                     /* initial y size                 */
-                               pWnd,                   /* parent window handle           */
-                               windowMenu,             /* window menu handle             */
-                               ProgramInstance,         /* program instance handle        */
-                               par?pWnd:nil);                   /* creation parameters            */
-
-
-    if ((!theWindow)||(!(windowMenu)&&(!isConsole))) {
-        _String errMsg ("Could not create a window structure. Windows Error:");
-        errMsg = errMsg&_String ((long)GetLastError());
-        FlagError (errMsg);
-    }
-
-
-    if ((windowFlag&HY_WINDOW_SCROLL)&&(windowFlag&HY_WINDOW_SIZE)) {
-        SetScrollRange (theWindow,SB_HORZ,0,MAX_CONTROL_VALUE,FALSE);
-        SetScrollRange (theWindow,SB_VERT,0,MAX_CONTROL_VALUE,FALSE);
-    }
-
-
-    windowPtrs<<(long)theWindow;
-    windowObjects<<(long)(_HYWindow*)this;
-
-
-
-    flags = windowFlag;
-
-}
-
-//__________________________________________________________________
-
-_HYPlatformWindow::~_HYPlatformWindow(void)
-{
-    if (windowMenu) {
-        DestroyMenu (windowMenu);
-    }
-    if (menuKeys) {
-        DestroyAcceleratorTable (menuKeys);
-    }
-    DestroyWindow (theWindow);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SetTitle(_String windowTitle)
-{
-    SetWindowText (theWindow,windowTitle);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Show(void)
-{
-    ShowWindow (theWindow,SW_SHOWNORMAL);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Hide(void)
-{
-    ShowWindow (theWindow,SW_HIDE);
-}
-
-//__________________________________________________________________
-
-_HYRect _HYPlatformWindow::_GetWindowRect(void)
-{
-    RECT res;
-
-    ::GetWindowRect (theWindow, &res);
-
-    return (_HYRect) {
-        res.top,res.left,res.bottom,res.right,0
-    };
-}
-
-//__________________________________________________________________
-
-long _HYPlatformWindow::_Grow(Ptr theData)
-{
-    RECT myDims;
-    GetClientRect (theWindow,&myDims);
-    _HYWindow* theParent = (_HYWindow*)this;
-    theParent->right = theParent->left+myDims.right-myDims.left;
-    theParent->bottom = theParent->top+myDims.bottom-myDims.top;
-    int windowWidth = theParent->right-theParent->left,
-        windowHeight = theParent->bottom-theParent->top;
-    if (flags&HY_WINDOW_SIZE) {
-        _HYWindow* theParent = (_HYWindow*)this;
-        if (windowWidth >= theParent->contentWidth) {
-            EnableScrollBar (theWindow,SB_HORZ, ESB_DISABLE_BOTH);
-        } else {
-            EnableScrollBar (theWindow,SB_HORZ, ESB_ENABLE_BOTH);
-        }
-        if (windowHeight >= theParent->contentHeight) {
-            EnableScrollBar (theWindow,SB_VERT, ESB_DISABLE_BOTH);
-        } else {
-            EnableScrollBar (theWindow,SB_VERT, ESB_ENABLE_BOTH);
-        }
-    }
-    return 0;
-}
-
-//__________________________________________________________________
-
-_String& _HYPlatformWindow::_GetTitle(void)
-{
-    return      ((_HYWindow*)this)->GetTitle();
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformWindow::_SetWindowBackColor (_HYColor newColor)
-{
-    PAINTSTRUCT      thePS;
-    HDC theContext = BeginPaint (theWindow,&thePS);
-
-    SetBkColor  (theContext, HYColor2ColorRef (newColor, theContext));
-
-    EndPaint (theWindow,&thePS);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Move(Ptr theData)
-{
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SetPosition(int l,int t)
-{
-    SetWindowPos (theWindow,NULL,l,t,0,0,SWP_NOZORDER|SWP_NOSIZE);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_BringWindowToFront(void)
-{
-    //RedrawWindow (theWindow, NULL, NULL, RDW_ALLCHILDREN);
-    //ShowWindow (theWindow, SW_SHOWNORMAL);
-    _Activate ();
-}
-
-//__________________________________________________________________
-
-bool _HYPlatformWindow::_Close(Ptr theData)
-{
-    _HYWindow* theParent = (_HYWindow*)this;
-    bool        doit = true;
-
-    if (theParent->ConfirmClose()) {
-        //long f = windowObjectRefs.Find((long)theParent);
-        //printf ("_Close handler %d\n",f);
-        /*if (f>=0)
-        {
-            DestroyWindow ((HWND)windowPtrs(f));
-            windowObjects.Delete(f);
-            windowPtrs.Delete(f);
-            windowObjectRefs.Delete(f);
-        }*/
-    } else {
-        doit = false;
-    }
-
-    return doit;
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Activate(void)
-{
-    _SetMenuBar();
-    _Show();
-    SetFocus(theWindow);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Deactivate(void)
-{
-    //_Hide();
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_AddStandardAccels(void)
-{
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'Z';
-    accels       << HY_WINDOW_MENU_ID_EDIT;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'C';
-    accels       << HY_WINDOW_MENU_ID_EDIT+1;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'X';
-    accels       << HY_WINDOW_MENU_ID_EDIT+2;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'V';
-    accels       << HY_WINDOW_MENU_ID_EDIT+3;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'A';
-    accels       << HY_WINDOW_MENU_ID_EDIT+5;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'W';
-    accels       << HY_WINDOW_MENU_ID_FILE;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'S';
-    accels       << HY_WINDOW_MENU_ID_FILE+1;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'P';
-    accels       << HY_WINDOW_MENU_ID_FILE+2;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << '0';
-    accels       << HY_WINDOW_MENU_ID_FILE-1;
-
-    accels       << (FCONTROL|FVIRTKEY);
-    accels       << 'I';
-    accels       << HY_WINDOW_MENU_ID_FILE-2;
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_BuildAccelTable (bool force)
-{
-    if (force&&menuKeys) {
-        DestroyAcceleratorTable (menuKeys);
-        menuKeys = nil;
-    }
-
-    if ((menuKeys == NULL)&&(accels.lLength>=3)) {
-        LPACCEL myAccels = (LPACCEL) new ACCEL[accels.lLength/3];
-        checkPointer (myAccels);
-
-        for (long k=0; k<accels.lLength/3; k++) {
-            myAccels[k].fVirt = accels.lData[k*3];
-            myAccels[k].key = accels.lData[k*3+1];
-            myAccels[k].cmd = accels.lData[k*3+2];
-        }
-
-        menuKeys = CreateAcceleratorTable (myAccels, accels.lLength/3);
-        delete (myAccels);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SetMenuBar(void)
-{
-    HMENU        fileHandle = GetSubMenu(GetMenu (theWindow),0);
-
-    if (windowMenu&&(GetMenuItemCount (fileHandle)==0)) {
-
-        _HYWindow* theParent = (_HYWindow*)this;
-
-        HMENU        editHandle = CreateMenu ();
-
-        checkPointer (fileHandle);
-        checkPointer (editHandle);
-
-        InsertMenu   (fileHandle, 0xFFFFFFFF, MF_BYPOSITION, HY_WINDOW_MENU_ID_FILE+1, "&Save\tCtrl-S");
-        InsertMenu   (fileHandle, 0xFFFFFFFF, MF_BYPOSITION, HY_WINDOW_MENU_ID_FILE+2, "&Print\tCtrl-P");
-        InsertMenu   (fileHandle, 0xFFFFFFFF, MF_BYPOSITION, HY_WINDOW_MENU_ID_FILE,   "&Close\tCtrl-W");
-        InsertMenu   (fileHandle, 0xFFFFFFFF, MF_BYPOSITION, HY_WINDOW_MENU_ID_FILE-1, "S&witch to Console\tCtrl-0");
-        InsertMenu   (fileHandle, 0xFFFFFFFF, MF_BYPOSITION, HY_WINDOW_MENU_ID_FILE-2, "Object &Inspector\tCtrl-I");
-
-        if (!theParent->IsSaveEnabled()) {
-            EnableMenuItem (fileHandle, 0, MF_BYPOSITION|MF_GRAYED);
-        }
-
-        if (!theParent->IsPrintEnabled()) {
-            EnableMenuItem (fileHandle, 1, MF_BYPOSITION|MF_GRAYED);
-        }
-
-        InsertMenu   (editHandle, 0xFFFFFFFF, MF_BYPOSITION|MF_GRAYED, HY_WINDOW_MENU_ID_EDIT, "&Undo\tCtrl-Z");
-
-        InsertMenu   (editHandle, 0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, NULL);
-
-        InsertMenu   (editHandle, 0xFFFFFFFF, MF_BYPOSITION|MF_GRAYED, HY_WINDOW_MENU_ID_EDIT+1, "&Copy\tCtrl-C");
-
-        InsertMenu   (editHandle, 0xFFFFFFFF, MF_BYPOSITION|MF_GRAYED, HY_WINDOW_MENU_ID_EDIT+2, "C&ut\tCtrl-X");
-
-        InsertMenu   (editHandle, 0xFFFFFFFF, MF_BYPOSITION|MF_GRAYED, HY_WINDOW_MENU_ID_EDIT+3, "&Paste\tCtrl-V");
-
-        InsertMenu   (editHandle, 0xFFFFFFFF, MF_BYPOSITION|MF_GRAYED, HY_WINDOW_MENU_ID_EDIT+4, "C&lear");
-
-        InsertMenu   (editHandle, 0xFFFFFFFF, MF_BYPOSITION|MF_GRAYED, HY_WINDOW_MENU_ID_EDIT+5, "Select &All\tCtrl-A");
-
-        //InsertMenu     (windowMenu, 0, MF_BYPOSITION|MF_POPUP, (UINT) fileHandle , "&File");
-        InsertMenu   (windowMenu, 1, MF_BYPOSITION|MF_POPUP, (UINT) editHandle , "&Edit");
-    }
-
-    _AddStandardAccels();
-    _BuildAccelTable  ();
-
-    accels.Clear();
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_UnsetMenuBar(void)
-{
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Paint(Ptr)
-{
-    PAINTSTRUCT      thePS;
-    HDC theContext = BeginPaint (theWindow,&thePS);
-    EndPaint (theWindow,&thePS);
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_Update(Ptr)
-{
-}
-
-//__________________________________________________________________
-
-void _HYPlatformWindow::_SetWindowRectangle(int top, int left, int bottom, int right, bool ss)
-{
-
-    int windowWidth  = right-left,
-        windowHeight = bottom-top;
-
-    if (flags&HY_WINDOW_SIZE) {
-        _HYWindow* theParent = (_HYWindow*)this;
-
-        if (windowWidth >= theParent->contentWidth) {
-            EnableScrollBar (theWindow,SB_HORZ, ESB_DISABLE_BOTH);
-        } else {
-            EnableScrollBar (theWindow,SB_HORZ, ESB_ENABLE_BOTH);
-        }
-        if (windowHeight >= theParent->contentHeight) {
-            EnableScrollBar (theWindow,SB_VERT, ESB_DISABLE_BOTH);
-        } else {
-            EnableScrollBar (theWindow,SB_VERT, ESB_ENABLE_BOTH);
-        }
-    }
-
-    if (ss) {
-        RECT            smallR,
-                        bigR;
-
-        GetWindowRect   (theWindow,&bigR);
-        GetClientRect   (theWindow,&smallR);
-        SetWindowPos    (theWindow,NULL,0,0,
-                         windowWidth + bigR.right  - bigR.left - smallR.right,
-                         windowHeight+ bigR.bottom - bigR.top  - smallR.bottom,
-                         SWP_NOZORDER|SWP_NOMOVE);
-
-        InvalidateRect  (theWindow, nil, false);
-    }
-}
-
-//__________________________________________________________________
-
-bool _HYPlatformWindow::_ProcessOSEvent (Ptr vEvent)
-{
-    _HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;
-    _HYWindow* theParent = (_HYWindow*)this;
-    long       invisPixels;
-    long       currentValue, oldValue;
-    switch (theEvent->iMsg) {
-    case WM_HSCROLL:
-    case WM_VSCROLL: {
-        if (theEvent->iMsg == WM_HSCROLL) {
-            invisPixels = theParent->contentWidth-(theParent->right-theParent->left);
-            currentValue = GetScrollPos (theWindow,SB_HORZ);
-        } else {
-            invisPixels = theParent->contentHeight-(theParent->bottom-theParent->top);
-            currentValue = GetScrollPos (theWindow,SB_VERT);
-        }
-        oldValue = currentValue;
-        invisPixels = (_Parameter)MAX_CONTROL_VALUE/invisPixels;
-        if (!invisPixels) {
-            invisPixels = 1;
-        }
-
-        switch (LOWORD(theEvent->wParam)) {
-        case SB_LINEUP:
-            currentValue-=invisPixels;
-            break;
-        case SB_LINEDOWN:
-            currentValue+=invisPixels;
-            break;
-        case SB_PAGEUP:
-            currentValue-=10*invisPixels;
-            break;
-        case SB_PAGEDOWN:
-            currentValue+=10*invisPixels;
-            break;
-        case SB_THUMBPOSITION:
-        case SB_THUMBTRACK:
-            currentValue = HIWORD(theEvent->wParam);
-            break;
-        case SB_TOP:
-            currentValue = 0;
-            break;
-        case  SB_BOTTOM:
-            currentValue = MAX_CONTROL_VALUE;
-            break;
-        default:
-            return true;
-        }
-
-        if (currentValue<0) {
-            currentValue = 0;
-        }
-        if (currentValue>MAX_CONTROL_VALUE) {
-            currentValue = MAX_CONTROL_VALUE;
-        }
-        if (currentValue!=oldValue) {
-            if (theEvent->iMsg == WM_HSCROLL) {
-                SetScrollPos (theWindow,SB_HORZ, currentValue, TRUE);
-                theParent->ProcessEvent (generateScrollEvent (currentValue-oldValue,0));
-            } else {
-                SetScrollPos (theWindow,SB_VERT, currentValue, TRUE);
-                theParent->ProcessEvent (generateScrollEvent (0,currentValue-oldValue));
-            }
-        }
-    }
-    return true;
-    break;
-
-    case WM_GETMINMAXINFO:
-
-        MINMAXINFO* windowInfo = (MINMAXINFO*)theEvent->lParam;
-        RECT   bigR, smallR;
-        GetClientRect (theWindow,&smallR);
-        GetWindowRect (theWindow,&bigR);
-        windowInfo->ptMinTrackSize.x = 50;
-        windowInfo->ptMinTrackSize.y = 50;
-        windowInfo->ptMaxTrackSize.x = theParent->contentWidth+bigR.right-bigR.left-(smallR.right);
-        windowInfo->ptMaxTrackSize.y = theParent->contentHeight+bigR.bottom-bigR.top-smallR.bottom;
-        return true;
-        break;
-    }
-    return false;
-}
-
-//__________________________________________________________________
-
-bool        _HYWindow::_ProcessMenuSelection (long msel)
-{
-    switch (msel) {
-    case HY_WINDOW_MENU_ID_FILE-2: { // close window
-        ShowObjectInspector();
-        return true;
-    }
-    case HY_WINDOW_MENU_ID_FILE-1: { // close window
-        SetForegroundWindow ((HWND)hyphyConsoleWindow->GetOSWindowData());
-        return true;
-    }
-    case HY_WINDOW_MENU_ID_FILE: { // close window
-        Close(nil);
-        return true;
-    }
-    }
-    return false;
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformWindow::_SetContentSize (int w, int h)
-{
-    _HYWindow* theParent = (_HYWindow*)this;
-    int     windowW = theParent->right-theParent->left,
-            windowH =  theParent->bottom-theParent->top;
-    if (w<=windowW) {
-        EnableScrollBar (theWindow,SB_HORZ,ESB_DISABLE_BOTH);
-    } else {
-        EnableScrollBar (theWindow,SB_HORZ,ESB_ENABLE_BOTH);
-        SetScrollPos (theWindow,SB_HORZ,0,TRUE);
-    }
-    if (h<=windowH) {
-        EnableScrollBar (theWindow,SB_VERT,ESB_DISABLE_BOTH);
-    } else {
-        EnableScrollBar (theWindow,SB_VERT,ESB_ENABLE_BOTH);
-        SetScrollPos (theWindow,SB_VERT,0,TRUE);
-    }
-
-}
-
-//__________________________________________________________________
-
-
-void    _HYPlatformWindow::_VisibleContents (int& t,int& l,int& b,int& r)
-{
-    _HYWindow* theParent = (_HYWindow*)this;
-    short v;
-    short windowH=theParent->bottom-theParent->top,
-          windowW=theParent->right-theParent->left;
-    if (flags&HY_WINDOW_SIZE) {
-        if (windowW>theParent->contentWidth) {
-            l = theParent->left;
-            r = theParent->right;
-        } else {
-            v = GetScrollPos (theWindow,SB_HORZ);
-            l = theParent->left+(theParent->contentWidth-windowW)*v/(_Parameter)MAX_CONTROL_VALUE;
-            r = l+windowW;
-        }
-        if (windowH>theParent->contentHeight) {
-            t = theParent->top;
-            b = theParent->bottom;
-        } else {
-            v = GetScrollPos (theWindow,SB_VERT);
-            t = theParent->top+(theParent->contentHeight-windowH)*v/(_Parameter)MAX_CONTROL_VALUE;
-            b = t+windowH;
-        }
-    } else {
-        t = theParent->top;
-        l = theParent->left;
-        b = theParent->bottom;
-        r = theParent->right;
-    }
-
-}
-
-
-//__________________________________________________________________
-
-RECT    _HYPlatformWindow::newVRect (void)
-{
-    return (RECT) {
-        0,0,0,0
-    };
-}
-
-//__________________________________________________________________
-
-RECT    _HYPlatformWindow::newHRect (void)
-{
-    return (RECT) {
-        0,0,0,0
-    };
-}
-
-//__________________________________________________________________
-
-void    _HYPlatformWindow::_SelectWindow (void)
-{
-}
-
-//__________________________________________________________________
-void        _PaintTheCircle (HBITMAP aPic, HWND theWindow, HDC theDC)
-{
-    RECT r;
-    GetClientRect (theWindow, &r);
-
-    r.right = r.left+15;
-    r.left  += 3;
-    r.bottom --;
-    r.top = r.bottom-12;
-
-    DrawTransparentBitmap (theDC, aPic, r.left, r.top, 12, 12, RGB(255,255,255));
-
-    /*BITMAP theBM;
-    theBM.bmBits = nil;
-
-
-
-    GetObject (aPic, sizeof (BITMAP), &theBM);
-    if (otherDC)
-    {
-        if (r.right-r.left<=0)
-            r.right  = r.left + theBM.bmWidth;
-
-        if (r.bottom-r.top<=0)
-            r.bottom  = r.top + theBM.bmHeight;
-
-        SelectObject (otherDC, aPic);
-
-        TransparentBlt   (theDC, r.left, r.top, r.right-r.left+1, r.bottom-r.top+1,
-                            otherDC, 0, 0, theBM.bmWidth, theBM.bmHeight, RGB(255,255,255));
-
-        SelectObject (otherDC, oDCBM);
-    }*/
-}
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/win/HYPlatfromUtils.cpp b/src/gui/win/HYPlatfromUtils.cpp
deleted file mode 100644
index 43b50fe..0000000
--- a/src/gui/win/HYPlatfromUtils.cpp
+++ /dev/null
@@ -1,773 +0,0 @@
-#include "HYUtils.h"
-#include "HYGraphicPane.h"
-#include "batchlan.h"
-#include "windows.h"
-#include "HYWindow.h"
-#include "time.h"
-#include "shlobj.h"
-#include "HYObjectInspector.h"
-#include "HYConsoleWindow.h"
-#include <Wininet.h>
-
-extern  _String   lastWinPathUsed,
-        dialogPrompt,
-        objectInspectorTitle ;
-
-extern  _List     pathNames;
-
-extern  bool      updateTimer;
-
-extern  clock_t   timerStart,
-        lastTimer;
-
-long    lastFileTypeSelection = 3;
-
-
-//__________________________________________________________________________________
-
-HMENU   ListToPopUpMenu (_List& menuOptions, long base)
-{
-    HMENU        listMenu = CreatePopupMenu ();
-    checkPointer (listMenu);
-
-    for (long counter=0; counter<menuOptions.lLength; counter++) {
-        _String *postItem = (_String*)(menuOptions(counter));
-
-        if (*postItem==_String("SEPARATOR")) {
-            AppendMenu (listMenu, MF_SEPARATOR, 0, nil);
-        } else {
-            AppendMenu (listMenu, MF_STRING, base+counter+1, postItem->sData);
-        }
-    }
-
-    return listMenu;
-}
-
-//__________________________________________________________________________________
-void    PlaceStringInClipboard (_String& res,Ptr powner)
-{
-    HWND    owner = (HWND)powner;
-    HGLOBAL TextHandle = GlobalAlloc(GHND, res.sLength+1);
-    if (TextHandle) {
-        char *TextPtr = (char*)GlobalLock(TextHandle);
-        char *SourcePtr = res.sData;
-        for (; *SourcePtr; SourcePtr++) {
-            *TextPtr++ = *SourcePtr;
-        }
-        *TextPtr = '\0';
-        GlobalUnlock(TextHandle);
-        OpenClipboard(owner);
-        EmptyClipboard();
-        SetClipboardData(CF_TEXT, TextHandle);
-        CloseClipboard();
-    }
-}
-
-//__________________________________________________________________________________
-void    PlaceBitmapInClipboard (HBITMAP res,HWND owner)
-{
-    if (res) {
-        OpenClipboard(owner);
-        EmptyClipboard();
-        SetClipboardData(CF_BITMAP, res);
-        CloseClipboard();
-    }
-}
-
-//__________________________________________________________________________________
-
-_String HandlePullDown (_List& menuOptions, long l, long t,long startPos)
-{
-    if (menuOptions.lLength) {
-        HMENU daMenu = ListToPopUpMenu (menuOptions);
-
-        SetMenuDefaultItem (daMenu, startPos-1, true);
-
-        long tSel = TrackPopupMenu (daMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_LEFTBUTTON|TPM_NONOTIFY,
-                                    l,
-                                    t,
-                                    0, (HWND)hyphyConsoleWindow->GetOSWindowData(), NULL);
-
-        if (tSel) {
-            DestroyMenu (daMenu);
-            return     *((_String*)menuOptions(tSel-1));
-        } else {
-            DestroyMenu (daMenu);
-        }
-    }
-
-    return empty;
-}
-
-//__________________________________________________________________________________
-
-long HandlePullDownWithFont (_List& menuOptions, long l, long t,long startPos,_String,long)
-{
-    _String res = HandlePullDown (menuOptions, l, t, startPos);
-
-    return menuOptions.Find (&res);
-}
-//________________________________________________________
-Ptr     ProcureIconResource (long iconID)
-{
-    //return (Ptr)LoadImage  (GetModuleHandle(NULL),MAKEINTRESOURCE(iconID),IMAGE_BITMAP,
-    //0,0,
-    //LR_DEFAULTSIZE);
-    return (Ptr)LoadBitmap (GetModuleHandle(NULL),MAKEINTRESOURCE(iconID));
-}
-
-
-//________________________________________________________
-long    GetVisibleStringWidth (_String& s, _HYFont& f)
-{
-    /*static HWND DumbWindow =
-                        CreateWindow("STATIC",
-                        "",
-                        SS_SIMPLE ,
-                        CW_USEDEFAULT,
-                        CW_USEDEFAULT,
-                        10,
-                        10,
-                        NULL,
-                        NULL,
-                        GetModuleHandle(NULL),
-                        NULL);        */
-    static _HYFont lastFont;
-    //HDC   defDC = GetDC(DumbWindow);
-    if ((lastFont.size!=f.size)||(lastFont.style!=f.style)||(lastFont.face!=f.face)) {
-        HFONT   newFont = CreateFont (f.size,0,0,0,(f.style&HY_FONT_BOLD)?FW_BOLD:FW_NORMAL,f.style&HY_FONT_ITALIC,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
-                                      CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,f.face.sData);
-        DeleteObject(SelectObject (otherDC,newFont));
-        lastFont.face = f.face;
-        lastFont.size = f.size;
-        lastFont.style = f.style;
-    }
-    SIZE  textSize;
-    GetTextExtentPoint32(otherDC,s.sData,s.sLength,&textSize);
-    //ReleaseDC (DumbWindow, defDC);
-    return textSize.cx;
-}
-
-//________________________________________________________
-
-long    SaveFileFunction (_String& fileName, _String& prompt, _String &startName, char* fileFilters, Ptr WindowHNDL)
-{
-    static char buffer[2049], buffer2[256];
-    OPENFILENAME ofn;
-    ofn.lStructSize = sizeof (OPENFILENAME);
-    ofn.hwndOwner = (HWND)WindowHNDL;
-
-    ofn.lpstrFilter = fileFilters;
-    ofn.lpstrCustomFilter = nil;
-
-    ofn.nFilterIndex = 1;
-
-    buffer[0] = 0;
-    buffer2[0] = 0;
-    ofn.lpstrFile = buffer;
-    ofn.nMaxFile = 2048;
-    ofn.lpstrFileTitle = buffer2;
-    memcpy (buffer,startName.sData,startName.sLength+1);
-    ofn.nMaxFileTitle = 255;
-    ofn.lpstrInitialDir = nil;
-    ofn.lpstrDefExt = nil;
-    if (lastWinPathUsed.sLength) {
-        ofn.lpstrInitialDir = lastWinPathUsed.getStr();
-    } else {
-        ofn.lpstrInitialDir = ((_String*)pathNames(0))->getStr();
-    }
-    ofn.lpstrTitle = prompt.getStr();
-    ofn.Flags           = OFN_HIDEREADONLY|OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT|OFN_EXPLORER;
-
-    if (!GetSaveFileName (&ofn)) {
-        return -1;
-    }
-
-    fileName = buffer;
-    lastWinPathUsed = fileName.Cut (0,ofn.nFileOffset-1);
-
-    return     ofn.nFilterIndex-1;
-}
-
-//_________________________________________________________________________
-_HYColor    GetDialogBackgroundColor (void)
-{
-    COLORREF    backColor = GetSysColor (COLOR_MENU);
-    _HYColor    res = {GetRValue (backColor), GetGValue (backColor), GetBValue (backColor)};
-    return res;
-}
-
-//________________________________________________________
-_HYRect     GetScreenDimensions (void)
-{
-    /*RECT          dskRect;
-    GetWindowRect   (GetDesktopWindow(), &dskRect);
-    _HYRect         res = {0,0,0,0,0};
-
-    res.right       = dskRect.right-dskRect.left;
-    res.bottom      = dskRect.bottom-dskRect.top;
-
-    return res;*/
-
-    HMONITOR        defMonitor = MonitorFromPoint ((POINT) {
-        0,0
-    },MONITOR_DEFAULTTOPRIMARY);
-    MONITORINFO     mInfo;
-    mInfo.cbSize = sizeof (MONITORINFO);
-    GetMonitorInfo  (defMonitor,&mInfo);
-
-    _HYRect         res = {0,0,0,0,0};
-
-    res.right       = mInfo.rcWork.right-mInfo.rcWork.left+1;
-    res.bottom      = mInfo.rcWork.bottom-mInfo.rcWork.top-50;
-
-    /*char buffer [1024];
-
-    sprintf (buffer, "%d %d %d %d; %d %d %d %d\n",
-                     mInfo.rcWork.left, mInfo.rcWork.top, mInfo.rcWork.right, mInfo.rcWork.bottom,
-                     mInfo.rcMonitor.left, mInfo.rcMonitor.top, mInfo.rcMonitor.right, mInfo.rcMonitor.bottom );
-    BufferToConsole (buffer);*/
-
-    return res;
-}
-
-//________________________________________________________
-void        CenterWindow (_HYGuiObject* g)
-{
-    _HYWindow* w = (_HYWindow*)g;
-
-    _HYRect   screen = GetScreenDimensions();
-
-    long      cleft = 0, ctop = 0;
-
-    if (screen.right>w->right) {
-        cleft = (screen.right-w->right)/2;
-    }
-    if (screen.bottom>w->bottom) {
-        ctop = (screen.bottom-w->bottom)/2;
-    }
-
-    w->_SetPosition (cleft,ctop);
-}
-
-//_________________________________________________________________________
-void    DelayNMs (long ms)
-{
-    Sleep (ms);
-}
-
-//________________________________________________________
-
-long    SaveFileWithPopUp (_String& fileName, _String& prompt, _String& defFileName,
-                           _String& , _List& menuOptions)
-
-// TBI - add proper dialog window owner
-
-{
-    static char buffer[2049],
-           buffer2[256];
-
-    _String     formatString (128L, true);
-
-    long        k;
-
-    _List       extensions;
-
-    for (k=0; k<menuOptions.lLength; k++) {
-        _String* menuItem = (_String*)menuOptions(k);
-        formatString << menuItem;
-        formatString << '\0';
-        if ((menuItem->sLength>5)&&(menuItem->sData[menuItem->sLength-1]==')')
-                &&(menuItem->sData[menuItem->sLength-6]=='(')) {
-            formatString << '*';
-            formatString << menuItem->Cut (menuItem->sLength-5,menuItem->sLength-2);
-            extensions.AppendNewInstance (new _String(menuItem,menuItem->sLength-5,menuItem->sLength-2));
-        } else {
-            formatString << "*.*";
-            extensions && & empty;
-        }
-        formatString << '\0';
-    }
-    formatString.Finalize();
-
-    long res = SaveFileFunction (fileName, prompt, defFileName, formatString.sData, (Ptr)GetForegroundWindow());
-
-    if (res>=0) {
-        _String * ext = (_String*)extensions (res);
-        if (ext->sLength) {
-            if (fileName.FindAnyCase (*ext, fileName.sLength-ext->sLength, -1)<0) {
-                fileName = fileName & *ext;
-            }
-        }
-    }
-
-    return res;
-
-    /*OPENFILENAME ofn;
-    ofn.lStructSize = sizeof (OPENFILENAME);
-    ofn.hwndOwner   = nil;
-
-    ofn.lpstrFilter = formatString.sData;
-    ofn.lpstrCustomFilter = nil;
-
-    ofn.nFilterIndex = 0;
-
-    buffer[0]           = 0;
-    buffer2[0]          = 0;
-    ofn.lpstrFile       = buffer;
-    ofn.nMaxFile        = 2048;
-    ofn.lpstrFileTitle  = buffer2;
-    memcpy (buffer,defFileName.sData,defFileName.sLength+1);
-
-    ofn.nMaxFileTitle   = 255;
-    ofn.lpstrInitialDir = nil;
-    ofn.lpstrDefExt     = nil;
-    //ofn.lpfnHook      = sfwpHook;
-    ofn.lpfnHook        = nil;
-
-    if (lastWinPathUsed.sLength)
-        ofn.lpstrInitialDir = lastWinPathUsed.getStr();
-    else
-        ofn.lpstrInitialDir = ((_String*)pathNames(0))->getStr();
-
-    ofn.lpstrTitle      = prompt.getStr();
-    ofn.Flags           = OFN_HIDEREADONLY|OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT|OFN_EXPLORER;
-
-    if (!GetSaveFileName (&ofn))
-        return -1;
-
-    fileName = buffer;
-    return     ofn.nFilterIndex-1;*/
-
-}
-
-//________________________________________________________
-
-int CALLBACK fontGeneratorProc (ENUMLOGFONT *lf, NEWTEXTMETRIC* , DWORD , LPARAM rec)
-{
-    _List * recList = (_List*)rec;
-    _String fontName (lf->elfLogFont.lfFaceName);
-    recList->BinaryInsert (&fontName);
-    return 1;
-}
-
-//_________________________________________________________________________
-
-void    GenerateFontList (_List& fonts)
-{
-    fonts.Clear();
-    EnumFontFamilies (GetDC(nil), nil, (FONTENUMPROC)fontGeneratorProc, (LPARAM)&fonts);
-}
-
-//__________________________________________________________________________________
-char    ScanDirectoryForFileNames (_String& source, _List& rec, bool recurse)
-{
-    _String searchSpec = source & "\\*";
-
-    WIN32_FIND_DATA      findData;
-
-    HANDLE  searchHandle = FindFirstFile (searchSpec.sData, &findData);
-
-    if (searchHandle!=INVALID_HANDLE_VALUE) {
-        while (1) {
-            if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-                if (recurse) {
-                    _String subDirSpec =  findData.cFileName;
-                    if (!subDirSpec.beginswith (".")) {
-                        subDirSpec = source & '\\' & subDirSpec;
-                        ScanDirectoryForFileNames (subDirSpec, rec, true);
-                    }
-                }
-            } else {
-                _String fullFileName = findData.cFileName;
-                if (!fullFileName.beginswith (".")) {
-                    fullFileName = source & '\\' & fullFileName;
-                    rec && & fullFileName;
-                }
-            }
-            if (!FindNextFile (searchHandle, &findData)) {
-                break;
-            }
-        }
-        FindClose (searchHandle);
-    }
-    return '\\';
-}
-
-//________________________________________________________
-
-void    StartBarTimer(void)
-{
-    lastTimer   = time(&timerStart);
-    updateTimer = true;
-}
-
-//________________________________________________________
-
-void    StopBarTimer(void)
-{
-    updateTimer = false;
-}
-
-//________________________________________________________
-void    ToggleAnalysisMenu (bool running)
-{
-    HMENU anMenu = GetSubMenu (GetMenu((HWND)hyphyConsoleWindow->GetOSWindowData()), 2);
-    if (running) {
-        EnableMenuItem (anMenu, 0, MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem (anMenu, 1, MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem (anMenu, 5, MF_GRAYED|MF_BYPOSITION);
-        EnableMenuItem (anMenu, 6, MF_GRAYED|MF_BYPOSITION);
-        EnableMenuItem (anMenu, 7, MF_GRAYED|MF_BYPOSITION);
-    } else {
-        EnableMenuItem (anMenu, 5, MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem (anMenu, 6, MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem (anMenu, 7, MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem (anMenu, 0, MF_GRAYED|MF_BYPOSITION);
-        EnableMenuItem (anMenu, 1, MF_GRAYED|MF_BYPOSITION);
-        SetStatusBarValue (-1,1,0);
-        SetStatusLine ("Idle");
-    }
-    DrawMenuBar ((HWND)hyphyConsoleWindow->GetOSWindowData());
-}
-
-//________________________________________________________
-_HYColor        SelectAColor (_HYColor& currentColor, _String& )
-{
-    static              COLORREF     customColors[16];
-    CHOOSECOLOR  cc;
-    cc.lStructSize = sizeof (CHOOSECOLOR);
-    cc.hwndOwner = GetFocus ();
-    cc.hInstance = nil;
-    cc.rgbResult = RGB (currentColor.R, currentColor.G, currentColor.B);
-    cc.lpCustColors = customColors;
-    cc.Flags = CC_ANYCOLOR|CC_RGBINIT|CC_FULLOPEN;
-    cc.lCustData = nil;
-    cc.lpfnHook  = nil;
-    cc.lpTemplateName = nil;
-
-    if (ChooseColor (&cc)) {
-        _HYColor res;
-        res.R = GetRValue (cc.rgbResult);
-        res.G = GetGValue (cc.rgbResult);
-        res.B = GetBValue (cc.rgbResult);
-        return res;
-    }
-    return currentColor;
-}
-
-//________________________________________________________
-long    GetMaxCharWidth (_HYFont& f)
-{
-    _String testString ('W');
-    return  GetVisibleStringWidth (testString, f)+2;
-}
-
-//________________________________________________________
-
-char        YesNoCancelPrompt (_String& prompt)
-{
-    int res = MessageBox (GetForegroundWindow(), prompt.sData, "HyPhy Prompt", MB_YESNOCANCEL|MB_ICONQUESTION|
-                          MB_DEFBUTTON1|MB_APPLMODAL);
-    if (res == IDYES) {
-        return 1;
-    }
-    if (res == IDCANCEL) {
-        return 2;
-    }
-
-    return 3;
-}
-
-//________________________________________________________
-
-char    * ReturnFileDialogSelectionWin (bool write, _String* initDir)
-{
-    static char buffer[2049], buffer2[256];
-    OPENFILENAME ofn;
-    ofn.lStructSize = sizeof (OPENFILENAME);
-    ofn.hwndOwner = GetForegroundWindow();
-
-    char  fileFilters[] = "HYPHY Batch Files\0*.bf\0Data File\0*.dat;*.nuc;*.seq;*.phy;*.nex;\0All Files\0*.*\0\0";
-    ofn.lpstrFilter = fileFilters;
-    ofn.lpstrCustomFilter = nil;
-
-    ofn.nFilterIndex = 3;
-
-    buffer2[0] = 0;
-    if (defFileNameValue.sLength) {
-        if (defFileNameValue.sLength > 2048) {
-            _String truncString (defFileNameValue,0,2047);
-            strcpy (buffer, truncString.sData);
-        } else {
-            strcpy (buffer, defFileNameValue.sData);
-        }
-    } else {
-        buffer[0] = 0;
-    }
-
-    ofn.lpstrFile = buffer;
-    ofn.nMaxFile = 2048;
-    ofn.lpstrFileTitle = buffer2;
-    ofn.nMaxFileTitle = 255;
-
-    if (initDir) {
-        ofn.lpstrInitialDir = initDir->sData;
-    } else {
-        if (lastWinPathUsed.sLength) {
-            ofn.lpstrInitialDir = lastWinPathUsed.getStr();
-        } else if (pathNames.lLength) {
-            ofn.lpstrInitialDir = ((_String*)pathNames(0))->getStr();
-        } else {
-            ofn.lpstrInitialDir = baseDirectory.getStr();
-        }
-    }
-
-    ofn.lpstrDefExt = nil;
-    ofn.lpstrTitle = dialogPrompt.getStr();
-    ofn.Flags = 0;
-    ofn.Flags|=OFN_FILEMUSTEXIST;
-    ofn.Flags|=OFN_HIDEREADONLY;
-    ofn.Flags|=OFN_PATHMUSTEXIST;
-    /*char defExt[] = ".bf";*/
-
-
-    bool         res;
-
-    if (write) {
-        res = GetSaveFileName (&ofn);
-    } else {
-        res = GetOpenFileName (&ofn);
-    }
-
-    if (res) {
-        lastFileTypeSelection = ofn.nFilterIndex;
-        lastWinPathUsed = buffer;
-        lastWinPathUsed = lastWinPathUsed.Cut (0,ofn.nFileOffset-1);
-        return            buffer;
-    } else {
-        return            empty.sData;
-    }
-
-}
-
-//________________________________________________________
-
-bool    PopUpFileDialog(_String ps, _String* defaultLocation)
-{
-    _String saveDP = dialogPrompt,
-            res;
-
-    dialogPrompt = ps;
-    res = ReturnFileDialogSelectionWin (false, defaultLocation);
-    if (argFileName) {
-        *argFileName = res;
-    } else {
-        argFileName = new _String (res);
-        checkPointer (argFileName);
-    }
-
-    dialogPrompt = saveDP;
-    return argFileName->sLength;
-}
-
-//_________________________________________________________________________
-
-void    MoveConsoleWindow (_HYRect& newLoc)
-{
-    //SetWindowPos(WindowHandle, nil, newLoc.left, newLoc.top,newLoc.right-newLoc.left,newLoc.bottom-newLoc.top,
-    //SWP_NOZORDER);
-
-    hyphyConsoleWindow->SetPosition         (newLoc.left, newLoc.top);
-    hyphyConsoleWindow->SetWindowRectangle  (newLoc.top,newLoc.left,newLoc.bottom,newLoc.right,true);
-}
-
-//_________________________________________________________________________
-
-_String ChooseAFolder       (_String& prompt)
-{
-    BROWSEINFO BI;
-    ITEMIDLIST *IDL;
-
-    char       cDirName [MAX_PATH+1];
-
-    memset(&BI, 0, sizeof(BI));
-
-    BI.hwndOwner = GetFocus();
-    BI.pszDisplayName = cDirName;
-    BI.lpszTitle = prompt.sData;
-    BI.ulFlags = BIF_RETURNONLYFSDIRS;
-
-    if( IDL = SHBrowseForFolder(&BI) ) {
-        LPMALLOC pMalloc;
-        BOOL bOK;
-        SHGetMalloc(&pMalloc);
-        bOK = SHGetPathFromIDList(IDL, cDirName);
-        pMalloc->Free(pMalloc);
-        pMalloc->Release();
-        return cDirName;
-    }
-    return empty;
-}
-
-//_________________________________________________________________________
-
-void    ShowObjectInspector (void)
-{
-    long f = FindWindowByName (objectInspectorTitle);
-    if (f>=0) {
-        SetForegroundWindow ((HWND)windowPtrs (f));
-    } else {
-        _HYObjectInspector* newOI = new _HYObjectInspector ();
-        newOI->Activate       ( );
-    }
-}
-
-//_________________________________________________________________________
-void    PositionWindow          (_HYGuiObject* twp, _String* args)
-{
-    _List * argL = args->Tokenize (",");
-    _HYWindow*   tw = (_HYWindow*)twp;
-    if (argL->lLength>=4) {
-        long R[5],
-             k;
-
-        for (k=0; k<4; k++) {
-            R[k] = ((_String*)(*argL)(k))->toNum();
-        }
-        if (argL->lLength>4) {
-            R[4] = ((_String*)(*argL)(4))->toNum();
-        } else {
-            R[4] = 0;
-        }
-
-        _HYRect   wR = GetScreenDimensions  (),
-                  wiR;
-        long      W[4] = {wR.left,wR.top, wR.right, wR.bottom};
-        for (k=0; k<4; k++)
-            if (R[k]<0) {
-                R[k] = W[k] + ((k<2)?-1:1)*R[k];
-            }
-
-        wiR.left    = R[0];
-        wiR.right   = R[2];
-        wiR.top     = R[1];
-        wiR.bottom  = R[3];
-
-        if (wiR.left>=wiR.right) {
-            wiR.right = 1+wiR.left;
-        }
-        if (wiR.top>=wiR.bottom) {
-            wiR.bottom = 1+wiR.top;
-        }
-
-        tw->SetPosition        (wiR.left,wiR.top);
-        tw->SetWindowRectangle (0,0,wiR.bottom-wiR.top,wiR.right-wiR.left);
-
-        if (R[4]>0) {
-            wiR.top         = wiR.bottom+2;
-            wiR.bottom      = wR.bottom - 2;
-            wiR.left        = 5;
-            wiR.right       = wR.right - 2;
-            MoveConsoleWindow (wiR);
-        }
-
-    }
-
-    DeleteObject (argL);
-}
-
-//_________________________________________________________________________
-
-bool    Get_a_URL (_String& urls, _String* fileName)
-{
-
-    DWORD dwSize     = 0,
-          dataChunk = 65536,
-          totalRead = 0;
-
-    HINTERNET   hRootHandle = InternetOpen   (GetVersionString().sData,INTERNET_OPEN_TYPE_DIRECT ,nil,nil,0),
-                hUrlDump;
-
-
-    FILE*       f = nil;
-    _String*     storage = nil;
-
-    if (hRootHandle) {
-        if (fileName) {
-            f = fopen (fileName->sData,"wb");
-            if (!f) {
-                urls = "Failed to create/open target file";
-                return false;
-            }
-        } else {
-            checkPointer (storage = new _String (dataChunk,true));
-        }
-
-        hUrlDump = InternetOpenUrl(hRootHandle, urls.sData, NULL, NULL, INTERNET_FLAG_RAW_DATA|INTERNET_FLAG_NO_CACHE_WRITE, 0);
-
-        SetStatusLine (_String("Retrieving ")& urls);
-        do {
-            Ptr buffer = MemAllocate (dataChunk+1);
-            if(!InternetReadFile(hUrlDump,(LPVOID)buffer,dataChunk,&dwSize)) {
-                free (buffer);
-                break;
-            } else {
-                buffer[dwSize]='\0';
-
-                if (dwSize == 0) {
-                    if (f) {
-                        fclose (f);
-                    }
-
-                    if (storage) {
-                        storage->Finalize();
-                        urls = *storage;
-                        DeleteObject (storage);
-                    }
-
-                    free (buffer);
-                    InternetCloseHandle (hRootHandle);
-                    SetStatusLine     ("Idle");
-                    return true;
-                } else {
-                    if (storage) {
-                        (*storage) << buffer;
-                    } else {
-                        fwrite (buffer,1,dwSize,f);
-                    }
-
-                    totalRead+=dwSize;
-
-                    SetStatusLine (_String("Read ") & (long)(totalRead/1024) & "KB from " & urls);
-                }
-            }
-
-        } while (true);
-
-        InternetCloseHandle (hRootHandle);
-    }
-
-
-    SetStatusLine     ("Idle");
-
-    LPVOID lpMsgBuf;
-
-    if (!FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-                        NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf,0,NULL )) {
-        urls = "Unknown system error";
-    }
-
-    if (f) {
-        fclose (f);
-    }
-
-    if (storage) {
-        DeleteObject (storage);
-    }
-
-    urls = (char*)lpMsgBuf;
-    LocalFree( lpMsgBuf );
-
-    return false;
-}
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformBootsrapWindow.cpp b/src/gui/win/WindowClasses/HYPlatformBootsrapWindow.cpp
deleted file mode 100644
index bae3a1c..0000000
--- a/src/gui/win/WindowClasses/HYPlatformBootsrapWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Win 32 rtions of the bootstrap window class

    Sergei L. Kosakovsky Pond, Spring 2000 - January 2003.
*/

#include "HYParameterTable.h"


//__________________________________________________________________


bool        _HYBootstrapWindow::_ProcessMenuSelection (long msel)
{
    switch (msel) {
    case HY_WINDOW_MENU_ID_FILE+1 : { // file menu
        DoSave ();
        return true;
    }

    case HY_WINDOW_MENU_ID_FILE+2 : { // print menu
        _HYTable* t =  (_HYTable*)GetCellObject (2,0);
        t->_PrintTable((_HYTable*)GetCellObject (1,0));
        return true;
    }
    }

    if (_HYTWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    return false;
}




//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformChartWindow.cpp b/src/gui/win/WindowClasses/HYPlatformChartWindow.cpp
deleted file mode 100644
index 62d0212..0000000
--- a/src/gui/win/WindowClasses/HYPlatformChartWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Win32 Portions of the chart window class

    Sergei L. Kosakovsky Pond, Spring 2000 - December 2002.
*/

#include "HYChartWindow.h"
#include "HYCanvas.h"
#include "HYUtils.h"
#include "HYPulldown.h"
#include "HYDialogs.h"

#include "math.h"

extern   _Parameter                pi_const;

#define  HY_CHART_WIN32_MENU_BASE   6000
#define  HY_CHARTD_WIN32_MENU_BASE  27000


//__________________________________________________________________

void _HYChartWindow::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();

    HMENU            windowMenu = GetMenu (theWindow),
                     editMenu   = GetSubMenu(windowMenu,1),
                     chartMenu  = GetSubMenu(windowMenu,2);

    if (!chartMenu) {
        chartMenu = CreateMenu();

        HMENU          saveMenu  =  CreatePopupMenu(),
                       printMenu =  CreatePopupMenu(),
                       fontMenu  =  CreatePopupMenu(),
                       procMenu  =  CreatePopupMenu();

        EnableMenuItem (editMenu,2,MF_BYPOSITION|MF_ENABLED);
        EnableMenuItem (editMenu,4,MF_BYPOSITION|MF_ENABLED);
        EnableMenuItem (editMenu,6,MF_BYPOSITION|MF_ENABLED);

        checkPointer  (saveMenu);
        checkPointer  (chartMenu);
        checkPointer  (fontMenu);
        checkPointer  (printMenu);
        checkPointer  (procMenu);

        InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_CHART_WIN32_MENU_BASE+4, "Chart &Name");
        InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_CHART_WIN32_MENU_BASE, "Chart &Options");

        InsertMenu      (saveMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+1, "Save &Chart\tCtrl-S");
        InsertMenu      (saveMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+3, "Save &Graphic");
        InsertMenu      (saveMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+4, "Save &Table");

        InsertMenu      (printMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+2, "Print &Graphic\tCtrl-P");
        InsertMenu      (printMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+5, "Print &Data");

        InsertMenu      (fontMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_CHART_WIN32_MENU_BASE+1, "&Tickmark  Font");
        InsertMenu      (fontMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_CHART_WIN32_MENU_BASE+2, "&Legend Font");
        InsertMenu      (fontMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_CHART_WIN32_MENU_BASE+3, "&Axis Label  Font");


        InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)fontMenu, "&Fonts");
        InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);

        if (chartProcessors.lLength == 0) {
            InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, 0, "&Data Processing");
            DestroyMenu     (procMenu);
        } else {
            for (long k=0; k<chartProcessors.lLength; k++) {
                _String *thisItem = (_String*)chartProcessors (k),
                         chopped = thisItem->Cut (thisItem->FindBackwards ('\\',0,-1)+1,-1);

                InsertMenu      (procMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_CHART_WIN32_MENU_BASE+5+k, chopped.sData);
            }
            InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)procMenu, "&Data Processing");
        }

        InsertMenu   (windowMenu, 2, MF_BYPOSITION|MF_POPUP, (UINT) chartMenu , "&Chart");

        chartMenu =  GetSubMenu(windowMenu,0);

        ModifyMenu   (chartMenu, 0, MF_BYPOSITION|MF_POPUP, (UINT) saveMenu , "&Save");
        ModifyMenu   (chartMenu, 1, MF_BYPOSITION|MF_POPUP, (UINT) printMenu , "&Print");

        _AddStandardAccels();
        _BuildAccelTable  (true);
        accels.Clear();
    }
}

//__________________________________________________________________

void _HYChartWindow::_UnsetMenuBar(void)
{

}

//__________________________________________________________________

void        _HYChartWindow::_PrintChart(void)
{

    DOCINFO                 di = {sizeof(DOCINFO), "HYPHY.out", NULL };
    PRINTDLG                pd;
    BOOL                    SuccessFlag;

    pd.lStructSize         = sizeof(PRINTDLG);
    pd.hwndOwner           = theWindow;
    pd.hDevMode            = NULL;
    pd.hDevNames           = NULL;
    pd.hDC                 = NULL;
    pd.Flags               = PD_COLLATE | PD_RETURNDC | PD_NOSELECTION;
    pd.nFromPage           = 1;
    pd.nToPage             = 0xffff;
    pd.nMinPage            = 1;
    pd.nMaxPage            = 0xffff;
    pd.nCopies             = 1;
    pd.hInstance           = NULL;
    pd.lCustData           = 0L;
    pd.lpfnPrintHook       = NULL;
    pd.lpfnSetupHook       = NULL;
    pd.lpPrintTemplateName = NULL;
    pd.lpSetupTemplateName = NULL;
    pd.hPrintTemplate      = NULL;
    pd.hSetupTemplate      = NULL;

    if (!PrintDlg(&pd)) {
        return;
    }

    if (pd.hDC == NULL) {
        pd.hDC = GetPrinterDeviceContext(theWindow);
    }


    EnableWindow(theWindow, FALSE);

    SuccessFlag   = TRUE;
    UserAbortFlag = FALSE;

    PrintDialogHandle = CreateDialog(GetModuleHandle(NULL), (LPCTSTR)"PrintDlgBox", theWindow,
                                     PrintDialogProc);
    SetDlgItemText(PrintDialogHandle, IDD_FNAME, "Chart Printing...");

    SetAbortProc(pd.hDC, AbortProc);

    if (StartDoc(pd.hDC, &di) > 0) {
        HDC         windowDC = GetDC (theWindow);

        long        printW = GetDeviceCaps(pd.hDC, HORZRES),
                    printH = GetDeviceCaps(pd.hDC, VERTRES),

                    hRes = GetDeviceCaps(pd.hDC, LOGPIXELSX),
                    vRes = GetDeviceCaps(pd.hDC, LOGPIXELSY),

                    screenHRes = GetDeviceCaps(windowDC, LOGPIXELSX),
                    screenVRes = GetDeviceCaps(windowDC, LOGPIXELSY),

                    fromPage = pd.nMinPage,
                    toPage   = pd.nMaxPage;


        if (pd.Flags & PD_PAGENUMS) {
            fromPage = pd.nFromPage;
            toPage   = pd.nToPage;
        }

        ReleaseDC   (theWindow, windowDC);
        hRes = printW*((_Parameter)screenHRes/hRes);
        vRes = printH*((_Parameter)screenVRes/vRes);
        screenHRes = printW;
        screenVRes = printH;

        printW = hRes;
        printH = vRes;

        if (StartPage (pd.hDC) <= 0) {
            SuccessFlag = FALSE;
        } else {
            SetMapMode  (pd.hDC, MM_ISOTROPIC);
            SetWindowExtEx (pd.hDC, hRes, vRes,nil);
            SetViewportExtEx (pd.hDC, screenHRes, screenVRes, nil);

            _HYRect     viewRect  = ((_HYStretchCanvas*)GetObject (0))->GetCanvasSize();

            _Parameter  aspectRatio = viewRect.right/(_Parameter)viewRect.bottom;

            _HYRect     printRect = {0,0,printH, printH*aspectRatio,0};

            if (printRect.right > printW) {
                aspectRatio = printW/(_Parameter)printRect.right;
                printRect.right = printW;
                printRect.bottom *= aspectRatio;
            }

            _HYStretchCanvas    *sc = (_HYStretchCanvas*)GetObject (0);
            HDC         saveDC = sc->thePane;

            sc->thePane = pd.hDC;
            DrawChart   (&printRect);
            sc->thePane = saveDC;

            if (EndPage (pd.hDC) <= 0) {
                SuccessFlag = FALSE;
            }
        }
    } else {
        SuccessFlag = FALSE;
    }

    if (SuccessFlag) {
        SuccessFlag = (EndDoc(pd.hDC)>0);
    }

    if (!UserAbortFlag) {
        EnableWindow(theWindow, TRUE);
        DestroyWindow(PrintDialogHandle);
    }

    DeleteDC (pd.hDC);

    if (!SuccessFlag && !UserAbortFlag) {
        _String errMsg = _String("Failed to print the chart. Windows Error:") & (long)GetLastError();
        ProblemReport (errMsg,nil);
    }
}


//__________________________________________________________________


bool        _HYChartWindow::_ProcessMenuSelection (long msel)
{

    switch (msel) {
    case HY_CHART_WIN32_MENU_BASE: { // chart menu
        HandleChartOptions ();
        return true;
    }
    case HY_WINDOW_MENU_ID_FILE+1: // save menu
    case HY_WINDOW_MENU_ID_FILE+3: // save menu
    case HY_WINDOW_MENU_ID_FILE+4: { // save menu
        DoSave ((msel==HY_WINDOW_MENU_ID_FILE-1)?0:msel-HY_WINDOW_MENU_ID_FILE-2);
        return true;
    }
    case HY_WINDOW_MENU_ID_FILE+2: // print menu
    case HY_WINDOW_MENU_ID_FILE+5: { // print menu
        DoPrint ((msel==HY_WINDOW_MENU_ID_FILE+2)?0:-1);
        return true;
    }
    case HY_CHART_WIN32_MENU_BASE+1: // font menu
    case HY_CHART_WIN32_MENU_BASE+2: // font menu
    case HY_CHART_WIN32_MENU_BASE+3: { // font menu
        DoChangeFont (msel-HY_CHART_WIN32_MENU_BASE-1);
        return true;
    }
    case HY_CHART_WIN32_MENU_BASE+4: { // chart name
        RenameChartWindow ();
        return true;
    }
    default: { // proc menu
        if (msel>=HY_CHART_WIN32_MENU_BASE+5) {
            ExecuteProcessor (msel-HY_CHART_WIN32_MENU_BASE-5);
            return true;
        }
    }
    }

    return _HYTWindow::_ProcessMenuSelection(msel);
}

//__________________________________________________________________

bool _HYChartWindow::_ProcessOSEvent (Ptr vEvent)
{
    static int   lastH = -1,
                 lastV = -1;

    if (!_HYTWindow::_ProcessOSEvent (vEvent)) {
        _HYWindowsUIMessage*    theEvent = (_HYWindowsUIMessage*)vEvent;

        if (components.lLength == 0) {
            return false;
        }

        _HYPullDown *p1 = (_HYPullDown*)GetObject (4);

        if (p1&&(p1->GetSelection()>=8)&&(ySeries.lLength)) {
            switch (theEvent->iMsg) {
            case WM_LBUTTONDOWN: {
                lastH = (short)LOWORD (theEvent->lParam);
                lastV = (short)HIWORD (theEvent->lParam);


                if (FindClickedCell(lastH, lastV)!=0) { // the chart
                    lastH = -1;
                    lastV = -1;
                } else {
                    SetCapture (theWindow);
                    return      true;
                }
                break;
            }

            case WM_LBUTTONUP: {
                if (lastH>=0) {
                    ReleaseCapture ();
                    lastH = -1;
                    lastV = -1;
                    return  true;
                }
                break;
            }

            case WM_MOUSEMOVE: {
                if (lastH>=0) {
                    short       newH = (short)LOWORD (theEvent->lParam),
                                newV = (short)HIWORD (theEvent->lParam);

                    bool        redraw = false;

                    _Parameter  stepper = pi_const/180.;

                    if (abs(newH-lastH)>abs(newV-lastV)) {
                        stepper *= 1+log (fabs(newH-lastH))/log(2.0);
                        if (newH-lastH<0) {
                            if (xyAngle>0.0) {
                                xyAngle -= stepper;
                                if (xyAngle<0) {
                                    xyAngle = 0;
                                }
                                redraw = true;
                            }
                        } else if (xyAngle<pi_const/2) {
                            xyAngle += stepper;
                            if (xyAngle>pi_const/2) {
                                xyAngle = pi_const/2;
                            }
                            redraw = true;
                        }
                    } else {
                        if (newV==lastV) {
                            return false;
                        }
                        stepper *= 1+log (fabs(newV-lastV))/log(2.0);
                        if (newV-lastV>0) {
                            if (zAngle<pi_const/2) {
                                zAngle += stepper;
                                if (zAngle>pi_const/2) {
                                    zAngle = pi_const/2;
                                }
                                redraw = true;
                            }
                        } else if (zAngle>0.0) {
                            zAngle -= stepper;
                            if (zAngle<0) {
                                zAngle = 0;
                            }
                            redraw = true;
                        }

                    }

                    if (redraw) {
                        ComputeProjectionSettings();
                        projectionMatrix = ComputeProjectionMatrix   ();
                        forceUpdateForScrolling = true;
                        DrawChart();
                        forceUpdateForScrolling = false;
                    }

                    lastH = newH;
                    lastV = newV;
                }
                break;
            }
            }
        }
        return false;
    }
    return true;
}

//__________________________________________________________________

void _HYChartWindow::_CopyChart (void)
{
    _HYStretchCanvas    *sc = (_HYStretchCanvas*)GetObject (0);
    PlaceBitmapInClipboard (sc->paneBitMap, theWindow);
}

//__________________________________________________________________

void _HYDistributionChartWindow::_SetMenuBar(void)
{
    HMENU            chartMenu  = GetSubMenu(windowMenu,3);

    if (!chartMenu) {
        chartMenu = CreateMenu();


        InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING , HY_CHARTD_WIN32_MENU_BASE, "Define New &Variable");
        InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING , HY_CHARTD_WIN32_MENU_BASE+1, "&Delete Variable");
        InsertMenu      (chartMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_CHARTD_WIN32_MENU_BASE+2, "&Conditional Distribution");

        if (distribProcessors.lLength > 0) {
            InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);
            for (long k=0; k<distribProcessors.lLength; k++) {
                _String *thisItem = (_String*)distribProcessors (k),
                         chopped = thisItem->Cut (thisItem->FindBackwards ('\\',0,-1)+1,-1);

                InsertMenu      (chartMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_CHARTD_WIN32_MENU_BASE+3+k, chopped.sData);
            }
        }

        InsertMenu   (windowMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT) chartMenu , "Cate&gories");
    }
}

//__________________________________________________________________

void _HYDistributionChartWindow::_UnsetMenuBar(void)
{
    _HYChartWindow::_UnsetMenuBar();
}

//__________________________________________________________________

bool _HYDistributionChartWindow::_ProcessMenuSelection (long msel)
{
    switch (msel) {
    case HY_CHARTD_WIN32_MENU_BASE: {
        AddVariable ();
        return true;
    }
    case HY_CHARTD_WIN32_MENU_BASE+1: {
        RemoveVariable ();
        return true;
    }
    case HY_CHARTD_WIN32_MENU_BASE+2: {
        ShowMarginals ();
        return true;
    }
    default: {
        if (msel>=HY_CHARTD_WIN32_MENU_BASE+3) {
            HandleCatPostProcessor (msel-HY_CHARTD_WIN32_MENU_BASE-3);
            return true;
        }
    }
    }

    return _HYChartWindow::_ProcessMenuSelection(msel);
}



//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformConsoleWindow.cpp b/src/gui/win/WindowClasses/HYPlatformConsoleWindow.cpp
deleted file mode 100644
index a6d8c69..0000000
--- a/src/gui/win/WindowClasses/HYPlatformConsoleWindow.cpp
+++ /dev/null
@@ -1,584 +0,0 @@
-/*
-    Win 32 Portions of the console window class
-
-    Sergei L. Kosakovsky Pond, December 2003.
-*/
-
-#include "HYConsoleWindow.h"
-#include "HYTextBox.h"
-#include "HYDialogs.h"
-#include "HYUtils.h"
-#include "HYDataPanel.h"
-#include "HYEventTypes.h"
-#include "HYSharedMain.h"
-#include "preferences.h"
-
-#include "time.h"
-#include "parser.h"
-
-extern   HFONT   statusBarBold,
-         statusBarPlain;
-
-extern   bool    hyphyExiting;
-
-//extern     _String selectedFileName,
-//               savedFileName;
-
-
-extern  time_t   timerStart,
-        lastTimer;
-
-extern  HMENU    recentFilesMenu;
-
-LARGE_INTEGER    lastMeasure = {0,0};
-
-void             RunStandardAnalyses (void);
-void             displayAbout        (bool);
-void             getUserFont         (void);
-void             UpdateTimer         (void);
-
-//__________________________________________________________________
-
-void _HYConsoleWindow::_SetMenuBar(void)
-{
-    if (!menuKeys) {
-        menuKeys = LoadAccelerators (ProgramInstance,"HYPHY");
-    }
-    //_HYWindow::_SetMenuBar();
-}
-
-//__________________________________________________________________
-
-void _HYConsoleWindow::_UpdateEditMenu (void)
-{
-
-    _HYTextBox* txb = (_HYTextBox*)GetObject (0);
-
-    HWND        te = txb->te;
-
-    CHARRANGE   cr;
-
-    SendMessage (te,EM_EXGETSEL,0,(LPARAM)&cr);
-
-    bool        haveSelection = cr.cpMax-cr.cpMin,
-                canPaste      = SendMessage (te,EM_CANPASTE,CF_TEXT,0),
-                canUndo        = SendMessage (te,EM_GETUNDONAME,0,0),
-                canRedo         = SendMessage (te,EM_CANREDO,0,0);
-
-    if ((((bool)editOptions&HY_CONSOLE_CAN_COPY)!=haveSelection)||
-            (((bool)editOptions&HY_CONSOLE_CAN_PASTE)!=canPaste)||
-            (((bool)editOptions&HY_CONSOLE_CAN_UNDO)!=canUndo)||
-            (((bool)editOptions&HY_CONSOLE_CAN_UNDO)!=canRedo)) {
-        HMENU            windowMenu = GetMenu (theWindow),
-                         editMenu   = GetSubMenu(windowMenu,1);
-
-        editOptions = 0;
-
-        if (haveSelection) {
-            editOptions |= HY_CONSOLE_CAN_COPY;
-        }
-
-        EnableMenuItem (editMenu,3,MF_BYPOSITION|(haveSelection?MF_ENABLED:MF_GRAYED));
-        EnableMenuItem (editMenu,4,MF_BYPOSITION|(haveSelection?MF_ENABLED:MF_GRAYED));
-
-        if (canPaste) {
-            editOptions |= HY_CONSOLE_CAN_PASTE;
-        }
-
-        EnableMenuItem (editMenu,5,MF_BYPOSITION|(canPaste?MF_ENABLED:MF_GRAYED));
-
-        if (canUndo) {
-            editOptions |= HY_CONSOLE_CAN_UNDO;
-        }
-
-        EnableMenuItem (editMenu,0,MF_BYPOSITION|(canUndo?MF_ENABLED:MF_GRAYED));
-
-        if (canRedo) {
-            editOptions |= HY_CONSOLE_CAN_REDO;
-        }
-
-        EnableMenuItem (editMenu,1,MF_BYPOSITION|(canRedo?MF_ENABLED:MF_GRAYED));
-    }
-}
-
-//__________________________________________________________________
-
-void _HYConsoleWindow::_UnsetMenuBar(void)
-{
-    _HYWindow::_UnsetMenuBar();
-}
-
-//__________________________________________________________________
-
-bool        _HYConsoleWindow::_ProcessMenuSelection (long msel)
-{
-    switch (msel) {
-    case 13:
-        SaveConsole ();
-        return true;
-
-    case 14:
-        _DoPrint ();
-        return true;
-
-    case 16:
-        ((_HYTextBox*)GetObject(0))->_DoUndo(true);
-        return true;
-
-    case 17:
-        ((_HYTextBox*)GetObject(0))->_DoCut(true);
-        return true;
-
-    case 18:
-        ((_HYTextBox*)GetObject(0))->_DoCopy(true);
-        return true;
-
-    case 20:
-        ((_HYTextBox*)GetObject(0))->_DoSelectAll(true);
-        return true;
-
-    case 21:
-        SetStatusLine ("Canceling");
-        terminateExecution = true;
-        return true;
-
-    case 22:
-        if (!isSuspended) {
-            isSuspended = true;
-            SetStatusLine (empty,empty,empty,-1,HY_SL_SUSPEND);
-            HMENU       sMenu = GetSubMenu (GetMenu((HWND)GetOSWindowData()),2);
-            if (sMenu) {
-                EnableMenuItem(sMenu, 0 ,MF_GRAYED|MF_BYPOSITION);
-            }
-            ModifyMenu (sMenu,1,MF_BYPOSITION,22,"&Resume\tCtrl+;");
-            updateTimer = false;
-        } else {
-            isSuspended = false;
-            SetStatusLine (empty,empty,empty,-1,HY_SL_RESUME);
-            HMENU       sMenu = GetSubMenu (GetMenu((HWND)GetOSWindowData()),2);
-            if (sMenu) {
-                EnableMenuItem(sMenu, 0 ,MF_ENABLED|MF_BYPOSITION);
-            }
-
-            ModifyMenu (sMenu,1,MF_BYPOSITION,22,"&Suspend Execution\tCtrl+;");
-            time_t      tt;
-            timerStart += time(&tt)-lastTimer;
-            updateTimer = true;
-        }
-        return true;
-
-    case 23:
-        ShowMessagesLog();
-        return true;
-
-    case 24:
-        RunStandardAnalyses();
-        return true;
-
-    case 25:
-        displayAbout(false);
-        return true;
-
-    case 26:
-        ((_HYTextBox*)GetObject(0))->_DoClear (true,true);
-        return true;
-
-    case 27:
-        HandlePreferences (globalPreferencesList,"HYPHY Preferences");
-        return true;
-
-    case 28:
-        getUserFont();
-        return true;
-
-    case 29:
-        WinExec ("hh HYPHY HELP.chm",SW_SHOWNORMAL);
-        return true;
-
-    case 30:
-        if (OpenBatchFile (false)) {
-            ExecuteBatchFile();
-        }
-        return true;
-
-    case 31:
-        ((_HYTextBox*)GetObject(0))->_DoRedo(true);
-        return true;
-
-    case 15:
-        postWindowCloseEvent (GetID());
-        return true;
-
-    case 60: // expression calculator
-        if (calculatorMode) {
-            _HYTextBox         *ib = (_HYTextBox*)hyphyConsoleWindow->GetObject(1);
-            ib->SetText ("exit");
-            hyphyConsoleWindow->ProcessEvent (generateTextEditChangeEvent(ib->GetID(),2));
-            calculatorMode         = false;
-            //ib->SetText (empty);
-        } else {
-            calculatorMode = true;
-            while(!hyphyExiting && calculatorMode&&ExpressionCalculator()) {}
-            calculatorMode = false;
-        }
-        return true;
-
-    case 61: { // execute selection
-        ExecuteSelection();
-        return true;
-    }
-
-    case 70: // New Tree
-        NewTreeWindow(-1);
-        return true;
-
-    case 71: // New Model
-        NewModel(nil);
-        return true;
-
-    case 72: // New Chart
-        NewChartWindow();
-        return true;
-
-    case 73: // New Genetic Code
-        NewGeneticCodeTable(0);
-        return true;
-
-    case 74: // New Database
-        NewDatabaseFile (nil);
-        return true;
-
-    case 80: // Open Batch File
-        if (OpenBatchFile()) {
-            ExecuteBatchFile ();
-        }
-        return true;
-
-    case 81: // Open Data File
-        OpenDataFile();
-        return true;
-
-    case 82: // Open Tree
-        OpenTreeFile();
-        return true;
-
-    case 83: // Open Text
-        OpenTextFile();
-        return true;
-
-    case 84: // Open Table
-        OpenTable ();
-        return true;
-
-    case 85: // Open Database
-        OpenDatabaseFile (nil);
-        return true;
-
-    case 200:
-        hyphyConsoleWindow->_BringWindowToFront();
-        return true;
-
-    case 201:
-        ShowObjectInspector ();
-        return true;
-
-    default: {
-        msel -= 1000;
-        if (msel<availablePostProcessors.lLength) {
-            ExecuteAPostProcessor (*(_String*)(*(_List*)availablePostProcessors(msel))(1));
-            return 0;
-        }
-        msel-=1000;
-        if (msel<(long)recentPaths.lLength) {
-            if (msel == -1) {
-                for (long mi = 0; mi < recentPaths.lLength; mi++) {
-                    DeleteMenu (recentFilesMenu,2,MF_BYPOSITION);
-                }
-
-                recentPaths.Clear();
-                recentFiles.Clear();
-                DrawMenuBar ((HWND)GetOSWindowData());
-            } else {
-                if (argFileName) {
-                    *argFileName = *(_String*)recentPaths(msel);
-                } else {
-                    argFileName = new _String (*(_String*)recentPaths(msel));
-                }
-                if (OpenBatchFile(false)) {
-                    ExecuteBatchFile ();
-                }
-            }
-            return true;
-        }
-
-        return true;
-    }
-    }
-
-    return _HYTWindow::_ProcessMenuSelection(msel);
-}
-
-//__________________________________________________________________
-
-bool _HYConsoleWindow::_ProcessOSEvent (Ptr vEvent)
-{
-    _HYWindowsUIMessage*    theEvent = (_HYWindowsUIMessage*)vEvent;
-    if (theEvent->iMsg == WM_SYSCOMMAND) {
-        if (theEvent->wParam == SC_CLOSE) {
-            hyphyExiting = true;
-            return true;
-        }
-    } else {
-        if (theEvent->iMsg == UPDATE_TIMER) {
-            UpdateTimer ();
-            return true;
-        }
-    }
-    return _HYTWindow::_ProcessOSEvent (vEvent);
-}
-
-//__________________________________________________________________
-
-bool _HYConsoleWindow::_Close (Ptr )
-{
-    hyphyExiting = true;
-    return false;
-}
-
-//__________________________________________________________________
-void    _HYConsoleWindow::_DoPrint          (void)
-{
-    _HYTextBox* ob = (_HYTextBox*)components(0);
-
-    DOCINFO                 di = {sizeof(DOCINFO), "HYPHY.out", NULL };
-    PRINTDLG                pd;
-    BOOL                    SuccessFlag;
-
-    pd.lStructSize         = sizeof(PRINTDLG);
-    pd.hwndOwner           = theWindow;
-    pd.hDevMode            = NULL;
-    pd.hDevNames           = NULL;
-    pd.hDC                 = NULL;
-    pd.Flags               = PD_COLLATE | PD_RETURNDC | PD_NOSELECTION;
-    pd.nFromPage           = 1;
-    pd.nToPage             = 0xffff;
-    pd.nMinPage            = 1;
-    pd.nMaxPage            = 0xffff;
-    pd.nCopies             = 1;
-    pd.hInstance           = NULL;
-    pd.lCustData           = 0L;
-    pd.lpfnPrintHook       = NULL;
-    pd.lpfnSetupHook       = NULL;
-    pd.lpPrintTemplateName = NULL;
-    pd.lpSetupTemplateName = NULL;
-    pd.hPrintTemplate      = NULL;
-    pd.hSetupTemplate      = NULL;
-
-    if (!PrintDlg(&pd)) {
-        return;
-    }
-
-    if (pd.hDC == NULL) {
-        pd.hDC = GetPrinterDeviceContext(theWindow);
-    }
-
-    EnableWindow(theWindow, FALSE);
-
-    SuccessFlag   = TRUE;
-    UserAbortFlag = FALSE;
-
-    PrintDialogHandle = CreateDialog(GetModuleHandle(NULL), (LPCTSTR)"PrintDlgBox", theWindow,
-                                     PrintDialogProc);
-    SetDlgItemText(PrintDialogHandle, IDD_FNAME, "Table Printing...");
-
-    SetAbortProc(pd.hDC, AbortProc);
-
-    if (StartDoc(pd.hDC, &di) > 0) {
-
-        long        fromPage = pd.nMinPage,
-                    toPage   = pd.nMaxPage;
-
-        _Parameter  CFW = 1440./GetDeviceCaps(pd.hDC, LOGPIXELSX),
-                    CFH = 1440./GetDeviceCaps(pd.hDC, LOGPIXELSY);
-
-
-
-        FORMATRANGE  fr;
-
-        fr.rc.left  = GetDeviceCaps(pd.hDC, PHYSICALOFFSETX)    * CFW;
-        fr.rc.top   = GetDeviceCaps(pd.hDC, PHYSICALOFFSETY)    * CFH;
-        fr.rc.right  = fr.rc.left + GetDeviceCaps(pd.hDC, HORZRES) * CFW;
-        fr.rc.bottom = fr.rc.top + GetDeviceCaps(pd.hDC, VERTRES) * CFH;
-
-        fr.rcPage.left  = fr.rcPage.top = 0;
-        fr.rcPage.right = GetDeviceCaps(pd.hDC, PHYSICALWIDTH) * CFW;
-        fr.rcPage.bottom = GetDeviceCaps(pd.hDC, PHYSICALHEIGHT) * CFH;
-        fr.chrg.cpMin = 0;
-
-        GETTEXTLENGTHEX gtl = {GTL_NUMCHARS,CP_ACP};
-        fr.chrg.cpMax = SendMessage (ob->te,EM_GETTEXTLENGTHEX,(WPARAM)&gtl,0)-1;
-
-        while (fr.chrg.cpMin < fr.chrg.cpMax) {
-            if (StartPage (pd.hDC) <= 0) {
-                SuccessFlag = FALSE;
-                break;
-            }
-
-            SetMapMode     (pd.hDC, MM_TEXT);
-
-            fr.hdc          = pd.hDC;
-            fr.hdcTarget    = pd.hDC;
-
-            fr.chrg.cpMin = SendMessage(ob->te,EM_FORMATRANGE,1,(LPARAM)&fr);
-            SendMessage(ob->te,EM_DISPLAYBAND,1,(LPARAM)&fr.rcPage);
-            SendMessage(ob->te,EM_FORMATRANGE,0,nil);
-
-            if (EndPage (pd.hDC) <= 0) {
-                SuccessFlag = FALSE;
-            }
-        }
-    } else {
-        SuccessFlag = FALSE;
-    }
-
-
-    if (SuccessFlag) {
-        SuccessFlag = (EndDoc(pd.hDC)>0);
-    }
-
-    if (!UserAbortFlag) {
-        EnableWindow(theWindow, TRUE);
-        DestroyWindow(PrintDialogHandle);
-    }
-
-    DeleteDC (pd.hDC);
-
-    if (!SuccessFlag && !UserAbortFlag) {
-        _String errMsg = _String("Failed to print console. Windows Error:") & (long)GetLastError();
-        ProblemReport (errMsg,nil);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYConsoleWindow::_PaintStatusBar(Ptr hdp, bool force)
-{
-    _Parameter      vL;
-    checkParameter (VerbosityLevelString, vL, 0.0);
-    if (vL<-0.5 && !force) {
-        LARGE_INTEGER curMeasure;
-        QueryPerformanceCounter (&curMeasure);
-
-        _Parameter      timeDiff   = (curMeasure.QuadPart-lastMeasure.QuadPart)/1000000;
-
-        if (timeDiff < -vL) {
-            return;
-        }
-        lastMeasure = curMeasure;
-    }
-
-    HDC  osc = CreateCompatibleDC (NULL),
-         hdc;
-
-    if (hdp) {
-        hdc = (HDC)hdp;
-    } else {
-        hdc = GetDC (theWindow);
-    }
-
-
-    RECT wRC,
-         w2RC;
-
-    GetClientRect (theWindow, &wRC);
-    wRC.top    = 0;
-    wRC.bottom = HY_SCROLLER_WIDTH;
-
-    HBITMAP oBM = CreateCompatibleBitmap (hdc,wRC.right,HY_SCROLLER_WIDTH),
-            oldBM;
-
-    //printf ("%x %x\n", osc, oBM);
-
-    if (oBM) {
-        oldBM = (HBITMAP)SelectObject (osc,oBM);
-        HBRUSH bkBrush = CreateSolidBrush (GetBkColor(hdc));
-
-        FillRect     (osc, &wRC,windowStatusBarBrush);
-        MoveToEx     (osc,0,wRC.bottom-HY_SCROLLER_WIDTH+1,NULL);
-        SelectObject (osc, (HPEN)GetStockObject(BLACK_PEN));
-        LineTo       (osc,wRC.right,wRC.bottom-HY_SCROLLER_WIDTH+1);
-
-        SetBkMode    (osc, TRANSPARENT);
-        SetTextAlign (osc, TA_LEFT|TA_BOTTOM|TA_NOUPDATECP);
-        SetTextColor (osc,RGB(0,0,0));
-        SelectObject (osc,statusBarPlain);
-        TextOut      (osc,33,wRC.bottom-1, fileName.getStr(),fileName.sLength);
-        if (inputStatus == 1) {
-            TextOut      (osc,193,wRC.bottom-1,cInput.getStr(),cInput.sLength);
-        } else {
-            TextOut      (osc,193,wRC.bottom-1,action.getStr(),action.sLength);
-        }
-
-        w2RC = wRC;
-
-        w2RC.right = 30;
-        w2RC.top=w2RC.bottom-HY_SCROLLER_WIDTH+2;
-
-        FillRect(osc, &w2RC, (HBRUSH)GetStockObject (DKGRAY_BRUSH));
-        w2RC.left  = 150;
-        w2RC.right = 190;
-        FillRect(osc, &w2RC, (HBRUSH)GetStockObject (DKGRAY_BRUSH));
-        w2RC.right = wRC.right;
-        w2RC.left = w2RC.right - 50;
-        FillRect(osc, &w2RC, (HBRUSH)GetStockObject (DKGRAY_BRUSH));
-        SelectObject (osc,statusBarBold);
-        SetTextColor (osc,RGB(255,255,255));
-        TextOut (osc,3,wRC.bottom-1,cState.sData,cState.sLength);
-        TextOut (osc,151,wRC.bottom-1,cTask.sData,cTask.sLength);
-        SelectObject (osc,statusBarPlain);
-
-        TextOut (osc,wRC.right-48,wRC.bottom-1,timer.getStr(),timer.sLength);
-
-        if (percentDone>=0 || percentDone == -HY_SL_DONE) {
-            HBRUSH blackBrush = CreateSolidBrush (RGB(80,80,80)), orangeBrush = CreateSolidBrush (RGB(255,153,102));
-            w2RC.right = w2RC.left-5;
-            w2RC.left-=75;
-            w2RC.top++;
-            w2RC.bottom--;
-
-            w2RC.right = w2RC.left+(w2RC.right-w2RC.left)*(percentDone>=0?percentDone:100)/100;
-            FillRect (osc,&w2RC,orangeBrush);
-            w2RC.right = w2RC.left+70;
-            FrameRect (osc,&w2RC,blackBrush);
-            _String pLine;
-            if (percentDone>=0) {
-                pLine = _String(percentDone)&"%";
-            } else {
-                pLine = "DONE";
-            }
-
-            SetTextColor (osc,RGB(0,0,0));
-            TextOut (osc,w2RC.left+28,wRC.bottom-1,pLine.getStr(),pLine.sLength);
-
-            DeleteObject (blackBrush);
-            DeleteObject (orangeBrush);
-        }
-
-        GetClientRect (theWindow,&w2RC);
-
-        BitBlt  (hdc,0,w2RC.bottom-HY_SCROLLER_WIDTH,wRC.right,HY_SCROLLER_WIDTH,osc, 0,0,SRCCOPY);
-        SelectObject (osc,oldBM);
-        DeleteObject (bkBrush);
-        DeleteObject (oBM);
-    }
-    DeleteDC     (osc);
-
-
-    if (!hdp) {
-        ReleaseDC (theWindow,hdc);
-    }
-    
-    yieldCPUTime();
-}
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformDBWindow.cpp b/src/gui/win/WindowClasses/HYPlatformDBWindow.cpp
deleted file mode 100644
index adb0deb..0000000
--- a/src/gui/win/WindowClasses/HYPlatformDBWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Win32 Portions of the DB Window class

    Sergei L. Kosakovsky Pond, Fall 2005.
*/

#include "HYDBWindow.h"

//__________________________________________________________________


bool        _HYDBWindow::_ProcessMenuSelection (long msel)
{
    long        menuChoice = msel&0x0000ffff;
    _HYTable*   table = (_HYTable*)GetObject(0);

    switch (msel) {
    case HY_WINDOW_MENU_ID_FILE+2: { // print menu
        _SimpleList columns (table->horizontalSpaces.lLength,0,1);
        table->_PrintTable(columns,(_HYTable*)GetObject(1));
        return true;
    }
    }
    return _HYTWindow::_ProcessMenuSelection(msel);
}

//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformDataPanel.cpp b/src/gui/win/WindowClasses/HYPlatformDataPanel.cpp
deleted file mode 100644
index 1007cd9..0000000
--- a/src/gui/win/WindowClasses/HYPlatformDataPanel.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Win 32 Portions of the data panel class

    Sergei L. Kosakovsky Pond, Spring 2000 - January 2003.
*/

#include "HYTreePanel.h"
#include "HYDataPanel.h"
#include "HYUtils.h"

#include "likefunc.h"

#define     HY_DATA_WIN32_MENU_BASE    8000
#define     HY_DATALF_WIN32_MENU_BASE  8500

//__________________________________________________________________

void _HYDataPanel::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();

    HMENU            windowMenu = GetMenu (theWindow),
                     dataMenu   = GetSubMenu(windowMenu,2);

    if (!dataMenu) {
        HMENU      dataMenu         = CreateMenu (),
                   lfMenu             = CreateMenu (),
                   blockMenu       = CreatePopupMenu (),
                   repeatCharMenu   = CreatePopupMenu (),
                   nameDisplayMenu  = CreatePopupMenu (),
                   additionalInfo  = CreatePopupMenu (),
                   lfDisplayMode   = CreatePopupMenu (),
                   omittedSpecies   = CreatePopupMenu (),
                   simulateData  = CreatePopupMenu (),
                   saveSubMenu     = CreatePopupMenu (),
                   procMenu         = CreatePopupMenu (),
                   inferSubMenu     = nil;

        _HYSequencePane* sp = (_HYSequencePane*)GetObject (0);

        if (!(dataMenu&&blockMenu&&repeatCharMenu&&nameDisplayMenu&&omittedSpecies&&additionalInfo)) {
            warnError (-108);
        }

        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATA_WIN32_MENU_BASE,
                         "&Partition->Selection\tCtrl-1");
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATA_WIN32_MENU_BASE+1,
                         "&Selection->Partition\tCtrl-2");
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+2,
                         "&Invert Selection\tCtrl-3");

        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);

        InsertMenu      (blockMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+50, "&9");
        InsertMenu      (blockMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+51, "&10");

        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)blockMenu, "&Block Width");

        InsertMenu      (repeatCharMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+60, "Display &Actual Character");
        InsertMenu      (repeatCharMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+61, "&Display '.'");

        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)repeatCharMenu, "&Repeat Characters");

        InsertMenu      (nameDisplayMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+70, "&None");
        InsertMenu      (nameDisplayMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+71, "&First 10 characters");
        InsertMenu      (nameDisplayMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+72, "F&ull names");
        InsertMenu      (nameDisplayMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);
        InsertMenu      (nameDisplayMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+73, "&Alphabetize names");
        InsertMenu      (nameDisplayMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+74, "&Revert to file order");
        InsertMenu      (nameDisplayMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+75, "&Clean up sequence names");

        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)nameDisplayMenu, "&Name Display");

        InsertMenu      (omittedSpecies, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+10000, "&Restore All");
        InsertMenu      (omittedSpecies, 0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP|MF_GRAYED, (UINT)omittedSpecies, "&Omitted Sequences");

        InsertMenu      (additionalInfo, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+80, "&Consensus Sequence");
        InsertMenu      (additionalInfo, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATA_WIN32_MENU_BASE+81,
                         "&Rate Class");
        InsertMenu      (additionalInfo, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATA_WIN32_MENU_BASE+82,
                         "&Aminoacid Translation");
        InsertMenu      (additionalInfo, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+83,  "Re&ference Sequence");

        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)additionalInfo, "&Additonal Info");
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);

        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATA_WIN32_MENU_BASE+3,"Part&ition Properties");
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+4,"Inp&ut Partition");
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);

        InsertMenu      (simulateData, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+90, "&Simulate 1");
        InsertMenu      (simulateData, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+91, "Simulate 1 To &File");
        InsertMenu      (simulateData, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+92, "Simulate &Many");

        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)simulateData, "&Simulation");
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATA_WIN32_MENU_BASE+5,"An&cestors");
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);
        InsertMenu      (dataMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+6,"&Font Options");

        if (dataPanelProcessors.lLength == 0) {
            InsertMenu      (dataMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, 0, "&Data Processing");
            DestroyMenu     (procMenu);
        } else {
            for (long k=0; k<dataPanelProcessors.lLength; k++) {
                _String *thisItem = (_String*)dataPanelProcessors (k),
                         chopped = thisItem->Cut (thisItem->FindBackwards ('\\',0,-1)+1,-1);

                InsertMenu      (procMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+100+k, chopped.sData);
            }
            InsertMenu      (dataMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)procMenu, "&Data Processing");
        }

        InsertMenu      (lfMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATALF_WIN32_MENU_BASE, "&Build\tCtrl-L");

        InsertMenu      (lfDisplayMode, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATALF_WIN32_MENU_BASE+50, "Log-Lkhd &Only");
        InsertMenu      (lfDisplayMode, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATALF_WIN32_MENU_BASE+51, "Log-Lkhd with &Parameter Values");
        InsertMenu      (lfDisplayMode, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATALF_WIN32_MENU_BASE+52, "Log-Lkhd with &Concise Trees");
        InsertMenu      (lfDisplayMode, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATALF_WIN32_MENU_BASE+53, "&Parameter Listing");
        InsertMenu      (lfDisplayMode, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATALF_WIN32_MENU_BASE+54, "Log-Lkhd with Complete &Trees");

        InsertMenu      (lfMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP|MF_GRAYED, (UINT)lfDisplayMode, "&Display");
        InsertMenu      (lfMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATALF_WIN32_MENU_BASE+1, "&Optimize\tCtrl-T");
        InsertMenu      (lfMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);
        InsertMenu      (lfMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATALF_WIN32_MENU_BASE+2, "&Show Parameters\tCtrl-H");
        InsertMenu      (lfMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);
        InsertMenu      (lfMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_DATALF_WIN32_MENU_BASE+3, "&General Bootstrap\tCtrl-B");

        if (omittedSeqs.lLength) {
            _OmitSelectedSpecies(omittedSeqs);
        }

        CheckMenuItem (blockMenu,(sp->blockWidth==10)?1:0,MF_CHECKED|MF_BYPOSITION);
        if (sp->nameDisplayFlags&HY_SEQUENCE_PANE_NAMES_ALL) {
            CheckMenuItem (nameDisplayMenu,2,MF_CHECKED|MF_BYPOSITION);
        } else if (sp->nameDisplayFlags&HY_SEQUENCE_PANE_NAMES_SHORT) {
            CheckMenuItem (nameDisplayMenu,1,MF_CHECKED|MF_BYPOSITION);
        } else {
            CheckMenuItem (nameDisplayMenu,0,MF_CHECKED|MF_BYPOSITION);
        }
        if (sp->showDots) {
            CheckMenuItem (repeatCharMenu,1,MF_CHECKED|MF_BYPOSITION);
        } else {
            CheckMenuItem (repeatCharMenu,0,MF_CHECKED|MF_BYPOSITION);
        }

        if (dataType&HY_DATAPANEL_NUCDATA) {
            EnableMenuItem (additionalInfo,2, MF_ENABLED|MF_BYPOSITION);
        }

        _UpdateLFMenu();

        InsertMenu   (windowMenu, 2, MF_BYPOSITION|MF_POPUP, (UINT) dataMenu , "&Data");

        InsertMenu      (saveSubMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+1, "&Save\tCtrl-S");
        InsertMenu      (saveSubMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+3, "Save &As");

        dataMenu =  GetSubMenu(windowMenu,0);

        ModifyMenu   (dataMenu, 0, MF_BYPOSITION|MF_POPUP, (UINT) saveSubMenu , "&Save");

        dataMenu =  GetSubMenu(windowMenu,1);
        InsertMenu   (dataMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_EDIT+6 ,  "&Find\tCtrl-F");
        InsertMenu   (dataMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_EDIT+7 ,  "&Search and &Replace");
        EnableMenuItem (dataMenu,2,MF_BYPOSITION|MF_ENABLED);
        EnableMenuItem (dataMenu,6,MF_BYPOSITION|MF_ENABLED);

        InsertMenu   (windowMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT) lfMenu , "&Likelihood");

        accels       << (FCONTROL|FVIRTKEY);
        accels       << 'F';
        accels       << HY_WINDOW_MENU_ID_EDIT+6;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << 'L';
        accels       << HY_DATALF_WIN32_MENU_BASE;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << 'T';
        accels       << HY_DATALF_WIN32_MENU_BASE+1;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << 'H';
        accels       << HY_DATALF_WIN32_MENU_BASE+2;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << 'B';
        accels       << HY_DATALF_WIN32_MENU_BASE+3;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << '1';
        accels       << HY_DATA_WIN32_MENU_BASE;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << '2';
        accels       << HY_DATA_WIN32_MENU_BASE+1;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << '3';
        accels       << HY_DATA_WIN32_MENU_BASE+2;

        _AddStandardAccels();
        _BuildAccelTable  (true);
        accels.Clear();
    }
    _VerifyInferMenu    ();
}
//__________________________________________________________________


bool        _HYDataPanel::_ProcessMenuSelection (long msel)
{
    if (_HYWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    _HYSequencePane* sp = (_HYSequencePane*)GetObject (0);
    _HYSequencePane* sp2 =(_HYSequencePane*)GetObject (4);
    _String     prompt;
    bool        done = false;
    HMENU       treeMenu;

    //printf ("Menu selection %d\n", msel);

    switch (msel) {
    case HY_WINDOW_MENU_ID_FILE+2: {
        _PrintData();
        done = true;
        break;
    }

    case HY_WINDOW_MENU_ID_EDIT+1: { // Copy
        _CopySelectionToClipboard   ();
        done = true;
        break;
    }

    case HY_WINDOW_MENU_ID_EDIT+5: { // Select All
        sp->SelectAll(true);
        done = true;
        break;
    }

    case HY_WINDOW_MENU_ID_EDIT+6: { // Find Function
        FindFunction();
        done = true;
        break;
    }

    case HY_WINDOW_MENU_ID_EDIT+7: { // Find Function
        HandleSearchAndReplace();
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE: { // Partition->Selection
        SelectPartition();
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+1: { // Selection->Partition
        if (sp->selection.lLength) {
            CreatePartition (sp->selection,1,true);
        }
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+2: { // Invert Selection
        InvertSelection();
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+3: { // Parition props
        PartitionPropsMenu ();
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+4: { // Input part
        InputPartitionString ();
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+5: { // Ancestors
        SimulateDataSet (0,true);
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+6: { // Ancestors
        HandleFontChange();
        done = true;
        break;
    }

    case HY_DATALF_WIN32_MENU_BASE: { // Build LF
        if (GetSubMenu (GetSubMenu (GetMenu (theWindow), 3), 0)) {
            InferTopologies ();
        } else {
            BuildLikelihoodFunction();
        }
        done = true;
        break;
    }

    case HY_DATALF_WIN32_MENU_BASE+1: { // Optimize LF
        OptimizeLikelihoodFunction();
        done = true;
        break;
    }

    case HY_DATALF_WIN32_MENU_BASE+2: { // Show Parameters
        DisplayParameterTable ();
        done = true;
        break;
    }

    case HY_DATALF_WIN32_MENU_BASE+3: { // General bootstrap
        //Uncomment when rdy
        OpenGeneralBSWindow ();
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+50: // Block size
    case HY_DATA_WIN32_MENU_BASE+51: {
        treeMenu       = GetSubMenu (GetSubMenu(GetMenu (theWindow),2), 4);
        long             newBlockSize;
        bool             is9 = (msel==HY_DATA_WIN32_MENU_BASE+50);

        if (is9) {
            newBlockSize = 9;
        } else {
            newBlockSize = 10;
        }

        if (sp->blockWidth!=newBlockSize) {
            sp->blockWidth = newBlockSize;
            sp2->blockWidth = newBlockSize;
            sp->BuildPane();
            sp->_MarkForUpdate();
            sp2->BuildPane();
            sp2->_MarkForUpdate();
            CheckMenuItem (treeMenu, 0, MF_BYPOSITION|(is9?MF_CHECKED:MF_UNCHECKED));
            CheckMenuItem (treeMenu, 1, MF_BYPOSITION|((!is9)?MF_CHECKED:MF_UNCHECKED));
        }
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+60: // Repeating character
    case HY_DATA_WIN32_MENU_BASE+61: {
        treeMenu = GetSubMenu (GetSubMenu(GetMenu (theWindow),2), 5);
        bool       newDisplay;
        if (msel==HY_DATA_WIN32_MENU_BASE+60) {
            newDisplay = false;
        } else {
            newDisplay = true;
        }

        if (sp->showDots!=newDisplay) {
            sp->showDots = newDisplay;
            sp->BuildPane();
            sp->_MarkForUpdate();
            CheckMenuItem (treeMenu, newDisplay, MF_BYPOSITION|MF_CHECKED);
            CheckMenuItem (treeMenu, !newDisplay, MF_BYPOSITION|MF_UNCHECKED);
        }
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+70: // Sequence names
    case HY_DATA_WIN32_MENU_BASE+71:
    case HY_DATA_WIN32_MENU_BASE+72:
    case HY_DATA_WIN32_MENU_BASE+73:
    case HY_DATA_WIN32_MENU_BASE+74:
    case HY_DATA_WIN32_MENU_BASE+75: {
        treeMenu = GetSubMenu (GetSubMenu(GetMenu (theWindow),2), 6);
        if (msel<=HY_DATA_WIN32_MENU_BASE+72) {
            unsigned char newDisplay;
            switch (msel) {
            case HY_DATA_WIN32_MENU_BASE+70:
                newDisplay = HY_SEQUENCE_PANE_NAMES_NONE;
                break;
            case HY_DATA_WIN32_MENU_BASE+71:
                newDisplay = HY_SEQUENCE_PANE_NAMES_SHORT;
                break;
            case HY_DATA_WIN32_MENU_BASE+72:
                newDisplay = HY_SEQUENCE_PANE_NAMES_ALL;

            }

            if ((sp->nameDisplayFlags&HY_SEQUENCE_PANE_NAMES_MASK)!=newDisplay) {
                CheckMenuItem (treeMenu, (sp->nameDisplayFlags&HY_SEQUENCE_PANE_NAMES_MASK), MF_BYPOSITION|MF_UNCHECKED);
                sp->SetNameDisplayMode(newDisplay,true);
                sp2->SetNameDisplayMode(newDisplay,true);
                BuildThermometer();
                BuildMarksPane();
                CheckMenuItem (treeMenu, newDisplay, MF_BYPOSITION|MF_CHECKED);
            }
        } else {
            if (msel==HY_DATA_WIN32_MENU_BASE+73) {
                sp->AlphabetizeSpecies();
            } else if (msel==HY_DATA_WIN32_MENU_BASE+74) {
                sp->RevertFileOrder();
            } else {
                sp->CleanUpSequenceNames();
            }
        }
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+80: // status lines
    case HY_DATA_WIN32_MENU_BASE+81: // status lines
    case HY_DATA_WIN32_MENU_BASE+82: // status lines
    case HY_DATA_WIN32_MENU_BASE+83: { // status lines
        treeMenu = GetSubMenu (GetSubMenu(GetMenu (theWindow),2), 8);
        if (AdjustStatusLine (msel-HY_DATA_WIN32_MENU_BASE-80)) {
            CheckMenuItem(treeMenu,msel-HY_DATA_WIN32_MENU_BASE-80,MF_BYPOSITION|MF_CHECKED);
        } else {
            CheckMenuItem(treeMenu,msel-HY_DATA_WIN32_MENU_BASE-80,MF_BYPOSITION|MF_UNCHECKED);
        }

        done = true;
        break;
    }

    case HY_DATALF_WIN32_MENU_BASE+50: // likelihood display
    case HY_DATALF_WIN32_MENU_BASE+51: // likelihood display
    case HY_DATALF_WIN32_MENU_BASE+52: // likelihood display
    case HY_DATALF_WIN32_MENU_BASE+53: // likelihood display
    case HY_DATALF_WIN32_MENU_BASE+54: { // likelihood display
        ComputeLikelihoodFunction (msel-HY_DATALF_WIN32_MENU_BASE-50);
        done = true;
        break;
    }

    case HY_DATA_WIN32_MENU_BASE+90: // simulate data set
    case HY_DATA_WIN32_MENU_BASE+91: // simulate data set
    case HY_DATA_WIN32_MENU_BASE+92: { // simulate data set
        SimulateDataSet (msel-HY_DATA_WIN32_MENU_BASE-90);
        done = true;
        break;
    }

    case HY_WINDOW_MENU_ID_FILE+1: // save/save as
    case HY_WINDOW_MENU_ID_FILE+3: { // save/save as
        SaveDataPanel (msel==HY_WINDOW_MENU_ID_FILE+1);
        done = true;
        break;
    }

    case HY_DATALF_WIN32_MENU_BASE+20: // infer
    case HY_DATALF_WIN32_MENU_BASE+21: { // infer
        InferTopologies (msel==HY_DATALF_WIN32_MENU_BASE+21);
        _VerifyInferMenu ();
        done = true;
        break;
    }

    default: {
        if (msel>=HY_DATA_WIN32_MENU_BASE+10000) {
            RestoreOmittedSequence(msel-HY_DATA_WIN32_MENU_BASE-10003);
            done = true;
            break;
        } else {
            if (msel >= HY_DATA_WIN32_MENU_BASE + 100) {
                ExecuteProcessor (msel-HY_DATA_WIN32_MENU_BASE-100);
                break;
            }
        }
    }
    }
    DrawMenuBar(theWindow);
    return done;
}

//__________________________________________________________________

void        _HYDataPanel::_PaintThermRect(bool update)
{
    navRect = ComputeNavRect();

    _HYCanvas* theCanvas = (_HYCanvas*)GetObject (1);

    HDC        windowDC = GetDC (theWindow);
    RECT       r;

    r.left   = navRect.left+theCanvas->rel.left+thermRect.left+1;
    r.right  = navRect.right+theCanvas->rel.left+thermRect.left-1;
    r.top    = navRect.top+theCanvas->rel.top+thermRect.top+1;
    r.bottom = navRect.bottom+theCanvas->rel.top+thermRect.top-1;

    HBRUSH     newBr  = CreateSolidBrush (RGB(255,151,51));


    FrameRect (windowDC,&r,newBr);
    InflateRect (&r, -1, -1);
    FrameRect (windowDC,&r,newBr);
    InflateRect (&r, 1, 1);

    DeleteObject (newBr);

    if (update) {
        HRGN        newClip = CreateRectRgn (r.left,r.top,r.right,r.bottom),
                    oldClip = CreateRectRgn (0,0,1,1);

        if (GetClipRgn (windowDC, oldClip) == 0) {
            DeleteObject (oldClip);
            oldClip = nil;
        }

        SelectClipRgn      (windowDC, nil);
        ExtSelectClipRgn   (windowDC, newClip,RGN_XOR);
        DeleteObject       (newClip);
        newClip = CreateRectRgn (r.left+2,r.top+2,r.right-2,r.bottom-2);
        ExtSelectClipRgn   (windowDC, newClip,RGN_OR);

        _HYRect rect;
        rect.left   = componentL.lData[1];
        rect.right  = componentR.lData[1];
        rect.top    = componentT.lData[1];
        rect.bottom = componentB.lData[1];
        rect.width  = (long)windowDC;
        theCanvas->_Paint((char*)&rect);

        SelectClipRgn (windowDC, oldClip);
        if (oldClip) {
            DeleteObject (oldClip);
        }
        DeleteObject (newClip);
    }

    ReleaseDC (theWindow, windowDC);
    _PaintLFStatus ();
}

//__________________________________________________________________

void        _HYDataPanel::_PaintLFStatus(void)
{
    HDC theDC = GetDC (theWindow);
    if (lfID<0) {
        _SimpleList goodP;
        bool    paintOrange = GenerateGoodPartitions (goodP);

        if (goodP.lLength) {
            _PaintTheCircle (paintOrange?orangeButtonIcon:yellowButtonIcon,theWindow, theDC);
        } else {
            _PaintTheCircle (redButtonIcon,theWindow, theDC);
        }
    } else {
        _PaintTheCircle (greenButtonIcon,theWindow, theDC);
    }

    ReleaseDC (theWindow, theDC);
}

//__________________________________________________________________

void        _HYDataPanel::_PrintData(void)
{
    DOCINFO                 di = {sizeof(DOCINFO), "HYPHY.out", NULL };
    PRINTDLG                pd;
    BOOL                    SuccessFlag;

    pd.lStructSize         = sizeof(PRINTDLG);
    pd.hwndOwner           = theWindow;
    pd.hDevMode            = NULL;
    pd.hDevNames           = NULL;
    pd.hDC                 = NULL;
    pd.Flags               = PD_COLLATE | PD_RETURNDC | PD_NOSELECTION;
    pd.nFromPage           = 1;
    pd.nToPage             = 0xffff;
    pd.nMinPage            = 1;
    pd.nMaxPage            = 0xffff;
    pd.nCopies             = 1;
    pd.hInstance           = NULL;
    pd.lCustData           = 0L;
    pd.lpfnPrintHook       = NULL;
    pd.lpfnSetupHook       = NULL;
    pd.lpPrintTemplateName = NULL;
    pd.lpSetupTemplateName = NULL;
    pd.hPrintTemplate      = NULL;
    pd.hSetupTemplate      = NULL;

    if (!PrintDlg(&pd)) {
        return;
    }

    if (pd.hDC == NULL) {
        pd.hDC = GetPrinterDeviceContext(theWindow);
    }


    EnableWindow(theWindow, FALSE);

    SuccessFlag   = TRUE;
    UserAbortFlag = FALSE;

    PrintDialogHandle = CreateDialog(GetModuleHandle(NULL), (LPCTSTR)"PrintDlgBox", theWindow,
                                     PrintDialogProc);
    SetDlgItemText(PrintDialogHandle, IDD_FNAME, "Table Printing...");

    SetAbortProc(pd.hDC, AbortProc);

    if (StartDoc(pd.hDC, &di) > 0) {
        _HYSequencePane* sp = (_HYSequencePane*)GetObject (0);
        HDC         windowDC = GetDC (theWindow);

        long        printW = GetDeviceCaps(pd.hDC, HORZRES),
                    printH = GetDeviceCaps(pd.hDC, VERTRES),

                    hRes = GetDeviceCaps(pd.hDC, LOGPIXELSX),
                    vRes = GetDeviceCaps(pd.hDC, LOGPIXELSY),

                    screenHRes = GetDeviceCaps(windowDC, LOGPIXELSX),
                    screenVRes = GetDeviceCaps(windowDC, LOGPIXELSY),

                    fromPage = pd.nMinPage,
                    toPage   = pd.nMaxPage;


        if (pd.Flags & PD_PAGENUMS) {
            fromPage = pd.nFromPage;
            toPage   = pd.nToPage;
        }

        ReleaseDC   (theWindow, windowDC);
        hRes = printW*((_Parameter)screenHRes/hRes);
        vRes = printH*((_Parameter)screenVRes/vRes);
        screenHRes = printW;
        screenVRes = printH;

        printW = hRes;
        printH = vRes;

        long
        vOffset = vOffset = sp->GetSlotHeight()*sp->speciesIndex.lLength+sp->GetSlotHeight()*3/2+1+20*(dataPartitions.lLength>0),
        cOffset = (printW-sp->headerWidth)/sp->charWidth,
        pageShift = printH/vOffset,
        sC = sp->startColumn,
        lC = sp->endColumn,
        sR = sp->startRow,
        lR = sp->endRow,
        sH = sp->settings.bottom,
        pageCount;

        _HYColor c1 = sp->backColor,
                 c2 = sp->headerColor,
                 bc = {0,0,0};


        sp->backColor   = (_HYColor) {
            255,255,255
        };
        sp->headerColor = (_HYColor) {
            255,255,255
        };
        cOffset     -= ((cOffset/sp->blockWidth)*2)/sp->charWidth;
        cOffset     = (cOffset/sp->blockWidth)*sp->blockWidth;
        pageShift   *= cOffset;
        if (sp->columnStrings.lLength%pageShift==0) {
            pageShift = sp->columnStrings.lLength / pageShift;
        } else {
            pageShift = sp->columnStrings.lLength / pageShift + 1;
        }

        if (toPage > pageShift) {
            toPage = pageShift;
        }


        sp->startColumn = 0;
        sp->endColumn = cOffset;
        sp->startRow = 0;
        sp->endRow = sp->speciesIndex.lLength;
        sp->settings.bottom = vOffset+5+HY_SCROLLER_WIDTH;

        for (pageCount = 1; pageCount<fromPage; pageCount++) {
            sp->endColumn       +=  printH/vOffset * cOffset;
            sp->startColumn     +=  printH/vOffset * cOffset;
        }

        RECT         hangover = {0,sp->headerWidth + cOffset * sp->charWidth + (cOffset * 2)/sp->blockWidth + 1,
                                 vOffset,printW
                                },
                     frame = {0,0,vOffset+1,hangover.left};

        if (sp->startColumn< sp->columnStrings.lLength)
            for (pageCount = fromPage; pageCount<=toPage; pageCount++) {
                pageShift       = vOffset;
                if (StartPage (pd.hDC) <= 0) {
                    SuccessFlag = FALSE;
                    break;
                }

                SetMapMode  (pd.hDC, MM_ISOTROPIC);
                SetWindowExtEx (pd.hDC, hRes, vRes,nil);
                SetViewportExtEx (pd.hDC, screenHRes, screenVRes, nil);
                HDC saveDC = sp->thePane;
                sp->thePane = pd.hDC;
                sp->_HYGraphicPane::SetFont     (sp->GetFont());
                sp->SetColor    (sp->GetColor());
                while (pageShift < printH) {
                    sp->BuildPane   (false);
                    if (dataPartitions.lLength) {
                        _HYRect          daFrame;
                        daFrame.top    = frame.bottom;
                        daFrame.bottom = frame.bottom + 20;
                        daFrame.left   = frame.left   + HY_SEQUENCE_PANE_CHAR_SPACING/2 + sp->headerWidth;
                        daFrame.right  = daFrame.left + cOffset*sp->charWidth + 2*(cOffset/sp->blockWidth) - HY_SCROLLER_WIDTH;
                        BuildThermometer (&daFrame);
                    }
                    sp->startColumn = sp->endColumn;
                    sp->endColumn += cOffset;
                    sp->SetColor (bc);
                    SetWindowOrgEx (pd.hDC,0,-pageShift,nil);
                    pageShift += vOffset;
                    if (sp->startColumn>=sp->columnStrings.lLength) {
                        break;
                    }
                }
                sp->thePane = saveDC;
                if (EndPage (pd.hDC) <= 0) {
                    SuccessFlag = FALSE;
                }
            }

        sp->startColumn = sC;
        sp->endColumn   = lC;
        sp->startRow    = sR;
        sp->endRow      = lR;
        sp->backColor   = c1;
        sp->headerColor = c2;
        sp->settings.bottom = sH;

    } else {
        SuccessFlag = FALSE;
    }

    if (SuccessFlag) {
        SuccessFlag = (EndDoc(pd.hDC)>0);
    }

    if (!UserAbortFlag) {
        EnableWindow(theWindow, TRUE);
        DestroyWindow(PrintDialogHandle);
    }

    DeleteDC (pd.hDC);

    if (!SuccessFlag && !UserAbortFlag) {
        _String errMsg = _String("Failed to print sequence data. Windows Error:") & (long)GetLastError();
        ProblemReport (errMsg,nil);
    }
}

//__________________________________________________________________

void _HYDataPanel::_VerifyInferMenu(void)
{
    HMENU       lfMenu          = GetSubMenu (GetMenu (theWindow), 3),
                inferSubMenu = GetSubMenu (lfMenu, 0);

    _SimpleList    gp;

    if (GenerateGoodPartitions(gp)) {
        if (!inferSubMenu) {
            inferSubMenu    = CreatePopupMenu ();
            checkPointer    (inferSubMenu);

            InsertMenu      (inferSubMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATALF_WIN32_MENU_BASE+20,
                             "&Infer Topology\tCtrl-L");
            InsertMenu      (inferSubMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATALF_WIN32_MENU_BASE+21,
                             "Infer Topology with Constraints");

            ModifyMenu      (lfMenu,0,MF_BYPOSITION|MF_POPUP,(UINT)inferSubMenu,"&Inference");
        }
    } else {
        if (inferSubMenu) {
            MENUITEMINFO    mInfo;
            mInfo.cbSize = sizeof (MENUITEMINFO);
            mInfo.fMask  = MIIM_SUBMENU;
            mInfo.hSubMenu = nil;
            SetMenuItemInfo (lfMenu, 0, true, &mInfo);

            ModifyMenu      (lfMenu,0,MF_BYPOSITION|MF_STRING,HY_DATALF_WIN32_MENU_BASE,"&Build\tCtrl-L");
            //ModifyMenu        (lfMenu,0,MF_BYPOSITION|MF_STRING,HY_DATALF_WIN32_MENU_BASE,"&Build\tCtrl-L");
            //DestroyMenu       (inferSubMenu);
        }
    }
    DrawMenuBar(theWindow);
}

//__________________________________________________________________

void _HYDataPanel::_UpdateLFMenu (void)
{
    HMENU      lfMenu   = GetSubMenu (GetMenu (theWindow), 3),
               dataMenu = GetSubMenu (GetMenu (theWindow), 2),

               addMenu  = GetSubMenu (dataMenu, 8);

    if (lfMenu && dataMenu && addMenu) {
        if (lfID>=0) {
            EnableMenuItem (lfMenu,1,MF_BYPOSITION|MF_ENABLED);
            EnableMenuItem (lfMenu,2,MF_BYPOSITION|MF_ENABLED);
            EnableMenuItem (lfMenu,4,MF_BYPOSITION|MF_ENABLED);
            EnableMenuItem (lfMenu,6,MF_BYPOSITION|MF_ENABLED);

            EnableMenuItem (dataMenu,13,MF_BYPOSITION|MF_ENABLED);
            EnableMenuItem (dataMenu,14,MF_BYPOSITION|MF_ENABLED);

            if (((_LikelihoodFunction*)likeFuncList (lfID))->GetCategoryVars().lLength) {
                EnableMenuItem (addMenu,1,MF_BYPOSITION|MF_ENABLED);
                DrawMenuBar(theWindow);
                return;
            }
        } else {
            EnableMenuItem (lfMenu,1,MF_BYPOSITION|MF_GRAYED);
            EnableMenuItem (lfMenu,2,MF_BYPOSITION|MF_GRAYED);
            EnableMenuItem (lfMenu,4,MF_BYPOSITION|MF_GRAYED);
            EnableMenuItem (lfMenu,6,MF_BYPOSITION|MF_GRAYED);

            EnableMenuItem (dataMenu,13,MF_BYPOSITION|MF_GRAYED);
            EnableMenuItem (dataMenu,14,MF_BYPOSITION|MF_GRAYED);
        }
        EnableMenuItem (addMenu,1,MF_BYPOSITION|MF_GRAYED);
    }
    DrawMenuBar(theWindow);
}

//__________________________________________________________________

void _HYDataPanel::_UpdateSelectionChoices (bool toggle)
{
    HMENU dataMenu  = GetSubMenu (GetMenu (theWindow), 2);

    if (toggle) {
        EnableMenuItem(dataMenu,1,MF_BYPOSITION|MF_ENABLED);
    } else {
        EnableMenuItem(dataMenu,1,MF_BYPOSITION|MF_GRAYED);
    }
    DrawMenuBar(theWindow);
}

//__________________________________________________________________

void _HYDataPanel::_CopySelectionToClipboard (void)
{
    _HYSequencePane*    sp = (_HYSequencePane*)GetObject(0);
    _String             cbStr (128L,true);

    if (sp->selection.lLength) {
        for (long m=0; m<sp->speciesIndex.lLength; m++) {
            long idx = sp->speciesIndex.lData[m];
            for (long k=0; k<sp->selection.lLength; k++) {
                cbStr << ((_String*)(sp->columnStrings(sp->selection.lData[k])))->sData[idx];
                if (k&&((k+1)%sp->blockWidth==0)) {
                    cbStr << ' ';
                }
            }
            cbStr << '\r';
            cbStr << '\n';
        }
    } else if (sp->vselection.lLength)
        for (long m=0; m<sp->vselection.lLength; m++) {
            cbStr << (_String*)(sp->rowHeaders(sp->speciesIndex(sp->vselection.lData[m])));
            cbStr << '\r';
            cbStr << '\n';
        }

    cbStr.Finalize();

    if (cbStr.sLength) {
        HGLOBAL TextHandle = GlobalAlloc(GHND, cbStr.sLength+1);
        if (TextHandle) {
            char *TextPtr = (char*)GlobalLock(TextHandle);
            char *SourcePtr = cbStr.sData;
            for (; *SourcePtr; SourcePtr++) {
                *TextPtr++ = *SourcePtr;
            }
            *TextPtr = '\0';
            GlobalUnlock(TextHandle);
            OpenClipboard(theWindow);
            EmptyClipboard();
            SetClipboardData(CF_TEXT, TextHandle);
            CloseClipboard();
        }
    }
}

//__________________________________________________________________

void _HYDataPanel::_OmitSelectedSpecies (_SimpleList& idx)
{
    HMENU      dataMenu       = GetSubMenu (GetMenu (theWindow), 2),
               omittedSpecies = GetSubMenu (dataMenu, 7);

    if (omittedSpecies) {
        _HYSequencePane*    sp = (_HYSequencePane*)GetObject(0);
        long                idxShift = 10001+GetMenuItemCount (omittedSpecies);

        for (long k=0; k<idx.lLength; k++) {
            _String*        thisSpec = (_String*)sp->rowHeaders(idx.lData[k]);
            InsertMenu      (omittedSpecies,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_DATA_WIN32_MENU_BASE+idxShift+k, thisSpec->sData);
        }

        EnableMenuItem (dataMenu,7, MF_BYPOSITION|MF_ENABLED);
        DrawMenuBar (theWindow);
    }
}

//__________________________________________________________________

void _HYDataPanel::_RestoreOmittedSequence (long index)
{
    HMENU      dataMenu       = GetSubMenu (GetMenu (theWindow), 2),
               omittedSpecies = GetSubMenu (dataMenu, 7);

    if (index>=0) {
        DeleteMenu  (omittedSpecies,index+2, MF_BYPOSITION);
        long        mic = GetMenuItemCount (omittedSpecies);

        MENUITEMINFO mi;
        mi.cbSize = sizeof (MENUITEMINFO);
        mi.fMask  = MIIM_ID;
        mi.wID    = HY_DATA_WIN32_MENU_BASE+10003+index;

        for (long k=index+2; k<mic; k++, mi.wID++) {
            SetMenuItemInfo (omittedSpecies, k, true, &mi);
        }

        if (mic==2) {
            EnableMenuItem (dataMenu,7, MF_BYPOSITION|MF_GRAYED);
        }
    } else {
        for (long k=0; k< omittedSeqs.lLength; k++) {
            DeleteMenu (omittedSpecies,2,MF_BYPOSITION);
        }

        EnableMenuItem (dataMenu,7, MF_BYPOSITION|MF_GRAYED);
    }
    DrawMenuBar (theWindow);
}

//__________________________________________________________________

void _HYDataPanel::_UpdatePartitionOperations (_SimpleList* sl)
{
    HMENU      dataMenu       = GetSubMenu (GetMenu (theWindow), 2);

    if (sl->lData[0]) {
        EnableMenuItem (dataMenu,0 , MF_BYPOSITION|MF_ENABLED);
        EnableMenuItem (dataMenu,10, MF_BYPOSITION|MF_ENABLED);
    } else {
        EnableMenuItem (dataMenu,0 , MF_BYPOSITION|MF_GRAYED);
        EnableMenuItem (dataMenu,10, MF_BYPOSITION|MF_GRAYED);
    }
    DrawMenuBar (theWindow);
}

//__________________________________________________________________

void _HYDataPanel::_UnsetMenuBar(void)
{
}

//__________________________________________________________________
bool _HYDataPanel::_ProcessOSEvent (Ptr vEvent)
{
    static  long        clickH   = 0;
    static  bool        isNavBar = false;

    if (!_HYTWindow::_ProcessOSEvent (vEvent)) {
        _HYWindowsUIMessage *theEvent = (_HYWindowsUIMessage*)vEvent;

        if ((theEvent->iMsg==WM_LBUTTONDOWN)||(theEvent->iMsg==WM_LBUTTONDBLCLK)
                ||(theEvent->iMsg==WM_RBUTTONDOWN)||(theEvent->iMsg==WM_MOUSEMOVE)) {
            int   ch = LOWORD(theEvent->lParam),
                  cv = HIWORD(theEvent->lParam),
                  c  = FindClickedCell(ch, cv);

            if (c<0) {
                return false;
            }

            _HYComponent* thisComponent = (_HYComponent*)components(c);

            if (c==1) { // navBar
                ch = ch-componentL.lData[1]-thermRect.left;
                cv = cv-componentT.lData[1]-thermRect.top;

                if (theEvent->iMsg==WM_LBUTTONDBLCLK) {
                    NavBarDblClick (ch);
                    return true;
                }
                if (navRect.Contains(ch,cv)||isNavBar) {
                    if ((theEvent->iMsg==WM_MOUSEMOVE)&&(theEvent->wParam & MK_LBUTTON)) {
                        isNavBar = true;
                        SetNavRectCenter (LOWORD(theEvent->lParam)-componentL.lData[1]-thermRect.left+clickH,0);
                    } else {
                        if (theEvent->iMsg==WM_LBUTTONDOWN) {
                            clickH = (navRect.right+navRect.left)/2-ch;
                        }
                        isNavBar = false;
                    }
                } else {
                    if (theEvent->iMsg==WM_LBUTTONDOWN) {
                        SetNavRectCenter (ch,cv);
                    }
                }

                //lastH = LOWORD(theEvent->lParam);
                //lastV = HIWORD(theEvent->lParam);

                return true;
            } else if ((c==4)&&(theEvent->iMsg==WM_RBUTTONDOWN)) {
                _HYSequencePane* sp2 = (_HYSequencePane*)components (4);
                sp2->ProcessContextualPopUp (ch,cv);
                return true;
            }
        } else if (theEvent->iMsg==WM_KEYDOWN) {
            TCHAR keyCode = theEvent->wParam;
            if ((keyCode==VK_LEFT)||(keyCode==VK_RIGHT)) { // left/right arrow
                _HYSequencePane* sp = (_HYSequencePane*) GetObject (0);
                if ((keyCode==VK_LEFT)&&(sp->startColumn)) {
                    sp->HScrollPane (-1);
                } else if ((keyCode==VK_RIGHT)&&(sp->endColumn<sp->columnStrings.lLength)) {
                    sp->HScrollPane (1);
                }
                return true;
            }
        } else if (theEvent->iMsg==WM_LBUTTONUP) {
            isNavBar = false;
            return   true;
        }
    } else {
        return true;
    }

    return false;
}



//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformGWindow.cpp b/src/gui/win/WindowClasses/HYPlatformGWindow.cpp
deleted file mode 100644
index 253c95c..0000000
--- a/src/gui/win/WindowClasses/HYPlatformGWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Graphics Window Object  for Win32 API

    Sergei L. Kosakovsky Pond, June 2000-December 2002
*/

#include "HYGWindow.h"
#include "HYEventTypes.h"
#include "HYUtils.h"

//__________________________________________________________________

void    _HYGWindow::_Paint (Ptr p)
{
    RECT srcRect,destRect;
    GetClientRect (theWindow,&destRect);
    destRect.right;
    destRect.bottom;
    int t,l,b,r;
    _VisibleContents (t,l,b,r);
    srcRect.top = t;
    srcRect.left = l;
    srcRect.bottom = b;
    srcRect.right = r;
    InvalidateRect (theWindow,&destRect,FALSE);
    PAINTSTRUCT      thePS;
    HDC theContext = BeginPaint (theWindow,&thePS);
    BitBlt (theContext,0,0,srcRect.right-srcRect.left,srcRect.bottom-srcRect.top,
            thePane,srcRect.left,srcRect.top,SRCCOPY);
    EndPaint (theWindow,&thePS);
}

//__________________________________________________________________

void    _HYGWindow::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________


bool        _HYGWindow::_ProcessMenuSelection (long msel)
{
    if (_HYWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    bool        done = false;
    switch (msel) {

    case HY_WINDOW_MENU_ID_EDIT+1: {
        _CopyToClipboard ();
        done = true;
    }
    break;

    case HY_WINDOW_MENU_ID_FILE+1: {
        _SavePicture (GetTitle());
        done = true;
    }
    break;
    }


    return done;
}

//__________________________________________________________________

void _HYGWindow::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();
    HMENU        fileHandle = GetSubMenu(GetMenu (theWindow),1);

    EnableMenuItem (fileHandle, 2, MF_BYPOSITION|MF_ENABLED);

    _AddStandardAccels();
    _BuildAccelTable  ();

    accels.Clear();
}

//__________________________________________________________________

void _HYGWindow::_UnsetMenuBar(void)
{
}


//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformModelWindow.cpp b/src/gui/win/WindowClasses/HYPlatformModelWindow.cpp
deleted file mode 100644
index c18bd39..0000000
--- a/src/gui/win/WindowClasses/HYPlatformModelWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Win32 Portions of the model window

    Sergei L. Kosakovsky Pond, Spring 2000 - February 2003.
*/

#include "HYModelWindow.h"
#include "HYUtils.h"

#define     HY_MDL_WIN32_MENU_BASE  9200

//__________________________________________________________________

void _HYModelWindow::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();

    HMENU     windowMenu = GetMenu (theWindow),
              ptMenu     = GetSubMenu(windowMenu,2);

    if (!ptMenu) {
        ptMenu = CreateMenu();

        HMENU        rateMenu = ListToPopUpMenu (rateOptions, HY_MDL_WIN32_MENU_BASE+99),
                     saveMenu = CreatePopupMenu ();

        checkPointer (ptMenu);
        checkPointer (rateMenu);
        checkPointer (saveMenu);

        CheckMenuItem (rateMenu, rateChoice, MF_BYPOSITION|MF_CHECKED);


        InsertMenu      (ptMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_MDL_WIN32_MENU_BASE, "&Model Name");
        InsertMenu      (ptMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)rateMenu, "&View Options");

        InsertMenu      (windowMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)ptMenu, "&Model");

        InsertMenu      (saveMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+1, "&Save\tCtrl-S");
        InsertMenu      (saveMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_FILE+3, "Save &As...");

        ModifyMenu   (GetSubMenu(windowMenu,0), 0, MF_BYPOSITION|MF_POPUP, (UINT) saveMenu , "&Save");

        _AddStandardAccels();
        _BuildAccelTable  (true);
        accels.Clear();

    }

    ptMenu = GetSubMenu (windowMenu,1);
    EnableMenuItem (ptMenu,6,MF_BYPOSITION|MF_ENABLED);
    EnableMenuItem (ptMenu,2,MF_BYPOSITION|MF_ENABLED);

    DrawMenuBar(theWindow);
}


//__________________________________________________________________

void _HYModelWindow::_UnsetMenuBar(void)
{
}

//__________________________________________________________________


bool        _HYModelWindow::_ProcessMenuSelection (long msel)
{
    switch (msel) {
    case HY_WINDOW_MENU_ID_FILE+1: // save menu
    case HY_WINDOW_MENU_ID_FILE+3: { // save as menu
        DoSave (msel-HY_WINDOW_MENU_ID_FILE-2);
        return true;
    }

    case HY_WINDOW_MENU_ID_FILE+2: { // print
        _HYTable* t = (_HYTable*)GetCellObject (MODEL_MATRIX_ROW,4);
        t->_PrintTable((_HYTable*)GetCellObject (MODEL_MATRIX_ROW-1,4));
        return true;
    }

    case HY_WINDOW_MENU_ID_EDIT+1: { // copy
        DoCopyCell ();
        return true;
    }

    case HY_WINDOW_MENU_ID_EDIT+3: { // paste
        DoPasteToCells();
        return true;
    }

    case HY_WINDOW_MENU_ID_EDIT+5: { // select all
        DoSelectAll();
        return true;
    }

    case HY_MDL_WIN32_MENU_BASE: { // model menu
        DoEditModelName ();
        return true;
    }

    default: { // rate menu
        msel -= HY_MDL_WIN32_MENU_BASE+100;
        if (msel>=0) {
            if (msel!=rateChoice) {
                HMENU           rateMenu = GetSubMenu (GetSubMenu (GetMenu (theWindow),2),1);
                CheckMenuItem   (rateMenu,rateChoice,MF_BYPOSITION|MF_UNCHECKED);
                rateChoice = msel;
                CheckMenuItem   (rateMenu,rateChoice,MF_BYPOSITION|MF_CHECKED);
                taint = true;
                DrawMenuBar(theWindow);
            }
        }
        return true;
    }
    }

    if (_HYTWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    return false;
}

//__________________________________________________________________

void _HYModelWindow::_UpdateEditMenu (bool c, bool p)
{
    HMENU  t = GetSubMenu (GetMenu (theWindow),2);
    if (c) {
        EnableMenuItem (t,2,MF_BYPOSITION|MF_ENABLED);
    } else {
        EnableMenuItem (t,2,MF_BYPOSITION|MF_GRAYED);
    }
    if (p) {
        EnableMenuItem (t,4,MF_BYPOSITION|MF_ENABLED);
    } else {
        EnableMenuItem (t,4,MF_BYPOSITION|MF_GRAYED);
    }

    DrawMenuBar(theWindow);
}

//__________________________________________________________________

bool _HYModelWindow::_CheckClipboard (void)
{
    clipboardString = empty;
    HANDLE  scrapHandle = GetClipboardData (CF_TEXT);

    if (scrapHandle) {
        _String cText ((char*)scrapHandle);
        skipWarningMessages = true;
        _Formula f (cText,nil,false);
        skipWarningMessages = false;
        if (f.GetList().lLength) {
            clipboardString = cText;
            SyncEditBox ();
        }
    }
    return clipboardString.sLength;
}

//__________________________________________________________________

void _HYModelWindow::_SetClipboard (void)
{
    if (clipboardString.sLength) {
        PlaceStringInClipboard (clipboardString, (Ptr)theWindow);
    }
}

//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformPWindow.cpp b/src/gui/win/WindowClasses/HYPlatformPWindow.cpp
deleted file mode 100644
index 3d00b1b..0000000
--- a/src/gui/win/WindowClasses/HYPlatformPWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Win32 Portions of the picture window class

    Sergei L. Kosakovsky Pond, Spring 2000 - January 2003.
*/

#include "HYGWindow.h"
#include "HYCanvas.h"
#include "errorfns.h"
#include "HYDialogs.h"

#define  HY_PWINDOW_WIN32_MENU_BASE  9000


//__________________________________________________________________
// _HYPlatformPWindow
//__________________________________________________________________

_HYPlatformPWindow::_HYPlatformPWindow          (void)
{
    savedPic  = nil;
    stashedDC = nil;
}

//__________________________________________________________________

_HYPlatformPWindow::~_HYPlatformPWindow         (void)
{
    if (savedPic) {
        DeleteEnhMetaFile (savedPic);
    }
}

//__________________________________________________________________

void    _HYPlatformPWindow::_StartPicture   (void)
{
    _HYPWindow*     theParent = (_HYPWindow*)    this;

    HDC             oldDC = theParent->thePane;

    if (savedPic) {
        DeleteEnhMetaFile (savedPic);
    }

    long    iXMM = GetDeviceCaps (oldDC, HORZSIZE),
            iYMM = GetDeviceCaps (oldDC, VERTSIZE),
            iXPX = GetDeviceCaps (oldDC, HORZRES),
            iYPX = GetDeviceCaps (oldDC, VERTRES);

    RECT    bounds = {0,0, (theParent->w*100*iXMM)/iXPX,
                      (theParent->h*100*iYMM)/iYPX
                     };



    if (!(oldDC = CreateEnhMetaFile (NULL, NULL, &bounds, NULL))) {
        _String errMsg = _String ("Failed to create an enhanced meta file in call to _StartPicture. Windows Error:") & (long)GetLastError() & '.';
        WarnError (errMsg);
        return;
    }

    stashedDC = theParent->thePane;
    theParent->thePane = oldDC;
    SetBkMode (oldDC, TRANSPARENT);
}

//__________________________________________________________________

void    _HYPlatformPWindow::_EndPicture     (void)
{
    if (stashedDC) {
        _HYPWindow*     theParent = (_HYPWindow*)    this;
        savedPic = CloseEnhMetaFile (theParent->thePane);

        RECT    bounds = {0,0, theParent->w,
                          theParent->h
                         };


        theParent->thePane = stashedDC;
        PlayEnhMetaFile (stashedDC, savedPic, &bounds);
        stashedDC = nil;
    }
}

//__________________________________________________________________

void    _HYPlatformPWindow::_DrawPicture    (_HYRect r)
{
    RECT R = HYRect2Rect (r);
    if (savedPic) {
        PlayEnhMetaFile (((_HYPWindow*)this)->thePane, savedPic, &R);
    }
}

//__________________________________________________________________
// _HYPWindow
//__________________________________________________________________

void        _HYPWindow::_PrintPWindow(void)
{
    DOCINFO                 di = {sizeof(DOCINFO), "HYPHY.out", NULL };
    PRINTDLG                pd;
    BOOL                    SuccessFlag;

    pd.lStructSize         = sizeof(PRINTDLG);
    pd.hwndOwner           = theWindow;
    pd.hDevMode            = NULL;
    pd.hDevNames           = NULL;
    pd.hDC                 = NULL;
    pd.Flags               = PD_COLLATE | PD_RETURNDC | PD_NOSELECTION;
    pd.nFromPage           = 1;
    pd.nToPage             = 0xffff;
    pd.nMinPage            = 1;
    pd.nMaxPage            = 0xffff;
    pd.nCopies             = 1;
    pd.hInstance           = NULL;
    pd.lCustData           = 0L;
    pd.lpfnPrintHook       = NULL;
    pd.lpfnSetupHook       = NULL;
    pd.lpPrintTemplateName = NULL;
    pd.lpSetupTemplateName = NULL;
    pd.hPrintTemplate      = NULL;
    pd.hSetupTemplate      = NULL;

    if (!PrintDlg(&pd)) {
        return;
    }

    if (pd.hDC == NULL) {
        pd.hDC = GetPrinterDeviceContext(theWindow);
    }


    EnableWindow(theWindow, FALSE);

    SuccessFlag   = TRUE;
    UserAbortFlag = FALSE;

    PrintDialogHandle = CreateDialog(GetModuleHandle(NULL), (LPCTSTR)"PrintDlgBox", theWindow,
                                     PrintDialogProc);
    SetDlgItemText(PrintDialogHandle, IDD_FNAME, "Chart Printing...");

    SetAbortProc(pd.hDC, AbortProc);

    if (StartDoc(pd.hDC, &di) > 0) {
        HDC         windowDC = GetDC (theWindow);

        long        printW = GetDeviceCaps(pd.hDC, HORZRES),
                    printH = GetDeviceCaps(pd.hDC, VERTRES),

                    hRes = GetDeviceCaps(pd.hDC, LOGPIXELSX),
                    vRes = GetDeviceCaps(pd.hDC, LOGPIXELSY),

                    screenHRes = GetDeviceCaps(windowDC, LOGPIXELSX),
                    screenVRes = GetDeviceCaps(windowDC, LOGPIXELSY),

                    fromPage = pd.nMinPage,
                    toPage   = pd.nMaxPage;


        if (pd.Flags & PD_PAGENUMS) {
            fromPage = pd.nFromPage;
            toPage   = pd.nToPage;
        }

        ReleaseDC   (theWindow, windowDC);
        hRes = printW*((_Parameter)screenHRes/hRes);
        vRes = printH*((_Parameter)screenVRes/vRes);
        screenHRes = printW;
        screenVRes = printH;

        printW = hRes;
        printH = vRes;

        if (StartPage (pd.hDC) <= 0) {
            SuccessFlag = FALSE;
        } else {
            SetMapMode  (pd.hDC, MM_ISOTROPIC);
            SetWindowExtEx (pd.hDC, hRes, vRes,nil);
            SetViewportExtEx (pd.hDC, screenHRes, screenVRes, nil);

            _Parameter sx = 1., sy = 1.;

            if (printW<w) {
                sx = (_Parameter)printW/w;
            }
            if (printH<h) {
                sy = (_Parameter)printH/h;
            }

            if (sx>sy) {
                sx = sy;
            } else {
                sy = sx;
            }

            _HYRect         drect = {0,0,h*sy,w*sx,0};
            drect.left   = (printW-drect.right)/2;
            drect.right += drect.left;
            drect.top    = (printH-drect.bottom)/2;
            drect.bottom+= drect.top;

            HDC         saveDC = thePane;

            thePane = pd.hDC;
            _DrawPicture    (drect);
            thePane = saveDC;

            if (EndPage (pd.hDC) <= 0) {
                SuccessFlag = FALSE;
            }
        }
    } else {
        SuccessFlag = FALSE;
    }

    if (SuccessFlag) {
        SuccessFlag = (EndDoc(pd.hDC)>0);
    }

    if (!UserAbortFlag) {
        EnableWindow(theWindow, TRUE);
        DestroyWindow(PrintDialogHandle);
    }

    DeleteDC (pd.hDC);

    if (!SuccessFlag && !UserAbortFlag) {
        _String errMsg = _String("Failed to print the picture. Windows Error:") & (long)GetLastError();
        ProblemReport (errMsg,nil);
    }
}

//__________________________________________________________________

void _HYPWindow::_SetWindowRectangle(int top, int left, int bottom, int right, bool ss)
{
    _HYPlatformWindow::_SetWindowRectangle (top,left,bottom,right, ss);
    SetPaneSize     (bottom-top,right-left,depth);
    SetContentSize  (right-left,bottom-top);
}

//__________________________________________________________________

void    _HYPWindow::_Paint (Ptr p)
{
    RECT          srcRect  = {0,0,w,h},
                  destRect = srcRect;

    InvalidateRect (theWindow,&destRect,FALSE);
    PAINTSTRUCT      thePS;
    HDC theContext = BeginPaint (theWindow,&thePS);
    BitBlt (theContext,0,0,srcRect.right-srcRect.left,srcRect.bottom-srcRect.top,
            thePane,srcRect.left,srcRect.top,SRCCOPY);
    EndPaint (theWindow,&thePS);


}

//__________________________________________________________________

void    _HYPWindow::_Update (Ptr p)
{
    _Paint (p);
}

//__________________________________________________________________

long _HYPWindow::_Grow(Ptr theData)
{
    _HYPlatformWindow::_Grow (theData);
    RECT myDims;
    GetClientRect (theWindow,&myDims);

    SetWindowRectangle (0,0,myDims.bottom,myDims.right,false);

    GetClientRect  (theWindow,&myDims);
    InvalidateRect (theWindow,&myDims,false);
    return 0;
}

//__________________________________________________________________

bool        _HYPWindow::_ProcessMenuSelection (long msel)
{
    if (_HYWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    bool        done = false;

    switch (msel) {
    case HY_WINDOW_MENU_ID_FILE+2:
        _PrintPWindow();
        done = true;
        break;

    case HY_PWINDOW_WIN32_MENU_BASE:
        Zoom (1.1);
        done = true;
        break;

    case HY_PWINDOW_WIN32_MENU_BASE+1:
        Zoom (.9);
        done = true;
        break;

    case HY_PWINDOW_WIN32_MENU_BASE+2:
        OriginalSize();
        done = true;
        break;
    }

    if (!done) {
        return _HYGWindow::_ProcessMenuSelection (msel);
    }

    return done;
}

//__________________________________________________________________

void _HYPWindow::_SetMenuBar(void)
{

    _HYGWindow::_SetMenuBar();

    HMENU            windowMenu = GetMenu (theWindow),
                     chartMenu =  GetSubMenu(windowMenu,2);

    if (!chartMenu) {
        chartMenu   = CreateMenu();

        InsertMenu   (chartMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PWINDOW_WIN32_MENU_BASE  , "&Enlarge\tCtrl-1");
        InsertMenu   (chartMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PWINDOW_WIN32_MENU_BASE+1, "&Shrink\tCtrl-2");
        InsertMenu   (chartMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PWINDOW_WIN32_MENU_BASE+2, "&Original Size\tCtrl-3");

        InsertMenu   (windowMenu, 2, MF_BYPOSITION|MF_POPUP, (UINT) chartMenu , "&Image");


        accels       << (FCONTROL|FVIRTKEY);
        accels       << '1';
        accels       << HY_PWINDOW_WIN32_MENU_BASE;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << '2';
        accels       << HY_PWINDOW_WIN32_MENU_BASE+1;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << '3';
        accels       << HY_PWINDOW_WIN32_MENU_BASE+2;

        _AddStandardAccels();
        _BuildAccelTable  (true);
        accels.Clear();
    }

    DrawMenuBar(theWindow);

}

//__________________________________________________________________

void _HYPWindow::_UnsetMenuBar(void)
{

}

//__________________________________________________________________

bool _HYPWindow::_ProcessOSEvent (Ptr vEvent)
{
    _HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;

    switch (theEvent->iMsg) {
    case WM_GETMINMAXINFO:

        MINMAXINFO* windowInfo = (MINMAXINFO*)theEvent->lParam;

        windowInfo->ptMinTrackSize.x = 10;
        windowInfo->ptMinTrackSize.y = 10;
        windowInfo->ptMaxSize.x=windowInfo->ptMaxTrackSize.x = 0x7777;
        windowInfo->ptMaxSize.y=windowInfo->ptMaxTrackSize.y = 0x7777;

        return false;
        break;
    }

    return _HYPlatformWindow::_ProcessOSEvent (vEvent);
}

//__________________________________________________________________
//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformParameterTable.cpp b/src/gui/win/WindowClasses/HYPlatformParameterTable.cpp
deleted file mode 100644
index 66a7c8a..0000000
--- a/src/gui/win/WindowClasses/HYPlatformParameterTable.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Win32 Portions of the parameter table class

    Sergei L. Kosakovsky Pond, Spring 2000 - January 2003.
*/

#include "HYParameterTable.h"
#include "HYUtils.h"

#define     HY_PT_WIN32_MENU_BASE  9000

//__________________________________________________________________

void _HYParameterTable::_SetMenuBar(void)
{
    _HYWindow::_SetMenuBar();

    HMENU     windowMenu = GetMenu (theWindow),
              ptMenu     = GetSubMenu(windowMenu,2);

    if (!ptMenu) {
        ptMenu = CreateMenu();
        HMENU viewMenu = CreatePopupMenu ();

        checkPointer (ptMenu);
        checkPointer (viewMenu);

        InsertMenu      (viewMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+10, "&Local Parameters");
        InsertMenu      (viewMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+11, "&Global Parameters");
        InsertMenu      (viewMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+12, "&Constrained Parameters");
        InsertMenu      (viewMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+13, "&Rate Classes");
        InsertMenu      (viewMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+14, "&Trees");

        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)viewMenu, "&View Options");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_SEPARATOR, 0, nil);
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE  , "&Recalculate LF\tCtrl-U");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+1, "&Optimize LF\tCtrl-T");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_SEPARATOR, 0, nil);
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+2, "&Enter Command");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+3, "Remove &Unused Parameters");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_SEPARATOR, 0, nil);
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+4, "Covariance, Sampler and C&I");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+5, "Likelihood Pro&file Plot");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_SEPARATOR, 0, nil);
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+6, "Cate&gories Processor");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_SEPARATOR, 0, nil);
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+7, "Sele&ct Parameters");
        InsertMenu      (ptMenu,    0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_PT_WIN32_MENU_BASE+8, "Open Selection in &Table");

        _UpdateViewMenu();

        InsertMenu      (windowMenu, 2, MF_BYPOSITION|MF_POPUP, (UINT) ptMenu , "&Likelihood");

        accels       << (FCONTROL|FVIRTKEY);
        accels       << 'U';
        accels       << HY_PT_WIN32_MENU_BASE;

        accels       << (FCONTROL|FVIRTKEY);
        accels       << 'T';
        accels       << HY_PT_WIN32_MENU_BASE+1;


        _AddStandardAccels();
        _BuildAccelTable  (true);
        accels.Clear();

    }

    ptMenu = GetSubMenu (windowMenu,1);
    EnableMenuItem (ptMenu,6,MF_BYPOSITION|MF_ENABLED);
    if (undoCommands.lLength) {
        EnableMenuItem (ptMenu,0,MF_BYPOSITION|MF_ENABLED);
    }

    DrawMenuBar(theWindow);
}

//__________________________________________________________________


bool        _HYParameterTable::_ProcessMenuSelection (long msel)
{

    _HYTable*   table = (_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW,0);
    bool        res = false;

    switch (msel) {
    case HY_WINDOW_MENU_ID_FILE+1: { // save
        DoSave ();
        res = true;
        break;
    }
    case HY_WINDOW_MENU_ID_FILE+2: { // print
        _SimpleList columns,
                    sel;
        columns << 0;
        columns << 1;
        columns << 2;
        columns << 3;
        table->GetSelection (sel);
        char    resp = 3;
        if (sel.lLength) {
            _String pr ("Would you like to print only the selected cells? (Click \"No\" to print the entire table).");
            resp = YesNoCancelPrompt (pr);
        }
        if (resp == 3) {
            table->_PrintTable(columns,(_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW-1,0));
        } else if (resp == 1) {
            _SimpleList rows;
            for (long k = 0; k < sel.lLength; k+=4) {
                rows << sel.lData[k]/4;
            }
            table->_PrintTable(columns,rows,(_HYTable*)GetCellObject(HY_PARAMETER_TABLE_TABLE_ROW-1,0));
        }
        res = true;
        break;
    }

    case HY_WINDOW_MENU_ID_EDIT: { // undo
        UndoCommand();
        _UpdateUndoMenu (nil,nil);
        res = true;
        break;
    }

    case HY_WINDOW_MENU_ID_EDIT+5: { // undo
        SelectAll();
        res = true;
        break;
    }

    case HY_PT_WIN32_MENU_BASE+10:
    case HY_PT_WIN32_MENU_BASE+11:
    case HY_PT_WIN32_MENU_BASE+12:
    case HY_PT_WIN32_MENU_BASE+13: {
        res = true;
        char   toggleFlag;
        msel -= HY_PT_WIN32_MENU_BASE+10;
        switch (msel) {
        case 0:
            toggleFlag = HY_PARAMETER_TABLE_VIEW_LOCAL;
            break;
        case 1:
            toggleFlag = HY_PARAMETER_TABLE_VIEW_GLOBAL;
            break;
        case 2:
            toggleFlag = HY_PARAMETER_TABLE_VIEW_CONSTRAINED;
            break;
        case 3:
            toggleFlag = HY_PARAMETER_TABLE_VIEW_CATEGORY;
            break;

        }
        if (viewOptions&toggleFlag) {
            if (viewOptions-toggleFlag) {
                viewOptions-=toggleFlag;
            } else {
                break;
            }
        } else {
            viewOptions+=toggleFlag;
        }

        CheckMenuItem (GetSubMenu(GetSubMenu (GetMenu (theWindow),2),0),msel,MF_BYPOSITION|((viewOptions&toggleFlag)?MF_CHECKED:MF_UNCHECKED));
        ConstructTheTable();
        SetWindowRectangle (top,left,bottom,right);
        break;
    }

    case HY_PT_WIN32_MENU_BASE+1:
        OptimizeLikelihoodFunction();
        res = true;
        break;

    case HY_PT_WIN32_MENU_BASE+2:
        DoEnterConstraint ();
        res = true;
        break;

    case HY_PT_WIN32_MENU_BASE+3:
        DoCleanUp   ();
        res = true;
        break;

    case HY_PT_WIN32_MENU_BASE+4:
        HandleVarianceEstimates ();
        res = true;
        break;

    case HY_PT_WIN32_MENU_BASE+5:
        HandleProfilePlot   ();
        res = true;
        break;

    case HY_PT_WIN32_MENU_BASE+6:
        HandleCategories    ();
        res = true;
        break;

    case HY_PT_WIN32_MENU_BASE+7:
        HandleSelectParameters  ();
        res = true;
        break;

    case HY_PT_WIN32_MENU_BASE+8:
        HandleOpenInChart   ();
        res = true;
        break;
    }

    if (!res) {
        res = _HYTWindow::_ProcessMenuSelection(msel);
    }
    DrawMenuBar (theWindow);
    return res;
}

//__________________________________________________________________

void _HYParameterTable::_UpdateViewMenu(void)
{
    HMENU viewMenu = GetSubMenu(GetSubMenu (GetMenu (theWindow),2),0);

    if (!(avViewOptions&HY_PARAMETER_TABLE_VIEW_GLOBAL)) {
        EnableMenuItem (viewMenu,1,MF_BYPOSITION|MF_GRAYED);
    } else {
        EnableMenuItem (viewMenu,1,MF_BYPOSITION|MF_ENABLED);
    }


    if (!(avViewOptions&HY_PARAMETER_TABLE_VIEW_CONSTRAINED)) {
        EnableMenuItem (viewMenu,2,MF_BYPOSITION|MF_GRAYED);
    } else {
        EnableMenuItem (viewMenu,2,MF_BYPOSITION|MF_ENABLED);
    }

    if (!(avViewOptions&HY_PARAMETER_TABLE_VIEW_CATEGORY)) {
        EnableMenuItem (viewMenu,3,MF_BYPOSITION|MF_GRAYED);
    } else {
        EnableMenuItem (viewMenu,3,MF_BYPOSITION|MF_ENABLED);
    }

    if (!(avViewOptions&HY_PARAMETER_TABLE_VIEW_TREES)) {
        EnableMenuItem (viewMenu,4,MF_BYPOSITION|MF_GRAYED);
    } else {
        EnableMenuItem (viewMenu,4,MF_BYPOSITION|MF_ENABLED);
    }

    CheckMenuItem (viewMenu,0,MF_BYPOSITION|((viewOptions&HY_PARAMETER_TABLE_VIEW_LOCAL)?MF_CHECKED:MF_UNCHECKED));
    CheckMenuItem (viewMenu,1,MF_BYPOSITION|((viewOptions&HY_PARAMETER_TABLE_VIEW_GLOBAL)?MF_CHECKED:MF_UNCHECKED));
    CheckMenuItem (viewMenu,2,MF_BYPOSITION|((viewOptions&HY_PARAMETER_TABLE_VIEW_CONSTRAINED)?MF_CHECKED:MF_UNCHECKED));
    CheckMenuItem (viewMenu,3,MF_BYPOSITION|((viewOptions&HY_PARAMETER_TABLE_VIEW_CATEGORY)?MF_CHECKED:MF_UNCHECKED));
    CheckMenuItem (viewMenu,4,MF_BYPOSITION|((viewOptions&HY_PARAMETER_TABLE_VIEW_TREES)?MF_CHECKED:MF_UNCHECKED));
}


//__________________________________________________________________

void _HYParameterTable::_UnsetMenuBar(void)
{
}

//__________________________________________________________________

void _HYParameterTable::_UpdateUndoMenu(_String* command, _String* desc)
{
    HMENU editMenu = GetSubMenu (GetMenu (theWindow),1);
    if (command&&desc) {
        undoCommands        &&  command;
        undoDescriptions    &&  desc;
        _String       temp = _String('&') & *desc & "\tCtrl-Z";
        ModifyMenu    (editMenu,0,MF_BYPOSITION|MF_STRING|MF_ENABLED, HY_WINDOW_MENU_ID_EDIT, temp.sData);
    } else {
        if (undoDescriptions.lLength==0) {
            ModifyMenu    (editMenu,0,MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_WINDOW_MENU_ID_EDIT, "Can't &Undo\tCtrl-Z");
        } else {
            _String       temp = _String('&') & *(_String*)undoDescriptions(undoDescriptions.lLength-1) & "\tCtrl-Z";
            ModifyMenu    (editMenu,0,MF_BYPOSITION|MF_STRING|MF_ENABLED, HY_WINDOW_MENU_ID_EDIT, temp.sData);
        }
    }
    DrawMenuBar(theWindow);
}

//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformTWindow.cpp b/src/gui/win/WindowClasses/HYPlatformTWindow.cpp
deleted file mode 100644
index cc048f5..0000000
--- a/src/gui/win/WindowClasses/HYPlatformTWindow.cpp
+++ /dev/null
@@ -1 +0,0 @@
-/*
    Container Window Object  for Win32 API

    Sergei L. Kosakovsky Pond, June 2000-December 2002
*/

#include "HYWindow.h"
#include "HYEventTypes.h"
#include "HYTableWindow.h"
#include "HYUtils.h"


//__________________________________________________________________

HFONT           _HY_StatusBarFont = //CreateFont (12,0,0,0,0,0,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
    //CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,"Times Roman");
    CreateFont (10,0,0,0,400,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
                CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,"MS Sans Serif");


HPEN            _BLACKPEN_        = CreatePen  (PS_SOLID,1,RGB(0,0,0));

//__________________________________________________________________

VOID CALLBACK IdleWindowTimer (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
    if (idEvent == IDLE_WINDOW_TIMER) {
        _HYTWindow * myTW = (_HYTWindow*)windowObjects(windowPtrs.Find((long)hwnd));
        for (long k=0; k<myTW->components.lLength; k++)
            if (myTW->cells.Find(k)>=0) {
                _HYComponent* tC = (_HYComponent*)myTW->components(k);
                tC->IdleHandler();
            }

        myTW->_HandleIdleEvent ();
    }
}

//__________________________________________________________________

long _HYTWindow::_Grow(Ptr theData)
{
    RECT myDims;
    GetClientRect (theWindow,&myDims);

    SetWindowRectangle (0,0,myDims.bottom,myDims.right,false);

    GetClientRect  (theWindow,&myDims);
    InvalidateRect (theWindow,&myDims,false);

    return 0;
}

//__________________________________________________________________

void _HYTWindow::_PaintStatusBar(Ptr hdc, bool)
{
    if ((flags&HY_WINDOW_SCROLL)==0) {
        RECT clearRect;
        GetClientRect (theWindow, &clearRect);

        clearRect.left--;
        clearRect.top = clearRect.bottom-HY_SCROLLER_WIDTH;
        clearRect.bottom++;

        HDC      windowContext;

        if (hdc) {
            windowContext = (HDC)hdc;
        } else {
            windowContext = GetDC (theWindow);
        }

        FillRect (windowContext, &clearRect, windowStatusBarBrush);

        HPEN     savePen = (HPEN)SelectObject (windowContext, _BLACKPEN_);

        /*MoveToEx (windowContext,clearRect.left,clearRect.top,NULL);
        LineTo (windowContext,clearRect.right,clearRect.top);*/

        DrawEdge (windowContext, &clearRect, EDGE_SUNKEN, BF_TOP);

        SelectObject (windowContext, savePen);

        if (statusBar.sLength) {
            UINT  saveAlign  = GetTextAlign (windowContext);
            int   saveBkMode = GetBkMode (windowContext);

            SetTextAlign (windowContext, TA_BASELINE);
            SetBkMode    (windowContext, TRANSPARENT);
            HFONT saveFont = (HFONT)SelectObject (windowContext, _HY_StatusBarFont);

            TextOut (windowContext, (flags&HY_WINDOW_STATUS_BAR_LIGHT_LEFT)?20:5,
                     clearRect.bottom-4, statusBar.sData, statusBar.sLength);

            SetBkMode    (windowContext, saveBkMode);
            SelectObject (windowContext, saveFont);
            SetTextAlign (windowContext, saveAlign);
        }

        if (!hdc) {
            ReleaseDC (theWindow,windowContext);
        }
    }
}

//__________________________________________________________________

void _HYTWindow::_Paint(Ptr)
{
    if (!GetUpdateRect(theWindow,NULL,FALSE)) {
        return;
    }
    PAINTSTRUCT      thePS;
    HDC theContext = BeginPaint (theWindow,&thePS);
    _HYRect  relRect;
    relRect.width = (long)theContext;

    _SimpleList     alreadyDone (components.lLength);

    for (int k=0; k<cells.lLength; k++) {
        long i = cells.lData[k];

        if (alreadyDone.lData[i] == 0) {
            relRect.left = componentL.lData[i];
            relRect.right = componentR.lData[i];
            relRect.top = componentT.lData[i];
            relRect.bottom = componentB.lData[i];
            ((_HYComponent*)components(i))->Update((Ptr)&relRect);
            alreadyDone.lData[i] = 1;
        }
    }
    if(flags&HY_WINDOW_SIZE) {
        _PaintStatusBar((Ptr)theContext);
    }

    EndPaint (theWindow,&thePS);
}

//__________________________________________________________________

void _HYTWindow::_Update(Ptr)
{
    _Paint(nil);
}


//__________________________________________________________________
void        _HYTWindow::_SetStatusBar(_String& text)
{
    statusBar = text;
    _PaintStatusBar();
}

//__________________________________________________________________

bool _HYTWindow::_ProcessOSEvent (Ptr vEvent)
{
    _HYWindowsUIMessage * theEvent = (_HYWindowsUIMessage *)vEvent;
    long       invisPixels;
    long       currentValue, oldValue;
    POINT      localPoint;
    int        c;
    RECT       bigR, smallR;
    MINMAXINFO* windowInfo;

    switch (theEvent->iMsg) {
    case WM_HSCROLL:
    case WM_VSCROLL: {
        HWND sW = (HWND)theEvent->lParam;
        if (sW) {
            for (int i=0; i<components.lLength; i++) {
                _HYComponent *thisC = (_HYComponent*)components(i);
                if ((thisC->hScroll==sW)||(thisC->vScroll==sW)) {
                    return thisC->_ProcessOSEvent (vEvent);
                }
            }
        }
        return true;
    }

    case WM_LBUTTONDOWN:
    case WM_LBUTTONDBLCLK:
    case WM_RBUTTONDBLCLK:
    case WM_LBUTTONUP:
    case WM_RBUTTONDOWN:
    case WM_RBUTTONUP:
    case 0x020A:
        if (trackMouseComponent) {
            return ((_HYComponent*)trackMouseComponent)->_ProcessOSEvent (vEvent);
        }
        if (theEvent->iMsg == 0x020A) {
            localPoint = (POINT) {
                LOWORD(theEvent->lParam),HIWORD(theEvent->lParam)
            };
            ScreenToClient (theWindow, &localPoint);
            c = FindClickedCell(localPoint.x, localPoint.y);
            if (c<0) {
                return false;
            }
            DoMouseWheel (c, ((signed short)HIWORD(theEvent->wParam))/120);
            return true;
        }
        c = FindClickedCell(LOWORD(theEvent->lParam),HIWORD(theEvent->lParam));
        if (c<0) {
            return false;
        }
        return ((_HYComponent*)components(c))->_ProcessOSEvent (vEvent);
        break;


    case WM_GETMINMAXINFO:

        windowInfo = (MINMAXINFO*)theEvent->lParam;

        if ((hWindowPad==0)&&(vWindowPad==0))
            if (!IsIconic (theWindow)) {
                GetClientRect (theWindow,&smallR);
                ::GetWindowRect (theWindow,&bigR);
                hWindowPad = bigR.right-bigR.left-smallR.right-1;
                vWindowPad = bigR.bottom-bigR.top-smallR.bottom-1;
            }

        windowInfo->ptMinTrackSize.x = dim.left+hWindowPad-1;
        windowInfo->ptMinTrackSize.y = dim.top+vWindowPad-1;
        windowInfo->ptMaxSize.x=windowInfo->ptMaxTrackSize.x = dim.right+hWindowPad;
        windowInfo->ptMaxSize.y=windowInfo->ptMaxTrackSize.y = dim.bottom+vWindowPad;

        return false;
        break;

        /*case WM_DESTROY:
        {
            KillTimer (theWindow,idleTimer);
            break;
        }*/

    case WM_CHAR:
    case WM_KEYDOWN: {
        if (keyboardFocusChain.lLength) {
            int keyCode = theEvent->wParam;
            if (keyCode == VK_TAB) { // tab
                bool    backwards = (GetAsyncKeyState (VK_SHIFT) & 0x8000);

                if (keyboardFocus==-1) {
                    keyCode = keyboardFocusChain.lData[backwards?keyboardFocusChain.lLength-1:0];
                } else if (keyboardFocusChain.lLength>1) {
                    keyCode = keyboardFocusChain.Find (keyboardFocus);
                    keyCode += backwards?(-1):1;
                    if (keyCode<0) {
                        keyCode = keyboardFocusChain.lLength-1;
                    } else if (keyCode >= keyboardFocusChain.lLength) {
                        keyCode = 0;
                    }
                    keyCode = keyboardFocusChain.lData[keyCode];
                } else {
                    keyCode = -1;
                }

                if (keyCode>=0) {
                    ProcessEvent (generateKeyboardFocusEvent (((_HYComponent*)components(keyCode))->GetID()));
                }
                return true;
            }
        }

        for (long k=0; k<components.lLength; k++)
            if (cells.Find(k)>=0) {
                _HYComponent* tC = (_HYComponent*)components(k);
                if (tC->UnfocusedKeyboardInput())
                    if (tC->_ProcessOSEvent (vEvent)) {
                        return true;
                    }
            }

        if ((keyboardFocus>=0)&&(keyboardFocus<components.lLength)) {
            if (((_HYComponent*)components(keyboardFocus))->_ProcessOSEvent (vEvent)) {
                return true;
            }
        }

        return false;
    }


    case WM_MOUSEMOVE: {
        if (trackMouseComponent) {
            return ((_HYComponent*)trackMouseComponent)->_ProcessOSEvent (vEvent);
        }

        int c = FindClickedCell(LOWORD(theEvent->lParam),HIWORD(theEvent->lParam));
        if (c<0) {
            if (lastMouseComponent>=0) {
                ((_HYComponent*)components(lastMouseComponent))->_ComponentMouseExit();
            }
            lastMouseComponent = -1;
            return false;
        } else {
            if (lastMouseComponent>=0) {
                if (c!=lastMouseComponent) {
                    ((_HYComponent*)components(lastMouseComponent))->_ComponentMouseExit();
                }
            } else {
                SetCursor (LoadCursor (nil, IDC_ARROW));
            }

            lastMouseComponent = c;
            return ((_HYComponent*)components(c))->_ProcessOSEvent (vEvent);
        }
        break;
    }

    case WM_NCMOUSEMOVE: {
        if (lastMouseComponent>=0) {
            ((_HYComponent*)components(lastMouseComponent))->_ComponentMouseExit();
        }
        lastMouseComponent = -1;
        return false;
    }

    case WM_ACTIVATE: {
        if (LOWORD(theEvent->wParam)!=WA_INACTIVE) {
            _Activate2();
        } else {
            _Deactivate2();
        }

        return true;
    }

    default: {
        //printf ("%x %x %x\n", theEvent->iMsg, theEvent->wParam, theEvent->lParam);
        for (int i=0; i<components.lLength; i++) {
            _HYComponent *thisC = (_HYComponent*)components(i);
            if (thisC->_ProcessOSEvent (vEvent)) {
                return true;
            }
        }
    }
    }
    return _HYPlatformWindow::_ProcessOSEvent (vEvent);
}

//__________________________________________________________________

void        _HYTWindow::_SetCopyString (_String* str)
{
    EmptyClipboard();

    HGLOBAL          cHandle = GlobalAlloc (GHND, str->sLength+1);
    checkPointer     (cHandle);
    LPVOID           cPtr = GlobalLock (cHandle);
    CopyMemory       (cPtr, str->sData, str->sLength+1);
    GlobalUnlock     (cHandle);

    SetClipboardData (CF_TEXT, cHandle);
    CloseClipboard();
}

//__________________________________________________________________

_String*        _HYTWindow::_GetPasteString (void)
{
    _String *res = nil;

    OpenClipboard  (theWindow);

    if (IsClipboardFormatAvailable (CF_TEXT)) {
        HANDLE           cHandle = GetClipboardData (CF_TEXT);
        LPVOID           cPtr = GlobalLock (cHandle);
        res = new _String((unsigned long)GlobalSize (cHandle)-1, false);
        checkPointer     (res);
        CopyMemory       (res->sData, cPtr, res->sLength+1);
        GlobalUnlock     (cHandle);
    }
    return res;
}

//__________________________________________________________________

void _HYTWindow::_Activate(void)
{
    for (int i=0; i<components.lLength; i++)
        if (cells.Find(i)>=0) {
            ((_HYComponent*)components(i))->Activate();
        }


    idleTimer = SetTimer (theWindow, IDLE_WINDOW_TIMER , 500,(TIMERPROC) IdleWindowTimer);
    _HYPlatformWindow::_Activate();

    if (keyboardFocus>=0) {
        ((_HYComponent*)components(keyboardFocus))->FocusComponent();
    }
}

//__________________________________________________________________

void _HYTWindow::_Activate2(void)
{
    //ReportWarning (_String ("Activated ") & (long)GetID());
    for (int i=0; i<components.lLength; i++)
        if (cells.Find(i)>=0) {
            //ReportWarning (_String ("Activated Component") & (long)i);
            ((_HYComponent*)components(i))->Activate();
        }


    idleTimer = SetTimer (theWindow, IDLE_WINDOW_TIMER , 500,(TIMERPROC) IdleWindowTimer);
    if (keyboardFocus>=0) {
        ((_HYComponent*)components(keyboardFocus))->FocusComponent();
    }
}

//__________________________________________________________________

void _HYTWindow::_Deactivate2(void)
{
    //ReportWarning (_String ("Deactivated ") &  (long)GetID());
    for (int i=0; i<components.lLength; i++)
        if (cells.Find(i)>=0) {
            ((_HYComponent*)components(i))->Deactivate();
        }

    KillTimer (theWindow,idleTimer);
}

//__________________________________________________________________

void _HYTWindow::_Deactivate(void)
{
    _Deactivate2 ();
    _HYPlatformWindow::_Deactivate();
}


//__________________________________________________________________


bool        _HYTWindow::_ProcessMenuSelection (long msel)
{
    bool done = false;

    if (_HYWindow::_ProcessMenuSelection(msel)) {
        return true;
    }

    switch (msel) {
    case HY_WINDOW_MENU_ID_EDIT+1:
        HandleCopyPaste(0);
        done = true;
        break;
    case HY_WINDOW_MENU_ID_EDIT+3:
        HandleCopyPaste(1);
        done = true;
        break;
    }

    return done;
}

//__________________________________________________________________

void _HYTWindow::_Zoom(bool inOut)
{
}


//__________________________________________________________________
void        _HYPlatformTWindow::_SetWindowRectangle     (int,int,int,int,bool)
{

}



//EOF
\ No newline at end of file
diff --git a/src/gui/win/WindowClasses/HYPlatformTreePanel.cpp b/src/gui/win/WindowClasses/HYPlatformTreePanel.cpp
deleted file mode 100644
index e88f538..0000000
--- a/src/gui/win/WindowClasses/HYPlatformTreePanel.cpp
+++ /dev/null
@@ -1,1328 +0,0 @@
-/*
-    Tree  Panel Object  for Win32 API
-
-    Sergei L. Kosakovsky Pond, June 2000-January 2003
-*/
-
-#include "HYTreePanel.h"
-#include "HYUtils.h"
-
-_String     saveForTreesPrompt ("Save Tree As:");
-
-HPEN        navPen = CreatePen (PS_SOLID,2,RGB(255,151,51));
-
-#define     HY_TREE_WIN32_MENU_BASE  7000
-
-//__________________________________________________________________
-
-bool _HYTreePanel::_ProcessOSEvent (Ptr vEvent)
-{
-    static  char draggin = 0;
-    _HYWindowsUIMessage *theEvent = (_HYWindowsUIMessage*)vEvent;
-    if (theEvent->iMsg==WM_RBUTTONDOWN) {
-        if (FindClickedCell(LOWORD(theEvent->lParam),HIWORD(theEvent->lParam)) == 0) {
-            HandleContextPopup(LOWORD(theEvent->lParam),HIWORD(theEvent->lParam));
-            return true;
-        }
-    }
-    if(!_HYTWindow::_ProcessOSEvent (vEvent)) {
-        if ((theEvent->iMsg==WM_LBUTTONDOWN)||(theEvent->iMsg==WM_LBUTTONDBLCLK)) {
-            int ch = LOWORD(theEvent->lParam),cv = HIWORD(theEvent->lParam),c;
-            c = FindClickedCell(ch,cv);
-            if (c<0) {
-                return false;
-            }
-            _HYComponent* thisComponent = (_HYComponent*)components(c);
-            if (c==1) { // navBar
-
-                ch -= componentL.lData[1];
-                cv -= componentT.lData[1];
-                if (navRect.Contains(ch,cv)) {
-                    draggin = 1;
-                } else {
-                    SetNavRectCenter (ch,cv);
-                }
-                return true;
-            } else if (c==0) {
-                ch -= componentL.lData[0];
-                cv -= componentT.lData[0];
-                char shiftFlag = 0;
-
-                if (theEvent->wParam&MK_SHIFT) {
-                    shiftFlag |= 0x01;
-                }
-                if (theEvent->wParam&MK_CONTROL) {
-                    shiftFlag |= 0x02;
-                }
-
-                if (shiftFlag > 2) {
-                    draggin = 2;
-                    theEvent->iMsg = WM_MOUSEMOVE;
-                } else {
-                    if (IsVertical()) {
-                        c = ch;
-                        ch = cv+thisComponent->vOrigin;
-                        cv = c+thisComponent->hOrigin;
-                    } else {
-                        ch+=thisComponent->hOrigin;
-                        cv+=thisComponent->vOrigin;
-                    }
-
-                    if ((theEvent->iMsg==WM_LBUTTONDBLCLK)&&(currentSelection.lLength)) {
-                        InvokeNodeEditor();
-                        return true;
-                    }
-
-                    if(FindSelection (ch,cv,shiftFlag)) {
-                        _UpdateOperationsMenu();
-                        RenderTree();
-                    }
-                }
-            }
-        }
-
-        if (theEvent->iMsg==WM_LBUTTONUP) {
-            draggin = 0;
-            return true;
-        } else if (theEvent->iMsg==WM_MOUSEMOVE) {
-            if (draggin == 1) {
-                int ch = LOWORD(theEvent->lParam)-componentL.lData[1],
-                    cv = HIWORD(theEvent->lParam)-componentT.lData[1];
-                SetNavRectCenter (ch,cv);
-            } else {
-                if (draggin == 2) {
-                    _HYCanvas   *theTree    = (_HYCanvas*)GetObject (0);
-
-                    int ch = LOWORD(theEvent->lParam),
-                        cv = HIWORD(theEvent->lParam);
-
-                    if (IsVertical()) {
-                        cv = cv-componentL.lData[0]+theTree->hOrigin;
-                        ch = ch-componentT.lData[0]+theTree->vOrigin;
-                    } else {
-                        ch = ch-componentL.lData[0]+theTree->hOrigin;
-                        cv = cv-componentT.lData[0]+theTree->vOrigin;
-                    }
-                    if ((ch<theTree->_HYComponent::GetMaxW())&&(cv<theTree->_HYComponent::GetMaxH())) {
-                        FishEyeProjection (ch,theTree->_HYComponent::GetMaxH()-cv,theTree->_HYComponent::GetMaxW(),
-                                           theTree->_HYComponent::GetMaxH(),coordTree);
-                        treeFlags |= HY_TREEPANEL_PROJECTION;
-                        RenderTree(false);
-                    }
-                }
-            }
-            return true;
-        } else {
-            if (theEvent->iMsg==WM_CHAR) {
-                TCHAR  theC = (TCHAR)theEvent->wParam;
-                //printf ("%x\n", theC);
-                if (theC == VK_BACK) {
-                    DeleteCurrentSelection();
-                    _UpdateOperationsMenu();
-                    return true;
-                } else if (theC == VK_RETURN) {
-                    InvokeNodeEditor ();
-                    _UpdateOperationsMenu();
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-}
-//__________________________________________________________________
-
-
-bool        _HYTreePanel::_ProcessMenuSelection (long msel)
-{
-    if (_HYWindow::_ProcessMenuSelection(msel)) {
-        return true;
-    }
-
-    switch (msel) {
-
-    case HY_WINDOW_MENU_ID_FILE+1: { // Save tree
-        _String           filePath,
-                          dtreeName = treeName,
-                          ext;
-
-        bool              good = false;
-
-        _List             treeFormats;
-
-        long pidOptions = GetUniversalSaveOptions (treeFormats);
-
-        ext = "Bitmap (.BMP)";
-        treeFormats && & ext;
-        ext = "Graphical Metafile (.EMF)";
-        treeFormats && & ext;
-
-        long              menuChoice = SaveFileWithPopUp (filePath, saveForTreesPrompt,dtreeName,
-                                       empty,
-                                       treeFormats);
-        if (menuChoice>=0) {
-            _HYCanvas   *theTree = (_HYCanvas*)GetObject (0);
-
-            if (menuChoice == pidOptions+1) {
-                HDC         mfDC = CreateEnhMetaFile (GetDC(NULL),filePath.getStr(),NULL,NULL), saveDC = theTree->thePane;
-                if (!mfDC) {
-                    _String errMsg ("Could not create meta file device context. Windows Error:");
-                    errMsg = errMsg & _String ((long)GetLastError());
-                    WarnError (errMsg);
-                    return true;
-                }
-                theTree->thePane = mfDC;
-                RenderTree (true, true);
-                theTree->thePane = saveDC;
-                DeleteEnhMetaFile(CloseEnhMetaFile (mfDC));
-            } else if (menuChoice == pidOptions) {
-                HBITMAP hBmp = (HBITMAP)GetCurrentObject (theTree->thePane,OBJ_BITMAP);
-                BITMAP bmp;
-                PBITMAPINFO pbmi;
-                long    rowWidth;
-                bool    good = true, ruler = (!IsVertical())&&(scaleVariable.sLength);
-                if (!::GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp)) {
-                    good = false;
-                } else {
-
-                    pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD) * 2);
-                    pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-                    pbmi->bmiHeader.biWidth = bmp.bmWidth;
-                    pbmi->bmiHeader.biHeight = bmp.bmHeight;
-                    pbmi->bmiHeader.biPlanes = 1;
-                    pbmi->bmiHeader.biBitCount = 1;
-                    pbmi->bmiHeader.biClrUsed = 0;
-                    pbmi->bmiHeader.biCompression = BI_RGB;
-                    pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 7) /8;
-                    if ( pbmi->bmiHeader.biSizeImage%4) {
-                        pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biSizeImage/4+1)*4;
-                    }
-                    rowWidth = pbmi->bmiHeader.biSizeImage;
-                    pbmi->bmiHeader.biSizeImage*=pbmi->bmiHeader.biHeight;
-                    pbmi->bmiHeader.biClrImportant = 0;
-                    pbmi->bmiHeader.biXPelsPerMeter = 0x0EC4;
-                    pbmi->bmiHeader.biYPelsPerMeter = 0x0EC4;
-                    RGBQUAD     t = {0,0,0,0};
-                    pbmi->bmiColors[0] = t;
-                    t.rgbRed = t.rgbGreen = t.rgbBlue = 255;
-                    pbmi->bmiColors[1] = t;
-
-                    HANDLE hf;                 // file handle
-                    BITMAPFILEHEADER hdr;       // bitmap file-header
-                    PBITMAPINFOHEADER pbih;     // bitmap info-header
-                    LPBYTE lpBits;
-                    // memory pointer
-                    DWORD dwTotal;              // total count of bytes
-                    DWORD cb;                   // incremental count of bytes
-                    BYTE *hp;                   // byte pointer
-                    DWORD dwTmp;
-
-                    pbih = (PBITMAPINFOHEADER) pbmi;
-                    lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage);
-
-                    if (!lpBits) {
-                        good = false;
-                    } else if (!GetDIBits(theTree->thePane, hBmp, 0, (WORD) bmp.bmHeight, lpBits, pbmi,DIB_RGB_COLORS)) {
-                        good = false;
-                        //printf ("\nStage 3 Error:%d\n",GetLastError());
-                    } else {
-                        hf = CreateFile(filePath.getStr(),
-                                        GENERIC_READ | GENERIC_WRITE,
-                                        (DWORD) 0,
-                                        NULL,
-                                        CREATE_ALWAYS,
-                                        FILE_ATTRIBUTE_NORMAL,
-                                        (HANDLE) NULL);
-                        if (hf == INVALID_HANDLE_VALUE) {
-                            good = false;
-                        } else {
-                            hdr.bfType = 0x4d42;
-                            if (ruler)
-                                hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) + pbih->biSize + 2 * sizeof(RGBQUAD) +
-                                                      (pbih->biSizeImage/pbmi->bmiHeader.biHeight)*(pbmi->bmiHeader.biHeight+HY_TREEPANEL_RULER_EXPANDED));
-                            else {
-                                hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) + pbih->biSize + 2 * sizeof(RGBQUAD) + pbih->biSizeImage);
-                            }
-                            hdr.bfReserved1 = 0;
-                            hdr.bfReserved2 = 0;
-
-                            hdr.bfOffBits = (DWORD) (sizeof(BITMAPFILEHEADER) +
-                                                     pbih->biSize + 2 * sizeof (RGBQUAD));
-
-                            if (WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER),
-                                          (LPDWORD) &dwTmp,  NULL)) {
-                                DWORD oldImSize = pbih->biSizeImage;
-                                if (ruler) {
-                                    pbih->biHeight+=HY_TREEPANEL_RULER_EXPANDED;
-                                    pbih->biSizeImage=(pbih->biSizeImage/pbmi->bmiHeader.biHeight)*(pbmi->bmiHeader.biHeight+HY_TREEPANEL_RULER_EXPANDED);
-                                }
-                                if (WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER)
-                                              + 2 * sizeof (RGBQUAD),
-                                              (LPDWORD) &dwTmp, ( NULL))) {
-                                    dwTotal = cb = oldImSize;
-                                    hp = lpBits;
-                                    WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp,NULL);
-
-                                }
-                            }
-                        }
-                    }
-                    if (ruler) {
-
-                        _HYCanvas   *theRuler = (_HYCanvas*)GetObject (2);
-                        hBmp = (HBITMAP)GetCurrentObject (theRuler->thePane,OBJ_BITMAP);
-                        if (::GetObject(hBmp, sizeof(BITMAP), (LPSTR)&bmp)) {
-                            pbmi->bmiHeader.biHeight = bmp.bmHeight;
-                            pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 7) /8;
-                            if ( pbmi->bmiHeader.biSizeImage%4) {
-                                pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biSizeImage/4+1)*4;
-                            }
-                            pbmi->bmiHeader.biSizeImage *= bmp.bmHeight;
-                            if (!GetDIBits(theRuler->thePane, hBmp, 0, (WORD) bmp.bmHeight, lpBits, pbmi,DIB_RGB_COLORS)) {
-                                good = false;
-                                //printf ("\nStage 3 Error:%d\n",GetLastError());
-                            } else {
-                                dwTotal = cb = pbmi->bmiHeader.biSizeImage;
-                                hp = lpBits;
-                                WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp,NULL);
-                            }
-                        } else {
-                            good = false;
-                        }
-                    }
-                    CloseHandle(hf);
-                    GlobalFree((HGLOBAL)lpBits);
-                    LocalFree (pbmi);
-                }
-                if (!good) {
-                    _String errMsg = "Couldn't create/write .bmp file";
-                    WarnError (errMsg);
-                }
-            } else {
-                HandleTreeSave (menuChoice, filePath);
-
-                /*FILE* theFile = fopen (filePath.sData,"w");
-                if (theFile)
-                {
-                    _String res = GetTreeString();
-                    fwrite (res.sData,1,res.sLength,theFile);
-                    fclose (theFile);
-                }
-                else
-                {
-                    filePath = "Error creating tree file";
-                    WarnError (filePath);
-                }*/
-            }
-        }
-        return true;
-    }
-    break;
-    case HY_WINDOW_MENU_ID_FILE+2: {
-        _PrintTree();
-        break;
-    }
-
-    case HY_WINDOW_MENU_ID_EDIT:   // Undo
-        UndoLastOperation();
-        break;
-
-    case HY_WINDOW_MENU_ID_EDIT+1: { // COPY
-        if (treeFlags&HY_TREEPANEL_CLIPBOARD_READY) {
-            CutSelectionToClipboard (false);
-        } else {
-            _HYCanvas   *theTree = (_HYCanvas*)GetObject (0);
-            bool ruler = (!IsVertical())&&(scaleVariable.sLength);
-            if (ruler) {
-                _HYCanvas   *theRuler = (_HYCanvas*)GetObject (2);
-
-            } else {
-                PlaceBitmapInClipboard ((HBITMAP)GetCurrentObject (theTree->thePane,OBJ_BITMAP),theWindow);
-            }
-        }
-        break;
-    }
-
-    case HY_WINDOW_MENU_ID_EDIT+2:   // Cut
-        CutSelectionToClipboard ();
-        break;
-
-    case HY_WINDOW_MENU_ID_EDIT+3:   // Paste
-        PasteClipboardTree();
-        break;
-
-    case HY_WINDOW_MENU_ID_EDIT+4:   // Delete
-        DeleteCurrentSelection();
-        break;
-
-    case HY_WINDOW_MENU_ID_EDIT+5:   // Select All
-        SelectAllBranches();
-        break;
-
-    case HY_WINDOW_MENU_ID_EDIT+6:   // S & R
-        HandleSearchAndReplace(false);
-        break;
-
-    case HY_WINDOW_MENU_ID_EDIT+7:   // S & R
-        HandleSearchAndReplace(true);
-        break;
-
-    case HY_TREE_WIN32_MENU_BASE: {
-        unsigned short newF;
-        if (treeFlags&HY_TREEPANEL_TIP_LABELS) {
-            newF = treeFlags - HY_TREEPANEL_TIP_LABELS;
-            SetFlags (newF);
-        } else {
-            newF = treeFlags + HY_TREEPANEL_TIP_LABELS;
-            SetFlags (newF);
-        }
-        CheckMenuItem (GetSubMenu(windowMenu,2),0,MF_BYPOSITION|((treeFlags&HY_TREEPANEL_TIP_LABELS)?MF_CHECKED:MF_UNCHECKED));
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+1: {
-        unsigned short newF;
-        if (treeFlags&HY_TREEPANEL_INT_LABELS) {
-            newF = treeFlags - HY_TREEPANEL_INT_LABELS;
-            SetFlags (newF);
-        } else {
-            newF = treeFlags + HY_TREEPANEL_INT_LABELS;
-            SetFlags (newF);
-        }
-        CheckMenuItem (GetSubMenu(windowMenu,2),1,MF_BYPOSITION|((treeFlags&HY_TREEPANEL_INT_LABELS)?MF_CHECKED:MF_UNCHECKED));
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+2: {
-        SwapSelectedSubTrees ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+3: {
-        CollapseSelectedBranch ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+4: {
-        JoinSelectedBranches ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+5: {
-        GraftATip ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+6: {
-        RerootTree ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+7: {
-        FlipSelectedBranches ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+8:
-    case HY_TREE_WIN32_MENU_BASE+9:
-    case HY_TREE_WIN32_MENU_BASE+10: {
-        HandleSelection (msel-HY_TREE_WIN32_MENU_BASE-8);
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+17:
-    case HY_TREE_WIN32_MENU_BASE+18: {
-        HandleSelection (msel-HY_TREE_WIN32_MENU_BASE-14);
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+30:
-    case HY_TREE_WIN32_MENU_BASE+31:
-    case HY_TREE_WIN32_MENU_BASE+32: {
-        HandleSelection (msel-HY_TREE_WIN32_MENU_BASE-25);
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+11: {
-        InvokeNodeEditor ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+12: {
-        RecalculateLikelihood ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+13: {
-        DisplayParameterTable();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+14: {
-        HandleViewOptions ();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+15:
-    case HY_TREE_WIN32_MENU_BASE+16: {
-        ShowModelMatrix (msel-HY_TREE_WIN32_MENU_BASE-15);
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+19:
-    case HY_TREE_WIN32_MENU_BASE+20: {
-        GenerateDistanceTable (msel-HY_TREE_WIN32_MENU_BASE-19);
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+24:
-    case HY_TREE_WIN32_MENU_BASE+25: {
-        HandleLabels(msel-HY_TREE_WIN32_MENU_BASE-24);
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+35:
-    case HY_TREE_WIN32_MENU_BASE+36:
-    case HY_TREE_WIN32_MENU_BASE+37:
-    case HY_TREE_WIN32_MENU_BASE+38:
-    case HY_TREE_WIN32_MENU_BASE+39: {
-        HandleComparison (msel-HY_TREE_WIN32_MENU_BASE-35);
-        _UpdateOperationsMenu();
-        break;
-    }
-
-    case HY_TREE_WIN32_MENU_BASE+40:
-    case HY_TREE_WIN32_MENU_BASE+41: {
-        HandleSelection(msel-HY_TREE_WIN32_MENU_BASE-33);
-        break;
-    }
-
-    default: { // proc menu
-        if (msel>=HY_TREE_WIN32_MENU_BASE+1000) {
-            ExecuteProcessor (msel-HY_TREE_WIN32_MENU_BASE-1000);
-            _UpdateOperationsMenu();
-            return true;
-        }
-    }
-    }
-
-    if (((msel>=HY_TREE_WIN32_MENU_BASE)&&(msel<HY_TREE_WIN32_MENU_BASE+12))||
-            ((msel>=HY_WINDOW_MENU_ID_EDIT)&&(msel<HY_WINDOW_MENU_ID_EDIT+6))) {
-        _UpdateOperationsMenu();
-    }
-
-    DrawMenuBar(theWindow);
-    return true;
-}
-
-
-
-//__________________________________________________________________
-
-void        _HYTreePanel::_PaintNavRect(void)
-{
-    navRect = ComputeNavRect();
-    _HYCanvas* theCanvas = (_HYCanvas*)GetCellObject (0,0);
-    HDC      theContext = GetDC(theWindow);
-    RECT r;
-    HPEN     savePen = (HPEN)SelectObject (theContext,navPen);
-    r.left = navRect.left+theCanvas->rel.left+HY_TREEPANEL_NAVSPACING;
-    r.right = navRect.right+theCanvas->rel.left;
-    r.top = navRect.top+theCanvas->rel.top+HY_TREEPANEL_NAVSPACING;
-    r.bottom = navRect.bottom+theCanvas->rel.top;
-    MoveToEx (theContext,r.left,r.top,NULL);
-    LineTo(theContext,r.right,r.top);
-    LineTo(theContext,r.right,r.bottom);
-    LineTo(theContext,r.left,r.bottom);
-    LineTo(theContext,r.left,r.top);
-    SelectObject (theContext,savePen);
-    _PaintLFStatus ((Ptr)theContext);
-    ReleaseDC (theWindow, theContext);
-    //printf ("\nPaintNavRect");
-}
-
-//__________________________________________________________________
-
-void        _HYTreePanel::_PrintTree(long hPages, long vPages)
-{
-    if ((hPages<0)||(vPages<0)) {
-        if (!TreePrintSetup (hPages, vPages, (Ptr)this)) {
-            return;
-        }
-    }
-
-    _HYCanvas* theCanvas = (_HYCanvas*)GetObject (0);
-    _HYCanvas* theRuler =  (_HYCanvas*)GetObject (2);
-
-    static DOCINFO  di = {sizeof(DOCINFO), "HYPHY.out", NULL };
-    static PRINTDLG pd;
-    BOOL            SuccessFlag;
-
-    pd.lStructSize         = sizeof(PRINTDLG);
-    pd.hwndOwner           = theWindow;
-    pd.hDevMode            = NULL;
-    pd.hDevNames           = NULL;
-    pd.hDC                 = NULL;
-    pd.Flags               = PD_ALLPAGES | PD_COLLATE | PD_RETURNDC | PD_NOSELECTION;
-    pd.nFromPage           = 1;
-    pd.nToPage             = 0xffff;
-    pd.nMinPage            = 1;
-    pd.nMaxPage            = 0xffff;
-    pd.nCopies             = 1;
-    pd.hInstance           = NULL;
-    pd.lCustData           = 0L;
-    pd.lpfnPrintHook       = NULL;
-    pd.lpfnSetupHook       = NULL;
-    pd.lpPrintTemplateName = NULL;
-    pd.lpSetupTemplateName = NULL;
-    pd.hPrintTemplate      = NULL;
-    pd.hSetupTemplate      = NULL;
-
-    if (!PrintDlg(&pd)) {
-        return;
-    }
-
-    if (pd.hDC == NULL) {
-        pd.hDC = GetPrinterDeviceContext(theWindow);
-    }
-
-
-    EnableWindow(theWindow, FALSE);
-
-    SuccessFlag   = TRUE;
-    UserAbortFlag = FALSE;
-
-    PrintDialogHandle = CreateDialog(GetModuleHandle(NULL), (LPCTSTR)"PrintDlgBox", theWindow,
-                                     PrintDialogProc);
-    SetDlgItemText(PrintDialogHandle, IDD_FNAME, treeName.getStr());
-
-    SetAbortProc(pd.hDC, AbortProc);
-
-    if (StartDoc(pd.hDC, &di) > 0) {
-
-        HDC         saveDC1 = theCanvas->thePane,
-                    saveDC2 = theRuler->thePane;
-
-
-        long    pageW = GetDeviceCaps(pd.hDC, HORZRES),
-                pageH = GetDeviceCaps(pd.hDC, VERTRES),
-                hRes = GetDeviceCaps(pd.hDC, LOGPIXELSX),
-                vRes = GetDeviceCaps(pd.hDC, LOGPIXELSY),
-                screenHRes = GetDeviceCaps(saveDC1, LOGPIXELSX),
-                screenVRes = GetDeviceCaps(saveDC1, LOGPIXELSY),
-                visW = theCanvas->_HYComponent::GetMaxW(),
-                visH = theCanvas->_HYComponent::GetMaxH(),
-                printW  = pageW * hPages,
-                printH  = pageH * vPages;
-
-
-        bool    hasRuler = (scaleVariable.sLength)&&(!IsVertical());
-
-        _HYFont oldFont  = treeLabelFont;
-
-        _Parameter  hsc = 1.0,
-                    vsc = 1.0,
-                    xResC = (_Parameter)screenHRes/hRes,
-                    yResC = (_Parameter)screenVRes/vRes;
-
-        if (hPages <= 0) {
-            hPages = visW/(pageW*xResC)+1;
-            printW= pageW * hPages;
-        }
-
-        if (vPages <= 0) {
-            vPages = visH/(pageH*yResC)+1;
-            printH = pageH * vPages;
-        }
-
-        hRes = printW*xResC;
-        vRes = printH*yResC;
-
-        screenHRes = printW;
-        screenVRes = printH;
-
-        printW = hRes;
-        printH = vRes;
-
-
-        if (visW>printW) {
-            hsc = (_Parameter)printW/visW;
-        }
-
-        if (hasRuler) {
-            printH -= HY_TREEPANEL_RULER_EXPANDED;
-        }
-
-        if (visH>printH) {
-            vsc = (_Parameter)printH/visH;
-        }
-
-        _HYFont     bf1 = branchLabel1,
-                    bf2 = branchLabel2;
-
-        if ((hsc<1.0)||(vsc<1.0)) {
-            treeLabelFont.size = ((_Parameter)treeLabelFont.size)*MIN(hsc,vsc);
-            bf1.size = ((_Parameter)bf1.size)*MIN(hsc,vsc);
-            bf2.size = ((_Parameter)bf2.size)*MIN(hsc,vsc);
-            ShiftScreenCoordinates  (-windowTextMarginH,-windowTextMarginV,coordTree);
-            Convert2ScreenCoordinates (hsc,vsc,0,coordTree);
-        }
-
-        theCanvas->thePane = pd.hDC;
-        theRuler->thePane  = pd.hDC;
-
-        theCanvas->lastPenSize = 2;
-
-        if (visW<printW) {
-            visW = (printW-visW)/2;
-        } else {
-            visW = 0;
-        }
-        if (visH<printH) {
-            visH = (printH-visH)/2;
-        } else {
-            visH = 0;
-        }
-
-        if (IsVertical()) {
-            long t = visH;
-            visH = visW;
-            visW = t;
-        }
-
-        for (long hCount = 0; hCount < hPages; hCount ++)
-            for (long vCount = 0; vCount < vPages; vCount ++) {
-                if (StartPage(pd.hDC) < 0) {
-                    SuccessFlag = FALSE;
-                } else {
-                    theCanvas->SetColor(theCanvas->color);
-                    /*if (visH||visW)
-                    {
-                        ShiftScreenCoordinates  (visW,hasRuler?visH+HY_TREEPANEL_RULER_EXPANDED/2:visH,coordTree);
-                    }
-                    else
-                        if (hasRuler)
-                            ShiftScreenCoordinates  (0,HY_TREEPANEL_RULER_EXPANDED/2,coordTree);
-                    if (hasRuler)
-                    {
-                        RenderRuler (hsc,true,visW,visH-HY_TREEPANEL_RULER_EXPANDED/2);
-                    }
-
-                    if (visH||visW)
-                    {
-                        ShiftScreenCoordinates  (-visW,hasRuler?-visH-HY_TREEPANEL_RULER_EXPANDED/2:-visH,coordTree);
-                    }
-                    else
-                        if (hasRuler)
-                            ShiftScreenCoordinates  (0,-HY_TREEPANEL_RULER_EXPANDED/2,coordTree);*/
-
-
-                    SetMapMode  (pd.hDC, MM_ISOTROPIC);
-                    SetWindowExtEx (pd.hDC, hRes, vRes,nil);
-                    SetViewportExtEx (pd.hDC, screenHRes, screenVRes, nil);
-
-                    //printf ("\n%d %d %d %d %d %d\n", hsc, vsc, hRes, vRes, screenHRes, screenVRes);
-
-                    if (visH||visW) {
-                        ShiftScreenCoordinates  (visW,hasRuler?visH+HY_TREEPANEL_RULER_EXPANDED-5:visH,coordTree);
-                    } else if (hasRuler&&(vCount==0)) {
-                        ShiftScreenCoordinates  (0,HY_TREEPANEL_RULER_EXPANDED-5,coordTree);
-                    }
-
-                    if (hCount||vCount) {
-                        ShiftScreenCoordinates  (-pageW*xResC*hCount,-pageH*yResC*vCount, coordTree);
-                    }
-
-
-                    if (hasRuler && (vCount == 0)) {
-                        RenderRuler (hsc,true,visW,visH);
-                    }
-
-                    theCanvas->SetFont (treeLabelFont);
-
-                    if (treeFlags&HY_TREEPANEL_ARCS) {
-                        PaintArcs(theCanvas, coordTree);
-                    } else if (treeFlags&(HY_TREEPANEL_STRAIGHT|HY_TREEPANEL_CIRCULAR)) {
-                        PaintStraight(theCanvas, coordTree);
-                    } else {
-                        if (IsVertical()) {
-                            PaintVSquare(theCanvas, coordTree);
-                        } else {
-                            PaintSquare(theCanvas, coordTree);
-                            if (treeFlags&HY_TREEPANEL_LABEL1) {
-                                theCanvas->SetFont(bf1);
-                                PaintSquareBranchLabels (theCanvas,coordTree,true);
-                            }
-                            if (treeFlags&HY_TREEPANEL_LABEL2) {
-                                theCanvas->SetFont(bf2);
-                                PaintSquareBranchLabels (theCanvas,coordTree,false);
-                            }
-                        }
-                    }
-
-                    if (visH||visW) {
-                        ShiftScreenCoordinates  (-visW,hasRuler?-visH-HY_TREEPANEL_RULER_EXPANDED+5:-visH,coordTree);
-                    } else if (hasRuler&&(vCount==0)) {
-                        ShiftScreenCoordinates  (0,-HY_TREEPANEL_RULER_EXPANDED+5,coordTree);
-                    }
-
-                    if (hCount||vCount) {
-                        ShiftScreenCoordinates  (pageW*hCount*xResC, pageH*vCount*yResC,coordTree);
-                    }
-                    if (EndPage (pd.hDC) < 0) {
-                        SuccessFlag = FALSE;
-                    }
-                }
-            }
-        //if ((hsc<1.0)||(vsc<1.0))
-        {
-            ShiftScreenCoordinates  (-windowTextMarginH,-windowTextMarginV,coordTree);
-            Convert2ScreenCoordinates (1.0/hsc,1.0/vsc,0,coordTree);
-        }
-
-        treeLabelFont = oldFont;
-        theCanvas->SetFont (oldFont);
-
-        theCanvas->thePane = saveDC1;
-        theRuler->thePane = saveDC2;
-    } else {
-        SuccessFlag = FALSE;
-    }
-
-
-    if (SuccessFlag) {
-        EndDoc(pd.hDC);
-    }
-
-    if (!UserAbortFlag) {
-        EnableWindow(theWindow, TRUE);
-        DestroyWindow(PrintDialogHandle);
-    }
-
-    DeleteDC (pd.hDC);
-
-    if (!SuccessFlag && !UserAbortFlag) {
-        MessageBox(theWindow, "Could not print the tree", AppName, MB_OK | MB_ICONEXCLAMATION);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTreePanel::_SetMenuBar(void)
-{
-    _HYWindow::_SetMenuBar();
-
-    HMENU            windowMenu =  GetMenu (theWindow),
-                     editMenu   =  GetSubMenu(windowMenu,1),
-                     treeMenu   =  GetSubMenu(windowMenu,2);
-
-    if (!treeMenu) {
-        treeMenu = CreateMenu();
-
-        HMENU          labelMenu  =  CreatePopupMenu(),
-                       selectMenu =  CreatePopupMenu(),
-                       compMenu   =  CreatePopupMenu(),
-                       procMenu   =  CreatePopupMenu();
-
-        checkPointer   (treeMenu);
-        checkPointer   (labelMenu);
-        checkPointer   (selectMenu);
-        checkPointer   (compMenu);
-        checkPointer   (procMenu);
-
-        InsertMenu      (labelMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+24,
-                         "&Above Branches\tCtrl-8");
-
-        InsertMenu      (labelMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+25,
-                         "&Below Branches\tCtrl-9");
-
-        InsertMenu      (compMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+35,
-                         "Test For &Equality");
-
-        InsertMenu      (compMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+36,
-                         "Find &Subtree In Another Tree");
-
-        InsertMenu      (compMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+37,
-                         "Find &Maximal Common Subtree");
-
-        InsertMenu      (compMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+38,
-                         "Find Maximal Common &Forest");
-
-
-        InsertMenu      (compMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+39,
-                         "&Match To Tree Pattern");
-
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|((treeFlags&HY_TREEPANEL_TIP_LABELS)?
-                         MF_CHECKED:0), HY_TREE_WIN32_MENU_BASE, "Tip &Labels");             //0
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|((treeFlags&HY_TREEPANEL_INT_LABELS)?
-                         MF_CHECKED:0), HY_TREE_WIN32_MENU_BASE+1, "I&nternal Labels"); //1
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil);                            //2
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+2,   //3
-                         "S&wap Subtrees\tCtrl-1");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+3,   //4
-                         "&Collapse Branch\tCtrl-2");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+4,   //5
-                         "&Join\tCtrl-3");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+5,   //6
-                         "&Graft A Tip\tCtrl-4");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+6,   //7
-                         "&Reroot\tCtrl-5");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+7,
-                         "&Flip tip ordering\tCtrl-6"); // 8
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil); // 9
-
-
-        InsertMenu      (selectMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+8,
-                         "Select &Entire Subtree");
-        InsertMenu      (selectMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+9,
-                         "Select Incom&plete Branches\tCtrl-I");
-        InsertMenu      (selectMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+10,
-                         "Select Bran&ches Without Models");
-        InsertMenu      (selectMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+17,
-                         "Select Branches By &Name");
-
-        InsertMenu      (selectMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+18,
-                         "Select Branches By &Length");
-
-        InsertMenu      (selectMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+30,
-                         "In&vert Selection");
-
-        InsertMenu      (selectMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+31,
-                         "&Grow Selection");
-
-        InsertMenu      (selectMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+32,
-                         "&Map Selection to Datapanel");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)selectMenu,
-                         "Select Branches"); // 10
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+11,
-                         "Edit Prope&rties"); // 11
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil); // 12
-
-        UINT            flags = MF_BYPOSITION|MF_STRING;
-
-        if (likeFuncID < 0) {
-            flags |= MF_GRAYED;
-        }
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, flags, HY_TREE_WIN32_MENU_BASE+12,
-                         "Optimi&ze Again\tCtrl-T"); // 13
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, flags, HY_TREE_WIN32_MENU_BASE+13,
-                         "Sh&ow Parameters in Table\tCtrl-H"); //14
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil); // 15
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+14,
-                         "Tr&ee Display Options..."); // 16
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)labelMenu,
-                         "Branch Labels"); // 17
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil); // 18
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+15, // 19
-                         "Show Rate Matri&x");
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, HY_TREE_WIN32_MENU_BASE+16,
-                         "S&how Transition Matrix"); // 20
-
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil); // 21
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+19, // 22
-                         "Pairwise Distan&ces");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+20, // 23
-                         "Branch Length Distributi&on");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil); // 24
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)compMenu,
-                         "Tree Compar&ison"); // 25
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+40, // 26
-                         "Match Leaves To Se&quence Data");
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+41, // 27
-                         "Find selection in anothe&r Tree");
-
-
-        InsertMenu      (treeMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil); // 12
-
-        if (treeProcessors.lLength == 0) {
-            InsertMenu      (treeMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING|MF_GRAYED, 0, "&Additional Tools");
-            DestroyMenu     (procMenu);
-        } else {
-            for (long k=0; k<treeProcessors.lLength; k++) {
-                _String *thisItem = (_String*)treeProcessors (k),
-                         chopped = thisItem->Cut (thisItem->FindBackwards ('\\',0,-1)+1,-1);
-
-                InsertMenu      (procMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_TREE_WIN32_MENU_BASE+1000+k, chopped.sData);
-            }
-            InsertMenu      (treeMenu, 0xFFFFFFFF, MF_BYPOSITION|MF_POPUP, (UINT)procMenu, "&Additional Tools");
-        }
-
-
-        InsertMenu      (editMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_SEPARATOR, 0, nil); // 24
-
-        InsertMenu      (editMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_EDIT+6,
-                         "Search and Repla&ce\tCtrl-F"); // 25
-
-        InsertMenu      (editMenu,  0xFFFFFFFF, MF_BYPOSITION|MF_STRING, HY_WINDOW_MENU_ID_EDIT+7, // 23
-                         "Search and Re&place in Selection");
-
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << '1';
-        accels       << HY_TREE_WIN32_MENU_BASE+2;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << '2';
-        accels       << HY_TREE_WIN32_MENU_BASE+3;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << '3';
-        accels       << HY_TREE_WIN32_MENU_BASE+4;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << '4';
-        accels       << HY_TREE_WIN32_MENU_BASE+5;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << '5';
-        accels       << HY_TREE_WIN32_MENU_BASE+6;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << '6';
-        accels       << HY_TREE_WIN32_MENU_BASE+7;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << 'I';
-        accels       << HY_TREE_WIN32_MENU_BASE+9;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << 'T';
-        accels       << HY_TREE_WIN32_MENU_BASE+12;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << 'H';
-        accels       << HY_TREE_WIN32_MENU_BASE+13;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << '8';
-        accels       << HY_TREE_WIN32_MENU_BASE+24;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << '9';
-        accels       << HY_TREE_WIN32_MENU_BASE+25;
-
-        accels       << (FCONTROL|FVIRTKEY);
-        accels       << 'F';
-        accels       << HY_WINDOW_MENU_ID_EDIT+6;
-
-        InsertMenu   (windowMenu, 2, MF_BYPOSITION|MF_POPUP, (UINT) treeMenu , "&Tree");
-
-        _AddStandardAccels();
-        _BuildAccelTable  (true);
-        accels.Clear();
-
-
-        treeMenu =  GetSubMenu(windowMenu,1);
-        EnableMenuItem (treeMenu, 2, MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem (treeMenu, 6, MF_ENABLED|MF_BYPOSITION);
-    }
-}
-
-//__________________________________________________________________
-
-void _HYTreePanel::_UnsetMenuBar(void)
-{
-
-}
-
-//__________________________________________________________________
-
-void _HYTreePanel::_UpdateOperationsMenu (void)
-{
-    node<nodeCoord>* node1, *node2, *t;
-    HMENU       treeMenu    = GetSubMenu(GetMenu (theWindow),2),
-                editMenu  = GetSubMenu(GetMenu (theWindow),1),
-                selectMenu  = GetSubMenu(treeMenu, 10),
-                compMenu   = GetSubMenu(treeMenu, 25);
-
-    EnableMenuItem(treeMenu, 3 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(treeMenu, 4 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(treeMenu, 5 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(treeMenu, 6 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(treeMenu, 7 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(treeMenu, 8 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(selectMenu,0 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(selectMenu,6 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(selectMenu,7 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(selectMenu,8 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(treeMenu,11 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(treeMenu,19 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(treeMenu,20 ,MF_GRAYED|MF_BYPOSITION);
-
-    EnableMenuItem(editMenu, 8 ,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(editMenu, 11,MF_GRAYED|MF_BYPOSITION);
-    EnableMenuItem(compMenu, 1 ,MF_GRAYED|MF_BYPOSITION);
-
-    bool  good = true;
-    long  k,j;
-    if (currentSelection.lLength==2) {
-        node1 = (node<nodeCoord>*)currentSelection(0);
-        node2 = (node<nodeCoord>*)currentSelection(1);
-        t = node1->parent;
-        while (t) {
-            if (t==node2) {
-                good = false;
-                break;
-            }
-            t = t->parent;
-        }
-        if (good) {
-            t = node2->parent;
-            while (t) {
-                if (t==node1) {
-                    good = false;
-                    break;
-                }
-                t = t->parent;
-            }
-        }
-        if (good) {
-            EnableMenuItem(treeMenu, 3 ,MF_ENABLED|MF_BYPOSITION);
-        }
-    }
-    if (currentSelection.lLength) {
-        EnableMenuItem(treeMenu, 6 ,MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem(treeMenu, 11 ,MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem(selectMenu,6 ,MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem(selectMenu,7 ,MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem(selectMenu,8 ,MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem(editMenu, 11,MF_ENABLED|MF_BYPOSITION);
-        for (k=0; k<currentSelection.lLength; k++) {
-            node1 = (node<nodeCoord>*)currentSelection(k);
-            if (node1->get_num_nodes()) {
-                EnableMenuItem(treeMenu, 4 ,MF_ENABLED|MF_BYPOSITION);
-                break;
-            }
-        }
-        for (k=0; k<currentSelection.lLength; k++) {
-            node1 = (node<nodeCoord>*)currentSelection(k);
-            if (!node1->get_num_nodes()) {
-                EnableMenuItem(treeMenu, 5 ,MF_ENABLED|MF_BYPOSITION);
-                break;
-            }
-        }
-        if (currentSelection.lLength>=2) {
-            node1 = (node<nodeCoord>*)currentSelection(0);
-            t = node1->parent;
-            if (t&&(t->get_num_nodes()>currentSelection.lLength)) {
-                for (k=1; k<currentSelection.lLength; k++) {
-                    node1 = (node<nodeCoord>*)currentSelection(k);
-                    if (node1->parent!=t) {
-                        break;
-                    }
-                }
-                if (k==currentSelection.lLength) {
-                    EnableMenuItem(treeMenu, 5 ,MF_ENABLED|MF_BYPOSITION);
-                }
-            }
-        } else {
-            node1 = (node<nodeCoord>*)currentSelection(0);
-            if (node1->parent) {
-                EnableMenuItem(treeMenu, 7 ,MF_ENABLED|MF_BYPOSITION);
-                ModifyMenu    (treeMenu, 7, MF_BYPOSITION, HY_TREE_WIN32_MENU_BASE+6, "Reroot");
-            }
-            if (node1->get_num_nodes()>0) {
-                EnableMenuItem(treeMenu, 8 ,MF_ENABLED|MF_BYPOSITION);
-                EnableMenuItem(selectMenu,0 ,MF_ENABLED|MF_BYPOSITION);
-            }
-            if (node1->in_object.varRef>=0) {
-                _CalcNode* thisCNode = (_CalcNode*)LocateVar(node1->in_object.varRef);
-
-                if (thisCNode&&(thisCNode->GetModelIndex()>=0)) {
-                    EnableMenuItem(treeMenu,19 ,MF_ENABLED|MF_BYPOSITION);
-                    EnableMenuItem(treeMenu,20 ,MF_ENABLED|MF_BYPOSITION);
-                }
-            }
-        }
-    } else {
-        _TheTree *me = LocateMyTreeVariable();
-        if (me) {
-            if (me->RootedFlag()==UNROOTED) {
-                EnableMenuItem(treeMenu, 7 ,MF_ENABLED|MF_BYPOSITION);
-                ModifyMenu    (treeMenu, 7, MF_BYPOSITION,HY_TREE_WIN32_MENU_BASE+6,"Balance");
-            } else {
-                EnableMenuItem(treeMenu, 7 ,MF_ENABLED|MF_BYPOSITION);
-                ModifyMenu    (treeMenu, 7, MF_BYPOSITION, HY_TREE_WIN32_MENU_BASE+6,"Unroot");
-            }
-        }
-    }
-
-    if (likeFuncID!=-1) {
-        EnableMenuItem(treeMenu, 13 ,MF_ENABLED|MF_BYPOSITION);
-        EnableMenuItem(treeMenu, 14 ,MF_ENABLED|MF_BYPOSITION);
-    } else {
-        EnableMenuItem(treeMenu, 13 ,MF_GRAYED|MF_BYPOSITION);
-        EnableMenuItem(treeMenu, 14 ,MF_GRAYED|MF_BYPOSITION);
-    }
-
-    if (treePanelClipboardRoot&&(currentSelection.lLength==1)) {
-        EnableMenuItem(editMenu, 4 ,MF_ENABLED|MF_BYPOSITION);
-    } else {
-        EnableMenuItem(editMenu, 4 ,MF_GRAYED|MF_BYPOSITION);
-    }
-
-    EnableMenuItem(editMenu, 3 ,MF_GRAYED|MF_BYPOSITION);
-    // check if can cut/paste
-    t = nil;
-
-    for (k=0; k<currentSelection.lLength; k++) {
-        node1 = (node<nodeCoord>*)currentSelection.lData[k];
-        if (node1->parent) {
-            if (currentSelection.Find((long)node1->parent)<0) {
-                if (t) {
-                    break;
-                } else {
-                    t = node1;
-                }
-            }
-            for (j=0; j<node1->nodes.length; j++) {
-                if (currentSelection.Find((long)node1->nodes.data[j])<0) {
-                    break;
-                }
-            }
-            if (j<node1->nodes.length) {
-                break;
-            }
-        } else {
-            if (t) {
-                break;
-            } else {
-                t = node1;
-            }
-        }
-    }
-    selectionTop = nil;
-    treeFlags &= 0xFF7F;
-    if (t&&(t->parent!=coordTree)&&(t->parent)) {
-        if (k==currentSelection.lLength) {
-            EnableMenuItem(editMenu, 3 ,MF_ENABLED|MF_BYPOSITION);
-            EnableMenuItem(compMenu, 1 ,MF_ENABLED|MF_BYPOSITION);
-            selectionTop = t;
-            treeFlags |= HY_TREEPANEL_CLIPBOARD_READY;
-        }
-    }
-    _String undoMessage;
-    EnableMenuItem(editMenu, 0 ,MF_ENABLED|MF_BYPOSITION);
-    UINT   menuFlag = MF_BYPOSITION;
-    switch (undoCode) {
-    case 1:
-        undoMessage = "Undo Swap";
-        break;
-    case 2:
-        undoMessage = "Undo Flip";
-        break;
-    case 3:
-        undoMessage = "Undo Collapse";
-        break;
-    case 4:
-        undoMessage = "Undo Delete";
-        break;
-    case 5:
-        undoMessage = "Undo Join";
-        break;
-    case 6:
-        undoMessage = "Undo Cut";
-        break;
-    case 7:
-        undoMessage = "Undo Graft";
-        break;
-    case 8:
-        undoMessage = "Undo Paste";
-        break;
-    case 9:
-        undoMessage = "Undo Subtree Move";
-        break;
-    default:
-        undoMessage = "Can't Undo";
-        menuFlag |= MF_GRAYED;
-    }
-    undoMessage = undoMessage & "\tCtrl-Z";
-    ModifyMenu (editMenu, 0, menuFlag, HY_WINDOW_MENU_ID_EDIT,undoMessage.sData);
-    //printf ("Undo message = %s\n", undoMessage.sData);
-    DrawMenuBar(theWindow);
-}
-
-//__________________________________________________________________
-
-void _HYTreePanel::_HandleIdleEvent (void)
-{
-    /*#ifdef TARGET_API_MAC_CARBON
-    Point    curMouse;
-    GetGlobalMouse (&curMouse);
-
-    unsigned long t;
-    GetDateTime(&t);
-
-
-    if ((abs(curMouse.h-saveMouseH)<=3)
-      &&(abs(curMouse.v-saveMouseV)<=3)
-      &&(t-lastSave>.5))
-
-    {
-        if (!HasToolTip())
-        {
-            GrafPtr curPort;
-            GetPort (&curPort);
-            SetPort (GetWindowPort (theWindow));
-            _DisplayBranchFloater();
-            SetPort (curPort);
-        }
-
-        lastSave   = t;
-    }
-
-    saveMouseH = curMouse.h;
-    saveMouseV = curMouse.v;
-    #endif*/
-}
-
-//__________________________________________________________________
-
-void        _HYTreePanel::_PaintLFStatus(Ptr p)
-{
-    HDC theDC = (HDC)p;
-
-    if (!theDC) {
-        theDC = GetDC (theWindow);
-    }
-
-    if (likeFuncID<0) {
-        _PaintTheCircle (redButtonIcon,theWindow, theDC);
-    } else {
-        if (dubiousNodes.lLength) {
-            _PaintTheCircle (yellowButtonIcon,theWindow, theDC);
-        } else {
-            _PaintTheCircle (greenButtonIcon,theWindow, theDC);
-        }
-    }
-    ReleaseDC (theWindow, theDC);
-}
-
-//EOF
\ No newline at end of file
diff --git a/src/gui/win/include/Components/HYPlatformButton.h b/src/gui/win/include/Components/HYPlatformButton.h
deleted file mode 100644
index 52b186e..0000000
--- a/src/gui/win/include/Components/HYPlatformButton.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A button object for Win32.

    Sergei L. Kosakovsky Pond, May 2000-December 2002.
*/

#ifndef _HYPBUTTON_
#define _HYPBUTTON_

#include "HYPlatformComponent.h"

//__________________________________________________________________

class _HYPlatformButton
{

public:

    _HYPlatformButton(void);
    virtual ~_HYPlatformButton(void);

    virtual void            _SetBackColor    (_HYColor&);
    virtual void            _SetDimensions   (_HYRect,_HYRect);
    virtual void            _SetVisibleSize  (_HYRect);
    virtual void            _SetFont         (_HYFont&);
    void            _SetText         (void);
    void            _SetButtonKind   (unsigned char);
    void            _EnableButton    (bool);

    virtual void            _Paint (Ptr p);
    virtual void            _Update(Ptr p);

    HBRUSH       backFill;
    COLORREF     fc;
    RECT         buttonRect;
    HFONT        pLabelFont;
    HWND         buttonWindow;
};

#endif
\ No newline at end of file
diff --git a/src/gui/win/include/Components/HYPlatformButtonBar.h b/src/gui/win/include/Components/HYPlatformButtonBar.h
deleted file mode 100644
index 792d7e4..0000000
--- a/src/gui/win/include/Components/HYPlatformButtonBar.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    At toolbar menu object for Win 32.

    Sergei L. Kosakovsky Pond, May 2000 - December 2002.
*/

#ifndef _HYPBUTTONBAR_
#define _HYPBUTTONBAR_

#include "HYPlatformComponent.h"

//__________________________________________________________________

class _HYPlatformButtonBar
{

public:

    _HYPlatformButtonBar(void);

    virtual ~_HYPlatformButtonBar(void);

    virtual void        _SetBackColor    (_HYColor&);
    virtual void        _SetDimensions   (_HYRect,_HYRect);
    virtual void        _SetVisibleSize  (_HYRect);
    _HYRect     _GetButtonRect   (bool conv = false);

    virtual void        _Paint (Ptr p);
    virtual void        _Update(Ptr p);
    void        _DisposeButtons (void);
    void        _DisposeButton  (long);
    void        _MarkButtonForUpdate(int);
    void        _UnpushButton   (void);
    int         _FindClickedButton (int,int);


    HWND         ttCtl;
    HBRUSH       backFill;
    RECT         buttonRect;
    int          pushed,
                 lastMouseDown;
};


#endif
\ No newline at end of file
diff --git a/src/gui/win/include/Components/HYPlatformCheckbox.h b/src/gui/win/include/Components/HYPlatformCheckbox.h
deleted file mode 100644
index 51391fd..0000000
--- a/src/gui/win/include/Components/HYPlatformCheckbox.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A checkbox with optional static label object for Win32.

    Sergei L. Kosakovsky Pond, May 2000-December 2002.
*/

#ifndef _HYPLCHECKBOX_
#define _HYPLCHECKBOX_

#include "HYPlatformLabel.h"

//__________________________________________________________________

class _HYPlatformCheckbox
{

public:

    _HYPlatformCheckbox(bool);
    virtual ~_HYPlatformCheckbox(void);

    virtual void        _SetVisibleSize     (_HYRect);
    virtual void        _SetState           (bool);


    virtual void        _Paint (Ptr p);
    virtual void        _Update(Ptr p);
    virtual void        _Enable(bool);

    HWND            buttonWindow;
    RECT            checkboxRect;
    bool            isRadio;

    HBRUSH          defBrush;

    LONG_PTR        mainHandler;
};

#endif
\ No newline at end of file
diff --git a/src/gui/win/include/Components/HYPlatformLabel.h b/src/gui/win/include/Components/HYPlatformLabel.h
deleted file mode 100644
index cfcd1cf..0000000
--- a/src/gui/win/include/Components/HYPlatformLabel.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A static label object for Win32.

    Sergei L. Kosakovsky Pond, May 2000-December 2002.
*/

#ifndef _HYPLABEL_
#define _HYPLABEL_

#include "HYBaseGUI.h"
#include "Windows.h"
#include "hy_strings.h"

//__________________________________________________________________

class _HYPlatformLabel
{

public:

    _HYPlatformLabel(void);
    // flags, title, visibility

    virtual ~_HYPlatformLabel(void);

    virtual void        _SetBackColor    (_HYColor&);
    virtual void        _SetForeColor    (_HYColor&);
    virtual void        _SetDimensions   (_HYRect,_HYRect);
    virtual void        _SetVisibleSize  (_HYRect);
    virtual void        _SetFont         (_HYFont&);
    virtual void        _SetText         (void);

    virtual void        _Paint (Ptr p);
    virtual void        _Update(Ptr p);

    HBRUSH       backFill;
    COLORREF     fc;
    RECT         labelRect;
    HFONT        pLabelFont;
    HPEN         labelPen;
};

#endif
\ No newline at end of file
diff --git a/src/gui/win/include/Components/HYPlatformPullDown.h b/src/gui/win/include/Components/HYPlatformPullDown.h
deleted file mode 100644
index 7afb1fb..0000000
--- a/src/gui/win/include/Components/HYPlatformPullDown.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A pull down menu object for Win 32

    Sergei L. Kosakovsky Pond, May 2000-December 2002
*/

#ifndef _HYPPULLDOWNMENU_
#define _HYPPULLDOWNMENU_


#include "HYPlatformComponent.h"

//__________________________________________________________________

extern   _String    menuSeparator;

//__________________________________________________________________

class _HYPlatformPullDown
{

public:

    _HYPlatformPullDown(void);
    // flags, title, visibility

    virtual ~_HYPlatformPullDown(void);

    virtual void        _AddMenuItem     (_String&, long);
    virtual void        _SetMenuItem     (_String&, long);
    virtual void        _SetBackColor    (_HYColor&);
    virtual void        _Duplicate       (Ptr);
    virtual void        _DeleteMenuItem  (long);
    virtual long        _GetSelection    (void);
    virtual void        _SetDimensions   (_HYRect,_HYRect);
    virtual void        _SetVisibleSize  (_HYRect);
    virtual void        _EnableItem      (long, bool);
    virtual void        _MarkItem        (long, char);
    virtual char        _ItemMark        (long);
    virtual void        _EnableMenu      (bool);


    virtual void        _Paint           (Ptr);
    virtual void        _Update          (Ptr);
    virtual void        _RefreshComboBox (void);
    virtual void        _AdjustItemIDs   (long, long, long);


    HWND         myMenu;
    HBRUSH       backFill;
    HMENU        theMenu;

    long         selection,
                 cbSelection,
                 menuWidth;

    LONG_PTR     mainHandler;

    RECT         menuRect;
};


#endif
\ No newline at end of file
diff --git a/src/gui/win/include/Components/HYPlatformTable.h b/src/gui/win/include/Components/HYPlatformTable.h
deleted file mode 100644
index b604e7a..0000000
--- a/src/gui/win/include/Components/HYPlatformTable.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A text input box object for Win 32.

    Sergei L. Kosakovsky Pond, May 2000-December 2002.
*/

#ifndef _HYPLTABLE_
#define _HYPLTABLE_


//__________________________________________________________________

#include "HYPlatformComponent.h"

#define     HY_TABLE_SIZE_CURSOR   0x01
#define     HY_TABLE_DRAG_CURSOR   0x02
#define     HY_TABLE_EDIT_CURSOR   0x04

//__________________________________________________________________

class _HYPlatformTable
{

public:

    _HYPlatformTable        (void);
    virtual             ~_HYPlatformTable       (void);

    void            _SetFont                (void);
    void            _SetBackColor           (_HYColor&);
    void            _SetBackColor2          (_HYColor&);

    void            _CreateTextBox          (_HYRect&,_String&);
    _String         _RetrieveTextValue      (void);
    void            _KillTextBox            (void);
    bool            _HasTextBox             (void) {
        return      editBox;
    }

    RECT            _GetVisibleRowRect      (long);

    void            _HiliteRowForDrag       (long,long);
    void            _ResetCursorState       (void);

    void            _FrameRect              (RECT&);

    HBRUSH          backPattern,
                    backPattern2;

    HFONT           tableFont,
                    tableFontB,
                    tableFontI,
                    tableFontBI;

    char            cursorState;

    HWND            editBox;
    RECT            textBoxRect,
                    limits;

    long            activeColumn,
                    activeColumn2;

    LONG_PTR        defautlTextHandler;


};

#endif
\ No newline at end of file
diff --git a/src/gui/win/include/Components/HYPlatformTextbox.h b/src/gui/win/include/Components/HYPlatformTextbox.h
deleted file mode 100644
index b98ad09..0000000
--- a/src/gui/win/include/Components/HYPlatformTextbox.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A text input box object for Win32

    Sergei L. Kosakovsky Pond, May 2000-December 2002.
*/

#ifndef _HYPLTEXTBOX_
#define _HYPLTEXTBOX_

#include "HYPlatformComponent.h"
#include <richedit.h>

//__________________________________________________________________

class _HYPlatformTextBox
{

public:

    _HYPlatformTextBox (void);

    virtual ~_HYPlatformTextBox(void);

    virtual void            _SetBackColor    (_HYColor&);
    virtual void            _SetBackTColor   (_HYColor&);
    virtual void            _SetForeColor    (_HYColor&);
    virtual void            _SetDimensions   (_HYRect,_HYRect);
    virtual void            _SetVisibleSize  (_HYRect);
    virtual void            _SetFont         (_HYFont&);
    void            _SetText         (const _String&);
    void            _InsertText      (const _String&, bool);
    _String         _GetText         (void);
    void            _StoreText       (_String*&, bool);
    void            _CreateTE        (void);
    void            _EnableTextBox   (bool);
    void            _SetMargins      (_HYRect&);
    void            _SetAlignFlags   (unsigned char);

    virtual void            _Paint (Ptr p);
    virtual void            _Update(Ptr p);

    virtual void            _FocusComponent  (void);
    virtual void            _UnfocusComponent(void);
    virtual bool            _NeedMultiLines  (void);

    HBRUSH          backFill,
                    backTFill;
    HWND            te;
    RECT            textBoxRect;
    COLORREF        textColor;
    HFONT           pLabelFont;

    LONG_PTR        mainHandler;
    bool            isSingleLine;
};

//__________________________________________________________________

_String                 retrieveEditControlText (HWND);
void                    retrieveEditControlText (HWND, _String*&);

#endif
\ No newline at end of file
diff --git a/src/gui/win/include/HYPlatformButtonMenu.h b/src/gui/win/include/HYPlatformButtonMenu.h
deleted file mode 100644
index 37ab3f0..0000000
--- a/src/gui/win/include/HYPlatformButtonMenu.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A pull down menu object for MacOS.

    Sergei L. Kosakovsky Pond, July 2000-June 2002.
*/

#ifndef _HYPPULLDOWNMENU_
#define _HYPPULLDOWNMENU_
#pragma once

#include "HYBaseGUI.h"
#include "Windows.h"
#include <strings.h>

//__________________________________________________________________

class _HYPlatformPullDown
{

public:

    _HYPlatformPullDown(void);
    // flags, title, visibility

    virtual ~_HYPlatformPullDown(void);

    virtual void        _AddMenuItem     (_String&, long);
    virtual void        _SetBackColor    (_HYColor&);
    virtual void        _Duplicate       (Ptr);
    virtual void        _DeleteMenuItem  (long);
    virtual long        _GetSelection    (void);
    virtual void        _SetDimensions   (_HYRect,_HYRect);
    virtual void        _SetVisibleSize  (_HYRect);
    virtual void        _EnableItem      (long, bool);


    virtual void        _Paint (Ptr p);
    virtual void        _Update(Ptr p);

// new

    virtual void        _MarkItem        (long, char);
    virtual char        _ItemMark        (long);

// end new

    HWND         myMenu;
    HBRUSH       backFill;
    long         selection, menuWidth;
    _List        disabledItems;
    _SimpleList  disabledIndices;
    RECT         menuRect;
};

//__________________________________________________________________

class _HYPlatformLabel
{

public:

    _HYPlatformLabel(void);
    // flags, title, visibility

    virtual ~_HYPlatformLabel(void);

    virtual void        _SetBackColor    (_HYColor&);
    virtual void        _SetForeColor    (_HYColor&);
    virtual void        _SetDimensions   (_HYRect,_HYRect);
    virtual void        _SetVisibleSize  (_HYRect);
    virtual void        _SetFont         (_HYFont&);

    virtual void        _Paint (Ptr p);
    virtual void        _Update(Ptr p);

    HBRUSH       backFill;
    COLORREF     fc;
    RECT         labelRect;
    HFONT        pLabelFont;
    HPEN         labelPen;
};

//__________________________________________________________________

class _HYPlatformButtonBar
{

public:

    _HYPlatformButtonBar(void);

    virtual ~_HYPlatformButtonBar(void);

    virtual void        _SetBackColor    (_HYColor&);
    virtual void        _SetDimensions   (_HYRect,_HYRect);
    virtual void        _SetVisibleSize  (_HYRect);

    virtual void        _Paint (Ptr p);
    virtual void        _Update(Ptr p);
    void        _DisposeButtons (void);
    void        _MarkButtonForUpdate(int);

    HBRUSH       backFill;
    RECT         buttonRect;
    int          pushed;
};

//__________________________________________________________________

#endif

//EOF
\ No newline at end of file
diff --git a/src/gui/win/include/HYPlatformComponent.h b/src/gui/win/include/HYPlatformComponent.h
deleted file mode 100644
index 3223bba..0000000
--- a/src/gui/win/include/HYPlatformComponent.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A general composite window component object, Windows specifics

    Sergei L. Kosakovsky Pond, June 2000-June 2002.
*/

#ifndef _HYPCOMPONENT_
#define _HYPCOMPONENT_
#pragma once

#include "HYBaseGUI.h"
#include "Windows.h"

#define  HY_COMPONENT_ENABLE_H_SCROLL 0x01
#define  HY_COMPONENT_ENABLE_V_SCROLL 0x02

#define  HY_SCROLLER_WIDTH 16

//__________________________________________________________________

class _HYPlatformComponent
{

public:

    _HYPlatformComponent(void);
    _HYPlatformComponent(_HYRect,Ptr);
    // settings

    virtual ~_HYPlatformComponent() {};

    virtual void        Duplicate (BaseRef);

    virtual void        _CleanUp   (void);

    virtual void        _SetDimensions (_HYRect,_HYRect);
    virtual void        _SetVisibleSize(_HYRect);

    virtual void        _Paint (Ptr);
    virtual void        _Update (Ptr);
    virtual bool        _ProcessOSEvent (Ptr);
    virtual _HYRect     _VisibleContents(Ptr);
    virtual void        _MarkForUpdate (void);


// new

    virtual void        _MarkContentsForUpdate (void);
    virtual long        _GetHScrollerPos (void);
    virtual long        _GetVScrollerPos (void);
    virtual void        _SetHScrollerPos (long);
    virtual void        _SetVScrollerPos (long);
    virtual void        _Activate (void);
    virtual void        _Deactivate(void);
    virtual void        _ComponentMouseExit (void) {}



    HWND          parentWindow,
                  vScroll,
                  hScroll;

    bool          activationFlag;

    _HYRect       rel;

    char          scrollState;
};

//__________________________________________________________________

void                AlignRectangle   (_HYRect& rel , RECT& target , unsigned char alFlags);
COLORREF            HYColor2ColorRef (_HYColor&, HDC);
RECT                HYRect2Rect      (_HYRect&);
#endif

//EOF
\ No newline at end of file
diff --git a/src/gui/win/include/HYPlatformGraphicPane.h b/src/gui/win/include/HYPlatformGraphicPane.h
deleted file mode 100644
index 7d0ef78..0000000
--- a/src/gui/win/include/HYPlatformGraphicPane.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A painting canvas with double buffer. Windows.

    Sergei L. Kosakovsky Pond, May 2000-June 2002
*/

#ifndef _HYPGRAPHICPANE_
#define _HYPGRAPHICPANE_
#pragma once

#include <windows.h>
#include "HYBaseGUI.h"

//__________________________________________________________________

class  _HYPlatformGraphicPane
{

public:

    _HYPlatformGraphicPane(int, int,int);
    // initial size

    virtual ~_HYPlatformGraphicPane();

    virtual void        _SetPaneSize  (int,int,int);
    virtual void        _DrawLine    (_HYRect);
    virtual void        _DrawHatchedLine     (_HYRect);
    // from, to , width
    virtual void        _DisplayText (_String,int,int,bool);
    // text, where, left-right or top-bottom
    virtual void        _DrawRect    (_HYRect);
    virtual void        _FillRect    (_HYRect);
    virtual void        _EraseRect   (_HYRect);
    virtual void        _DrawOval    (_HYRect);
    virtual void        _FillOval    (_HYRect);
    virtual void        _EraseOval   (_HYRect);
    virtual void        _DrawArc     (_HYRect,int,int);
    virtual void        _FillArc     (_HYRect,int,int);
    virtual void        _EraseArc    (_HYRect,int,int);
    virtual void        _SetColor    (_HYColor);
    virtual void        _SetFont     (_HYFont);
    virtual void        _StartDraw   (void);
    virtual void        _EndDraw     (void);
    virtual void        _SetPort     (Ptr);
    virtual void        _DrawPicRes  (_HYRect&, long);

// new

    virtual void        _SetBColor   (_HYColor);
    virtual void        _DisplayText  (_String&,_HYRect&, char);
    virtual void        _DisplayChar  (char,int,int);
    virtual void        _SetFontSize (long);
    virtual void        _SlidePane   (int dv, int dh);
    virtual void        _SlideRect   (_HYRect&r ,int dv, int dh);
    virtual void        _InvertRect  (_HYRect&);
    virtual void        _SavePicture (_String);
    virtual Ptr         _DefinePolygon
    (_SimpleList&);
    virtual void        _KillPolygon (Ptr);
    virtual void        _DrawPolygon (Ptr,long = 1);
    virtual void        _FillPolygon (Ptr);
    virtual void        _ErasePolygon(Ptr);
    virtual void        _SetDialogBG (void);
    virtual void        _CopyToClipboard
    (void);

    HDC          thePane;
    int          lastPenSize;

    HBITMAP      paneBitMap,
                 oldMap;

protected:

    void         CheckPen (_HYRect&, bool force = false);
    HBRUSH       fillColor,
                 backColor,
                 oldBrush;


    HPEN         oldPen;
    HFONT        oldFont;

};

extern   HINSTANCE    ProgramInstance;

POINT                 DrawTransparentBitmap(HDC, HBITMAP, short,short,short,short, COLORREF);

extern   HDC          otherDC;
extern   HBITMAP      oDCBM;


#endif

//EOF
\ No newline at end of file
diff --git a/src/gui/win/include/HYPlatformWindow.h b/src/gui/win/include/HYPlatformWindow.h
deleted file mode 100644
index 614a350..0000000
--- a/src/gui/win/include/HYPlatformWindow.h
+++ /dev/null
@@ -1 +0,0 @@
-/*
    A Windows window object - a window/title/size-box/scroll-bars handler.

    Sergei L. Kosakovsky Pond, June 2000-June 2002.
*/

#ifndef _HYPWINDOW_
#define _HYPWINDOW_
#pragma once

#define  MAX_CONTROL_VALUE      100000000

#define  HY_WINDOW_MENU_ID_FILE 5000
#define  HY_WINDOW_MENU_ID_EDIT 5050

#include "hy_strings.h"
#include <windows.h>
#include <commdlg.h>
#include "HYBaseGUI.h"

struct  _HYWindowsUIMessage {
    UINT    iMsg;
    WPARAM  wParam;
    LPARAM  lParam;
    LRESULT res;
};

//__________________________________________________________________

class _HYPlatformWindow
{

public:

    _HYPlatformWindow(unsigned char,_String,bool,Ptr);
    // flags, title, visibility

    virtual ~_HYPlatformWindow();

    void        _SetTitle               (_String);
    void        _Show                   (void);
    void        _Hide                   (void);
    virtual long        _Grow                   (Ptr);
    virtual bool        _Close                  (Ptr);
    virtual void        _Move                   (Ptr);
    void        _SelectWindow           (void);
    virtual void        _SetWindowRectangle     (int,int,int,int,bool=true);
    virtual void        _SetContentSize         (int,int);
    virtual void        _Paint                  (Ptr);
    virtual void        _Update                 (Ptr);
    virtual void        _Activate               (void);
    virtual void        _Deactivate             (void);
    virtual bool        _ProcessOSEvent         (Ptr);
    virtual void        _VisibleContents        (int&,int&,int&,int&);
    bool        _IsHScroll              (HWND);
    virtual bool        _ProcessMenuSelection   (long) {
        return false;
    }
    virtual void        _SetMenuBar             (void);
    virtual void        _UnsetMenuBar           (void);
    virtual Ptr         _GetOSWindowData        (void) {
        return (Ptr)theWindow;
    }

// new

    virtual void        _SetPosition            (int,int);
    virtual void        _BringWindowToFront     (void);
    virtual _HYRect     _GetWindowRect          (void);
    virtual _String&    _GetTitle               (void);
    void        _SetWindowBackColor     (_HYColor);

    virtual void        _AddStandardAccels      (void);
    virtual void        _BuildAccelTable        (bool force = false);

// end new

    HWND        theWindow,
                oldFrontWindow;
    HMENU       windowMenu;
    RECT        newVRect ();
    RECT        newHRect ();
    HACCEL      menuKeys;

    unsigned char
    flags;

    _SimpleList accels;

    Ptr         parentWindowPtr;
};

//__________________________________________________________________

class _HYPlatformTWindow
{

public:

    _HYPlatformTWindow  (Ptr) {
        idleTimer = 0;
        hWindowPad = 0;
        vWindowPad = 0;
        trackMouseComponent = nil;
    }

    virtual         ~_HYPlatformTWindow (void) {}
    virtual void    _SetWindowRectangle     (int,int,int,int,bool=true);

    UINT_PTR idleTimer;

    long     hWindowPad,
             vWindowPad;


    _HYGuiObject*
    trackMouseComponent;


//virtual void   _Activate          (void);
//virtual void   _Deactivate        (void);

};

//__________________________________________________________________

class _HYPlatformPWindow
{

public:

    _HYPlatformPWindow          (void);

    virtual ~_HYPlatformPWindow         (void);

    virtual void _StartPicture          (void);
    virtual void _EndPicture            (void);
    virtual void _DrawPicture           (_HYRect);

private:

    HENHMETAFILE     savedPic;
    HDC              stashedDC;

};


//__________________________________________________________________

COLORREF  HYColor2ColorRef (_HYColor&, HDC);

extern    bool          forceUpdateForScrolling;
extern    BOOL          UserAbortFlag;
extern    HBRUSH        windowStatusBarBrush;
extern    HFONT         statusBarPlain;
extern    HWND          PrintDialogHandle;
extern    char          WinName[],
          AppName[];

extern    HINSTANCE     ProgramInstance;
extern    HWND          WindowHandle;
extern    HBRUSH        windowStatusBarBrush;
extern    HPEN          _BLACKPEN_;

extern    HBITMAP       redButtonIcon,
          yellowButtonIcon,
          orangeButtonIcon,
          greenButtonIcon;

BOOL      CALLBACK      PrintDialogProc(HWND, UINT, WPARAM, LPARAM);
BOOL      CALLBACK      AbortProc(HDC, int);
HDC                     GetPrinterDeviceContext(HWND);

#define                 IDD_FNAME               10
#define                 IDLE_WINDOW_TIMER       111
#define                 GLOBAL_QUEUE_TIMER      222

extern  _SimpleList     windowPtrs,
        windowObjects,
        windowObjectRefs;

int     MessageLoop     (bool = true, bool = true);

void    _PaintTheCircle (HBITMAP, HWND, HDC);
#endif

//EOF
\ No newline at end of file
diff --git a/src/gui/win/include/pthread.h b/src/gui/win/include/pthread.h
deleted file mode 100644
index 689ba4a..0000000
--- a/src/gui/win/include/pthread.h
+++ /dev/null
@@ -1,1363 +0,0 @@
-/* This is an implementation of the threads API of POSIX 1003.1-2001.
- *
- * --------------------------------------------------------------------------
- *
- *      Pthreads-win32 - POSIX Threads Library for Win32
- *      Copyright(C) 1998 John E. Bossom
- *      Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- *      Contact Email: rpj at callisto.canberra.edu.au
- *
- *      The current list of contributors is contained
- *      in the file CONTRIBUTORS included with the source
- *      code distribution. The list can also be seen at the
- *      following World Wide Web location:
- *      http://sources.redhat.com/pthreads-win32/contributors.html
- *
- *      This library is free software; you can redistribute it and/or
- *      modify it under the terms of the GNU Lesser General Public
- *      License as published by the Free Software Foundation; either
- *      version 2 of the License, or (at your option) any later version.
- *
- *      This library is distributed in the hope that it will be useful,
- *      but WITHOUT ANY WARRANTY; without even the implied warranty of
- *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *      Lesser General Public License for more details.
- *
- *      You should have received a copy of the GNU Lesser General Public
- *      License along with this library in the file COPYING.LIB;
- *      if not, write to the Free Software Foundation, Inc.,
- *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#if !defined( PTHREAD_H )
-#define PTHREAD_H
-
-/*
- * See the README file for an explanation of the pthreads-win32 version
- * numbering scheme and how the DLL is named etc.
- */
-#define PTW32_VERSION 2,7,0,0
-#define PTW32_VERSION_STRING "2, 7, 0, 0\0"
-
-/* There are three implementations of cancel cleanup.
- * Note that pthread.h is included in both application
- * compilation units and also internally for the library.
- * The code here and within the library aims to work
- * for all reasonable combinations of environments.
- *
- * The three implementations are:
- *
- *   WIN32 SEH
- *   C
- *   C++
- *
- * Please note that exiting a push/pop block via
- * "return", "exit", "break", or "continue" will
- * lead to different behaviour amongst applications
- * depending upon whether the library was built
- * using SEH, C++, or C. For example, a library built
- * with SEH will call the cleanup routine, while both
- * C++ and C built versions will not.
- */
-
-/*
- * Define defaults for cleanup code.
- * Note: Unless the build explicitly defines one of the following, then
- * we default to standard C style cleanup. This style uses setjmp/longjmp
- * in the cancelation and thread exit implementations and therefore won't
- * do stack unwinding if linked to applications that have it (e.g.
- * C++ apps). This is currently consistent with most/all commercial Unix
- * POSIX threads implementations.
- */
-#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C )
-# define __CLEANUP_C
-#endif
-
-#if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC))
-#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler.
-#endif
-
-/*
- * Stop here if we are being included by the resource compiler.
- */
-#ifndef RC_INVOKED
-
-#undef PTW32_LEVEL
-
-#if defined(_POSIX_SOURCE)
-#define PTW32_LEVEL 0
-/* Early POSIX */
-#endif
-
-#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 1
-/* Include 1b, 1c and 1d */
-#endif
-
-#if defined(INCLUDE_NP)
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 2
-/* Include Non-Portable extensions */
-#endif
-
-#define PTW32_LEVEL_MAX 3
-
-#if !defined(PTW32_LEVEL)
-#define PTW32_LEVEL PTW32_LEVEL_MAX
-/* Include everything */
-#endif
-
-#ifdef _UWIN
-#   define HAVE_STRUCT_TIMESPEC 1
-#   define HAVE_SIGNAL_H        1
-#   undef HAVE_CONFIG_H
-#   pragma comment(lib, "pthread")
-#endif
-
-/*
- * -------------------------------------------------------------
- *
- *
- * Module: pthread.h
- *
- * Purpose:
- *      Provides an implementation of PThreads based upon the
- *      standard:
- *
- *              POSIX 1003.1-2001
- *  and
- *    The Single Unix Specification version 3
- *
- *    (these two are equivalent)
- *
- *      in order to enhance code portability between Windows,
- *  various commercial Unix implementations, and Linux.
- *
- *      See the ANNOUNCE file for a full list of conforming
- *      routines and defined constants, and a list of missing
- *      routines and constants not defined in this implementation.
- *
- * Authors:
- *      There have been many contributors to this library.
- *      The initial implementation was contributed by
- *      John Bossom, and several others have provided major
- *      sections or revisions of parts of the implementation.
- *      Often significant effort has been contributed to
- *      find and fix important bugs and other problems to
- *      improve the reliability of the library, which sometimes
- *      is not reflected in the amount of code which changed as
- *      result.
- *      As much as possible, the contributors are acknowledged
- *      in the ChangeLog file in the source code distribution
- *      where their changes are noted in detail.
- *
- *      Contributors are listed in the CONTRIBUTORS file.
- *
- *      As usual, all bouquets go to the contributors, and all
- *      brickbats go to the project maintainer.
- *
- * Maintainer:
- *      The code base for this project is coordinated and
- *      eventually pre-tested, packaged, and made available by
- *
- *              Ross Johnson <rpj at callisto.canberra.edu.au>
- *
- * QA Testers:
- *      Ultimately, the library is tested in the real world by
- *      a host of competent and demanding scientists and
- *      engineers who report bugs and/or provide solutions
- *      which are then fixed or incorporated into subsequent
- *      versions of the library. Each time a bug is fixed, a
- *      test case is written to prove the fix and ensure
- *      that later changes to the code don't reintroduce the
- *      same error. The number of test cases is slowly growing
- *      and therefore so is the code reliability.
- *
- * Compliance:
- *      See the file ANNOUNCE for the list of implemented
- *      and not-implemented routines and defined options.
- *      Of course, these are all defined is this file as well.
- *
- * Web site:
- *      The source code and other information about this library
- *      are available from
- *
- *              http://sources.redhat.com/pthreads-win32/
- *
- * -------------------------------------------------------------
- */
-
-/* Try to avoid including windows.h */
-#if defined(__MINGW32__) && defined(__cplusplus)
-#define PTW32_INCLUDE_WINDOWS_H
-#endif
-
-#ifdef PTW32_INCLUDE_WINDOWS_H
-#include <windows.h>
-#endif
-
-#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__)
-/*
- * VC++6.0 or early compiler's header has no DWORD_PTR type.
- */
-typedef unsigned long DWORD_PTR;
-#endif
-/*
- * -----------------
- * autoconf switches
- * -----------------
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#ifndef NEED_FTIME
-#include <time.h>
-#else /* NEED_FTIME */
-/* use native WIN32 time API */
-#endif /* NEED_FTIME */
-
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif /* HAVE_SIGNAL_H */
-
-#include <setjmp.h>
-#include <limits.h>
-
-/*
- * Boolean values to make us independent of system includes.
- */
-enum {
-    PTW32_FALSE = 0,
-    PTW32_TRUE = (! PTW32_FALSE)
-};
-
-/*
- * This is a duplicate of what is in the autoconf config.h,
- * which is only used when building the pthread-win32 libraries.
- */
-
-#ifndef PTW32_CONFIG_H
-#  if defined(WINCE)
-#    define NEED_ERRNO
-#    define NEED_SEM
-#  endif
-#  if defined(_UWIN) || defined(__MINGW32__)
-#    define HAVE_MODE_T
-#  endif
-#endif
-
-/*
- *
- */
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-#ifdef NEED_ERRNO
-#include "need_errno.h"
-#else
-#include <errno.h>
-#endif
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-/*
- * Several systems don't define some error numbers.
- */
-#ifndef ENOTSUP
-#  define ENOTSUP 48   /* This is the value in Solaris. */
-#endif
-
-#ifndef ETIMEDOUT
-#  define ETIMEDOUT 10060     /* This is the value in winsock.h. */
-#endif
-
-#ifndef ENOSYS
-#  define ENOSYS 140     /* Semi-arbitrary value */
-#endif
-
-#ifndef EDEADLK
-#  ifdef EDEADLOCK
-#    define EDEADLK EDEADLOCK
-#  else
-#    define EDEADLK 36     /* This is the value in MSVC. */
-#  endif
-#endif
-
-#include <sched.h>
-
-/*
- * To avoid including windows.h we define only those things that we
- * actually need from it.
- */
-#ifndef PTW32_INCLUDE_WINDOWS_H
-#ifndef HANDLE
-# define PTW32__HANDLE_DEF
-# define HANDLE void *
-#endif
-#ifndef DWORD
-# define PTW32__DWORD_DEF
-# define DWORD unsigned long
-#endif
-#endif
-
-#ifndef HAVE_STRUCT_TIMESPEC
-#define HAVE_STRUCT_TIMESPEC 1
-struct timespec {
-    long tv_sec;
-    long tv_nsec;
-};
-#endif /* HAVE_STRUCT_TIMESPEC */
-
-#ifndef SIG_BLOCK
-#define SIG_BLOCK 0
-#endif /* SIG_BLOCK */
-
-#ifndef SIG_UNBLOCK
-#define SIG_UNBLOCK 1
-#endif /* SIG_UNBLOCK */
-
-#ifndef SIG_SETMASK
-#define SIG_SETMASK 2
-#endif /* SIG_SETMASK */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif                          /* __cplusplus */
-
-    /*
-     * -------------------------------------------------------------
-     *
-     * POSIX 1003.1-2001 Options
-     * =========================
-     *
-     * Options are normally set in <unistd.h>, which is not provided
-     * with pthreads-win32.
-     *
-     * For conformance with the Single Unix Specification (version 3), all of the
-     * options below are defined, and have a value of either -1 (not supported)
-     * or 200112L (supported).
-     *
-     * These options can neither be left undefined nor have a value of 0, because
-     * either indicates that sysconf(), which is not implemented, may be used at
-     * runtime to check the status of the option.
-     *
-     * _POSIX_THREADS (== 200112L)
-     *                      If == 200112L, you can use threads
-     *
-     * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L)
-     *                      If == 200112L, you can control the size of a thread's
-     *                      stack
-     *                              pthread_attr_getstacksize
-     *                              pthread_attr_setstacksize
-     *
-     * _POSIX_THREAD_ATTR_STACKADDR (== -1)
-     *                      If == 200112L, you can allocate and control a thread's
-     *                      stack. If not supported, the following functions
-     *                      will return ENOSYS, indicating they are not
-     *                      supported:
-     *                              pthread_attr_getstackaddr
-     *                              pthread_attr_setstackaddr
-     *
-     * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1)
-     *                      If == 200112L, you can use realtime scheduling.
-     *                      This option indicates that the behaviour of some
-     *                      implemented functions conforms to the additional TPS
-     *                      requirements in the standard. E.g. rwlocks favour
-     *                      writers over readers when threads have equal priority.
-     *
-     * _POSIX_THREAD_PRIO_INHERIT (== -1)
-     *                      If == 200112L, you can create priority inheritance
-     *                      mutexes.
-     *                              pthread_mutexattr_getprotocol +
-     *                              pthread_mutexattr_setprotocol +
-     *
-     * _POSIX_THREAD_PRIO_PROTECT (== -1)
-     *                      If == 200112L, you can create priority ceiling mutexes
-     *                      Indicates the availability of:
-     *                              pthread_mutex_getprioceiling
-     *                              pthread_mutex_setprioceiling
-     *                              pthread_mutexattr_getprioceiling
-     *                              pthread_mutexattr_getprotocol     +
-     *                              pthread_mutexattr_setprioceiling
-     *                              pthread_mutexattr_setprotocol     +
-     *
-     * _POSIX_THREAD_PROCESS_SHARED (== -1)
-     *                      If set, you can create mutexes and condition
-     *                      variables that can be shared with another
-     *                      process.If set, indicates the availability
-     *                      of:
-     *                              pthread_mutexattr_getpshared
-     *                              pthread_mutexattr_setpshared
-     *                              pthread_condattr_getpshared
-     *                              pthread_condattr_setpshared
-     *
-     * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L)
-     *                      If == 200112L you can use the special *_r library
-     *                      functions that provide thread-safe behaviour
-     *
-     * _POSIX_READER_WRITER_LOCKS (== 200112L)
-     *                      If == 200112L, you can use read/write locks
-     *
-     * _POSIX_SPIN_LOCKS (== 200112L)
-     *                      If == 200112L, you can use spin locks
-     *
-     * _POSIX_BARRIERS (== 200112L)
-     *                      If == 200112L, you can use barriers
-     *
-     *      + These functions provide both 'inherit' and/or
-     *        'protect' protocol, based upon these macro
-     *        settings.
-     *
-     * -------------------------------------------------------------
-     */
-
-    /*
-     * POSIX Options
-     */
-#undef _POSIX_THREADS
-#define _POSIX_THREADS 200112L
-
-#undef _POSIX_READER_WRITER_LOCKS
-#define _POSIX_READER_WRITER_LOCKS 200112L
-
-#undef _POSIX_SPIN_LOCKS
-#define _POSIX_SPIN_LOCKS 200112L
-
-#undef _POSIX_BARRIERS
-#define _POSIX_BARRIERS 200112L
-
-#undef _POSIX_THREAD_SAFE_FUNCTIONS
-#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
-
-#undef _POSIX_THREAD_ATTR_STACKSIZE
-#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
-
-    /*
-     * The following options are not supported
-     */
-#undef _POSIX_THREAD_ATTR_STACKADDR
-#define _POSIX_THREAD_ATTR_STACKADDR -1
-
-#undef _POSIX_THREAD_PRIO_INHERIT
-#define _POSIX_THREAD_PRIO_INHERIT -1
-
-#undef _POSIX_THREAD_PRIO_PROTECT
-#define _POSIX_THREAD_PRIO_PROTECT -1
-
-    /* TPS is not fully supported.  */
-#undef _POSIX_THREAD_PRIORITY_SCHEDULING
-#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
-
-#undef _POSIX_THREAD_PROCESS_SHARED
-#define _POSIX_THREAD_PROCESS_SHARED -1
-
-
-    /*
-     * POSIX 1003.1-2001 Limits
-     * ===========================
-     *
-     * These limits are normally set in <limits.h>, which is not provided with
-     * pthreads-win32.
-     *
-     * PTHREAD_DESTRUCTOR_ITERATIONS
-     *                      Maximum number of attempts to destroy
-     *                      a thread's thread-specific data on
-     *                      termination (must be at least 4)
-     *
-     * PTHREAD_KEYS_MAX
-     *                      Maximum number of thread-specific data keys
-     *                      available per process (must be at least 128)
-     *
-     * PTHREAD_STACK_MIN
-     *                      Minimum supported stack size for a thread
-     *
-     * PTHREAD_THREADS_MAX
-     *                      Maximum number of threads supported per
-     *                      process (must be at least 64).
-     *
-     * SEM_NSEMS_MAX
-     *                      The maximum number of semaphores a process can have.
-     *                      (must be at least 256)
-     *
-     * SEM_VALUE_MAX
-     *                      The maximum value a semaphore can have.
-     *                      (must be at least 32767)
-     *
-     */
-#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
-#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS     4
-
-#undef PTHREAD_DESTRUCTOR_ITERATIONS
-#define PTHREAD_DESTRUCTOR_ITERATIONS           _POSIX_THREAD_DESTRUCTOR_ITERATIONS
-
-#undef _POSIX_THREAD_KEYS_MAX
-#define _POSIX_THREAD_KEYS_MAX                  128
-
-#undef PTHREAD_KEYS_MAX
-#define PTHREAD_KEYS_MAX                        _POSIX_THREAD_KEYS_MAX
-
-#undef PTHREAD_STACK_MIN
-#define PTHREAD_STACK_MIN                       0
-
-#undef _POSIX_THREAD_THREADS_MAX
-#define _POSIX_THREAD_THREADS_MAX               64
-
-    /* Arbitrary value */
-#undef PTHREAD_THREADS_MAX
-#define PTHREAD_THREADS_MAX                     2019
-
-#undef _POSIX_SEM_NSEMS_MAX
-#define _POSIX_SEM_NSEMS_MAX                    256
-
-    /* Arbitrary value */
-#undef SEM_NSEMS_MAX
-#define SEM_NSEMS_MAX                           1024
-
-#undef _POSIX_SEM_VALUE_MAX
-#define _POSIX_SEM_VALUE_MAX                    32767
-
-#undef SEM_VALUE_MAX
-#define SEM_VALUE_MAX                           INT_MAX
-
-
-#if __GNUC__ && ! defined (__declspec)
-# error Please upgrade your GNU compiler to one that supports __declspec.
-#endif
-
-    /*
-     * When building the DLL code, you should define PTW32_BUILD so that
-     * the variables/functions are exported correctly. When using the DLL,
-     * do NOT define PTW32_BUILD, and then the variables/functions will
-     * be imported correctly.
-     */
-#ifndef PTW32_STATIC_LIB
-#  ifdef PTW32_BUILD
-#    define PTW32_DLLPORT __declspec (dllexport)
-#  else
-#    define PTW32_DLLPORT __declspec (dllimport)
-#  endif
-#else
-#  define PTW32_DLLPORT
-#endif
-
-    /*
-     * The Open Watcom C/C++ compiler uses a non-standard calling convention
-     * that passes function args in registers unless __cdecl is explicitly specified
-     * in exposed function prototypes.
-     *
-     * We force all calls to cdecl even though this could slow Watcom code down
-     * slightly. If you know that the Watcom compiler will be used to build both
-     * the DLL and application, then you can probably define this as a null string.
-     * Remember that pthread.h (this file) is used for both the DLL and application builds.
-     */
-#define PTW32_CDECL __cdecl
-
-#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX
-#   include     <sys/types.h>
-#else
-    /*
-     * Generic handle type - intended to extend uniqueness beyond
-     * that available with a simple pointer. It should scale for either
-     * IA-32 or IA-64.
-     */
-    typedef struct {
-        void * p;                   /* Pointer to actual object */
-        unsigned int x;             /* Extra information - reuse count etc */
-    } ptw32_handle_t;
-
-    typedef ptw32_handle_t pthread_t;
-    typedef struct pthread_attr_t_ * pthread_attr_t;
-    typedef struct pthread_once_t_ pthread_once_t;
-    typedef struct pthread_key_t_ * pthread_key_t;
-    typedef struct pthread_mutex_t_ * pthread_mutex_t;
-    typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t;
-    typedef struct pthread_cond_t_ * pthread_cond_t;
-    typedef struct pthread_condattr_t_ * pthread_condattr_t;
-#endif
-    typedef struct pthread_rwlock_t_ * pthread_rwlock_t;
-    typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t;
-    typedef struct pthread_spinlock_t_ * pthread_spinlock_t;
-    typedef struct pthread_barrier_t_ * pthread_barrier_t;
-    typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t;
-
-    /*
-     * ====================
-     * ====================
-     * POSIX Threads
-     * ====================
-     * ====================
-     */
-
-    enum {
-        /*
-         * pthread_attr_{get,set}detachstate
-         */
-        PTHREAD_CREATE_JOINABLE       = 0,  /* Default */
-        PTHREAD_CREATE_DETACHED       = 1,
-
-        /*
-         * pthread_attr_{get,set}inheritsched
-         */
-        PTHREAD_INHERIT_SCHED         = 0,
-        PTHREAD_EXPLICIT_SCHED        = 1,  /* Default */
-
-        /*
-         * pthread_{get,set}scope
-         */
-        PTHREAD_SCOPE_PROCESS         = 0,
-        PTHREAD_SCOPE_SYSTEM          = 1,  /* Default */
-
-        /*
-         * pthread_setcancelstate paramters
-         */
-        PTHREAD_CANCEL_ENABLE         = 0,  /* Default */
-        PTHREAD_CANCEL_DISABLE        = 1,
-
-        /*
-         * pthread_setcanceltype parameters
-         */
-        PTHREAD_CANCEL_ASYNCHRONOUS   = 0,
-        PTHREAD_CANCEL_DEFERRED       = 1,  /* Default */
-
-        /*
-         * pthread_mutexattr_{get,set}pshared
-         * pthread_condattr_{get,set}pshared
-         */
-        PTHREAD_PROCESS_PRIVATE       = 0,
-        PTHREAD_PROCESS_SHARED        = 1,
-
-        /*
-         * pthread_barrier_wait
-         */
-        PTHREAD_BARRIER_SERIAL_THREAD = -1
-    };
-
-    /*
-     * ====================
-     * ====================
-     * Cancelation
-     * ====================
-     * ====================
-     */
-#define PTHREAD_CANCELED       ((void *) -1)
-
-
-    /*
-     * ====================
-     * ====================
-     * Once Key
-     * ====================
-     * ====================
-     */
-#define PTHREAD_ONCE_INIT       { PTW32_FALSE, 0, 0, 0}
-
-    struct pthread_once_t_ {
-        int          done;        /* indicates if user function has been executed */
-        void *       lock;
-        int          reserved1;
-        int          reserved2;
-    };
-
-
-    /*
-     * ====================
-     * ====================
-     * Object initialisers
-     * ====================
-     * ====================
-     */
-#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1)
-#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t) -2)
-#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t) -3)
-
-    /*
-     * Compatibility with LinuxThreads
-     */
-#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER
-#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER
-
-#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1)
-
-#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1)
-
-#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1)
-
-
-    /*
-     * Mutex types.
-     */
-    enum {
-        /* Compatibility with LinuxThreads */
-        PTHREAD_MUTEX_FAST_NP,
-        PTHREAD_MUTEX_RECURSIVE_NP,
-        PTHREAD_MUTEX_ERRORCHECK_NP,
-        PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP,
-        PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP,
-        /* For compatibility with POSIX */
-        PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
-        PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
-        PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
-        PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
-    };
-
-
-    typedef struct ptw32_cleanup_t ptw32_cleanup_t;
-
-#if defined(_MSC_VER)
-    /* Disable MSVC 'anachronism used' warning */
-#pragma warning( disable : 4229 )
-#endif
-
-    typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *);
-
-#if defined(_MSC_VER)
-#pragma warning( default : 4229 )
-#endif
-
-    struct ptw32_cleanup_t {
-        ptw32_cleanup_callback_t routine;
-        void *arg;
-        struct ptw32_cleanup_t *prev;
-    };
-
-#ifdef __CLEANUP_SEH
-    /*
-     * WIN32 SEH version of cancel cleanup.
-     */
-
-#define pthread_cleanup_push( _rout, _arg ) \
-        { \
-            ptw32_cleanup_t     _cleanup; \
-            \
-        _cleanup.routine        = (ptw32_cleanup_callback_t)(_rout); \
-            _cleanup.arg        = (_arg); \
-            __try \
-              { \
- 
-#define pthread_cleanup_pop( _execute ) \
-              } \
-            __finally \
-                { \
-                    if( _execute || AbnormalTermination()) \
-                      { \
-                          (*(_cleanup.routine))( _cleanup.arg ); \
-                      } \
-                } \
-        }
-
-#else /* __CLEANUP_SEH */
-
-#ifdef __CLEANUP_C
-
-    /*
-     * C implementation of PThreads cancel cleanup
-     */
-
-#define pthread_cleanup_push( _rout, _arg ) \
-        { \
-            ptw32_cleanup_t     _cleanup; \
-            \
-            ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
- 
-#define pthread_cleanup_pop( _execute ) \
-            (void) ptw32_pop_cleanup( _execute ); \
-        }
-
-#else /* __CLEANUP_C */
-
-#ifdef __CLEANUP_CXX
-
-    /*
-     * C++ version of cancel cleanup.
-     * - John E. Bossom.
-     */
-
-    class PThreadCleanup
-    {
-        /*
-         * PThreadCleanup
-         *
-         * Purpose
-         *      This class is a C++ helper class that is
-         *      used to implement pthread_cleanup_push/
-         *      pthread_cleanup_pop.
-         *      The destructor of this class automatically
-         *      pops the pushed cleanup routine regardless
-         *      of how the code exits the scope
-         *      (i.e. such as by an exception)
-         */
-        ptw32_cleanup_callback_t cleanUpRout;
-        void    *       obj;
-        int             executeIt;
-
-    public:
-        PThreadCleanup() :
-            cleanUpRout( 0 ),
-            obj( 0 ),
-            executeIt( 0 )
-    /*
-     * No cleanup performed
-     */
-        {
-        }
-
-        PThreadCleanup(
-            ptw32_cleanup_callback_t routine,
-            void    *       arg ) :
-            cleanUpRout( routine ),
-            obj( arg ),
-            executeIt( 1 )
-    /*
-     * Registers a cleanup routine for 'arg'
-     */
-        {
-        }
-
-        ~PThreadCleanup() {
-            if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) {
-                (void) (*cleanUpRout)( obj );
-            }
-        }
-
-        void execute( int exec ) {
-            executeIt = exec;
-        }
-    };
-
-    /*
-     * C++ implementation of PThreads cancel cleanup;
-     * This implementation takes advantage of a helper
-     * class who's destructor automatically calls the
-     * cleanup routine if we exit our scope weirdly
-     */
-#define pthread_cleanup_push( _rout, _arg ) \
-        { \
-            PThreadCleanup  cleanup((ptw32_cleanup_callback_t)(_rout), \
-                                    (void *) (_arg) );
-
-#define pthread_cleanup_pop( _execute ) \
-            cleanup.execute( _execute ); \
-        }
-
-#else
-
-#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
-
-#endif /* __CLEANUP_CXX */
-
-#endif /* __CLEANUP_C */
-
-#endif /* __CLEANUP_SEH */
-
-    /*
-     * ===============
-     * ===============
-     * Methods
-     * ===============
-     * ===============
-     */
-
-    /*
-     * PThread Attribute Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr,
-            int *detachstate);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr,
-            void **stackaddr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr,
-            size_t * stacksize);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr,
-            int detachstate);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr,
-            void *stackaddr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr,
-            size_t stacksize);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr,
-            struct sched_param *param);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr,
-            const struct sched_param *param);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *,
-            int);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (pthread_attr_t *,
-            int *);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr,
-            int inheritsched);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(pthread_attr_t * attr,
-            int * inheritsched);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *,
-            int);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *,
-            int *);
-
-    /*
-     * PThread Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid,
-            const pthread_attr_t * attr,
-            void *(*start) (void *),
-            void *arg);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1,
-            pthread_t t2);
-
-    PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread,
-            void **value_ptr);
-
-    PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state,
-            int *oldstate);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type,
-            int *oldtype);
-
-    PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control,
-            void (*init_routine) (void));
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-    PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute);
-
-    PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
-            void (*routine) (void *),
-            void *arg);
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-    /*
-     * Thread Specific Data Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key,
-            void (*destructor) (void *));
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key,
-            const void *value);
-
-    PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key);
-
-
-    /*
-     * Mutex Attribute Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t
-            * attr,
-            int *pshared);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
-            int pshared);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
-
-    /*
-     * Barrier Attribute Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t
-            * attr,
-            int *pshared);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
-            int pshared);
-
-    /*
-     * Mutex Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex,
-            const pthread_mutexattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t *mutex,
-            const struct timespec *abstime);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex);
-
-    /*
-     * Spinlock Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock);
-
-    /*
-     * Barrier Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier,
-            const pthread_barrierattr_t * attr,
-            unsigned int count);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier);
-
-    /*
-     * Condition Variable Attribute Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr,
-            int *pshared);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr,
-            int pshared);
-
-    /*
-     * Condition Variable Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond,
-            const pthread_condattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond,
-            pthread_mutex_t * mutex);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond,
-            pthread_mutex_t * mutex,
-            const struct timespec *abstime);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond);
-
-    /*
-     * Scheduling
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread,
-            int policy,
-            const struct sched_param *param);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread,
-            int *policy,
-            struct sched_param *param);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void);
-
-    /*
-     * Read-Write Lock Functions
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock,
-            const pthread_rwlockattr_t *attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
-            const struct timespec *abstime);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
-            const struct timespec *abstime);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr,
-            int *pshared);
-
-    PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
-            int pshared);
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1
-
-    /*
-     * Signal Functions. Should be defined in <signal.h> but MSVC and MinGW32
-     * already have signal.h that don't define these.
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig);
-
-    /*
-     * Non-portable functions
-     */
-
-    /*
-     * Compatibility with Linux.
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr,
-            int kind);
-    PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr,
-            int *kind);
-
-    /*
-     * Possibly supported by other POSIX threads implementations
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval);
-    PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void);
-
-    /*
-     * Useful if an application wants to statically link
-     * the lib rather than load the DLL at run-time.
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void);
-    PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void);
-    PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void);
-    PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void);
-
-    /*
-     * Features that are auto-detected at load/run time.
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int);
-    enum ptw32_features {
-        PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */
-        PTW32_ALERTABLE_ASYNC_CANCEL              = 0x0002  /* Can cancel blocked threads. */
-    };
-
-    /*
-     * Register a system time change with the library.
-     * Causes the library to perform various functions
-     * in response to the change. Should be called whenever
-     * the application's top level window receives a
-     * WM_TIMECHANGE message. It can be passed directly to
-     * pthread_create() as a new thread if desired.
-     */
-    PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *);
-
-#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-
-    /*
-     * Returns the Win32 HANDLE for the POSIX thread.
-     */
-    PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
-
-
-    /*
-     * Protected Methods
-     *
-     * This function blocks until the given WIN32 handle
-     * is signaled or pthread_cancel had been called.
-     * This function allows the caller to hook into the
-     * PThreads cancel mechanism. It is implemented using
-     *
-     *              WaitForMultipleObjects
-     *
-     * on 'waitHandle' and a manually reset WIN32 Event
-     * used to implement pthread_cancel. The 'timeout'
-     * argument to TimedWait is simply passed to
-     * WaitForMultipleObjects.
-     */
-    PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle);
-    PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle,
-            DWORD timeout);
-
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-    /*
-     * Thread-Safe C Runtime Library Mappings.
-     */
-#ifndef _UWIN
-#  if defined(NEED_ERRNO)
-    PTW32_DLLPORT int * PTW32_CDECL _errno( void );
-#  else
-#    ifndef errno
-#      if (defined(_MT) || defined(_DLL))
-    __declspec(dllimport) extern int * __cdecl _errno(void);
-#        define errno   (*_errno())
-#      endif
-#    endif
-#  endif
-#endif
-
-    /*
-     * WIN32 C runtime library had been made thread-safe
-     * without affecting the user interface. Provide
-     * mappings from the UNIX thread-safe versions to
-     * the standard C runtime library calls.
-     * Only provide function mappings for functions that
-     * actually exist on WIN32.
-     */
-
-#if !defined(__MINGW32__)
-#define strtok_r( _s, _sep, _lasts ) \
-        ( *(_lasts) = strtok( (_s), (_sep) ) )
-#endif /* !__MINGW32__ */
-
-#define asctime_r( _tm, _buf ) \
-        ( strcpy( (_buf), asctime( (_tm) ) ), \
-          (_buf) )
-
-#define ctime_r( _clock, _buf ) \
-        ( strcpy( (_buf), ctime( (_clock) ) ),  \
-          (_buf) )
-
-#define gmtime_r( _clock, _result ) \
-        ( *(_result) = *gmtime( (_clock) ), \
-          (_result) )
-
-#define localtime_r( _clock, _result ) \
-        ( *(_result) = *localtime( (_clock) ), \
-          (_result) )
-
-#define rand_r( _seed ) \
-        ( _seed == _seed? rand() : rand() )
-
-
-    /*
-     * Some compiler environments don't define some things.
-     */
-#if defined(__BORLANDC__)
-#  define _ftime ftime
-#  define _timeb timeb
-#endif
-
-#ifdef __cplusplus
-
-    /*
-     * Internal exceptions
-     */
-    class ptw32_exception {};
-    class ptw32_exception_cancel : public ptw32_exception {};
-    class ptw32_exception_exit   : public ptw32_exception {};
-
-#endif
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-
-    /* FIXME: This is only required if the library was built using SEH */
-    /*
-     * Get internal SEH tag
-     */
-    PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
-
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-#ifndef PTW32_BUILD
-
-#ifdef __CLEANUP_SEH
-
-    /*
-     * Redefine the SEH __except keyword to ensure that applications
-     * propagate our internal exceptions up to the library's internal handlers.
-     */
-#define __except( E ) \
-        __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
-                 ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
-
-#endif /* __CLEANUP_SEH */
-
-#ifdef __CLEANUP_CXX
-
-    /*
-     * Redefine the C++ catch keyword to ensure that applications
-     * propagate our internal exceptions up to the library's internal handlers.
-     */
-#ifdef _MSC_VER
-    /*
-     * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
-     * if you want Pthread-Win32 cancelation and pthread_exit to work.
-     */
-
-#ifndef PtW32NoCatchWarn
-
-#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.")
-#pragma message("------------------------------------------------------------------")
-#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
-#pragma message("  Replace any 'catch( ... )' in routines called from POSIX threads")
-#pragma message("  with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread")
-#pragma message("  cancelation and pthread_exit to work. For example:")
-#pragma message("")
-#pragma message("    #ifdef PtW32CatchAll")
-#pragma message("      PtW32CatchAll")
-#pragma message("    #else")
-#pragma message("      catch(...)")
-#pragma message("    #endif")
-#pragma message("        {")
-#pragma message("          /* Catchall block processing */")
-#pragma message("        }")
-#pragma message("------------------------------------------------------------------")
-
-#endif
-
-#define PtW32CatchAll \
-        catch( ptw32_exception & ) { throw; } \
-        catch( ... )
-
-#else /* _MSC_VER */
-
-#define catch( E ) \
-        catch( ptw32_exception & ) { throw; } \
-        catch( E )
-
-#endif /* _MSC_VER */
-
-#endif /* __CLEANUP_CXX */
-
-#endif /* ! PTW32_BUILD */
-
-#ifdef __cplusplus
-}                               /* End of extern "C" */
-#endif                          /* __cplusplus */
-
-#ifdef PTW32__HANDLE_DEF
-# undef HANDLE
-#endif
-#ifdef PTW32__DWORD_DEF
-# undef DWORD
-#endif
-
-#undef PTW32_LEVEL
-#undef PTW32_LEVEL_MAX
-
-#endif /* ! RC_INVOKED */
-
-#endif /* PTHREAD_H */
diff --git a/src/gui/win/include/sched.h b/src/gui/win/include/sched.h
deleted file mode 100644
index 551c9f1..0000000
--- a/src/gui/win/include/sched.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Module: sched.h
- *
- * Purpose:
- *      Provides an implementation of POSIX realtime extensions
- *      as defined in
- *
- *              POSIX 1003.1b-1993      (POSIX.1b)
- *
- * --------------------------------------------------------------------------
- *
- *      Pthreads-win32 - POSIX Threads Library for Win32
- *      Copyright(C) 1998 John E. Bossom
- *      Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- *      Contact Email: rpj at callisto.canberra.edu.au
- *
- *      The current list of contributors is contained
- *      in the file CONTRIBUTORS included with the source
- *      code distribution. The list can also be seen at the
- *      following World Wide Web location:
- *      http://sources.redhat.com/pthreads-win32/contributors.html
- *
- *      This library is free software; you can redistribute it and/or
- *      modify it under the terms of the GNU Lesser General Public
- *      License as published by the Free Software Foundation; either
- *      version 2 of the License, or (at your option) any later version.
- *
- *      This library is distributed in the hope that it will be useful,
- *      but WITHOUT ANY WARRANTY; without even the implied warranty of
- *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *      Lesser General Public License for more details.
- *
- *      You should have received a copy of the GNU Lesser General Public
- *      License along with this library in the file COPYING.LIB;
- *      if not, write to the Free Software Foundation, Inc.,
- *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#ifndef _SCHED_H
-#define _SCHED_H
-
-#undef PTW32_LEVEL
-
-#if defined(_POSIX_SOURCE)
-#define PTW32_LEVEL 0
-/* Early POSIX */
-#endif
-
-#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 1
-/* Include 1b, 1c and 1d */
-#endif
-
-#if defined(INCLUDE_NP)
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 2
-/* Include Non-Portable extensions */
-#endif
-
-#define PTW32_LEVEL_MAX 3
-
-#if !defined(PTW32_LEVEL)
-#define PTW32_LEVEL PTW32_LEVEL_MAX
-/* Include everything */
-#endif
-
-
-#if __GNUC__ && ! defined (__declspec)
-# error Please upgrade your GNU compiler to one that supports __declspec.
-#endif
-
-/*
- * When building the DLL code, you should define PTW32_BUILD so that
- * the variables/functions are exported correctly. When using the DLL,
- * do NOT define PTW32_BUILD, and then the variables/functions will
- * be imported correctly.
- */
-#ifndef PTW32_STATIC_LIB
-#  ifdef PTW32_BUILD
-#    define PTW32_DLLPORT __declspec (dllexport)
-#  else
-#    define PTW32_DLLPORT __declspec (dllimport)
-#  endif
-#else
-#  define PTW32_DLLPORT
-#endif
-
-/*
- * This is a duplicate of what is in the autoconf config.h,
- * which is only used when building the pthread-win32 libraries.
- */
-
-#ifndef PTW32_CONFIG_H
-#  if defined(WINCE)
-#    define NEED_ERRNO
-#    define NEED_SEM
-#  endif
-#  if defined(_UWIN) || defined(__MINGW32__)
-#    define HAVE_MODE_T
-#  endif
-#endif
-
-/*
- *
- */
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-#ifdef NEED_ERRNO
-#include "need_errno.h"
-#else
-#include <errno.h>
-#endif
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-#if defined(__MINGW32__) || defined(_UWIN)
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-/* For pid_t */
-#  include <sys/types.h>
-/* Required by Unix 98 */
-#  include <time.h>
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-#else
-typedef int pid_t;
-#endif
-
-/* Thread scheduling policies */
-
-enum {
-    SCHED_OTHER = 0,
-    SCHED_FIFO,
-    SCHED_RR,
-    SCHED_MIN   = SCHED_OTHER,
-    SCHED_MAX   = SCHED_RR
-};
-
-struct sched_param {
-    int sched_priority;
-};
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif                          /* __cplusplus */
-
-    PTW32_DLLPORT int __cdecl sched_yield (void);
-
-    PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
-
-    PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
-
-    PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
-
-    PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
-
-    /*
-     * Note that this macro returns ENOTSUP rather than
-     * ENOSYS as might be expected. However, returning ENOSYS
-     * should mean that sched_get_priority_{min,max} are
-     * not implemented as well as sched_rr_get_interval.
-     * This is not the case, since we just don't support
-     * round-robin scheduling. Therefore I have chosen to
-     * return the same value as sched_setscheduler when
-     * SCHED_RR is passed to it.
-     */
-#define sched_rr_get_interval(_pid, _interval) \
-  ( errno = ENOTSUP, (int) -1 )
-
-
-#ifdef __cplusplus
-}                               /* End of extern "C" */
-#endif                          /* __cplusplus */
-
-#undef PTW32_LEVEL
-#undef PTW32_LEVEL_MAX
-
-#endif                          /* !_SCHED_H */
-
diff --git a/src/gui/win/include/semaphore.h b/src/gui/win/include/semaphore.h
deleted file mode 100644
index 533624f..0000000
--- a/src/gui/win/include/semaphore.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Module: semaphore.h
- *
- * Purpose:
- *  Semaphores aren't actually part of the PThreads standard.
- *  They are defined by the POSIX Standard:
- *
- *      POSIX 1003.1b-1993  (POSIX.1b)
- *
- * --------------------------------------------------------------------------
- *
- *      Pthreads-win32 - POSIX Threads Library for Win32
- *      Copyright(C) 1998 John E. Bossom
- *      Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
- *      Contact Email: rpj at callisto.canberra.edu.au
- *
- *      The current list of contributors is contained
- *      in the file CONTRIBUTORS included with the source
- *      code distribution. The list can also be seen at the
- *      following World Wide Web location:
- *      http://sources.redhat.com/pthreads-win32/contributors.html
- *
- *      This library is free software; you can redistribute it and/or
- *      modify it under the terms of the GNU Lesser General Public
- *      License as published by the Free Software Foundation; either
- *      version 2 of the License, or (at your option) any later version.
- *
- *      This library is distributed in the hope that it will be useful,
- *      but WITHOUT ANY WARRANTY; without even the implied warranty of
- *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *      Lesser General Public License for more details.
- *
- *      You should have received a copy of the GNU Lesser General Public
- *      License along with this library in the file COPYING.LIB;
- *      if not, write to the Free Software Foundation, Inc.,
- *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-#if !defined( SEMAPHORE_H )
-#define SEMAPHORE_H
-
-#undef PTW32_LEVEL
-
-#if defined(_POSIX_SOURCE)
-#define PTW32_LEVEL 0
-/* Early POSIX */
-#endif
-
-#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 1
-/* Include 1b, 1c and 1d */
-#endif
-
-#if defined(INCLUDE_NP)
-#undef PTW32_LEVEL
-#define PTW32_LEVEL 2
-/* Include Non-Portable extensions */
-#endif
-
-#define PTW32_LEVEL_MAX 3
-
-#if !defined(PTW32_LEVEL)
-#define PTW32_LEVEL PTW32_LEVEL_MAX
-/* Include everything */
-#endif
-
-#if __GNUC__ && ! defined (__declspec)
-# error Please upgrade your GNU compiler to one that supports __declspec.
-#endif
-
-/*
- * When building the DLL code, you should define PTW32_BUILD so that
- * the variables/functions are exported correctly. When using the DLL,
- * do NOT define PTW32_BUILD, and then the variables/functions will
- * be imported correctly.
- */
-#ifndef PTW32_STATIC_LIB
-#  ifdef PTW32_BUILD
-#    define PTW32_DLLPORT __declspec (dllexport)
-#  else
-#    define PTW32_DLLPORT __declspec (dllimport)
-#  endif
-#else
-#  define PTW32_DLLPORT
-#endif
-
-/*
- * This is a duplicate of what is in the autoconf config.h,
- * which is only used when building the pthread-win32 libraries.
- */
-
-#ifndef PTW32_CONFIG_H
-#  if defined(WINCE)
-#    define NEED_ERRNO
-#    define NEED_SEM
-#  endif
-#  if defined(_UWIN) || defined(__MINGW32__)
-#    define HAVE_MODE_T
-#  endif
-#endif
-
-/*
- *
- */
-
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-#ifdef NEED_ERRNO
-#include "need_errno.h"
-#else
-#include <errno.h>
-#endif
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-#define _POSIX_SEMAPHORES
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif              /* __cplusplus */
-
-#ifndef HAVE_MODE_T
-    typedef unsigned int mode_t;
-#endif
-
-
-    typedef struct sem_t_ * sem_t;
-
-    PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
-                                        int pshared,
-                                        unsigned int value);
-
-    PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
-
-    PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
-
-    PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
-
-    PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
-            const struct timespec * abstime);
-
-    PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
-
-    PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
-            int count);
-
-    PTW32_DLLPORT int __cdecl sem_open (const char * name,
-                                        int oflag,
-                                        mode_t mode,
-                                        unsigned int value);
-
-    PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
-
-    PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
-
-    PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
-                                            int * sval);
-
-#ifdef __cplusplus
-}               /* End of extern "C" */
-#endif              /* __cplusplus */
-
-#undef PTW32_LEVEL
-#undef PTW32_LEVEL_MAX
-
-#endif              /* !SEMAPHORE_H */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/hyphy.git



More information about the debian-med-commit mailing list