⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 icadentproptabs.cpp

📁 mtext,编辑器,支持潜入对象
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            iTxtCurSel=15;
            break;
    }
}

//Fill members from the index of the combo box
void ent_ATTRIB_TAB::ent_SelChange() {
    switch(iTxtCurSel) {
        case 0:
            iJust72=1;
            iJust74=1;
            break;
        case 1:
            iJust72=1;
            iJust74=2;
            break;
        case 2:
            iJust72=1;
            iJust74=4;
            break;
        case 3:
            iJust72=1;
            iJust74=8;
            break;
        case 4:
            iJust72=2;
            iJust74=1;
            break;
        case 5:
            iJust72=2;
            iJust74=2;
            break;
        case 6:
            iJust72=2;
            iJust74=4;
            break;
        case 7:
            iJust72=2;
            iJust74=8;
            break;
        case 8:
            iJust72=4;
            iJust74=1;
            break;
        case 9:
            iJust72=4;
            iJust74=2;
            break;
        case 10:
            iJust72=4;
            iJust74=4;
            break;
        case 11:
            iJust72=4;
            iJust74=8;
            break;
        case 12:
            iJust72=8;
            iJust74=1;
            break;
        case 13:
            iJust72=16;
            iJust74=1;
            break;
        case 14:
            iJust72=32;
            iJust74=1;
            break;
        case 15:
            iJust72=63;
            iJust74=15;
            break;
    }
}

//This will read in the styles
//into the drop down list.
void ent_ATTRIB_TAB::ent_StyleChoice() {
    int i;
	CString csTmp;

	::SendMessage(::GetDlgItem(m_hWnd,ATTR_STYLE),CB_RESETCONTENT,0,0);
//Changed by Vitaly Spirin    SDS_StartTblRead(ResourceString(IDC_ICADENTPROP_STYLE_21, "STYLE" ));
    SDS_StartTblRead("STYLE");
	while(SDS_TblReadHasMore()) {
    	csTmp=SDS_TblReadString();
    	if(csTmp.GetLength() == 0) continue; // EBATECH(CNBR) 2002/4/24 STYPE for SHAPE has null NAME.
        if(csTmp.Find('|')>0) continue;
    	::SendMessage(::GetDlgItem(m_hWnd,ATTR_STYLE),CB_ADDSTRING,0,(LPARAM)(LPCTSTR)csTmp);
    }

    for(i=0;ent_DlgItems[i].ID!=ATTR_STYLE;i++);
    if(ent_DlgItems[i].DspValue!=NULL && strisame(ent_DlgItems[i].DspValue,ResourceString(IDC_ICADENTPROP_VARIES_18, "Varies" )))
        ::SendMessage(::GetDlgItem(m_hWnd,ATTR_STYLE),CB_ADDSTRING,0,(LPARAM)ResourceString(IDC_ICADENTPROP_VARIES_18, "Varies" ));
}

void ent_ATTRIB_TAB::OnStyleChange() {
    char szTmp[IC_ACADBUF];
    struct resbuf *pRb,*pRbb=NULL;

    ::GetWindowText(::GetDlgItem(m_hWnd,ATTR_STYLE),szTmp,sizeof(szTmp)-1);
    if((pRbb=sds_tblsearch("STYLE"/*DNT*/,szTmp,0))==NULL) return;
    for(pRb=pRbb;pRb!=NULL;pRb=pRb->rbnext){
        switch(pRb->restype){
            case 40:
                if(!cmd_real_equal(pRb->resval.rreal,0.0)){
                    sds_rtos(pRb->resval.rreal,-1,-1,szTmp);
                    ::SetWindowText(::GetDlgItem(m_hWnd,ATTR_HEIGHT),szTmp);
                }
                break;
            case 41:
                sds_rtos(pRb->resval.rreal,-1,-1,szTmp);
                ::SetWindowText(::GetDlgItem(m_hWnd,ATTR_SCALE),szTmp);
                break;
            case 50:
                sds_angtos(pRb->resval.rreal,-1,-1,szTmp);
                ::SetWindowText(::GetDlgItem(m_hWnd,ATTR_OBLIQUE),szTmp);
                break;
            case 71:
                if(pRb->resval.rint & IC_TEXT_GEN_BACKWARD) {
                    ::SendMessage(::GetDlgItem(m_hWnd,ATTR_BACKWARD),BM_SETCHECK,BST_CHECKED,0);
                }else{
                    ::SendMessage(::GetDlgItem(m_hWnd,ATTR_BACKWARD),BM_SETCHECK,BST_UNCHECKED,0);
                }
                if(pRb->resval.rint & IC_TEXT_GEN_UPSIDEDOWN) {
                    ::SendMessage(::GetDlgItem(m_hWnd,ATTR_UPSIDEDOWN),BM_SETCHECK,BST_CHECKED,0);
                }else{
                    ::SendMessage(::GetDlgItem(m_hWnd,ATTR_UPSIDEDOWN),BM_SETCHECK,BST_UNCHECKED,0);
                }
                break;
        }
    }
    IC_RELRB(pRbb);
    UpdateData(true);
}

