Skip to content

Commit 6e13211

Browse files
committed
implement ID jump
1 parent 5ed381f commit 6e13211

File tree

6 files changed

+98
-0
lines changed

6 files changed

+98
-0
lines changed

src/MIDListDlg.hpp

+15
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
class MSubclassedListView;
3131
class MIDListDlg;
3232

33+
#define MYWM_IDJUMPBANG (WM_USER + 238)
34+
3335
//////////////////////////////////////////////////////////////////////////////
3436

3537
// Let the listview subclassed to get Enter key
@@ -390,6 +392,19 @@ class MIDListDlg : public MDialogBase
390392
case CMDID_LOADRESH:
391393
SendMessage(m_hMainWnd, WM_COMMAND, CMDID_LOADRESHBANG, 0);
392394
break;
395+
case CMDID_IDJUMP:
396+
iItem = ListView_GetNextItem(m_hLst1, -1, LVNI_ALL | LVNI_SELECTED);
397+
ListView_GetItemText(m_hLst1, iItem, 1, szText, _countof(szText));
398+
str1 = szText;
399+
ListView_GetItemText(m_hLst1, iItem, 2, szText, _countof(szText));
400+
str2 = szText;
401+
{
402+
ConstantsDB::TableType table;
403+
int nIDTYPE_ = m_db.GetValue(L"RESOURCE.ID.TYPE", str1.c_str());
404+
int nID = mstr_parse_int(str2.c_str());
405+
SendMessage(m_hMainWnd, MYWM_IDJUMPBANG, nIDTYPE_, nID);
406+
}
407+
break;
393408
}
394409
}
395410

src/RisohEditor.cpp

+76
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,7 @@ class MMainWnd : public MWindowBase
11721172
LRESULT OnClearStatus(HWND hwnd, WPARAM wParam, LPARAM lParam);
11731173
LRESULT OnReopenRad(HWND hwnd, WPARAM wParam, LPARAM lParam);
11741174
LRESULT OnPostSearch(HWND hwnd, WPARAM wParam, LPARAM lParam);
1175+
LRESULT OnIDJumpBang(HWND hwnd, WPARAM wParam, LPARAM lParam);
11751176

11761177
void OnUpdateID(HWND hwnd)
11771178
{
@@ -6680,6 +6681,7 @@ MMainWnd::WindowProcDx(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
66806681
DO_MESSAGE(MYWM_COMPILECHECK, OnCompileCheck);
66816682
DO_MESSAGE(MYWM_REOPENRAD, OnReopenRad);
66826683
DO_MESSAGE(MYWM_POSTSEARCH, OnPostSearch);
6684+
DO_MESSAGE(MYWM_IDJUMPBANG, OnIDJumpBang);
66836685
default:
66846686
if (uMsg == s_uFindMsg)
66856687
{
@@ -6689,6 +6691,80 @@ MMainWnd::WindowProcDx(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
66896691
}
66906692
}
66916693

6694+
LRESULT MMainWnd::OnIDJumpBang(HWND hwnd, WPARAM wParam, LPARAM lParam)
6695+
{
6696+
int nIDTYPE_ = (int)wParam;
6697+
int nID = (int)lParam;
6698+
6699+
MIdOrString type, name = (WORD)nID;
6700+
switch (nIDTYPE_)
6701+
{
6702+
case IDTYPE_CURSOR:
6703+
type = RT_GROUP_CURSOR;
6704+
break;
6705+
case IDTYPE_BITMAP:
6706+
type = RT_BITMAP;
6707+
break;
6708+
case IDTYPE_MENU:
6709+
type = RT_MENU;
6710+
break;
6711+
case IDTYPE_DIALOG:
6712+
type = RT_DIALOG;
6713+
break;
6714+
case IDTYPE_STRING:
6715+
type = RT_STRING;
6716+
name.clear();
6717+
break;
6718+
case IDTYPE_ACCEL:
6719+
type = RT_ACCELERATOR;
6720+
break;
6721+
case IDTYPE_ICON:
6722+
type = RT_GROUP_ICON;
6723+
break;
6724+
case IDTYPE_ANICURSOR:
6725+
type = RT_ANICURSOR;
6726+
break;
6727+
case IDTYPE_ANIICON:
6728+
type = RT_ANIICON;
6729+
break;
6730+
case IDTYPE_HTML:
6731+
type = RT_HTML;
6732+
break;
6733+
case IDTYPE_HELP:
6734+
return 0;
6735+
case IDTYPE_COMMAND:
6736+
return 0;
6737+
case IDTYPE_CONTROL:
6738+
return 0;
6739+
case IDTYPE_RESOURCE:
6740+
break;
6741+
case IDTYPE_MESSAGE:
6742+
type = RT_MESSAGETABLE;
6743+
name.clear();
6744+
break;
6745+
case IDTYPE_INVALID:
6746+
return 0;
6747+
}
6748+
6749+
ResEntry entry;
6750+
entry.type = type;
6751+
entry.name = name;
6752+
entry.lang = 0xFFFF;
6753+
INT iFound = Res_Find2(m_entries, entry, FALSE);
6754+
6755+
if (iFound < 0 || iFound >= INT(m_entries.size()))
6756+
return 0;
6757+
6758+
entry = m_entries[iFound];
6759+
TV_SelectEntry(m_hTreeView, m_entries, entry);
6760+
6761+
SetForegroundWindow(m_hwnd);
6762+
BringWindowToTop(m_hwnd);
6763+
SetFocus(m_hwnd);
6764+
6765+
return 0;
6766+
}
6767+
66926768
LRESULT MMainWnd::OnPostSearch(HWND hwnd, WPARAM wParam, LPARAM lParam)
66936769
{
66946770
m_fr.Flags = FR_DOWN;

src/lang/ch-CN.rc

+2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ IDM_POPUPS MENU
171171
}
172172
POPUP "Popup #3"
173173
{
174+
MENUITEM "跳转(&J)!", CMDID_IDJUMP
175+
MENUITEM SEPARATOR
174176
MENUITEM "增加ID(&A)...", CMDID_ADDRESID
175177
MENUITEM "修改ID(&M)...\tEnter", CMDID_MODIFYRESID
176178
MENUITEM SEPARATOR

src/lang/en-US.rc

+2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ IDM_POPUPS MENU
171171
}
172172
POPUP "Popup #3"
173173
{
174+
MENUITEM "&Jump!", CMDID_IDJUMP
175+
MENUITEM SEPARATOR
174176
MENUITEM "&Add ID...", CMDID_ADDRESID
175177
MENUITEM "&Modify ID...\tEnter", CMDID_MODIFYRESID
176178
MENUITEM SEPARATOR

src/lang/ja-JP.rc

+2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ IDM_POPUPS MENU
171171
}
172172
POPUP "ポップアップ #3"
173173
{
174+
MENUITEM "ジャンプ(&J)!", CMDID_IDJUMP
175+
MENUITEM SEPARATOR
174176
MENUITEM "追加(&A)...", CMDID_ADDRESID
175177
MENUITEM "変更(&M)...\tEnter", CMDID_MODIFYRESID
176178
MENUITEM SEPARATOR

src/resource.h

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
#define CMDID_DEBUGTREENODE 194
131131
#define CMDID_LOADRESHBANG 195
132132
#define CMDID_REFRESHDIALOG 196
133+
#define CMDID_IDJUMP 197
133134

134135
#define IDD_REPLACERES 100
135136
#define IDD_ADDICON 101

0 commit comments

Comments
 (0)