Commit 7fc077f9 authored by Jay Dubb's avatar Jay Dubb
Browse files

v1.25.2

-- Fix wrong implementation of duplicate plot in PlotProbeGUI. We want duplicate plot to remain constant as the current element and main plot probe display changes.
-- Also make axes in duplicate plot probe invisible and use same size and positioning to make it truly duplicate.
parent dfdebd58
Loading
Loading
Loading
Loading
+39 −13
Original line number Diff line number Diff line
@@ -495,26 +495,33 @@ end
figure(handles.figure);
a = get(gca,'xlim');
b = get(gca,'ylim');
set(gca, 'tag','axes1');

%%%% Create new figure and use same zoom level and axes position 
%%%% as original 
plotprobe.handles.figureDup = figure();
handles.figureDup = figure('name', plotprobe.dataTree.currElem.GetName(), 'NumberTitle','off');
xlim(a);
ylim(b);
pos = getNewFigPos(plotprobe.handles.figureDup);
set(plotprobe.handles.figureDup, 'position',pos);
axis off
pos = getNewFigPos(handles);
set(handles.figureDup, 'position',pos);

nDataBlks = plotprobe.dataTree.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk, length(plotprobe.handles.data)+1);
end

plotprobe.handles.figureDup = handles.figureDup;


% ---------------------------------------------
function pos = getNewFigPos(hFig)
function pos = getNewFigPos(handles)

hFig = handles.figure;
hFigDup = handles.figureDup;

p = get(hFig,'position');
u = get(hFig,'units');
set(hFigDup, 'units',u, 'position',p);

% Find upper right corner of figure
pu = [p(1)+p(3), p(2)+p(4)];
@@ -525,6 +532,12 @@ c = [p(1)+(pu(1)-p(1))/2, p(2)+(pu(2)-p(2))/2];
% determine which direction to move new figure relative 
% to hFig based on which quadrant of the screen the center
% of hFig appears.

% Set screen units to match figure units for the purpose of calculating new
% fig position
u0 = get(0,'units');   % Save original screen units in order to restore later
set(0,'units',u);

scrsz = get(0,'screensize');
if c(1)>scrsz(3)/2
    q=-1;
@@ -536,10 +549,17 @@ if c(2)>scrsz(4)/2
else
    r=+1;
end
offsetX = q*scrsz(3)*.1;
offsetX = q*scrsz(3)*.4;
offsetY = r*scrsz(4)*.1;

pos = [p(1)+offsetX p(2)+offsetY p(3) p(4)];
% pos = [p(1)+offsetX p(2)+offsetY p(3) p(4)];
pos = [p(1)+offsetX p(2), p(3) p(4)];
set(0,'units',u0);

% Set relative position with axes to be same in duplicate as in parent 
haxes = findobj2(hFig, 'tag','axes1', 'flat');
p = get(haxes,'position');
set(gca, 'position',p)



@@ -610,6 +630,9 @@ for iBlk = 1:nDataBlks
    end
    
    for iFig = 1:length(hFigs)
        
        if iFig==1
        
            % Clear axes of previous data, before redisplaying it
            ClearAxesData(iFig);
            
@@ -618,8 +641,11 @@ for iBlk = 1:nDataBlks
                plotProbeAndSetProperties(handles, iBlk, iFig);
            end
        end
        
        figure(hFigs(iFig))
        
    end    
end
figure(hFigs(1))



Utils/findobj2.m

0 → 100644
+27 −0
Original line number Diff line number Diff line
function hObj = findobj2(h, propname, propvalue, options)

% Find graphic object handle given the parent (or grandparent, etc) handle
% and property name/value pair 

if ~exist('options','var')
    options = '';
end

hObj = [];
hc = get(h, 'children');
for ii = 1:length(hc)
    try 
        if eval( sprintf('strcmp(get(hc(ii), ''%s''), ''%s'')', propname, propvalue) )
            hObj = hc(ii);
            return;
        elseif ~optionExist(options, 'flat')
            hObj = findobj2(hc(ii), propname, propvalue);
            if ~isempty(hObj)
                return;
            end
        end
    catch
        continue
    end
end
+1 −1
Original line number Diff line number Diff line
@@ -2,5 +2,5 @@ function vrnnum = getVernum()

vrnnum{1} = '1';   % Major version #
vrnnum{2} = '25';  % Major sub-version #
vrnnum{3} = '1';   % Minor version #
vrnnum{3} = '2';   % Minor version #
vrnnum{4} = '0';   % Minor sub-version # or patch #: 'p1', 'p2', etc