Skip to content

Commit

Permalink
・ダークモード対応
Browse files Browse the repository at this point in the history
・HSP関連実装
  • Loading branch information
inovia authored and inovia committed Aug 27, 2023
1 parent 9a01c8b commit de6f646
Show file tree
Hide file tree
Showing 102 changed files with 5,848 additions and 185 deletions.
10 changes: 10 additions & 0 deletions sakura/sakura.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@
<ClInclude Include="..\sakura_core\dlg\CDlgFind.h" />
<ClInclude Include="..\sakura_core\dlg\CDlgGrep.h" />
<ClInclude Include="..\sakura_core\dlg\CDlgGrepReplace.h" />
<ClInclude Include="..\sakura_core\dlg\CDlgHspInput2.h" />
<ClInclude Include="..\sakura_core\dlg\CDlgHspReports.h" />
<ClInclude Include="..\sakura_core\dlg\CDlgInput1.h" />
<ClInclude Include="..\sakura_core\dlg\CDlgJump.h" />
<ClInclude Include="..\sakura_core\dlg\CDlgOpenFile.h" />
Expand Down Expand Up @@ -337,9 +339,13 @@
<ClInclude Include="..\sakura_core\func\Funccode.h" />
<ClInclude Include="..\sakura_core\GrepInfo.h" />
<ClInclude Include="..\sakura_core\hsp\CHsp3.h" />
<ClInclude Include="..\sakura_core\hsp\CHsp3DarkMode.h" />
<ClInclude Include="..\sakura_core\hsp\CHsp3Dll.h" />
<ClInclude Include="..\sakura_core\hsp\CHsp3Font.h" />
<ClInclude Include="..\sakura_core\hsp\CHsp3Interface.h" />
<ClInclude Include="..\sakura_core\hsp\PolyHook\IatHook.h" />
<ClInclude Include="..\sakura_core\hsp\win32-custom-menubar-aero-theme\UAHMenuBar.h" />
<ClInclude Include="..\sakura_core\hsp\win32-darkmode\DarkMode.h" />
<ClInclude Include="..\sakura_core\io\CBinaryStream.h" />
<ClInclude Include="..\sakura_core\io\CFile.h" />
<ClInclude Include="..\sakura_core\io\CFileLoad.h" />
Expand Down Expand Up @@ -644,6 +650,8 @@
<ClCompile Include="..\sakura_core\dlg\CDlgFind.cpp" />
<ClCompile Include="..\sakura_core\dlg\CDlgGrep.cpp" />
<ClCompile Include="..\sakura_core\dlg\CDlgGrepReplace.cpp" />
<ClCompile Include="..\sakura_core\dlg\CDlgHspInput2.cpp" />
<ClCompile Include="..\sakura_core\dlg\CDlgHspReports.cpp" />
<ClCompile Include="..\sakura_core\dlg\CDlgInput1.cpp" />
<ClCompile Include="..\sakura_core\dlg\CDlgJump.cpp" />
<ClCompile Include="..\sakura_core\dlg\CDlgOpenFile.cpp" />
Expand Down Expand Up @@ -711,9 +719,11 @@
<ClCompile Include="..\sakura_core\func\Funccode.cpp" />
<ClCompile Include="..\sakura_core\GrepInfo.cpp" />
<ClCompile Include="..\sakura_core\hsp\CHsp3.cpp" />
<ClCompile Include="..\sakura_core\hsp\CHsp3DarkMode.cpp" />
<ClCompile Include="..\sakura_core\hsp\CHsp3Dll.cpp" />
<ClCompile Include="..\sakura_core\hsp\CHsp3Font.cpp" />
<ClCompile Include="..\sakura_core\hsp\CHsp3Interface.cpp" />
<ClCompile Include="..\sakura_core\hsp\win32-custom-menubar-aero-theme\UAHMenuBar.cpp" />
<ClCompile Include="..\sakura_core\io\CBinaryStream.cpp" />
<ClCompile Include="..\sakura_core\io\CFile.cpp" />
<ClCompile Include="..\sakura_core\io\CFileLoad.cpp" />
Expand Down
39 changes: 39 additions & 0 deletions sakura/sakura.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@
<Filter Include="Cpp Source Files\hsp\res">
<UniqueIdentifier>{345d9ea9-f70c-45d7-98ac-49bee2343a35}</UniqueIdentifier>
</Filter>
<Filter Include="Cpp Source Files\hsp\win32-custom-menubar-aero-theme">
<UniqueIdentifier>{31e0ace4-26f5-4d61-8edc-f4023189b2bb}</UniqueIdentifier>
</Filter>
<Filter Include="Cpp Source Files\hsp\PolyHook">
<UniqueIdentifier>{cb17b5bf-fc8f-4c9e-98a1-dbf6869f9400}</UniqueIdentifier>
</Filter>
<Filter Include="Cpp Source Files\hsp\win32-darkmode">
<UniqueIdentifier>{e6bca8fa-5318-40bc-b258-2358542a5c63}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\sakura_core\Funccode_define.h">
Expand Down Expand Up @@ -1133,6 +1142,24 @@
<ClInclude Include="..\sakura_core\hsp\CHsp3Font.h">
<Filter>Cpp Source Files\hsp</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\hsp\CHsp3DarkMode.h">
<Filter>Cpp Source Files\hsp</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\hsp\win32-custom-menubar-aero-theme\UAHMenuBar.h">
<Filter>Cpp Source Files\hsp\win32-custom-menubar-aero-theme</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\hsp\PolyHook\IatHook.h">
<Filter>Cpp Source Files\hsp\PolyHook</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\hsp\win32-darkmode\DarkMode.h">
<Filter>Cpp Source Files\hsp\win32-darkmode</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\dlg\CDlgHspReports.h">
<Filter>Cpp Source Files\dlg</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\dlg\CDlgHspInput2.h">
<Filter>Cpp Source Files\dlg</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\resource\auto_scroll_center.cur">
Expand Down Expand Up @@ -2354,6 +2381,18 @@
<ClCompile Include="..\sakura_core\hsp\CHsp3Font.cpp">
<Filter>Cpp Source Files\hsp</Filter>
</ClCompile>
<ClCompile Include="..\sakura_core\hsp\CHsp3DarkMode.cpp">
<Filter>Cpp Source Files\hsp</Filter>
</ClCompile>
<ClCompile Include="..\sakura_core\hsp\win32-custom-menubar-aero-theme\UAHMenuBar.cpp">
<Filter>Cpp Source Files\hsp\win32-custom-menubar-aero-theme</Filter>
</ClCompile>
<ClCompile Include="..\sakura_core\dlg\CDlgHspReports.cpp">
<Filter>Cpp Source Files\dlg</Filter>
</ClCompile>
<ClCompile Include="..\sakura_core\dlg\CDlgHspInput2.cpp">
<Filter>Cpp Source Files\dlg</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\resource\auto_scroll_center.bmp">
Expand Down
28 changes: 28 additions & 0 deletions sakura_core/CHokanMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "plugin/CComplementIfObj.h"
#include "util/input.h"
#include "util/os.h"
#include "hsp/CHsp3DarkMode.h"
#include "apiwrap/StdApi.h"
#include "apiwrap/StdControl.h"
#include "sakura_rc.h"
Expand Down Expand Up @@ -447,13 +448,40 @@ INT_PTR CHokanMgr::DispatchEvent( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lP
pmmi->ptMinTrackSize.x = ::GetSystemMetrics(SM_CXVSCROLL) * 4;
pmmi->ptMinTrackSize.y = ::GetSystemMetrics(SM_CYHSCROLL) * 4;
break;


case WM_CTLCOLORLISTBOX:

// ダークモード
auto& DarkMode = CHsp3DarkMode::GetInstance();
if ( DarkMode.IsSystemUseDarkMode())
{
SetBkColor((HDC)wParam, DarkMode.GetSysColor(COLOR_BTNFACE));
SetTextColor((HDC)wParam, DarkMode.GetSysColor(COLOR_BTNTEXT));
return (LRESULT)DarkMode.GetSysColorBrush(COLOR_BTNFACE);
}
break;
}
return result;
}

