Example #1
0
void WDialog::doDialog( WWindow *parent ) {
/*****************************************/

    WRect               r;
    gui_create_info     create_info;

    autoPosition( r );
    gui_window *hparent = NULL;
    if( parent != NULL ) {
        hparent = parent->handle();
    }
    const char *ctext = _text;
    create_info.text = (char *)ctext;
    create_info.rect.x = r.x();
    create_info.rect.y = r.y();
    create_info.rect.width = r.w();
    create_info.rect.height = r.h();
    create_info.scroll = GUI_NOSCROLL;
    create_info.style = GUI_NONE;
    create_info.parent = hparent;
    create_info.num_menus = 0;
    create_info.menu = NULL;
    create_info.num_attrs = 0;
    create_info.colours = NULL;
    create_info.call_back = DlgProc;
    create_info.extra = this;
    create_info.icon = NULL;
    GUICreateDialog( &create_info, 0, NULL );
}
Example #2
0
void WEXPORT WSystemMetrics::screenSize( WRect& r ) {
/***************************************************/

    r.x( 0 );
    r.y( 0 );
    r.w( _screen.width );
    r.h( _screen.height );
}
void WEXPORT WStatDialog::getCtrlRect( WControlId id, WRect & r ) {
    /*****************************************************************/

    gui_rect    rr;

    GUIGetControlRect( handle(), id, &rr );
    r.x( rr.x );
    r.y( rr.y );
    r.w( rr.width );
    r.h( rr.height );
}
Example #4
0
void WEXPORT WRect::fitInside( const WRect& r ) {
/***********************************************/

    if( _x >= r.w() ) _x = (WOrdinal)(r.w() - 2);
    if( _y >= r.h() ) _y = (WOrdinal)(r.h() - 2);
    if( _x+_w >= r.w() ) _w = (WOrdinal)(r.w() - _x - 1);
    if( _y+_h >= r.h() ) _h = (WOrdinal)(r.h() - _y - 1);
}
Example #5
0
WEXPORT VMsgLog::VMsgLog( VpeMain* parent )
    : WMdiChild( parent, "IDE Log" )
    , _parent( parent )
    , _batcher( NULL )
    , _connecting( FALSE )
    , _runQueued( FALSE )
    , _connectTimer( NULL )
    , _serverConnected( FALSE )
    , _maxLength( 0 )
    , _running( FALSE )
    , _batserv( TRUE )
    , _localBatserv( FALSE )
    , _vxdPresent( FALSE )
{
    if( _config->hostType() == HOST_WINDOWS ||
        _config->hostType() == HOST_NEC_WIN ||
        _config->hostType() == HOST_J_WIN ) {
        _batserv = FALSE;
    }
    setIcon( I_MsgLog );

    WRect sc;
    _parent->getClientRect( sc );
    sc.y( sc.h() * 2/3 );
    sc.h( sc.h() - sc.y() );
    move( sc );

    int yoff = 0;

    _batcher = new VListBox( this, WRect(0,yoff,-1,-1) );
    _batcher->onDblClick( this, (cbw)&VMsgLog::selected );
    _batcher->show();

    show();

    loadHelpList();

    clearData();

    _batcher->setPopup( _parent->logPopup() );

    addAccelKey( LOG_ESCAPE_KEY, this, (bcbk)&VMsgLog::kAccelKey );
    addAccelKey( LOG_HELP_KEY, this, (bcbk)&VMsgLog::kAccelKey );
}
Example #6
0
bool WHotSpotList::paint()
//-----------------------
{
    int offset;
    int maxRows = numDirtyRows() + _topIndex + firstDirtyRow();
    int numElem = count();
    int extent;
    WRect r;

    getClientRect( r );

    for( int i = _topIndex + firstDirtyRow(); i < maxRows && i < numElem; i += 1 ) {
        const char * str = getString( i );

        int hotSpot;
        if( i == _hotPressIdx && _inHotZone ) {
            hotSpot = getHotSpot( i, TRUE );
        } else {
            hotSpot = getHotSpot( i, FALSE );
        }

        if( _hs != NULL ) {
            WPoint hotSize;
            _hs->hotSpotSize( hotSpot, hotSize );
            offset = getHotOffset( i ) + hotSize.x();
            drawHotSpot( hotSpot, i - _topIndex, getHotOffset( i ) );
        } else {
            offset = 0;
        }
        extent = r.w();
        if( width() > extent ) extent = width();
        if( i == _selected ) {
            drawTextExtent( i - _topIndex, offset, str, WPaintAttrMenuActive,
                            extent );
        } else {
            drawTextExtent( i - _topIndex, offset, str, WPaintAttrControlBackground,
                            extent );
        }
    }

    return TRUE;
}
Example #7
0
void TreeNode::paint( OutputDevice *dev, TreeRect *r )
//----------------------------------------------------
{
    /* first make sure that this node needs to be drawn:
     * it must be visible, and it must be inside the
     * invalid rectangle
     */

    if( _flags.enabled == Hidden )  return;

    if( ( r->x() + r->w() < _bounding.x() ) ||
         (r->x() > _bounding.x() + _bounding.w() ) )  return;

    if( ( r->y() + r->h() < _bounding.y() ) ||
        ( r->y() > _bounding.y() + _bounding.h() ) )  return;


    WPoint      start;
    WRect       virtBnd;
    TreeCoord   xOff = _parent->getXOff();
    TreeCoord   yOff = _parent->getYOff();
    Color       back;
    Color       fore;
    PaintInfo * pinf;
    PaintInfo * oldPinf;

    //---------- border ---------//

    virtBnd.x( (int) _bounding.x() - xOff );
    virtBnd.y( (int) _bounding.y() - yOff );
    virtBnd.w( (int) _bounding.w() );
    virtBnd.h( (int) _bounding.h() );

    pinf = getPaintInfo();
    oldPinf = dev->getPaintInfo();
    dev->setPaintInfo( pinf );

    dev->rectangle( virtBnd );

    delete pinf;
    dev->setPaintInfo( oldPinf );

    //---------- text -----------//

    if( _flags.selected ) {
        back = CUSTOM_RGB(0,0,128);
        fore = ColorWhite;
    } else {
        back = ColorLiteGray;
        fore = ColorBlack;
    }

    start.x( virtBnd.x() + NodeBuffer );
    start.y( virtBnd.y() + NodeBuffer );

    dev->drawText( start, name(), fore, back );
}
Example #8
0
bool VpeMain::reallyClose()
{
    WRect rect;
    show( WWinStateShowNormal );
    if( _quitAnyways || okToQuit() ) {
        startWait();
        clearProject();
        stopWait();
        // write out .INI file stuff
        char buff[_MAX_PATH];
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_EDITOR, (char*)_editor.gets() );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_EDITOR_ISDLL, _editorIsDll ? "1" : "0" );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_EDITOR_PARMS, _editorParms.gets() );
        for( int i=0; i<_oldProjects.count(); i++ ) {
            itoa( i+1, buff, 10 );
            _ini.write( IDE_INI_IDENTIFIER, buff, (const char*)*((WFileName*)_oldProjects[i]) );
        }
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_TOOLBAR, _toolBarActive ? "1" : "0" );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_STATWND, (_statusBar != NULL) ? "1" : "0" );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_AUTOREFRESH, _autoRefresh ? "1" : "0" );
        getRectangle( rect );
        itoa( rect.w(), buff, 10 );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_WIDTH, buff );
        itoa( rect.h(), buff, 10 );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_HEIGHT, buff );
        itoa( rect.x(), buff, 10 );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_X, buff );
        itoa( rect.y(), buff, 10 );
        _ini.write( IDE_INI_IDENTIFIER, IDE_INI_Y, buff );
        if( _otherhelp != NULL ) {
            delete _otherhelp;
            _otherhelp = NULL;
        }
        delete _help;
        _help = NULL;
        return( true );
    }
    return( false );
}
Example #9
0
HRESULT WStatic::ProcessMessage(UINT message, WPARAM wParam, 
    LPARAM lParam, BOOL& handle)
{
    switch(message)
    {
    case WM_CREATE:
        {
            break;
        }
    case WM_KEYDOWN:
        {
            OutputDebugString(_T("WM_KEYDOWN\n"));
            break;
        }
    case WM_PAINT:
        {
            PAINTSTRUCT ps = {0};
            HDC hdc = BeginPaint(hWnd_, &ps);

            WRect rect = GetClientRect();
            HBRUSH backBrush = CreateSolidBrush(backColor_);
            RECT fillRect = {0, 0, rect.Width(), rect.Height()};
            FillRect(hdc, &fillRect, backBrush);

            TCHAR text[200];
            ::GetWindowText(hWnd_, text, _countof(text));
            ::SetBkMode(hdc, TRANSPARENT);
            ::SetTextColor(hdc, textColor_);
            ::DrawText(hdc, text, _tcslen(text), &fillRect, 
                DT_VCENTER|DT_CENTER);
  
            EndPaint(hWnd_, &ps);           
            break;
        }
    }
    return __super::ProcessMessage(message, wParam, lParam, handle);
}
Example #10
0
static bool ClipToRect( long & x1, long & y1, long & x2, long & y2,
                        const WRect & clip )
