// =========================================================== // searches for valid charging-period, if not found, the default-string is returned void get_current_zone(char *timeperiods) // =========================================================== { CString str; CString tmp; size_t matchlen=0; *timeperiods=0; for (int t=0;t<costuserlist.GetCount();t++) { str=costuserlist.GetString(t); get_token(str,USERPHON,tmp); if (!timeperiods[0] && (!stricmp(tmp,"default") || !stricmp(tmp,"по умолчанию"))) { get_token(str,USERZONE,tmp); strcpy(chargzone,tmp); get_period_by_zone(chargzone,tmp); strcpy(timeperiods,tmp); // defaultvalue found } else if (!strncmp(curphone,tmp,strlen(tmp)) && strlen(tmp)>matchlen) // search maximum similarity to curphone in costuser { matchlen = strlen(tmp); get_token(str,USERZONE,tmp); strcpy(chargzone,tmp); get_period_by_zone(chargzone,tmp); strcpy(timeperiods,tmp); } } }
// ===================================================================== void insmm::OnOK() // ===================================================================== { int sel; CString line; CString mmfile; char buf[300]; char *p; UpdateData(1); sel=m_mm_list.GetCurSel(); if (sel==LB_ERR) ERR_MSG_RET("E_PLSAME"); line=mmstuff.GetString(sel); get_token(line,0,mmfile); strcpy(buf,mmfile); p=strchr(buf,'.'); if (!p) ERR_MSG_RET("E_ILLMML"); *p=0; p=buf; // while (*p && *p=='0') // skip begining zeroes // p++; MM_Element.Format("%s%s%d%s",MM_PREFIX,m_mmtype==0 ? "B":"W",IDTOCOD(m_mmdisplay),p); infolist.RemoveAll(); CDialog::OnOK(); }
// ================================================ void resultfm::OnOK() // ================================================ { char buf[1000]; char tabs[1000]; int i; if (!TestConsistency()) return; m_edit_format.GetWindowText(buf,999); for (i=0;i<(int)strlen(buf);i++) if (!strchr(" ASETIDKXY",buf[i])) ERR_MSG2_RET("E_ILLRCCIS",buf[i]); m_edit_tabs.GetWindowText(tabs,999); for (i=0;i<(int)strlen(tabs);i++) if (tabs[i]!=',' && !isdigit(tabs[i])) ERR_MSG2_RET("E_ILLRSCCIS",tabs[i]); resultdisp.RemoveAll(); resultdisp.AddTail(buf); resultdisp.AddTail(tabs); resultdisp.SaveToFile("resudisp.cfg"); KillTimer(2345); CDialog::OnOK(); }
// =========================================================== // searches the time-period by the specified zone, returns string "UNIT CHARGESTRING" void get_period_by_zone(const char *zone,CString &period) // =========================================================== { CString str,tmp; struct tm *loctime; time_t tim; period.Empty(); for (int t=0;t<costbaselist.GetCount();t++) { str=costbaselist.GetString(t); get_token(str,BASEZONE,tmp); if (!tmp.CompareNoCase(zone)) { time(&tim); /* Get time as long integer. */ loctime = localtime(&tim); /* Convert to local time. */ if (loctime->tm_wday == 0 || loctime->tm_wday == 6) get_token(str,BASEWEND,period); // weekend else get_token(str,BASEWDAY,period); // workdays get_token(str,BASECURR,tmp); // currency strcpy(currency,tmp); get_token(str,BASEPERU,tmp); // charging per unit period = tmp+" "+period; return; } } }
// =========================================================================== BOOL receiver::OnInitDialog() // =========================================================================== { CString str; int tabs[]={60,170}; int tabs2[]={100}; int lng[]={ IDC_ADD1, IDC_ADD2, IDC_CHANGE1, IDC_CHANGE2, IDC_DELETE1, IDC_DELETE2, IDC_STATIC1, IDC_STATIC2, IDC_STATIC4, IDC_STATIC3, IDC_STATIC5, IDC_IMPORT, }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); TAB_LIST(m_groups,tabs2); TAB_LIST(m_members,tabs); for (int i=0;i<Agroups.GetCount();i++) { str=Agroups.GetString(i); str.Trim(); m_groups.AddString(str); } SET_SEL(m_groups,0); OnLbnSelchangeGroups(); return TRUE; }
void CLoadSavePropPage::OnBnClickedButtonSave() { const int MAX_BUFFER_SIZE = 1024; CFileDialog FileDialog(FALSE); CString strBuffer; FileDialog.GetOFN().lpstrFile = strBuffer.GetBuffer(MAX_BUFFER_SIZE); FileDialog.GetOFN().nMaxFile = MAX_BUFFER_SIZE; FileDialog.GetOFN().lpstrDefExt = TEXT(".txt"); FileDialog.GetOFN().lpstrFilter = TEXT("Text Files(*.txt)\0*.txt\0All Files(*.*)\0*.*\0\0"); INT_PTR nRet = FileDialog.DoModal(); strBuffer.ReleaseBuffer(); if (nRet == IDOK) { CString strFileName = FileDialog.GetPathName(); CString strText; m_TextEdit.GetWindowText(strText); CStrList StrList; StrList.SetText(strText); StrList.SaveToFile(strFileName, false); } }
// ================================================ void resultfm::OnDefault() // ================================================ { m_edit_format.SetWindowText("ATSTI"); m_edit_tabs.SetWindowText("72,154"); resultdisp.RemoveAll(); resultdisp.AddTail("ATSTI"); resultdisp.AddTail("72,154"); resultdisp.SaveToFile("resudisp.cfg"); }
void CCommaTextPropPage::OnBnClickedButtonSetCommatext() { CStrList StrList; CString strCommaText; m_CommaTextEdit.GetWindowText(strCommaText); StrList.SetCommaText(strCommaText); m_Edit2.SetWindowText(StrList.GetText()); }
BOOL CIndexOfPropPage::OnInitDialog() { CPropertyPage::OnInitDialog(); // Init the text of m_TextEdit CStrList StrList; StrList.Add(TEXT("abc")); StrList.Add(TEXT("123,4")); StrList.Add(TEXT("x y z")); StrList.Add(TEXT("a=b")); StrList.Add(TEXT("a=c")); StrList.Add(TEXT("b=test1")); StrList.Add(TEXT("str = test2")); StrList.Add(TEXT("str=test2")); StrList.Add(TEXT("string=test3")); m_TextEdit.SetWindowText(StrList.GetText()); // Init m_IndexOfParamEdit m_IndexOfParamEdit.SetWindowText(TEXT("a=c")); // Init m_IndexOfNameParamEdit m_IndexOfNameParamEdit.SetWindowText(TEXT("str")); return TRUE; }
void CSortPropPage::OnBnClickedButtonSort() { CString strText; m_TextEdit.GetWindowText(strText); CStrList StrList; StrList.SetText(strText); StrList.SetSorted(true); m_TextEdit.SetWindowText(StrList.GetText()); }
void CIndexOfPropPage::OnBnClickedButtonIndexofname() { CString strText; m_TextEdit.GetWindowText(strText); CString strParam; m_IndexOfNameParamEdit.GetWindowText(strParam); CStrList StrList; StrList.SetText(strText); int nIndex = StrList.IndexOfName(strParam); m_IndexOfNameResultEdit.SetWindowText(IntToStr(nIndex)); }
BOOL CCommaTextPropPage::OnInitDialog() { BOOL bResult = CPropertyPage::OnInitDialog(); // Init the text of m_Edit1 CStrList StrList; StrList.Add(TEXT("abc")); StrList.Add(TEXT("123,4")); StrList.Add(TEXT("x y z")); StrList.Add(TEXT("a=b")); m_Edit1.SetWindowText(StrList.GetText()); return bResult; }
// =========================================================================== void receiver::populate_lists() // =========================================================================== { CString help,group; int i; m_groups.ResetContent(); m_members.ResetContent(); for (i=0;i<Agroups.GetCount();i++) { help=Agroups.GetString(i); get_token(help,0,group); m_groups.AddString(group); } }
// =========================================================================== void receiver::OnOK() // =========================================================================== { Agroups.SaveToFile("receiver.cfg"); if(m_bCloseOnOk) CDialog::OnOK(); }
// ================================================ void resultfm::OnCancel() // ================================================ { resultdisp.LoadFromFile("resudisp.cfg"); KillTimer(2345); CDialog::OnCancel(); }
// ======================================================================== void cfg_ring::OnOK() // ======================================================================== { int from=0,to=0; UpdateData(1); if (m_nr_m1.IsEmpty() || m_pause_m1.IsEmpty() || m_nr_m2.IsEmpty() || m_pause_m2.IsEmpty() || m_nr_isdn.IsEmpty() || m_pause_isdn.IsEmpty()) ERR_MSG_RET("E_PFUAE"); sscanf(m_from,"%d",&from); sscanf(m_to,"%d",&to); if (m_for1 || m_for2) { if (from<1) ERR_MSG_RET("E_WFSPCA"); if (to<1 || to<from) ERR_MSG_RET("E_WFSPCA"); } set_cfg(CFG_INCOMIN,"Modem1",m_nr_m1+","+m_pause_m1); set_cfg(CFG_INCOMIN,"Modem2",m_nr_m2+","+m_pause_m2); set_cfg(CFG_INCOMIN,"ISDN",m_nr_isdn+","+m_pause_isdn); income_times.defaultindex=m_disable.GetCheck(); income_times.reserved3=0; if (m_for1) income_times.reserved3 |=1; if (m_for2) income_times.reserved3 |=2; income_times.reserved4=from; income_times.reserved5=to; income_times.SaveToFile("incomet.cfg"); gIncomeDevicesHaveChanged=1; if(m_bCloseOnOk) CDialog::OnOK(); }
// ===================================================================== BOOL nodesel::OnInitDialog() // ===================================================================== { _fidonumber *result; _fidonumber number; CString flags,bbsname,location,phone; char buf[300]; char *p; int ret; int tabs[]={85,140,250,350,430}; int lng[]={ IDOK, IDCANCEL, IDC_STATIC1 }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); StoreOrgItemSizes(DlgName,this,DlgItemsSize,sizeof(DlgItemsSize)/sizeof(_DlgItemsSize)); TABULATE_LB(IDC_LIST); EXTENT_LB(IDC_LIST,1000); result=gustat.findresult; BeginWaitCursor(); displist.RemoveAll(); for (int i=0;i<gustat.findcount;i++) { ret=nl_get_fido_by_number(result->zone,result->net,result->node,result->point,&number); if (ret) { p=strchr(number.flags,'\n'); if (p) *p=0; flags.Format ("%s",number.flags); p=strchr(number.bbsname,'\n'); if (p) *p=0; bbsname.Format ("%s",number.bbsname); p=strchr(number.location,'\n'); if (p) *p=0; location.Format("%s",number.location); p=strchr(number.phone,'\n'); if (p) *p=0; phone.Format ("%s",number.phone); } sprintf(buf,"%s\t%d:%d/%d.%d\t%s\t%s\t%s\t%s", result->user,result->zone,result->net,result->node,result->point,flags,bbsname,location,phone); displist.AddTail(buf); result++; } UPDATE_LB(displist,IDC_LIST); EndWaitCursor(); return TRUE; }
// ===================================================================== void nodesel::OnOK() // ===================================================================== { if (m_list.GetCurSel() != LB_ERR) extract_selected(); displist.RemoveAll(); StoreInitDialogSize(DlgName,this); CDialog::OnOK(); }
// ================================================================= void cfgexfr::OnOK() // ================================================================= { CString str; m_edit_path.GetWindowText(str); if (strchr(str,'\\')) ERR_MSG_RET("E_DMNCAP"); if (strchr(str,':')) ERR_MSG_RET("E_DMNCAP"); exfrcfg.RemoveAll(); exfrcfg.AddTail(str); exfrcfg.AddTail(m_check_16bit.GetCheck() ? "1" : "0"); exfrcfg.SaveToFile("exfrtool.cfg"); CDialog::OnOK(); }
// ================================================================= BOOL cfgexfr::OnInitDialog() // ================================================================= { int lng[]={ IDC_STATIC2, IDC_CHECK_16BIT, IDCANCEL, IDOK }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); if (exfrcfg.GetCount()>1) { m_edit_path.SetWindowText(exfrcfg.GetString(0)); m_check_16bit.SetCheck(exfrcfg.GetString(1)=="1" ? 1 : 0); } return TRUE; }
BOOL CInPlaceCombo::ShowComboCtrl(DWORD dwStyle, const CRect &rCellRect, CWnd* pParentWnd, UINT uiResourceID, int iRowIndex, int iColumnIndex, CStrList &lstDropDown, CString strCurSel, int iCurSel ) { m_iRowIndex = iRowIndex; m_iColumnIndex = iColumnIndex; m_bESC = FALSE; m_DropDownList.clear(); m_DropDownList.insert(m_DropDownList.begin(), lstDropDown.begin(), lstDropDown.end()); BOOL bRetVal = TRUE; if (-1 != iCurSel) { GetLBText(iCurSel, m_strWindowText); } else if (!strCurSel.IsEmpty()) { m_strWindowText = strCurSel; } if (NULL == m_pInPlaceCombo->m_hWnd) { // ComboBoxLineToDisplay(&m_pInPlaceCombo,10); bRetVal = m_pInPlaceCombo->Create(dwStyle, rCellRect, pParentWnd, uiResourceID); //m_pInPlaceCombo->SetItemHeight(1,2); m_pInPlaceCombo->EnableScrollBar(SB_BOTH,ESB_ENABLE_BOTH); m_pInPlaceCombo->SetDroppedWidth(100); } if (iCurSel >=0 && iCurSel < this->GetCount()) { SetCurSel(iCurSel); } else { SelectString(0, strCurSel); } return bRetVal; }
// ================================================ BOOL resultfm::OnInitDialog() // ================================================ { int lng[]={ IDOK, IDCANCEL, IDC_STATIC1, IDHELP, IDDEFAULT, IDAPPLY }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); hinweiscounter=0; m_edit_format.SetWindowText(resultdisp.GetString(0)); m_edit_tabs.SetWindowText(resultdisp.GetString(1)); SetTimer(2345,400,0); return TRUE; }
// ===================================================================== BOOL insmm::OnInitDialog() // ===================================================================== { int tabs[]={75,180}; int lng[]={ IDC_WAVTYPE, IDOK, IDCANCEL, IDHELP, IDC_STATIC1, IDC_STATIC2, IDTEST, IDC_STATIC4, IDC_PLAYMAIL, IDC_PLAYLINE, IDC_BMPTYPE, IDC_PLAYDBLCLK, }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); MM_Element.Empty(); infolist.RemoveAll(); if (gc.disable_insmm_items) { DISABLEID(IDOK); DISABLEID(IDC_PLAYMAIL); DISABLEID(IDC_PLAYLINE); DISABLEID(IDC_PLAYDBLCLK); } TABULATE_LB(IDC_LIST); mmstuff.RemoveAll(); UPDATE_LB(mmstuff,IDC_LIST); OnRadioBmps(); UpdateData(0); return TRUE; }
BOOL CSortPropPage::OnInitDialog() { CPropertyPage::OnInitDialog(); // Init the text of m_TextEdit CStrList StrList; StrList.Add(TEXT("abc")); StrList.Add(TEXT("x y z")); StrList.Add(TEXT("123,4")); StrList.Add(TEXT("1234567890")); StrList.Add(TEXT("0123456789")); StrList.Add(TEXT("zzZZzzzZZZ")); StrList.Add(TEXT("test3")); StrList.Add(TEXT("test2")); StrList.Add(TEXT("test1")); StrList.Add(TEXT("str1=test2")); StrList.Add(TEXT("str2=test1")); m_TextEdit.SetWindowText(StrList.GetText()); return TRUE; }
// ===================================================================== void insmm::OnTest() // ===================================================================== { CString fname; char mmdir[300]; int sel; UpdateData(1); GET_SELID(IDC_LIST); get_token(mmstuff.GetString(sel),0,fname); make_path(mmdir,gc.MultimedPath,fname); if (m_mmtype==0) { display_bitmap(mmdir); force_bmp_display_update(); } else test_sound(mmdir); }
// ============================================ BOOL nodesel::OnCommand(WPARAM wParam, LPARAM lParam) // ============================================ { int sort=-1; if (lParam==0) { switch (wParam) { case IDC_NAME: sort=0; break; case IDC_ADDRESS: sort=1; break; case IDC_FLAGS: sort=2; break; case IDC_BBSNAME: sort=3; break; case IDC_TOWN: sort=4; break; case IDC_PHONE: sort=5; break; } if (sort>=0) { BeginWaitCursor(); displist.Sort(sort); UPDATE_LB(displist,IDC_LIST); EndWaitCursor(); return TRUE; } } return CDialog::OnCommand(wParam, lParam); }
// ===================================================================== void insmm::OnCancel() // ===================================================================== { infolist.RemoveAll(); CDialog::OnCancel(); }
// ===================================================================== void insmm::DisplayNewTypeList(void) // ===================================================================== // Format of .INF-files: 00000001.WAV,name & surname,fido address // old: 00000001.WAV,deutsch description,englisch description { int i,n,ret; FILE *fp; char buf[300]; char tmp[300]; char name[300]; char addr[300]; CString help1; CString help2; CStrList inffiles; CStrList mmfiles; UpdateData(1); make_path(tmp,gc.MultimedPath,"*.inf"); infolist.RemoveAll(); inffiles.FillWithFiles(tmp); for (i=0;i<inffiles.GetCount();i++) { make_path(tmp,gc.MultimedPath,inffiles.GetString(i)); fp=fopen(tmp,"rt"); if (fp) { while (fgets(buf,299,fp)) { if (strchr(" ;/",buf[0]) || strlen(buf)<4) continue; infolist.AddTail(buf); } fclose(fp); } } make_path(tmp,gc.MultimedPath,m_mmtype==0 ? "*.bmp":"*.wav"); mmstuff.RemoveAll(); mmfiles.FillWithFiles(tmp); for (i=0;i<mmfiles.GetCount();i++) { help1=mmfiles.GetString(i); for (n=0;n<infolist.GetCount();n++) { help2=infolist.GetString(n); if (!strnicmp(help1,help2,help1.GetLength())) { name[0]=addr[0]=0; ret=sscanf(help2,"%[^,]%[, ]%[^,]%[ ,]%[^\n,]",tmp,tmp,name,tmp,addr); if (ret!=5) break; sprintf(buf,"%s\t%s\t%s",help1,name,addr); mmstuff.AddTail(buf); break; } } } UPDATE_LB(mmstuff,IDC_LIST); }
// ================================================================= void cfgexfr::OnCancel() // ================================================================= { exfrcfg.LoadFromFile("exfrtool.cfg"); CDialog::OnCancel(); }
// ================================================================== void hatch::OnOK() // ================================================================== { CString str,areapath,filepath,magic,echotag,upl,desc; int zone,net,node,point,myzone,mynet,mynode,mypoint,sel,ret; char fpath[MAX_PATH],fname[MAX_PATH]; sel=m_list.GetCurSel(); if (sel==LB_ERR) ERR_MSG_RET("E_ETMBSEC"); str=tics.GetString(sel); get_token(str,0,echotag); get_token(str,1,upl); trim_all(upl); get_token(str,3,areapath); m_description.GetWindowText(desc); trim_all(desc); desc.Replace("\r\n",". "); // if (strchr(desc,'\r') && err_out("DN_MULLDES")==IDNO) return; m_filename.GetWindowText(filepath); if (filepath.GetLength()<2) ERR_MSG_RET("E_NOFILEGIVEN"); m_edit_magic.GetWindowText(magic); get_filename(filepath,fname); make_path(fpath,areapath,fname); if (access(fpath,0) && err_out("DY_STFBCTDA",fpath)==IDYES) { if (!CopyFile(filepath,fpath,0)) { err_out("E_CTFF",filepath,fpath); return; } } if (parse_address(upl,&zone,&net,&node,&point)<3) ERR_MSG2_RET("E_INVALUPL",upl); CFido fid=upl; char phone[300],psw[300],aka[300],ffixpsw[300],replace_buf[100]; CString repl; memset(replace_buf,0,sizeof(replace_buf)); fid.GetPhoneAndPwd(phone,psw,aka,ffixpsw); if (parse_address(aka,&myzone,&mynet,&mynode,&mypoint)<3) ERR_MSG2_RET("E_INVALUPO",upl); m_replace.GetWindowText(repl); trim_all(repl); if (repl.GetLength()>0) strcpy(replace_buf,repl); ret=make_tic_file(zone,net,node, point,myzone,mynet,mynode, mypoint, filepath,ffixpsw,desc,echotag,m_deleteafter.GetCheck(), replace_buf,magic); show_msg(ret ? L("S_176") : L("S_237"),200); // Done/Error CDialog::OnOK(); }