Exemplo n.º 1
0
void ButcherView::RepositionView()
{
    if (GetShowRulers())
    {
        ruler_left_->SetSize(0, GetRulerSize(), GetRulerSize(), GetClientSize().GetHeight()-(2*GetRulerSize()));
        ruler_top_->SetSize(GetRulerSize(), 0, GetClientSize().GetWidth()-(2*GetRulerSize()), GetRulerSize());
        ruler_right_->SetSize(GetClientSize().GetWidth()-GetRulerSize(), GetRulerSize(), GetRulerSize(), GetClientSize().GetHeight()-(2*GetRulerSize()));
        ruler_bottom_->SetSize(GetRulerSize(), GetClientSize().GetHeight()-GetRulerSize(), GetClientSize().GetWidth()-(2*GetRulerSize()), GetRulerSize());

        dwindow_->SetSize(GetRulerSize(), GetRulerSize(), GetClientSize().GetWidth()-(2*GetRulerSize()), GetClientSize().GetHeight()-(2*GetRulerSize()));
    }
    else
    {
        dwindow_->SetSize(0, 0, GetClientSize().GetWidth(), GetClientSize().GetHeight());
    }
    ruler_left_->Show(GetShowRulers());
    ruler_top_->Show(GetShowRulers());
    ruler_right_->Show(GetShowRulers());
    ruler_bottom_->Show(GetShowRulers());

    dwindow_->SetVirtualSize( PosToClient(GetDesignWidth())+10, PosToClient(GetDesignHeight())+10 );

    int sw, sh;
    dwindow_->CalcUnscrolledPosition(0, 0, &sw, &sh);

    designer_->SetSize(0-sw, 0-sh, PosToClient(GetDesignWidth()), PosToClient(GetDesignHeight()));

    RepositionScroll();

    Refresh();

    DoChangedEvent(ButcherViewChangedEvent::VC_VIEW);
}
Exemplo n.º 2
0
static void GetDispRect( HWND hWnd, LPRECT lpRect, int iHorzMode, int iVertMode )
/************************************************************************/
// int iHorzMode; /* 0 = GetClientRect 1 = No Scrollbars 2 = With Scrollbars */
// int iVertMode; /* 0 = GetClientRect 1 = No Scrollbars 2 = With Scrollbars */
{
RECT rHorz, rVert;
int cy, cx;
LPDISPLAY lpDisplay;

GetScrollBarSize(&cx, &cy);
if (iHorzMode == 2)         // with horizontal scrollbar
    {
    GetRealClientRect(hWnd, &rHorz);
    rHorz.bottom -= cy;
    }
else
if (iHorzMode == 1)     // without horizontal scrollbar
    {
    GetRealClientRect(hWnd, &rHorz);
    }
else
    {           // actual client size
    GetClientRect(hWnd, &rHorz);
    }
if (iVertMode == 2)     // with vertical scrollbar
    {
    GetRealClientRect(hWnd, &rVert);
    rVert.right -= cx;
    }
else
if (iVertMode == 1) // without horizontal scrollbar
    {
    GetRealClientRect(hWnd, &rVert);
    }
else                // actual client size
    {
    GetClientRect(hWnd, &rVert);
    }

lpRect->top = rHorz.top;
lpRect->bottom = rHorz.bottom;
lpRect->left = rVert.left;
lpRect->right = rVert.right;


lpDisplay = GetDisplayPtr(hWnd);
if (lpDisplay->HasRulers && !IsIconic(hWnd)) 
    {
    lpRect->top += GetRulerSize();
    lpRect->left += GetRulerSize();
    }

// adjust because our rects include right and bottom
lpRect->bottom -= 1;
lpRect->right -= 1;
}
Exemplo n.º 3
0
void ViewAll(HWND hWnd)
/************************************************************************/
{
int x, y, width, height, rs, left, top;
RECT rClient;
LPIMAGE lpImage;
LPDISPLAY lpDisplay;

HWND hMDIWindow = hWnd;
CWnd *pWnd = CWnd::FromHandle(hMDIWindow);
if (pWnd->IsKindOf(RUNTIME_CLASS(CServerView)))        
	hMDIWindow = pWnd->GetParentFrame()->GetSafeHwnd();

if (IsIconic(hMDIWindow))
    return;

lpImage = GetImagePtr(hWnd);
lpDisplay = GetDisplayPtr(hWnd);

GetClientRect(hWnd, &rClient);
width = rClient.right - rClient.left;
height = rClient.bottom - rClient.top;
if (lpDisplay->HasRulers)
    {
    rs = GetRulerSize();
    width -= rs;
    height -= rs;
    }
if ((width <= 0 || height <= 0) && !View.ZoomWindow)
    return;

SaveLastView(hWnd);
lpDisplay->FileRect.top = 0;
lpDisplay->FileRect.left = 0;
lpDisplay->FileRect.bottom = lpImage->nlin - 1;
lpDisplay->FileRect.right = lpImage->npix - 1;
lpDisplay->FileRate = TINYRATE;
lpDisplay->ViewPercentage = 0;
x = ( lpDisplay->FileRect.left 
    + lpDisplay->FileRect.right+1 ) / 2;
y = ( lpDisplay->FileRect.top 
    + lpDisplay->FileRect.bottom+1 ) / 2;
if (View.ZoomWindow)
    {
	GetWinXY(hMDIWindow, &left, &top);
    FullViewWindow(hWnd, left, top, x, y, YES);
    }
else
    {
    ComputeDispRect(hWnd);
    ComputeFileRect(hWnd, x, y, lpDisplay->FileRate);
    SetupRulers(hWnd);
    InvalidateRect(hWnd, NULL, TRUE);
    }
}
Exemplo n.º 4
0
void CBallRolling::BaselineCorrection(int nRulerSize, CHistory* pcHistory)
{
//	m_nRulerSize=nRulerSize;
    GetOptionParameters(pcHistory);
    if(m_bTracingMinima)
    {
        ReversePolarity();
    }
    LocalExtrema(m_pfData, m_pnLocalMinima, m_pnLocalMaxima, m_nSizeOfData,
                 m_nSizeOfLocalMinima, m_nSizeOfLocalMaxima);
    GetRulerSize();
    FindingContactingPoints_BallRolling();
    if(m_bCheckContactingPoints)
    {
        EraseFalseContactingPoints();
    }
    if(m_bSmoothingTrace)
    {
        Smoothing();
    }

    BaselineAdjust();

    if(m_bTracingMinima)
    {
        ReversePolarity();
        float *pfTemp=m_pfData;
        m_pfData=m_pfAdjustedData;
        ReversePolarity();
        m_pfData=pfTemp;
    }

    if(!m_bApplyingToEntireTrace)
    {
        float fTemp;
        int nBegin=int(m_fTime1*1000./m_fSampleInterval);
        int nEnd=int(m_fTime2*1000./m_fSampleInterval);
        int nLength=nEnd-nBegin+1;
        delete m_structBrigeSeg.pfData;
        m_structBrigeSeg.pfData=new float[nLength];
        for(int i0=0; i0<nLength; i0++)
        {
            fTemp=*(m_pfAdjustedData+nBegin+i0);
            *(m_structBrigeSeg.pfData+i0)=fTemp;
        }
        float fBegin=SegAverage(m_structBrigeSeg.pfData,40);
        float fEnd=SegAverage(m_structBrigeSeg.pfData+nLength-40,40);
        float fSlope=(fEnd-fBegin)/float(nEnd-nBegin-40);
        m_structBrigeSeg.fAmpBegin=fBegin;
        m_structBrigeSeg.fAmpEnd=fEnd;
        m_structBrigeSeg.nLength=nLength;;
        m_structBrigeSeg.fSlope=fSlope;
        BrigeSegment(nBegin,nEnd);
    }
}
Exemplo n.º 5
0
void CalcFullViewWindowSize( LPRECT lpWindowRect, LPRECT lpFileRect,
                              LFIXED FileRate, int npix, int nlin, int x,
                              int y, BOOL fHasRulers, BOOL fClipToImage )
