void ContourColorDlg::FillColorList( const AcGeDoubleArray& zValues, const AcArray<COLORREF>& colors ) { DeleteColorListItemDatas(); AddColorListColumns(); // 额外增加一个z值(表示最大z值之后的范围) AcGeDoubleArray new_zValues; new_zValues.append( zValues ); new_zValues.append( zValues.last() ); int n = new_zValues.length(); for( int i = 0; i < n; i++ ) { m_colorList.InsertItem( i, _T( "xx" ) ); CString str; if( i == 0 ) { str.Format( _T( "<%.3f" ), new_zValues[i] ); } else if( i == n - 1 ) { str.Format( _T( ">%.3f" ), new_zValues[i - 1] ); } else { str.Format( _T( "%.3f ~ %.3f" ), new_zValues[i - 1], new_zValues[i] ); } m_colorList.SetItemText( i, 0, str ); m_colorList.SetItemText( i, 1, _T( "填充颜色" ) ); COLORREF rgb = GetColorRGB( colors, i ); m_colorList.SetCellColors( i, 1, rgb, -1 ); ColorListItemData* pData = new ColorListItemData(); pData->z = new_zValues[i]; pData->rgb = rgb;; m_colorList.SetItemData( i, ( DWORD_PTR )pData ); } }
static void _draw(void* fullPanel, Delegate* exec) { Label lab; Color col; Point p; Size s; int i; ChannelPanelMenu* cpm = (ChannelPanelMenu*)((FullPanel*)fullPanel)->parent; G_Object* g; if (exec != 0) { EventArg args; exec->Method(fullPanel, &args); } g = ((FullPanel*)fullPanel)->mainForm->base; g->Draw(g); col = GetColorRGB(0,0,0); lab.TextColor = &col; lab.BGColor = (void*)0; s = cpm->chlsRb[0]->base->Size; p = cpm->chlsRb[0]->base->Location; p.X += cpm->chlsRb[0]->base->ParentLocation.X; p.Y += cpm->chlsRb[0]->base->ParentLocation.Y; lab.StartPoint = GetPoint(p.X - 30, p.Y + s.Height / 2 - 4, 0); DrawLabel(&lab, "ON"); s = cpm->chlsRb[8]->base->Size; p = cpm->chlsRb[8]->base->Location; p.X += cpm->chlsRb[8]->base->ParentLocation.X; p.Y += cpm->chlsRb[8]->base->ParentLocation.Y; lab.StartPoint = GetPoint(p.X - 30, p.Y + s.Height / 2 - 4, 0); DrawLabel(&lab, "OFF"); for(i = 0; i < 8; i++) { s = cpm->chlsRb[i]->base->Size; p = cpm->chlsRb[i]->base->Location; p.X += cpm->chlsRb[i]->base->ParentLocation.X; p.Y += cpm->chlsRb[i]->base->ParentLocation.Y; lab.StartPoint = GetPoint(p.X + (s.Width-16) / 2, p.Y - 24, 0); DrawLabel(&lab, "CH %1d", (i+1)); } s = cpm->textBoxPeriodCicle->base->Size; p = cpm->textBoxPeriodCicle->base->Location; p.X += cpm->textBoxPeriodCicle->base->ParentLocation.X; p.Y += cpm->textBoxPeriodCicle->base->ParentLocation.Y; lab.StartPoint = GetPoint(p.X - 80, p.Y + s.Height / 2 - 4, 0); DrawLabel(&lab, "PERIOD LOOP"); s = cpm->textBoxPeriodCalib->base->Size; p = cpm->textBoxPeriodCalib->base->Location; p.X += cpm->textBoxPeriodCalib->base->ParentLocation.X; p.Y += cpm->textBoxPeriodCalib->base->ParentLocation.Y; lab.StartPoint = GetPoint(p.X - 120, p.Y + s.Height / 2 - 4, 0); DrawLabel(&lab, "PERIOD CALIBRATION"); s = cpm->textBoxMaxError->base->Size; p = cpm->textBoxMaxError->base->Location; p.X += cpm->textBoxMaxError->base->ParentLocation.X; p.Y += cpm->textBoxMaxError->base->ParentLocation.Y; lab.StartPoint = GetPoint(p.X - 100, p.Y + s.Height / 2 - 4, 0); DrawLabel(&lab, "MAX ERROR FLOW"); }
ChannelPanelMenu* ChannelPanelMenu_ctor(ModbusParams* mb) { uint16_t i; Point p; Size s; ChannelPanelMenu* obj = (ChannelPanelMenu*) i_malloc(sizeof(ChannelPanelMenu)); obj->panel = FullPanel_ctor(); obj->panel->parent = obj; obj->params = mb; obj->_ChannelPanelMenu = &_dstr_ChannelPanelMenu; obj->panel->mainForm->closeBtn->eventClick.Method = &closeBtn_Click; // Controls for(i = 0; i < 16;i++) { uint16_t a; a = i % 8; s = GetSize(50, 50); p = GetPoint(40 + a*(s.Width + 15), (i / 8)*(s.Height + 15) + 100, 0); obj->chlsRb[i] = Radiobutton_ctor(); obj->chlsRb[i]->base->SetBounds(obj->chlsRb[i]->base, &p, &s); obj->chlsRb[i]->base->ParentLocation = obj->panel->mainForm->base->Location; obj->chlsRb[i]->eventClick.Method = &chnlsRb_Click; obj->chlsRb[i]->ID = i; if (i < 8) obj->chlsRb[i]->base->StyleCtrl.ColorDown = GetColorRGB(0, 0xc0, 0); else obj->chlsRb[i]->base->StyleCtrl.ColorDown = GetColorRGB(0xf0, 0, 0); obj->chlsRb[i]->parent = obj; obj->panel->AddControl(obj->panel, obj->chlsRb[i]->base); } for(i = 0; i < 12; i++) { s = GetSize(30, 30); p = GetPoint(600, i * (s.Height + 5) + 50, 0); obj->chBoxFlagsError[i] = CheckBox_ctor(); obj->chBoxFlagsError[i]->base->SetBounds(obj->chBoxFlagsError[i]->base, &p, &s); obj->chBoxFlagsError[i]->base->ParentLocation = obj->panel->mainForm->base->Location; obj->chBoxFlagsError[i]->ID = i; obj->chBoxFlagsError[i]->base->StyleCtrl.ColorDown = GetColorRGB(0xf0, 0, 0); obj->chBoxFlagsError[i]->parent = obj; obj->panel->AddControl(obj->panel, obj->chBoxFlagsError[i]->base); } obj->chBoxFlagsError[0]->Caption = "Voltage small"; obj->chBoxFlagsError[1]->Caption = "Temperature max"; obj->chBoxFlagsError[2]->Caption = "sensor density error"; obj->chBoxFlagsError[3]->Caption = "sensor dp"; obj->chBoxFlagsError[4]->Caption = "dp filt max"; obj->chBoxFlagsError[5]->Caption = "error density"; obj->chBoxFlagsError[6]->Caption = "Voltage max"; obj->chBoxFlagsError[7]->Caption = "calc val != mes value"; obj->chBoxFlagsError[8]->Caption = "input d min"; obj->chBoxFlagsError[9]->Caption = "error input sensor"; obj->chBoxFlagsError[10]->Caption = "bypass"; obj->chBoxFlagsError[11]->Caption = "avar on filt"; obj->textBoxPeriodCicle = TextBox_ctor(); s = GetSize(100, 40); p = GetPoint(450, s.Height + 200, 0); obj->textBoxPeriodCicle->base->SetBounds(obj->textBoxPeriodCicle->base, &p, &s); obj->textBoxPeriodCicle->base->ParentLocation = obj->panel->mainForm->base->Location; obj->textBoxPeriodCicle->parent = obj; obj->textBoxPeriodCicle->eventClick.Method = &textBoxPeriodCicle_Click; obj->panel->AddControl(obj->panel, obj->textBoxPeriodCicle->base); obj->textBoxPeriodCalib = TextBox_ctor(); s = GetSize(100, 40); p = GetPoint(450, s.Height + 260, 0); obj->textBoxPeriodCalib->base->SetBounds(obj->textBoxPeriodCalib->base, &p, &s); obj->textBoxPeriodCalib->base->ParentLocation = obj->panel->mainForm->base->Location; obj->textBoxPeriodCalib->parent = obj; obj->textBoxPeriodCalib->eventClick.Method = &textBoxPeriodCalib_Click; obj->panel->AddControl(obj->panel, obj->textBoxPeriodCalib->base); obj->textBoxMaxError = TextBox_ctor(); s = GetSize(100, 40); p = GetPoint(450, s.Height + 320, 0); obj->textBoxMaxError->base->SetBounds(obj->textBoxMaxError->base, &p, &s); obj->textBoxMaxError->base->ParentLocation = obj->panel->mainForm->base->Location; obj->textBoxMaxError->parent = obj; obj->textBoxMaxError->eventClick.Method = &textBoxMaxError_Click; obj->panel->AddControl(obj->panel, obj->textBoxMaxError->base); obj->mbUpdate.Method = &mbUpdateFunc; obj->panel->Draw = &_draw; RelocateElements(obj->panel->mainForm); return obj; }
/***************************************************************************** Function: DDV_DrawSequence() Purpose: draw a sequence within a ParaG Return value: - *****************************************************************************/ static void DDV_DrawSequence(UnDViewerGraphDataPtr GrData,ParaGPtr pgp, DDV_ColorGlobal *pColorGlobal,SeqIdPtr sip,RectPtr rc_pgp, CharPtr szSeq,Int4 from,Int4 to,Uint1 ScaleStyle, Int2 leftDecal,Uint1 strand,Boolean bUseColors,ValNodePtr vnp_bsp, Int4 row,Boolean bSelect) { DDV_ColorCell *dclrp,*highlighClr; Int4 dp; Uint4 old_colour,new_colour,hlClr; Int2 decal=1,i,x,y,pos=0; Boolean isAlpha,bSelected,bGoTo; RecT rcSel; if (!szSeq) return; /*scale or not... to be or not to be ?*/ if (ScaleStyle==SCALE_POS_TOP) decal++; /*compute the first letter's coordinate*/ x=rc_pgp->left+leftDecal-GrData->udv_font.cxChar/2; y=rc_pgp->top+decal*GrData->udv_font.LineHeight; i=from;/*if from!=0, means we don't draw the entire ParaG*/ to++; /*get the selection(s)*/ if (pColorGlobal){/*use color*/ old_colour=new_colour=GetColorRGB(0,0,0); highlighClr = DDV_SearchColorCellbyName(pColorGlobal->pvnSpecialColors, "Highlight"); if (highlighClr) hlClr = GetColorRGB (highlighClr->rgb[0], highlighClr->rgb[1],highlighClr->rgb[2]); else hlClr = GetColorRGB (255,255,0); while(szSeq[i] && i<to){ /*if a letter, get the color*/ if (szSeq[i]!=' '){ if (isalpha(szSeq[i])){ isAlpha=TRUE; dp=DDV_GetBspCoordGivenDispCoord(pgp,pgp->StartLetter+i); bSelected=DDV_IsLetterSelected(vnp_bsp,dp); if (dp==(Int4)-1) dclrp=NULL; else dclrp=DDV_GetColor(pColorGlobal,NULL, row+1, dp); if(bUseColors){ if (dclrp) new_colour=GetColorRGB(dclrp->rgb[0],dclrp->rgb[1],dclrp->rgb[2]); else new_colour=GetColorRGB(0,0,0); } } else { bSelected=FALSE; isAlpha=FALSE; new_colour=GetColorRGB(0,0,0); } if (GrData->GotoLetter==pgp->StartLetter+i){ bGoTo=TRUE;bSelected=TRUE; } else{ bGoTo=FALSE; } if (bSelected){ if (bGoTo==FALSE){ if (bSelect) #ifdef WIN_MSWIN Nlm_SetColorEx(hlClr); #else Nlm_SetColor(hlClr); #endif else White(); } else{ Red(); } rcSel.left=x-2; rcSel.top=y-GrData->udv_font.LineHeight; rcSel.bottom=y; rcSel.right=rcSel.left+GrData->udv_font.ColWidth; PaintRect(&rcSel); /*FrameRect(&rcSel);*/ } if ((bUseColors && new_colour!=old_colour) || bSelected) { #ifdef WIN_MSWIN Nlm_SetColorEx(new_colour); #else Nlm_SetColor(new_colour); #endif old_colour=new_colour; } MoveTo(x,y); if (isAlpha && dclrp) PaintChar((dclrp->LowerCase ? TO_LOWER(szSeq[i]) : szSeq[i])); else PaintChar(szSeq[i]); } i++; x+=GrData->udv_font.ColWidth; }