<commit_before>// $Id: mainControl.C,v 1.2 2000/10/05 22:34:46 oliver Exp $

// this is required for QMenuItem
#define INCLUDE_MENUITEM_DEF


#include <BALL/VIEW/GUI/KERNEL/mainControl.h>
#include <BALL/VIEW/GUI/WIDGETS/modularWidget.h>
#include <BALL/VIEW/GUI/WIDGETS/scene.h>

#include <qmenudata.h>
#include <qwidget.h>
#include <qmenubar.h>
#include <qpopupmenu.h>

using std::istream;
using std::ostream;



namespace BALL
{

	namespace VIEW
	{

	  MainControl::OptionsFileError::OptionsFileError(const char* file, int line, const string& data)
			: Exception::GeneralException(file, line, string("OptionsFileError"), data)
		{
    }
  
		MainControl::MainControl
			(QWidget* parent, const char* name, String /* option_filename */)
			:	QMainWindow(parent, name),
				composite_map_(),
				descriptor_map_(),
				descriptors_(),
				options_()
		{
			//			if (!options_.readOptionFile(option_filename))
			//			{
			//					throw ::BALL::VIEW::MainControl::OptionsFileError(__FILE__, __LINE__, "file error.");			
			//			}
		}
			
		MainControl::MainControl(const MainControl& main_control)
		{	
			// BAUSTELLE
		}

		MainControl::~MainControl()
		{
			#ifdef BALL_VIEW_DEBUG
				cout << "Destructing object " << (void *)this 
					<< " of class " << RTTI::getName<MainControl>() << endl;
			#endif 

			destroy();
		}

		QPopupMenu* MainControl::initPopupMenu(int ID)
		{
			QPopupMenu* menu = 0;
			QMenuItem* item = menuBar()->findItem(ID);
			if ((item == 0) || (item->popup() == 0))
			{
				menu = new QPopupMenu(this);
				CHECK_PTR(menu);

				Log.info() << "new menu entry: " << ID << endl;
				int max_id = menuBar()->count();
				switch (ID)
				{
					case FILE:
						menuBar()->insertItem("&File", menu, FILE, 0);
						break;
					case EDIT:
						menuBar()->insertItem("&Edit", menu, EDIT, (1 <= max_id) ? 1 : -1);
						break;
					case BUILD:
						menuBar()->insertItem("&Build", menu, BUILD, (2 <= max_id) ? 2 : -1);
						break;
					case DISPLAY:
						menuBar()->insertItem("&Display", menu, DISPLAY, (3 <= max_id) ? 3 : -1);
						break;
					case TOOLS:
						menuBar()->insertItem("&Tools", menu, TOOLS, (4 <= max_id) ? 4 : -1);
						break;
					case USER:
						menuBar()->insertItem("&User", menu, USER, (5 <= max_id) ? 5 : -1);
						break;

					case HELP:
						menuBar()->insertSeparator();
						menuBar()->insertItem("&Help", menu, HELP, -1);
						break;<commit_msg>initPopupMenu extended: Submenu FILE_IMPORT added<commit_after>// $Id: mainControl.C,v 1.3 2000/10/07 15:25:17 hekl Exp $

// this is required for QMenuItem
#define INCLUDE_MENUITEM_DEF


#include <BALL/VIEW/GUI/KERNEL/mainControl.h>
#include <BALL/VIEW/GUI/WIDGETS/modularWidget.h>
#include <BALL/VIEW/GUI/WIDGETS/scene.h>

#include <qmenudata.h>
#include <qwidget.h>
#include <qmenubar.h>
#include <qpopupmenu.h>

using std::istream;
using std::ostream;



namespace BALL
{

	namespace VIEW
	{

	  MainControl::OptionsFileError::OptionsFileError(const char* file, int line, const string& data)
			: Exception::GeneralException(file, line, string("OptionsFileError"), data)
		{
    }
  
		MainControl::MainControl
			(QWidget* parent, const char* name, String /* option_filename */)
			:	QMainWindow(parent, name),
				composite_map_(),
				descriptor_map_(),
				descriptors_(),
				options_()
		{
			//			if (!options_.readOptionFile(option_filename))
			//			{
			//					throw ::BALL::VIEW::MainControl::OptionsFileError(__FILE__, __LINE__, "file error.");			
			//			}
		}
		/*
		MainControl::MainControl(const MainControl& main_control)
		{	
			// BAUSTELLE
		}
		*/
		MainControl::~MainControl()
		{
			#ifdef BALL_VIEW_DEBUG
				cout << "Destructing object " << (void *)this 
					<< " of class " << RTTI::getName<MainControl>() << endl;
			#endif 

			destroy();
		}

		QPopupMenu* MainControl::initPopupMenu(int ID)
		{
			QPopupMenu* menu = 0;
			QMenuItem* item = menuBar()->findItem(ID);
			if ((item == 0) || (item->popup() == 0))
			{
				menu = new QPopupMenu(this);
				CHECK_PTR(menu);

				Log.info() << "new menu entry: " << ID << endl;
				int max_id = menuBar()->count();
				switch (ID)
				{
					case FILE:
						menuBar()->insertItem("&File", menu, FILE, 0);
						break;
   				case FILE_IMPORT:
						initPopupMenu(MainControl::FILE)
							->insertItem("&Import File", menu, FILE_IMPORT, (1 <= max_id) ? 1 : -1);
						break;
					case EDIT:
						menuBar()->insertItem("&Edit", menu, EDIT, (2 <= max_id) ? 2 : -1);
						break;
					case BUILD:
						menuBar()->insertItem("&Build", menu, BUILD, (3 <= max_id) ? 3 : -1);
						break;
					case DISPLAY:
						menuBar()->insertItem("&Display", menu, DISPLAY, (4 <= max_id) ? 4 : -1);
						break;
					case TOOLS:
						menuBar()->insertItem("&Tools", menu, TOOLS, (5 <= max_id) ? 5 : -1);
						break;
					case USER:
						menuBar()->insertItem("&User", menu, USER, (6 <= max_id) ? 6 : -1);
						break;

					case HELP:
						menuBar()->insertSeparator();
						menuBar()->insertItem("&Help", menu, HELP, -1);
						break;
{'fraction_non_alphanumeric': 0.16979249800478852, 'fraction_numerical': 0.014964086193136472, 'mean_word_length': 3.07229894394801, 'pattern_counts': {'":': 0, '<': 62, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5698456', 'n_tokens_mistral': 2236, 'n_tokens_neox': 1786, 'n_words': 379}