void ent_ATTRIB_TAB::DoDataExchange(CDataExchange *pDX) {
    int index,iLen,start,end,i;

    for(start=0;(ent_DlgItems[start].EntTyp!=DB_ATTRIB) && (start<ent_num_of_vars);start++);
    start+=5; //Skip the layer,linetype,linetypescale,thickness and color
    for(end=start;(ent_DlgItems[end+1].EntTyp==DB_ATTRIB) && (end<ent_num_of_vars);end++);

    for(i=start;i<=end;i++){
        switch(ent_DlgItems[i].ResType){
            case RTREAL:
            case RT3DPOINT:
                if(!pDX->m_bSaveAndValidate){  //Moving data to the dialog
                    csTmp=ent_DlgItems[i].DspValue;
                    DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                } else { //Retrieving data from the dialog
                    DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                    DDV_MaxChars(pDX,csTmp,511);
                    if(csTmp.IsEmpty()) {
                        if(ent_DlgItems[i].DspValue!=NULL){
                            free(ent_DlgItems[i].DspValue);
                            ent_DlgItems[i].DspValue=NULL;
                        }
                    }else{
                        ent_DlgItems[i].DspValue=(char *)realloc(ent_DlgItems[i].DspValue,csTmp.GetLength()+1);
                        strcpy(ent_DlgItems[i].DspValue,(LPCTSTR)csTmp);
                    }
                }
                break;
            case RTANG:
                if(!pDX->m_bSaveAndValidate){  //Moving data to the dialog
                    csTmp=ent_DlgItems[i].DspValue;
                    DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                } else { //Retrieving data from the dialog
                    DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                    DDV_MaxChars(pDX,csTmp,511);
                    if(csTmp.IsEmpty()) {
                        if(ent_DlgItems[i].DspValue!=NULL){
                            free(ent_DlgItems[i].DspValue);
                            ent_DlgItems[i].DspValue=NULL;
                        }
                    }else{
                        ent_DlgItems[i].DspValue=(char *)realloc(ent_DlgItems[i].DspValue,csTmp.GetLength()+1);
                        strcpy(ent_DlgItems[i].DspValue,(LPCTSTR)csTmp);
                    }
                }
                break;
            case RTSHORT:
            case RTSTR:
                if(!pDX->m_bSaveAndValidate){  //Moving data to the dialog
                    if(ent_DlgItems[i].ID==ATTR_STYLE) {
                        index=::SendMessage(::GetDlgItem(m_hWnd,ATTR_STYLE),CB_FINDSTRINGEXACT,(WPARAM)-1,(LPARAM)ent_DlgItems[i].DspValue);
                        DDX_CBIndex(pDX,ATTR_STYLE,index);
                    }else{
                        csTmp=ent_DlgItems[i].DspValue;
                        DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                    }
                } else { //Retrieving data from the dialog
                    if(ent_DlgItems[i].ID==ATTR_STYLE) {
                        DDX_CBIndex(pDX,ATTR_STYLE,index);
                            iLen=::SendMessage(::GetDlgItem(m_hWnd,ATTR_STYLE),CB_GETLBTEXTLEN,(WPARAM)index,0);
                            ent_DlgItems[i].DspValue=(char *)realloc(ent_DlgItems[i].DspValue,iLen+1);
                            ::SendMessage(::GetDlgItem(m_hWnd,ATTR_STYLE),CB_GETLBTEXT,(WPARAM)index,(LPARAM)ent_DlgItems[i].DspValue);
                    }else{
                        DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                        DDV_MaxChars(pDX,csTmp,511);
                        if(csTmp.IsEmpty()) {
                            if(ent_DlgItems[i].DspValue!=NULL){
                                free(ent_DlgItems[i].DspValue);
                                ent_DlgItems[i].DspValue=NULL;
                            }
                        }else{
                            ent_DlgItems[i].DspValue=(char *)realloc(ent_DlgItems[i].DspValue,csTmp.GetLength()+1);
                            strcpy(ent_DlgItems[i].DspValue,(LPCTSTR)csTmp);
                        }
                    }
                }
            break;
            case ENT_CHECK:
                if(!pDX->m_bSaveAndValidate){ //Moving data to the dialog
                    iTmp=ent_DlgItems[i].CheckBit;
                    DDX_Check(pDX,ent_DlgItems[i].ID,iTmp);
                } else { //Retrieving data from the dialog
                    DDX_Check(pDX,ent_DlgItems[i].ID,iTmp);
                    ent_DlgItems[i].CheckBit=iTmp;
                }
            break;
            case ENT_GREY:
                if(!pDX->m_bSaveAndValidate && ent_DlgItems[i].CheckBit){ //Moving data to the dialog
                    ::EnableWindow(::GetDlgItem(m_hWnd,ent_DlgItems[i].ID),TRUE);
                }
            break;
            case ENT_JUSTI:
                if(!pDX->m_bSaveAndValidate){ //Moving data to the dialog
                    if(ent_DlgItems[i].DXFCode==72) {
                        iJust72=ent_DlgItems[i].CheckBit;
                    }else if(ent_DlgItems[i].DXFCode==74) {
                        iJust74=ent_DlgItems[i].CheckBit;
                        ent_SetSel();
                        DDX_CBIndex(pDX,ATTR_JUSTIFY,iTxtCurSel);
                    }
                } else { //Retrieving data from the dialog
                    DDX_CBIndex(pDX,ATTR_JUSTIFY,iTxtCurSel);
                    ent_SelChange();
                    if(ent_DlgItems[i].DXFCode==72) {
                        ent_DlgItems[i].CheckBit=iJust72;
                    }else if(ent_DlgItems[i].DXFCode==74) {
                        ent_DlgItems[i].CheckBit=iJust74;
                    }
                }
        }
    }

}

