diff --git a/sakura_core/String_define.h b/sakura_core/String_define.h index e878572890..2dae5536f6 100644 --- a/sakura_core/String_define.h +++ b/sakura_core/String_define.h @@ -219,6 +219,7 @@ #define STR_DLGFAV_MENU_DEL_INVALID 34158 #define STR_DLGFAV_MENU_DEL_SEL 34159 #define STR_DLGFAV_LIST_LIMIT_OVER 34160 +#define STR_DLGFAV_FAV_COUNT_LIMIT 35047 #define STR_ERR_DLGUPQRY1 34161 #define STR_ERR_DLGUPQRY2 34162 diff --git a/sakura_core/config/system_constants.h b/sakura_core/config/system_constants.h index bd62f5f85d..b73946a663 100644 --- a/sakura_core/config/system_constants.h +++ b/sakura_core/config/system_constants.h @@ -550,12 +550,15 @@ Version 177: WriteQuit廃止に伴い未使用となった IniFolder のメンバを削除した為、DLLSHAREDATA のメモリレイアウトを変更 + Version 178: + 各履歴のお気に入り + -- 統合されたので元に戻す(1000~1023が使用済み) 2008.11.16 nasukoji -- Version 1000: -- バージョン1000以降を本家統合までの間、使わせてください。かなり頻繁に構成が変更されると思われるので。by kobake 2008.03.02 */ -#define N_SHAREDATA_VERSION 177 +#define N_SHAREDATA_VERSION 178 #define STR_SHAREDATA_VERSION NUM_TO_STR(N_SHAREDATA_VERSION) #define GSTR_SHAREDATA (L"SakuraShareData" _T(CON_SKR_MACHINE_SUFFIX_) _T(_CODE_SUFFIX_) _T(_DEBUG_SUFFIX_) _T(STR_SHAREDATA_VERSION)) diff --git a/sakura_core/dlg/CDialog.cpp b/sakura_core/dlg/CDialog.cpp index 58002e9072..3b257e1f5d 100644 --- a/sakura_core/dlg/CDialog.cpp +++ b/sakura_core/dlg/CDialog.cpp @@ -757,11 +757,16 @@ static void DeleteRecentItem( return; } + int nRecentIndex = pRecent->FindItemByText( cItemText.GetStringPtr() ); + // お気に入りチェック + if( pRecent->IsFavorite(nRecentIndex) ){ + return; + } + // コンボボックスのリストアイテム削除 Combo_DeleteString( hwndCombo, nIndex ); // 履歴項目を削除 - int nRecentIndex = pRecent->FindItemByText( cItemText.GetStringPtr() ); if( 0 <= nRecentIndex ){ pRecent->DeleteItem(nRecentIndex); } diff --git a/sakura_core/dlg/CDlgFavorite.cpp b/sakura_core/dlg/CDlgFavorite.cpp index 6c4604cd2d..70f2838053 100644 --- a/sakura_core/dlg/CDlgFavorite.cpp +++ b/sakura_core/dlg/CDlgFavorite.cpp @@ -89,6 +89,9 @@ static int FormatFavoriteColumn( WCHAR*, int, int , bool ); static int ListView_GetLParamInt( HWND, int ); static int CALLBACK CompareListViewFunc( LPARAM, LPARAM, LPARAM ); +const int nFavoriteLimitOffset = 5; +const int ignoreTab = 3; + struct CompareListViewLParam { int nSortColumn; @@ -156,7 +159,7 @@ CDlgFavorite::CDlgFavorite() m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_SEARCH ); m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str(); m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_SEARCH; - m_aFavoriteInfo[i].m_bHaveFavorite = false; + m_aFavoriteInfo[i].m_bHaveFavorite = true; m_aFavoriteInfo[i].m_bFilePath = false; m_aFavoriteInfo[i].m_bHaveView = false; m_aFavoriteInfo[i].m_bEditable = true; @@ -167,7 +170,7 @@ CDlgFavorite::CDlgFavorite() m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_REPLACE ); m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str(); m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_REPLACE; - m_aFavoriteInfo[i].m_bHaveFavorite = false; + m_aFavoriteInfo[i].m_bHaveFavorite = true; m_aFavoriteInfo[i].m_bFilePath = false; m_aFavoriteInfo[i].m_bHaveView = false; m_aFavoriteInfo[i].m_bEditable = true; @@ -178,7 +181,7 @@ CDlgFavorite::CDlgFavorite() m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_GREP_FILE ); m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str(); m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_GREP_FILE; - m_aFavoriteInfo[i].m_bHaveFavorite = false; + m_aFavoriteInfo[i].m_bHaveFavorite = true; m_aFavoriteInfo[i].m_bFilePath = false; m_aFavoriteInfo[i].m_bHaveView = false; m_aFavoriteInfo[i].m_bEditable = true; @@ -189,7 +192,7 @@ CDlgFavorite::CDlgFavorite() m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_GREP_FOLDER ); m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str(); m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_GREP_FOLDER; - m_aFavoriteInfo[i].m_bHaveFavorite = false; + m_aFavoriteInfo[i].m_bHaveFavorite = true; m_aFavoriteInfo[i].m_bFilePath = true; m_aFavoriteInfo[i].m_bHaveView = false; m_aFavoriteInfo[i].m_bEditable = false; @@ -200,7 +203,7 @@ CDlgFavorite::CDlgFavorite() m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_EXT_COMMAND ); m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str(); m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_CMD; - m_aFavoriteInfo[i].m_bHaveFavorite = false; + m_aFavoriteInfo[i].m_bHaveFavorite = true; m_aFavoriteInfo[i].m_bFilePath = false; m_aFavoriteInfo[i].m_bHaveView = false; m_aFavoriteInfo[i].m_bEditable = true; @@ -211,7 +214,7 @@ CDlgFavorite::CDlgFavorite() m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_CURRENT_DIR ); m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str(); m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_CUR_DIR; - m_aFavoriteInfo[i].m_bHaveFavorite = false; + m_aFavoriteInfo[i].m_bHaveFavorite = true; m_aFavoriteInfo[i].m_bFilePath = true; m_aFavoriteInfo[i].m_bHaveView = false; m_aFavoriteInfo[i].m_bEditable = false; @@ -625,8 +628,32 @@ BOOL CDlgFavorite::OnNotify(NMHDR* pNMHDR) switch(pNMHDR->code ) { case NM_DBLCLK: - EditItem(); - return TRUE; + { + LVHITTESTINFO lvht = { 0 }; + ::GetCursorPos( &lvht.pt); + ::ScreenToClient( hwndList, &lvht.pt ); + ListView_HitTest( hwndList, &lvht ); + //IsGreaterThanMax + if( lvht.flags & LVHT_ONITEMSTATEICON && !( lvht.flags & LVHT_ONITEMLABEL ) && IsGreaterThanOrEqualMax( m_nCurrentTab )){ + ListView_SetCheckState( hwndList, (int)lvht.iItem, true ); + } + if( lvht.flags & LVHT_ONITEMLABEL ){ + EditItem(); + } + } + return true; + case NM_CLICK: + { + LVHITTESTINFO lvht = { 0 }; + ::GetCursorPos( &lvht.pt ); + ::ScreenToClient( hwndList, &lvht.pt ); + ListView_HitTest( hwndList, &lvht ); + //IsGreaterThanMax + if( lvht.flags & LVHT_ONITEMSTATEICON && !( lvht.flags & LVHT_ONITEMLABEL ) && IsGreaterThanOrEqualMax( m_nCurrentTab )){ + ListView_SetCheckState( hwndList, (int)lvht.iItem, true ); + } + } + return true; case NM_RCLICK: { POINT po; @@ -651,6 +678,20 @@ BOOL CDlgFavorite::OnNotify(NMHDR* pNMHDR) case VK_DELETE: DeleteSelected(); return TRUE; + case VK_SPACE: + { + //IsGreaterThanMax + if( IsGreaterThanOrEqualMax( m_nCurrentTab )){ + auto nCount = ListView_GetItemCount( hwndList ); + for( int i = 0; i < nCount; i++ ){ + if( ListView_GetItemState( hwndList, i, LVIS_FOCUSED )){ + ListView_SetCheckState( hwndList, i, true ); + break; + } + } + } + } + return TRUE; case VK_APPS: { POINT po; @@ -843,6 +884,30 @@ void CDlgFavorite::GetFavorite( int nIndex ) } } +bool CDlgFavorite::IsGreaterThanOrEqualMax( int nTab ) +{ + if( nTab < ignoreTab ){ + return false; + } + const HWND hwndList = m_aListViewInfo[nTab].hListView; + const int nCount = ListView_GetItemCount(hwndList); + CRecent* const pRecent = m_aFavoriteInfo[nTab].m_pRecent; + const int nMax = pRecent->GetArrayCount() - nFavoriteLimitOffset; + if( nCount < nMax ){ + return false; + } + int nFavoriteCount = 0; + for( int i = 0; i < nCount; i++ ){ + if( ListView_GetCheckState( hwndList, i )){ + nFavoriteCount++; + if( nFavoriteCount >= nMax ){ + return true; + } + } + } + return false; +} + /* 選択中の項目を削除 リストの更新もする diff --git a/sakura_core/dlg/CDlgFavorite.h b/sakura_core/dlg/CDlgFavorite.h index b2508a0087..790ae4e725 100644 --- a/sakura_core/dlg/CDlgFavorite.h +++ b/sakura_core/dlg/CDlgFavorite.h @@ -86,6 +86,7 @@ class CDlgFavorite final : public CDialog void UpdateUIState(); void GetFavorite( int nIndex ); + bool IsGreaterThanOrEqualMax( int nTab ); int DeleteSelected(); void AddItem(); void EditItem(); diff --git a/sakura_core/env/CSearchKeywordManager.h b/sakura_core/env/CSearchKeywordManager.h index 4e9fc62c81..1e9a5addda 100644 --- a/sakura_core/env/CSearchKeywordManager.h +++ b/sakura_core/env/CSearchKeywordManager.h @@ -34,9 +34,13 @@ struct SShare_SearchKeywords{ // -- -- 検索キー -- -- // StaticVector< StaticString, MAX_SEARCHKEY, const WCHAR*> m_aSearchKeys; + bool m_aSearchKeysFav[MAX_SEARCHKEY]; StaticVector< StaticString, MAX_REPLACEKEY, const WCHAR*> m_aReplaceKeys; + bool m_aReplaceKeysFav[MAX_REPLACEKEY]; StaticVector< StaticString, MAX_GREPFILE, const WCHAR*> m_aGrepFiles; + bool m_aGrepFilesFav[MAX_GREPFILE]; StaticVector< StaticString, MAX_GREPFOLDER, const WCHAR*> m_aGrepFolders; + bool m_aGrepFoldersFav[MAX_GREPFOLDER]; StaticVector< StaticString, MAX_EXCLUDEFILE, const WCHAR*> m_aExcludeFiles; StaticVector< StaticString, MAX_EXCLUDEFOLDER, const WCHAR*> m_aExcludeFolders; }; diff --git a/sakura_core/env/CShareData.cpp b/sakura_core/env/CShareData.cpp index 6b0329b2fb..9d97ac769a 100644 --- a/sakura_core/env/CShareData.cpp +++ b/sakura_core/env/CShareData.cpp @@ -694,6 +694,7 @@ bool CShareData::InitShareData() } { + SShare_SearchKeywords& sKeys = m_pShareData->m_sSearchKeywords; m_pShareData->m_sSearchKeywords.m_aSearchKeys.clear(); m_pShareData->m_sSearchKeywords.m_aReplaceKeys.clear(); m_pShareData->m_sSearchKeywords.m_aGrepFiles.clear(); @@ -714,6 +715,7 @@ bool CShareData::InitShareData() wcscpy( m_pShareData->m_sHistory.m_szIMPORTFOLDER, szIniFolder ); /* 設定インポート用フォルダー */ + SShare_History& sHis = m_pShareData->m_sHistory; m_pShareData->m_sHistory.m_aCommands.clear(); m_pShareData->m_sHistory.m_aCurDirs.clear(); diff --git a/sakura_core/env/CShareData_IO.cpp b/sakura_core/env/CShareData_IO.cpp index 2481ee42ee..9fe7da6f3b 100644 --- a/sakura_core/env/CShareData_IO.cpp +++ b/sakura_core/env/CShareData_IO.cpp @@ -311,6 +311,10 @@ void CShareData_IO::ShareData_IO_Keys( CDataProfile& cProfile ) for( i = 0; i < nSize; ++i ){ auto_sprintf( szKeyName, LTEXT("SEARCHKEY[%02d]"), i ); cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aSearchKeys[i] ); + if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aSearchKeysFav[i] ){ + auto_sprintf( szKeyName, LTEXT("SEARCHKEY[%02d].Fav"), i ); + cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aSearchKeysFav[i] ); + } } cProfile.IOProfileData( pszSecName, LTEXT("_REPLACEKEY_Counts"), pShare->m_sSearchKeywords.m_aReplaceKeys._GetSizeRef() ); @@ -319,6 +323,10 @@ void CShareData_IO::ShareData_IO_Keys( CDataProfile& cProfile ) for( i = 0; i < nSize; ++i ){ auto_sprintf( szKeyName, LTEXT("REPLACEKEY[%02d]"), i ); cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aReplaceKeys[i] ); + if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aReplaceKeysFav[i] ){ + auto_sprintf( szKeyName, LTEXT("REPLACEKEY[%02d].Fav"), i ); + cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aReplaceKeysFav[i] ); + } } } @@ -343,6 +351,10 @@ void CShareData_IO::ShareData_IO_Grep( CDataProfile& cProfile ) for( i = 0; i < nSize; ++i ){ auto_sprintf( szKeyName, LTEXT("GREPFILE[%02d]"), i ); cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFiles[i] ); + if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aGrepFilesFav[i] ){ + auto_sprintf( szKeyName, LTEXT("GREPFILE[%02d].Fav"), i ); + cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFilesFav[i] ); + } } cProfile.IOProfileData( pszSecName, LTEXT("_GREPFOLDER_Counts"), pShare->m_sSearchKeywords.m_aGrepFolders._GetSizeRef() ); @@ -351,6 +363,10 @@ void CShareData_IO::ShareData_IO_Grep( CDataProfile& cProfile ) for( i = 0; i < nSize; ++i ){ auto_sprintf( szKeyName, LTEXT("GREPFOLDER[%02d]"), i ); cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFolders[i] ); + if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aGrepFoldersFav[i] ){ + auto_sprintf( szKeyName, LTEXT("GREPFOLDER[%02d].Fav"), i ); + cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFoldersFav[i] ); + } } /* 除外ファイルパターン */ @@ -409,6 +425,10 @@ void CShareData_IO::ShareData_IO_Cmd( CDataProfile& cProfile ) for( i = 0; i < nSize; ++i ){ auto_sprintf( szKeyName, LTEXT("szCmdArr[%02d]"), i ); cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCommands[i] ); + if( cProfile.IsReadingMode() || pShare->m_sHistory.m_aCommandsFav[i] ){ + auto_sprintf( szKeyName, LTEXT("szCmdArr[%02d].Fav"), i ); + cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCommandsFav[i] ); + } } cProfile.IOProfileData( pszSecName, LTEXT("nCurDirArrNum"), pShare->m_sHistory.m_aCurDirs._GetSizeRef() ); @@ -417,6 +437,10 @@ void CShareData_IO::ShareData_IO_Cmd( CDataProfile& cProfile ) for( i = 0; i < nSize; ++i ){ auto_sprintf( szKeyName, LTEXT("szCurDirArr[%02d]"), i ); cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCurDirs[i] ); + if( cProfile.IsReadingMode() || pShare->m_sHistory.m_aCurDirsFav[i] ){ + auto_sprintf( szKeyName, LTEXT("szCurDirArr[%02d].Fav"), i ); + cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCurDirsFav[i] ); + } } } diff --git a/sakura_core/recent/CRecentCmd.cpp b/sakura_core/recent/CRecentCmd.cpp index 76d33d2550..fe1e56664b 100644 --- a/sakura_core/recent/CRecentCmd.cpp +++ b/sakura_core/recent/CRecentCmd.cpp @@ -37,7 +37,7 @@ CRecentCmd::CRecentCmd() GetShareData()->m_sHistory.m_aCommands.dataPtr(), GetShareData()->m_sHistory.m_aCommands.dataPtr()->GetBufferCount(), &GetShareData()->m_sHistory.m_aCommands._GetSizeRef(), - NULL, + GetShareData()->m_sHistory.m_aCommandsFav, MAX_CMDARR, NULL ); diff --git a/sakura_core/recent/CRecentCurDir.cpp b/sakura_core/recent/CRecentCurDir.cpp index d51a3b0cae..392488100f 100644 --- a/sakura_core/recent/CRecentCurDir.cpp +++ b/sakura_core/recent/CRecentCurDir.cpp @@ -38,7 +38,7 @@ CRecentCurDir::CRecentCurDir() GetShareData()->m_sHistory.m_aCurDirs.dataPtr(), GetShareData()->m_sHistory.m_aCurDirs.dataPtr()->GetBufferCount(), &GetShareData()->m_sHistory.m_aCurDirs._GetSizeRef(), - NULL, + GetShareData()->m_sHistory.m_aCurDirsFav, MAX_CMDARR, NULL ); diff --git a/sakura_core/recent/CRecentGrepFile.cpp b/sakura_core/recent/CRecentGrepFile.cpp index 134dad8391..748dc2cd29 100644 --- a/sakura_core/recent/CRecentGrepFile.cpp +++ b/sakura_core/recent/CRecentGrepFile.cpp @@ -37,7 +37,7 @@ CRecentGrepFile::CRecentGrepFile() GetShareData()->m_sSearchKeywords.m_aGrepFiles.dataPtr(), GetShareData()->m_sSearchKeywords.m_aGrepFiles.dataPtr()->GetBufferCount(), &GetShareData()->m_sSearchKeywords.m_aGrepFiles._GetSizeRef(), - NULL, + GetShareData()->m_sSearchKeywords.m_aGrepFilesFav, MAX_GREPFILE, NULL ); diff --git a/sakura_core/recent/CRecentGrepFolder.cpp b/sakura_core/recent/CRecentGrepFolder.cpp index b11060fa93..0ead26b487 100644 --- a/sakura_core/recent/CRecentGrepFolder.cpp +++ b/sakura_core/recent/CRecentGrepFolder.cpp @@ -37,7 +37,7 @@ CRecentGrepFolder::CRecentGrepFolder() GetShareData()->m_sSearchKeywords.m_aGrepFolders.dataPtr(), GetShareData()->m_sSearchKeywords.m_aGrepFolders.dataPtr()->GetBufferCount(), &GetShareData()->m_sSearchKeywords.m_aGrepFolders._GetSizeRef(), - NULL, + GetShareData()->m_sSearchKeywords.m_aGrepFoldersFav, MAX_GREPFOLDER, NULL ); diff --git a/sakura_core/recent/CRecentReplace.cpp b/sakura_core/recent/CRecentReplace.cpp index a96255edf4..cc57556fd6 100644 --- a/sakura_core/recent/CRecentReplace.cpp +++ b/sakura_core/recent/CRecentReplace.cpp @@ -38,7 +38,7 @@ CRecentReplace::CRecentReplace() GetShareData()->m_sSearchKeywords.m_aReplaceKeys.dataPtr(), GetShareData()->m_sSearchKeywords.m_aReplaceKeys.dataPtr()->GetBufferCount(), &GetShareData()->m_sSearchKeywords.m_aReplaceKeys._GetSizeRef(), - NULL, + GetShareData()->m_sSearchKeywords.m_aReplaceKeysFav, MAX_REPLACEKEY, NULL ); diff --git a/sakura_core/recent/CRecentSearch.cpp b/sakura_core/recent/CRecentSearch.cpp index 8b2defa263..d39b031cd8 100644 --- a/sakura_core/recent/CRecentSearch.cpp +++ b/sakura_core/recent/CRecentSearch.cpp @@ -38,7 +38,7 @@ CRecentSearch::CRecentSearch() GetShareData()->m_sSearchKeywords.m_aSearchKeys.dataPtr(), GetShareData()->m_sSearchKeywords.m_aSearchKeys.dataPtr()->GetBufferCount(), &GetShareData()->m_sSearchKeywords.m_aSearchKeys._GetSizeRef(), - NULL, + GetShareData()->m_sSearchKeywords.m_aSearchKeysFav, MAX_SEARCHKEY, NULL ); diff --git a/sakura_core/recent/SShare_History.h b/sakura_core/recent/SShare_History.h index 7ce9b8a954..372756a3a8 100644 --- a/sakura_core/recent/SShare_History.h +++ b/sakura_core/recent/SShare_History.h @@ -47,7 +47,10 @@ struct SShare_History{ //MRU以外の情報 SFilePath m_szIMPORTFOLDER; // インポートディレクトリの履歴 StaticVector< StaticString, MAX_CMDARR > m_aCommands; // 外部コマンド実行履歴 + bool m_aCommandsFav[MAX_CMDARR]; //!< 外部コマンド実行お気に入り StaticVector< StaticString, MAX_CMDARR > m_aCurDirs; // カレントディレクトリ履歴 + bool m_aCurDirsFav[MAX_CMDARR]; //!< カレントディレクトリお気に入り + }; #endif /* SAKURA_SSHARE_HISTORY_9F7E6200_FEE2_4CAC_A5D3_32EEC4130CFC_H_ */