//-----------------------------------------------------------------
// Cohen-Sutherland Clipping Algorithm from _Fundamentals of Interactive
// Computer Graphics_, page 148.
{
    PointCode   point1( x1, y1, CL_Inside );
    PointCode   point2( x2, y2, CL_Inside );
    PointCode * p1;
    PointCode * p2;
    PointCode * tmp;
    long        top = clip.y();
    long        left = clip.x();
    long        bottom = clip.y() + clip.h();
    long        right = clip.x() + clip.w();

    p1 = & point1;
    p2 = & point2;

    while( 1 ) {
        CalcOut( *p1, top, left, bottom, right );
        CalcOut( *p2, top, left, bottom, right );

        if( p1->code == CL_Inside && p2->code == CL_Inside ) {
            return TRUE;                                // trivial acceptance
        }
        if( (p1->code & p2->code) != 0 ) {
            return FALSE;                               // trivial rejection
        }

        if( p1->code == 0 ) {   // p1 inside -- swap so p1 outside
            tmp = p1;
            p1 = p2;
            p2 = tmp;
        }

        // perform a subdivision; move p1 to the intersection point.
        // use the formula y = y1 + slope * (x - x1),
        //                 x = x1 + (y - y1) / slope.

        if( p1->code & CL_Above ) {                 // divide at top
            p1->x += ((p2->x - p1->x) * (top - p1->y)) / (p2->y - p1->y);
            p1->y = top;
        } else if( p1->code & CL_Below ) {          // divide at bottom of
            p1->x += ((p2->x - p1->x) * (bottom - p1->y)) / (p2->y - p1->y);
            p1->y = bottom;
        } else if( p1->code & CL_Right ) {          // divide at right
            p1->y += ((p2->y - p1->y) * (right - p1->x)) / (p2->x - p1->x);
            p1->x = right;
        } else if( p1->code & CL_Left ) {           // divide at left
            p1->y += ((p2->y - p1->y) * (left - p1->x)) / (p2->x - p1->x);
            p1->x = left;
        }
    }
}
Example #11
0
DescriptionPaint::DescriptionPaint( WBRWindow * prnt, const WRect & r,
                                    Symbol * sym )
                    : _parent( prnt )
                    , _rect( r )
                    , _current( -1 )
