diff --git a/tools/imglab/src/metadata_editor.cpp b/tools/imglab/src/metadata_editor.cpp index af551d6ac..d81232f85 100644 --- a/tools/imglab/src/metadata_editor.cpp +++ b/tools/imglab/src/metadata_editor.cpp @@ -50,6 +50,7 @@ metadata_editor( overlay_label.set_width(200); display.set_overlay_rects_changed_handler(*this, &metadata_editor::on_overlay_rects_changed); + display.set_overlay_rect_selected_handler(*this, &metadata_editor::on_overlay_rect_selected); overlay_label.set_text_modified_handler(*this, &metadata_editor::on_overlay_label_changed); mbar.set_number_of_menus(1); @@ -386,3 +387,14 @@ on_overlay_label_changed( // ---------------------------------------------------------------------------------------- +void metadata_editor:: +on_overlay_rect_selected( + const image_display::overlay_rect& orect +) +{ + overlay_label.set_text(orect.label); + display.set_default_overlay_rect_label(orect.label); +} + +// ---------------------------------------------------------------------------------------- + diff --git a/tools/imglab/src/metadata_editor.h b/tools/imglab/src/metadata_editor.h index 659960e3a..d7eb1666a 100644 --- a/tools/imglab/src/metadata_editor.h +++ b/tools/imglab/src/metadata_editor.h @@ -37,6 +37,7 @@ private: void load_image_and_set_size(unsigned long idx); void on_overlay_rects_changed(); void on_overlay_label_changed(); + void on_overlay_rect_selected(const dlib::image_display::overlay_rect& orect); std::string filename; dlib::image_dataset_metadata::dataset metadata;