ent_ATTRIB_TAB::ent_ATTRIB_TAB():CDialog(ENT_ATTRIB_TAB) {
    ent_Pick1=ent_Pick2=0;
}


//////////////////////////////////////////////////////////////////////////////
// CIRCLE     ****************************************************************
//////////////////////////////////////////////////////////////////////////////

BEGIN_MESSAGE_MAP(ent_CIRCLE_TAB,CDialog)
    ON_BN_CLICKED(CIRCLE_PICK1,ent_OnPick)
    ON_NOTIFY(UDN_DELTAPOS,UPDN_CIRCLERAD,OnSpinCircleRad)
    ON_NOTIFY(UDN_DELTAPOS,UPDN_CIRCLE_CPX,OnSpinCircleCpx)
    ON_NOTIFY(UDN_DELTAPOS,UPDN_CIRCLE_CPY,OnSpinCircleCpy)
    ON_NOTIFY(UDN_DELTAPOS,UPDN_CIRCLE_CPZ,OnSpinCircleCpz)
	ON_WM_HELPINFO()
END_MESSAGE_MAP()

BOOL ent_CIRCLE_TAB::OnHelpInfo(HELPINFO *pHel){
	CommandRefHelp( m_hWnd, HLP_ENTPROP);
	return(true);
}

void ent_CIRCLE_TAB::OnOK(){
    HWND hParentWnd;

    ent_bHitEnter=true;
    hParentWnd=::GetParent(m_hWnd);
    ::SendMessage(hParentWnd,WM_CLOSE,0,0);
}

void ent_CIRCLE_TAB::OnCancel(){
    HWND hParentWnd;

    ent_bHitEnter=false;
    hParentWnd=::GetParent(m_hWnd);
    ::SendMessage(hParentWnd,WM_CLOSE,0,0);
}


