ROOT logo
// $Id: Gled.h 2810 2012-07-11 01:24:45Z matevz $

// Copyright (C) 1999-2008, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

#ifndef GledCore_Gled_H
#define GledCore_Gled_H

// Includes
#include <Gled/GledTypes.h>
#include <Gled/GMutex.h>

class Saturn;
class SaturnInfo;
class EyeInfo;
class ShellInfo;
class Forest;
class Mountain;
class Eye;
class ZMIR;

class GCondition;
class GThread;

class Fl_SWM_Manager;
class Fl_Window;
class Fl_Tile;
class Fl_Browser;

class TApplication;
class TRint;

class Gled
{
protected:
  void next_arg_or_die(lStr_t& args, lStr_i& i, bool allow_single_minus=false);

  TString       mCmdName;       // X{GS}
  lStr_t        mArgs;

  SaturnInfo*	mSaturnInfo;	// X{g}
  Saturn*	mSaturn;	// X{g}
  Bool_t	bIsSun;		// X{G}

  Bool_t	bQuit;		// X{G}
  Bool_t	bHasPrompt;	// X{G}
  Bool_t	bShowSplash;	// X{G}
  Bool_t	bPreExec;       // X{G}
  TString	mPreExecString; // X{G}
  Bool_t	bAutoSpawn;	// X{G}
  Bool_t        bEarlySrvSock;  // X{G}
  Bool_t	bAllowMoons;	// X{G}
  Bool_t        bDaemon;        // X{G}

  Bool_t	bRootAppRunning;// X{G}
  TApplication *mRootApp;       // X{g}

  GMutex	mLoggingMutex;
  TString	mLogFileName;
  FILE*		mLogFile;
  TString	mOutFileName;
  TString	mErrFileName;

  TString       mLibDir;        // X{G}
  TString       mDataDir;       // X{G}
  TString       mHomeDir;       // X{G}

  TString	mAuthDir;	 // X{GS}
  TString	mDefEyeIdentity; // X{GS}

  TString	mRenderers;      // X{GS}

  GCondition*	mExitCondVar;
  GThread*      mRootAppThread;  // X{g}
  GThread*      mExitThread;

  list<ZMIR*>   mAfterSetupMirs;

  static Int_t  sExitStatus;

public:
  Gled();

  void AddArgument(const char* arg);
  void ReadArguments(int argc, char **argv);

  virtual void ParseArguments(Bool_t allow_daemon);
  virtual void InitLogging();
  virtual void InitGledCore();
  virtual void ProcessCmdLineMacros();
  virtual void StopLogging();
  virtual ~Gled();

  void SetExitCondVar(GCondition* cond) { mExitCondVar = cond; }

  void PreExec();

  void SpawnSunOrSaturn();
  void SpawnSun();
  void SpawnSaturn();

  void        AfterSetup(ZMIR* mir);
  void        ShootAfterSetupMirs();

  void        CheckAuthDir();
  const char* PubKeyFile(TString& id);
  const char* PrivKeyFile(TString& id);
  const char* GetPubKeyFile(TString& id, Bool_t use_exc=true);
  const char* GetPrivKeyFile(TString& id, Bool_t use_exc=true);

  Bool_t IsIdentityInGroup(const char* id, const char* group);

  void WaitUntilQueensLoaded();
  void AllowMoonConnections();

  virtual void  Run();
          void  Exit(Int_t status=0);
  static  void* Exit_tl(void*);
  virtual void  ExitVirtual();

  virtual Int_t LoadLibSet(const Text_t* lib_set);
  virtual Int_t LoadLibSet(LID_t lid);

  virtual void SetDebugLevel(Int_t d=0);

  virtual void info(const char* s);
  virtual void message(const char* s);
  virtual void warning(const char* s);
  virtual void error(const char* s);

  virtual Bool_t HasGUILibs() const { return false; }

  virtual EyeInfo* SpawnEye(const TString& libset, const TString& eyector);
  virtual EyeInfo* SpawnEye(EyeInfo* ei, ZGlass* ud,
			    const TString& libset, const TString& eyector)
  { return 0; }

  static void AssertLibSet(const Text_t* lib_set);

  static void AssertMacro(const Text_t* mac);
  static void Macro(const Text_t* mac);
  static void LoadMacro(const Text_t* mac);

