Beispiel #1
0
void ecSplitterScrolledWindow::OnRestoreDefaults(wxCommandEvent& event)
{
    ecConfigTreeCtrl* treeCtrl = (ecConfigTreeCtrl*) FindWindow(ecID_TREE_CTRL);
    wxASSERT (treeCtrl != NULL) ;
    
    wxTreeItemId id = treeCtrl->GetSelection();
    if (id != 0 && ecIsMenuForItem(event))
    {
        ecConfigItem* item = ((ecTreeItemData*) treeCtrl->GetItemData(id))->GetConfigItem();
        if (item->HasModifiedChildren())
        {
            int ans = wxMessageBox(_("Restore defaults for nested items?"), wxGetApp().GetSettings().GetAppName(), wxYES_NO|wxCANCEL|wxICON_QUESTION);
            switch (ans)
            {
            case wxYES:
                RestoreDefault(id, TRUE);
                break;
            case wxNO:
                RestoreDefault(id, FALSE);
                break;
            case wxCANCEL:
                break;
            default:
                wxASSERT(FALSE);
                break;
            }
        }
        else
        {
            RestoreDefault(id, FALSE);
        }
        // current values may have changed so refresh the other views
        wxGetApp().GetConfigToolDoc ()->UpdateFailingRuleCount ();
        
        if (item->GetOptionType () != ecOptionTypeNone)
        {
            ecConfigToolHint hint(item, ecValueChanged);
            wxGetApp().GetConfigToolDoc ()->UpdateAllViews (NULL, & hint);
        }
    }
}
Beispiel #2
0
void ecSplitterScrolledWindow::RestoreDefault(wxTreeItemId h, bool bRecurse /* = FALSE */, bool bTopLevel /* = TRUE */)
{
    ecConfigTreeCtrl* treeCtrl = (ecConfigTreeCtrl*) FindWindow(ecID_TREE_CTRL);
    wxASSERT (treeCtrl != NULL) ;

    ecConfigItem* ti = ((ecTreeItemData*) treeCtrl->GetItemData(h))->GetConfigItem();

    const CdlValuable valuable = ti->GetCdlValuable();

    if (valuable && (CdlValueFlavor_None != valuable->get_flavor ())) // skip the root node and nodes without a value
        valuable->set_source (CdlValueSource_Default);
    treeCtrl->SetItemText (h, ti->GetItemNameOrMacro ()); // remove asterisk in control view
    
    if (bTopLevel && ti->HasRadio ()) // if user-specified item is a radio button
    {
        for (ecConfigItem * pItem = ti->FirstRadio (); pItem; pItem = pItem->NextRadio ())
        {
            if (ti != pItem)
            {
                const CdlValuable valuable = pItem->GetCdlValuable();
                wxASSERT (valuable);
                valuable->set_source (CdlValueSource_Default); // restore default for each sibling radio button
                treeCtrl->SetItemText (pItem->GetTreeItem(), pItem->GetItemNameOrMacro ()); // remove asterisk in control view
            }
            
        }
    }
    
    if (bRecurse)
    {
        long cookie;
        for (h = treeCtrl->GetFirstChild(h, cookie); h; h = treeCtrl->GetNextSibling(h))
        {
            RestoreDefault (h, TRUE, FALSE);
        }
    }
}
void CZProfilePageDialog::OnButtonClick(Cint2 nButtonId, Cint2 nChange)
{
    CCard1Dialog::OnButtonClick(nButtonId, nChange);
    
    switch(nButtonId)
    {
    case 10000:
        RestoreDefault();
        break;
    case 10001:
        AdvanceSet();
        break;
    case 10004:   //Ñ¡Ôñ¸½¼Ó±ê×¢Îļþ
        {
            
        }
        break;
    case 10005:   //±à¼­¸½¼Ó±ê×¢Îļþ
        {
            
        }
        break;
    }
}
Beispiel #4
0
int RcvMsgQ()
{
    int infolen;
    int bAskQuit = 0;
    msgbuf send_buf;        
    msgbuf receive_buf;    
    if((infolen=msgrcv(m_msqid_to_d,&receive_buf,MAX_IPC_MSG_BUF,0,0))<0)
    {
        if (errno == EINTR)
        {
          return 0;
        }
        else
        {
          myprintf("TP_INIT:msgrcv err\n");
          return -1;
        }
    }
    else
    {
        //printf("msgrcv ok\n");
        int bSendResp = 1;
        if (IPC_CLIENT_MSG_Q_ID == receive_buf.mtype)
        {
            int* pInt;
            pInt=(int*)(&receive_buf.mtext[0]);                    
            myprintf("TP_INIT:IPC_CLIENT_MSG_Q_ID\n");        
            m_msqid_from_d = *pInt;
            myprintf("%d\n",m_msqid_from_d);                    
            bSendResp = 0;
        }
        else if (IPC_START_AUTO_DET == receive_buf.mtype)
        {
            myprintf("TP_INIT:IPC_START_AUTO_DET\n");
            // delete timer
            disable_polling();
            // wait timer function exit
            wait_polling_stop();            
            send_buf.mtype=IPC_START_AUTO_DET;
            strcpy(send_buf.mtext,"Start Done");        
        }
        else if (IPC_ADD_PVC == receive_buf.mtype)
        {
            unsigned short idx;
            unsigned short vlan_id;
            unsigned short vpi;
            unsigned short vci;
            unsigned short encap;
            unsigned short mode;
            unsigned short* pWord;
            pWord=(unsigned short*)(&receive_buf.mtext[0]);            
            int add_ret;            
            myprintf("TP_INIT:IPC_ADD_PVC\n");                        
            idx = *pWord++;
            vlan_id = *pWord++;
            vpi = *pWord++;
            vci = *pWord++;
            encap = *pWord++;
            mode = *pWord;
            myprintf("ADDPVC:%d %d %d %d %d %d\n",idx,vlan_id,vpi,vci,encap,mode);
            add_ret = AddPvc(idx,vlan_id,vpi,vci,encap,mode);
            send_buf.mtype=IPC_ADD_PVC;
            if (add_ret == 0) strcpy(send_buf.mtext,"OK");
            else strcpy(send_buf.mtext,"FAIL");
        }        
        else if (IPC_DEL_ALL_PVC == receive_buf.mtype)
        {
            int del_ret;
            myprintf("TP_INIT:IPC_DEL_ALL_PVC\n");                        
            del_ret = DelAllPvc();
            send_buf.mtype=IPC_DEL_ALL_PVC;
            if (del_ret == 0) strcpy(send_buf.mtext,"OK");
            else strcpy(send_buf.mtext,"FAIL");
        }
				/* Paul add 2012/8/7 */
        else if (IPC_ATE_ADSL_RESTORE_DEFAULT == receive_buf.mtype)
        {
            int rst_ret;
            myprintf("TP_INIT:IPC_ATE_ADSL_RESTORE_DEFAULT\n");                        
            rst_ret = RestoreDefault();
            send_buf.mtype=IPC_ATE_ADSL_RESTORE_DEFAULT;
            if (rst_ret == 0) strcpy(send_buf.mtext,"OK");
            else strcpy(send_buf.mtext,"FAIL");
        }
	//Ren.B
	else if (IPC_ATE_ADSL_GET_BITS_PER_CARRIER == receive_buf.mtype)
	{
		int rst_ret;
		myprintf("TP_INIT:IPC_ATE_ADSL_GET_BITS_PER_CARRIER\n");                        
		rst_ret = getBitsPerCarrier();
		send_buf.mtype=IPC_ATE_ADSL_GET_BITS_PER_CARRIER;
		if (rst_ret == 0) strcpy(send_buf.mtext,"OK");
		else strcpy(send_buf.mtext,"FAIL");
	}
	else if (IPC_ATE_ADSL1_GET_SNR == receive_buf.mtype)
	{
		int rst_ret;
		myprintf("TP_INIT:IPC_ATE_ADSL1_GET_SNR\n");                        
		rst_ret = getSNR_ADSL1();
		send_buf.mtype=IPC_ATE_ADSL1_GET_SNR;
		if (rst_ret == 0) strcpy(send_buf.mtext,"OK");
		else strcpy(send_buf.mtext,"FAIL");
	}
	else if (IPC_ATE_ADSL2_PLUS_GET_SNR == receive_buf.mtype)
	{
		int rst_ret;
		myprintf("TP_INIT:IPC_ATE_ADSL2_PLUS_GET_SNR\n");                        
		rst_ret = getSNR_ADSL2_PLUS();
		send_buf.mtype=IPC_ATE_ADSL2_PLUS_GET_SNR;
		if (rst_ret == 0) strcpy(send_buf.mtext,"OK");
		else strcpy(send_buf.mtext,"FAIL");
	}
	//Ren.E
        else if (IPC_LINK_STATE == receive_buf.mtype)
        {
			char LinkSts[30];
            myprintf("TP_INIT:IPC_LINK_STATE\n");                                
            GetLinkSts(LinkSts, sizeof(LinkSts));
            send_buf.mtype=IPC_LINK_STATE;
			if (!strcmp(LinkSts,"wait for initializing"))
			{
				// nvram could not allow space character
				strcpymax(send_buf.mtext,"wait_for_init",MAX_IPC_MSG_BUF);				
			}
			else
			{
				strcpymax(send_buf.mtext,LinkSts,MAX_IPC_MSG_BUF);								
			}
        }
        else if (IPC_STOP_AUTO_DET == receive_buf.mtype)
        {
            myprintf("TP_INIT:IPC_STOP_AUTO_DET\n");                                        
            send_buf.mtype=IPC_STOP_AUTO_DET;
            strcpy(send_buf.mtext,"Stop Done");
            enable_polling();
        }                
        else if (IPC_ATE_ADSL_SHOW == receive_buf.mtype)
        {
            myprintf("TP_INIT:IPC_ATE_ADSL_SHOW\n");                                        
            UpdateAllAdslSts(0,1);
            send_buf.mtype=IPC_ATE_ADSL_SHOW;
            strcpy(send_buf.mtext,"AteSetDone");           
        }                
        else if (IPC_ATE_ADSL_QUIT_DRV == receive_buf.mtype)
        {
            myprintf("TP_INIT:IPC_ATE_ADSL_QUIT_DRV\n");                                        
            bAskQuit = 1;
            send_buf.mtype=IPC_ATE_ADSL_QUIT_DRV;
            strcpy(send_buf.mtext,"AteSetDone");           
        }           
        else if (IPC_ATE_ADSL_DISP_PVC == receive_buf.mtype)
        {
            myprintf("TP_INIT:IPC_ATE_ADSL_DISP_PVC\n");                                        
            DispAllPvc();
            send_buf.mtype=IPC_ATE_ADSL_DISP_PVC;
            strcpy(send_buf.mtext,"AteSetDone");           
        }                        
        else if (IPC_ATE_SET_ADSL_MODE == receive_buf.mtype)
        {
            unsigned short mode;
            unsigned short type;
            unsigned short* pWord;
            pWord=(unsigned short*)(&receive_buf.mtext[0]);            
            int set_ret_mode, set_ret_type;            
            myprintf("TP_INIT:IPC_ATE_SET_ADSL_MODE\n");                                        
            mode = *pWord++;
            type = *pWord++;
            myprintf("SET MODE:%d %d\n",mode,type);
            set_ret_mode = SetAdslMode(mode,1);
            set_ret_type = SetAdslType(type,1);
            send_buf.mtype=IPC_ATE_SET_ADSL_MODE;
            if (set_ret_mode == 0 && set_ret_type) strcpy(send_buf.mtext,"OK");
            else strcpy(send_buf.mtext,"FAIL");            
        }    
        else if (IPC_RELOAD_PVC == receive_buf.mtype)
        {
            int del_ret;
            myprintf("TP_INIT:IPC_RELOAD_PVC\n");                        
            del_ret = DelAllPvc();
			reload_pvc();
            send_buf.mtype=IPC_RELOAD_PVC;			
            strcpy(send_buf.mtext,"OK");
        }
        
        if (bSendResp)
        {
            if(msgsnd(m_msqid_from_d,&send_buf,MAX_IPC_MSG_BUF,0)<0)
            {
                myprintf("msgsnd fail\n");
                return -1;
            }
        }
    }
  
    if (bAskQuit == 1) return 1;
    return 0;
}
void CZProfileAdvanceDialog::OnButtonClick(Cint2 nButtonId, Cint2 nChange)
{
    CCard1Dialog::OnButtonClick(nButtonId, nChange);
    HWND hWnd = FindWindow(NULL, "ºá¶ÏÃæ»æͼ¿ØÖÆ");

    switch(nButtonId)
    {
    case 10000:
        RestoreDefault();
        break;
    case 10001:
    {
        CZDwgDrawConfig* pDrawConfig = CZDwgDrawConfig::GetInstance();
        CZLayerPenConfig* pPen = pDrawConfig->GetPen(m_nGroundPen - 1);
        if(pPen != NULL)
        {
            CZLayerPenConfig::ShowPenDialog(pPen, hWnd);
            //CZLayerPenDialog dlg(pPen);
            //if(dlg.DoModal() == 1)
            //{
            //    dlg.GetLayerPenConfig(pPen);
            //}
        }
    }
    break;
    case 10002:
    {
        CZDwgDrawConfig* pDrawConfig = CZDwgDrawConfig::GetInstance();
        CZLayerPenConfig* pPen = pDrawConfig->GetPen(m_nDesignPen - 1);
        if(pPen != NULL)
        {
            CZLayerPenConfig::ShowPenDialog(pPen, hWnd);
            //CZLayerPenDialog dlg(pPen);
            //if(dlg.DoModal() == 1)
            //{
            //    dlg.GetLayerPenConfig(pPen);
            //}
        }
    }
    break;
    case 10003:
    {
        CZDwgDrawConfig* pDrawConfig = CZDwgDrawConfig::GetInstance();
        CZLayerPenConfig* pPen = pDrawConfig->GetPen(m_nRoadPen - 1);
        if(pPen != NULL)
        {
            CZLayerPenConfig::ShowPenDialog(pPen, hWnd);
            //CZLayerPenDialog dlg(pPen);
            //if(dlg.DoModal() == 1)
            //{
            //    dlg.GetLayerPenConfig(pPen);
            //}
        }
    }
    break;
    case 10004:
    {
        CZDwgDrawConfig* pDrawConfig = CZDwgDrawConfig::GetInstance();
        CZLayerPenConfig* pPen = pDrawConfig->GetPen(m_nLandPen - 1);
        if(pPen != NULL)
        {
            CZLayerPenConfig::ShowPenDialog(pPen, hWnd);
            //CZLayerPenDialog dlg(pPen);
            //if(dlg.DoModal() == 1)
            //{
            //    dlg.GetLayerPenConfig(pPen);
            //}
        }
    }
    break;
    case 10005:
    {
        CZDwgDrawConfig* pDrawConfig = CZDwgDrawConfig::GetInstance();
        CZLayerPenConfig* pPen = pDrawConfig->GetPen(m_nDataPen - 1);
        if(pPen != NULL)
        {
            CZLayerPenConfig::ShowPenDialog(pPen, hWnd);
            //CZLayerPenDialog dlg(pPen);
            //if(dlg.DoModal() == 1)
            //{
            //    dlg.GetLayerPenConfig(pPen);
            //}
        }
    }
    break;
    break;
    }
}