void CWhiteInfoBox::Draw(RECT client_rect, LOGFONT logfont, CDC *pDC, CPen *black_pen, CBrush *white_brush) { CPen *pTempPen = NULL, oldpen; CBrush *pTempBrush = NULL, oldbrush; RECT rect = {0}; CFont *oldfont = NULL, cFont; int left = 0, top = 0, right = 0, bottom = 0; bool sym_playing = p_table_state->User()->HasKnownCards(); // "White box" in the OpenHoldem-GUI with basic important info const int k_basic_height = 2; // pixels const int k_extra_height_per_line = 16; // pixels const int k_number_of_default_lines = 4; // hand-number, game-type, ante, pot int height = k_basic_height + k_extra_height_per_line * k_number_of_default_lines; if (kMaxLogSymbolsForWhiteBox > 0) { // Extra lines for symbol-logging height += k_extra_height_per_line * kMaxLogSymbolsForWhiteBox; } // Figure placement of box left = client_rect.right/2-70; top = 0; right = client_rect.right/2+70; bottom = top+height; pTempPen = (CPen*)pDC->SelectObject(&black_pen); oldpen.FromHandle((HPEN)pTempPen); // Save old pen pTempBrush = (CBrush*)pDC->SelectObject(&white_brush); oldbrush.FromHandle((HBRUSH)pTempBrush); // Save old brush pDC->SetBkMode(OPAQUE); pDC->Rectangle(left, top, right, bottom); // Set font basics logfont.lfHeight = -12; logfont.lfWeight = FW_NORMAL; cFont.CreateFontIndirect(&logfont); oldfont = pDC->SelectObject(&cFont); pDC->SetTextColor(COLOR_BLACK); // Set rectangle rect.left = left; rect.top = top; rect.right = right; rect.bottom = bottom; CString info_txt = InfoText(); // Draw it pDC->SetBkMode(TRANSPARENT); pDC->DrawText(info_txt.GetString(), info_txt.GetLength(), &rect, NULL); // Restore original pen, brush and font pDC->SelectObject(oldpen); pDC->SelectObject(oldbrush); pDC->SelectObject(oldfont); cFont.DeleteObject(); }
int SaveIndexToDisk( struct ClassData * data, struct GroupFolder ** grp ) { BPTR fd; ULONG idxid = IDX_ID; struct YGRDBIndex * idx; unsigned char len; /* THIS FUNCTION CALLER *MUST* LOCK THE SEMAPHORE !(?).. */ InfoText("Saving index for group \"%s\" to disk, please wait...", (*grp)->YahooGroup ); if(!(fd = Open((*grp)->index, MODE_NEWFILE ))) goto done; WriteCheck( &idxid, sizeof(ULONG)); DBG_VALUE((*grp)->New); for( idx = (*grp)->idx ; idx ; idx = idx->next ) { len = 160; // chunk separator WriteCheck( &len, sizeof(unsigned char)); WriteCheck( &(idx->msgnum), sizeof(ULONG)); DBG_STRING(idx->from); len = (unsigned char) strlen(idx->from); WriteCheck( &len, sizeof(unsigned char)); WriteCheck( idx->from, len ); DBG_STRING(idx->subj); len = (unsigned char) strlen(idx->subj); WriteCheck( &len, sizeof(unsigned char)); WriteCheck( idx->subj, len ); DBG_STRING(idx->date); len = (unsigned char) strlen(idx->date); WriteCheck( &len, sizeof(unsigned char)); WriteCheck( idx->date, len ); (*grp)->New--; } len = 159; // EOF bit mark WriteCheck( &len, sizeof(unsigned char)); #ifdef DEBUG if(((long)((*grp)->New)) < 0) { DBG(" \a +++++++++++++++ (*grp)->New < 0 !!!!! (%ld)\n", (long) (*grp)->New); (*grp)->New = 0; } #endif Close( fd ); done: if((data->LastError = IoErr()) == 0) data->LastError = ERR_NOERROR; return data->LastError; }