コード例 #1
0
ファイル: Utils.c プロジェクト: gilles-didier/Matchines
void fixSpace(char *src) {
	int i;
	for(i=0; src[i] != '\0'; i++)
		if(IsSeparator(src[i]))
			src[i] = '_';
}
コード例 #2
0
ファイル: menu.cpp プロジェクト: beanhome/dev
void wxMenuItem::SetItemLabel( const wxString& string )
{
    wxString str = string;
    if ( str.empty() && !IsSeparator() )
    {
        wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
        str = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR |
                                       wxSTOCK_WITH_MNEMONIC);
    }

    // Some optimization to avoid flicker
    wxString oldLabel = m_text;
    oldLabel = wxStripMenuCodes(oldLabel);
    oldLabel.Replace(wxT("_"), wxEmptyString);
    wxString label1 = wxStripMenuCodes(str);
    wxString oldhotkey = GetHotKey();    // Store the old hotkey in Ctrl-foo format
    wxCharBuffer oldbuf = wxGTK_CONV( GetGtkHotKey(*this) );  // and as <control>foo

    DoSetText(str);

    if (oldLabel == label1 &&
             oldhotkey == GetHotKey())    // Make sure we can change a hotkey even if the label is unaltered
        return;

    if (m_menuItem)
    {
        GtkLabel *label;
        if (m_labelWidget)
            label = (GtkLabel*) m_labelWidget;
        else
            label = GTK_LABEL( GTK_BIN(m_menuItem)->child );

        // set new text
        gtk_label_set( label, wxGTK_CONV( m_text ) );

        // reparse key accel
        (void)gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV(m_text) );
        gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) );
    }

    guint accel_key;
    GdkModifierType accel_mods;
    gtk_accelerator_parse( (const char*) oldbuf, &accel_key, &accel_mods);
    if (accel_key != 0)
    {
        gtk_widget_remove_accelerator( GTK_WIDGET(m_menuItem),
                                       m_parentMenu->m_accel,
                                       accel_key,
                                       accel_mods );
    }

    wxCharBuffer buf = wxGTK_CONV( GetGtkHotKey(*this) );
    gtk_accelerator_parse( (const char*) buf, &accel_key, &accel_mods);
    if (accel_key != 0)
    {
        gtk_widget_add_accelerator( GTK_WIDGET(m_menuItem),
                                    "activate",
                                    m_parentMenu->m_accel,
                                    accel_key,
                                    accel_mods,
                                    GTK_ACCEL_VISIBLE);
    }
}
コード例 #3
0
void IGameController::CycleMap()
{
	if(m_aMapWish[0] != 0)
	{
		char aBuf[256];
		str_format(aBuf, sizeof(aBuf), "rotating map to %s", m_aMapWish);
		GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
		str_copy(g_Config.m_SvMap, m_aMapWish, sizeof(g_Config.m_SvMap));
		m_aMapWish[0] = 0;
		m_RoundCount = 0;
		return;
	}
	if(!str_length(g_Config.m_SvMaprotation))
		return;

	if(m_RoundCount < g_Config.m_SvRoundsPerMap-1)
	{
		if(g_Config.m_SvRoundSwap)
			GameServer()->SwapTeams();
		return;
	}

	// handle maprotation
	const char *pMapRotation = g_Config.m_SvMaprotation;
	const char *pCurrentMap = g_Config.m_SvMap;

	int CurrentMapLen = str_length(pCurrentMap);
	const char *pNextMap = pMapRotation;
	while(*pNextMap)
	{
		int WordLen = 0;
		while(pNextMap[WordLen] && !IsSeparator(pNextMap[WordLen]))
			WordLen++;

		if(WordLen == CurrentMapLen && str_comp_num(pNextMap, pCurrentMap, CurrentMapLen) == 0)
		{
			// map found
			pNextMap += CurrentMapLen;
			while(*pNextMap && IsSeparator(*pNextMap))
				pNextMap++;

			break;
		}

		pNextMap++;
	}

	// restart rotation
	if(pNextMap[0] == 0)
		pNextMap = pMapRotation;

	// cut out the next map
	char aBuf[512];
	for(int i = 0; i < 512; i++)
	{
		aBuf[i] = pNextMap[i];
		if(IsSeparator(pNextMap[i]) || pNextMap[i] == 0)
		{
			aBuf[i] = 0;
			break;
		}
	}

	// skip spaces
	int i = 0;
	while(IsSeparator(aBuf[i]))
		i++;

	m_RoundCount = 0;

	char aBufMsg[256];
	str_format(aBufMsg, sizeof(aBufMsg), "rotating map to %s", &aBuf[i]);
	GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
	str_copy(g_Config.m_SvMap, &aBuf[i], sizeof(g_Config.m_SvMap));
}
コード例 #4
0
/* boolean addListToBuild(in short aCatType, [optional] in nsIArray items, [optional] in AString catName); */
NS_IMETHODIMP JumpListBuilder::AddListToBuild(PRInt16 aCatType, nsIArray *items, const nsAString &catName, bool *_retval)
{
  nsresult rv;

  *_retval = false;

  if (!mJumpListMgr)
    return NS_ERROR_NOT_AVAILABLE;

  switch(aCatType) {
    case nsIJumpListBuilder::JUMPLIST_CATEGORY_TASKS:
    {
      NS_ENSURE_ARG_POINTER(items);

      HRESULT hr;
      nsRefPtr<IObjectCollection> collection;
      hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC_SERVER,
                            IID_IObjectCollection, getter_AddRefs(collection));
      if (FAILED(hr))
        return NS_ERROR_UNEXPECTED;

      // Build the list
      PRUint32 length;
      items->GetLength(&length);
      for (PRUint32 i = 0; i < length; ++i) {
        nsCOMPtr<nsIJumpListItem> item = do_QueryElementAt(items, i);
        if (!item)
          continue;
        // Check for separators 
        if (IsSeparator(item)) {
          nsRefPtr<IShellLinkW> link;
          rv = JumpListSeparator::GetSeparator(link);
          if (NS_FAILED(rv))
            return rv;
          collection->AddObject(link);
          continue;
        }
        // These should all be ShellLinks
        nsRefPtr<IShellLinkW> link;
        rv = JumpListShortcut::GetShellLink(item, link, mIOThread);
        if (NS_FAILED(rv))
          return rv;
        collection->AddObject(link);
      }

      // We need IObjectArray to submit
      nsRefPtr<IObjectArray> pArray;
      hr = collection->QueryInterface(IID_IObjectArray, getter_AddRefs(pArray));
      if (FAILED(hr))
        return NS_ERROR_UNEXPECTED;

      // Add the tasks
      hr = mJumpListMgr->AddUserTasks(pArray);
      if (SUCCEEDED(hr))
        *_retval = true;
      return NS_OK;
    }
    break;
    case nsIJumpListBuilder::JUMPLIST_CATEGORY_RECENT:
    {
      if (SUCCEEDED(mJumpListMgr->AppendKnownCategory(KDC_RECENT)))
        *_retval = true;
      return NS_OK;
    }
    break;
    case nsIJumpListBuilder::JUMPLIST_CATEGORY_FREQUENT:
    {
      if (SUCCEEDED(mJumpListMgr->AppendKnownCategory(KDC_FREQUENT)))
        *_retval = true;
      return NS_OK;
    }
    break;
    case nsIJumpListBuilder::JUMPLIST_CATEGORY_CUSTOMLIST:
    {
      NS_ENSURE_ARG_POINTER(items);

      if (catName.IsEmpty())
        return NS_ERROR_INVALID_ARG;

      HRESULT hr;
      nsRefPtr<IObjectCollection> collection;
      hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC_SERVER,
                            IID_IObjectCollection, getter_AddRefs(collection));
      if (FAILED(hr))
        return NS_ERROR_UNEXPECTED;

      PRUint32 length;
      items->GetLength(&length);
      for (PRUint32 i = 0; i < length; ++i) {
        nsCOMPtr<nsIJumpListItem> item = do_QueryElementAt(items, i);
        if (!item)
          continue;
        PRInt16 type;
        if (NS_FAILED(item->GetType(&type)))
          continue;
        switch(type) {
          case nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR:
          {
            nsRefPtr<IShellLinkW> shellItem;
            rv = JumpListSeparator::GetSeparator(shellItem);
            if (NS_FAILED(rv))
              return rv;
            collection->AddObject(shellItem);
          }
          break;
          case nsIJumpListItem::JUMPLIST_ITEM_LINK:
          {
            nsRefPtr<IShellItem2> shellItem;
            rv = JumpListLink::GetShellItem(item, shellItem);
            if (NS_FAILED(rv))
              return rv;
            collection->AddObject(shellItem);
          }
          break;
          case nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT:
          {
            nsRefPtr<IShellLinkW> shellItem;
            rv = JumpListShortcut::GetShellLink(item, shellItem, mIOThread);
            if (NS_FAILED(rv))
              return rv;
            collection->AddObject(shellItem);
          }
          break;
        }
      }

      // We need IObjectArray to submit
      nsRefPtr<IObjectArray> pArray;
      hr = collection->QueryInterface(IID_IObjectArray, (LPVOID*)&pArray);
      if (FAILED(hr))
        return NS_ERROR_UNEXPECTED;

      // Add the tasks
      hr = mJumpListMgr->AppendCategory(catName.BeginReading(), pArray);
      if (SUCCEEDED(hr))
        *_retval = true;
      return NS_OK;
    }
    break;
  }
  return NS_OK;
}
コード例 #5
0
ファイル: menuitem.cpp プロジェクト: emutavchi/pxCore
bool wxMenuItem::OnMeasureItem(size_t *width, size_t *height)
{
    const MenuDrawData* data = MenuDrawData::Get();

    if ( IsOwnerDrawn() )
    {
        *width  = data->ItemMargin.GetTotalX();
        *height = data->ItemMargin.GetTotalY();

        if ( IsSeparator() )
        {
            *width  += data->SeparatorSize.cx
                     + data->SeparatorMargin.GetTotalX();
            *height += data->SeparatorSize.cy
                     + data->SeparatorMargin.GetTotalY();
            return true;
        }

        wxString str = GetName();

        wxMemoryDC dc;
        wxFont font;
        GetFontToUse(font);
        dc.SetFont(font);

        wxCoord w, h;
        dc.GetTextExtent(str, &w, &h);

        *width = data->TextBorder + w + data->AccelBorder;
        *height = h;

        w = m_parentMenu->GetMaxAccelWidth();
        if ( w > 0 )
            *width += w + data->ArrowBorder;

        *width += data->Offset;
        *width += data->ArrowMargin.GetTotalX() + data->ArrowSize.cx;
    }
    else // don't draw the text, just the bitmap (if any)
    {
        *width = 0;
        *height = 0;
    }

    // bitmap

    if ( IsOwnerDrawn() )
    {
        // width of menu icon with margins in ownerdrawn menu
        // if any bitmap is not set, the width of space reserved for icon
        // image is equal to the width of std check mark,
        // if bitmap is set, then the width is set to the width of the widest
        // bitmap in menu (GetMarginWidth()) unless std check mark is wider,
        // then it's is set to std mark's width
        int imgWidth = wxMax(GetMarginWidth(), data->CheckSize.cx)
                     + data->CheckMargin.GetTotalX();

        *width += imgWidth + data->CheckBgMargin.GetTotalX();
    }

    if ( m_bmpChecked.IsOk() || m_bmpUnchecked.IsOk() )
    {
        // get size of bitmap always return valid value (0 for invalid bitmap),
        // so we don't needed check if bitmap is valid ;)
        size_t heightBmp = wxMax(m_bmpChecked.GetHeight(), m_bmpUnchecked.GetHeight());
        size_t widthBmp = wxMax(m_bmpChecked.GetWidth(),  m_bmpUnchecked.GetWidth());

        if ( IsOwnerDrawn() )
        {
            heightBmp += data->CheckMargin.GetTotalY();
        }
        else
        {
            // we must allocate enough space for the bitmap
            *width += widthBmp;
        }

        // Is BMP height larger than text height?
        if ( *height < heightBmp )
            *height = heightBmp;
    }

    // make sure that this item is at least as tall as the system menu height
    const size_t menuHeight = data->CheckMargin.GetTotalY()
                            + data->CheckSize.cy;
    if (*height < menuHeight)
        *height = menuHeight;

    return true;
}
コード例 #6
0
ファイル: menuitem.cpp プロジェクト: emutavchi/pxCore
bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc,
                            wxODAction WXUNUSED(act), wxODStatus stat)
{
    const MenuDrawData* data = MenuDrawData::Get();

    wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
    HDC hdc = GetHdcOf(*impl);

    RECT rect;
    wxCopyRectToRECT(rc, rect);

    int imgWidth = wxMax(GetMarginWidth(), data->CheckSize.cx);

    if ( IsOwnerDrawn() )
    {
        // font and colors to use
        wxFont font;
        GetFontToUse(font);

        wxColour colText, colBack;
        GetColourToUse(stat, colText, colBack);

        // calculate metrics of item parts
        RECT rcSelection = rect;
        data->ItemMargin.ApplyTo(rcSelection);

        RECT rcSeparator = rcSelection;
        data->SeparatorMargin.ApplyTo(rcSeparator);

        RECT rcGutter = rcSelection;
        rcGutter.right = data->ItemMargin.cxLeftWidth
                       + data->CheckBgMargin.cxLeftWidth
                       + data->CheckMargin.cxLeftWidth
                       + imgWidth
                       + data->CheckMargin.cxRightWidth
                       + data->CheckBgMargin.cxRightWidth;

        RECT rcText = rcSelection;
        rcText.left = rcGutter.right + data->TextBorder;

        // we draw the text label vertically centered, but this results in it
        // being 1px too low compared to native menus for some reason, fix it
        if ( data->MenuLayout() != MenuDrawData::FullTheme )
            rcText.top--;

#if wxUSE_UXTHEME
        // If a custom background colour is explicitly specified, we should use
        // it instead of the default theme background.
        wxUxThemeEngine* const theme = GetBackgroundColour().IsOk()
                                        ? NULL
                                        : MenuDrawData::GetUxThemeEngine();
        if ( theme )
        {
            POPUPITEMSTATES state;
            if ( stat & wxODDisabled )
            {
                state = (stat & wxODSelected) ? MPI_DISABLEDHOT
                                              : MPI_DISABLED;
            }
            else if ( stat & wxODSelected )
            {
                state = MPI_HOT;
            }
            else
            {
                state = MPI_NORMAL;
            }

            wxUxThemeHandle hTheme(GetMenu()->GetWindow(), L"MENU");

            if ( theme->IsThemeBackgroundPartiallyTransparent(hTheme,
                    MENU_POPUPITEM, state) )
            {
                theme->DrawThemeBackground(hTheme, hdc,
                                           MENU_POPUPBACKGROUND,
                                           0, &rect, NULL);
            }

            theme->DrawThemeBackground(hTheme, hdc, MENU_POPUPGUTTER,
                                       0, &rcGutter, NULL);

            if ( IsSeparator() )
            {
                rcSeparator.left = rcGutter.right;
                theme->DrawThemeBackground(hTheme, hdc, MENU_POPUPSEPARATOR,
                                           0, &rcSeparator, NULL);
                return true;
            }

            theme->DrawThemeBackground(hTheme, hdc, MENU_POPUPITEM,
                                       state, &rcSelection, NULL);

        }
        else
#endif // wxUSE_UXTHEME
        {
            if ( IsSeparator() )
            {
                DrawEdge(hdc, &rcSeparator, EDGE_ETCHED, BF_TOP);
                return true;
            }

            AutoHBRUSH hbr(colBack.GetPixel());
            SelectInHDC selBrush(hdc, hbr);
            ::FillRect(hdc, &rcSelection, hbr);
        }


        // draw text label
        // using native API because it recognizes '&'

        HDCTextColChanger changeTextCol(hdc, colText.GetPixel());
        HDCBgColChanger changeBgCol(hdc, colBack.GetPixel());
        HDCBgModeChanger changeBgMode(hdc, TRANSPARENT);

        SelectInHDC selFont(hdc, GetHfontOf(font));


        // item text name without mnemonic for calculating size
        wxString text = GetName();

        SIZE textSize;
        ::GetTextExtentPoint32(hdc, text.c_str(), text.length(), &textSize);

        // item text name with mnemonic
        text = GetItemLabel().BeforeFirst('\t');

        int flags = DST_PREFIXTEXT;
        // themes menu is using specified color for disabled labels
        if ( data->MenuLayout() == MenuDrawData::Classic &&
             (stat & wxODDisabled) && !(stat & wxODSelected) )
            flags |= DSS_DISABLED;

        if ( (stat & wxODHidePrefix) && !data->AlwaysShowCues )
            flags |= DSS_HIDEPREFIX;

        int x = rcText.left;
        int y = rcText.top + (rcText.bottom - rcText.top - textSize.cy) / 2;

        ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(text),
                    text.length(), x, y, 0, 0, flags);

        // ::SetTextAlign(hdc, TA_RIGHT) doesn't work with DSS_DISABLED or DSS_MONO
        // as the last parameter in DrawState() (at least with Windows98). So we have
        // to take care of right alignment ourselves.
        wxString accel = GetItemLabel().AfterFirst(wxT('\t'));
        if ( !accel.empty() )
        {
            SIZE accelSize;
            ::GetTextExtentPoint32(hdc, accel.c_str(), accel.length(), &accelSize);

            flags = DST_TEXT;
            // themes menu is using specified color for disabled labels
            if ( data->MenuLayout() == MenuDrawData::Classic &&
                 (stat & wxODDisabled) && !(stat & wxODSelected) )
                flags |= DSS_DISABLED;

            x = rcText.right - data->ArrowMargin.GetTotalX()
                                 - data->ArrowSize.cx
                                 - data->ArrowBorder;

            // right align accel on FullTheme menu, left otherwise
            if ( data->MenuLayout() == MenuDrawData::FullTheme)
                x -= accelSize.cx;
            else
                x -= m_parentMenu->GetMaxAccelWidth();

            y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2;

            ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel),
                        accel.length(), x, y, 0, 0, flags);
        }
    }


    // draw the bitmap

    RECT rcImg;
    SetRect(&rcImg,
            rect.left   + data->ItemMargin.cxLeftWidth
                        + data->CheckBgMargin.cxLeftWidth
                        + data->CheckMargin.cxLeftWidth,
            rect.top    + data->ItemMargin.cyTopHeight
                        + data->CheckBgMargin.cyTopHeight
                        + data->CheckMargin.cyTopHeight,
            rect.left   + data->ItemMargin.cxLeftWidth
                        + data->CheckBgMargin.cxLeftWidth
                        + data->CheckMargin.cxLeftWidth
                        + imgWidth,
            rect.bottom - data->ItemMargin.cyBottomHeight
                        - data->CheckBgMargin.cyBottomHeight
                        - data->CheckMargin.cyBottomHeight);

    if ( IsCheckable() && !m_bmpChecked.IsOk() )
    {
        if ( stat & wxODChecked )
        {
            DrawStdCheckMark((WXHDC)hdc, &rcImg, stat);
        }
    }
    else
    {
        wxBitmap bmp;

        if ( stat & wxODDisabled )
        {
            bmp = GetDisabledBitmap();
        }

        if ( !bmp.IsOk() )
        {
            // for not checkable bitmaps we should always use unchecked one
            // because their checked bitmap is not set
            bmp = GetBitmap(!IsCheckable() || (stat & wxODChecked));

#if wxUSE_IMAGE
            if ( bmp.IsOk() && stat & wxODDisabled )
            {
                // we need to grey out the bitmap as we don't have any specific
                // disabled bitmap
                wxImage imgGrey = bmp.ConvertToImage().ConvertToGreyscale();
                if ( imgGrey.IsOk() )
                    bmp = wxBitmap(imgGrey);
            }
#endif // wxUSE_IMAGE
        }

        if ( bmp.IsOk() )
        {
            wxMemoryDC dcMem(&dc);
            dcMem.SelectObjectAsSource(bmp);

            // center bitmap
            int nBmpWidth  = bmp.GetWidth(),
                nBmpHeight = bmp.GetHeight();

            int x = rcImg.left + (imgWidth - nBmpWidth) / 2;
            int y = rcImg.top  + (rcImg.bottom - rcImg.top - nBmpHeight) / 2;
            dc.Blit(x, y, nBmpWidth, nBmpHeight, &dcMem, 0, 0, wxCOPY, true);
        }
    }

    return true;

}
コード例 #7
0
TCodParser::TCodAttr TCodParser::AttrName()
    {
    TCodAttr attr( ECodUnknownAttr );

    const TText* start = iCurP;
    while
        (
            iCurP < iEndP &&
            !IsControl() &&
            !IsSeparator() &&
            *iCurP != KCodCarriageRet &&
            *iCurP != KCodLineFeed
        )
        {
        iCurP++;
        }

    TPtrC token( start, iCurP - start );
    if ( !token.Length() )
        {
        Error( KErrCodInvalidDescriptor );
        }
    else if ( !token.Compare( KCodName ) )
        {
        attr = ECodName;
        }
    else if ( !token.Compare( KCodVendor ) )
        {
        attr = ECodVendor;
        }
    else if ( !token.Compare( KCodDescription ) )
        {
        attr = ECodDescription;
        }
    else if ( !token.Compare( KCodUrl ) )
        {
        attr = ECodUrl;
        }
    else if ( !token.Compare( KCodSize ) )
        {
        attr = ECodSize;
        }
    else if ( !token.Compare( KCodType ) )
        {
        attr = ECodType;
        }
    else if ( !token.Compare( KCodInstallNotify ) )
        {
        attr = ECodInstallNotify;
        }
    else if ( !token.Compare( KCodNextUrl ) )
        {
        attr = ECodNextUrl;
        }
    else if ( !token.Compare( KCodNextUrlAtError ) )
        {
        attr = ECodNextUrlAtError;
        }
    else if ( !token.Compare( KCodInfoUrl ) )
        {
        attr = ECodInfoUrl;
        }
    else if ( !token.Compare( KCodPrice ) )
        {
        attr = ECodPrice;
        }
    else if ( !token.Compare( KCodIcon ) )
        {
        attr = ECodIcon;
        }

    CLOG(( EParse, 4, _L("TCodParser::AttrName token<%S> attr(%d)"), \
        &token, attr ));
    return attr;
    }
