Skip to content

Commit ad4ff24

Browse files
corndogitseraxis
authored andcommitted
Copy highlighted menu text in music select
Press CTRL-C to copy the currently highlighted menu item in the music select scene
1 parent 92d8644 commit ad4ff24

5 files changed

Lines changed: 20 additions & 3 deletions

File tree

core/src/bms/player/beatoraja/input/BMSPlayerInputProcessor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ public boolean isActivated(KeyCommand key) {
425425
return isControlKeyPressed(ControlKeys.F12);
426426
case TOGGLE_MOD_MENU:
427427
return isControlKeyPressed(ControlKeys.F5) || isControlKeyPressed(ControlKeys.INSERT);
428+
case COPY_HIGHLIGHTED_MENU_TEXT:
429+
return isControlKeyPressed(ControlKeys.KEY_C, MASK_CTRL);
428430
}
429431
return false;
430432
}

core/src/bms/player/beatoraja/input/KeyBoardInputProcesseor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ public enum ControlKeys {
277277
INSERT(27, Keys.INSERT, false),
278278
DEL(28, Keys.FORWARD_DEL, false),
279279
ESCAPE(29, Keys.ESCAPE, false),
280+
KEY_C(30, Keys.C, false)
280281
;
281282

282283
public final int id;

core/src/bms/player/beatoraja/input/KeyCommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ public enum KeyCommand {
1616
OPEN_IR,
1717
OPEN_SKIN_CONFIGURATION,
1818
TOGGLE_MOD_MENU,
19+
COPY_HIGHLIGHTED_MENU_TEXT
1920
}

core/src/bms/player/beatoraja/select/MusicSelectCommand.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
import bms.player.beatoraja.select.bar.*;
55
import bms.player.beatoraja.song.SongData;
66
import bms.player.beatoraja.BMSPlayerMode;
7-
import com.badlogic.gdx.graphics.Color;
87
import com.badlogic.gdx.utils.Queue;
98
import javafx.scene.input.Clipboard;
109
import javafx.scene.input.ClipboardContent;
1110

1211
import java.util.Arrays;
1312
import java.util.List;
1413
import java.util.function.Consumer;
15-
import org.slf4j.Logger;
14+
1615
import org.slf4j.LoggerFactory;
1716
import java.util.stream.Collectors;
1817

@@ -202,7 +201,18 @@ else if (current instanceof HashBar && previous instanceof TableBar) {
202201
}
203202
else if (bar.updateBar(current)) { selector.play(FOLDER_OPEN); }
204203
}
205-
});
204+
}),
205+
COPY_HIGHLIGHTED_MENU_TEXT(selector -> {
206+
Bar current = selector.getBarManager().getSelected();
207+
String content = current.getTitle();
208+
if (content != null && !content.isEmpty()) {
209+
Clipboard clipboard = Clipboard.getSystemClipboard();
210+
ClipboardContent clipboardContent = new ClipboardContent();
211+
clipboardContent.putString(content);
212+
clipboard.setContent(clipboardContent);
213+
ImGuiNotify.info(String.format("Copied highlighted menu text: %s", content));
214+
}
215+
});
206216

207217
public final Consumer<MusicSelector> function;
208218

core/src/bms/player/beatoraja/select/MusicSelectInputProcessor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ else if (property.isPressed(input, NEXT_REPLAY, true)) {
397397
if(input.isActivated(KeyCommand.COPY_SONG_SHA256_HASH)) {
398398
select.execute(MusicSelectCommand.COPY_SHA256_HASH);
399399
}
400+
if(input.isActivated(KeyCommand.COPY_HIGHLIGHTED_MENU_TEXT)) {
401+
select.execute(MusicSelectCommand.COPY_HIGHLIGHTED_MENU_TEXT);
402+
}
400403

401404
if (input.isControlKeyPressed(ControlKeys.ESCAPE)) {
402405
boolean isTopLevel = select.getBarManager().getDirectory().isEmpty();

0 commit comments

Comments
 (0)