Skip to content

Commit 559e383

Browse files
author
Jeffrey M Girard
committed
Updates for v6.02
Updated the way the Collect and Review windows resize to be more efficient and to make it impossible to go below 1024x768 pixels. Also updated the Review window to enable video playback and seeking without having any annotation files loaded.
1 parent 03e413e commit 559e383

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

fig_collect.m

+10-14
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
% Create and center main window
1212
defaultBackground = get(0,'defaultUicontrolBackgroundColor');
1313
handles.figure_collect = figure( ...
14-
'Units','normalized', ...
1514
'Name','DARMA: Collect Ratings', ...
1615
'MenuBar','none', ...
1716
'ToolBar','none', ...
1817
'NumberTitle','off', ...
1918
'Visible','off', ...
2019
'Color',defaultBackground, ...
21-
'SizeChangedFcn',@figure_collect_SizeChanged, ...
20+
'ResizeFcn',@figure_collect_Resize, ...
2221
'KeyPressFcn',@figure_collect_KeyPress, ...
2322
'CloseRequestFcn',@figure_collect_CloseReq);
2423
% Create menu bar elements
@@ -63,8 +62,13 @@
6362
handles.menu_report = uimenu(handles.menu_help, ...
6463
'Label','Report Issues', ...
6564
'Callback',@menu_report_Callback);
66-
pause(0.1);
67-
set(handles.figure_collect,'Position',[0.1 0.1 0.8 0.8]);
65+
% Set minimum size
66+
set(handles.figure_collect,'Units','normalized','Position',[0.1,0.1,0.8,0.8],'Visible','on');
67+
drawnow;
68+
jFig = get(handle(handles.figure_collect),'JavaFrame');
69+
jClient = jFig.fHG2Client;
70+
jWindow = jClient.getWindow;
71+
jWindow.setMinimumSize(java.awt.Dimension(1024,768));
6872
% Create uicontrol elements
6973
handles.axis_info = axes(handles.figure_collect, ...
7074
'Units','normalized', ...
@@ -582,7 +586,7 @@ function menu_defaultdir_Callback(hObject,~)
582586

583587
function menu_about_Callback(~,~)
584588
global version;
585-
msgbox(sprintf('DARMA version %.2f\nJeffrey M Girard (c) 2014-2016\nhttp://darma.jmgirard.com\nGNU General Public License v3',version),'About','Help');
589+
msgbox(sprintf('DARMA version %.2f\nJeffrey M Girard (c) 2014-2017\nhttp://darma.jmgirard.com\nGNU General Public License v3',version),'About','Help');
586590
end
587591

588592
% ===============================================================================
@@ -772,20 +776,12 @@ function create_axis(handles)
772776

773777
% =========================================================
774778

775-
function figure_collect_SizeChanged(hObject,~)
779+
function figure_collect_Resize(hObject,~)
776780
handles = guidata(hObject);
777781
if isfield(handles,'figure_collect')
778-
pos = getpixelposition(handles.figure_collect);
779782
% Force to remain above a minimum size
780-
if pos(3) < 1024 || pos(4) < 600
781-
setpixelposition(handles.figure_collect,[pos(1) pos(2) 1024 600]);
782-
movegui(handles.figure_collect,'center');
783-
set(handles.toggle_playpause,'FontSize',12);
784-
set(handles.table_info,'ColumnName',[]);
785-
else
786783
set(handles.toggle_playpause,'FontSize',14);
787784
set(handles.table_info,'ColumnName',{'Bin Size','Axis Magnitude'});
788-
end
789785
% Update the size and position of the VLC controller
790786
if isfield(handles,'vlc')
791787
move(handles.vlc,getpixelposition(handles.axis_guide));

fig_launcher.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
% License: https://github.com/jmgirard/DARMA/blob/master/LICENSE.txt
44

55
global version;
6-
version = 6.01;
6+
version = 6.02;
77
% Create and center main window
88
defaultBackground = get(0,'defaultUicontrolBackgroundColor');
99
handles.figure_launcher = figure( ...

fig_review.m

+21-16
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
% Create and maximize annotation window
66
defaultBackground = get(0,'defaultUicontrolBackgroundColor');
77
handles.figure_review = figure( ...
8-
'Units','normalized', ...
9-
'Position',[0.1 0.1 0.8 0.8], ...
108
'Name','DARMA: Review Ratings', ...
119
'NumberTitle','off', ...
1210
'MenuBar','none', ...
1311
'ToolBar','none', ...
1412
'Visible','off', ...
1513
'Color',defaultBackground, ...
16-
'SizeChangedFcn',@figure_review_SizeChanged, ...
14+
'ResizeFcn',@figure_review_Resize, ...
1715
'CloseRequestFcn',@figure_review_CloseRequest);
1816
%Create menu bar elements
1917
handles.menu_media = uimenu(handles.figure_review, ...
@@ -60,8 +58,15 @@
6058
handles.menu_report = uimenu(handles.menu_help, ...
6159
'Label','Report Issues', ...
6260
'Callback',@menu_report_Callback);
63-
pause(0.1);
61+
% Set minimum size
62+
set(handles.figure_review,'Units','normalized','Position',[0.1,0.1,0.8,0.8],'Visible','on');
63+
drawnow;
64+
jFig = get(handle(handles.figure_review),'JavaFrame');
65+
jClient = jFig.fHG2Client;
66+
jWindow = jClient.getWindow;
67+
jWindow.setMinimumSize(java.awt.Dimension(1024,768));
6468
%Create uicontrol elements
69+
global ts_X ts_Y;
6570
lc = .01; rc = .89;
6671
handles.axis_X = axes('Units','Normalized', ...
6772
'Parent',handles.figure_review, ...
@@ -73,6 +78,9 @@
7378
'PickableParts','none', ...
7479
'ButtonDownFcn',{@axis_click_Callback,'X'});
7580
ylabel('X Axis','FontSize',10);
81+
hold on;
82+
ts_X = plot(handles.axis_X,[0,0],[-100,100],'k');
83+
hold off;
7684
handles.axis_Y = axes('Units','Normalized', ...
7785
'Parent',handles.figure_review, ...
7886
'TickLength',[0.005 0], ...
@@ -83,6 +91,9 @@
8391
'PickableParts','none', ...
8492
'ButtonDownFcn',{@axis_click_Callback,'Y'});
8593
ylabel('Y Axis','FontSize',10);
94+
hold on;
95+
ts_Y = plot(handles.axis_Y,[0,0],[-100,100],'k');
96+
hold off;
8697
handles.listbox = uicontrol('Style','listbox', ...
8798
'Parent',handles.figure_review, ...
8899
'Units','normalized', ...
@@ -200,6 +211,8 @@ function menu_openmedia_Callback(hObject,~)
200211
handles.dur = handles.vlc.input.length / 1000;
201212
set(handles.toggle_playpause,'String','Play','Enable','on');
202213
set(handles.menu_closemedia,'Enable','on');
214+
set(handles.axis_X,'XLim',[0,handles.dur],'XTick',round(linspace(0,handles.dur,11)),'PickableParts','Visible');
215+
set(handles.axis_Y,'XLim',[0,handles.dur],'XTick',round(linspace(0,handles.dur,11)),'PickableParts','Visible');
203216
catch err
204217
msgbox(err.message,'Error loading media file.','error'); return;
205218
end
@@ -269,7 +282,7 @@ function menu_export_Callback(hObject,~)
269282

270283
function menu_about_Callback(~,~)
271284
global version;
272-
msgbox(sprintf('DARMA version %.2f\nJeffrey M Girard (c) 2014-2016\nhttp://darma.jmgirard.com\nGNU General Public License v3',version),'About','Help');
285+
msgbox(sprintf('DARMA version %.2f\nJeffrey M Girard (c) 2014-2017\nhttp://darma.jmgirard.com\nGNU General Public License v3',version),'About','Help');
273286
end
274287

275288
% ===============================================================================
@@ -768,19 +781,11 @@ function update_plots(handles)
768781

769782
% ===============================================================================
770783

771-
function figure_review_SizeChanged(hObject,~)
784+
function figure_review_Resize(hObject,~)
772785
handles = guidata(hObject);
773-
if isfield(handles,'figure_review')
774-
pos = getpixelposition(handles.figure_review);
775-
% Force to remain above a minimum size
776-
if pos(3) < 1024 || pos(4) < 600
777-
setpixelposition(handles.figure_review,[pos(1) pos(2) 1024 600]);
778-
movegui(handles.figure_review,'center');
779-
end
786+
if isfield(handles,'figure_review') && isfield(handles,'vlc')
780787
% Update the size and position of the VLC controller
781-
if isfield(handles,'vlc')
782-
move(handles.vlc,getpixelposition(handles.axis_guide));
783-
end
788+
move(handles.vlc,getpixelposition(handles.axis_guide));
784789
end
785790
end
786791

0 commit comments

Comments
 (0)