//--------------------------------------------------------------------
{
    int             i;
    WVList          desc;
    Description *   entry;
    WString         buf;
    const char *    uDefSymName;
    int             x = r.x();
    int             w;
    int             h;

    _parts = new WCPtrOrderedVector<DescriptionPart>;

    sym->description( desc );

    for( i = 0; i < desc.count(); i += 1 ) {
        entry = (Description *) desc[i];
        if( entry->symbol() ) {
            if( sym->isEqual( entry->symbol() ) ) {

                // don't hilight the symbol we're describing
                buf.concat( entry->name() );
                delete entry->symbol();

            } else {

                if( buf != "" ) { // flush buf
                    w = prnt->getTextExtentX( buf );
                    h = prnt->getTextExtentY( buf );
                    _parts->append( new DescriptionPart( buf.gets(), NULL,
                                        WRect(x,r.y(),w, h ) ) );

                    buf="";
                    x+=w;
                }

                uDefSymName = entry->name();
                w = prnt->getTextExtentX( uDefSymName );
                h = prnt->getTextExtentY( uDefSymName );
                _parts->append( new DescriptionPart( uDefSymName,
                                                     entry->symbol(),
                                                     WRect(x,r.y(),w, h ) ) );
                x+=w;
            }
        } else {
            buf.concat( entry->name() );
        }
    }

    desc.deleteContents();


    if( buf != "" ) { // flush buf
        w = prnt->getTextExtentX( buf );
        h = prnt->getTextExtentY( buf );
        _parts->append( new DescriptionPart( buf, NULL,
                                WRect(x,r.y(),w, h ) ) );

        buf="";
        x+=w;
    }

    _rect.w( x - abs( _rect.x() ) );
}
Example #12
0
void VpeMain::readIdeInit()
{
    char buff[FILENAME_MAX];
    int width, height, x, y;

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_TOOLBAR, "1", buff, sizeof( buff ) );
    if( buff[0] == '0' ) {
        delete clearToolBar();
        _toolBarActive = false;
    }

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_STATWND, "1", buff, sizeof( buff ) );
    if( buff[0] == '0' ) {
        deleteStatusBar();
    }

    _ini.read( IDE_INI_IDENTIFIER,IDE_INI_AUTOREFRESH, "1", buff, sizeof( buff ) );
    if( buff[0] == '0' ) {
        _autoRefresh = false;
    } else {
        _autoRefresh = true;
    }
    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_EDITOR, (const char*)_config->editor(),
               buff, sizeof( buff ) );
    _editor = buff;

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_EDITOR_ISDLL,
               _config->editorIsDLL() ? "1" : "0", buff, sizeof( buff ) );
    if( buff[0] == '0' ) {
        _editorIsDll = false;
    } else {
        _editorIsDll = true;
    }

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_EDITOR_PARMS, "%f", buff, sizeof( buff ) );
    _editorParms = buff;

    for( int i=0; i < MAXOLDPROJECTS; i++ ) {
        itoa( i+1, buff, 10 );
        _ini.read( IDE_INI_IDENTIFIER, buff, "*", buff, sizeof( buff ) ); // if we get "*", doesn't exist
        if( buff[0] != '*' ) {
            _oldProjects.add( new WFileName( buff ) );
        }
    }
    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_HEIGHT, "0", buff, sizeof( buff ) );
    height = atoi( buff );

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_WIDTH, "0", buff, sizeof( buff ) );
    width = atoi( buff );

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_X, "0", buff, sizeof( buff ) );
    x = atoi( buff );

    _ini.read( IDE_INI_IDENTIFIER, IDE_INI_Y, "0", buff, sizeof( buff ) );
    y = atoi( buff );

    WRect sc;
    WSystemMetrics::screenCoordinates( sc );
    if( width == 0 ) width = sc.w() * 3/4;
    if( height == 0 ) height = sc.h() * 9/10;

    sc.w( width );
    sc.h( height );
    sc.x( x );
    sc.y( y );
    move( sc );
}
Example #13
0
    void URLCompletions::draw(Menu &menu, const WRect &rect, WDrawable &d)
    {
      const menu::Style &style = menu.style();

      fill_rect(d, style.completions_background, rect);

      draw_border(d, style.border_color, style.border_pixels,
                  style.border_pixels, style.border_pixels, 0,
                  rect);

      WRect rect2 = rect.inside_border(style.border_pixels, style.border_pixels, style.border_pixels, 0);

      size_t begin_pos_index, end_pos_index;

      if (selected >= lines)
      {
        end_pos_index = selected + 1;
        begin_pos_index = end_pos_index - lines;
      } else
      {
        end_pos_index = lines;
        begin_pos_index = 0;
      }
      if (end_pos_index > completions.size())
        end_pos_index = completions.size();

      size_t base_y = rect2.y;

      for (size_t pos_index = begin_pos_index; pos_index < end_pos_index; ++pos_index)
      {
        int row = pos_index - begin_pos_index;
        WRect cell_rect(rect2.x,
                        base_y + style.completions_spacing + line_height * row,
                        rect2.width, line_height);

        const WColor *url_color, *title_color;

        WColor title_unselected(d.draw_context(), "gold1");
        WColor title_selected(d.draw_context(), "black");

        if ((int)pos_index == selected)
        {
          fill_rect(d, entry_style.selected_background, cell_rect);

          url_color = &entry_style.selected_url_foreground;
          title_color = &entry_style.selected_title_foreground;
        } else
        {
          url_color = &entry_style.normal_url_foreground;
          title_color = &entry_style.normal_title_foreground;
        }

        WRect url_rect(cell_rect.x, cell_rect.y, cell_rect.width / 2,
                       cell_rect.height);

        WRect title_rect(cell_rect.x + cell_rect.width / 2,
                         cell_rect.y,
                         cell_rect.width - cell_rect.width / 2, cell_rect.height);

        WRect url_rect2 = url_rect.inside_border(style.completions_spacing);

        WRect url_rect3 = url_rect2.inside_lr_tb_border
          (style.label.horizontal_padding,
           style.label.vertical_padding);

        WRect title_rect2 = title_rect.inside_border(style.completions_spacing);

        WRect title_rect3 = title_rect2.inside_lr_tb_border
          (style.label.horizontal_padding,
           style.label.vertical_padding);

        draw_label(d, completions[pos_index].url, style.label.font, *url_color, url_rect3);
        draw_label(d, completions[pos_index].title, style.label.font, *title_color, title_rect3);
      }
    }
