コード例 #1
0
//-----------------------------------------------------------------------------
// Purpose: Stores layout information in the registry for use next session.
//-----------------------------------------------------------------------------
void CChildFrame::SaveOptions(void)
{
	if (bUsingSplitter)
	{
		//
		// Save the draw type for each pane of the splitter.
		//
		for (int nRow = 0; nRow < 2; nRow++)
		{
			for (int nCol = 0; nCol < 2; nCol++)
			{
				CMapView *pView = (CMapView *)m_wndSplitter->GetPane(nRow, nCol);
				if (pView != NULL)
				{
					char szKey[30];
					sprintf(szKey, "DrawType%d,%d", nRow, nCol);
					APP()->WriteProfileInt("Splitter", szKey, pView->GetDrawType());
				}
			}
		}

		//
		// Save the window position, size, and minimized/maximized state.
		//
		WINDOWPLACEMENT wp;
		wp.length = sizeof(wp);
		GetWindowPlacement(&wp);

		char szPlacement[100];
		sprintf(szPlacement, "(%d %d) (%d %d) (%d %d %d %d) %d", wp.ptMaxPosition.x, wp.ptMaxPosition.y, wp.ptMinPosition.x, wp.ptMinPosition.y, wp.rcNormalPosition.bottom, wp.rcNormalPosition.left, wp.rcNormalPosition.right, wp.rcNormalPosition.top, wp.showCmd);
		APP()->WriteProfileString("Splitter", "WindowPlacement", szPlacement);
	}
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: creates the CHammerBar.  
//			initializes size variables.
//			reads saved dimension information from registry
// Input  : CWnd *pParentWnd
//			UINT nIDTemplate - the ID of the dialog to be created
//			UINT nStyle - the type of dialog we are making
//			UINT nID - 
// Output : BOOL - TRUE on success
//-----------------------------------------------------------------------------
BOOL CHammerBar::Create( CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID, char *pszName )
{
	UINT nStyleFixed = nStyle;
	if ( *pszName == 0 )
	{
		//did not give a title and cannot have a dynamic bar.  Routing back through old create
		return Create( pParentWnd, nIDTemplate, nStyle, nID );   
	}
	else
	{
		if ( !CDialogBar::Create(pParentWnd,nIDTemplate,nStyleFixed,nID) )
			return FALSE;

		SetWindowText( pszName );

		CString textTitle;
		textTitle = "FloatingBarSize\\" + CString(pszName);

		//read size from registry
		m_sizeFloating.cx = APP()->GetProfileInt( textTitle, "floatX", m_sizeDefault.cx );
		m_sizeFloating.cy = APP()->GetProfileInt( textTitle, "floatY", m_sizeDefault.cy );
		m_sizeDocked = m_sizeDefault;
	}
    return TRUE;
}
コード例 #3
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void COptions::Init(void)
{
	//
	// If the we have no registry settings and the "Valve Hammer Editor" registry tree exists,
	// import settings from there. If that isn't found, try "Worldcraft".
	//
	bool bWCSettingsFound = false;
	bool bVHESettingsFound = false;

	if (!HammerSettingsFound())
	{
		bVHESettingsFound = ValveHammerEditorSettingsFound();
		if (!bVHESettingsFound)
		{
			bWCSettingsFound = WorldcraftSettingsFound();
		}
	}

	if (bVHESettingsFound)
	{
		APP()->BeginImportVHESettings();
	}
	else if (bWCSettingsFound)
	{
		APP()->BeginImportWCSettings();
	}

	SetDefaults();
	Read();

	if (bVHESettingsFound || bWCSettingsFound)
	{
		APP()->EndImportSettings();
	}

	//
	// Notify appropriate windows of new settings.
	// dvs: is all this necessary?
	//
	CMainFrame *pMainWnd = GetMainWnd();
	if (pMainWnd != NULL)
	{
		pMainWnd->SetBrightness(textures.fBrightness);

		pMainWnd->UpdateAllDocViews(MAPVIEW_UPDATE_2D | MAPVIEW_OPTIONS_CHANGED);
		pMainWnd->UpdateAllDocViews(MAPVIEW_UPDATE_3D | MAPVIEW_OPTIONS_CHANGED);

		pMainWnd->GlobalNotify(WM_GAME_CHANGED);
	}
}
コード例 #4
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : lpCreateStruct - 
// Output : int
//-----------------------------------------------------------------------------
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
	{
		return(-1);
	}

	//
	// The splitter gets its layout from the registry.
	//
	if (bUsingSplitter)
	{
		CString str = APP()->GetProfileString("Splitter", "WindowPlacement", "");
		if (!str.IsEmpty())
		{
			WINDOWPLACEMENT wp;
			wp.length = sizeof(wp);
			wp.flags = 0;
			sscanf(str, "(%d %d) (%d %d) (%d %d %d %d) %d", &wp.ptMaxPosition.x, &wp.ptMaxPosition.y, &wp.ptMinPosition.x, &wp.ptMinPosition.y, &wp.rcNormalPosition.bottom, &wp.rcNormalPosition.left, &wp.rcNormalPosition.right, &wp.rcNormalPosition.top, &wp.showCmd);

			if (wp.showCmd == SW_SHOWMAXIMIZED)
			{
				PostMessage(WM_SYSCOMMAND, SC_MAXIMIZE);
			}
			else
			{
				SetWindowPlacement(&wp);
			}
		}
	}

	return(0);
}
コード例 #5
0
ファイル: edit_picking.c プロジェクト: vaplv/foo
/*******************************************************************************
 *
 * Picking functions
 *
 ******************************************************************************/
enum edit_error
edit_create_picking
  (struct app* app,
   struct edit_imgui* imgui,
   struct edit_model_instance_selection* instance_selection,
   struct mem_allocator* allocator,
   struct edit_picking** out_picking)
{
  struct edit_picking* picking = NULL;
  enum edit_error edit_err = EDIT_NO_ERROR;
  enum sl_error sl_err = SL_NO_ERROR;

  if(UNLIKELY(!app || !instance_selection || !allocator || !out_picking)) {
    edit_err = EDIT_INVALID_ARGUMENT;
    goto error;
  }

