Esempio n. 1
0
void NewDBRFile::initialize()
//--------------------------
{
    setSystemFont( false );
    rescale();
    move( frame().r );
    centre();

    _browsefileGroup =   new WGroupBox(      this, _browsefileGroupR.r,   _browsefileGroupR.t );
    _fileEdit =          new WEditBox(       this, _fileEditR.r,          _fileEditR.t );
    _okButton =          new WDefPushButton( this, _okButtonR.r,          _okButtonR.t );
    _browseFilesButton = new WPushButton(    this, _browseFilesButtonR.r, _browseFilesButtonR.t );
    _cancelButton =      new WPushButton(    this, _cancelButtonR.r,      _cancelButtonR.t );

    _browsefileGroup->show();
    _fileEdit->show();
    _okButton->show();
    _browseFilesButton->show();
    _cancelButton->show();

    _okButton->onClick(          this, (cbw) NewDBRFile::okButton );
    _browseFilesButton->onClick( this, (cbw) NewDBRFile::filesButton );
    _cancelButton->onClick(      this, (cbw) NewDBRFile::cancelButton );

    _fileEdit->setFocus();

    show();
}
Esempio n. 2
0
void MemberFilterDlg::initialize()
//--------------------------------
{
    setSystemFont( FALSE );
    rescale();
    move( frame().r );
    centre();

    _inheritGroup = new WGroupBox(      this, _inheritGroupR.r,  _inheritGroupR.t );
    _bttns._none = new WRadioButton(    this, _noneR.r,          _noneR.t, RStyleGroupFirst );
    _bttns._visible = new WRadioButton( this, _visibleR.r,       _visibleR.t );
    _bttns._all = new WRadioButton(     this, _allR.r,           _allR.t, RStyleGroupLast );

    _accessGroup = new WGroupBox(       this, _accessGroupR.r,   _accessGroupR.t );
    _public = new WCheckBox(            this, _publicR.r,        _publicR.t );
    _protected = new WCheckBox(         this, _protectedR.r,     _protectedR.t );
    _private = new WCheckBox(           this, _privateR.r,       _privateR.t );

    _memberGroup = new WGroupBox(       this, _memberGroupR.r,   _memberGroupR.t );
    _variables = new WCheckBox(         this, _variablesR.r,     _variablesR.t );
    _varStatic = new WCheckBox(         this, _varStaticR.r,    _varStaticR.t );
    _functions = new WCheckBox(         this, _functionsR.r,     _functionsR.t );
    _virtual = new WCheckBox(           this, _virtualR.r,       _virtualR.t );
    _funcStatic = new WCheckBox(        this, _funcStaticR.r,    _funcStaticR.t );

    _variables->onClick( this, (cbw) &MemberFilterDlg::varOrFuncPushed );
    _functions->onClick( this, (cbw) &MemberFilterDlg::varOrFuncPushed );

    _okButton = new WDefPushButton( this, _okButtonR.r,      _okButtonR.t );
    _defaultButton = new WPushButton(   this, _defaultButtonR.r, _defaultButtonR.t );
    _cancelButton = new WPushButton(    this, _cancelButtonR.r,  _cancelButtonR.t );


    _inheritGroup->show();
    _bttns._none->show();
    _bttns._visible->show();
    _bttns._all->show();
    _accessGroup->show();
    _public->show();
    _protected->show();
    _private->show();
    _memberGroup->show();
    _variables->show();
    _varStatic->show();
    _functions->show();
    _virtual->show();
    _funcStatic->show();
    _okButton->show();
    _defaultButton->show();
    _cancelButton->show();

    _okButton->onClick(      this, (cbw) MemberFilterDlg::okButton );
    _defaultButton->onClick( this, (cbw) MemberFilterDlg::defaultButton );
    _cancelButton->onClick(  this, (cbw) MemberFilterDlg::cancelButton );

    _bttns._none->setFocus();

    setValues( _current );
    show();
}
Esempio n. 3
0
void QueryConfig::initialize()
//----------------------------
{
    int i;
    OptionManager * optMgr = WBRWinBase::optManager();

    setSystemFont( FALSE );
    rescale();
    move( frame().r );
    centre();

    _symText =      new WText( this, _symTextR.r, _symTextR.t );
    _symName =      new WCommandList( this, _symNameR.r, NULL );

    _symText->show();
    _symName->show();

    _matchCase =    new WCheckBox( this, _matchCaseR.r, _matchCaseR.t );
    _wholeWord =    new WCheckBox( this, _anchoredR.r, _anchoredR.t );
    _useRX =        new WCheckBox( this, _useRXR.r, _useRXR.t );
    _cfgRegexp =    new WPushButton( this, _cfgRegexpR.r, _cfgRegexpR.t );

    _matchCase->show();
    _wholeWord->show();
    _useRX->show();

    _matchCase->setCheck( !optMgr->getIgnoreCase() );
    _wholeWord->setCheck( optMgr->getWholeWord() );
    _useRX->setCheck( optMgr->getUseRX() );
    _useRX->onClick( this, (cbw) &QueryConfig::useRXClicked );
    _wholeWord->enable( !optMgr->getUseRX() );

    _ok =           new WDefPushButton( this, _searchR.r, _searchR.t );
    _cancel =       new WPushButton( this, _cancelR.r, _cancelR.t );
    _filters =      new WPushButton( this, _filtersR.r, _filtersR.t );
    _help =         new WPushButton( this, _helpR.r, _helpR.t );

    _ok->show();
    _cancel->show();
    _filters->show();
    _cfgRegexp->show();
    _help->show();

    _cfgRegexp->enable( optMgr->getUseRX() );

    _ok->onClick(           this, (cbw) &QueryConfig::okButton );
    _cancel->onClick(       this, (cbw) &WDialog::cancelButton );
    _filters->onClick(      this, (cbw) &QueryConfig::filtersButton );
    _cfgRegexp->onClick(    this, (cbw) &QueryConfig::cfgRXButton );
    _help->onClick(         this, (cbw) &QueryConfig::helpButton );

    for( i = 0; i < _searchStrings->count(); i +=1 ) {
        _symName->insertString( ((WString *)(*_searchStrings)[ i ] )->gets(),
                                0 );
    }

    _symName->setFocus();

    show();
}
Esempio n. 4
0
void input(char prompt[], char line[], uint8_t asciistart, uint8_t asciiend, uint8_t maxlength){
 	setSystemFont();
	inputInit(prompt, line, maxlength, asciistart, asciiend);
	while (!s_input.done) {
        inputDraw();
        lcdDisplay();
        inputMove();
    }
	inputClean();
	return;
}
Esempio n. 5
0
void lcdInit(void) {
	SETUPgout(LCD_BL_EN);
	SETUPgout(LCD_RESET);
	SETUPgout(LCD_CS);

	/* prepare SPI */
	SETUPpin(LCD_MOSI);
	SETUPpin(LCD_SCK);

	// Reset the display
    OFF(LCD_RESET);
    delayms(100); /* 1 ms */
    ON(LCD_RESET);
    delayms(100); /* 5 ms */

    lcd_select();

	static uint8_t initseq_d[] = {
		/* The controller is a PCF8833 -
		   documentation can be found online.
		 */
		0x11,              // SLEEP_OUT  (wake up)
		0x3A, 2,           // mode 8bpp  (2= 8bpp, 3= 12bpp, 5= 16bpp)
		0x36, 0b11000000,  // my,mx,v,lao,rgb,x,x,x
		0x25, 0x3a,        // set contrast
		0x29,              // display on 
		0x03,              // BSTRON (booster voltage)
		0x2A, 1, RESX,
		0x2B, 1, RESY
	};
	uint16_t initseq_c = ~  (  /* commands: 1, data: 0 */
			(1<< 0) |
			(1<< 1) | (0<< 2) |
			(1<< 3) | (0<< 4) |
			(1<< 5) | (0<< 6) |
			(1<< 7) |
			(1<< 8) |
			(1<< 9) | (0<<10) | (0<<11) |
			(1<<12) | (0<<13) | (0<<14) |
			0);
	int i = 0;

	lcdWrite(0, 0x01); /* most color displays need the pause */
	delayms(10);

	while(i<sizeof(initseq_d)){
		lcdWrite(initseq_c&1, initseq_d[i++]);
		initseq_c = initseq_c >> 1;
	}
    lcd_deselect();
	lcdFill(0xff); /* Clear display buffer */
	setSystemFont();
}
Esempio n. 6
0
int input_int(char prompt[], int initial, int min, int max, int digits) {
	setSystemFont();
  setTextColor(0xFF,0x00);
	intinInit(prompt, initial, min, max, digits);
	while (!s_int.done) {
		intinDraw();
		lcdDisplay();
		intinMove();
    intinClean();
	}
  lcdPrintln("");
  lcdPrint("number: ");
  lcdPrintln(IntToStr(s_int.the_number,s_int.digits,F_LONG|F_ZEROS));
	return s_int.the_number;
}
Esempio n. 7
0
void EnumStyleEdit::initialize()
//------------------------------
{
    int i;

    setSystemFont( false );
    rescale();
    move( frame().r );
    centre();

    _styleGroup = new WGroupBox( this, _styleGroupR.r, _styleGroupR.t );

    _okButton = new WDefPushButton( this, _okButtonR.r, _okButtonR.t );
    _defaultButton = new WPushButton( this, _defaultButtonR.r, _defaultButtonR.t );
    _cancelButton = new WPushButton( this, _cancelButtonR.r,  _cancelButtonR.t );

    _buttons[ EV_HexLowerCase ] = new WRadioButton( this, _lowerHexR.r, _lowerHexR.t, RStyleGroupFirst );
    _buttons[ EV_HexUpperCase ] = new WRadioButton( this, _upperHexR.r, _upperHexR.t );
    _buttons[ EV_HexMixedCase ] = new WRadioButton( this, _mixedHexR.r, _mixedHexR.t );
    _buttons[ EV_Octal ] =        new WRadioButton( this, _octalR.r,    _octalR.t );
    _buttons[ EV_Decimal ] =      new WRadioButton( this, _decimalR.r,  _decimalR.t );
    _buttons[ EV_Character ] =    new WRadioButton( this, _characterR.r,_characterR.t, RStyleGroupLast );

    _styleGroup->show();
    _okButton->show();
    _defaultButton->show();
    _cancelButton->show();

    for( i = 0; i < EV_NumStyles; i += 1 ) {
        _buttons[ i ]->show();
    }

    _okButton->onClick(      this, (cbw) EnumStyleEdit::okButton );
    _defaultButton->onClick( this, (cbw) EnumStyleEdit::defaultButton );
    _cancelButton->onClick(  this, (cbw) EnumStyleEdit::cancelButton );

    _buttons[ EV_HexLowerCase ]->setFocus();

    setValues( _current );
    show();
}
Esempio n. 8
0
void WAutoDialog::initialize() {
    /******************************/

    WText       *t;
    WPoint      avg;
    WPoint      max;
    int         i;

    setSystemFont( FALSE );
    int x = WSystemMetrics::dialogFrameWidth();
    int y = WSystemMetrics::dialogFrameHeight();
    textMetrics( avg, max );

    int t_w = 0;
    int t_h = 0;
    int icount = _prompts->count();
    for( i = 0; i < icount; i++ ) {
        updateExtents( _prompts->cStringAt( i ), &t_w, &t_h );
    }

    int b_w = 50 * avg.x() / 4;
    int b_h = 14 * avg.y() / 8;

    int p_w = _editwidth * avg.x();
    int p_h = max.y();
    t_w += avg.x() / 2;
    t_h += avg.y() / 2;
    p_w += avg.x() / 2;
    p_h += 2*max.y() / 3;
    int sp = max.x();

    for( i = 0; i < icount; i++ ) {
        WString s( _prompts->cStringAt( i ) );
        bool bro = FALSE;
        char* p = strchr( (char *)s.gets(), '=' );
        if( p != NULL ) { // this code depends on internals of WString!
            *p = '\0';
            p++;
            if( *p == '=' ) {
                bro = TRUE;
                p++;
            }
        }
        t = new WText( this, WRect( x, y + (p_h - t_h)/2, t_w, t_h ), s );
        t->show();
        WEditBox* e = new WEditBox( this,
                                    WRect( x + t_w + sp, y, p_w, p_h ), p );
        e->show();
        _inputs.add( e );
        if( bro ) {
            WPushButton* bBrowse = new WPushButton( this,
                                                    WRect( x + t_w + p_w + 2*sp, y, b_w, b_h ), BrowseText );
            bBrowse->onClick( this, (cbw)&WAutoDialog::browseButton );
            bBrowse->setTagPtr( e );
            bBrowse->show();
        }
        y += t_h + t_h / 2;
    }

    WDefPushButton* bOk = new WDefPushButton( this, WRect( x, y, b_w, b_h ),
            OKText );
    bOk->onClick( this, (cbw)&WAutoDialog::okButton );
    bOk->show();

    WPushButton* bCancel = new WPushButton( this,
                                            WRect( x + b_w + sp, y, b_w, b_h ), CancelText );
    bCancel->onClick( this, (cbw)&WAutoDialog::cancelButton );
    bCancel->show();

    shrink();
    centre();

    WEditBox* e = (WEditBox *)_inputs[0];
    e->select();
    e->setFocus();
    show();
}
Esempio n. 9
0
int main(void)
{
	cpu_clock_init_();
//	cpu_clock_pll1_max_speed();
	scu_pinmux(RF_EN_PIN,SCU_GPIO_NOPULL|RF_EN_FUNC);
	GPIO_DIR(RF_EN_GPORT) |= RF_EN_GPIN;
	gpio_clear(RF_EN_GPORT, RF_EN_GPIN); /* RF off */

    // Config LED as out
	scu_pinmux(LED1_PIN,SCU_GPIO_NOPULL|LED1_FUNC);
	GPIO_DIR(LED1_GPORT) |= LED1_GPIN;

	inputInit();

    lcdInit();
    lcdFill(0xff);
	setSystemFont();
	char tu=0,td=0,tl=0,tr=0,tm=0;
	char led=0;
	lcdPrintln("Sec-Test v2");
	lcdPrintln("");

	int ctr=0;
	int k=0;
	/* Blink LED1 on the board. */
	while (1) 
	{
		lcdSetCrsr(0,16);
		lcdPrint(IntToStr(tu,2,F_HEX)); lcdPrintln(" Up");
		lcdPrint(IntToStr(td,2,F_HEX)); lcdPrintln(" Down");
		lcdPrint(IntToStr(tl,2,F_HEX)); lcdPrintln(" Left");
		lcdPrint(IntToStr(tr,2,F_HEX)); lcdPrintln(" Right");
		lcdPrint(IntToStr(tm,2,F_HEX)); lcdPrintln(" Enter");
		lcdDisplay(); 
		switch(getInput()){
			case BTN_UP:
				tu=1-tu;
				if (tu){
				}else{
				};
				break;
			case BTN_DOWN:
				td=1-td;
				if (td){
				}else{
				};
				break;
			case BTN_LEFT:
				tl=1-tl;
				if (tl){
				}else{
				};
				break;
			case BTN_RIGHT:
				tr=1-tr;
				if (tr){
				}else{
				};
				break;
			case BTN_ENTER:
				tm=1-tm;
				if (tm){
				}else{
				};
				break;
		};

		led=1-led;
		if (led){
			gpio_set(LED1_GPORT, LED1_GPIN); /* LED on */
		}else{
			gpio_clear(LED1_GPORT, LED1_GPIN); /* LED off */
//			delayNop(200000);
		};

		ctr++;
		lcdNl();
		lcdPrint(IntToStrX(ctr,4));
	}

	return 0;
}
Esempio n. 10
0
void VEditDlg::initialize()
{

    int                 sx;
    int                 sy;
    WPoint              average;
    WPoint              max;
    WGroupBox           *gbox;
    WText               *t1;
    WText               *t3;
    WText               *t4;
    WText               *t5;
    WText               *t6;
    WText               *t7;

    const int   rb_hite = 10;  //height of a radio button
//    const int   space = 10;
    const int   button_width = 50;
    const int   button_hite = 14;

    setSystemFont( false );
    this->textMetrics( average, max );
    sx = average.x() / 4;
    sy = average.y() / 8;

    t1 = new WText( this, WRect( 5*sx, 5*sy, 132*sx, 9*sy ),
                    "Enter editor file name:" );
    t1->show();

    _editorName = new WEditBox( this, WRect( 5*sx, 17*sy, 139*sx, 13*sy ) );
    _editorName->select();
    _editorName->show();

    _parmBoxText = new WText( this, WRect( 5*sx, 33*sy, 132*sx, 9*sy ),
                    "Enter editor parameters:" );
    _parmBoxText->show();

    _editorParms = new WEditBox( this, WRect( 5*sx, 45*sy, 139*sx, 13*sy ) );
    _editorParms->select();
    _editorParms->show();

    WPushButton* bBrowse = new WPushButton( this,
                WRect( 155*sx, 16*sy, button_width * sx, button_hite * sy ),
                "&Browse..." );
    bBrowse->onClick( this, (cbw)&VEditDlg::browseButton );
    bBrowse->show();

    WDefPushButton*     bOk;
    bOk = new WDefPushButton( this,
                WRect( 26*sx, 117*sy, button_width * sx, button_hite * sy ),
                "&OK" );
    bOk->onClick( this, (cbw)&VEditDlg::okButton );
    bOk->show();

    WPushButton* bCancel = new WPushButton( this,
                WRect( 82*sx, 117*sy, button_width * sx, button_hite * sy ),
                "&Cancel" );
    bCancel->onClick( this, (cbw)&VEditDlg::cancelButton );
    bCancel->show();

    WPushButton* bDefault = new WPushButton( this,
                WRect( 138*sx, 117*sy, button_width * sx, button_hite * sy ),
                "&Default" );
    bDefault->onClick( this, (cbw)&VEditDlg::defaultButton );
    bDefault->show();

    _exeButton = new WRadioButton( this,
           WRect( 13*sx, 74*sy, 60*sx, rb_hite * sy ),
           "Executable", RStyleGroupFirst );
    _exeButton->show();
    _exeButton->onClick( this, (cbw)&VEditDlg::exeButton );

    _dllButton = new WRadioButton( this,
           WRect( 13*sx, 87*sy, 60*sx, rb_hite * sy ),
           "DLL", RStyleGroupFirst );
    _dllButton->show();
    _dllButton->onClick( this, (cbw)&VEditDlg::dllButton );

    gbox = new WGroupBox( this,
                          WRect( 5*sx, 61*sy, 139*sx, 42 * sy ),
                          "Editor type: " );
    gbox->show();

    t3 = new WText( this, WRect( 155*sx, 45*sy, 65*sx, 9*sy ),
                    "Parameter" );
    t3->show();
    t4 = new WText( this, WRect( 155*sx, 54*sy, 65*sx, 9*sy ),
                    "Macros:" );
    t4->show();
    t5 = new WText( this, WRect( 155*sx, 67*sy, 65*sx, 9*sy ),
                    "%f - filename" );
    t5->show();
    t6 = new WText( this, WRect( 155*sx, 76*sy, 65*sx, 9*sy ),
                    "%r - row" );
    t6->show();
    t7 = new WText( this, WRect( 155*sx, 85*sy, 65*sx, 9*sy ),
                    "%c - column" );
    t7->show();

    _editorName->setText( _fn );
    _editorParms->setText( _parms );
    if( _isDll ) {
        _dllButton->setCheck( true );
        _editorParms->setText( "" );
        _editorParms->enable( false );
        _parmBoxText->enable( false );
    } else {
        _exeButton->setCheck( true );
    }

    size( (WOrdinal)225*sx, (WOrdinal)155*sy );
    centre();
    show();
    _editorName->setFocus();
}
Esempio n. 11
0
void VCompDialog::initialize()
{

    int         sx;
    int         sy;
    WPoint      average;
    WPoint      max;

    const int   rb_hite = 10;  //height of a radio button
    const int   space = 10;
    const int   button_width = 50;
    const int   button_hite = 14;

    setSystemFont( FALSE );
    this->textMetrics( average, max );
    sx = average.x() / 4;
    sy = average.y() / 8;

    WText* t1 = new WText( this, WRect( 7*sx, 2*sy, 164*sx, 9*sy ),
                            "Target name:" );
    t1->show();

    _eName = new WEditBox( this, WRect( 7*sx, 12*sy, 250*sx, 13*sy ), *_fn );
    _eName->select();
    _eName->show();

    WPushButton* bBrowse = new WPushButton( this,
                WRect( 265*sx, 11*sy, button_width * sx, button_hite * sy ),
                "&Browse..." );
    bBrowse->onClick( this, (cbw)&VCompDialog::browseButton );
    bBrowse->show();

    WText* t2 = new WText( this, WRect( 167*sx, 31*sy, 86*sx, 9*sy ),
                            "Image Type:" );
    t2->show();

    WRadioButton        *button;
    WRadioButton        *checkedbutton;
    int                 icount;
    WStyle              style;
    MTarget             *curtarg;
    int                 i;
    bool                singletarg;

    curtarg = NULL;
    if( _comp != NULL ) {
        WPickList& targets = _config->targets();
        icount = targets.count();
        for( i=0; i < icount; i++ ) {
            curtarg = (MTarget *)targets[i];
            if( curtarg->mask() == _comp->mask() ) break;
        }
        if( i == icount ) curtarg = NULL;
    }

    WVList &list = _config->targetOSs();
    icount = list.count();
    if( icount == 1 ) {
        // use a static field instead of a radio button when there is
        // only one target installed
        singletarg = TRUE;
        i = 0;
        _cur_os = *(WString *)list[0];
        WText* t3 = new WText( this, WRect( 11*sx, 41*sy, 135*sx, rb_hite * sy ),
                            _cur_os.gets() );
        t3->show();
    } else {
        singletarg = FALSE;
        for( i=0; i < icount; i ++ ) {
            if( i == 0 ) {
                if( icount == 1 ) {
                    style = RStyleRadioButton;
                } else {
                    style = RStyleGroupFirst;
                }
            } else if( i == icount - 1 ) {
                style = RStyleGroupLast;
            } else {
                style = RStyleRadioButton;
            }
            button = new WRadioButton( this,
                   WRect( 11*sx, ( 41 + rb_hite * i ) * sy, 135*sx, rb_hite * sy ),
                   ( (WString *)list[i] )->gets(), style );
            button->show();
            button->onClick( this, (cbw)&VCompDialog::osButton );

            if( curtarg == NULL ) {
                if( i == 0 ) {
                    checkedbutton = button;
                }
            } else {
                if( curtarg->targetOS() == *(WString *)list[i] ) {
                    checkedbutton = button;
                }
            }
        }
    }

    WGroupBox           *gbox;

    if( i < 5 ) i = 5;
    int boxtop = 29;
    int boxhite = i * rb_hite + 20;
    int boxbottom = boxtop + boxhite;
    gbox = new WGroupBox( this,
                          WRect( 7*sx, boxtop * sy, 146*sx, boxhite * sy ),
                          "Target Environment" );
    gbox->show();


    _imagelist = new WListBox( this,
                 WRect( 166*sx, 44*sy, 150*sx, ( boxbottom - 44 ) * sy ),
                 LStyleNoIntegral );
    _imagelist->onDblClick( this, (cbw)&VCompDialog::okButton );
    _imagelist->show();


    WDefPushButton* bOk;
    boxbottom += space;
    bOk = new WDefPushButton( this,
          WRect( 105*sx, boxbottom * sy, button_width * sx, button_hite * sy ),
          "&OK" );
    bOk->onClick( this, (cbw)&VCompDialog::okButton );
    bOk->show();

    WPushButton* bCancel;
    bCancel = new WPushButton( this,
           WRect( 186*sx, boxbottom * sy, button_width * sx, button_hite * sy ),
           "&Cancel" );
    bCancel->onClick( this, (cbw)&VCompDialog::cancelButton );
    bCancel->show();

    if( singletarg ) {
        updateCurOs();
    } else {
        checkedbutton->setCheck( TRUE );
    }
    if( curtarg != NULL ) {
        icount = _tgList.count();
        MTarget         *tmptarg;
        for( i=0; i < icount; i++ ) {
            tmptarg = (MTarget *)_tgList[i];
            if( curtarg->imageName() == tmptarg->imageName() ) {
                _imagelist->select( i );
                break;
            }
        }
    }
    int xsize = 330 * sx;
    int ysize = WSystemMetrics::dialogFrameWidth() * 2
                + WSystemMetrics::captionSize()
                + ( boxbottom + button_hite + space ) * sy;
    size( (WOrdinal)xsize, (WOrdinal) ysize );
    centre();
    show();
    _eName->setFocus();
}
Esempio n. 12
0
void handleMenu(const struct MENU *the_menu) {
    uint8_t back = 0;
    int8_t menuselection = 0;
    uint8_t numentries;
    uint8_t visible_lines = 0;
    uint8_t current_offset = 0;

    if (the_menu == NULL) return;

    setSystemFont();

    for (numentries = 0; the_menu->entries[numentries].text != NULL ; numentries++);

    if(the_menu->entries[numentries-1].text[0]=='|' && !GLOBAL(develmode))
        numentries--;

    visible_lines = lcdGetVisibleLines()-1; // subtract title line

    if(menuflags&MENU_BIG)
        visible_lines/=2;

#ifdef SAFETY
    if (visible_lines < 2) return;
#endif

    while (!back) {
        // Display current menu page
        lcdClear();
        lcdPrintln(the_menu->title);

        for (uint8_t i = current_offset; i < (visible_lines + current_offset) && i < numentries; i++) {
            if(menuflags&MENU_BIG)
                lcdNl();
            if (i == menuselection) {
                lcdPrint("*");
            }
            lcdSetCrsrX(14);
            lcdPrintln(the_menu->entries[i].text);
        }
        lcdRefresh();

        switch (getInputWaitTimeout((menuflags&MENU_TIMEOUT)?15000:0)) {
            case BTN_UP:
                menuselection--;
                if (menuselection < current_offset) {
                    if (menuselection < 0) {
                        menuselection = numentries-1;
                        current_offset = ((numentries-1)/visible_lines) * visible_lines;
                    } else {
                        current_offset -= visible_lines;
                    }
                }
                break;
            case BTN_DOWN:
                menuselection++;
                if (menuselection > (current_offset + visible_lines-1) || menuselection >= numentries) {
                    if (menuselection >= numentries) {
                        menuselection = 0;
                        current_offset = 0;
                    } else {
                        current_offset += visible_lines;
                    }
                }
                break;
            case BTN_LEFT:
                return;
            case BTN_RIGHT:
                if (the_menu->entries[menuselection].callback!=NULL)
                    the_menu->entries[menuselection].callback();
				
				if (menuflags&MENU_JUSTONCE)
					return;
				
                break;
            case BTN_ENTER:
                lcdClear();
//                lcdPrintln("Called...");
//                lcdRefresh();
                getInputWaitRelease();
                if (the_menu->entries[menuselection].callback!=NULL)
                    the_menu->entries[menuselection].callback();
                lcdRefresh();
				
				if (menuflags&MENU_JUSTONCE)
					return;

//                getInputWait();

                break;
            case BTN_NONE: /* timeout */
                return;
            default:
                /* NOTREACHED */
                break;
        }
        getInputWaitRelease();
    }
    return;
}
Esempio n. 13
0
void NewEditDLL::initialize()
//--------------------------
{
    setSystemFont( FALSE );
    rescale();
    move( frame().r );
    centre();

    _dllText =      new WText(          this, _dllNameTextR.r,  _dllNameTextR.t );
    _dllEdit =      new WEditBox(       this, _dllNameEditR.r,  _dllNameEditR.t );
    _parmBoxText =  new WText(          this, _parmBoxTextR.r,  _parmBoxTextR.t );
    _editorParms =  new WEditBox(       this, _editorParmsR.r,  _editorParmsR.t );
    _okButton =     new WDefPushButton( this, _okButtonR.r,     _okButtonR.t );
    _defaultButton =new WPushButton(    this, _defaultButtonR.r,_defaultButtonR.t );
    _filesButton =  new WPushButton(    this, _fileButtonR.r,   _fileButtonR.t );
    _cancelButton = new WPushButton(    this, _cancelButtonR.r, _cancelButtonR.t );
    _helpButton =   new WPushButton(    this, _helpButtonR.r,   _helpButtonR.t );
    _exeButton =    new WRadioButton(   this, _exeButtonR.r,    _exeButtonR.t, RStyleGroupFirst );
    _dllButton =    new WRadioButton(   this, _dllButtonR.r,    _dllButtonR.t, RStyleGroupFirst );
    _gbox =         new WGroupBox(      this, _gboxR.r,         _gboxR.t );

    _parmMsg =  new WText(              this, _parmMsgR.r,      _parmMsgR.t );
    _macroMsg = new WText(              this, _macroMsgR.r,     _macroMsgR.t );
    _fMsg =     new WText(              this, _fMsgR.r,         _fMsgR.t );
    _rMsg =     new WText(              this, _rMsgR.r,         _rMsgR.t );
    _cMsg =     new WText(              this, _cMsgR.r,         _cMsgR.t );

    _dllText->show();
    _dllEdit->show();
    _editorParms->show();
    _parmBoxText->show();
    _okButton->show();
    _defaultButton->show();
    _filesButton->show();
    _cancelButton->show();
    _helpButton->show();
    _exeButton->show();
    _dllButton->show();
    _parmMsg->show();
    _macroMsg->show();
    _fMsg->show();
    _rMsg->show();
    _cMsg->show();
    _gbox->show();

    _okButton->onClick(          this, (cbw) NewEditDLL::okButton );
    _defaultButton->onClick(     this, (cbw) NewEditDLL::defaultButton );
    _filesButton->onClick(       this, (cbw) NewEditDLL::filesButton );
    _cancelButton->onClick(      this, (cbw) NewEditDLL::cancelButton );
    _helpButton->onClick(        this, (cbw) NewEditDLL::helpButton );
    _exeButton->onClick(         this, (cbw) NewEditDLL::exeButton );
    _dllButton->onClick(         this, (cbw) NewEditDLL::dllButton );

    _dllEdit->setText( _newDLLName );
    _dllEdit->setFocus();

    if( _isDLL ) {
        _dllButton->setCheck( TRUE );
        _editorParms->setText( "" );
        _editorParms->enable( FALSE );
        _parmBoxText->enable( FALSE );
    } else {
        _exeButton->setCheck( TRUE );
        _editorParms->setText( _parms );
        _editorParms->enable( TRUE );
        _parmBoxText->enable( TRUE );
    }

    show();
}