Import.
line source
% BUILDMAINFIG build the main repo gui figure
%
% M Hewitson 22-09-08
%
% $Id: buildMainFig.m,v 1.5 2008/12/17 12:17:47 hewitson Exp $
%
function mainfig = buildMainFig(mainfig, varargin)
% Some initial setup
import utils.const.*
prefs = getappdata(0, 'LTPDApreferences');
utils.helper.msg(msg.PROC1, 'building Main Figure');
Screen = get(0,'screensize');
wsize = prefs.repository.winsize;
mainfig.Gproperties.Screen = Screen;
mainfig.Gproperties.Gwidth = wsize(1);
mainfig.Gproperties.Gheight = wsize(2);
mainfig.Gproperties.Gborder = 10;
mainfig.Gproperties.fontsize = prefs.repository.fontsize;
l = (0.5-mainfig.Gproperties.Gwidth/2);
b = (0.5-mainfig.Gproperties.Gheight/2);
w = mainfig.Gproperties.Gwidth;
h = mainfig.Gproperties.Gheight;
mainfig.Gproperties.Gposition = [l b w h];
mainfig.Gproperties.Gcol{1} = [150 180 200]/255;
mainfig.Gproperties.Gcol{2} = [200 200 180]/255;
mainfig.Gproperties.Gcol{3} = [180 150 200]/255;
mainfig.Gproperties.Gcol{4} = [150 200 180]/255;
if ~isempty(varargin) && ishandle(varargin{1})
mainfig.handle = varargin{1};
set(mainfig.handle, 'Tag', 'REPOGUI2mainfig');
set(mainfig.handle, 'Units', 'normalized');
else
% Initialize and hide the GUI as it is being constructed.
mainfig.handle = figure('Name', 'LTPDA Repository GUI',...
'NumberTitle', 'off',...
'Visible','off',...
'Units','normalized',...
'Position',mainfig.Gproperties.Gposition,...
'Toolbar', 'none',...
'MenuBar', 'none',...
'Color', mainfig.Gproperties.Gcol{1},...
'Resize', 'on',...
'Tag', 'REPOGUI2mainfig');
end
% Set mainfig callbacks
set(mainfig.handle, 'CloseRequestFcn', {'repogui2.cb_mainfigClose', mainfig});
% Setup GUI elements
%----------- Status bar
Hmargin = 0.0;
Vmargin = 0.0;
%-- Status Txt
Sleft = Hmargin;
Sbottom = Vmargin;
Swidth = 0.1;
Sheight = 0.1;
sth = uicontrol(mainfig.handle,'Style','text',...
'String','Status:',...
'Units','normalized',...
'Fontsize', mainfig.Gproperties.fontsize,...
'BackgroundColor', mainfig.Gproperties.Gcol{1},...
'HorizontalAlignment', 'left',...
'Position',[Sleft Sbottom Swidth Sheight], ...
'Tag', 'RepoguiStatusLabel');
%-- Status bar
Sleft = 0.1;
Swidth = 0.9-0.02;
Sheight = 0.10-0.02;
Sbottom = 0.02;
sth = uicontrol(mainfig.handle,'Style','text',...
'String','not connected',...
'Units','normalized',...
'Fontsize', mainfig.Gproperties.fontsize,...
'BackgroundColor', 'w',...
'ForegroundColor', 'r', ...
'HorizontalAlignment', 'left',...
'Max', 100,...
'Position',[Sleft Sbottom Swidth Sheight],...
'Tag', 'RepoguiStatusTxt');
%------------------------------------------------------------------------
%------------------------------------------------------------------------
%----------- TAB PANEL
%------------------------------------------------------------------------
%------------------------------------------------------------------------
PanLeft = Hmargin;
Tleft = PanLeft + Hmargin;
Theight = 1-2*Vmargin -0.1 - 0.01;
Tbottom = 0.1;
Twidth = 1;
htab = uitabgroup('v0', 'Parent', mainfig.handle, ...
'Units','normalized',...
'Position',[Tleft Tbottom Twidth Theight],...
'BackgroundColor', mainfig.Gproperties.Gcol{1}, ...
'SelectionChangeFcn', {'repogui2.cb_tabChanged', mainfig});
t1 = uitab('v0', htab, 'title', 'Connect');
t2 = uitab('v0', htab, 'title', 'Submit');
t3 = uitab('v0', htab, 'title', 'Query');
t4 = uitab('v0', htab, 'title', 'Retrieve');
% Set app data
mainfig.panels = [t1 t2 t3 t4];
end