  picking = MEM_CALLOC(allocator, 1, sizeof(struct edit_picking));
  if(!picking) {
    edit_err = EDIT_MEMORY_ERROR;
    goto error;
  }
  ref_init(&picking->ref);
  APP(ref_get(app));
  picking->app = app;
  EDIT(imgui_ref_get(imgui));
  picking->imgui = imgui;
  EDIT(model_instance_selection_ref_get(instance_selection));
  picking->instance_selection = instance_selection;
  picking->allocator = allocator;

  sl_err = sl_create_hash_table
    (sizeof(uint32_t),
     ALIGNOF(uint32_t),
     sizeof(uint32_t),
     ALIGNOF(uint32_t),
     hash_uint32,
     eq_uint32,
     allocator,
     &picking->picked_instances_htbl);
  if(sl_err != SL_NO_ERROR) {
    edit_err = sl_to_edit_error(sl_err);
    goto error;
  }

exit:
  if(out_picking)
    *out_picking = picking;
  return edit_err;
error:
  if(picking) {
    EDIT(picking_ref_put(picking));
    picking = NULL;
  }
  goto exit;
}
コード例 #6
0
//-----------------------------------------------------------------------------
// Purpose: called by windows when the edges of the dialog are clicked
//			returns the size of the dialog
// Input  : passed automatically by windows
//			int nLength - amount the dialog edge has moved
//			DWORD dwMode - type of dialog/movement we are dealing with			
// Output : CSize - size of the dialog
//-----------------------------------------------------------------------------
CSize CHammerBar::CalcDynamicLayout(int nLength, DWORD dwMode)
{		
	CSize newSize;

    // If the bar is docked, use the default size
    if ( (dwMode & LM_VERTDOCK) || (dwMode & LM_HORZDOCK) )
    {	
		m_sizeDocked.cy = m_sizeFloating.cy;		
 		return m_sizeDocked;		
    }

	//if the bar is floating, use the current floating size
    if ( dwMode & LM_MRUWIDTH )
	{
		return m_sizeFloating;
	}
	
    // In all other cases, we are changing the length with a drag
    if ( dwMode & LM_LENGTHY )
	{
		//the bar is being resized in the y direction
		newSize = CSize( m_sizeFloating.cx, m_sizeFloating.cy = nLength );
	}
    else
	{
		//the bar is being resized in the x direction
		newSize = CSize( m_sizeFloating.cx = nLength, m_sizeFloating.cy);
	}    

	CString textTitle;
	GetWindowText( textTitle );	
	
	//it should not be possible that a bar with no name could be dynamic; this check is just to be safe
	if ( !textTitle.IsEmpty() )
	{
		//writing the new size of the bar to the registry
		textTitle = "FloatingBarSize\\" + textTitle;
		APP()->WriteProfileInt( textTitle, "floatX", newSize.cx );
		APP()->WriteProfileInt( textTitle, "floatY", newSize.cy );    
	}

	return newSize;
}
コード例 #7
0
ファイル: app_term.c プロジェクト: vaplv/foo
/*******************************************************************************
 *
 * Helper functions.
 *
 ******************************************************************************/
