Example #1
0
/*--------------------------------------------------------------------------*/
Dragon4Screen::Dragon4Screen(PegRect &Rect) : PegScreen(Rect)
{
    mdNumColors = 16;  

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();

    mpScanPointers = new UCHAR *[Rect.Height()];

    UCHAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = CurrentPtr;
        CurrentPtr += mwHRes >> 1;
    }

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;

    ConfigureController();        // set up controller registers

    SetPalette(0, 16, GrayPalette);
}
Example #2
0
/*--------------------------------------------------------------------------*/
SED1355Screen::SED1355Screen(PegRect &Rect, BOOL bDual) : PegScreen(Rect)
{
    mdNumColors = 256;
    mbDualMode = bDual;

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();

    mpScanPointers = new UCHAR PEGFAR *[Rect.Height()];
    UCHAR PEGFAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = CurrentPtr;
        CurrentPtr += mwHRes;
    }

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;

    ConfigureController();        // set up controller registers
    SetPalette(0, 232, DefPalette256);
}
Example #3
0
/*--------------------------------------------------------------------------*/
SED1376Screen8::SED1376Screen8(PegRect &Rect) : PegScreen(Rect)
{
    mdNumColors = 256;

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();

    mpScanPointers = new UCHAR PEGFAR *[Rect.Height()];
    UCHAR PEGFAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = CurrentPtr;
        CurrentPtr += mwHRes;
    }

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;

    ConfigureController();        // set up controller registers
    SetPalette(0, 232, DefPalette256);

#ifdef PEGWIN32
    mwWinRectXOffset = 0;
    mwWinRectYOffset = 0;
#endif
}
Example #4
0
/*--------------------------------------------------------------------------*/
GenericSvgaScreen::GenericSvgaScreen(PegRect &Rect) : PegScreen(Rect)
{
	mdNumColors = 256;

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();
    WORD wPitch = mwHRes;

    ConfigureController();        // set up controller registers

    SetPalette(0, 232, DefPalette256);

    mpScanPointers = new UCHAR *[Rect.Height()];
    UCHAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = CurrentPtr;
        CurrentPtr += wPitch;
    }

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;
}
Example #5
0
SED1353Screen::SED1353Screen(HWND hWnd, PegRect &Rect) : PegScreen(Rect)
#else
SED1353Screen::SED1353Screen(PegRect &Rect) : PegScreen(Rect)
#endif
{
    mdNumColors = 16;  

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();

    mpScanPointers = new UCHAR PEGFAR *[Rect.Height()];

    UCHAR PEGFAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = CurrentPtr;
        CurrentPtr += mwHRes >> 1;
    }

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;

    ConfigureController();        // set up controller registers


#ifdef PEGWIN32

   // Some setup stuff for the BitBlitting function:

   mHWnd = hWnd;
   mhPalette = NULL;
   RECT lSize;
   ::GetClientRect(mHWnd, &lSize);

   mwWinRectXOffset = (lSize.right - mwHRes) / 2;
   mwWinRectYOffset = (lSize.bottom -mwVRes) / 2;
#endif

    SetPalette(0, 16, DefPalette16);
}