コード例 #8
0
ファイル: NavigationItem.cpp プロジェクト: prestocore/browser
OP_STATUS NavigationItem::GetItemData(ItemData* item_data)
{
	item_data->column_query_data.column_image = GetImage();

	if (item_data->query_type == INIT_QUERY)
	{
		if (IsSeparator())
		{
			item_data->flags |= FLAG_SEPARATOR;
			item_data->flags |= FLAG_DISABLED | FLAG_INITIALLY_DISABLED;
		}
		else if (IsFolder() && IsAllBookmarks())
		{
			item_data->flags |= FLAG_INITIALLY_OPEN;
		}

		return OpStatus::OK;
	}

	if (item_data->query_type == MATCH_QUERY)
	{
		BOOL match = FALSE;

		if (item_data->match_query_data.match_type == MATCH_FOLDERS)
		{
			match = IsFolder();
		}
		if (match)
		{
			item_data->flags |= FLAG_MATCHED;
		}
		return OpStatus::OK;
	}

	if (item_data->query_type == INFO_QUERY)
	{
		GetInfoText(*item_data->info_query_data.info_text);
		return OpStatus::OK;
	}

	if (item_data->query_type != COLUMN_QUERY)
	{
		return OpStatus::OK;
	}

	if (IsFolder() )
	{
		if( IsDeletedFolder() )
		{
			int index = GetIndex();
			if( index != -1 && GetChildItem())
			{
				item_data->flags |= FLAG_BOLD;
			}
		}
	}

	if (item_data->column_query_data.column == 0 || item_data->column_query_data.column == 1)
	{
		item_data->column_query_data.column_text->Set(GetName());
	}

	return OpStatus::OK;
}
コード例 #9
0
ファイル: xbexp.cpp プロジェクト: utech/UtechLib
/*!
*/
xbShort xbExpn::GetNextToken( const char * s, xbShort MaxLen )
{
   /* TreeResultType Settings 
          Token        Action/
     Was   Type        Result
     Unv    N            N
     Unv    C            C
     Unv    Function     Table Lookup
     Unv    Field        Field Type
     Not L  Any Logical  L
   */

  xbShort Wctr, Wtype, Wsw, EmptyCtr, MaxCtr, MaxCtrSave;
  const char *sp, *np, *pp;   /* save, next and previous pointer */

  LogicalType = 0;
  TokenType   = 0;
  TokenLen    = 0;
  EmptyCtr    = 0;
  MaxCtr      = 0;

  if( !s || ! *s ) 
    return XB_NO_DATA;

  /* go past any initial white space */
  while( s && *s && IsWhiteSpace( *s )){
    s++;
    MaxCtr++;
    if (MaxCtr >= MaxLen)
    return XB_NO_ERROR;
  }

/* 1 - check for parens */
/* '(', if found go to corresponding ')', if no ')', return -1 */
  if( *s == '(' || *s == '{' ){
    if( *s == '{' ) Wtype = 0; else Wtype = 1;
    Wctr = 1;
    s++;

    MaxCtr++;
    if( MaxCtr >= MaxLen )
      return XB_PARSE_ERROR;

    while( s && *s ){
      if(( *s == ')' && Wtype == 1 ) || (*s == '}' && Wtype == 0 )){
        Wctr--;
        if( Wctr == 0 ){
          if( EmptyCtr != 0 ) {
            TokenType = 'E';
            PreviousType = 'E';
          } else
            return XB_PARSE_ERROR;

          TokenLen += 2;
          return XB_NO_ERROR;
        }
      }
      else if(( *s == '(' && Wtype == 1 ) || (*s == '{' && Wtype == 0 )){
        Wctr++;
        EmptyCtr++;
      } else if( *s != ' ' )
        EmptyCtr++;

      s++;
      TokenLen++;
      MaxCtr++; 
      if( MaxCtr >= MaxLen )
        return XB_PARSE_ERROR;
    }
    return XB_PARSE_ERROR;
  }


/* 2 - Check for Constants */
/* check for "'" or """, if no corresponding quote return -1 */
  if( *s == '"' || *s == '\'' ){
    if( *s == '"' ) Wtype = 0; else Wtype = 1;
    TokenType  = 'C';               /* set to constant  */
    PreviousType = 'C';
    s++;
    MaxCtr++;
    if( MaxCtr >= MaxLen )
      return XB_NO_ERROR;
    while( s && *s ){
      if(( *s == '"' && Wtype == 0 ) || (*s == '\'' && Wtype == 1 ))
        return XB_NO_ERROR;
      s++;
      TokenLen++;
      MaxCtr++;
      if( MaxCtr >= MaxLen )
        return XB_NO_ERROR;
    }
    return XB_PARSE_ERROR;
  }


/* 3 - check for .T. .F. .TRUE. or .FALSE.  */
  if( s && *s && *s == '.' ){
    if(( strncmp( s, ".T.", 3 ) == 0 ) || ( strncmp( s, ".F.", 3 ) == 0 )){
      TokenLen   = 3;
      TokenType  = 'C';      /* constant */
      PreviousType = 'C';
      LogicalType = 1;
      return XB_NO_ERROR;
    } else if( strncmp( s, ".TRUE.", 6 ) == 0 ){
      TokenLen   = 6;
      TokenType  = 'C';      /* constant */
      PreviousType = 'C';
      LogicalType = 1;
      return XB_NO_ERROR;
    } else if( strncmp( s, ".FALSE.", 7 ) == 0 ){
      TokenLen   = 7;
      TokenType  = 'C';      /* constant */
      PreviousType = 'C';
      LogicalType = 1;
      return XB_NO_ERROR;
    }
  }

/* 4 - check for positive, negative or decimal number constants */
  if(( *s == '-' && ( PreviousType == 'O' || PreviousType == 0 )) ||
     ( *s == '+' && ( PreviousType == 'O' || PreviousType == 0 )) ||
       *s == '.' || isdigit( *s )){
    sp = s;
    MaxCtrSave = MaxCtr;
    Wsw = Wctr = 0;
    if( *s == '.' ){
      Wctr++;
      s++;
      MaxCtr++;
      if( MaxCtr >= MaxLen )
        return XB_PARSE_ERROR;

      if( s && *s && isdigit( *s ))
        TokenLen++;
      else
        Wsw++;
    } else if( *s == '-' ){
      s++;
      TokenLen++;
      MaxCtr++;
      if( MaxCtr >= MaxLen )
        return XB_PARSE_ERROR;

      /* go past any white space between sign and number */
      while( s && *s && IsWhiteSpace( *s )){
        s++;
        TokenLen++;
        MaxCtr++;
        if( MaxCtr >= MaxLen )
          return XB_PARSE_ERROR;
      }
    }

    if( isdigit( *s ) || (*s == '.' && !Wsw )){
      while(s && *s && ((*s == '.' && Wctr < 2 ) || isdigit(*s)) && !Wsw ){
        if( *s == '.' ) {
          Wctr++; 
          if( Wctr > 1 ) break;
          s++;

          MaxCtr++;
          if( MaxCtr >= MaxLen ){
            TokenType = 'N';
            PreviousType = 'N';
            return XB_NO_ERROR;
          }

          if( s && *s && isdigit( *s ))
            TokenLen++;
          else
            Wsw++;
        } else {
          s++;
          TokenLen++;
          MaxCtr++;
          if( MaxCtr >= MaxLen ) {
            TokenType = 'N';
            PreviousType = 'N';
            return XB_NO_ERROR;
          }
        }
      }
      TokenType  = 'N';      /* constant */
      PreviousType = 'N'; 
      return XB_NO_ERROR;
    } else {
      s = sp;
      MaxCtr = MaxCtrSave;
    }
  }

/* 5 - Check for operators */
  if( *s == '+' || *s == '-' || *s == '/' || *s == '^'){
    TokenLen = 1;
    TokenType = 'O';
    PreviousType = 'O';
    return XB_NO_ERROR;
  }
  if(*s == '=' || *s == '$' || *s == '#' ){
    LogicalType = 1;
    TokenLen = 1;
    TokenType = 'O';
    PreviousType = 'O';
    return XB_NO_ERROR;
  }
  if( strncmp( s, "!=", 2 ) == 0 ){
    LogicalType = 1;
    TokenLen = 2;
    TokenType = 'O';
    PreviousType = 'O';
    return XB_NO_ERROR;
  }
  if( *s == '*' ){
    s++;
    MaxCtr++;
    if( MaxCtr >= MaxLen )
      return XB_PARSE_ERROR;

    TokenType = 'O';
    PreviousType = 'O';
    if( *s == '*' ){
      TokenLen = 2;
      return XB_NO_ERROR;
    } else {
      TokenLen = 1;
      return XB_NO_ERROR;
    }
  }
  if( *s == '<' || *s == '>' ) {
    s++;

    MaxCtr++;
    if( MaxCtr >= MaxLen )
      return XB_PARSE_ERROR;

    LogicalType = 1;  // added 3/25/00 dtb
    TokenType = 'O';
    PreviousType = 'O';
    if( *s == '<' || *s == '>' || *s == '=' ){
      TokenLen = 2;
      return XB_NO_ERROR;
    } else {
      TokenLen = 1;
      return XB_NO_ERROR;
    }
  } 

/* check for .NOT. .OR. .AND. */

  if( s && *s && *s == '.' ){
    if( strncmp( s, ".NOT.", 5 ) == 0 ){
      TokenLen   = 5;
      TokenType  = 'O';      /* constant */
      PreviousType = 'O';
      LogicalType = 1;
      return XB_NO_ERROR;
    } else if( strncmp( s, ".AND.", 5 ) == 0 ){
      TokenLen   = 5;
      TokenType  = 'O';      /* constant */
      PreviousType = 'O';
      LogicalType = 1;
      return XB_NO_ERROR;
    } else if( strncmp( s, ".OR.", 4 ) == 0 ){
      TokenLen   = 4;
      TokenType  = 'O';      /* constant */
      PreviousType = 'O';
      LogicalType = 1;
      return XB_NO_ERROR;
    }
  } 

  /* If get this far, must be function or database field */
  while( s && *s ){
    s++;
    TokenLen++;
    MaxCtr++;
    if( MaxCtr >= MaxLen ) {
      TokenType = 'D';
      PreviousType = 'D';
      return XB_NO_ERROR;
    }

    if( s && *s && *s == '(' ) {
      /* look for corresponding ) */
      Wctr = 1;
      s++;
      TokenLen++;
      MaxCtr++;
      if( MaxCtr >= MaxLen )
        return XB_PARSE_ERROR;
      
      while( s && *s ) {
        if( *s == ')' ) {
          Wctr--;
          if( !Wctr ) {
            TokenType = 'F';     /* function */
            PreviousType = 'F';
            TokenLen++;
            return XB_NO_ERROR;
          }
        }
        if( *s == '(' ) Wctr++;
        s++;
        TokenLen++;
        MaxCtr++;
        if( MaxCtr >= MaxLen )
          return XB_PARSE_ERROR;
      }
      return XB_PARSE_ERROR;
    } else {
      np = s + 1;
      pp = s - 1;
      if( !s || !*s || (IsSeparator( *s ) &&
         !(*s == '-' && *np == '>' ) && !(*s == '>' && *pp == '-' ))) {
        if( TokenLen > 0 ){
          TokenType = 'D';      /* database field */
          PreviousType = 'D';
          return XB_NO_ERROR;
        }
      }
    }
  }
  return XB_NO_ERROR;
}
コード例 #10
0
ファイル: gamecontroller.cpp プロジェクト: 949f45ac/atwmodr3
void IGameController::CycleMap()
{
	if(m_aMapWish[0] != 0)
	{
		dbg_msg("game", "rotating map to %s", m_aMapWish);
		str_copy(g_Config.m_SvMap, m_aMapWish, sizeof(g_Config.m_SvMap));
		m_aMapWish[0] = 0;
		m_RoundCount = 0;
		return;
	}
	if(!str_length(g_Config.m_SvMaprotation))
		return;

	if(m_RoundCount < g_Config.m_SvRoundsPerMap-1)
		return;
		
	// handle maprotation
	const char *pMapRotation = g_Config.m_SvMaprotation;
	const char *pCurrentMap = g_Config.m_SvMap;
	
	int CurrentMapLen = str_length(pCurrentMap);
	const char *pNextMap = pMapRotation;
	while(*pNextMap)
	{
		int WordLen = 0;
		while(pNextMap[WordLen] && !IsSeparator(pNextMap[WordLen]))
			WordLen++;
		
		if(WordLen == CurrentMapLen && str_comp_num(pNextMap, pCurrentMap, CurrentMapLen) == 0)
		{
			// map found
			pNextMap += CurrentMapLen;
			while(*pNextMap && IsSeparator(*pNextMap))
				pNextMap++;
				
			break;
		}
		
		pNextMap++;
	}
	
	// restart rotation
	if(pNextMap[0] == 0)
		pNextMap = pMapRotation;

	// cut out the next map	
	char Buf[512];
	for(int i = 0; i < 512; i++)
	{
		Buf[i] = pNextMap[i];
		if(IsSeparator(pNextMap[i]) || pNextMap[i] == 0)
		{
			Buf[i] = 0;
			break;
		}
	}
	
	// skip spaces
	int i = 0;
	while(IsSeparator(Buf[i]))
		i++;
	
	m_RoundCount = 0;
	
	dbg_msg("game", "rotating map to %s", &Buf[i]);
	str_copy(g_Config.m_SvMap, &Buf[i], sizeof(g_Config.m_SvMap));
}
コード例 #11
0
ファイル: menuitem.cpp プロジェクト: chromylei/third_party
void wxMenuItem::CreateItem (WXWidget menu, wxMenuBar * menuBar,
                             wxMenu * topMenu, size_t index)
{
    m_menuBar = menuBar;
    m_topMenu = topMenu;

    if (GetId() == -3)
    {
        // Id=-3 identifies a Title item.
        m_buttonWidget = (WXWidget) XtVaCreateManagedWidget
            (wxStripMenuCodes(m_text),
            xmLabelGadgetClass, (Widget) menu, NULL);
    }
    else if (!IsSeparator() && !m_subMenu)
    {
        wxString txt = m_text;

        if (m_text.IsEmpty())
        {
            wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
            txt = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
        }

        wxString strName = wxStripMenuCodes(txt);
        if (IsCheckable())
        {
            m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (strName,
                xmToggleButtonGadgetClass, (Widget) menu,
#ifdef XmNpositionIndex
                XmNpositionIndex, index,
#endif
                NULL);
            XtVaSetValues ((Widget) m_buttonWidget, XmNset, (Boolean) IsChecked(), NULL);
        }
        else
            m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (strName,
            xmPushButtonGadgetClass, (Widget) menu,
#ifdef XmNpositionIndex
            XmNpositionIndex, index,
#endif
            NULL);
        char mnem = wxFindMnemonic (m_text);
        if (mnem != 0)
            XtVaSetValues ((Widget) m_buttonWidget, XmNmnemonic, mnem, NULL);

        //// TODO: proper accelerator treatment. What does wxFindAccelerator
        //// look for?
        strName = m_text;
        char *accel = wxFindAccelerator (strName);
        if (accel)
            XtVaSetValues ((Widget) m_buttonWidget, XmNaccelerator, accel, NULL);

        // TODO: What does this do?
        XmString accel_str = wxFindAcceleratorText (strName);
        if (accel_str)
        {
            XtVaSetValues ((Widget) m_buttonWidget, XmNacceleratorText, accel_str, NULL);
            XmStringFree (accel_str);
        }

        if (IsCheckable())
            XtAddCallback ((Widget) m_buttonWidget,
            XmNvalueChangedCallback,
            (XtCallbackProc) wxMenuItemCallback,
            (XtPointer) this);
        else
            XtAddCallback ((Widget) m_buttonWidget,
            XmNactivateCallback,
            (XtCallbackProc) wxMenuItemCallback,
            (XtPointer) this);
        XtAddCallback ((Widget) m_buttonWidget,
            XmNarmCallback,
            (XtCallbackProc) wxMenuItemArmCallback,
            (XtPointer) this);
        XtAddCallback ((Widget) m_buttonWidget,
            XmNdisarmCallback,
            (XtCallbackProc) wxMenuItemDisarmCallback,
            (XtPointer) this);
    }
    else if (IsSeparator())
    {
        m_buttonWidget = (WXWidget) XtVaCreateManagedWidget ("separator",
            xmSeparatorGadgetClass, (Widget) menu,
#ifndef XmNpositionIndex
            XmNpositionIndex, index,
#endif
            NULL);
    }
    else if (m_subMenu)
    {
        m_buttonWidget = m_subMenu->CreateMenu (menuBar, menu, topMenu, index, m_text, true);
        m_subMenu->SetButtonWidget(m_buttonWidget);
        XtAddCallback ((Widget) m_buttonWidget,
            XmNcascadingCallback,
            (XtCallbackProc) wxMenuItemArmCallback,
            (XtPointer) this);
    }
    if (m_buttonWidget)
        XtSetSensitive ((Widget) m_buttonWidget, (Boolean) IsEnabled());
}
コード例 #12
0
ファイル: PythonSyntax.cpp プロジェクト: andreincx/upp-mirror
void PythonSyntax::Highlight(const wchar *start, const wchar *end, HighlightOutput& hls, CodeEditor *editor, int line, int pos)
{
	InitKeywords();
	
	bool isComment = false;
	bool isStr = false;
	char strOpening;
	
	const wchar* p = start;
	while(p < end) {
		if((*p == '#' || isComment) && !isStr) {
			isComment = true;
			hls.Put(hl_style[INK_COMMENT]);
		}
		else
		if(*p == '\'' || *p == '\"' || isStr) {
			hls.Put(hl_style[INK_CONST_STRING]);
			if((*p == '\'' || *p == '\"') && p - 1 != start && *(p - 1) != '\\')
				if (!isStr || strOpening == *p) {
					isStr = !isStr;
					strOpening = (char)*p;
				}
		}
		else
		if(IsSeparator(p) || p == start) {
			WString w;
			bool isW = false;
			const wchar* bp = (p == start && !IsSeparator(p)) ? p : p + 1;
			while (bp != end && !IsSeparator(bp))
				w += *bp++;
			
			bool isPutted = false;
			if(IsSeparator(p)) {
				hls.Put(hl_style[INK_NORMAL]);
				isPutted = true;
			}
			if(IsKeyword(w)) {
				hls.Put(w.GetLength(), hl_style[INK_KEYWORD]);
				isW = true;
			}
			else
			if(IsSpecialVar(w)) {
				hls.Put(w.GetLength(), hl_style[INK_UPP]);
				isW = true;
			}
			else
			if(IsNumber(w)) {
				hls.Put(w.GetLength(), hl_style[INK_CONST_INT]);
				isW = true;
			}
			
			if(isW) {
				p += w.GetLength() - (isPutted ? 0 : 1);
			}
		}
		else
			hls.Put(hl_style[INK_NORMAL]);
		
		p++;
	}
}
コード例 #13
0
ファイル: DrawGrid.cpp プロジェクト: dlsyaim/sm-eye-app
////////////////////////////////////////////////////////////////////
// Public functions
//
void CDrawGrid::Draw( int page, CDC* dc )
/* ============================================================
	Function :		CDrawGrid::Draw
	Description :	Draws this object.
	Access :		Public
					
	Return :		void
	Parameters :	int page	-	Current page
					CDC* dc		-	CDC to draw to

	Usage :			Called by the generator to draw the object.

   ============================================================*/
{

	/////////////////////////////////
	// Get and convert grid position
	//

	int drawpage = page - GetPageOffset();
	CDoubleRect rect = GetPosition();
	CUnitConversion::InchesToPixels( rect );

	CRect r( static_cast< int >( rect.left ), static_cast< int >( rect.top ), static_cast< int >( rect.right ), static_cast< int >( rect.bottom ) );
	CUnitConversion::AdjustPixelsToPaper( dc, r );

	/////////////////////////////////
	// Create column widths and 
	// fonts 
	//

	int restWidth = 0;
	int sumWidth = 0;
	TContainer< CFont* > fonts;

	double lpi = static_cast< double >( GetLPI() );
	double inch = static_cast< double >( dc->GetDeviceCaps( LOGPIXELSY ) );
	int lineHeight = static_cast< int >( inch / lpi + .5 );

	int max = m_columns.GetSize();
	for( int t = 0 ; t < max ; t++ )
	{

		CColumn* column = m_columns.GetAt( t );
		if( column )
		{
			sumWidth += CUnitConversion::InchesToPixels( column->GetWidth() );
			fonts.Add( column->GetColumnFont() );
		}

	}

	// restWidth will be used for 
	// any 0-length field
	restWidth = r.Width() - sumWidth;

	/////////////////////////////////
	// Find start and end of data
	// 

	int start = m_pages.GetAt( drawpage )->m_startLine;
	int end = m_pages.GetAt( drawpage )->m_endLine;

	int mode = dc->SetBkMode( TRANSPARENT );
	COLORREF color = dc->GetTextColor();

	/////////////////////////////////
	// Border
	//

	const CBorderLine* borderline = GetBorder();
	CPen pen;
	CPen boldPen;

	if( borderline->GetVisible() )
	{
		// Draw a border around the grid
		int thickness = CUnitConversion::InchesToPixels( borderline->GetThickness() );
		pen.CreatePen( borderline->GetStyle(),
					   thickness,
					   borderline->GetColor() );

		dc->SelectObject( &pen );
		dc->SelectStockObject( NULL_BRUSH );
		dc->Rectangle( r );
		dc->SelectStockObject( NULL_PEN );
	}


	/////////////////////////////////
	// Line pens
	//

	const CBorderLine* columnline = GetColumnLine();
	const CBorderLine* rowline = GetRowLine();
	CPen* columnpen = NULL;
	CPen* rowpen = NULL;
	if( columnline->GetVisible() )
	{
		columnpen = new CPen;
		int thickness = CUnitConversion::InchesToPixels( columnline->GetThickness() );
		columnpen->CreatePen( columnline->GetStyle(),
					   thickness,
					   columnline->GetColor() );
	}

	if( rowline->GetVisible() )
	{
		rowpen = new CPen;
		int thickness = CUnitConversion::InchesToPixels( rowline->GetThickness() );
		rowpen->CreatePen( rowline->GetStyle(),
					   thickness,
					   rowline->GetColor() );
	}


	/////////////////////////////////
	// Column lines
	//

	if( columnpen )
	{

		dc->SelectObject( columnpen );
		int left = r.left;

		// Loop columns
		for( int i = 0 ; i < max - 1; i++ )
		{

			CColumn* column = m_columns.GetAt( i );
			if( column )
			{

				int pixelWidth = CUnitConversion::InchesToPixels( column->GetWidth() );
				if( pixelWidth == 0 )
					pixelWidth = restWidth;

				left += pixelWidth;

				dc->MoveTo( left, r.top );
				dc->LineTo( left, r.bottom );

			}

		}

		dc->SelectStockObject( NULL_PEN );

	}

	/////////////////////////////////
	// Loop and print column strings
	//

	int top = r.top;
	for(int t = start ; t < end ; t++ )
	{
		// Tokenize a line of data
		CString line( m_data[ t ] );
		int quarterHeight = lineHeight / 4;

		// Check if this is a separator 
		if( IsSeparator( line ) )
		{
			// Draw a line across the grid
			dc->SelectStockObject( BLACK_PEN );
			dc->MoveTo( r.left, top + quarterHeight );
			dc->LineTo( r.right, top + quarterHeight );
		}
		else if( IsDoubleSeparator( line ) )
		{
			// Draw a double line across the grid
			dc->SelectStockObject( BLACK_PEN );
			dc->MoveTo( r.left, top + quarterHeight );
			dc->LineTo( r.right, top + quarterHeight );
			dc->MoveTo( r.left, top + quarterHeight * 2 );
			dc->LineTo( r.right, top + quarterHeight * 2 );
		}
		else if( IsBoldSeparator( line ) )
		{
			// Draw a bold line across the grid
			boldPen.CreatePen( PS_SOLID, quarterHeight / 2, RGB( 0, 0, 0 ) );
			dc->SelectObject( boldPen );
			dc->MoveTo( r.left, top + quarterHeight );
			dc->LineTo( r.right, top + quarterHeight );
			dc->SelectStockObject( BLACK_PEN );
		}
		else
		{
			CTokenizer tok( line, _T( "|" ) );

			int left = r.left;
			// Loop columns
			for( int i = 0 ; i < max ; i++ )
			{
				CColumn* column = m_columns.GetAt( i );
				CRect drawRect( left, top, r.right, top + lineHeight );
				if( column )
				{
					// Get the data for this column
					CString data;
					tok.GetAt( i, data );

					// Get the width of the column
					int pixelWidth = CUnitConversion::InchesToPixels( column->GetWidth() );
					if( pixelWidth == 0 )
						pixelWidth = restWidth;

					// Set font
					CFont* font = fonts.GetAt( i );
					CFont* specialFont = NULL;

					if( font )
					{
						if( IsBold( data ) )
						{

							// Select a bold font 
							// here instead

							specialFont = new CFont;
							LOGFONT lf;

							font->GetLogFont( &lf );

							lf.lfWeight = FW_BOLD;
							specialFont->CreateFontIndirect( &lf );

						}

						if( IsItalic( data ))
						{

							// Select an italic font 
							// here instead

							specialFont = new CFont;
							LOGFONT lf;

							font->GetLogFont( &lf );

							lf.lfItalic = TRUE;
							specialFont->CreateFontIndirect( &lf );

						}
					}

					if( specialFont )
						dc->SelectObject( specialFont );
					else if( font )
						dc->SelectObject( font );

					// Create draw rect
					drawRect.SetRect( left, top, left + pixelWidth, top + lineHeight );

					// Add offsets for columns
					int offset = CUnitConversion::PointsToPixels( column->GetFontSize() / 40.0 );
					if( borderline->GetVisible() && i == 0 )
						offset += max( 1, CUnitConversion::InchesToPixels( borderline->GetThickness() ) );
					if( columnline->GetVisible() && i > 0 )
						offset += max( 1, CUnitConversion::InchesToPixels( columnline->GetThickness() ) );

					drawRect.left += offset;
					drawRect.right -= offset;

					// Draw data
					int justification = column->GetJustification();
					dc->DrawText( data, drawRect, DT_VCENTER | DT_NOPREFIX | DT_WORDBREAK | justification );

					if( specialFont )
						delete specialFont;

					// Increase x-coord
					left += pixelWidth;
				}


				/////////////////////////////////
				// Row dividers
				//

				if( rowpen && t < end )
				{

					dc->SelectObject( rowpen );
					dc->MoveTo( r.left, drawRect.bottom );
					dc->LineTo( r.right, drawRect.bottom );

				}

			}
		}

		// Increase y-coord
		top += lineHeight;

	}

	/////////////////////////////////
	// Restore everything
	//

	dc->SetBkMode( mode );
	dc->SetTextColor( color );
	dc->SelectStockObject( ANSI_VAR_FONT );
	dc->SelectStockObject( NULL_PEN );

	if( columnpen )
		delete columnpen;

	if( rowpen )
		delete rowpen;
	
}