Skip to content

Commit

Permalink
dock: Add focus peaking
Browse files Browse the repository at this point in the history
Focus peaking will be hidden when created the dock.
  • Loading branch information
norihiro committed Oct 12, 2024
1 parent 63c0994 commit 70ef8cf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ dock.menu.show.waveform="Show &Waveform"
dock.menu.show.histogram="Show &Histogram"
dock.menu.show.zebra="Show &Zebra"
dock.menu.show.falsecolor="Show &False Color"
dock.menu.show.focuspeaking="Show Focus &Peaking"
dock.menu.properties="Properties..."
dock.menu.projector="Open Pro&jector"
dock.menu.close="Close (&X)"
Expand Down
21 changes: 14 additions & 7 deletions src/scope-widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@

#define N_SRC SCOPE_WIDGET_N_SRC

static const char *id_list[N_SRC] = {
"colormonitor_roi", "vectorscope_source", "waveform_source",
"histogram_source", ID_PREFIX "zebra_source", ID_PREFIX "falsecolor_source",
};
static const char *id_list[N_SRC] = {"colormonitor_roi",
"vectorscope_source",
"waveform_source",
"histogram_source",
ID_PREFIX "zebra_source",
ID_PREFIX "falsecolor_source",
ID_PREFIX "focuspeaking_source"};

struct src_rect_s
{
Expand Down Expand Up @@ -122,6 +125,7 @@ static void draw(void *param, uint32_t cx, uint32_t cy)
case 0: // ROI
case 4: // Zebra
case 5: // False color
case 6: // Focus peaking
if (w * h_src > h * w_src)
w = h * w_src / h_src;
else if (h * w_src > w * h_src)
Expand Down Expand Up @@ -503,9 +507,10 @@ bool ScopeWidget::openMenu(QMouseEvent *)
QAction *act;

const char *menu_text[N_SRC] = {
obs_module_text("dock.menu.show.roi"), obs_module_text("dock.menu.show.vectorscope"),
obs_module_text("dock.menu.show.waveform"), obs_module_text("dock.menu.show.histogram"),
obs_module_text("dock.menu.show.zebra"), obs_module_text("dock.menu.show.falsecolor"),
obs_module_text("dock.menu.show.roi"), obs_module_text("dock.menu.show.vectorscope"),
obs_module_text("dock.menu.show.waveform"), obs_module_text("dock.menu.show.histogram"),
obs_module_text("dock.menu.show.zebra"), obs_module_text("dock.menu.show.falsecolor"),
obs_module_text("dock.menu.show.focuspeaking"),
};

for (int i = 0; i < N_SRC; i++) {
Expand Down Expand Up @@ -559,6 +564,8 @@ void ScopeWidget::createProperties()
void ScopeWidget::default_properties(obs_data_t *props)
{
for (int i = 0; i < N_SRC; i++) {
if (strcmp(id_list[i], ID_PREFIX "focuspeaking_source") == 0)
continue;
char s[64];
snprintf(s, sizeof(s), "%s-shown", id_list[i]);
s[sizeof(s) - 1] = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/scope-widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <memory>
#include <string>

#define SCOPE_WIDGET_N_SRC 6
#define SCOPE_WIDGET_N_SRC 7

class ScopeWidget : public QWidget {
Q_OBJECT
Expand Down

0 comments on commit 70ef8cf

Please sign in to comment.