From e5ef1c51e5754ecd84daa5e211cf9397ed15805c Mon Sep 17 00:00:00 2001
From: Yves Gouriou <yves.gouriou@ird.fr>
Date: Fri, 14 Dec 2007 16:32:31 +0000
Subject: [PATCH] =?UTF-8?q?Developpement=20du=20module=20de=20correction?=
 =?UTF-8?q?=20ajout=20des=20icones=20de=20selection=20de=20debut=20et=20fi?=
 =?UTF-8?q?n=20de=20s=C3=A9rie=20temporelle?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 tsg_util/tsg_plot_SalTsgSample.m |  2 +-
 tsgcor_GUI.m                     | 79 +++++++++++++++++++++++++++++---
 2 files changed, 74 insertions(+), 7 deletions(-)

diff --git a/tsg_util/tsg_plot_SalTsgSample.m b/tsg_util/tsg_plot_SalTsgSample.m
index df1f5a0..acb549d 100644
--- a/tsg_util/tsg_plot_SalTsgSample.m
+++ b/tsg_util/tsg_plot_SalTsgSample.m
@@ -85,6 +85,6 @@ set(hAxes(2), 'Visible', 'on' );
 
 % The 3 axes will behave identically when zoomed and panned
 % ---------------------------------------------------------
-%linkaxes([hAxes(1),hAxes(2),hAxes(3)], 'x');
+linkaxes([hAxes(1),hAxes(2)], 'x');
 
 end
diff --git a/tsgcor_GUI.m b/tsgcor_GUI.m
index 62657e3..e197674 100644
--- a/tsgcor_GUI.m
+++ b/tsgcor_GUI.m
@@ -127,6 +127,23 @@ function tsgcor_GUI( hMainFig )
                          [DEFAULT_PATH_FILE 'tsg_icon' filesep 'bottleicon.mat']),...
                         'HandleVisibility','callback', ...
                         'ClickedCallback', @BottleMenuCallback);
+    hStartlimitPushtool  = uipushtool(...   % Open toolbar button
+                        'Parent',hToolbar,...
+                        'TooltipString','Start time',...
+                        'Separator', 'on', ...
+                        'Tag', 'off', ...
+                        'CData',iconRead(...
+                         [DEFAULT_PATH_FILE 'tsg_icon' filesep 'startlimit.mat']),...
+                        'HandleVisibility','callback', ...
+                        'ClickedCallback', @TimeLimitCallback);
+    hEndlimitPushtool  = uipushtool(...   % Open toolbar button
+                        'Parent',hToolbar,...
+                        'TooltipString','End time',...
+                        'Tag', 'off', ...
+                        'CData',iconRead(...
+                         [DEFAULT_PATH_FILE 'tsg_icon' filesep 'endlimit.mat']),...
+                        'HandleVisibility','callback', ...
+                        'ClickedCallback', @TimeLimitCallback);
 
     % Static text that displays the position, salinity and temperature
     % ----------------------------------------------------------------
@@ -176,7 +193,7 @@ function tsgcor_GUI( hMainFig )
     htDateMin = uicontrol( ...
                 'Parent', hpDateLimit, ...
                 'Style', 'Text', ...
-                'String', 'Minimum  (mm/dd/yyyy)', ...
+                'String', 'Minimum  (yyyy-mm-dd hh:mm:ss)', ...
                 'HorizontalAlignment', 'left', ...
                 'Units', 'normalized', ...
                 'backgroundcolor', 'white', ...
@@ -193,7 +210,7 @@ function tsgcor_GUI( hMainFig )
     htDateMax = uicontrol( ...
                 'Parent', hpDateLimit, ...
                 'Style', 'Text', ...
-                'String', 'Maximum  (mm/dd/yyyy)', ...
+                'String', 'Maximum  (yyyy-mm-dd hh:mm:ss)', ...
                 'HorizontalAlignment', 'left', ...
                 'Units', 'normalized', ...
                 'backgroundcolor', 'white', ...
@@ -273,8 +290,8 @@ tsg    = getappdata( hMainFig, 'tsg_data' );
 sample = getappdata( hMainFig, 'sample' );
 cst    = getappdata( hMainFig, 'constante');
 
-dateMin = datestr(tsg.TIME(1), 23);
-dateMax = datestr(tsg.TIME(end), 23);
+dateMin = datestr(tsg.TIME(1), 31);
+dateMax = datestr(tsg.TIME(end), 31);
 set( hetDateMin, 'String', dateMin);
 set( hetDateMax, 'String', dateMax); 
 
@@ -323,7 +340,9 @@ set( hChild1Fig, 'Tag', 'ButtonMotionOn');
                 zoomAdaptiveDateTicks('off');
             case 'off'
                 pan off
-%                set(hQCPushtool, 'Tag', 'off' );
+                set(hChild1Fig,'Pointer','arrow');
+                set(hEndlimitPushtool, 'Tag', 'off' );
+                set(hStartlimitPushtool, 'Tag', 'off' );
 
                 zoom on
                 zoomAdaptiveDateTicks('on');
@@ -347,13 +366,61 @@ set( hChild1Fig, 'Tag', 'ButtonMotionOn');
                 panAdaptiveDateTicks('off');
             case 'off'
                 zoom off
-%                set(hQCPushtool, 'Tag', 'off' );
+                set(hChild1Fig,'Pointer','arrow');
+                set(hEndlimitPushtool, 'Tag', 'off' );
+                set(hStartlimitPushtool, 'Tag', 'off' );
 
                 pan on
                 panAdaptiveDateTicks('on');                
         end
     end
 
+    %----------------------------------------------------------------------
+    function TimeLimitCallback(hObject, eventdata)
+    % Callback function run when the ....    
+
+        % Desactivate the Zoom and Pan functions.
+        % ---------------------------------------
+        zoom off; pan off
+        panAdaptiveDateTicks('off');zoomAdaptiveDateTicks('off');
+
+        % Retrieve named application data
+        % -------------------------------
+        tsg = getappdata( hMainFig, 'tsg_data');
+        
+        % Toggle the tag of the Qc pushbutton to 'on' or 'off'
+        % ----------------------------------------------------
+        switch get(hObject, 'Tag'); 
+            case 'off'
+                set(hObject, 'Tag', 'on' );
+                set( hChild1Fig, 'Pointer', 'crosshair');
+            case 'on'
+                set(hObject, 'Tag', 'off' );
+                set(hChild1Fig,'Pointer','arrow');
+        end
+
+        % Wait for key press
+        % ------------------
+        [x, y] = ginput(1);
+        
+        % Write the date in the Editable uicontrol
+        % ----------------------------------------
+        if hObject == hEndlimitPushtool
+            set( hetDateMax, 'String', datestr(x, 31));
+        else
+            set( hetDateMin, 'String', datestr(x, 31));
+        end
+        
+        set(hChild1Fig,'Pointer','arrow');
+
+    end
+
+    %----------------------------------------------------------------------
+    function StartLimitCallback(hObject, eventdata)
+    % Callback function run when the ....    
+
+    end
+
     %----------------------------------------------------------------------
     function QCMenuCallback(gcbo, eventdata,handles)
     % Callback function run when the QC pushbutton is selected
-- 
GitLab