Salome HOME
NRI : Merge from V1_2.
[modules/kernel.git] / src / TOOLSGUI / ToolsGUI.cxx
1 //  SALOME TOOLSGUI : implementation of desktop "Tools" optioins
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : ToolsGUI.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 using namespace std;
30 #include "ToolsGUI.h"
31 #include "ToolsGUI_CatalogGeneratorDlg.h"
32
33 #include "utilities.h"
34
35 #include <stdlib.h>
36
37 int ToolsGUI::runCommand(string & arg)
38
39   int res;
40   res = system(arg.c_str());
41  
42   if (res == -1)
43     MESSAGE("fork failed (system command result = 0x" << hex << res << ")" << dec) 
44   else
45     if (res == 217)
46       MESSAGE("shell exec failed (system command result = 0x" << hex << res << ")" << dec)
47         
48   return res;
49 }
50
51 bool ToolsGUI::OnGUIEvent(int theCommandID,  QAD_Desktop* parent)
52 {
53   QAD_Study* myActiveStudy = parent->getActiveStudy();
54   switch (theCommandID)
55     {
56     case 5102 :
57       {
58         ToolsGUI_CatalogGeneratorDlg* aDlg = new ToolsGUI_CatalogGeneratorDlg(parent);
59         aDlg->exec();
60         delete aDlg;
61         break;
62       }
63
64     default:
65       MESSAGE (" No command associated with this id = " << theCommandID )
66       break;
67     }
68   return true;
69 }
70
71 extern "C"
72 {
73   bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
74   {
75     //MESSAGE("ToolsGUI::OnGUIEvent "<< theCommandID);
76     return ToolsGUI::OnGUIEvent(theCommandID, parent);
77   }
78
79 }