void IMessageModel::GetValueByRow( wxVariant &variant, unsigned int row, unsigned int col ) const { if(row>=Target.m_aRecordsReal.size()||col>=m_aColumns.size()) return; ICellInfo cell(variant,row,col); m_aColumns[col]->GetValue(Target.m_aRecords[Target.m_aRecordsReal[row]],cell); }
// 设置关联的LogLevel的过滤状态,并刷新。 bool EvtMsgBase::CmdExecute(ICmdParam& cmd) { flags.set(FLAG_CHECKED,cmd.param1!=0); for(size_t i=0;i<m_aLogLevel.size();i++) { int lv=m_aLogLevel[i]; Target.m_aLogLevelEnabled[lv]=flags.get(FLAG_CHECKED); } Target.UpdateModel(); return true; }
void EvtMsgBase::DoUpdateCtrl(IUpdParam& upd) { int lv_count=0; for(size_t i=0;i<m_aLogLevel.size();i++) { int lv=m_aLogLevel[i]; lv_count+=Target.m_nLogLevelCount[lv]; } this->m_sLabel=String::Format(m_sFormat,lv_count); EvtCommand::DoUpdateCtrl(upd); }
void AddPanel(EvtGroup* pevt) { String panel_name = pevt->m_sId; ICtl_ribbon_toolbar* p = new ICtl_ribbon_toolbar(this, pevt,16); //ICtl_ribbon_buttonbar* p = new ICtl_ribbon_buttonbar(this, pevt, 16); //ICtl_ribbon_sizer* p=new ICtl_ribbon_sizer(this, pevt, 16); //ICtl_ribbon_gallery* p = new ICtl_ribbon_gallery(this, pevt, 16); for (size_t i = 0; i < panels.size(); i++) { if (panels[i]->name == panel_name) { delete panels[i]; panels[i] = p; return; } } p->Layout(); panels.push_back(p); }
void EvtGroup::DoAppendItem(const arr_1t<EvtItem>& a) { EvtManager& ec(EvtManager::current()); for(size_t i=0;i<a.size();i++) { const EvtItem& item(a[i]); EvtBase* vp=ec.get(item.sname); if(!vp) continue; if(item.flags==0) { impl.append(vp->cast_command()); } else { EvtGroup* gp=vp->cast_group(); if(!gp) continue; DoAppendItem(gp->m_aItems); } } }
void EvtCommandWindowMessage::UpdateModel() { m_aSrcCount.clear(); m_aRecordsReal.clear(); memset(m_nLogLevelCount,0,sizeof(m_nLogLevelCount)); for(int i=m_nRdPos;i!=m_nWrPos;i=(i+1)%m_nCapacity) { int lv=m_aRecords[i].m_nLevel; if(uint32_t(lv)>LOGLEVEL_MAX) continue; m_nLogLevelCount[lv]++; if(!m_aLogLevelEnabled[lv]) { continue; } if(!m_sSearchText.empty()) { const char* c=::strstr(m_aRecords[i].m_sMessage.c_str(),m_sSearchText.c_str()); if(c==NULL) continue; } m_aSrcCount[m_aRecords[i].m_nSrc]++; m_aRecordsReal.append(i); } unsigned _nRowCount=m_aRecordsReal.size(); m_pListModel->Reset(_nRowCount); EvtManager::current()["TB_MSG"].UpdateCtrl(); //延时事件,通知消息窗口滚动动最新的消息 if(_nRowCount>0) EvtManager::current().pending("MessageAdded",_nRowCount-1); }
bool CmdLineParser::parse(const arr_1t<String>& argv) { typedef bst_map<String, OptionType>::iterator iterator; m_aParams.clear(); m_aSwitchs.clear(); m_aOptions=m_aOptionsDefault; int argc=argv.size(); int nParamCount=m_aCmdLineOptions[""].tags; for (int i = 1; i < argc; i++) { const char* pa = argv[i].c_str(); if (pa[0] == '-') { if (pa[1] == 0) { this_logger().PrintLn("empty option"); return false; } String ps = pa + 1; iterator it = m_aCmdLineOptions.find(ps); if (it == m_aCmdLineOptions.end()) { this_logger().PrintLn("unknown option or switch"); return false; } OptionType opt((*it).second); if (opt.type == CMDLINE_SWITCH) { m_aSwitchs.insert(ps); } else if (opt.type == CMDLINE_OPTION) { if (++i == argc) { this_logger().PrintLn("option value expected"); return false; } m_aOptions[ps] = argv[i]; m_aSwitchs.insert(ps); } else { this_logger().PrintLn("unknown option type"); return false; } } else { m_aParams.push_back(pa); } } if(nParamCount>=0 && (int)m_aParams.size()!=nParamCount) { if (nParamCount == 0) { this_logger().PrintLn("no_param_allown"); } else { this_logger().PrintLn("invalid_param_count:%d needed",nParamCount); } return false; } return true; }