Skip to content

Commit 2072ee9

Browse files
authored
Merge e642bca into b7538a1
2 parents b7538a1 + e642bca commit 2072ee9

15 files changed

+124
-16
lines changed

sakura_core/String_define.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@
219219
#define STR_DLGFAV_MENU_DEL_INVALID 34158
220220
#define STR_DLGFAV_MENU_DEL_SEL 34159
221221
#define STR_DLGFAV_LIST_LIMIT_OVER 34160
222+
#define STR_DLGFAV_FAV_COUNT_LIMIT 35047
222223

223224
#define STR_ERR_DLGUPQRY1 34161
224225
#define STR_ERR_DLGUPQRY2 34162

sakura_core/config/system_constants.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,12 +550,15 @@
550550
Version 177:
551551
WriteQuit廃止に伴い未使用となった IniFolder のメンバを削除した為、DLLSHAREDATA のメモリレイアウトを変更
552552
553+
Version 178:
554+
各履歴のお気に入り
555+
553556
-- 統合されたので元に戻す(1000~1023が使用済み) 2008.11.16 nasukoji
554557
-- Version 1000:
555558
-- バージョン1000以降を本家統合までの間、使わせてください。かなり頻繁に構成が変更されると思われるので。by kobake 2008.03.02
556559
557560
*/
558-
#define N_SHAREDATA_VERSION 177
561+
#define N_SHAREDATA_VERSION 178
559562
#define STR_SHAREDATA_VERSION NUM_TO_STR(N_SHAREDATA_VERSION)
560563
#define GSTR_SHAREDATA (L"SakuraShareData" _T(CON_SKR_MACHINE_SUFFIX_) _T(_CODE_SUFFIX_) _T(_DEBUG_SUFFIX_) _T(STR_SHAREDATA_VERSION))
561564

sakura_core/dlg/CDialog.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,11 +757,16 @@ static void DeleteRecentItem(
757757
return;
758758
}
759759

760+
int nRecentIndex = pRecent->FindItemByText( cItemText.GetStringPtr() );
761+
// お気に入りチェック
762+
if( pRecent->IsFavorite(nRecentIndex) ){
763+
return;
764+
}
765+
760766
// コンボボックスのリストアイテム削除
761767
Combo_DeleteString( hwndCombo, nIndex );
762768

763769
// 履歴項目を削除
764-
int nRecentIndex = pRecent->FindItemByText( cItemText.GetStringPtr() );
765770
if( 0 <= nRecentIndex ){
766771
pRecent->DeleteItem(nRecentIndex);
767772
}

sakura_core/dlg/CDlgFavorite.cpp

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ static int FormatFavoriteColumn( WCHAR*, int, int , bool );
8989
static int ListView_GetLParamInt( HWND, int );
9090
static int CALLBACK CompareListViewFunc( LPARAM, LPARAM, LPARAM );
9191

92+
const int nFavoriteLimitOffset = 5;
93+
const int ignoreTab = 3;
94+
9295
struct CompareListViewLParam
9396
{
9497
int nSortColumn;
@@ -156,7 +159,7 @@ CDlgFavorite::CDlgFavorite()
156159
m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_SEARCH );
157160
m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str();
158161
m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_SEARCH;
159-
m_aFavoriteInfo[i].m_bHaveFavorite = false;
162+
m_aFavoriteInfo[i].m_bHaveFavorite = true;
160163
m_aFavoriteInfo[i].m_bFilePath = false;
161164
m_aFavoriteInfo[i].m_bHaveView = false;
162165
m_aFavoriteInfo[i].m_bEditable = true;
@@ -167,7 +170,7 @@ CDlgFavorite::CDlgFavorite()
167170
m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_REPLACE );
168171
m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str();
169172
m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_REPLACE;
170-
m_aFavoriteInfo[i].m_bHaveFavorite = false;
173+
m_aFavoriteInfo[i].m_bHaveFavorite = true;
171174
m_aFavoriteInfo[i].m_bFilePath = false;
172175
m_aFavoriteInfo[i].m_bHaveView = false;
173176
m_aFavoriteInfo[i].m_bEditable = true;
@@ -178,7 +181,7 @@ CDlgFavorite::CDlgFavorite()
178181
m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_GREP_FILE );
179182
m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str();
180183
m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_GREP_FILE;
181-
m_aFavoriteInfo[i].m_bHaveFavorite = false;
184+
m_aFavoriteInfo[i].m_bHaveFavorite = true;
182185
m_aFavoriteInfo[i].m_bFilePath = false;
183186
m_aFavoriteInfo[i].m_bHaveView = false;
184187
m_aFavoriteInfo[i].m_bEditable = true;
@@ -189,7 +192,7 @@ CDlgFavorite::CDlgFavorite()
189192
m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_GREP_FOLDER );
190193
m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str();
191194
m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_GREP_FOLDER;
192-
m_aFavoriteInfo[i].m_bHaveFavorite = false;
195+
m_aFavoriteInfo[i].m_bHaveFavorite = true;
193196
m_aFavoriteInfo[i].m_bFilePath = true;
194197
m_aFavoriteInfo[i].m_bHaveView = false;
195198
m_aFavoriteInfo[i].m_bEditable = false;
@@ -200,7 +203,7 @@ CDlgFavorite::CDlgFavorite()
200203
m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_EXT_COMMAND );
201204
m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str();
202205
m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_CMD;
203-
m_aFavoriteInfo[i].m_bHaveFavorite = false;
206+
m_aFavoriteInfo[i].m_bHaveFavorite = true;
204207
m_aFavoriteInfo[i].m_bFilePath = false;
205208
m_aFavoriteInfo[i].m_bHaveView = false;
206209
m_aFavoriteInfo[i].m_bEditable = true;
@@ -211,7 +214,7 @@ CDlgFavorite::CDlgFavorite()
211214
m_aFavoriteInfo[i].m_strCaption = LS( STR_DLGFAV_CURRENT_DIR );
212215
m_aFavoriteInfo[i].m_pszCaption = m_aFavoriteInfo[i].m_strCaption.c_str();
213216
m_aFavoriteInfo[i].m_nId = IDC_LIST_FAVORITE_CUR_DIR;
214-
m_aFavoriteInfo[i].m_bHaveFavorite = false;
217+
m_aFavoriteInfo[i].m_bHaveFavorite = true;
215218
m_aFavoriteInfo[i].m_bFilePath = true;
216219
m_aFavoriteInfo[i].m_bHaveView = false;
217220
m_aFavoriteInfo[i].m_bEditable = false;
@@ -625,8 +628,32 @@ BOOL CDlgFavorite::OnNotify(NMHDR* pNMHDR)
625628
switch(pNMHDR->code )
626629
{
627630
case NM_DBLCLK:
628-
EditItem();
629-
return TRUE;
631+
{
632+
LVHITTESTINFO lvht = { 0 };
633+
::GetCursorPos( &lvht.pt);
634+
::ScreenToClient( hwndList, &lvht.pt );
635+
ListView_HitTest( hwndList, &lvht );
636+
//IsGreaterThanMax
637+
if( lvht.flags & LVHT_ONITEMSTATEICON && !( lvht.flags & LVHT_ONITEMLABEL ) && IsGreaterThanOrEqualMax( m_nCurrentTab )){
638+
ListView_SetCheckState( hwndList, (int)lvht.iItem, true );
639+
}
640+
if( lvht.flags & LVHT_ONITEMLABEL ){
641+
EditItem();
642+
}
643+
}
644+
return true;
645+
case NM_CLICK:
646+
{
647+
LVHITTESTINFO lvht = { 0 };
648+
::GetCursorPos( &lvht.pt );
649+
::ScreenToClient( hwndList, &lvht.pt );
650+
ListView_HitTest( hwndList, &lvht );
651+
//IsGreaterThanMax
652+
if( lvht.flags & LVHT_ONITEMSTATEICON && !( lvht.flags & LVHT_ONITEMLABEL ) && IsGreaterThanOrEqualMax( m_nCurrentTab )){
653+
ListView_SetCheckState( hwndList, (int)lvht.iItem, true );
654+
}
655+
}
656+
return true;
630657
case NM_RCLICK:
631658
{
632659
POINT po;
@@ -651,6 +678,20 @@ BOOL CDlgFavorite::OnNotify(NMHDR* pNMHDR)
651678
case VK_DELETE:
652679
DeleteSelected();
653680
return TRUE;
681+
case VK_SPACE:
682+
{
683+
//IsGreaterThanMax
684+
if( IsGreaterThanOrEqualMax( m_nCurrentTab )){
685+
auto nCount = ListView_GetItemCount( hwndList );
686+
for( int i = 0; i < nCount; i++ ){
687+
if( ListView_GetItemState( hwndList, i, LVIS_FOCUSED )){
688+
ListView_SetCheckState( hwndList, i, true );
689+
break;
690+
}
691+
}
692+
}
693+
}
694+
return TRUE;
654695
case VK_APPS:
655696
{
656697
POINT po;
@@ -843,6 +884,30 @@ void CDlgFavorite::GetFavorite( int nIndex )
843884
}
844885
}
845886

887+
bool CDlgFavorite::IsGreaterThanOrEqualMax( int nTab )
888+
{
889+
if( nTab < ignoreTab ){
890+
return false;
891+
}
892+
const HWND hwndList = m_aListViewInfo[nTab].hListView;
893+
const int nCount = ListView_GetItemCount(hwndList);
894+
CRecent* const pRecent = m_aFavoriteInfo[nTab].m_pRecent;
895+
const int nMax = pRecent->GetArrayCount() - nFavoriteLimitOffset;
896+
if( nCount < nMax ){
897+
return false;
898+
}
899+
int nFavoriteCount = 0;
900+
for( int i = 0; i < nCount; i++ ){
901+
if( ListView_GetCheckState( hwndList, i )){
902+
nFavoriteCount++;
903+
if( nFavoriteCount >= nMax ){
904+
return true;
905+
}
906+
}
907+
}
908+
return false;
909+
}
910+
846911
/*
847912
選択中の項目を削除
848913
リストの更新もする

sakura_core/dlg/CDlgFavorite.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class CDlgFavorite final : public CDialog
8686
void UpdateUIState();
8787

8888
void GetFavorite( int nIndex );
89+
bool IsGreaterThanOrEqualMax( int nTab );
8990
int DeleteSelected();
9091
void AddItem();
9192
void EditItem();

sakura_core/env/CSearchKeywordManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@
3434
struct SShare_SearchKeywords{
3535
// -- -- 検索キー -- -- //
3636
StaticVector< StaticString<WCHAR, _MAX_PATH>, MAX_SEARCHKEY, const WCHAR*> m_aSearchKeys;
37+
bool m_aSearchKeysFav[MAX_SEARCHKEY];
3738
StaticVector< StaticString<WCHAR, _MAX_PATH>, MAX_REPLACEKEY, const WCHAR*> m_aReplaceKeys;
39+
bool m_aReplaceKeysFav[MAX_REPLACEKEY];
3840
StaticVector< StaticString<WCHAR, MAX_GREP_PATH>, MAX_GREPFILE, const WCHAR*> m_aGrepFiles;
41+
bool m_aGrepFilesFav[MAX_GREPFILE];
3942
StaticVector< StaticString<WCHAR, MAX_GREP_PATH>, MAX_GREPFOLDER, const WCHAR*> m_aGrepFolders;
43+
bool m_aGrepFoldersFav[MAX_GREPFOLDER];
4044
StaticVector< StaticString<WCHAR, MAX_EXCLUDE_PATH>, MAX_EXCLUDEFILE, const WCHAR*> m_aExcludeFiles;
4145
StaticVector< StaticString<WCHAR, MAX_EXCLUDE_PATH>, MAX_EXCLUDEFOLDER, const WCHAR*> m_aExcludeFolders;
4246
};

sakura_core/env/CShareData.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ bool CShareData::InitShareData()
694694
}
695695

696696
{
697+
SShare_SearchKeywords& sKeys = m_pShareData->m_sSearchKeywords;
697698
m_pShareData->m_sSearchKeywords.m_aSearchKeys.clear();
698699
m_pShareData->m_sSearchKeywords.m_aReplaceKeys.clear();
699700
m_pShareData->m_sSearchKeywords.m_aGrepFiles.clear();
@@ -714,6 +715,7 @@ bool CShareData::InitShareData()
714715

715716
wcscpy( m_pShareData->m_sHistory.m_szIMPORTFOLDER, szIniFolder ); /* 設定インポート用フォルダー */
716717

718+
SShare_History& sHis = m_pShareData->m_sHistory;
717719
m_pShareData->m_sHistory.m_aCommands.clear();
718720
m_pShareData->m_sHistory.m_aCurDirs.clear();
719721

sakura_core/env/CShareData_IO.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ void CShareData_IO::ShareData_IO_Keys( CDataProfile& cProfile )
311311
for( i = 0; i < nSize; ++i ){
312312
auto_sprintf( szKeyName, LTEXT("SEARCHKEY[%02d]"), i );
313313
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aSearchKeys[i] );
314+
if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aSearchKeysFav[i] ){
315+
auto_sprintf( szKeyName, LTEXT("SEARCHKEY[%02d].Fav"), i );
316+
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aSearchKeysFav[i] );
317+
}
314318
}
315319

316320
cProfile.IOProfileData( pszSecName, LTEXT("_REPLACEKEY_Counts"), pShare->m_sSearchKeywords.m_aReplaceKeys._GetSizeRef() );
@@ -319,6 +323,10 @@ void CShareData_IO::ShareData_IO_Keys( CDataProfile& cProfile )
319323
for( i = 0; i < nSize; ++i ){
320324
auto_sprintf( szKeyName, LTEXT("REPLACEKEY[%02d]"), i );
321325
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aReplaceKeys[i] );
326+
if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aReplaceKeysFav[i] ){
327+
auto_sprintf( szKeyName, LTEXT("REPLACEKEY[%02d].Fav"), i );
328+
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aReplaceKeysFav[i] );
329+
}
322330
}
323331
}
324332

@@ -343,6 +351,10 @@ void CShareData_IO::ShareData_IO_Grep( CDataProfile& cProfile )
343351
for( i = 0; i < nSize; ++i ){
344352
auto_sprintf( szKeyName, LTEXT("GREPFILE[%02d]"), i );
345353
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFiles[i] );
354+
if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aGrepFilesFav[i] ){
355+
auto_sprintf( szKeyName, LTEXT("GREPFILE[%02d].Fav"), i );
356+
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFilesFav[i] );
357+
}
346358
}
347359