static void
command_completion(struct term* term)
{
  struct app* app = NULL;
  const char* cmdbuf = NULL;
  const char** list = NULL;
  size_t cursor = 0;
  size_t len = 0;
  assert(term);

  app = CONTAINER_OF(term, struct app, term);

  APP(command_buffer_completion(app->term.cmdbuf, &len, &list));
  APP(get_command_buffer_string(app->term.cmdbuf, &cursor, &cmdbuf));
  RDR(clear_term(app->term.render_term, RDR_TERM_CMDOUT));
  RDR(term_print_string
    (app->term.render_term, RDR_TERM_CMDOUT, cmdbuf, RDR_TERM_COLOR_WHITE));
  RDR(term_translate_cursor(app->term.render_term, INT_MIN));
  RDR(term_translate_cursor(app->term.render_term, cursor));
  if(0 != len) {
    if(1 < len) {
      size_t i = 0;
      for(i = 0; i < len; ++i) {
        if(0 != i) {
          RDR(term_print_wchar
            (app->term.render_term,
             RDR_TERM_STDOUT,
             L'\t',
             RDR_TERM_COLOR_WHITE));
        }
        RDR(term_print_string
          (app->term.render_term,
           RDR_TERM_STDOUT,
           list[i],
           RDR_TERM_COLOR_WHITE));
      }
      RDR(term_print_wchar
        (app->term.render_term, RDR_TERM_STDOUT, L'\n', RDR_TERM_COLOR_WHITE));
    }
  }
}
コード例 #8
0
ファイル: PgRect.cpp プロジェクト: sanyaade-webdev/wpub
void CPgRect::OnColor() 
{
	LPFX pfx = EDIT().GetEditFx();
	if ( pfx == NULL ) return;

	// Choose a new color
	CWinFile::ChooseColor( &pfx->bck, GetSafeHwnd() );	

	m_colorbox.SetColor( pfx->bck );

	APP()->ReGen();
}
コード例 #9
0
ファイル: app_term.c プロジェクト: vaplv/foo
enum app_error
app_shutdown_term(struct app* app)
{
  enum app_error app_err = APP_NO_ERROR;
  if(!app) {
    app_err = APP_INVALID_ARGUMENT;
    goto error;
  }
  if(app->term.cmdbuf)
    APP(regular_command_buffer_ref_put(app->term.cmdbuf));
  if(app->term.render_term)
    RDR(term_ref_put(app->term.render_term));
  if(true == app->term.is_enabled)
    APP(enable_term(app, false));
  memset(&app->term, 0, sizeof(app->term));

exit:
  return app_err;
error:
  goto exit;
}
コード例 #10
0
ファイル: PgRect.cpp プロジェクト: sanyaade-webdev/wpub
void CPgRect::OnFoundered() 
{
	UpdateData( TRUE );
	LPFX pfx = EDIT().GetEditFx();
	if ( pfx == NULL ) return;

	// Toggle bit
	if ( m_bFoundered ) pfx->f1 |= FXF1_FOUNDERED;
	else pfx->f1 &= ~FXF1_FOUNDERED;

	APP()->ReGen();
}
コード例 #11
0
ファイル: PgChromaKey.cpp プロジェクト: sanyaade-webdev/wpub
void CPgChromaKey::OnEnable() 
{	DoEnable();

	// Get the current image
	LPPUBIMGINFO ppii = IMGLIST().GetSelImage();
	if ( ppii == NULL ) return;

	// Set/clear flag
	if ( m_bEnable ) ppii->f1 |= PIIF1_CHROMAKEY;
	else ppii->f1 &= ~PIIF1_CHROMAKEY;

	APP()->ReGen();
}
コード例 #12
0
ファイル: edit_picking.c プロジェクト: vaplv/foo
static void
release_picking(struct ref* ref)
{
  struct edit_picking* picking = NULL;
  assert(ref);

  picking = CONTAINER_OF(ref, struct edit_picking, ref);
  EDIT(imgui_ref_put(picking->imgui));
  EDIT(model_instance_selection_ref_put(picking->instance_selection));
  APP(ref_put(picking->app));
  SL(free_hash_table(picking->picked_instances_htbl));
  MEM_FREE(picking->allocator, picking);
}
コード例 #13
0
ファイル: PgChromaKey.cpp プロジェクト: sanyaade-webdev/wpub
void CPgChromaKey::OnChooseColor() 
{
	// Get the current image
	LPPUBIMGINFO ppii = IMGLIST().GetSelImage();
	if ( ppii == NULL ) return;

	// Choose a new color
	CWinFile::ChooseColor( &ppii->rgbkey, GetSafeHwnd() );	

	// Set color to box
	m_colorbox.SetColor( ppii->rgbkey );

	APP()->ReGen();
}
コード例 #14
0
ファイル: PgChromaKey.cpp プロジェクト: sanyaade-webdev/wpub
void CPgChromaKey::OnChangePositive() 
{
	UpdateData( TRUE );

	// Get the current image
	LPPUBIMGINFO ppii = IMGLIST().GetSelImage();
	if ( ppii == NULL ) return;

	// Set neg value
	ppii->cpos = strtoul( m_sPositive, NULL, 10 );
	m_slidePositive.SetPos( ppii->cpos );

	APP()->ReGen();
}
コード例 #15
0
ファイル: PgRect.cpp プロジェクト: sanyaade-webdev/wpub
void CPgRect::OnBorder() 
{
	UpdateData( TRUE );
	LPFX pfx = EDIT().GetEditFx();
	if ( pfx == NULL ) return;

	// Toggle bit
	if ( m_bBorder ) pfx->f1 |= FXF1_BORDER;
	else pfx->f1 &= ~FXF1_BORDER;

	APP()->ReGen();

	DoEnable();
}
コード例 #16
0
ファイル: PgChromaKey.cpp プロジェクト: sanyaade-webdev/wpub
void CPgChromaKey::OnNosmoothing() 
{
	UpdateData( TRUE );

	// Get the current image
	LPPUBIMGINFO ppii = IMGLIST().GetSelImage();
	if ( ppii == NULL ) return;

	// Set/clear flag
	if ( m_bNoSmoothing ) ppii->f1 |= PIIF1_NOSMOOTHING;
	else ppii->f1 &= ~PIIF1_NOSMOOTHING;

	APP()->ReGen();
}
コード例 #17
0
ファイル: PgRect.cpp プロジェクト: sanyaade-webdev/wpub
void CPgRect::OnChangeTranslucency() 
{
	UpdateData( TRUE );

	LPFX pfx = EDIT().GetEditFx();
	if ( pfx == NULL ) return;

	pfx->translucency = (DWORD)( strtod( m_sTranslucency, NULL ) * 100 );
	if ( pfx->translucency > 10000 ) 
	{
		pfx->translucency = 10000;
		m_sTranslucency = "100.00";
		UpdateData( FALSE );
	} // end if

	APP()->ReGen();
}
コード例 #18
0
ファイル: core.cpp プロジェクト: drm004e/resoundnv
int main(int argc, char** argv){

	parse_command_arguments(argc,argv);
	// for now we take the first arg and use it as the filename for xml
	std::cout << "resoundnv server v0.0.1\n";
	std::cout << "Loading config from " << g_options.inputXML_ << std::endl;

	// loading and parsing the xml
//	try
//	{
		xmlpp::DomParser parser;
		parser.set_validate(false);
		parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
		parser.parse_file(g_options.inputXML_);
		if(parser){
			const xmlpp::Node* pNode = parser.get_document()->get_root_node(); //deleted by DomParser.
			const xmlpp::Element* nodeElement = dynamic_cast<const xmlpp::Element*>(pNode);
			if(nodeElement)
			{	
				std::string name = nodeElement->get_name();
				if(name=="resoundnv"){
					std::cout << "Resoundnv XML node found, building session.\n";
					g_session = new ResoundSession(g_options);
					APP().set_session(g_session);
					SESSION().load_from_xml(nodeElement);
				}
			}
		}
//	}
//	catch(const std::exception& ex){
//		std::cout << "XML Initialisation file parsing exception what()=" << ex.what() << std::endl;
//		std::cout << "Server cannot continue"<< std::endl;
//		std::exit(1);
//	}
        signal(SIGINT, handle_sigint);
        g_continue = true;
	while(g_continue){ // TODO this should really listen for incoming signals, see unix programming book.
		usleep(100000); // around 10 fps
		// use this thread to send some feedback
		//session->update_clients();
                if(g_session) g_session->send_osc_feedback();
	}
        delete g_session; // should invoke destructor
        g_session=0;
        return 0;
}
コード例 #19
0
ファイル: PgImageProp.cpp プロジェクト: sanyaade-webdev/wpub
void CPgImageProp::OnCustomsize() 
{
	DoEnable();

	// Get the current image
	LPPUBIMGINFO ppii = IMGLIST().GetSelImage();
	if ( ppii == NULL ) return;
	
	// Toggle custom size mode
	if ( m_bCustomSize ) ppii->f1 |= PIIF1_CUSTOMSIZE;
	else ppii->f1 &= ~PIIF1_CUSTOMSIZE;

	APP()->ReGen();

	EDIT().Size( NULL );

	OnRefresh( 0, 0L );
}
コード例 #20
0
//-----------------------------------------------------------------------------
// Purpose: Automagically bring this bar to the top when the mouse cursor passes
//			over it.
// Input  : pWnd - 
//			nHitTest - 
//			message - 
// Output : Always returns FALSE.
//-----------------------------------------------------------------------------
BOOL CHammerBar::OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message)
{
	if (APP()->IsActiveApp())
	{
		// The control bar window is actually our grandparent.
		CWnd *pwnd = GetParent();
		if (pwnd != NULL)
		{
			pwnd = pwnd->GetParent();
			if (pwnd != NULL)
			{
				pwnd->BringWindowToTop();
			}
		}
	}

	//this wasn't being called and fixes some minor cursor problems.
	return CWnd::OnSetCursor( pWnd, nHitTest, message );
}
コード例 #21
0
ファイル: app_term.c プロジェクト: vaplv/foo
/*******************************************************************************
 *
 * Command buffer functions.
 *
 ******************************************************************************/
