Exemplo n.º 1
0
int wxMainToolBar::InsertType(int pos)
{
	wxStaticText* tool_text = new wxStaticText(this, wxNewId(), _("Type"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT6"));
   m_typeChoice = new wxChoice(this, ID_TYPE_CHOICE, wxDefaultPosition, wxSize(70,-1), 0, 0, 0, wxDefaultValidator, _T("Frame Type"));
   m_typeChoice->Append(_("LIGHT"));
   m_typeChoice->Append(_("DARK"));
   m_typeChoice->Append(_("BIAS"));
   m_typeChoice->Append(_("FLAT"));

   wxString imgtyp;
   wxF()->getFitsHeaderValue(wxT("IMAGETYP"),imgtyp);
   if(wxNOT_FOUND == m_typeChoice->FindString(imgtyp)) {
      // illegal value, set to LIGHT
      imgtyp = _("LIGHT");
      wxF()->saveFitsHeaderValue(wxT("IMAGETYP"),imgtyp);
   }

   m_typeChoice->SetStringSelection(imgtyp);

   int ipos = pos;

   // Separator, leading text + binning choice box
   InsertSeparator(ipos++);
   InsertControl(ipos++,tool_text);
   InsertControl(ipos++,m_typeChoice);
   SetToolShortHelp(ID_TYPE_CHOICE,_("Frame type"));
   Realize();

   return (ipos-pos);
}
Exemplo n.º 2
0
void CWBProcess::_DrawEllipse(PtPos& pt1, PtPos& pt2, UINT nLin, ColorDef& color, bool bFull)
{
    CtrlAttr *lpAttr;

    lpAttr = new CtrlAttr();
    if (lpAttr)
    {
        if (bFull)
            lpAttr->ctName = WB_CRF;
        else
            lpAttr->ctName = WB_CRE;

        lpAttr->ctColor.SetAttr(color.cdRed, color.cdGreen, color.cdBlue);
        lpAttr->ctLine = nLin;
        lpAttr->ctPos.SetAttr(pt1.X, pt1.Y, pt2.X, pt2.Y);
        if (InsertControl(lpAttr) && m_pIWBNotify)
        {
            m_pIWBNotify->OnWhiteBoardMessage(WBN_ADDELEMENT, lpAttr);
        }
    }

    if (GetInterfacePtr())
        GetInterfacePtr()->CtlDrawEllipse(pt1, pt2, nLin, color, bFull, DC_AUTOSCROLL|DC_REPAINT);

    m_bChanged = true;
}
Exemplo n.º 3
0
void CWBProcess::_DrawText(WB_PSTR szText, PtPos& pt1, PtPos& pt2, FontDef& font, ColorDef& color)
{
    CtrlAttr *lpAttr;

    if (szText && !comp_branco(szText))
    {
        lpAttr = new CtrlAttr ();
        if (lpAttr)
        {
            lpAttr->ctName = WB_TXT;
            lpAttr->ctColor.SetAttr(color.cdRed, color.cdGreen, color.cdBlue);
            lpAttr->ctFont.SetAttr(font.fdName, font.fdSize, font.fdEffect);
            lpAttr->ctText.CopyTxt(szText, (int)strlen(szText));
            lpAttr->ctPos.SetAttr(pt1.X, pt1.Y, pt2.X, pt2.Y);
            if (InsertControl(lpAttr) && m_pIWBNotify)
            {
                m_pIWBNotify->OnWhiteBoardMessage(WBN_ADDELEMENT, lpAttr);
            }
        }
    }

    if (GetInterfacePtr())
        GetInterfacePtr()->CtlDrawTxt(szText, pt1, pt2, font, color, DC_AUTOSCROLL|DC_REPAINT);

    m_bChanged = true;
}
Exemplo n.º 4
0
CWnd* CToolBarEx::InsertControl(CRuntimeClass* pClass, PCTSTR lpszWindowName, RECT& rect, UINT nID, DWORD dwStyle)
{
	CWnd* pCtrl = 0;	
	if (pClass->IsDerivedFrom(RUNTIME_CLASS(CComboBox)))		// CODCombo control.
	{
		pCtrl = new CODCombo();
		ASSERT_VALID(pCtrl);
		if (!((CODCombo*)pCtrl)->Create(WS_CHILD | WS_VISIBLE | dwStyle, rect, this, nID))
		{			
			delete pCtrl;
			return 0;
		}
	}
	else if( pClass->IsDerivedFrom(RUNTIME_CLASS(CEdit)))		// CEdit control.
	{
		pCtrl = new CEdit();
		ASSERT_VALID(pCtrl);
		if (!((CEdit*)pCtrl)->Create(WS_CHILD | WS_VISIBLE | dwStyle, rect, this, nID))
		{
			delete pCtrl;
			return 0;
		}
	}
	else if (pClass->IsDerivedFrom(RUNTIME_CLASS(CButton)))		// CButton control.
	{
		pCtrl = new CButton();
		ASSERT_VALID(pCtrl);
		if (!((CButton*)pCtrl)->Create(lpszWindowName, WS_CHILD | WS_VISIBLE | dwStyle, rect, this, nID))
		{
			delete pCtrl;
			return 0;
		}
	}
	else if (pClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)))			// CWnd object.
	{
		pCtrl = new CWnd();				
		ASSERT_VALID(pCtrl);
#ifdef _UNICODE
		TCHAR szClassName[_MAX_PATH];
		MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pClass->m_lpszClassName, -1, szClassName, 255);
		if (!((CWnd*)pCtrl)->Create(szClassName, lpszWindowName, WS_CHILD | WS_VISIBLE | dwStyle, rect, this, nID))
		{
			delete pCtrl;
			return 0;
		}
#else
		if (!((CWnd*)pCtrl)->Create(pClass->m_lpszClassName, lpszWindowName, WS_CHILD | WS_VISIBLE | dwStyle, rect, this, nID))
		{
			delete pCtrl;
			return 0;
		}
#endif
	}
	else															// An invalid object was passed in
	{
		ASSERT(0);
		return 0;
	}
	return InsertControl(pCtrl, rect, nID);	
}
Exemplo n.º 5
0
int wxMainToolBar::InsertSubframe(int pos)
{
   int ipos = pos;
	wxStaticText* tool_text = new wxStaticText(this, wxNewId(), _("Fullframe"), wxDefaultPosition, wxDefaultSize, 0);

   // separator, leading text
   InsertSeparator(ipos++);
   InsertControl(ipos++,tool_text);
	InsertTool(ipos++,ID_FULLFRAME, _("Reset Fullframe"), wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_UNDO")),wxART_TOOLBAR,wxSize(15,16)), wxNullBitmap, wxITEM_NORMAL, _("Reset Fullframe"), wxEmptyString);
	return (ipos-pos);
}
Exemplo n.º 6
0
int wxMainToolBar::InsertRestartExposure(int pos)
{
   int ipos = pos;
	wxStaticText* tool_text = new wxStaticText(this, wxNewId(), _("Restart"), wxDefaultPosition, wxDefaultSize, 0);

   // separator, leading text
   InsertSeparator(ipos++);
   InsertControl(ipos++,tool_text);
//	InsertTool(ipos++,ID_RESTART, _("Cancel"), wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_CROSS_MARK")),wxART_TOOLBAR), wxNullBitmap, wxITEM_NORMAL, _("Cancel exposure"), wxEmptyString);
	InsertTool(ipos++,ID_RESTART, _("Restart"), wxBitmap(&restart_15x16_xpm[0]), wxNullBitmap, wxITEM_NORMAL, _("Restart exposure"), wxEmptyString);
	return (ipos-pos);
}
Exemplo n.º 7
0
int wxMainToolBar::InsertZoom(int pos)
{
	wxStaticText* tool_text = new wxStaticText(this, wxNewId(), _("Zoom"), wxDefaultPosition, wxDefaultSize, 0);
  	m_zoomSpin = new wxSpinCtrlDbl(this, ID_ZOOM_SPIN, _T("1.0"), wxDefaultPosition,wxSize(60,-1), 0, 0, 100, 0, _("Zoom"));

   m_zoomSpin->SetRange(0.01,5.0);
   m_zoomSpin->SetValue(1.0);
   m_zoomSpin->SetIncrement(0.1);
   m_zoomSpin->SetFormat(_T("%.3lf"));

   int ipos = pos;

   // Separator, leading text + spinctrl
   InsertSeparator(ipos++);
   InsertControl(ipos++,tool_text);
   InsertControl(ipos++,m_zoomSpin);
   InsertTool(ipos++,ID_UNZOOM, _("Undo Zoom"), wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_UNDO")),wxART_TOOLBAR,wxSize(15,16)), wxNullBitmap, wxITEM_NORMAL, _("Undo Zoom"), wxEmptyString);
   SetToolShortHelp(ID_ZOOM_SPIN,_("Zoom factor"));
   Realize();

   return (ipos-pos);
}
Exemplo n.º 8
0
int wxMainToolBar::InsertBin(int pos)
{
	wxStaticText* tool_text = new wxStaticText(this, wxNewId(), _("Bin"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT6"));
   m_binChoice = new wxChoice(this, ID_BIN_CHOICE, wxDefaultPosition, wxSize(60,-1), 0, 0, 0, wxDefaultValidator, _T("Binning"));
   m_binChoice->Append(_("1:1"));
   m_binChoice->Append(_("2:2"));
   m_binChoice->Append(_("3:3"));
   m_binChoice->Append(_("4:4"));
   m_binChoice->Append(_("5:5"));
   m_binChoice->Append(_("6:6"));
   m_binChoice->SetSelection(wxArtcam::DefaultBinning()-1);

   int ipos = pos;

   // Separator, leading text + binning choice box
   InsertSeparator(ipos++);
   InsertControl(ipos++,tool_text);
   InsertControl(ipos++,m_binChoice);
   SetToolShortHelp(ID_BIN_CHOICE,_("Binning level"));
   Realize();

   return (ipos-pos);
}
Exemplo n.º 9
0
bool CWBProcess::AddElement(CtrlAttr* attr)
{
    bool ret = false;

    if (!GetInterfacePtr())
        return ret;

    if (attr && InsertControl(attr))
    {
        ret = true;
        DrawControl(attr, DC_REPAINT|DC_AUTOSCROLL);
    }

    return (ret);
}
Exemplo n.º 10
0
int wxMainToolBar::InsertObject(int pos)
{
   wxString object;
   wxF()->getFitsHeaderValue(wxT("OBJECT"),object);
   if(object == wxT("")) {
      object = wxT("Object");
      wxF()->saveFitsHeaderValue(wxT("OBJECT"),object);
   }

   int ipos = pos;
	m_object_text = new wxStaticText(this, wxNewId(), object, wxDefaultPosition, wxDefaultSize, 0);

   // separator, leading text
   InsertSeparator(ipos++);
   InsertControl(ipos++,m_object_text);
	InsertTool(ipos++,ID_OBJECT, _("Object"),wxBitmap(&star_16x16_blue_xpm[0]) , wxNullBitmap, wxITEM_NORMAL, _("Object"), wxEmptyString);
	return (ipos-pos);
}
Exemplo n.º 11
0
void CWBProcess::_DrawPoint(PtPos* pPoint, UINT nLin, ColorDef& color, bool bMask)
{
    CtrlAttr *lpAttr;
    PtPos fp;

    if (pPoint == NULL || m_CtrlAttr.ctPoints.CanTrans())
    {
        lpAttr = new CtrlAttr();
        if (lpAttr)
        {
            mov_mem (&m_CtrlAttr, lpAttr, sizeof(CtrlAttr));
            if (InsertControl(lpAttr) && m_pIWBNotify)
                m_pIWBNotify->OnWhiteBoardMessage(WBN_ADDELEMENT, lpAttr);
        }

        if (pPoint == NULL)
        {
            m_CtrlAttr.Clear();
        }
        else
        {
            m_CtrlAttr.ctPoints.Clear();
            fp.SetAttr(m_MousePos.X, m_MousePos.Y);
            m_CtrlAttr.ctPoints.InsPoint(fp);
            m_CtrlAttr.ctPos.SetAttr(fp.X, fp.Y, fp.X, fp.Y);
        }
    }

    if (pPoint)
    {
        if (GetInterfacePtr())
            GetInterfacePtr()->CtlDrawLine(m_MousePos, *pPoint, nLin, color, bMask, DC_AUTOSCROLL|DC_REPAINT);

        m_MousePos.SetAttr(pPoint->X, pPoint->Y);

        m_CtrlAttr.ctPoints.InsPoint(*pPoint);
        m_CtrlAttr.ctPos.Right  = pPoint->X;
        m_CtrlAttr.ctPos.Bottom = pPoint->Y;
    }

    m_bChanged = true;
}
Exemplo n.º 12
0
int wxMainToolBar::InsertCooling(int pos)
{
   if(wxArtcam* camera = wxF()->artcam()) {

      if(!camera->HasCooling())return 0;

      int ipos = pos;
      m_temp_text = new wxStaticText(this, wxNewId(), _("Temp"), wxDefaultPosition, wxDefaultSize, 0);

      // separator, leading text
      InsertSeparator(ipos++);
      InsertControl(ipos++,m_temp_text);
      InsertTool(ipos++,ID_SET_TEMP, _("Set Temperature"), wxBitmap(&temp_red_15x16_xpm[0]) , wxNullBitmap, wxITEM_NORMAL, _("Set Temperature"), wxEmptyString);
/*
      if(camera->HasWarmup()) {
         InsertTool(ipos++,ID_WARMUP, _("Warm up"),  wxBitmap(&heat_15x16_xpm[0]) , wxNullBitmap, wxITEM_NORMAL, _("Warm up"), wxEmptyString);
      }
*/
      return (ipos-pos);
   }
   return 0;
}
Exemplo n.º 13
0
void menu(DATA P)
{
    int input;


    system("clear");//change to "cls" if your OS windows
    printf("\n\t JUDUL \n\n");
    printf("1. Insert data\n");
    printf("2. Update data\n");
    printf("3. Delete data\n");
    printf("4. Show data\n");
    printf("Other. Exit\n");
    printf("\n\nInput : ");scanf("%d",&input);

    switch(input)
    {
        case 1:P=InsertControl(P);menu(P);
        case 2:P=UpdateControl(P);menu(P);
        case 3:P=DeleteControl(P);menu(P);
        case 4:ShowTableControl(P);
        default:exit(EXIT_FAILURE);
    }
}
Exemplo n.º 14
0
void CWBProcess::OnEditCutArea( PtPos& pt1, PtPos& pt2 )
{
    CtrlAttr *attr;

    attr = new CtrlAttr ();

    if (attr)
    {
        attr->ctName = WB_CUT;
        attr->ctPos.SetAttr(pt1.X, pt1.Y, pt2.X, pt2.Y);

        if (InsertControl(attr) && m_pIWBNotify)
            m_pIWBNotify->OnWhiteBoardMessage(WBN_ADDELEMENT, attr);

        m_bChanged = true;
    }

    if (GetInterfacePtr())
    {
        GetInterfacePtr()->CtlDrawRect(pt1, pt2, 1, m_DelColor, true, DC_REPAINT|DC_AUTOSCROLL);
        GetInterfacePtr()->EdtKillArea();
    }
}
Exemplo n.º 15
0
void CWBProcess::_DrawIndicator(PtPos& pt)
{
    CtrlAttr *lpAttr;
    PtPos point;

    // Para manter a compatibilidade com a versão anterior
    point.SetAttr(pt.X + PTR_WIDTH, pt.Y + PTR_HEIGHT);

    lpAttr = new CtrlAttr();
    if (lpAttr)
    {
        lpAttr->ctName = WB_SET;
        lpAttr->ctPos.SetAttr(pt.X, pt.Y, point.X, point.Y);
        if (InsertControl(lpAttr) && m_pIWBNotify)
        {
            m_pIWBNotify->OnWhiteBoardMessage(WBN_ADDELEMENT, lpAttr);
        }
    }

    if (GetInterfacePtr())
        GetInterfacePtr()->CtlDrawIndicator(point, DC_AUTOSCROLL|DC_REPAINT);

    m_bChanged = true;
}
Exemplo n.º 16
0
void CWBProcess::_DrawImage(WB_PCSTR szFile, PtPos& pt1, PtPos& pt2)
{
    CtrlAttr *lpAttr;

    if (FileExist(szFile))
    {
        lpAttr = new CtrlAttr();
        if (lpAttr)
        {
            lpAttr->ctName = WB_IMG;
            lpAttr->ctImage.SetName(szFile);
            lpAttr->ctPos.SetAttr(pt1.X, pt1.Y, pt2.X, pt2.Y);
            if (InsertControl(lpAttr) && m_pIWBNotify)
            {
                m_pIWBNotify->OnWhiteBoardMessage(WBN_ADDELEMENT, lpAttr);
            }
        }

        if (GetInterfacePtr())
            GetInterfacePtr()->CtlDrawImage(szFile, pt1, pt2, DC_AUTOSCROLL|DC_REPAINT);

        m_bChanged = true;
    }
}
Exemplo n.º 17
0
wxToolBarToolBase *
wxToolBarBase::AddControl(wxControl *control, const wxString& label)
{
    return InsertControl(GetToolsCount(), control, label);
}
Exemplo n.º 18
0
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::FormResize(TObject *Sender)
{
	if( m_DisEvent ) return;

	int WW = m_RectS.Right + 6;
	int HH = m_RectS.Bottom + 6;
	if( BorderStyle == bsNone ){
		int ch = m_Line * HH;
		int cw = m_Col * WW;
		m_DisEvent++;
		ClientHeight = GetCH(ch);
		ClientWidth = cw;
		m_DisEvent--;
		return;
	}
	int OldMax = m_Max;
	int h = (pTabS != NULL) ? ClientHeight - pTabS->TabHeight - 6 : ClientHeight;
	h = int((double(h - Panel->Height)/ HH) + 0.5);
	if( !h ) h = 1;
	int w = int((double(ClientWidth)/ WW) + 0.5);
	if( !w ) w = 1;
	while( (h * w) > AHDMAX ){
		if( w > 1 ){
			w--;
		}
		else if( h > 1 ){
			h--;
		}
	}
	int ch = h * HH;
	int cw = w * WW;
	if( cw < (UD->Left + UD->Width) ){
		w++;
		cw += WW;
	}
	m_Col = w;
	m_Line = h;
	m_Max = h * w;
	SetBitmapSize();
	TWinControl *pCtr = this;
	if( (m_MaxPage > 1) && (pTabS == NULL) ){
		Panel->Align = alNone;
		RemoveControl(Panel);
		pTabS = new TTabControl(this);
		pTabS->Width = ClientWidth;
		pTabS->Height = ClientHeight;
		pTabS->TabPosition = KBP->Checked ? tpBottom : tpTop;
		InsertControl(pTabS);
		pTabS->Parent = this;
		pTabS->Align = alClient;
		for( int j = 0; j < m_MaxPage; j++ ){
			AnsiString as;
			GetPageName(as, j);
			pTabS->Tabs->Add(as);
		}
		pTabS->Font->Height = -16;
		pTabS->TabHeight = 20;
		pTabS->InsertControl(Panel);
		Panel->Parent = pTabS;
		if( KBP->Checked ){
			Panel->Top = 0;
		}
		else {
			Panel->Top = pTabS->TabHeight + 3;
		}
		pTabS->TabIndex = m_CurPage;
		pTabS->OnChange = TabSChange;
		pCtr = pTabS;
	}
	pCurPage = pFileV[m_CurPage];
	if( UD->Max < pCurPage->m_CurPage ) UD->Max = SHORT(pCurPage->m_CurPage + 1);
	UD->Position = SHORT(pCurPage->m_CurPage);
	int i;
	for( i = 0; i < m_Max; i++ ){
		if( pPanel[i] == NULL ){
			pPanel[i] = new TPanel(this);
			TPanel *pn = pPanel[i];
			pn->BorderStyle = bsSingle;
			pn->Width = WW;
			pn->Height = HH;
			pCtr->InsertControl(pn);
			pn->Parent = pCtr;
			pBox[i] = new TPaintBox(this);
			TPaintBox *pb = pBox[i];
			pn->InsertControl(pb);
			pb->Parent = pn;
			pb->Align = alClient;
			pb->OnPaint = PBPaint;
			pb->OnMouseDown = PBMouseDown;
			pb->OnMouseMove = PBMouseMove;
			pb->OnDblClick = PBDblClick;
			pb->OnDragOver = PanelDragOver;
			pb->OnDragDrop = PanelDragDrop;
			pb->PopupMenu = pPopup;
		}
		else {
			pPanel[i]->Visible = FALSE;
			pPanel[i]->Width = WW;
			pPanel[i]->Height = HH;
		}
		MultProc();
	}
	for( ; i < AHDMAX; i++ ){
		if( pPanel[i] != NULL ){
			pPanel[i]->Visible = FALSE;
		}
		MultProc();
	}
	m_DisEvent++;
	ClientHeight = GetCH(ch);
	ClientWidth = cw;
	for( i = 0; i < m_Max; i++ ){
		pPanel[i]->Left = (i % m_Col) * WW;
		pPanel[i]->Top = Panel->Top + Panel->Height + (i / m_Col) * HH;
		pPanel[i]->Visible = TRUE;
	}
	if( pTabS != NULL ) Panel->Width = pTabS->ClientWidth;
	m_DisEvent--;
	if( m_Max != OldMax ){
		for( i = 0; i < m_MaxPage; i++ ){
			if( i != m_CurPage ){
				delete pFileV[i]->pList;
				pFileV[i]->pList = NULL;
			}
		}
		LoadImage();
	}
	SetPopup(Popup);
}