more work on the Linux stuff, though nothing's working yet

This commit is contained in:
AJ Kelly
2011-08-22 17:23:09 -05:00
parent e2ab3d6493
commit c7ac0b4466
5 changed files with 52 additions and 5 deletions
+2 -4
View File
@@ -270,9 +270,7 @@ void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
FILEMAN->Mount( "dir", "/proc", "/proc" );
#endif
/*
* Next: path to write general mutable user data.
*
/* Next: path to write general mutable user data.
* Lowercase the PRODUCT_ID; dotfiles and directories are almost always lowercase.
*/
const char *szHome = getenv( "HOME" );
@@ -294,7 +292,7 @@ void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
Root = RageFileManagerUtil::sInitialWorkingDirectory;
else
RageException::Throw( "%s", COULDNT_FIND_SONGS.GetValue().c_str() );
FILEMAN->Mount( "dir", Root, "/" );
}
@@ -11,6 +11,7 @@ static void *Handle = NULL;
static INIT Module_Init;
static SHUTDOWN Module_Shutdown;
static SETTEXT Module_SetText;
static SETICON Module_SetIcon;
static SETSPLASH Module_SetSplash;
static SETPROGRESS Module_SetProgress;
static SETINDETERMINATE Module_SetIndeterminate;
@@ -44,6 +45,10 @@ RString LoadingWindow_Gtk::Init()
if( !Module_SetText )
return ModuleError("SetText");
Module_SetIcon = (SETICON) dlsym(Handle, "SetIcon");
if( !Module_SetIcon )
return ModuleError("SetIcon");
Module_SetSplash = (SETSPLASH) dlsym(Handle, "SetSplash");
if( !Module_SetSplash )
return ModuleError("SetSplash");
@@ -78,6 +83,11 @@ void LoadingWindow_Gtk::SetText( RString s )
Module_SetText( s );
}
void LoadingWindow_Gtk::SetIcon( const RageSurface *pIcon )
{
Module_SetIcon( pIcon );
}
void LoadingWindow_Gtk::SetSplash( const RString str )
{
Module_SetSplash( str );
+1 -1
View File
@@ -12,7 +12,7 @@ public:
RString Init();
~LoadingWindow_Gtk();
void SetText( RString str );
//void SetIcon( const RageSurface *pIcon );
void SetIcon( const RageSurface *pIcon );
void SetSplash( const RString str );
void SetProgress( const int progress );
void SetTotalWork( const int totalWork );
@@ -1,5 +1,9 @@
#include "global.h"
#include "LoadingWindow_GtkModule.h"
#include "RageUtil.h"
#include "RageSurface.h"
#include "RageSurfaceUtils.h"
#include "RageSurface_Load.h"
#include <gtk/gtk.h>
@@ -20,12 +24,17 @@ extern "C" const char *Init( int *argc, char ***argv )
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_CENTER );
gtk_window_set_default_size( GTK_WINDOW(window), 512,96 );
//gtk_window_set_icon( GTK_WINDOW(window), );
gtk_widget_realize(window);
splash = gtk_image_new_from_file(splash_image_path);
label = gtk_label_new(NULL);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER);
progressBar = gtk_progress_bar_new();
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), 0.0 );
vbox = gtk_vbox_new(FALSE,5);
gtk_container_add(GTK_CONTAINER(window),vbox);
gtk_box_pack_start(GTK_BOX(vbox),splash,FALSE,FALSE,0);
@@ -52,6 +61,33 @@ extern "C" void SetText( const char *s )
gtk_main_iteration_do(FALSE);
}
extern "C" void SetIcon( const RageSurface *pSrcImg )
{
RageSurface *pImg;
{
pImg = CreateSurface( pSrcImg->w, pSrcImg->h, 32,
0x00FF0000,
0x0000FF00,
0x000000FF,
0xFF000000 );
RageSurfaceUtils::Blit( pSrcImg, pImg );
}
GdkPixbuf *pIcon;
pIcon = gdk_pixbuf_new_from_data(pImg->pixels,
GDK_COLORSPACE_RGB, true,
32,
pImg->w, pImg->h,
pImg->h * pImg->pitch, // ?
NULL, NULL);
delete pImg;
pImg = NULL;
gtk_window_set_icon( GTK_WINDOW(window), pIcon );
gtk_main_iteration_do(FALSE);
}
extern "C" void SetSplash( const char *s )
{
splash = gtk_image_new_from_file(s);
@@ -1,9 +1,12 @@
#ifndef LOADING_WINDOW_MODULE_GTK
#define LOADING_WINDOW_MODULE_GTK
struct RageSurface;
typedef const char *(*INIT)(int *argc, char ***argv);
typedef void (*SHUTDOWN)();
typedef void (*SETTEXT)( const char *s );
typedef void (*SETICON)( const RageSurface *pSrcImg );
typedef void (*SETSPLASH)( const char *s );
typedef void (*SETPROGRESS)( int progress, int totalWork );
typedef void (*SETINDETERMINATE)( bool indeterminate );