/*--------------------------------------------------------------------------*/
// *** This function must be filled in by the developer ***
/*--------------------------------------------------------------------------*/
UCHAR PEGFAR *SED1353Screen::GetVideoAddress(void)
{
#ifdef PEGWIN32

    DWORD dSize = mwHRes / 2 * mwVRes;
    UCHAR *pMem = new UCHAR[dSize];
    return pMem; 

#else
    return (UCHAR *) VID_MEM_BASE;
#endif
}
Example #6
0
/*--------------------------------------------------------------------------*/
void PegMenuBar::PositionButtons(void)
{
    PegRect Put;
    PegRect Current;
    Put.wTop = mReal.wTop + 2;
    Put.wLeft = mReal.wLeft + 2;
    Put.wRight = Put.wLeft;
    PegMessage NewMessage;

    // I have to figure out where my children go!

    PegMenuButton *pButton = (PegMenuButton *) First();

    while(pButton)
    {
        Put.wLeft = Put.wRight + 4;
        Current = pButton->GetMinSize(TYPE_MENU_BAR);
        Put.wRight = Put.wLeft + Current.Width();
        Put.wBottom = Put.wTop + Current.Height() - 1;
        NewMessage.wType = PM_SIZE;
        NewMessage.Rect = Put;
        pButton->Message(NewMessage);
        pButton = (PegMenuButton *) pButton->Next();
    }
}
Example #7
0
/*--------------------------------------------------------------------------*/
void PegWindow::CheckResizeRect(PegRect &NewSize)
{
    if (muMoveMode == PMM_MOVEALL)
    {
        return;
    }
    SIGNED iChange = mReal.Width() - NewSize.Width();
    SIGNED iMin;

    if (Type() == TYPE_WINDOW)
    {
        iMin = mClient.Width() - 4;
    }
    else
    {
        iMin = mReal.Width() - PEG_SCROLL_WIDTH * 5;
    }

    if (iChange > iMin)
    {
        switch(muMoveMode)
        {
        case PMM_MOVELEFT:
        case PMM_MOVEUL:
        case PMM_MOVELL:
            NewSize.wLeft -= iChange - iMin;
            break;

        default:
            NewSize.wRight += iChange - iMin;
        }
    }

    iChange = mReal.Height() - NewSize.Height();
    iMin = mClient.Height();

    if (iChange > iMin)
    {
        switch(muMoveMode)
        {
        case PMM_MOVETOP:
        case PMM_MOVEUL:
        case PMM_MOVEUR:
            NewSize.wTop -= iChange - iMin;
            break;

        default:
            NewSize.wBottom += iChange - iMin;
        }
    }
}
Example #8
0
/*--------------------------------------------------------------------------*/
Permedia2Screen::Permedia2Screen(PegRect &Rect) : PegScreen(Rect)
{
    mdNumColors = 256;

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();

    mpScanPointers = new UCHAR PEGFAR *[Rect.Height()];
    UCHAR PEGFAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = CurrentPtr;
        CurrentPtr += mwHRes;
    }

    ConfigureController();        // set up controller registers

   #ifdef USE_VID_MEM_MANAGER
    UCHAR *pStart = CurrentPtr;
            
    #ifdef HARDWARE_CURSOR
    pStart += 4 * 1024;        // leave 4K for mouse pointer bitmaps
    #endif

    UCHAR *pEnd = mpVidMemBase;
    pEnd += VID_MEM_SIZE - 1;
    InitVidMemManager(pStart, pEnd);
   #endif

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;

    SetPalette(0, 232, DefPalette256);
}
Example #9
0
/*--------------------------------------------------------------------------*/
PegRect PegMenu::GetMinSize(void)
{
    PegRect SizeRect;
    PegRect CurrentSize;
    SizeRect.Set(0, 0, 0, 0);

    PegMenuButton *pButton = (PegMenuButton *) First();

    while(pButton)
    {
        CurrentSize = pButton->GetMinSize(TYPE_MENU);
        if (CurrentSize.Width() > SizeRect.Width())
        {
            SizeRect.wRight += CurrentSize.Width() - SizeRect.Width();
        }
        SizeRect.wBottom += CurrentSize.Height();
        pButton = (PegMenuButton *) pButton->Next();
    }
    SizeRect.wBottom += 6;
    SizeRect.wRight += 6;
    return SizeRect;
}
Example #10
0
SED1375Screen8::SED1375Screen8(HWND hWnd, PegRect &Rect) : PegScreen(Rect)
#else
SED1375Screen8::SED1375Screen8(PegRect &Rect) : PegScreen(Rect)
#endif
{
    mdNumColors = 256;

   #ifdef PEGWIN32
    mhPalette = NULL;
   #endif

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();

    mpScanPointers = new UCHAR PEGFAR *[Rect.Height()];
    UCHAR PEGFAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = CurrentPtr;
        CurrentPtr += mwHRes;
    }

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;

    ConfigureController();        // set up controller registers


#ifdef PEGWIN32

   // Some setup stuff for the BitBlitting function:

   mHWnd = hWnd;
   RECT lSize;
   ::GetClientRect(mHWnd, &lSize);

   mwWinRectXOffset = (lSize.right - mwHRes) / 2;
   mwWinRectYOffset = (lSize.bottom -mwVRes) / 2;
   mhPalette = NULL;
#endif

    SetPalette(0, 232, DefPalette256);
}