enum app_error
app_init_term(struct app* app)
{
  struct wm_window_desc win_desc;
  enum app_error app_err = APP_NO_ERROR;
  enum rdr_error rdr_err = RDR_NO_ERROR;

  if(!app || !app->rdr.term_font || !app->wm.window) {
    app_err = APP_INVALID_ARGUMENT;
    goto error;
  }
  app_err = app_regular_create_command_buffer(app, &app->term.cmdbuf);
  if(APP_NO_ERROR != app_err)
    goto error;
  WM(get_window_desc(app->wm.window, &win_desc));
  rdr_err = rdr_create_term
    (app->rdr.system,
     app->rdr.term_font,
     win_desc.width,
     win_desc.height,
     &app->term.render_term);
  if(RDR_NO_ERROR != rdr_err) {
    app_err = rdr_to_app_error(rdr_err);
    goto error;
  }
  rdr_err = rdr_term_print_wstring
    (app->term.render_term, RDR_TERM_PROMPT, L"$ ", RDR_TERM_COLOR_GREEN);
  if(RDR_NO_ERROR != rdr_err) {
    app_err = rdr_to_app_error(rdr_err);
    goto error;
  }
  app->term.is_enabled = false;
exit:
  return app_err;
error:
  APP(shutdown_term(app));
  goto exit;
}
コード例 #22
0
int main(int argc, char ** argv)
{
	if(DLibH::Herramientas_SDL::iniciar_SDL(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK))
	{
		//Inicializar control de logs.
		LOG.inicializar("data/logs/info.log");
		LOG.activar();

		DLibH::Log_motor::arrancar("data/logs/log_motor.log");

		//Inicializar control de argumentos.
		Herramientas_proyecto::Controlador_argumentos CARG(argc, argv);

		try
		{
			App::App_kernel_config AKC;

			App::App_config config;
			config.cargar();

			DFramework::Kernel kernel(CARG, AKC, config);

			App::Director_estados APP(kernel, config);
			APP.iniciar(kernel);
		}
		catch(std::exception &e)
		{
			std::cout<<"Saliendo: se atraṕo una excepción : "<<e.what()<<std::endl;
		}
	}
	
	DLibH::Log_motor::finalizar();
	DLibH::Herramientas_SDL::apagar_SDL();

	return 0;
}
コード例 #23
0
//-----------------------------------------------------------------------------
// Purpose: Overloaded to handle the 2x2 splitter. If the splitter is enabled,
//			the splitter window is createed and one 3D view and three 2D views
//			are added to it.
// Input  : lpcs - 
//			pContext - 
// Output : Returns TRUE on success, FALSE on failure.
//-----------------------------------------------------------------------------
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
{
	//
	// If we are using the splitter, create the splitter and 4 views.
	//
	if (bUsingSplitter)
	{
		m_wndSplitter = new CMySplitterWnd;
		Assert(m_wndSplitter != NULL);
		
		if (m_wndSplitter == NULL)
		{
			return(FALSE);
		}

		if (!m_wndSplitter->CreateStatic(this, 2, 2))
		{
			delete m_wndSplitter;
			m_wndSplitter = NULL;
			TRACE0("Failed to create split bar ");
			return(FALSE);
		}
		
		//
		// Calculate the size of each view within the splitter,
		//
		CRect r;
		GetClientRect(r);
		CSize sizeView((r.Width() / 2) - 3, (r.Height() / 2) - 3);

		//
		// Create the 4 views as they were when the user last closed the app.
		//
		DrawType_t eDrawType[2][2];

		eDrawType[0][0] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType0,0", VIEW3D_WIREFRAME);
		eDrawType[0][1] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType0,1", VIEW2D_XY);
		eDrawType[1][0] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType1,0", VIEW2D_YZ);
		eDrawType[1][1] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType1,1", VIEW2D_XZ);

		for (int nRow = 0; nRow < 2; nRow++)
		{
			for (int nCol = 0; nCol < 2; nCol++)
			{
				// These might be lying around in people's registry.
				if ((eDrawType[nRow][nCol] == VIEW3D_ENGINE) || (eDrawType[nRow][nCol] >= VIEW_TYPE_LAST))
				{
					eDrawType[nRow][nCol] = VIEW3D_TEXTURED;
				}
			
				switch (eDrawType[nRow][nCol])
				{
					case VIEW2D_XY:
					case VIEW2D_XZ:
					case VIEW2D_YZ:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapView2D), sizeView, pContext);
						break;
					}

					case VIEW_LOGICAL:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapViewLogical), sizeView, pContext);
						break;
					}

					case VIEW3D_WIREFRAME:
					case VIEW3D_POLYGON:
					case VIEW3D_TEXTURED:
					case VIEW3D_TEXTURED_SHADED:
					case VIEW3D_LIGHTMAP_GRID:
					case VIEW3D_LIGHTING_PREVIEW2:
					case VIEW3D_LIGHTING_PREVIEW_RAYTRACED:
					case VIEW3D_SMOOTHING_GROUP:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapView3D), sizeView, pContext);
						break;
					}
				}

				CMapView *pView = dynamic_cast<CMapView*>(m_wndSplitter->GetPane(nRow, nCol));
				if (pView != NULL)
				{
					pView->SetDrawType(eDrawType[nRow][nCol]);
				}
			}
		}
		
		int nWidth = APP()->GetProfileInt("Splitter", "SplitterWidth", -1);
		int nHeight = APP()->GetProfileInt("Splitter", "SplitterHeight", -1);

		if ( nWidth != -1 && nHeight != -1 )
		{
			m_wndSplitter->SetRowInfo( 0, nHeight, 0 );
			m_wndSplitter->SetColumnInfo( 0, nWidth, 0 );
			m_wndSplitter->RecalcLayout();
		}
		else
		{
			m_bNeedsCentered = TRUE;
		}

        m_bReady = TRUE;
		return TRUE;
	}

	//
	// No splitter, call default creation code.
	//
	return(CMDIChildWnd::OnCreateClient(lpcs, pContext));
}
コード例 #24
0
ファイル: PgChromaKey.cpp プロジェクト: sanyaade-webdev/wpub
void CPgChromaKey::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	long pos = pScrollBar->GetScrollPos();

	int min = 0, max = 100;
