Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

  • Understand the issue: Support TEXTINCLUDE 1 for RC file loading
  • Analyze current codebase to understand how TEXTINCLUDE is handled
  • Implement TEXTINCLUDE 1 parsing to extract header file name
  • Modify RC file loading to use TEXTINCLUDE 1 value for loading resource.h
  • Ensure TEXTINCLUDE 1 is preserved when saving RC/RC2 files
  • Add test case for TEXTINCLUDE 1 handling (TextInclude1Test)
  • Address code review comments (added TN035 references, improved comments)
  • Run CodeQL security check (passed)
  • Add prompt to copy custom header file when destination doesn't have it
  • Add IDS_COPYHEADERFILE to all language files

Implementation Summary

Changes Made:

  1. GetTextInclude1HeaderFile(): New helper function to extract header file path from TEXTINCLUDE 1 data

    • Handles both relative and absolute paths
    • Respects Visual C++ write-protect marker ("< " prefix)
    • Falls back to empty string if file doesn't exist
  2. DoLoadRC(): Modified to use TEXTINCLUDE 1 value when loading resource.h

    • First tries to load header file from TEXTINCLUDE 1 value
    • Falls back to standard resource.h search if unavailable
  3. DoWriteRC(): Updated to preserve TEXTINCLUDE 1 header file name when saving RC files

    • Uses actual TEXTINCLUDE 1 value from resource if available
    • Preserves custom header file names in #include directive
    • Prompts user to copy custom header file if it doesn't exist at destination
  4. TextInclude1Test: New test case with custom_resource.h to verify TEXTINCLUDE 1 handling

  5. Localization: Added IDS_COPYHEADERFILE string to all 15 language files

Fixes #301

Original prompt

Win32リソース編集において、TEXTINCLUDE 1のサポートが不足しているため、TEXTINCLUDE 1リソースへの対応を追加してください。これには、TEXTINCLUDE 1の解析、表示、編集、保存機能の実装を含めてください。既存リソースファイルを正常に扱えるようにし、動作確認のためのテストケースも追加してください。
参考: #301

This pull request was created as a result of the following prompt from Copilot chat.

Win32リソース編集において、TEXTINCLUDE 1のサポートが不足しているため、TEXTINCLUDE 1リソースへの対応を追加してください。これには、TEXTINCLUDE 1の解析、表示、編集、保存機能の実装を含めてください。既存リソースファイルを正常に扱えるようにし、動作確認のためのテストケースも追加してください。
参考: #301


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 28, 2025 16:05
- Add GetTextInclude1HeaderFile() helper function to extract header file path from TEXTINCLUDE 1 data
- Modify DoLoadRC() to use TEXTINCLUDE 1 value when loading resource.h
- Update DoWriteRC() to preserve TEXTINCLUDE 1 header file name when saving RC files
- Add test case with custom header file name in TEXTINCLUDE 1

Co-authored-by: katahiromz <2107452+katahiromz@users.noreply.github.com>
- Add comment explaining write-protect marker "< " convention from Visual C++
- Improve comment for res2/res1 selection logic with TN035 reference
- Use !res2.empty() instead of res2.size() for clearer condition

Co-authored-by: katahiromz <2107452+katahiromz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for TEXTINCLUDE 1 resource in Win32 editor Support TEXTINCLUDE 1 for loading and saving RC files Nov 28, 2025
Copilot AI requested a review from katahiromz November 28, 2025 16:11
@katahiromz katahiromz marked this pull request as ready for review November 28, 2025 16:30
@katahiromz
Copy link
Owner

@copilot RC保存先にcustom resource headerがなければ、コピーするかどうか英語で尋ねてください。コピーを選択したらコピーしてください。

When saving an RC file with a custom header (from TEXTINCLUDE 1) to a
new location, the editor now checks if the header file exists at the
destination. If not, it prompts the user in English to copy the file.

- Added IDS_COPYHEADERFILE string resource for the copy prompt
- Modified DoWriteRC() to detect missing custom header files
- Shows Yes/No dialog asking to copy the header file
- Reports error if copy operation fails

Co-authored-by: katahiromz <2107452+katahiromz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot RC保存先にcustom resource headerがなければ、コピーするかどうか英語で尋ねてください。コピーを選択したらコピーしてください。

Added in commit 72a896a. When saving an RC file with a custom header from TEXTINCLUDE 1 to a new location, the editor now prompts: "The header file '%s' does not exist at the destination. Do you want to copy it?" If the user selects Yes, the file is copied. If the copy fails, an error is shown.

@katahiromz
Copy link
Owner

@copilot IDS_COPYHEADERFILEを他の言語にも追加してください。翻訳しなくてもいいです。

Added the English string "The header file '%s' does not exist at the
destination. Do you want to copy it?" to all 14 language RC files.

Co-authored-by: katahiromz <2107452+katahiromz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot IDS_COPYHEADERFILEを他の言語にも追加してください。翻訳しなくてもいいです。

Added in commit 7b46925. IDS_COPYHEADERFILE with the English string has been added to all 14 language RC files (de_DE, es_ES, fi_FI, fr_FR, id_ID, it_IT, ja_JP, ko_KR, pl_PL, pt_BR, ru_RU, tr_TR, zh_CN, zh_TW).

@katahiromz katahiromz merged commit 83b9ee1 into master Nov 28, 2025
1 check passed
@katahiromz katahiromz deleted the copilot/add-textinclude-1-support branch November 28, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support TEXTINCLUDE 1

2 participants