/*--------------------------------------------------------------------------*/
// *** This function must be filled in by the developer ***
/*--------------------------------------------------------------------------*/
UCHAR PEGFAR *SED1375Screen8::GetVideoAddress(void)
{
#ifdef PEGWIN32

    DWORD dSize = mwHRes * mwVRes;
    UCHAR *pMem = new UCHAR[dSize];
    return pMem; 

#else

    // for an example, just allocate a buffer in dynamic memory:
   #ifdef DOUBLE_BUFFER
    DWORD dSize = mwHRes * mwVRes;
    UCHAR PEGFAR *pMem = new UCHAR[dSize];
    return pMem; 
   #else
	 return((UCHAR PEGFAR *) VID_MEM_BASE);
   #endif

#endif
}
Example #11
0
/*--------------------------------------------------------------------------*/
void TabWindow::SetNotebookClients(void)
{
    char cTemp[20];

    for (UCHAR uLoop = 0; uLoop < NUM_TABS; uLoop++)
    {
        sprintf(cTemp, "TabText%d", uLoop);
        mpNotebook->SetTabString(uLoop, cTemp);
    }

    PegRect ChildRect = mpNotebook->mClient;
    ChildRect -= 4;
    
    // make a PegTextBox for the first client:

    char EditText[] = "This is a PegNotebook window. The notebook tabs can be "
        "simple text, or custom objects. Each page of the notebook is populated "
        "with any type of PegThing, in this case a PegTextBox.";

    PegTextBox *pEdit = new PegTextBox(ChildRect, 0, FF_RECESSED|TJ_LEFT|TT_COPY|EF_WRAP);
    pEdit->DataSet(EditText);
    mpNotebook->SetPageClient(1, pEdit);
    
    // make a group for the second client:

    PegGroup *pGroup = new PegGroup(ChildRect, "Group Client");
    //PegWindow *pWin = new PegWindow(ChildRect, FF_NONE);

    SIGNED iTop = pGroup->mClient.wTop + 10;
    pGroup->Add(new PegPrompt(pGroup->mClient.wLeft + 10, iTop, "PegGroup populated with checkboxes..."));
    iTop += 24;
    SIGNED iFlag = 0;

    while (iTop < pGroup->mClient.wBottom - 40)
    {
        if (iFlag & 1)
        {
            pGroup->Add(new PegCheckBox(pGroup->mClient.wLeft + 10,
                iTop, "CheckBox"));
        }
        else
        {
            pGroup->Add(new PegCheckBox(pGroup->mClient.wLeft + 10,
                iTop, "CheckBox", 0, AF_ENABLED|BF_SELECTED));
        }
        iFlag++;
        iTop += 24;
    }

    mpNotebook->SetPageClient(0, pGroup);

    // make a different group for the third client:

    pGroup = new PegGroup(ChildRect, "Group Client");
    iTop = pGroup->mClient.wTop + 10;
    pGroup->Add(new PegPrompt(pGroup->mClient.wLeft + 10, iTop, "PegGroup populated with radio buttons..."));
    iTop += 24;

    iFlag = 0;

    while (iTop < pGroup->mClient.wBottom - 40)
    {
        if (!iFlag)
        {
            pGroup->Add(new PegRadioButton(pGroup->mClient.wLeft + 10, iTop,
                 "Radio Button", 0, AF_ENABLED|BF_SELECTED));
        }
        else
        {
            pGroup->Add(new PegRadioButton(pGroup->mClient.wLeft + 10, iTop, "Radio Button"));
        }
        iTop += 24;
        iFlag++;
    }

    iTop = pGroup->mClient.wTop + 34;
    mpPrompt = new PegPrompt(pGroup->mClient.wLeft + 140, iTop,
        "00000000", 0, FF_RECESSED|TT_COPY|TJ_RIGHT);
    mpPrompt->SetColor(PCI_NORMAL, BLACK);
    mpPrompt->SetColor(PCI_NTEXT, LIGHTGREEN);
    pGroup->Add(mpPrompt);

    mpNotebook->SetPageClient(2, pGroup);

    // make a window with two text boxes for the final client:

    //PegWindow *pChild = new PegWindow(ChildRect, FF_NONE);
    PegWindow *pChild = new TestWindow(ChildRect, FF_NONE);
    pChild->SetColor(PCI_NORMAL, PCLR_DIALOG);
    ChildRect.wBottom = ChildRect.wTop + ChildRect.Height() / 2;
    
    pEdit = new PegTextBox(ChildRect);
    pEdit->DataSet("Each Notebook client can of course also have multiple children. In "
        "this case, we have created a frameless window as the notebook page client. "
        "This allows us to add scrolling, and populate the notebook page with objects "
        "that are larger than the notebook itself!");
    pChild->Add(pEdit);

    ChildRect.wTop = ChildRect.wBottom + 10;
    ChildRect.wBottom = mpNotebook->mClient.wBottom - 40;
    pEdit = new PegTextBox(ChildRect);
    pEdit->DataSet("To the frameless window we have added two PegTextBoxes. " 
        "Any other type of object could be used just as easily");
    pChild->Add(pEdit);
    mpNotebook->SetPageClient(3, pChild);

    //mpNotebook->SelectTab(1);
}
Example #12
0
L24Screen::L24Screen(HWND hWnd, PegRect &Rect) : PegScreen(Rect)
#else
L24Screen::L24Screen(PegRect &Rect) : PegScreen(Rect)
#endif
{
    mdNumColors = 256;

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();

    mpScanPointers = new COLORVAL PEGFAR *[Rect.Height()];
    UCHAR PEGFAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = (COLORVAL *) CurrentPtr;
        CurrentPtr += mwHRes * 3;
    }

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;

    ConfigureController();        // set up controller registers