void ent_CIRCLE_TAB::OnSpinCircleCpx(NMHDR *pNotifyStruct,LRESULT *result) {
    NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNotifyStruct;
    ent_SpinMasterReal(::GetDlgItem(m_hWnd,CIRCLE_CPX),pNMUpDown->iDelta);
    UpdateData(TRUE);
    *result=0;
}

void ent_CIRCLE_TAB::OnSpinCircleCpy(NMHDR *pNotifyStruct,LRESULT *result) {
    NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNotifyStruct;
    ent_SpinMasterReal(::GetDlgItem(m_hWnd,CIRCLE_CPY),pNMUpDown->iDelta);
    UpdateData(TRUE);
    *result=0;
}

void ent_CIRCLE_TAB::OnSpinCircleCpz(NMHDR *pNotifyStruct,LRESULT *result) {
    NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNotifyStruct;
    ent_SpinMasterReal(::GetDlgItem(m_hWnd,CIRCLE_CPZ),pNMUpDown->iDelta);
    UpdateData(TRUE);
    *result=0;
}

void ent_CIRCLE_TAB::OnSpinCircleRad(NMHDR *pNotifyStruct,LRESULT *result) {
    NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNotifyStruct;
    ent_SpinMasterReal(::GetDlgItem(m_hWnd,CIRCLE_RADIUS),pNMUpDown->iDelta);
    UpdateData(TRUE);
    *result=0;
}

BOOL ent_CIRCLE_TAB::OnInitDialog() {

    return(CDialog::OnInitDialog());
}

void ent_CIRCLE_TAB::ent_OnPick() {
    HWND hWnd;

    hWnd=::GetParent(m_hWnd);
    ent_Pick=1;
    ::SendMessage(hWnd,WM_CLOSE,CIRCLE_PICK1,0);
}

void ent_CIRCLE_TAB::DoDataExchange(CDataExchange *pDX) {
    int start,end,i;

    for(start=0;(ent_DlgItems[start].EntTyp!=DB_CIRCLE) && (start<ent_num_of_vars);start++);
    start+=5; //Skip the layer,linetype,linetypescale,thickness and color
    for(end=start;(ent_DlgItems[end+1].EntTyp==DB_CIRCLE) && (end<ent_num_of_vars);end++);

    for(i=start;i<=end;i++){
        switch(ent_DlgItems[i].ResType){
            case RT3DPOINT:
            case RTREAL:
                if(!pDX->m_bSaveAndValidate){  //Moving data to the dialog
                    csTmp=ent_DlgItems[i].DspValue;
                    DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                }else if(pDX->m_bSaveAndValidate){ //Retrieving data from the dialog
                    DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                    if(csTmp.IsEmpty()) {
                        if(ent_DlgItems[i].DspValue!=NULL){
                            free(ent_DlgItems[i].DspValue);
                            ent_DlgItems[i].DspValue=NULL;
                        }
                    }else{
                        ent_DlgItems[i].DspValue=(char *)realloc(ent_DlgItems[i].DspValue,csTmp.GetLength()+1);
                        strcpy(ent_DlgItems[i].DspValue,(LPCTSTR)csTmp);
                    }
                }
                break;
            case RTANG:
                if(!pDX->m_bSaveAndValidate){  //Moving data to the dialog
                    csTmp=ent_DlgItems[i].DspValue;
                    DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                }else if(pDX->m_bSaveAndValidate){ //Retrieving data from the dialog
                    DDX_Text(pDX,ent_DlgItems[i].ID,csTmp);
                    if(csTmp.IsEmpty()) {
                        if(ent_DlgItems[i].DspValue!=NULL){
                            free(ent_DlgItems[i].DspValue);
                            ent_DlgItems[i].DspValue=NULL;
                        }
                    }else{
                        ent_DlgItems[i].DspValue=(char *)realloc(ent_DlgItems[i].DspValue,csTmp.GetLength()+1);
                        strcpy(ent_DlgItems[i].DspValue,(LPCTSTR)csTmp);
                    }
                }
                break;
            case RTSTR:
            case RTSHORT:
                if(!pDX->m_bSaveAndValidate){  //Moving data to the dialog
                    csTmp=ent_DlgItems[i].DspValue;
                    DDX_Text(pDX,ent_Dl

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -