Skip to content

Commit

Permalink
Merge pull request sakura-editor#1063 from beru/InsMRU
Browse files Browse the repository at this point in the history
最近使ったファイル挿入 と 最近使ったフォルダ挿入 を行う機能追加
  • Loading branch information
beru authored Sep 28, 2019
2 parents a399f5d + 07a1ad1 commit cfecf97
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 4 deletions.
2 changes: 2 additions & 0 deletions resource/MainMenu.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
2,1,30790,D,
2,1,30791,T,
2,1,30792,C,
2,1,30794,F,
2,1,30795,O,
1,0,34012,V,
2,1,30230,L,
2,1,30231,R,
Expand Down
Binary file modified resource/mytool.bmp
Binary file not shown.
2 changes: 2 additions & 0 deletions sakura_core/Funccode_x.hsrc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ F_INS_DATE = 30790, //日付挿入 なし
F_INS_TIME = 30791, //時刻挿入 なし
F_CTRL_CODE_DIALOG = 30792, //コントロールコードの入力(ダイアログ) なし
F_CTRL_CODE = 30793. //コントロールコードの入力 wchar_t code
F_INS_FILE_USED_RECENTLY = 30794, // 最近使ったファイル挿入
F_INS_FOLDER_USED_RECENTLY = 30795, // 最近使ったフォルダ挿入