//	pScrollBar->GetScrollRange( &min, &max );

	switch( nSBCode )
	{
		case SB_LEFT : pos = min;							break;
		case SB_ENDSCROLL : 
			break;
		case SB_LINELEFT : pos -= 1;						break;
		case SB_LINERIGHT : pos += 1;						break;
		case SB_PAGELEFT : pos -= ( max - min ) / 10;		break;
		case SB_PAGERIGHT : pos += ( max - min ) / 10;		break;
		case SB_RIGHT : pos = max;							break;
		case SB_THUMBPOSITION : pos = long( nPos );			break;
		case SB_THUMBTRACK : pos = long( nPos );			break;
		default : return; break;

	} // end switch
	
	if ( (CSlider*)pScrollBar == &m_slidePositive )
	{
		if ( nSBCode == SB_ENDSCROLL )
			pos = m_slidePositive.GetPos();
		else m_slidePositive.SetPos( pos );

		char num[ 64 ];
		wsprintf( num, "%lu", pos );
		m_sPositive = num;

		UpdateData( FALSE );

		if ( nSBCode == SB_ENDSCROLL )
		{			
			// Get the current image
			LPPUBIMGINFO ppii = IMGLIST().GetSelImage();
			if ( ppii == NULL ) return;

			ppii->cpos = pos;
			APP()->ReGen();
		} // end if
	} // end if

	else if ( (CSlider*)pScrollBar == &m_slideNegative )
	{
		if ( nSBCode == SB_ENDSCROLL )
			pos = m_slideNegative.GetPos();
		else m_slideNegative.SetPos( pos );

		char num[ 64 ];
		wsprintf( num, "%lu", pos );
		m_sNegative = num;

		UpdateData( FALSE );

		if ( nSBCode == SB_ENDSCROLL )
		{			
			// Get the current image
			LPPUBIMGINFO ppii = IMGLIST().GetSelImage();
			if ( ppii == NULL ) return;

			ppii->cneg = pos;
			APP()->ReGen();
		} // end if
	} // end if
	
	CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