/************************************************************************/
{
int dx, dy, sx, sy, rs, iImageWidth, iImageHeight, iWidth, iHeight;
LFIXED DispRate;
int minsize;

// normal window - to goal is to size the window to fit the view
// If FileRate == 0 or 1, then we make the window as big as possible
// for the FileRect provided.  If FileRate != 0, then we make the
// the window as big as possible to fit the image at that FileRate.
// If the fClipToImage flag and FileRate == 0, then we do not let
// the FileRate go over 100%.  This is used for a caller who wants
// to display the image pixel for pixel, if possible.
if (x < 0 || y < 0)
	GetDocumentPosition(&x, &y);

dx = 2 * GetSystemMetrics(SM_CXFRAME);
dy = GetSystemMetrics(SM_CYCAPTION) + (2*GetSystemMetrics(SM_CYFRAME)) - 1;

// get size of scrollbars and rulers for use later
GetScrollBarSize(&sx, &sy);
rs = GetRulerSize();

// determine maximum area for window to occupy
if (IsIconic(PictPubApp.Get_hWndAstral()))
    *lpWindowRect = rClient;
else
    GetClientRect(PictPubApp.Get_hClientAstral(), lpWindowRect);
lpWindowRect->top = y;
lpWindowRect->left = x;
lpWindowRect->right -= dx;
lpWindowRect->bottom -= (dy + GetSystemMetrics(SM_CYFRAME));

// start with this maximum Client Area size
minsize = MIN_WINDOW_SIZE+rs;
iWidth = RectWidth(lpWindowRect);
if ( iWidth < minsize )
    iWidth = minsize;
iHeight = RectHeight(lpWindowRect);
if ( iHeight < minsize )
    iHeight = minsize;

// If we already have a FileRate, calculate new size of window
// based on the image size
if (FileRate > TINYRATE)
    {
    // calculate size of area for total image at this
    // FileRate
    DispRate = FGET(FUNITY, FileRate);
    iImageWidth = FMUL(npix, DispRate);
    iImageHeight = FMUL(nlin, DispRate);

    // add in additional space for rulers if necessary
    if (fHasRulers)
        {
        iImageWidth += rs;
        iImageHeight += rs;
        }
    if (iImageWidth > iWidth && iImageHeight < iHeight)
        iImageHeight += sy;
    if (iImageHeight > iHeight && iImageWidth < iWidth)
        iImageWidth += sx;

    // see if we don't need the total width
    // otherwise, use the maximum
    if (iImageWidth < iWidth)
        iWidth = iImageWidth;
    // see if we don't need the total height
    // otherwise, use the maximum
    if (iImageHeight < iHeight)
        iHeight = iImageHeight;
    }
// if we have no FileRate, then somebody wants a specific
// FileRect, figure out how big the window needs to be and
// whether we need rulers
else
    {
    // get width and height of area to be displayed
    iImageWidth = RectWidth(lpFileRect);
    iImageHeight = RectHeight(lpFileRect);

    // reduce the maximum area if we have rulers
    if (fHasRulers)
        {
        iWidth -= rs;
        iHeight -= rs;
        }

    // reduce the maximum area if we need scrollbars
    if (lpFileRect->left != 0 ||
        lpFileRect->right != npix-1 ||
        lpFileRect->top != 0 ||
        lpFileRect->bottom != nlin-1)
        {
        iWidth -= sx;
        iHeight -= sy;
        }

    // scale maximum client area size (not including rulers and
    // scrollbars) to fit aspect ratio of FileRect
    DispRate = ScaleToFit(&iWidth, &iHeight, iImageWidth, iImageHeight);

    // if caller wants to clip to hires to achieve 100% view,
    // clip.  But only if hires is smaller
    if (iImageWidth <= iWidth && iImageHeight <= iHeight && fClipToImage)
        {
        iWidth = iImageWidth;
        iHeight = iImageHeight;
        }

    // add ruler size back into client area
    if (fHasRulers)
        {
        iWidth += rs;
        iHeight += rs;
        }

    // add scrollbar size back into client area
    if (lpFileRect->left != 0 ||
        lpFileRect->right != npix-1 ||
        lpFileRect->top != 0 ||
        lpFileRect->bottom != nlin-1)
        {
        iWidth += sx;
        iHeight += sy;
        }
    }
// Calculate new window size based on iWidth and iHeight */
lpWindowRect->right = lpWindowRect->left + iWidth + dx - 1;
lpWindowRect->bottom = lpWindowRect->top + iHeight + dy - 1;
}