www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcmultiview/@MultiViewPanel/saveViewLayout.m

    function saveViewLayout(obj, LayoutName)
%SAVEVIEWLAYOUT Save the current view layout
%
%  SAVEVIEWLAYOUT(OBJ, LAYOUTNAME) saves a structure that defines the
%  current set and layout of views in the preferences.  The layout can then
%  be restored in the future by RESTOREVIEWLAYOUT.

%  Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin<2
    LayoutName = obj.ViewLayoutName;
end

if isempty(LayoutName)
    return
end

PR = xregGui.PointerRepository;
Pid = PR.stackSetPointer(obj.Parent, 'watch');

lytStruc = obj.pGetLayoutStructure;
P = mbcprefs('mbc');
if ispref(P, 'MultiViewPanel')
    s = getpref(P, 'MultiViewPanel');
else
    addpref(P, 'MultiViewPanel');
    s = struct('Layouts', []);
end

s.Layouts.(LayoutName) = lytStruc;
setpref(P, 'MultiViewPanel', s);

PR.stackRemovePointer(obj.Parent, Pid);