Example #14
0
void DTViewSymbol::initialize()
//-----------------------------
// create the detail view of the symbol and size it.
{
    WString         titleText;
    WRect           tmpRect;
    char            fName[_MAX_PATH];
    int             width;
    int             tmpWidth;
    int             height;

    rescale();

    //----------------- "Function initialize" title ----------------

    titleText.printf( "%s %s", SymbolTitleText[ _symbol->symtype() ],
                _symbol->name() );
    setText( titleText.gets() );
    width = getTextExtentX( titleText.gets() ) + CaptionGadgetSize;

    //----------  "Defined: D:\dev\browser\cpp\dtvsym.cpp" line ----------

    if( _symbol->defSourceFile( fName ) ) {
        _fileText.printf( "%s: %s", (_symbol->isDefined()) ? Defined : Declared, fName );
        height = _symbolLineR.r.y();
    } else {
        height = _fileNameR.r.y();
    }
    tmpWidth = _fileNameR.r.x() + abs( _fileNameR.r.w() ) +
                getTextExtentX( _fileText.gets() );

    width = maxInt( width, tmpWidth );

    //------- "void DTViewSymbol::initialize()" line -------

    tmpRect = _symbolLineR.r;
    tmpRect.y( height );

    _descPaint = new DescriptionPaint( this, tmpRect, _symbol );

    height += _symbolBoxR.r.y() - _symbolLineR.r.y();
    tmpWidth = _symbolLineR.r.x() + _descPaint->rect().w() + abs( _symbolLineR.r.w() );
    width = maxInt( width, tmpWidth );

    //------------------ member listbox --------------------
    if( _useBox ) {
        tmpRect = _symbolBoxR.r;
        tmpRect.y( height );

        _symbolBox = new WListBox( this, tmpRect,
                        LStyleNoIntegral | WStyleHScroll | WStyleVScroll );
        _symbolBox->show();
        _symbolBox->setFocus();

        height += __frame.r.h() - _symbolBoxR.r.y();    // this include 2 * dialogFrameHeight
    }


    width += 2 * WSystemMetrics::dialogFrameWidth();
    height += WSystemMetrics::captionSize();

    size( width, height );
    show();
}