コード例 #25
0
//-----------------------------------------------------------------------------
// Purpose: Overloaded to handle the 2x2 splitter. If the splitter is enabled,
//			the splitter window is createed and one 3D view and three 2D views
//			are added to it.
// Input  : lpcs - 
//			pContext - 
// Output : Returns TRUE on success, FALSE on failure.
//-----------------------------------------------------------------------------
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
{
	//
	// If we are using the splitter, create the splitter and 4 views.
	//
	if (bUsingSplitter)
	{
		m_wndSplitter = new CMySplitterWnd;
		ASSERT(m_wndSplitter != NULL);
		
		if (m_wndSplitter == NULL)
		{
			return(FALSE);
		}

		if (!m_wndSplitter->CreateStatic(this, 2, 2))
		{
			delete m_wndSplitter;
			m_wndSplitter = NULL;
			TRACE0("Failed to create split bar ");
			return(FALSE);
		}
		
		//
		// Calculate the size of each view within the splitter,
		//
		CRect r;
		GetClientRect(r);
		CSize sizeView((r.Width() / 2) - 3, (r.Height() / 2) - 3);

		//
		// Create the 4 views as they were when the user last closed the app.
		//
		DrawType_t eDrawType[2][2];

		eDrawType[0][0] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType0,0", VIEW3D_WIREFRAME);
		eDrawType[0][1] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType0,1", VIEW2D_XY);
		eDrawType[1][0] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType1,0", VIEW2D_YZ);
		eDrawType[1][1] = (DrawType_t)APP()->GetProfileInt("Splitter", "DrawType1,1", VIEW2D_XZ);

		for (int nRow = 0; nRow < 2; nRow++)
		{
			for (int nCol = 0; nCol < 2; nCol++)
			{
				switch (eDrawType[nRow][nCol])
				{
					case VIEW2D_XY:
					case VIEW2D_XZ:
					case VIEW2D_YZ:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapView2D), sizeView, pContext);
						break;
					}

					case VIEW3D_WIREFRAME:
					case VIEW3D_POLYGON:
					case VIEW3D_TEXTURED:
					case VIEW3D_LIGHTMAP_GRID:
					case VIEW3D_LIGHTING_PREVIEW:
					case VIEW3D_SMOOTHING_GROUP:
					{
						m_wndSplitter->CreateView(nRow, nCol, RUNTIME_CLASS(CMapView3D), sizeView, pContext);
						break;
					}
				}

				CMapView *pView = (CMapView *)m_wndSplitter->GetPane(nRow, nCol);
				if (pView != NULL)
				{
					pView->SetDrawType(eDrawType[nRow][nCol]);
				}
			}
		}

		m_bReady = TRUE;

		return TRUE;
	}

	//
	// No splitter, call default creation code.
	//
	return(CMDIChildWnd::OnCreateClient(lpcs, pContext));
}
コード例 #26
0
void			kaneton(t_init*				bootloader)
{
  /*
   * 1)
   */
  init = bootloader;

  /*
   * 2)
   */

  if (cons_init() != ERROR_NONE)
    core_error("cannot initialise the console manager\n");

  /*
   * 3)
   */

  printf("\n");
  cons_msg('+', "%s\n", version);
  printf("\n");

  /*
   * 4)
   */

#if (DEBUG & DEBUG_PARAMS)
  kaneton_dump();
#endif

  /*
   * 5)
   */

  cons_msg('+', "starting malloc\n");

  alloc_init(init->alloc, init->allocsz);

  /*
   * 6)
   */

  cons_msg('+', "starting kernel manager\n");

  kernel_init();

  /*
   * 7)
   */

  cons_msg('+', "kaneton started\n");

  /*
   * XXX
   */

#if defined(CONF_ENABLE_CHECK)
  cons_msg('+', "running manual tests\n");
  check_tests();
  while(1)
    ;
#endif

#ifdef SERIAL
  cons_msg('+', "starting debug manager\n");
  debug_init();
  while(1)
    ;
#endif

  /*
   * /XXX
   */

#ifdef APP
  APP();
#endif

  while(1)
    ;

  cons_msg('#', "kaneton is stopping...\n");

  /*
   * 8)
   */

  kernel_clean();

  /*
   * 21)
   */

  cons_msg('+', "system shutdown\n");

  while (1)
    ;
}
コード例 #27
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void COptions::SetDefaults(void)
{
	BOOL bWrite = FALSE;

	if (APP()->GetProfileInt("Configured", "Configured", 0) != iThisVersion)
	{
		bWrite = TRUE;
	}

	if (APP()->GetProfileInt("Configured", "Installed", 42151) == 42151)
	{
		APP()->WriteProfileInt("Configured", "Installed", time(NULL));
	}

	uDaysSinceInstalled = 0;

	// textures
	textures.nTextureFiles = 1;
	textures.TextureFiles.Add("textures.wad");
	textures.fBrightness = 1.0;

	// general
	general.bIndependentwin = FALSE;
	general.bLoadwinpos = TRUE;
	general.iUndoLevels = 50;
	general.bGroupWhileIgnore = FALSE;
	general.bStretchArches = TRUE;
	general.bLockingTextures = TRUE;
	general.bShowHelpers = TRUE;

	// view2d
	view2d.bCrosshairs = FALSE;
	view2d.bGroupCarve = TRUE;
	view2d.bScrollbars = TRUE;
	view2d.bRotateConstrain = FALSE;
	view2d.bDrawVertices = TRUE;
	view2d.iDefaultGrid = 64;
	view2d.bWhiteOnBlack = TRUE;
	view2d.bGridHigh1024 = TRUE;
	view2d.bGridHigh10 = TRUE;
	view2d.iGridIntensity = 30;
	view2d.bHideSmallGrid = TRUE;
	view2d.bNudge = FALSE;
	view2d.bOrientPrimitives = FALSE;
	view2d.bAutoSelect = FALSE;
	view2d.bSelectbyhandles = FALSE;
	view2d.iGridHighSpec = 8;
	view2d.bKeepclonegroup = TRUE;
	view2d.bGridHigh64 = FALSE;
	view2d.bGridDots = FALSE;
	view2d.bCenteroncamera = FALSE;
	view2d.bUsegroupcolors = TRUE;

	// view3d
	view3d.bUseMouseLook = TRUE;
	view3d.bHardware = FALSE;
	view3d.bReverseY = FALSE;
	view3d.iBackPlane = 5000;
	view3d.nModelDistance = 400;
	view3d.bAnimateModels = TRUE;
	view3d.nForwardSpeedMax = 1000;
	view3d.nTimeToMaxSpeed = 500;
	view3d.bFilterTextures = TRUE;
	view3d.bReverseSelection = FALSE;

	if (bWrite)
	{
		Write(FALSE);
	}
}
コード例 #28
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : fOverwrite - 
//-----------------------------------------------------------------------------
void COptions::Write(BOOL fOverwrite)
{
	APP()->WriteProfileInt("Configured", "Configured", iThisVersion);

	int i, iSize;
	CString str;

	// write texture info - remember, it's stored in general
	iSize = textures.nTextureFiles;
	APP()->WriteProfileInt(pszGeneral, "TextureFileCount", iSize);
	for(i = 0; i < iSize; i++)
	{
		str.Format("TextureFile%d", i);
		APP()->WriteProfileString(pszGeneral, str, textures.TextureFiles[i]);
	}
	APP()->WriteProfileInt(pszGeneral, "Brightness", int(textures.fBrightness * 10));

	// write general
	APP()->WriteProfileInt(pszGeneral, "Undo Levels", general.iUndoLevels);
	APP()->WriteProfileInt(pszGeneral, "Locking Textures", general.bLockingTextures);
	APP()->WriteProfileInt(pszGeneral, "Texture Alignment", general.eTextureAlignment);
	APP()->WriteProfileInt(pszGeneral, "Independent Windows", general.bIndependentwin);
	APP()->WriteProfileInt(pszGeneral, "Load Default Positions", general.bLoadwinpos);
	APP()->WriteProfileInt(pszGeneral, "GroupWhileIgnore", general.bGroupWhileIgnore);
	APP()->WriteProfileInt(pszGeneral, "StretchArches", general.bStretchArches);
	APP()->WriteProfileInt(pszGeneral, "Show Helpers", general.bShowHelpers);

	// write view2d
	APP()->WriteProfileInt(pszView2D, "Crosshairs", view2d.bCrosshairs);
	APP()->WriteProfileInt(pszView2D, "GroupCarve", view2d.bGroupCarve);
	APP()->WriteProfileInt(pszView2D, "Scrollbars", view2d.bScrollbars);
	APP()->WriteProfileInt(pszView2D, "RotateConstrain", view2d.bRotateConstrain);
	APP()->WriteProfileInt(pszView2D, "Draw Vertices", view2d.bDrawVertices);
	APP()->WriteProfileInt(pszView2D, "Default Grid", view2d.iDefaultGrid);
	APP()->WriteProfileInt(pszView2D, "WhiteOnBlack", view2d.bWhiteOnBlack);
	APP()->WriteProfileInt(pszView2D, "GridHigh1024", view2d.bGridHigh1024);
	APP()->WriteProfileInt(pszView2D, "GridHigh10", view2d.bGridHigh10);
	APP()->WriteProfileInt(pszView2D, "GridIntensity", view2d.iGridIntensity);
	APP()->WriteProfileInt(pszView2D, "HideSmallGrid", view2d.bHideSmallGrid);
	APP()->WriteProfileInt(pszView2D, "Nudge", view2d.bNudge);
	APP()->WriteProfileInt(pszView2D, "OrientPrimitives", view2d.bOrientPrimitives);
	APP()->WriteProfileInt(pszView2D, "AutoSelect", view2d.bAutoSelect);
	APP()->WriteProfileInt(pszView2D, "SelectByHandles", view2d.bSelectbyhandles);
	APP()->WriteProfileInt(pszView2D, "GridHighSpec", view2d.iGridHighSpec);
	APP()->WriteProfileInt(pszView2D, "KeepCloneGroup", view2d.bKeepclonegroup);
	APP()->WriteProfileInt(pszView2D, "Gridhigh64", view2d.bGridHigh64);
	APP()->WriteProfileInt(pszView2D, "GridDots", view2d.bGridDots);
	APP()->WriteProfileInt(pszView2D, "Centeroncamera", view2d.bCenteroncamera);
	APP()->WriteProfileInt(pszView2D, "Usegroupcolors", view2d.bUsegroupcolors);

	// write view3d
	APP()->WriteProfileInt(pszView3D, "Hardware", view3d.bHardware);
	APP()->WriteProfileInt(pszView3D, "Reverse Y", view3d.bReverseY);
	APP()->WriteProfileInt(pszView3D, "BackPlane", view3d.iBackPlane);
	APP()->WriteProfileInt(pszView3D, "UseMouseLook", view3d.bUseMouseLook);
	APP()->WriteProfileInt(pszView3D, "ModelDistance", view3d.nModelDistance);
	APP()->WriteProfileInt(pszView3D, "AnimateModels", view3d.bAnimateModels);
	APP()->WriteProfileInt(pszView3D, "ForwardSpeedMax", view3d.nForwardSpeedMax);
	APP()->WriteProfileInt(pszView3D, "TimeToMaxSpeed", view3d.nTimeToMaxSpeed);
	APP()->WriteProfileInt(pszView3D, "FilterTextures", view3d.bFilterTextures);
	APP()->WriteProfileInt(pszView3D, "ReverseSelection", view3d.bReverseSelection);

	//
	// We don't write custom color settings because there is no GUI for them yet.
	//

	//
	// Write game configs to the INI file. This is in an external file so we can distribute it
	// with worldcraft as a set of defaults.
	//
	char szIniPath[MAX_PATH];
	APP()->GetDirectory(DIR_PROGRAM, szIniPath);
	strcat(szIniPath, "GameCfg.ini");
	configs.SaveGameConfigs(szIniPath);
}
コード例 #29
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void COptions::ReadColorSettings(void)
{ 
	colors.bUseCustom = (APP()->GetProfileInt(g_szColors, "UseCustom", 0) != 0);
	if (colors.bUseCustom)
	{
		colors.clrAxis = APP()->GetProfileColor(g_szColors, "Grid0", 0 , 100, 100);
		colors.bScaleAxisColor = (APP()->GetProfileInt(g_szColors, "ScaleGrid0", 0) != 0);
		colors.clrGrid = APP()->GetProfileColor(g_szColors, "Grid", 50 , 50, 50);
		colors.bScaleGridColor = (APP()->GetProfileInt(g_szColors, "ScaleGrid", 1) != 0);
		colors.clrGrid10 = APP()->GetProfileColor(g_szColors, "Grid10", 40 , 40, 40);
		colors.bScaleGrid10Color = (APP()->GetProfileInt(g_szColors, "ScaleGrid10", 1) != 0);
		colors.clrGrid1024 = APP()->GetProfileColor(g_szColors, "Grid1024", 40 , 40, 40);
		colors.bScaleGrid1024Color = (APP()->GetProfileInt(g_szColors, "ScaleGrid1024", 1) != 0);
		colors.clrGridDot = APP()->GetProfileColor(g_szColors, "GridDot", 128, 128, 128);
		colors.bScaleGridDotColor = (APP()->GetProfileInt(g_szColors, "ScaleGridDot", 1) != 0);

		colors.clrBrush = APP()->GetProfileColor(g_szColors, "LineColor", 0, 0, 0);
		colors.clrEntity = APP()->GetProfileColor(g_szColors, "Entity", 220, 30, 220);
		colors.clrVertex = APP()->GetProfileColor(g_szColors, "Vertex", 0, 0, 0);
		colors.clrBackground = APP()->GetProfileColor(g_szColors, "Background", 0, 0, 0);
		colors.clrToolHandle = APP()->GetProfileColor(g_szColors, "HandleColor", 0, 0, 0);
		colors.clrToolBlock = APP()->GetProfileColor(g_szColors, "BoxColor", 0, 0, 0);
		colors.clrToolSelection = APP()->GetProfileColor(g_szColors, "ToolSelect", 0, 0, 0);
		colors.clrToolMorph = APP()->GetProfileColor(g_szColors, "Morph", 255, 0, 0);
		colors.clrToolPath = APP()->GetProfileColor(g_szColors, "Path", 255, 0, 0);
		colors.clrSelection = APP()->GetProfileColor(g_szColors, "Selection", 220, 0, 0);
		colors.clrToolDrag = APP()->GetProfileColor(g_szColors, "ToolDrag", 255, 255, 0);
	}
	else
	{
		if (Options.view2d.bWhiteOnBlack)
		{
			// BLACK BACKGROUND
			colors.clrBackground = RGB(0, 0, 0);
			colors.clrGrid = RGB(255, 255, 255);
			colors.clrGridDot = RGB(255, 255, 255);
			colors.clrGrid1024 = RGB(100, 50, 5);
			colors.clrGrid10 = RGB(255, 255, 255);
			colors.clrAxis = RGB(0, 100, 100);
			colors.clrBrush = RGB(255, 255, 255);
			colors.clrVertex = RGB(255, 255, 255);

			colors.clrToolHandle = RGB(255, 255, 255);
			colors.clrToolBlock = RGB(255, 255, 255);
			colors.clrToolDrag = RGB(255, 255, 0);
		}
		else
		{
			// WHITE BACKGROUND
			colors.clrBackground = RGB(255, 255, 255);
			colors.clrGrid = RGB(50, 50, 50);
			colors.clrGridDot = RGB(40, 40, 40);
			colors.clrGrid1024 = RGB(200, 100, 10);
			colors.clrGrid10 = RGB(40, 40, 40);
			colors.clrAxis = RGB(0, 100, 100);
			colors.clrBrush = RGB(0, 0, 0);
			colors.clrVertex = RGB(0, 0, 0);

			colors.clrToolHandle = RGB(0, 0, 0);
			colors.clrToolBlock = RGB(0, 0, 0);
			colors.clrToolDrag = RGB(0, 0, 255);
		}

		colors.bScaleAxisColor = false;
		colors.bScaleGridColor = true;
		colors.bScaleGrid10Color = true;
		colors.bScaleGrid1024Color = false;
		colors.bScaleGridDotColor = true;

		colors.clrToolSelection = colors.clrSelection = RGB(255, 0, 0);
		colors.clrToolMorph = RGB(255, 0, 0);
		colors.clrToolPath = RGB(255, 0, 0);
		colors.clrEntity = RGB(220, 30, 220);
	}
}
コード例 #30
0
//-----------------------------------------------------------------------------
// Purpose: Loads the application configuration settings.
// Output : Returns TRUE on success, FALSE on failure.
//-----------------------------------------------------------------------------
BOOL COptions::Read(void)
{
	if (!APP()->GetProfileInt("Configured", "Configured", 0))
	{
		return FALSE;
	}

	DWORD dwTime = APP()->GetProfileInt("Configured", "Installed", time(NULL));
	CTimeSpan ts(time(NULL) - dwTime);
	uDaysSinceInstalled = ts.GetDays();

	int i, iSize;
	CString str;

	// read texture info - it's stored in the general section from
	//  an old version, but this doesn't matter much.
	iSize = APP()->GetProfileInt(pszGeneral, "TextureFileCount", 0);
	if(iSize)
	{
		// make sure default is removed
		textures.nTextureFiles = 0;
		textures.TextureFiles.RemoveAll();
		// read texture file names
		for(i = 0; i < iSize; i++)
		{
			str.Format("TextureFile%d", i);
			str = APP()->GetProfileString(pszGeneral, str);
			if(GetFileAttributes(str) == 0xffffffff)
			{
				// can't find
				continue;
			}
			textures.TextureFiles.Add(str);
			textures.nTextureFiles++;
		}
	}
	else
	{
		// SetDefaults() added 'textures.wad' to the list
	}
	textures.fBrightness = float(APP()->GetProfileInt(pszGeneral, "Brightness", 10)) / 10.0;

	// load general info
	general.iUndoLevels = APP()->GetProfileInt(pszGeneral, "Undo Levels", 50);
	general.bLockingTextures = APP()->GetProfileInt(pszGeneral, "Locking Textures", TRUE);
	general.eTextureAlignment = (TextureAlignment_t)APP()->GetProfileInt(pszGeneral, "Texture Alignment", TEXTURE_ALIGN_WORLD);
	general.bLoadwinpos = APP()->GetProfileInt(pszGeneral, "Load Default Positions", TRUE);
	general.bIndependentwin = APP()->GetProfileInt(pszGeneral, "Independent Windows", FALSE);
	general.bGroupWhileIgnore = APP()->GetProfileInt(pszGeneral, "GroupWhileIgnore", FALSE);
	general.bStretchArches = APP()->GetProfileInt(pszGeneral, "StretchArches", TRUE);
	general.bShowHelpers = APP()->GetProfileInt(pszGeneral, "Show Helpers", TRUE);

	// read view2d
	view2d.bCrosshairs = APP()->GetProfileInt(pszView2D, "Crosshairs", FALSE);
	view2d.bGroupCarve = APP()->GetProfileInt(pszView2D, "GroupCarve", TRUE);
	view2d.bScrollbars = APP()->GetProfileInt(pszView2D, "Scrollbars", TRUE);
	view2d.bRotateConstrain = APP()->GetProfileInt(pszView2D, "RotateConstrain", FALSE);
	view2d.bDrawVertices = APP()->GetProfileInt(pszView2D, "Draw Vertices", TRUE);
	view2d.bWhiteOnBlack = APP()->GetProfileInt(pszView2D, "WhiteOnBlack", TRUE);
	view2d.bGridHigh1024 = APP()->GetProfileInt(pszView2D, "GridHigh1024", TRUE);
	view2d.bGridHigh10 = APP()->GetProfileInt(pszView2D, "GridHigh10", TRUE);
	view2d.bHideSmallGrid = APP()->GetProfileInt(pszView2D, "HideSmallGrid", TRUE);
	view2d.bNudge = APP()->GetProfileInt(pszView2D, "Nudge", FALSE);
	view2d.bOrientPrimitives = APP()->GetProfileInt(pszView2D, "OrientPrimitives", FALSE);
	view2d.bAutoSelect = APP()->GetProfileInt(pszView2D, "AutoSelect", FALSE);
	view2d.bSelectbyhandles = APP()->GetProfileInt(pszView2D, "SelectByHandles", FALSE);
	view2d.iGridIntensity = APP()->GetProfileInt(pszView2D, "GridIntensity", 30);
	view2d.iDefaultGrid = APP()->GetProfileInt(pszView2D, "Default Grid", 64);
	view2d.iGridHighSpec = APP()->GetProfileInt(pszView2D, "GridHighSpec", 8);
	view2d.bKeepclonegroup = APP()->GetProfileInt(pszView2D, "Keepclonegroup", TRUE);
	view2d.bGridHigh64 = APP()->GetProfileInt(pszView2D, "Gridhigh64", TRUE);
	view2d.bGridDots = APP()->GetProfileInt(pszView2D, "GridDots", FALSE);
	view2d.bCenteroncamera = APP()->GetProfileInt(pszView2D, "Centeroncamera", FALSE);
	view2d.bUsegroupcolors = APP()->GetProfileInt(pszView2D, "Usegroupcolors", TRUE);

	// read view3d
	view3d.bHardware = APP()->GetProfileInt(pszView3D, "Hardware", FALSE);
	view3d.bReverseY = APP()->GetProfileInt(pszView3D, "Reverse Y", TRUE);
	view3d.iBackPlane = APP()->GetProfileInt(pszView3D, "BackPlane", 5000);
	view3d.bUseMouseLook = APP()->GetProfileInt(pszView3D, "UseMouseLook", TRUE);
	view3d.nModelDistance = APP()->GetProfileInt(pszView3D, "ModelDistance", 400);
	view3d.bAnimateModels = APP()->GetProfileInt(pszView3D, "AnimateModels", TRUE);
	view3d.nForwardSpeedMax = APP()->GetProfileInt(pszView3D, "ForwardSpeedMax", 1000);
	view3d.nTimeToMaxSpeed = APP()->GetProfileInt(pszView3D, "TimeToMaxSpeed", 500);
	view3d.bFilterTextures = APP()->GetProfileInt(pszView3D, "FilterTextures", TRUE);
	view3d.bReverseSelection = APP()->GetProfileInt(pszView3D, "ReverseSelection", FALSE);

	ReadColorSettings();

	//
	// If we can't load any game configurations, pop up the options screen.
	//
	char szIniPath[MAX_PATH];
	APP()->GetDirectory(DIR_PROGRAM, szIniPath);
	strcat(szIniPath, "GameCfg.ini");
	if (configs.LoadGameConfigs(szIniPath) == 0)
	{
		COptionProperties dlg("Configure Worldcraft");
		dlg.DoModal();
	}

	//
	// By default use the first config.
	//
	if (configs.nConfigs > 0)
	{
		g_pGameConfig = configs.Configs.GetAt(0);
	}

	return(TRUE);
}