// 変換系
Expand Down
2 changes: 2 additions & 0 deletions sakura_core/cmd/CViewCommander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ BOOL CViewCommander::HandleCommand(
case F_INS_TIME: Command_INS_TIME();break; //時刻挿入
case F_CTRL_CODE_DIALOG: Command_CtrlCode_Dialog();break; /* コントロールコードの入力(ダイアログ) */ //@@@ 2002.06.02 MIK
case F_CTRL_CODE: Command_WCHAR( (wchar_t)lparam1, false );break;
case F_INS_FILE_USED_RECENTLY: Command_INS_FILE_USED_RECENTLY();break; //最近使ったファイル挿入
case F_INS_FOLDER_USED_RECENTLY:Command_INS_FOLDER_USED_RECENTLY();break; //最近使ったフォルダ挿入

/* 変換 */
case F_TOLOWER: Command_TOLOWER();break; /* 小文字 */
Expand Down
4 changes: 3 additions & 1 deletion sakura_core/cmd/CViewCommander.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ class CViewCommander{
void Command_SORT(BOOL bAsc); // 2001.12.06 hor
void Command_MERGE(void); // 2001.12.06 hor
void Command_Reconvert(void); /* メニューからの再変換対応 minfu 2002.04.09 */
void Command_CtrlCode_Dialog(void); /* コントロールコードの入力(ダイアログ) */ //@@@ 2002.06.02 MIK

/* カーソル移動系 */
// Oct. 24, 2001 genta 機能拡張のため引数追加
Expand Down Expand Up @@ -236,6 +235,9 @@ class CViewCommander{
/* 挿入系 */
void Command_INS_DATE( void ); //日付挿入
void Command_INS_TIME( void ); //時刻挿入
void Command_CtrlCode_Dialog(void); /* コントロールコードの入力(ダイアログ) */ //@@@ 2002.06.02 MIK
void Command_INS_FILE_USED_RECENTLY( void ); //最近使ったファイル挿入
void Command_INS_FOLDER_USED_RECENTLY( void ); //最近使ったフォルダ挿入

/* 変換系 */
void Command_TOLOWER( void ); /* 小文字 */
Expand Down
30 changes: 30 additions & 0 deletions sakura_core/cmd/CViewCommander_Insert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "dlg/CDlgCtrlCode.h" //コントロールコードの入力(ダイアログ)
#include "env/CFormatManager.h"
#include "recent/CMRUFile.h"
#include "recent/CMRUFolder.h"

//日付挿入
void CViewCommander::Command_INS_DATE( void )
Expand Down Expand Up @@ -62,3 +64,31 @@ void CViewCommander::Command_CtrlCode_Dialog( void )
HandleCommand( F_CTRL_CODE, true, cDlgCtrlCode.GetCharCode(), 0, 0, 0 );
}
}

// 最近使ったファイル挿入
void CViewCommander::Command_INS_FILE_USED_RECENTLY( void )
{
std::wstring eol = GetDocument()->m_cDocEditor.GetNewLineCode().GetValue2();
std::wstring s;
CMRUFile cMRUFile;
auto list = cMRUFile.GetPathList();
for (auto item : list) {
s += item;
s += eol;
}
Command_INSTEXT( true, s.c_str(), (CLogicInt)s.size(), TRUE );
}

// 最近使ったフォルダ挿入
void CViewCommander::Command_INS_FOLDER_USED_RECENTLY( void )
{
std::wstring eol = GetDocument()->m_cDocEditor.GetNewLineCode().GetValue2();
std::wstring s;
CMRUFolder cMRUFolder;
auto list = cMRUFolder.GetPathList();
for (auto item : list) {
s += item;
s += eol;
}
Command_INSTEXT( true, s.c_str(), (CLogicInt)s.size(), TRUE );
}
2 changes: 2 additions & 0 deletions sakura_core/doc/CEditDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ static const EFunctionCode EIsModificationForbidden[] = {
F_INS_DATE,
F_INS_TIME,
F_CTRL_CODE_DIALOG, //@@@ 2002.06.02 MIK
F_INS_FILE_USED_RECENTLY,
F_INS_FOLDER_USED_RECENTLY,
F_TOLOWER,
F_TOUPPER,
F_TOHANKAKU,
Expand Down
4 changes: 3 additions & 1 deletion sakura_core/func/Funccode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ const int nFincList_Clip_Num = _countof( pnFuncList_Clip ); //Oct. 16, 2000 JEPR
const EFunctionCode pnFuncList_Insert[] = {
F_INS_DATE , // 日付挿入
F_INS_TIME , // 時刻挿入
F_CTRL_CODE_DIALOG //コントロールコードの入力
F_CTRL_CODE_DIALOG , // コントロールコードの入力
F_INS_FILE_USED_RECENTLY, // 最近使ったファイル挿入
F_INS_FOLDER_USED_RECENTLY, // 最近使ったフォルダ挿入
};
const int nFincList_Insert_Num = _countof( pnFuncList_Insert );

Expand Down
4 changes: 4 additions & 0 deletions sakura_core/macro/CSMacroMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ MacroFuncInfo CSMacroMgr::m_MacroFuncInfoCommandArr[] =
{F_INS_TIME, LTEXT("InsertTime"), {VT_EMPTY, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_EMPTY, NULL}, // 時刻挿入
{F_CTRL_CODE_DIALOG, LTEXT("CtrlCodeDialog"), {VT_EMPTY, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_EMPTY, NULL}, //コントロールコードの入力(ダイアログ) //@@@ 2002.06.02 MIK
{F_CTRL_CODE, LTEXT("CtrlCode"), {VT_I4, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_EMPTY, NULL}, //コントロールコードの入力 2013.12.12
{F_INS_FILE_USED_RECENTLY, LTEXT("InsertFileUsedRecently"),{VT_EMPTY, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_EMPTY, NULL}, // 最近使ったファイル挿入
{F_INS_FOLDER_USED_RECENTLY,LTEXT("InsertFolderUsedRecently"),{VT_EMPTY, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_EMPTY, NULL}, // 最近使ったフォルダ挿入

/* 変換系 */
{F_TOLOWER, LTEXT("ToLower"), {VT_EMPTY, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_EMPTY, NULL}, //小文字
Expand Down Expand Up @@ -1050,6 +1052,8 @@ BOOL CSMacroMgr::CanFuncIsKeyMacro( int nFuncID )
case F_INS_TIME :// 時刻挿入
// case F_CTRL_CODE_DIALOG ://コントロールコードの入力(ダイアログ) //@@@ 2002.06.02 MIK
case F_CTRL_CODE ://コントロールコードの入力 2013.12.12
case F_INS_FILE_USED_RECENTLY :// 最近使ったファイル挿入
case F_INS_FOLDER_USED_RECENTLY :// 最近使ったフォルダ挿入

/* 変換系 */
case F_TOLOWER ://小文字
Expand Down
2 changes: 2 additions & 0 deletions sakura_core/sakura_rc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,8 @@ BEGIN
F_INS_DATE "日付挿入"
F_INS_TIME "時刻挿入"
F_CTRL_CODE_DIALOG "コントロールコード入力..."
F_INS_FILE_USED_RECENTLY "最近使ったファイル挿入"
F_INS_FOLDER_USED_RECENTLY "最近使ったフォルダ挿入"
END

STRINGTABLE DISCARDABLE
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/uiparts/CMenuDrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ CMenuDrawer::CMenuDrawer()
/* 185 */ F_INS_DATE /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //日付挿入 //Nov. 5, 2000 JEPRO 追加
/* 186 */ F_INS_TIME /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //時刻挿入 //Nov. 5, 2000 JEPRO 追加
/* 187 */ F_CTRL_CODE_DIALOG /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //コントロールコードの入力(ダイアログ) //@@@ 2002.06.02 MIK
/* 188 */ F_DISABLE /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //ダミー
/* 189 */ F_DISABLE /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //ダミー
/* 188 */ F_INS_FILE_USED_RECENTLY /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //最近使ったファイル挿入
/* 189 */ F_INS_FOLDER_USED_RECENTLY /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //最近使ったフォルダ挿入
/* 190 */ F_DISABLE /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //ダミー
/* 191 */ F_DISABLE /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //ダミー
/* 192 */ F_DISABLE /* , TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 */, //ダミー
Expand Down
2 changes: 2 additions & 0 deletions sakura_lang_en_US/sakura_lang_rc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -2509,6 +2509,8 @@ BEGIN
F_INS_DATE "Ins. Date"
F_INS_TIME "Ins. Time"
F_CTRL_CODE_DIALOG "Control Code Input"
F_INS_FILE_USED_RECENTLY "Ins. Recently Used File"
F_INS_FOLDER_USED_RECENTLY "Ins. Recently Used Folder"
END

STRINGTABLE DISCARDABLE
Expand Down

0 comments on commit cfecf97

Please sign in to comment.