ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gfview/mainwin.cpp
Revision: 45
Committed: Tue Sep 6 18:19:20 2011 UTC (8 years, 6 months ago) by gpertea
File size: 19384 byte(s)
Log Message:
added gfview files

Line File contents
1 /********************************************************************************
2 * *
3 * *
4 *********************************************************************************/
5 #include "mainwin.h"
6 #include "mdichild.h"
7 #include "clrutils.h"
8 /*******************************************************************************/
9
10 // Map
11 FXDEFMAP(MainWindow) MainWindowMap[]={
12 //________Message_Type____________ID___________________Message_Handler________
13 FXMAPFUNC(SEL_COMMAND, MainWindow::ID_ABOUT, MainWindow::onCmdAbout),
14 FXMAPFUNC(SEL_COMMAND, MainWindow::ID_RANDOM, MainWindow::onRandomLayout),
15 FXMAPFUNC(SEL_COMMAND, MainWindow::ID_FILEFILTER, MainWindow::onCmdFilter),
16 FXMAPFUNC(SEL_COMMAND, MainWindow::ID_FILEOPEN, MainWindow::onCmdFileDlg),
17 FXMAPFUNC(SEL_SIGNAL, MainWindow::ID_CLOSEALL, MainWindow::onCmdCloseAll),
18 FXMAPFUNC(SEL_COMMAND, MainWindow::ID_CLOSEALL, MainWindow::onCmdCloseAll),
19 FXMAPFUNC(SEL_COMMAND, MDIChild::ID_MAXRESTORE, MainWindow::onMaxRestore),
20 FXMAPFUNC(SEL_DOUBLECLICKED, MainWindow::ID_TREELIST, MainWindow::onCmdTreeList),
21 };
22
23 // Object implementation
24 FXIMPLEMENT(MainWindow,FXMainWindow,MainWindowMap,ARRAYNUMBER(MainWindowMap))
25
26
27 // FXSplashDlg implementation
28 FXIMPLEMENT(FXSplashDlg,FXDialogBox,NULL,0)
29
30 /*******************************************************************************/
31
32 const unsigned char penguin[]={
33 0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x12,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
34 0x80,0x80,0x80,0x00,0x00,0x00,0xc0,0xc0,0xc0,0x10,0x10,0x10,0xff,0xff,0xff,0xe0,
35 0xa0,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x12,0x00,0x00,0x03,
36 0x53,0x08,0xba,0x21,0x12,0x2b,0xc6,0xe6,0x9e,0x94,0x62,0x64,0x77,0xa3,0x20,0x4e,
37 0x21,0x74,0x8b,0x60,0x9c,0x1a,0xa9,0x98,0xa8,0x45,0xb2,0x85,0x38,0x76,0x4f,0x6c,
38 0xbb,0x93,0x60,0xdb,0x0d,0xe4,0xd9,0x83,0x1d,0xe7,0x57,0x18,0x04,0x6f,0xb8,0x4c,
39 0xec,0x88,0x9c,0x01,0x0c,0x47,0x66,0xac,0xa2,0x38,0x19,0x76,0x36,0x83,0xc3,0xf0,
40 0xb4,0x5e,0x77,0x03,0xaf,0xf8,0x7b,0x13,0x77,0xad,0xd3,0xad,0x75,0x61,0xa5,0x54,
41 0x02,0x27,0x45,0x02,0x00,0x3b
42 };
43
44
45 static const FXchar fltfiles[]="ACE files (*.ace,*ACE)\nLayout files (*.lyt)\nAny file (*)";
46
47 FXString fileNameOnly(const FXString& file){
48 register FXint f,n;
49 if(!file.empty()){
50 n=0;
51 #ifdef WIN32
52 if(isalpha((FXuchar)file[0]) && file[1]==':') n=2;
53 #endif
54 f=n;
55 while(file[n]){
56 if(ISPATHSEP(file[n])) f=n+1;
57 n++;
58 }
59 return FXString(file.text()+f,n-f);
60 }
61 return FXString::null;
62 }
63
64 void MainWindow::initColors() {
65 FXRegistry& ini=getApp()->reg();
66 static const char* section="Colors";
67 static const char* bsection="Base Color Mode";
68 static const char* grpsect="Group Colors";
69
70 matchColors[16]=ini.readColorEntry(section, "Mismatch",
71 makeHiliteColor(makeHiliteColor(fxcolorfromname("Red"))));
72 ini.writeColorEntry(section,"Mismatch",matchColors[16]);
73 matchColors[15]=ini.readColorEntry(section, "MaxCoverage",
74 fxcolorfromname("darkBlue"));
75 ini.writeColorEntry(section,"MaxCoverage",matchColors[15]);
76 ctgQuals[16]=ini.readColorEntry(section, "ContigNoCoverage",
77 getApp()->getBaseColor());
78 ini.writeColorEntry(section,"ContigNoCoverage",ctgQuals[16]);
79 ctgQuals[15]=ini.readColorEntry(section,"ContigMaxCoverage",0xFF00FFFF);
80 ini.writeColorEntry(section,"ContigMaxCoverage",ctgQuals[15]);
81
82 /*
83 buffer for color array to pass to
84 the Seq Paint method
85 0 = seq color
86 1 = seq highlight
87 2 = seq shadow
88 3 = seqtext color
89 4 = seqtrim color
90 5 = seq range color
91 6 = seq select color
92 7 = alternate seq color (ET)
93 8 = inter-segment connector color
94 9 = internal trim color
95 10 = major consensus splice site
96 11 = minor consensus splice site
97 */
98 //-- base sequence color:
99
100 seqColors[0]=ini.readColorEntry(section,"SeqBg",fxcolorfromname("darkBlue"));
101 // Hex Colors are BGR style !
102 //-- highlight border:
103 seqColors[1]=ini.readColorEntry(section,"SeqBorderHilight",
104 makeHiliteColor(fxcolorfromname("Gray50")));
105 //--shadow border:
106 seqColors[2]=ini.readColorEntry(section,"SeqBorderShadow",
107 makeShadowColor(fxcolorfromname("Gray20")));
108 //nucleotide font color:
109 seqColors[3]=ini.readColorEntry(section,"SeqText",fxcolorfromname("White"));
110 //-- clipping color:
111 seqColors[4]=ini.readColorEntry(section,"SeqClipping",
112 fxcolorfromname("MistyRose3")); //trimmed ends
113 //seq range color:
114 seqColors[5]=ini.readColorEntry(section,"SeqRange",fxcolorfromname("Green"));
115 //seq select color:
116 seqColors[6]=ini.readColorEntry(section,"SeqSelect", fxcolorfromname("Yellow"));
117 //-- NP/ET color:
118 seqColors[7]=ini.readColorEntry(section,"SeqSpecial", fxcolorfromname("darkRed"));
119 //-- inter-segment gap line:
120 seqColors[8]=ini.readColorEntry(section, "Intron", fxcolorfromname("LightSkyBlue3"));
121 //-- internal clipping color:
122 seqColors[9]=ini.readColorEntry(section, "InternalClipping", fxcolorfromname("MistyRose1"));
123 //-- splice site consensus
124 seqColors[10]=ini.readColorEntry(section, "MajorSplice", fxcolorfromname("Red")); //hard
125 seqColors[11]=ini.readColorEntry(section, "MinorSplice", fxcolorfromname("DarkPink")); //soft
126 ini.writeColorEntry(section, "SeqBg",seqColors[0]);
127 ini.writeColorEntry(section, "SeqBorderHilight",seqColors[1]);
128 ini.writeColorEntry(section, "SeqBorderShadow",seqColors[2]);
129 ini.writeColorEntry(section, "SeqText",seqColors[3]);
130 ini.writeColorEntry(section, "SeqClipping",seqColors[4]);
131 ini.writeColorEntry(section, "SeqRange",seqColors[5]);
132 ini.writeColorEntry(section, "SeqSelect",seqColors[6]);
133 ini.writeColorEntry(section, "SeqSpecial",seqColors[7]);
134 ini.writeColorEntry(section, "Intron",seqColors[8]);
135 ini.writeColorEntry(section, "InternalClipping",seqColors[9]);
136 ini.writeColorEntry(section, "MajorSplice",seqColors[10]);
137 ini.writeColorEntry(section, "MinorSplice",seqColors[11]);
138
139 FXString s;
140 FXColor ggapc;
141 for (int i=0;i<NUM_GROUPS;i++) {
142 s.format("ColorGrp%d",i);
143 grpColors[0][i]=ini.readColorEntry(grpsect, s.text(),
144 getRColor(seqColors[0],NUM_GROUPS,i));
145 ini.writeColorEntry(grpsect,s.text(),grpColors[0][i]);
146 //intron color: increase luminance, decrease saturation of the group color
147 ggapc=makeHiliteColor(makeHiliteColor(grpColors[0][i]));
148 ggapc=modhls(ggapc,0,45,-200);
149 if (ggapc==backColor) { //white, I assume..
150 ggapc=modhls(ggapc, 0,-10,10);
151 }
152 grpColors[1][i]=ggapc;
153 }
154 for (int i=0;i<15;i++) {
155 matchColors[14-i]=modhls(matchColors[15], 0, 10*i, -5*i);
156 ctgQuals[14-i]=modhls(ctgQuals[15], 0, -4*i, 0);
157 }
158 baseColors[0]=ini.readColorEntry(bsection, "BaseText", fxcolorfromname("White")); //font color
159 baseColors[1]=ini.readColorEntry(bsection, "BaseA", fxcolorfromname("DarkGreen")); //A
160 baseColors[2]=ini.readColorEntry(bsection, "BaseC", fxcolorfromname("Blue")); //C
161 baseColors[3]=ini.readColorEntry(bsection, "BaseG", fxcolorfromname("Orange")); //G
162 baseColors[4]=ini.readColorEntry(bsection, "BaseT", fxcolorfromname("Red")); //T
163 baseColors[5]=ini.readColorEntry(bsection, "BaseX", fxcolorfromname("Gray20")); // N,*, other codes
164 ini.writeColorEntry(bsection, "BaseText",baseColors[0]);
165 ini.writeColorEntry(bsection, "BaseA",baseColors[1]);
166 ini.writeColorEntry(bsection, "BaseC",baseColors[2]);
167 ini.writeColorEntry(bsection, "BaseG",baseColors[3]);
168 ini.writeColorEntry(bsection, "BaseT",baseColors[4]);
169 ini.writeColorEntry(bsection, "BaseX",baseColors[5]);
170 ini.write();
171 }
172
173 // Make some windows
174 MainWindow::MainWindow(FXApp *a):FXMainWindow(a,"Cluster viewer",NULL,NULL,
175 DECOR_ALL|PLACEMENT_SCREEN,40,40,760,560) {
176
177 //MDIChild::ifont=NULL;
178 constructing=true;
179 initColors();
180 new FXToolTip(a);
181 menubar=new FXMenuBar(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
182 // Status bar
183 statusbar=new FXStatusBar(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER);
184 FXSplitter* splitter=new FXSplitter(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_TRACKING);
185 /*
186 // Contents
187 FXHorizontalFrame *contents = new FXHorizontalFrame(this,
188 LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0, 0,0);
189 */
190
191 // Sunken border for tree
192 FXVerticalFrame* treebox=new FXVerticalFrame(splitter,LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,160,0,0,0,0,0);
193 // Make tree
194 FXHorizontalFrame* treeframe=new FXHorizontalFrame(treebox,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
195 dirlist=new FXDirList(treeframe,this,ID_TREELIST,
196 DIRLIST_SHOWFILES|TREELIST_BROWSESELECT|
197 TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y);
198 FXHorizontalFrame* filterframe=new FXHorizontalFrame(treebox,LAYOUT_FILL_X);
199 new FXLabel(filterframe,"Filter:");
200 filter=new FXComboBox(filterframe,25,this,ID_FILEFILTER,COMBOBOX_STATIC|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK);
201 filter->appendItem("ACE files (*.ace)");
202 filter->appendItem("Layout files (*.lyt)");
203 filter->appendItem("All Files (*)");
204 filter->setNumVisible(3);
205 setCurrentPattern(0);
206 dirlist->setDirectory(FXSystem::getCurrentDirectory());
207 treebox->hide();
208
209 // --------- MDI Stuff ------------------------------------------
210 // Nice sunken box around the MDIClient
211 FXVerticalFrame *mdibox=new FXVerticalFrame(splitter,
212 FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
213 // MDI Client
214 mdiclient=new FXMDIClient(mdibox,LAYOUT_FILL_X|LAYOUT_FILL_Y);
215
216 // Make MDI Menu
217 mdimenu=new FXMDIMenu(this,mdiclient);
218 mdiicon=new FXGIFIcon(a,penguin);
219
220 // MDI buttons in menu:- note the message ID's!!!!!
221 // Normally, MDI commands are simply sensitized or desensitized;
222 // Under the menubar, however, they're hidden if the MDI Client is
223 // not maximized. To do this, they must have different ID's.
224 new FXMDIWindowButton(menubar,mdimenu,mdiclient,FXMDIClient::ID_MDI_MENUWINDOW,LAYOUT_LEFT);
225 new FXMDIDeleteButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUCLOSE,FRAME_RAISED|LAYOUT_RIGHT);
226 new FXMDIRestoreButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENURESTORE,FRAME_RAISED|LAYOUT_RIGHT);
227 new FXMDIMinimizeButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUMINIMIZE,FRAME_RAISED|LAYOUT_RIGHT);
228
229 //newMDIChild();
230 //--------------------------------------------------------------------------------------------
231
232 // File Menu
233 filemenu=new FXMenuPane(this);
234 new FXMenuCommand(filemenu,"File Browser\t\tDisplay file list.",NULL,treebox,
235 FXWindow::ID_TOGGLESHOWN);
236 //new FXMenuCommand(filemenu,"&New\tCtl-N\tCreate new empty view",NULL,this,ID_NEW);
237 new FXMenuCommand(filemenu,"&Open\tCtl-O\tOpen ace/layout file ", NULL, this, MainWindow::ID_FILEOPEN);
238 new FXMenuSeparator(filemenu);
239 /*
240 new FXMenuCommand(filemenu,"&Random layout\t\tGenerate a random test layout.",NULL,this,
241 MainWindow::ID_RANDOM,0);
242 new FXMenuSeparator(filemenu);*/
243 new FXMenuCommand(filemenu,"&Quit\tCtl-Q\tQuit application.",NULL,a,FXApp::ID_QUIT,0);
244 new FXMenuTitle(menubar,"&File",NULL,filemenu);
245 // Window menu
246 windowmenu=new FXMenuPane(this);
247 new FXMenuCommand(windowmenu,"Tile &Horizontally",NULL,mdiclient,FXMDIClient::ID_MDI_TILEHORIZONTAL);
248 new FXMenuCommand(windowmenu,"Tile &Vertically",NULL,mdiclient,FXMDIClient::ID_MDI_TILEVERTICAL);
249 new FXMenuCommand(windowmenu,"C&ascade",NULL,mdiclient,FXMDIClient::ID_MDI_CASCADE);
250 new FXMenuCommand(windowmenu,"&Close",NULL,mdiclient,FXMDIClient::ID_MDI_CLOSE);
251 new FXMenuCommand(windowmenu,"Close &All",NULL,mdiclient,MainWindow::ID_CLOSEALL);
252 FXMenuSeparator* sep1=new FXMenuSeparator(windowmenu);
253 sep1->setTarget(mdiclient);
254 sep1->setSelector(FXMDIClient::ID_MDI_ANY);
255 new FXMenuCommand(windowmenu,FXString::null,NULL,mdiclient,FXMDIClient::ID_MDI_1);
256 new FXMenuCommand(windowmenu,FXString::null,NULL,mdiclient,FXMDIClient::ID_MDI_2);
257 new FXMenuCommand(windowmenu,FXString::null,NULL,mdiclient,FXMDIClient::ID_MDI_3);
258 new FXMenuCommand(windowmenu,FXString::null,NULL,mdiclient,FXMDIClient::ID_MDI_4);
259 new FXMenuTitle(menubar,"&Window",NULL,windowmenu);
260 // Help menu
261 helpmenu=new FXMenuPane(this);
262 new FXMenuCommand(helpmenu,"&About clView...",NULL,this,ID_ABOUT,0);
263 new FXMenuTitle(menubar,"&Help",NULL,helpmenu,LAYOUT_RIGHT);
264 constructing=false;
265 a->setAnimSpeed(0);
266 }
267
268
269 // Set current pattern
270 // Strip pattern from text if present
271 static FXString patternFromText(const FXString& pattern){
272 FXint beg,end;
273 end=pattern.rfind(')');
274 beg=pattern.rfind('(',end-1);
275 if(0<=beg && beg<end) return pattern.mid(beg+1,end-beg-1);
276 return pattern;
277 }
278
279 // Close all windows
280 long MainWindow::onCmdCloseAll(FXObject* sender, FXSelector, void*){
281 mdiclient->forallWindows(sender, FXSEL(SEL_CLOSE, 0), NULL);
282 return 1;
283 }
284
285
286
287 void MainWindow::setCurrentPattern(FXint n){
288 n=FXCLAMP(0,n,filter->getNumItems()-1);
289 FXString cdir=dirlist->getDirectory();
290 if (cdir.empty())
291 cdir=FXSystem::getCurrentDirectory();
292 filter->setCurrentItem(n);
293 dirlist->setPattern(patternFromText(filter->getItemText(n)));
294 dirlist->setDirectory(cdir);
295 }
296
297 // Change the pattern
298 long MainWindow::onCmdFilter(FXObject*,FXSelector,void* ptr){
299 dirlist->setPattern(FXFileSelector::patternFromText((FXchar*)ptr));
300
301 FXTreeItem* curitem=dirlist->getCurrentItem();
302 if (dirlist->isItemFile(curitem))
303 curitem=curitem->getParent();
304 dirlist->collapseTree(curitem,1);
305 dirlist->expandTree(curitem,1);
306 dirlist->selectItem(curitem,1);
307 dirlist->makeItemVisible(curitem);
308 return 1;
309 }
310
311
312 // Clean up
313 MainWindow::~MainWindow(){
314 delete filemenu;
315 delete windowmenu;
316 delete helpmenu;
317 delete mdiicon;
318 }
319
320 // Show up
321 void MainWindow::create(){
322 FXMainWindow::create();
323 show();
324 FXTreeItem* curitem=dirlist->getCurrentItem();
325 dirlist->expandTree(curitem,1);
326 dirlist->makeItemVisible(curitem);
327 }
328
329 // About
330 long MainWindow::onCmdAbout(FXObject*,FXSelector,void*){
331 FXMessageBox::information(this,MBOX_OK,"About clView",
332 "Assembly/Cluster layout viewer \n Written using FOX toolkit");
333 return 1;
334 }
335
336 // Change patterns, each pattern separated by newline
337 void MainWindow::setPatterns(const FXString& patterns){
338 FXString pat; FXint i;
339 filter->clearItems();
340 for(i=0; !(pat=patterns.section('\n',i)).empty(); i++){
341 filter->appendItem(pat);
342 }
343 if(!filter->getNumItems()) filter->appendItem("All Files (*)");
344 setCurrentPattern(0);
345 }
346
347
348 // Return list of patterns
349 FXString MainWindow::getPatterns() const {
350 FXString pat; FXint i;
351 for(i=0; i<filter->getNumItems(); i++){
352 if(!pat.empty()) pat+='\n';
353 pat+=filter->getItemText(i);
354 }
355 return pat;
356 }
357
358 // Open existing file
359 long MainWindow::onCmdFileDlg(FXObject*,FXSelector,void*){
360 FXFileDialog opendialog(this,"Open file");
361 opendialog.setSelectMode(SELECTFILE_EXISTING);
362 opendialog.setPatternList(fltfiles);
363 opendialog.setCurrentPattern(getCurrentPattern());
364 //opendialog.setDirectory(FXFile::directory(filename));
365 if(opendialog.execute()){
366 FXString file=opendialog.getFilename();
367 if (!file.empty()) newMDIChild(file.text());
368 }
369 //FXString file=FXFileDialog::getOpenFilename(this,"Open file",NULL,fltfiles,0);
370 return 1;
371 }
372
373
374 // Command from the tree list
375 long MainWindow::onCmdTreeList(FXObject*,FXSelector,void* ptr){
376 FXTreeItem *item=(FXTreeItem*)ptr;
377 FXint x,y;
378 FXuint state;
379 getCursorPosition(x,y,state);
380
381 FXString file;
382 if(!item || !dirlist->isItemFile(item)) return 1;
383 file=dirlist->getItemPathname(item);
384 //loadFile(file); :TO DO
385 MDIChild* mdichild=(MDIChild*)mdiclient->getActiveChild();
386 if ((state & CONTROLMASK) && mdichild!=NULL) {
387 mdichild->loadGroups(file);
388 }
389 else newMDIChild(file.text());
390 return 1;
391 }
392
393 void MainWindow::newMDIChild(const char* openfile) {
394 if (openfile!=NULL) {
395 FXString s;
396 s.format(" Parsing file %s, please wait... ", openfile);
397 splash(s.text());
398 s=openfile;
399 //s.format("Cluster viewer: %s", fileNameOnly(s).text());
400 s=fileNameOnly(s);
401 MDIChild* mdichild=new MDIChild(mdiclient,s.text(),mdiicon,mdimenu,
402 MDI_MAXIMIZED|MDI_TRACKING,10,10,600,400);
403 if (!constructing)
404 mdichild->create();
405 mdichild->alignview->initColors(seqColors, baseColors, matchColors,
406 ctgQuals, grpColors[0], grpColors[1]);
407 mdichild->openFile(openfile);
408 splash();
409 }
410 }
411
412 long MainWindow::onMaxRestore(FXObject* obj,FXSelector sel,void* ptr) {
413 FXMDIChild* active=mdiclient->getActiveChild();
414 FXString appName(getApp()->getAppName());
415 if (active!=NULL && active->isMaximized()) {
416 //FXString newtitle(appName);
417 //newtitle.append(" - ");
418 //newtitle.append(active->getTitle());
419 FXString title=active->getTitle();
420 //fprintf(stderr, "%s\n",title.text());
421 obj->handle(this,FXSEL(SEL_COMMAND,ID_SETSTRINGVALUE),(void*)&title);
422 //this->setTitle(active->getTitle());
423 }
424 else
425 this->setTitle(appName);
426 //pass message to FXMainWindow
427 return FXMainWindow::handle(obj,sel,ptr);
428 }
429
430
431 long MainWindow::onRandomLayout (FXObject*,FXSelector,void* ptr) {
432 MDIChild* mdichild=new MDIChild(mdiclient,"Random layout",mdiicon,mdimenu,
433 MDI_MAXIMIZED,10,10,600,400);
434 if (!constructing)
435 mdichild->create();
436 mdichild->alignview->initColors(seqColors, baseColors, matchColors,
437 ctgQuals, grpColors[0], grpColors[1]);
438 FXString s;
439 for (int i=0;i<1000;i++) {
440 s.format("TEST%04d",i);
441 mdichild->alignview->addSeq(s.text(), rand()%640+120, rand()%1024-120, rand()%2,
442 rand()%20, rand()%20);
443 }
444 mdichild->alignview->buildLayout(); //only after this it is displayed correctly
445 mdichild->alignview->setColorStyle(FXGView::csDensity);
446 if (mdichild->alignview->HasSeqs())
447 mdichild->clropt3->enable();
448 else
449 mdichild->clropt3->disable();
450 return 1;
451 }
452
453 void MainWindow::splash(const char* mesg) {
454 if (mesg==NULL) {
455 splashmsg->hide();
456 delete splashmsg;
457 return;
458 }
459 splashmsg=new FXSplashDlg(this, mesg);
460 splashmsg->create();
461 splashmsg->show();
462 getApp()->flush();
463 }
464
465 /**************************** splash/dialog */
466 // Construct a dialog box
467 FXSplashDlg::FXSplashDlg(FXWindow* ownr, const char* mesg):
468 FXDialogBox(ownr,"splash",DECOR_NONE|PLACEMENT_OWNER,
469 ownr->getX()+ownr->getWidth()/2-60,
470 ownr->getY()+ownr->getHeight()/2-30,0,0,0,0,0,0) {
471 // Contents
472 contents=new FXVerticalFrame(this, FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0,0,0,0,0);
473 FXHorizontalFrame* fr=new FXHorizontalFrame(contents,
474 FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_CENTER_Y|LAYOUT_CENTER_X,
475 0,0,0,0,20,20,20,20);
476 msg=new FXLabel(fr, mesg, NULL, FRAME_NONE|LAYOUT_CENTER_Y|LAYOUT_FILL_X);
477 }
478
479
480 // Must delete the menus
481 FXSplashDlg::~FXSplashDlg(){
482 //anybody?
483 }