0001 function ltpdv_buildImportPanel(ph, mainfig)
0002
0003 Gproperties = getappdata(mainfig, 'Gproperties');
0004
0005 pmarg = 0.025;
0006
0007
0008
0009
0010
0011 Hmargin = 0.025;
0012 Vmargin = 0.025;
0013
0014 PanLeft = Hmargin;
0015 Tleft = Hmargin;
0016 Theight = 1-2*Vmargin;
0017 Tbottom = (1 - Theight - Vmargin);
0018 Twidth = 1-2*Hmargin;
0019
0020 Pcol = [1 1 0.9];
0021
0022
0023 htab = uitabgroup('Parent', ph, ...
0024 'Units','normalized',...
0025 'Tag', 'LTPDVimportTabPanel', ...
0026 'Position',[Tleft Tbottom Twidth Theight], 'SelectionChangeFcn', {@ltpdv_tabChanged});
0027 mt1 = uitab(htab, 'title', 'Server');
0028 mt2 = uitab(htab, 'title', 'Workspace');
0029 mt3 = uitab(htab, 'title', 'Build');
0030
0031
0032 buildServerPanel(mt1, mainfig);
0033
0034 h = buildWorkspacePanel(mt2, mainfig);
0035
0036 buildBuildPanel(mt3, mainfig);
0037 end
0038
0039
0040
0041 function buildBuildPanel(hp, mainfig)
0042
0043 EditFontSize = 11;
0044 vmarg = 0.03;
0045 pmarg = 0.01;
0046 CommHeight = EditFontSize/80;
0047
0048 bw = 0.12;
0049 bh = 0.05;
0050 bl = 0.5-bw/2;
0051 bb = 0.5-bh/2;
0052 pbh = uicontrol(hp,'Style','pushbutton',...
0053 'String','Build objects',...
0054 'Callback', {@ltpda_constructor_helper}, ...
0055 'Units', 'normalized', ...
0056 'Fontsize', EditFontSize, ...
0057 'Position',[bl bb bw bh]);
0058
0059 bh = CommHeight;
0060 bl = pmarg;
0061 bw = 1-2*pmarg;
0062 bb = vmarg;
0063 sth = uicontrol(hp, 'Style','text',...
0064 'String', 'Build objects with the ''constructor helper'' then import from workspace.',...
0065 'Units', 'normalized', ...
0066 'BackgroundColor', 'w', ...
0067 'Fontsize', EditFontSize, ...
0068 'Position',[bl bb bw bh]);
0069
0070 end
0071
0072
0073 function buildServerPanel(hp, mainfig)
0074
0075
0076 EditFontSize = 11;
0077 vmarg = 0.03;
0078 pmarg = 0.01;
0079 CommHeight = EditFontSize/80;
0080
0081
0082 bw = 0.12;
0083 bh = 0.05;
0084 bl = pmarg;
0085 bb = pmarg;
0086 pbh = uicontrol(hp,'Style','pushbutton',...
0087 'String','Import',...
0088 'Callback', {@ltpdv_server_import, mainfig}, ...
0089 'Units', 'normalized', ...
0090 'Fontsize', EditFontSize, ...
0091 'Position',[bl bb bw bh]);
0092
0093
0094 Tleft = pmarg;
0095 Theight = 0.8;
0096 Tbottom = 1-Theight - pmarg;
0097 Twidth = 1-2*pmarg;
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107 ph = 0.3;
0108 htab = uipanel('Parent', hp, 'Position', [pmarg 1-ph-pmarg 1-2*pmarg ph]);
0109 set(htab, 'Units', 'Normalized')
0110 set(htab, 'Title', 'Server settings')
0111 set(htab, 'BackgroundColor', [0.3 0.7 0.3]);
0112 set(htab, 'ForegroundColor', 'w');
0113
0114 bh = CommHeight;
0115 bl = pmarg;
0116 bw = 0.1;
0117 bb = 1-bh-3*vmarg;
0118 sth = uicontrol(htab, 'Style','text',...
0119 'String', 'Data type',...
0120 'Units', 'normalized', ...
0121 'BackgroundColor', 'w', ...
0122 'Fontsize', EditFontSize, ...
0123 'Position',[bl bb bw bh]);
0124 bl = bl+bw+pmarg;
0125 bw = 0.17;
0126 dtypeh = uicontrol(htab, ...
0127 'Style', 'popupmenu', ...
0128 'Units', 'normalized',...
0129 'Fontsize', EditFontSize, ...
0130 'BackgroundColor', 'w', ...
0131 'String', {'frame data','h(t) frames', 'raw data', 'hour trends', 'day trends'}, ...
0132 'Position', [bl bb bw bh],...
0133 'Tag', 'LTPDVserverDataType', ...
0134 'Callback', {@ltpdv_server_datatype_select, mainfig});
0135
0136
0137 bl = bl + bw + pmarg;
0138 bw = 0.1;
0139 sth = uicontrol(htab, 'Style','text',...
0140 'String', 'Statistic',...
0141 'Units', 'normalized', ...
0142 'BackgroundColor', 'w', ...
0143 'Fontsize', EditFontSize, ...
0144 'Position',[bl bb bw bh]);
0145 bl = bl+bw+pmarg;
0146 bw = 0.12;
0147 th = uicontrol(htab, ...
0148 'Style', 'popupmenu', ...
0149 'Units', 'normalized',...
0150 'BackgroundColor', 'w', ...
0151 'Fontsize', EditFontSize, ...
0152 'String', {'rms','min', 'max', 'avg'}, ...
0153 'Position', [bl bb bw bh],...
0154 'Tag', 'LTPDVserverStat');
0155
0156
0157 bl = pmarg;
0158 bw = 0.1;
0159 bb = bb - bh - vmarg;
0160 sth = uicontrol(htab, 'Style','text',...
0161 'String', 'Server',...
0162 'Units', 'normalized', ...
0163 'BackgroundColor', 'w', ...
0164 'Fontsize', EditFontSize, ...
0165 'Position',[bl bb bw bh]);
0166 bl = bl+bw+pmarg;
0167 bw = 0.25;
0168 th = uicontrol(htab, ...
0169 'Style', 'popupmenu', ...
0170 'Units', 'normalized',...
0171 'BackgroundColor', 'w', ...
0172 'String', {'130.75.117.159','130.75.117.73', '130.75.117.164', 'localhost'}, ...
0173 'Fontsize', EditFontSize, ...
0174 'Position', [bl bb bw bh],...
0175 'Tag', 'LTPDVserverServer', ...
0176 'Callback', {@ltpdv_server_server_select, mainfig});
0177
0178
0179 bl = bl+bw+pmarg;
0180 bw = 0.22;
0181 th = uicontrol(htab, ...
0182 'Style', 'edit', ...
0183 'Units', 'normalized',...
0184 'BackgroundColor', 'w', ...
0185 'Fontsize', EditFontSize, ...
0186 'String', '', ...
0187 'Position', [bl bb bw bh],...
0188 'Tag', 'LTPDVserverServerEdit');
0189
0190
0191 bl = bl+bw+pmarg;
0192 bw = 0.07;
0193 sth = uicontrol(htab, 'Style','text',...
0194 'String', 'Port',...
0195 'Units', 'normalized', ...
0196 'BackgroundColor', 'w', ...
0197 'Fontsize', EditFontSize, ...
0198 'Position',[bl bb bw bh]);
0199 bl = bl+bw+pmarg;
0200 bw = 0.1;
0201 th = uicontrol(htab, ...
0202 'Style', 'edit', ...
0203 'Units', 'normalized',...
0204 'BackgroundColor', 'w', ...
0205 'Fontsize', EditFontSize, ...
0206 'String', '', ...
0207 'Position', [bl bb bw bh],...
0208 'Tag', 'LTPDVserverPortEdit');
0209
0210
0211 bl = pmarg;
0212 bw = 0.1;
0213 bb = bb - bh - vmarg;
0214 sth = uicontrol(htab, 'Style','text',...
0215 'String', 'RDS Level',...
0216 'Units', 'normalized', ...
0217 'BackgroundColor', 'w', ...
0218 'Fontsize', EditFontSize, ...
0219 'Position',[bl bb bw bh]);
0220 bl = bl+bw+pmarg;
0221 bw = 0.05;
0222 th = uicontrol(htab, ...
0223 'Style', 'edit', ...
0224 'Units', 'normalized',...
0225 'BackgroundColor', 'w', ...
0226 'Fontsize', EditFontSize, ...
0227 'String', '', ...
0228 'Position', [bl bb bw bh],...
0229 'Tag', 'LTPDVserverRdsEdit');
0230
0231
0232 bl = pmarg + bl + bw;
0233 bw = 0.1;
0234 sth = uicontrol(htab, 'Style','text',...
0235 'String', 'Cal Ver',...
0236 'Units', 'normalized', ...
0237 'BackgroundColor', 'w', ...
0238 'Fontsize', EditFontSize, ...
0239 'Position',[bl bb bw bh]);
0240 bl = bl+bw+pmarg;
0241 bw = 0.05;
0242 th = uicontrol(htab, ...
0243 'Style', 'edit', ...
0244 'Units', 'normalized',...
0245 'BackgroundColor', 'w', ...
0246 'Fontsize', EditFontSize, ...
0247 'String', '', ...
0248 'Position', [bl bb bw bh],...
0249 'Tag', 'LTPDVserverCalEdit');
0250
0251
0252
0253 ltpdv_server_server_select(0, mainfig);
0254 ltpdv_server_datatype_select(dtypeh, mainfig);
0255
0256
0257 bw = 0.13;
0258 bb = vmarg;
0259 bl = pmarg;
0260 pbh = uicontrol(htab,'Style','pushbutton',...
0261 'String','Query Server',...
0262 'Callback', {@ltpdv_server_queryServer, mainfig}, ...
0263 'Units', 'normalized', ...
0264 'Fontsize', EditFontSize, ...
0265 'Position',[bl bb bw 1.4*CommHeight]);
0266
0267
0268 bl = bl + bw + pmarg;
0269 pbh = uicontrol(htab,'Style','pushbutton',...
0270 'String','Get latest',...
0271 'Callback', {@ltpdv_server_getLatest, mainfig}, ...
0272 'Units', 'normalized', ...
0273 'Fontsize', EditFontSize, ...
0274 'Position',[bl bb bw 1.4*CommHeight]);
0275
0276
0277
0278
0279 ph = 0.3;
0280 htab = uipanel('Parent', hp, 'Position', [pmarg 1-2*ph-2*pmarg 1-2*pmarg ph]);
0281 set(htab, 'Units', 'Normalized')
0282 set(htab, 'Title', 'Times settings')
0283 set(htab, 'BackgroundColor', [0.7 0.3 0.3]);
0284 set(htab, 'ForegroundColor', 'w');
0285
0286
0287 bb = 1-0.7*bh-pmarg;
0288 bl = pmarg+0.4;
0289 bw = 0.5;
0290 timesH = uicontrol(htab, 'Style','text',...
0291 'String', 'Times',...
0292 'Units', 'normalized', ...
0293 'BackgroundColor', 'w', ...
0294 'Fontsize', EditFontSize, ...
0295 'Position',[bl bb bw 0.7*bh]);
0296
0297 bl = pmarg + 0.4;
0298 bh = 0.7;
0299 bb = bb - bh;
0300 lh = uicontrol(htab, 'Style', 'listbox', ...
0301 'String', '',...
0302 'BackgroundColor', 'w', ...
0303 'Value',1, 'Units', 'normalized', ...
0304 'Fontsize', EditFontSize, ...
0305 'Max', 1000, ...
0306 'Tag', 'LTPDVtimesList', ...
0307 'Position',[bl bb bw bh], ...
0308 'Callback', {@ltpdv_server_timeslist, mainfig});
0309
0310
0311 bw = (0.5 - 3*pmarg)/ 4;
0312 bh = CommHeight;
0313 bb = bb - bh - vmarg;
0314 pbh = uicontrol(htab,'Style','pushbutton',...
0315 'String','Delete times',...
0316 'Callback', {@ltpdv_server_deleteTimes, mainfig}, ...
0317 'Units', 'normalized', ...
0318 'Fontsize', EditFontSize, ...
0319 'Position',[bl bb bw bh]);
0320
0321 bl = bl + pmarg + bw;
0322 pbh = uicontrol(htab,'Style','pushbutton',...
0323 'String','Clear list',...
0324 'Callback', {@ltpdv_server_clearTimes, mainfig}, ...
0325 'Units', 'normalized', ...
0326 'Fontsize', EditFontSize, ...
0327 'Position',[bl bb bw bh]);
0328
0329 bl = bl + pmarg + bw;
0330 pbh = uicontrol(htab,'Style','pushbutton',...
0331 'String','Save list',...
0332 'Callback', {@ltpdv_server_saveTimes, mainfig}, ...
0333 'Units', 'normalized', ...
0334 'Fontsize', EditFontSize, ...
0335 'Position',[bl bb bw bh]);
0336
0337 bl = bl + pmarg + bw;
0338 pbh = uicontrol(htab,'Style','pushbutton',...
0339 'String','Load list',...
0340 'Callback', {@ltpdv_server_loadTimes, mainfig}, ...
0341 'Units', 'normalized', ...
0342 'Fontsize', EditFontSize, ...
0343 'Position',[bl bb bw bh]);
0344
0345
0346 pos = get(timesH, 'Position');
0347 bl = pmarg;
0348 bw = 0.1;
0349 bh = CommHeight;
0350 bb = pos(2)-2*vmarg;
0351 sth = uicontrol(htab, 'Style','text',...
0352 'String', 'Start',...
0353 'Units', 'normalized', ...
0354 'BackgroundColor', 'w', ...
0355 'Fontsize', EditFontSize, ...
0356 'Position',[bl bb bw bh]);
0357 bl = bl+bw+pmarg;
0358 bw = 0.25;
0359 th = uicontrol(htab, ...
0360 'Style', 'edit', ...
0361 'Units', 'normalized',...
0362 'BackgroundColor', 'w', ...
0363 'Fontsize', EditFontSize, ...
0364 'String', '', ...
0365 'Position', [bl bb bw bh],...
0366 'Callback', {@ltpdv_server_start_edit, mainfig}, ...
0367 'Tag', 'LTPDVserverStartEdit');
0368
0369 bl = pmarg;
0370 bw = 0.1;
0371 bb = bb - bh - vmarg;
0372 sth = uicontrol(htab, 'Style','text',...
0373 'String', 'Stop',...
0374 'Units', 'normalized', ...
0375 'BackgroundColor', 'w', ...
0376 'Fontsize', EditFontSize, ...
0377 'Position',[bl bb bw bh]);
0378 bl = bl+bw+pmarg;
0379 bw = 0.25;
0380 th = uicontrol(htab, ...
0381 'Style', 'edit', ...
0382 'Units', 'normalized',...
0383 'BackgroundColor', 'w', ...
0384 'String', '', ...
0385 'Fontsize', EditFontSize, ...
0386 'Position', [bl bb bw bh],...
0387 'Callback', {@ltpdv_server_stop_edit, mainfig}, ...
0388 'Tag', 'LTPDVserverStopEdit');
0389
0390
0391 bw = 0.1;
0392 bl = pmarg;
0393 bb = bb - bh - vmarg;
0394 sth = uicontrol(htab, 'Style','text',...
0395 'String', 'Duration',...
0396 'Units', 'normalized', ...
0397 'BackgroundColor', 'w', ...
0398 'Fontsize', EditFontSize, ...
0399 'Position',[bl bb bw bh]);
0400 bl = bl + bw + pmarg;
0401 bw = 0.25;
0402 sth = uicontrol(htab, 'Style','text',...
0403 'String', '',...
0404 'Units', 'normalized', ...
0405 'BackgroundColor', 'w', ...
0406 'Fontsize', EditFontSize, ...
0407 'Tag', 'LTPDVserverDurationDisplay', ...
0408 'Position',[bl bb bw bh]);
0409
0410
0411 pos = get(sth, 'Position');
0412 bl = pmarg;
0413 bw = pos(1) + pos(3) - pmarg;
0414 bb = bb - 0.7*bh - vmarg;
0415 sth = uicontrol(htab, 'Style','text',...
0416 'String', 'Comment',...
0417 'Units', 'normalized', ...
0418 'BackgroundColor', 'w', ...
0419 'Fontsize', EditFontSize, ...
0420 'Position',[bl bb bw bh*0.7]);
0421 bb = bb - bh - pmarg;
0422 bl = pmarg;
0423 th = uicontrol(htab, ...
0424 'Style', 'edit', ...
0425 'Units', 'normalized',...
0426 'BackgroundColor', 'w', ...
0427 'String', '', ...
0428 'Fontsize', EditFontSize, ...
0429 'Position', [bl bb bw bh],...
0430 'Tag', 'LTPDVserverCommentEdit');
0431
0432
0433 bl = pmarg;
0434 bb = bb - bh - vmarg;
0435 pbh = uicontrol(htab,'Style','pushbutton',...
0436 'String','Add to list',...
0437 'Fontsize', EditFontSize, ...
0438 'Callback', {@ltpdv_server_addTime, mainfig}, ...
0439 'Units', 'normalized', ...
0440 'Position',[bl bb bw bh]);
0441
0442
0443
0444 ph = 0.3;
0445 htab = uipanel('Parent', hp, 'Position', [pmarg pmarg+2*vmarg 1-2*pmarg ph]);
0446 set(htab, 'Units', 'Normalized')
0447 set(htab, 'Title', 'Channel settings')
0448 set(htab, 'BackgroundColor', [0.3 0.3 0.7]);
0449 set(htab, 'ForegroundColor', 'w');
0450
0451 bw = 0.5;
0452 bb = 1 - vmarg - 0.7*bh;
0453 bl = pmarg;
0454 sth = uicontrol(htab, 'Style','text',...
0455 'String', 'Channels',...
0456 'Units', 'normalized', ...
0457 'BackgroundColor', 'w', ...
0458 'Fontsize', EditFontSize, ...
0459 'Position',[bl bb bw 0.7*bh]);
0460 bh = 0.8;
0461 bb = bb - bh;
0462 lh = uicontrol(htab, 'Style', 'listbox', ...
0463 'String', '',...
0464 'BackgroundColor', 'w', ...
0465 'Value',1, 'Units', 'normalized', ...
0466 'Fontsize', EditFontSize, ...
0467 'Max', 1000, ...
0468 'Tag', 'LTPDVchannelList', ...
0469 'Position',[bl bb bw bh], ...
0470 'Callback', {@ltpdv_server_channellist, mainfig});
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487 bl = 0.55;
0488 bw = 0.08;
0489 bh = CommHeight;
0490 bb = 1 - vmarg - bh;
0491 sth = uicontrol(htab, 'Style','text',...
0492 'String', 'Search',...
0493 'Units', 'normalized', ...
0494 'BackgroundColor', 'w', ...
0495 'Fontsize', EditFontSize, ...
0496 'Position',[bl bb bw bh]);
0497 bl = bl+bw+pmarg;
0498 bw = 0.17;
0499 th = uicontrol(htab, ...
0500 'Style', 'edit', ...
0501 'Units', 'normalized',...
0502 'BackgroundColor', 'w', ...
0503 'String', '', ...
0504 'Fontsize', EditFontSize, ...
0505 'Position', [bl bb bw bh],...
0506 'Callback', {@ltpdv_search_channels, mainfig}, ...
0507 'Tag', 'LTPDVchannelSearchEdit');
0508 pos = get(sth, 'Position');
0509 bl = pos(1);
0510 bb = bb - bh - vmarg;
0511 pbh = uicontrol(htab,'Style','pushbutton',...
0512 'String','Get channels',...
0513 'Fontsize', EditFontSize, ...
0514 'Callback', {@ltpdv_server_getChannels, mainfig}, ...
0515 'Units', 'normalized', ...
0516 'Position',[bl bb bw bh]);
0517 end
0518
0519
0520 function th = buildWorkspacePanel(hp, mainfig)
0521
0522
0523 pmarg = 0.025;
0524 Lleft = pmarg;
0525 Lbottom = 0.4+pmarg;
0526 Lwidth = 1-2*pmarg;
0527 Lheight = 1-Lbottom-pmarg;
0528 th = uitable(hp, ...
0529 'Units', 'normalized',...
0530 'ColumnName', {'Name','Type', 'Size', 'kB'}, ...
0531 'Position', [Lleft Lbottom Lwidth Lheight],...
0532 'Tag', 'LTPDVworkspaceList', ...
0533 'CellSelectionCallback', {@ltpdv_workspaceList_select, mainfig});
0534
0535
0536 ltpdv_workspaceList_set_data(th);
0537
0538
0539 pl = pmarg;
0540 ph = 0.05;
0541 pb = Lbottom - ph - pmarg;
0542 pw = 0.1;
0543 pbh = uicontrol(hp,'Style','pushbutton',...
0544 'String','Refresh',...
0545 'Callback', {@ltpdv_workspaceList_set_data, th}, ...
0546 'Units', 'normalized', ...
0547 'Position',[pl pb pw ph]);
0548
0549
0550 pl = pmarg + pw + pmarg;
0551 ph = 0.05;
0552 pb = Lbottom - ph - pmarg;
0553 pw = 0.1;
0554 pbh = uicontrol(hp,'Style','pushbutton',...
0555 'String','Import',...
0556 'Callback', {@ltpdv_importObjs, mainfig, th}, ...
0557 'Units', 'normalized', ...
0558 'Position',[pl pb pw ph]);
0559
0560
0561 pl = pl + pw + pmarg;
0562 ph = 0.05;
0563 pb = Lbottom - ph - pmarg;
0564 pw = 0.3;
0565 ch = uicontrol(hp, 'Style', 'checkbox', ...
0566 'String', 'use var name', ...
0567 'TooltipString', 'Set object name to workspace variable name.', ...
0568 'Units', 'normalized', ...
0569 'Position', [pl pb pw ph], ...
0570 'Value', 1, ...
0571 'Tag', 'LTPDVusevarnameChk');
0572
0573 end
0574
0575
0576
0577
0578