<commit_before>/* BZWorkbench
 * Copyright (c) 1993 - 2007 <NAME>
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include "windows/MainWindow.h"

bool MainWindow::initialized = false;

// build up the button panel
void MainWindow::buildButtonPanel() {
	// set up the "add object" button group
	objectButtonGroup = new Fl_Group( BUTTON_PANEL_X, BUTTON_PANEL_Y, BUTTON_PANEL_WIDTH, BUTTON_PANEL_HEIGHT, "Add Object");
	objectButtonGroup->end();
	objectButtonGroup->align( FL_ALIGN_LEFT | FL_ALIGN_TOP );
	
	// create the buttons
	addBoxButton = new Fl_ImageButton( BUTTON_PANEL_X, BUTTON_PANEL_Y, 36, 36, "share/UI/box.png");
	addPyramidButton = new Fl_ImageButton( BUTTON_PANEL_X + 36, BUTTON_PANEL_Y, 36, 36, "share/UI/pyramid.png");
	addTeleporterButton = new Fl_ImageButton( BUTTON_PANEL_X, BUTTON_PANEL_Y + 36, 36, 36, "share/UI/teleporter.png");
	
	// assign them callbacks
	addBoxButton->callback( addBoxCallback, this );
	addPyramidButton->callback( addPyramidCallback, this );
	addTeleporterButton->callback( addTeleporterCallback, this );
	
	// add them to the group
	objectButtonGroup->add( addBoxButton );
	objectButtonGroup->add( addPyramidButton );
	objectButtonGroup->add( addTeleporterButton );
	
	
	// set up the "add base" button group
	baseButtonGroup = new Fl_Group( BASE_PANEL_X, BASE_PANEL_Y, BASE_PANEL_WIDTH, BASE_PANEL_HEIGHT, "Add Base");
	baseButtonGroup->end();
	baseButtonGroup->align( FL_ALIGN_LEFT | FL_ALIGN_TOP );
	
	// create the base buttons
	addBlueBaseButton = new Fl_ImageButton( BASE_PANEL_X, BASE_PANEL_Y, 36, 36, "share/UI/bluebase.png");
	addGreenBaseButton = new Fl_ImageButton( BASE_PANEL_X + 36, BASE_PANEL_Y, 36, 36, "share/UI/greenbase.png");
	addPurpleBaseButton = new Fl_ImageButton( BASE_PANEL_X, BASE_PANEL_Y + 36, 36, 36, "share/UI/purplebase.png");
	addRedBaseButton = new Fl_ImageButton( BASE_PANEL_X + 36, BASE_PANEL_Y + 36, 36, 36, "share/UI/redbase.png");
	
	// assign the base buttons callbacks
	addBlueBaseButton->callback( addBlueBaseCallback, this );
	addGreenBaseButton->callback( addGreenBaseCallback, this );
	addPurpleBaseButton->callback( addPurpleBaseCallback, this );
	addRedBaseButton->callback( addRedBaseCallback, this );
	
	// add them to the group
	baseButtonGroup->add( addBlueBaseButton );
	baseButtonGroup->add( addGreenBaseButton );
	baseButtonGroup->add( addPurpleBaseButton );
	baseButtonGroup->add( addRedBaseButton );
	
	// add the groups
	add( objectButtonGroup );
	add( baseButtonGroup );
	
	// make the configuration button
	configureButton = new Fl_Button( RENDER_WINDOW_X, RENDER_WINDOW_Y + RENDER_WINDOW_HEIGHT, 80, DEFAULT_TEXTSIZE + 6, "Configure" );
	configureButton->callback( configureCallback, this );
	add( configureButton );
}

// default constructor
MainWindow::MainWindow() :
	Fl_Window(DEFAULT_WIDTH, DEFAULT_HEIGHT, "BZWorkbench") {
	
	this->end();
	
	this->model = new Model();
	this->view = new View(model, this, RENDER_WINDOW_X, RENDER_WINDOW_Y, RENDER_WINDOW_WIDTH, RENDER_WINDOW_HEIGHT);
	this->view->end();
	this->add(view);
	
	this->configurationMenu = new ConfigurationMenu(this, MENU_X, MENU_Y, MENU_WIDTH, MENU_HEIGHT);
	this->add(configurationMenu);
	
	// mainMenu = new MainMenu(this, MENU_X, MENU_Y, MENU_WIDTH, MENU_HEIGHT);
	// add(mainMenu);
	
	this->menuBar = new MenuBar( this );
	this->add(menuBar);
	
	initialized = true;
   
   // add the View as an observer to the Model
   this->model->addObserver( view );
   
   // build the button panel
   this->buildButtonPanel();
   
   this->resizable(NULL);
}

// construct from a model
MainWindow::MainWindow(Model* m) :
	Fl_Window(DEFAULT_WIDTH, DEFAULT_HEIGHT, "BZWorkbench") {
	
	
	this->end();
	
	this->model = m;
	
	printf("MainWindow: model addr: %x\n", this->getModel());
	
	this->view = new View(this->model, this, RENDER_WINDOW_X, RENDER_WINDOW_Y, RENDER_WINDOW_WIDTH, RENDER_WINDOW_HEIGHT);
	this->view->end();
	
	this->add(view);
	
	this->configurationMenu = new ConfigurationMenu(this, RENDER_WINDOW_X, RENDER_WINDOW_Y, RENDER_WINDOW_WIDTH, RENDER_WINDOW_HEIGHT);
	this->add(configurationMenu);
	
	// mainMenu = new MainMenu(this, RENDER_WINDOW_X, RENDER_WINDOW_Y, RENDER_WINDOW_WIDTH, RENDER_WINDOW_HEIGHT);
	// add(mainMenu);
	
	printf("MainWindow addr: %x\n", this );
	this->menuBar = new MenuBar( this );
	this->add(menuBar);
	<commit_msg>%x->%p for pointers<commit_after>/* BZWorkbench
 * Copyright (c) 1993 - 2007 <NAME>
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include "windows/MainWindow.h"

bool MainWindow::initialized = false;

// build up the button panel
void MainWindow::buildButtonPanel() {
	// set up the "add object" button group
	objectButtonGroup = new Fl_Group( BUTTON_PANEL_X, BUTTON_PANEL_Y, BUTTON_PANEL_WIDTH, BUTTON_PANEL_HEIGHT, "Add Object");
	objectButtonGroup->end();
	objectButtonGroup->align( FL_ALIGN_LEFT | FL_ALIGN_TOP );
	
	// create the buttons
	addBoxButton = new Fl_ImageButton( BUTTON_PANEL_X, BUTTON_PANEL_Y, 36, 36, "share/UI/box.png");
	addPyramidButton = new Fl_ImageButton( BUTTON_PANEL_X + 36, BUTTON_PANEL_Y, 36, 36, "share/UI/pyramid.png");
	addTeleporterButton = new Fl_ImageButton( BUTTON_PANEL_X, BUTTON_PANEL_Y + 36, 36, 36, "share/UI/teleporter.png");
	
	// assign them callbacks
	addBoxButton->callback( addBoxCallback, this );
	addPyramidButton->callback( addPyramidCallback, this );
	addTeleporterButton->callback( addTeleporterCallback, this );
	
	// add them to the group
	objectButtonGroup->add( addBoxButton );
	objectButtonGroup->add( addPyramidButton );
	objectButtonGroup->add( addTeleporterButton );
	
	
	// set up the "add base" button group
	baseButtonGroup = new Fl_Group( BASE_PANEL_X, BASE_PANEL_Y, BASE_PANEL_WIDTH, BASE_PANEL_HEIGHT, "Add Base");
	baseButtonGroup->end();
	baseButtonGroup->align( FL_ALIGN_LEFT | FL_ALIGN_TOP );
	
	// create the base buttons
	addBlueBaseButton = new Fl_ImageButton( BASE_PANEL_X, BASE_PANEL_Y, 36, 36, "share/UI/bluebase.png");
	addGreenBaseButton = new Fl_ImageButton( BASE_PANEL_X + 36, BASE_PANEL_Y, 36, 36, "share/UI/greenbase.png");
	addPurpleBaseButton = new Fl_ImageButton( BASE_PANEL_X, BASE_PANEL_Y + 36, 36, 36, "share/UI/purplebase.png");
	addRedBaseButton = new Fl_ImageButton( BASE_PANEL_X + 36, BASE_PANEL_Y + 36, 36, 36, "share/UI/redbase.png");
	
	// assign the base buttons callbacks
	addBlueBaseButton->callback( addBlueBaseCallback, this );
	addGreenBaseButton->callback( addGreenBaseCallback, this );
	addPurpleBaseButton->callback( addPurpleBaseCallback, this );
	addRedBaseButton->callback( addRedBaseCallback, this );
	
	// add them to the group
	baseButtonGroup->add( addBlueBaseButton );
	baseButtonGroup->add( addGreenBaseButton );
	baseButtonGroup->add( addPurpleBaseButton );
	baseButtonGroup->add( addRedBaseButton );
	
	// add the groups
	add( objectButtonGroup );
	add( baseButtonGroup );
	
	// make the configuration button
	configureButton = new Fl_Button( RENDER_WINDOW_X, RENDER_WINDOW_Y + RENDER_WINDOW_HEIGHT, 80, DEFAULT_TEXTSIZE + 6, "Configure" );
	configureButton->callback( configureCallback, this );
	add( configureButton );
}

// default constructor
MainWindow::MainWindow() :
	Fl_Window(DEFAULT_WIDTH, DEFAULT_HEIGHT, "BZWorkbench") {
	
	this->end();
	
	this->model = new Model();
	this->view = new View(model, this, RENDER_WINDOW_X, RENDER_WINDOW_Y, RENDER_WINDOW_WIDTH, RENDER_WINDOW_HEIGHT);
	this->view->end();
	this->add(view);
	
	this->configurationMenu = new ConfigurationMenu(this, MENU_X, MENU_Y, MENU_WIDTH, MENU_HEIGHT);
	this->add(configurationMenu);
	
	// mainMenu = new MainMenu(this, MENU_X, MENU_Y, MENU_WIDTH, MENU_HEIGHT);
	// add(mainMenu);
	
	this->menuBar = new MenuBar( this );
	this->add(menuBar);
	
	initialized = true;
   
   // add the View as an observer to the Model
   this->model->addObserver( view );
   
   // build the button panel
   this->buildButtonPanel();
   
   this->resizable(NULL);
}

// construct from a model
MainWindow::MainWindow(Model* m) :
	Fl_Window(DEFAULT_WIDTH, DEFAULT_HEIGHT, "BZWorkbench") {
	
	
	this->end();
	
	this->model = m;
	
	printf("MainWindow: model addr: %p\n", this->getModel());
	
	this->view = new View(this->model, this, RENDER_WINDOW_X, RENDER_WINDOW_Y, RENDER_WINDOW_WIDTH, RENDER_WINDOW_HEIGHT);
	this->view->end();
	
	this->add(view);
	
	this->configurationMenu = new ConfigurationMenu(this, RENDER_WINDOW_X, RENDER_WINDOW_Y, RENDER_WINDOW_WIDTH, RENDER_WINDOW_HEIGHT);
	this->add(configurationMenu);
	
	// mainMenu = new MainMenu(this, RENDER_WINDOW_X, RENDER_WINDOW_Y, RENDER_WINDOW_WIDTH, RENDER_WINDOW_HEIGHT);
	// add(mainMenu);
	
	printf("MainWindow addr: %p\n", this );
	this->menuBar = new MenuBar( this );
	this->add(menuBar);
	
{'fraction_non_alphanumeric': 0.11646328409334189, 'fraction_numerical': 0.010918432883750802, 'mean_word_length': 5.2369826435246996, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 96, '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': '2730869', 'n_tokens_mistral': 3437, 'n_tokens_neox': 3243, 'n_words': 754}