File: menubar.hxx

package info (click to toggle)
imview 1.1.9c-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,068 kB
  • ctags: 3,686
  • sloc: cpp: 28,834; sh: 2,624; ansic: 1,818; makefile: 767; exp: 112; python: 88
file content (242 lines) | stat: -rw-r--r-- 9,723 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/*
 * $Id: menubar.hxx,v 4.10 2007/06/23 13:47:17 hut66au Exp $
 *
 * Imview, the portable image analysis application
 * http://www.cmis.csiro.au/Hugues.Talbot/imview
 * ----------------------------------------------------------
 *
 *  Imview is an attempt to provide an image display application
 *  suitable for professional image analysis. It was started in
 *  1997 and is mostly the result of the efforts of Hugues Talbot,
 *  Image Analysis Project, CSIRO Mathematical and Information
 *  Sciences, with help from others (see the CREDITS files for
 *  more information)
 *
 *  Imview is Copyrighted (C) 1997-2001 by Hugues Talbot and was
 *  supported in parts by the Australian Commonwealth Science and 
 *  Industry Research Organisation. Please see the COPYRIGHT file 
 *  for full details. Imview also includes the contributions of 
 *  many others. Please see the CREDITS file for full details.
 *
 *  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, USA.
 * */

/*------------------------------------------------------------------------
 *
 * The application main menu
 *
 * Hugues Talbot	16 Nov 1997
 *
 *-----------------------------------------------------------------------*/

#ifndef MENUBAR_H
#define MENUBAR_H

#ifndef Fl_Object_H
#include <FL/Fl_Object.H>
#endif


#include <FL/Fl.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Sys_Menu_Bar.H>


#define IMAGE_LIST_ID      0
#define CLUT_LIST_ID       1
#define LAST_LIST_ID       2

#define ONLINEHELP         "quickhelp.html"
#define LICENSE            "gpl.html"
#define WARRANTY           "warranty.html"
// #define HELPURL            "http://extra.cmis.csiro.au/IA/talbot/ee02only/imview/"
#define HELPURL            "http://www.cmis.csiro.au/Hugues.Talbot/imview/online/imview.html"
#define LOCALHELP          "/usr/share/doc/imview-doc/html/imview.html"

#define IMAGE_LIST_BEGIN   "Image list"
#define CLUT_LIST_BEGIN    "Default Colourmap"

// menu items that have variable flags, for which
// their name is important
#define NEXTIMAGE_ITEM           "Next image"
#define PREVIOUSIMAGE_ITEM       "Previous image"
#define OVERLAY_SUBMENU          "Overlay"
#define OPEN_OVERLAY_ITEM        "Open overlay"
#define CLOSE_OVERLAY_ITEM       "Close overlay"
#define CLOSE_ITEM               "Close"
#define SAVE_ITEM                "Save"
#define PRINTPREFS_ITEM          "Print"
#define WRAPLUT_ITEM             "Wraparound LUT"
#define SYNCDISP_ITEM            "Synchronize display"
#define COLOURMAP_ITEM           "Colourmap"
#define VIEW3D_ITEM              "View 3D"
#define ROTATE3DMENU_ITEM        "3D rotate"
#define NEXTCOMPONENT_ITEM       "Next sample"
#define PREVIOUSCOMPONENT_ITEM   "Previous sample"
#define SELECTCOMPONENT_ITEM     "Select sample"
#define HYPERSPECTRAL_ITEM       "Show spectrum"
#define DEPTHPROFILE_ITEM        "Show depth profile"
#define RGBTRANSFER_ITEM         "RGB contrast/brightness"
#define BIVHIST_ITEM             "Bivariate histogram"
#define NEXTPLANE_ITEM           "Next plane"
#define PREVIOUSPLANE_ITEM       "Previous plane"
#define SELECTPLANE_ITEM         "Select plane"
#define NEXTFRAME_ITEM           "Next frame"
#define PREVIOUSFRAME_ITEM       "Previous frame"
#define SELECTFRAME_ITEM         "Select frame"
#define WIN_FIT_IMG_ITEM         "Fit &window to image"
#define IMG_FIT_WIN_ITEM         "Fit &image to window"
#define DECOUPLE_IMG_WIN_ITEM    "&De-coupled image and window"

// preference definition
enum imview_quickpref {
    PREF_SMOOTHUNZOOM = 0,  // smooth when unzooming
    PREF_DEBUG,             // debug on/off
    PREF_KEEPPOINTS,        // keep point when switching images (or not)
    PREF_STOPDEBUG,         // stop after each debug message (not recommended!)
    PREF_WARNING,           // show warnings
    PREF_WRAPAROUND,        // make the LUT wrap around after 255 rather than fit to min/max
    PREF_MAKECHAR,          // make images CHAR if no data is lost that way (the non-char data fits into chars)
    PREF_RGBRGB,            // RGB images are displayed as RGB, not as multi-spectral images
    PREF_FITALL,            // fit grey-levels/colours over all samples, not just the one displayed
    PREF_FIT3D,             // fit grey-level/colours over all slices
    PREF_SYNCDISP,          // synchronize display with the imview server
    PREF_HIDEMENU,          // totally hide the main menu
    PREF_FULLSCREEN,        // fullscreen mode
    LAST_INT_ARG,           // END marker.
};

#define MODE_POINTFILE        0

