void CSub::OnButtonChooseProgram() { CFileDialog *fd = new CFileDialog(TRUE, "zap", NULL, OFN_HIDEREADONLY | OFN_NOCHANGEDIR , "Zap! Files (*.zap)|*.zap||", this); CString DefaultPath = ((CFlowZap*)m_fc)->GetDefaultZapDirectory(); fd->m_ofn.lpstrInitialDir = DefaultPath; int response = fd->DoModal(); if (response == IDOK) { m_NameOfFile = fd->GetPathName(); CString filename = GetFileNameFromPath(m_NameOfFile); m_ChooseProgram.SetWindowText("[" + filename + "]"); CFlowZap *fc = (CFlowZap*)m_fc; fc->ChangeMadeInFile(); m_tooltip.AddTool(GetDlgItem(IDC_CHOOSEPROGRAM), m_NameOfFile); } delete fd; fd = NULL; }
void CSub::Configure(CString pathname) { m_NameOfFile = pathname; CString fn = GetFileNameFromPath(pathname); m_tooltip.AddTool(GetDlgItem(IDC_CHOOSEPROGRAM), m_NameOfFile); m_ChooseProgram.SetWindowText("[" + fn + "]"); }
std::string Path::GetFileNameFromPathWithoutExt(std::string filePath) { if (filePath.empty()) { return ""; } std::string fileName = GetFileNameFromPath(filePath); return GetFileNameWithoutExt(fileName); }
//--------------------------------------------------------------------------- void TShortcutBox::SetMacroFileButtonText(hxc_button *p_but,int p) { if (CurrentCuts[p].MacroFileIdx>=0){ Str Text=CurrentCutsStrings[CurrentCuts[p].MacroFileIdx].String; Str Name=GetFileNameFromPath(Text); char *dot=strrchr(Name,'.'); if (dot) *dot=0; p_but->set_text(Name); }else{ p_but->set_text(T("Choose")); } }
//--------------------------------------------------------------------------- void TShortcutBox::Show() { if (StandardShow(600,400,T("Shortcuts"), ICO16_CUT,ButtonPressMask,(LPWINDOWPROC)WinProc)) return; st_chars_ig.LoadIconsFromMemory(XD,Get_st_charset_bmp(),16,RGB(255,255,255)); st_chars_ig.IconHeight=16; st_chars_ig.NumIcons=256-32; int y=10; dir_lv.ext_sl.DeleteAll(); dir_lv.ext_sl.Add(3,T("Parent Directory"),1,1,0); dir_lv.ext_sl.Add(3,"",ICO16_FOLDER,ICO16_FOLDERLINK,0); dir_lv.ext_sl.Add(3,"stcut",ICO16_CUTON,ICO16_CUTONLINK,0); dir_lv.ext_sl.Add(3,"stcut",ICO16_CUTOFF,ICO16_CUTOFFLINK,0); dir_lv.lpig=&Ico16; dir_lv.base_fol=CutDir; dir_lv.fol=CutDir; dir_lv.allow_type_change=true; dir_lv.show_broken_links=0; if (CurrentCutSel.NotEmpty()){ dir_lv.fol=CurrentCutSel; RemoveFileNameFromPath(dir_lv.fol,REMOVE_SLASH); } dir_lv.create(XD,Handle,10,y,325,120,dir_lv_notify_proc,this); new_cut_but.create(XD,Handle,10,y+125,160,25,button_notify_proc,this, BT_TEXT,T("New Shortcuts"),20000,BkCol); change_fol_but.create(XD,Handle,10+165,y+125,160,25,button_notify_proc,this, BT_TEXT,T("Change Store Folder"),20001,BkCol); help_td.create(XD,Handle,345,y,245,150,BkCol); help_td.set_text(T("Note: Shortcuts only work when Steem's main window is activated.")); y+=160; sa_border.create(XD,Handle,9,y,602-20,390-y, NULL,this,BT_GROUPBOX,"",0,BkCol); sa.create(XD,sa_border.handle,1,1,sa_border.w-2,sa_border.h-2,NULL,this); if (CurrentCutSel.NotEmpty()){ dir_lv.select_item_by_name(GetFileNameFromPath(CurrentCutSel)); } LoadCutsAndCreateCutControls(); XMapWindow(XD,Handle); if (StemWin) CutBut.set_check(true); }
//--------------------------------------------------------------------------- Str TShortcutBox::ChooseMacro(Str Current) { int dlv_h=200; int w=300,h=10+dlv_h+10; Window handle=hxc::create_modal_dialog(XD,w,h,T("Choose a Macro"),true); if (handle==0) return ""; int y=10; hxc_dir_lv dlv; dlv.ext_sl.Add(3,T("Parent Directory"),1,1,0); dlv.ext_sl.Add(3,"",ICO16_FOLDER,ICO16_FOLDERLINK,0); dlv.ext_sl.Add(3,"stmac",ICO16_MACROS,ICO16_MACROLINK,0); dlv.lpig=&Ico16; dlv.base_fol=OptionBox.MacroDir; dlv.fol=OptionBox.MacroDir; dlv.allow_type_change=0; dlv.show_broken_links=0; dlv.choose_only=true; if (Current.NotEmpty()){ dlv.fol=Current; RemoveFileNameFromPath(dlv.fol,REMOVE_SLASH); } dlv.create(XD,handle,10,y,w-20,dlv_h,NULL,NULL); dlv.select_item_by_name(GetFileNameFromPath(Current)); if (dlv.lv.sel<0) dlv.lv.changesel(0); y+=dlv_h+10; EasyStr ret; bool show=true; for (;;){ int chosen=hxc::show_modal_dialog(XD,handle,show,dlv.lv.handle); if (chosen!=1) break; ret=dlv.get_item_path(dlv.lv.sel); if (ret.NotEmpty()) break; show=0; } hxc::destroy_modal_dialog(XD,handle); return ret; }
void BacnetScreen::OnNMDblclkListScreen(NMHDR *pNMHDR, LRESULT *pResult) { LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR); int device_obj_instance = g_bac_instance; DWORD dwPos=GetMessagePos();//Get which line is click by user.Set the check box, when user enter Insert it will jump to program dialog CPoint point( LOWORD(dwPos), HIWORD(dwPos)); m_screen_list.ScreenToClient(&point); LVHITTESTINFO lvinfo; lvinfo.pt=point; lvinfo.flags=LVHT_ABOVE; int nItem=m_screen_list.SubItemHitTest(&lvinfo); if(nItem!=-1) { m_screen_list.SetCellChecked(nItem,0,1); screen_list_line = nItem; for (int i=0;i<m_screen_list.GetItemCount();++i) { if(i == nItem) continue; m_screen_list.SetCellChecked(i,0,FALSE); } } int lRow = 0; int lCol = 0; lRow = lvinfo.iItem; lCol = lvinfo.iSubItem; if(lRow>m_screen_list.GetItemCount()) //如果点击区超过最大行号,则点击是无效的; return; if(lRow<0) return; m_screen_list.Set_Edit(true); CString New_CString; CString temp_task_info; if(lCol == SCREEN_PIC_FILE) { TRACE(_T("Double")); CString FilePath; CString image_fordor; CString ApplicationFolder; GetModuleFileName(NULL, ApplicationFolder.GetBuffer(MAX_PATH), MAX_PATH); PathRemoveFileSpec(ApplicationFolder.GetBuffer(MAX_PATH)); ApplicationFolder.ReleaseBuffer(); //image_fordor = ApplicationFolder + _T("\\Database\\image"); CMainFrame* pFrame=(CMainFrame*)(AfxGetApp()->m_pMainWnd); CString temp_now_building_name= g_strCurBuildingDatabasefilePath; PathRemoveFileSpec(temp_now_building_name.GetBuffer(MAX_PATH)); temp_now_building_name.ReleaseBuffer(); image_fordor = temp_now_building_name + _T("\\image"); WIN32_FIND_DATA fd; BOOL ret = FALSE; HANDLE hFind = FindFirstFile(image_fordor, &fd); if ((hFind != INVALID_HANDLE_VALUE) && (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { //目录存在 ret = TRUE; } else { SECURITY_ATTRIBUTES attrib; attrib.bInheritHandle = FALSE; attrib.lpSecurityDescriptor = NULL; attrib.nLength = sizeof(SECURITY_ATTRIBUTES); CreateDirectory( image_fordor, &attrib); } SetCurrentDirectoryW(image_fordor); //选择图片,如果选的不在database目录下就copy一份过来;如果在的话就重命名,因为文件名长度不能超过10个字节; CString strFilter = _T("jpg file;bmp file;png file|*.jpg;*.bmp;*.png|all File|*.*||"); CFileDialog dlg(true,_T("bmp"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER,strFilter); if(IDOK==dlg.DoModal()) { FilePath=dlg.GetPathName(); CString FileName; GetFileNameFromPath(FilePath,FileName); CString temp1; temp1 = FilePath; PathRemoveFileSpec(temp1.GetBuffer(MAX_PATH)); temp1.ReleaseBuffer(); //The next part of code change file name length larger than 11 and rename it move to image folder. // Eg : T3000Building.bmp -> T3000B.bmp CString extension_name; extension_name = PathFindExtension(FileName.GetBuffer()); int extension_length = extension_name.GetLength(); if(extension_length > 10) return; PathRemoveExtension(FileName.GetBuffer(MAX_PATH)); FileName.ReleaseBuffer(); if(FileName.GetLength() >=11 - extension_length) { FileName = FileName.Left(10 - extension_length); FileName = FileName + extension_name; } CString new_file_path; new_file_path = image_fordor + _T("\\") + FileName; Change_File_Path = new_file_path; if(temp1.CompareNoCase(image_fordor) != 0)//如果就在当前目录就不用copy过来了; { CopyFile(FilePath,new_file_path,false); } else { CFile::Rename(FilePath, new_file_path); } memcpy_s(&m_temp_screen_data[lRow],sizeof(Control_group_point),&m_screen_data.at(lRow),sizeof(Control_group_point)); char cTemp1[255]; memset(cTemp1,0,255); WideCharToMultiByte( CP_ACP, 0, FileName.GetBuffer(), -1, cTemp1, 255, NULL, NULL ); memcpy_s(m_screen_data.at(lRow).picture_file,STR_SCREEN_PIC_FILE_LENGTH,cTemp1,STR_SCREEN_PIC_FILE_LENGTH); m_screen_list.SetItemText(lRow,SCREEN_PIC_FILE,FileName); New_CString = FileName; pic_filename = FileName; //if(h_write_pic_thread==NULL) //{ // if(Device_Basic_Setting.reg.sd_exist) // h_write_pic_thread =CreateThread(NULL,NULL,WritePictureThread,this,NULL, NULL); //} } } else { for (int i=0;i<m_screen_list.GetItemCount();++i) { if(m_screen_list.GetCellChecked(i,0)) { screen_list_line = i; break; } } //if(h_get_pic_thread==NULL) //{ // if(Device_Basic_Setting.reg.sd_exist) // h_get_pic_thread =CreateThread(NULL,NULL,GetPictureThread,this,NULL, NULL); //} if(h_read_screenlabel_thread==NULL) { h_read_screenlabel_thread =CreateThread(NULL,NULL,ReadScreenThreadfun,this,NULL, NULL); } *pResult = 0; return; } //m_screen_list.Set_Edit(false); int cmp_ret = memcmp(&m_temp_screen_data[lRow],&m_screen_data.at(lRow),sizeof(Control_group_point)); if(cmp_ret!=0) { m_screen_list.SetItemBkColor(lRow,lCol,LIST_ITEM_CHANGED_BKCOLOR); temp_task_info.Format(_T("Write Screen List Item%d .Changed to \"%s\" "),lRow + 1,New_CString); Post_Write_Message(g_bac_instance,WRITESCREEN_T3000,lRow,lRow,sizeof(Control_group_point),m_screen_dlg_hwnd ,temp_task_info,lRow,lCol); } *pResult = 0; }
CString CSub::ToString() { return "Run " + GetFileNameFromPath(m_NameOfFile); }
void hxc_fileselect::attempt_to_choose(int md) { EasyStr fn; if (filename_ed.text[0]=='/') { //absolute path fn=filename_ed.text; } else { if (md!=FSM_CHOOSE_FOLDER || filename_ed.text.Text[0]) { fn=DisplayDir+EasyStr("/")+filename_ed.text; } else { //mode is choose folder and text is empty fn=DisplayDir; } } Close=1; if (md!=FSM_CHOOSE_FOLDER) { if (default_extension[0] && strchr(GetFileNameFromPath(fn),'.')==NULL) { // if(md==FSM_LOAD){ if (!Exists(fn)) { fn+=default_extension; } /* }else if(md==FSM_SAVE){ if(!Exists(fn)){ fn+=default_extension; } } */ } } /* #define FSM_CONFIRMOVERWRITE 64 #define FSM_CONFIRMLOAD 128 #define FSM_MUSTEXIST 256 #define FSM_CONFIRMCREATEONLOAD 512 2=! 3=? 4=STOP 5=i */ if (md!=FSM_CHOOSE_FOLDER || fn[0]) { //okay to choose "/" for pick folder if (md==FSM_CHOOSE_FOLDER) { struct stat s; if (stat(fn,&s)==0) { if (!S_ISDIR(s.st_mode)) { //you've chosen a file which exists and isn't a directory fn=DisplayDir; //chop off the filename } } } if ((mode&FSM_LOADMUSTEXIST) && ((md==FSM_LOAD) || (md==FSM_OK) || (md==FSM_CHOOSE_FOLDER)) ) { if (!Exists(fn)) { alert.set_icons(alert.lp_big_ig,4,alert.lp_small_ig,4); EasyStr a; if(md==FSM_CHOOSE_FOLDER) { a=fn+"\n\n"+T_folder_doesnt_exist; } else { a=fn+"\n\n"+T_doesnt_exist; } alert.ask(XD,a,T_cant_find, T_okay,0,0); Close=0; } } if (Close) { if (md==FSM_LOAD) { if (mode&FSM_CONFIRMLOAD) { alert.set_icons(alert.lp_big_ig,4,alert.lp_small_ig,4); if(alert.ask(XD,T_do_you_wanna+"\n"+fn+"?",T_confirm_load, T_yes+"|"+T_no,0,1)==1) { Close=0; } } else if (mode & FSM_CONFIRMCREATE) { if(!Exists(fn)) { alert.set_icons(alert.lp_big_ig,4,alert.lp_small_ig,4); if(alert.ask(XD,fn+"\n\n"+T_create_new_question, T_confirm_create, T_yes+"|"+T_no,0,1)==1) { Close=0; } } } } else if (md==FSM_SAVE) { if (mode & FSM_CONFIRMOVERWRITE) { if (Exists(fn)) { alert.set_icons(alert.lp_big_ig,2,alert.lp_small_ig,2); if (alert.ask(XD,fn+"\n\n"+T_overwrite_it,T_confirm_overwrite, T_yes+"|"+T_no,1,1)==1) { Close=0; } } } } else if (md==FSM_CHOOSE_FOLDER) { if (mode & FSM_CONFIRMCREATE) { struct stat s; if (stat(fn,&s)) { //folder doesn't exist alert.set_icons(alert.lp_big_ig,4,alert.lp_small_ig,4); if (alert.ask(XD,fn+"\n\n"+T_create_new_folder_question, T_confirm_create, T_yes+"|"+T_no,0,1)==1) { Close=0; } else { if (mkdir(fn,S_IRWXU|S_IRWXG|S_IRWXO)) { alert.set_icons(alert.lp_big_ig,2,alert.lp_small_ig,2); alert.ask(XD,T_failed_to_create_folder, T_error, T_okay,0,0); Close=0; } } } } } } } if (Close) { chose_option=md; chose_filename=GetFileNameFromPath(fn); //(This->lv.sl)[This->lv.sel].String; chose_path=DisplayDir; DisplayDir=fn; if (mode==FSM_CHOOSE_FOLDER) fn+="/"; } }
/*********************************************************************** * * Procedure: * main - start of module * ***********************************************************************/ int main(int argc, char **argv) { char *display_name = NULL; int itemp,i; char line[100]; short opt_num; Window JunkRoot, JunkChild; int JunkX, JunkY; unsigned JunkMask; #ifdef I18N_MB setlocale(LC_CTYPE, ""); #endif /* Save our program name - for error messages */ MyName = GetFileNameFromPath(argv[0]); if(argc < 6) { fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName, VERSION); exit(1); } #ifdef HAVE_SIGACTION { struct sigaction sigact; sigemptyset(&sigact.sa_mask); sigaddset(&sigact.sa_mask, SIGPIPE); sigaddset(&sigact.sa_mask, SIGTERM); sigaddset(&sigact.sa_mask, SIGQUIT); sigaddset(&sigact.sa_mask, SIGINT); sigaddset(&sigact.sa_mask, SIGHUP); # ifdef SA_INTERRUPT sigact.sa_flags = SA_INTERRUPT; # else sigact.sa_flags = 0; # endif sigact.sa_handler = TerminateHandler; sigaction(SIGPIPE, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); sigaction(SIGQUIT, &sigact, NULL); sigaction(SIGINT, &sigact, NULL); sigaction(SIGHUP, &sigact, NULL); } #else /* We don't have sigaction(), so fall back to less robust methods. */ #ifdef USE_BSD_SIGNALS fvwmSetSignalMask( sigmask(SIGPIPE) | sigmask(SIGTERM) | sigmask(SIGQUIT) | sigmask(SIGINT) | sigmask(SIGHUP) ); #endif signal(SIGPIPE, TerminateHandler); signal(SIGTERM, TerminateHandler); signal(SIGQUIT, TerminateHandler); signal(SIGINT, TerminateHandler); signal(SIGHUP, TerminateHandler); #ifdef HAVE_SIGINTERRUPT siginterrupt(SIGPIPE, 1); siginterrupt(SIGTERM, 1); siginterrupt(SIGQUIT, 1); siginterrupt(SIGINT, 1); siginterrupt(SIGHUP, 1); #endif #endif fd[0] = atoi(argv[1]); fd[1] = atoi(argv[2]); fd_width = GetFdWidth(); opt_num = 6; if (argc >= 7 && (StrEquals(argv[opt_num], "-transient") || StrEquals(argv[opt_num], "transient"))) { opt_num++; is_transient = True; do_ignore_next_button_release = True; } /* Check for an alias */ if (argc >= opt_num + 1) { char *s; if (!StrEquals(argv[opt_num], "*")) { for (s = argv[opt_num]; *s; s++) { if (!isdigit(*s) && (*s != '-' || s != argv[opt_num] || *(s+1) == 0)) { free(MyName); MyName=safestrdup(argv[opt_num]); opt_num++; break; } } } } if (argc < opt_num + 1) { desk1 = Scr.CurrentDesk; desk2 = Scr.CurrentDesk; } else if (StrEquals(argv[opt_num], "*")) { desk1 = Scr.CurrentDesk; desk2 = Scr.CurrentDesk; fAlwaysCurrentDesk = 1; } else { desk1 = atoi(argv[opt_num]); if (argc == opt_num+1) desk2 = desk1; else desk2 = atoi(argv[opt_num+1]); if(desk2 < desk1) { itemp = desk1; desk1 = desk2; desk2 = itemp; } } ndesks = desk2 - desk1 + 1; Desks = (DeskInfo *)safemalloc(ndesks*sizeof(DeskInfo)); memset(Desks, 0, ndesks * sizeof(DeskInfo)); for(i=0;i<ndesks;i++) { sprintf(line,"Desk %d",i+desk1); CopyString(&Desks[i].label,line); Desks[i].colorset = -1; Desks[i].highcolorset = -1; Desks[i].ballooncolorset = -1; } /* Initialize X connection */ if (!(dpy = XOpenDisplay(display_name))) { fprintf(stderr,"%s: can't open display %s", MyName, XDisplayName(display_name)); exit (1); } x_fd = XConnectionNumber(dpy); InitPictureCMap(dpy); FScreenInit(dpy); AllocColorset(0); FShapeInit(dpy); Scr.screen = DefaultScreen(dpy); Scr.Root = RootWindow(dpy, Scr.screen); /* make a temp window for any pixmaps, deleted later */ initialize_viz_pager(); #ifdef DEBUG fprintf(stderr,"[main]: Connection to X server established.\n"); #endif SetMessageMask(fd, M_ADD_WINDOW| M_CONFIGURE_WINDOW| M_DESTROY_WINDOW| M_FOCUS_CHANGE| M_NEW_PAGE| M_NEW_DESK| M_RAISE_WINDOW| M_LOWER_WINDOW| M_ICONIFY| M_ICON_LOCATION| M_DEICONIFY| M_RES_NAME| M_RES_CLASS| M_WINDOW_NAME| M_ICON_NAME| M_CONFIG_INFO| M_END_CONFIG_INFO| M_MINI_ICON| M_END_WINDOWLIST| M_RESTACK); #ifdef DEBUG fprintf(stderr,"[main]: calling ParseOptions\n"); #endif ParseOptions(); if (is_transient) { XQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild, &window_x, &window_y, &JunkX, &JunkY, &JunkMask); usposition = 1; xneg = 0; yneg = 0; } #ifdef DEBUG fprintf(stderr, "[main]: back from calling ParseOptions, calling init pager\n"); #endif if (PagerFore == NULL) PagerFore = safestrdup("black"); if (PagerBack == NULL) PagerBack = safestrdup("white"); if (HilightC == NULL) HilightC = safestrdup(PagerFore); if (WindowLabelFormat == NULL) WindowLabelFormat = safestrdup("%i"); if (font_string == NULL) font_string = safestrdup("fixed"); if ((HilightC == NULL) && (HilightPixmap == NULL)) HilightDesks = 0; if (BalloonFont == NULL) BalloonFont = safestrdup("fixed"); if (BalloonBorderColor == NULL) BalloonBorderColor = safestrdup("black"); if (BalloonTypeString == NULL) BalloonTypeString = safestrdup("%i"); if (BalloonFormatString == NULL) BalloonFormatString = safestrdup("%i"); /* open a pager window */ initialize_pager(); #ifdef DEBUG fprintf(stderr,"[main]: back from init pager, getting window list\n"); #endif /* Create a list of all windows */ /* Request a list of all windows, * wait for ConfigureWindow packets */ SendInfo(fd,"Send_WindowList",0); #ifdef DEBUG fprintf(stderr,"[main]: back from getting window list, looping\n"); #endif if (is_transient) { Bool is_pointer_grabbed = False; Bool is_keyboard_grabbed = False; XSync(dpy,0); for (i = 0; i < 50 && !(is_pointer_grabbed && is_keyboard_grabbed); i++) { if (!is_pointer_grabbed && XGrabPointer( dpy, Scr.Root, True, ButtonPressMask|ButtonReleaseMask|ButtonMotionMask| PointerMotionMask|EnterWindowMask|LeaveWindowMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) == GrabSuccess) { is_pointer_grabbed = True; } if (!is_keyboard_grabbed && XGrabKeyboard( dpy, Scr.Root, True, GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess) { is_keyboard_grabbed = True; } /* If you go too fast, other windows may not get a change to release * any grab that they have. */ usleep(20000); } if (!is_pointer_grabbed) { XBell(dpy, 0); fprintf(stderr, "%s: could not grab pointer in transient mode. exiting.\n", MyName); exit(1); } XSync(dpy,0); } /* tell fvwm we're running */ SendFinishedStartupNotification(fd); Loop(fd); #ifdef DEBUG if (debug_term_signal) { fprintf(stderr,"[main]: Terminated due to signal %d\n", debug_term_signal); } #endif return 0; }
//--------------------------------------------------------------------------- int TShortcutBox::button_notify_proc(hxc_button *But,int Mess,int *Inf) { TShortcutBox *This=(TShortcutBox*)But->owner; if (Mess==BN_CLICKED){ if (But->id==9998 || But->id==9999){ if (This->CurrentCutSelType<=0) return 0; SHORTCUTINFO si; if ((But->id & 1) && CurrentCuts.NumItems){ // Copy si=CurrentCuts[CurrentCuts.NumItems-1]; if (si.MacroFileIdx>=0){ Str MacroFile=CurrentCutsStrings[si.MacroFileIdx].String; si.MacroFileIdx=CurrentCutsStrings.Add(MacroFile); } }else{ ClearSHORTCUTINFO(&si); } si.pESL=&CurrentCutsStrings; CurrentCuts.Add(si); This->AddPickerLine(CurrentCuts.NumItems-1); This->UpdateAddButsPosition(); This->sa.adjust(); This->sa.scrollto(0,CurrentCuts.NumItems*30+25-This->sa.h); This->UpdateDisableIfDownLists(); }else if (But->id<20000){ if ((But->id % 100)==5){ This->DeleteCut(But->id/100); }else if ((But->id % 100)==9){ But->set_check(true); int Num=But->id/100; int StrIdx=CurrentCuts[Num].MacroFileIdx; Str CurFile; if (StrIdx>=0) CurFile=CurrentCutsStrings[StrIdx].String; Str NewFile=This->ChooseMacro(CurFile); SetForegroundWindow(This->Handle); if (NewFile.NotEmpty()){ if (StrIdx>=0){ CurrentCutsStrings.SetString(StrIdx,NewFile); }else{ CurrentCuts[Num].MacroFileIdx=CurrentCutsStrings.Add(NewFile); } This->SetMacroFileButtonText(But,Num); } But->set_check(0); } }else if (But->id==20000){ hxc_prompt prompt; EasyStr new_name=prompt.ask(XD,T("New Shortcuts"),T("Enter Name")); if (new_name.NotEmpty()){ EasyStr new_path=GetUniquePath(This->dir_lv.fol,new_name+".stcut"); FILE *f=fopen(new_path,"wb"); if (f){ fclose(f); This->dir_lv.refresh_fol(); This->dir_lv.select_item_by_name(GetFileNameFromPath(new_path)); This->ChangeCutFile(new_path,1,true); } } }else if (But->id==20001){ fileselect.set_corner_icon(&Ico16,ICO16_FOLDER); EasyStr new_path=fileselect.choose(XD,This->CutDir,"",T("Pick a Folder"), FSM_CHOOSE_FOLDER | FSM_CONFIRMCREATE,folder_parse_routine,""); if (new_path.NotEmpty()){ NO_SLASH(new_path); This->CutDir=new_path; CutFiles.DeleteAll(); This->LoadAllCuts(); This->dir_lv.base_fol=This->CutDir; This->dir_lv.fol=This->CutDir; This->dir_lv.refresh_fol(); } } } return 0; }