[0.1.22] Copy all text buttons in the OCR and Capture windows

This commit is contained in:
Musa Mahmood 2026-10-14 20:28:35 +01:00
parent 7cee21122c
commit c5ef13f146
3 changed files with 17 additions and 2 deletions

View File

@ -47,7 +47,7 @@ APP_NAME :: "mcap";
APP_FOLDER_NAME :: "mcap";
GIT_BRANCH :: "check";
GIT_HASH :: "-";
VERSION :: "0.1.21";
VERSION :: "0.1.22";
BUILD_DATE :: "-";
DEBUG :: true;
COMPILE_TESTS :: true;

View File

@ -8,7 +8,7 @@ APP_NAME :: "mcap";
APP_FOLDER_NAME :: "mcap";
APP_BUNDLE_IDENTIFIER :: "com.example.mcap";
VERSION :: "0.1.21";
VERSION :: "0.1.22";
// Where everything goes: bin/, or bin-headless/ for builds made with no_crash_dialog, so automated
// builds never write over the ones you run by hand.
build_directory := "bin";

View File

@ -824,6 +824,8 @@ ocr_ui_frame :: () { using ImGui;
if section && viewer.full_index >= 0 {
Separator();
Text("Text of % (% , % lines):", viewer.captures[viewer.full_index].name, section.model, section.lines.count);
SameLine();
if SmallButton("Copy all text") ocr_copy_all_text(section);
BeginChild("ocr text");
for section.lines TextUnformatted(it.text);
EndChild();
@ -850,6 +852,17 @@ text_with_links :: (text: string) { using ImGui;
// ---------------------------------------------------------------- the Capture window
// Puts the reading on the clipboard, a line of text to each of its lines.
ocr_copy_all_text :: (section: *Mcap_Ocr_Section) {
builder: String_Builder;
builder.allocator = temp;
for section.lines {
if it_index append(*builder, "\n");
append(*builder, it.text);
}
clipboard_set_text(builder_to_string(*builder,, temp));
}
// The reading shown over the capture in the Capture window: the overlay's choice, else the chosen
// model's, else the first there is.
ocr_overlay_section :: () -> *Mcap_Ocr_Section {
@ -911,6 +924,8 @@ ocr_ui_capture_controls :: (index: s32, path: string) { using ImGui;
SameLine();
}
Checkbox("Boxes", *ocr_ui.show_boxes);
SameLine();
if SmallButton("Copy all text") ocr_copy_all_text(section);
if viewer.search_terms.count {
matches := 0;
for section.lines if search_line_matches(it.text, viewer.search_terms) matches += 1;