BOOL CHokanMgr::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
{
_SetHwnd( hwndDlg );

// ダークモード
const auto& DarkMode = CHsp3DarkMode::GetInstance();
HWND hwndList = GetItemHwnd(IDC_LIST_WORDS);
if (hwndList)
{
// コントロールをダークモードに変更する
if (DarkMode.IsSystemUseDarkMode())
{
DarkMode.AllowDarkModeForWindow(hwndList, true);
::SetWindowTheme(hwndList, L"DarkMode_Explorer", nullptr);
}
}

/* 基底クラスメンバ */
//- CreateSizeBox();
return CDialog::OnInitDialog( hwndDlg, wParam, lParam );
Expand Down
10 changes: 8 additions & 2 deletions sakura_core/String_define.h
Original file line number Diff line number Diff line change
Expand Up @@ -1329,5 +1329,11 @@

#define STR_ERR_DLGFUNCLKUP20 35048
#define F_HSP_TOPMENU 35049

// Now using max number 35048 by STR_ERR_DLGFUNCLKUP20
#define STR_OUTLINE_HSP3 35050
#define STR_DLGFNCLST_HSP3_LABEL 35051
#define STR_DLGFNCLST_HSP3_DEFFUNC 35052
#define STR_DLGFNCLST_HSP3_DEFCFUNC 35053
#define STR_DLGFNCLST_LIST_NAME 35054
#define STR_DLGFNCLST_LIST_NAME_M 35055

// Now using max number 35055 by STR_DLGFNCLST_LIST_NAME_M
3 changes: 3 additions & 0 deletions sakura_core/_main/CControlProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ bool CControlProcess::InitializeProcess()

/* 共有メモリを初期化 */
if( !CProcess::InitializeProcess() ){

// TODO: 微妙。初期化した扱いにしないとエディタプロセスが待機してしまう。
::SetEvent(m_hEventCPInitialized);
return false;
}

Expand Down
12 changes: 12 additions & 0 deletions sakura_core/_main/WinMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "version.h"
#include "util/std_macro.h"
#include "env/DLLSHAREDATA.h"
#include "hsp/CHsp3DarkMode.h"

/*!
Windows Entry point
Expand Down Expand Up @@ -65,6 +66,17 @@ int WINAPI wWinMain(

setlocale( LC_ALL, "Japanese" ); //2007.08.16 kobake 追加
::OleInitialize( NULL ); // 2009.01.07 ryoji 追加

auto& DarkMode = CHsp3DarkMode::GetInstance();
if ( DarkMode.Load())
{
// DarkMode.AllowDarkModeForApp(true);
DarkMode.SetPreferredAppMode(
CHsp3DarkMode::PreferredAppMode::APPMODE_DEFAULT);
DarkMode.SetPreferredAppMode(
CHsp3DarkMode::PreferredAppMode::APPMODE_ALLOWDARK);
DarkMode.RefreshImmersiveColorPolicyState();
}
}

//開発情報
Expand Down
62 changes: 49 additions & 13 deletions sakura_core/cmd/CViewCommander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,43 +544,79 @@ BOOL CViewCommander::HandleCommand(
break;

/* HSP */
case F_HSP_OPEN_SRC_FOLDER:
case F_HSP_LABEL_LIST: /* ラベル・関数一覧(&L) */
bRet = Command_FUNCLIST((int)lparam1, OUTLINE_DEFAULT);
break;
case F_HSP_COMPILE_RUN: /* コンパイル+実行(&C) */
Command_HSP_COMPILE_RUN();
break;
case F_HSP_RUN: /* 実行(&R) */
Command_HSP_RUN();
break;
case F_HSP_COMPILE_ONLY: /* コンパイルのみ(&P) */
Command_HSP_COMPILE_ONLY();
break;
case F_HSP_SHOW_ERR: /* エラー表示(&E) */
Command_HSP_SHOW_ERROR();
break;
case F_HSP_CREATE_OBJ: /* オブジェクトファイル作成(&B) */
Command_HSP_CREATE_OBJ();
break;
case F_HSP_CREATE_STARTAX: /* START.AXファイル作成(&S) */
Command_HSP_CREATE_STARTAX();
break;
case F_HSP_CREATE_EXE_AUTO: /* 実行ファイル自動作成(&A) */
Command_HSP_CREATE_EXE_AUTO();
break;
case F_HSP_RUN_EXTERNAL: /* 外部ファイル実行(&F) */
Command_HSP_RUN_EXTERNAL();
break;
case F_HSP_RESV_KEYWORD_LIST: /* 予約キーワード一覧(&K) */
Command_HSP_RESERVED_KEYWORD_LIST();
break;
case F_HSP_RUN_OPTIONS: /* 起動オプション(&O) */
Command_HSP_COMMANDLINE_OPTION();
break;
case F_HSP_SHOW_DEBUG_WINDOW: /* Debugウィンドウ表示(&D) */
Command_HSP_SHOW_DEBUG_WINDOW();
break;
case F_HSP_OPEN_SRC_FOLDER: /* ソースフォルダを開く(&O) */
Command_HSP_OPEN_SRC_FOLDER();
break;
case F_HSP_RUN_ASSIST:
case F_HSP_RUN_ASSIST: /* HSPアシスタント起動(&F) */
Command_HSP_RUN_ASSIST();
break;
case F_HSP_RUN_HSPTV:
case F_HSP_RUN_HSPTV: /* HSPTVブラウザ起動(&H) */
Command_HSP_RUN_HSPTV();
break;
case F_HSP_CREATE_DPM:
case F_HSP_CREATE_DPM: /* 指定フォルダからDPM作成(&D) */
Command_HSP_CREATE_DPM();
break;
case F_HSP_CREATE_PACKOPT:
case F_HSP_CREATE_PACKOPT: /* PACKOPT項目の作成(&P) */
Command_HSP_CREATE_PACKOPT();
break;
case F_HSP_CONVERT_DISH_C:
case F_HSP_CONVERT_DISH_C: /* HSP3Dish / Cソース変換(&C) */
Command_HSP_CONVERT_DISH_C();
break;
case F_HSP_OPEN_HGIMG4_TOOL:
case F_HSP_OPEN_HGIMG4_TOOL: /* HGIMG4ツールを開く(&G) */
Command_HSP_OPEN_HGIMG4_TOOL();
break;
case F_HSP_OPEN_PAINT_TOOL:
case F_HSP_OPEN_PAINT_TOOL: /* ペイントツールを開く(&W) */
Command_HSP_OPEN_PAINT_TOOL();
break;
case F_HSP_OPEN_HELP_SOURCE_EDITOR:
case F_HSP_OPEN_HELP_SOURCE_EDITOR: /* Help Source Editorを開く(&E) */
Command_HSP_OPEN_HELP_SOURCE_EDITOR();
break;
case F_HSP_SEARCH_KEYWORD:
case F_HSP_SEARCH_KEYWORD: /* HSPキーワード検索(&K) */
Command_HSP_SEARCH_KEYWORD();
break;
case F_HSP_OPEN_PG_MANUAL:
case F_HSP_OPEN_PG_MANUAL: /* HSPプログラミング・マニュアルを開く(&P) */
Command_HSP_OPEN_PG_MANUAL();
break;
case F_HSP_OPEN_FUNC_REF:
case F_HSP_OPEN_FUNC_REF: /* HSP命令リファレンスを開く(&R) */
Command_HSP_OPEN_FUNC_REF();
break;
case F_HSP_OPEN_MANUAL_INDEX:
case F_HSP_OPEN_MANUAL_INDEX: /* HSPマニュアル目次(&I) */
Command_HSP_OPEN_MANUAL_INDEX();
break;

Expand Down
13 changes: 13 additions & 0 deletions sakura_core/cmd/CViewCommander.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,17 @@ class CViewCommander{
// To Here 2006.12.03 maru 引数の拡張

/* HSP */
void Command_HSP_RESERVED_KEYWORD_LIST(void);
void Command_HSP_COMPILE_RUN(void);
void Command_HSP_RUN(void);
void Command_HSP_COMPILE_ONLY(void);
void Command_HSP_SHOW_ERROR(void);
void Command_HSP_CREATE_OBJ(void);
void Command_HSP_CREATE_STARTAX(void);
void Command_HSP_CREATE_EXE_AUTO(void);
void Command_HSP_RUN_EXTERNAL(void);
void Command_HSP_COMMANDLINE_OPTION(void);
void Command_HSP_SHOW_DEBUG_WINDOW(void);
void Command_HSP_OPEN_SRC_FOLDER(void);
void Command_HSP_RUN_ASSIST(void);
void Command_HSP_RUN_HSPTV(void);
Expand Down Expand Up @@ -429,6 +440,8 @@ class CViewCommander{
void AlertNotFound(HWND hwnd, bool bReplaceAll, LPCWSTR format, ...);
void DelCharForOverwrite(const wchar_t* pszInput, int nLen); // 上書き用の一文字削除 // 2009.04.11 ryoji
bool Sub_PreProcTagJumpByTagsFile( WCHAR* szCurrentPath, int count ); // タグジャンプの前処理
bool Sub_HSP_GetFileName( WCHAR* szHSPTmpFilePath, WCHAR* szHSPFilePath, WCHAR* szHSPObjFilePath);

public:
CLogicInt ConvertEol(const wchar_t* pszText, CLogicInt nTextLen, wchar_t* pszConvertedText);
void Sub_BoxSelectLock( int flags );
Expand Down
Loading

0 comments on commit de6f646

Please sign in to comment.