void Life::layout() { dxy=cfg.cell_dxy+cfg.space_dxy; Point size=getSize(); FontSize font_size=cfg.font->getSize(); Coord dy=font_size.dy+2*cfg.outer_dxy; status=Pane(cfg.outer_dxy,0,size.x-cfg.outer_dxy,dy); arena=Pane(cfg.outer_dxy,dy,cfg.cx*dxy+cfg.space_dxy,cfg.cy*dxy+cfg.space_dxy); }
void EditRatioWindow::layout() { Coord s=+cfg.shade_dxy; Point size=getSize().subXY(s); pane=Pane(Null,size.x,size.y); shade1=Pane(s,size.y,size.x,s); shade2=Pane(size.x,s,s,size.y-s); base=size/2; text=Pane(0,base.y+size.y/12,size.x,size.y/3); }
void PointEditWindow::layout() { Point s=spin_x.getMinSize(); Coord space_dxy=+cfg.space_dxy; spin_x.setPlace(Pane(Null,s)); spin_y.setPlace(Pane(Point(s.x+space_dxy,0),s)); Coord dx=s.x+space_dxy/2; pos=Point(dx,s.y+dx); }
virtual void layout() { Point size=getSize(); Coord dx=Div(4,21)*size.x; Coord dy=Div(4,21)*size.y; Coord x0=dx/4; Coord y0=dy/4; Coord delta_x=dx+x0; Coord delta_y=dy+y0; if( dx>0 && dy>0 ) { for(int i=0; i<4 ;i++) for(int j=0; j<4 ;j++) { pane[i][j]=Pane(x0+i*delta_x,y0+j*delta_y,dx,dy); } } else { for(int i=0; i<4 ;i++) for(int j=0; j<4 ;j++) { pane[i][j]=Empty; } } }
void DrawLab::zoom_based(MPoint base,Coord delta) { if( !delta ) return; Pane clip=Pane(Null,normal.getSize()); ulen len=dots.getLen(); Ratio zoom=Zoom(delta); DynArray<Smooth::Dot> new_dots(len); for(ulen i=0; i<len ;i++) { Smooth::Dot dot=dots[i]; dot.point=Zoom(dot.point,base,zoom); if( !clip.contains(dot.point.toPoint()) ) return; new_dots[i]=dot; } Swap(dots,new_dots); redraw(); }
virtual void layout(Point size_) { size=size_; field=Pane(size.x/4,size.y/4,size.x/2,size.y/2); for(ulen i=0,len=dots.getLen(); i<len ;i++) dots_based[i]=dots[i]-field.getBase(); }
void DragFrameShape::draw_Frame(const DrawBuf &buf,Pane part) const { VColor frame=+cfg.frame; VColor small=+cfg.dragSmall; VColor frameSmall = has_good_size? frame : small ; drawFrame(buf,Pane(Null,size),client,frame,frameSmall,part); }
void CoordEditWindow::layout() { Point size=getSize(); spin.setPlace(Pane(Null,size.x,size.y/2)); pos.x=size.x/2; pos.y=Div(3,4)*size.y; }
void Life::draw(DrawBuf buf,bool) const { try { CommonDrawArt art(buf); art.erase(cfg.outer); // status { char temp[TextBufLen]; PrintBuf out(Range(temp)); Printf(out,"Step #; per second #; div = #;",map.getStepNumber(),speed,divider.getDiv()); cfg.font->text(buf,status,TextPlace(AlignX_Left,AlignY_Center),out.close(),cfg.text); } // arena { art.block(arena,cfg.back); PaneBorder border(arena.expand(1)); art.path(cfg.border_up,border.bottomLeft(),border.topLeft(),border.topRight()); art.path(cfg.border_down,border.bottomLeft(),border.bottomRight(),border.topRight()); } // cells { Coord dxy=this->dxy; const bool *src=map.getPtr(); Coord cx=cfg.cx; Coord cy=cfg.cy; Pos pos=map.getPos(); Coord x0=arena.x+cfg.space_dxy; Coord y0=arena.y+cfg.space_dxy; for(Coord x=0; x<cx ; x++) for(Coord y=0; y<cy ; y++) { if( src[pos(x,y)] ) { art.block(Pane(x0+x*dxy,y0+y*dxy,cfg.cell_dxy,cfg.cell_dxy),cfg.cell); } } } } catch(CatchType) { } }
Pane TextContourShape::getInner() const { TextSize ts=cfg.font.get()->text(Range(title)); Coord dxy=RoundUpLen(+cfg.width); if( 2*dxy>=pane.dx || ts.dy+dxy>=pane.dy ) return Empty; return Pane(pane.x+dxy,pane.y+ts.dy,pane.dx-2*dxy,pane.dy-ts.dy-dxy); }
Pane MessageWindow::getPane(StrLen title) const { Point size=getMinSize(title,sub_win.getMinSize()); Point s=desktop->getScreenSize(); size=Inf(size,s-s/4); return Pane((s.x-size.x)/2,+cfg.pos_ratio*(s.y-size.y),size); }
void ToolFrame::react_other(UserAction action) { if( action.fromKeyboard() ) { getClient().react(action); } else { Point point=action.getPoint(); if( client_capture || Pane(Null,size).contains(point) ) { getClient().forward_react(action); } } }
//--------------------------------------------------------- void CSAGA_Frame::_Bar_Show(wxWindow *pWindow, bool bShow) { wxAuiPaneInfo Pane(m_pLayout->GetPane(pWindow)); if( Pane.IsOk() && Pane.IsShown() != bShow ) { Pane.Show(bShow); if( bShow && Pane.IsToolbar() && Pane.IsDocked() ) { Pane.Position(pWindow == m_pTB_Main ? 0 : 1); } m_pLayout->GetPane(pWindow) = Pane; m_pLayout->Update(); } }
void ToolFrame::redrawAll(bool do_layout) { if( do_layout ) { if( client ) client->setPlace(Pane(Null,size)); } redraw_set.pop(); redrawBuf( [this] (FrameBuf<DesktopColor> &buf) { getClient().forward_draw(buf,false); shade(buf); host->invalidate(1); } ); }
void ToolFrame::react_Move(Point point,MouseKey mkey) { if( Pane(Null,size).contains(point) ) { client_enter=true; getClient().forward().put_Move(point,mkey); } else { if( client_capture ) getClient().forward().put_Move(point,mkey); if( client_enter ) { client_enter=false; getClient().put_Leave(); } } }
void PANEFAILI::PaneX(const LYLI_TMPL<S_TYYP, C_TYYP>& lyli, const MRF_FLAGS& mrfFlags) { S_TYYP str; if((lyli.lipp & PRMS_SARV) == PRMS_SARV) str.Format(EritiSobiViit(C_TYYP, "<%d/>\n"), lyli.ptr.arv); else if ((lyli.lipp & PRMS_STRKLASS) == PRMS_STRKLASS) str = *lyli.ptr.pStr + EritiSobiViit(C_TYYP, "\n"); else if ((lyli.lipp & PRMS_STRID) == PRMS_STRID) //str.Format(EritiSobiViit(C_TYYP, "%s <%d/>\n"), // (const C_TYYP *)lyli.ptr.strid->str, lyli.ptr.strid->id); str.Format(EritiSobiViit(C_TYYP, "%s\n"), (const C_TYYP *)lyli.ptr.strid->str); else if ((lyli.lipp & PRMS_MRF) == PRMS_MRF) lyli.ptr.pMrfAnal->Strct2Strng(&str, &mrfFlags); else throw VEAD(ERR_X_TYKK, ERR_MINGIJAMA, __FILE__, __LINE__, "Ei oska sellist LYLI tekstina faili kirjutada"); Pane(str); }
void MessageSubWindow::layout() { Point size=getSize(); Coord space_dxy=+cfg.space_dxy; if( ulen count=btn_count ) { Point btnSpace=+cfg.btnSpace; Point s; for(ulen ind=0; ind<count ;ind++) s=Sup(s,btn_list[ind]->getMinSize()); s+=btnSpace; Coord delta=s.y+2*space_dxy; showInfo.setPlace(Pane(0,0,size.x,size.y-delta).shrink(space_dxy)); dline.setPlace(Pane(0,size.y-delta-space_dxy,size.x,2*space_dxy)); Coord total=Coord(count)*s.x+Coord(count-1)*space_dxy; Point o((size.x-total)/2,size.y-s.y-space_dxy); Coord delta_x=s.x+space_dxy; for(ulen ind=0; ind<count ;ind++) { btn_list[ind]->setPlace(Pane(o,s)); o.x+=delta_x; } } else { Coord knob_dxy=+cfg.knob_dxy; Coord delta=knob_dxy+2*space_dxy; showInfo.setPlace(Pane(0,0,size.x,size.y-delta).shrink(space_dxy)); dline.setPlace(Pane(0,size.y-delta-space_dxy,size.x,2*space_dxy)); knobOk.setPlace(Pane((size.x-knob_dxy)/2,size.y-knob_dxy-space_dxy,knob_dxy)); } }
void TextContourShape::draw(const DrawBuf &buf) const { MPane p(pane); if( !p ) return; Smooth::DrawArt art(buf); Font font=cfg.font.get(); TextSize ts=font->text(Range(title)); Coord ty=Min(ts.dy,pane.dy); Coord tx=Min<Coord>(ty,pane.dx/2); Coord len=pane.dx-2*tx; Coord free; if( ts.overflow ) free=0; else free=(len>ts.full_dx)?len-ts.full_dx:0; MCoord width=+cfg.width; MCoord x0=p.x; MCoord x1=p.ex; MCoord y0=p.y+Fraction(ty)/2; MCoord y1=p.ey; MCoord t0; MCoord t1; switch( align_x ) { case AlignX_Left : { MCoord d=Fraction(tx)/2; t0=d; t1=p.dx-d-Fraction(free); } break; case AlignX_Right : { MCoord d=Fraction(tx)/2; t0=d+Fraction(free); t1=p.dx-d; } break; default: { MCoord d=Fraction(tx)/2+Fraction(free)/2; t0=d; t1=p.dx-d; } } t0+=p.x; t1+=p.x; // border VColor top=+cfg.top; FigureTopBorder fig_top(x0,x1,y0,y1,width); fig_top.getLeftCut(t0).solid(art,top); fig_top.getRightCut(t1).solid(art,top); FigureBottomBorder fig_bottom(x0,x1,y0,y1,width); fig_bottom.solid(art,+cfg.bottom); // title font->text(buf,Pane(pane.x+tx,pane.y,len,ty),TextPlace(align_x,AlignY_Center),Range(title),+cfg.text); }
void DragFrameShape::draw_Frame(const DrawBuf &buf) const { draw_Frame(buf,Pane(Null,size)); }
void ManagerGui::addSubwindow(const sf::Vector2f &size, const sf::Vector2f &position, const sf::Color &color, float thickness, const sf::Color &thicknessColor, int number){ pane = Pane(size, position, color, thickness, thicknessColor, number); windowList.push_back(&pane); }
void DragFrameShape::layout(Point size_) { size=size_; Coord dxy=+cfg.frame_dxy; Coord tdy=+cfg.title_dy; Coord bdx=+cfg.btn_dx; Coord bdy=+cfg.btn_dy; Coord btn_len = is_main? 6*bdx+bdx/8 : 4*bdx ; if( size>=Point( 2*dxy+btn_len+bdx/2+Max(tdy,dxy) , dxy+Max(tdy,dxy) ) ) { Pane pane=Pane(Null,size); Pane left=SplitX(dxy,pane); Pane right=SplitX(pane,dxy); dragTopLeft=SplitY(dxy,left); dragBottomLeft=SplitY(left,dxy); dragLeft=left; dragTopRight=SplitY(dxy,right); dragBottomRight=SplitY(right,dxy); dragRight=right; dragBar=SplitY(tdy,pane); dragBottom=SplitY(pane,dxy); client=pane; Coord yb=(tdy-bdy)/2; Coord tx=dragBar.dx-btn_len; if( is_main ) { Coord xb0=dragBar.x+tx; Coord xb1=xb0+bdx+bdx/8; Coord xb2=xb1+bdx+bdx/8; Coord xb3=xb2+bdx+bdx/8; Coord xb4=xb3+bdx+bdx/2; btnAlert=Pane(xb0,yb,bdx,bdy); btnHelp=Pane(xb1,yb,bdx,bdy); btnMin=Pane(xb2,yb,bdx,bdy); btnMax=Pane(xb3,yb,bdx,bdy); btnClose=Pane(xb4,yb,bdx,bdy); } else { Coord xb0=dragBar.x+tx; Coord xb1=xb0+bdx+bdx/8; Coord xb2=xb1+bdx+bdx/2; btnAlert=Empty; btnMin=Empty; btnHelp=Pane(xb0,yb,bdx,bdy); btnMax=Pane(xb1,yb,bdx,bdy); btnClose=Pane(xb2,yb,bdx,bdy); } Coord w=RoundUpLen(+cfg.width); titleBar=Pane(dragBar.x+bdx/4,w,tx-bdx/2,tdy-2*w); } else { dragTopLeft=Empty; dragBottomLeft=Empty; dragLeft=Empty; dragTopRight=Empty; dragBottomRight=Pane(Null,size); dragRight=Empty; dragBar=Empty; dragBottom=Empty; client=Empty; btnAlert=Empty; btnHelp=Empty; btnMin=Empty; btnMax=Empty; btnClose=Empty; titleBar=Empty; } }