// apparently all the callbacks have to be global functions
void openfile_cb(const char *s);
void test_cb(Fl_Object *,void *i);
void open_cb(Fl_Object *, void *);
void openoverlay_cb(Fl_Object *, void *);
void closeoverlay_cb(Fl_Object *, void *);
void save_cb(Fl_Object *, void *);
void printprefs_cb(Fl_Object *, void *);
void close_cb(Fl_Object *, void *);
// help
void whodunit_cb(Fl_Object *, void *);
void onlinehelp_cb(Fl_Object *, void *);
void fulldocument_cb(Fl_Object *, void *);
void licence_cb(Fl_Object *, void *);
void warranty_cb(Fl_Object *, void *);
// histogram
void transfer_cb(Fl_Object *, void *);
void transferRGB_cb(Fl_Object *, void *);
void threshold_cb(Fl_Object *, void *);
// zoom
void zoomin_cb(Fl_Object *,void *);
void zoomout_cb(Fl_Object *,void *);
void smallzoomin_cb(Fl_Object *,void *);
void smallzoomout_cb(Fl_Object *,void *);
void unzoom_cb(Fl_Object *,void *);
void selectzoom_cb(Fl_Object *, void *);
void thiszoom_cb(Fl_Object *, void *);
void selectdefaultzoom_cb(Fl_Object *, void *);
// 3D viewer
void showview3d_cb(Fl_Object *, void *);
// rotations & flips
void rotate90right_cb(Fl_Object *, void *);
void rotate90left_cb(Fl_Object *, void *);
void rotate180_cb(Fl_Object *, void *);
void rotate3dup_cb(Fl_Object *, void *);
void rotate3ddown_cb(Fl_Object *, void *);
void flipv_cb(Fl_Object *, void *);
void fliph_cb(Fl_Object *, void *);
// image list manipulation
void image_cb(Fl_Object *, void *);
void nextimage_cb(Fl_Object *, void *arg);
void previousimage_cb(Fl_Object *, void *arg);
void saveimagelist_cb(Fl_Object *, void *);
// various manipulation on images
void nextcomponent_cb(Fl_Object *, void *);
void previouscomponent_cb(Fl_Object *, void *);
void showprofile_cb(Fl_Object *, void *);
void showspectrum_cb(Fl_Object *, void *);
void showbivhist_cb(Fl_Object *, void *);
void setcomponentvalue(int v);
void selectcomponent_cb(Fl_Object *, void *);
void showdepthprofile_cb(Fl_Object *, void *);
void nextplane_cb(Fl_Object *, void *);
void previousplane_cb(Fl_Object *, void *);
void setplanevalue(int v);
void selectplane_cb(Fl_Object *, void *);
void setframevalue(int v);
void nextframe_cb(Fl_Object *, void *);
void previousframe_cb(Fl_Object *, void *);
void selectframe_cb(Fl_Object *, void *);
void imageinfo_cb(Fl_Object *, void *);
void toolbar_cb(Fl_Object *, void *);
int setClut(const char *label); // Hmmm
void clut_cb(Fl_Object *,void *);
void noclut_cb(Fl_Object *,void *);
void mode_cb(Fl_Object *,void *);
// user preferences
void userprefspanel_cb(Fl_Object *, void *);
void preference_cb(Fl_Object *,void *);
void displaymode_cb(Fl_Object *,void *);
void fullscreen_cb(Fl_Object *,void *);
void hidemainmenu_cb(Fl_Object *, void *arg);
void showmainmenu_cb(Fl_Object *, void *arg);
// pointfiles
void openpointfile_cb(Fl_Object *,void *);
void newpointfile_cb(Fl_Object *, void *);
void closepointfile_cb(Fl_Object *,void *);
void deleteallpoints_cb(Fl_Object *,void *);
void deletelastpoint_cb(Fl_Object *,void *);
void setxorvalue_cb(Fl_Object *,void *);
// server
void startserver_cb(Fl_Object *, void *);
void stopserver_cb(Fl_Object *, void *);
void showprogress_cb(Fl_Object *, void *);
// graceful exit
void quit_cb(Fl_Object *,void *);
void noquit_cb(Fl_Object *,void *);

// a global wrapper
int openimage(const char *imname, int frame=-1);

class imViewMenuBar: public Fl_Menu_Bar {
public:
    imViewMenuBar(int x, int y, int w, int h, const char *label = 0);
    ~imViewMenuBar();
    int addToItemList(const char *newImage, int listID);
    void removeFromItemList(const char *oldImage, int listID);
    void *getSelectedItemArgument(int listID);
    Fl_Menu_Item *getSelectedMenuItem(int listID);
    void *getItemByLabel(const char *givenLbl, int listID);
    char *getItemListContent(int listID, int &nbitems);
    void *getNextItemInList(int listID);
    void *getPreviousItemInList(int listID);
    int isAlreadyInItemList(const char *newImageName, int listID);
    void setFlagsByName(const char *itemName, int newFlags, Fl_Menu_Item *aMenu = 0, int menuSize = 0);
    int getFlagsByName(const char *itemName, Fl_Menu_Item *aMenu = 0, int menuSize = 0);
    int getNbImagesInList(void) { return nbImagesInList; }
    void setSysMenu(void);
    void draw();
private:
    Fl_Menu_Item *dynamicMenu, *staticMenu_;
    Fl_Sys_Menu_Bar *sysmenu_;
    // global variables for the menu application
    const char *listName[LAST_LIST_ID];
    void *listCallback[LAST_LIST_ID]; // this will be a list of functions
    int   nbImagesInList;    
};


#endif // MENUBAR_H