Ejemplo n.º 1
0
void CWidget::Init()
{
    m_pNCursWin = derwin(GetParentWin(), Height(), Width(), Y(), X());
    
    if (!m_pNCursWin)
        throw Exceptions::CExFrontend("Could not create derived window");
    
    m_bSizeChanged = false;
    
    leaveok(m_pNCursWin, false);
    KeyPad(m_pNCursWin, true);
    Meta(m_pNCursWin, true);
    
    if (m_pParent)
    {
        if (!m_bSetFColors)
        {
            TColorPair colors = m_pParent->GetFColors();
            SetFColors(colors);
        }
        
        if (!m_bSetDFColors)
        {
            TColorPair colors = m_pParent->GetDFColors();
            SetDFColors(colors);
        }
    }
    
    CoreInit();
}
Ejemplo n.º 2
0
void CTUI::InitNCurses()
{
    EndWin();
    initscr();
    
    NoEcho();
    CBreak();
    leaveok(GetRootWin(), false);
    KeyPad(GetRootWin(), true);
    Meta(GetRootWin(), true);
    
    if (has_colors())
        StartColor();
    
    m_pMainBox = new CBox(CBox::VERTICAL, false);
    m_pMainBox->SetParent(GetRootWin());
    m_pMainBox->Init();
    m_pMainBox->SetSize(0, 0, GetWWidth(GetRootWin()), GetWHeight(GetRootWin()));
    m_pMainBox->SetFocus(true);
    
    m_pButtonBar = new CButtonBar(GetWWidth(GetRootWin()));
    
    // Focused colors are used for keys, defocused colors for descriptions
    m_pButtonBar->SetFColors(COLOR_YELLOW, COLOR_RED);
    m_pButtonBar->SetDFColors(COLOR_WHITE, COLOR_RED);
    
    m_pMainBox->EndPack(m_pButtonBar, false, false, 0, 0);
    
    m_pWinManager = new CWindowManager;
    m_pMainBox->AddWidget(m_pWinManager);
    m_pWinManager->ReqFocus();
    
    m_pMainBox->RequestQueuedDraw();
}
Ejemplo n.º 3
0
// D8 (PB0) LCD RS
//~D9 (PB1) LCD E
//~D10(PB2) LCD Backlight ctr
//~D11(PB3) PWM for heat lamp
// D12(PB4) Power ON sensor
// D13(PB5) Alarm buzzer
// A0 (PC0) Keys sensor
// A1 (PC1) Light sensor
// A2 (PC2) Debug LED
// A3 (PC3)
// A4 (PC4) RTC SDA
// A5 (PC5) RTC SCL

OneWire oneWire = OneWire(2); // D2
DS1307 RTC = DS1307();
LCD4Bit_mod LCD = LCD4Bit_mod();
KeyPad KEYS = KeyPad(A0);
Alarm ALARM = Alarm();
TempManager TEMP = TempManager(oneWire);
UIManager UI = UIManager();
System SYSTEM = System();
EpromManager EEPROM = EpromManager();

//////////////////////////////////////////////////////////////////////////

byte range_cycle(byte min, byte max, byte val)
{
  if(val > max) return min;
  if(val < min) return max;
  return val;
}