/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::pbFixeinzugMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
    int i = X / dx;
    int j = maxy-1 - (Y / dy);

    dbw3_assert(i>=0);
    dbw3_assert(j>=0);

    if (i>=maxx || j>=maxy) return;

    short old = einzug[scrollx+i];
    if (old==j+1) einzug[scrollx+i] = 0;
    else einzug[scrollx+i] = short(j+1);
    changed = true;
    CalcRange();
    if (old!=0) {
        pbFixeinzug->Canvas->Pen->Color = clBtnFace;
        pbFixeinzug->Canvas->Brush->Color = clBtnFace;
        pbFixeinzug->Canvas->Rectangle (i*dx+2, (maxy-old)*dy+2, (i+1)*dx-1, (maxy-old+1)*dy-1);
    }
    DrawData (pbFixeinzug, i);
    DeleteCursor();
    cx = i;
    cy = j;
    DeleteRange();
    CalcRange();
    DrawRange();
    DrawCursor();
}
Exemple #2
0
/*-----------------------------------------------------------------*/
void __fastcall CrFeld::DisableCursor()
{
    dbw3_assert(frm);
    dbw3_assert(frm->CursorTimer);
    frm->CursorTimer->Enabled = false;
    DeleteCursor();
}
Exemple #3
0
CGeneral::~CGeneral()
{
   DeleteImages();
   DeleteFonts();
   DeleteMusic();
   DeleteSound();
   DeleteCursor();
}
void CGradientCtrl::OnMouse(wxMouseEvent& event)
{
    ECursorType eType = eCT_Invalid;
    wxPoint pos = event.GetPosition();
    if (event.ButtonDown(wxMOUSE_BTN_LEFT))
    {
        if (m_pSelectedCursor)
        {
            m_pSelectedCursor->Select(false);
        }
        m_pSelectedCursor = GetGradientCursor(pos);
        if (m_pSelectedCursor)
        {
            eType = m_pSelectedCursor->GetType();
            if (eType == eCT_Color)
            {
                m_pColoutPicker->SetColour(m_pSelectedCursor->GetColor());
            }
            else
            {
                m_pMaskSlider->SetValue(m_pSelectedCursor->GetColor().Red());
            }
            m_pSelectedCursor->Select(true);
        }
        ShowCtrl(m_pSelectedCursor == NULL ? eCT_Invalid : m_pSelectedCursor->GetType());
        Refresh(true);
        UpdateSelectedCursorPos();
    }
    else if (event.Dragging())
    {
        if (event.LeftIsDown())
        {
            if (m_pSelectedCursor)
            {
                SetSelectedCursorPos(pos);
                UpdateSelectedCursorPos();
                float fPos = GetNearestCursorPos(m_pSelectedCursor);
                if (fPos >= 0)
                {
                    m_pSelectedCursor->SetPos(fPos);
                }
                Refresh(true);
            }
        }
    }
    else if (event.ButtonUp(wxMOUSE_BTN_LEFT))
    {
        if (m_pSelectedCursor)
        {
            if (GetNearestCursorPos(m_pSelectedCursor) > 0)
            {
                DeleteCursor(m_pSelectedCursor);
                m_pSelectedCursor = NULL;
            }
        }
    }
    
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::CurDown (bool _step)
{
    if (cy>0) {
        DeleteCursor();
        if (!_step) cy--;
        else {
            cy -= 4;
            if (cy<0) cy = 0;
        }
        DrawRange();
        DrawCursor();
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::CurUp (bool _step)
{
    if (cy<maxy-1) {
        DeleteCursor();
        if (!_step) cy++;
        else {
            cy += 4;
            if (cy>maxy-1) cy = maxy-1;
        }
        DrawRange();
        DrawCursor();
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::CurRight (bool _step)
{
    if (cx<maxx-1) {
        DeleteCursor();
        if (!_step) cx++;
        else {
            cx += 4;
            if (cx>maxx-1) cx = maxx-1;
        }
        DrawRange();
        DrawCursor();
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::CurLeft (bool _step)
{
    if (cx>0) {
        DeleteCursor();
        if (!_step) cx--;
        else {
            cx -= 4;
            if (cx<0) cx = 0;
        }
        DrawRange();
        DrawCursor();
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
    switch (Key) {
        case VK_SPACE: {
            DeleteCursor();
            DeleteRange();
            short old = einzug[scrollx+cx];
            if (old==cy+1) einzug[scrollx+cx] = 0;
            else einzug[scrollx+cx] = short(cy+1);
            CalcRange();
            if (old!=0) {
                pbFixeinzug->Canvas->Pen->Color = clBtnFace;
                pbFixeinzug->Canvas->Brush->Color = clBtnFace;
                int x, y;
                if (frm->righttoleft) x = (maxx-cx-1)*dx;
                else x = cx*dx;
                if (frm->toptobottom) y = (old-1)*dy;
                else y = (maxy-old)*dy;
                pbFixeinzug->Canvas->Rectangle (x+2, y+2, x+dx-1, y+dy-1);
            }
            DrawData(pbFixeinzug, cx);
            DrawRange();
            CurMove();
            DrawCursor();
            changed = true;
            break;
        }
        case VK_LEFT:
            if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) {
                if (frm->righttoleft) CurDirRight();
                else CurDirLeft();
                break;
            }
            if (frm->righttoleft) CurRight(Shift.Contains(ssCtrl));
            else CurLeft (Shift.Contains(ssCtrl));
            break;
        case VK_RIGHT:
            if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) {
                if (frm->righttoleft) CurDirLeft();
                else CurDirRight();
                break;
            }
            if (frm->righttoleft) CurLeft(Shift.Contains(ssCtrl));
            else CurRight (Shift.Contains(ssCtrl));
            break;
        case VK_UP:
            if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) {
                if (frm->toptobottom) CurDirDown();
                else CurDirUp();
                break;
            }
            if (frm->toptobottom) CurDown (Shift.Contains(ssCtrl));
            else CurUp (Shift.Contains(ssCtrl));
            break;
        case VK_DOWN:
            if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) {
                if (frm->toptobottom) CurDirUp();
                else CurDirDown();
                break;
            }
            if (frm->toptobottom) CurUp (Shift.Contains(ssCtrl));
            else CurDown (Shift.Contains(ssCtrl));
            break;
    }
}
Exemple #10
0
/*-----------------------------------------------------------------*/
void __fastcall CrFeld::ToggleCursor()
{
    if (visible) DeleteCursor();
    else DrawCursor();
}