void CPPgDirectories::OnBnClickedSeltempdir() { TCHAR buffer[MAX_PATH] = {0}; GetDlgItemText(IDC_TEMPFILES, buffer, _countof(buffer)); if(SelectDir(GetSafeHwnd(),buffer,GetResString(IDS_SELECT_TEMPDIR))) GetDlgItem(IDC_TEMPFILES)->SetWindowText(buffer); }
//восстановление параметров окон void RestoreState(void) { cbreak(); keypad(menu[1],1); keypad(menu[0],1); noecho(); SelectDir(0,1,0); SelectDir(1,1,0); ClearPanel(2); curs_set(0); wrefresh(mng[0]); wrefresh(mng[1]); wrefresh(menu[0]); wrefresh(menu[1]); wrefresh(cmd); }
//стрелки лево-право переключают между панел¤ми, возврат номер панели int LeftRightHandler(int x0,int mngnum,int pos) { if(x0>0&&mngnum==0) { SelectDir(0,pos,0); SelectDir(1,1,1); return 1; } if(x0<0&&mngnum==1) { SelectDir(1,pos,0); SelectDir(0,1,1); return 0; } return mngnum; }
void CPPgDirectories::OnBnClickedSelincdir() { TCHAR buffer[MAX_PATH] = {0}; GetDlgItemText(IDC_INCFILES, buffer, ARRSIZE(buffer)); if(SelectDir(GetSafeHwnd(),buffer,GetResString(IDS_SELECT_INCOMINGDIR))) GetDlgItem(IDC_INCFILES)->SetWindowText(buffer); }
void CCatDialog::OnBnClickedBrowse() { TCHAR buffer[MAX_PATH] = {0}; GetDlgItemText(IDC_INCOMING, buffer, _countof(buffer)); if (SelectDir(GetSafeHwnd(), buffer,GetResString(IDS_SELECT_INCOMINGDIR))) GetDlgItem(IDC_INCOMING)->SetWindowText(buffer); }
void NewProjectDlg::BindSignal(){ bool res = false; res = connect(ui.ok,SIGNAL(clicked()),SLOT(accept())); assert(res); res = connect(ui.cancel,SIGNAL(clicked()),SLOT(reject())); assert(res); res = connect(ui.selectDir,SIGNAL(clicked()),SLOT(SelectDir())); assert(res); res = connect(ui.name,SIGNAL(textChanged(const QString&)), SLOT(NameChanged(const QString&))); assert(res); }
//стрелика вверх-вниз между директори¤ми, возврат номер новой позиции int UpDownHandler(int y0,int mngnum,int pos) { char ch; //обрабатываем верхнюю границу if(!(pos==1&&y0<0)) { ch=mvwinch(mng[mngnum],pos+1,1); //обрабатываем нижнюю границу if(!(y0>0&&ch==' ')) { SelectDir(mngnum,pos,0); SelectDir(mngnum,pos+y0,1); return pos+y0; } else return pos; } return pos; }
CClientExtractor::CClientExtractor(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) { ui.setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); connect(ui.selectDir, SIGNAL(clicked()), this, SLOT(SelectDir())); connect(ui.ok, SIGNAL(clicked()), this, SLOT(ExtractAll())); }
//{end} VC-dgkang void ImportUnfinishedTasks(void) { TCHAR buffer[MAX_PATH] = {0}; StringCchCopy(buffer, MAX_PATH, thePrefs.GetMuleDirectory(EMULE_INCOMINGDIR)); if(SelectDir(AfxGetMainWnd()->GetSafeHwnd(),buffer,GetResString(IDS_SEL_IMPORT_TASK_DIR), NULL, FALSE)) { CGlobalVariable::downloadqueue->ScanPartFile(CString(buffer)); } }
void CCollectionViewDialog::OnBnClickedModSelectoutputdir() { TCHAR buffer[MAX_PATH] = {0}; if (SelectDir(GetSafeHwnd(),buffer,_T("Укажите место сохранения каталога '" + m_pCollection->m_sCollectionName + _T("'")))) { SetDlgItemText(IDC_MOD_SAVEPATH, buffer); m_pCollection->m_sCollectionFolder = buffer; m_pCollection->m_sCollectionFolder.TrimRight(_T("\\")); CString temp = m_pCollection->m_sCollectionFolder +_T("\\")+ m_pCollection->m_sCollectionName; SetDlgItemText(IDC_MOD_SAVEPATH, temp); if (m_pCollection->m_sCollectionName == _T("") || temp == _T("")) GetDlgItem(IDC_VIEWCOLLECTIONDL)->EnableWindow(false); else GetDlgItem(IDC_VIEWCOLLECTIONDL)->EnableWindow(true); } }
void CPPgDirectories::OnBnClickedSeltempdiradd() { CString paths; GetDlgItemText(IDC_TEMPFILES, paths); TCHAR buffer[MAX_PATH] = {0}; //GetDlgItemText(IDC_TEMPFILES, buffer, _countof(buffer)); if(SelectDir(GetSafeHwnd(),buffer,GetResString(IDS_SELECT_TEMPDIR))) { paths.Append(_T("|")); paths.Append(buffer); SetDlgItemText(IDC_TEMPFILES, paths); } }
void CDlgAddTask::OnBnClickedBnBrowse() { // TODO: 在此添加控件通知处理程序代码 CString str; m_cmbLocation.GetWindowText(str); TCHAR buffer[MAX_PATH] = {0}; ::StringCchCopy(buffer, MAX_PATH, str); if(SelectDir(GetSafeHwnd(),buffer,GetResString(IDS_CHOOSE_SAVE_LOCATION))) { m_cmbLocation.SetWindowText(buffer); //m_cmbLocation.SetCurSel(AddLocToCmb(buffer)); UpdateFreeSpaceValue(); } }
LPCTSTR ringDir::Select(LPCTSTR lpInitDir/*=NULL*/,LPTSTR lpDir/*=NULL*/) { if(lpDir == NULL) lpDir = m_szDir; BFFCALLBACK lpfn = NULL; LPARAM lParam = 0; if(lpInitDir && *lpInitDir != '\0') { //设置初始目录 lParam = (LPARAM)lpInitDir; lpfn = (BFFCALLBACK)SelDirSpecInitProc; } if(SelectDir(lpDir,LANSTR_SELDIR,BIF_RETURNONLYFSDIRS,lpfn,lParam)) { FindClose(); return lpDir; } else return NULL; }
//***************************************************************************** // // This is the main loop that runs the application. // //***************************************************************************** int main(void) { FRESULT FileResult; tRectangle sRect; // // Initially wait for device connection. // g_eState = STATE_NO_DEVICE; // // Set the clocking to run directly from the crystal. // SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); // // Enable Clocking to the USB controller. // SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); // // Enable the peripherals used by this example. // SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); // // Set the USB pins to be controlled by the USB controller. // GPIOPinTypeUSBDigital(GPIO_PORTH_BASE, GPIO_PIN_3 | GPIO_PIN_4); // // The LM3S3748 board uses a USB mux that must be switched to use the // host connecter and not the device connecter. // GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN); GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_HOST); // // Turn on USB Phy clock. // SysCtlUSBPLLEnable(); // // Set the system tick to fire 100 times per second. // SysTickPeriodSet(SysCtlClockGet()/100); SysTickIntEnable(); SysTickEnable(); // // Enable the uDMA controller and set up the control table base. // SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); uDMAEnable(); uDMAControlBaseSet(g_sDMAControlTable); // // Initialize the display driver. // Formike128x128x16Init(); // // Turn on the backlight. // Formike128x128x16BacklightOn(); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sFormike128x128x16); // // Fill the top 15 rows of the screen with blue to create the banner. // sRect.sXMin = 0; sRect.sYMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMax = SPLASH_HEIGHT - 1; GrContextForegroundSet(&g_sContext, ClrDarkBlue); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, ClrWhite); GrRectDraw(&g_sContext, &sRect); // // Put the application name in the middle of the banner. // GrContextFontSet(&g_sContext, &g_sFontFixed6x8); GrStringDrawCentered(&g_sContext, "usb_host_msc", -1, GrContextDpyWidthGet(&g_sContext) / 2, 7, 0); // // Set the color to white and select the 20 point font. // GrContextForegroundSet(&g_sContext, FILE_COLOR); GrStringDraw(&g_sContext, "No Device", 100, 0, TOP_HEIGHT, 1); // // Register the host class drivers. // USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ulNumHostClassDrivers); // // Open an instance of the mass storage class driver. // g_ulMSCInstance = USBHMSCDriveOpen(0, MSCCallback); // // Initialize the power configuration. This sets the power enable signal // to be active high and does not enable the power fault. // USBHCDPowerConfigInit(0, USB_HOST_PWREN_HIGH); // // Initialize the host controller. // USBHCDInit(0, g_pHCDPool, HCD_MEMORY_SIZE); // // Initialize the pushbuttons. // ButtonsInit(); // // Set the auto repeat rates for the up and down buttons. // ButtonsSetAutoRepeat(UP_BUTTON, 50, 15); ButtonsSetAutoRepeat(DOWN_BUTTON, 50, 15); // // Current directory is "/" // g_DirData.szPWD[0] = '/'; g_DirData.szPWD[1] = 0; // // Initialize the file system. // FileInit(); while(1) { USBHCDMain(); switch(g_eState) { case STATE_DEVICE_ENUM: { // // Reset the root directory. // g_DirData.szPWD[0] = '/'; g_DirData.szPWD[1] = 0; // // Open the root directory. // FileResult = f_opendir(&g_DirData.DirState, g_DirData.szPWD); // // Wait for the root directory to open successfully. The MSC // device can enumerate before being read to be accessed, so // there may be some delay before it is ready. // if(FileResult == FR_OK) { // // Reset the directory state. // g_DirData.ulIndex = 0; g_DirData.ulSelectIndex = 0; g_DirData.ulValidValues = 0; g_eState = STATE_DEVICE_READY; // // Ignore buttons pressed before being ready. // g_ulButtons = 0; // // Update the screen if the root dir opened successfully. // DirUpdate(); UpdateWindow(); } else if(FileResult != FR_NOT_READY) { // some kind of error } // // Set the Device Present flag. // g_ulFlags = FLAGS_DEVICE_PRESENT; break; } // // This is the running state where buttons are checked and the // screen is updated. // case STATE_DEVICE_READY: { // // Down button pressed and released. // if(g_ulButtons & BUTTON_DOWN_CLICK) { // // Update the screen and directory state. // MoveDown(); // // Clear the button pressed event. // g_ulButtons &= ~BUTTON_DOWN_CLICK; } // // Up button pressed and released. // if(g_ulButtons & BUTTON_UP_CLICK) { // // Update the screen and directory state. // MoveUp(); // // Clear the button pressed event. // g_ulButtons &= ~BUTTON_UP_CLICK; } // // Select button pressed and released. // if(g_ulButtons & BUTTON_SELECT_CLICK) { // // If this was a directory go into it. // SelectDir(); // // Clear the button pressed event. // g_ulButtons &= ~BUTTON_SELECT_CLICK; } break; } // // If there is no device then just wait for one. // case STATE_NO_DEVICE: { if(g_ulFlags == FLAGS_DEVICE_PRESENT) { // // Clear the screen and indicate that there is no longer // a device present. // ClearTextBox(); GrStringDraw(&g_sContext, "No Device", 100, 0, TOP_HEIGHT, 1); // // Clear the Device Present flag. // g_ulFlags &= ~FLAGS_DEVICE_PRESENT; } break; } // // An unknown device was connected. // case STATE_UNKNOWN_DEVICE: { // // If this is a new device then change the status. // if((g_ulFlags & FLAGS_DEVICE_PRESENT) == 0) { // // Clear the screen and indicate that an unknown device is // present. // ClearTextBox(); GrStringDraw(&g_sContext, "Unknown Device", 100, 0, TOP_HEIGHT, 1); } // // Set the Device Present flag. // g_ulFlags = FLAGS_DEVICE_PRESENT; break; } // // Something has caused a power fault. // case STATE_POWER_FAULT: { break; } default: { break; } } } }
BOOL CMuleToolbarCtrl::OnCommand(WPARAM wParam, LPARAM /*lParam*/) { switch (wParam) { case MP_SELECTTOOLBARBITMAPDIR:{ TCHAR buffer[MAX_PATH]; _sntprintf(buffer, _countof(buffer), _T("%s"), thePrefs.GetMuleDirectory(EMULE_TOOLBARDIR)); buffer[_countof(buffer) - 1] = _T('\0'); if(SelectDir(m_hWnd, buffer, GetResString(IDS_SELECTTOOLBARBITMAPDIR))) thePrefs.SetMuleDirectory(EMULE_TOOLBARDIR, buffer); break; } case MP_CUSTOMIZETOOLBAR: Customize(); break; case MP_SELECTTOOLBARBITMAP: { // we could also load "*.jpg" here, but because of the typical non solid background of JPGs this // doesn't make sense here. CString strFilter=GetResString(IDS_LOADFILTER_EMTOOLBAR)+ _T(" ("); for (int f = 0; f < _countof(s_apszTBFiles); f++){ if (f > 0) strFilter += _T(';'); strFilter += s_apszTBFiles[f]; } strFilter += _T(")|"); for (int f = 0; f < _countof(s_apszTBFiles); f++){ if (f > 0) strFilter += _T(';'); strFilter += s_apszTBFiles[f]; } strFilter += _T("||"); CFileDialog dialog(TRUE, EMULTB_BASEEXT _T(".bmp"), NULL, OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST, strFilter, NULL, 0); if (IDOK == dialog.DoModal()) if(thePrefs.GetToolbarBitmapSettings()!=dialog.GetPathName()) { ChangeToolbarBitmap(dialog.GetPathName(), true); thePrefs.SetToolbarBitmapSettings(dialog.GetPathName()); } break; } case MP_LARGEICONS: m_sizBtnBmp.cx = m_sizBtnBmp.cy = 32; ForceRecalcLayout(); ChangeToolbarBitmap(thePrefs.GetToolbarBitmapSettings(), true); thePrefs.SetToolbarIconSize(m_sizBtnBmp); break; case MP_SMALLICONS: m_sizBtnBmp.cx = m_sizBtnBmp.cy = 16; ForceRecalcLayout(); ChangeToolbarBitmap(thePrefs.GetToolbarBitmapSettings(), true); thePrefs.SetToolbarIconSize(m_sizBtnBmp); break; case MP_NOTEXTLABELS: ForceRecalcLayout(); ChangeTextLabelStyle(NoLabels, true); thePrefs.SetToolbarLabelSettings(NoLabels); break; case MP_TEXTLABELS: ForceRecalcLayout(); ChangeTextLabelStyle(LabelsBelow, true); thePrefs.SetToolbarLabelSettings(LabelsBelow); break; case MP_TEXTLABELSONRIGHT: ForceRecalcLayout(); ChangeTextLabelStyle(LabelsRight, true); thePrefs.SetToolbarLabelSettings(LabelsRight); break; case MP_SELECT_SKIN_DIR:{ TCHAR buffer[MAX_PATH]; _sntprintf(buffer, _countof(buffer), _T("%s"), thePrefs.GetMuleDirectory(EMULE_SKINDIR, false)); buffer[_countof(buffer) - 1] = _T('\0'); if(SelectDir(m_hWnd, buffer, GetResString(IDS_SELSKINPROFILEDIR))) thePrefs.SetMuleDirectory(EMULE_SKINDIR, buffer); break; } case MP_SELECT_SKIN_FILE: { CString strFilter=GetResString(IDS_LOADFILTER_EMSKINFILES) + _T(" ("); for (int f = 0; f < _countof(s_apszSkinFiles); f++){ if (f > 0) strFilter += _T(';'); strFilter += s_apszSkinFiles[f]; } strFilter += _T(")|"); for (int f = 0; f < _countof(s_apszSkinFiles); f++){ if (f > 0) strFilter += _T(';'); strFilter += s_apszSkinFiles[f]; } strFilter += _T("||"); CFileDialog dialog(TRUE, EMULSKIN_BASEEXT _T(".ini"), NULL, OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST, strFilter, NULL, 0); if (dialog.DoModal() == IDOK) { if (thePrefs.GetSkinProfile().CompareNoCase(dialog.GetPathName()) != 0) theApp.ApplySkin(dialog.GetPathName()); } break; } default: if (wParam >= MP_TOOLBARBITMAP && wParam < MP_TOOLBARBITMAP + MAX_TOOLBAR_FILES) { if (thePrefs.GetToolbarBitmapSettings().CompareNoCase(m_astrToolbarPaths[wParam-MP_TOOLBARBITMAP]) != 0) { ChangeToolbarBitmap(m_astrToolbarPaths[wParam-MP_TOOLBARBITMAP], true); thePrefs.SetToolbarBitmapSettings(m_astrToolbarPaths[wParam-MP_TOOLBARBITMAP]); } } else if (wParam >= MP_SKIN_PROFILE && wParam < MP_SKIN_PROFILE + MAX_SKIN_FILES) { if (thePrefs.GetSkinProfile().CompareNoCase(m_astrSkinPaths[wParam - MP_SKIN_PROFILE]) != 0) theApp.ApplySkin(m_astrSkinPaths[wParam - MP_SKIN_PROFILE]); } } return true; }
/* メッセージ処理 */ INT_PTR CPropBackup::DispatchEvent( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { WORD wNotifyCode; WORD wID; NMHDR* pNMHDR; NM_UPDOWN* pMNUD; int idCtrl; // int nVal; int nVal; //Sept.21, 2000 JEPRO スピン要素を加えたので復活させた // int nDummy; // int nCharChars; switch( uMsg ){ case WM_INITDIALOG: /* ダイアログデータの設定 Backup */ SetData( hwndDlg ); // Modified by KEITA for WIN64 2003.9.6 ::SetWindowLongPtr( hwndDlg, DWLP_USER, lParam ); /* ユーザーがエディット コントロールに入力できるテキストの長さを制限する */ // Oct. 5, 2002 genta バックアップフォルダ名の入力サイズを指定 // Oct. 8, 2002 genta 最後に付加される\の領域を残すためバッファサイズ-1しか入力させない EditCtl_LimitText( ::GetDlgItem( hwndDlg, IDC_EDIT_BACKUPFOLDER ), _countof2(m_Common.m_sBackup.m_szBackUpFolder) - 1 - 1 ); // 20051107 aroka EditCtl_LimitText( ::GetDlgItem( hwndDlg, IDC_EDIT_BACKUPFILE ), _countof2(m_Common.m_sBackup.m_szBackUpPathAdvanced) - 1 - 1 ); return TRUE; case WM_NOTIFY: idCtrl = (int)wParam; pNMHDR = (NMHDR*)lParam; pMNUD = (NM_UPDOWN*)lParam; switch( idCtrl ){ default: switch( pNMHDR->code ){ case PSN_HELP: OnHelp( hwndDlg, IDD_PROP_BACKUP ); return TRUE; case PSN_KILLACTIVE: /* ダイアログデータの取得 Backup */ GetData( hwndDlg ); return TRUE; //@@@ 2002.01.03 YAZAKI 最後に表示していたシートを正しく覚えていないバグ修正 case PSN_SETACTIVE: m_nPageNum = ID_PROPCOM_PAGENUM_BACKUP; return TRUE; } break; case IDC_SPIN_BACKUP_GENS: /* バックアップファイルの世代数 */ nVal = ::GetDlgItemInt( hwndDlg, IDC_EDIT_BACKUP_3, NULL, FALSE ); if( pMNUD->iDelta < 0 ){ ++nVal; }else if( pMNUD->iDelta > 0 ){ --nVal; } if( nVal < 1 ){ nVal = 1; } if( nVal > 99 ){ nVal = 99; } ::SetDlgItemInt( hwndDlg, IDC_EDIT_BACKUP_3, nVal, FALSE ); return TRUE; } //**** To Here Sept. 21, 2000 JEPRO ダイアログ要素にスピンを入れるので以下のWM_NOTIFYをコメントアウトにし下に修正を置いた break; case WM_COMMAND: wNotifyCode = HIWORD(wParam); /* 通知コード */ wID = LOWORD(wParam); /* 項目ID、 コントロールID、 またはアクセラレータID */ switch( wNotifyCode ){ /* ボタン/チェックボックスがクリックされた */ case BN_CLICKED: switch( wID ){ case IDC_RADIO_BACKUP_TYPE1: // Aug. 16, 2000 genta // バックアップ方式追加 case IDC_RADIO_BACKUP_TYPE3: case IDC_CHECK_BACKUP: case IDC_CHECK_BACKUPFOLDER: // Aug. 21, 2000 genta case IDC_CHECK_AUTOSAVE: // Jun. 5, 2004 genta IDC_RADIO_BACKUP_TYPE2を廃止して, // IDC_RADIO_BACKUP_DATETYPE1, IDC_RADIO_BACKUP_DATETYPE2を同列に持ってきた case IDC_RADIO_BACKUP_DATETYPE1: case IDC_RADIO_BACKUP_DATETYPE2: // 20051107 aroka case IDC_CHECK_BACKUP_ADVANCED: GetData( hwndDlg ); UpdateBackupFile( hwndDlg ); EnableBackupInput(hwndDlg); return TRUE; case IDC_BUTTON_BACKUP_FOLDER_REF: /* フォルダ参照 */ { /* バックアップを作成するフォルダ */ TCHAR szFolder[_MAX_PATH]; ::DlgItem_GetText( hwndDlg, IDC_EDIT_BACKUPFOLDER, szFolder, _countof( szFolder )); if( SelectDir( hwndDlg, LS(STR_PROPCOMBK_SEL_FOLDER), szFolder, szFolder ) ){ _tcscpy( m_Common.m_sBackup.m_szBackUpFolder, szFolder ); ::DlgItem_SetText( hwndDlg, IDC_EDIT_BACKUPFOLDER, m_Common.m_sBackup.m_szBackUpFolder ); } UpdateBackupFile( hwndDlg ); } return TRUE; default: // 20051107 aroka Default節 追加 GetData( hwndDlg ); UpdateBackupFile( hwndDlg ); } break; /* BN_CLICKED */ case EN_CHANGE: // 20051107 aroka フォルダが変更されたらリアルタイムにエディットボックス内を更新 switch( wID ){ case IDC_EDIT_BACKUPFOLDER: // 2009.02.21 ryoji 後ろに\が追加されるので,1文字余裕をみる必要がある. ::DlgItem_GetText( hwndDlg, IDC_EDIT_BACKUPFOLDER, m_Common.m_sBackup.m_szBackUpFolder, _countof2(m_Common.m_sBackup.m_szBackUpFolder) - 1 ); UpdateBackupFile( hwndDlg ); break; } break; /* EN_CHANGE */ } break; /* WM_COMMAND */ //@@@ 2001.02.04 Start by MIK: Popup Help case WM_HELP: { HELPINFO *p = (HELPINFO *)lParam; MyWinHelp( (HWND)p->hItemHandle, HELP_WM_HELP, (ULONG_PTR)(LPVOID)p_helpids ); // 2006.10.10 ryoji MyWinHelpに変更に変更 } return TRUE; /*NOTREACHED*/ //break; //@@@ 2001.02.04 End //@@@ 2001.12.22 Start by MIK: Context Menu Help //Context Menu case WM_CONTEXTMENU: MyWinHelp( hwndDlg, HELP_CONTEXTMENU, (ULONG_PTR)(LPVOID)p_helpids ); // 2006.10.10 ryoji MyWinHelpに変更に変更 return TRUE; //@@@ 2001.12.22 End } return FALSE; }
BOOL CDlgGrep::OnBnClicked( int wID ) { switch( wID ){ case IDC_BUTTON_HELP: /* 「Grep」のヘルプ */ //Stonee, 2001/03/12 第四引数を、機能番号からヘルプトピック番号を調べるようにした MyWinHelp( GetHwnd(), HELP_CONTEXT, ::FuncID_To_HelpContextID(F_GREP_DIALOG) ); // 2006.10.10 ryoji MyWinHelpに変更に変更 return TRUE; case IDC_CHK_FROMTHISTEXT: /* この編集中のテキストから検索する */ // 2010.05.30 関数化 SetDataFromThisText( 0 != ::IsDlgButtonChecked( GetHwnd(), IDC_CHK_FROMTHISTEXT ) ); return TRUE; case IDC_BUTTON_CURRENTFOLDER: /* 現在編集中のファイルのフォルダ */ /* ファイルを開いているか */ if( m_szCurrentFilePath[0] != _T('\0') ){ TCHAR szWorkFolder[MAX_PATH]; TCHAR szWorkFile[MAX_PATH]; SplitPath_FolderAndFile( m_szCurrentFilePath, szWorkFolder, szWorkFile ); SetGrepFolder( GetItemHwnd(IDC_COMBO_FOLDER), szWorkFolder ); } else{ /* 現在のプロセスのカレントディレクトリを取得します */ TCHAR szWorkFolder[MAX_PATH]; ::GetCurrentDirectory( _countof( szWorkFolder ) - 1, szWorkFolder ); SetGrepFolder( GetItemHwnd(IDC_COMBO_FOLDER), szWorkFolder ); } return TRUE; case IDC_BUTTON_FOLDER_UP: { HWND hwnd = GetItemHwnd( IDC_COMBO_FOLDER ); TCHAR szFolder[_MAX_PATH]; ::GetWindowText( hwnd, szFolder, _countof(szFolder) ); std::vector<std::tstring> vPaths; CGrepAgent::CreateFolders( szFolder, vPaths ); if( 0 < vPaths.size() ){ // 最後のパスが操作対象 auto_strncpy( szFolder, vPaths.rbegin()->c_str(), _MAX_PATH ); szFolder[_MAX_PATH-1] = _T('\0'); if( DirectoryUp( szFolder ) ){ *(vPaths.rbegin()) = szFolder; szFolder[0] = _T('\0'); for( int i = 0 ; i < (int)vPaths.size(); i++ ){ TCHAR szFolderItem[_MAX_PATH]; auto_strncpy( szFolderItem, vPaths[i].c_str(), _MAX_PATH ); szFolderItem[_MAX_PATH-1] = _T('\0'); if( auto_strchr( szFolderItem, _T(';') ) ){ szFolderItem[0] = _T('"'); auto_strncpy( szFolderItem + 1, vPaths[i].c_str(), _MAX_PATH - 1 ); szFolderItem[_MAX_PATH-1] = _T('\0'); auto_strcat( szFolderItem, _T("\"") ); szFolderItem[_MAX_PATH-1] = _T('\0'); } if( i ){ auto_strcat( szFolder, _T(";") ); szFolder[_MAX_PATH-1] = _T('\0'); } auto_strcat_s( szFolder, _MAX_PATH, szFolderItem ); } ::SetWindowText( hwnd, szFolder ); } } } return TRUE; // case IDC_CHK_LOHICASE: /* 英大文字と英小文字を区別する */ // MYTRACE( _T("IDC_CHK_LOHICASE\n") ); // return TRUE; case IDC_CHK_REGULAREXP: /* 正規表現 */ // MYTRACE( _T("IDC_CHK_REGULAREXP ::IsDlgButtonChecked( GetHwnd(), IDC_CHK_REGULAREXP ) = %d\n"), ::IsDlgButtonChecked( GetHwnd(), IDC_CHK_REGULAREXP ) ); if( ::IsDlgButtonChecked( GetHwnd(), IDC_CHK_REGULAREXP ) ){ // From Here Jun. 26, 2001 genta // 正規表現ライブラリの差し替えに伴う処理の見直し if( !CheckRegexpVersion( GetHwnd(), IDC_STATIC_JRE32VER, true ) ){ ::CheckDlgButton( GetHwnd(), IDC_CHK_REGULAREXP, 0 ); }else{ // To Here Jun. 26, 2001 genta /* 英大文字と英小文字を区別する */ // 正規表現のときも選択できるように。 // ::CheckDlgButton( GetHwnd(), IDC_CHK_LOHICASE, 1 ); // ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHK_LOHICASE ), FALSE ); //2001/06/23 N.Nakatani /* 単語単位で検索 */ ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHK_WORD ), FALSE ); } }else{ /* 英大文字と英小文字を区別する */ // 正規表現のときも選択できるように。 // ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHK_LOHICASE ), TRUE ); // ::CheckDlgButton( GetHwnd(), IDC_CHK_LOHICASE, 0 ); //2001/06/23 N.Nakatani //単語単位のgrepが実装されたらコメントを外すと思います //2002/03/07実装してみた。 /* 単語単位で検索 */ ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHK_WORD ), TRUE ); } return TRUE; case IDC_BUTTON_FOLDER: /* フォルダ参照ボタン */ { TCHAR szFolder[MAX_PATH]; /* 検索フォルダ */ ::DlgItem_GetText( GetHwnd(), IDC_COMBO_FOLDER, szFolder, _MAX_PATH - 1 ); if( szFolder[0] == _T('\0') ){ ::GetCurrentDirectory( _countof( szFolder ), szFolder ); } if( SelectDir( GetHwnd(), LS(STR_DLGGREP1), szFolder, szFolder ) ){ SetGrepFolder( GetItemHwnd(IDC_COMBO_FOLDER), szFolder ); } } return TRUE; case IDC_CHECK_CP: { if( IsDlgButtonChecked( GetHwnd(), IDC_CHECK_CP ) ){ ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHECK_CP ), FALSE ); HWND combo = ::GetDlgItem( GetHwnd(), IDC_COMBO_CHARSET ); CCodePage::AddComboCodePages(GetHwnd(), combo, -1); } } return TRUE; case IDC_CHK_DEFAULTFOLDER: /* フォルダの初期値をカレントフォルダにする */ { m_pShareData->m_Common.m_sSearch.m_bGrepDefaultFolder = ::IsDlgButtonChecked( GetHwnd(), IDC_CHK_DEFAULTFOLDER ); } return TRUE; case IDC_RADIO_OUTPUTSTYLE3: { ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHECK_BASE_PATH ), FALSE ); ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHECK_SEP_FOLDER ),FALSE ); } break; case IDC_RADIO_OUTPUTSTYLE1: case IDC_RADIO_OUTPUTSTYLE2: { ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHECK_BASE_PATH ), TRUE ); ::EnableWindow( ::GetDlgItem( GetHwnd(), IDC_CHECK_SEP_FOLDER ),TRUE ); } break; case IDOK: /* ダイアログデータの取得 */ if( GetData() ){ // ::EndDialog( hwndDlg, TRUE ); CloseDialog( TRUE ); } return TRUE; case IDCANCEL: // ::EndDialog( hwndDlg, FALSE ); CloseDialog( FALSE ); return TRUE; } /* 基底クラスメンバ */ return CDialog::OnBnClicked( wID ); }