/** * \brief collapse/expand automatically the palette after a click on its tab */ void UBDockPalette::tabClicked() { if(mLastWidth == -1) { // The palette must be collapsed mLastWidth = width(); resize(border(), height()); } else { // The palette will be expanded resize(mLastWidth, height()); mLastWidth = -1; } }
void NetwalkWindow::setSkill( const int skill ) { int bw = 0; int bh = 0; if ( border() != NULL ) { bw = border()->widthLeft + border()->widthRight; bh = border()->heightBottom + border()->heightTop; } //beginUpdate(); if ( skill == 0 ) { pSizeX = 5; pSizeY = 5; pNumCli = 6; setWidth( (5 * 32) + 2 + bw ); setHeight( (5 * 32) + 2 + bh + 40 ); mapView.setWidth( (5 * 32) + 2 ); mapView.setHeight( mapView.width() ); return; } else if ( skill == 1 ) { pSizeX = 8; pSizeY = 8; pNumCli = 16; } else if ( skill == 2 ) { pSizeX = 10; pSizeY = 10; pNumCli = 22; } setWidth( (pSizeX * 32) + 2 + bw ); setHeight( (pSizeY * 32) + 2 + bh + 40 ); mapView.setWidth( (pSizeX * 32) + 2 ); mapView.setHeight( mapView.width() ); updated(); //endUpdate(); newGame(); }
double J(double *a) { double res = 0.0; for (int i = 0; i < POINTS_INNER; i++) { res += sqr(laplace(a, test_points[i][0], test_points[i][1]) \ - f(test_points[i][0], test_points[i][1], 0.0, 0.0, 0.0)); } for (int i = POINTS_INNER; i < POINTS_INNER + POINTS_BORDER; ++i) { res += DELTA * sqr(calc(a, test_points[i][0], test_points[i][1]) \ - border(test_points[i][0], test_points[i][1])); } return res; }
void cntr_print(struct cntr *cntr, enum action act) { struct cntr_ent *e; time_t now=time(NULL); border(); logc("Start time: %s\n", getdatestr(cntr->start)); logc(" End time: %s\n", getdatestr(now)); logc("Time taken: %s\n", time_taken(now-cntr->start)); if(act==ACTION_BACKUP || act==ACTION_BACKUP_TIMED) { logc("% 18s % 9s % 9s % 9s % 9s % 9s |% 9s\n", " ", "New", "Changed", "Unchanged", "Deleted", "Total", "Scanned"); } if(act==ACTION_RESTORE || act==ACTION_VERIFY) { logc("% 18s % 9s % 9s |% 9s\n", " ", "", "Attempted", "Expected"); } if(act==ACTION_ESTIMATE) { logc("% 18s % 9s % 9s %9s\n", " ", "", "", "Scanned"); } table_border(act); for(e=cntr->list; e; e=e->next) quint_print(e, act); table_border(act); bottom_part(cntr, act); border(); }
void drawscreen(int clear) { int i; if(clear){ geometry(screen->r); draw(screen, screen->r, bkgd, nil, ZP); } border(screen, rbig, -1, display->black, ZP); draw(screen, rbig, orig, nil, orig->r.min); border(screen, rramp, -1, display->black, ZP); draw(screen, rramp, ramp, nil, ramp->r.min); drawrampbar(red, &state); border(screen, rectaddpt(state.selr, subpt(rbig.min, orig->r.min)), -2, red, ZP); if(clear){ drawface(-1); for(i=0; i<nelem(face); i++) drawface(i); } }
void gambar(int lebar, int panjang, titik TITIK[lebar+1][panjang+1], char kode[3]){ int i, j; console = GetStdHandle(STD_OUTPUT_HANDLE); for(i = -1; i <= lebar + 1; i++){ if(i == -1 || i == lebar+1){ SetConsoleTextAttribute(console, 7); border(panjang); } else{ SetConsoleTextAttribute(console, 7); printf("|"); for(j = 0; j <= panjang; j++){ //memberi status kosong tiap titik kordinat if(strcmp(kode, "A") == 0){ SetConsoleTextAttribute(console, 9); } else if(strcmp(kode, "B") == 0){ SetConsoleTextAttribute(console, 10); } else if(strcmp(kode, "C") == 0){ SetConsoleTextAttribute(console, 11); } else if(strcmp(kode, "D") == 0){ SetConsoleTextAttribute(console, 12); } else if(strcmp(kode, "E") == 0){ SetConsoleTextAttribute(console, 13); } else if(strcmp(kode, "F") == 0){ SetConsoleTextAttribute(console, 14); } printf("%s", TITIK[i][j].isi); } SetConsoleTextAttribute(console, 7); printf("|\n"); } } }
void TupPenThicknessWidget::paintEvent(QPaintEvent *) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); painter.fillRect(0, 0, width(), height(), QColor(255, 255, 255)); QPen border(QColor(0, 0, 0)); // border.setWidth(0.5); border.setWidth(1); painter.setPen(border); painter.drawRect(0, 0, width(), height()); painter.translate(width() / 2, height() / 2); QBrush brush; Qt::BrushStyle style = Qt::BrushStyle(k->brush); if (style != Qt::TexturePattern) { if (k->brush != -1) { // tFatal() << "TupPenThicknessWidget::paintEvent() - Setting pre-def brush"; brush = QBrush(Qt::BrushStyle(k->brush)); brush.setColor(k->color); } else { if (k->currentBrush.gradient()) { // tFatal() << "TupPenThicknessWidget::paintEvent() - Setting gradient brush"; brush = k->currentBrush; } else { #ifdef K_DEBUG QString msg = "TupPenThicknessWidget::paintEvent() - Warning! NO gradient!"; #ifdef Q_OS_WIN32 qDebug() << msg; #else tError() << msg; #endif #endif return; } } QPen pen(Qt::NoPen); painter.setPen(pen); painter.setBrush(brush); painter.setOpacity(k->opacity); painter.drawEllipse(-(k->thickness/2), -(k->thickness/2), k->thickness, k->thickness); } else { QPixmap pixmap(THEME_DIR + "icons/brush_15.png"); painter.drawPixmap(-(pixmap.width()/2), -(pixmap.height()/2), pixmap); } }
void QRibbonComboBoxStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { if (element == PE_Frame) { QPainterPath painterpath; QRect border(0, 0, option->rect.width() - 1, option->rect.height() - 1); painterpath.addRoundedRect(border, 0, 0); painter->strokePath(painterpath, QPen(QColor("#5c5c5c"))); } else { QProxyStyle::drawPrimitive(element, option, painter, widget); } }
void printselfhelp() { init_pair(2,COLOR_MAGENTA,COLOR_BLACK); attron(COLOR_PAIR(2)); border(0,0,0,0, 0,0,0,0); refresh(); attroff(COLOR_PAIR(2)); refresh(); mvprintw(13,28,"SELECT SUBCATEGORY"); mvprintw(15,28,"1. Fine arts"); mvprintw(16,28,"2. Culinary skills"); mvprintw(17,28,"3. Languages"); mvprintw(18,28,"4. Communication skills"); mvprintw(19,28,"5. Encyclopaedias"); mvprintw(20,20,"Enter your choice"); refresh(); }
void Console::draw(Engine& engine) { int width = engine.getScreenWidth(); int height = engine.getScreenHeight() / 2; Square background(0, 0, width, height); engine.drawSquare(background, 0, 0, 0); Square border(0, height, width, 1); engine.drawSquare(border, 255, 255, 255); int currentCommandY = height - m_font->getHeight() - 1; ostringstream currentCommand; currentCommand << "]" << m_currentCommand << "_"; m_font->drawText(1, currentCommandY, currentCommand); }
void drawboard(void) { int i, j; border(screen, insetrect(rboard, -2), 2, display->black, ZP); draw(screen, Rect(rboard.min.x, rboard.min.y-2, rboard.max.x, rboard.min.y), display->white, nil, ZP); for(i=0; i<NY; i++) for(j=0; j<NX; j++) if(board[i][j]) drawsq(screen, Pt(rboard.min.x+j*pcsz, rboard.min.y+i*pcsz), board[i][j]-16); score(0); if (suspended) draw(screen, screen->r, display->white, whitemask, ZP); }
wxSize wxStdRenderer::GetStatusBarBorders() const { // Rendered border may be different depending on field's style, we use // the largest value so that any field certainly fits into the borders // we return: wxRect raised = GetBorderDimensions(wxBORDER_RAISED); wxRect flat = GetBorderDimensions(wxBORDER_STATIC); wxASSERT_MSG( raised.x == raised.width && raised.y == raised.height && flat.x == flat.width && flat.y == flat.height, _T("this code expects uniform borders, you must override GetStatusBarBorders") ); // take the larger of flat/raised values: wxSize border(wxMax(raised.x, flat.x), wxMax(raised.y, flat.y)); return border; }
void CText2D::Render(float _posX, float _posY) { __INT32 posX = __INT32 (_posX); __INT32 posY = __INT32 (_posY); for(int i = 0; i < strlen(m_strText); i++) { SCharMap* map = m_CharMap->GetMap(m_strText[i]); if(map != NULL) { SRect<__INT32> border(posX, posY, 30, 30); SRect<__INT32> texCoord(map->x, map->y, map->w, map->h); g->DrawImageRegion(border, texCoord, m_img); posX += 30; } } }
static void menuscrollpaint(Rectangle scrollr, int off, int nitem, int nitemdrawn) { Rectangle r; bitblt(&screen, scrollr.min, &screen, scrollr, 0); r.min.x = scrollr.min.x; r.max.x = scrollr.max.x; r.min.y = scrollr.min.y + (Dy(scrollr)*off)/nitem; r.max.y = scrollr.min.y + (Dy(scrollr)*(off+nitemdrawn))/nitem; if(r.max.y < r.min.y+2) r.max.y = r.min.y+2; border(&screen, r, 1, F, _bgpixel); if(darkgrey) texture(&screen, inset(r, 1), darkgrey, S); }
void SettingsListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { painter->save(); QStyleOptionViewItemV4 opt = option; initStyleOption( &opt, QModelIndex() ); qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter ); #if defined(Q_WS_MAC) || defined(Q_WS_WIN) // On mac draw our own selection rect as we don't get one from osx (around the whole icon or around just text) if ( opt.state & QStyle::State_Selected ) { painter->save(); painter->setRenderHint( QPainter::Antialiasing ); QPainterPath p; p.addRoundedRect( opt.rect.adjusted( 2, 1, -1, -1 ), 5, 5 ); QColor fill( 214, 214, 214 ); QColor border( 107, 107, 107 ); painter->setPen( border ); painter->drawPath( p ); painter->fillPath( p, fill ); painter->restore(); } #else if ( ( option.state & QStyle::State_Selected ) == QStyle::State_Selected ) { painter->setPen( option.palette.color( QPalette::HighlightedText ) ); } #endif int horizontalOffset = ( option.rect.width() - option.decorationSize.width() ) /2; QRect iconRect = option.rect.adjusted( horizontalOffset, 6, -horizontalOffset, -option.rect.height() + 6 + option.decorationSize.height() ); QPixmap avatar = index.data( Qt::DecorationRole ).value<QIcon>().pixmap( iconRect.size() ); painter->drawPixmap( iconRect, avatar ); QRect textRect = option.rect.adjusted( 6, iconRect.height() + 8, -6, 0 ); QString text = painter->fontMetrics().elidedText( index.data( Qt::DisplayRole ).toString(), Qt::ElideRight, textRect.width() ); QTextOption to( Qt::AlignHCenter ); painter->drawText( textRect, text, to); painter->restore(); }
void curson(int bl) { Image *col; if(!cursoron){ cursoff(); return; } draw(cursback, cursback->r, screen, nil, pt(x, y)); if(bl) col = red; else col = bordercol; border(screen, Rpt(pt(x, y), addpt(pt(x, y), Pt(CW,NS))), 2, col, ZP); }
void printfiction() { /*Prints subgenres of fiction*/ init_pair(2,COLOR_YELLOW,COLOR_BLACK); attron(COLOR_PAIR(2)); border(0,0,0,0, 0,0,0,0); refresh(); attroff(COLOR_PAIR(2)); refresh(); mvprintw(13,28,"SELECT SUBCATEGORY"); mvprintw(15,28,"1. Mystery"); mvprintw(16,28,"2. Drama"); mvprintw(17,28,"3. Young adult"); mvprintw(18,28,"4. Horror"); mvprintw(19,28,"5. Historic"); mvprintw(20,28,"6. Conspiracy theory"); mvprintw(21,20,"Enter your choice"); refresh(); }
int main(){ int r, c; while( scanf("%d%d", &r, &c) && r+c ){ /* 讀取地圖,並設定好邊界 */ int i; for(i = 1; i <= r; ++i) scanf("%s", map[i]+1); border(r, c); int x = r, y = 1, dir = 0; while(1){ /* 試著移動,如果不能就左轉再試試看 */ int nx, ny; while(1){ nx = x + dirs[dir][0]; ny = y + dirs[dir][1]; if(map[nx][ny] != '1') break; dir = (dir+1) % 4; } x = nx; y = ny; map[x][y]--; /* 累計走過的次數 */ /* 如果右邊不是牆壁,就向右轉 */ if(map[ x+dirs[(dir+3)%4][0] ][ y+dirs[(dir+3)%4][1] ] != '1') dir = (dir+3) % 4; /* 如果到終點就跳出 */ if(x == r && y == 1) break; } /* 統計五個數字答案 */ int ans[5] = {0}; for(x = 1; x <= r; x++){ for(y = 1; y <= c; y++){ for(i = 0; i <= 4; i++){ if(map[x][y] == '0'-i) ans[i]++; }}} for(r = 0; r < 5; ++r) printf("%3d", ans[r]); puts(""); } return 0; }
void printgen() { /*Prints genre menu*/ int y, x; clear(); init_pair(1, COLOR_CYAN, COLOR_BLACK); bkgd(COLOR_PAIR(1)); attron(A_BOLD); for(x = 44; x < 100; x++) { attron(COLOR_PAIR(1)); printw("*"); move(0, x); attroff(COLOR_PAIR(1)); } for(y = 0; y < 11; y++) { attron(COLOR_PAIR(1)); printw("*"); move(y, 44); attroff(COLOR_PAIR(1)); } for(x = 44; x < 100; x++) { attron(COLOR_PAIR(1)); printw("*"); move(11, x); attroff(COLOR_PAIR(1)); } for(y = 0; y < 11; y++) { attron(COLOR_PAIR(1)); printw("*"); move(y, 100); attroff(COLOR_PAIR(1)); } init_pair(2,COLOR_YELLOW,COLOR_BLACK); attron(COLOR_PAIR(2)); border(0,0,0,0, 0,0,0,0); refresh(); attroff(COLOR_PAIR(2)); refresh(); mvaddstr(2,60," ----- SELECT GENRES -----"); mvaddstr(4,48,"1. Fiction"); mvaddstr(5,48,"2. Non-fiction"); mvaddstr(6,48,"3. Reference"); mvaddstr(7,48,"4. Self-help"); mvaddstr(8,48,"5. Back to main menu"); mvaddstr(9,48,"Enter your choice:"); refresh(); }
unsigned char FunctionMenu(struct words_info *words) { unsigned int i, j; _refresh: clear(); border('|', '|', '-', '-', '+', '+', '+', '+'); _mvchgrectat(1, 1, getmaxy(stdscr) - 2, getmaxx(stdscr) - 2, 0, clr_obkg, NULL); attron(COLOR_PAIR(clr_ottl)); mvaddstr(1, (getmaxx(stdscr) - 16) / 2, "Words - 学习方式"); attroff(COLOR_PAIR(clr_ottl)); i = (getmaxy(stdscr) - 6) / 4; j = (getmaxx(stdscr) - 12 ) / 2; attron(COLOR_PAIR(clr_oopt) | A_BOLD); mvaddstr(2 + (getmaxy(stdscr) - 6 - 2 * i) / 2, j, "[↑]记默模式"); mvaddstr(getcury(stdscr) + 1 + i, (getmaxx(stdscr) - 24) / 3, "[←]认知模式"); mvaddstr(getcury(stdscr), ((getmaxx(stdscr) - 24) / 3) * 2 + 12, "[→]检测模式"); mvaddstr(getcury(stdscr) + 1 + i, j, "[↓]进入设置"); attroff(COLOR_PAIR(clr_oopt)); i = (getmaxx(stdscr) - 36) / 4; attron(COLOR_PAIR(clr_otip)); mvaddstr(getcury(stdscr), j - i - 12, "[输入]单词表"); mvaddstr(getcury(stdscr), j + i + 12, "[返回]返回"); attroff(COLOR_PAIR(clr_otip) | A_BOLD); refresh(); _getkey: switch (getch()) { case KEY_UP: return 2; case KEY_DOWN: return 4; case KEY_LEFT: return 1; case KEY_RIGHT: return 3; case '\n': return 5; case 033: return 0; case KEY_RESIZE: goto _refresh; default: goto _getkey; } return 0; }
void drawbrick(Click c) { Rectangle r; r = tilerect(c); draw(img, r, tileset, nil, level.board[c.d][c.x][c.y].start); if(level.board[c.d][c.x][c.y].clicked) draw(img, r, selected, nil, ZP); if(eqcl(level.l, c)) border(img, r, 2, litbrdr, level.board[c.d][c.x][c.y].start); /* looks better without borders, uncomment to check it out with'em */ // r = Rpt(r.min, addpt(r.min, Pt(Tilex, Tiley))); // draw(img, r, brdr, nil, ZP); }
Flu_Combo_Box::Popup :: Popup( Flu_Combo_Box *b, Fl_Widget *c, int H ) : Fl_Double_Window( global_x(b)-2, //Fl::x()+b->window()->x()+b->x()-2, global_y(b)+b->h()-2, //Fl::y()+b->window()->y()+b->y()+b->h()-2, b->w()+4, H, 0 ) { combo = b; dragging = false; selected = NULL; box( FL_BORDER_FRAME ); border( 0 ); add( c ); end(); //set_non_modal(); set_modal(); c->resize( 1, 1, w()-2, h()-2 ); }
int kmp(const char * pattern, const char * text, int * output){ size_t m = strlen(pattern), n = strlen(text); int * pattern_border = calloc(m, sizeof(int)); border(pattern, pattern_border); int i = 0, k = 0; for (int j = 0; j < n; ++j) { while (i > 0 && pattern[i] != text[j]) i = pattern_border[i - 1]; if (pattern[i] == text[j]) i++; if (i >= m) { output[k++] = j - i + 1; i = pattern_border[i - 1]; } } free(pattern_border); return k; }
static void menuscrollpaint(Image *m, Rectangle scrollr, int off, int nitem, int nitemdrawn) { Rectangle r; draw(m, scrollr, back, nil, ZP); r.min.x = scrollr.min.x; r.max.x = scrollr.max.x; r.min.y = scrollr.min.y + (Dy(scrollr)*off)/nitem; r.max.y = scrollr.min.y + (Dy(scrollr)*(off+nitemdrawn))/nitem; if(r.max.y < r.min.y+2) r.max.y = r.min.y+2; border(m, r, 1, bord, ZP); if(menutxt == 0) menutxt = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, DDarkgreen); /* border color; BUG? */ if(menutxt) draw(m, insetrect(r, 1), menutxt, nil, ZP); }
unsigned char DisInfo(struct words_info *words) { char *path, *size, *wrdf, *wrdl; int i, len = 0, key; _resize: path = _cut(1, getmaxx(stdscr) - 14, words->fpath); size = _husize(words->size); for (i = 0; i < 6; i++) len += _intlength(words->num[i]); len += 7; wrdf = _cut(2, getmaxx(stdscr) - 14, words->p->mean); wrdl = _cut(2, getmaxx(stdscr) - 14, words->p->prev->mean); len = _max(strlen(path), _max(strlen(size), _max(len, _max(strlen(wrdf), strlen(wrdl))))) + 12; clear(); border('|', '|', '-', '-', '+', '+', '+', '+'); _mvchgrectat(1, 1, getmaxy(stdscr) - 2, getmaxx(stdscr) - 2, 0, clr_ibkg, NULL); i = (getmaxy(stdscr) - 8) / 2 + 1; attron(COLOR_PAIR(clr_ides)); mvaddstr(i++, 1, "单词表文件: "); mvaddstr(i++, 1, "文件大小: "); mvaddstr(i++, 1, "单词个数: "); mvaddstr(i++, 1, "第一个单词: "); mvprintw(i++, 1, "最后一个: "); attroff(COLOR_PAIR(clr_ides)); attron(COLOR_PAIR(clr_con) | A_BOLD); mvaddstr(i++, 1, "按回车键继续,返回键返回..."); attroff(COLOR_PAIR(clr_con) | A_BOLD); i = (getmaxy(stdscr) - 8) / 2 + 1; attron(COLOR_PAIR(clr_igvn)); mvaddstr(i++, 13, path); mvaddstr(i++, 13, size); mvprintw(i++, 13, "%d (%d/%d/%d/%d/%d)", words->num[0], words->num[1], words->num[2], words->num[3], words->num[4], words->num[5]); mvaddstr(i++, 13, wrdf); mvaddstr(i++, 13, wrdl); attroff(COLOR_PAIR(clr_igvn)); refresh(); while (key = getch(), key != '\n' && key != 033) goto _resize; free(path); free(size); free(wrdf); free(wrdl); return key != 033; }
void displaydata() { char *c; cleardevice(); hidemouseptr(); cleardevice(); border(); setcolor(GREEN); settextstyle(10,HORIZ_DIR,3); outtextxy(70,20,"LIST OF ACCOUNTS IN BANK"); setcolor(LIGHTGRAY); line(8,95,getmaxx()-8,95); line(8,100,getmaxx()-8,100); settextstyle(1,HORIZ_DIR,1); outtextxy(15,120,"Acc.No."); outtextxy(150,120,"Name"); outtextxy(300,120,"Address"); outtextxy(500,120,"Balance"); }
void QProg::paintBorder() { QPainter painter(this); painter.setWindow(0, 0, 470, 80); painter.setRenderHint(QPainter::Antialiasing); QLinearGradient linGrad(5, 40, 15, 40); linGrad.setColorAt(0, Qt::white); linGrad.setColorAt(1, Qt::black); linGrad.setSpread(QGradient::PadSpread); painter.setBrush(linGrad); QRectF border(5, 5, 460, 70); painter.drawRoundRect(border, 3); // value rect painter.setBrush(QColor(70, 70, 70)); QRectF value(385, 10, 75, 60); painter.drawRoundRect(value, 15); }
int main(int argc, char* argv[]) { line* l; int nl, ind; parse_cl(argc, argv); print_title(); base_triangles(); nl = border(sfile->trg, sfile->hdr->nfacets, &l); printf("Facets %d\n", sfile->hdr->nfacets); printf("Border segments %d\n", nl); for(int i=0; i<nl; i++) print_line(&l[i]); print_circle(); }
// Handler for repaint tool-tip window void CTTComboBox::HandleOnPaint() { CPaintDC dc(&m_tipWnd); CRect rc; m_tipWnd.GetClientRect(&rc); CBrush brush(GetSysColor(COLOR_INFOBK)); dc.FillRect(&rc, &brush); CBrush border(RGB(0,0,0)); dc.FrameRect(&rc, &border); CString strText; m_tipWnd.GetWindowText(strText); dc.SetBkMode(TRANSPARENT); CFont* pOldFont = dc.SelectObject(&m_font); dc.DrawText(strText, &rc, DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX); dc.SelectObject(pOldFont); }
void NewMenu::subBorders() { // x coordinate of the left side of all the sub borders const int LEFTX = windowWidth - 480; border(LEFTX, windowWidth, windowHeight, windowHeight - 150); if (startConfirm) { border(LEFTX, windowWidth, windowHeight - 150, windowHeight - 480); border(LEFTX, windowWidth, windowHeight - 480, windowHeight - 750); border(LEFTX, windowWidth, windowHeight - 750, -windowHeight); } else { border(LEFTX, windowWidth, windowHeight - 150, windowHeight - 530); border(LEFTX, windowWidth, windowHeight - 530, -windowHeight); } }