Skip to content

Commit

Permalink
Add "Close and select files…" menu item
Browse files Browse the repository at this point in the history
Similar to "Select files…" but automatically closes the current
window.

Fixes #24
  • Loading branch information
humdingerb committed Oct 8, 2024
1 parent 7bdc70f commit 2d2fb26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/CommandIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
enum
{
MSG_FILE_OPEN = 'mOpn',
MSG_FILE_NEW = 'mNew',
MSG_FILE_RELOAD = 'mRld',
MSG_FILE_QUIT = 'mQit',
MSG_FILE_DROPPED = 'mDrp',
Expand Down
11 changes: 11 additions & 0 deletions source/DiffWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ DiffWindow::MessageReceived(BMessage* message)
}
} break;

case MSG_FILE_NEW:
{
message->what = MSG_FILE_OPEN;
message->AddMessenger("killme", BMessenger(this));
} // intentional fall-tru

case MSG_FILE_OPEN:
{
message->AddRect("window_frame", Frame());
Expand Down Expand Up @@ -204,6 +210,11 @@ DiffWindow::_CreateMainMenu(BMenuBar* menuBar)
menuItem->SetTarget(this);
fileMenu->AddItem(menuItem);

menuItem = new BMenuItem(B_TRANSLATE("Close and select files" B_UTF8_ELLIPSIS),
new BMessage(MSG_FILE_NEW), 'N');
menuItem->SetTarget(this);
fileMenu->AddItem(menuItem);

menuItem = new BMenuItem(B_TRANSLATE("Switch files"), new BMessage(MSG_FILE_SWITCH), B_TAB);
menuItem->SetTarget(this);
fileMenu->AddItem(menuItem);
Expand Down

0 comments on commit 2d2fb26

Please sign in to comment.