348360
cProfile.IOProfileData( pszSecName, LTEXT("_GREPFOLDER_Counts"), pShare->m_sSearchKeywords.m_aGrepFolders._GetSizeRef() );
@@ -351,6 +363,10 @@ void CShareData_IO::ShareData_IO_Grep( CDataProfile& cProfile )
351363
for( i = 0; i < nSize; ++i ){
352364
auto_sprintf( szKeyName, LTEXT("GREPFOLDER[%02d]"), i );
353365
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFolders[i] );
366+
if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aGrepFoldersFav[i] ){
367+
auto_sprintf( szKeyName, LTEXT("GREPFOLDER[%02d].Fav"), i );
368+
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFoldersFav[i] );
369+
}
354370
}
355371

356372
/* 除外ファイルパターン */
@@ -409,6 +425,10 @@ void CShareData_IO::ShareData_IO_Cmd( CDataProfile& cProfile )
409425
for( i = 0; i < nSize; ++i ){
410426
auto_sprintf( szKeyName, LTEXT("szCmdArr[%02d]"), i );
411427
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCommands[i] );
428+
if( cProfile.IsReadingMode() || pShare->m_sHistory.m_aCommandsFav[i] ){
429+
auto_sprintf( szKeyName, LTEXT("szCmdArr[%02d].Fav"), i );
430+
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCommandsFav[i] );
431+
}
412432
}
413433

414434
cProfile.IOProfileData( pszSecName, LTEXT("nCurDirArrNum"), pShare->m_sHistory.m_aCurDirs._GetSizeRef() );
@@ -417,6 +437,10 @@ void CShareData_IO::ShareData_IO_Cmd( CDataProfile& cProfile )
417437
for( i = 0; i < nSize; ++i ){
418438
auto_sprintf( szKeyName, LTEXT("szCurDirArr[%02d]"), i );
419439
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCurDirs[i] );
440+
if( cProfile.IsReadingMode() || pShare->m_sHistory.m_aCurDirsFav[i] ){
441+
auto_sprintf( szKeyName, LTEXT("szCurDirArr[%02d].Fav"), i );
442+
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCurDirsFav[i] );
443+
}
420444
}
421445
}
422446

sakura_core/recent/CRecentCmd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ CRecentCmd::CRecentCmd()
3737
GetShareData()->m_sHistory.m_aCommands.dataPtr(),
3838
GetShareData()->m_sHistory.m_aCommands.dataPtr()->GetBufferCount(),
3939
&GetShareData()->m_sHistory.m_aCommands._GetSizeRef(),
40-
NULL,
40+
GetShareData()->m_sHistory.m_aCommandsFav,
4141
MAX_CMDARR,
4242
NULL
4343
);

sakura_core/recent/CRecentCurDir.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ CRecentCurDir::CRecentCurDir()
3838
GetShareData()->m_sHistory.m_aCurDirs.dataPtr(),
3939
GetShareData()->m_sHistory.m_aCurDirs.dataPtr()->GetBufferCount(),
4040
&GetShareData()->m_sHistory.m_aCurDirs._GetSizeRef(),
41-
NULL,
41+
GetShareData()->m_sHistory.m_aCurDirsFav,
4242
MAX_CMDARR,
4343
NULL
4444
);

0 commit comments

Comments
 (0)