#ifdef PEGWIN32

   // Some setup stuff for the BitBlitting function:

   mHWnd = hWnd;
   RECT lSize;
   ::GetClientRect(mHWnd, &lSize);

   mwWinRectXOffset = (lSize.right - mwHRes) / 2;
   mwWinRectYOffset = (lSize.bottom -mwVRes) / 2;
#endif

    SetPalette(0, 232, DefPalette256);
}

/*--------------------------------------------------------------------------*/
// *** This function must be filled in by the developer ***
/*--------------------------------------------------------------------------*/
UCHAR PEGFAR *L24Screen::GetVideoAddress(void)
{
#ifdef PEGWIN32

    DWORD dSize = mwHRes * mwVRes * 3;
    UCHAR *pMem = new UCHAR[dSize];
    return pMem; 

#else

    #ifdef STATIC_FRAME_BUFFER

    // just return the address of the static array:
    UCHAR PEGFAR *pMem = (UCHAR PEGFAR *) gbVMemory;

    #else

    #if 0
    // for an example, just allocate a buffer in dynamic memory:

    DWORD dSize = mwHRes * mwVRes * 3;
    UCHAR *pMem = new UCHAR[dSize];

    #else
    UCHAR *pMem = (UCHAR *) 0x00800000L;
    #endif

    #endif
    return pMem; 

#endif
}
Example #13
0
L8Screen::L8Screen(HWND hWnd, PegRect &Rect) : PegScreen(Rect)
#else
L8Screen::L8Screen(PegRect &Rect) : PegScreen(Rect)
#endif
{
    mdNumColors = 256;

#ifdef PEGWIN32
    mhPalette = NULL;
#endif

    mwHRes = Rect.Width();
    mwVRes = Rect.Height();
    WORD wPitch = mwHRes;

#ifdef PEGWIN32

    // Windows bitmaps must be modulo-4 byte in width:
    wPitch += 3;
    wPitch &= 0xfffc;

#endif

    mpScanPointers = new UCHAR PEGFAR *[Rect.Height()];
    UCHAR PEGFAR *CurrentPtr = GetVideoAddress();

    for (SIGNED iLoop = 0; iLoop < Rect.Height(); iLoop++)
    {
        mpScanPointers[iLoop] = CurrentPtr;
        CurrentPtr += wPitch;
    }

    mLastPointerPos.x = Rect.Width() / 2;
    mLastPointerPos.y = Rect.Height() / 2;
    mbPointerHidden = FALSE;
    mwDrawNesting = 0;

    ConfigureController();        // set up controller registers


#ifdef PEGWIN32

    // Some setup stuff for the BitBlitting function:

    mHWnd = hWnd;
    RECT lSize;
    ::GetClientRect(mHWnd, &lSize);

    mwWinRectXOffset = (lSize.right - mwHRes) / 2;
    mwWinRectYOffset = (lSize.bottom -mwVRes) / 2;
    mhPalette = NULL;
#endif

    SetPalette(0, 232, DefPalette256);
}

/*--------------------------------------------------------------------------*/
// *** This function must be filled in by the developer ***
/*--------------------------------------------------------------------------*/
UCHAR PEGFAR *L8Screen::GetVideoAddress(void)
{
    UCHAR PEGFAR *pMem;

#ifdef PEGWIN32

    DWORD dSize = mwHRes;
    dSize += 3;
    dSize &= 0xfffffffc;
    dSize *= mwVRes;
    pMem = new UCHAR[dSize];

#else

#ifdef STATIC_FRAME_BUFFER

    // simply return the address of the static array:

    pMem = (UCHAR PEGFAR *) gbVMemory;

#else

    // For an example, allocate a buffer in dynamic memory. This
    // would normally be an address specific to your hardware.

    DWORD dSize = mwHRes * mwVRes;

#ifdef DOUBLE_BUFFER
    dSize *= 2;
#endif

    pMem = new UCHAR[dSize];
#endif

#ifdef DOUBLE_BUFFER
    pMem += (DWORD) mwHRes * (DWORD) mwVRes;
#endif
#endif

    return pMem;
}