예제 #1
0
wxWindow* BFTaskDlg::CreateBookPageA (wxWindow* pParent)
{
    wxPanel* pPanel = new wxPanel(pParent, wxID_ANY);

    // type
    wxStaticText* pTypeStatic = new wxStaticText(pPanel, -1, _("type:"));
    pTypeCtrl_ = new wxBitmapComboBox(pPanel,
                                      BFTASKDGL_ID_CBTYPE,
                                      wxEmptyString,
                                      wxDefaultPosition,
                                      wxDefaultSize,
                                      0,
                                      NULL,
                                      wxCB_READONLY);
    pHelpCtrl_->Connect(pTypeStatic, pTypeCtrl_, _("This is the type of the backup task."));

    // name
    wxPanel*        pNamePanel      = new wxPanel(pPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
                    pNameCtrl_      = new wxTextCtrl(pNamePanel, -1);
    wxButton*       pPlaceholderButton    = new BFPlaceholderButton(pNamePanel, *pNameCtrl_);
    wxStaticText*   pNameStatic     = new wxStaticText(pPanel, -1, _("destination name:"));
    pNameStatic ->SetMinSize(wxSize(BFTaskDlg::lWidth1_, pNameStatic->GetSize().GetHeight()));
    pNamePanel  ->SetMinSize(wxSize(BFTaskDlg::lWidth2_, pNamePanel->GetSize().GetHeight()+3));
    wxBoxSizer* pNameSubSizer   = new wxBoxSizer(wxHORIZONTAL);
    pNameSubSizer->Add(pNameCtrl_,          wxSizerFlags(1).Align(wxALIGN_CENTER_VERTICAL));
    pNameSubSizer->Add(pPlaceholderButton,  wxSizerFlags(0).Align(wxALIGN_CENTER_VERTICAL));
    pNamePanel->SetSizer(pNameSubSizer);
    pHelpCtrl_->Connect(pNameStatic, pNameCtrl_, _("The name of the Task. It is the same as the destination."));

    // source
    pSourceCtrl_ = new wxTextCtrl(pPanel, -1);
    wxStaticText* pSourceStatic   = new wxStaticText(pPanel, -1, _("source:"));
    pSourceCtrl_->Disable();
    SetRowSize(pSourceStatic, pSourceCtrl_);
    pHelpCtrl_->Connect(pSourceCtrl_, pSourceStatic, _("This is the directory or file that should be backuped."));

    // destination
    wxStaticText* pDestStatic = new wxStaticText(pPanel, -1, _("destination path:"));
    pDestCtrl_ = new BFDestinationCtrl(pPanel, wxEmptyString, false);
    pDestCtrl_->ConnectHelpText(pHelpCtrl_, _("This is the path where the backup is stored."));

    // sizer and arrange
    wxBoxSizer* pSizer = new wxBoxSizer(wxHORIZONTAL);
    wxGridSizer* pBodySizer     = new wxFlexGridSizer(2);
    pBodySizer->SetVGap(5);
    pBodySizer->Add(pTypeStatic,    wxSizerFlags(0).Align(wxALIGN_CENTER_VERTICAL));
    pBodySizer->Add(pTypeCtrl_,     wxSizerFlags(0).Expand());
    pBodySizer->Add(pNameStatic,    wxSizerFlags(0).Align(wxALIGN_CENTER_VERTICAL));
    pBodySizer->Add(pNamePanel);
    pBodySizer->Add(pSourceStatic,  wxSizerFlags(0).Align(wxALIGN_CENTER_VERTICAL));
    pBodySizer->Add(pSourceCtrl_);
    pBodySizer->Add(pDestStatic,    wxSizerFlags(0).Align(wxALIGN_CENTER_VERTICAL));
    pBodySizer->Add(pDestCtrl_);
    pSizer->Add(pBodySizer, wxSizerFlags(0).Border());
    pPanel->SetSizer(pSizer);

    return pPanel;
}
예제 #2
0
void XDomTable::LayeroutCells(DRAWCONTEXT*pDraw,CELLDATA*pData)
{
	//if(!pData->bReturn)
	//pDraw->PADDING=1;
    //pDraw->SPACING=1;
	LAYEROUTDATA margin; 
	CELLDATA data;
	data.Reset(pData->cur.x,pData->cur.y,XTRUE);

	

	PreLayerout(pDraw,&data,&margin);
	//XU8 bCollapse=pDraw->bCollapse;
	pDraw->bCollapse=FindAttrib(XEAB::BORDER_COLLAPSE,0);
	data.pData=XNULL;

	XU8 bInline=IsFingerInline();
	XRect rt=pDraw->win;
	InitMargin(pDraw,&data,&margin,m_nPosX,m_nPosY,m_nWidth,m_nHeight,XTRUE);
	if(m_nWidth>0&&m_nWidth==pDraw->win.Width()&&m_bFinal)
	{
		//bSet=XTRUE;
		data.max.cx=m_nWidth;
		data.max.cy=m_nHeight;
		data.nMin=m_nMin;
	}
	else
	{
		//m_nWin=pDraw->win.Width();
		
		LayeroutTable(pDraw,data);
		
		m_rows.DataFrom(data.rowws);
		m_nMin=data.nMin;
	}
	XSize size(m_nWidth,m_nHeight);
	SetMargin(&margin,m_nWidth,m_nHeight,size);
	//SetMargin(&margin,m_nWidth,m_nHeight,size);
	pDraw->win=rt;
//	XU8 bInline=IsFingerInline();
	if(!bInline)
		m_bReturn=NewRowIfMust(pDraw,pData,m_nWidth);
	SetRowSize(pDraw,pData,size,data.nMin,XTRUE);
	if(!bInline) 
		NewRow(0,pDraw,pData,pDraw->IND);
	//pDraw->bCollapse=
	EndLayerout(pDraw,pData);
	//pDraw->win=rect;
}
예제 #3
0
 XU32 XHTMLBody::Handle(XU32 nOpera, XU32 pData1, XU32 pData2)
 {
	XU32 i;
 	switch(nOpera)
 	{
 	//case XDO_SET_START:
 	//	 return StartEvent((DRAWCONTEXT*)pData1);
	/*case XDO_LAYEROUT_CELLS:
		{
			CELLDATA*p=(CELLDATA*)pData2;
			DRAWCONTEXT*pd=(DRAWCONTEXT*)pData1;
			XU32 ss=PreLayerout(pd,p);
 			XDomCard::Handle(nOpera,pData1,pData2);
 			EndLayerout(pd,p);
		}return 1;*/
 	case XDO_LAYEROUT_CELL:
 		{
			  CELLDATA data;
			  LAYEROUTDATA margin;
			  //data.Reset(pData->cur.x,pData->cur.y,XTRUE);
			  CELLDATA*pData=&data;//(CELLDATA*)pData2;
			  DRAWCONTEXT*pDraw=(DRAWCONTEXT*)pData1;
			  pDraw->Init();
			  pData->Reset(pDraw->win.left,pDraw->win.top,XTRUE);

			  PreLayerout(pDraw,pData,&margin);
			  if(m_nWidth>0) 
			  {
				  if(margin.nMargin[BORDERDATA::LEFT]>0&&
					 margin.nMargin[BORDERDATA::LEFT]+m_nWidth>pDraw->view.Width())
				  {
					  margin.nMargin[BORDERDATA::LEFT]=XMAX(
						  (pDraw->view.Width()-m_nWidth)>>1,0);
				  }
				  if(m_nWidth>pDraw->win.Width())
					pDraw->win.right=pDraw->win.left+m_nWidth;
			  }
			  
			  
			  //pData->Init();
			  InitMargin(pDraw,pData,&margin,m_nPosX,m_nPosY,m_nWidth,m_nHeight);
			  XPoint pt=pData->cur;
			  for(i=0;i<m_childs.GetSize();i++)
				m_childs[i]->LayeroutItem(pDraw,pData,XTRUE);//Handle(XDO_LAYEROUT_CELLS,(XU32)pDraw,(XU32)&data);
			  pData->Reset(pt.x,pt.y,XFALSE);
			  NewRow(0,pDraw,pData,pDraw->IND);
			  pData->bEmpty=XTRUE;
			  for(i=0;i<m_childs.GetSize();i++)
				m_childs[i]->LayeroutItem(pDraw,pData,XFALSE);//Handle(XDO_LAYEROUT_CELL,(XU32)pDraw,(XU32)&data);
			  //data.max.cx-=pData->cur.x;
			  //data.max.cy-=pData->cur.y;
			  m_nWidth=pData->max.cx-pt.x;
			  m_nHeight=pData->max.cy-pt.y;
			  if(m_nWidth<pDraw->view.Width())
				  m_nWidth=pDraw->view.Width();
			  if(m_nHeight<pDraw->view.Height())
				  m_nHeight=pDraw->view.Height();
			  XSize size(m_nWidth,m_nHeight);
			  SetMargin(&margin,m_nWidth,m_nHeight,size);
			  //m_nWidth=data.max.cx-pData->cur.x;
	          pData=(CELLDATA*)pData2;
			  SetRowSize(pDraw,pData,size,m_nWidth,XFALSE);
			  NewRow(0,pDraw,pData,pDraw->IND);

			/*CELLDATA*p=(CELLDATA*)pData2;
			DRAWCONTEXT*pd=(DRAWCONTEXT*)pData1;
			LAYEROUTDATA margin;
			XU32 ss=PreLayerout(pd,p,margin);
//			StartMargin(pd,p,XTRUE);
			//BeginMargin(pd,p);
			m_nPosX=p->cur.x;
			m_nPosY=p->cur.y;
 			XDomCard::Handle(nOpera,pData1,pData2);
 			EndLayerout(pd,p);
 			m_nWidth=XMAX(p->max.cx-m_nPosX,pd->view.Width()-(m_nPosX<<1)-1);
 			m_nHeight=XMAX(p->max.cy-m_nPosY,pd->view.Height()-(m_nPosY<<1)-1);*/
 		}return 1;
 	case XDO_PAINT:
 		{
 			XRect rect(m_nPosX,m_nPosY,m_nPosX+m_nWidth,m_nPosY+m_nHeight);
 			PaintBack((DRAWCONTEXT*)pData1,rect);
			XU32 s=XDomCard::Handle(nOpera,pData1,pData2);
			PaintBorder((DRAWCONTEXT*)pData1,rect);
			return s;
 		};
	case XDO_EVENT_ONTIMER:
		{
			XRect rect(0,0,m_nWidth,m_nHeight);
			return OnTimer((XEVENTDATA*)pData1,rect)|
				   XDomCard::Handle(nOpera,pData1,pData2);
		}break;
 /*	case XDO_SET_ATTR:
 	case XDO_ADD_ATTR:
 		 SetBodyAttrib((XVar*)pData1);
 		 break;	*/
 		 //return XTRUE;
 	}
예제 #4
0
void XDomTable::LayeroutCell(DRAWCONTEXT*pDraw,CELLDATA*pData)
{

   if(m_nWidth<=0) return;

   int aw=pDraw->ALIGNW;
   pDraw->ALIGNW=XEA::LEFT;
   LAYEROUTDATA margin;
   CELLDATA data;
   data.Reset(pData->cur.x,pData->cur.y,XTRUE);
   PreLayerout(pDraw,&data,&margin);
   data.pData=XNULL;
   pDraw->bCollapse=FindAttrib(XEAB::BORDER_COLLAPSE,0);
   //if(!pData->bReturn)
   //if(m_bReturn)
   XU8 bInline=IsFingerInline();


   //if(pDraw->SETWIDTH==-92)
   //   int a=0;

   if(!bInline)//&&m_bReturn)
   {
	  AlignRow(pDraw,pData);
	  NewRowMust(pDraw,pData,m_bReturn);
   }
   //else 
	  

   m_nPosX=pData->cur.x;//+margin.nMargin[BORDERDATA::LEFT];
   m_nPosY=pData->cur.y;//+margin.nMargin[BORDERDATA::TOP];

   int bd=FindAttrib(XEAB::BORDER,0);
   int cs=pDraw->PADDING;//XMAX(FindAttrib(XEAB::CELLPADDING,1),0);
   int cp=pDraw->SPACING;//XMAX(FindAttrib(XEAB::CELLSPACING,1),0);
   /*int bdx=margin.nMargin[BORDERDATA::LEFT]+
	       margin.nPadding[BORDERDATA::LEFT]+
		   margin.nBorderWidth[BORDERDATA::LEFT];
   int bdy=margin.nMargin[BORDERDATA::RIGHT]+
	       margin.nPadding[BORDERDATA::RIGHT]+
		   margin.nBorderWidth[BORDERDATA::RIGHT];*/
   
   XU8 bCollapse=FindAttrib(XEAB::BORDER_COLLAPSE,0);
   if(bCollapse)
	 bd+=2;
   //XU8 nType=FindAttrib(XEAB::FRAME,XEnumFrame::BOX);
   //if(nType==XEF::VOID_X) bd=0;
   
   //
   XRect rt=pDraw->win;
   //if(bd>0)
   {
	pDraw->win.left=m_nPosX+bd;
	pDraw->win.right=m_nPosX+m_nWidth-(bd+cs);
   }
   //else pDraw->win.right--;

   //if(m_bFinal&&m_nWidth==pDraw->win.Width())
   data.rowws.DataFrom(m_rows);

   data.Reset(pData->cur.x+bd,pData->cur.y+bd,XFALSE);
   //if(margin.nBorderWidth[0]&&m_nPosX==3)
   	 //  int a=0;
   
   InitMargin(pDraw,&data,&margin,m_nPosX,m_nPosY,m_nWidth,m_nHeight,XTRUE);
   m_nPosX-=bd;
   m_nPosY-=bd;

   HandleChild(XDO_LAYEROUT_TAB,(XU32)pDraw,(XU32)&data);
   XSize size(m_nWidth,m_nHeight);
   SetMargin(&margin,m_nWidth,m_nHeight,size);
   m_rows.DataFrom(data.rowws);

  // pDraw->PADDING=nPad;
  // pDraw->SPACING=nSpa;
   pDraw->win=rt; 
  // pData->alignw=aw;
   //data.max.cx-=pData->cur.x;
   //data.max.cy-=pData->cur.y;
   EndLayerout(pDraw,pData);
   pDraw->ALIGNW=aw;
   SetRowSize(pDraw,pData,size,data.nMin,XFALSE);
   NewRow(0,pDraw,pData,pDraw->IND);
   
   //pDraw->win=rect;
}
void GLIDebugVariableGrid::SetItemValue(int rowIndex, GLenum glType, unsigned int floatCount, const float *floatData)
{
  wxString setText;

  //Determine if the color block is rendered
  bool renderColor = false;
  if(floatCount == 3 ||
     floatCount == 4)
  {
    renderColor = true;
  }

  //Determine if it is a matrix type
  bool isMatrix = false;
  uint numMatrixElemPerRow = 1;
  if(glType == GL_FLOAT_MAT2 || 
     glType == GL_FLOAT_MAT3 ||
     glType == GL_FLOAT_MAT4 ||
     glType == GL_FLOAT_MAT2x3 ||
     glType == GL_FLOAT_MAT2x4 ||
     glType == GL_FLOAT_MAT3x2 ||
     glType == GL_FLOAT_MAT3x4 ||
     glType == GL_FLOAT_MAT4x2 ||
     glType == GL_FLOAT_MAT4x3)
  {
    isMatrix = true;
    renderColor = false;

    //Get the number of matrix rows
    switch(glType)
    {
      case(GL_FLOAT_MAT2):
      case(GL_FLOAT_MAT2x3):
      case(GL_FLOAT_MAT2x4):
        numMatrixElemPerRow = 2;
        break;
      case(GL_FLOAT_MAT3):
      case(GL_FLOAT_MAT3x2):
      case(GL_FLOAT_MAT3x4):
        numMatrixElemPerRow = 3;
        break;
      case(GL_FLOAT_MAT4):
      case(GL_FLOAT_MAT4x2):
      case(GL_FLOAT_MAT4x3):
        numMatrixElemPerRow = 4;
        break;
    };

    switch(glType)
    {
      case(GL_FLOAT_MAT2):
      case(GL_FLOAT_MAT3x2):
      case(GL_FLOAT_MAT4x2):
        SetRowSize(rowIndex, GetRowSize(rowIndex) * 2);
        break;
      case(GL_FLOAT_MAT3):
      case(GL_FLOAT_MAT2x3):
      case(GL_FLOAT_MAT4x3):

        SetRowSize(rowIndex, GetRowSize(rowIndex) * 3);
        break;
      case(GL_FLOAT_MAT4):
      case(GL_FLOAT_MAT2x4):
      case(GL_FLOAT_MAT3x4):
        SetRowSize(rowIndex, GetRowSize(rowIndex) * 4);
        break;
    };
  }

  //Add an opening brace
  if(floatCount > 1)
  {
    setText += "("; 
  }

  //Copy the data
  for(unsigned int i=0; i<floatCount; i++)
  {
    wxString newStr;
    newStr.Printf(wxT("%g"), floatData[i]); // TODO: Transpose
    
    //Ensure there is a trailing .0
    if(newStr.Find('.') < 0 &&
       newStr.Find('e') < 0)
    {
      newStr += ".0";
    }

    //Append to the string
    setText += newStr;

    //Add a comma if necessary
    if(i != floatCount-1)
    {
      setText += ", "; 
    }

    //If this is the end of a matrix row, add a newline
    if(isMatrix && 
       (i != floatCount-1) && 
       ((i+1) % numMatrixElemPerRow == 0))
    {
      setText += "\n ";
    }
  }

  //Add a closing brace
  if(floatCount > 1)
  {
    setText += ")"; 
  }


  //If rendering a color
  if(renderColor)
  {
    //Assign a color box render to the value
    wxColor assignColour = wxColor(FloatClamp(floatData[0]), 
                                   FloatClamp(floatData[1]),
                                   FloatClamp(floatData[2]));

    SetCellRenderer(rowIndex, VALUE_COLUMN_INDEX, new ColourGridCellRenderer(assignColour));
  }

  //Assign the data to the row
  SetCellValue(rowIndex, VALUE_COLUMN_INDEX, setText);
}