From c4eb11b81d91f0cfa88f0a9df98bf2bc37b86615 Mon Sep 17 00:00:00 2001 From: egolol Date: Mon, 23 Oct 2023 11:11:31 +0200 Subject: [PATCH 1/5] works --- braph2/src/gui/PanelProp.m | 26 +++++++++++++++++++++++++- braph2genesis/src/gui/_PanelProp.gen.m | 19 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/braph2/src/gui/PanelProp.m b/braph2/src/gui/PanelProp.m index a9557af21d..3f3a41329b 100644 --- a/braph2/src/gui/PanelProp.m +++ b/braph2/src/gui/PanelProp.m @@ -1353,8 +1353,32 @@ function postset(pr, prop) function cb_button_cb(~, ~) gui_cb = pr.memorize('GUI_CB'); + gui_el = gui_cb.get('PE').get('EL'); + + % new section, find repeating figures + all_fig_h = findall(0, 'type', 'figure'); + original_item = []; + for i = 1:length(all_fig_h) + tmp_h = all_fig_h(i); + tmp_UserData = tmp_h.UserData; + if isempty(tmp_UserData) + continue; + end + tmp_pe = tmp_UserData.get('PE'); + tmp_el = tmp_pe.get('EL'); + if strcmp(tmp_h.Name, gui_cb.get('TITLE')) && strcmp(gui_el.get('ID'), tmp_el.get('ID')) + original_item = tmp_h; + break; + end + end + + if ~isempty(original_item) + gui_element = original_item.UserData; + gui_element.get('SHOW'); + return; + end - if ~gui_cb.get('DRAWN') + if ~gui_cb.get('DRAWN') gui_cb.get('DRAW') gui_cb.get('SHOW') else diff --git a/braph2genesis/src/gui/_PanelProp.gen.m b/braph2genesis/src/gui/_PanelProp.gen.m index bdd05205dc..b244ce5dc7 100644 --- a/braph2genesis/src/gui/_PanelProp.gen.m +++ b/braph2genesis/src/gui/_PanelProp.gen.m @@ -452,6 +452,25 @@ A Prop Panel (PanelProp) renders a property of an element in a panel. %%%% ¡calculate_callbacks! function cb_button_cb(~, ~) gui_cb = pr.memorize('GUI_CB'); + gui_el = gui_cb.get('PE').get('EL'); + + % new section, find repeating figures + all_fig_h = findall(0, 'type', 'figure'); + original_item = []; + for i = 1:length(all_fig_h) + tmp_h = all_fig_h(i); + tmp_UserData = tmp_h.UserData; + if isempty(tmp_UserData) + continue; + end + tmp_pe = tmp_UserData.get('PE'); + tmp_el = tmp_pe.get('EL'); + % might compare elements but it takes to long + if strcmp(tmp_h.Name, gui_cb.get('TITLE')) && strcmp(gui_el.get('ID'), tmp_el.get('ID')) + original_item = tmp_h; + break; + end + end if ~gui_cb.get('DRAWN') gui_cb.get('DRAW') From 4860076d9551a1ce9f5b4757e7c9ebb36237e629 Mon Sep 17 00:00:00 2001 From: Giovanni Volpe <46021832+giovannivolpe@users.noreply.github.com> Date: Mon, 23 Oct 2023 22:40:28 +0800 Subject: [PATCH 2/5] Update PanelProp.m --- braph2/src/gui/PanelProp.m | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/braph2/src/gui/PanelProp.m b/braph2/src/gui/PanelProp.m index 3f3a41329b..1770493fab 100644 --- a/braph2/src/gui/PanelProp.m +++ b/braph2/src/gui/PanelProp.m @@ -1353,29 +1353,15 @@ function postset(pr, prop) function cb_button_cb(~, ~) gui_cb = pr.memorize('GUI_CB'); - gui_el = gui_cb.get('PE').get('EL'); - % new section, find repeating figures - all_fig_h = findall(0, 'type', 'figure'); - original_item = []; - for i = 1:length(all_fig_h) - tmp_h = all_fig_h(i); - tmp_UserData = tmp_h.UserData; - if isempty(tmp_UserData) - continue; - end - tmp_pe = tmp_UserData.get('PE'); - tmp_el = tmp_pe.get('EL'); - if strcmp(tmp_h.Name, gui_cb.get('TITLE')) && strcmp(gui_el.get('ID'), tmp_el.get('ID')) - original_item = tmp_h; - break; - end - end - - if ~isempty(original_item) - gui_element = original_item.UserData; - gui_element.get('SHOW'); - return; + % find repeating figures + all_figs = findall(0, 'type', 'figure'); + for i = 1:1:length(all_figs) + user_data = all_figs(i).get('UserData'); + if isa(user_data, 'PanelElement') && user_data.get('PE').get('EL') == gui_cb.get('PE').get('EL') + user_data.get('PE').get('SHOW') + return + end end if ~gui_cb.get('DRAWN') From a892116d58f3bb2e60262150cdf540eabea46294 Mon Sep 17 00:00:00 2001 From: egolol Date: Mon, 23 Oct 2023 17:10:32 +0200 Subject: [PATCH 3/5] Update PanelProp.m --- braph2/src/gui/PanelProp.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/braph2/src/gui/PanelProp.m b/braph2/src/gui/PanelProp.m index 1770493fab..26acc4df6f 100644 --- a/braph2/src/gui/PanelProp.m +++ b/braph2/src/gui/PanelProp.m @@ -1359,9 +1359,9 @@ function cb_button_cb(~, ~) for i = 1:1:length(all_figs) user_data = all_figs(i).get('UserData'); if isa(user_data, 'PanelElement') && user_data.get('PE').get('EL') == gui_cb.get('PE').get('EL') - user_data.get('PE').get('SHOW') - return - end + user_data.get('PE').get('SHOW') + return + end end if ~gui_cb.get('DRAWN') From ba187fb257b7ad5b7d270507368b636309c705cb Mon Sep 17 00:00:00 2001 From: egolol Date: Tue, 24 Oct 2023 14:57:45 +0200 Subject: [PATCH 4/5] Update _PanelProp.gen.m --- braph2genesis/src/gui/_PanelProp.gen.m | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/braph2genesis/src/gui/_PanelProp.gen.m b/braph2genesis/src/gui/_PanelProp.gen.m index b244ce5dc7..b2bd40881f 100644 --- a/braph2genesis/src/gui/_PanelProp.gen.m +++ b/braph2genesis/src/gui/_PanelProp.gen.m @@ -452,23 +452,14 @@ A Prop Panel (PanelProp) renders a property of an element in a panel. %%%% ¡calculate_callbacks! function cb_button_cb(~, ~) gui_cb = pr.memorize('GUI_CB'); - gui_el = gui_cb.get('PE').get('EL'); - - % new section, find repeating figures - all_fig_h = findall(0, 'type', 'figure'); - original_item = []; - for i = 1:length(all_fig_h) - tmp_h = all_fig_h(i); - tmp_UserData = tmp_h.UserData; - if isempty(tmp_UserData) - continue; - end - tmp_pe = tmp_UserData.get('PE'); - tmp_el = tmp_pe.get('EL'); - % might compare elements but it takes to long - if strcmp(tmp_h.Name, gui_cb.get('TITLE')) && strcmp(gui_el.get('ID'), tmp_el.get('ID')) - original_item = tmp_h; - break; + + % find repeating figures + all_figs = findall(0, 'type', 'figure'); + for i = 1:1:length(all_figs) + user_data = all_figs(i).get('UserData'); + if isa(user_data, 'GUIElement') && user_data.get('PE').get('EL') == gui_cb.get('PE').get('EL') + user_data.get('PE').get('SHOW') + return end end From 66d570a770f3025cf7ec6ed6c20671f9018a5d07 Mon Sep 17 00:00:00 2001 From: egolol Date: Wed, 25 Oct 2023 11:46:46 +0200 Subject: [PATCH 5/5] Update PanelProp.m on braph2 --- braph2/src/gui/PanelProp.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/braph2/src/gui/PanelProp.m b/braph2/src/gui/PanelProp.m index 26acc4df6f..d0e93b5026 100644 --- a/braph2/src/gui/PanelProp.m +++ b/braph2/src/gui/PanelProp.m @@ -1358,7 +1358,7 @@ function cb_button_cb(~, ~) all_figs = findall(0, 'type', 'figure'); for i = 1:1:length(all_figs) user_data = all_figs(i).get('UserData'); - if isa(user_data, 'PanelElement') && user_data.get('PE').get('EL') == gui_cb.get('PE').get('EL') + if isa(user_data, 'GUIElement') && user_data.get('PE').get('EL') == gui_cb.get('PE').get('EL') user_data.get('PE').get('SHOW') return end