File: MyDocument.h

package info (click to toggle)
lynkeos.app 3.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,740 kB
  • sloc: objc: 36,412; ansic: 684; cpp: 148; sh: 68; makefile: 21
file content (186 lines) | stat: -rw-r--r-- 5,818 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//
//  Lynkeos
//  $Id: MyDocument.h 585 2018-09-08 21:30:37Z j-etienne $
//
//  Created by Jean-Etienne LAMIAUD on Thu Jul 29 2004.
//  Copyright (c) 2004-2014. Jean-Etienne LAMIAUD
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//

/*! \defgroup Controlers Controler classes
*
* The controler classes manage the interactions between the view classes and 
* the model classes
*/

/*!
 * @header
 * @abstract Definitions of the document controller.
 */
#ifndef __MYDOCUMENT_H
#define __MYDOCUMENT_H

#import <Foundation/Foundation.h>

#include "LynkeosProcessing.h"
#include "LynkeosProcessingView.h"
#include "MyImageListItem.h"
#include "MyImageList.h"
#include "MyCalibrationLock.h"
#include "MyProcessingThread.h"
#include "ProcessStackManager.h"

/*!
 * @name Document delegation
 * @discussion Methods for document only use
 */
@protocol LynkeosDocumentDelegate

/*!
 * @abstract Called after document loading, or re-loading
 */
- (void) documentDidLoad : (id <LynkeosDocument>)document ;

/*!
 * @abstract Called at process launching
 */
- (void) document:(id <LynkeosDocument>)document
  processDidStart:(Class)processClass;

/*!
 * @abstract Called at process end
 */
- (void) document:(id <LynkeosDocument>)document
  processHasEnded:(Class)processingClass;

/*!
 * @abstract Called after adding an item in a list
 */
- (void) itemWasAdded:(id <LynkeosDocument>)document ;

/*!
 * @abstract Called after removing an item from a list
 */
- (void) itemWasRemoved:(id <LynkeosDocument>)document ;

/*!
 * @abstract Called when the list mode (dark frame, flat fied, image) changes
 */
- (void) documentListModeChanged:(id <LynkeosDocument>)document ;

/*!
 * @abstract Called when the data mode (list, result) changes
 */
- (void) documentDataModeChanged:(id <LynkeosDocument>)document ;

@end

/*!
 * @abstract The document controler
 * @discussion This class controls the actions on the document.
 *   It dialogs with MyImageListWindow for GUI interactions and
 *   the Models classes for document contents change.
 * @ingroup Controlers
 */
@interface MyDocument : NSDocument <LynkeosViewDocument>
{
@private
   // Document data
   MyImageList*		_darkFrameList;   //!< Thermal noise images
   MyImageList*		_flatFieldList;   //!< Optical attenuations
   MyImageList*         _imageList;       //!< Images to be processed

   MyCalibrationLock*    _calibrationLock;//!< Enforces calibration restrictions
   NSDictionary*         _windowSizes;     //!< Saved window sizes and placement

   // Lists management
   MyImageList*         _currentList;     //!< List being used
   DataMode_t           _dataMode;      //!< Which data to use

   // Multithread control
   NSMutableArray      *_threads;         //!< Living threads
   Class               _currentProcessingClass; //!< What processing is running
   //! Item being processed, nil if it is a list processing
   id <LynkeosProcessableItem> _processedItem;
   u_long               _imageListSequenceNumber; //!< To detect original change
   ProcessStackManager *_processStackMgr; //!< Manager for the stack
   //! Used at document loading to apply the processings
   NSEnumerator         *_initialProcessEnum;
   BOOL                 _isInitialProcessing;

#if !defined GNUSTEP
   io_connect_t         _rootPort;         //!< Sleep control
   io_object_t          _sysPowerNotifier; //!< Sleep notifier
   IONotificationPortRef  _sysPowerNotifPort;
#endif

   NSWindowController
   <LynkeosWindowController,
    LynkeosDocumentDelegate> *_myWindow; //!< Document window controller

   LynkeosProcessingParameterMgr* _parameters;    //!< Aggregate class for parameters

   // Stuff to help notifying
   NSNotificationCenter* _notifCenter;    //!< Our notification center
   NSNotificationQueue* _notifQueue;      //!< For asynchronous notifications
}

/// \name Accessors
/// Read accessors to the class attributes
//@{
- (NSDictionary*) savedWindowSizes ;
//@}

/// \name GUIActions
/// Coming from window controllers
//@{
/*!
 * @abstract Add the item to the current list
 * @discussion The undo manager is updated for undoing the add
 * @param item item to add to the list
 */
- (void) addEntry :(MyImageListItem*)item ;
/*!
 * @abstract Remove the item from the current list
 * @discussion The undo manager is updated for undoing the remove
 * @param item item to remove from the list
 */
- (void) deleteEntry :(MyImageListItem*)item ;
- (void) changeEntrySelection :(MyImageListItem*)entry value:(BOOL)v ;
//@}

/// \name Process management
//@{
/*!
 * @abstract Inform the document of the thread creation.
 * @discussion The "obj" proxy cannot be retained. The process ended call will
 *    inform of the proxy release.
 * @param proxy Proxy for the created process thread.
 * @param cnx The connection for this thread.
 */
- (oneway void) processStarted: (id)proxy connection:(LynkeosThreadConnection*)cnx;

/*!
 * @abstract Inform the document of the thread termination.
 * @discussion This method is synchronous to wait execution before terminating
 *    the thread.
 * @param obj The proxy for the thread that is ending.
 */
- (void) processEnded: (id)obj ;
//@}
@end

#endif