  GThread*     SpawnRootAppThread(const TString& name_prefix);
  static void* RootApp_runner_tl(void*);
  static void  RootApp_cleanup_tl(void*);

  void         SpawnTimeBeatThread();
  static void* TimeBeat_tl(void*);

  virtual void LockFltk()   {}
  virtual void UnlockFltk() {}

  static Gled* theOne;
  static Int_t GetExitStatus();

#include "Gled.h7"
  ClassDef(Gled, 0);
}; // endclass Gled

#endif
 Gled.h:1
 Gled.h:2
 Gled.h:3
 Gled.h:4
 Gled.h:5
 Gled.h:6
 Gled.h:7
 Gled.h:8
 Gled.h:9
 Gled.h:10
 Gled.h:11
 Gled.h:12
 Gled.h:13
 Gled.h:14
 Gled.h:15
 Gled.h:16
 Gled.h:17
 Gled.h:18
 Gled.h:19
 Gled.h:20
 Gled.h:21
 Gled.h:22
 Gled.h:23
 Gled.h:24
 Gled.h:25
 Gled.h:26
 Gled.h:27
 Gled.h:28
 Gled.h:29
 Gled.h:30
 Gled.h:31
 Gled.h:32
 Gled.h:33
 Gled.h:34
 Gled.h:35
 Gled.h:36
 Gled.h:37
 Gled.h:38
 Gled.h:39
 Gled.h:40
 Gled.h:41
 Gled.h:42
 Gled.h:43
 Gled.h:44
 Gled.h:45
 Gled.h:46
 Gled.h:47
 Gled.h:48
 Gled.h:49
 Gled.h:50
 Gled.h:51
 Gled.h:52
 Gled.h:53
 Gled.h:54
 Gled.h:55
 Gled.h:56
 Gled.h:57
 Gled.h:58
 Gled.h:59
 Gled.h:60
 Gled.h:61
 Gled.h:62
 Gled.h:63
 Gled.h:64
 Gled.h:65
 Gled.h:66
 Gled.h:67
 Gled.h:68
 Gled.h:69
 Gled.h:70
 Gled.h:71
 Gled.h:72
 Gled.h:73
 Gled.h:74
 Gled.h:75
 Gled.h:76
 Gled.h:77
 Gled.h:78
 Gled.h:79
 Gled.h:80
 Gled.h:81
 Gled.h:82
 Gled.h:83
 Gled.h:84
 Gled.h:85
 Gled.h:86
 Gled.h:87
 Gled.h:88
 Gled.h:89
 Gled.h:90
 Gled.h:91
 Gled.h:92
 Gled.h:93
 Gled.h:94
 Gled.h:95
 Gled.h:96
 Gled.h:97
 Gled.h:98
 Gled.h:99
 Gled.h:100
 Gled.h:101
 Gled.h:102
 Gled.h:103
 Gled.h:104
 Gled.h:105
 Gled.h:106
 Gled.h:107
 Gled.h:108
 Gled.h:109
 Gled.h:110
 Gled.h:111
 Gled.h:112
 Gled.h:113
 Gled.h:114
 Gled.h:115
 Gled.h:116
 Gled.h:117
 Gled.h:118
 Gled.h:119
 Gled.h:120
 Gled.h:121
 Gled.h:122
 Gled.h:123
 Gled.h:124
 Gled.h:125
 Gled.h:126
 Gled.h:127
 Gled.h:128
 Gled.h:129
 Gled.h:130
 Gled.h:131
 Gled.h:132
 Gled.h:133
 Gled.h:134
 Gled.h:135
 Gled.h:136
 Gled.h:137
 Gled.h:138
 Gled.h:139
 Gled.h:140
 Gled.h:141
 Gled.h:142
 Gled.h:143
 Gled.h:144
 Gled.h:145
 Gled.h:146
 Gled.h:147
 Gled.h:148
 Gled.h:149
 Gled.h:150
 Gled.h:151
 Gled.h:152
 Gled.h:153
 Gled.h:154
 Gled.h:155
 Gled.h:156
 Gled.h:157
 Gled.h:158
 Gled.h:159
 Gled.h:160
 Gled.h:161
 Gled.h:162